tekivex-ui 3.20.1 → 3.22.0

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/index.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,o=Object.getPrototypeOf,i=Object.prototype.hasOwnProperty;let a=require("react");var l,s;s=null!=(l=a)?e(o(l)):{},a=((e,o,a,l)=>{if(o&&"object"==typeof o||"function"==typeof o)for(var s,d=r(o),c=0,u=d.length;c<u;c++)s=d[c],i.call(e,s)||void 0===s||t(e,s,{get:(e=>o[e]).bind(null,s),enumerable:!(l=n(o,s))||l.enumerable});return e})(t(s,"default",{value:l,enumerable:!0}),l);let d=require("react/jsx-runtime"),c=require("react-dom");function u(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619)>>>0;return t.toString(16).padStart(8,"0")}var p=class{constructor(e=512){this.cache=new Map,this.hits=0,this.misses=0,this.ceiling=Math.min(e,512)}get(e){if(!this.cache.has(e))return void this.misses++;this.hits++;const t=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,t),t}set(e,t){this.cache.has(e)?this.cache.delete(e):this.cache.size>=this.ceiling&&this.cache.delete(this.cache.keys().next().value),this.cache.set(e,t)}has(e){return this.cache.has(e)}invalidate(e){void 0!==e?this.cache.delete(e):this.cache.clear()}get size(){return this.cache.size}get cacheHitRate(){const e=this.hits+this.misses;return 0===e?0:this.hits/e*100}},h=new p(512);function f(e,t){const n=h.get(e);if(void 0!==n)return n;const r=t();return h.set(e,r),r}var m=[],g=!1,x=[],b=0,y=0;function v(e){m.push(e),g||(g=!0,queueMicrotask(()=>{!function(){const e=m.splice(0),t=performance.now();for(const r of e)try{r()}catch{}const n=performance.now()-t;b+=n,y++,x.push({duration:n,timestamp:Date.now()}),x.length>100&&x.shift()}(),g=!1}))}var w={hash:u,memoize:f,batchUpdate:v,invalidate:function(e){void 0!==e?h.invalidate(e):h.invalidate()},get avgRenderTime(){return 0===y?0:b/y},get cacheHitRate(){return h.cacheHitRate},getMetrics:function(e){const t=void 0!==e?x.slice(-e):x.slice();return{avgRenderTime:0===y?0:b/y,cacheHitRate:h.cacheHitRate,renderCount:y,recent:t}}},k=new Map;function $(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}function S(e){const t=function(e){return"tkx-"+u(e)}(e);return k.has(t)||k.set(t,e),t}function C(e,...t){const n=e.reduce((e,n,r)=>e+n+(void 0!==t[r]?String(t[r]):""),"");return{className:S(n.trim()),styles:n.trim()}}function z(e){const t=Object.entries(e).map(([e,t])=>`${$(e)}: ${t};`).join(" ");return{className:S(t),styles:t}}var M={xs:"480px",sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"};function N(e,t){return`@media (min-width: ${M[e]}) { ${t} }`}function D(e,t){return`@keyframes ${e} { ${Object.entries(t).map(([e,t])=>`${e} { ${Object.entries(t).map(([e,t])=>`${$(e)}: ${t};`).join(" ")} }`).join(" ")} }`}function R(e,t){return void 0!==t?`--tkx-${e}: ${t};`:`var(--tkx-${e})`}function P(){return Array.from(k.entries()).map(([e,t])=>`.${e} { ${t} }`).join("\n")}function F(){if("undefined"==typeof document)return;let e=document.getElementById("tkx-styles");e||(e=document.createElement("style"),e.id="tkx-styles",document.head.appendChild(e)),e.textContent=P()}var I={css:C,fromObject:z,responsive:N,keyframes:D,cssVar:R,extractCSS:P,injectStyles:F,resetStyles:function(){k.clear()}};function A(e){const[t,n,r]=function(e){if(!e||"string"!=typeof e)return[0,0,0];const t=e.replace("#",""),n=3===t.length?t.split("").map(e=>e+e).join(""):t,r=parseInt(n.slice(0,2),16),o=parseInt(n.slice(2,4),16),i=parseInt(n.slice(4,6),16);return[isNaN(r)?0:r,isNaN(o)?0:o,isNaN(i)?0:i]}(e).map(e=>{const t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4});return.2126*t+.7152*n+.0722*r}function L(e,t){const n=A(e),r=A(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function T(e,t,n=!1){return L(e,t)>=(n?3:4.5)}function W(e,t,n=!1){return L(e,t)>=(n?4.5:7)}function j(e,t){const n=t??["#ffffff","#000000"];return n.reduce((t,n)=>L(n,e)>L(t,e)?n:t,n[0])}function E(){const e=document.createElement("div"),t=document.createElement("div");for(const n of[e,t])n.setAttribute("aria-atomic","true"),n.style.cssText="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;",document.body.appendChild(n);return e.setAttribute("aria-live","polite"),t.setAttribute("aria-live","assertive"),{announce(n,r="polite"){const o="assertive"===r?t:e;o.textContent="",setTimeout(()=>{o.textContent=n},0)},destroy(){e.remove(),t.remove()}}}var B=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])',"details > summary"].join(", ");function V(e){let t=null,n=null;function r(){return Array.from(e.querySelectorAll(B)).filter(e=>!e.closest("[hidden]")&&!e.closest('[aria-hidden="true"]'))}return{activate(){t=document.activeElement;const o=r();o.length>0&&o[0].focus(),n=e=>{if("Tab"!==e.key)return;const t=r();if(0===t.length)return;const n=t[0],o=t[t.length-1];e.shiftKey?document.activeElement===n&&(e.preventDefault(),o.focus()):document.activeElement===o&&(e.preventDefault(),n.focus())},e.addEventListener("keydown",n)},deactivate(){n&&e.removeEventListener("keydown",n),t instanceof HTMLElement&&t.focus(),t=null,n=null}}}function H(e,t,n,r){let o=t;switch(e.key){case"ArrowLeft":case"ArrowUp":e.preventDefault(),o=0===t?n-1:t-1;break;case"ArrowRight":case"ArrowDown":e.preventDefault(),o=t===n-1?0:t+1;break;case"Home":e.preventDefault(),o=0;break;case"End":e.preventDefault(),o=n-1;break;case"Enter":case" ":return e.preventDefault(),void r(t);default:return}r(o)}function O(){return"undefined"!=typeof window&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function q(){return"undefined"!=typeof window&&window.matchMedia("(forced-colors: active)").matches}var U={contrastRatio:L,meetsAA:T,meetsAAA:W,getAccessibleForeground:j,createAnnouncer:E,createFocusTrap:V,handleTabsKeyboard:H,handleMenuKeyboard:function(e,t,n,r,o){let i=t;switch(e.key){case"ArrowUp":e.preventDefault(),i=0===t?n-1:t-1;break;case"ArrowDown":e.preventDefault(),i=t===n-1?0:t+1;break;case"Home":e.preventDefault(),i=0;break;case"End":e.preventDefault(),i=n-1;break;case"Enter":case" ":return e.preventDefault(),void r(t);case"Escape":return e.preventDefault(),void o?.();default:return}r(i)},prefersReducedMotion:O,prefersHighContrast:q,announce:function(e,t="polite"){if("undefined"==typeof document)return;let n=document.getElementById("tkx-live-region");n||(n=document.createElement("div"),n.id="tkx-live-region",n.setAttribute("aria-live",t),n.setAttribute("aria-atomic","true"),n.style.cssText="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;",document.body.appendChild(n)),n.textContent="",setTimeout(()=>{n&&(n.textContent=e)},0)}},K="undefined"!=typeof window?a.useLayoutEffect:a.useEffect,Y={bg:"#0a0a0f",surface:"#12121a",surfaceAlt:"#1a1a2e",border:"#2a2a3e",text:"#e8e8f4",textMuted:"#8888aa",primary:"#00f5d4",secondary:"#7b2ff7",danger:"#f72585",warning:"#ffbe0b",success:"#06d6a0",info:"#3a86ff"},X={bg:"#f8f6f1",surface:"#ffffff",surfaceAlt:"#f0ede6",border:"#ddd8cc",text:"#1a1815",textMuted:"#6b6560",primary:"#0d7c5f",secondary:"#6930c3",danger:"#c1121f",warning:"#d4a017",success:"#0d7c5f",info:"#1d4ed8"},Z=/^#[0-9a-fA-F]{3,8}$/,G=(0,a.createContext)(Y);function _({theme:e,mode:t,lightTheme:n=X,darkTheme:r=Y,defaultMode:o="light",suppressHydrationWarning:i=!1,children:l}){const s=void 0!==e,d=function(e){const[t,n]=(0,a.useState)(null);return(0,a.useEffect)(()=>{if(!e||"undefined"==typeof window||!window.matchMedia)return;const t=window.matchMedia("(prefers-color-scheme: dark)");n(t.matches);const r=e=>n(e.matches);return t.addEventListener?(t.addEventListener("change",r),()=>t.removeEventListener("change",r)):(t.addListener(r),()=>t.removeListener(r))},[e]),t}(!s&&("auto"===t||void 0===t)),c=function(){const[e,t]=(0,a.useState)(!1);return(0,a.useEffect)(()=>t(!0),[]),e}();let u;u=s?e:"light"===t?n:"dark"===t?r:null===d?"dark"===o?r:n:d?r:n;const p=i&&!c;K(()=>{if(p)return;const e=Object.entries(u).map(([e,t])=>R(e,t)).join(" ");let t=document.getElementById("tkx-theme");if(!t){t=document.createElement("style"),t.id="tkx-theme";const e=document.head.querySelector("style");e?document.head.insertBefore(t,e):document.head.appendChild(t)}t.textContent=`:root { ${e} }`,document.documentElement.setAttribute("data-tkx-scheme",u===r?"dark":u===n?"light":"custom")},[u,r,n,p]);const h=p?{}:Object.fromEntries(Object.entries(u).map(([e,t])=>[`--tkx-${e}`,t]));return(0,a.createElement)(G.Provider,{value:u},(0,a.createElement)("div",{style:{display:"contents",...h}},l))}function J(){return(0,a.useContext)(G)}function Q(e,t,n){n/=100;const r=(t/=100)*Math.min(n,1-n),o=t=>{const o=(t+e/30)%12,i=n-r*Math.max(Math.min(o-3,9-o,1),-1);return Math.round(255*i).toString(16).padStart(2,"0")};return`#${o(0)}${o(8)}${o(4)}`}var ee=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function te(e,t){return e>>>t|e<<32-t}function ne(e){const t=[];for(let a=0;a<e.length;a++){let n=e.charCodeAt(a);n<128?t.push(n):n<2048?t.push(192|n>>6,128|63&n):n<55296||n>=57344?t.push(224|n>>12,128|n>>6&63,128|63&n):(a++,n=65536+((1023&n)<<10|1023&e.charCodeAt(a)),t.push(240|n>>18,128|n>>12&63,128|n>>6&63,128|63&n))}const n=8*t.length;for(t.push(128);t.length%64!=56;)t.push(0);for(let a=0;a<4;a++)t.push(0);t.push(n>>>24&255,n>>>16&255,n>>>8&255,255&n);const r=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),o=new Uint32Array(64);for(let a=0;a<t.length;a+=64){for(let r=0;r<16;r++)o[r]=t[a+4*r]<<24|t[a+4*r+1]<<16|t[a+4*r+2]<<8|t[a+4*r+3];for(let t=16;t<64;t++){const e=te(o[t-15],7)^te(o[t-15],18)^o[t-15]>>>3,n=te(o[t-2],17)^te(o[t-2],19)^o[t-2]>>>10;o[t]=o[t-16]+e+o[t-7]+n|0}let[e,n,i,l,s,d,c,u]=r;for(let t=0;t<64;t++){const r=u+(te(s,6)^te(s,11)^te(s,25))+(s&d^~s&c)+ee[t]+o[t]|0,a=(te(e,2)^te(e,13)^te(e,22))+(e&n^e&i^n&i)|0;u=c,c=d,d=s,s=l+r|0,l=i,i=n,n=e,e=r+a|0}r[0]=r[0]+e|0,r[1]=r[1]+n|0,r[2]=r[2]+i|0,r[3]=r[3]+l|0,r[4]=r[4]+s|0,r[5]=r[5]+d|0,r[6]=r[6]+c|0,r[7]=r[7]+u|0}let i="";for(let a=0;a<8;a++)i+=(r[a]>>>0).toString(16).padStart(8,"0");return i}var re={"<":"&lt;",">":"&gt;","&":"&amp;","'":"&#39;",'"':"&quot;","`":"&#96;"};function oe(e){if(null==e)return"";let t=String(e);return t=t.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/g,""),t.replace(/[<>&'"`]/g,e=>re[e]??e)}function ie(e){const t={};for(const n of Object.keys(e))t[n]=ae(e[n]);return t}function ae(e){return"string"==typeof e?oe(e):Array.isArray(e)?e.map(ae):null===e||"object"!=typeof e||function(e){return"object"==typeof e&&null!==e&&"$$typeof"in e}(e)?e:ie(e)}function le(e,t){const n=[];for(const[r,o]of Object.entries(t)){const t=e[r],i=null==t;o.required&&i?n.push(`prop '${r}' is required`):i||(typeof t===o.type?("number"===o.type&&"number"==typeof t&&(void 0!==o.min&&t<o.min&&n.push(`prop '${r}' must be >= ${o.min}`),void 0!==o.max&&t>o.max&&n.push(`prop '${r}' must be <= ${o.max}`)),"string"===o.type&&"string"==typeof t&&o.pattern&&!o.pattern.test(t)&&n.push(`prop '${r}' does not match pattern ${o.pattern}`),o.enum&&!o.enum.includes(t)&&n.push(`prop '${r}' must be one of: ${o.enum.join(", ")}`)):n.push(`prop '${r}' must be of type ${o.type}, got ${typeof t}`))}return{valid:0===n.length,errors:n}}var se=new Map,de=[];function ce(e,t,n){const r=ne(JSON.stringify(n??{})),o=ne((de.length>0?de[de.length-1].chainHash:"0000000000000000000000000000000000000000000000000000000000000000")+r+t+e),i=Object.freeze({timestamp:Date.now(),component:t,action:e,propsHash:r,chainHash:o});return de=Object.freeze([...de,i]),i}function ue(e){let t=de;return e?.component&&(t=t.filter(t=>t.component===e.component)),e?.action&&(t=t.filter(t=>t.action===e.action)),e?.limit&&(t=t.slice(-e.limit)),t}function pe(){let e="0000000000000000000000000000000000000000000000000000000000000000";for(const t of de){if(ne(e+t.propsHash+t.component+t.action)!==t.chainHash)return!1;e=t.chainHash}return!0}function he(e){if("string"!=typeof e)return null;const t=e.trim();if(!t)return null;const n=t.replace(/[\u0000-\u001F\u007F]/g,"");return/^javascript:/i.test(n)||/^vbscript:/i.test(n)||/^data:/i.test(n)&&!/^data:image\//i.test(n)||/^file:/i.test(n)?null:n}var fe=new Set(["a","abbr","b","blockquote","br","code","del","div","em","h1","h2","h3","h4","h5","h6","hr","i","img","ins","kbd","li","mark","ol","p","pre","q","s","samp","small","span","strong","sub","sup","table","tbody","td","tfoot","th","thead","tr","u","ul"]),me={a:new Set(["href","title","target","rel"]),img:new Set(["src","alt","title","width","height","loading","decoding"]),th:new Set(["scope","colspan","rowspan","align"]),td:new Set(["colspan","rowspan","align"]),"*":new Set(["id","class","lang","dir","title"])},ge=new Set(["constructor","prototype","__proto__","submit","reset","action","method","enctype","target","elements","children","firstChild","nextSibling","parentNode","ownerDocument","cookie","domain","location","documentElement","body","head","title","contentWindow","contentDocument"]);function xe(e){if("string"!=typeof e)return"";if("undefined"==typeof DOMParser)return oe(e);const t=(new DOMParser).parseFromString(`<div>${e}</div>`,"text/html").body.firstElementChild;return t?(be(t),t.innerHTML):""}function be(e){const t=Array.from(e.children);for(const n of t){const e=n.tagName.toLowerCase();if(fe.has(e)){for(const t of Array.from(n.attributes)){const r=t.name.toLowerCase();if(r.startsWith("on"))n.removeAttribute(t.name);else if(ge.has(r))n.removeAttribute(t.name);else if("style"!==r)if((me[e]??new Set).has(r)||me["*"].has(r)){if(("href"===r||"src"===r)&&"string"==typeof t.value){const e=he(t.value);null===e?n.removeAttribute(t.name):n.setAttribute(t.name,e)}"name"!==r&&"id"!==r||!ge.has(t.value.toLowerCase())||n.removeAttribute(t.name)}else n.removeAttribute(t.name);else n.setAttribute("style",ye(t.value))}be(n)}else n.remove()}}function ye(e){if("string"!=typeof e)return"";let t=e;return t=t.replace(/expression\s*\([^)]*\)/gi,""),t=t.replace(/url\s*\(\s*['"]?\s*(javascript|vbscript|data)\s*:[^)]*\)/gi,"url(#)"),t=t.replace(/@import[^;]*;?/gi,""),t=t.replace(/behavior\s*:[^;]*;?/gi,""),t=t.replace(/-moz-binding[^;]*;?/gi,""),t=t.replace(/[<>]/g,""),t=t.replace(/[\u0000-\u001F\u007F]/g,""),t.trim()}var ve=new Set(["__proto__","constructor","prototype"]);function we(e){try{return ke(JSON.parse(e,(e,t)=>{if(!ve.has(e))return t}))}catch{return null}}function ke(e){if(Array.isArray(e))return e.map(ke);if(e&&"object"==typeof e){const t={};for(const[n,r]of Object.entries(e))ve.has(n)||(t[n]=ke(r));return t}return e}function $e(e){return!("string"!=typeof e||!e||/[\u0000-\u001F\u007F<>"]/.test(e)||ge.has(e.toLowerCase()))}function Se(e){return"string"!=typeof e?"":e.replace(/[\u200B-\u200F\u202A-\u202E\u2060-\u206F\uFEFF\u00AD]/g,"")}function Ce(e={}){const{allowInlineStyles:t=!0,imgHosts:n=[],connectHosts:r=[],fontHosts:o=[],scriptNonce:i,reportUri:a}=e,l=["default-src 'self'","script-src "+(i?`'self' 'nonce-${i}'`:"'self'"),"style-src "+(t?"'self' 'unsafe-inline'":"'self'"),`img-src ${["'self'","data:","https:",...n].join(" ")}`,`font-src ${["'self'","https:","data:",...o].join(" ")}`,`connect-src ${["'self'",...r].join(" ")}`,"frame-ancestors 'none'","form-action 'self'","base-uri 'self'","object-src 'none'","upgrade-insecure-requests"];return a&&l.push(`report-uri ${a}`),l.join("; ")}function ze(){if("undefined"==typeof window)return;const e=window.trustedTypes;if(e)try{e.createPolicy("tkx",{createHTML:xe,createScriptURL:e=>he(e)??"",createScript:()=>{throw new Error("TekiVex: inline script creation forbidden")}})}catch{}}function Me(){if("undefined"==typeof window)return!1;try{return window.top!==window.self}catch{return!0}}function Ne(e){if("undefined"!=typeof window&&Me())if(e)e();else try{window.top.location.href=window.self.location.href}catch{}}function De(e,t){let n=e,r=Date.now();return{check(){const o=Date.now(),i=o-r,a=Math.floor(i/t);return a>0&&(n=Math.min(e,n+a),r=o),!(n<=0||(n-=1,0))},reset(){n=e,r=Date.now()}}}async function Re(e){const t=new Uint8Array(await e.slice(0,12).arrayBuffer()),n=(...e)=>e.every((e,n)=>t[n]===e);return n(137,80,78,71)?"image/png":n(255,216,255)?"image/jpeg":n(71,73,70,56)?"image/gif":n(66,77)?"image/bmp":n(82,73,70,70)&&87===t[8]&&69===t[9]&&66===t[10]&&80===t[11]?"image/webp":n(37,80,68,70)?"application/pdf":n(80,75,3,4)?"application/zip":123===t[0]||91===t[0]?"application/json":[...t].includes(0)?null:"text/plain"}var Pe=[{name:"ssn",re:/\b\d{3}-\d{2}-\d{4}\b/g,repl:"[redacted-ssn]"},{name:"credit",re:/\b(?:\d[ -]?){13,19}\b/g,repl:e=>{const t=e.replace(/[ -]/g,"");return t.length<13||t.length>19?e:function(e){let t=0,n=!1;for(let r=e.length-1;r>=0;r--){let o=e.charCodeAt(r)-48;if(o<0||o>9)return!1;n&&(o*=2,o>9&&(o-=9)),t+=o,n=!n}return t>0&&t%10==0}(t)?"[redacted-card]":e}},{name:"email",re:/\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b/gi,repl:"[redacted-email]"},{name:"phone",re:/\b(\+?\d{1,3}[ -])?\(?\d{3}\)?[ -]?\d{3}[ -]?\d{4}\b/g,repl:"[redacted-phone]"},{name:"apikey",re:/\b(sk|pk|rk)-[A-Za-z0-9]{20,}\b/g,repl:"[redacted-key]"}];function Fe(e){if("string"!=typeof e)return"";let t=e;for(const{re:n,repl:r}of Pe)t=t.replace(n,r);return t}function Ie(e){if(e&&"object"==typeof e&&!Object.isFrozen(e)){for(const t of Object.keys(e))Ie(e[t]);Object.freeze(e)}return e}var Ae=Object.freeze({sanitizeString:oe,sanitizeHref:he,sanitizeHTML:xe,sanitizeCSS:ye,sanitizeJSON:we,sanitizeUnicode:Se,isSafeAttrName:$e,buildTkxCSP:Ce,installTrustedTypes:ze,isFramed:Me,installFrameBuster:Ne,createRateLimiter:De,sniffMimeType:Re,scrubPII:Fe,deepFreeze:Ie,__brand:"TekiVex SecurityCore v2.6.0 © 007krcs"}),Le={sanitize:oe,sanitizeProps:ie,validateProps:le,createCSP:function(e,t){const n={componentId:e,permissions:t,directives:{"default-src":["'self'"],"style-src":t.allowInlineStyles?["'self'","'unsafe-inline'"]:["'self'"],"img-src":t.allowDataUrls?["'self'","data:"]:t.allowExternalSrc?["'self'","*"]:["'self'"],"script-src":t.allowScripts?["'self'"]:["'none'"]}};return se.set(e,n),n},hasPermission:function(e,t){return!0===se.get(e)?.permissions[t]},audit:ce,getAuditLog:ue,verifyAuditIntegrity:pe};function Te(){const[e,t]=(0,a.useState)(()=>"undefined"!=typeof window&&O());return(0,a.useEffect)(()=>{if("undefined"==typeof window)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)"),n=e=>t(e.matches);return e.addEventListener("change",n),()=>e.removeEventListener("change",n)},[]),e}function We(e){const t=(0,a.useRef)(null);return(0,a.useEffect)(()=>{if(!e||!t.current)return;const n=V(t.current);return n.activate(),()=>n.deactivate()},[e]),t}function je(){const e=(0,a.useRef)(null);return(0,a.useEffect)(()=>{if("undefined"!=typeof document)return e.current=E(),()=>{e.current?.destroy()}},[]),(0,a.useCallback)((t,n="polite")=>{e.current?.announce(t,n)},[])}function Ee(e,t=!0){const n=(0,a.useRef)(e);n.current=e,(0,a.useEffect)(()=>{if(!t||"undefined"==typeof document)return;const e=e=>{"Escape"===e.key&&n.current()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[t])}function Be(e,t){const n=(0,a.useRef)(t);n.current=t,(0,a.useEffect)(()=>{const t=t=>{e.current&&!e.current.contains(t.target)&&n.current()};return document.addEventListener("pointerdown",t),()=>document.removeEventListener("pointerdown",t)},[e])}var Ve={0:"0",px:"1px",.5:"2px",1:"4px",1.5:"6px",2:"8px",2.5:"10px",3:"12px",3.5:"14px",4:"16px",5:"20px",6:"24px",7:"28px",8:"32px",9:"36px",10:"40px",11:"44px",12:"48px",14:"56px",16:"64px",20:"80px",24:"96px",28:"112px",32:"128px",36:"144px",40:"160px",44:"176px",48:"192px",52:"208px",56:"224px",60:"240px",64:"256px",72:"288px",80:"320px",96:"384px",auto:"auto",full:"100%",screen:"100vw",svh:"100svh",dvh:"100dvh",fit:"fit-content",max:"max-content",min:"min-content"},He={...Ve,screen:"100vh"},Oe={"1/2":"50%","1/3":"33.333333%","2/3":"66.666667%","1/4":"25%","2/4":"50%","3/4":"75%","1/5":"20%","2/5":"40%","3/5":"60%","4/5":"80%","1/6":"16.666667%","5/6":"83.333333%","1/12":"8.333333%","5/12":"41.666667%","7/12":"58.333333%","11/12":"91.666667%"},qe={none:"0",sm:"2px","":"4px",md:"6px",lg:"8px",xl:"12px","2xl":"16px","3xl":"24px",full:"9999px"},Ue={sm:"0 1px 2px 0 rgba(0,0,0,.05)","":"0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1)",md:"0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1)",lg:"0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1)",xl:"0 20px 25px -5px rgba(0,0,0,.1),0 8px 10px -6px rgba(0,0,0,.1)","2xl":"0 25px 50px -12px rgba(0,0,0,.25)",inner:"inset 0 2px 4px 0 rgba(0,0,0,.05)",none:"none"},Ke={xs:["0.75rem","1rem"],sm:["0.875rem","1.25rem"],base:["1rem","1.5rem"],lg:["1.125rem","1.75rem"],xl:["1.25rem","1.75rem"],"2xl":["1.5rem","2rem"],"3xl":["1.875rem","2.25rem"],"4xl":["2.25rem","2.5rem"],"5xl":["3rem","1"],"6xl":["3.75rem","1"],"7xl":["4.5rem","1"],"8xl":["6rem","1"],"9xl":["8rem","1"]},Ye={thin:"100",extralight:"200",light:"300",normal:"400",medium:"500",semibold:"600",bold:"700",extrabold:"800",black:"900"},Xe={none:"1",tight:"1.25",snug:"1.375",normal:"1.5",relaxed:"1.625",loose:"2",3:"0.75rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem"},Ze={tighter:"-0.05em",tight:"-0.025em",normal:"0em",wide:"0.025em",wider:"0.05em",widest:"0.1em"},Ge={none:"0",sm:"4px","":"8px",md:"12px",lg:"16px",xl:"24px","2xl":"40px","3xl":"64px"},_e=Object.fromEntries([0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100].map(e=>[String(e),String(e/100)])),Je=new Set(["bg","surface","surfaceAlt","border","text","textMuted","primary","secondary","danger","warning","success","info"]),Qe={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},et=/javascript\s*:|vbscript\s*:|data\s*:\s*text\/html|data\s*:\s*text\/javascript|expression\s*\(|[\r\n\x00]/i,tt=new Set(["behavior","-moz-binding","-webkit-binding","src"]),nt=new Set(["width","min-width","max-width","height","min-height","max-height","margin","margin-top","margin-right","margin-bottom","margin-left","padding","padding-top","padding-right","padding-bottom","padding-left","position","top","right","bottom","left","z-index","inset","flex","flex-grow","flex-shrink","flex-basis","flex-direction","flex-wrap","align-items","align-self","align-content","justify-content","justify-items","justify-self","gap","row-gap","column-gap","grid-template-columns","grid-template-rows","grid-column","grid-row","grid-area","grid-template-areas","font-size","font-weight","font-family","font-style","line-height","letter-spacing","text-align","text-decoration","text-transform","text-overflow","white-space","word-break","word-wrap","overflow-wrap","color","background","background-color","background-image","background-position","background-size","background-repeat","opacity","border","border-top","border-right","border-bottom","border-left","border-width","border-style","border-color","border-radius","outline","outline-offset","box-shadow","text-shadow","filter","backdrop-filter","transform","transition","animation","display","overflow","overflow-x","overflow-y","visibility","pointer-events","cursor","user-select","aspect-ratio","object-fit","object-position","list-style","vertical-align","float","clear","resize","scroll-behavior","content"]);function rt(e){return et.test(e)||e.includes("}")||e.includes("{")||e.includes("<")||e.includes(">")?null:e}function ot(e){const t=e.match(/^\[(.+)]$/);return t?rt(t[1]):null}function it(e){return Je.has(e)?`var(--tkx-${e})`:"transparent"===e?"transparent":"current"===e?"currentColor":"white"===e?"#ffffff":"black"===e?"#000000":"inherit"===e?"inherit":ot(e)||(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(e),e)}function at(e){const t=e.match(/^\[(--[a-zA-Z0-9_-]+):(.+)]$/);if(t){const e=rt(t[2]);return e?{[t[1]]:e}:null}const n=e.match(/^\[([a-zA-Z-]+):(.+)]$/);if(n){const e=function(e){const t=e.toLowerCase().trim();return tt.has(t)?null:nt.has(t)?t:null}(n[1]),t=rt(n[2]);return e&&t?{[e]:t}:null}const r={flex:"flex","inline-flex":"inline-flex",grid:"grid","inline-grid":"inline-grid",block:"block","inline-block":"inline-block",inline:"inline",hidden:"none",contents:"contents","flow-root":"flow-root",table:"table","table-row":"table-row","table-cell":"table-cell","table-caption":"table-caption","list-item":"list-item"};if(r[e])return{display:r[e]};const o={"flex-row":"row","flex-col":"column","flex-row-reverse":"row-reverse","flex-col-reverse":"column-reverse"};if(o[e])return{"flex-direction":o[e]};const i={"flex-wrap":"wrap","flex-nowrap":"nowrap","flex-wrap-reverse":"wrap-reverse"};if(i[e])return{"flex-wrap":i[e]};const a={"flex-1":"1 1 0%","flex-auto":"1 1 auto","flex-none":"none","flex-initial":"0 1 auto"};if(a[e])return{flex:a[e]};if("grow"===e||"flex-grow"===e)return{"flex-grow":"1"};if("grow-0"===e)return{"flex-grow":"0"};if("shrink"===e||"flex-shrink"===e)return{"flex-shrink":"1"};if("shrink-0"===e||"flex-shrink-0"===e)return{"flex-shrink":"0"};const l={"items-start":"flex-start","items-end":"flex-end","items-center":"center","items-stretch":"stretch","items-baseline":"baseline"};if(l[e])return{"align-items":l[e]};const s={"justify-start":"flex-start","justify-end":"flex-end","justify-center":"center","justify-between":"space-between","justify-around":"space-around","justify-evenly":"space-evenly","justify-stretch":"stretch","justify-normal":"normal"};if(s[e])return{"justify-content":s[e]};const d={"self-auto":"auto","self-start":"flex-start","self-end":"flex-end","self-center":"center","self-stretch":"stretch","self-baseline":"baseline"};if(d[e])return{"align-self":d[e]};const c={"content-start":"flex-start","content-end":"flex-end","content-center":"center","content-between":"space-between","content-around":"space-around","content-evenly":"space-evenly","content-stretch":"stretch"};if(c[e])return{"align-content":c[e]};let u;if(u=e.match(/^grid-cols-(\d+|none|subgrid)$/))return{"grid-template-columns":"none"===u[1]?"none":"subgrid"===u[1]?"subgrid":`repeat(${u[1]},minmax(0,1fr))`};if(u=e.match(/^grid-rows-(\d+|none|subgrid)$/))return{"grid-template-rows":"none"===u[1]?"none":"subgrid"===u[1]?"subgrid":`repeat(${u[1]},minmax(0,1fr))`};if(u=e.match(/^col-span-(full|\d+)$/))return{"grid-column":"full"===u[1]?"1 / -1":`span ${u[1]} / span ${u[1]}`};if(u=e.match(/^col-start-(\d+|auto)$/))return{"grid-column-start":u[1]};if(u=e.match(/^col-end-(\d+|auto)$/))return{"grid-column-end":u[1]};if(u=e.match(/^row-span-(full|\d+)$/))return{"grid-row":"full"===u[1]?"1 / -1":`span ${u[1]} / span ${u[1]}`};if(u=e.match(/^row-start-(\d+|auto)$/))return{"grid-row-start":u[1]};if(u=e.match(/^row-end-(\d+|auto)$/))return{"grid-row-end":u[1]};if("grid-flow-row"===e)return{"grid-auto-flow":"row"};if("grid-flow-col"===e)return{"grid-auto-flow":"column"};if("grid-flow-dense"===e)return{"grid-auto-flow":"dense"};if("grid-flow-row-dense"===e)return{"grid-auto-flow":"row dense"};if("grid-flow-col-dense"===e)return{"grid-auto-flow":"column dense"};if(u=e.match(/^p-(.+)$/)){const e=Ve[u[1]]??ot(u[1]);if(e)return{padding:e}}if(u=e.match(/^px-(.+)$/)){const e=Ve[u[1]]??ot(u[1]);if(e)return{"padding-left":e,"padding-right":e}}if(u=e.match(/^py-(.+)$/)){const e=Ve[u[1]]??ot(u[1]);if(e)return{"padding-top":e,"padding-bottom":e}}if(u=e.match(/^pt-(.+)$/)){const e=Ve[u[1]]??ot(u[1]);if(e)return{"padding-top":e}}if(u=e.match(/^pr-(.+)$/)){const e=Ve[u[1]]??ot(u[1]);if(e)return{"padding-right":e}}if(u=e.match(/^pb-(.+)$/)){const e=Ve[u[1]]??ot(u[1]);if(e)return{"padding-bottom":e}}if(u=e.match(/^pl-(.+)$/)){const e=Ve[u[1]]??ot(u[1]);if(e)return{"padding-left":e}}if(u=e.match(/^-?m-(.+)$/)){const t=e.startsWith("-"),n=Ve[u[1]]??ot(u[1]);if(n)return{margin:t&&"0"!==n?`-${n}`:n}}if(u=e.match(/^-?mx-(.+)$/)){const t=e.startsWith("-"),n=Ve[u[1]]??ot(u[1]);if(n){const e=t&&"0"!==n?`-${n}`:n;return{"margin-left":e,"margin-right":e}}}if(u=e.match(/^-?my-(.+)$/)){const t=e.startsWith("-"),n=Ve[u[1]]??ot(u[1]);if(n){const e=t&&"0"!==n?`-${n}`:n;return{"margin-top":e,"margin-bottom":e}}}if(u=e.match(/^-?mt-(.+)$/)){const t=e.startsWith("-"),n=Ve[u[1]]??ot(u[1]);if(n)return{"margin-top":t&&"0"!==n?`-${n}`:n}}if(u=e.match(/^-?mr-(.+)$/)){const t=e.startsWith("-"),n=Ve[u[1]]??ot(u[1]);if(n)return{"margin-right":t&&"0"!==n?`-${n}`:n}}if(u=e.match(/^-?mb-(.+)$/)){const t=e.startsWith("-"),n=Ve[u[1]]??ot(u[1]);if(n)return{"margin-bottom":t&&"0"!==n?`-${n}`:n}}if(u=e.match(/^-?ml-(.+)$/)){const t=e.startsWith("-"),n=Ve[u[1]]??ot(u[1]);if(n)return{"margin-left":t&&"0"!==n?`-${n}`:n}}if("mx-auto"===e)return{"margin-left":"auto","margin-right":"auto"};if("my-auto"===e)return{"margin-top":"auto","margin-bottom":"auto"};if(u=e.match(/^gap-(.+)$/)){const e=Ve[u[1]]??ot(u[1]);if(e)return{gap:e}}if(u=e.match(/^gap-x-(.+)$/)){const e=Ve[u[1]]??ot(u[1]);if(e)return{"column-gap":e}}if(u=e.match(/^gap-y-(.+)$/)){const e=Ve[u[1]]??ot(u[1]);if(e)return{"row-gap":e}}if(u=e.match(/^w-(.+)$/)){const e=u[1],t=Ve[e]??Oe[e]??ot(e);if(t)return{width:t}}if(u=e.match(/^min-w-(.+)$/)){const e=Ve[u[1]]??ot(u[1]);if(e)return{"min-width":e}}if(u=e.match(/^max-w-(.+)$/)){const e={none:"none",xs:"20rem",sm:"24rem",md:"28rem",lg:"32rem",xl:"36rem","2xl":"42rem","3xl":"48rem","4xl":"56rem","5xl":"64rem","6xl":"72rem","7xl":"80rem",full:"100%",screen:"100vw",min:"min-content",max:"max-content",fit:"fit-content"}[u[1]]??Ve[u[1]]??ot(u[1]);if(e)return{"max-width":e}}if(u=e.match(/^h-(.+)$/)){const e=u[1],t=He[e]??Oe[e]??ot(e);if(t)return{height:t}}if(u=e.match(/^min-h-(.+)$/)){const e={0:"0",full:"100%",screen:"100vh",svh:"100svh",dvh:"100dvh"}[u[1]]??Ve[u[1]]??ot(u[1]);if(e)return{"min-height":e}}if(u=e.match(/^max-h-(.+)$/)){const e=He[u[1]]??ot(u[1]);if(e)return{"max-height":e}}if(u=e.match(/^size-(.+)$/)){const e=Ve[u[1]]??Oe[u[1]]??ot(u[1]);if(e)return{width:e,height:e}}if(u=e.match(/^text-(xs|sm|base|lg|[2-9]xl|\d+xl)$/)){const[e,t]=Ke[u[1]]??["1rem","1.5rem"];return{"font-size":e,"line-height":t}}if(u=e.match(/^font-(thin|extralight|light|normal|medium|semibold|bold|extrabold|black|\d+)$/))return{"font-weight":Ye[u[1]]??u[1]};if(u=e.match(/^leading-(.+)$/)){const e=Xe[u[1]]??ot(u[1]);if(e)return{"line-height":e}}if(u=e.match(/^tracking-(.+)$/)){const e=Ze[u[1]]??ot(u[1]);if(e)return{"letter-spacing":e}}const p={"text-left":"left","text-center":"center","text-right":"right","text-justify":"justify","text-start":"start","text-end":"end"};if(p[e])return{"text-align":p[e]};if("italic"===e)return{"font-style":"italic"};if("not-italic"===e)return{"font-style":"normal"};if("uppercase"===e)return{"text-transform":"uppercase"};if("lowercase"===e)return{"text-transform":"lowercase"};if("capitalize"===e)return{"text-transform":"capitalize"};if("normal-case"===e)return{"text-transform":"none"};if("underline"===e)return{"text-decoration-line":"underline"};if("overline"===e)return{"text-decoration-line":"overline"};if("line-through"===e)return{"text-decoration-line":"line-through"};if("no-underline"===e)return{"text-decoration-line":"none"};if("truncate"===e)return{overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap"};if("text-ellipsis"===e)return{"text-overflow":"ellipsis"};if("text-clip"===e)return{"text-overflow":"clip"};if("whitespace-normal"===e)return{"white-space":"normal"};if("whitespace-nowrap"===e)return{"white-space":"nowrap"};if("whitespace-pre"===e)return{"white-space":"pre"};if("whitespace-pre-wrap"===e)return{"white-space":"pre-wrap"};if("whitespace-pre-line"===e)return{"white-space":"pre-line"};if("break-words"===e)return{"overflow-wrap":"break-word"};if("break-all"===e)return{"word-break":"break-all"};if("break-keep"===e)return{"word-break":"keep-all"};if("font-mono"===e)return{"font-family":"var(--tkx-font-mono,monospace)"};if("font-sans"===e)return{"font-family":"var(--tkx-font-family,system-ui,sans-serif)"};if("font-serif"===e)return{"font-family":"ui-serif,Georgia,serif"};if("antialiased"===e)return{"-webkit-font-smoothing":"antialiased","-moz-osx-font-smoothing":"grayscale"};if(u=e.match(/^indent-(.+)$/)){const e=Ve[u[1]]??ot(u[1]);if(e)return{"text-indent":e}}if(u=e.match(/^line-clamp-(\d+)$/))return{overflow:"hidden",display:"-webkit-box","-webkit-line-clamp":u[1],"-webkit-box-orient":"vertical"};if(u=e.match(/^text-(.+)$/)){const[e,t]=u[1].split("/"),n=it(e);if(!["left","center","right","justify","start","end","xs","sm","base","lg","xl","2xl","3xl","4xl","5xl","6xl","7xl","8xl","9xl"].includes(e)){if(t){const e=parseInt(t)/100;return{color:n,opacity:String(e)}}return{color:n}}}if(u=e.match(/^bg-(.+)$/)){const[e,t]=u[1].split("/"),n=it(e);return t?{"background-color":n,opacity:String(parseInt(t)/100)}:"none"===e?{background:"none"}:{"background-color":n}}if(u=e.match(/^border-color-(.+)$/))return{"border-color":it(u[1])};if(u=e.match(/^fill-(.+)$/))return{fill:it(u[1])};if(u=e.match(/^stroke-(.+)$/))return{stroke:it(u[1])};if(u=e.match(/^shadow-color-(.+)$/))return{"--tkx-shadow-color":it(u[1])};if(u=e.match(/^ring-color-(.+)$/))return{"--tkx-ring-color":it(u[1])};if(u=e.match(/^accent-(.+)$/))return{"accent-color":it(u[1])};if(u=e.match(/^caret-(.+)$/))return{"caret-color":it(u[1])};if(u=e.match(/^outline-color-(.+)$/))return{"outline-color":it(u[1])};if("border"===e)return{"border-width":"1px"};if(u=e.match(/^border-(\d+)$/))return{"border-width":`${u[1]}px`};if("border-t"===e)return{"border-top-width":"1px"};if(u=e.match(/^border-t-(\d+)$/))return{"border-top-width":`${u[1]}px`};if("border-r"===e)return{"border-right-width":"1px"};if(u=e.match(/^border-r-(\d+)$/))return{"border-right-width":`${u[1]}px`};if("border-b"===e)return{"border-bottom-width":"1px"};if(u=e.match(/^border-b-(\d+)$/))return{"border-bottom-width":`${u[1]}px`};if("border-l"===e)return{"border-left-width":"1px"};if(u=e.match(/^border-l-(\d+)$/))return{"border-left-width":`${u[1]}px`};if("border-x"===e)return{"border-left-width":"1px","border-right-width":"1px"};if("border-y"===e)return{"border-top-width":"1px","border-bottom-width":"1px"};if("border-none"===e)return{"border-style":"none"};if("border-solid"===e)return{"border-style":"solid"};if("border-dashed"===e)return{"border-style":"dashed"};if("border-dotted"===e)return{"border-style":"dotted"};if("border-double"===e)return{"border-style":"double"};if((u=e.match(/^border-([a-zA-Z].*)$/))&&Je.has(u[1]))return{"border-color":`var(--tkx-${u[1]})`};if(u=e.match(/^border-\[(.+)]$/))return{"border-color":u[1]};if("border-0"===e)return{"border-width":"0"};if("rounded"===e)return{"border-radius":qe[""]};if(u=e.match(/^rounded-(none|sm|md|lg|xl|2xl|3xl|full|\[.+])$/))return{"border-radius":qe[u[1]]??ot(u[1])??u[1]};if(u=e.match(/^rounded-(t|r|b|l|tl|tr|br|bl)(?:-(none|sm|md|lg|xl|2xl|3xl|full))?$/)){const e=u[1],t=qe[u[2]??""]??qe[""];return{t:{"border-top-left-radius":t,"border-top-right-radius":t},r:{"border-top-right-radius":t,"border-bottom-right-radius":t},b:{"border-bottom-left-radius":t,"border-bottom-right-radius":t},l:{"border-top-left-radius":t,"border-bottom-left-radius":t},tl:{"border-top-left-radius":t},tr:{"border-top-right-radius":t},br:{"border-bottom-right-radius":t},bl:{"border-bottom-left-radius":t}}[e]??{}}const h={0:"0",1:"1px",2:"2px",ring:"3px",4:"4px",8:"8px"};if("ring"===e)return{"box-shadow":"0 0 0 3px var(--tkx-ring-color,var(--tkx-primary))"};if((u=e.match(/^ring-(\d+)$/))&&h[u[1]])return{"box-shadow":`0 0 0 ${h[u[1]]} var(--tkx-ring-color,var(--tkx-primary))`};if("ring-inset"===e)return{"--tkx-ring-offset":"inset"};if(u=e.match(/^ring-offset-(\d+)$/))return{"--tkx-ring-offset-width":`${u[1]}px`,"box-shadow":`0 0 0 ${u[1]}px var(--tkx-bg)`};if("shadow"===e)return{"box-shadow":Ue[""]};if(u=e.match(/^shadow-(sm|md|lg|xl|2xl|inner|none)$/))return{"box-shadow":Ue[u[1]]};if(u=e.match(/^opacity-(\d+)$/)){const e=_e[u[1]];if(void 0!==e)return{opacity:e}}if("bg-none"===e)return{background:"none"};const f={"bg-auto":"auto","bg-cover":"cover","bg-contain":"contain"};if(f[e])return{"background-size":f[e]};const m={"bg-center":"center","bg-top":"top","bg-bottom":"bottom","bg-left":"left","bg-right":"right"};if(m[e])return{"background-position":m[e]};const g={"bg-repeat":"repeat","bg-no-repeat":"no-repeat","bg-repeat-x":"repeat-x","bg-repeat-y":"repeat-y"};if(g[e])return{"background-repeat":g[e]};if("backdrop-blur"===e)return{"backdrop-filter":`blur(${Ge[""]})`};if(u=e.match(/^backdrop-blur-(none|sm|md|lg|xl|2xl|3xl)$/))return{"backdrop-filter":`blur(${Ge[u[1]]})`};if("blur"===e)return{filter:`blur(${Ge[""]})`};if(u=e.match(/^blur-(none|sm|md|lg|xl|2xl|3xl)$/))return{filter:`blur(${Ge[u[1]]})`};if("grayscale"===e)return{filter:"grayscale(100%)"};if("grayscale-0"===e)return{filter:"grayscale(0)"};if("invert"===e)return{filter:"invert(100%)"};if("invert-0"===e)return{filter:"invert(0)"};const x={static:"static",relative:"relative",absolute:"absolute",fixed:"fixed",sticky:"sticky"};if(x[e])return{position:x[e]};if("inset-0"===e)return{top:"0",right:"0",bottom:"0",left:"0"};if("inset-auto"===e)return{top:"auto",right:"auto",bottom:"auto",left:"auto"};if("inset-full"===e)return{top:"100%",right:"100%",bottom:"100%",left:"100%"};if("inset-x-0"===e)return{left:"0",right:"0"};if("inset-y-0"===e)return{top:"0",bottom:"0"};if(u=e.match(/^-?top-(.+)$/)){const t=e.startsWith("-"),n=Ve[u[1]]??Oe[u[1]]??ot(u[1]);if(n)return{top:t&&"0"!==n?`-${n}`:n}}if(u=e.match(/^-?right-(.+)$/)){const t=e.startsWith("-"),n=Ve[u[1]]??Oe[u[1]]??ot(u[1]);if(n)return{right:t&&"0"!==n?`-${n}`:n}}if(u=e.match(/^-?bottom-(.+)$/)){const t=e.startsWith("-"),n=Ve[u[1]]??Oe[u[1]]??ot(u[1]);if(n)return{bottom:t&&"0"!==n?`-${n}`:n}}if(u=e.match(/^-?left-(.+)$/)){const t=e.startsWith("-"),n=Ve[u[1]]??Oe[u[1]]??ot(u[1]);if(n)return{left:t&&"0"!==n?`-${n}`:n}}const b={0:"0",10:"10",20:"20",30:"30",40:"40",50:"50",100:"100",1e3:"1000",9e3:"9000",auto:"auto"};if(u=e.match(/^z-(.+)$/)){const e=b[u[1]]??ot(u[1]);if(e)return{"z-index":e}}const y={"overflow-auto":"auto","overflow-hidden":"hidden","overflow-visible":"visible","overflow-scroll":"scroll","overflow-clip":"clip"};if(y[e])return{overflow:y[e]};if(u=e.match(/^overflow-(x|y)-(auto|hidden|visible|scroll|clip)$/))return{[`overflow-${u[1]}`]:u[2]};if("scrollbar-hide"===e)return{"-ms-overflow-style":"none","scrollbar-width":"none"};if("visible"===e)return{visibility:"visible"};if("invisible"===e)return{visibility:"hidden"};if("collapse"===e)return{visibility:"collapse"};const v={"cursor-auto":"auto","cursor-default":"default","cursor-pointer":"pointer","cursor-wait":"wait","cursor-text":"text","cursor-move":"move","cursor-help":"help","cursor-not-allowed":"not-allowed","cursor-none":"none","cursor-grab":"grab","cursor-grabbing":"grabbing","cursor-zoom-in":"zoom-in","cursor-zoom-out":"zoom-out","cursor-crosshair":"crosshair"};if(v[e])return{cursor:v[e]};if("select-none"===e)return{"user-select":"none"};if("select-text"===e)return{"user-select":"text"};if("select-all"===e)return{"user-select":"all"};if("select-auto"===e)return{"user-select":"auto"};if("pointer-events-none"===e)return{"pointer-events":"none"};if("pointer-events-auto"===e)return{"pointer-events":"auto"};const w={0:"0",50:".5",75:".75",90:".9",95:".95",100:"1",105:"1.05",110:"1.1",125:"1.25",150:"1.5"};if(u=e.match(/^scale-(.+)$/)){const e=w[u[1]]??ot(u[1]);if(e)return{transform:`scale(${e})`}}if(u=e.match(/^scale-x-(.+)$/)){const e=w[u[1]]??ot(u[1]);if(e)return{transform:`scaleX(${e})`}}if(u=e.match(/^scale-y-(.+)$/)){const e=w[u[1]]??ot(u[1]);if(e)return{transform:`scaleY(${e})`}}const k={0:"0deg",1:"1deg",2:"2deg",3:"3deg",6:"6deg",12:"12deg",45:"45deg",90:"90deg",180:"180deg"};if(u=e.match(/^-?rotate-(.+)$/)){const t=e.startsWith("-"),n=k[u[1]]??ot(u[1]);if(n)return{transform:t?`rotate(-${n})`:`rotate(${n})`}}if(u=e.match(/^-?translate-x-(.+)$/)){const t=e.startsWith("-"),n=Ve[u[1]]??Oe[u[1]]??ot(u[1]);if(n)return{transform:`translateX(${t&&"0"!==n?`-${n}`:n})`}}if(u=e.match(/^-?translate-y-(.+)$/)){const t=e.startsWith("-"),n=Ve[u[1]]??Oe[u[1]]??ot(u[1]);if(n)return{transform:`translateY(${t&&"0"!==n?`-${n}`:n})`}}if(u=e.match(/^-?skew-x-(.+)$/)){const t=e.startsWith("-"),n=ot(u[1])??`${u[1]}deg`;return{transform:t?`skewX(-${n})`:`skewX(${n})`}}if(u=e.match(/^-?skew-y-(.+)$/)){const t=e.startsWith("-"),n=ot(u[1])??`${u[1]}deg`;return{transform:t?`skewY(-${n})`:`skewY(${n})`}}const $={"origin-center":"center","origin-top":"top","origin-top-right":"top right","origin-right":"right","origin-bottom-right":"bottom right","origin-bottom":"bottom","origin-bottom-left":"bottom left","origin-left":"left","origin-top-left":"top left"};if($[e])return{"transform-origin":$[e]};const S={transition:"color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter","transition-all":"all","transition-colors":"color,background-color,border-color,text-decoration-color,fill,stroke","transition-opacity":"opacity","transition-shadow":"box-shadow","transition-transform":"transform","transition-none":"none"};if(S[e])return{"transition-property":S[e],"transition-timing-function":"cubic-bezier(0.4,0,0.2,1)","transition-duration":"150ms"};const C={75:"75ms",100:"100ms",150:"150ms",200:"200ms",300:"300ms",500:"500ms",700:"700ms",1e3:"1000ms"};if(u=e.match(/^duration-(.+)$/)){const e=C[u[1]]??ot(u[1]);if(e)return{"transition-duration":e}}if(u=e.match(/^delay-(.+)$/)){const e=C[u[1]]??ot(u[1]);if(e)return{"transition-delay":e}}const z={"ease-linear":"linear","ease-in":"cubic-bezier(0.4,0,1,1)","ease-out":"cubic-bezier(0,0,0.2,1)","ease-in-out":"cubic-bezier(0.4,0,0.2,1)"};if(z[e])return{"transition-timing-function":z[e]};const M={"animate-none":"none","animate-spin":"tkx-spin 1s linear infinite","animate-ping":"tkx-ping 1s cubic-bezier(0,0,0.2,1) infinite","animate-pulse":"tkx-pulse 2s cubic-bezier(0.4,0,0.6,1) infinite","animate-bounce":"tkx-bounce 1s infinite","animate-fade-in":"tkx-fade-in 200ms ease both","animate-slide-up":"tkx-slide-up 200ms ease both","animate-shimmer":"tkx-shimmer 1.5s infinite"};if(M[e])return{animation:M[e]};const N={"object-contain":"contain","object-cover":"cover","object-fill":"fill","object-none":"none","object-scale-down":"scale-down"};return N[e]?{"object-fit":N[e]}:"aspect-square"===e?{"aspect-ratio":"1 / 1"}:"aspect-video"===e?{"aspect-ratio":"16 / 9"}:"aspect-auto"===e?{"aspect-ratio":"auto"}:(u=e.match(/^aspect-\[(.+)]$/))?{"aspect-ratio":u[1]}:"list-none"===e?{"list-style-type":"none"}:"list-disc"===e?{"list-style-type":"disc"}:"list-decimal"===e?{"list-style-type":"decimal"}:"list-inside"===e?{"list-style-position":"inside"}:"list-outside"===e?{"list-style-position":"outside"}:(u=e.match(/^columns-(\d+)$/))?{columns:u[1]}:"resize"===e?{resize:"both"}:"resize-none"===e?{resize:"none"}:"resize-x"===e?{resize:"horizontal"}:"resize-y"===e?{resize:"vertical"}:"sr-only"===e?{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0,0,0,0)","white-space":"nowrap",border:"0"}:"not-sr-only"===e?{position:"static",width:"auto",height:"auto",padding:"0",margin:"0",overflow:"visible",clip:"auto","white-space":"normal"}:"focus-ring"===e?{outline:"2px solid var(--tkx-primary)","outline-offset":"2px","border-radius":"2px"}:"appearance-none"===e?{appearance:"none"}:"outline-none"===e?{outline:"none"}:"outline"===e?{outline:"2px solid currentColor","outline-offset":"2px"}:"float-left"===e?{float:"left"}:"float-right"===e?{float:"right"}:"float-none"===e?{float:"none"}:"clear-both"===e?{clear:"both"}:"isolate"===e?{isolation:"isolate"}:"isolation-auto"===e?{isolation:"auto"}:(u=e.match(/^will-change-(.+)$/))?{"will-change":u[1]}:"touch-manipulation"===e?{"touch-action":"manipulation"}:"touch-none"===e?{"touch-action":"none"}:"touch-pan-x"===e?{"touch-action":"pan-x"}:"touch-pan-y"===e?{"touch-action":"pan-y"}:"scroll-smooth"===e?{"scroll-behavior":"smooth"}:"scroll-auto"===e?{"scroll-behavior":"auto"}:(u=e.match(/^\[(--[a-zA-Z0-9-]+):(.+)]$/))?{[u[1]]:u[2]}:yt(e)||null}function lt(e){let t=0,n=-1;for(let r=0;r<e.length;r++)if("["===e[r])t++;else if("]"===e[r])t--;else if(":"===e[r]&&0===t){n=r;break}return-1===n?{variant:null,utility:e}:{variant:e.slice(0,n),utility:e.slice(n+1)}}function st(e,t){for(const[n,r]of Object.entries(t))e[n]=r}function dt(e){return Object.entries(e).map(([e,t])=>`${e}:${t}`).join(";")}var ct=new Map,ut=null,pt=null;function ht(){return ut&&ut.isConnected||(ut=document.getElementById("tkx-atomic"))||((ut=document.createElement("style")).id="tkx-atomic",document.head.appendChild(ut)),ut}function ft(e){const t=[];for(const n of e)if(n)if("string"==typeof n)t.push(...n.split(/\s+/).filter(Boolean));else if(Array.isArray(n))t.push(...ft(n));else if("object"==typeof n)for(const[e,r]of Object.entries(n))r&&t.push(e);return t}function mt(...e){const t=ft(e);if(0===t.length)return"";const n={base:{},variants:{}};for(const l of t){const{variant:e,utility:t}=lt(l),r=at(t);r&&(e?(n.variants[e]||(n.variants[e]={}),st(n.variants[e],r)):st(n.base,r))}const r=[],o=dt(n.base),i=u([o,...Object.entries(n.variants).map(([e,t])=>`${e}{${dt(t)}}`)].join("|")),a=`tkx-${i}`;o&&r.push(`.${a}{${o}}`);for(const[l,s]of Object.entries(n.variants)){const e=dt(s);if(e)if(l.startsWith("@")){const t=Qe[l.slice(1)];t&&r.push(`@media(min-width:${t}){.${a}{${e}}}`)}else if("motion-safe"===l)r.push(`@media(prefers-reduced-motion:no-preference){.${a}{${e}}}`);else if("motion-reduce"===l)r.push(`@media(prefers-reduced-motion:reduce){.${a}{${e}}}`);else if("contrast-more"===l)r.push(`@media(prefers-contrast:more){.${a}{${e}}}`);else if("forced-colors"===l)r.push(`@media(forced-colors:active){.${a}{${e}}}`);else if("dark"===l)r.push(`@media(prefers-color-scheme:dark){.${a}{${e}}}`);else if("print"===l)r.push(`@media print{.${a}{${e}}}`);else if("group-hover"===l)r.push(`.group:hover .${a}{${e}}`);else if("group-focus"===l)r.push(`.group:focus-within .${a}{${e}}`);else if("peer-hover"===l)r.push(`.peer:hover~.${a}{${e}}`);else{const t={hover:":hover",focus:":focus","focus-visible":":focus-visible","focus-within":":focus-within",active:":active",disabled:":disabled",checked:":checked",required:":required",valid:":valid",invalid:":invalid",first:":first-child",last:":last-child",odd:":nth-child(odd)",even:":nth-child(even)","first-of-type":":first-of-type","last-of-type":":last-of-type","only-child":":only-child","only-of-type":":only-of-type",empty:":empty",visited:":visited",target:":target","placeholder-shown":":placeholder-shown","read-only":":read-only",before:"::before",after:"::after",placeholder:"::placeholder",selection:"::selection","file-selector":"::file-selector-button",marker:"::marker"}[l]??`:${l}`;r.push(`.${a}${t}{${e}}`)}}return r.length>0&&function(e,t){if(ct.has(e))return;if(ct.set(e,t),"undefined"==typeof document)return;const n=function(){if(pt)return pt;try{const e=new CSSStyleSheet;return document.adoptedStyleSheets=[...document.adoptedStyleSheets,e],pt=e,e}catch{return null}}();if(n){const e=function(e){const t=[];let n=0,r=0;for(let o=0;o<e.length;o++)if("{"===e[o])n++;else if("}"===e[o]&&(n--,0===n)){const n=e.slice(r,o+1).trim();n&&t.push(n),r=o+1}return t}(t);for(const t of e)try{n.insertRule(t,n.cssRules.length)}catch{ht().textContent+=t+"\n"}}else ht().textContent+=t+"\n"}(i,r.join("")),a}var gt=mt;function xt(...e){return e.filter(Boolean).join(" ")}var bt=new Map;function yt(e){for(const t of bt.values())if(t[e])return t[e];return null}var vt={sm:"text-xs font-semibold",md:"text-sm font-semibold",lg:"text-base font-semibold",xl:"text-lg font-semibold"},wt={sm:"py-1.5 px-3",md:"py-2 px-4",lg:"py-2.5 px-5",xl:"py-3 px-6"},kt={sm:"min-h-[32px]",md:"min-h-[40px]",lg:"min-h-[48px]",xl:"min-h-[56px]"},$t={sm:14,md:16,lg:18,xl:20};function St({size:e}){const t=$t[e];return(0,d.jsxs)("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",className:mt("animate-spin shrink-0"),children:[(0,d.jsx)("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",strokeOpacity:"0.25"}),(0,d.jsx)("path",{d:"M12 2a10 10 0 0 1 10 10",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]})}var Ct=(0,a.forwardRef)(({variant:e="solid",size:t="md",colorScheme:n="primary",isLoading:r=!1,loadingText:o,leftIcon:i,rightIcon:a,isFullWidth:l=!1,glow:s=!1,disabled:c,isDisabled:u,children:p,className:h,style:f,...m},g)=>{globalThis.process;const x=J(),b=Te(),y=(c??u??!1)||r,v={primary:x.primary,secondary:x.secondary,danger:x.danger,warning:x.warning,success:x.success}[n],w=j(v,["#ffffff","#000000",x.bg]),k="string"==typeof p?oe(p):p,$=o?oe(o):void 0,S="solid"===e?{backgroundColor:v,color:w,border:"none",boxShadow:s&&!b?`0 0 20px ${v}55`:void 0}:"outline"===e?{backgroundColor:"transparent",color:v,border:`2px solid ${v}`}:"ghost"===e?{backgroundColor:"transparent",color:v,border:"none"}:{backgroundColor:"transparent",color:v,border:"none",textDecoration:"underline"};return(0,d.jsx)("button",{ref:g,"aria-busy":r,"aria-disabled":y,disabled:y,className:xt(mt("inline-flex items-center justify-center gap-2","rounded-lg font-sans font-semibold","select-none relative overflow-hidden",vt[t],wt[t],kt[t],"link"!==e&&kt[t],l&&"w-full",y?"cursor-not-allowed opacity-60":"cursor-pointer",!b&&"transition-all duration-200","focus-visible:focus-ring"),h),style:{...S,...f},...m,children:r?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(St,{size:t}),$??k]}):(0,d.jsxs)(d.Fragment,{children:[i&&(0,d.jsx)("span",{"aria-hidden":"true",children:i}),k,a&&(0,d.jsx)("span",{"aria-hidden":"true",children:a})]})})});Ct.displayName="TkxButton";var zt={none:"",sm:"p-3",md:"p-5",lg:"p-7"},Mt=(0,a.forwardRef)(({variant:e="default",isHoverable:t,isClickable:n,padding:r="md",as:o,children:i,className:a,style:l,...s},c)=>{const u=J(),p=Te(),h=o??(n?"button":"div"),f={default:{backgroundColor:u.surface,border:`1px solid ${u.border}`},glass:{backgroundColor:`${u.surface}cc`,backdropFilter:"blur(12px)",border:`1px solid ${u.border}55`,boxShadow:`0 4px 24px ${u.bg}40`},quantum:{backgroundColor:u.surfaceAlt,border:`1px solid ${u.primary}33`,boxShadow:`0 0 24px ${u.primary}18`},elevated:{backgroundColor:u.surface,boxShadow:`0 4px 20px ${u.bg}60`},outlined:{backgroundColor:"transparent",border:`2px solid ${u.border}`}}[e];return(0,d.jsx)(h,{ref:c,className:xt("tkx-card",mt("rounded-xl w-full text-left block font-sans focus-visible:focus-ring",zt[r],(t||n)&&!p&&"transition-transform duration-150 hover:scale-[1.01]",n?"cursor-pointer":"cursor-default"),a),style:{color:u.text,...f,...l},...s,children:i})});Mt.displayName="TkxCard";var Nt=(0,a.forwardRef)(({label:e,id:t,error:n,hint:r,leftAddon:o,rightAddon:i,isInvalid:l,isRequired:s,disabled:c,className:u,style:p,unicodeSafe:h=!0,onChange:f,...m},g)=>{const x=J(),b=(0,a.useId)(),y=t??b,v=`${y}-hint`,w=`${y}-error`,k=l||!!n,$=[r&&v,k&&w].filter(Boolean).join(" ")||void 0,S=oe(e),C=n?oe(n):void 0,z=r?oe(r):void 0,M=k?x.danger:x.border;return(0,d.jsxs)("div",{className:xt(mt("flex flex-col gap-1 w-full"),u),style:p,children:[(0,d.jsxs)("label",{htmlFor:y,className:mt("text-sm font-medium font-sans"),style:{color:x.text},children:[S,s&&(0,d.jsx)("span",{"aria-hidden":"true",className:mt("ml-1"),style:{color:x.danger},children:"*"})]}),(0,d.jsxs)("div",{className:mt("flex items-center rounded-lg overflow-hidden","transition-colors duration-150",c?"opacity-60":""),style:{border:`1.5px solid ${M}`,backgroundColor:x.surface},children:[o&&(0,d.jsx)("div",{className:mt("px-2.5 self-stretch flex items-center text-sm shrink-0"),style:{backgroundColor:x.surfaceAlt,color:x.textMuted,borderRight:`1px solid ${x.border}`},children:o}),(0,d.jsx)("input",{ref:g,id:y,"aria-invalid":k,"aria-required":s,"aria-describedby":$,disabled:c,className:xt(mt("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:x.text},onChange:h?e=>{const t=Se(e.target.value);t!==e.target.value&&(e.target.value=t),f?.(e)}:f,...m}),i&&(0,d.jsx)("div",{className:mt("px-2.5 self-stretch flex items-center text-sm shrink-0"),style:{backgroundColor:x.surfaceAlt,color:x.textMuted,borderLeft:`1px solid ${x.border}`},children:i})]}),z&&!C&&(0,d.jsx)("span",{id:v,className:mt("text-xs"),style:{color:x.textMuted},children:z}),C&&(0,d.jsxs)("span",{id:w,role:"alert",className:mt("text-xs flex items-center gap-1"),style:{color:x.danger},children:[(0,d.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.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"})}),C]})]})});Nt.displayName="TkxInput";var Dt={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]"},Rt={sm:"size-[6px]",md:"size-2",lg:"size-2.5"},Pt=(0,a.forwardRef)(({variant:e="default",size:t="md",dot:n=!1,pulse:r=!1,outlined:o=!1,children:i,className:a,style:l,...s},c)=>{const u=J(),p={default:u.border,primary:u.primary,secondary:u.secondary,danger:u.danger,warning:u.warning,success:u.success,info:u.info}[e]||"#666666",h=j(p,["#ffffff","#000000",u.bg||"#000000"]),f="string"==typeof i?oe(i):i;return n?(0,d.jsx)("span",{ref:c,"aria-label":"string"==typeof i?oe(i):void 0,className:xt(mt("inline-block rounded-full",Rt[t],r&&"animate-pulse"),a),style:{backgroundColor:p,...l},...s}):(0,d.jsx)("span",{ref:c,className:xt(mt("inline-flex items-center justify-center rounded-full font-semibold font-sans tracking-wide",Dt[t],r&&"animate-pulse"),a),style:{backgroundColor:o?"transparent":p,color:o?p:h,border:o?`1px solid ${p}`:"none",...l},...s,children:f})});Pt.displayName="TkxBadge";var Ft={sm:"4px",md:"8px",lg:"12px"},It={sm:32,md:48,lg:64},At=(0,a.forwardRef)(({value:e,variant:t="linear",size:n="md",label:r,showValue:o,color:i,className:a,style:l,...s},c)=>{const u=J(),p=Te(),h=i??u.primary,f=void 0===e,m=void 0!==e?Math.min(100,Math.max(0,e)):0;if(void 0!==e){const{errors:t}=le({value:e},{value:{type:"number",min:0,max:100}});t.length}if("circular"===t){const e=It[n],t="sm"===n?3:"md"===n?4:5,i=(e-2*t)/2,s=2*Math.PI*i,g=f?0:s-m/100*s;return(0,d.jsxs)("div",{ref:c,role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":f?void 0:m,"aria-label":r??(f?"Loading":`${m}%`),className:xt(mt("inline-flex flex-col items-center gap-1"),a),style:l,children:[(0,d.jsxs)("svg",{width:e,height:e,viewBox:`0 0 ${e} ${e}`,"aria-hidden":"true",children:[(0,d.jsx)("circle",{cx:e/2,cy:e/2,r:i,fill:"none",stroke:u.border,strokeWidth:t}),(0,d.jsx)("circle",{cx:e/2,cy:e/2,r:i,fill:"none",stroke:h,strokeWidth:t,strokeLinecap:"round",strokeDasharray:s,strokeDashoffset:g,transform:`rotate(-90 ${e/2} ${e/2})`,style:{transition:p?"none":"stroke-dashoffset 300ms ease",animation:f&&!p?"tkx-spin 1s linear infinite":void 0}})]}),o&&!f&&(0,d.jsxs)("span",{className:mt("text-xs"),style:{color:u.textMuted},children:[m,"%"]})]})}const g=Ft[n];return(0,d.jsxs)("div",{ref:c,role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":f?void 0:m,"aria-label":r??(f?"Loading":`${m}%`),className:xt(mt("flex flex-col gap-1 w-full"),a),style:l,children:[r&&(0,d.jsxs)("div",{className:mt("flex justify-between text-sm"),style:{color:u.text},children:[(0,d.jsx)("span",{children:r}),o&&!f&&(0,d.jsxs)("span",{children:[m,"%"]})]}),(0,d.jsx)("div",{className:mt("w-full overflow-hidden"),style:{height:g,borderRadius:g,backgroundColor:u.border},children:(0,d.jsx)("div",{style:{height:"100%",borderRadius:g,backgroundColor:h,width:f?"40%":`${m}%`,transition:p?"none":"width 300ms ease",animation:f&&!p?"tkx-shimmer 1.5s ease-in-out infinite":void 0}})})]})});At.displayName="TkxProgress";var Lt={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}},Tt=(0,a.forwardRef)(({checked:e,onChange:t,label:n,size:r="md",hideLabel:o,disabled:i,className:l,style:s,...c},u)=>{const p=J(),h=Te(),f=(0,a.useId)();le({label:n,checked:e},{label:{type:"string",required:!0},checked:{type:"boolean",required:!0}});const{tw:m,th:g,td:x,gap:b}=Lt[r],y=e?m-x-b:b,v=e?p.primary:p.border;return(0,d.jsxs)("div",{className:xt(mt("inline-flex items-center gap-2",i?"opacity-50":""),l),style:s,children:[!o&&(0,d.jsx)("label",{htmlFor:f,className:mt("text-sm font-sans",i?"cursor-not-allowed":"cursor-pointer","select-none"),style:{color:p.text},children:n}),(0,d.jsx)("button",{ref:u,id:f,role:"switch","aria-checked":e,"aria-label":o?n:void 0,disabled:i,onClick:()=>!i&&t(!e),onKeyDown:n=>{"Enter"!==n.key&&" "!==n.key||i||(n.preventDefault(),t(!e))},className:xt(mt("relative border-none p-0 outline-none shrink-0 focus-visible:focus-ring",i?"cursor-not-allowed":"cursor-pointer",!h&&"transition-colors duration-200")),style:{width:m,height:g,borderRadius:g,backgroundColor:v},...c,children:(0,d.jsx)("span",{"aria-hidden":"true",className:mt("absolute rounded-full"),style:{top:"50%",left:y,width:x,height:x,transform:"translateY(-50%)",backgroundColor:"#ffffff",boxShadow:"0 1px 3px rgba(0,0,0,0.3)",transition:h?"none":"left 200ms ease"}})})]})});Tt.displayName="TkxToggle";var Wt={info:(0,d.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"})}),success:(0,d.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm-2 14.5l-4-4 1.41-1.41L10 13.67l6.59-6.59L18 8.5l-8 8z"})}),warning:(0,d.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"})}),danger:(0,d.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.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"})})},jt={close:"Close",cancel:"Cancel",confirm:"Confirm",save:"Save",delete:"Delete",search:"Search",loading:"Loading...",noResults:"No results found",required:"Required",previous:"Previous",next:"Next",pageOf:(e,t)=>`Page ${e} of ${t}`,selectPlaceholder:"Select...",clearSelection:"Clear selection",selectDate:"Select a date",today:"Today",dropFiles:"Drop files here or",browse:"Browse",noData:"No data available",sortAscending:"Sort ascending",sortDescending:"Sort descending",filterPlaceholder:"Filter...",exportCsv:"Export CSV",rowsSelected:e=>`${e} row${1===e?"":"s"} selected`},Et={"en-US":jt,"es-ES":{close:"Cerrar",cancel:"Cancelar",confirm:"Confirmar",save:"Guardar",delete:"Eliminar",search:"Buscar",loading:"Cargando...",noResults:"No se encontraron resultados",required:"Requerido",previous:"Anterior",next:"Siguiente",pageOf:(e,t)=>`Página ${e} de ${t}`,selectPlaceholder:"Seleccionar...",clearSelection:"Limpiar selección",selectDate:"Seleccionar fecha",today:"Hoy",dropFiles:"Suelte archivos aquí o",browse:"Explorar",noData:"No hay datos disponibles",sortAscending:"Orden ascendente",sortDescending:"Orden descendente",filterPlaceholder:"Filtrar...",exportCsv:"Exportar CSV",rowsSelected:e=>`${e} fila${1===e?"":"s"} seleccionada${1===e?"":"s"}`,firstPage:"Primera página",lastPage:"Última página",previousPage:"Página anterior",nextPage:"Página siguiente",showingRange:(e,t,n)=>`Mostrando ${e}–${t} de ${n}`,itemsPerPage:"Por página",uploadFiles:"Subir archivos",yesterday:"Ayer",last7Days:"Últimos 7 días",last30Days:"Últimos 30 días",thisMonth:"Este mes",lastMonth:"Mes pasado",notifications:"Notificaciones",commandSearch:"Escribir un comando o buscar…",noCommandsFound:"No se encontraron comandos",closeDrawer:"Cerrar panel",fieldRequired:"Este campo es obligatorio",invalidFormat:"Formato inválido",minLength:e=>`Mínimo ${e} caracteres`,maxLength:e=>`Máximo ${e} caracteres`,minValue:e=>`Mínimo ${e}`,maxValue:e=>`Máximo ${e}`,noRows:"Sin filas",resetFilters:"Restablecer filtros"},"pt-BR":{close:"Fechar",cancel:"Cancelar",confirm:"Confirmar",save:"Salvar",delete:"Excluir",search:"Pesquisar",loading:"Carregando...",noResults:"Nenhum resultado encontrado",required:"Obrigatório",previous:"Anterior",next:"Próximo",pageOf:(e,t)=>`Página ${e} de ${t}`,selectPlaceholder:"Selecionar...",clearSelection:"Limpar seleção",selectDate:"Selecionar data",today:"Hoje",dropFiles:"Solte arquivos aqui ou",browse:"Procurar",noData:"Nenhum dado disponível",sortAscending:"Ordenar crescente",sortDescending:"Ordenar decrescente",filterPlaceholder:"Filtrar...",exportCsv:"Exportar CSV",rowsSelected:e=>`${e} linha${1===e?"":"s"} selecionada${1===e?"":"s"}`,firstPage:"Primeira página",lastPage:"Última página",previousPage:"Página anterior",nextPage:"Próxima página",showingRange:(e,t,n)=>`Exibindo ${e}–${t} de ${n}`,itemsPerPage:"Por página",uploadFiles:"Enviar arquivos",yesterday:"Ontem",last7Days:"Últimos 7 dias",last30Days:"Últimos 30 dias",thisMonth:"Este mês",lastMonth:"Mês passado",notifications:"Notificações",commandSearch:"Digite um comando ou pesquise…",noCommandsFound:"Nenhum comando encontrado",closeDrawer:"Fechar painel",fieldRequired:"Este campo é obrigatório",invalidFormat:"Formato inválido",minLength:e=>`Mínimo de ${e} caracteres`,maxLength:e=>`Máximo de ${e} caracteres`,minValue:e=>`Mínimo ${e}`,maxValue:e=>`Máximo ${e}`,noRows:"Sem linhas",resetFilters:"Redefinir filtros"},"pt-PT":{close:"Fechar",cancel:"Cancelar",confirm:"Confirmar",save:"Guardar",delete:"Eliminar",search:"Pesquisar",loading:"A carregar...",noResults:"Sem resultados",required:"Obrigatório",previous:"Anterior",next:"Próximo",pageOf:(e,t)=>`Página ${e} de ${t}`,selectPlaceholder:"Selecionar...",clearSelection:"Limpar seleção",selectDate:"Selecionar data",today:"Hoje",dropFiles:"Largue ficheiros aqui ou",browse:"Procurar",noData:"Sem dados disponíveis",sortAscending:"Ordenar crescente",sortDescending:"Ordenar decrescente",filterPlaceholder:"Filtrar...",exportCsv:"Exportar CSV",rowsSelected:e=>`${e} linha${1===e?"":"s"} selecionada${1===e?"":"s"}`,firstPage:"Primeira página",lastPage:"Última página",previousPage:"Página anterior",nextPage:"Página seguinte",showingRange:(e,t,n)=>`A mostrar ${e}–${t} de ${n}`,itemsPerPage:"Por página",uploadFiles:"Carregar ficheiros",yesterday:"Ontem",last7Days:"Últimos 7 dias",last30Days:"Últimos 30 dias",thisMonth:"Este mês",lastMonth:"Mês passado",notifications:"Notificações",commandSearch:"Digite um comando ou pesquise…",noCommandsFound:"Nenhum comando encontrado",closeDrawer:"Fechar painel",fieldRequired:"Este campo é obrigatório",invalidFormat:"Formato inválido",minLength:e=>`Mínimo ${e} caracteres`,maxLength:e=>`Máximo ${e} caracteres`,minValue:e=>`Mínimo ${e}`,maxValue:e=>`Máximo ${e}`,noRows:"Sem linhas",resetFilters:"Repor filtros"},"fr-FR":{close:"Fermer",cancel:"Annuler",confirm:"Confirmer",save:"Enregistrer",delete:"Supprimer",search:"Rechercher",loading:"Chargement...",noResults:"Aucun résultat trouvé",required:"Obligatoire",previous:"Précédent",next:"Suivant",pageOf:(e,t)=>`Page ${e} sur ${t}`,selectPlaceholder:"Sélectionner...",clearSelection:"Effacer la sélection",selectDate:"Sélectionner une date",today:"Aujourd'hui",dropFiles:"Déposez les fichiers ici ou",browse:"Parcourir",noData:"Aucune donnée disponible",sortAscending:"Tri croissant",sortDescending:"Tri décroissant",filterPlaceholder:"Filtrer...",exportCsv:"Exporter CSV",rowsSelected:e=>`${e} ligne${1===e?"":"s"} sélectionnée${1===e?"":"s"}`,firstPage:"Première page",lastPage:"Dernière page",previousPage:"Page précédente",nextPage:"Page suivante",showingRange:(e,t,n)=>`Affichage de ${e}–${t} sur ${n}`,itemsPerPage:"Par page",uploadFiles:"Téléverser des fichiers",yesterday:"Hier",last7Days:"7 derniers jours",last30Days:"30 derniers jours",thisMonth:"Ce mois-ci",lastMonth:"Le mois dernier",notifications:"Notifications",commandSearch:"Tapez une commande ou recherchez…",noCommandsFound:"Aucune commande trouvée",closeDrawer:"Fermer le panneau",fieldRequired:"Ce champ est obligatoire",invalidFormat:"Format invalide",minLength:e=>`Au moins ${e} caractères`,maxLength:e=>`Au plus ${e} caractères`,minValue:e=>`Au moins ${e}`,maxValue:e=>`Au plus ${e}`,noRows:"Aucune ligne",resetFilters:"Réinitialiser les filtres"},"de-DE":{close:"Schließen",cancel:"Abbrechen",confirm:"Bestätigen",save:"Speichern",delete:"Löschen",search:"Suchen",loading:"Wird geladen...",noResults:"Keine Ergebnisse gefunden",required:"Erforderlich",previous:"Zurück",next:"Weiter",pageOf:(e,t)=>`Seite ${e} von ${t}`,selectPlaceholder:"Auswählen...",clearSelection:"Auswahl löschen",selectDate:"Datum auswählen",today:"Heute",dropFiles:"Dateien hier ablegen oder",browse:"Durchsuchen",noData:"Keine Daten verfügbar",sortAscending:"Aufsteigend sortieren",sortDescending:"Absteigend sortieren",filterPlaceholder:"Filtern...",exportCsv:"CSV exportieren",rowsSelected:e=>`${e} Zeile${1===e?"":"n"} ausgewählt`,firstPage:"Erste Seite",lastPage:"Letzte Seite",previousPage:"Vorherige Seite",nextPage:"Nächste Seite",showingRange:(e,t,n)=>`${e}–${t} von ${n} angezeigt`,itemsPerPage:"Pro Seite",uploadFiles:"Dateien hochladen",yesterday:"Gestern",last7Days:"Letzte 7 Tage",last30Days:"Letzte 30 Tage",thisMonth:"Dieser Monat",lastMonth:"Letzter Monat",notifications:"Benachrichtigungen",commandSearch:"Befehl eingeben oder suchen…",noCommandsFound:"Keine Befehle gefunden",closeDrawer:"Panel schließen",fieldRequired:"Dieses Feld ist erforderlich",invalidFormat:"Ungültiges Format",minLength:e=>`Mindestens ${e} Zeichen`,maxLength:e=>`Höchstens ${e} Zeichen`,minValue:e=>`Mindestens ${e}`,maxValue:e=>`Höchstens ${e}`,noRows:"Keine Zeilen",resetFilters:"Filter zurücksetzen"},"it-IT":{close:"Chiudi",cancel:"Annulla",confirm:"Conferma",save:"Salva",delete:"Elimina",search:"Cerca",loading:"Caricamento...",noResults:"Nessun risultato trovato",required:"Obbligatorio",previous:"Precedente",next:"Successivo",pageOf:(e,t)=>`Pagina ${e} di ${t}`,selectPlaceholder:"Seleziona...",clearSelection:"Cancella selezione",selectDate:"Seleziona una data",today:"Oggi",dropFiles:"Trascina file qui o",browse:"Sfoglia",noData:"Nessun dato disponibile",sortAscending:"Ordinamento crescente",sortDescending:"Ordinamento decrescente",filterPlaceholder:"Filtra...",exportCsv:"Esporta CSV",rowsSelected:e=>`${e} riga${1===e?"":"i"} selezionat${1===e?"a":"e"}`,firstPage:"Prima pagina",lastPage:"Ultima pagina",previousPage:"Pagina precedente",nextPage:"Pagina successiva",showingRange:(e,t,n)=>`Visualizzazione ${e}–${t} di ${n}`,itemsPerPage:"Per pagina",uploadFiles:"Carica file",yesterday:"Ieri",last7Days:"Ultimi 7 giorni",last30Days:"Ultimi 30 giorni",thisMonth:"Questo mese",lastMonth:"Mese scorso",notifications:"Notifiche",commandSearch:"Digita un comando o cerca…",noCommandsFound:"Nessun comando trovato",closeDrawer:"Chiudi pannello",fieldRequired:"Questo campo è obbligatorio",invalidFormat:"Formato non valido",minLength:e=>`Almeno ${e} caratteri`,maxLength:e=>`Massimo ${e} caratteri`,minValue:e=>`Almeno ${e}`,maxValue:e=>`Massimo ${e}`,noRows:"Nessuna riga",resetFilters:"Reimposta filtri"},"nl-NL":{close:"Sluiten",cancel:"Annuleren",confirm:"Bevestigen",save:"Opslaan",delete:"Verwijderen",search:"Zoeken",loading:"Laden...",noResults:"Geen resultaten gevonden",required:"Verplicht",previous:"Vorige",next:"Volgende",pageOf:(e,t)=>`Pagina ${e} van ${t}`,selectPlaceholder:"Selecteer...",clearSelection:"Selectie wissen",selectDate:"Selecteer een datum",today:"Vandaag",dropFiles:"Zet bestanden hier neer of",browse:"Bladeren",noData:"Geen gegevens beschikbaar",sortAscending:"Oplopend sorteren",sortDescending:"Aflopend sorteren",filterPlaceholder:"Filteren...",exportCsv:"CSV exporteren",rowsSelected:e=>`${e} rij${1===e?"":"en"} geselecteerd`,firstPage:"Eerste pagina",lastPage:"Laatste pagina",previousPage:"Vorige pagina",nextPage:"Volgende pagina",showingRange:(e,t,n)=>`${e}–${t} van ${n} weergegeven`,itemsPerPage:"Per pagina",uploadFiles:"Bestanden uploaden",yesterday:"Gisteren",last7Days:"Laatste 7 dagen",last30Days:"Laatste 30 dagen",thisMonth:"Deze maand",lastMonth:"Vorige maand",notifications:"Meldingen",commandSearch:"Typ een opdracht of zoek…",noCommandsFound:"Geen opdrachten gevonden",closeDrawer:"Paneel sluiten",fieldRequired:"Dit veld is verplicht",invalidFormat:"Ongeldig formaat",minLength:e=>`Minimaal ${e} tekens`,maxLength:e=>`Maximaal ${e} tekens`,minValue:e=>`Minimaal ${e}`,maxValue:e=>`Maximaal ${e}`,noRows:"Geen rijen",resetFilters:"Filters herstellen"},"pl-PL":{close:"Zamknij",cancel:"Anuluj",confirm:"Potwierdź",save:"Zapisz",delete:"Usuń",search:"Szukaj",loading:"Ładowanie...",noResults:"Nie znaleziono wyników",required:"Wymagane",previous:"Poprzednia",next:"Następna",pageOf:(e,t)=>`Strona ${e} z ${t}`,selectPlaceholder:"Wybierz...",clearSelection:"Wyczyść wybór",selectDate:"Wybierz datę",today:"Dzisiaj",dropFiles:"Upuść pliki tutaj lub",browse:"Przeglądaj",noData:"Brak danych",sortAscending:"Sortuj rosnąco",sortDescending:"Sortuj malejąco",filterPlaceholder:"Filtruj...",exportCsv:"Eksportuj CSV",rowsSelected:e=>`Wybrano ${e} wier${1===e?"sz":"sze"}`,firstPage:"Pierwsza strona",lastPage:"Ostatnia strona",previousPage:"Poprzednia strona",nextPage:"Następna strona",showingRange:(e,t,n)=>`Wyświetlanie ${e}–${t} z ${n}`,itemsPerPage:"Na stronę",uploadFiles:"Prześlij pliki",yesterday:"Wczoraj",last7Days:"Ostatnie 7 dni",last30Days:"Ostatnie 30 dni",thisMonth:"Ten miesiąc",lastMonth:"Poprzedni miesiąc",notifications:"Powiadomienia",commandSearch:"Wpisz polecenie lub wyszukaj…",noCommandsFound:"Nie znaleziono poleceń",closeDrawer:"Zamknij panel",fieldRequired:"To pole jest wymagane",invalidFormat:"Nieprawidłowy format",minLength:e=>`Minimum ${e} znaków`,maxLength:e=>`Maksymalnie ${e} znaków`,minValue:e=>`Minimum ${e}`,maxValue:e=>`Maksymalnie ${e}`,noRows:"Brak wierszy",resetFilters:"Resetuj filtry"},"ru-RU":{close:"Закрыть",cancel:"Отмена",confirm:"Подтвердить",save:"Сохранить",delete:"Удалить",search:"Поиск",loading:"Загрузка...",noResults:"Результаты не найдены",required:"Обязательно",previous:"Назад",next:"Вперёд",pageOf:(e,t)=>`Страница ${e} из ${t}`,selectPlaceholder:"Выбрать...",clearSelection:"Снять выделение",selectDate:"Выбрать дату",today:"Сегодня",dropFiles:"Перетащите файлы сюда или",browse:"Обзор",noData:"Нет данных",sortAscending:"По возрастанию",sortDescending:"По убыванию",filterPlaceholder:"Фильтр...",exportCsv:"Экспорт CSV",rowsSelected:e=>`Выбрано ${e} строк`,firstPage:"Первая страница",lastPage:"Последняя страница",previousPage:"Предыдущая страница",nextPage:"Следующая страница",showingRange:(e,t,n)=>`Показано ${e}–${t} из ${n}`,itemsPerPage:"На странице",uploadFiles:"Загрузить файлы",yesterday:"Вчера",last7Days:"Последние 7 дней",last30Days:"Последние 30 дней",thisMonth:"Этот месяц",lastMonth:"Прошлый месяц",notifications:"Уведомления",commandSearch:"Введите команду или найдите…",noCommandsFound:"Команды не найдены",closeDrawer:"Закрыть панель",fieldRequired:"Это поле обязательно",invalidFormat:"Неверный формат",minLength:e=>`Не менее ${e} символов`,maxLength:e=>`Не более ${e} символов`,minValue:e=>`Не менее ${e}`,maxValue:e=>`Не более ${e}`,noRows:"Нет строк",resetFilters:"Сбросить фильтры"},"uk-UA":{close:"Закрити",cancel:"Скасувати",confirm:"Підтвердити",save:"Зберегти",delete:"Видалити",search:"Пошук",loading:"Завантаження...",noResults:"Результати не знайдено",required:"Обов'язково",previous:"Назад",next:"Далі",pageOf:(e,t)=>`Сторінка ${e} з ${t}`,selectPlaceholder:"Вибрати...",clearSelection:"Очистити вибір",selectDate:"Вибрати дату",today:"Сьогодні",dropFiles:"Перетягніть файли або",browse:"Огляд",noData:"Немає даних",sortAscending:"За зростанням",sortDescending:"За спаданням",filterPlaceholder:"Фільтр...",exportCsv:"Експорт CSV",rowsSelected:e=>`Вибрано ${e} рядків`,firstPage:"Перша сторінка",lastPage:"Остання сторінка",previousPage:"Попередня сторінка",nextPage:"Наступна сторінка",showingRange:(e,t,n)=>`Показано ${e}–${t} з ${n}`,itemsPerPage:"На сторінці",uploadFiles:"Завантажити файли",yesterday:"Вчора",last7Days:"Останні 7 днів",last30Days:"Останні 30 днів",thisMonth:"Цей місяць",lastMonth:"Минулий місяць",notifications:"Сповіщення",commandSearch:"Введіть команду або знайдіть…",noCommandsFound:"Команд не знайдено",closeDrawer:"Закрити панель",fieldRequired:"Це поле обов'язкове",invalidFormat:"Невірний формат",minLength:e=>`Не менше ${e} символів`,maxLength:e=>`Не більше ${e} символів`,minValue:e=>`Не менше ${e}`,maxValue:e=>`Не більше ${e}`,noRows:"Немає рядків",resetFilters:"Скинути фільтри"},"tr-TR":{close:"Kapat",cancel:"İptal",confirm:"Onayla",save:"Kaydet",delete:"Sil",search:"Ara",loading:"Yükleniyor...",noResults:"Sonuç bulunamadı",required:"Zorunlu",previous:"Önceki",next:"Sonraki",pageOf:(e,t)=>`${t} sayfadan ${e}. sayfa`,selectPlaceholder:"Seçin...",clearSelection:"Seçimi temizle",selectDate:"Tarih seçin",today:"Bugün",dropFiles:"Dosyaları buraya bırakın veya",browse:"Gözat",noData:"Veri yok",sortAscending:"Artan sıralama",sortDescending:"Azalan sıralama",filterPlaceholder:"Filtrele...",exportCsv:"CSV dışa aktar",rowsSelected:e=>`${e} satır seçildi`,firstPage:"İlk sayfa",lastPage:"Son sayfa",previousPage:"Önceki sayfa",nextPage:"Sonraki sayfa",showingRange:(e,t,n)=>`${n} öğeden ${e}–${t} gösteriliyor`,itemsPerPage:"Sayfa başına",uploadFiles:"Dosya yükle",yesterday:"Dün",last7Days:"Son 7 gün",last30Days:"Son 30 gün",thisMonth:"Bu ay",lastMonth:"Geçen ay",notifications:"Bildirimler",commandSearch:"Komut yazın veya arayın…",noCommandsFound:"Komut bulunamadı",closeDrawer:"Paneli kapat",fieldRequired:"Bu alan zorunludur",invalidFormat:"Geçersiz biçim",minLength:e=>`En az ${e} karakter`,maxLength:e=>`En fazla ${e} karakter`,minValue:e=>`En az ${e}`,maxValue:e=>`En fazla ${e}`,noRows:"Satır yok",resetFilters:"Filtreleri sıfırla"},"sv-SE":{close:"Stäng",cancel:"Avbryt",confirm:"Bekräfta",save:"Spara",delete:"Ta bort",search:"Sök",loading:"Laddar...",noResults:"Inga resultat hittades",required:"Obligatoriskt",previous:"Föregående",next:"Nästa",pageOf:(e,t)=>`Sida ${e} av ${t}`,selectPlaceholder:"Välj...",clearSelection:"Rensa val",selectDate:"Välj ett datum",today:"Idag",dropFiles:"Släpp filer här eller",browse:"Bläddra",noData:"Inga data tillgängliga",sortAscending:"Sortera stigande",sortDescending:"Sortera fallande",filterPlaceholder:"Filtrera...",exportCsv:"Exportera CSV",rowsSelected:e=>`${e} rad${1===e?"":"er"} vald${1===e?"":"a"}`,firstPage:"Första sidan",lastPage:"Sista sidan",previousPage:"Föregående sida",nextPage:"Nästa sida",showingRange:(e,t,n)=>`Visar ${e}–${t} av ${n}`,itemsPerPage:"Per sida",uploadFiles:"Ladda upp filer",yesterday:"Igår",last7Days:"Senaste 7 dagarna",last30Days:"Senaste 30 dagarna",thisMonth:"Denna månad",lastMonth:"Förra månaden",notifications:"Aviseringar",commandSearch:"Skriv ett kommando eller sök…",noCommandsFound:"Inga kommandon hittades",closeDrawer:"Stäng panel",fieldRequired:"Detta fält är obligatoriskt",invalidFormat:"Ogiltigt format",minLength:e=>`Minst ${e} tecken`,maxLength:e=>`Högst ${e} tecken`,minValue:e=>`Minst ${e}`,maxValue:e=>`Högst ${e}`,noRows:"Inga rader",resetFilters:"Återställ filter"},"da-DK":{close:"Luk",cancel:"Annuller",confirm:"Bekræft",save:"Gem",delete:"Slet",search:"Søg",loading:"Indlæser...",noResults:"Ingen resultater fundet",required:"Påkrævet",previous:"Forrige",next:"Næste",pageOf:(e,t)=>`Side ${e} af ${t}`,selectPlaceholder:"Vælg...",clearSelection:"Ryd valg",selectDate:"Vælg en dato",today:"I dag",dropFiles:"Slip filer her eller",browse:"Gennemse",noData:"Ingen data tilgængelige",sortAscending:"Sorter stigende",sortDescending:"Sorter faldende",filterPlaceholder:"Filtrer...",exportCsv:"Eksporter CSV",rowsSelected:e=>`${e} række${1===e?"":"r"} valgt`,firstPage:"Første side",lastPage:"Sidste side",previousPage:"Forrige side",nextPage:"Næste side",showingRange:(e,t,n)=>`Viser ${e}–${t} af ${n}`,itemsPerPage:"Per side",uploadFiles:"Upload filer",yesterday:"I går",last7Days:"Sidste 7 dage",last30Days:"Sidste 30 dage",thisMonth:"Denne måned",lastMonth:"Sidste måned",notifications:"Notifikationer",commandSearch:"Skriv en kommando eller søg…",noCommandsFound:"Ingen kommandoer fundet",closeDrawer:"Luk panel",fieldRequired:"Dette felt er påkrævet",invalidFormat:"Ugyldigt format",minLength:e=>`Mindst ${e} tegn`,maxLength:e=>`Højst ${e} tegn`,minValue:e=>`Mindst ${e}`,maxValue:e=>`Højst ${e}`,noRows:"Ingen rækker",resetFilters:"Nulstil filtre"},"cs-CZ":{close:"Zavřít",cancel:"Zrušit",confirm:"Potvrdit",save:"Uložit",delete:"Smazat",search:"Hledat",loading:"Načítání...",noResults:"Žádné výsledky",required:"Povinné",previous:"Předchozí",next:"Další",pageOf:(e,t)=>`Stránka ${e} z ${t}`,selectPlaceholder:"Vyberte...",clearSelection:"Vymazat výběr",selectDate:"Vyberte datum",today:"Dnes",dropFiles:"Přetáhněte soubory nebo",browse:"Procházet",noData:"Žádná data",sortAscending:"Seřadit vzestupně",sortDescending:"Seřadit sestupně",filterPlaceholder:"Filtrovat...",exportCsv:"Exportovat CSV",rowsSelected:e=>`Vybráno ${e} řádků`,firstPage:"První stránka",lastPage:"Poslední stránka",previousPage:"Předchozí stránka",nextPage:"Další stránka",showingRange:(e,t,n)=>`Zobrazeno ${e}–${t} z ${n}`,itemsPerPage:"Na stránku",uploadFiles:"Nahrát soubory",yesterday:"Včera",last7Days:"Posledních 7 dní",last30Days:"Posledních 30 dní",thisMonth:"Tento měsíc",lastMonth:"Minulý měsíc",notifications:"Oznámení",commandSearch:"Zadejte příkaz nebo hledejte…",noCommandsFound:"Žádné příkazy nenalezeny",closeDrawer:"Zavřít panel",fieldRequired:"Toto pole je povinné",invalidFormat:"Neplatný formát",minLength:e=>`Minimálně ${e} znaků`,maxLength:e=>`Maximálně ${e} znaků`,minValue:e=>`Minimálně ${e}`,maxValue:e=>`Maximálně ${e}`,noRows:"Žádné řádky",resetFilters:"Resetovat filtry"},"hu-HU":{close:"Bezárás",cancel:"Mégse",confirm:"Megerősítés",save:"Mentés",delete:"Törlés",search:"Keresés",loading:"Betöltés...",noResults:"Nincs találat",required:"Kötelező",previous:"Előző",next:"Következő",pageOf:(e,t)=>`${e}. oldal / ${t}`,selectPlaceholder:"Válasszon...",clearSelection:"Kijelölés törlése",selectDate:"Válasszon dátumot",today:"Ma",dropFiles:"Húzza ide a fájlokat vagy",browse:"Tallózás",noData:"Nincs adat",sortAscending:"Növekvő sorrend",sortDescending:"Csökkenő sorrend",filterPlaceholder:"Szűrés...",exportCsv:"CSV exportálása",rowsSelected:e=>`${e} sor kiválasztva`,firstPage:"Első oldal",lastPage:"Utolsó oldal",previousPage:"Előző oldal",nextPage:"Következő oldal",showingRange:(e,t,n)=>`${e}–${t} megjelenítése a(z) ${n}-ből`,itemsPerPage:"Oldalanként",uploadFiles:"Fájlok feltöltése",yesterday:"Tegnap",last7Days:"Elmúlt 7 nap",last30Days:"Elmúlt 30 nap",thisMonth:"Ez a hónap",lastMonth:"Múlt hónap",notifications:"Értesítések",commandSearch:"Írjon parancsot vagy keressen…",noCommandsFound:"Nincsenek parancsok",closeDrawer:"Panel bezárása",fieldRequired:"Ez a mező kötelező",invalidFormat:"Érvénytelen formátum",minLength:e=>`Legalább ${e} karakter`,maxLength:e=>`Legfeljebb ${e} karakter`,minValue:e=>`Legalább ${e}`,maxValue:e=>`Legfeljebb ${e}`,noRows:"Nincsenek sorok",resetFilters:"Szűrők visszaállítása"},"ar-SA":{close:"إغلاق",cancel:"إلغاء",confirm:"تأكيد",save:"حفظ",delete:"حذف",search:"بحث",loading:"...جارٍ التحميل",noResults:"لم يتم العثور على نتائج",required:"مطلوب",previous:"السابق",next:"التالي",pageOf:(e,t)=>`صفحة ${e} من ${t}`,selectPlaceholder:"...اختر",clearSelection:"مسح الاختيار",selectDate:"اختر تاريخ",today:"اليوم",dropFiles:"أفلت الملفات هنا أو",browse:"تصفح",noData:"لا توجد بيانات",sortAscending:"ترتيب تصاعدي",sortDescending:"ترتيب تنازلي",filterPlaceholder:"...فلترة",exportCsv:"تصدير CSV",rowsSelected:e=>`تم تحديد ${e} صفوف`,firstPage:"الصفحة الأولى",lastPage:"الصفحة الأخيرة",previousPage:"الصفحة السابقة",nextPage:"الصفحة التالية",showingRange:(e,t,n)=>`عرض ${e}–${t} من ${n}`,itemsPerPage:"لكل صفحة",uploadFiles:"رفع الملفات",yesterday:"الأمس",last7Days:"آخر 7 أيام",last30Days:"آخر 30 يوم",thisMonth:"هذا الشهر",lastMonth:"الشهر الماضي",notifications:"إشعارات",commandSearch:"اكتب أمرًا أو ابحث…",noCommandsFound:"لم يتم العثور على أوامر",closeDrawer:"إغلاق اللوحة",fieldRequired:"هذا الحقل مطلوب",invalidFormat:"تنسيق غير صالح",minLength:e=>`الحد الأدنى ${e} حرفًا`,maxLength:e=>`الحد الأقصى ${e} حرفًا`,minValue:e=>`الحد الأدنى ${e}`,maxValue:e=>`الحد الأقصى ${e}`,noRows:"لا توجد صفوف",resetFilters:"إعادة ضبط الفلاتر"},"he-IL":{close:"סגור",cancel:"ביטול",confirm:"אישור",save:"שמור",delete:"מחק",search:"חיפוש",loading:"טוען...",noResults:"לא נמצאו תוצאות",required:"חובה",previous:"הקודם",next:"הבא",pageOf:(e,t)=>`עמוד ${e} מתוך ${t}`,selectPlaceholder:"בחר...",clearSelection:"נקה בחירה",selectDate:"בחר תאריך",today:"היום",dropFiles:"גרור קבצים לכאן או",browse:"עיון",noData:"אין נתונים",sortAscending:"מיון עולה",sortDescending:"מיון יורד",filterPlaceholder:"סינון...",exportCsv:"ייצוא CSV",rowsSelected:e=>`נבחרו ${e} שורות`,firstPage:"עמוד ראשון",lastPage:"עמוד אחרון",previousPage:"עמוד קודם",nextPage:"עמוד הבא",showingRange:(e,t,n)=>`מציג ${e}–${t} מתוך ${n}`,itemsPerPage:"לעמוד",uploadFiles:"העלאת קבצים",yesterday:"אתמול",last7Days:"7 ימים אחרונים",last30Days:"30 ימים אחרונים",thisMonth:"החודש",lastMonth:"החודש שעבר",notifications:"התראות",commandSearch:"הקלד פקודה או חפש…",noCommandsFound:"לא נמצאו פקודות",closeDrawer:"סגור פאנל",fieldRequired:"שדה זה הוא חובה",invalidFormat:"פורמט לא חוקי",minLength:e=>`מינימום ${e} תווים`,maxLength:e=>`מקסימום ${e} תווים`,minValue:e=>`מינימום ${e}`,maxValue:e=>`מקסימום ${e}`,noRows:"אין שורות",resetFilters:"איפוס מסננים"},"fa-IR":{close:"بستن",cancel:"لغو",confirm:"تأیید",save:"ذخیره",delete:"حذف",search:"جستجو",loading:"...در حال بارگذاری",noResults:"نتیجه‌ای یافت نشد",required:"الزامی",previous:"قبلی",next:"بعدی",pageOf:(e,t)=>`صفحه ${e} از ${t}`,selectPlaceholder:"...انتخاب کنید",clearSelection:"پاک کردن انتخاب",selectDate:"تاریخ را انتخاب کنید",today:"امروز",dropFiles:"فایل‌ها را اینجا رها کنید یا",browse:"مرور",noData:"داده‌ای موجود نیست",sortAscending:"مرتب‌سازی صعودی",sortDescending:"مرتب‌سازی نزولی",filterPlaceholder:"...فیلتر",exportCsv:"خروجی CSV",rowsSelected:e=>`${e} ردیف انتخاب شده`,firstPage:"صفحه اول",lastPage:"صفحه آخر",previousPage:"صفحه قبل",nextPage:"صفحه بعد",showingRange:(e,t,n)=>`نمایش ${e}–${t} از ${n}`,itemsPerPage:"در هر صفحه",uploadFiles:"آپلود فایل‌ها",yesterday:"دیروز",last7Days:"۷ روز گذشته",last30Days:"۳۰ روز گذشته",thisMonth:"این ماه",lastMonth:"ماه گذشته",notifications:"اعلان‌ها",commandSearch:"دستور را تایپ یا جستجو کنید…",noCommandsFound:"هیچ دستوری یافت نشد",closeDrawer:"بستن پنل",fieldRequired:"این فیلد الزامی است",invalidFormat:"فرمت نامعتبر",minLength:e=>`حداقل ${e} کاراکتر`,maxLength:e=>`حداکثر ${e} کاراکتر`,minValue:e=>`حداقل ${e}`,maxValue:e=>`حداکثر ${e}`,noRows:"هیچ ردیفی نیست",resetFilters:"بازنشانی فیلترها"},"ja-JP":{close:"閉じる",cancel:"キャンセル",confirm:"確認",save:"保存",delete:"削除",search:"検索",loading:"読み込み中...",noResults:"結果が見つかりません",required:"必須",previous:"前へ",next:"次へ",pageOf:(e,t)=>`${t}ページ中${e}ページ`,selectPlaceholder:"選択...",clearSelection:"選択解除",selectDate:"日付を選択",today:"今日",dropFiles:"ファイルをドロップまたは",browse:"参照",noData:"データなし",sortAscending:"昇順",sortDescending:"降順",filterPlaceholder:"フィルター...",exportCsv:"CSVエクスポート",rowsSelected:e=>`${e}行選択中`,firstPage:"最初のページ",lastPage:"最後のページ",previousPage:"前のページ",nextPage:"次のページ",showingRange:(e,t,n)=>`${n}件中 ${e}–${t}件を表示`,itemsPerPage:"ページあたり",uploadFiles:"ファイルをアップロード",yesterday:"昨日",last7Days:"過去7日間",last30Days:"過去30日間",thisMonth:"今月",lastMonth:"先月",notifications:"通知",commandSearch:"コマンドを入力するか検索…",noCommandsFound:"コマンドが見つかりません",closeDrawer:"パネルを閉じる",fieldRequired:"この項目は必須です",invalidFormat:"無効な形式",minLength:e=>`${e}文字以上で入力してください`,maxLength:e=>`${e}文字以内で入力してください`,minValue:e=>`${e}以上`,maxValue:e=>`${e}以下`,noRows:"行がありません",resetFilters:"フィルターをリセット"},"ko-KR":{close:"닫기",cancel:"취소",confirm:"확인",save:"저장",delete:"삭제",search:"검색",loading:"로딩 중...",noResults:"검색 결과 없음",required:"필수",previous:"이전",next:"다음",pageOf:(e,t)=>`${t}페이지 중 ${e}페이지`,selectPlaceholder:"선택...",clearSelection:"선택 해제",selectDate:"날짜 선택",today:"오늘",dropFiles:"여기에 파일을 놓거나",browse:"찾아보기",noData:"데이터 없음",sortAscending:"오름차순 정렬",sortDescending:"내림차순 정렬",filterPlaceholder:"필터...",exportCsv:"CSV 내보내기",rowsSelected:e=>`${e}개 행 선택됨`,firstPage:"첫 페이지",lastPage:"마지막 페이지",previousPage:"이전 페이지",nextPage:"다음 페이지",showingRange:(e,t,n)=>`총 ${n}개 중 ${e}–${t}개 표시`,itemsPerPage:"페이지당",uploadFiles:"파일 업로드",yesterday:"어제",last7Days:"지난 7일",last30Days:"지난 30일",thisMonth:"이번 달",lastMonth:"지난달",notifications:"알림",commandSearch:"명령을 입력하거나 검색…",noCommandsFound:"명령을 찾을 수 없음",closeDrawer:"패널 닫기",fieldRequired:"이 필드는 필수입니다",invalidFormat:"잘못된 형식",minLength:e=>`최소 ${e}자`,maxLength:e=>`최대 ${e}자`,minValue:e=>`최소 ${e}`,maxValue:e=>`최대 ${e}`,noRows:"행 없음",resetFilters:"필터 재설정"},"zh-CN":{close:"关闭",cancel:"取消",confirm:"确认",save:"保存",delete:"删除",search:"搜索",loading:"加载中...",noResults:"未找到结果",required:"必填",previous:"上一页",next:"下一页",pageOf:(e,t)=>`第 ${e} 页,共 ${t} 页`,selectPlaceholder:"请选择...",clearSelection:"清除选择",selectDate:"选择日期",today:"今天",dropFiles:"将文件拖到此处或",browse:"浏览",noData:"暂无数据",sortAscending:"升序排列",sortDescending:"降序排列",filterPlaceholder:"筛选...",exportCsv:"导出 CSV",rowsSelected:e=>`已选择 ${e} 行`,firstPage:"第一页",lastPage:"最后一页",previousPage:"上一页",nextPage:"下一页",showingRange:(e,t,n)=>`显示 ${e}–${t} 项,共 ${n} 项`,itemsPerPage:"每页",uploadFiles:"上传文件",yesterday:"昨天",last7Days:"最近 7 天",last30Days:"最近 30 天",thisMonth:"本月",lastMonth:"上个月",notifications:"通知",commandSearch:"输入命令或搜索…",noCommandsFound:"未找到命令",closeDrawer:"关闭面板",fieldRequired:"此字段为必填项",invalidFormat:"格式无效",minLength:e=>`至少 ${e} 个字符`,maxLength:e=>`最多 ${e} 个字符`,minValue:e=>`最小 ${e}`,maxValue:e=>`最大 ${e}`,noRows:"无数据",resetFilters:"重置筛选"},"zh-TW":{close:"關閉",cancel:"取消",confirm:"確認",save:"儲存",delete:"刪除",search:"搜尋",loading:"載入中...",noResults:"未找到結果",required:"必填",previous:"上一頁",next:"下一頁",pageOf:(e,t)=>`第 ${e} 頁,共 ${t} 頁`,selectPlaceholder:"請選擇...",clearSelection:"清除選擇",selectDate:"選擇日期",today:"今天",dropFiles:"將檔案拖曳至此或",browse:"瀏覽",noData:"暫無資料",sortAscending:"升冪排列",sortDescending:"降冪排列",filterPlaceholder:"篩選...",exportCsv:"匯出 CSV",rowsSelected:e=>`已選擇 ${e} 行`,firstPage:"第一頁",lastPage:"最後一頁",previousPage:"上一頁",nextPage:"下一頁",showingRange:(e,t,n)=>`顯示 ${e}–${t} 項,共 ${n} 項`,itemsPerPage:"每頁",uploadFiles:"上傳檔案",yesterday:"昨天",last7Days:"最近 7 天",last30Days:"最近 30 天",thisMonth:"本月",lastMonth:"上個月",notifications:"通知",commandSearch:"輸入命令或搜尋…",noCommandsFound:"找不到命令",closeDrawer:"關閉面板",fieldRequired:"此欄位為必填",invalidFormat:"格式無效",minLength:e=>`至少 ${e} 個字元`,maxLength:e=>`最多 ${e} 個字元`,minValue:e=>`最小 ${e}`,maxValue:e=>`最大 ${e}`,noRows:"無資料",resetFilters:"重設篩選"},"th-TH":{close:"ปิด",cancel:"ยกเลิก",confirm:"ยืนยัน",save:"บันทึก",delete:"ลบ",search:"ค้นหา",loading:"กำลังโหลด...",noResults:"ไม่พบผลลัพธ์",required:"จำเป็น",previous:"ก่อนหน้า",next:"ถัดไป",pageOf:(e,t)=>`หน้า ${e} จาก ${t}`,selectPlaceholder:"เลือก...",clearSelection:"ล้างการเลือก",selectDate:"เลือกวันที่",today:"วันนี้",dropFiles:"วางไฟล์ที่นี่หรือ",browse:"เรียกดู",noData:"ไม่มีข้อมูล",sortAscending:"เรียงจากน้อยไปมาก",sortDescending:"เรียงจากมากไปน้อย",filterPlaceholder:"กรอง...",exportCsv:"ส่งออก CSV",rowsSelected:e=>`เลือก ${e} แถว`,firstPage:"หน้าแรก",lastPage:"หน้าสุดท้าย",previousPage:"หน้าก่อนหน้า",nextPage:"หน้าถัดไป",showingRange:(e,t,n)=>`แสดง ${e}–${t} จาก ${n}`,itemsPerPage:"ต่อหน้า",uploadFiles:"อัปโหลดไฟล์",yesterday:"เมื่อวาน",last7Days:"7 วันที่ผ่านมา",last30Days:"30 วันที่ผ่านมา",thisMonth:"เดือนนี้",lastMonth:"เดือนที่แล้ว",notifications:"การแจ้งเตือน",commandSearch:"พิมพ์คำสั่งหรือค้นหา…",noCommandsFound:"ไม่พบคำสั่ง",closeDrawer:"ปิดแผง",fieldRequired:"ช่องนี้จำเป็นต้องกรอก",invalidFormat:"รูปแบบไม่ถูกต้อง",minLength:e=>`อย่างน้อย ${e} ตัวอักษร`,maxLength:e=>`ไม่เกิน ${e} ตัวอักษร`,minValue:e=>`อย่างน้อย ${e}`,maxValue:e=>`ไม่เกิน ${e}`,noRows:"ไม่มีแถว",resetFilters:"รีเซ็ตตัวกรอง"},"vi-VN":{close:"Đóng",cancel:"Hủy",confirm:"Xác nhận",save:"Lưu",delete:"Xóa",search:"Tìm kiếm",loading:"Đang tải...",noResults:"Không tìm thấy kết quả",required:"Bắt buộc",previous:"Trước",next:"Tiếp",pageOf:(e,t)=>`Trang ${e} / ${t}`,selectPlaceholder:"Chọn...",clearSelection:"Xóa lựa chọn",selectDate:"Chọn ngày",today:"Hôm nay",dropFiles:"Thả tệp vào đây hoặc",browse:"Duyệt",noData:"Không có dữ liệu",sortAscending:"Sắp xếp tăng dần",sortDescending:"Sắp xếp giảm dần",filterPlaceholder:"Lọc...",exportCsv:"Xuất CSV",rowsSelected:e=>`Đã chọn ${e} hàng`,firstPage:"Trang đầu",lastPage:"Trang cuối",previousPage:"Trang trước",nextPage:"Trang sau",showingRange:(e,t,n)=>`Hiển thị ${e}–${t} trong ${n}`,itemsPerPage:"Mỗi trang",uploadFiles:"Tải lên tệp",yesterday:"Hôm qua",last7Days:"7 ngày qua",last30Days:"30 ngày qua",thisMonth:"Tháng này",lastMonth:"Tháng trước",notifications:"Thông báo",commandSearch:"Nhập lệnh hoặc tìm kiếm…",noCommandsFound:"Không tìm thấy lệnh",closeDrawer:"Đóng bảng",fieldRequired:"Trường này là bắt buộc",invalidFormat:"Định dạng không hợp lệ",minLength:e=>`Tối thiểu ${e} ký tự`,maxLength:e=>`Tối đa ${e} ký tự`,minValue:e=>`Tối thiểu ${e}`,maxValue:e=>`Tối đa ${e}`,noRows:"Không có hàng",resetFilters:"Đặt lại bộ lọc"},"id-ID":{close:"Tutup",cancel:"Batal",confirm:"Konfirmasi",save:"Simpan",delete:"Hapus",search:"Cari",loading:"Memuat...",noResults:"Tidak ada hasil",required:"Wajib",previous:"Sebelumnya",next:"Berikutnya",pageOf:(e,t)=>`Halaman ${e} dari ${t}`,selectPlaceholder:"Pilih...",clearSelection:"Hapus pilihan",selectDate:"Pilih tanggal",today:"Hari ini",dropFiles:"Seret file ke sini atau",browse:"Jelajahi",noData:"Tidak ada data",sortAscending:"Urutkan naik",sortDescending:"Urutkan turun",filterPlaceholder:"Filter...",exportCsv:"Ekspor CSV",rowsSelected:e=>`${e} baris dipilih`,firstPage:"Halaman pertama",lastPage:"Halaman terakhir",previousPage:"Halaman sebelumnya",nextPage:"Halaman berikutnya",showingRange:(e,t,n)=>`Menampilkan ${e}–${t} dari ${n}`,itemsPerPage:"Per halaman",uploadFiles:"Unggah berkas",yesterday:"Kemarin",last7Days:"7 hari terakhir",last30Days:"30 hari terakhir",thisMonth:"Bulan ini",lastMonth:"Bulan lalu",notifications:"Notifikasi",commandSearch:"Ketik perintah atau cari…",noCommandsFound:"Tidak ada perintah ditemukan",closeDrawer:"Tutup panel",fieldRequired:"Bidang ini wajib diisi",invalidFormat:"Format tidak valid",minLength:e=>`Minimal ${e} karakter`,maxLength:e=>`Maksimal ${e} karakter`,minValue:e=>`Minimal ${e}`,maxValue:e=>`Maksimal ${e}`,noRows:"Tidak ada baris",resetFilters:"Atur ulang filter"},"ro-RO":{close:"Închide",cancel:"Anulează",confirm:"Confirmă",save:"Salvează",delete:"Șterge",search:"Caută",loading:"Se încarcă...",noResults:"Nu s-au găsit rezultate",required:"Obligatoriu",previous:"Anterior",next:"Următor",pageOf:(e,t)=>`Pagina ${e} din ${t}`,selectPlaceholder:"Selectați...",clearSelection:"Șterge selecția",selectDate:"Selectați o dată",today:"Astăzi",dropFiles:"Trageți fișierele aici sau",browse:"Răsfoiți",noData:"Nu există date",sortAscending:"Sortare crescătoare",sortDescending:"Sortare descrescătoare",filterPlaceholder:"Filtrați...",exportCsv:"Exportați CSV",rowsSelected:e=>`${e} rând${1===e?"":"uri"} selectat${1===e?"":"e"}`,firstPage:"Prima pagină",lastPage:"Ultima pagină",previousPage:"Pagina anterioară",nextPage:"Pagina următoare",showingRange:(e,t,n)=>`Se afișează ${e}–${t} din ${n}`,itemsPerPage:"Pe pagină",uploadFiles:"Încărcare fișiere",yesterday:"Ieri",last7Days:"Ultimele 7 zile",last30Days:"Ultimele 30 de zile",thisMonth:"Această lună",lastMonth:"Luna trecută",notifications:"Notificări",commandSearch:"Tastați o comandă sau căutați…",noCommandsFound:"Nu s-au găsit comenzi",closeDrawer:"Închidere panou",fieldRequired:"Acest câmp este obligatoriu",invalidFormat:"Format invalid",minLength:e=>`Minim ${e} caractere`,maxLength:e=>`Maxim ${e} caractere`,minValue:e=>`Minim ${e}`,maxValue:e=>`Maxim ${e}`,noRows:"Niciun rând",resetFilters:"Resetare filtre"},"hi-IN":{close:"बंद करें",cancel:"रद्द करें",confirm:"पुष्टि करें",save:"सहेजें",delete:"हटाएँ",search:"खोजें",loading:"लोड हो रहा है...",noResults:"कोई परिणाम नहीं मिला",required:"आवश्यक",previous:"पिछला",next:"अगला",pageOf:(e,t)=>`पृष्ठ ${e} / ${t}`,selectPlaceholder:"चुनें...",clearSelection:"चयन साफ़ करें",selectDate:"दिनांक चुनें",today:"आज",dropFiles:"यहाँ फ़ाइलें छोड़ें या",browse:"ब्राउज़ करें",noData:"कोई डेटा उपलब्ध नहीं",sortAscending:"आरोही क्रम में",sortDescending:"अवरोही क्रम में",filterPlaceholder:"फ़िल्टर...",exportCsv:"CSV निर्यात करें",rowsSelected:e=>`${e} पंक्ति${1===e?"":"याँ"} चयनित`,firstPage:"पहला पृष्ठ",lastPage:"अंतिम पृष्ठ",previousPage:"पिछला पृष्ठ",nextPage:"अगला पृष्ठ",showingRange:(e,t,n)=>`${n} में से ${e}–${t} दिखा रहे हैं`,itemsPerPage:"प्रति पृष्ठ",uploadFiles:"फ़ाइलें अपलोड करें",yesterday:"कल",last7Days:"पिछले 7 दिन",last30Days:"पिछले 30 दिन",thisMonth:"इस महीने",lastMonth:"पिछले महीने",notifications:"सूचनाएँ",commandSearch:"कमांड खोजें या टाइप करें…",noCommandsFound:"कोई कमांड नहीं मिली",closeDrawer:"पैनल बंद करें",fieldRequired:"यह फ़ील्ड आवश्यक है",invalidFormat:"अमान्य प्रारूप",minLength:e=>`कम से कम ${e} वर्ण होने चाहिए`,maxLength:e=>`${e} वर्णों से अधिक नहीं हो सकते`,minValue:e=>`${e} या उससे अधिक होना चाहिए`,maxValue:e=>`${e} या उससे कम होना चाहिए`,noRows:"कोई पंक्ति नहीं",resetFilters:"फ़िल्टर रीसेट करें"},"mr-IN":{close:"बंद करा",cancel:"रद्द करा",confirm:"पुष्टी करा",save:"जतन करा",delete:"हटवा",search:"शोधा",loading:"लोड होत आहे...",noResults:"कोणतेही परिणाम सापडले नाहीत",required:"आवश्यक",previous:"मागील",next:"पुढील",pageOf:(e,t)=>`पृष्ठ ${e} / ${t}`,selectPlaceholder:"निवडा...",clearSelection:"निवड साफ करा",selectDate:"तारीख निवडा",today:"आज",dropFiles:"फाइल्स येथे टाका किंवा",browse:"ब्राउझ करा",noData:"डेटा उपलब्ध नाही",sortAscending:"चढत्या क्रमाने",sortDescending:"उतरत्या क्रमाने",filterPlaceholder:"फिल्टर...",exportCsv:"CSV निर्यात करा",rowsSelected:e=>`${e} पंक्ती निवडली${1===e?"":"या"}`,firstPage:"पहिले पृष्ठ",lastPage:"शेवटचे पृष्ठ",previousPage:"मागील पृष्ठ",nextPage:"पुढील पृष्ठ",showingRange:(e,t,n)=>`${n} पैकी ${e}–${t} दाखवत आहे`,itemsPerPage:"प्रति पृष्ठ",uploadFiles:"फाइल्स अपलोड करा",yesterday:"काल",last7Days:"गेले 7 दिवस",last30Days:"गेले 30 दिवस",thisMonth:"हा महिना",lastMonth:"मागील महिना",notifications:"सूचना",commandSearch:"आदेश टाइप करा किंवा शोधा…",noCommandsFound:"कोणतेही आदेश सापडले नाहीत",closeDrawer:"पॅनेल बंद करा",fieldRequired:"हे फील्ड आवश्यक आहे",invalidFormat:"अवैध स्वरूप",minLength:e=>`किमान ${e} अक्षरे असणे आवश्यक`,maxLength:e=>`${e} अक्षरांपेक्षा जास्त नसावी`,minValue:e=>`किमान ${e}`,maxValue:e=>`कमाल ${e}`,noRows:"कोणत्याही पंक्ती नाहीत",resetFilters:"फिल्टर रीसेट करा"},"bn-IN":{close:"বন্ধ করুন",cancel:"বাতিল",confirm:"নিশ্চিত করুন",save:"সংরক্ষণ",delete:"মুছুন",search:"খুঁজুন",loading:"লোড হচ্ছে...",noResults:"কোনো ফলাফল পাওয়া যায়নি",required:"আবশ্যক",previous:"পূর্ববর্তী",next:"পরবর্তী",pageOf:(e,t)=>`পৃষ্ঠা ${e} / ${t}`,selectPlaceholder:"নির্বাচন করুন...",clearSelection:"নির্বাচন মুছুন",selectDate:"তারিখ নির্বাচন",today:"আজ",dropFiles:"এখানে ফাইল ছাড়ুন বা",browse:"ব্রাউজ",noData:"কোনো ডেটা নেই",sortAscending:"ক্রমবর্ধমান",sortDescending:"ক্রমহ্রাসমান",filterPlaceholder:"ফিল্টার...",exportCsv:"CSV রপ্তানি",rowsSelected:e=>`${e}টি সারি নির্বাচিত`,firstPage:"প্রথম পৃষ্ঠা",lastPage:"শেষ পৃষ্ঠা",previousPage:"পূর্ববর্তী পৃষ্ঠা",nextPage:"পরবর্তী পৃষ্ঠা",showingRange:(e,t,n)=>`${n}টির মধ্যে ${e}–${t} দেখাচ্ছে`,itemsPerPage:"প্রতি পৃষ্ঠায়",uploadFiles:"ফাইল আপলোড",yesterday:"গতকাল",last7Days:"গত 7 দিন",last30Days:"গত 30 দিন",thisMonth:"এই মাস",lastMonth:"গত মাস",notifications:"বিজ্ঞপ্তি",commandSearch:"কমান্ড টাইপ বা অনুসন্ধান করুন…",noCommandsFound:"কোনো কমান্ড পাওয়া যায়নি",closeDrawer:"প্যানেল বন্ধ",fieldRequired:"এই ক্ষেত্রটি প্রয়োজন",invalidFormat:"অবৈধ ফর্ম্যাট",minLength:e=>`কমপক্ষে ${e}টি অক্ষর`,maxLength:e=>`সর্বাধিক ${e}টি অক্ষর`,minValue:e=>`কমপক্ষে ${e}`,maxValue:e=>`সর্বাধিক ${e}`,noRows:"কোনো সারি নেই",resetFilters:"ফিল্টার রিসেট"},"ta-IN":{close:"மூடு",cancel:"ரத்து",confirm:"உறுதிப்படுத்து",save:"சேமி",delete:"நீக்கு",search:"தேடு",loading:"ஏற்றுகிறது...",noResults:"முடிவுகள் இல்லை",required:"தேவை",previous:"முந்தைய",next:"அடுத்து",pageOf:(e,t)=>`பக்கம் ${e} / ${t}`,selectPlaceholder:"தேர்ந்தெடு...",clearSelection:"அழி",selectDate:"தேதி தேர்ந்தெடு",today:"இன்று",dropFiles:"இங்கே கோப்புகளை விடவும் அல்லது",browse:"உலாவு",noData:"தரவு இல்லை",sortAscending:"ஏறுவரிசை",sortDescending:"இறங்குவரிசை",filterPlaceholder:"வடிகட்டு...",exportCsv:"CSV ஏற்றுமதி",rowsSelected:e=>`${e} வரிசை${1===e?"":"கள்"} தேர்ந்தெடுக்கப்பட்டது`,firstPage:"முதல் பக்கம்",lastPage:"கடைசி பக்கம்",previousPage:"முந்தைய பக்கம்",nextPage:"அடுத்த பக்கம்",showingRange:(e,t,n)=>`${n}-ல் ${e}–${t} காட்டப்படுகிறது`,itemsPerPage:"பக்கத்திற்கு",uploadFiles:"கோப்புகளை பதிவேற்று",yesterday:"நேற்று",last7Days:"கடந்த 7 நாட்கள்",last30Days:"கடந்த 30 நாட்கள்",thisMonth:"இந்த மாதம்",lastMonth:"கடந்த மாதம்",notifications:"அறிவிப்புகள்",commandSearch:"கட்டளை தட்டச்சு செய்யவும் அல்லது தேடவும்…",noCommandsFound:"கட்டளைகள் இல்லை",closeDrawer:"பலகத்தை மூடு",fieldRequired:"இந்த புலம் அவசியம்",invalidFormat:"தவறான வடிவம்",minLength:e=>`குறைந்தது ${e} எழுத்துகள்`,maxLength:e=>`அதிகபட்சம் ${e} எழுத்துகள்`,minValue:e=>`குறைந்தது ${e}`,maxValue:e=>`அதிகபட்சம் ${e}`,noRows:"வரிசைகள் இல்லை",resetFilters:"வடிகட்டிகளை மீட்டமை"},"te-IN":{close:"మూసివేయి",cancel:"రద్దు",confirm:"నిర్ధారించు",save:"సేవ్",delete:"తొలగించు",search:"వెతుకు",loading:"లోడ్ అవుతోంది...",noResults:"ఫలితాలు లేవు",required:"అవసరం",previous:"మునుపటి",next:"తరువాత",pageOf:(e,t)=>`పేజీ ${e} / ${t}`,selectPlaceholder:"ఎంచుకోండి...",clearSelection:"ఎంపిక క్లియర్",selectDate:"తేదీ ఎంచుకోండి",today:"నేడు",dropFiles:"ఇక్కడ ఫైల్‌లను వదలండి లేదా",browse:"బ్రౌజ్",noData:"డేటా అందుబాటులో లేదు",sortAscending:"ఆరోహణ",sortDescending:"అవరోహణ",filterPlaceholder:"ఫిల్టర్...",exportCsv:"CSV ఎగుమతి",rowsSelected:e=>`${e} అడ్డువరుస${1===e?"":"లు"} ఎంచుకోబడ్డాయి`,firstPage:"మొదటి పేజీ",lastPage:"చివరి పేజీ",previousPage:"మునుపటి పేజీ",nextPage:"తదుపరి పేజీ",showingRange:(e,t,n)=>`${n}లో ${e}–${t} చూపుతోంది`,itemsPerPage:"పేజీకి",uploadFiles:"ఫైల్‌లను అప్‌లోడ్ చేయండి",yesterday:"నిన్న",last7Days:"గత 7 రోజులు",last30Days:"గత 30 రోజులు",thisMonth:"ఈ నెల",lastMonth:"గత నెల",notifications:"నోటిఫికేషన్‌లు",commandSearch:"ఆదేశాన్ని టైప్ చేయండి లేదా శోధించండి…",noCommandsFound:"ఆదేశాలు కనుగొనబడలేదు",closeDrawer:"ప్యానెల్‌ను మూసివేయండి",fieldRequired:"ఈ ఫీల్డ్ తప్పనిసరి",invalidFormat:"చెల్లని ఫార్మాట్",minLength:e=>`కనీసం ${e} అక్షరాలు`,maxLength:e=>`గరిష్టంగా ${e} అక్షరాలు`,minValue:e=>`కనీసం ${e}`,maxValue:e=>`గరిష్టంగా ${e}`,noRows:"వరుసలు లేవు",resetFilters:"ఫిల్టర్‌లను రీసెట్ చేయండి"},"gu-IN":{close:"બંધ",cancel:"રદ",confirm:"પુષ્ટિ",save:"સાચવો",delete:"કાઢી નાંખો",search:"શોધો",loading:"લોડ થઈ રહ્યું છે...",noResults:"કોઈ પરિણામ મળ્યું નથી",required:"આવશ્યક",previous:"પાછલું",next:"આગલું",pageOf:(e,t)=>`પૃષ્ઠ ${e} / ${t}`,selectPlaceholder:"પસંદ કરો...",clearSelection:"પસંદગી સાફ",selectDate:"તારીખ પસંદ કરો",today:"આજે",dropFiles:"અહીં ફાઇલો છોડો અથવા",browse:"બ્રાઉઝ",noData:"કોઈ ડેટા ઉપલબ્ધ નથી",sortAscending:"ચઢતા ક્રમ",sortDescending:"ઉતરતા ક્રમ",filterPlaceholder:"ફિલ્ટર...",exportCsv:"CSV નિકાસ",rowsSelected:e=>`${e} પંક્તિ${1===e?"":"ઓ"} પસંદ`,firstPage:"પ્રથમ પૃષ્ઠ",lastPage:"છેલ્લું પૃષ્ઠ",previousPage:"પાછલું પૃષ્ઠ",nextPage:"આગલું પૃષ્ઠ",showingRange:(e,t,n)=>`${n} માંથી ${e}–${t} બતાવી રહ્યું છે`,itemsPerPage:"પ્રતિ પૃષ્ઠ",uploadFiles:"ફાઇલો અપલોડ કરો",yesterday:"ગઈ કાલે",last7Days:"છેલ્લા 7 દિવસ",last30Days:"છેલ્લા 30 દિવસ",thisMonth:"આ મહિને",lastMonth:"ગયા મહિને",notifications:"સૂચનાઓ",commandSearch:"આદેશ લખો અથવા શોધો…",noCommandsFound:"કોઈ આદેશ મળ્યો નથી",closeDrawer:"પેનલ બંધ કરો",fieldRequired:"આ ફીલ્ડ આવશ્યક છે",invalidFormat:"અમાન્ય ફોર્મેટ",minLength:e=>`ઓછામાં ઓછા ${e} અક્ષરો`,maxLength:e=>`વધુમાં વધુ ${e} અક્ષરો`,minValue:e=>`ઓછામાં ઓછું ${e}`,maxValue:e=>`વધુમાં વધુ ${e}`,noRows:"કોઈ પંક્તિ નથી",resetFilters:"ફિલ્ટર્સ રીસેટ કરો"},"pa-IN":{close:"ਬੰਦ ਕਰੋ",cancel:"ਰੱਦ ਕਰੋ",confirm:"ਪੁਸ਼ਟੀ ਕਰੋ",save:"ਸੰਭਾਲੋ",delete:"ਮਿਟਾਓ",search:"ਖੋਜੋ",loading:"ਲੋਡ ਹੋ ਰਿਹਾ...",noResults:"ਕੋਈ ਨਤੀਜਾ ਨਹੀਂ ਮਿਲਿਆ",required:"ਲੋੜੀਂਦਾ",previous:"ਪਿਛਲਾ",next:"ਅਗਲਾ",pageOf:(e,t)=>`ਪੰਨਾ ${e} / ${t}`,selectPlaceholder:"ਚੁਣੋ...",clearSelection:"ਚੋਣ ਸਾਫ਼",selectDate:"ਮਿਤੀ ਚੁਣੋ",today:"ਅੱਜ",dropFiles:"ਇੱਥੇ ਫਾਈਲਾਂ ਛੱਡੋ ਜਾਂ",browse:"ਬ੍ਰਾਊਜ਼",noData:"ਕੋਈ ਡਾਟਾ ਉਪਲਬਧ ਨਹੀਂ",sortAscending:"ਚੜ੍ਹਦੇ ਕ੍ਰਮ",sortDescending:"ਉਤਰਦੇ ਕ੍ਰਮ",filterPlaceholder:"ਫਿਲਟਰ...",exportCsv:"CSV ਨਿਰਯਾਤ",rowsSelected:e=>`${e} ਕਤਾਰ${1===e?"":"ਾਂ"} ਚੁਣੀਆਂ`,firstPage:"ਪਹਿਲਾ ਪੰਨਾ",lastPage:"ਆਖਰੀ ਪੰਨਾ",previousPage:"ਪਿਛਲਾ ਪੰਨਾ",nextPage:"ਅਗਲਾ ਪੰਨਾ",showingRange:(e,t,n)=>`${n} ਵਿੱਚੋਂ ${e}–${t} ਦਿਖਾ ਰਿਹਾ ਹੈ`,itemsPerPage:"ਪ੍ਰਤੀ ਪੰਨਾ",uploadFiles:"ਫਾਈਲਾਂ ਅੱਪਲੋਡ ਕਰੋ",yesterday:"ਕੱਲ੍ਹ",last7Days:"ਪਿਛਲੇ 7 ਦਿਨ",last30Days:"ਪਿਛਲੇ 30 ਦਿਨ",thisMonth:"ਇਸ ਮਹੀਨੇ",lastMonth:"ਪਿਛਲੇ ਮਹੀਨੇ",notifications:"ਸੂਚਨਾਵਾਂ",commandSearch:"ਕਮਾਂਡ ਟਾਈਪ ਕਰੋ ਜਾਂ ਖੋਜੋ…",noCommandsFound:"ਕੋਈ ਕਮਾਂਡ ਨਹੀਂ ਮਿਲੀ",closeDrawer:"ਪੈਨਲ ਬੰਦ ਕਰੋ",fieldRequired:"ਇਹ ਖੇਤਰ ਲੋੜੀਂਦਾ ਹੈ",invalidFormat:"ਅਵੈਧ ਫਾਰਮੈਟ",minLength:e=>`ਘੱਟੋ-ਘੱਟ ${e} ਅੱਖਰ`,maxLength:e=>`ਵੱਧ ਤੋਂ ਵੱਧ ${e} ਅੱਖਰ`,minValue:e=>`ਘੱਟੋ-ਘੱਟ ${e}`,maxValue:e=>`ਵੱਧ ਤੋਂ ਵੱਧ ${e}`,noRows:"ਕੋਈ ਕਤਾਰਾਂ ਨਹੀਂ",resetFilters:"ਫਿਲਟਰ ਰੀਸੈੱਟ ਕਰੋ"},"ur-PK":{close:"بند کریں",cancel:"منسوخ",confirm:"تصدیق",save:"محفوظ کریں",delete:"حذف کریں",search:"تلاش",loading:"لوڈ ہو رہا ہے...",noResults:"کوئی نتیجہ نہیں ملا",required:"ضروری",previous:"پچھلا",next:"اگلا",pageOf:(e,t)=>`صفحہ ${e} / ${t}`,selectPlaceholder:"منتخب کریں...",clearSelection:"انتخاب صاف کریں",selectDate:"تاریخ منتخب کریں",today:"آج",dropFiles:"یہاں فائلیں چھوڑیں یا",browse:"براؤز",noData:"کوئی ڈیٹا دستیاب نہیں",sortAscending:"صعودی ترتیب",sortDescending:"نزولی ترتیب",filterPlaceholder:"فلٹر...",exportCsv:"CSV برآمد",rowsSelected:e=>`${e} قطار${1===e?"":"یں"} منتخب`,firstPage:"پہلا صفحہ",lastPage:"آخری صفحہ",previousPage:"پچھلا صفحہ",nextPage:"اگلا صفحہ",showingRange:(e,t,n)=>`${n} میں سے ${e}–${t} دکھایا جا رہا ہے`,itemsPerPage:"فی صفحہ",uploadFiles:"فائلیں اپ لوڈ کریں",yesterday:"کل",last7Days:"پچھلے 7 دن",last30Days:"پچھلے 30 دن",thisMonth:"اس مہینے",lastMonth:"پچھلے مہینے",notifications:"اطلاعات",commandSearch:"کمانڈ ٹائپ کریں یا تلاش کریں…",noCommandsFound:"کوئی کمانڈ نہیں ملی",closeDrawer:"پینل بند کریں",fieldRequired:"یہ فیلڈ ضروری ہے",invalidFormat:"غلط فارمیٹ",minLength:e=>`کم از کم ${e} حروف`,maxLength:e=>`زیادہ سے زیادہ ${e} حروف`,minValue:e=>`کم از کم ${e}`,maxValue:e=>`زیادہ سے زیادہ ${e}`,noRows:"کوئی قطاریں نہیں",resetFilters:"فلٹر دوبارہ ترتیب دیں"},"bg-BG":{close:"Затвори",cancel:"Отказ",confirm:"Потвърди",save:"Запази",delete:"Изтрий",search:"Търсене",loading:"Зареждане...",noResults:"Няма намерени резултати",required:"Задължително",previous:"Предишна",next:"Следваща",pageOf:(e,t)=>`Страница ${e} от ${t}`,selectPlaceholder:"Изберете...",clearSelection:"Изчисти избора",selectDate:"Изберете дата",today:"Днес",dropFiles:"Пуснете файлове тук или",browse:"Прегледай",noData:"Няма налични данни",sortAscending:"Възходящо сортиране",sortDescending:"Низходящо сортиране",filterPlaceholder:"Филтър...",exportCsv:"Експортиране в CSV",rowsSelected:e=>`${e} ${1===e?"избран ред":"избрани реда"}`,firstPage:"Първа страница",lastPage:"Последна страница",previousPage:"Предишна страница",nextPage:"Следваща страница",showingRange:(e,t,n)=>`Показани ${e}–${t} от ${n}`,itemsPerPage:"На страница",uploadFiles:"Качване на файлове",yesterday:"Вчера",last7Days:"Последни 7 дни",last30Days:"Последни 30 дни",thisMonth:"Този месец",lastMonth:"Миналия месец",notifications:"Известия",commandSearch:"Въведете команда или потърсете…",noCommandsFound:"Няма намерени команди",closeDrawer:"Затвори панела",fieldRequired:"Това поле е задължително",invalidFormat:"Невалиден формат",minLength:e=>`Минимум ${e} символа`,maxLength:e=>`Максимум ${e} символа`,minValue:e=>`Минимум ${e}`,maxValue:e=>`Максимум ${e}`,noRows:"Няма редове",resetFilters:"Нулирай филтрите"},"hr-HR":{close:"Zatvori",cancel:"Odustani",confirm:"Potvrdi",save:"Spremi",delete:"Obriši",search:"Pretraži",loading:"Učitavanje...",noResults:"Nema pronađenih rezultata",required:"Obavezno",previous:"Prethodno",next:"Sljedeće",pageOf:(e,t)=>`Stranica ${e} od ${t}`,selectPlaceholder:"Odaberi...",clearSelection:"Obriši odabir",selectDate:"Odaberi datum",today:"Danas",dropFiles:"Ispustite datoteke ovdje ili",browse:"Pregledaj",noData:"Nema dostupnih podataka",sortAscending:"Uzlazno sortiranje",sortDescending:"Silazno sortiranje",filterPlaceholder:"Filtriraj...",exportCsv:"Izvezi CSV",rowsSelected:e=>`Odabrano ${e} ${1===e?"redak":"redaka"}`,firstPage:"Prva stranica",lastPage:"Posljednja stranica",previousPage:"Prethodna stranica",nextPage:"Sljedeća stranica",showingRange:(e,t,n)=>`Prikaz ${e}–${t} od ${n}`,itemsPerPage:"Po stranici",uploadFiles:"Prenesi datoteke",yesterday:"Jučer",last7Days:"Posljednjih 7 dana",last30Days:"Posljednjih 30 dana",thisMonth:"Ovaj mjesec",lastMonth:"Prošli mjesec",notifications:"Obavijesti",commandSearch:"Upišite naredbu ili pretražite…",noCommandsFound:"Nema pronađenih naredbi",closeDrawer:"Zatvori ploču",fieldRequired:"Ovo polje je obavezno",invalidFormat:"Neispravan format",minLength:e=>`Najmanje ${e} znakova`,maxLength:e=>`Najviše ${e} znakova`,minValue:e=>`Najmanje ${e}`,maxValue:e=>`Najviše ${e}`,noRows:"Nema redaka",resetFilters:"Poništi filtre"},"et-EE":{close:"Sulge",cancel:"Tühista",confirm:"Kinnita",save:"Salvesta",delete:"Kustuta",search:"Otsi",loading:"Laadimine...",noResults:"Tulemusi ei leitud",required:"Kohustuslik",previous:"Eelmine",next:"Järgmine",pageOf:(e,t)=>`Lehekülg ${e} / ${t}`,selectPlaceholder:"Vali...",clearSelection:"Tühjenda valik",selectDate:"Vali kuupäev",today:"Täna",dropFiles:"Lohista failid siia või",browse:"Sirvi",noData:"Andmeid pole",sortAscending:"Sorteeri kasvavalt",sortDescending:"Sorteeri kahanevalt",filterPlaceholder:"Filtreeri...",exportCsv:"Ekspordi CSV",rowsSelected:e=>`${e} rida valitud`,firstPage:"Esimene lehekülg",lastPage:"Viimane lehekülg",previousPage:"Eelmine lehekülg",nextPage:"Järgmine lehekülg",showingRange:(e,t,n)=>`Kuvatud ${e}–${t} kokku ${n}-st`,itemsPerPage:"Lehekülje kohta",uploadFiles:"Laadi failid üles",yesterday:"Eile",last7Days:"Viimased 7 päeva",last30Days:"Viimased 30 päeva",thisMonth:"See kuu",lastMonth:"Eelmine kuu",notifications:"Teavitused",commandSearch:"Sisesta käsk või otsi…",noCommandsFound:"Käske ei leitud",closeDrawer:"Sulge paneel",fieldRequired:"See väli on kohustuslik",invalidFormat:"Vigane vorming",minLength:e=>`Vähemalt ${e} tähemärki`,maxLength:e=>`Maksimaalselt ${e} tähemärki`,minValue:e=>`Vähemalt ${e}`,maxValue:e=>`Maksimaalselt ${e}`,noRows:"Ridu pole",resetFilters:"Lähtesta filtrid"},"fi-FI":{close:"Sulje",cancel:"Peruuta",confirm:"Vahvista",save:"Tallenna",delete:"Poista",search:"Hae",loading:"Ladataan...",noResults:"Ei tuloksia",required:"Pakollinen",previous:"Edellinen",next:"Seuraava",pageOf:(e,t)=>`Sivu ${e} / ${t}`,selectPlaceholder:"Valitse...",clearSelection:"Tyhjennä valinta",selectDate:"Valitse päivämäärä",today:"Tänään",dropFiles:"Pudota tiedostot tähän tai",browse:"Selaa",noData:"Ei tietoja",sortAscending:"Lajittele nousevasti",sortDescending:"Lajittele laskevasti",filterPlaceholder:"Suodata...",exportCsv:"Vie CSV",rowsSelected:e=>`${e} ${1===e?"rivi":"riviä"} valittu`,firstPage:"Ensimmäinen sivu",lastPage:"Viimeinen sivu",previousPage:"Edellinen sivu",nextPage:"Seuraava sivu",showingRange:(e,t,n)=>`Näytetään ${e}–${t} / ${n}`,itemsPerPage:"Sivua kohti",uploadFiles:"Lataa tiedostot",yesterday:"Eilen",last7Days:"Viimeiset 7 päivää",last30Days:"Viimeiset 30 päivää",thisMonth:"Tämä kuukausi",lastMonth:"Viime kuukausi",notifications:"Ilmoitukset",commandSearch:"Kirjoita komento tai hae…",noCommandsFound:"Komentoja ei löytynyt",closeDrawer:"Sulje paneeli",fieldRequired:"Tämä kenttä on pakollinen",invalidFormat:"Virheellinen muoto",minLength:e=>`Vähintään ${e} merkkiä`,maxLength:e=>`Enintään ${e} merkkiä`,minValue:e=>`Vähintään ${e}`,maxValue:e=>`Enintään ${e}`,noRows:"Ei rivejä",resetFilters:"Palauta suodattimet"},"lt-LT":{close:"Uždaryti",cancel:"Atšaukti",confirm:"Patvirtinti",save:"Išsaugoti",delete:"Ištrinti",search:"Ieškoti",loading:"Įkeliama...",noResults:"Rezultatų nerasta",required:"Privaloma",previous:"Ankstesnis",next:"Kitas",pageOf:(e,t)=>`Puslapis ${e} iš ${t}`,selectPlaceholder:"Pasirinkite...",clearSelection:"Išvalyti pasirinkimą",selectDate:"Pasirinkite datą",today:"Šiandien",dropFiles:"Nuvilkite failus čia arba",browse:"Naršyti",noData:"Duomenų nėra",sortAscending:"Rikiuoti didėjančiai",sortDescending:"Rikiuoti mažėjančiai",filterPlaceholder:"Filtruoti...",exportCsv:"Eksportuoti CSV",rowsSelected:e=>`Pasirinkta ${e} ${1===e?"eilutė":"eilučių"}`,firstPage:"Pirmas puslapis",lastPage:"Paskutinis puslapis",previousPage:"Ankstesnis puslapis",nextPage:"Kitas puslapis",showingRange:(e,t,n)=>`Rodoma ${e}–${t} iš ${n}`,itemsPerPage:"Puslapyje",uploadFiles:"Įkelti failus",yesterday:"Vakar",last7Days:"Paskutinės 7 dienos",last30Days:"Paskutinės 30 dienų",thisMonth:"Šis mėnuo",lastMonth:"Praėjęs mėnuo",notifications:"Pranešimai",commandSearch:"Įveskite komandą arba ieškokite…",noCommandsFound:"Komandų nerasta",closeDrawer:"Uždaryti skydelį",fieldRequired:"Šis laukas yra privalomas",invalidFormat:"Neteisingas formatas",minLength:e=>`Bent ${e} simbolių`,maxLength:e=>`Ne daugiau kaip ${e} simbolių`,minValue:e=>`Bent ${e}`,maxValue:e=>`Ne daugiau kaip ${e}`,noRows:"Eilučių nėra",resetFilters:"Atstatyti filtrus"},"lv-LV":{close:"Aizvērt",cancel:"Atcelt",confirm:"Apstiprināt",save:"Saglabāt",delete:"Dzēst",search:"Meklēt",loading:"Notiek ielāde...",noResults:"Rezultāti nav atrasti",required:"Obligāts",previous:"Iepriekšējais",next:"Nākamais",pageOf:(e,t)=>`Lapa ${e} no ${t}`,selectPlaceholder:"Izvēlieties...",clearSelection:"Notīrīt izvēli",selectDate:"Izvēlieties datumu",today:"Šodien",dropFiles:"Nometiet failus šeit vai",browse:"Pārlūkot",noData:"Nav pieejamu datu",sortAscending:"Kārtot augošā secībā",sortDescending:"Kārtot dilstošā secībā",filterPlaceholder:"Filtrēt...",exportCsv:"Eksportēt CSV",rowsSelected:e=>`Atlasītas ${e} ${1===e?"rinda":"rindas"}`,firstPage:"Pirmā lapa",lastPage:"Pēdējā lapa",previousPage:"Iepriekšējā lapa",nextPage:"Nākamā lapa",showingRange:(e,t,n)=>`Rāda ${e}–${t} no ${n}`,itemsPerPage:"Lapā",uploadFiles:"Augšupielādēt failus",yesterday:"Vakar",last7Days:"Pēdējās 7 dienas",last30Days:"Pēdējās 30 dienas",thisMonth:"Šis mēnesis",lastMonth:"Iepriekšējais mēnesis",notifications:"Paziņojumi",commandSearch:"Ievadiet komandu vai meklējiet…",noCommandsFound:"Komandas nav atrastas",closeDrawer:"Aizvērt paneli",fieldRequired:"Šis lauks ir obligāts",invalidFormat:"Nederīgs formāts",minLength:e=>`Vismaz ${e} rakstzīmes`,maxLength:e=>`Ne vairāk kā ${e} rakstzīmes`,minValue:e=>`Vismaz ${e}`,maxValue:e=>`Ne vairāk kā ${e}`,noRows:"Nav rindu",resetFilters:"Atiestatīt filtrus"},"sk-SK":{close:"Zavrieť",cancel:"Zrušiť",confirm:"Potvrdiť",save:"Uložiť",delete:"Odstrániť",search:"Hľadať",loading:"Načítava sa...",noResults:"Žiadne výsledky",required:"Povinné",previous:"Predchádzajúce",next:"Ďalšie",pageOf:(e,t)=>`Strana ${e} z ${t}`,selectPlaceholder:"Vyberte...",clearSelection:"Vymazať výber",selectDate:"Vyberte dátum",today:"Dnes",dropFiles:"Pretiahnite súbory sem alebo",browse:"Prehľadávať",noData:"Žiadne údaje",sortAscending:"Zoradiť vzostupne",sortDescending:"Zoradiť zostupne",filterPlaceholder:"Filtrovať...",exportCsv:"Exportovať CSV",rowsSelected:e=>`Vybraných ${e} riadkov`,firstPage:"Prvá strana",lastPage:"Posledná strana",previousPage:"Predchádzajúca strana",nextPage:"Ďalšia strana",showingRange:(e,t,n)=>`Zobrazené ${e}–${t} z ${n}`,itemsPerPage:"Na stranu",uploadFiles:"Nahrať súbory",yesterday:"Včera",last7Days:"Posledných 7 dní",last30Days:"Posledných 30 dní",thisMonth:"Tento mesiac",lastMonth:"Minulý mesiac",notifications:"Oznámenia",commandSearch:"Zadajte príkaz alebo hľadajte…",noCommandsFound:"Žiadne príkazy sa nenašli",closeDrawer:"Zavrieť panel",fieldRequired:"Toto pole je povinné",invalidFormat:"Neplatný formát",minLength:e=>`Minimálne ${e} znakov`,maxLength:e=>`Maximálne ${e} znakov`,minValue:e=>`Minimálne ${e}`,maxValue:e=>`Maximálne ${e}`,noRows:"Žiadne riadky",resetFilters:"Obnoviť filtre"},"sl-SI":{close:"Zapri",cancel:"Prekliči",confirm:"Potrdi",save:"Shrani",delete:"Izbriši",search:"Iskanje",loading:"Nalaganje...",noResults:"Ni najdenih rezultatov",required:"Obvezno",previous:"Prejšnje",next:"Naslednje",pageOf:(e,t)=>`Stran ${e} od ${t}`,selectPlaceholder:"Izberite...",clearSelection:"Počisti izbor",selectDate:"Izberite datum",today:"Danes",dropFiles:"Spustite datoteke sem ali",browse:"Prebrskaj",noData:"Ni razpoložljivih podatkov",sortAscending:"Razvrsti naraščajoče",sortDescending:"Razvrsti padajoče",filterPlaceholder:"Filtriraj...",exportCsv:"Izvozi CSV",rowsSelected:e=>`Izbranih ${e} vrstic`,firstPage:"Prva stran",lastPage:"Zadnja stran",previousPage:"Prejšnja stran",nextPage:"Naslednja stran",showingRange:(e,t,n)=>`Prikaz ${e}–${t} od ${n}`,itemsPerPage:"Na stran",uploadFiles:"Naloži datoteke",yesterday:"Včeraj",last7Days:"Zadnjih 7 dni",last30Days:"Zadnjih 30 dni",thisMonth:"Ta mesec",lastMonth:"Prejšnji mesec",notifications:"Obvestila",commandSearch:"Vnesite ukaz ali poiščite…",noCommandsFound:"Ni najdenih ukazov",closeDrawer:"Zapri ploščo",fieldRequired:"To polje je obvezno",invalidFormat:"Neveljavna oblika",minLength:e=>`Najmanj ${e} znakov`,maxLength:e=>`Največ ${e} znakov`,minValue:e=>`Najmanj ${e}`,maxValue:e=>`Največ ${e}`,noRows:"Ni vrstic",resetFilters:"Ponastavi filtre"},"nb-NO":{close:"Lukk",cancel:"Avbryt",confirm:"Bekreft",save:"Lagre",delete:"Slett",search:"Søk",loading:"Laster...",noResults:"Ingen resultater funnet",required:"Påkrevd",previous:"Forrige",next:"Neste",pageOf:(e,t)=>`Side ${e} av ${t}`,selectPlaceholder:"Velg...",clearSelection:"Fjern valg",selectDate:"Velg en dato",today:"I dag",dropFiles:"Slipp filer her eller",browse:"Bla gjennom",noData:"Ingen data tilgjengelig",sortAscending:"Sorter stigende",sortDescending:"Sorter synkende",filterPlaceholder:"Filtrer...",exportCsv:"Eksporter CSV",rowsSelected:e=>`${e} ${1===e?"rad":"rader"} valgt`,firstPage:"Første side",lastPage:"Siste side",previousPage:"Forrige side",nextPage:"Neste side",showingRange:(e,t,n)=>`Viser ${e}–${t} av ${n}`,itemsPerPage:"Per side",uploadFiles:"Last opp filer",yesterday:"I går",last7Days:"Siste 7 dager",last30Days:"Siste 30 dager",thisMonth:"Denne måneden",lastMonth:"Forrige måned",notifications:"Varsler",commandSearch:"Skriv en kommando eller søk…",noCommandsFound:"Ingen kommandoer funnet",closeDrawer:"Lukk panel",fieldRequired:"Dette feltet er påkrevd",invalidFormat:"Ugyldig format",minLength:e=>`Minst ${e} tegn`,maxLength:e=>`Maks ${e} tegn`,minValue:e=>`Minst ${e}`,maxValue:e=>`Maks ${e}`,noRows:"Ingen rader",resetFilters:"Tilbakestill filtre"}},Bt=new Set(["ar-SA","he-IL","fa-IR","ur-PK"]);function Vt(e){return Bt.has(e)}var Ht=(0,a.createContext)({locale:"en-US",direction:"ltr",strings:jt});function Ot(){return(0,a.useContext)(Ht).strings}var qt={sm:"400px",md:"560px",lg:"720px",full:"100vw"},Ut=0;function Kt(){--Ut<=0&&(Ut=0,document.body.style.overflow="")}var Yt=(0,a.createContext)(null);function Xt(){const e=(0,a.useContext)(Yt);if(!e)throw new Error("TkxTab must be used inside TkxTabs");return e}var Zt={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 Gt({variant:e,width:t,height:n,animation:r,bgColor:o,accentColor:i}){const a=void 0!==t?"number"==typeof t?`${t}px`:t:"100%",l=void 0!==n?"number"==typeof n?`${n}px`:n:{text:"1em",circular:a,rectangular:"80px"}[e],s=mt("circular"===e?"rounded-full":"text"===e?"rounded":"rounded-lg"),c="pulse"===r?mt("animate-pulse"):"wave"===r?mt("animate-shimmer"):"",u="wave"===r?{background:`linear-gradient(90deg,${o} 25%,${i} 50%,${o} 75%)`,backgroundSize:"200% 100%"}:{backgroundColor:o};return(0,d.jsx)("div",{className:xt(s,c),style:{width:a,height:l,...u}})}var _t=(0,a.forwardRef)(({variant:e="rectangular",width:t,height:n,lines:r,animation:o="pulse",className:i,style:a,...l},s)=>{const c=J(),u=!Te()&&o;return"text"===e&&r&&r>1?(0,d.jsx)("div",{ref:s,role:"progressbar","aria-busy":"true","aria-label":"Loading...",className:xt(mt("flex flex-col gap-2"),i),style:a,...l,children:Array.from({length:r},(e,o)=>(0,d.jsx)(Gt,{variant:"text",width:o===r-1?"75%":t,height:n,animation:u,bgColor:c.surfaceAlt,accentColor:c.border},o))}):(0,d.jsx)("div",{ref:s,role:"progressbar","aria-busy":"true","aria-label":"Loading...",className:i,style:a,...l,children:(0,d.jsx)(Gt,{variant:e,width:t,height:n,animation:u,bgColor:c.surfaceAlt,accentColor:c.border})})});_t.displayName="TkxSkeleton";var Jt={xs:24,sm:32,md:40,lg:56,xl:72},Qt={online:"#06d6a0",offline:"#8888aa",away:"#ffbe0b",busy:"#f72585"},en=(0,a.forwardRef)(({src:e,alt:t,initials:n,size:r="md",shape:o="circle",status:i,className:l,style:s,...c},u)=>{const p=J(),[h,f]=(0,a.useState)(!1),m=Jt[r],g="circle"===o,x=p.surfaceAlt,b=j(x,[p.text,p.textMuted]),y=e&&!h,v=!y&&n,w=Math.max(8,.22*m),k=mt("relative inline-flex shrink-0",g?"rounded-full":"rounded-lg"),$=mt("block object-cover",g?"rounded-full":"rounded-lg"),S=mt("flex items-center justify-center font-semibold font-sans select-none",g?"rounded-full":"rounded-lg");return(0,d.jsxs)("div",{ref:u,className:xt(k,l),style:{width:m,height:m,...s},...c,children:[y?(0,d.jsx)("img",{src:oe(e),alt:oe(t),onError:()=>f(!0),className:$,style:{width:m,height:m}}):(0,d.jsx)("div",{role:"img","aria-label":oe(t),className:S,style:{width:m,height:m,backgroundColor:x,color:b,fontSize:.38*m},children:v?oe(n).slice(0,2).toUpperCase():(0,d.jsxs)("svg",{width:.5*m,height:.5*m,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:[(0,d.jsx)("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),(0,d.jsx)("circle",{cx:"12",cy:"7",r:"4"})]})}),i&&(0,d.jsx)("span",{"aria-label":`Status: ${i}`,className:mt("absolute bottom-0 right-0 rounded-full"),style:{width:w,height:w,backgroundColor:Qt[i],border:`2px solid ${p.bg}`}})]})});function tn({dir:e}){return(0,d.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:mt("shrink-0"),children:"asc"===e?(0,d.jsx)("path",{d:"M7 14l5-5 5 5H7z"}):"desc"===e?(0,d.jsx)("path",{d:"M7 10l5 5 5-5H7z"}):(0,d.jsx)("path",{d:"M7 10l5 5 5-5H7zM7 14l5-5 5 5H7z",opacity:"0.4"})})}en.displayName="TkxAvatar";var nn=(0,a.forwardRef)(({orientation:e="horizontal",label:t,variant:n="solid",className:r,style:o,...i},a)=>{const l=J(),s=t?oe(t):void 0,c="vertical"===e,u=c?"borderLeft":"borderTop",p=`1px ${n} ${l.border}`;return s?(0,d.jsxs)("div",{role:"separator","aria-orientation":e,className:xt(mt("flex items-center gap-3 text-xs"),r),style:{color:l.textMuted,...o},...i,children:[(0,d.jsx)("hr",{className:mt("flex-1 m-0 border-none"),style:{[u]:p}}),(0,d.jsx)("span",{children:s}),(0,d.jsx)("hr",{className:mt("flex-1 m-0 border-none"),style:{[u]:p}})]}):(0,d.jsx)("hr",{ref:a,role:"separator","aria-orientation":e,className:xt(mt(c?"inline-block self-stretch border-none w-0 h-full":"w-full border-none m-0"),r),style:{[u]:p,...o},...i})});nn.displayName="TkxDivider";var rn={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 on(e){return void 0===e?[]:Array.isArray(e)?e:[e]}function an({size:e,color:t}){return(0,d.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:"2.5",strokeLinecap:"round","aria-hidden":"true",style:{animation:"tkx-spin 0.7s linear infinite"},children:[(0,d.jsx)("style",{children:"@keyframes tkx-spin{to{transform:rotate(360deg)}}"}),(0,d.jsx)("path",{d:"M12 2a10 10 0 0 1 10 10"})]})}function ln({options:e,value:t,defaultValue:n,placeholder:r,size:o="md",isDisabled:i=!1,isInvalid:l=!1,label:s,hint:u,errorMessage:p,multiple:h=!1,searchable:f=!1,clearable:m=!1,isLoading:g=!1,onChange:x,renderOption:b,maxMenuHeight:y=280,virtualScroll:v,optionHeight:w=36,id:k,className:$,style:S}){const C=J(),z=Ot(),M=r??z.selectPlaceholder,N=(0,a.useId)(),D=k??N,R=`${D}-listbox`,P=`${D}-hint`,F=`${D}-error`,I=void 0!==t,[A,L]=(0,a.useState)(on(n)),T=I?on(t):A,[W,j]=(0,a.useState)(!1),[E,B]=(0,a.useState)(""),[V,H]=(0,a.useState)(-1),[O,q]=(0,a.useState)(null),[U,K]=(0,a.useState)(""),Y=(0,a.useRef)(null),X=(0,a.useRef)(null),Z=(0,a.useRef)(null),G=(0,a.useRef)(null),_=(0,a.useRef)(null),Q=rn[o],ee=l||!!p,te=(0,a.useRef)(null),[ne,re]=(0,a.useState)(0),[ie,ae]=(0,a.useState)(0),le=(0,a.useCallback)(()=>{te.current&&re(te.current.scrollTop)},[]);(0,a.useEffect)(()=>{if(!W)return void re(0);const e=te.current;if(!e)return;ae(e.clientHeight);const t=new ResizeObserver(()=>{ae(e.clientHeight)});return t.observe(e),()=>t.disconnect()},[W]);const se=f&&E?e.filter(e=>e.label.toLowerCase().includes(E.toLowerCase())):e,de=se.filter(e=>!e.disabled),ce=se.some(e=>!!e.group),ue=(void 0!==v?v:se.length>=100)&&!ce,pe=se.length*w,he=ue?Math.max(0,Math.floor(ne/w)-8):0,fe=ue?Math.min(se.length,Math.ceil((ne+ie)/w)+8):se.length,me=ue?se.slice(he,fe):se,ge=he*w,xe=se.reduce((e,t)=>{const n=t.group??"";return e[n]||(e[n]=[]),e[n].push(t),e},{}),be=(0,a.useCallback)(e=>{let t;t=h?T.includes(e)?T.filter(t=>t!==e):[...T,e]:[e],I||L(t),x?.(h?t:t[0]??""),h||(j(!1),B(""),H(-1),X.current?.focus())},[I,h,x,T]),ye=(0,a.useCallback)((e,t)=>{t.stopPropagation();const n=T.filter(t=>t!==e);I||L(n),x?.(h?n:n[0]??"")},[I,h,x,T]),ve=(0,a.useCallback)(e=>{e.stopPropagation(),I||L([]),x?.(h?[]:"")},[I,h,x]),we=(0,a.useCallback)(()=>{X.current&&W&&q(function(e,t){const n=e.getBoundingClientRect(),r=window.innerHeight-n.bottom-6,o=n.top-6,i=r>=Math.min(t,200)||r>=o?"below":"above";return{top:"below"===i?n.bottom+window.scrollY+6:n.top+window.scrollY-6-Math.min(t,280),left:n.left+window.scrollX,width:n.width,placement:i}}(X.current,y))},[W,y]);function ke(){if(i||g)return;j(!0);const e=de.findIndex(e=>T.includes(e.value));H(e>=0?e:0)}(0,a.useEffect)(()=>{if(W)return we(),window.addEventListener("scroll",we,!0),window.addEventListener("resize",we),()=>{window.removeEventListener("scroll",we,!0),window.removeEventListener("resize",we)}},[W,we]),(0,a.useEffect)(()=>{if(!W)return;const e=e=>{const t=e.target;X.current?.contains(t)||G.current?.contains(t)||(j(!1),B(""))};return document.addEventListener("pointerdown",e),()=>document.removeEventListener("pointerdown",e)},[W]),(0,a.useEffect)(()=>{W&&f&&setTimeout(()=>Z.current?.focus(),0)},[W,f]),(0,a.useEffect)(()=>{if(W&&!(V<0))if(ue&&te.current){const e=V*w,t=e+w,n=te.current;e<n.scrollTop?n.scrollTop=e:t>n.scrollTop+n.clientHeight&&(n.scrollTop=t-n.clientHeight)}else(_.current?.querySelector(`[data-idx="${V}"]`))?.scrollIntoView({block:"nearest"})},[V,W,ue,w]);const $e=ee?C.danger:W?C.primary:C.border,Se=V>=0&&de[V]?`${D}-opt-${de[V].value}`:void 0,Ce=[u&&P,ee&&F].filter(Boolean).join(" ")||void 0,ze=T.map(t=>e.find(e=>e.value===t)).filter(Boolean),Me=W&&O?(0,c.createPortal)((0,d.jsxs)("div",{ref:G,role:"listbox",id:R,"aria-label":s?oe(s):"Options","aria-multiselectable":h,style:{position:"absolute",top:O.top,left:O.left,width:O.width,zIndex:9999,backgroundColor:C.surface,border:`1.5px solid ${C.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:O.width,maxHeight:y,display:"flex",flexDirection:"column"},children:[f&&(0,d.jsxs)("div",{style:{padding:"8px 10px",borderBottom:`1px solid ${C.border}`,flexShrink:0,display:"flex",alignItems:"center",gap:6},children:[(0,d.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:C.textMuted,strokeWidth:"2","aria-hidden":"true",style:{flexShrink:0},children:[(0,d.jsx)("circle",{cx:"11",cy:"11",r:"8"}),(0,d.jsx)("path",{d:"M21 21l-4.35-4.35"})]}),(0,d.jsx)("input",{ref:Z,type:"text",value:E,onChange:e=>{B(e.target.value),H(0)},onKeyDown:e=>{switch(e.key){case"Escape":e.preventDefault(),j(!1),B(""),X.current?.focus();break;case"ArrowDown":e.preventDefault(),H(e=>Math.min(e+1,de.length-1));break;case"ArrowUp":e.preventDefault(),H(e=>Math.max(e-1,0));break;case"Home":e.preventDefault(),H(0);break;case"End":e.preventDefault(),H(de.length-1);break;case"Enter":e.preventDefault(),V>=0&&de[V]&&be(de[V].value)}},placeholder:`${z.search}…`,"aria-label":`${z.search} options`,style:{border:"none",outline:"none",background:"transparent",color:C.text,fontSize:Q.fontSize,fontFamily:"inherit",width:"100%"}})]}),(0,d.jsx)("div",{ref:e=>{_.current=e,te.current=e},onScroll:ue?le:void 0,style:{overflowY:"auto",flexGrow:1,maxHeight:y-(f?48:0)},children:ue?(0,d.jsxs)("div",{style:{height:pe,position:"relative"},children:[(0,d.jsx)("div",{style:{position:"absolute",top:ge,left:0,right:0},children:me.map(e=>{const t=de.indexOf(e),n=t===V,r=T.includes(e.value),o=b?b(e,r):(0,d.jsxs)("span",{style:{display:"flex",flexDirection:"column",flex:1,minWidth:0},children:[(0,d.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:8},children:[e.icon&&(0,d.jsx)("span",{style:{flexShrink:0,display:"flex"},children:e.icon}),(0,d.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:oe(e.label)})]}),e.description&&(0,d.jsx)("span",{style:{fontSize:"12px",color:C.textMuted,marginTop:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:oe(e.description)})]});return(0,d.jsxs)("div",{id:`${D}-opt-${e.value}`,"data-idx":t>=0?t:void 0,role:"option","aria-selected":r,"aria-disabled":e.disabled||void 0,onClick:()=>!e.disabled&&be(e.value),onMouseEnter:()=>!e.disabled&&t>=0&&H(t),style:{height:w,boxSizing:"border-box",padding:`0 ${Q.px}`,fontSize:Q.fontSize,fontFamily:"inherit",color:e.disabled?C.textMuted:C.text,backgroundColor:n?`${C.primary}22`:r?`${C.primary}12`:"transparent",cursor:e.disabled?"not-allowed":"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,transition:"background-color 80ms",opacity:e.disabled?.5:1,userSelect:"none",touchAction:"manipulation"},children:[o,r&&!b&&(0,d.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:C.primary,strokeWidth:"2.5","aria-hidden":"true",style:{flexShrink:0},children:(0,d.jsx)("path",{d:"M20 6L9 17l-5-5"})})]},e.value)})}),0===se.length&&(0,d.jsx)("div",{style:{padding:`${Q.py} ${Q.px}`,fontSize:Q.fontSize,fontFamily:"inherit",color:C.textMuted,textAlign:"center",position:"absolute",top:0,left:0,right:0},children:g?"Loading…":"No options found"})]}):(0,d.jsxs)(d.Fragment,{children:[Object.entries(xe).map(([e,t])=>(0,d.jsxs)("div",{children:[e&&(0,d.jsx)("div",{"aria-hidden":"true",style:{padding:"8px 12px 4px",fontSize:"11px",fontWeight:700,letterSpacing:"0.08em",textTransform:"uppercase",color:C.textMuted,fontFamily:"inherit",position:"sticky",top:0,backgroundColor:C.surface,zIndex:1,borderBottom:`1px solid ${C.border}`},children:oe(e)}),t.map(e=>{const t=de.indexOf(e),n=t===V,r=T.includes(e.value),o=b?b(e,r):(0,d.jsxs)("span",{style:{display:"flex",flexDirection:"column",flex:1,minWidth:0},children:[(0,d.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:8},children:[e.icon&&(0,d.jsx)("span",{style:{flexShrink:0,display:"flex"},children:e.icon}),(0,d.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:oe(e.label)})]}),e.description&&(0,d.jsx)("span",{style:{fontSize:"12px",color:C.textMuted,marginTop:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:oe(e.description)})]});return(0,d.jsxs)("div",{id:`${D}-opt-${e.value}`,"data-idx":t>=0?t:void 0,role:"option","aria-selected":r,"aria-disabled":e.disabled||void 0,onClick:()=>!e.disabled&&be(e.value),onMouseEnter:()=>!e.disabled&&t>=0&&H(t),style:{padding:`${Q.py} ${Q.px}`,fontSize:Q.fontSize,fontFamily:"inherit",color:e.disabled?C.textMuted:C.text,backgroundColor:n?`${C.primary}22`:r?`${C.primary}12`:"transparent",cursor:e.disabled?"not-allowed":"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,transition:"background-color 80ms",opacity:e.disabled?.5:1,userSelect:"none",touchAction:"manipulation"},children:[o,r&&!b&&(0,d.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:C.primary,strokeWidth:"2.5","aria-hidden":"true",style:{flexShrink:0},children:(0,d.jsx)("path",{d:"M20 6L9 17l-5-5"})})]},e.value)})]},e)),0===se.length&&(0,d.jsx)("div",{style:{padding:`${Q.py} ${Q.px}`,fontSize:Q.fontSize,fontFamily:"inherit",color:C.textMuted,textAlign:"center"},children:g?"Loading…":"No options found"})]})})]}),document.body):null,Ne=m&&T.length>0&&!i&&!g;return(0,d.jsxs)("div",{className:xt(mt("flex flex-col gap-1 w-full"),$),style:S,children:[s&&(0,d.jsx)("label",{htmlFor:D,style:{fontSize:"14px",fontWeight:500,fontFamily:"inherit",color:C.text,userSelect:"none"},children:oe(s)}),(0,d.jsx)("div",{style:{position:"relative",width:"100%",opacity:i?.55:1},children:(0,d.jsxs)("button",{ref:X,id:D,type:"button",role:"combobox","aria-haspopup":"listbox","aria-expanded":W,"aria-controls":R,"aria-activedescendant":Se,"aria-invalid":ee||void 0,"aria-describedby":Ce,"aria-multiselectable":h,disabled:i,onClick:()=>W?j(!1):ke(),onKeyDown:e=>{switch(e.key){case"Enter":case" ":e.preventDefault(),W?V>=0&&de[V]&&be(de[V].value):ke();break;case"Escape":e.preventDefault(),j(!1),B("");break;case"ArrowDown":e.preventDefault(),W?H(e=>Math.min(e+1,de.length-1)):ke();break;case"ArrowUp":e.preventDefault(),W?H(e=>Math.max(e-1,0)):ke();break;case"Home":e.preventDefault(),W&&H(0);break;case"End":e.preventDefault(),W&&H(de.length-1);break;default:1!==e.key.length||e.ctrlKey||e.metaKey||(W||ke(),function(e){Y.current&&clearTimeout(Y.current);const t=U+e.toLowerCase();K(t);const n=de.findIndex(e=>e.label.toLowerCase().startsWith(t));n>=0&&H(n),Y.current=setTimeout(()=>K(""),800)}(e.key))}},style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:h&&T.length>0?`4px ${Q.px}`:`${Q.py} ${Q.px}`,fontSize:Q.fontSize,fontFamily:"inherit",backgroundColor:C.surface,color:T.length>0?C.text:C.textMuted,border:`1.5px solid ${$e}`,borderRadius:8,boxSizing:"border-box",transition:"border-color 150ms",textAlign:"left",cursor:i?"not-allowed":"pointer",outline:"none",minHeight:"sm"===o?34:"lg"===o?50:42,flexWrap:"wrap",touchAction:"manipulation"},children:[(0,d.jsx)("span",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:4,flex:1,minWidth:0},children:h&&ze.length>0?ze.map(e=>(0,d.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:4,padding:`${Q.tagPy} ${Q.tagPx}`,fontSize:`calc(${Q.fontSize} - 1px)`,fontFamily:"inherit",backgroundColor:`${C.primary}22`,color:C.primary,borderRadius:6,border:`1px solid ${C.primary}44`,lineHeight:1.4,maxWidth:150,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[(0,d.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:110},children:oe(e.label)}),(0,d.jsx)("span",{role:"button","aria-label":`Remove ${oe(e.label)}`,tabIndex:-1,onClick:t=>ye(e.value,t),style:{cursor:"pointer",flexShrink:0,display:"flex",alignItems:"center",opacity:.8},children:(0,d.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M18 6L6 18M6 6l12 12"})})})]},e.value)):!h&&T.length>0?(()=>{const t=e.find(e=>e.value===T[0]);return(0,d.jsxs)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"flex",alignItems:"center",gap:6},children:[t?.icon&&(0,d.jsx)("span",{style:{flexShrink:0,display:"flex"},children:t.icon}),t?oe(t.label):""]})})():(0,d.jsx)("span",{style:{opacity:.6},children:oe(M)})}),(0,d.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:4,flexShrink:0,color:C.textMuted},children:[g&&(0,d.jsx)(an,{size:Q.iconSize,color:C.primary}),Ne&&!g&&(0,d.jsx)("span",{role:"button","aria-label":z.clearSelection,tabIndex:-1,onClick:ve,style:{cursor:"pointer",display:"flex",alignItems:"center",lineHeight:1,opacity:.7,transition:"opacity 120ms"},onMouseEnter:e=>e.currentTarget.style.opacity="1",onMouseLeave:e=>e.currentTarget.style.opacity="0.7",children:(0,d.jsx)("svg",{width:Q.iconSize,height:Q.iconSize,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M18 6L6 18M6 6l12 12"})})}),(0,d.jsx)("svg",{width:Q.iconSize,height:Q.iconSize,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",style:{transform:W?"rotate(180deg)":"rotate(0deg)",transition:"transform 150ms",flexShrink:0},children:(0,d.jsx)("path",{d:"M6 9l6 6 6-6"})})]})]})}),u&&!ee&&(0,d.jsx)("span",{id:P,style:{fontSize:"12px",color:C.textMuted,fontFamily:"inherit"},children:oe(u)}),ee&&p&&(0,d.jsxs)("span",{id:F,role:"alert",style:{fontSize:"12px",color:C.danger,display:"flex",alignItems:"center",gap:4,fontFamily:"inherit"},children:[(0,d.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.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"})}),oe(p)]}),Me]})}ln.displayName="TkxSelect";var sn={sm:{box:16,fontSize:"13px",iconStroke:2.5},md:{box:20,fontSize:"14px",iconStroke:2.5},lg:{box:24,fontSize:"15px",iconStroke:2}},dn=(0,a.forwardRef)(({label:e,hint:t,isInvalid:n,errorMessage:r,isIndeterminate:o=!1,size:i="md",colorScheme:l="primary",checked:s,defaultChecked:c,onChange:u,disabled:p,className:h,style:f,id:m,...g},x)=>{const b=J(),y=Te(),v=(0,a.useId)(),w=m??v,k=`${w}-hint`,$=`${w}-error`,S=(0,a.useRef)(null),[C,z]=(0,a.useState)(!1),M=sn[i],N=n||!!r,D={primary:b.primary,success:b.success,danger:b.danger,warning:b.warning}[l]??b.primary,R=void 0!==s?s:void 0;(0,a.useEffect)(()=>{const e=x?.current??S.current;e&&(e.indeterminate=o)},[o,x]);const P=o||(R??!1),F=P?D:b.surface,I=N?b.danger:P?D:b.border,A=j(D),L=C?{outline:`2px solid ${D}`,outlineOffset:"2px"}:{},T=[t&&k,N&&$].filter(Boolean).join(" ")||void 0,W=!y&&P?{animation:"tkx-check-scale-in 120ms ease forwards"}:{};return(0,d.jsxs)("div",{className:xt(mt("flex flex-col gap-1"),h),style:{opacity:p?.5:1,...f},children:[(0,d.jsx)("style",{children:"\n @keyframes tkx-check-scale-in {\n from { transform: scale(0.4); opacity: 0; }\n to { transform: scale(1); opacity: 1; }\n }\n "}),(0,d.jsxs)("label",{htmlFor:w,className:mt("flex items-center gap-2 select-none"),style:{cursor:p?"not-allowed":"pointer",fontFamily:"inherit"},children:[(0,d.jsx)("input",{ref:e=>{S.current=e,"function"==typeof x?x(e):x&&(x.current=e)},id:w,type:"checkbox",checked:s,defaultChecked:c,onChange:u,disabled:p,"aria-invalid":N,"aria-describedby":T,onFocus:e=>{e.target.matches(":focus-visible")&&z(!0)},onBlur:()=>z(!1),className:mt("sr-only"),...g}),(0,d.jsx)("span",{"aria-hidden":"true",style:{width:M.box,height:M.box,minWidth:M.box,borderRadius:"4px",border:`2px solid ${I}`,backgroundColor:F,display:"flex",alignItems:"center",justifyContent:"center",transition:y?"none":"background-color 120ms, border-color 120ms",boxSizing:"border-box",...L},children:o?(0,d.jsx)("span",{"aria-hidden":"true",style:{display:"block",width:.5*M.box,height:2,backgroundColor:A,borderRadius:"1px",...W}}):P?(0,d.jsx)("svg",{width:.6*M.box,height:.6*M.box,viewBox:"0 0 24 24",fill:"none",stroke:A,strokeWidth:M.iconStroke,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:W,children:(0,d.jsx)("path",{d:"M20 6L9 17l-5-5"})}):null}),e&&(0,d.jsx)("span",{style:{fontSize:M.fontSize,color:b.text,lineHeight:1.4},children:"string"==typeof e?oe(e):e})]}),t&&!N&&(0,d.jsx)("span",{id:k,className:mt("text-xs ml-7"),style:{color:b.textMuted,marginLeft:M.box+8},children:oe(t)}),N&&r&&(0,d.jsxs)("span",{id:$,role:"alert",className:mt("text-xs flex items-center gap-1"),style:{color:b.danger,marginLeft:M.box+8},children:[(0,d.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.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"})}),oe(r)]})]})});dn.displayName="TkxCheckbox";var cn=(0,a.createContext)(null),un={sm:{outer:16,inner:7,fontSize:"13px"},md:{outer:20,inner:9,fontSize:"14px"},lg:{outer:24,inner:11,fontSize:"15px"}},pn=(0,a.forwardRef)(({label:e,hint:t,size:n="md",colorScheme:r="primary",value:o,checked:i,onChange:l,disabled:s,name:c,className:u,style:p,id:h,...f},m)=>{const g=J(),x=Te(),b=(0,a.useId)(),y=h??b,v=(0,a.useContext)(cn),w=v?v.value===String(o??""):i??!1,k=s??v?.isDisabled??!1,$=c??v?.name??"",S=un[n],C={primary:g.primary,success:g.success,danger:g.danger}[r]??g.primary;j(C);const z=w?C:g.border,M=g.surface;return(0,d.jsxs)("div",{className:xt(mt("flex flex-col gap-0.5"),u),style:{opacity:k?.5:1,...p},children:[(0,d.jsx)("style",{children:"\n @keyframes tkx-radio-dot-in {\n from { transform: scale(0) translate(-50%, -50%); opacity: 0; }\n to { transform: scale(1) translate(-50%, -50%); opacity: 1; }\n }\n "}),(0,d.jsxs)("label",{htmlFor:y,className:mt("flex items-center gap-2 select-none"),style:{cursor:k?"not-allowed":"pointer",fontFamily:"inherit"},children:[(0,d.jsx)("input",{ref:m,id:y,type:"radio",name:$,value:o,checked:w,onChange:()=>{k||(v?v.onChange(String(o??"")):l?.({target:{value:String(o??"")}}))},disabled:k,"aria-invalid":v?.isInvalid,className:mt("sr-only"),...f}),(0,d.jsx)("span",{"aria-hidden":"true",style:{position:"relative",width:S.outer,height:S.outer,minWidth:S.outer,borderRadius:"50%",border:`2px solid ${z}`,backgroundColor:M,display:"inline-block",boxSizing:"border-box",transition:x?"none":"border-color 120ms"},children:w&&(0,d.jsx)("span",{"aria-hidden":"true",style:{position:"absolute",top:"50%",left:"50%",width:S.inner,height:S.inner,borderRadius:"50%",backgroundColor:C,transform:"translate(-50%, -50%)",transformOrigin:"center",...x?{}:{animation:"tkx-radio-dot-in 130ms ease forwards"}}})}),e&&(0,d.jsx)("span",{style:{fontSize:S.fontSize,color:g.text,lineHeight:1.4},children:"string"==typeof e?oe(e):e})]}),t&&(0,d.jsx)("span",{className:mt("text-xs"),style:{color:g.textMuted,marginLeft:S.outer+8},children:oe(t)})]})});pn.displayName="TkxRadio";var hn=[],fn=[],mn=new Set,gn=new Map;function xn(){const e=[...fn];mn.forEach(t=>t(e))}function bn(e,t){0!==t&&gn.set(e,setTimeout(()=>yn(e),t))}function yn(e){clearTimeout(gn.get(e)),gn.delete(e);const t=fn.some(t=>t.id===e);if(fn=fn.filter(t=>t.id!==e),hn=hn.filter(t=>t.id!==e),t&&hn.length>0&&fn.length<5){const e=hn.shift();fn=[...fn,e],bn(e.id,e.duration??4e3)}xn()}var vn={default:(0,d.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"})}),success:(0,d.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm-2 14.5l-4-4 1.41-1.41L10 13.67l6.59-6.59L18 8.5l-8 8z"})}),danger:(0,d.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),warning:(0,d.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"})}),info:(0,d.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.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"})})},wn={"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 kn(e,t){return t?{}:{animation:`tkx-toast-slide-${e.startsWith("top")?"down":"up"} 220ms cubic-bezier(0.16,1,0.3,1) both`}}function $n({toast:e,position:t,onDismiss:n,reduced:r}){const o=J(),i=Ot(),l=(0,a.useId)(),s={default:o.textMuted,success:o.success,danger:o.danger,warning:o.warning,info:o.info},c=e.variant??"default",u=s[c],p="danger"===c,h=e.title?oe(e.title):void 0,f=e.description?oe(e.description):void 0;return(0,d.jsxs)("div",{role:p?"alert":"status","aria-live":p?"assertive":"polite","aria-atomic":"true","aria-labelledby":h?l:void 0,className:mt("flex items-start gap-3 px-4 py-3 rounded-lg shadow-lg font-sans min-w-[280px] max-w-[380px]"),style:{backgroundColor:o.surface,border:`1px solid ${u}55`,boxShadow:`0 8px 24px ${o.bg}cc`,color:o.text,...kn(t,r)},children:[(0,d.jsx)("span",{className:mt("shrink-0 mt-[2px]"),style:{color:u},children:vn[c]}),(0,d.jsxs)("div",{className:mt("flex-1 min-w-0"),children:[h&&(0,d.jsx)("p",{id:l,className:mt("m-0 font-semibold text-sm leading-snug"),children:h}),f&&(0,d.jsx)("p",{className:mt("m-0 text-xs mt-[2px] leading-relaxed"),style:{color:o.textMuted},children:f}),e.action&&(0,d.jsx)("button",{onClick:()=>{e.action.onClick(),n(e.id)},className:mt("border-none bg-transparent cursor-pointer p-0 mt-2 text-xs font-semibold focus-visible:focus-ring"),style:{color:u},children:oe(e.action.label)})]}),(0,d.jsx)("button",{"aria-label":i.close,onClick:()=>n(e.id),className:mt("bg-transparent border-none cursor-pointer rounded p-[2px] shrink-0 flex items-center justify-center focus-visible:focus-ring"),style:{color:o.textMuted},children:(0,d.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:[(0,d.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,d.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})}var Sn={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 Cn({open:e,reduced:t,iconStyle:n,size:r,color:o}){const i=t?"none":"transform 240ms cubic-bezier(0.4, 0, 0.2, 1)";return"chevron"===n?(0,d.jsx)("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:o,strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{transform:e?"rotate(180deg)":"rotate(0deg)",transition:i,flexShrink:0},children:(0,d.jsx)("polyline",{points:"6 9 12 15 18 9"})}):"plus"===n?(0,d.jsxs)("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:o,strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{transform:e?"rotate(45deg)":"rotate(0deg)",transition:i,flexShrink:0},children:[(0,d.jsx)("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),(0,d.jsx)("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}):(0,d.jsxs)("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:o,strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{transform:e?"rotate(90deg)":"rotate(0deg)",transition:i,flexShrink:0},children:[(0,d.jsx)("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),(0,d.jsx)("polyline",{points:"12 5 19 12 12 19"})]})}function zn({isOpen:e,reduced:t,children:n,id:r,triggerId:o}){const i=(0,a.useRef)(null),l=(0,a.useRef)(null),s=(0,a.useRef)(e),c=(0,a.useRef)(!1);return(0,a.useEffect)(()=>{const t=i.current;t&&(e?(t.style.height="auto",t.style.overflow="visible"):(t.style.height="0px",t.style.overflow="hidden"))},[]),(0,a.useEffect)(()=>{if(s.current===e)return;s.current=e;const n=i.current,r=l.current;if(n&&r){if(t)return n.style.height=e?"auto":"0px",void(n.style.overflow=e?"visible":"hidden");if(c.current){const e=n.getBoundingClientRect().height;n.style.transition="none",n.style.height=`${e}px`,n.offsetHeight}c.current=!0,n.style.overflow="hidden",e?(n.style.height="0px",n.style.transition="height 280ms cubic-bezier(0.4, 0, 0.2, 1)",requestAnimationFrame(()=>{requestAnimationFrame(()=>{n.style.height=`${r.scrollHeight}px`})})):(n.style.height=`${r.scrollHeight}px`,n.style.transition="height 280ms cubic-bezier(0.4, 0, 0.2, 1)",requestAnimationFrame(()=>{requestAnimationFrame(()=>{n.style.height="0px"})}))}},[e,t]),(0,d.jsx)("div",{ref:i,id:r,role:"region","aria-labelledby":o,onTransitionEnd:t=>{if("height"!==t.propertyName)return;c.current=!1;const n=i.current;n&&(e?(n.style.height="auto",n.style.overflow="visible"):n.style.overflow="hidden")},style:{willChange:"height"},children:(0,d.jsx)("div",{ref:l,children:n})})}function Mn({items:e,multiple:t=!1,defaultOpen:n,value:r,onChange:o,variant:i="default",size:l="md",iconPosition:s="right",iconStyle:c="chevron",flush:u=!1,className:p,style:h}){const f=J(),m=Te(),g=(0,a.useId)(),x=void 0!==r,b=e=>e?Array.isArray(e)?new Set(e):new Set([e]):new Set,[y,v]=(0,a.useState)(()=>b(n)),w=x?b(r):y,k=(0,a.useCallback)((e,n)=>{if(n)return;let i;if(!x)return void v(n=>{i=new Set(n),i.has(e)?i.delete(e):(t||i.clear(),i.add(e));const r=[...i];return o?.(t?r:r[0]??""),i});{const n=b(r);i=new Set(n),i.has(e)?i.delete(e):(t||i.clear(),i.add(e))}const a=[...i];o?.(t?a:a[0]??"")},[t,o,x,r]),$=Sn[l],S=(e,t,n)=>{if(u)return{};switch(i){case"default":case"bordered":return{borderBottom:n?"none":`1px solid ${f.border}`};case"separated":return{border:`1px solid ${f.border}`,borderRadius:"10px",overflow:"hidden",boxShadow:"0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04)"};default:return{}}},C="separated"===i;return(0,d.jsx)("div",{className:mt(p??""),style:{...u?{}:"bordered"===i?{border:`1px solid ${f.border}`,borderRadius:"10px",overflow:"hidden"}:{},display:C?"flex":void 0,flexDirection:C?"column":void 0,gap:C?"8px":void 0,...h},children:e.map((t,n)=>{const r=w.has(t.id),o=n===e.length-1,a=`${g}-trigger-${t.id}`,l=`${g}-panel-${t.id}`;return(0,d.jsxs)("div",{className:t.className,style:S(0,0,o),children:[(0,d.jsxs)("button",{id:a,type:"button",role:"button","aria-expanded":r,"aria-controls":l,disabled:t.disabled,onClick:()=>k(t.id,t.disabled),style:{width:"100%",display:"flex",alignItems:t.subtitle?"flex-start":"center",gap:"8px",padding:$.triggerPadding,border:"none",background:"transparent",cursor:t.disabled?"not-allowed":"pointer",textAlign:"left",fontFamily:"inherit",fontSize:$.fontSize,fontWeight:500,color:t.disabled?f.textMuted:f.text,opacity:t.disabled?.5:1,transition:m?"none":"background-color 160ms ease",outline:"none"},onMouseEnter:e=>{t.disabled||(e.currentTarget.style.backgroundColor=(e=>"ghost"===i||"flush"===i?e?`${f.primary}10`:`${f.surfaceAlt}80`:e?`${f.primary}0d`:`${f.surfaceAlt}60`)(r))},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=r?`${f.primary}0d`:"transparent"},onFocus:e=>{t.disabled||(e.currentTarget.style.outline=`2px solid ${f.primary}`,e.currentTarget.style.outlineOffset="2px")},onBlur:e=>{e.currentTarget.style.outline="none"},children:[t.icon&&(0,d.jsx)("span",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",flexShrink:0,color:f.primary,marginTop:t.subtitle?"1px":void 0},children:t.icon}),"left"===s&&(0,d.jsx)("span",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",flexShrink:0,color:r?f.primary:f.textMuted,marginTop:t.subtitle?"1px":void 0},children:(0,d.jsx)(Cn,{open:r,reduced:m,iconStyle:c,size:$.iconSize,color:r?f.primary:f.textMuted})}),(0,d.jsxs)("span",{style:{flex:1,minWidth:0},children:[(0,d.jsx)("span",{style:{display:"block",lineHeight:1.4},children:t.title}),t.subtitle&&(0,d.jsx)("span",{style:{display:"block",fontSize:$.subtitleSize,color:f.textMuted,fontWeight:400,marginTop:"2px",lineHeight:1.3},children:t.subtitle})]}),t.badge&&(0,d.jsx)("span",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",flexShrink:0},children:t.badge}),"right"===s&&(0,d.jsx)("span",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",flexShrink:0,color:r?f.primary:f.textMuted,marginTop:t.subtitle?"1px":void 0},children:(0,d.jsx)(Cn,{open:r,reduced:m,iconStyle:c,size:$.iconSize,color:r?f.primary:f.textMuted})})]}),(0,d.jsx)(zn,{isOpen:r,reduced:m,id:l,triggerId:a,children:(0,d.jsx)("div",{style:{padding:$.contentPadding,fontSize:$.fontSize,lineHeight:1.6,color:f.textMuted,fontFamily:"inherit"},children:t.content})})]},t.id)})})}Mn.displayName="TkxAccordion";var Nn={sm:"280px",md:"380px",lg:"480px",xl:"600px",full:"100%"},Dn=0;function Rn(){--Dn<=0&&(Dn=0,document.body.style.overflow="")}function Pn(){return(0,d.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:[(0,d.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,d.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}var Fn=["Su","Mo","Tu","We","Th","Fr","Sa"],In=["January","February","March","April","May","June","July","August","September","October","November","December"],An=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ln(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function Tn(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())}function Wn(e,t,n){return!(!t||!Ln(e,t))||!(!n||!Ln(e,n))}function jn(e,t="en-US",n){if(!e)return"";if(n){const t=String(e.getFullYear()),r=t.slice(-2),o=e.getMonth()+1,i=String(o).padStart(2,"0"),a=An[e.getMonth()],l=In[e.getMonth()],s=e.getDate(),d=String(s).padStart(2,"0");return n.replace(/YYYY/g,t).replace(/YY/g,r).replace(/MMMM/g,l).replace(/MMM/g,a).replace(/MM/g,i).replace(/\bM\b/g,String(o)).replace(/DD/g,d).replace(/\bD\b/g,String(s))}return e.toLocaleDateString(t,{month:"2-digit",day:"2-digit",year:"numeric"})}function En(e,t){return new Date(e,t+1,0).getDate()}function Bn(e){return 10*Math.floor(e/10)}function Vn({values:e,selected:t,onSelect:n,label:r,theme:o,format:i}){const l=(0,a.useRef)([]),s=(0,a.useRef)(null);(0,a.useEffect)(()=>{const e=l.current[t];e&&s.current&&e.scrollIntoView({block:"nearest"})},[t]);const c=i??(e=>String(e).padStart(2,"0"));return(0,d.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"4px"},children:[(0,d.jsx)("div",{style:{fontSize:"11px",fontWeight:600,color:o.textMuted,textTransform:"uppercase",letterSpacing:"0.05em"},children:r}),(0,d.jsx)("div",{ref:s,style:{height:"160px",overflowY:"auto",width:"52px",scrollbarWidth:"thin",border:`1px solid ${o.border}`,borderRadius:"8px",padding:"4px"},children:e.map(e=>{const r=e===t;return(0,d.jsx)("button",{ref:t=>{l.current[e]=t},type:"button",onClick:()=>n(e),style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"32px",borderRadius:"6px",border:"none",cursor:"pointer",fontSize:"13px",fontWeight:r?600:400,backgroundColor:r?o.primary:"transparent",color:r?o.bg:o.text,fontFamily:"monospace",transition:"background-color 100ms ease"},children:c(e)},e)})})]})}function Hn({year:e,month:t,today:n,mode:r,selectedDate:o,selectedRange:i,multiDates:a,hoverDate:l,focusedDate:s,isDateDisabled:c,onSelectDate:u,onHoverDate:p,onSetFocused:h,theme:f,locale:m}){const g=function(e,t){const n=new Date(e,t,1).getDay(),r=En(e,t),o=[],i=En(e,t-1);for(let l=n-1;l>=0;l--)o.push(new Date(e,t-1,i-l));for(let l=1;l<=r;l++)o.push(new Date(e,t,l));let a=1;for(;o.length<42;)o.push(new Date(e,t+1,a++));return o}(e,t);return(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:"2px",marginBottom:"4px"},children:Fn.map(e=>(0,d.jsx)("div",{style:{textAlign:"center",fontSize:"11px",fontWeight:600,color:f.textMuted,padding:"4px 0",textTransform:"uppercase",letterSpacing:"0.05em"},children:e},e))}),(0,d.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:"2px"},children:g.map((e,g)=>{const x=e.getMonth()===t,b=Ln(e,n),y=0===e.getDay()||6===e.getDay(),v=c(e),w="single"===r&&null!=o&&Ln(e,o),k="multiple"===r&&a.some(t=>Ln(t,e)),$="range"===r&&Wn(e,i[0],null),S="range"===r&&Wn(e,null,i[1]),C=$||S,z="range"===r&&i[0]&&!i[1]&&l?l:i[1],M="range"===r&&function(e,t,n){if(!t||!n)return!1;const r=Tn(e).getTime(),o=Tn(t).getTime(),i=Tn(n).getTime();return r>Math.min(o,i)&&r<Math.max(o,i)}(e,i[0],z),N="range"===r&&i[0]&&!i[1]&&l&&Ln(e,l),D=w||k||C,R=null!=s&&Ln(e,s);let P="transparent",F=x?y?`${f.text}cc`:f.text:`${f.textMuted}60`,I="none",A=400;return D||N?(P=f.primary,F=f.bg,A=600):M&&(P=`${f.primary}18`),b&&!D&&(I=`2px solid ${f.primary}`,A=600),v&&(F=`${f.textMuted}50`),R&&!D&&(I=`2px solid ${f.secondary}`),(0,d.jsx)("button",{type:"button","aria-label":e.toLocaleDateString(m,{weekday:"long",year:"numeric",month:"long",day:"numeric"}),"aria-pressed":D,"aria-disabled":v,disabled:v,onClick:()=>!v&&u(e),onMouseEnter:()=>p(e),onMouseLeave:()=>p(null),onFocus:()=>h(e),style:{width:"34px",height:"34px",borderRadius:"8px",backgroundColor:P,color:F,border:I,fontSize:"13px",fontWeight:A,cursor:v?"not-allowed":"pointer",opacity:v?.35:1,display:"flex",alignItems:"center",justifyContent:"center",fontFamily:"inherit",position:"relative",outline:"none",textDecoration:v?"line-through":"none",transition:"background-color 80ms ease"},children:e.getDate()},g)})})]})}function On({value:e,onChange:t,rangeValue:n,onRangeChange:r,multiValue:o,onMultiChange:i,mode:l="single",minDate:s,maxDate:u,disabledDates:p,locale:h="en-US",dateFormat:f,showTime:m=!1,timeValue:g,onTimeChange:x,showPresets:b=!1,customPresets:y,label:v,placeholder:w="MM/DD/YYYY",hint:k,isDisabled:$=!1,isInvalid:S=!1,errorMessage:C,numberOfMonths:z=1,id:M,className:N,style:D}){const R=J(),P=Ot(),F=(0,a.useId)(),I=M??F,A=Te(),L=Tn(new Date),T=e=>e instanceof Date&&!Number.isNaN(e.getTime())?e:null,W=void 0!==e,[j,E]=(0,a.useState)(null),B=W?T(e):j,V=void 0!==n,[H,O]=(0,a.useState)([null,null]),q=V?(U=n,Array.isArray(U)?[T(U[0]),T(U[1])]:[null,null]):H;var U;const K=void 0!==o,[Y,X]=(0,a.useState)([]),Z=K?(o??[]).filter(e=>e instanceof Date&&!Number.isNaN(e.getTime())):Y,[G,_]=(0,a.useState)("start"),Q="range"===l||"single"===l&&m,[ee,te]=(0,a.useState)([null,null]),[ne,re]=(0,a.useState)(null),ie=B??q[0]??L,[ae,le]=(0,a.useState)(ie.getFullYear()),[se,de]=(0,a.useState)(ie.getMonth()),[ce,ue]=(0,a.useState)("day"),[pe,he]=(0,a.useState)({h:0,m:0}),fe=g??pe,[me,ge]=(0,a.useState)(!1),[xe,be]=(0,a.useState)(()=>{if("single"===l)return jn(B,h,f);if("range"===l){const[e,t]=q;if(e&&t)return`${jn(e,h,f)} – ${jn(t,h,f)}`}return""}),[ye,ve]=(0,a.useState)(null),[we,ke]=(0,a.useState)(null),[$e,Se]=(0,a.useState)({top:0,left:0,flipUp:!1}),[,Ce]=(0,a.useReducer)(e=>e+1,0),ze=(0,a.useRef)(null),Me=(0,a.useRef)(null),Ne=(0,a.useRef)(null),De=(0,a.useRef)(!1),Re=b?420:m?480:360;(0,a.useEffect)(()=>{if("single"===l)be(jn(B,h,f));else if("range"===l){const[e,t]=q;be(e&&t?`${jn(e,h,f)} – ${jn(t,h,f)}`:e?jn(e,h,f):"")}else"multiple"===l&&be(Z.length>0?`${Z.length} date${1!==Z.length?"s":""} selected`:"")},[B,q,Z,l,h,f]);const Pe=(0,a.useCallback)(()=>{ze.current&&Se(function(e,t){const n=e.getBoundingClientRect(),r=window.innerHeight,o=window.scrollY,i=window.scrollX,a=r-n.bottom<t+8&&n.top>t+8;return{top:a?o+n.top-t-4:o+n.bottom+4,left:i+n.left,flipUp:a}}(ze.current,Re))},[Re]);(0,a.useEffect)(()=>{if(me)return Pe(),window.addEventListener("scroll",Pe,!0),window.addEventListener("resize",Pe),()=>{window.removeEventListener("scroll",Pe,!0),window.removeEventListener("resize",Pe)}},[me,Pe]),(0,a.useEffect)(()=>{if(!me)return;const e=e=>{ze.current?.contains(e.target)||Me.current?.contains(e.target)||ge(!1)};return document.addEventListener("pointerdown",e),()=>document.removeEventListener("pointerdown",e)},[me]),(0,a.useEffect)(()=>{if(!me)return;const e=e=>{"Escape"===e.key&&(ge(!1),De.current=!0,Ne.current?.focus())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[me]);const Fe=(0,a.useCallback)(e=>!!(s&&Tn(e)<Tn(s))||!!(u&&Tn(e)>Tn(u))||!!p&&("function"==typeof p?p(e):p.some(t=>Ln(t,e))),[s,u,p]),Ie=(0,a.useCallback)(e=>{if(!Fe(e)){if("single"===l)Q?re(e):(W||E(e),t?.(e),be(jn(e,h,f)),ge(!1));else if("range"===l)if("start"===G){const t=[e,null];te(t),V||O(t),r?.(t),_("end")}else{const t=ee[0]??q[0],n=t&&e<t?[e,t]:[t,e];te(n),Q?_("start"):(V||O(n),r?.(n),_("start"),ge(!1))}else if("multiple"===l){const t=Z.some(t=>Ln(t,e))?Z.filter(t=>!Ln(t,e)):[...Z,e];K||X(t),i?.(t)}Ce()}},[l,Fe,W,V,K,t,r,i,G,ee,q,Z,Q,h]),Ae=(0,a.useCallback)(()=>{if("single"===l){const e=ne??B;W||E(e),t?.(e)}else"range"===l&&(V||O(ee),r?.(ee));ge(!1),_("start")},[l,ne,ee,B,W,V,t,r]),Le=(0,a.useCallback)(()=>{re(null),te([null,null]),_("start"),ge(!1)},[]),We=y??function(e){const t={today:e?.today??"Today",yesterday:e?.yesterday??"Yesterday",last7:e?.last7Days??"Last 7 days",last30:e?.last30Days??"Last 30 days",last90:"Last 90 days",thisWeek:"This week",lastWeek:"Last week",thisMonth:e?.thisMonth??"This month",lastMonth:e?.lastMonth??"Last month"};return[{label:t.today,getValue:()=>{const e=Tn(new Date);return[e,e]}},{label:t.yesterday,getValue:()=>{const e=Tn(new Date);return e.setDate(e.getDate()-1),[e,e]}},{label:t.last7,getValue:()=>{const e=Tn(new Date),t=new Date(e);return t.setDate(t.getDate()-6),[t,e]}},{label:t.last30,getValue:()=>{const e=Tn(new Date),t=new Date(e);return t.setDate(t.getDate()-29),[t,e]}},{label:t.last90,getValue:()=>{const e=Tn(new Date),t=new Date(e);return t.setDate(t.getDate()-89),[t,e]}},{label:t.thisWeek,getValue:()=>{const e=Tn(new Date),t=new Date(e);t.setDate(t.getDate()-t.getDay());const n=new Date(t);return n.setDate(n.getDate()+6),[t,n]}},{label:t.lastWeek,getValue:()=>{const e=Tn(new Date),t=new Date(e);t.setDate(t.getDate()-t.getDay()-1);const n=new Date(t);return n.setDate(n.getDate()-6),[n,t]}},{label:t.thisMonth,getValue:()=>{const e=new Date;return[new Date(e.getFullYear(),e.getMonth(),1),new Date(e.getFullYear(),e.getMonth()+1,0)]}},{label:t.lastMonth,getValue:()=>{const e=new Date;return[new Date(e.getFullYear(),e.getMonth()-1,1),new Date(e.getFullYear(),e.getMonth(),0)]}},{label:"This quarter",getValue:()=>{const e=new Date,t=Math.floor(e.getMonth()/3);return[new Date(e.getFullYear(),3*t,1),new Date(e.getFullYear(),3*t+3,0)]}},{label:"Last quarter",getValue:()=>{const e=new Date,t=Math.floor(e.getMonth()/3),n=0===t?3:t-1,r=0===t?e.getFullYear()-1:e.getFullYear();return[new Date(r,3*n,1),new Date(r,3*n+3,0)]}},{label:"This year",getValue:()=>{const e=(new Date).getFullYear();return[new Date(e,0,1),new Date(e,11,31)]}},{label:"Last year",getValue:()=>{const e=(new Date).getFullYear()-1;return[new Date(e,0,1),new Date(e,11,31)]}}]}(P),je=11===se?0:se+1,Ee=11===se?ae+1:ae,Be=z>=2,Ve=v?oe(v):void 0,He=k?oe(k):void 0,Oe=C?oe(C):void 0,qe=oe(w),Ue="single"===l&&null!=B||"range"===l&&(null!=q[0]||null!=q[1])||"multiple"===l&&Z.length>0,Ke="range"===l?Q?ee:q:[null,null],Ye=S?R.danger:me?R.primary:R.border,Xe=Array.from({length:24},(e,t)=>t),Ze=Array.from({length:60},(e,t)=>t),Ge=(0,d.jsxs)("div",{ref:Me,role:"dialog","aria-label":"Date picker","aria-modal":"false",onKeyDown:e=>{if("day"!==ce)return;const t=ye??B??L;let n=null;if("ArrowRight"===e.key)n=new Date(t.getFullYear(),t.getMonth(),t.getDate()+1);else if("ArrowLeft"===e.key)n=new Date(t.getFullYear(),t.getMonth(),t.getDate()-1);else if("ArrowDown"===e.key)n=new Date(t.getFullYear(),t.getMonth(),t.getDate()+7);else if("ArrowUp"===e.key)n=new Date(t.getFullYear(),t.getMonth(),t.getDate()-7);else if("Enter"===e.key&&ye)return void Ie(ye);n&&(e.preventDefault(),ve(n),n.getMonth()===se&&n.getFullYear()===ae||(de(n.getMonth()),le(n.getFullYear())))},style:{position:"absolute",top:$e.top,left:$e.left,zIndex:9999,backgroundColor:R.surface,border:`1px solid ${R.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:Be?"580px":"300px",maxWidth:Be&&b?"780px":Be?"620px":b?"520px":"300px",opacity:me?1:0,transform:me?"translateY(0) scale(1)":$e.flipUp?"translateY(4px) scale(0.98)":"translateY(-4px) scale(0.98)",transition:A?"none":"opacity 120ms ease, transform 120ms ease",fontFamily:"inherit"},children:[b&&"range"===l&&(0,d.jsxs)("div",{style:{width:"148px",flexShrink:0,borderRight:`1px solid ${R.border}`,padding:"8px 6px",overflowY:"auto",display:"flex",flexDirection:"column",gap:"1px"},children:[(0,d.jsx)("div",{style:{fontSize:"11px",fontWeight:600,color:R.textMuted,textTransform:"uppercase",letterSpacing:"0.07em",padding:"4px 8px 8px"},children:"Quick select"}),We.map(e=>{const[t,n]=e.getValue(),o=Ke[0]&&Ke[1]&&Ln(Ke[0],t)&&Ln(Ke[1],n);return(0,d.jsx)("button",{type:"button",onClick:()=>(e=>{const[t,n]=e.getValue(),o=[t,n];te(o),V||O(o),r?.(o),le(t.getFullYear()),de(t.getMonth()),_("start"),Q||ge(!1)})(e),style:{width:"100%",textAlign:"left",padding:"7px 10px",borderRadius:"7px",border:"none",cursor:"pointer",fontSize:"13px",backgroundColor:o?`${R.primary}20`:"transparent",color:o?R.primary:R.text,fontWeight:o?600:400,fontFamily:"inherit",transition:"background-color 80ms ease"},onMouseEnter:e=>{o||(e.currentTarget.style.backgroundColor=`${R.surfaceAlt}`)},onMouseLeave:e=>{o||(e.currentTarget.style.backgroundColor="transparent")},children:e.label},e.label)})]}),(0,d.jsxs)("div",{style:{flex:1,padding:"16px",display:"flex",flexDirection:"column",gap:"12px",minWidth:0},children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,d.jsx)("button",{type:"button","aria-label":"day"===ce?"Previous month":"month"===ce?"Previous year":"Previous decade",onClick:()=>{"day"===ce?(0===se?(de(11),le(e=>e-1)):de(e=>e-1),ue("day")):le("month"===ce?e=>e-1:e=>e-10)},style:{border:"none",background:"transparent",cursor:"pointer",color:R.textMuted,padding:"6px",borderRadius:"6px",display:"flex",alignItems:"center"},children:(0,d.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,d.jsx)("polyline",{points:"15 18 9 12 15 6"})})}),(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:["day"===ce&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("button",{type:"button",onClick:()=>ue("month"),style:{border:"none",background:"transparent",cursor:"pointer",fontSize:"14px",fontWeight:600,color:R.text,padding:"4px 6px",borderRadius:"6px",fontFamily:"inherit"},children:In[se]}),(0,d.jsx)("button",{type:"button",onClick:()=>ue("year"),style:{border:"none",background:"transparent",cursor:"pointer",fontSize:"14px",fontWeight:600,color:R.text,padding:"4px 6px",borderRadius:"6px",fontFamily:"inherit"},children:ae}),Be&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{style:{color:R.textMuted,fontSize:"14px"},children:"–"}),(0,d.jsxs)("span",{style:{fontSize:"14px",fontWeight:600,color:R.text},children:[In[je]," ",Ee]})]})]}),"month"===ce&&(0,d.jsx)("button",{type:"button",onClick:()=>ue("year"),style:{border:"none",background:"transparent",cursor:"pointer",fontSize:"14px",fontWeight:600,color:R.text,padding:"4px 6px",borderRadius:"6px",fontFamily:"inherit"},children:ae}),"year"===ce&&(0,d.jsxs)("span",{style:{fontSize:"14px",fontWeight:600,color:R.text},children:[Bn(ae),"–",Bn(ae)+9]})]}),(0,d.jsx)("button",{type:"button","aria-label":"day"===ce?"Next month":"month"===ce?"Next year":"Next decade",onClick:()=>{"day"===ce?(11===se?(de(0),le(e=>e+1)):de(e=>e+1),ue("day")):le("month"===ce?e=>e+1:e=>e+10)},style:{border:"none",background:"transparent",cursor:"pointer",color:R.textMuted,padding:"6px",borderRadius:"6px",display:"flex",alignItems:"center"},children:(0,d.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,d.jsx)("polyline",{points:"9 18 15 12 9 6"})})})]}),"day"===ce&&(0,d.jsxs)("div",{style:{display:"flex",gap:"20px"},children:[(0,d.jsx)(Hn,{year:ae,month:se,today:L,mode:l,selectedDate:B,selectedRange:Ke,multiDates:Z,hoverDate:we,focusedDate:ye,isDateDisabled:Fe,onSelectDate:Ie,onHoverDate:ke,onSetFocused:ve,theme:R,locale:h}),Be&&(0,d.jsx)(Hn,{year:Ee,month:je,today:L,mode:l,selectedDate:B,selectedRange:Ke,multiDates:Z,hoverDate:we,focusedDate:ye,isDateDisabled:Fe,onSelectDate:Ie,onHoverDate:ke,onSetFocused:ve,theme:R,locale:h})]}),"month"===ce&&(0,d.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:"6px"},children:An.map((e,t)=>{const n=t===se;return(0,d.jsx)("button",{type:"button",onClick:()=>{de(t),ue("day")},style:{padding:"10px",borderRadius:"8px",border:t!==L.getMonth()||ae!==L.getFullYear()||n?"none":`2px solid ${R.primary}`,cursor:"pointer",fontSize:"13px",fontWeight:n?600:400,backgroundColor:n?R.primary:"transparent",color:n?R.bg:R.text,fontFamily:"inherit",transition:"background-color 80ms ease"},children:e},e)})}),"year"===ce&&(0,d.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:"6px"},children:Array.from({length:12},(e,t)=>{const n=Bn(ae)-1+t,r=n===ae,o=n===L.getFullYear(),i=0===t||11===t;return(0,d.jsx)("button",{type:"button",onClick:()=>{le(n),ue("month")},style:{padding:"10px 6px",borderRadius:"8px",border:o&&!r?`2px solid ${R.primary}`:"none",cursor:"pointer",fontSize:"13px",fontWeight:r?600:400,backgroundColor:r?R.primary:"transparent",color:r?R.bg:i?R.textMuted:R.text,fontFamily:"inherit",transition:"background-color 80ms ease",opacity:i?.5:1},children:n},n)})}),m&&"day"===ce&&(0,d.jsxs)("div",{style:{borderTop:`1px solid ${R.border}`,paddingTop:"12px",display:"flex",alignItems:"flex-start",gap:"8px",justifyContent:"center"},children:[(0,d.jsx)(Vn,{values:Xe,selected:fe.h,onSelect:e=>{g||he(t=>({...t,h:e})),x?.({...fe,h:e})},label:"Hour",theme:R}),(0,d.jsx)("div",{style:{display:"flex",alignItems:"center",height:"40px",marginTop:"28px",fontSize:"16px",fontWeight:700,color:R.textMuted},children:":"}),(0,d.jsx)(Vn,{values:Ze,selected:fe.m,onSelect:e=>{g||he(t=>({...t,m:e})),x?.({...fe,m:e})},label:"Min",theme:R})]}),"multiple"===l&&"day"===ce&&Z.length>0&&(0,d.jsxs)("div",{style:{borderTop:`1px solid ${R.border}`,paddingTop:"8px",fontSize:"12px",color:R.textMuted,textAlign:"center"},children:[Z.length," date",1!==Z.length?"s":""," selected"]}),(0,d.jsxs)("div",{style:{borderTop:`1px solid ${R.border}`,paddingTop:"10px",display:"flex",alignItems:"center",justifyContent:Q?"space-between":"flex-start",gap:"8px"},children:[(0,d.jsx)("button",{type:"button",onClick:()=>{le(L.getFullYear()),de(L.getMonth()),ue("day"),Ie(L)},style:{border:"none",background:"transparent",cursor:"pointer",fontSize:"13px",color:R.primary,fontWeight:500,padding:"6px 10px",borderRadius:"6px",fontFamily:"inherit"},children:"Today"}),Q&&(0,d.jsxs)("div",{style:{display:"flex",gap:"6px"},children:[(0,d.jsx)("button",{type:"button",onClick:Le,style:{padding:"6px 14px",borderRadius:"7px",border:`1px solid ${R.border}`,cursor:"pointer",fontSize:"13px",fontWeight:500,backgroundColor:"transparent",color:R.text,fontFamily:"inherit"},children:"Cancel"}),(0,d.jsx)("button",{type:"button",onClick:Ae,style:{padding:"6px 14px",borderRadius:"7px",border:"none",cursor:"pointer",fontSize:"13px",fontWeight:600,backgroundColor:R.primary,color:R.bg,fontFamily:"inherit"},children:"Apply"})]})]})]})]});return(0,d.jsxs)("div",{className:N,style:{display:"flex",flexDirection:"column",gap:"4px",width:"100%",position:"relative",...D},children:[Ve&&(0,d.jsx)("label",{htmlFor:I,style:{fontSize:"13px",fontWeight:500,color:R.text,marginBottom:"2px"},children:Ve}),(0,d.jsxs)("div",{ref:ze,style:{display:"flex",alignItems:"center",border:`1.5px solid ${Ye}`,borderRadius:"8px",backgroundColor:R.surface,overflow:"hidden",transition:A?"none":"border-color 120ms ease",opacity:$?.5:1},children:[(0,d.jsx)("span",{style:{display:"flex",alignItems:"center",paddingLeft:"10px",color:R.textMuted,flexShrink:0},children:(0,d.jsxs)("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,d.jsx)("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2"}),(0,d.jsx)("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),(0,d.jsx)("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),(0,d.jsx)("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]})}),(0,d.jsx)("input",{ref:Ne,id:I,type:"text",value:xe,placeholder:qe,disabled:$,"aria-invalid":S,"aria-haspopup":"dialog","aria-expanded":me,readOnly:"range"===l||"multiple"===l,onChange:e=>(e=>{if(be(e),"single"===l){const n=function(e,t){const n=e.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);if(n){const[,e,t,r]=n.map(Number);if(e>=1&&e<=12&&t>=1&&t<=31){const n=new Date(r,e-1,t);if(n.getMonth()===e-1)return n}}const r=e.match(/^(\d{4})-(\d{1,2})-(\d{1,2})$/);if(r){const[,e,t,n]=r.map(Number),o=new Date(e,t-1,n);if(o.getMonth()===t-1)return o}if(t&&/^DD/.test(t)){const t=e.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);if(t){const[,e,n,r]=t.map(Number),o=new Date(r,n-1,e);if(o.getMonth()===n-1)return o}}return null}(e,f);n&&!Fe(n)&&(W||E(n),t?.(n),le(n.getFullYear()),de(n.getMonth()))}})(e.target.value),onFocus:()=>{$||(De.current?De.current=!1:ge(!0))},style:{flex:1,backgroundColor:"transparent",border:"none",outline:"none",fontSize:"14px",padding:"9px 8px",color:R.text,cursor:"single"!==l?"pointer":"text",fontFamily:"inherit",minWidth:0}}),Ue&&!$&&(0,d.jsx)("button",{type:"button","aria-label":"Clear selection",onClick:e=>{if(e.stopPropagation(),"single"===l)W||E(null),t?.(null),be("");else if("range"===l){const e=[null,null];V||O(e),r?.(e),te(e),be(""),_("start")}else"multiple"===l&&(K||X([]),i?.([]),be(""))},style:{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",border:"none",background:"transparent",cursor:"pointer",color:R.textMuted,flexShrink:0,borderRadius:"4px",marginRight:"4px"},children:(0,d.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,d.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,d.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),(0,d.jsx)("button",{type:"button","aria-label":me?"Close calendar":"Open calendar",tabIndex:-1,disabled:$,onClick:()=>{$||ge(e=>!e)},style:{display:"flex",alignItems:"center",justifyContent:"center",width:"34px",height:"36px",border:"none",background:"transparent",cursor:$?"not-allowed":"pointer",color:R.textMuted,flexShrink:0},children:(0,d.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:A?"none":"transform 160ms ease"},children:(0,d.jsx)("polyline",{points:"6 9 12 15 18 9"})})})]}),He&&!S&&(0,d.jsx)("span",{style:{fontSize:"12px",color:R.textMuted},children:He}),S&&Oe&&(0,d.jsx)("span",{role:"alert",style:{fontSize:"12px",color:R.danger},children:Oe}),me&&"undefined"!=typeof document&&(0,c.createPortal)(Ge,document.body)]})}On.displayName="TkxDatePicker";var qn={sm:{track:4,thumb:14,fontSize:"0.75rem"},md:{track:6,thumb:18,fontSize:"0.875rem"},lg:{track:8,thumb:22,fontSize:"1rem"}};function Un(e,t,n){return Math.min(Math.max(e,t),n)}function Kn(e,t,n){return Math.round((e-t)/n)*n+t}function Yn(e,t,n){return(e-t)/(n-t)*100}function Xn({value:e,min:t,max:n,step:r,isDisabled:o,trackColor:i,thumbSize:l,ariaLabel:s,tooltipMode:c,formatValue:u,orientation:p,onChange:h,onChangeEnd:f}){const[m,g]=(0,a.useState)(!1),[x,b]=(0,a.useState)(!1),[y,v]=(0,a.useState)(!1),w="vertical"===p,k=Yn(e,t,n),$="always"===c||"hover"===c&&(y||x||m),S=w?{position:"absolute",bottom:`${k}%`,transform:"translateY(50%)",left:"50%",marginLeft:`-${l/2}px`,zIndex:2,cursor:o?"not-allowed":"grab"}:{position:"absolute",left:`${k}%`,transform:"translateX(-50%)",top:"50%",marginTop:`-${l/2}px`,zIndex:2,cursor:o?"not-allowed":"grab"},C=w?{position:"absolute",left:l+6,top:"50%",transform:"translateY(-50%)",backgroundColor:i,color:"#fff",borderRadius:"4px",padding:"2px 6px",fontSize:"0.75rem",whiteSpace:"nowrap",pointerEvents:"none"}:{position:"absolute",bottom:l+6,left:"50%",transform:"translateX(-50%)",backgroundColor:i,color:"#fff",borderRadius:"4px",padding:"2px 6px",fontSize:"0.75rem",whiteSpace:"nowrap",pointerEvents:"none"};return(0,d.jsxs)("div",{style:S,children:[$&&(0,d.jsx)("div",{style:C,children:u(e)}),(0,d.jsx)("div",{role:"slider",tabIndex:o?-1:0,"aria-label":s,"aria-valuemin":t,"aria-valuemax":n,"aria-valuenow":e,"aria-disabled":o,"aria-orientation":p,onKeyDown:i=>{o||("ArrowRight"===i.key||"ArrowUp"===i.key?(i.preventDefault(),h(Un(Kn(e+r,t,r),t,n))):"ArrowLeft"===i.key||"ArrowDown"===i.key?(i.preventDefault(),h(Un(Kn(e-r,t,r),t,n))):"Home"===i.key?(i.preventDefault(),h(t)):"End"===i.key&&(i.preventDefault(),h(n)))},onFocus:()=>g(!0),onBlur:()=>g(!1),onPointerEnter:()=>v(!0),onPointerLeave:()=>v(!1),onPointerDown:e=>{o||(b(!0),e.target.setPointerCapture(e.pointerId))},onPointerUp:()=>{b(!1),f?.()},style:{width:l,height:l,borderRadius:"50%",backgroundColor:o?"#888":i,border:"3px solid #fff",boxShadow:m?`0 0 0 3px ${i}44`:"0 1px 4px rgba(0,0,0,0.3)",outline:"none",display:"block",transition:"box-shadow 150ms ease"}})]})}function Zn({value:e,defaultValue:t=0,onChange:n,rangeValue:r,onRangeChange:o,min:i=0,max:l=100,step:s=1,isRange:c=!1,label:u,showValue:p=!1,showTicks:h=!1,tickCount:f=5,isDisabled:m=!1,colorScheme:g="primary",size:x="md",marks:b,orientation:y="horizontal",showTooltip:v=!1,formatValue:w,onChangeEnd:k,onRangeChangeEnd:$,gradient:S=!1}){const C=J(),z=(0,a.useId)(),M=Te(),N=void 0!==e,[D,R]=(0,a.useState)(t),P=N?e:D,F=void 0!==r,[I,A]=(0,a.useState)([i,l]),L=F?r:I,T=(0,a.useRef)(null),W=(0,a.useRef)(P);W.current=P;const j=(0,a.useRef)(L);j.current=L;const E={primary:C.primary,success:C.success,danger:C.danger,warning:C.warning}[g],B=qn[x],V="vertical"===y,H=!0===v?"hover":!1!==v&&v,O=w??(e=>String(e)),q=E+"66",U=(0,a.useCallback)((e,t)=>{const n=T.current;if(!n)return i;const r=n.getBoundingClientRect();let o;return o=Un(V?(r.bottom-(t??0))/r.height:(e-r.left)/r.width,0,1),Un(Kn(o*(l-i)+i,i,s),i,l)},[i,l,s,V]),K=(0,a.useCallback)(e=>{if(m)return;const t=U(e.clientX,e.clientY);if(c){const[e,n]=L,r=Math.abs(t-e)<=Math.abs(t-n)?[t,n]:[e,t];F||A(r),o?.(r)}else N||R(t),n?.(t)},[m,c,N,F,U,n,o,L]),Y=c?Yn(L[0],i,l):0,X=Yn(c?L[1]:P,i,l),Z=h?Array.from({length:f},(e,t)=>i+t/(f-1)*(l-i)):[],G=u?oe(u):void 0,_=M?"none":"background 150ms ease";return(0,d.jsxs)("div",{className:mt("flex flex-col gap-2"),style:{opacity:m?.55:1,...V?{height:200,width:"auto",display:"inline-flex"}:{width:"100%"}},children:[(G||p)&&(0,d.jsxs)("div",{className:mt("flex items-center justify-between"),children:[G&&(0,d.jsx)("label",{htmlFor:z,className:mt("text-sm font-medium"),style:{color:C.text,fontSize:B.fontSize},children:G}),p&&!c&&(0,d.jsx)("span",{className:mt("text-sm tabular-nums"),style:{color:C.textMuted,fontSize:B.fontSize},children:O(P)}),p&&c&&(0,d.jsxs)("span",{className:mt("text-sm tabular-nums"),style:{color:C.textMuted,fontSize:B.fontSize},children:[O(L[0])," – ",O(L[1])]})]}),(0,d.jsxs)("div",{style:{position:"relative",...V?{paddingLeft:B.thumb/2,paddingRight:B.thumb/2,flex:1}:{paddingTop:B.thumb/2,paddingBottom:B.thumb/2}},children:[(0,d.jsxs)("div",{ref:T,onPointerDown:K,style:{position:"relative",...V?{width:B.track,height:"100%"}:{height:B.track},borderRadius:9999,backgroundColor:C.border,cursor:m?"not-allowed":"pointer",userSelect:"none",touchAction:"none"},children:[(0,d.jsx)("div",{style:{position:"absolute",...V?{left:0,bottom:`${Y}%`,height:X-Y+"%",width:"100%"}:{top:0,left:`${Y}%`,width:X-Y+"%",height:"100%"},borderRadius:9999,...m?{backgroundColor:C.textMuted}:S?{background:V?`linear-gradient(to top, ${q}, ${E})`:`linear-gradient(to right, ${q}, ${E})`}:{backgroundColor:E},transition:_}}),Z.map((e,t)=>(0,d.jsx)("div",{style:{position:"absolute",...V?{bottom:`${Yn(e,i,l)}%`,left:"50%",transform:"translate(-50%, 50%)",height:3,width:B.track+4}:{left:`${Yn(e,i,l)}%`,top:"50%",transform:"translate(-50%, -50%)",width:3,height:B.track+4},backgroundColor:C.surface,borderRadius:9999,pointerEvents:"none"}},t)),c?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(Xn,{value:L[0],min:i,max:L[1],step:s,isDisabled:m,trackColor:E,trackHeight:B.track,thumbSize:B.thumb,ariaLabel:`${G??"Range"} start`,tooltipMode:H,formatValue:O,orientation:y,onChange:e=>{const t=[Un(e,i,L[1]),L[1]];F||A(t),o?.(t)},onChangeEnd:$?()=>$(j.current):void 0}),(0,d.jsx)(Xn,{value:L[1],min:L[0],max:l,step:s,isDisabled:m,trackColor:E,trackHeight:B.track,thumbSize:B.thumb,ariaLabel:`${G??"Range"} end`,tooltipMode:H,formatValue:O,orientation:y,onChange:e=>{const t=[L[0],Un(e,L[0],l)];F||A(t),o?.(t)},onChangeEnd:$?()=>$(j.current):void 0})]}):(0,d.jsx)(Xn,{value:P,min:i,max:l,step:s,isDisabled:m,trackColor:E,trackHeight:B.track,thumbSize:B.thumb,ariaLabel:G??"Slider",tooltipMode:H,formatValue:O,orientation:y,onChange:e=>{N||R(e),n?.(e)},onChangeEnd:k?()=>k(W.current):void 0})]}),b&&b.length>0&&(0,d.jsx)("div",{style:{position:V?"absolute":"relative",...V?{left:"100%",top:0,bottom:0,marginLeft:8}:{marginTop:8}},children:b.map((e,t)=>(0,d.jsx)("div",{style:{position:"absolute",...V?{bottom:`${Yn(e.value,i,l)}%`,transform:"translateY(50%)",left:0}:{left:`${Yn(e.value,i,l)}%`,transform:"translateX(-50%)"},fontSize:"0.6875rem",color:C.textMuted,whiteSpace:"nowrap"},children:oe(e.label)},t))})]}),h&&!b&&!V&&(0,d.jsx)("div",{style:{position:"relative",height:"1rem"},children:Z.map((e,t)=>(0,d.jsx)("span",{style:{position:"absolute",left:`${Yn(e,i,l)}%`,transform:"translateX(-50%)",fontSize:"0.6875rem",color:C.textMuted},children:O(Math.round(e))},t))})]})}Zn.displayName="TkxSlider";var Gn={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 _n({total:e,pageSize:t=10,page:n,defaultPage:r=1,onChange:o,siblingCount:i=1,showEdges:l=!0,showPageSize:s=!1,onPageSizeChange:c,pageSizeOptions:u=[10,25,50,100],size:p="md",variant:h="default"}){const f=J(),m=Ot(),g=(0,a.useId)(),x={pagination:"Pagination",firstPage:m.firstPage??"First page",lastPage:m.lastPage??"Last page",previousPage:m.previousPage??"Previous page",nextPage:m.nextPage??"Next page",pageN:e=>`Page ${e}`,showing:(e,t,n)=>m.showingRange?m.showingRange(e,t,n):`Showing ${e}–${t} of ${n} items`},b=void 0!==n,[y,v]=(0,a.useState)(r),w=b?n:y,[k,$]=(0,a.useState)(t),S=t,C=Math.max(1,Math.ceil(e/S)),z=e=>{const t=Math.min(Math.max(e,1),C);t!==w&&(b||v(t),o?.(t))},M=function(e,t,n,r){if(t<=1)return[1];const o=(e,t)=>Array.from({length:Math.max(0,t-e+1)},(t,n)=>e+n),i=Math.max(e-n,1),a=Math.min(e+n,t);if(!r){const e=[];return i>1&&e.push("..."),e.push(...o(i,a)),a<t&&e.push("..."),e}const l=i>3,s=a<t-2,d=[];d.push(1),l?d.push("left-ellipsis"):d.push(...o(2,i-1)),d.push(...o(Math.max(i,2),Math.min(a,t-1))),s?d.push("right-ellipsis"):d.push(...o(a+1,t-1)),t>1&&d.push(t);const c=new Set,u=[];for(const p of d)"number"==typeof p?c.has(p)||(c.add(p),u.push(p)):u.push(p);return u}(w,C,i,l),N=Gn[p],D=Math.min((w-1)*S+1,e),R=Math.min(w*S,e),P=(e,t)=>{const n={height:N.height,minWidth:N.minWidth,paddingLeft:N.px,paddingRight:N.px,fontSize:N.fontSize,borderRadius:"8px",display:"inline-flex",alignItems:"center",justifyContent:"center",cursor:t?"not-allowed":"pointer",border:"none",outline:"none",fontFamily:"inherit",transition:"background 120ms ease, color 120ms ease",opacity:t?.4:1};return e?{...n,backgroundColor:f.primary,color:f.bg,fontWeight:600,boxShadow:`0 0 0 2px ${f.primary}44`}:"default"===h?{...n,backgroundColor:f.surface,color:f.text,border:`1px solid ${f.border}`}:"outline"===h?{...n,backgroundColor:"transparent",color:f.text,border:`1px solid ${f.border}`}:{...n,backgroundColor:"transparent",color:f.text}},F=({d:e})=>(0,d.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5","aria-hidden":"true",children:(0,d.jsx)("polyline",{points:e})});return(0,d.jsxs)("nav",{"aria-label":x.pagination,className:mt("flex flex-col gap-2"),children:[e>0&&(0,d.jsx)("p",{className:mt("text-sm"),style:{color:f.textMuted,fontSize:N.fontSize},children:oe(x.showing(D,R,e))}),(0,d.jsxs)("div",{className:mt("flex items-center gap-1 flex-wrap"),children:[l&&(0,d.jsxs)("button",{type:"button","aria-label":x.firstPage,disabled:1===w,onClick:()=>z(1),style:P(!1,1===w),children:[(0,d.jsx)(F,{d:"15 18 9 12 15 6"}),(0,d.jsx)(F,{d:"20 18 14 12 20 6"})]}),(0,d.jsx)("button",{type:"button","aria-label":x.previousPage,disabled:1===w,onClick:()=>z(w-1),style:P(!1,1===w),children:(0,d.jsx)(F,{d:"15 18 9 12 15 6"})}),M.map((e,t)=>{if("string"==typeof e)return(0,d.jsx)("span",{"aria-hidden":"true",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:N.minWidth,height:N.height,fontSize:N.fontSize,color:f.textMuted,userSelect:"none"},children:"…"},`${e}-${t}`);const n=e,r=n===w;return(0,d.jsx)("button",{type:"button","aria-label":x.pageN(n),"aria-current":r?"page":void 0,onClick:()=>z(n),style:P(r,!1),children:n},n)}),(0,d.jsx)("button",{type:"button","aria-label":x.nextPage,disabled:w===C,onClick:()=>z(w+1),style:P(!1,w===C),children:(0,d.jsx)(F,{d:"9 18 15 12 9 6"})}),l&&(0,d.jsxs)("button",{type:"button","aria-label":x.lastPage,disabled:w===C,onClick:()=>z(C),style:P(!1,w===C),children:[(0,d.jsx)(F,{d:"4 18 10 12 4 6"}),(0,d.jsx)(F,{d:"14 18 20 12 14 6"})]}),s&&(0,d.jsxs)("div",{className:mt("flex items-center gap-2 ml-2"),children:[(0,d.jsx)("label",{htmlFor:g,className:mt("text-sm"),style:{color:f.textMuted,fontSize:N.fontSize,whiteSpace:"nowrap"},children:"Rows per page"}),(0,d.jsx)("select",{id:g,value:k,onChange:e=>{return t=Number(e.target.value),$(t),c?.(t),void z(1);var t},style:{height:N.height,paddingLeft:N.px,paddingRight:N.px,fontSize:N.fontSize,borderRadius:"8px",border:`1px solid ${f.border}`,backgroundColor:f.surface,color:f.text,cursor:"pointer",outline:"none",fontFamily:"inherit"},children:u.map(e=>(0,d.jsx)("option",{value:e,children:e},e))})]})]})]})}_n.displayName="TkxPagination";var Jn={"1/1":"100%","4/3":"75%","16/9":"56.25%","3/2":"66.666%","9/16":"177.777%"},Qn={none:"0",sm:"4px",md:"8px",lg:"16px",full:"9999px"};function er({color:e,size:t}){return(0,d.jsxs)("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:e,strokeWidth:1.5,"aria-hidden":"true",children:[(0,d.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),(0,d.jsx)("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),(0,d.jsx)("path",{d:"M21 15l-5-5L5 21"})]})}function tr(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function nr({mimeType:e,color:t}){return e.startsWith("image/")?(0,d.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:1.5,"aria-hidden":"true",children:[(0,d.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),(0,d.jsx)("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),(0,d.jsx)("path",{d:"M21 15l-5-5L5 21"})]}):"application/pdf"===e?(0,d.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:1.5,"aria-hidden":"true",children:[(0,d.jsx)("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),(0,d.jsx)("polyline",{points:"14 2 14 8 20 8"}),(0,d.jsx)("line",{x1:"9",y1:"13",x2:"15",y2:"13"}),(0,d.jsx)("line",{x1:"9",y1:"17",x2:"11",y2:"17"})]}):(0,d.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:1.5,"aria-hidden":"true",children:[(0,d.jsx)("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),(0,d.jsx)("polyline",{points:"14 2 14 8 20 8"})]})}var rr=0,or={sm:16,md:24,lg:32,xl:40};function ir({size:e,filled:t,color:n,halfFilled:r,id:o}){const i=o?`hg-${o}`:void 0;return(0,d.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24","aria-hidden":"true",style:{display:"block"},children:[r&&i&&(0,d.jsx)("defs",{children:(0,d.jsxs)("linearGradient",{id:i,x1:"0",x2:"1",y1:"0",y2:"0",children:[(0,d.jsx)("stop",{offset:"50%",stopColor:n}),(0,d.jsx)("stop",{offset:"50%",stopColor:"transparent"})]})}),(0,d.jsx)("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2",fill:r&&i?`url(#${i})`:t?n:"none",stroke:n,strokeWidth:1.5,strokeLinejoin:"round"})]})}function ar({size:e,filled:t,color:n,halfFilled:r,id:o}){const i=o?`hg-${o}`:void 0;return(0,d.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24","aria-hidden":"true",style:{display:"block"},children:[r&&i&&(0,d.jsx)("defs",{children:(0,d.jsxs)("linearGradient",{id:i,x1:"0",x2:"1",y1:"0",y2:"0",children:[(0,d.jsx)("stop",{offset:"50%",stopColor:n}),(0,d.jsx)("stop",{offset:"50%",stopColor:"transparent"})]})}),(0,d.jsx)("path",{d:"M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z",fill:r&&i?`url(#${i})`:t?n:"none",stroke:n,strokeWidth:1.5,strokeLinejoin:"round"})]})}function lr({size:e,filled:t,color:n,halfFilled:r,id:o}){const i=o?`hg-${o}`:void 0;return(0,d.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24","aria-hidden":"true",style:{display:"block"},children:[r&&i&&(0,d.jsx)("defs",{children:(0,d.jsxs)("linearGradient",{id:i,x1:"0",x2:"1",y1:"0",y2:"0",children:[(0,d.jsx)("stop",{offset:"50%",stopColor:n}),(0,d.jsx)("stop",{offset:"50%",stopColor:"transparent"})]})}),(0,d.jsx)("circle",{cx:"12",cy:"12",r:"9",fill:r&&i?`url(#${i})`:t?n:"none",stroke:n,strokeWidth:1.5})]})}function sr({type:e,size:t,filled:n,color:r,halfFilled:o,uid:i}){const a={size:t,filled:n,color:r,halfFilled:o,id:i};return"heart"===e?(0,d.jsx)(ar,{...a}):"circle"===e?(0,d.jsx)(lr,{...a}):(0,d.jsx)(ir,{...a})}function dr(e,t,n){return Math.min(n,Math.max(t,e))}function cr(e,t,n){if(1===n)return t+1;const r=e.currentTarget.getBoundingClientRect(),o=r.left+r.width/2;return e.clientX<o?t+.5:t+1}var ur=!1;function pr(){return(0,d.jsxs)("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none","aria-hidden":"true",children:[(0,d.jsx)("circle",{cx:"14",cy:"14",r:"14",fill:"currentColor",fillOpacity:"0.15"}),(0,d.jsx)("circle",{cx:"14",cy:"11",r:"4",fill:"currentColor"}),(0,d.jsx)("path",{d:"M6 24c0-4.418 3.582-8 8-8s8 3.582 8 8",fill:"currentColor"})]})}function hr(){return(0,d.jsxs)("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none","aria-hidden":"true",children:[(0,d.jsx)("circle",{cx:"14",cy:"14",r:"14",fill:"currentColor",fillOpacity:"0.15"}),(0,d.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 fr(){const e=J();return(0,d.jsxs)("div",{className:mt("flex items-center gap-1.5 px-4 py-3 rounded-2xl w-fit"),style:{backgroundColor:e.surface,border:`1px solid ${e.border}`},"aria-label":"Assistant is thinking",children:[(0,d.jsx)("span",{className:"tkx-dot1 inline-block w-2 h-2 rounded-full",style:{backgroundColor:e.textMuted}}),(0,d.jsx)("span",{className:"tkx-dot2 inline-block w-2 h-2 rounded-full",style:{backgroundColor:e.textMuted}}),(0,d.jsx)("span",{className:"tkx-dot3 inline-block w-2 h-2 rounded-full",style:{backgroundColor:e.textMuted}})]})}function mr({message:e,showTimestamp:t,avatarUser:n,avatarAssistant:r}){const o=J(),i=Te(),{role:a,content:l,timestamp:s,isStreaming:c,error:u}=e,p=oe(l),h=s?new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}).format(s):null;if("system"===a)return(0,d.jsx)("div",{role:"listitem",className:mt("flex justify-center my-2"),children:(0,d.jsx)("p",{className:mt("text-xs italic px-3 py-1 rounded-full"),style:{color:o.textMuted,backgroundColor:o.surfaceAlt},children:p})});const f="user"===a,m=f?n??(0,d.jsx)(pr,{}):r??(0,d.jsx)(hr,{}),g=f?{backgroundColor:o.primary,color:o.bg}:{backgroundColor:o.surface,color:o.text,border:`1px solid ${u?o.danger:o.border}`};return u&&(g.borderColor=o.danger,g.borderWidth="2px"),(0,d.jsxs)("div",{role:"listitem",className:mt("flex gap-2 mb-4",f?"flex-row-reverse":"flex-row"),children:[(0,d.jsx)("div",{className:mt("shrink-0 w-8 h-8 rounded-full flex items-center justify-center overflow-hidden"),style:{color:f?o.primary:o.secondary},children:m}),(0,d.jsxs)("div",{className:mt("flex flex-col gap-1 max-w-[75%]",f?"items-end":"items-start"),children:[(0,d.jsxs)("div",{className:xt(mt("px-4 py-2.5 rounded-2xl text-sm leading-relaxed break-words whitespace-pre-wrap"),c&&!i?"tkx-cursor":""),style:g,children:[p,u&&(0,d.jsx)("span",{"aria-label":"Error",style:{marginLeft:6,color:o.danger},children:"⚠"})]}),t&&h&&(0,d.jsx)("span",{className:mt("text-[10px]"),style:{color:o.textMuted},children:h})]})]})}var gr=["👍","❤️","😂","🎉","😢","👀"];function xr(e){return e instanceof Date?e:new Date(e)}function br(e){return new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit"}).format(e)}function yr(e){const t=new Date,n=new Date(t);n.setDate(t.getDate()-1);const r=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate();return r(e,t)?"Today":r(e,n)?"Yesterday":e.toLocaleDateString()}function vr({state:e,color:t,danger:n}){if("sending"===e)return(0,d.jsx)("span",{"aria-label":"Sending",title:"Sending",style:{display:"inline-block",width:8,height:8,borderRadius:"50%",backgroundColor:t,opacity:.6}});if("failed"===e)return(0,d.jsx)("span",{"aria-label":"Failed",title:"Failed",style:{color:n,fontWeight:700,fontSize:12},children:"!"});if("sent"===e)return(0,d.jsx)("svg",{width:14,height:14,viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,"aria-label":"Sent",children:(0,d.jsx)("path",{d:"M2 8l4 4 8-8",stroke:t,strokeWidth:1.6,strokeLinecap:"round",strokeLinejoin:"round"})});const r="read"===e?2.2:1.4;return(0,d.jsxs)("svg",{width:18,height:14,viewBox:"0 0 22 16",fill:"none","aria-label":"read"===e?"Read":"Delivered",children:[(0,d.jsx)("path",{d:"M2 8l4 4 8-8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),(0,d.jsx)("path",{d:"M8 12l4 4 8-8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function wr({sender:e,color:t,bg:n}){return e.avatar?(0,d.jsx)("img",{src:e.avatar,alt:oe(e.name),className:mt("rounded-full"),style:{width:32,height:32,objectFit:"cover"}}):(0,d.jsx)("div",{className:mt("rounded-full flex items-center justify-center text-xs font-medium"),style:{width:32,height:32,backgroundColor:n,color:t},"aria-hidden":"true",children:(r=e.name,oe(r).split(/\s+/).filter(Boolean).slice(0,2).map(e=>e[0]?.toUpperCase()??"").join("")||"?")});var r}function kr({att:e,theme:t}){const n=oe(e.name);return"image"===e.kind?(0,d.jsx)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:mt("block mt-2"),children:(0,d.jsx)("img",{src:e.url,alt:n,loading:"lazy",className:mt("rounded-md"),style:{maxWidth:260,maxHeight:260,display:"block"}})}):"audio"===e.kind?(0,d.jsx)("audio",{controls:!0,src:e.url,className:mt("mt-2 block"),style:{maxWidth:260},"aria-label":n}):"video"===e.kind?(0,d.jsx)("video",{controls:!0,src:e.url,poster:e.thumbnail,className:mt("mt-2 rounded-md"),style:{maxWidth:260,display:"block"},"aria-label":n}):(0,d.jsxs)("a",{href:e.url,download:e.name,target:"_blank",rel:"noopener noreferrer",className:mt("flex items-center gap-2 mt-2 px-2.5 py-2 rounded-md text-xs no-underline"),style:{backgroundColor:t.surfaceAlt,color:t.text,border:`1px solid ${t.border}`},children:[(0,d.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,"aria-hidden":"true",children:[(0,d.jsx)("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),(0,d.jsx)("polyline",{points:"14 2 14 8 20 8"})]}),(0,d.jsxs)("div",{className:mt("flex flex-col min-w-0"),children:[(0,d.jsx)("span",{className:mt("truncate font-medium"),style:{maxWidth:200},children:n}),(0,d.jsxs)("span",{style:{color:t.textMuted,fontSize:10},children:[oe(e.mimeType),null!=e.size?" · "+(r=e.size,r<1024?`${r} B`:r<1048576?`${(r/1024).toFixed(1)} KB`:`${(r/1048576).toFixed(1)} MB`):""]})]}),(0,d.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,"aria-hidden":"true",children:(0,d.jsx)("path",{d:"M12 3v12m0 0l-4-4m4 4l4-4M4 21h16"})})]});var r}function $r({messages:e,senders:t,currentUserId:n,onSend:r,onReact:o,onEdit:i,onDelete:l,onAttach:s,height:c=520,placeholder:u="Type a message…",showTimeSeparators:p=!0,groupConsecutive:h=!0,emojiPickerOptions:f=gr,className:m,style:g,typingUserIds:x,onTypingStart:b,onTypingStop:y}){const v=J(),w=Te(),[k,$]=(0,a.useState)(""),[S,C]=(0,a.useState)(null),[z,M]=(0,a.useState)(null),[N,D]=(0,a.useState)(null),[R,P]=(0,a.useState)(""),[F,I]=(0,a.useState)(null),A=(0,a.useRef)(null),L=(0,a.useRef)(null),T=(0,a.useRef)(null),W=(0,a.useRef)(!1),j=(0,a.useRef)(null),E=(0,a.useCallback)(()=>{null!=j.current&&(clearTimeout(j.current),j.current=null),W.current&&(W.current=!1,y?.())},[y]),B=(0,a.useCallback)(()=>{W.current||(W.current=!0,b?.()),null!=j.current&&clearTimeout(j.current),j.current=setTimeout(()=>{j.current=null,W.current&&(W.current=!1,y?.())},3e3)},[b,y]);(0,a.useEffect)(()=>()=>{null!=j.current&&(clearTimeout(j.current),j.current=null)},[]),(0,a.useEffect)(()=>{const e=A.current;e&&e.scrollTo({top:e.scrollHeight,behavior:w?"auto":"smooth"})},[e.length,w]);const V=(0,a.useMemo)(()=>{const t={};for(const n of e)t[n.id]=n;return t},[e]),H=(0,a.useCallback)(()=>{const e=k.trim();e&&r&&(r(oe(e),S??void 0),$(""),C(null),L.current&&(L.current.style.height="auto"),E())},[k,r,S,E]),O=(0,a.useCallback)(e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),H())},[H]),q=(0,a.useCallback)(e=>{const t=e.target.value;$(t);const n=L.current;if(n){n.style.height="auto";const e=160;n.style.height=`${Math.min(n.scrollHeight,e)}px`}0===t.length?E():B()},[B,E]),U=(0,a.useCallback)(()=>{E()},[E]),K=(0,a.useCallback)(async e=>{const t=Array.from(e.target.files??[]);if(e.target.value="",!t.length||!s)return;I(null);const n=[],r=[];for(const o of t)try{const e=await Re(o),t=(o.type||"").split("/")[0],i=e?e.split("/")[0]:null;if(!e||t&&i&&t!==i){r.push(o.name);continue}n.push(o)}catch{r.push(o.name)}r.length&&I(`File type does not match its content — refusing to attach: ${r.map(oe).join(", ")}`),n.length&&await s(n)},[s]),Y=(0,a.useCallback)((e,t)=>{M(null),o?.(e,t)},[o]),X=(0,a.useCallback)(e=>{("undefined"==typeof window||window.confirm("Delete this message?"))&&l?.(e)},[l]),Z=(0,a.useCallback)(e=>{D(e.id),P(e.text??"")},[]),G=(0,a.useCallback)(e=>{const t=R.trim();t&&(i?.(e,oe(t)),D(null),P(""))},[R,i]),_="number"==typeof c?`${c}px`:c,Q=S?V[S]:null,ee=Q?t[Q.senderId]:null,te=(0,a.useMemo)(()=>{if(!x||0===x.length)return null;const e=x.map(e=>oe(t[e]?.name??"Unknown"));return 1===e.length?`${e[0]} is typing`:2===e.length?`${e[0]} and ${e[1]} are typing`:"Several people are typing"},[x,t]),ne=[];let re=null;for(const a of e){const e=xr(a.timestamp);p&&(re?xr(re.timestamp).toDateString():null)!==e.toDateString()&&ne.push({kind:"sep",key:`sep-${a.id}`,label:yr(e)});const t=h&&null!=re&&re.senderId===a.senderId&&xr(re.timestamp).toDateString()===e.toDateString()&&e.getTime()-xr(re.timestamp).getTime()<3e5;ne.push({kind:"msg",key:a.id,msg:a,showHeader:!t}),re=a}return(0,d.jsxs)("div",{className:xt(mt("flex flex-col overflow-hidden rounded-2xl"),m),style:{height:_,backgroundColor:v.bg,border:`1px solid ${v.border}`,...g},children:[(0,d.jsx)("div",{ref:A,role:"log","aria-live":"polite","aria-label":"Message thread",className:mt("flex-1 overflow-y-auto p-4"),children:ne.map(e=>{if("sep"===e.kind)return(0,d.jsx)("div",{className:mt("flex items-center justify-center my-3"),children:(0,d.jsx)("span",{className:mt("text-[11px] px-2.5 py-0.5 rounded-full"),style:{color:v.textMuted,backgroundColor:v.surfaceAlt},children:e.label})},e.key);const r=e.msg,a=t[r.senderId]??{id:r.senderId,name:"Unknown"},s=r.senderId===n,c=xr(r.timestamp),u=!!r.deletedAt,p=r.replyTo?V[r.replyTo]:null,h=p?t[p.senderId]:null,m=N===r.id,g=s?{backgroundColor:v.primary,color:v.bg}:{backgroundColor:v.surface,color:v.text,border:`1px solid ${v.border}`};return(0,d.jsxs)("div",{role:"article","aria-label":`${oe(a.name)}, ${br(c)}`,"data-own":s?"true":"false","data-grouped":e.showHeader?"false":"true",className:mt("flex gap-2 mb-1",s?"flex-row-reverse":"flex-row"),style:{marginTop:e.showHeader?12:2},children:[(0,d.jsx)("div",{className:mt("shrink-0"),style:{width:32},children:e.showHeader?(0,d.jsx)(wr,{sender:a,color:v.primary,bg:v.surfaceAlt}):null}),(0,d.jsxs)("div",{className:mt("flex flex-col max-w-[75%]",s?"items-end":"items-start"),children:[e.showHeader&&(0,d.jsxs)("div",{className:mt("flex items-center gap-2 mb-0.5 text-xs"),style:{color:v.textMuted},children:[(0,d.jsx)("span",{style:{fontWeight:600,color:v.text},children:oe(a.name)}),a.role&&(0,d.jsxs)("span",{children:["· ",oe(a.role)]}),(0,d.jsxs)("span",{children:["· ",br(c)]}),r.editedAt&&!u&&(0,d.jsx)("span",{children:"(edited)"})]}),p&&!u&&(0,d.jsxs)("div",{className:mt("mb-1 px-2 py-1 rounded text-xs"),style:{backgroundColor:v.surfaceAlt,borderLeft:`3px solid ${v.primary}`,color:v.textMuted,maxWidth:"100%"},children:[(0,d.jsxs)("span",{style:{fontWeight:600},children:[oe(h?.name??"Unknown"),":"," "]}),oe((p.text??"").slice(0,80)),(p.text??"").length>80?"…":""]}),(0,d.jsx)("div",{className:mt("px-3 py-2 rounded-2xl text-sm leading-relaxed break-words whitespace-pre-wrap"),style:g,children:u?(0,d.jsx)("span",{style:{fontStyle:"italic",opacity:.7},children:"Message deleted"}):m?(0,d.jsxs)("div",{className:mt("flex flex-col gap-1"),children:[(0,d.jsx)("textarea",{value:R,onChange:e=>P(e.target.value),"aria-label":"Edit message",className:mt("text-sm leading-relaxed bg-transparent outline-none resize-none w-full"),style:{color:"inherit",minHeight:48,border:`1px solid ${v.border}`,borderRadius:8,padding:4}}),(0,d.jsxs)("div",{className:mt("flex gap-2 justify-end"),children:[(0,d.jsx)("button",{type:"button",onClick:()=>D(null),className:mt("text-xs px-2 py-1 rounded bg-transparent border-none cursor-pointer"),style:{color:"inherit"},children:"Cancel"}),(0,d.jsx)("button",{type:"button",onClick:()=>G(r.id),className:mt("text-xs px-2 py-1 rounded border-none cursor-pointer"),style:{backgroundColor:v.bg,color:v.primary},children:"Save"})]})]}):(0,d.jsxs)(d.Fragment,{children:[r.text&&oe(r.text),r.attachments?.map(e=>(0,d.jsx)(kr,{att:e,theme:v},e.id))]})}),!u&&(0,d.jsxs)("div",{className:mt("flex items-center gap-1 mt-1 flex-wrap",s?"justify-end":"justify-start"),children:[r.reactions?.map(e=>{const t=e.by.includes(n);return(0,d.jsxs)("button",{type:"button",onClick:()=>o?.(r.id,e.emoji),"aria-label":`React ${e.emoji} (${e.by.length})`,"aria-pressed":t,className:mt("text-xs px-1.5 py-0.5 rounded-full cursor-pointer"),style:{backgroundColor:t?v.primary+"33":v.surfaceAlt,border:`1px solid ${t?v.primary:v.border}`,color:v.text},children:[e.emoji," ",e.by.length]},e.emoji)}),s&&r.delivery&&(0,d.jsx)("span",{className:mt("inline-flex items-center ml-1"),children:(0,d.jsx)(vr,{state:r.delivery,color:v.textMuted,danger:v.danger})})]}),!u&&!m&&(0,d.jsxs)("div",{className:mt("flex items-center gap-1 mt-1 text-xs"),style:{color:v.textMuted,opacity:.85},children:[(0,d.jsx)("button",{type:"button",onClick:()=>C(r.id),"aria-label":"Reply to message",className:mt("bg-transparent border-none cursor-pointer px-1 py-0.5 rounded"),style:{color:"inherit"},children:"Reply"}),(0,d.jsx)("button",{type:"button",onClick:()=>M(e=>e===r.id?null:r.id),"aria-label":"React to message","aria-expanded":z===r.id,className:mt("bg-transparent border-none cursor-pointer px-1 py-0.5 rounded"),style:{color:"inherit"},children:"React"}),s&&i&&(0,d.jsx)("button",{type:"button",onClick:()=>Z(r),"aria-label":"Edit message",className:mt("bg-transparent border-none cursor-pointer px-1 py-0.5 rounded"),style:{color:"inherit"},children:"Edit"}),s&&l&&(0,d.jsx)("button",{type:"button",onClick:()=>X(r.id),"aria-label":"Delete message",className:mt("bg-transparent border-none cursor-pointer px-1 py-0.5 rounded"),style:{color:"inherit"},children:"Delete"}),z===r.id&&(0,d.jsx)("div",{role:"menu","aria-label":"Pick a reaction",className:mt("flex items-center gap-1 ml-1 px-1.5 py-1 rounded-full"),style:{backgroundColor:v.surface,border:`1px solid ${v.border}`},children:f.map(e=>(0,d.jsx)("button",{type:"button",role:"menuitem",onClick:()=>Y(r.id,e),"aria-label":`React with ${e}`,className:mt("bg-transparent border-none cursor-pointer text-sm px-1"),style:{color:"inherit"},children:e},e))})]})]})]},e.key)})}),te&&(0,d.jsxs)("div",{role:"status","aria-live":"polite",className:mt("px-4 py-1 flex items-center gap-1"),style:{color:v.textMuted,fontSize:12,fontStyle:"italic",borderTop:`1px solid ${v.border}`,backgroundColor:v.bg},children:[(0,d.jsx)("span",{children:te}),w?(0,d.jsx)("span",{"aria-hidden":"true",children:"…"}):(0,d.jsxs)("span",{"aria-hidden":"true",className:mt("inline-flex items-end gap-0.5"),style:{marginLeft:2},children:[(0,d.jsx)("span",{style:{width:3,height:3,borderRadius:"50%",backgroundColor:"currentColor",animation:"tkx-typing-dot 1.2s infinite ease-in-out",animationDelay:"0s",display:"inline-block"}}),(0,d.jsx)("span",{style:{width:3,height:3,borderRadius:"50%",backgroundColor:"currentColor",animation:"tkx-typing-dot 1.2s infinite ease-in-out",animationDelay:"0.15s",display:"inline-block"}}),(0,d.jsx)("span",{style:{width:3,height:3,borderRadius:"50%",backgroundColor:"currentColor",animation:"tkx-typing-dot 1.2s infinite ease-in-out",animationDelay:"0.3s",display:"inline-block"}}),(0,d.jsx)("style",{children:"@keyframes tkx-typing-dot { 0%, 60%, 100% { opacity: 0.25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2px); } } @media (prefers-reduced-motion: reduce) { @keyframes tkx-typing-dot { 0%, 100% { opacity: 1; transform: none; } } }"})]})]}),(0,d.jsxs)("div",{className:mt("flex flex-col gap-1 p-3"),style:{borderTop:`1px solid ${v.border}`,backgroundColor:v.surface},children:[F&&(0,d.jsx)("div",{role:"alert",className:mt("text-xs px-2 py-1 rounded"),style:{backgroundColor:v.danger+"20",color:v.danger,border:`1px solid ${v.danger}`},children:F}),Q&&(0,d.jsxs)("div",{className:mt("flex items-center gap-2 px-2 py-1 rounded text-xs"),style:{backgroundColor:v.surfaceAlt,color:v.textMuted},children:[(0,d.jsxs)("span",{className:mt("truncate flex-1"),children:["Replying to"," ",(0,d.jsx)("span",{style:{fontWeight:600,color:v.text},children:oe(ee?.name??"Unknown")}),": ",oe((Q.text??"").slice(0,80))]}),(0,d.jsx)("button",{type:"button",onClick:()=>C(null),"aria-label":"Cancel reply",className:mt("bg-transparent border-none cursor-pointer"),style:{color:"inherit"},children:"×"})]}),(0,d.jsxs)("div",{className:mt("flex items-end gap-2"),children:[s&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("input",{ref:T,type:"file",multiple:!0,onChange:K,className:mt("sr-only"),tabIndex:-1,"aria-hidden":"true"}),(0,d.jsx)("button",{type:"button",onClick:()=>T.current?.click(),"aria-label":"Attach files",className:mt("shrink-0 w-9 h-9 rounded-xl flex items-center justify-center cursor-pointer border-none"),style:{backgroundColor:v.surfaceAlt,color:v.text},children:(0,d.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.8,"aria-hidden":"true",children:(0,d.jsx)("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"})})})]}),(0,d.jsx)("textarea",{ref:L,rows:1,value:k,onChange:q,onKeyDown:O,onBlur:U,placeholder:oe(u),"aria-label":"Message input","aria-multiline":"true",className:mt("flex-1 resize-none text-sm leading-6 bg-transparent outline-none py-1"),style:{color:v.text,caretColor:v.primary,minHeight:32,maxHeight:160}}),(0,d.jsx)("button",{type:"button",onClick:H,disabled:!k.trim(),"aria-label":"Send message",className:mt("shrink-0 w-9 h-9 rounded-xl flex items-center justify-center border-none",k.trim()?"cursor-pointer opacity-100":"opacity-40 cursor-not-allowed"),style:{backgroundColor:v.primary,color:v.bg},children:(0,d.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M2 14L14 8 2 2v4.5l8 1.5-8 1.5V14z",fill:"currentColor"})})})]})]})]})}var Sr={sm:"text-[11px]",md:"text-xs",lg:"text-sm"},Cr={sm:"px-2 py-0.5",md:"px-2.5 py-1",lg:"px-3 py-1.5"},zr={sm:"gap-1",md:"gap-1.5",lg:"gap-2"},Mr={sm:12,md:14,lg:16};function Nr({variant:e="subtle",size:t="md",colorScheme:n="default",onRemove:r,leftIcon:o,isDisabled:i=!1,clickable:a=!1,children:l,className:s,style:c,onClick:u,...p}){J();const h=Te(),f=function(e,t){const n=J(),r={default:n.textMuted,primary:n.primary,secondary:n.secondary,success:n.success,danger:n.danger,warning:n.warning,info:n.info}[e];return"solid"===t?{bg:r,color:n.bg,border:"transparent"}:"subtle"===t?{bg:`${r}22`,color:r,border:"transparent"}:{bg:"transparent",color:r,border:r}}(n,e),m="string"==typeof l?oe(l):l,g=Mr[t],x=mt("inline-flex items-center font-medium rounded-full select-none",Sr[t],Cr[t],zr[t],i?"opacity-50 cursor-not-allowed":a?"cursor-pointer":"cursor-default",a&&!h&&"transition-opacity duration-150");return(0,d.jsxs)("span",{role:a?"button":void 0,tabIndex:a&&!i?0:void 0,"aria-disabled":i||void 0,className:xt(x,s),style:{backgroundColor:f.bg,color:f.color,border:`1px solid ${"transparent"===f.border?"transparent":f.border}`,...c},onClick:i?void 0:u,onKeyDown:a&&!i&&u?e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),u(e))}:void 0,...p,children:[o&&(0,d.jsx)("span",{"aria-hidden":"true",className:mt("shrink-0 flex items-center"),children:o}),(0,d.jsx)("span",{children:m}),r&&!i&&(0,d.jsx)("button",{type:"button","aria-label":`Remove ${"string"==typeof l?l:"tag"}`,onClick:e=>{e.stopPropagation(),r()},className:mt("shrink-0 flex items-center justify-center rounded-full cursor-pointer"),style:{width:g+4,height:g+4,color:f.color,backgroundColor:"transparent",border:"none",padding:0},tabIndex:0,children:(0,d.jsx)("svg",{width:g,height:g,viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M2 2l8 8M10 2L2 10",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})})})]})}var Dr=!1;function Rr({status:e="pending",icon:t,size:n=28}){const r=J(),o=Te(),i=function(e="pending"){const t=J();return{completed:t.success,active:t.primary,pending:t.border,error:t.danger}[e]}(e),a="active"===e;return(0,d.jsx)("div",{className:xt(mt("relative flex items-center justify-center rounded-full shrink-0 z-10"),a&&!o?"tkx-pulse-dot":""),style:{width:n,height:n,backgroundColor:"pending"===e?r.surface:i,border:`2px solid ${i}`,color:"pending"===e?i:r.bg},"aria-hidden":"true",children:t?(0,d.jsx)("span",{style:{fontSize:.45*n,lineHeight:1},children:t}):(0,d.jsx)("span",{style:{width:.35*n,height:.35*n,borderRadius:"50%",backgroundColor:"pending"===e?i:r.bg,display:"block"}})})}function Pr({style:e,color:t,animate:n}){return J(),(0,d.jsx)("div",{className:xt(mt("w-0.5 flex-1 min-h-[24px]"),n?"tkx-draw-v":""),style:{borderLeft:`2px ${e} ${t}`,backgroundColor:"transparent",alignSelf:"stretch",borderColor:t,marginLeft:1},"aria-hidden":"true"})}function Fr({style:e,color:t,animate:n}){return(0,d.jsx)("div",{className:xt(mt("h-0.5 flex-1 min-w-[24px]"),n?"tkx-draw-h":""),style:{borderTop:`2px ${e} ${t}`,borderColor:t},"aria-hidden":"true"})}function Ir({item:e,compact:t}){const n=J(),r=e.timestamp?oe(e.timestamp):null;return(0,d.jsxs)("div",{className:mt("flex flex-col gap-0.5",t?"pb-3":"pb-5"),children:[(0,d.jsxs)("div",{className:mt("flex items-center gap-2 flex-wrap"),children:[(0,d.jsx)("span",{className:mt("text-sm font-semibold leading-snug"),style:{color:n.text},children:"string"==typeof e.title?oe(e.title):e.title}),e.badge&&(0,d.jsx)("span",{children:e.badge}),r&&(0,d.jsx)("span",{className:mt("text-[11px] ml-auto"),style:{color:n.textMuted},children:r})]}),e.description&&!t&&(0,d.jsx)("div",{className:mt("text-xs leading-relaxed mt-0.5"),style:{color:n.textMuted},children:"string"==typeof e.description?oe(e.description):e.description})]})}function Ar(e,t,n,r){const o=window.innerWidth,i=window.innerHeight;let a=0,l=0,s="top left";switch(t){case"bottom-start":a=e.bottom+6,l=e.left,s="top left",a+r>i&&e.top-6-r>0&&(a=e.top-6-r,s="bottom left"),l+n>o&&(l=Math.max(0,o-n-8));break;case"bottom-end":a=e.bottom+6,l=e.right-n,s="top right",a+r>i&&e.top-6-r>0&&(a=e.top-6-r,s="bottom right"),l<0&&(l=8);break;case"top-start":a=e.top-6-r,l=e.left,s="bottom left",a<0&&(a=e.bottom+6,s="top left"),l+n>o&&(l=Math.max(0,o-n-8));break;case"top-end":a=e.top-6-r,l=e.right-n,s="bottom right",a<0&&(a=e.bottom+6,s="top right"),l<0&&(l=8);break;case"right-start":a=e.top,l=e.right+6,s="top left",l+n>o&&(l=e.left-6-n,s="top right"),a+r>i&&(a=Math.max(8,i-r-8));break;case"left-start":a=e.top,l=e.left-6-n,s="top right",l<0&&(l=e.right+6,s="top left"),a+r>i&&(a=Math.max(8,i-r-8))}return{top:a+window.scrollY,left:l+window.scrollX,transformOrigin:s}}function Lr(e,t){return{position:"absolute",top:t.top,left:t.left,zIndex:9999,minWidth:200,maxWidth:320,backgroundColor:e.surface,border:`1.5px solid ${e.border}`,borderRadius:10,boxShadow:"0 8px 32px rgba(0,0,0,0.28), 0 2px 8px rgba(0,0,0,0.14)",padding:"4px 0",transformOrigin:t.transformOrigin,overflow:"hidden"}}function Tr({color:e}){return(0,d.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:e,strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M20 6L9 17l-5-5"})})}function Wr({color:e}){return(0,d.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,d.jsx)("circle",{cx:"12",cy:"12",r:"5",fill:e}),(0,d.jsx)("circle",{cx:"12",cy:"12",r:"9",fill:"none",stroke:e,strokeWidth:"2"})]})}function jr({color:e}){return(0,d.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:e,strokeWidth:"2","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M9 18l6-6-6-6"})})}function Er({items:e,pos:t,panelId:n,onClose:r,onCloseAll:o,isSubmenu:i=!1}){const l=J(),[s,u]=(0,a.useState)(-1),[p,h]=(0,a.useState)(null),[f,m]=(0,a.useState)(null),g=(0,a.useRef)(null),[x,b]=(0,a.useState)(""),y=(0,a.useRef)(null),v=function(e){const t=[];let n=0;for(const r of e)if("separator"!==r.type)if("radio-group"===r.type)for(let e=0;e<r.options.length;e++)t.push({kind:"radio",item:r,optionIdx:e,idx:n++});else"check"===r.type?t.push({kind:"check",item:r,idx:n++}):"submenu"===r.type?t.push({kind:"submenu",item:r,idx:n++}):t.push({kind:"action",item:r,idx:n++});return t}(e);(0,a.useEffect)(()=>{g.current?.focus()},[]),(0,a.useEffect)(()=>{s<0||(g.current?.querySelector(`[data-midx="${s}"]`))?.scrollIntoView({block:"nearest"})},[s]);const w=(0,a.useCallback)(e=>{if("action"===e.kind){if(e.item.disabled)return;e.item.onClick?.(),o()}else if("check"===e.kind){if(e.item.disabled)return;e.item.onChange?.(!e.item.checked)}else if("radio"===e.kind){if(e.item.disabled)return;e.item.onChange?.(e.item.options[e.optionIdx].value)}else if("submenu"===e.kind){if(e.item.disabled)return;const t=g.current?.querySelector(`[data-midx="${e.idx}"]`);t?k(e.item,t):h(e.item.id)}},[o]);function k(e,t){const n=t.getBoundingClientRect();h(e.id),m(function(e,t,n){const r=window.innerWidth,o=window.innerHeight;let i=e.right+4,a="top left";i+220>r&&(i=e.left-4-220,a="top right");let l=e.top;return l+n>o&&(l=Math.max(8,o-n-8)),{top:l+window.scrollY,left:i+window.scrollX,transformOrigin:a}}(n,0,Math.min(38*e.items.length+12,360)))}function $(){h(null),m(null)}return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("style",{children:"\n@keyframes tkxMenuIn {\n from { opacity: 0; transform: scale(0.94); }\n to { opacity: 1; transform: scale(1); }\n}\n@keyframes tkxMenuInReduced {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n@media (prefers-reduced-motion: no-preference) {\n .tkx-menu-panel {\n animation: tkxMenuIn 130ms cubic-bezier(0.16, 1, 0.3, 1) forwards;\n }\n}\n@media (prefers-reduced-motion: reduce) {\n .tkx-menu-panel {\n animation: tkxMenuInReduced 100ms ease forwards;\n }\n}\n"}),(0,d.jsx)("div",{ref:g,id:n,role:"menu",tabIndex:-1,className:"tkx-menu-panel",onKeyDown:e=>{switch(e.key){case"ArrowDown":e.preventDefault(),u(e=>{const t=e+1;return t<v.length?t:0});break;case"ArrowUp":e.preventDefault(),u(e=>{const t=e-1;return t>=0?t:v.length-1});break;case"Home":e.preventDefault(),u(0);break;case"End":e.preventDefault(),u(v.length-1);break;case"Enter":case" ":e.preventDefault(),s>=0&&v[s]&&w(v[s]);break;case"Escape":e.preventDefault(),i?r():o();break;case"Tab":e.preventDefault(),o();break;case"ArrowRight":if(e.preventDefault(),s>=0&&"submenu"===v[s]?.kind){const e=v[s],t=g.current?.querySelector(`[data-midx="${e.idx}"]`);t?k(e.item,t):h(e.item.id)}break;case"ArrowLeft":e.preventDefault(),i&&r();break;default:1!==e.key.length||e.ctrlKey||e.metaKey||function(e){y.current&&clearTimeout(y.current);const t=x+e.toLowerCase();b(t);const n=v.findIndex(e=>("radio"===e.kind?e.item.options[e.optionIdx].label:e.item.label).toLowerCase().startsWith(t));n>=0&&u(n),y.current=setTimeout(()=>b(""),800)}(e.key)}},style:{...Lr(l,t),maxHeight:400,overflowY:"auto"},children:(()=>{let t=-1;return e.map(e=>{if("separator"===e.type)return(0,d.jsx)("div",{role:"separator",style:{margin:(e.label,"4px 0"),display:"flex",alignItems:"center",gap:8},children:e.label?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:{flex:1,height:1,backgroundColor:l.border,marginLeft:14}}),(0,d.jsx)("span",{style:{fontSize:"11px",fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:l.textMuted,fontFamily:"inherit",whiteSpace:"nowrap"},children:oe(e.label)}),(0,d.jsx)("div",{style:{flex:1,height:1,backgroundColor:l.border,marginRight:14}})]}):(0,d.jsx)("div",{style:{flex:1,height:1,backgroundColor:l.border,margin:"0 10px"}})},e.id);if("radio-group"===e.type)return(0,d.jsxs)("div",{role:"group","aria-label":e.label,children:[e.label&&(0,d.jsx)("div",{style:{padding:"6px 14px 2px",fontSize:"11px",fontWeight:700,letterSpacing:"0.07em",textTransform:"uppercase",color:l.textMuted,fontFamily:"inherit"},"aria-hidden":"true",children:oe(e.label)}),e.options.map((n,r)=>{t++;const o=t,i=o===s,a=n.value===e.value,c=!!e.disabled,p=Br(l,i,!1,c);return(0,d.jsxs)("div",{role:"menuitemradio","aria-checked":a,"aria-disabled":c||void 0,"data-midx":o,tabIndex:-1,style:p,onClick:()=>!c&&e.onChange?.(n.value),onMouseEnter:()=>!c&&u(o),children:[(0,d.jsx)("span",{style:{width:16,flexShrink:0,display:"flex",alignItems:"center"},children:a?(0,d.jsx)(Wr,{color:l.primary}):(0,d.jsx)("span",{style:{width:14,height:14,borderRadius:"50%",border:`2px solid ${l.border}`,display:"inline-block"}})}),n.icon&&(0,d.jsx)("span",{style:{flexShrink:0,display:"flex",color:l.textMuted},children:n.icon}),(0,d.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:oe(n.label)})]},n.value)})]},e.id);if("check"===e.type){t++;const n=t,r=n===s,o=!!e.disabled,i=Br(l,r,!1,o);return(0,d.jsxs)("div",{role:"menuitemcheckbox","aria-checked":e.checked,"aria-disabled":o||void 0,"data-midx":n,tabIndex:-1,style:i,onClick:()=>!o&&e.onChange?.(!e.checked),onMouseEnter:()=>!o&&u(n),children:[(0,d.jsx)("span",{style:{width:16,flexShrink:0,display:"flex",alignItems:"center"},children:e.checked?(0,d.jsx)(Tr,{color:l.primary}):(0,d.jsx)("span",{style:{width:14,height:14,display:"inline-block"}})}),e.icon&&(0,d.jsx)("span",{style:{flexShrink:0,display:"flex",color:l.textMuted},children:e.icon}),(0,d.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:oe(e.label)})]},e.id)}if("submenu"===e.type){t++;const r=t,i=r===s,a=!!e.disabled,h=p===e.id,m=Br(l,i||h,!1,a);return(0,d.jsxs)("div",{style:{position:"relative"},children:[(0,d.jsxs)("div",{role:"menuitem","aria-haspopup":"menu","aria-expanded":h,"aria-disabled":a||void 0,"data-midx":r,tabIndex:-1,style:m,onMouseEnter:t=>{a||(u(r),k(e,t.currentTarget))},onMouseLeave:()=>{},onClick:t=>{a||(h?$():k(e,t.currentTarget))},children:[(0,d.jsx)("span",{style:{width:16,flexShrink:0,display:"flex",alignItems:"center"},children:e.icon?(0,d.jsx)("span",{style:{display:"flex",color:l.textMuted},children:e.icon}):(0,d.jsx)("span",{style:{width:14}})}),(0,d.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:oe(e.label)}),(0,d.jsx)(jr,{color:l.textMuted})]}),h&&f&&(0,c.createPortal)((0,d.jsx)(Er,{items:e.items,pos:f,panelId:`${n}-sub-${e.id}`,onClose:$,onCloseAll:o,isSubmenu:!0}),document.body)]},e.id)}const r=e;t++;const i=t,a=i===s,h=!!r.disabled,m=!!r.danger,g=Br(l,a,m,h);return(0,d.jsxs)("div",{role:"menuitem","aria-disabled":h||void 0,"data-midx":i,tabIndex:-1,style:g,onClick:()=>{h||(r.onClick?.(),o())},onMouseEnter:()=>{h||(u(i),$())},children:[(0,d.jsx)("span",{style:{width:16,flexShrink:0,display:"flex",alignItems:"center"},children:r.icon?(0,d.jsx)("span",{style:{display:"flex",color:m?l.danger:l.textMuted},children:r.icon}):(0,d.jsx)("span",{style:{width:14}})}),(0,d.jsxs)("span",{style:{flex:1,minWidth:0},children:[(0,d.jsx)("span",{style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:oe(r.label)}),r.description&&(0,d.jsx)("span",{style:{display:"block",fontSize:"12px",color:l.textMuted,marginTop:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:oe(r.description)})]}),r.shortcut&&(0,d.jsx)("span",{style:{fontSize:"12px",color:l.textMuted,fontFamily:"inherit",flexShrink:0,marginLeft:16,opacity:.8},children:oe(r.shortcut)})]},r.id)})})()})]})}function Br(e,t,n,r){const o=n?e.danger:e.text;return{display:"flex",alignItems:"center",gap:8,padding:"7px 14px",fontSize:"14px",fontFamily:"inherit",cursor:r?"not-allowed":"pointer",userSelect:"none",color:r?e.textMuted:t&&n?e.danger:o,backgroundColor:t?n?`${e.danger}18`:`${e.primary}18`:"transparent",transition:"background-color 80ms",opacity:r?.5:1,outline:"none"}}function Vr({trigger:e,items:t,placement:n="bottom-start",isDisabled:r=!1,onOpen:o,onClose:i,className:l,style:s}){const u=`tkx-menu-${(0,a.useId)().replace(/:/g,"")}`,[p,h]=(0,a.useState)(!1),[f,m]=(0,a.useState)(null),g=(0,a.useRef)(null),x=(0,a.useCallback)(()=>{if(r)return;const e=g.current;e&&(m(Ar(e.getBoundingClientRect(),n,220,Math.min(38*t.length+12,360))),h(!0),o?.())},[r,t.length,o,n]),b=(0,a.useCallback)(()=>{h(!1),i?.(),(g.current?.firstElementChild)?.focus?.()},[i]);return(0,a.useEffect)(()=>{if(!p)return;const e=e=>{const t=e.target;if(g.current?.contains(t))return;const n=document.querySelectorAll(".tkx-menu-panel");for(const r of n)if(r.contains(t))return;b()};return document.addEventListener("pointerdown",e),()=>document.removeEventListener("pointerdown",e)},[p,b]),(0,a.useEffect)(()=>{if(!p)return;const e=()=>{const e=g.current;e&&m(Ar(e.getBoundingClientRect(),n,220,Math.min(38*t.length+12,360)))};return window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}},[p,t.length,n]),(0,d.jsxs)("span",{ref:g,className:l,style:{display:"inline-flex",...s},children:[(0,d.jsx)("span",{role:"button",tabIndex:r?-1:0,"aria-haspopup":"menu","aria-expanded":p,"aria-controls":p?u:void 0,"aria-disabled":r||void 0,onClick:()=>p?b():x(),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key&&"ArrowDown"!==e.key||(e.preventDefault(),p||x()),"Escape"===e.key&&p&&(e.preventDefault(),b())},style:{display:"inline-flex",cursor:r?"not-allowed":"pointer",opacity:r?.55:1,outline:"none"},children:e}),p&&f&&(0,c.createPortal)((0,d.jsx)(Er,{items:t,pos:f,panelId:u,onClose:b,onCloseAll:b}),document.body)]})}Vr.displayName="TkxMenu";var Hr={sm:120,md:180,lg:240,xl:320};function Or(e){const t=new Date;if(e)try{const n=new Intl.DateTimeFormat("en-US",{timeZone:e,hour:"numeric",minute:"numeric",second:"numeric",hour12:!1,weekday:"long",month:"long",day:"2-digit",year:"numeric"}).formatToParts(t),r=e=>n.find(t=>t.type===e)?.value??"0";let o=parseInt(r("hour"),10);24===o&&(o=0);const i=parseInt(r("minute"),10),a=parseInt(r("second"),10),l=`${r("weekday")}, ${r("month")} ${r("day")}, ${r("year")}`;return{hours:o,minutes:i,seconds:a,milliseconds:t.getMilliseconds(),dateString:l}}catch{}const n=t.getHours(),r=t.getMinutes(),o=t.getSeconds(),i=t.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"2-digit",year:"numeric"});return{hours:n,minutes:r,seconds:o,milliseconds:t.getMilliseconds(),dateString:i}}function qr({time:e,size:t,analogStyle:n,showSeconds:r,reducedMotion:o,primary:i,danger:a,text:l,textMuted:s,border:c,surface:u,bg:p}){const h=t/2,f=t/2,m=t/2-4,{hours:g,minutes:x,seconds:b,milliseconds:y}=e,v=(b+(o?0:y)/1e3)/60*360,w=x/60*360+b/60*6,k=g%12/12*360+x/60*30,$=(e,t)=>{const n=(e-90)*Math.PI/180;return{x:h+Math.cos(n)*t,y:f+Math.sin(n)*t}},S=o?"none":"transform 0.15s cubic-bezier(0.4, 2.08, 0.55, 0.44)";if("modern"===n){const e=(e,t)=>{const n=360*e-90;return`M ${h+Math.cos(-90*Math.PI/180)*t} ${f+Math.sin(-90*Math.PI/180)*t} A ${t} ${t} 0 ${e>.5?1:0} 1 ${h+Math.cos(n*Math.PI/180)*t} ${f+Math.sin(n*Math.PI/180)*t}`},n=g%12/12+x/60/12,u=x/60+b/3600,p=(b+(o?0:y/1e3))/60,v=m-2,w=m-10,k=m-18;return(0,d.jsxs)("svg",{width:t,height:t,viewBox:`0 0 ${t} ${t}`,"aria-hidden":"true",children:[(0,d.jsx)("circle",{cx:h,cy:f,r:v,fill:"none",stroke:c,strokeWidth:4}),(0,d.jsx)("circle",{cx:h,cy:f,r:w,fill:"none",stroke:c,strokeWidth:4}),r&&(0,d.jsx)("circle",{cx:h,cy:f,r:k,fill:"none",stroke:c,strokeWidth:3}),(0,d.jsx)("path",{d:e(n,v),fill:"none",stroke:i,strokeWidth:4,strokeLinecap:"round"}),(0,d.jsx)("path",{d:e(u,w),fill:"none",stroke:l,strokeWidth:4,strokeLinecap:"round"}),r&&(0,d.jsx)("path",{d:e(p,k),fill:"none",stroke:a,strokeWidth:3,strokeLinecap:"round"}),(0,d.jsx)("circle",{cx:h,cy:f,r:4,fill:i}),(0,d.jsxs)("text",{x:h,y:f+20,textAnchor:"middle",fontSize:.12*t,fill:s,fontFamily:"monospace",style:{fontVariantNumeric:"tabular-nums"},children:[String(g).padStart(2,"0"),":",String(x).padStart(2,"0")]})]})}const C=$(k,.5*m),z=$(w,.75*m),M=$(v,.85*m),N=$(v+180,.2*m),D=[];if("classic"===n){for(let e=0;e<60;e++){const t=e%5==0,n=(e/60*360-90)*Math.PI/180,r=t?m-10:m-6,o=h+Math.cos(n)*m,i=f+Math.sin(n)*m,a=h+Math.cos(n)*r,c=f+Math.sin(n)*r;D.push((0,d.jsx)("line",{x1:o,y1:i,x2:a,y2:c,stroke:t?l:s,strokeWidth:t?2:1,strokeLinecap:"round"},e))}for(const{n:e,angle:n}of[{n:12,angle:0},{n:3,angle:90},{n:6,angle:180},{n:9,angle:270}]){const r=(n-90)*Math.PI/180,o=m-20;D.push((0,d.jsx)("text",{x:h+Math.cos(r)*o,y:f+Math.sin(r)*o,textAnchor:"middle",dominantBaseline:"central",fontSize:.09*t,fill:l,fontFamily:"system-ui, sans-serif",fontWeight:"600",children:e},`n${e}`))}}else for(let R=0;R<12;R++){const e=(R/12*360-90)*Math.PI/180,t=m-8;D.push((0,d.jsx)("circle",{cx:h+Math.cos(e)*t,cy:f+Math.sin(e)*t,r:R%3==0?3:2,fill:R%3==0?l:s},R))}return(0,d.jsxs)("svg",{width:t,height:t,viewBox:`0 0 ${t} ${t}`,"aria-hidden":"true",style:{display:"block"},children:[(0,d.jsx)("circle",{cx:h,cy:f,r:m,fill:u,stroke:c,strokeWidth:2}),D,(0,d.jsx)("line",{x1:h,y1:f,x2:C.x,y2:C.y,stroke:i,strokeWidth:"minimal"===n?3:4,strokeLinecap:"round",style:{transformOrigin:`${h}px ${f}px`,transition:S}}),(0,d.jsx)("line",{x1:h,y1:f,x2:z.x,y2:z.y,stroke:l,strokeWidth:"minimal"===n?2:3,strokeLinecap:"round",style:{transformOrigin:`${h}px ${f}px`,transition:S}}),r&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("line",{x1:N.x,y1:N.y,x2:M.x,y2:M.y,stroke:a,strokeWidth:1.5,strokeLinecap:"round",style:{transformOrigin:`${h}px ${f}px`,transition:"none"}}),(0,d.jsx)("circle",{cx:h,cy:f,r:3,fill:a})]}),(0,d.jsx)("circle",{cx:h,cy:f,r:"minimal"===n?3:5,fill:i})]})}function Ur({time:e,format:t,showSeconds:n,showDate:r,label:o,size:i,primary:a,text:l,textMuted:s,colonVisible:c}){const{hours:u,minutes:p,seconds:h,dateString:f}=e;let m=u,g="";"12h"===t&&(g=u>=12?"PM":"AM",m=u%12||12);const x=.2*i,b={opacity:c?1:0,transition:"opacity 0.1s",display:"inline-block",minWidth:"0.5ch",textAlign:"center"};return(0,d.jsxs)("div",{style:{textAlign:"center",fontFamily:"'Courier New', Courier, monospace",fontVariantNumeric:"tabular-nums",lineHeight:1.1},children:[(0,d.jsxs)("div",{style:{fontSize:x,color:a,fontWeight:700,letterSpacing:"0.05em",display:"flex",alignItems:"center",justifyContent:"center",gap:0},children:[(0,d.jsx)("span",{children:String(m).padStart(2,"0")}),(0,d.jsx)("span",{style:b,children:":"}),(0,d.jsx)("span",{children:String(p).padStart(2,"0")}),n&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{style:b,children:":"}),(0,d.jsx)("span",{children:String(h).padStart(2,"0")})]}),"12h"===t&&(0,d.jsx)("span",{style:{fontSize:.45*x,color:s,marginLeft:"0.4ch",alignSelf:"flex-end",marginBottom:.05*x},children:g})]}),r&&(0,d.jsx)("div",{style:{fontSize:.072*i,color:s,marginTop:.025*i,letterSpacing:"0.03em"},children:f}),o&&(0,d.jsx)("div",{style:{fontSize:.065*i,color:s,marginTop:.015*i,textTransform:"uppercase",letterSpacing:"0.08em"},children:oe(o)})]})}function Kr({variant:e="both",size:t="md",showSeconds:n=!0,showDate:r=!1,format:o="24h",timezone:i,timezone2:l,label:s,analogStyle:c="classic",className:u,style:p}){const h=J(),f=Te(),[m,g]=(0,a.useState)(()=>Or(i)),[x,b]=(0,a.useState)(()=>l?Or(l):null),[y,v]=(0,a.useState)(!0),[w,k]=(0,a.useState)(!1),$=(0,a.useRef)(null);(0,a.useEffect)(()=>{k(!0)},[]),(0,a.useEffect)(()=>{const e=()=>{g(Or(i)),l&&b(Or(l))};e();const t=setInterval(e,1e3);return()=>clearInterval(t)},[i,l]),(0,a.useEffect)(()=>($.current=setInterval(()=>{v(e=>!e)},500),()=>{$.current&&clearInterval($.current)}),[]);const S=Hr[t],C="analog"===e||"both"===e,z="digital"===e||"both"===e;return(0,d.jsxs)("div",{className:u,style:{display:"inline-flex",flexDirection:"column",alignItems:"center",gap:"both"===e?.06*S+"px":0,opacity:w?1:0,transition:f?"none":"opacity 0.4s ease",...p},role:"timer","aria-live":"off",children:[C&&(0,d.jsx)(qr,{time:m,size:S,analogStyle:c,showSeconds:n,reducedMotion:f,primary:h.primary,danger:h.danger,text:h.text,textMuted:h.textMuted,border:h.border,surface:h.surface,bg:h.bg}),z&&(0,d.jsx)(Ur,{time:m,format:o,showSeconds:n,showDate:r,label:s,size:S,primary:h.primary,text:h.text,textMuted:h.textMuted,colonVisible:y}),x&&l&&(0,d.jsx)("div",{style:{marginTop:.04*S,padding:`${.03*S}px ${.06*S}px`,borderTop:`1px solid ${h.border}`,textAlign:"center"},children:(0,d.jsx)(Ur,{time:x,format:o,showSeconds:!1,showDate:!1,label:l,size:.7*S,primary:h.secondary,text:h.text,textMuted:h.textMuted,colonVisible:y})})]})}function Yr(e){if(!isFinite(e)||isNaN(e))return"0:00";const t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=Math.floor(e%60);return t>0?`${t}:${String(n).padStart(2,"0")}:${String(r).padStart(2,"0")}`:`${n}:${String(r).padStart(2,"0")}`}function Xr({path:e,size:t=20,color:n="currentColor",title:r}){return(0,d.jsx)("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:n,"aria-hidden":r?void 0:"true",role:r?"img":void 0,"aria-label":r,style:{display:"block",flexShrink:0},children:(0,d.jsx)("path",{d:e})})}Kr.displayName="TkxClock";var Zr="M8 5v14l11-7z",Gr="M6 19h4V5H6v14zm8-14v14h4V5h-4z";function _r({onClick:e,title:t,children:n,active:r,primary:o}){const[i,l]=(0,a.useState)(!1);return(0,d.jsx)("button",{type:"button",onClick:e,title:t,"aria-label":t,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),style:{background:"none",border:"none",padding:"6px",cursor:"pointer",color:r||i?o:"#ffffff",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"4px",flexShrink:0,transition:"color 0.15s ease"},children:n})}function Jr({src:e,poster:t,title:n,width:r="100%",height:o,autoPlay:i=!1,loop:l=!1,muted:s=!1,controls:c=!0,showTitle:u=!0,allowFullscreen:p=!0,allowPiP:h=!0,allowDownload:f=!1,chapters:m=[],subtitles:g=[],startTime:x,onPlay:b,onPause:y,onEnded:v,onTimeUpdate:w,className:k,style:$}){const S=J(),C=Te(),z=(0,a.useRef)(null),M=(0,a.useRef)(null),N=(0,a.useRef)(null),D=(0,a.useRef)(null),[R,P]=(0,a.useState)(!1),[F,I]=(0,a.useState)(0),[A,L]=(0,a.useState)(0),[T,W]=(0,a.useState)(0),[j,E]=(0,a.useState)(1),[B,V]=(0,a.useState)(s),[H,O]=(0,a.useState)(!1),[q,U]=(0,a.useState)(!0),[K,Y]=(0,a.useState)(!1),[X,Z]=(0,a.useState)(1),[G,_]=(0,a.useState)(!1),[Q,ee]=(0,a.useState)(-1),[te,ne]=(0,a.useState)(null),[re,ie]=(0,a.useState)(0),[ae,le]=(0,a.useState)(null),[se,de]=(0,a.useState)(!1),[ce,ue]=(0,a.useState)(!1),[pe,he]=(0,a.useState)(null),[fe,me]=(0,a.useState)(!1);(0,a.useEffect)(()=>{const e=z.current;if(!e)return;void 0!==x&&(e.currentTime=x);const t=()=>{I(e.currentTime),e.buffered.length>0&&W(e.buffered.end(e.buffered.length-1))},n=()=>L(e.duration),r=()=>P(!0),o=()=>{P(!1),Y(!0)},i=()=>{P(!1),Y(!0),v?.()},a=()=>de(!0),l=()=>de(!1),s=()=>ue(!0),d=()=>ue(!1),c=()=>{const t=e.error;he(t?`Error ${t.code}: ${t.message||"Failed to load video"}`:"Failed to load video"),ue(!1)};return e.addEventListener("timeupdate",t),e.addEventListener("durationchange",n),e.addEventListener("play",r),e.addEventListener("pause",o),e.addEventListener("ended",i),e.addEventListener("enterpictureinpicture",a),e.addEventListener("leavepictureinpicture",l),e.addEventListener("waiting",s),e.addEventListener("canplay",d),e.addEventListener("error",c),()=>{e.removeEventListener("timeupdate",t),e.removeEventListener("durationchange",n),e.removeEventListener("play",r),e.removeEventListener("pause",o),e.removeEventListener("ended",i),e.removeEventListener("enterpictureinpicture",a),e.removeEventListener("leavepictureinpicture",l),e.removeEventListener("waiting",s),e.removeEventListener("canplay",d),e.removeEventListener("error",c)}},[v,x]),(0,a.useEffect)(()=>{z.current&&(R?b?.():y?.())},[R,b,y]),(0,a.useEffect)(()=>{w?.(F,A)},[F,A,w]),(0,a.useEffect)(()=>{const e=z.current;if(!e)return;const t=e.textTracks;for(let n=0;n<t.length;n++)t[n].mode=n===Q?"showing":"disabled"},[Q]),(0,a.useEffect)(()=>{const e=()=>O(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]),(0,a.useEffect)(()=>{const e=M.current;if(!e)return;const t=e=>{const t=z.current;if(t&&"INPUT"!==e.target.tagName)switch(e.key){case" ":case"k":e.preventDefault(),xe();break;case"f":case"F":p&&ye();break;case"m":case"M":be();break;case"ArrowRight":e.preventDefault(),t.currentTime=Math.min(t.currentTime+10,t.duration);break;case"ArrowLeft":e.preventDefault(),t.currentTime=Math.max(t.currentTime-10,0);break;case"ArrowUp":e.preventDefault(),E(Math.min(j+.1,1)),z.current&&(z.current.volume=Math.min(j+.1,1));break;case"ArrowDown":e.preventDefault(),E(Math.max(j-.1,0)),z.current&&(z.current.volume=Math.max(j-.1,0))}};return e.addEventListener("keydown",t),()=>e.removeEventListener("keydown",t)},[j,p]);const ge=(0,a.useCallback)(()=>{U(!0),D.current&&clearTimeout(D.current),D.current=setTimeout(()=>{R&&U(!1)},3e3)},[R]);(0,a.useEffect)(()=>(ge(),()=>{D.current&&clearTimeout(D.current)}),[R,ge]);const xe=(0,a.useCallback)(()=>{const e=z.current;e&&(e.paused?(e.play().catch(()=>{}),le("play"),Y(!1)):(e.pause(),le("pause")),setTimeout(()=>le(null),600))},[]),be=(0,a.useCallback)(()=>{const e=z.current;if(!e)return;const t=!B;V(t),e.muted=t},[B]),ye=(0,a.useCallback)(()=>{const e=M.current;e&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):e.requestFullscreen().catch(()=>{}))},[]),ve=(0,a.useCallback)(async()=>{const e=z.current;if(e)try{document.pictureInPictureElement?await document.exitPictureInPicture():await e.requestPictureInPicture()}catch{}},[]),we=(0,a.useCallback)(()=>{0!==g.length&&(ee(e=>(e+1)%(g.length+1)-1),ee(e=>{const t=e+1;return t>=g.length?-1:t}))},[g.length]),ke=(0,a.useCallback)(()=>{const e=z.current;e&&(e.currentTime=Math.min(e.currentTime+10,e.duration||0))},[]),$e=(0,a.useCallback)(()=>{const e=z.current;e&&(e.currentTime=Math.max(e.currentTime-10,0))},[]),Se=(0,a.useCallback)(()=>{const e=z.current;e&&(he(null),e.load())},[]),Ce=(0,a.useCallback)(()=>{p&&ye()},[p,ye]),ze=(0,a.useCallback)(e=>{const t=z.current,n=N.current;if(!t||!n||!A)return;const r=n.getBoundingClientRect();t.currentTime=Math.max(0,Math.min(1,(e.clientX-r.left)/r.width))*A},[A]),Me=(0,a.useCallback)(e=>{const t=N.current;if(!t||!A)return;const n=t.getBoundingClientRect();ne(Math.max(0,Math.min(1,(e.clientX-n.left)/n.width))*A),ie(e.clientX-n.left)},[A]),Ne=(0,a.useCallback)(e=>{const t=parseFloat(e.target.value);E(t),z.current&&(z.current.volume=t,z.current.muted=0===t,V(0===t))},[]),De=(0,a.useCallback)(e=>{Z(e),z.current&&(z.current.playbackRate=e),_(!1)},[]),Re=m.length>0?[...m].reverse().find(e=>F>=e.time):null,Pe=e=>[...m].reverse().find(t=>e>=t.time)??null,Fe=Array.isArray(e)?e:[{src:e,type:"video/mp4"}],Ie=Array.isArray(e)?e[0].src:e,Ae=q||K||!R,Le=C?"none":"opacity 0.25s ease",We=B||0===j?"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":j<.5?"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":"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",je=A>0?F/A*100:0,Ee=A>0?T/A*100:0;return(0,d.jsxs)("div",{ref:M,className:k,tabIndex:0,onMouseMove:ge,onMouseLeave:()=>{R&&U(!1)},style:{position:"relative",width:r,height:o??"auto",background:"#000",borderRadius:"8px",overflow:"hidden",outline:"none",userSelect:"none",...$},children:[(0,d.jsxs)("video",{ref:z,style:{width:"100%",height:"100%",display:"block",objectFit:"contain"},poster:t,autoPlay:i,loop:l,muted:s,playsInline:!0,onClick:xe,onDoubleClick:Ce,children:[Fe.map((e,t)=>(0,d.jsx)("source",{src:e.src,type:e.type},t)),g.map((e,t)=>(0,d.jsx)("track",{kind:"subtitles",label:oe(e.label),srcLang:e.lang,src:e.src,default:e.default},t))]}),u&&n&&(0,d.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:Le,pointerEvents:"none"},children:[(0,d.jsx)("span",{style:{color:"#fff",fontSize:"0.95rem",fontWeight:600,textShadow:"0 1px 3px rgba(0,0,0,0.7)"},children:oe(n)}),Re&&(0,d.jsxs)("span",{style:{color:"rgba(255,255,255,0.65)",fontSize:"0.8rem",marginLeft:8},children:["— ",oe(Re.label)]})]}),ae&&(0,d.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:C?"none":"tkxvp-flash 0.6s ease forwards",pointerEvents:"none"},children:(0,d.jsx)(Xr,{path:"play"===ae?Zr:Gr,size:32,color:"#fff"})}),ce&&!pe&&(0,d.jsx)("div",{"aria-label":"Loading",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",pointerEvents:"none",zIndex:10},children:(0,d.jsx)("div",{style:{width:48,height:48,border:"4px solid rgba(255,255,255,0.25)",borderTopColor:S.primary,borderRadius:"50%",animation:C?"none":"tkxvp-spin 0.8s linear infinite"}})}),pe&&(0,d.jsxs)("div",{style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",background:"rgba(0,0,0,0.8)",zIndex:20,gap:12},children:[(0,d.jsx)(Xr,{path:"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",size:48,color:"#ef4444"}),(0,d.jsx)("span",{style:{color:"#fff",fontSize:"0.9rem",maxWidth:"80%",textAlign:"center"},children:pe}),(0,d.jsxs)("button",{type:"button",onClick:Se,style:{display:"flex",alignItems:"center",gap:6,background:S.primary,color:"#fff",border:"none",borderRadius:6,padding:"8px 18px",fontSize:"0.85rem",fontWeight:600,cursor:"pointer",marginTop:4},children:[(0,d.jsx)(Xr,{path:"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",size:18,color:"#fff"}),"Retry"]})]}),c&&(0,d.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:Le},onMouseEnter:()=>Y(!0),onMouseLeave:()=>Y(!1),children:[(0,d.jsxs)("div",{ref:N,role:"slider","aria-label":"Seek","aria-valuemin":0,"aria-valuemax":Math.floor(A),"aria-valuenow":Math.floor(F),tabIndex:0,onClick:ze,onMouseMove:Me,style:{position:"relative",height:4,borderRadius:2,background:"rgba(255,255,255,0.25)",cursor:"pointer",marginBottom:8,transition:"height 0.15s ease"},onMouseEnter:e=>{e.currentTarget.style.height="8px"},onMouseLeave:e=>{e.currentTarget.style.height="4px",ne(null)},children:[(0,d.jsx)("div",{style:{position:"absolute",top:0,left:0,bottom:0,width:`${Ee}%`,background:"rgba(255,255,255,0.3)",borderRadius:2,pointerEvents:"none"}}),(0,d.jsx)("div",{style:{position:"absolute",top:0,left:0,bottom:0,width:`${je}%`,background:S.primary,borderRadius:2,pointerEvents:"none"}}),(0,d.jsx)("div",{style:{position:"absolute",top:"50%",left:`${je}%`,transform:"translate(-50%, -50%)",width:12,height:12,borderRadius:"50%",background:S.primary,pointerEvents:"none"}}),m.map((e,t)=>{const n=A>0?e.time/A*100:0;return(0,d.jsx)("div",{title:oe(e.label),style:{position:"absolute",top:"50%",left:`${n}%`,transform:"translate(-50%, -50%)",width:8,height:8,borderRadius:"50%",background:"#fff",border:`2px solid ${S.primary}`,zIndex:2,cursor:"pointer",pointerEvents:"auto"}},t)}),null!==te&&(0,d.jsxs)("div",{style:{position:"absolute",bottom:12,left:re,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:[Yr(te),Pe(te)&&(0,d.jsx)("span",{style:{display:"block",fontSize:"0.65rem",color:"rgba(255,255,255,0.7)"},children:oe(Pe(te).label)})]})]}),(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:2},children:[(0,d.jsx)(_r,{onClick:xe,title:R?"Pause":"Play",primary:S.primary,children:(0,d.jsx)(Xr,{path:R?Gr:Zr,size:22})}),(0,d.jsx)(_r,{onClick:$e,title:"Skip back 10 seconds",primary:S.primary,children:(0,d.jsxs)("div",{style:{position:"relative",display:"flex",alignItems:"center",justifyContent:"center"},children:[(0,d.jsx)(Xr,{path:"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",size:22}),(0,d.jsx)("span",{style:{position:"absolute",fontSize:"7px",fontWeight:700,color:"currentColor",marginTop:1},children:"10"})]})}),(0,d.jsx)(_r,{onClick:ke,title:"Skip forward 10 seconds",primary:S.primary,children:(0,d.jsxs)("div",{style:{position:"relative",display:"flex",alignItems:"center",justifyContent:"center"},children:[(0,d.jsx)(Xr,{path:"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",size:22}),(0,d.jsx)("span",{style:{position:"absolute",fontSize:"7px",fontWeight:700,color:"currentColor",marginTop:1},children:"10"})]})}),(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",position:"relative"},onMouseEnter:()=>me(!0),onMouseLeave:()=>me(!1),children:[(0,d.jsx)(_r,{onClick:be,title:B?"Unmute":"Mute",primary:S.primary,children:(0,d.jsx)(Xr,{path:We,size:20})}),(0,d.jsx)("div",{style:{overflow:"hidden",width:fe?64:0,opacity:fe?1:0,transition:C?"none":"width 0.2s ease, opacity 0.2s ease",display:"flex",alignItems:"center"},children:(0,d.jsx)("input",{type:"range",min:0,max:1,step:.05,value:B?0:j,onChange:Ne,"aria-label":"Volume",style:{width:64,accentColor:S.primary,cursor:"pointer",height:4}})})]}),(0,d.jsxs)("span",{style:{color:"#fff",fontSize:"0.78rem",fontFamily:"monospace",fontVariantNumeric:"tabular-nums",marginLeft:6,whiteSpace:"nowrap",flexShrink:0},children:[Yr(F)," / ",Yr(A)]}),(0,d.jsx)("div",{style:{flex:1}}),g.length>0&&(0,d.jsx)(_r,{onClick:we,title:"Subtitles",primary:S.primary,active:Q>=0,children:(0,d.jsx)(Xr,{path:"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",size:20})}),(0,d.jsxs)("div",{style:{position:"relative",display:"flex",alignItems:"center"},children:[(0,d.jsxs)("button",{type:"button",onClick:()=>_(e=>!e),title:"Playback speed",style:{background:"none",border:"none",cursor:"pointer",color:"#fff",fontSize:"0.75rem",fontWeight:600,padding:"6px 8px",letterSpacing:"0.02em",position:"relative"},children:[X,"×"]}),1!==X&&(0,d.jsxs)("span",{style:{position:"absolute",top:0,right:0,background:S.primary,color:"#fff",fontSize:"0.55rem",fontWeight:700,borderRadius:6,padding:"1px 4px",lineHeight:1.2,pointerEvents:"none"},children:[X,"x"]}),G&&(0,d.jsx)("div",{style:{position:"absolute",bottom:"100%",right:0,background:"rgba(20,20,20,0.97)",border:`1px solid ${S.border}`,borderRadius:6,overflow:"hidden",zIndex:100,minWidth:80},children:[.5,.75,1,1.25,1.5,2].map(e=>(0,d.jsxs)("button",{type:"button",onClick:()=>De(e),style:{display:"block",width:"100%",padding:"6px 14px",background:e===X?S.primary+"30":"none",border:"none",color:e===X?S.primary:"#fff",fontSize:"0.8rem",cursor:"pointer",textAlign:"left"},children:[e,"×"]},e))})]}),h&&"undefined"!=typeof document&&"pictureInPictureEnabled"in document&&(0,d.jsx)(_r,{onClick:ve,title:"Picture-in-Picture",primary:S.primary,active:se,children:(0,d.jsx)(Xr,{path:"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",size:20})}),f&&(0,d.jsx)("a",{href:Ie,download:!0,title:"Download",style:{color:"#fff",display:"flex",alignItems:"center",padding:"6px"},children:(0,d.jsx)(Xr,{path:"M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z",size:20})}),p&&(0,d.jsx)(_r,{onClick:ye,title:H?"Exit fullscreen":"Fullscreen",primary:S.primary,children:(0,d.jsx)(Xr,{path:H?"M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z":"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z",size:20})})]})]}),(0,d.jsx)("style",{children:"\n @keyframes tkxvp-flash {\n 0% { opacity: 1; transform: translate(-50%,-50%) scale(1); }\n 100% { opacity: 0; transform: translate(-50%,-50%) scale(1.5); }\n }\n @keyframes tkxvp-spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "})]})}Jr.displayName="TkxVideoPlayer";var Qr={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 eo({size:e}){const t=.55*e;return(0,d.jsx)("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z"})})}function to({size:e}){const t=.55*e;return(0,d.jsx)("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.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 no({status:e,index:t,showStepNumbers:n,icon:r,circleSize:o,fontSize:i,primary:a,danger:l,success:s,text:c,textMuted:u,border:p,surface:h,variant:f,reducedMotion:m,clickable:g}){const x="completed"===e,b="active"===e,y="error"===e;let v=h,w=p,k=u,$=2;x?(v="filled"===f?s:h,w=s,k="filled"===f?"#fff":s):b?(v="outlined"===f?h:a,w=a,k="outlined"===f?a:"#fff",$=2):y?(v="filled"===f?l:h,w=l,k="filled"===f?"#fff":l):"pending"===e&&(v=h,w=p,k=u);const S=b&&!m?{boxShadow:`0 0 0 4px ${a}30`,animation:"tkxstepper-pulse 2s ease-in-out infinite"}:{},C=g?{cursor:"pointer",transition:"transform 0.15s ease, box-shadow 0.15s ease"}:{};let z;return z=!r||x||y?x?(0,d.jsx)(eo,{size:o}):y?(0,d.jsx)(to,{size:o}):n?(0,d.jsx)("span",{style:{fontSize:i,fontWeight:600,lineHeight:1},children:t+1}):(0,d.jsx)("span",{style:{fontSize:.22*o,lineHeight:1,background:k,borderRadius:"50%",width:.22*o,height:.22*o,display:"block"}}):(0,d.jsx)("span",{style:{fontSize:i,lineHeight:1},children:r}),(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("style",{children:`\n @keyframes tkxstepper-pulse {\n 0%, 100% { box-shadow: 0 0 0 0 ${a}50; }\n 50% { box-shadow: 0 0 0 6px ${a}20; }\n }\n `}),(0,d.jsx)("div",{style:{width:o,height:o,minWidth:o,borderRadius:"50%",border:`${$}px solid ${w}`,backgroundColor:v,color:k,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:m?"none":"background-color 0.2s, border-color 0.2s",...S,...C},children:z})]})}function ro({completed:e,orientation:t,connectorStyle:n,connectorWidth:r,primary:o,border:i,reducedMotion:a}){const l=e?o:i;return"horizontal"===t?(0,d.jsx)("div",{"aria-hidden":"true",style:{flex:1,height:r,backgroundColor:"solid"===n?l:"transparent",backgroundImage:"solid"!==n?`repeating-linear-gradient(90deg, ${l} 0, ${l} 6px, transparent 6px, transparent ${"dashed"===n?12:9}px)`:"none",borderRadius:1,transition:a?"none":"background-color 0.3s ease, background-image 0.3s ease",alignSelf:"center",marginLeft:4,marginRight:4}}):(0,d.jsx)("div",{"aria-hidden":"true",style:{width:r,flex:1,minHeight:20,backgroundColor:"solid"===n?l:"transparent",backgroundImage:"solid"!==n?`repeating-linear-gradient(180deg, ${l} 0, ${l} 6px, transparent 6px, transparent ${"dashed"===n?12:9}px)`:"none",borderRadius:1,transition:a?"none":"background-color 0.3s ease, background-image 0.3s ease",alignSelf:"stretch",marginTop:4,marginBottom:4,marginLeft:"auto",marginRight:"auto"}})}function oo({steps:e,activeStep:t=0,orientation:n="horizontal",variant:r="default",size:o="md",clickable:i=!1,onStepClick:a,showStepNumbers:l=!0,alternateLabel:s=!1,connector:c="solid",className:u,style:p}){const h=J(),f=Te(),m=Qr[o],g="horizontal"===n;return(0,d.jsx)("div",{className:u,role:"list","aria-label":"Steps",style:{display:"flex",flexDirection:g?"row":"column",alignItems:g?s?"flex-start":"center":"stretch",width:"100%",gap:0,...p},children:e.map((n,o)=>{const u=((e,n)=>e.status?e.status:n<t?"completed":n===t?"active":"pending")(n,o),p=o===e.length-1,x="completed"===u||o<t,b=o%2==0,y=()=>{i&&a?.(o)},v=(0,d.jsx)(no,{status:u,index:o,showStepNumbers:l,icon:n.icon,circleSize:m.circle,fontSize:m.fontSize,primary:h.primary,danger:h.danger,success:h.success,text:h.text,textMuted:h.textMuted,border:h.border,surface:h.surface,variant:r,reducedMotion:f,clickable:i}),w=(0,d.jsxs)("div",{style:{textAlign:g&&!s?"center":"left",maxWidth:g?120:void 0},children:[(0,d.jsxs)("div",{style:{fontSize:m.titleSize,fontWeight:"active"===u?600:500,color:"pending"===u?h.textMuted:"error"===u?h.danger:h.text,lineHeight:1.3,transition:f?"none":"color 0.2s"},children:[oe(n.title),n.optional&&(0,d.jsx)("span",{style:{fontSize:m.descSize,color:h.textMuted,fontWeight:400,marginLeft:4},children:"(optional)"})]}),n.description&&(0,d.jsx)("div",{style:{fontSize:m.descSize,color:h.textMuted,marginTop:2,lineHeight:1.4},children:oe(n.description)}),n.error&&"error"===u&&(0,d.jsx)("div",{style:{fontSize:m.descSize,color:h.danger,marginTop:2},children:oe(n.error)})]});return g?(0,d.jsxs)("div",{role:"listitem",style:{display:"flex",flex:p?0:1,alignItems:"center",minWidth:0},children:[(0,d.jsxs)("div",{onClick:y,style:{display:"flex",flexDirection:"column",alignItems:"center",gap:6,cursor:i?"pointer":"default",flexShrink:0},"aria-current":"active"===u?"step":void 0,children:[s&&!b&&(0,d.jsx)("div",{style:{minHeight:1.5*m.circle+6,display:"flex",alignItems:"flex-end",paddingBottom:6},children:w}),v,!s&&w,s&&b&&(0,d.jsx)("div",{style:{marginTop:6},children:w})]}),!p&&(0,d.jsx)(ro,{completed:x,orientation:"horizontal",connectorStyle:c,connectorWidth:m.connectorWidth,primary:h.primary,border:h.border,reducedMotion:f})]},n.id):(0,d.jsxs)("div",{role:"listitem",style:{display:"flex",flexDirection:"row",minHeight:0},children:[(0,d.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",marginRight:14,flexShrink:0},children:[(0,d.jsx)("div",{onClick:y,style:{cursor:i?"pointer":"default"},"aria-current":"active"===u?"step":void 0,children:v}),!p&&(0,d.jsx)(ro,{completed:x,orientation:"vertical",connectorStyle:c,connectorWidth:m.connectorWidth,primary:h.primary,border:h.border,reducedMotion:f})]}),(0,d.jsx)("div",{style:{paddingTop:(m.circle-16*parseFloat(m.titleSize))/2,paddingBottom:p?0:16,flex:1,minWidth:0},children:w})]},n.id)})})}function io(e){let t=0,n=0,r=0;const o=e.replace("#","");3===o.length?(t=parseInt(o[0]+o[0],16),n=parseInt(o[1]+o[1],16),r=parseInt(o[2]+o[2],16)):o.length>=6&&(t=parseInt(o.slice(0,2),16),n=parseInt(o.slice(2,4),16),r=parseInt(o.slice(4,6),16)),t/=255,n/=255,r/=255;const i=Math.max(t,n,r),a=Math.min(t,n,r);let l=0,s=0;const d=(i+a)/2;if(i!==a){const e=i-a;switch(s=d>.5?e/(2-i-a):e/(i+a),i){case t:l=((n-r)/e+(n<r?6:0))/6;break;case n:l=((r-t)/e+2)/6;break;case r:l=((t-n)/e+4)/6}}return[Math.round(360*l),Math.round(100*s),Math.round(100*d)]}function ao(e,t,n){n/=100;const r=(t/=100)*Math.min(n,1-n),o=t=>{const o=(t+e/30)%12,i=n-r*Math.max(Math.min(o-3,9-o,1),-1);return Math.round(255*i).toString(16).padStart(2,"0")};return`#${o(0)}${o(8)}${o(4)}`}function lo(e){const t=e.replace("#",""),n=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),o=parseInt(t.slice(4,6),16);return[isNaN(n)?0:n,isNaN(r)?0:r,isNaN(o)?0:o]}function so(e,t,n){return`#${e.toString(16).padStart(2,"0")}${t.toString(16).padStart(2,"0")}${n.toString(16).padStart(2,"0")}`}function co(e){return/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(e)}function uo(e,t,n){if("hex"===n)return t<1?`${e}${Math.round(255*t).toString(16).padStart(2,"0")}`:e;const[r,o,i]=lo(e);if("rgb"===n)return t<1?`rgba(${r}, ${o}, ${i}, ${t.toFixed(2)})`:`rgb(${r}, ${o}, ${i})`;const[a,l,s]=io(e);return"hsl"===n?t<1?`hsla(${a}, ${l}%, ${s}%, ${t.toFixed(2)})`:`hsl(${a}, ${l}%, ${s}%)`:e}oo.displayName="TkxStepper";var po=["#ef4444","#f97316","#eab308","#22c55e","#06b6d4","#3b82f6","#8b5cf6","#ec4899","#ffffff","#94a3b8","#475569","#0f172a"];function ho({hue:e,sat:t,bright:n,onChange:r}){const o=(0,a.useRef)(null),i=(0,a.useRef)(!1),l=(0,a.useCallback)(e=>{const t=o.current;if(!t)return;const n=t.getBoundingClientRect(),i=Math.max(0,Math.min(1,(e.clientX-n.left)/n.width)),a=Math.max(0,Math.min(1,(e.clientY-n.top)/n.height));r(Math.round(100*i),Math.round(100*(1-a)))},[r]);(0,a.useEffect)(()=>{const e=e=>{i.current&&l(e)},t=()=>{i.current=!1};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",t),()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",t)}},[l]);const s=`${t}%`,c=100-n+"%";return(0,d.jsxs)("div",{ref:o,style:{position:"relative",width:"100%",height:"160px",borderRadius:"6px",cursor:"crosshair",background:`hsl(${e}, 100%, 50%)`,flexShrink:0},onMouseDown:e=>{i.current=!0,l(e)},children:[(0,d.jsx)("div",{style:{position:"absolute",inset:0,borderRadius:"6px",background:"linear-gradient(to right, #ffffff, transparent)"}}),(0,d.jsx)("div",{style:{position:"absolute",inset:0,borderRadius:"6px",background:"linear-gradient(to bottom, transparent, #000000)"}}),(0,d.jsx)("div",{style:{position:"absolute",left:s,top:c,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:ao(e,t,n/2+25)}})]})}function fo({hue:e,onChange:t}){const n=(0,a.useRef)(null),r=(0,a.useRef)(!1),o=(0,a.useCallback)(e=>{const r=n.current;if(!r)return;const o=r.getBoundingClientRect(),i=Math.max(0,Math.min(1,(e.clientX-o.left)/o.width));t(Math.round(360*i))},[t]);return(0,a.useEffect)(()=>{const e=e=>{r.current&&o(e)},t=()=>{r.current=!1};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",t),()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",t)}},[o]),(0,d.jsx)("div",{ref:n,style:{position:"relative",height:"12px",borderRadius:"6px",cursor:"pointer",background:"linear-gradient(to right, #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000)"},onMouseDown:e=>{r.current=!0,o(e)},children:(0,d.jsx)("div",{style:{position:"absolute",left:e/360*100+"%",top:"50%",transform:"translate(-50%, -50%)",width:"16px",height:"16px",borderRadius:"50%",border:"2px solid white",boxShadow:"0 0 0 1px rgba(0,0,0,0.3)",backgroundColor:`hsl(${e}, 100%, 50%)`,pointerEvents:"none"}})})}function mo({alpha:e,hex:t,onChange:n}){const r=(0,a.useRef)(null),o=(0,a.useRef)(!1),i=(0,a.useCallback)(e=>{const t=r.current;if(!t)return;const o=t.getBoundingClientRect(),i=Math.max(0,Math.min(1,(e.clientX-o.left)/o.width));n(Math.round(100*i)/100)},[n]);(0,a.useEffect)(()=>{const e=e=>{o.current&&i(e)},t=()=>{o.current=!1};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",t),()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",t)}},[i]);const[l,s,c]=lo(t);return(0,d.jsxs)("div",{style:{position:"relative"},children:[(0,d.jsx)("div",{style:{position:"absolute",inset:0,borderRadius:"6px",backgroundImage:"repeating-conic-gradient(#ccc 0% 25%, white 0% 50%)",backgroundSize:"8px 8px"}}),(0,d.jsx)("div",{ref:r,style:{position:"relative",height:"12px",borderRadius:"6px",cursor:"pointer",background:`linear-gradient(to right, rgba(${l},${s},${c},0), rgba(${l},${s},${c},1))`},onMouseDown:e=>{o.current=!0,i(e)},children:(0,d.jsx)("div",{style:{position:"absolute",left:100*e+"%",top:"50%",transform:"translate(-50%, -50%)",width:"16px",height:"16px",borderRadius:"50%",border:"2px solid white",boxShadow:"0 0 0 1px rgba(0,0,0,0.3)",backgroundColor:`rgba(${l},${s},${c},${e})`,pointerEvents:"none"}})})]})}var go={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 xo(e,t,n){let r=e;return void 0!==t&&(r=Math.max(r,t)),void 0!==n&&(r=Math.min(r,n)),r}function bo(e,t){if(void 0===t)return e;const n=Math.pow(10,t);return Math.round(e*n)/n}function yo({direction:e,isDisabled:t,btnW:n,height:r,primaryColor:o,borderColor:i,textMuted:l,iconSz:s,onStep:c,incrementLabel:u,decrementLabel:p}){const h=(0,a.useRef)(null),f=(0,a.useRef)(null),m="inc"===e?1:-1,g=(0,a.useCallback)(()=>{c(m),h.current=setTimeout(()=>{f.current=setInterval(()=>c(m),60)},400)},[m,c]),x=(0,a.useCallback)(()=>{h.current&&(clearTimeout(h.current),h.current=null),f.current&&(clearInterval(f.current),f.current=null)},[]);(0,a.useEffect)(()=>()=>x(),[x]);const b="inc"===e;return(0,d.jsx)("button",{type:"button","aria-label":b?u:p,disabled:t,onMouseDown:g,onMouseUp:x,onMouseLeave:x,onTouchStart:e=>{e.preventDefault(),g()},onTouchEnd:x,style:{width:n,height:r,minWidth:n,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",background:"transparent",border:"none",borderRight:b?void 0:`1px solid ${i}`,borderLeft:b?`1px solid ${i}`:void 0,cursor:t?"not-allowed":"pointer",color:t?l:o,transition:"color 120ms ease, background 120ms ease",outline:"none"},onFocus:e=>{t||(e.currentTarget.style.background=`${o}12`)},onBlur:e=>{e.currentTarget.style.background="transparent"},children:b?(0,d.jsxs)("svg",{width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:[(0,d.jsx)("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),(0,d.jsx)("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}):(0,d.jsx)("svg",{width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:(0,d.jsx)("line",{x1:"5",y1:"12",x2:"19",y2:"12"})})})}function vo({value:e,defaultValue:t=0,onChange:n,min:r,max:o,step:i=1,precision:l,prefix:s,suffix:c,format:u,currency:p,locale:h,clampOnBlur:f=!0,allowMouseWheel:m=!1,size:g="md",label:x,hint:b,isDisabled:y=!1,isReadOnly:v=!1,isInvalid:w=!1,errorMessage:k,id:$,className:S,style:C}){const z=J(),M=Ot(),N=M.increment??"Increment",D=M.decrement??"Decrement",R=(0,a.useId)(),P=$??R,F=`${P}-hint`,I=`${P}-error`,A=void 0!==e,[L,T]=(0,a.useState)(t),W=A?e:L,[j,E]=(0,a.useState)(!1),[B,V]=(0,a.useState)(""),H=go[g],O=w||!!k,q=O?z.danger:j?z.primary:z.border,U=[b&&F,O&&I].filter(Boolean).join(" ")||void 0,K=x?oe(x):void 0,Y=b?oe(b):void 0,X=k?oe(k):void 0,Z=s?oe(s):void 0,G=c?oe(c):void 0,_=(0,a.useCallback)(e=>{const t=bo(e,l);A||T(t),n?.(t)},[A,n,l]),Q=(0,a.useCallback)(e=>{y||v||_(xo(bo(W+e*i,l),r,o))},[y,v,W,i,l,r,o,_]),ee=j?B:function(e,t,n,r,o){const i=r??"en-US";return"currency"===t?new Intl.NumberFormat(i,{style:"currency",currency:n??"USD",minimumFractionDigits:o??2,maximumFractionDigits:o??2}).format(e):"percent"===t?new Intl.NumberFormat(i,{style:"percent",minimumFractionDigits:o??0,maximumFractionDigits:o??0}).format(e/100):"decimal"===t||void 0!==o?new Intl.NumberFormat(i,{minimumFractionDigits:o??0,maximumFractionDigits:o??20}).format(e):String(e)}(W,u,p,h,l),te=(Z||G)&&!j;return(0,d.jsxs)("div",{className:xt(mt("flex flex-col gap-1 w-full"),S),style:C,children:[K&&(0,d.jsx)("label",{htmlFor:P,className:mt("text-sm font-medium font-sans"),style:{color:z.text},children:K}),(0,d.jsxs)("div",{className:mt("flex items-stretch overflow-hidden rounded-lg transition-colors duration-150"),style:{border:`1.5px solid ${q}`,backgroundColor:y?z.surfaceAlt:z.surface,opacity:y?.65:1,height:H.height},children:[(0,d.jsx)(yo,{direction:"dec",isDisabled:y||v,btnW:H.btnW,height:H.height,primaryColor:z.primary,borderColor:z.border,textMuted:z.textMuted,iconSz:H.iconSz,onStep:Q,incrementLabel:N,decrementLabel:D}),(0,d.jsxs)("div",{className:mt("relative flex-1 flex items-center overflow-hidden"),children:[te&&Z&&(0,d.jsx)("span",{style:{position:"absolute",left:H.px,fontSize:H.fontSize,color:z.textMuted,pointerEvents:"none",userSelect:"none"},children:Z}),(0,d.jsx)("input",{id:P,type:"text",inputMode:"decimal",value:j?B:ee,readOnly:v,disabled:y,"aria-invalid":O,"aria-describedby":U,"aria-valuemin":r,"aria-valuemax":o,"aria-valuenow":W,style:{width:"100%",height:"100%",border:"none",background:"transparent",outline:"none",textAlign:"center",fontSize:H.fontSize,fontFamily:"inherit",color:z.text,paddingLeft:te&&Z?`calc(${H.px} + 1.2em)`:H.px,paddingRight:te&&G?`calc(${H.px} + 1.2em)`:H.px,cursor:y?"not-allowed":v?"default":"text"},onFocus:()=>{E(!0),V(String(W))},onBlur:()=>{E(!1);const e=parseFloat(B);if(isNaN(e))return n?.(null),void V(String(W));let t=bo(e,l);f&&(t=xo(t,r,o)),_(t)},onChange:e=>{V(Se(e.target.value))},onKeyDown:e=>{"ArrowUp"===e.key&&(e.preventDefault(),Q(1)),"ArrowDown"===e.key&&(e.preventDefault(),Q(-1))},onWheel:e=>{m&&j&&(e.preventDefault(),Q(e.deltaY<0?1:-1))}}),te&&G&&(0,d.jsx)("span",{style:{position:"absolute",right:H.px,fontSize:H.fontSize,color:z.textMuted,pointerEvents:"none",userSelect:"none"},children:G})]}),(0,d.jsx)(yo,{direction:"inc",isDisabled:y||v,btnW:H.btnW,height:H.height,primaryColor:z.primary,borderColor:z.border,textMuted:z.textMuted,iconSz:H.iconSz,onStep:Q,incrementLabel:N,decrementLabel:D})]}),Y&&!X&&(0,d.jsx)("span",{id:F,className:mt("text-xs"),style:{color:z.textMuted},children:Y}),X&&(0,d.jsxs)("span",{id:I,role:"alert",className:mt("text-xs flex items-center gap-1"),style:{color:z.danger},children:[(0,d.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.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"})}),X]})]})}vo.displayName="TkxNumberInput";var wo={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 $o(e,t){return ko[t].test(e)?e.toUpperCase():""}function So({length:e=6,value:t,onChange:n,onComplete:r,type:o="number",mask:i=!1,autoFocus:l=!1,isDisabled:s=!1,isInvalid:c=!1,errorMessage:u,hint:p,size:h="md",separator:f,separatorPosition:m,webOTP:g=!0,className:x,style:b}){const y=J(),v=Ot(),w=(0,a.useId)(),k=`${w}-hint`,$=`${w}-error`,S=void 0!==t,C=t=>{const n=t.split("").slice(0,e);for(;n.length<e;)n.push("");return n},[z,M]=(0,a.useState)(()=>C(S?t:"")),N=S?C(t):z,D=(0,a.useRef)([]),R=wo[h],P=c||!!u,F=N.every(e=>""!==e),I=p?oe(p):void 0,A=u?oe(u):void 0,L=e=>P?y.danger:F?y.success:y.border;(0,a.useEffect)(()=>{l&&D.current[0]?.focus()},[]);const T=(0,a.useCallback)(e=>{S||M(e);const t=e.join("");n?.(t),e.every(e=>""!==e)&&r?.(t)},[S,n,r]);(0,a.useEffect)(()=>{if(!g||s)return;if("undefined"==typeof window||!("OTPCredential"in window))return;const t=new AbortController;return navigator.credentials?.get({otp:{transport:["sms"]},signal:t.signal}).then(t=>{if(!t?.code)return;const n=String(t.code).slice(0,e).split("").map(e=>$o(e,o));for(;n.length<e;)n.push("");T(n)}).catch(()=>{}),()=>t.abort()},[g,s,e,o]);const W=t=>{const n=Math.max(0,Math.min(e-1,t));D.current[n]?.focus()},j=t=>n=>{if(!s){if("Backspace"!==n.key){if("Delete"===n.key){n.preventDefault();const e=[...N];return e[t]="",void T(e)}return"ArrowLeft"===n.key?(n.preventDefault(),void W(t-1)):"ArrowRight"===n.key?(n.preventDefault(),void W(t+1)):"Home"===n.key?(n.preventDefault(),void W(0)):"End"===n.key?(n.preventDefault(),void W(e-1)):void 0}if(n.preventDefault(),""!==N[t]){const e=[...N];e[t]="",T(e)}else if(t>0){const e=[...N];e[t-1]="",T(e),W(t-1)}}},E=t=>n=>{if(s)return;const r=Se(n.target.value).slice(-1);if(!r)return;const i=$o(r,o);if(!i)return;const a=[...N];a[t]=i,T(a),t<e-1&&W(t+1)},B=t=>n=>{if(n.preventDefault(),s)return;const r=Se(n.clipboardData.getData("text")).split("").map(e=>$o(e,o)).filter(Boolean);if(!r.length)return;const i=[...N];let a=t;for(const t of r){if(a>=e)break;i[a]=t,a++}T(i),W(Math.min(a,e-1))},V=[I&&k,P&&$].filter(Boolean).join(" ")||void 0;return(0,d.jsxs)("div",{className:xt(mt("flex flex-col gap-2 w-fit"),x),style:b,children:[(0,d.jsx)("div",{role:"group","aria-label":v.oneTimePassword??"One-time password","aria-describedby":V,className:mt("flex items-center"),style:{gap:R.gap},children:Array.from({length:e},(t,n)=>{const r=L();return"undefined"!=typeof document&&(document.activeElement,D.current[n]),(0,d.jsxs)("div",{className:mt("flex items-center"),style:{gap:R.gap},children:[f&&m===n&&0!==n&&(0,d.jsx)("span",{"aria-hidden":"true",style:{color:y.textMuted,userSelect:"none",flexShrink:0},children:f}),(0,d.jsx)("input",{ref:e=>{D.current[n]=e},type:i?"password":"text",inputMode:"number"===o?"numeric":"text",maxLength:1,value:N[n],disabled:s,"aria-label":`Digit ${n+1} of ${e}`,autoComplete:"one-time-code",spellCheck:!1,onChange:E(n),onKeyDown:j(n),onPaste:B(n),onFocus:e=>e.target.select(),style:{width:R.box,height:R.box,textAlign:"center",fontSize:R.fontSize,fontFamily:"monospace",fontWeight:600,border:`1.5px solid ${r}`,borderRadius:"8px",backgroundColor:s?y.surfaceAlt:y.surface,color:y.text,outline:"none",boxShadow:"none",cursor:s?"not-allowed":"text",transition:"border-color 150ms ease, box-shadow 150ms ease",opacity:s?.6:1},onFocusCapture:e=>{s||(e.currentTarget.style.borderColor=P?y.danger:y.primary,e.currentTarget.style.boxShadow=`0 0 0 3px ${P?y.danger:y.primary}33`)},onBlurCapture:e=>{e.currentTarget.style.borderColor=L(),e.currentTarget.style.boxShadow="none"}})]},n)})}),I&&!A&&(0,d.jsx)("span",{id:k,className:mt("text-xs"),style:{color:y.textMuted},children:I}),A&&(0,d.jsxs)("span",{id:$,role:"alert",className:mt("text-xs flex items-center gap-1"),style:{color:y.danger},children:[(0,d.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.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]})]})}function Co(e,t){if(!e)return{matched:!0,ranges:[],score:0};const n=e.toLowerCase(),r=t.toLowerCase(),o=r.indexOf(n);if(-1!==o)return{matched:!0,ranges:[[o,o+n.length-1]],score:0===o?100:80};const i=[];let a=0,l=-1,s=-1;for(let d=0;d<r.length&&a<n.length;d++)r[d]===n[a]&&(-1!==s&&d===s+1||(-1!==l&&i.push([l,s]),l=d),s=d,a++);return-1!==l&&-1!==s&&i.push([l,s]),a<n.length?{matched:!1,ranges:[],score:0}:{matched:!0,ranges:i,score:40}}function zo({text:e,ranges:t,color:n}){if(!t.length)return(0,d.jsx)(d.Fragment,{children:e});const r=[];let o=0;for(const[i,a]of t)o<i&&r.push((0,d.jsx)("span",{children:e.slice(o,i)},`t-${o}`)),r.push((0,d.jsx)("span",{style:{color:n,fontWeight:700},children:e.slice(i,a+1)},`h-${i}`)),o=a+1;return o<e.length&&r.push((0,d.jsx)("span",{children:e.slice(o)},"t-end")),(0,d.jsx)(d.Fragment,{children:r})}function Mo({surface:e,border:t}){return(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"10px 12px",borderRadius:8,overflow:"hidden"},children:[(0,d.jsx)("div",{style:{width:24,height:24,borderRadius:6,background:`linear-gradient(90deg, ${t} 25%, ${e} 50%, ${t} 75%)`,backgroundSize:"200% 100%",animation:"tkx-shimmer 1.4s ease-in-out infinite",flexShrink:0}}),(0,d.jsxs)("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:5},children:[(0,d.jsx)("div",{style:{height:13,borderRadius:4,width:"60%",background:`linear-gradient(90deg, ${t} 25%, ${e} 50%, ${t} 75%)`,backgroundSize:"200% 100%",animation:"tkx-shimmer 1.4s ease-in-out infinite"}}),(0,d.jsx)("div",{style:{height:10,borderRadius:4,width:"40%",background:`linear-gradient(90deg, ${t} 25%, ${e} 50%, ${t} 75%)`,backgroundSize:"200% 100%",animation:"tkx-shimmer 1.4s ease-in-out 0.2s infinite"}})]})]})}function No({items:e,isOpen:t=!1,onClose:n,placeholder:r,emptyMessage:o,maxItems:i=8,onItemSelect:l,className:s,style:u}){const p=J(),h=Ot(),f=r??h.commandSearch??"Type a command or search…",[m,g]=(0,a.useState)(""),[x,b]=(0,a.useState)(0),[y,v]=(0,a.useState)(!1),w=(0,a.useRef)(null),k=(0,a.useRef)(null),$=(0,a.useId)(),S=function(e){const t=(0,a.useRef)(null);return(0,a.useEffect)(()=>{if(!e||!t.current)return;const n=t.current,r=n.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),o=r[0],i=r[r.length-1],a=e=>{"Tab"===e.key&&(e.shiftKey?document.activeElement===o&&(e.preventDefault(),i?.focus()):document.activeElement===i&&(e.preventDefault(),o?.focus()))};return n.addEventListener("keydown",a),()=>n.removeEventListener("keydown",a)},[e]),t}(t),C=function(e,t){if(!e.trim())return t.filter(e=>!e.disabled).map(e=>({item:e,score:0,labelRanges:[]}));const n=[];for(const r of t){if(r.disabled)continue;const t=Co(e,r.label),o=r.description?Co(e,r.description):{matched:!1,score:0},i=(r.keywords??[]).some(t=>Co(e,t).matched);t.matched?n.push({item:r,score:t.score+20,labelRanges:t.ranges}):o.matched?n.push({item:r,score:o.score,labelRanges:[]}):i&&n.push({item:r,score:20,labelRanges:[]})}return n.sort((e,t)=>t.score-e.score)}(m,e).slice(0,i),z=[];for(const a of C){const e=a.item.group,t=z.find(t=>t.group===e);t?t.items.push(a):z.push({group:e,items:[a]})}const M=z.flatMap(e=>e.items);var N,D;N=()=>{n?.()},D=t,(0,a.useEffect)(()=>{if(!D)return;const e=e=>{"Escape"===e.key&&N()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[N,D]),(0,a.useEffect)(()=>{t&&(g(""),b(0),setTimeout(()=>w.current?.focus(),30))},[t]),(0,a.useEffect)(()=>{x>=M.length&&b(Math.max(0,M.length-1))},[M.length,x]);const R=(0,a.useCallback)(e=>{const t=k.current;t&&t.querySelectorAll("[data-command-item]")[e]?.scrollIntoView({block:"nearest"})},[]),P=e=>{e.disabled||(e.onSelect?.(),l?.(e),n?.())};if(!t||"undefined"==typeof document)return null;const F=oe(f),I=h.noCommandsFound??`No results for "${oe(m)}"`,A=o?oe(o):I;if("undefined"!=typeof document&&!document.getElementById("tkx-shimmer-style")){const e=document.createElement("style");e.id="tkx-shimmer-style",e.textContent="@keyframes tkx-shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }",document.head.appendChild(e)}return(0,c.createPortal)((0,d.jsxs)("div",{role:"presentation",style:{position:"fixed",inset:0,zIndex:1e4,display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"15vh",paddingLeft:16,paddingRight:16},children:[(0,d.jsx)("div",{"aria-hidden":"true",onClick:n,style:{position:"absolute",inset:0,backgroundColor:"rgba(0,0,0,0.55)",backdropFilter:"blur(4px)",animation:"tkx-fade-in 120ms ease"}}),(0,d.jsxs)("div",{ref:S,role:"dialog","aria-modal":"true","aria-label":"Command palette",id:$,className:xt(s),style:{position:"relative",zIndex:1,width:"100%",maxWidth:560,backgroundColor:p.surface,border:`1px solid ${p.border}`,borderRadius:16,boxShadow:`0 24px 64px rgba(0,0,0,0.5), 0 0 0 1px ${p.border}`,overflow:"hidden",display:"flex",flexDirection:"column",maxHeight:"70vh",...u},children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 16px",borderBottom:`1px solid ${p.border}`},children:[(0,d.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:p.textMuted,strokeWidth:2,"aria-hidden":"true",style:{flexShrink:0},children:[(0,d.jsx)("circle",{cx:"11",cy:"11",r:"8"}),(0,d.jsx)("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),(0,d.jsx)("input",{ref:w,type:"text",role:"combobox","aria-expanded":!0,"aria-autocomplete":"list","aria-controls":`${$}-list`,"aria-activedescendant":M[x]?`${$}-item-${M[x].item.id}`:void 0,value:m,onChange:e=>{g(e.target.value),b(0)},onKeyDown:e=>{if("ArrowDown"===e.key){e.preventDefault();const t=Math.min(M.length-1,x+1);b(t),R(t)}else if("ArrowUp"===e.key){e.preventDefault();const t=Math.max(0,x-1);b(t),R(t)}else if("Enter"===e.key){e.preventDefault();const t=M[x];t&&P(t.item)}},placeholder:F,style:{flex:1,border:"none",background:"transparent",outline:"none",fontSize:16,fontFamily:"inherit",color:p.text}}),m&&(0,d.jsx)("button",{type:"button","aria-label":h.clearSelection,onClick:()=>{g(""),b(0),w.current?.focus()},style:{border:"none",background:"transparent",cursor:"pointer",color:p.textMuted,display:"flex",alignItems:"center",padding:0},children:(0,d.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:[(0,d.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,d.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),(0,d.jsx)("div",{id:`${$}-list`,ref:k,role:"listbox","aria-label":"Command results",style:{overflowY:"auto",flex:1,padding:"6px 8px"},children:y?Array.from({length:4},(e,t)=>(0,d.jsx)(Mo,{surface:p.surface,border:p.border},t)):0===M.length?(0,d.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:8,padding:"32px 16px",color:p.textMuted},children:[(0,d.jsxs)("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,"aria-hidden":"true",children:[(0,d.jsx)("circle",{cx:"11",cy:"11",r:"8"}),(0,d.jsx)("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"}),(0,d.jsx)("line",{x1:"8",y1:"11",x2:"14",y2:"11"})]}),(0,d.jsx)("span",{style:{fontSize:"0.875rem"},children:A})]}):z.map(({group:e,items:t},n)=>{const r=z.slice(0,n).reduce((e,t)=>e+t.items.length,0);return(0,d.jsxs)("div",{children:[e&&(0,d.jsx)("div",{role:"presentation",style:{fontSize:"0.6875rem",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.08em",color:p.textMuted,padding:"10px 12px 4px"},children:oe(e)}),t.map((e,t)=>{const n=r+t,o=n===x,i=e.item;return(0,d.jsxs)("div",{id:`${$}-item-${i.id}`,role:"option","aria-selected":o,"aria-disabled":i.disabled,"data-command-item":!0,onClick:()=>P(i),onMouseEnter:()=>b(n),style:{display:"flex",alignItems:"center",gap:10,padding:"9px 12px",borderRadius:8,cursor:i.disabled?"not-allowed":"pointer",opacity:i.disabled?.45:1,backgroundColor:o?`${p.primary}18`:"transparent",borderLeft:o?`2px solid ${p.primary}`:"2px solid transparent",transition:"background 80ms ease",userSelect:"none"},children:[i.icon&&(0,d.jsx)("span",{style:{width:20,height:20,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",color:o?p.primary:p.textMuted},children:i.icon}),(0,d.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,d.jsx)("div",{style:{fontSize:"0.875rem",fontWeight:500,color:p.text,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:(0,d.jsx)(zo,{text:i.label,ranges:e.labelRanges,color:p.primary})}),i.description&&(0,d.jsx)("div",{style:{fontSize:"0.75rem",color:p.textMuted,marginTop:1,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:oe(i.description)})]}),i.shortcut&&(0,d.jsx)("span",{style:{flexShrink:0,fontSize:"0.6875rem",fontWeight:500,color:p.textMuted,backgroundColor:p.surfaceAlt,border:`1px solid ${p.border}`,borderRadius:6,padding:"2px 6px",fontFamily:"monospace",letterSpacing:"0.04em"},children:oe(i.shortcut)})]},i.id)})]},e??"__default__")})}),M.length>0&&(0,d.jsxs)("div",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",gap:12,padding:"8px 16px",borderTop:`1px solid ${p.border}`,fontSize:"0.6875rem",color:p.textMuted},children:[(0,d.jsxs)("span",{children:[(0,d.jsx)("kbd",{style:{fontFamily:"monospace"},children:"↑↓"})," navigate"]}),(0,d.jsxs)("span",{children:[(0,d.jsx)("kbd",{style:{fontFamily:"monospace"},children:"↵"})," select"]}),(0,d.jsxs)("span",{children:[(0,d.jsx)("kbd",{style:{fontFamily:"monospace"},children:"Esc"})," close"]})]})]})]}),document.body)}function Do({direction:e,onClick:t,isDisabled:n,primaryColor:r,position:o,orientation:i}){const a="vertical"===i,l="prev"===e,s="inside"===o?{position:"absolute",zIndex:3,...a?{[l?"top":"bottom"]:10,left:"50%",transform:"translateX(-50%)"}:{[l?"left":"right"]:10,top:"50%",transform:"translateY(-50%)"}}:{flexShrink:0,position:"relative"};return(0,d.jsx)("button",{type:"button","aria-label":l?"Previous slide":"Next slide",disabled:n,onClick:t,style:{...s,width:36,height:36,borderRadius:"50%",border:"none",backgroundColor:"rgba(0,0,0,0.45)",backdropFilter:"blur(4px)",color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",cursor:n?"not-allowed":"pointer",opacity:n?.35:1,transition:"background 150ms ease, opacity 150ms ease",outline:"none"},onFocus:e=>{e.currentTarget.style.boxShadow=`0 0 0 3px ${r}55`},onBlur:e=>{e.currentTarget.style.boxShadow="none"},onMouseEnter:e=>{n||(e.currentTarget.style.backgroundColor="rgba(0,0,0,0.65)")},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="rgba(0,0,0,0.45)"},children:a?l?(0,d.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:(0,d.jsx)("polyline",{points:"18 15 12 9 6 15"})}):(0,d.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:(0,d.jsx)("polyline",{points:"6 9 12 15 18 9"})}):l?(0,d.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:(0,d.jsx)("polyline",{points:"15 18 9 12 15 6"})}):(0,d.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:(0,d.jsx)("polyline",{points:"9 18 15 12 9 6"})})})}function Ro({slides:e,autoPlay:t=!1,autoPlayInterval:n=4e3,pauseOnHover:r=!0,loop:o=!0,showArrows:i=!0,showDots:l=!0,showThumbnails:s=!1,orientation:c="horizontal",slidesToShow:u=1,gap:p=0,transitionDuration:h=400,swipeable:f=!0,initialIndex:m=0,onChange:g,arrowPosition:x="inside",height:b=320,className:y,style:v}){const w=J(),k=Te(),$=(0,a.useId)(),S=e.length,[C,z]=(0,a.useState)(m),[M,N]=(0,a.useState)(o?m+1:m),[D,R]=(0,a.useState)(!1),[P,F]=(0,a.useState)(!1),I=(0,a.useRef)(null),A=(0,a.useRef)(null),L=(0,a.useRef)(null),T=(0,a.useRef)(0),W=(0,a.useRef)(!1),j="vertical"===c,E=k?0:h,B=o&&S>1?[e[S-1],...e,e[0]]:e,V=B.length,H=100/u,O=(e,t=0)=>{const n=0!==t?` - ${t}px`:"";return j?`translateY(calc(-${e*H}%${n}))`:`translateX(calc(-${e*H}%${n}))`},q=(0,a.useCallback)((e,t=!1)=>{const n=o?(e%S+S)%S:Math.max(0,Math.min(S-1,e)),r=o?n+1:n;t&&I.current?(I.current.style.transition="none",N(r),z(n),I.current.offsetHeight,I.current.style.transition=""):(R(!0),N(r),z(n)),g?.(n)},[S,o,g]),U=(0,a.useCallback)(()=>q(C-1),[C,q]),K=(0,a.useCallback)(()=>q(C+1),[C,q]),Y=(0,a.useCallback)(()=>{R(!1),!o||S<=1||(0===M?q(S-1,!0):M===V-1&&q(0,!0))},[o,S,M,V,q]);(0,a.useEffect)(()=>{if(!(!t||P||S<=1))return A.current=setInterval(K,n),()=>{A.current&&clearInterval(A.current)}},[t,P,n,K,S]),(0,a.useEffect)(()=>{const e=e=>{const t=document.activeElement;document.getElementById($)?.contains(t)&&(e.key===(j?"ArrowUp":"ArrowLeft")&&(e.preventDefault(),U()),e.key===(j?"ArrowDown":"ArrowRight")&&(e.preventDefault(),K()))};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[$,j,U,K]);const X=e=>"touches"in e?j?e.touches[0].clientY:e.touches[0].clientX:j?e.clientY:e.clientX,Z=e=>{f&&(L.current=X(e),T.current=0,W.current=!0)},G=e=>{if(!W.current||null===L.current)return;const t=X(e)-L.current;T.current=t,I.current&&(I.current.style.transition="none",I.current.style.transform=O(M,-t))},_=()=>{if(!W.current)return;W.current=!1;const e=T.current;I.current&&(I.current.style.transition="",I.current.style.transform=""),e<-50?K():e>50?U():I.current&&(I.current.style.transform=O(M)),L.current=null,T.current=0},Q="number"==typeof b?`${b}px`:b,ee={display:"flex",flexDirection:j?"column":"row",width:j?"100%":V/u*100+"%",height:j?V/u*100+"%":"100%",transform:O(M),transition:D||!k?`transform ${E}ms cubic-bezier(0.4, 0, 0.2, 1)`:"none",willChange:"transform",gap:p>0?p:void 0},te={flexShrink:0,width:j?"100%":H/(V/u)+"%",height:j?H/(V/u)+"%":"100%",overflow:"hidden",position:"relative"},ne=o||C>0,re=o||C<S-1,oe="outside"===x;return(0,d.jsxs)("div",{id:$,className:xt(mt("flex flex-col gap-2"),y),style:v,"aria-roledescription":"carousel","aria-label":"Content carousel",children:[(0,d.jsxs)("div",{className:mt("flex items-center gap-2"),style:{gap:oe&&i?8:0},children:[i&&oe&&(0,d.jsx)(Do,{direction:"prev",onClick:U,isDisabled:!ne,primaryColor:w.primary,position:"outside",orientation:c}),(0,d.jsxs)("div",{style:{position:"relative",flex:1,overflow:"hidden",height:Q,borderRadius:12,cursor:f?W.current?"grabbing":"grab":"default",userSelect:"none"},onMouseEnter:()=>r&&F(!0),onMouseLeave:()=>{F(!1),_()},onTouchStart:Z,onTouchMove:G,onTouchEnd:_,onMouseDown:Z,onMouseMove:G,onMouseUp:_,"aria-live":"polite","aria-atomic":"false",children:[i&&!oe&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(Do,{direction:"prev",onClick:U,isDisabled:!ne,primaryColor:w.primary,position:"inside",orientation:c}),(0,d.jsx)(Do,{direction:"next",onClick:K,isDisabled:!re,primaryColor:w.primary,position:"inside",orientation:c})]}),(0,d.jsx)("div",{ref:I,style:ee,onTransitionEnd:Y,children:B.map((e,t)=>(0,d.jsx)("div",{style:te,role:"group","aria-roledescription":"slide","aria-label":`Slide ${(t-(o?1:0)+S)%S+1} of ${S}`,"aria-hidden":(t-(o?1:0)+S)%S!==C,children:e.content},`${e.id}-${t}`))}),l&&!s&&(0,d.jsx)("div",{"aria-label":"Slide indicators",style:{position:"absolute",bottom:12,left:"50%",transform:"translateX(-50%)",display:"flex",gap:6,zIndex:2},children:e.map((e,t)=>(0,d.jsx)("button",{type:"button","aria-label":`Go to slide ${t+1}`,"aria-current":t===C?"true":void 0,onClick:()=>q(t),style:{width:t===C?20:8,height:8,borderRadius:9999,border:"none",backgroundColor:t===C?w.primary:"rgba(255,255,255,0.5)",cursor:"pointer",padding:0,transition:"width 250ms ease, background 250ms ease",outline:"none"},onFocus:e=>{e.currentTarget.style.boxShadow=`0 0 0 3px ${w.primary}66`},onBlur:e=>{e.currentTarget.style.boxShadow="none"}},e.id))})]}),i&&oe&&(0,d.jsx)(Do,{direction:"next",onClick:K,isDisabled:!re,primaryColor:w.primary,position:"outside",orientation:c})]}),s&&(0,d.jsx)("div",{role:"tablist","aria-label":"Slide thumbnails",style:{display:"flex",gap:6,overflowX:"auto",paddingBottom:4,scrollbarWidth:"thin"},children:e.map((e,t)=>(0,d.jsxs)("button",{type:"button",role:"tab","aria-selected":t===C,"aria-label":`Thumbnail for slide ${t+1}`,onClick:()=>q(t),style:{flexShrink:0,width:60,height:42,border:`2px solid ${t===C?w.primary:w.border}`,borderRadius:6,overflow:"hidden",cursor:"pointer",padding:0,background:w.surfaceAlt,transition:"border-color 150ms ease",outline:"none",position:"relative"},onFocus:e=>{e.currentTarget.style.boxShadow=`0 0 0 3px ${w.primary}55`},onBlur:e=>{e.currentTarget.style.boxShadow="none"},children:[e.thumbnail?(0,d.jsx)("img",{src:e.thumbnail,alt:"","aria-hidden":"true",style:{width:"100%",height:"100%",objectFit:"cover",display:"block"}}):(0,d.jsx)("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"0.625rem",color:w.textMuted,fontWeight:600},children:t+1}),t===C&&(0,d.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",inset:0,backgroundColor:`${w.primary}22`}})]},e.id))})]})}function Po({color:e}){return(0,d.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",style:{flexShrink:0},children:(0,d.jsx)("path",{d:"M6 3l5 5-5 5",stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Fo({onClick:e,bgColor:t,hoverColor:n,textColor:r,label:o}){return(0,d.jsx)("button",{type:"button",onClick:e,onKeyDown:t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e())},"aria-label":o,className:mt("inline-flex items-center justify-center rounded px-1.5 py-0.5","text-sm font-medium cursor-pointer border-none outline-none","focus-visible:ring-2 focus-visible:ring-offset-1"),style:{backgroundColor:t,color:r,transition:"background-color 150ms ease"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor=n},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=t},children:"…"})}function Io(e,t){if(!t)return!0;const n=t.toLowerCase(),r=e.label.toLowerCase();let o=0;for(let i=0;i<r.length&&o<n.length;i++)r[i]===n[o]&&o++;return o===n.length}function Ao({color:e}){return(0,d.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",style:{animation:"spin 0.8s linear infinite",flexShrink:0},children:[(0,d.jsx)("circle",{cx:"8",cy:"8",r:"6",stroke:e,strokeWidth:"2",opacity:"0.3"}),(0,d.jsx)("path",{d:"M14 8a6 6 0 00-6-6",stroke:e,strokeWidth:"2",strokeLinecap:"round"})]})}function Lo({expanded:e,color:t,reducedMotion:n}){return(0,d.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",style:{transform:e?"rotate(90deg)":"rotate(0deg)",transition:n?"none":"transform 150ms ease",flexShrink:0},children:(0,d.jsx)("path",{d:"M6 3l5 5-5 5",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function To({checked:e,color:t,borderColor:n}){return(0,d.jsx)("span",{role:"presentation","aria-hidden":"true",className:mt("inline-flex items-center justify-center flex-shrink-0"),style:{width:16,height:16,borderRadius:3,border:`1.5px solid ${e?t:n}`,backgroundColor:e?t:"transparent",transition:"all 100ms ease"},children:e&&(0,d.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:(0,d.jsx)("path",{d:"M2 5l2.5 2.5L8 3",stroke:"#fff",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})}So.displayName="TkxOTP",No.displayName="TkxCommand",Ro.displayName="TkxCarousel";var Wo={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 jo({color:e}){return(0,d.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[(0,d.jsx)("circle",{cx:"6",cy:"6",r:"4.5",stroke:e,strokeWidth:"1.5"}),(0,d.jsx)("path",{d:"M9.5 9.5L13 13",stroke:e,strokeWidth:"1.5",strokeLinecap:"round"})]})}function Eo({checked:e,primaryColor:t,borderColor:n}){return(0,d.jsx)("span",{"aria-hidden":"true",className:mt("inline-flex items-center justify-center flex-shrink-0"),style:{width:16,height:16,borderRadius:3,border:`1.5px solid ${e?t:n}`,backgroundColor:e?t:"transparent",transition:"all 100ms ease"},children:e&&(0,d.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:(0,d.jsx)("path",{d:"M2 5l2.5 2.5L8 3",stroke:"#fff",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})}function Bo({color:e}){return(0,d.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M3 8h10M9 4l4 4-4 4",stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Vo({color:e}){return(0,d.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M13 8H3M7 4l-4 4 4 4",stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Ho({title:e,items:t,selected:n,onToggle:r,onToggleAll:o,search:i,onSearchChange:l,searchable:s,height:c,listId:u}){const p=J(),h=Te(),f=oe(e),m=(0,a.useMemo)(()=>{if(!i)return t;const e=i.toLowerCase();return t.filter(t=>t.label.toLowerCase().includes(e))},[t,i]),g=m.filter(e=>!e.disabled),x=g.length>0&&g.every(e=>n.has(e.value));return g.some(e=>n.has(e.value)),(0,d.jsxs)("div",{className:mt("flex flex-col rounded-lg overflow-hidden flex-1 min-w-0"),style:{border:`1px solid ${p.border}`,backgroundColor:p.surface},children:[(0,d.jsxs)("div",{className:mt("flex items-center gap-2 px-3 py-2 border-b"),style:{borderColor:p.border,backgroundColor:p.surfaceAlt},children:[(0,d.jsx)("button",{type:"button","aria-label":x?`Deselect all ${f}`:`Select all ${f}`,onClick:o,className:mt("border-none bg-transparent cursor-pointer p-0 outline-none focus-visible:ring-2"),children:(0,d.jsx)(Eo,{checked:x,primaryColor:p.primary,borderColor:p.border})}),(0,d.jsx)("span",{className:mt("text-sm font-medium flex-1 truncate"),style:{color:p.text},children:f}),(0,d.jsxs)("span",{className:mt("text-xs"),style:{color:p.textMuted},children:[n.size,"/",t.length]})]}),s&&(0,d.jsxs)("div",{className:mt("flex items-center gap-1.5 px-3 py-1.5 border-b"),style:{borderColor:p.border},children:[(0,d.jsx)(jo,{color:p.textMuted}),(0,d.jsx)("input",{type:"text","aria-label":`Search ${f}`,value:i,onChange:e=>l(e.target.value),placeholder:"Search...",className:mt("flex-1 bg-transparent border-none outline-none text-xs"),style:{color:p.text}})]}),(0,d.jsx)("ul",{id:u,role:"listbox","aria-label":f,"aria-multiselectable":"true",className:mt("list-none m-0 p-1 overflow-y-auto"),style:{height:c,minHeight:100},children:0===m.length?(0,d.jsx)("li",{className:mt("text-xs text-center py-4"),style:{color:p.textMuted},"aria-disabled":"true",children:"No items"}):m.map(e=>{const t=n.has(e.value),o=oe(e.label);return(0,d.jsxs)("li",{role:"option","aria-selected":t,"aria-disabled":e.disabled||void 0,tabIndex:0,onClick:()=>!e.disabled&&r(e.value),onKeyDown:t=>!e.disabled&&((e,t)=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),r(t))})(t,e.value),className:mt("flex items-center gap-2 px-2 py-1.5 rounded-md cursor-pointer text-sm","outline-none focus-visible:ring-2 focus-visible:ring-offset-1",e.disabled?"opacity-50 cursor-not-allowed":""),style:{color:e.disabled?p.textMuted:p.text,backgroundColor:t?`${p.primary}10`:"transparent",transition:h?"none":"background-color 100ms ease"},onMouseEnter:n=>{e.disabled||t||(n.currentTarget.style.backgroundColor=p.surfaceAlt)},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=t?`${p.primary}10`:"transparent"},children:[(0,d.jsx)(Eo,{checked:t,primaryColor:p.primary,borderColor:p.border}),(0,d.jsx)("span",{className:mt("truncate"),children:o})]},e.value)})})]})}function Oo({color:e,rotated:t,reducedMotion:n}){return(0,d.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",style:{transform:t?"rotate(45deg)":"rotate(0deg)",transition:n?"none":"transform 200ms ease"},children:(0,d.jsx)("path",{d:"M12 5v14M5 12h14",stroke:e,strokeWidth:"2.5",strokeLinecap:"round"})})}var qo={"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 Uo({open:e}){return(0,d.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round","aria-hidden":"true",children:e?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,d.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),(0,d.jsx)("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),(0,d.jsx)("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]})})}var Ko=!1,Yo=!1,Xo={success:(0,d.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm-2 14.5l-4-4 1.41-1.41L10 13.67l6.59-6.59L18 8.5l-8 8z"})}),error:(0,d.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),warning:(0,d.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"})}),info:(0,d.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.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"})})},Zo={"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 Go({direction:e}){return(0,d.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:mt("shrink-0 ml-1"),children:"asc"===e?(0,d.jsx)("path",{d:"M7 14l5-5 5 5H7z"}):"desc"===e?(0,d.jsx)("path",{d:"M7 10l5 5 5-5H7z"}):(0,d.jsx)("path",{d:"M7 10l5 5 5-5H7zM7 14l5-5 5 5H7z",opacity:"0.35"})})}function _o({expanded:e}){return(0,d.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10","aria-hidden":"true",style:{display:"inline-block",marginRight:6,transform:e?"rotate(90deg)":"rotate(0deg)",transition:"transform 120ms ease"},children:(0,d.jsx)("path",{d:"M2 1l6 4-6 4z",fill:"currentColor"})})}function Jo({expanded:e}){return(0,d.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10","aria-hidden":"true",style:{display:"inline-block",transform:e?"rotate(90deg)":"rotate(0deg)",transition:"transform 120ms ease"},children:(0,d.jsx)("path",{d:"M2 1l6 4-6 4z",fill:"currentColor"})})}function Qo({checked:e,indeterminate:t}){const n=J();return(0,d.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16","aria-hidden":"true",children:[(0,d.jsx)("rect",{x:"1",y:"1",width:"14",height:"14",rx:"2",fill:e||t?n.primary:"transparent",stroke:e||t?n.primary:n.border,strokeWidth:"1.5"}),t&&(0,d.jsx)("line",{x1:"4",y1:"8",x2:"12",y2:"8",stroke:n.bg,strokeWidth:"2"}),e&&!t&&(0,d.jsx)("path",{d:"M4.5 8L7 10.5L11.5 5.5",fill:"none",stroke:n.bg,strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function ei(e,t){return"function"==typeof t?t(e):String(e[t])}function ti(e,t){return e[t]}function ni(e,t){return null==e&&null==t?0:null==e?1:null==t?-1:"number"==typeof e&&"number"==typeof t?e-t:String(e).localeCompare(String(t),void 0,{numeric:!0,sensitivity:"base"})}function ri(e){const t=String(e??"");return t.includes(",")||t.includes('"')||t.includes("\n")?`"${t.replace(/"/g,'""')}"`:t}function oi({colCount:e}){const t=J();return(0,d.jsx)("tbody",{children:Array.from({length:5},(n,r)=>(0,d.jsx)("tr",{children:Array.from({length:e},(e,n)=>(0,d.jsx)("td",{className:mt("px-3 py-2"),style:{borderBottom:`1px solid ${t.border}`},children:(0,d.jsx)(_t,{height:16})},n))},r))})}function ii({label:e,showExport:t,onExport:n,totalRows:r,selectedCount:o,theme:i}){return t||0!==o?(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",borderBottom:`1px solid ${i.border}`,backgroundColor:i.surface,gap:8},children:[(0,d.jsx)("span",{style:{fontSize:13,color:i.textMuted},children:o>0?`${o} of ${r} row${1!==r?"s":""} selected`:`${r} row${1!==r?"s":""}`}),t&&(0,d.jsxs)("button",{onClick:n,"aria-label":`Export ${e} as CSV`,style:{display:"inline-flex",alignItems:"center",gap:6,padding:"5px 12px",fontSize:13,fontWeight:500,borderRadius:6,border:`1px solid ${i.border}`,backgroundColor:"transparent",color:i.text,cursor:"pointer"},children:[(0,d.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,d.jsx)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,d.jsx)("polyline",{points:"7 10 12 15 17 10"}),(0,d.jsx)("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]}),"Export CSV"]})]}):null}function ai({page:e,totalPages:t,pageSize:n,totalRows:r,onPageChange:o,theme:i}){const a=(e-1)*n+1,l=Math.min(e*n,r),s={display:"inline-flex",alignItems:"center",justifyContent:"center",width:32,height:32,borderRadius:6,border:`1px solid ${i.border}`,backgroundColor:"transparent",color:i.text,cursor:"pointer",fontSize:13,fontWeight:500};return(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",borderTop:`1px solid ${i.border}`,backgroundColor:i.surface,gap:8,flexWrap:"wrap"},role:"navigation","aria-label":"Pagination",children:[(0,d.jsx)("span",{style:{fontSize:13,color:i.textMuted},children:0===r?"0 rows":`${a}–${l} of ${r}`}),(0,d.jsxs)("div",{style:{display:"flex",gap:4},children:[(0,d.jsx)("button",{onClick:()=>o(1),disabled:1===e,"aria-label":"First page",style:{...s,opacity:1===e?.4:1},children:"«"}),(0,d.jsx)("button",{onClick:()=>o(e-1),disabled:1===e,"aria-label":"Previous page",style:{...s,opacity:1===e?.4:1},children:"‹"}),Array.from({length:Math.min(5,t)},(n,r)=>{let a=r+1;return t>5&&(a=Math.max(1,Math.min(e-Math.floor(2.5),t-4))+r),(0,d.jsx)("button",{onClick:()=>o(a),"aria-label":`Page ${a}`,"aria-current":a===e?"page":void 0,style:{...s,backgroundColor:a===e?i.primary:"transparent",color:a===e?i.bg:i.text,borderColor:a===e?i.primary:i.border},children:a},a)}),(0,d.jsx)("button",{onClick:()=>o(e+1),disabled:e===t,"aria-label":"Next page",style:{...s,opacity:e===t?.4:1},children:"›"}),(0,d.jsx)("button",{onClick:()=>o(t),disabled:e===t,"aria-label":"Last page",style:{...s,opacity:e===t?.4:1},children:"»"})]})]})}function li({col:e,row:t,initialValue:n,onCommit:r,onCancel:o}){const i=J(),[l,s]=(0,a.useState)(n),[c,u]=(0,a.useState)(null),p=(0,a.useRef)(null),h=(0,a.useId)(),f=(0,a.useRef)(!1);(0,a.useEffect)(()=>{if(p.current&&(p.current.focus(),"select"in p.current&&"function"==typeof p.current.select))try{p.current.select()}catch{}},[]);const m=(0,a.useCallback)(n=>{if(e.validateCell){const r=e.validateCell(n,t);if(r)return u(r),!1}return u(null),r(n),!0},[e,t,r]),g=(0,a.useCallback)(e=>{"Enter"===e.key?(e.preventDefault(),e.stopPropagation(),m(l)):"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),f.current=!0,o())},[l,m,o]),x=(0,a.useCallback)(()=>{f.current?f.current=!1:m(l)},[m,l]);if("function"==typeof e.editor)return(0,d.jsxs)(d.Fragment,{children:[e.editor({value:n,row:t,onCommit:e=>m(e),onCancel:o}),c&&(0,d.jsx)("span",{id:h,role:"alert",style:{display:"block",marginTop:2,fontSize:11,color:"#dc2626"},children:c})]});const b=`Edit ${e.header}`,y={width:"100%",padding:"3px 6px",fontSize:13,borderRadius:4,border:`1px solid ${c?"#dc2626":i.primary}`,backgroundColor:i.bg,color:i.text,outline:"none",boxSizing:"border-box"};let v;if("select"===e.editor){const t=e.editorOptions?.options??[];v=(0,d.jsx)("select",{ref:e=>{p.current=e},value:l,onChange:e=>s(e.target.value),onKeyDown:g,onBlur:x,"aria-label":b,"aria-describedby":c?h:void 0,style:y,children:t.map(e=>(0,d.jsx)("option",{value:e.value,children:e.label},String(e.value)))})}else v="number"===e.editor?(0,d.jsx)("input",{ref:e=>{p.current=e},type:"number",value:null==l?"":String(l),onChange:e=>{const t=e.target.value;s(""===t?"":Number(t))},onKeyDown:g,onBlur:x,"aria-label":b,"aria-describedby":c?h:void 0,style:y}):(0,d.jsx)("input",{ref:e=>{p.current=e},type:"text",value:null==l?"":String(l),onChange:e=>s(e.target.value),onKeyDown:g,onBlur:x,"aria-label":b,"aria-describedby":c?h:void 0,style:y});return(0,d.jsxs)(d.Fragment,{children:[v,c&&(0,d.jsx)("span",{id:h,role:"alert","data-cell-error":"",style:{display:"block",marginTop:2,fontSize:11,color:"#dc2626"},children:c})]})}var si=!1,di={info:(0,d.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"})}),warning:(0,d.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"})}),success:(0,d.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm-2 14.5l-4-4 1.41-1.41L10 13.67l6.59-6.59L18 8.5l-8 8z"})}),danger:(0,d.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.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"})})},ci={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}},ui={heading:function({block:e}){const t=J(),n=e.level??1,r=`h${n}`,o=oe(e.content??"");return(0,d.jsx)(r,{className:mt("m-0"),style:{...ci[n],color:t.text},children:o})},paragraph:function({block:e}){const t=J(),n=oe(e.content??"");return(0,d.jsx)("p",{className:mt("m-0"),style:{fontSize:"0.938rem",lineHeight:1.7,color:t.text,marginBottom:12},children:n})},blockquote:function({block:e}){const t=J(),n=oe(e.content??"");return(0,d.jsx)("blockquote",{className:mt("m-0"),style:{borderLeft:`3px solid ${t.primary}`,paddingLeft:16,paddingTop:8,paddingBottom:8,marginTop:12,marginBottom:12,backgroundColor:`${t.surfaceAlt}`,borderRadius:"0 6px 6px 0",color:t.textMuted,fontStyle:"italic",fontSize:"0.938rem",lineHeight:1.6},children:n})},code:function({block:e}){const t=J(),n=oe(e.content??""),r=e.language?oe(e.language):null;return(0,d.jsxs)("div",{className:mt("rounded-lg overflow-hidden"),style:{marginTop:12,marginBottom:12,border:`1px solid ${t.border}`,backgroundColor:t.surfaceAlt},children:[r&&(0,d.jsx)("div",{className:mt("px-3 py-1 text-[11px] font-semibold uppercase tracking-wider"),style:{color:t.textMuted,borderBottom:`1px solid ${t.border}`,backgroundColor:t.surface},children:r}),(0,d.jsx)("pre",{className:mt("m-0 p-4 overflow-x-auto"),style:{fontFamily:"'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace",fontSize:"0.85rem",lineHeight:1.6,color:t.text,tabSize:2},children:(0,d.jsx)("code",{"aria-label":r?`Code block in ${r}`:"Code block",children:n})})]})},list:function({block:e}){const t=J(),n=e.ordered?"ol":"ul",r=(e.items??[]).map(e=>oe(e));return(0,d.jsx)(n,{className:mt("m-0"),style:{paddingLeft:24,marginTop:8,marginBottom:12,color:t.text,fontSize:"0.938rem",lineHeight:1.7,listStyleType:e.ordered?"decimal":"disc"},role:"list",children:r.map((e,t)=>(0,d.jsx)("li",{role:"listitem",style:{marginBottom:4},children:e},t))})},divider:function(){return(0,d.jsx)("hr",{"aria-hidden":"true",style:{border:"none",borderTop:`1px solid ${J().border}`,marginTop:20,marginBottom:20}})},image:function({block:e}){const t=J(),n=oe(e.src??""),r=oe(e.alt??"Image");return(0,d.jsxs)("figure",{className:mt("m-0"),style:{marginTop:12,marginBottom:12},children:[(0,d.jsx)("img",{src:n,alt:r,loading:"lazy",className:mt("rounded-lg"),style:{maxWidth:"100%",height:"auto",display:"block",border:`1px solid ${t.border}`}}),e.alt&&(0,d.jsx)("figcaption",{className:mt("text-xs mt-2 text-center"),style:{color:t.textMuted},children:r})]})},callout:function({block:e}){const t=J(),n=e.variant??"info",r=oe(e.content??""),o={info:t.info,warning:t.warning,success:t.success,danger:t.danger}[n],i=di[n];return(0,d.jsxs)("div",{role:{info:"note",warning:"alert",success:"status",danger:"alert"}[n],className:mt("flex gap-3 px-4 py-3 rounded-lg"),style:{backgroundColor:`${o}12`,border:`1px solid ${o}33`,marginTop:12,marginBottom:12},children:[(0,d.jsx)("span",{className:mt("shrink-0 mt-[2px]"),style:{color:o},children:i}),(0,d.jsx)("div",{className:mt("flex-1"),style:{fontSize:"0.9rem",lineHeight:1.6,color:t.text},children:r})]})}};function pi(e){const t=[];let n=0,r="";const o=()=>{r&&(t.push({kind:"text",value:r}),r="")};for(;n<e.length;){const i=e[n];if("\\"===i&&n+1<e.length)r+=e[n+1],n+=2;else{if("!"===i&&"["===e[n+1]){const r=e.indexOf("]",n+2);if(-1!==r&&"("===e[r+1]){const i=e.indexOf(")",r+2);if(-1!==i){o(),t.push({kind:"image",alt:e.slice(n+2,r),src:e.slice(r+2,i)}),n=i+1;continue}}}if("["===i){const r=hi(e,n,"[","]");if(-1!==r&&"("===e[r+1]){const i=e.indexOf(")",r+2);if(-1!==i){o(),t.push({kind:"link",href:e.slice(r+2,i).trim(),children:pi(e.slice(n+1,r))}),n=i+1;continue}}}if("<"===i){const r=e.indexOf(">",n+1);if(-1!==r){const i=e.slice(n+1,r);if(/^(https?:\/\/|mailto:)/i.test(i)||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i)){o();const e=/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i)?`mailto:${i}`:i;t.push({kind:"link",href:e,children:[{kind:"text",value:i}]}),n=r+1;continue}}}if("`"===i){const r=e.indexOf("`",n+1);if(-1!==r){o(),t.push({kind:"code",value:e.slice(n+1,r)}),n=r+1;continue}}if("~"===i&&"~"===e[n+1]){const r=e.indexOf("~~",n+2);if(-1!==r){o(),t.push({kind:"strike",children:pi(e.slice(n+2,r))}),n=r+2;continue}}if("*"===i&&"*"===e[n+1]||"_"===i&&"_"===e[n+1]){const r=i+i,a=e.indexOf(r,n+2);if(-1!==a){o(),t.push({kind:"bold",children:pi(e.slice(n+2,a))}),n=a+2;continue}}if(("*"===i||"_"===i)&&e[n+1]!==i){const r=e.indexOf(i,n+1);if(-1!==r&&e.slice(n+1,r).trim().length>0){o(),t.push({kind:"italic",children:pi(e.slice(n+1,r))}),n=r+1;continue}}r+=i,n++}}return o(),t}function hi(e,t,n,r){let o=0;for(let i=t;i<e.length;i++)if("\\"!==e[i]){if(e[i]===n)o++;else if(e[i]===r&&(o--,0===o))return i}else i++;return-1}function fi(e){const t=e.replace(/^\uFEFF/,"").replace(/\r\n?/g,"\n").split("\n"),n=[];let r=0;for(;r<t.length;){const e=t[r];if(/^\s*$/.test(e)){r++;continue}const o=e.match(/^\s*```(.*)$/);if(o){const e=o[1].trim();r++;const i=[];for(;r<t.length&&!/^\s*```\s*$/.test(t[r]);)i.push(t[r]),r++;r<t.length&&r++,n.push({kind:"code",language:e,value:i.join("\n")});continue}const i=e.match(/^(#{1,6})\s+(.*?)\s*#*\s*$/);if(i){n.push({kind:"heading",level:i[1].length,inline:pi(i[2])}),r++;continue}if(/^\s*([-*_])\s*(?:\1\s*){2,}$/.test(e)){n.push({kind:"hr"}),r++;continue}if(xi(e)&&r+1<t.length&&bi(t[r+1])){const o=yi(e).map(pi),i=vi(t[r+1]);r+=2;const a=[];for(;r<t.length&&xi(t[r]);)a.push(yi(t[r]).map(pi)),r++;n.push({kind:"table",headers:o,rows:a,align:i});continue}if(/^\s*>/.test(e)){const e=[];for(;r<t.length&&/^\s*>/.test(t[r]);)e.push(t[r].replace(/^\s*>\s?/,"")),r++;n.push({kind:"blockquote",children:fi(e.join("\n"))});continue}if(mi(e)){const[e,o]=gi(t,r);n.push(e),r=o;continue}const a=[e];for(r++;r<t.length&&!/^\s*$/.test(t[r])&&!/^#{1,6}\s/.test(t[r])&&!/^\s*```/.test(t[r])&&!/^\s*>/.test(t[r])&&!mi(t[r])&&!/^\s*([-*_])\s*(?:\1\s*){2,}$/.test(t[r]);)a.push(t[r]),r++;n.push({kind:"paragraph",inline:pi(a.join(" "))})}return n}function mi(e){return/^(\s*)([-*+]|\d+[.)])\s+/.test(e)}function gi(e,t){const n=e[t].match(/^(\s*)([-*+]|\d+[.)])\s+/),r=n[1].length,o=/\d/.test(n[2]),i=[];let a=t;for(;a<e.length;){const t=e[a].match(/^(\s*)([-*+]|\d+[.)])\s+(.*)$/);if(!t||t[1].length!==r)break;const n=t[3];let o=null,l=n;const s=n.match(/^\[([ xX])\]\s+(.*)$/);s&&(o="x"===s[1].toLowerCase()?"checked":"unchecked",l=s[2]);const d=[l];for(a++;a<e.length;){if(/^\s*$/.test(e[a])){if(a+1<e.length&&/^\s+\S/.test(e[a+1])){d.push(""),a++;continue}break}const t=e[a].match(/^(\s*)(\S)/);if(!(t&&t[1].length>r))break;d.push(e[a].slice(r+2)),a++}i.push({blocks:fi(d.join("\n")),task:o})}return[{kind:"list",ordered:o,items:i},a]}function xi(e){return/^\s*\|.+\|\s*$/.test(e.trim())||e.includes("|")&&e.trim().startsWith("|")}function bi(e){return/^\s*\|?\s*:?-{2,}:?\s*(\|\s*:?-{2,}:?\s*)+\|?\s*$/.test(e)}function yi(e){return e.trim().replace(/^\|/,"").replace(/\|$/,"").split("|").map(e=>e.trim())}function vi(e){return yi(e).map(e=>{const t=e.startsWith(":"),n=e.endsWith(":");return t&&n?"center":n?"right":t?"left":null})}function wi(e,t,n="i"){return e.map((e,r)=>{const o=`${n}-${r}`;switch(e.kind){case"text":return(0,d.jsx)("span",{children:oe(e.value)},o);case"bold":return(0,d.jsx)("strong",{children:wi(e.children,t,o)},o);case"italic":return(0,d.jsx)("em",{children:wi(e.children,t,o)},o);case"strike":return(0,d.jsx)("s",{children:wi(e.children,t,o)},o);case"code":return(0,d.jsx)("code",{style:{background:t.theme.surfaceAlt,border:`1px solid ${t.theme.border}`,borderRadius:4,padding:"0.15em 0.4em",fontSize:"0.9em",fontFamily:"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",wordBreak:"break-word"},children:oe(e.value)},o);case"link":{const n=ki(e.href);if(!n)return(0,d.jsx)("span",{children:wi(e.children,t,o)},o);const r=/^(https?:)?\/\//i.test(n)||n.startsWith("mailto:");return(0,d.jsx)("a",{href:n,target:r?t.externalLinkTarget:void 0,rel:r?t.externalLinkRel:void 0,onClick:e=>{!1===t.onLinkClick?.(n,e)&&e.preventDefault()},style:{color:t.theme.primary,textDecoration:"underline",wordBreak:"break-word"},children:wi(e.children,t,o)},o)}case"image":return(0,d.jsx)("img",{src:ki(e.src)||"",alt:oe(e.alt),loading:"lazy",decoding:"async",style:{maxWidth:"100%",height:"auto",borderRadius:6,display:"inline-block"}},o)}})}function ki(e){const t=e.trim();return t?/^javascript:/i.test(t)||/^data:/i.test(t)&&!/^data:image\//i.test(t)||/^vbscript:/i.test(t)?null:t:null}function $i({text:e,theme:t}){const[n,r]=(0,a.useState)(!1);return(0,d.jsx)("button",{type:"button",onClick:()=>{"undefined"!=typeof navigator&&navigator.clipboard&&navigator.clipboard.writeText(e).then(()=>{r(!0),setTimeout(()=>r(!1),1500)})},"aria-label":n?"Copied to clipboard":"Copy code",style:{position:"absolute",top:6,right:6,padding:"2px 8px",fontSize:11,background:t.surface,color:n?t.success:t.textMuted,border:`1px solid ${t.border}`,borderRadius:4,cursor:"pointer",fontFamily:"inherit",transition:"color 120ms"},children:n?"Copied":"Copy"})}function Si(e,t,n="b"){return e.map((e,r)=>{const o=`${n}-${r}`;switch(e.kind){case"heading":{const n=`h${e.level}`,r={1:{fs:t.compact?"1.75rem":"2rem",lh:"1.2",mt:"0.6em",mb:"0.5em",fw:700},2:{fs:t.compact?"1.4rem":"1.6rem",lh:"1.25",mt:"1em",mb:"0.5em",fw:700},3:{fs:t.compact?"1.2rem":"1.3rem",lh:"1.3",mt:"1em",mb:"0.4em",fw:600},4:{fs:"1.1rem",lh:"1.35",mt:"1em",mb:"0.4em",fw:600},5:{fs:"1rem",lh:"1.4",mt:"1em",mb:"0.3em",fw:600},6:{fs:"0.9rem",lh:"1.4",mt:"1em",mb:"0.3em",fw:600}}[e.level];return(0,d.jsx)(n,{style:{fontSize:r.fs,lineHeight:r.lh,marginTop:r.mt,marginBottom:r.mb,fontWeight:r.fw,color:t.theme.text,scrollMarginTop:"1em"},children:wi(e.inline,t,o)},o)}case"paragraph":return(0,d.jsx)("p",{style:{margin:"0 0 "+(t.compact?"0.7em":"1em"),lineHeight:1.65,color:t.theme.text,wordBreak:"break-word"},children:wi(e.inline,t,o)},o);case"blockquote":return(0,d.jsx)("blockquote",{style:{margin:"0 0 1em",padding:"0.5em 1em",borderLeft:`4px solid ${t.theme.primary}`,background:`${t.theme.surfaceAlt}`,color:t.theme.textMuted,borderRadius:"0 6px 6px 0"},children:Si(e.children,t,o)},o);case"code":{const n=e.value;return(0,d.jsxs)("div",{style:{position:"relative",margin:"0 0 1em",border:`1px solid ${t.theme.border}`,borderRadius:8,background:t.theme.surfaceAlt,overflow:"hidden"},children:[e.language&&(0,d.jsx)("div",{style:{padding:"4px 10px",fontSize:11,color:t.theme.textMuted,borderBottom:`1px solid ${t.theme.border}`,textTransform:"uppercase",letterSpacing:"0.05em"},children:oe(e.language)}),t.copyableCode&&(0,d.jsx)($i,{text:n,theme:t.theme}),(0,d.jsx)("pre",{style:{margin:0,padding:12,overflowX:"auto",fontSize:13,lineHeight:1.55,fontFamily:"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",color:t.theme.text,whiteSpace:"pre"},children:(0,d.jsx)("code",{children:oe(n)})})]},o)}case"list":return(0,d.jsx)(e.ordered?"ol":"ul",{style:{margin:"0 0 1em",paddingLeft:"1.5em",color:t.theme.text,lineHeight:1.65},children:e.items.map((e,n)=>(0,d.jsxs)("li",{style:{listStyle:null!==e.task?"none":void 0,marginLeft:null!==e.task?"-1.25em":void 0},children:[null!==e.task&&(0,d.jsx)("input",{type:"checkbox",disabled:!0,checked:"checked"===e.task,readOnly:!0,style:{marginRight:6,verticalAlign:"middle"},"aria-label":"checked"===e.task?"Completed task":"Uncompleted task"}),Si(e.blocks,t,`${o}-${n}`)]},`${o}-${n}`))},o);case"hr":return(0,d.jsx)("hr",{style:{border:"none",borderTop:`1px solid ${t.theme.border}`,margin:"1.5em 0"}},o);case"table":return(0,d.jsx)("div",{style:{overflowX:"auto",margin:"0 0 1em",border:`1px solid ${t.theme.border}`,borderRadius:6,WebkitOverflowScrolling:"touch"},children:(0,d.jsxs)("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:14,color:t.theme.text},children:[(0,d.jsx)("thead",{children:(0,d.jsx)("tr",{children:e.headers.map((n,r)=>(0,d.jsx)("th",{style:{padding:"8px 12px",textAlign:e.align[r]??"left",borderBottom:`2px solid ${t.theme.border}`,background:t.theme.surfaceAlt,fontWeight:600},children:wi(n,t,`${o}-h-${r}`)},r))})}),(0,d.jsx)("tbody",{children:e.rows.map((n,r)=>(0,d.jsx)("tr",{children:n.map((n,i)=>(0,d.jsx)("td",{style:{padding:"8px 12px",textAlign:e.align[i]??"left",borderBottom:`1px solid ${t.theme.border}`},children:wi(n,t,`${o}-r-${r}-${i}`)},i))},r))})]})},o)}})}function Ci({source:e,src:t,maxWidth:n="100%",compact:r=!1,copyableCode:o=!0,onLinkClick:i,externalLinkRel:l="noopener noreferrer",externalLinkTarget:s="_blank",loadingFallback:c,errorFallback:u,className:p,style:h}){const f=J(),[m,g]=(0,a.useState)({text:null,error:null,loading:!!t&&void 0===e}),x=(0,a.useRef)(null);(0,a.useEffect)(()=>{if(void 0!==e||!t)return;x.current?.abort();const n=new AbortController;return x.current=n,g({text:null,error:null,loading:!0}),fetch(t,{signal:n.signal}).then(async e=>{if(!e.ok)throw new Error(`Failed to load markdown (HTTP ${e.status})`);g({text:await e.text(),error:null,loading:!1})}).catch(e=>{"AbortError"!==e.name&&g({text:null,error:e.message,loading:!1})}),()=>n.abort()},[t,e]);const b=e??m.text??"",y=(0,a.useMemo)(()=>b?fi(b):[],[b]),v={theme:f,compact:r,copyableCode:o,externalLinkRel:l,externalLinkTarget:s,onLinkClick:i},w={maxWidth:n,width:"100%",color:f.text,fontFamily:"inherit",fontSize:r?14:15,lineHeight:1.65,wordBreak:"break-word",overflowWrap:"anywhere",boxSizing:"border-box",...h};if(void 0===e&&t){if(m.loading)return(0,d.jsx)("div",{className:p,style:w,"aria-busy":"true","aria-live":"polite",children:c??(0,d.jsx)("span",{style:{color:f.textMuted},children:"Loading…"})});if(m.error)return(0,d.jsx)("div",{className:p,style:w,role:"alert",children:u?u(m.error):(0,d.jsx)("span",{style:{color:f.danger},children:oe(m.error)})})}return(0,d.jsx)("div",{className:p,style:w,children:Si(y,v)})}Ci.displayName="TkxMarkdown";var zi=(0,a.createContext)(null),Mi={required:"This field is required",invalidFormat:"Invalid format",minLength:e=>`Must be at least ${e} characters`,maxLength:e=>`Must be no more than ${e} characters`,minValue:e=>`Must be at least ${e}`,maxValue:e=>`Must be no more than ${e}`};async function Ni(e,t,n=Mi){for(const r of t){if(r.required&&(null==e||""===e||Array.isArray(e)&&0===e.length))return r.message??n.required;if(null!=e&&""!==e){if(void 0!==r.min){if("string"==typeof e&&e.length<r.min)return r.message??n.minLength(r.min);if("number"==typeof e&&e<r.min)return r.message??n.minValue(r.min)}if(void 0!==r.max){if("string"==typeof e&&e.length>r.max)return r.message??n.maxLength(r.max);if("number"==typeof e&&e>r.max)return r.message??n.maxValue(r.max)}if(r.pattern&&"string"==typeof e&&!r.pattern.test(e))return r.message??n.invalidFormat;if(r.validator){const t=await r.validator(e);if(t)return t}}}return null}function Di({onSubmit:e,onValuesChange:t,initialValues:n={},layout:r="vertical",disabled:o=!1,children:i,className:l,style:s,form:c}){const u=J(),p=Ot(),h=(0,a.useMemo)(()=>({required:p.fieldRequired??Mi.required,invalidFormat:p.invalidFormat??Mi.invalidFormat,minLength:p.minLength??Mi.minLength,maxLength:p.maxLength??Mi.maxLength,minValue:p.minValue??Mi.minValue,maxValue:p.maxValue??Mi.maxValue}),[p]),[f,m]=(0,a.useState)({values:{...n},errors:{},touched:{}}),g=(0,a.useRef)(n),x=(0,a.useRef)({}),b=(0,a.useRef)(f);b.current=f;const y=(0,a.useCallback)((e,t)=>{x.current[e]=t},[]),v=(0,a.useCallback)(e=>{delete x.current[e]},[]),w=(0,a.useCallback)((e,n)=>{m(r=>{const o={...r,values:{...r.values,[e]:n}};return t?.({[e]:n},o.values),o})},[t]),k=(0,a.useCallback)((e,t)=>{m(n=>({...n,errors:{...n.errors,[e]:t}}))},[]),$=(0,a.useCallback)(e=>{m(t=>({...t,touched:{...t.touched,[e]:!0}}))},[]),S=(0,a.useCallback)(async e=>{const t=x.current[e];if(!t)return!0;const n=b.current.values[e],r=await Ni(n,t.rules,h);return m(t=>({...t,errors:{...t.errors,[e]:r},touched:{...t.touched,[e]:!0}})),null===r},[h]),C=(0,a.useCallback)(async()=>{const e=Object.keys(x.current),t=await Promise.all(e.map(async e=>{const t=x.current[e],n=b.current.values[e];return{name:e,error:await Ni(n,t.rules,h)}})),n={},r={};let o=!1;for(const{name:i,error:a}of t)n[i]=a,r[i]=!0,a&&(o=!0);if(m(e=>({...e,errors:{...e.errors,...n},touched:{...e.touched,...r}})),o){const e=Object.fromEntries(t.filter(e=>e.error).map(e=>[e.name,e.error]));return Promise.reject(e)}return{...b.current.values}},[]),z=(0,a.useCallback)(()=>{m({values:{...g.current},errors:{},touched:{}})},[]),M=(0,a.useMemo)(()=>({getFieldValue:e=>b.current.values[e],setFieldValue:w,getFieldsValue:()=>({...b.current.values}),setFieldsValue:e=>{m(n=>{const r={...n.values,...e};return t?.(e,r),{...n,values:r}})},validateFields:C,validateField:S,resetFields:z,getFieldError:e=>b.current.errors[e]??null,isFieldTouched:e=>!!b.current.touched[e]}),[w,C,S,z,t]),N=(0,a.useCallback)(async t=>{t.preventDefault();try{const t=await C();await(e?.(t))}catch{}},[C,e]),D=mt("inline"===r?"flex flex-row flex-wrap items-end gap-4":"flex flex-col gap-5");(0,a.useEffect)(()=>{if(!c)return;const e=c;e.getFieldValue=M.getFieldValue,e.setFieldValue=M.setFieldValue,e.getFieldsValue=M.getFieldsValue,e.setFieldsValue=M.setFieldsValue,e.validateFields=M.validateFields,e.validateField=M.validateField,e.resetFields=M.resetFields,e.getFieldError=M.getFieldError,e.isFieldTouched=M.isFieldTouched},[c,M]);const R=c??M,P=(0,a.useMemo)(()=>({state:f,initialValues:g.current,layout:r,disabled:o,fieldMeta:x,setFieldValue:w,setFieldError:k,setFieldTouched:$,registerField:y,unregisterField:v,validateField:S,instance:R}),[f,r,o,w,k,$,y,v,S,R]);return(0,d.jsx)(zi.Provider,{value:P,children:(0,d.jsx)("form",{noValidate:!0,role:"form","aria-label":"Form",onSubmit:N,className:xt(D,l),style:{color:u.text,...s},children:i})})}function Ri({name:e,label:t,rules:n,help:r,required:o,children:i,className:l,style:s}){const c=J(),u=function(){const e=(0,a.useContext)(zi);if(!e)throw new Error("TkxFormField must be used inside a <TkxForm>. Wrap your fields in a TkxForm component.");return e}(),{state:p,layout:h,disabled:f}=u,m=(0,a.useMemo)(()=>function(e,t,n=Mi.required){const r=e?[...e]:[];return t&&!r.some(e=>e.required)&&r.unshift({required:!0,message:n}),r}(n,o),[n,o]),g=function(e){return e.some(e=>e.required)}(m),x=(0,a.useRef)({rules:m});x.current.rules=m;const b=(0,a.useRef)(!1);b.current||(u.registerField(e,x.current),b.current=!0),(0,a.useMemo)(()=>{u.registerField(e,x.current)},[m,e,u]);const y=p.values[e],v=p.touched[e]?p.errors[e]??null:null,w=v?oe(v):null,k=t?oe(t):void 0,$=r?oe(r):void 0,S=(0,a.useCallback)(t=>{let n;if(null!==t&&"object"==typeof t&&"target"in t){const e=t.target;n="checkbox"===e.type?e.checked:e.value}else n=t;u.setFieldValue(e,n)},[u,e]),C=(0,a.useCallback)(()=>{u.setFieldTouched(e),u.validateField(e)},[u,e]),z=i,M=(0,a.cloneElement)(z,{value:y??"",onChange:S,onBlur:C,error:w??void 0,isInvalid:!!w,isRequired:g,disabled:f||z.props.disabled,name:e}),N="horizontal"===h,D="inline"===h,R=(0,d.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),P=k?(0,d.jsxs)("label",{className:mt("text-sm font-medium font-sans",N?"min-w-[140px] pt-2.5":""),style:{color:c.text},children:[k,g&&(0,d.jsx)("span",{"aria-hidden":"true",className:mt("ml-1"),style:{color:c.danger},children:"*"})]}):null,F=(0,d.jsxs)(d.Fragment,{children:[$&&!w&&(0,d.jsx)("span",{className:mt("text-xs mt-0.5"),style:{color:c.textMuted},children:$}),w&&(0,d.jsxs)("span",{role:"alert",className:mt("text-xs flex items-center gap-1 mt-0.5"),style:{color:c.danger,animation:"tkxFormErrorReveal 200ms ease-out"},children:[R,w]})]});return D?(0,d.jsxs)("div",{className:xt(mt("flex flex-col gap-1"),l),style:s,children:[P,M,F]}):N?(0,d.jsxs)("div",{className:xt(mt("flex flex-row gap-4 items-start"),l),style:s,children:[P,(0,d.jsxs)("div",{className:mt("flex flex-col gap-1 flex-1 min-w-0"),children:[M,F]})]}):(0,d.jsxs)("div",{className:xt(mt("flex flex-col gap-1"),l),style:s,children:[P,M,F]})}Di.displayName="TkxForm",Ri.displayName="TkxFormField";var Pi=!1;!function(){if(Pi)return;if("undefined"==typeof document)return;Pi=!0;const e=document.createElement("style");e.setAttribute("data-tkx-form",""),e.textContent="\n @keyframes tkxFormErrorReveal {\n from {\n opacity: 0;\n transform: translateY(-4px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n }\n ",document.head.appendChild(e)}();var Fi={sm:576,md:768,lg:992,xl:1200};function Ii(e){return"number"==typeof e?`${e}px`:e}var Ai=(0,a.createContext)({h:0,v:0}),Li=(0,a.forwardRef)(({children:e,hasSider:t=!1,className:n,style:r,...o},i)=>{const a=J(),l=mt("flex min-h-0 w-full font-sans"),s=t?{flexDirection:"row"}:{flexDirection:"column"};return(0,d.jsx)("section",{ref:i,className:xt("tkx-layout",l,n),style:{minHeight:"100%",color:a.text,backgroundColor:a.bg,...s,...r},...o,children:e})});Li.displayName="TkxLayout";var Ti=(0,a.forwardRef)(({children:e,height:t=64,fixed:n=!1,className:r,style:o,...i},a)=>{const l=J(),s=Ii(t),c=mt("flex items-center px-6 shrink-0 w-full"),u=n?{position:"fixed",top:0,left:0,right:0,zIndex:1e3}:{};return(0,d.jsx)("header",{ref:a,className:xt("tkx-layout-header",c,r),style:{height:s,minHeight:s,backgroundColor:l.surface,borderBottom:`1px solid ${l.border}`,...u,...o},...i,children:e})});function Wi({collapsed:e,onClick:t,color:n}){const r=Te();return(0,d.jsx)("button",{type:"button","aria-label":e?"Expand sidebar":"Collapse sidebar",onClick:t,className:mt("flex items-center justify-center w-full py-3 cursor-pointer","border-0 bg-transparent"),style:{color:n},children:(0,d.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",style:{transform:e?"rotate(0deg)":"rotate(180deg)",transition:r?"none":"transform 200ms ease"},"aria-hidden":"true",children:(0,d.jsx)("path",{d:"M6 3l5 5-5 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}Ti.displayName="TkxHeader";var ji=(0,a.forwardRef)(({children:e,width:t=240,collapsedWidth:n=64,collapsed:r,onCollapse:o,collapsible:i=!1,breakpoint:l,trigger:s,className:c,style:u,...p},h)=>{const f=J(),m=Te(),[g,x]=(0,a.useState)(!1),b=r??g,y=(0,a.useCallback)(e=>{void 0===r&&x(e),o?.(e)},[r,o]);(0,a.useEffect)(()=>{if(!l)return;const e=Fi[l];if(!e)return;const t=window.matchMedia(`(max-width: ${e-1}px)`),n=e=>{y(e.matches)};return y(t.matches),t.addEventListener("change",n),()=>t.removeEventListener("change",n)},[l,y]);const v=Ii(t),w=b?`${n}px`:v,k=i&&null!==s,$=m?"none":"width 200ms ease, min-width 200ms ease, max-width 200ms ease";return(0,d.jsxs)("aside",{ref:h,className:xt("tkx-layout-sider",mt("shrink-0 overflow-hidden flex flex-col"),c),style:{width:w,minWidth:w,maxWidth:w,backgroundColor:f.surface,borderRight:`1px solid ${f.border}`,transition:$,...u},...p,children:[(0,d.jsx)("div",{className:mt("flex-1 overflow-y-auto overflow-x-hidden"),style:{width:w,transition:$},children:e}),k&&(0,d.jsx)("div",{className:mt("shrink-0"),style:{borderTop:`1px solid ${f.border}`},children:void 0!==s?s:(0,d.jsx)(Wi,{collapsed:b,onClick:()=>y(!b),color:f.textMuted})})]})});ji.displayName="TkxSider";var Ei=(0,a.forwardRef)(({children:e,className:t,style:n,...r},o)=>{const i=J();return(0,d.jsx)("main",{ref:o,className:xt("tkx-layout-content",mt("flex-1 min-w-0 min-h-0"),t),style:{backgroundColor:i.bg,padding:"24px",...n},...r,children:e})});Ei.displayName="TkxContent";var Bi=(0,a.forwardRef)(({children:e,className:t,style:n,...r},o)=>{const i=J();return(0,d.jsx)("footer",{ref:o,className:xt("tkx-layout-footer",mt("flex items-center px-6 py-4 shrink-0"),t),style:{backgroundColor:i.surface,borderTop:`1px solid ${i.border}`,color:i.textMuted,...n},...r,children:e})});Bi.displayName="TkxFooter";var Vi={start:"flex-start",center:"center",end:"flex-end","space-between":"space-between","space-around":"space-around","space-evenly":"space-evenly"},Hi={top:"flex-start",middle:"center",bottom:"flex-end",stretch:"stretch"},Oi=(0,a.forwardRef)(({children:e,gutter:t,justify:n="start",align:r="top",wrap:o=!0,className:i,style:a,...l},s)=>{const[c,u]=Array.isArray(t)?t:[t??0,0],p=c/2,h=u/2,f=c||u?{marginLeft:-p,marginRight:-p,marginTop:-h,marginBottom:-h}:{},m={h:p,v:h};return(0,d.jsx)(Ai.Provider,{value:m,children:(0,d.jsx)("div",{ref:s,className:xt("tkx-row",mt("flex w-full"),i),style:{flexWrap:o?"wrap":"nowrap",justifyContent:Vi[n]??"flex-start",alignItems:Hi[r]??"flex-start",...f,...a},...l,children:e})})});Oi.displayName="TkxRow";var qi=!1;function Ui(e){if(void 0!==e)return"number"==typeof e?{span:e}:e}var Ki=(0,a.forwardRef)(({children:e,span:t,offset:n=0,push:r,pull:o,order:i,sm:l,md:s,lg:c,xl:u,className:p,style:h,...f},m)=>{(0,a.useEffect)(()=>{!function(){if(qi||"undefined"==typeof document)return;qi=!0;const e=[];for(const[n,r]of Object.entries(Fi)){for(let t=1;t<=24;t++){const o=t/24*100+"%";e.push(`@media (min-width: ${r}px) { .tkx-col-${n}-${t} { flex: 0 0 ${o} !important; max-width: ${o} !important; } }`)}for(let t=0;t<=24;t++){const o=t/24*100+"%";e.push(`@media (min-width: ${r}px) { .tkx-col-${n}-offset-${t} { margin-left: ${o} !important; } }`)}}const t=document.createElement("style");t.id="tkx-col-responsive",t.textContent=e.join("\n"),document.head.appendChild(t)}()},[]);const g=(0,a.useContext)(Ai),x=void 0!==t?t/24*100+"%":void 0,b=n?n/24*100+"%":void 0,y=[],v=[["sm",l],["md",s],["lg",c],["xl",u]];for(const[a,d]of v){const e=Ui(d);e&&(y.push(`tkx-col-${a}-${e.span}`),void 0!==e.offset&&e.offset>0&&y.push(`tkx-col-${a}-offset-${e.offset}`))}const w={};return void 0!==r&&(w.left=r/24*100+"%",w.position="relative"),void 0!==o&&(w.right=o/24*100+"%",w.position="relative"),void 0!==i&&(w.order=i),(0,d.jsx)("div",{ref:m,className:xt("tkx-col",mt("box-border min-h-[1px]"),...y,p),style:{flex:x?`0 0 ${x}`:"1",maxWidth:x??"100%",marginLeft:b,paddingLeft:g.h||void 0,paddingRight:g.h||void 0,paddingTop:g.v||void 0,paddingBottom:g.v||void 0,...w,...h},...f,children:e})});Ki.displayName="TkxCol";var Yi=(0,a.createContext)({locale:"en-US",direction:"ltr",componentDefaults:{size:"md",variant:"default",animation:!0,bordered:!0},componentOverrides:{},prefixCls:"tkx",configured:!1,cls:e=>`tkx-${e}`,getSize:()=>"md",getAnimation:()=>!0,getBordered:()=>!0});function Xi({children:e,locale:t,direction:n,componentDefaults:r,componentOverrides:o,prefixCls:i}){const l=(0,a.useContext)(Yi),s=(0,a.useMemo)(()=>({size:r?.size??l.componentDefaults.size,variant:r?.variant??l.componentDefaults.variant,animation:r?.animation??l.componentDefaults.animation,bordered:r?.bordered??l.componentDefaults.bordered}),[r,l.componentDefaults]),c=(0,a.useMemo)(()=>{const e=l.componentOverrides,t=o??{};return{button:{...e.button,...t.button},input:{...e.input,...t.input},table:{...e.table,...t.table},modal:{...e.modal,...t.modal}}},[o,l.componentOverrides]),u=t??l.locale,p=n??l.direction,h=i??l.prefixCls,f=(0,a.useCallback)(e=>`${h}-${e}`,[h]),m=(0,a.useCallback)((e,t)=>{if(void 0!==t)return t;if(e){const t=c[e];if(t?.size)return t.size}return s.size},[s.size,c]),g=(0,a.useCallback)(e=>void 0!==e?e:s.animation,[s.animation]),x=(0,a.useCallback)((e,t)=>{if(void 0!==t)return t;if(e){const t=c[e];if(void 0!==t?.bordered)return t.bordered}return s.bordered},[s.bordered,c]),b=(0,a.useMemo)(()=>({locale:u,direction:p,componentDefaults:s,componentOverrides:c,prefixCls:h,configured:!0,cls:f,getSize:m,getAnimation:g,getBordered:x}),[u,p,s,c,h,f,m,g,x]);return(0,d.jsx)(Yi.Provider,{value:b,children:(0,d.jsx)("div",{dir:p,lang:u,className:`${h}-config-root`,style:{direction:p},children:e})})}function Zi(){return(0,a.useContext)(Yi)}Xi.displayName="TkxConfigProvider";var Gi={"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"},_i=new Set(["ar","ar-SA","ar-EG","ar-AE","he","he-IL","fa","fa-IR","ur","ur-PK","ps","ps-AF"]);function Ji(e){return"string"==typeof e?e:"number"==typeof e?String(e):Array.isArray(e)?e.map(Ji).join(""):e&&"object"==typeof e&&"props"in e?Ji(e.props.children):""}function Qi({text:e}){const t=J(),[n,r]=(0,a.useState)(!1);return(0,a.createElement)("button",{type:"button",onClick:(0,a.useCallback)(()=>{navigator.clipboard.writeText(e).then(()=>{r(!0),setTimeout(()=>r(!1),2e3)})},[e]),"aria-label":n?"Copied":"Copy to clipboard",style:{display:"inline-flex",alignItems:"center",marginLeft:"4px",padding:"2px 6px",border:"none",background:"transparent",color:n?t.success:t.textMuted,cursor:"pointer",fontSize:"0.8em",borderRadius:"4px",transition:"color 0.2s"}},n?"Copied!":"⎘")}function ea(e="default"){const t=J();return{default:t.text,secondary:t.textMuted,success:t.success,warning:t.warning,danger:t.danger}[e]}var ta={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}},na={sm:{dimension:20,borderWidth:2,fontSize:"0.75rem"},md:{dimension:32,borderWidth:3,fontSize:"0.875rem"},lg:{dimension:48,borderWidth:4,fontSize:"1rem"}},ra=!1;function oa({size:e,color:t}){return(0,a.createElement)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",role:"img","aria-label":"Loading"},(0,a.createElement)("circle",{cx:12,cy:12,r:10,stroke:`${t}33`,strokeWidth:2.5,fill:"none"}),(0,a.createElement)("path",{d:"M12 2a10 10 0 0 1 10 10",stroke:t,strokeWidth:2.5,strokeLinecap:"round",fill:"none"}))}function ia({size:e,borderWidth:t,color:n,reducedMotion:r}){return r?(0,a.createElement)(oa,{size:e,color:n}):(function(){if(ra||"undefined"==typeof document)return;ra=!0;const e=document.createElement("style");e.id="tkx-spin-styles",e.textContent="\n @keyframes tkx-spin-rotate {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n ",document.head.appendChild(e)}(),(0,a.createElement)("div",{role:"img","aria-label":"Loading",style:{width:`${e}px`,height:`${e}px`,border:`${t}px solid ${n}33`,borderTopColor:n,borderRadius:"50%",animation:"tkx-spin-rotate 0.8s linear infinite",boxSizing:"border-box"}}))}function aa({color:e,mutedColor:t}){return(0,a.createElement)("svg",{width:120,height:100,viewBox:"0 0 120 100",fill:"none","aria-hidden":"true"},(0,a.createElement)("path",{d:"M20 40 L60 20 L100 40 L60 60 Z",fill:`${t}18`,stroke:t,strokeWidth:1.5,strokeLinejoin:"round"}),(0,a.createElement)("path",{d:"M20 40 L20 65 L60 85 L60 60 Z",fill:`${t}10`,stroke:t,strokeWidth:1.5,strokeLinejoin:"round"}),(0,a.createElement)("path",{d:"M100 40 L100 65 L60 85 L60 60 Z",fill:`${t}0d`,stroke:t,strokeWidth:1.5,strokeLinejoin:"round"}),(0,a.createElement)("path",{d:"M20 40 L40 28 L60 40 L40 52 Z",fill:`${e}15`,stroke:e,strokeWidth:1,strokeLinejoin:"round",strokeDasharray:"3 2"}),(0,a.createElement)("path",{d:"M60 40 L80 28 L100 40 L80 52 Z",fill:`${e}15`,stroke:e,strokeWidth:1,strokeLinejoin:"round",strokeDasharray:"3 2"}))}function la({mutedColor:e}){return(0,a.createElement)("svg",{width:64,height:64,viewBox:"0 0 64 64",fill:"none","aria-hidden":"true"},(0,a.createElement)("rect",{x:16,y:8,width:32,height:40,rx:3,fill:`${e}12`,stroke:e,strokeWidth:1.5}),(0,a.createElement)("line",{x1:24,y1:20,x2:40,y2:20,stroke:e,strokeWidth:1.5,strokeLinecap:"round"}),(0,a.createElement)("line",{x1:24,y1:28,x2:36,y2:28,stroke:e,strokeWidth:1.5,strokeLinecap:"round"}),(0,a.createElement)("line",{x1:24,y1:36,x2:32,y2:36,stroke:e,strokeWidth:1.5,strokeLinecap:"round"}),(0,a.createElement)("circle",{cx:32,cy:54,r:6,stroke:e,strokeWidth:1.2,fill:"none"}),(0,a.createElement)("line",{x1:28,y1:54,x2:36,y2:54,stroke:e,strokeWidth:1.2,strokeLinecap:"round"}))}function sa({direction:e,color:t}){return(0,a.createElement)("svg",{width:16,height:14,viewBox:"0 0 20 14",fill:"none","aria-hidden":"true",style:{display:"inline-block",verticalAlign:"middle"}},(0,a.createElement)("path",{d:"up"===e?"M6 10 L10 4 L14 10":"M6 4 L10 10 L14 4",stroke:t,strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}))}var da=!1;function ca({w:e,h:t,alt:n,bdr:r,rm:o}){return o||function(){if(da||"undefined"==typeof document)return;da=!0;const e=document.createElement("style");e.id="tkx-statistic-skeleton",e.textContent="@keyframes tkx-stat-shimmer{0%{background-position:-200% 0}100%{background-position:200% 0}}",document.head.appendChild(e)}(),(0,a.createElement)("div",{"aria-hidden":"true",style:{width:e,height:t,borderRadius:"4px",background:o?n:`linear-gradient(90deg, ${n} 25%, ${r} 50%, ${n} 75%)`,backgroundSize:"200% 100%",animation:o?"none":"tkx-stat-shimmer 1.5s ease-in-out infinite"}})}var ua={sm:{height:28,fontSize:12,px:10},md:{height:36,fontSize:14,px:16},lg:{height:44,fontSize:16,px:20}},pa={L:.38,M:.42,Q:.48,H:.55},ha={success:e=>(0,d.jsxs)("svg",{width:"72",height:"72",viewBox:"0 0 72 72",fill:"none","aria-hidden":"true",children:[(0,d.jsx)("circle",{cx:"36",cy:"36",r:"34",stroke:e,strokeWidth:"3",fill:`${e}18`}),(0,d.jsx)("path",{d:"M22 37l9 9 19-19",stroke:e,strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]}),error:e=>(0,d.jsxs)("svg",{width:"72",height:"72",viewBox:"0 0 72 72",fill:"none","aria-hidden":"true",children:[(0,d.jsx)("circle",{cx:"36",cy:"36",r:"34",stroke:e,strokeWidth:"3",fill:`${e}18`}),(0,d.jsx)("path",{d:"M26 26l20 20M46 26L26 46",stroke:e,strokeWidth:"4",strokeLinecap:"round"})]}),warning:e=>(0,d.jsxs)("svg",{width:"72",height:"72",viewBox:"0 0 72 72",fill:"none","aria-hidden":"true",children:[(0,d.jsx)("path",{d:"M36 6L4 64h64L36 6z",stroke:e,strokeWidth:"3",fill:`${e}18`}),(0,d.jsx)("path",{d:"M36 30v16",stroke:e,strokeWidth:"4",strokeLinecap:"round"}),(0,d.jsx)("circle",{cx:"36",cy:"54",r:"2.5",fill:e})]}),info:e=>(0,d.jsxs)("svg",{width:"72",height:"72",viewBox:"0 0 72 72",fill:"none","aria-hidden":"true",children:[(0,d.jsx)("circle",{cx:"36",cy:"36",r:"34",stroke:e,strokeWidth:"3",fill:`${e}18`}),(0,d.jsx)("path",{d:"M36 32v18",stroke:e,strokeWidth:"4",strokeLinecap:"round"}),(0,d.jsx)("circle",{cx:"36",cy:"22",r:"2.5",fill:e})]}),404:e=>(0,d.jsxs)("svg",{width:"72",height:"72",viewBox:"0 0 72 72",fill:"none","aria-hidden":"true",children:[(0,d.jsx)("circle",{cx:"36",cy:"36",r:"34",stroke:e,strokeWidth:"3",fill:`${e}18`}),(0,d.jsx)("text",{x:"36",y:"44",textAnchor:"middle",fontSize:"22",fontWeight:"bold",fill:e,children:"404"})]}),403:e=>(0,d.jsxs)("svg",{width:"72",height:"72",viewBox:"0 0 72 72",fill:"none","aria-hidden":"true",children:[(0,d.jsx)("circle",{cx:"36",cy:"36",r:"34",stroke:e,strokeWidth:"3",fill:`${e}18`}),(0,d.jsx)("path",{d:"M28 30h16v16H28z",stroke:e,strokeWidth:"3",fill:"none"}),(0,d.jsx)("path",{d:"M32 30v-4a4 4 0 018 0v4",stroke:e,strokeWidth:"3",fill:"none"})]}),500:e=>(0,d.jsxs)("svg",{width:"72",height:"72",viewBox:"0 0 72 72",fill:"none","aria-hidden":"true",children:[(0,d.jsx)("circle",{cx:"36",cy:"36",r:"34",stroke:e,strokeWidth:"3",fill:`${e}18`}),(0,d.jsx)("text",{x:"36",y:"44",textAnchor:"middle",fontSize:"22",fontWeight:"bold",fill:e,children:"500"})]})};function fa(){if("undefined"==typeof window)return!1;const e=window.outerWidth-window.innerWidth,t=window.outerHeight-window.innerHeight;return e>160||t>160}function ma(){const[e,t]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{if("undefined"==typeof window)return;t(fa());const e=()=>t(fa());window.addEventListener("resize",e);const n=window.setInterval(e,1e3);return()=>{window.removeEventListener("resize",e),window.clearInterval(n)}},[]),e}function ga(e){if(e)try{return e()}catch{return window}return window}function xa(e){const t=[];for(const n of e)t.push(n),n.children&&t.push(...xa(n.children));return t}function ba(e){return e.startsWith("#")?e.slice(1):e}function ya({item:e,activeKey:t,depth:n,onClick:r,theme:o,reducedMotion:i}){const a=e.key===t,l=oe(e.title);return(0,d.jsxs)("li",{role:"none",style:{listStyle:"none"},children:[(0,d.jsx)("a",{role:"treeitem","aria-current":a?"location":void 0,href:e.href,onClick:t=>{t.preventDefault(),r(e.href)},className:mt("block text-sm py-1 no-underline"),style:{paddingLeft:12+16*n,color:a?o.primary:o.textMuted,fontWeight:a?600:400,borderLeft:`2px solid ${a?o.primary:"transparent"}`,transition:i?"none":"color 0.15s ease, border-color 0.15s ease"},children:l}),e.children&&e.children.length>0&&(0,d.jsx)("ul",{role:"group",style:{margin:0,padding:0},children:e.children.map(e=>(0,d.jsx)(ya,{item:e,activeKey:t,depth:n+1,onClick:r,theme:o,reducedMotion:i},e.key))})]})}function va(e,t){const n=[];let r=e;for(const o of t){const e=r.find(e=>e.value===o);if(!e)break;n.push(e),r=e.children??[]}return n}var wa={sm:"8px 12px",md:"12px 16px",lg:"16px 20px"};function ka({theme:e,reducedMotion:t}){return(0,d.jsxs)("div",{className:mt("flex items-center gap-3 px-4 py-3"),"aria-hidden":"true",children:[(0,d.jsx)("div",{style:{width:40,height:40,borderRadius:"50%",backgroundColor:e.surfaceAlt,animation:t?"none":"tkxPulse 1.5s ease infinite"}}),(0,d.jsxs)("div",{className:mt("flex-1"),children:[(0,d.jsx)("div",{style:{width:"60%",height:14,borderRadius:4,backgroundColor:e.surfaceAlt,marginBottom:8,animation:t?"none":"tkxPulse 1.5s ease infinite"}}),(0,d.jsx)("div",{style:{width:"40%",height:12,borderRadius:4,backgroundColor:e.surfaceAlt,animation:t?"none":"tkxPulse 1.5s ease infinite"}})]})]})}var $a={turnstile:"https://challenges.cloudflare.com/turnstile/v0/api.js",hcaptcha:"https://js.hcaptcha.com/1/api.js",recaptcha:"https://www.google.com/recaptcha/api.js"},Sa={turnstile:"turnstile",hcaptcha:"hcaptcha",recaptcha:"grecaptcha"},Ca=/^[A-Za-z0-9_-]{20,80}$/,za={},Ma=(0,a.forwardRef)(function({provider:e="turnstile",sitekey:t,theme:n="auto",size:r="normal",language:o,execution:i="render",onVerify:l,onExpire:s,onError:c,className:u,style:p,testMode:h=!1},f){const m=(0,a.useRef)(null),g=(0,a.useRef)(null),x=(0,a.useRef)(null);return"string"!=typeof t||Ca.test(t),(0,a.useImperativeHandle)(f,()=>({reset:()=>{if(h)return void(x.current=null);const t=window[Sa[e]];if(t&&null!=g.current){try{t.reset?.(g.current)}catch{}x.current=null}},execute:()=>{if(h)return void setTimeout(()=>{x.current="TEST_TOKEN",l("TEST_TOKEN")},200);const t=window[Sa[e]];if(t&&null!=g.current)try{t.execute?.(g.current)}catch{}},getResponse:()=>x.current}),[e,l,h]),(0,a.useEffect)(()=>{if(h){const e=window.setTimeout(()=>{x.current="TEST_TOKEN",l("TEST_TOKEN")},200);return()=>window.clearTimeout(e)}let a=!1,d=null;const u=m.current;if(u)return function(e,t){if("undefined"==typeof window)return Promise.resolve();if(window[Sa[e]])return Promise.resolve();if(za[e])return za[e];const n=new Promise((n,r)=>{const o=document.querySelector(`script[data-tkx-captcha="${e}"]`);if(o)return o.addEventListener("load",()=>n()),void o.addEventListener("error",()=>r(new Error("script-load-failed")));const i=document.createElement("script");let a=$a[e];t&&"turnstile"!==e&&(a+=`?hl=${encodeURIComponent(t)}`),i.src=a,i.async=!0,i.defer=!0,i.dataset.tkxCaptcha=e,i.addEventListener("load",()=>n()),i.addEventListener("error",()=>r(new Error("script-load-failed"))),document.head.appendChild(i)});return za[e]=n,n}(e,o).then(()=>{if(a||!u)return;const p=window[Sa[e]];if(!p)return;const h={callback:e=>{x.current=e,l(e)},"expired-callback":()=>{x.current=null,s?.()},"error-callback":e=>{x.current=null,c?.("string"==typeof e?e:"unknown")}};try{"turnstile"===e?d=p.render(u,{sitekey:t,theme:n,size:"flexible"===r?"flexible":"compact"===r?"compact":"normal",execution:i,language:o||"auto",...h}):"hcaptcha"===e?d=p.render(u,{sitekey:t,theme:"auto"===n?"light":n,size:"invisible"===r?"invisible":"compact"===r?"compact":"normal",...h}):"recaptcha"===e&&(d=p.render(u,{sitekey:t,theme:"auto"===n?"light":n,size:"invisible"===r?"invisible":"normal",...h})),g.current=d}catch(f){c?.(f?.message||"render-failed")}}).catch(()=>{a||c?.("script-load-failed")}),()=>{a=!0;const t=window[Sa[e]];if(t&&null!=d)try{t.remove?.(d)}catch{}g.current=null,x.current=null}},[]),(0,d.jsx)("div",{ref:m,className:u,style:p,"data-tkx-captcha-provider":e,children:h&&(0,d.jsx)("div",{"aria-live":"polite",style:{padding:"12px 16px",border:"1px dashed currentColor",borderRadius:8,fontSize:13,opacity:.7,display:"inline-block"},children:"[TkxCaptcha test mode — auto-verifying with TEST_TOKEN]"})})});Ma.displayName="TkxCaptcha";var Na={latin:{id:"tkx-font-latin",href:"https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;500;600;700&display=swap"},"latin-ext":{id:"tkx-font-latin-ext",href:"https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;500;600;700&display=swap&subset=latin-ext"},devanagari:{id:"tkx-font-devanagari",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Devanagari:wght@400;500;600;700&display=swap"},tamil:{id:"tkx-font-tamil",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Tamil:wght@400;500;600;700&display=swap"},telugu:{id:"tkx-font-telugu",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Telugu:wght@400;500;600;700&display=swap"},kannada:{id:"tkx-font-kannada",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Kannada:wght@400;500;600;700&display=swap"},malayalam:{id:"tkx-font-malayalam",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Malayalam:wght@400;500;600;700&display=swap"},bengali:{id:"tkx-font-bengali",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Bengali:wght@400;500;600;700&display=swap"},gujarati:{id:"tkx-font-gujarati",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Gujarati:wght@400;500;600;700&display=swap"},gurmukhi:{id:"tkx-font-gurmukhi",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Gurmukhi:wght@400;500;600;700&display=swap"},oriya:{id:"tkx-font-oriya",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Oriya:wght@400;500;600;700&display=swap"},sinhala:{id:"tkx-font-sinhala",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Sinhala:wght@400;500;600;700&display=swap"},arabic:{id:"tkx-font-arabic",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Arabic:wght@400;500;600;700&display=swap"},hebrew:{id:"tkx-font-hebrew",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Hebrew:wght@400;500;600;700&display=swap"},thai:{id:"tkx-font-thai",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Thai:wght@400;500;600;700&display=swap"},vietnamese:{id:"tkx-font-vietnamese",href:"https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;500;600;700&display=swap&subset=vietnamese"},cyrillic:{id:"tkx-font-cyrillic",href:"https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;500;600;700&display=swap&subset=cyrillic"},"cyrillic-ext":{id:"tkx-font-cyrillic-ext",href:"https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;500;600;700&display=swap&subset=cyrillic-ext"},greek:{id:"tkx-font-greek",href:"https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;500;600;700&display=swap&subset=greek"},"greek-ext":{id:"tkx-font-greek-ext",href:"https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;500;600;700&display=swap&subset=greek-ext"},jp:{id:"tkx-font-jp",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;600;700&display=swap"},kr:{id:"tkx-font-kr",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;600;700&display=swap"},sc:{id:"tkx-font-sc",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;600;700&display=swap"},tc:{id:"tkx-font-tc",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;500;600;700&display=swap"}},Da={en:["latin"],hi:["devanagari"],mr:["devanagari"],sa:["devanagari"],ne:["devanagari"],ta:["tamil"],te:["telugu"],kn:["kannada"],ml:["malayalam"],bn:["bengali"],as:["bengali"],gu:["gujarati"],pa:["gurmukhi"],or:["oriya"],si:["sinhala"],ar:["arabic"],ur:["arabic"],fa:["arabic"],he:["hebrew"],th:["thai"],vi:["vietnamese","latin"],ru:["cyrillic"],uk:["cyrillic"],bg:["cyrillic"],el:["greek"],ja:["jp"],ko:["kr"],zh:["sc"],"zh-CN":["sc"],"zh-TW":["tc"],"zh-HK":["tc"]},Ra=!1;function Pa(e){if("undefined"==typeof document)return;const t=Na[e];if(!t)return;if(document.getElementById(t.id))return;const n=document.createElement("link");n.id=t.id,n.rel="stylesheet",n.href=t.href,document.head.appendChild(n)}function Fa(e){return e&&(Da[e]||Da[e.split("-")[0]])||["latin"]}var Ia=[{iso2:"in",name:"India",dial:"91",length:10,format:"##### #####",flag:"🇮🇳"},{iso2:"us",name:"United States",dial:"1",length:10,format:"(###) ###-####",flag:"🇺🇸"},{iso2:"gb",name:"United Kingdom",dial:"44",length:[9,10],format:"#### ######",flag:"🇬🇧"},{iso2:"ca",name:"Canada",dial:"1",length:10,format:"(###) ###-####",flag:"🇨🇦"},{iso2:"au",name:"Australia",dial:"61",length:9,format:"### ### ###",flag:"🇦🇺"},{iso2:"de",name:"Germany",dial:"49",length:[10,11],format:"#### ########",flag:"🇩🇪"},{iso2:"fr",name:"France",dial:"33",length:9,format:"# ## ## ## ##",flag:"🇫🇷"},{iso2:"es",name:"Spain",dial:"34",length:9,format:"### ### ###",flag:"🇪🇸"},{iso2:"it",name:"Italy",dial:"39",length:[9,10],format:"### ### ####",flag:"🇮🇹"},{iso2:"nl",name:"Netherlands",dial:"31",length:9,format:"# #### ####",flag:"🇳🇱"},{iso2:"se",name:"Sweden",dial:"46",length:[7,9],format:"## ### ## ##",flag:"🇸🇪"},{iso2:"no",name:"Norway",dial:"47",length:8,format:"### ## ###",flag:"🇳🇴"},{iso2:"dk",name:"Denmark",dial:"45",length:8,format:"## ## ## ##",flag:"🇩🇰"},{iso2:"fi",name:"Finland",dial:"358",length:[9,10],format:"## ### ####",flag:"🇫🇮"},{iso2:"pl",name:"Poland",dial:"48",length:9,format:"### ### ###",flag:"🇵🇱"},{iso2:"ie",name:"Ireland",dial:"353",length:9,format:"## ### ####",flag:"🇮🇪"},{iso2:"pt",name:"Portugal",dial:"351",length:9,format:"### ### ###",flag:"🇵🇹"},{iso2:"ch",name:"Switzerland",dial:"41",length:9,format:"## ### ## ##",flag:"🇨🇭"},{iso2:"at",name:"Austria",dial:"43",length:[10,11],format:"### ### ####",flag:"🇦🇹"},{iso2:"be",name:"Belgium",dial:"32",length:9,format:"### ## ## ##",flag:"🇧🇪"},{iso2:"jp",name:"Japan",dial:"81",length:10,format:"## #### ####",flag:"🇯🇵"},{iso2:"kr",name:"South Korea",dial:"82",length:[9,10],format:"## #### ####",flag:"🇰🇷"},{iso2:"cn",name:"China",dial:"86",length:11,format:"### #### ####",flag:"🇨🇳"},{iso2:"hk",name:"Hong Kong",dial:"852",length:8,format:"#### ####",flag:"🇭🇰"},{iso2:"sg",name:"Singapore",dial:"65",length:8,format:"#### ####",flag:"🇸🇬"},{iso2:"my",name:"Malaysia",dial:"60",length:[9,10],format:"## ### ####",flag:"🇲🇾"},{iso2:"id",name:"Indonesia",dial:"62",length:[9,12],format:"### ### ####",flag:"🇮🇩"},{iso2:"th",name:"Thailand",dial:"66",length:9,format:"## ### ####",flag:"🇹🇭"},{iso2:"vn",name:"Vietnam",dial:"84",length:[9,10],format:"### ### ####",flag:"🇻🇳"},{iso2:"ph",name:"Philippines",dial:"63",length:10,format:"### ### ####",flag:"🇵🇭"},{iso2:"pk",name:"Pakistan",dial:"92",length:10,format:"### #######",flag:"🇵🇰"},{iso2:"bd",name:"Bangladesh",dial:"880",length:10,format:"#### ######",flag:"🇧🇩"},{iso2:"lk",name:"Sri Lanka",dial:"94",length:9,format:"## ### ####",flag:"🇱🇰"},{iso2:"np",name:"Nepal",dial:"977",length:10,format:"###-#######",flag:"🇳🇵"},{iso2:"ae",name:"UAE",dial:"971",length:9,format:"## ### ####",flag:"🇦🇪"},{iso2:"sa",name:"Saudi Arabia",dial:"966",length:9,format:"## ### ####",flag:"🇸🇦"},{iso2:"qa",name:"Qatar",dial:"974",length:8,format:"#### ####",flag:"🇶🇦"},{iso2:"kw",name:"Kuwait",dial:"965",length:8,format:"#### ####",flag:"🇰🇼"},{iso2:"om",name:"Oman",dial:"968",length:8,format:"#### ####",flag:"🇴🇲"},{iso2:"bh",name:"Bahrain",dial:"973",length:8,format:"#### ####",flag:"🇧🇭"},{iso2:"il",name:"Israel",dial:"972",length:9,format:"## ### ####",flag:"🇮🇱"},{iso2:"tr",name:"Turkey",dial:"90",length:10,format:"### ### ####",flag:"🇹🇷"},{iso2:"ru",name:"Russia",dial:"7",length:10,format:"### ### ####",flag:"🇷🇺"},{iso2:"ua",name:"Ukraine",dial:"380",length:9,format:"## ### ####",flag:"🇺🇦"},{iso2:"br",name:"Brazil",dial:"55",length:[10,11],format:"## ##### ####",flag:"🇧🇷"},{iso2:"mx",name:"Mexico",dial:"52",length:10,format:"## #### ####",flag:"🇲🇽"},{iso2:"ar",name:"Argentina",dial:"54",length:10,format:"## #### ####",flag:"🇦🇷"},{iso2:"cl",name:"Chile",dial:"56",length:9,format:"# #### ####",flag:"🇨🇱"},{iso2:"co",name:"Colombia",dial:"57",length:10,format:"### ### ####",flag:"🇨🇴"},{iso2:"pe",name:"Peru",dial:"51",length:9,format:"### ### ###",flag:"🇵🇪"},{iso2:"za",name:"South Africa",dial:"27",length:9,format:"## ### ####",flag:"🇿🇦"},{iso2:"ng",name:"Nigeria",dial:"234",length:10,format:"### ### ####",flag:"🇳🇬"},{iso2:"ke",name:"Kenya",dial:"254",length:9,format:"### ### ###",flag:"🇰🇪"},{iso2:"eg",name:"Egypt",dial:"20",length:10,format:"### ### ####",flag:"🇪🇬"},{iso2:"ma",name:"Morocco",dial:"212",length:9,format:"## ### ####",flag:"🇲🇦"},{iso2:"nz",name:"New Zealand",dial:"64",length:[8,9],format:"## ### ####",flag:"🇳🇿"}];function Aa(e){return e.replace(/\D+/g,"")}function La(e,t){if(!t)return e;let n="",r=0;for(const o of t)if("#"===o){if(r>=e.length)break;n+=e[r++]}else r<e.length&&(n+=o);return r<e.length&&(n+=e.slice(r)),n}function Ta(e,t){return Array.isArray(t)?e.length>=t[0]&&e.length<=t[1]:e.length===t}function Wa(e){return Array.isArray(e)?`${e[0]}–${e[1]}`:`${e}`}var ja=(0,a.forwardRef)(function({defaultCountry:e="in",value:t,defaultValue:n,onChange:r,onValid:o,label:i,placeholder:l,disabled:s,required:c,id:u,name:p,extraCountries:h=[],className:f,style:m},g){const x=J(),b=(0,a.useId)(),y=(0,a.useId)(),v=(0,a.useMemo)(()=>[...Ia,...h].sort((e,t)=>e.name.localeCompare(t.name)),[h]),w=e=>v.find(t=>t.iso2===e.toLowerCase())||v[0],k=t=>{if(!t.startsWith("+"))return{country:w(e),digits:Aa(t)};const n=Aa(t);for(const e of[4,3,2,1]){const t=n.slice(0,e),r=v.find(e=>e.dial===t);if(r)return{country:r,digits:n.slice(e)}}return{country:w(e),digits:n}},$=t?k(t):{country:w(e),digits:Aa(n||"")},[S,C]=(0,a.useState)($.country),[z,M]=(0,a.useState)($.digits),[N,D]=(0,a.useState)(!1),[R,P]=(0,a.useState)(""),[F,I]=(0,a.useState)(0),A=(0,a.useRef)(null),L=(0,a.useRef)(null);(0,a.useEffect)(()=>{if(void 0===t)return;const e=k(t);C(e.country),M(e.digits)},[t]);const T=La(z,S.format),W=Ta(z,S.length),j=z?`+${S.dial}${z}`:"",E=(e,t)=>{const n={raw:La(e,t.format),digits:e,e164:e?`+${t.dial}${e}`:"",country:t,valid:Ta(e,t.length)};r?.(n)},B=e=>{C(e),D(!1),E(z,e),A.current?.focus()},V=(0,a.useMemo)(()=>{const e=R.trim().toLowerCase();return e?v.filter(t=>t.name.toLowerCase().includes(e)||t.iso2.includes(e)||t.dial.includes(e.replace(/^\+/,""))):v},[v,R]);(0,a.useEffect)(()=>{I(0)},[R]),(0,a.useEffect)(()=>{if(N){const e=setTimeout(()=>L.current?.focus(),0);return()=>clearTimeout(e)}},[N]);const H=l??Wa(S.length).replace(/\d/g,"#"),O={display:"inline-flex",flexDirection:"column",gap:6,width:"100%",maxWidth:360,...m},q={fontSize:13,fontWeight:600,color:x.text},U={display:"flex",alignItems:"stretch",border:`1px solid ${x.border}`,borderRadius:8,background:x.surface,overflow:"visible",position:"relative"},K={display:"inline-flex",alignItems:"center",gap:6,padding:"0 10px",background:"transparent",border:"none",borderRight:`1px solid ${x.border}`,cursor:s?"not-allowed":"pointer",color:x.text,fontSize:14,minHeight:40,fontWeight:500},Y={flex:1,border:"none",outline:"none",padding:"0 12px",fontSize:14,color:x.text,background:"transparent",minHeight:40,minWidth:0},X={position:"absolute",top:"calc(100% + 4px)",left:0,right:0,maxHeight:280,overflow:"auto",background:x.surface,border:`1px solid ${x.border}`,borderRadius:8,zIndex:1e3,padding:6,boxShadow:"0 8px 24px rgba(0,0,0,0.18)"},Z={width:"100%",padding:"8px 10px",border:`1px solid ${x.border}`,borderRadius:6,background:x.bg,color:x.text,fontSize:13,marginBottom:6,outline:"none"},G={fontSize:12,color:x.danger,marginTop:2};return(0,d.jsxs)("div",{className:f,style:O,onKeyDown:e=>{N&&("ArrowDown"===e.key?(e.preventDefault(),I(e=>Math.min(V.length-1,e+1))):"ArrowUp"===e.key?(e.preventDefault(),I(e=>Math.max(0,e-1))):"Enter"===e.key?(e.preventDefault(),V[F]&&B(V[F])):"Escape"===e.key&&(e.preventDefault(),D(!1),A.current?.focus()))},children:[i&&(0,d.jsxs)("label",{htmlFor:u||b,style:q,children:[i,c&&(0,d.jsx)("span",{style:{color:x.danger,marginLeft:4},"aria-hidden":"true",children:"*"})]}),(0,d.jsxs)("div",{style:U,children:[(0,d.jsxs)("button",{ref:A,type:"button",style:K,onClick:()=>!s&&D(e=>!e),"aria-haspopup":"listbox","aria-expanded":N,"aria-controls":y,"aria-label":`Country: ${S.name}, dial code +${S.dial}`,disabled:s,children:[(0,d.jsx)("span",{"aria-hidden":"true",style:{fontSize:18,lineHeight:1},children:S.flag}),(0,d.jsxs)("span",{"aria-hidden":"true",children:["+",S.dial]}),(0,d.jsx)("span",{"aria-hidden":"true",style:{fontSize:10,opacity:.6,marginLeft:2},children:"▾"})]}),(0,d.jsx)("input",{ref:g,id:u||b,name:p,type:"tel",inputMode:"tel",autoComplete:"tel-national",value:T,onChange:e=>{const t=Aa(e.target.value).slice(0,15);M(t),E(t,S)},onBlur:()=>{W&&o&&o({raw:T,digits:z,e164:j,country:S,valid:!0})},placeholder:H,disabled:s,required:c,"aria-invalid":z.length>0&&!W,"aria-describedby":z.length>0&&!W?`${b}-err`:void 0,style:Y}),N&&!s&&(0,d.jsxs)("div",{id:y,role:"listbox","aria-label":"Select country",style:X,children:[(0,d.jsx)("input",{ref:L,type:"text",placeholder:"Search country or dial code…",value:R,onChange:e=>P(e.target.value),style:Z,"aria-label":"Filter countries"}),0===V.length&&(0,d.jsxs)("div",{style:{padding:"12px 10px",fontSize:13,color:x.textMuted},children:['No country matches "',R,'"']}),V.map((e,t)=>{return(0,d.jsxs)("div",{role:"option","aria-selected":t===F,onMouseEnter:()=>I(t),onClick:()=>B(e),style:(n=t===F,{display:"flex",alignItems:"center",gap:10,padding:"8px 10px",borderRadius:6,cursor:"pointer",background:n?x.surfaceAlt:"transparent",color:x.text,fontSize:13}),children:[(0,d.jsx)("span",{"aria-hidden":"true",style:{fontSize:16},children:e.flag}),(0,d.jsx)("span",{style:{flex:1},children:e.name}),(0,d.jsxs)("span",{style:{color:x.textMuted,fontVariantNumeric:"tabular-nums"},children:["+",e.dial]})]},e.iso2);var n})]})]}),z.length>0&&!W&&(0,d.jsxs)("div",{id:`${b}-err`,role:"alert",style:G,children:["Expected ",Wa(S.length)," digits for ",S.name,"."]})]})});ja.displayName="TkxPhoneInput";var Ea={free:null,"1:1":1,"3:4":3/4,"4:5":.8,"16:9":16/9,"4:3":4/3,"3:2":1.5},Ba={drop:"Drop an image here, or",browse:"browse",rotate:"Rotate",apply:"Apply",cancel:"Cancel",brightness:"Brightness",contrast:"Contrast",aspect:"Aspect",free:"Free"},Va=(0,a.forwardRef)(function({src:e,aspectRatio:t="free",ratios:n=["free","1:1","3:4","4:5","16:9"],mimeType:r="image/png",quality:o=.92,maxOutputSize:i=2048,outputFilename:l="edited.png",onChange:s,onResult:c,onCancel:u,className:p,style:h,labels:f},m){const g={...Ba,...f},x=J(),b=(0,a.useRef)(null),y=(0,a.useRef)(null),v=(0,a.useRef)(null),w=(0,a.useRef)(null),[k,$]=(0,a.useState)(e??null),[S,C]=(0,a.useState)(null),[z,M]=(0,a.useState)(t),[N,D]=(0,a.useState)(0),[R,P]=(0,a.useState)(100),[F,I]=(0,a.useState)(100),[A,L]=(0,a.useState)({x:0,y:0,w:0,h:0}),[T,W]=(0,a.useState)(!1),j=(0,a.useRef)({mode:null,startX:0,startY:0,startCrop:{x:0,y:0,w:0,h:0}});(0,a.useEffect)(()=>{if(!k)return w.current=null,void C(null);const e=new Image;e.crossOrigin="anonymous",e.onload=()=>{w.current=e,C({w:e.naturalWidth,h:e.naturalHeight});const t=Ea[z];if(t){const n=Math.min(e.naturalWidth,e.naturalHeight*t),r=n/t;L({x:(e.naturalWidth-n)/2,y:(e.naturalHeight-r)/2,w:n,h:r})}else L({x:0,y:0,w:e.naturalWidth,h:e.naturalHeight})},e.src=k},[k,z]),(0,a.useEffect)(()=>{s?.({rotation:N,brightness:R,contrast:F})},[N,R,F,s]);const E=(0,a.useCallback)(()=>{const e=y.current,t=w.current,n=S;if(!e||!t||!n)return;const r=e.getContext("2d");if(!r)return;const o=v.current,i=o?Math.min(o.clientWidth,800):600,a=N%180!=0,l=a?n.h:n.w,s=a?n.w:n.h,d=Math.min(i/l,600/s,1),c=Math.floor(l*d),u=Math.floor(s*d);e.width=c,e.height=u,r.save(),r.filter=`brightness(${R}%) contrast(${F}%)`,r.translate(c/2,u/2),r.rotate(N*Math.PI/180),r.drawImage(t,-n.w*d/2,-n.h*d/2,n.w*d,n.h*d),r.restore()},[N,R,F,S]);(0,a.useEffect)(()=>{E()},[E]),(0,a.useEffect)(()=>{const e=S;if(!e)return;const t=Ea[z];t&&L(n=>{const r=n.x+n.w/2,o=n.y+n.h/2;let i=n.w,a=i/t;return a>e.h&&(a=e.h,i=a*t),i>e.w&&(i=e.w,a=i/t),{x:Math.max(0,Math.min(e.w-i,r-i/2)),y:Math.max(0,Math.min(e.h-a,o-a/2)),w:i,h:a}})},[z,S]);const B=e=>{const t=new FileReader;t.onload=()=>{"string"==typeof t.result&&($(t.result),D(0),P(100),I(100))},t.readAsDataURL(e)},V=e=>t=>{t.preventDefault(),t.stopPropagation();const n="touches"in t?t.touches[0]:t;j.current={mode:e,startX:n.clientX,startY:n.clientY,startCrop:{...A}};const r=e=>{e.preventDefault();const t="touches"in e?e.touches[0]:e,n=t.clientX-j.current.startX,r=t.clientY-j.current.startY,o=S;if(!o)return;const i=y.current;if(!i)return;const a=n*(o.w/i.width),l=r*(o.h/i.height),s=j.current.startCrop,d=Ea[z];let c={...s};if("move"===j.current.mode)c.x=Math.max(0,Math.min(o.w-s.w,s.x+a)),c.y=Math.max(0,Math.min(o.h-s.h,s.y+l));else{const e=j.current.mode;if("se"===e)c.w=Math.max(20,Math.min(o.w-s.x,s.w+a)),c.h=d?c.w/d:Math.max(20,Math.min(o.h-s.y,s.h+l));else if("sw"===e){const e=Math.max(20,s.w-a);c.x=Math.max(0,s.x+s.w-e),c.w=s.x+s.w-c.x,c.h=d?c.w/d:Math.max(20,Math.min(o.h-s.y,s.h+l))}else if("ne"===e){c.w=Math.max(20,Math.min(o.w-s.x,s.w+a));const e=d?c.w/d:Math.max(20,s.h-l);c.y=Math.max(0,s.y+s.h-e),c.h=s.y+s.h-c.y}else if("nw"===e){const e=Math.max(20,s.w-a);c.x=Math.max(0,s.x+s.w-e),c.w=s.x+s.w-c.x;const t=d?c.w/d:Math.max(20,s.h-l);c.y=Math.max(0,s.y+s.h-t),c.h=s.y+s.h-c.y}}L(c)},o=()=>{j.current.mode=null,window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",o),window.removeEventListener("touchmove",r),window.removeEventListener("touchend",o)};window.addEventListener("mousemove",r,{passive:!1}),window.addEventListener("mouseup",o),window.addEventListener("touchmove",r,{passive:!1}),window.addEventListener("touchend",o)},H=(0,a.useCallback)(()=>new Promise(e=>{const t=w.current,n=S;if(!t||!n)return e(null);const a=document.createElement("canvas"),s=N%180!=0,d=s?A.h:A.w,c=s?A.w:A.h,u=Math.min(1,i/Math.max(d,c));a.width=Math.round(d*u),a.height=Math.round(c*u);const p=a.getContext("2d");if(!p)return e(null);p.filter=`brightness(${R}%) contrast(${F}%)`;const h=document.createElement("canvas");h.width=s?n.h:n.w,h.height=s?n.w:n.h;const f=h.getContext("2d");if(!f)return e(null);f.translate(h.width/2,h.height/2),f.rotate(N*Math.PI/180),f.drawImage(t,-n.w/2,-n.h/2,n.w,n.h),p.drawImage(h,A.x,A.y,A.w,A.h,0,0,a.width,a.height),a.toBlob(t=>{if(!t)return e(null);const n="image/jpeg"===r?"jpg":"image/webp"===r?"webp":"png",o=l.endsWith(`.${n}`)?l:l.replace(/\.\w+$/,"")+`.${n}`;e({blob:t,file:new File([t],o,{type:r,lastModified:Date.now()}),url:URL.createObjectURL(t),width:a.width,height:a.height})},r,o)}),[A,N,R,F,S,r,o,i,l]);(0,a.useImperativeHandle)(m,()=>({getResult:H,reset:()=>{if(D(0),P(100),I(100),S){const e=Ea[z];if(e){const t=Math.min(S.w,S.h*e),n=t/e;L({x:(S.w-t)/2,y:(S.h-n)/2,w:t,h:n})}else L({x:0,y:0,w:S.w,h:S.h})}},loadSource:e=>$(e)}),[H,z,S]);const O={border:`1px solid ${x.border}`,borderRadius:12,background:x.surface,padding:16,...h},q={border:`2px dashed ${T?x.primary:x.border}`,borderRadius:10,padding:48,textAlign:"center",color:x.textMuted,cursor:"pointer",transition:"border-color 0.15s",background:T?`${x.primary}10`:"transparent"},U={padding:"8px 14px",border:`1px solid ${x.border}`,borderRadius:6,background:x.bg,color:x.text,cursor:"pointer",fontSize:13,fontWeight:600,minHeight:36},K=(0,a.useMemo)(()=>{const e=y.current,t=S;if(!e||!t)return null;const n=N%180!=0,r=n?t.h:t.w,o=n?t.w:t.h,i=e.width/r,a=e.height/o;return{left:A.x*i,top:A.y*a,width:A.w*i,height:A.h*a}},[A,S,N]);return k?(0,d.jsxs)("div",{ref:v,className:p,style:O,children:[(0,d.jsxs)("div",{style:{display:"flex",gap:8,flexWrap:"wrap",marginBottom:12,alignItems:"center"},children:[(0,d.jsxs)("span",{style:{fontSize:13,fontWeight:600,marginRight:4},children:[g.aspect,":"]}),n.map(e=>{return(0,d.jsx)("button",{type:"button",onClick:()=>M(e),style:(t=z===e,{...U,background:t?x.primary:x.bg,color:t?x.bg:x.text,borderColor:t?x.primary:x.border}),"aria-pressed":z===e,children:"free"===e?g.free:e},e);var t}),(0,d.jsx)("div",{style:{width:1,height:24,background:x.border,margin:"0 4px"}}),(0,d.jsxs)("button",{type:"button",onClick:()=>D(e=>(e-90+360)%360),style:U,"aria-label":`${g.rotate} 90 degrees left`,children:["↺ ",g.rotate]}),(0,d.jsxs)("button",{type:"button",onClick:()=>D(e=>(e+90)%360),style:U,"aria-label":`${g.rotate} 90 degrees right`,children:["↻ ",g.rotate]})]}),(0,d.jsxs)("div",{style:{display:"flex",gap:16,marginBottom:12,flexWrap:"wrap"},children:[(0,d.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13},children:[(0,d.jsx)("span",{style:{minWidth:80},children:g.brightness}),(0,d.jsx)("input",{type:"range",min:50,max:150,value:R,onChange:e=>P(Number(e.target.value)),"aria-label":g.brightness,style:{width:140}}),(0,d.jsxs)("span",{style:{minWidth:40,color:x.textMuted,fontVariantNumeric:"tabular-nums"},children:[R,"%"]})]}),(0,d.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13},children:[(0,d.jsx)("span",{style:{minWidth:80},children:g.contrast}),(0,d.jsx)("input",{type:"range",min:50,max:150,value:F,onChange:e=>I(Number(e.target.value)),"aria-label":g.contrast,style:{width:140}}),(0,d.jsxs)("span",{style:{minWidth:40,color:x.textMuted,fontVariantNumeric:"tabular-nums"},children:[F,"%"]})]})]}),(0,d.jsxs)("div",{style:{position:"relative",display:"inline-block",maxWidth:"100%",userSelect:"none",touchAction:"none"},children:[(0,d.jsx)("canvas",{ref:y,style:{display:"block",maxWidth:"100%"}}),K&&(0,d.jsx)("div",{role:"region","aria-label":"Crop area",style:{position:"absolute",left:K.left,top:K.top,width:K.width,height:K.height,border:`2px solid ${x.primary}`,boxShadow:`0 0 0 9999px ${x.bg}aa`,cursor:"move",touchAction:"none"},onMouseDown:V("move"),onTouchStart:V("move"),tabIndex:0,onKeyDown:e=>{const t=S;if(!t)return;const n=e.shiftKey?20:5;"ArrowLeft"===e.key?L(e=>({...e,x:Math.max(0,e.x-n)})):"ArrowRight"===e.key?L(e=>({...e,x:Math.min(t.w-e.w,e.x+n)})):"ArrowUp"===e.key?L(e=>({...e,y:Math.max(0,e.y-n)})):"ArrowDown"===e.key&&L(e=>({...e,y:Math.min(t.h-e.h,e.y+n)}))},children:["nw","ne","sw","se"].map(e=>(0,d.jsx)("div",{onMouseDown:V(e),onTouchStart:V(e),style:{position:"absolute",width:14,height:14,background:x.primary,border:`2px solid ${x.bg}`,borderRadius:2,cursor:`${e}-resize`,top:e.startsWith("n")?-7:void 0,bottom:e.startsWith("s")?-7:void 0,left:e.endsWith("w")?-7:void 0,right:e.endsWith("e")?-7:void 0,touchAction:"none"},"aria-hidden":"true"},e))})]}),(0,d.jsxs)("div",{style:{display:"flex",gap:8,marginTop:16,justifyContent:"flex-end"},children:[u&&(0,d.jsx)("button",{type:"button",onClick:u,style:U,children:g.cancel}),(0,d.jsx)("button",{type:"button",onClick:async()=>{const e=await H();e&&c&&c(e)},style:{...U,background:x.primary,color:x.bg,borderColor:x.primary},children:g.apply})]})]}):(0,d.jsx)("div",{className:p,style:O,children:(0,d.jsxs)("div",{style:q,onClick:()=>b.current?.click(),onDrop:e=>{e.preventDefault(),W(!1);const t=e.dataTransfer.files?.[0];t&&t.type.startsWith("image/")&&B(t)},onDragOver:e=>{e.preventDefault(),W(!0)},onDragLeave:()=>W(!1),role:"button",tabIndex:0,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),b.current?.click())},"aria-label":"Upload image to edit",children:[(0,d.jsx)("div",{style:{fontSize:14,marginBottom:6},children:g.drop}),(0,d.jsx)("button",{type:"button",style:{...U,color:x.primary,borderColor:x.primary},children:g.browse}),(0,d.jsx)("input",{ref:b,type:"file",accept:"image/*",style:{display:"none"},onChange:e=>{const t=e.target.files?.[0];t&&B(t)}})]})})});Va.displayName="TkxImageEditor";var Ha={razorpay:"https://checkout.razorpay.com/v1/checkout.js",stripe:"https://js.stripe.com/v3/",square:"https://web.squarecdn.com/v1/square.js"},Oa={razorpay:"Razorpay",stripe:"Stripe",square:"Square"},qa=/^[A-Za-z0-9_-]{20,200}$/,Ua={},Ka=(0,a.forwardRef)(function({config:e,onSuccess:t,onFailure:n,onDismiss:r,children:o,variant:i="primary",size:l="md",disabled:s,className:c,style:u},p){const h=J(),f=Ot(),[m,g]=(0,a.useState)(!1),x="razorpay"===e.provider||"stripe"===e.provider?e.publicKey:e.applicationId;qa.test(x);const b="sm"===l?13:"lg"===l?16:14,y="sm"===l?32:"lg"===l?48:40,v={padding:`${"sm"===l?6:"lg"===l?12:9}px ${"sm"===l?12:"lg"===l?22:16}px`,borderRadius:8,border:"outline"===i?`1.5px solid ${h.primary}`:"none",background:"outline"===i?"transparent":h.primary,color:"outline"===i?h.primary:h.bg,fontSize:b,fontWeight:600,cursor:s?"not-allowed":m?"progress":"pointer",opacity:s?.5:1,minHeight:y,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:8,transition:"opacity 0.15s, transform 0.05s",...u};return(0,d.jsx)("button",{ref:p,type:"button",onClick:async()=>{if(!m&&!s){g(!0);try{if(await function(e){if("undefined"==typeof window)return Promise.resolve();if(window[Oa[e]])return Promise.resolve();if(Ua[e])return Ua[e];const t=new Promise((t,n)=>{const r=document.querySelector(`script[data-tkx-payment="${e}"]`);if(r)return r.addEventListener("load",()=>t()),void r.addEventListener("error",()=>n(new Error("script-load-failed")));const o=document.createElement("script");o.src=Ha[e],o.async=!0,o.dataset.tkxPayment=e,o.addEventListener("load",()=>t()),o.addEventListener("error",()=>n(new Error("script-load-failed"))),document.head.appendChild(o)});return Ua[e]=t,t}(e.provider),"razorpay"===e.provider){const o=window.Razorpay;if(!o)throw new Error("Razorpay script loaded but global missing");const i=new o({key:e.publicKey,amount:e.amount,currency:e.currency,order_id:e.orderId,name:oe(e.brand?.name??"Payment"),description:oe(e.brand?.description??""),image:e.brand?.image,prefill:e.prefill,notes:e.notes,theme:{color:e.themeColor??h.primary},handler:e=>{t({provider:"razorpay",paymentId:e.razorpay_payment_id,orderId:e.razorpay_order_id,signature:e.razorpay_signature,raw:e})},modal:{ondismiss:()=>{g(!1),r?.()}}});return i.on("payment.failed",e=>{g(!1),n?.({provider:"razorpay",code:e?.error?.code??"unknown",message:e?.error?.description??"Payment failed",raw:e})}),void i.open()}if("stripe"===e.provider){const t=window.Stripe;if(!t)throw new Error("Stripe script loaded but global missing");const r=await t(e.publicKey).redirectToCheckout({sessionId:e.sessionId});return void(r?.error&&(g(!1),n?.({provider:"stripe",code:r.error.code??"unknown",message:r.error.message??"Stripe checkout failed",raw:r})))}if("square"===e.provider){if(!window.Square)throw new Error("Square script loaded but global missing");const r={applicationId:e.applicationId,locationId:e.locationId,orderId:e.orderId,amount:e.amount,currency:e.currency,success:(n,r)=>t({provider:"square",paymentId:n,orderId:e.orderId,raw:r}),failure:(e,t,r)=>n?.({provider:"square",code:e,message:t,raw:r})};return void window.dispatchEvent(new CustomEvent("tkx-payment-square-init",{detail:r}))}}catch(o){g(!1),n?.({provider:e.provider,code:"sdk-load-failed",message:o?.message??"Unable to load payment SDK",raw:o})}}},disabled:s||m,"aria-busy":m,className:c,style:v,"data-tkx-payment-provider":e.provider,children:m?(0,d.jsx)("span",{"aria-hidden":"true",children:f.loading}):o??"Pay"})});Ka.displayName="TkxPaymentButton";var Ya=(0,a.forwardRef)(function({label:e,width:t,height:n=180,strokeColor:r,strokeWidth:o=2,backgroundColor:i,onChange:l,disabled:s,className:c,style:u},p){const h=J(),f=Ot(),m=(0,a.useRef)(null),g=(0,a.useRef)(null),x=(0,a.useRef)([]),b=(0,a.useRef)(null),y=(0,a.useRef)(1),[v,w]=(0,a.useState)(t??320),k=r??h.text,$=i??h.surface;(0,a.useEffect)(()=>{if(void 0!==t)return;const e=m.current;if(!e||"undefined"==typeof ResizeObserver)return;const n=new ResizeObserver(e=>{for(const t of e){const e=Math.floor(t.contentRect.width);e>0&&w(e)}});return n.observe(e),()=>n.disconnect()},[t]);const S=(0,a.useCallback)(()=>{const e=g.current;if(!e)return;const t=e.getContext("2d");if(!t)return;const n=y.current;t.fillStyle=$,t.fillRect(0,0,e.width,e.height),t.strokeStyle=k,t.lineWidth=o*n,t.lineCap="round",t.lineJoin="round";for(const r of x.current){if(r.length<2){1===r.length&&(t.beginPath(),t.arc(r[0].x*n,r[0].y*n,o*n/2,0,2*Math.PI),t.fillStyle=k,t.fill());continue}t.beginPath(),t.moveTo(r[0].x*n,r[0].y*n);for(let o=1;o<r.length-1;o++){const e=(r[o].x+r[o+1].x)/2,i=(r[o].y+r[o+1].y)/2;t.quadraticCurveTo(r[o].x*n,r[o].y*n,e*n,i*n)}const e=r[r.length-1];t.lineTo(e.x*n,e.y*n),t.stroke()}},[$,k,o]);(0,a.useEffect)(()=>{const e=g.current;if(!e)return;const t=window.devicePixelRatio||1;y.current=t,e.width=v*t,e.height=n*t,e.style.width=`${v}px`,e.style.height=`${n}px`,S()},[v,n,S]);const C=e=>{const t=e.currentTarget.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top}},z=e=>{if(b.current){try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}b.current=null,l?.(g.current?.toDataURL("image/png")??"")}};(0,a.useImperativeHandle)(p,()=>({clear:()=>{x.current=[],b.current=null,S(),l?.(g.current?.toDataURL("image/png")??"")},undo:()=>{x.current.pop(),S(),l?.(g.current?.toDataURL("image/png")??"")},isEmpty:()=>0===x.current.length,toDataURL:(e="image/png",t=.92)=>g.current?.toDataURL(e,t)??"",toBlob:(e="image/png",t=.92)=>new Promise(n=>{g.current?.toBlob(e=>n(e),e,t)})}),[S,l]);const M={display:"inline-flex",flexDirection:"column",gap:6,width:t??"100%",...u},N={fontSize:13,fontWeight:600,color:h.text},D={borderRadius:8,border:`1px solid ${h.border}`,background:$,cursor:s?"not-allowed":"crosshair",touchAction:"none",display:"block",width:"100%"};return(0,d.jsxs)("div",{ref:m,className:c,style:M,children:[e&&(0,d.jsx)("label",{style:N,children:e}),(0,d.jsx)("canvas",{ref:g,role:"img","aria-label":e??f.uploadFiles??"Signature pad",style:D,onPointerDown:e=>{s||(e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),b.current=[C(e)],x.current.push(b.current))},onPointerMove:e=>{if(!b.current||s)return;e.preventDefault();const t=C(e),n=b.current,r=n[n.length-1];Math.abs(r.x-t.x)<1&&Math.abs(r.y-t.y)<1||(n.push(t),S())},onPointerUp:z,onPointerCancel:z})]})});Ya.displayName="TkxSignaturePad";var Xa=async(e,t)=>{const n=await fetch(`https://api.postalpincode.in/pincode/${e}`,{signal:t});if(!n.ok)throw new Error(`HTTP ${n.status}`);const r=await n.json();return Array.isArray(r)&&r[0]&&"Success"===r[0].Status&&r[0].PostOffice?r[0].PostOffice:[]},Za=/^\d{6}$/,Ga=(0,a.forwardRef)(function({value:e,onChange:t,lookup:n=Xa,divisionsSource:r,label:o,showAddressLines:i=!0,disabled:l,className:s,style:c},u){const p=J(),h=Ot(),f=(0,a.useId)(),[m,g]=(0,a.useState)([]),[x,b]=(0,a.useState)(!1),[y,v]=(0,a.useState)(null),[w,k]=(0,a.useState)([]),[$,S]=(0,a.useState)([]),[C,z]=(0,a.useState)([]),[M,N]=(0,a.useState)([]),[D,R]=(0,a.useState)(null);(0,a.useEffect)(()=>{if(!r)return;const e=new AbortController;return R(null),r.countries(e.signal).then(k).catch(e=>{"AbortError"!==e?.name&&R(e?.message||"Failed to load countries")}),()=>e.abort()},[r]),(0,a.useEffect)(()=>{if(!r||!e.countryCode)return void S([]);const t=new AbortController;return r.states(e.countryCode,t.signal).then(S).catch(e=>{"AbortError"!==e?.name&&R(e?.message||"Failed to load states")}),()=>t.abort()},[r,e.countryCode]),(0,a.useEffect)(()=>{if(!r||!e.countryCode||!e.stateCode)return void z([]);const t=new AbortController;return r.districts(e.countryCode,e.stateCode,t.signal).then(z).catch(e=>{"AbortError"!==e?.name&&R(e?.message||"Failed to load districts")}),()=>t.abort()},[r,e.countryCode,e.stateCode]),(0,a.useEffect)(()=>{if(!(r&&e.countryCode&&e.stateCode&&e.districtCode))return void N([]);const t=new AbortController;return r.subDistricts(e.countryCode,e.stateCode,e.districtCode,t.signal).then(N).catch(e=>{"AbortError"!==e?.name&&R(e?.message||"Failed to load sub-districts")}),()=>t.abort()},[r,e.countryCode,e.stateCode,e.districtCode]);const P=(0,a.useMemo)(()=>{if(!r?.subDistrictLabel||!e.countryCode||!e.stateCode)return"Sub-district";try{return r.subDistrictLabel(e.countryCode,e.stateCode)||"Sub-district"}catch{return"Sub-district"}},[r,e.countryCode,e.stateCode]);(0,a.useEffect)(()=>{if(!e.pin||!Za.test(e.pin))return g([]),void v(null);const t=new AbortController;return b(!0),v(null),n(e.pin,t.signal).then(e=>{g(e),0===e.length&&v(h.noResults)}).catch(e=>{"AbortError"!==e?.name&&(v(e?.message||"Lookup failed"),g([]))}).finally(()=>b(!1)),()=>t.abort()},[e.pin]);const F=n=>{t({...e,pin:n.Pincode,postOffice:n.Name,city:n.District,state:n.State,country:n.Country}),g([])},I=(n,r)=>{t({...e,pin:e.pin??"",[n]:r})},A={display:"flex",flexDirection:"column",gap:8,width:"100%",...c},L={display:"flex",gap:8,flexWrap:"wrap"},T={flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:4},W={width:"100%",padding:"8px 10px",border:`1px solid ${p.border}`,borderRadius:8,background:p.surface,color:p.text,fontSize:14,outline:"none",minHeight:40},j={...W,appearance:"none",WebkitAppearance:"none",MozAppearance:"none",paddingRight:28,backgroundImage:`url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='${encodeURIComponent(p.textMuted)}' d='M0 0l5 6 5-6z'/></svg>")`,backgroundRepeat:"no-repeat",backgroundPosition:"right 10px center"},E={border:`1px solid ${p.border}`,borderRadius:8,background:p.surface,maxHeight:200,overflow:"auto",padding:4},B={padding:"8px 10px",borderRadius:6,cursor:"pointer",fontSize:13,color:p.text},V={fontSize:12,color:p.textMuted};return(0,d.jsxs)("div",{className:s,style:A,children:[o&&(0,d.jsx)("label",{htmlFor:`${f}-pin`,style:{fontSize:13,fontWeight:600},children:o}),r&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{style:L,children:[(0,d.jsxs)("div",{style:T,children:[(0,d.jsx)("label",{style:V,htmlFor:`${f}-country`,children:"Country"}),(0,d.jsxs)("select",{id:`${f}-country`,value:e.countryCode??"",onChange:n=>(n=>{const r=w.find(e=>e.code===n);t({...e,pin:e.pin??"",countryCode:n||void 0,country:r?.name,stateCode:void 0,state:void 0,districtCode:void 0,city:void 0,subDistrictCode:void 0,subDistrict:void 0})})(n.target.value),disabled:l||0===w.length,style:j,children:[(0,d.jsx)("option",{value:"",children:0===w.length?"Loading…":"Select country"}),w.map(e=>(0,d.jsx)("option",{value:e.code,children:e.name},e.code))]})]}),(0,d.jsxs)("div",{style:T,children:[(0,d.jsx)("label",{style:V,htmlFor:`${f}-state`,children:"State / UT"}),(0,d.jsxs)("select",{id:`${f}-state`,value:e.stateCode??"",onChange:n=>(n=>{const r=$.find(e=>e.code===n);t({...e,pin:e.pin??"",stateCode:n||void 0,state:r?.name,districtCode:void 0,city:void 0,subDistrictCode:void 0,subDistrict:void 0})})(n.target.value),disabled:l||!e.countryCode||0===$.length,style:j,children:[(0,d.jsx)("option",{value:"",children:e.countryCode?0===$.length?"Loading…":"Select state":"Pick country first"}),$.map(e=>(0,d.jsx)("option",{value:e.code,children:e.name},e.code))]})]})]}),(0,d.jsxs)("div",{style:L,children:[(0,d.jsxs)("div",{style:T,children:[(0,d.jsx)("label",{style:V,htmlFor:`${f}-district`,children:"District"}),(0,d.jsxs)("select",{id:`${f}-district`,value:e.districtCode??"",onChange:n=>(n=>{const r=C.find(e=>e.code===n);t({...e,pin:e.pin??"",districtCode:n||void 0,city:r?.name,subDistrictCode:void 0,subDistrict:void 0})})(n.target.value),disabled:l||!e.stateCode||0===C.length,style:j,children:[(0,d.jsx)("option",{value:"",children:e.stateCode?0===C.length?"Loading…":"Select district":"Pick state first"}),C.map(e=>(0,d.jsx)("option",{value:e.code,children:e.name},e.code))]})]}),(0,d.jsxs)("div",{style:T,children:[(0,d.jsx)("label",{style:V,htmlFor:`${f}-subdistrict`,children:P}),(0,d.jsxs)("select",{id:`${f}-subdistrict`,value:e.subDistrictCode??"",onChange:n=>(n=>{const r=M.find(e=>e.code===n);t({...e,pin:e.pin??"",subDistrictCode:n||void 0,subDistrict:r?.name})})(n.target.value),disabled:l||!e.districtCode||0===M.length,style:j,children:[(0,d.jsx)("option",{value:"",children:e.districtCode?0===M.length?"Loading…":`Select ${P.toLowerCase()}`:"Pick district first"}),M.map(e=>(0,d.jsx)("option",{value:e.code,children:e.name},e.code))]})]})]}),D&&(0,d.jsx)("div",{role:"alert",style:{fontSize:12,color:p.danger},children:D})]}),(0,d.jsxs)("div",{style:L,children:[(0,d.jsxs)("div",{style:{...T,flex:"0 0 140px"},children:[(0,d.jsx)("span",{style:V,children:"PIN code"}),(0,d.jsx)("input",{ref:u,id:`${f}-pin`,type:"text",inputMode:"numeric",maxLength:6,autoComplete:"postal-code",value:e.pin??"",onChange:n=>(n=>{const r=n.replace(/\D+/g,"").slice(0,6);t({...e,pin:r})})(n.target.value),disabled:l,"aria-busy":x,"aria-invalid":null!==y,style:W,placeholder:"000000"})]}),(0,d.jsxs)("div",{style:T,children:[(0,d.jsx)("span",{style:V,children:"City"}),(0,d.jsx)("input",{type:"text",autoComplete:"address-level2",value:e.city??"",onChange:n=>t({...e,city:n.target.value,pin:e.pin??""}),disabled:l,style:W})]}),(0,d.jsxs)("div",{style:T,children:[(0,d.jsx)("span",{style:V,children:"State"}),(0,d.jsx)("input",{type:"text",autoComplete:"address-level1",value:e.state??"",onChange:n=>t({...e,state:n.target.value,pin:e.pin??""}),disabled:l,style:W})]})]}),m.length>1&&(0,d.jsx)("div",{role:"listbox","aria-label":"Matching post offices",style:E,children:m.map(t=>(0,d.jsxs)("div",{role:"option","aria-selected":e.postOffice===t.Name,onClick:()=>F(t),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),F(t))},tabIndex:0,style:{...B,background:e.postOffice===t.Name?p.surfaceAlt:"transparent"},children:[(0,d.jsx)("strong",{children:t.Name})," ",(0,d.jsxs)("span",{style:{color:p.textMuted},children:["· ",t.District,", ",t.State]})]},`${t.Pincode}-${t.Name}`))}),y&&(0,d.jsx)("div",{role:"alert",style:{fontSize:12,color:p.danger},children:y}),i&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("input",{type:"text",autoComplete:"address-line1",placeholder:"Address line 1",value:e.line1??"",onChange:e=>I("line1",e.target.value),disabled:l,style:W}),(0,d.jsx)("input",{type:"text",autoComplete:"address-line2",placeholder:"Address line 2 (optional)",value:e.line2??"",onChange:e=>I("line2",e.target.value),disabled:l,style:W})]})]})});Ga.displayName="TkxAddressInput";var _a=new Set(["JPY","KRW"]),Ja=(0,a.forwardRef)(function({value:e,onChange:t,currency:n="INR",locale:r,label:o,min:i,max:l,precision:s,required:c,disabled:u,showSymbol:p=!0,id:h,name:f,className:m,style:g},x){const b=J(),y=(0,a.useId)(),v=h??y,w=r??function(e){return"INR"===e?"en-IN":"PKR"===e?"ur-PK":"BDT"===e?"bn-BD":"JPY"===e?"ja-JP":"KRW"===e?"ko-KR":"CNY"===e?"zh-CN":"undefined"!=typeof navigator&&navigator.language?navigator.language:"en-US"}(n),k=s??(_a.has(n)?0:2),$=(0,a.useMemo)(()=>new Intl.NumberFormat(w,{minimumFractionDigits:0,maximumFractionDigits:k,useGrouping:!0}),[w,k]),S=(0,a.useMemo)(()=>{try{return new Intl.NumberFormat(w,{style:"currency",currency:n,currencyDisplay:"narrowSymbol",minimumFractionDigits:0,maximumFractionDigits:0}).formatToParts(0).find(e=>"currency"===e.type)?.value??n}catch{return n}},[w,n]),C=null===e||Number.isNaN(e)?"":$.format(e),z=(0,a.useCallback)(e=>{const n=e.replace(/[^\d.,\-]/g,""),r=$.format(1.5),o=r.includes(",")&&!r.includes(".")?",":".",a=n.replace(new RegExp(`[^\\d\\-${o}]`,"g"),"").replace(o,".");if(""===a||"-"===a)return void t(null);const s=Number(a);if(Number.isNaN(s))return;let d=s;void 0!==i&&d<i&&(d=i),void 0!==l&&d>l&&(d=l),t(d)},[$,i,l,t]),M={display:"inline-flex",flexDirection:"column",gap:6,width:"100%",maxWidth:320,...g},N={display:"flex",alignItems:"stretch",border:`1px solid ${b.border}`,borderRadius:8,background:b.surface,overflow:"hidden"},D={display:"inline-flex",alignItems:"center",padding:"0 12px",borderRight:`1px solid ${b.border}`,color:b.textMuted,fontSize:14,fontVariantNumeric:"tabular-nums",background:b.bg},R={flex:1,border:"none",outline:"none",padding:"0 12px",fontSize:14,color:b.text,background:"transparent",minHeight:40,minWidth:0,textAlign:"right",fontVariantNumeric:"tabular-nums"};return(0,d.jsxs)("div",{className:m,style:M,children:[o&&(0,d.jsxs)("label",{htmlFor:v,style:{fontSize:13,fontWeight:600,color:b.text},children:[o,c&&(0,d.jsx)("span",{style:{color:b.danger,marginLeft:4},"aria-hidden":"true",children:"*"})]}),(0,d.jsxs)("div",{style:N,children:[p&&(0,d.jsx)("span",{style:D,"aria-hidden":"true",children:S}),(0,d.jsx)("input",{ref:x,id:v,name:f,type:"text",inputMode:k>0?"decimal":"numeric",value:C,onChange:e=>z(e.target.value),disabled:u,required:c,"aria-label":o??`Amount in ${n}`,style:R})]})]})});Ja.displayName="TkxCurrencyInput";var Qa=(0,a.forwardRef)(function({items:e,onChange:t,renderItem:n,orientation:r="vertical",disabled:o,className:i,style:l,ariaLabel:s},c){const u=J(),p=(0,a.useId)(),[h,f]=(0,a.useState)(null),[m,g]=(0,a.useState)(null),x=(0,a.useRef)(null),b=(0,a.useCallback)((n,r)=>{if(n===r||n<0||r<0||r>=e.length)return;const o=[...e],[i]=o.splice(n,1);o.splice(r,0,i),t(o),x.current&&(x.current.textContent=`Moved item ${n+1} to position ${r+1}`)},[e,t]),y=e=>t=>{!o&&h&&(t.preventDefault(),t.dataTransfer.dropEffect="move",g(e))},v=()=>{f(null),g(null)},w=(t,n)=>t=>{if(o)return;const i="vertical"===r,a=i?"ArrowUp"===t.key:"ArrowLeft"===t.key,l=i?"ArrowDown"===t.key:"ArrowRight"===t.key;a&&n>0?(t.preventDefault(),b(n,n-1)):l&&n<e.length-1&&(t.preventDefault(),b(n,n+1))},k={display:"flex",flexDirection:"vertical"===r?"column":"row",gap:8,...l},$=e=>({cursor:o?"not-allowed":"grab",opacity:h===e?.5:1,transition:"opacity 0.15s, transform 0.05s",outline:m===e&&h!==e?`2px dashed ${u.primary}`:"none",outlineOffset:4,borderRadius:8});return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{ref:c,id:p,role:"list","aria-label":s??"Sortable list","aria-orientation":r,className:i,style:k,children:e.map((t,r)=>{return(0,d.jsx)("div",{role:"listitem",tabIndex:o?-1:0,draggable:!o,"data-tkx-sortable-handle":"true","aria-grabbed":h===t.id,"aria-posinset":r+1,"aria-setsize":e.length,onDragStart:(a=t.id,e=>{o||(f(a),e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",a))}),onDragOver:y(t.id),onDragEnd:v,onDrop:(i=t.id,t=>{t.preventDefault(),!o&&h&&(b(e.findIndex(e=>e.id===h),e.findIndex(e=>e.id===i)),f(null),g(null))}),onKeyDown:w(t.id,r),style:$(t.id),children:n(t,r)},t.id);var i,a})}),(0,d.jsx)("div",{ref:x,role:"status","aria-live":"polite","aria-atomic":"true",style:{position:"absolute",width:1,height:1,margin:-1,padding:0,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0}})]})});Qa.displayName="TkxSortable";var el=["#00f5d4","#7b2ff7","#f72585","#ffbe0b","#06d6a0","#3a86ff"],tl=(0,a.forwardRef)(function({trigger:e,particleCount:t=80,spread:n=60,origin:r,colors:o=el,zIndex:i=9999,className:l,style:s},c){const u=(0,a.useRef)(null),p=(0,a.useRef)([]),h=(0,a.useRef)(null),f=Te(),m=(0,a.useCallback)(()=>{const e=u.current;if(!e)return;const t=window.devicePixelRatio||1;e.width=window.innerWidth*t,e.height=window.innerHeight*t,e.style.width="100vw",e.style.height="100vh";const n=e.getContext("2d");n&&n.scale(t,t)},[]);(0,a.useEffect)(()=>(m(),window.addEventListener("resize",m),()=>window.removeEventListener("resize",m)),[m]);const g=(0,a.useCallback)(()=>{const e=u.current;if(!e)return;const t=e.getContext("2d");if(!t)return;const n=window.devicePixelRatio||1;t.clearRect(0,0,e.width/n,e.height/n);const r=p.current;for(const o of r)t.save(),t.globalAlpha=o.alpha,t.translate(o.x,o.y),t.rotate(o.rot*Math.PI/180),t.fillStyle=o.color,t.fillRect(-o.size/2,-o.size/4,o.size,o.size/2),t.restore()},[]),x=(0,a.useCallback)(()=>{const e=p.current;let t=!1;for(const n of e)n.ttl<=0||(n.x+=n.vx,n.y+=n.vy,n.vy+=.18,n.vx*=.99,n.rot+=n.vRot,n.ttl-=1,n.ttl<30&&(n.alpha=n.ttl/30),t=!0);e.length>1e3&&(p.current=e.filter(e=>e.ttl>0)),g(),h.current=t?requestAnimationFrame(x):null},[g]),b=(0,a.useCallback)(e=>{if(!u.current)return;const i=e?.x??r?.x??window.innerWidth/2,a=e?.y??r?.y??window.innerHeight/3,l=[];for(let r=0;r<t;r++){const e=((Math.random()-.5)*n-90)*(Math.PI/180),t=6+6*Math.random();l.push({x:i,y:a,vx:Math.cos(e)*t,vy:Math.sin(e)*t,rot:360*Math.random(),vRot:14*(Math.random()-.5),size:6+6*Math.random(),color:o[Math.floor(Math.random()*o.length)],alpha:1,ttl:90+Math.floor(30*Math.random())})}if(p.current.push(...l),f)return g(),void window.setTimeout(()=>{p.current=[],g()},1500);null===h.current&&(h.current=requestAnimationFrame(x))},[t,n,r,o,f,x,g]);return(0,a.useImperativeHandle)(c,()=>({fire:b}),[b]),(0,a.useEffect)(()=>{e&&b()},[e]),(0,a.useEffect)(()=>()=>{null!==h.current&&cancelAnimationFrame(h.current)},[]),(0,d.jsx)("canvas",{ref:u,"aria-hidden":"true",className:l,style:{position:"fixed",inset:0,pointerEvents:"none",zIndex:i,...s}})});tl.displayName="TkxConfetti";var nl="data-tkx-seo";function rl(){"undefined"!=typeof document&&document.querySelectorAll(`[${nl}]`).forEach(e=>e.remove())}function ol(e,t,n="name"){if("undefined"==typeof document||!t)return;const r=document.createElement("meta");r.setAttribute(n,e),r.content=t,r.setAttribute(nl,"1"),document.head.appendChild(r)}var il=["Pratipada","Dwitiya","Tritiya","Chaturthi","Panchami","Shashthi","Saptami","Ashtami","Navami","Dashami","Ekadashi","Dwadashi","Trayodashi","Chaturdashi","Purnima","Pratipada","Dwitiya","Tritiya","Chaturthi","Panchami","Shashthi","Saptami","Ashtami","Navami","Dashami","Ekadashi","Dwadashi","Trayodashi","Chaturdashi","Amavasya"],al=["Ashwini","Bharani","Krittika","Rohini","Mrigashira","Ardra","Punarvasu","Pushya","Ashlesha","Magha","Purva Phalguni","Uttara Phalguni","Hasta","Chitra","Swati","Vishakha","Anuradha","Jyeshtha","Mula","Purva Ashadha","Uttara Ashadha","Shravana","Dhanishtha","Shatabhisha","Purva Bhadrapada","Uttara Bhadrapada","Revati"];function ll(e,t,n){try{return{gregorian:e,display:new Intl.DateTimeFormat(`${t}-u-ca-${n}`,{day:"numeric",month:"long",year:"numeric"}).format(e)}}catch{return{gregorian:e,display:e.toISOString().slice(0,10)}}}function sl(e,t,n,r){switch(t){case"hindu":return function(e,t,n){const{tithi:r,nakshatra:o}=n?n(e):function(e){const t=function(e){return e.getTime()/864e5-10957.5}(e),n=function(e){return(280.46+.9856474*e)%360}(t),r=function(e){return(218.316+13.176396*e)%360}(t);let o=(r-n+360)%360;const i=Math.floor(o/12)+1,a=Math.floor(r%360/(360/27))+1;return{tithi:Math.max(1,Math.min(30,i)),nakshatra:a}}(e);return{gregorian:e,display:`${new Intl.DateTimeFormat(t,{dateStyle:"medium"}).format(e)} · ${r<=15?"Shukla":"Krishna"} ${il[r-1]} · ${al[o-1]}`,tithi:r,nakshatra:o}}(e,n,r);case"hijri":return ll(e,n,"islamic-civil");case"hebrew":return ll(e,n,"hebrew");case"buddhist":return ll(e,n,"buddhist");default:return function(e,t){return{gregorian:e,display:new Intl.DateTimeFormat(t,{dateStyle:"long"}).format(e)}}(e,n)}}var dl=(0,a.forwardRef)(function({value:e,onChange:t,calendar:n="gregorian",locale:r,tithiResolver:o,label:i,minDate:l,maxDate:s,disabled:c,className:u,style:p},h){const f=J(),m=Ot(),g=r??("undefined"!=typeof navigator?navigator.language:"en-US"),[x,b]=(0,a.useState)(!1),y=(0,a.useMemo)(()=>e?sl(e,n,g,o).display:"",[e,n,g,o]),v={display:"inline-flex",flexDirection:"column",gap:6,width:"100%",maxWidth:360,...p},w={display:"flex",alignItems:"stretch",border:`1px solid ${f.border}`,borderRadius:8,background:f.surface,overflow:"hidden"},k={flex:1,border:"none",outline:"none",padding:"0 12px",fontSize:14,color:f.text,background:"transparent",minHeight:40,minWidth:0};return(0,d.jsxs)("div",{className:u,style:v,children:[i&&(0,d.jsx)("label",{style:{fontSize:13,fontWeight:600,color:f.text},children:i}),(0,d.jsxs)("div",{style:w,children:[(0,d.jsx)("input",{ref:h,type:"text",readOnly:!0,value:y,onClick:()=>!c&&b(!0),onFocus:()=>!c&&b(!0),disabled:c,placeholder:m.selectDate,"aria-label":i??m.selectDate,style:k}),(0,d.jsx)("input",{type:"date",value:e?e.toISOString().slice(0,10):"",onChange:e=>(e=>{if(!e)return;const r=new Date(`${e}T00:00:00`);Number.isNaN(r.getTime())||l&&r<l||s&&r>s||(t(sl(r,n,g,o)),b(!1))})(e.target.value),min:l?l.toISOString().slice(0,10):void 0,max:s?s.toISOString().slice(0,10):void 0,disabled:c,"aria-hidden":"true",tabIndex:-1,style:{width:36,border:"none",borderLeft:`1px solid ${f.border}`,padding:0,background:f.bg,color:f.text,cursor:c?"not-allowed":"pointer"}})]}),x&&e&&"gregorian"!==n&&(0,d.jsxs)("div",{role:"status",style:{padding:"6px 10px",borderRadius:6,background:f.surfaceAlt,fontSize:12,color:f.textMuted},children:[(0,d.jsxs)("strong",{style:{color:f.text},children:[n,":"]})," ",y]})]})});dl.displayName="TkxCalendarLunar";var cl=(0,a.forwardRef)(function({items:e,currency:t,locale:n,taxRate:r=0,shipping:o=0,paymentConfigFor:i,onComplete:l,onCancel:s,initialAddress:c={},className:u,style:p},h){const f=J(),m=Ot(),[g,x]=(0,a.useState)("address"),[b,y]=(0,a.useState)(c),[v,w]=(0,a.useState)(null),[k,$]=(0,a.useState)(null),S=e.reduce((e,t)=>e+t.quantity*t.unitPrice,0),C=S*r,z=S+C+o,M=e=>{try{return new Intl.NumberFormat(n??"en-IN",{style:"currency",currency:t}).format(e)}catch{return`${t} ${e.toFixed(2)}`}},N=Boolean(b.pin&&6===b.pin.length&&b.line1&&b.city),D={display:"grid",gridTemplateColumns:"minmax(0, 1fr) 320px",gap:24,maxWidth:960,width:"100%",...p},R={border:`1px solid ${f.border}`,borderRadius:12,padding:20,background:f.surface},P={...R,position:"sticky",top:16,height:"fit-content"},F={fontSize:11,fontWeight:600,letterSpacing:"0.05em",textTransform:"uppercase",color:f.textMuted,marginBottom:12};return(0,d.jsxs)("div",{ref:h,className:u,style:D,children:[(0,d.jsxs)("div",{style:R,children:[(0,d.jsxs)("div",{style:F,children:["Step ","address"===g?1:"payment"===g?2:3," of 3"]}),"address"===g&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("h2",{style:{margin:"0 0 16px",fontSize:20,fontWeight:700},children:"Shipping address"}),(0,d.jsx)(Ga,{value:b,onChange:y}),k&&(0,d.jsx)("div",{role:"alert",style:{marginTop:12,fontSize:13,color:f.danger},children:k}),(0,d.jsxs)("div",{style:{marginTop:20,display:"flex",justifyContent:"flex-end",gap:8},children:[s&&(0,d.jsx)("button",{type:"button",onClick:s,style:{padding:"8px 14px",borderRadius:6,border:`1px solid ${f.border}`,background:"transparent",color:f.text,cursor:"pointer",fontSize:13,fontWeight:600},children:m.cancel}),(0,d.jsx)("button",{type:"button",onClick:async()=>{if(N){$(null);try{w(await i(b)),x("payment")}catch(e){$(e?.message??"Could not initialise payment")}}else $(m.fieldRequired??"Address incomplete")},disabled:!N,style:{padding:"8px 14px",borderRadius:6,border:"none",background:N?f.primary:f.border,color:N?f.bg:f.textMuted,cursor:N?"pointer":"not-allowed",fontSize:13,fontWeight:600,minHeight:36},children:"Continue to payment"})]})]}),"payment"===g&&v&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("h2",{style:{margin:"0 0 16px",fontSize:20,fontWeight:700},children:"Payment"}),(0,d.jsxs)("p",{style:{margin:"0 0 16px",color:f.textMuted,fontSize:14},children:["Total ",(0,d.jsx)("strong",{style:{color:f.text,fontSize:18},children:M(z)})]}),(0,d.jsxs)(Ka,{config:v,onSuccess:e=>{x("confirm"),l({address:b,payment:e})},onFailure:e=>{$(e.message)},size:"lg",children:["Pay ",M(z)]}),k&&(0,d.jsx)("div",{role:"alert",style:{marginTop:12,fontSize:13,color:f.danger},children:k}),(0,d.jsx)("div",{style:{marginTop:20},children:(0,d.jsx)("button",{type:"button",onClick:()=>x("address"),style:{padding:"6px 10px",border:"none",background:"transparent",color:f.textMuted,cursor:"pointer",fontSize:13},children:"← Back to address"})})]}),"confirm"===g&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("h2",{style:{margin:"0 0 16px",fontSize:20,fontWeight:700},children:"Order confirmed"}),(0,d.jsx)("p",{style:{color:f.textMuted,fontSize:14,lineHeight:1.6},children:"Thank you. A receipt has been emailed to you. Your order will ship shortly."})]})]}),(0,d.jsxs)("div",{style:P,children:[(0,d.jsx)("div",{style:F,children:"Order summary"}),e.map(e=>(0,d.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",padding:"6px 0",fontSize:13},children:[(0,d.jsxs)("span",{style:{color:f.text},children:[e.label," ",(0,d.jsxs)("span",{style:{color:f.textMuted},children:["×",e.quantity]})]}),(0,d.jsx)("span",{style:{color:f.text,fontVariantNumeric:"tabular-nums"},children:M(e.quantity*e.unitPrice)})]},e.id)),(0,d.jsx)("hr",{style:{margin:"12px 0",border:0,borderTop:`1px solid ${f.border}`}}),r>0&&(0,d.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",fontSize:13,color:f.textMuted},children:[(0,d.jsxs)("span",{children:["Tax (",(100*r).toFixed(0),"%)"]}),(0,d.jsx)("span",{children:M(C)})]}),o>0&&(0,d.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",fontSize:13,color:f.textMuted},children:[(0,d.jsx)("span",{children:"Shipping"}),(0,d.jsx)("span",{children:M(o)})]}),(0,d.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",marginTop:12,paddingTop:12,borderTop:`2px solid ${f.text}`,fontSize:16,fontWeight:700},children:[(0,d.jsx)("span",{children:"Total"}),(0,d.jsx)("span",{children:M(z)})]})]})]})});cl.displayName="TkxCheckout";var ul=[[0,1,2,3,4,5,6,7,8,9],[1,2,3,4,0,6,7,8,9,5],[2,3,4,0,1,7,8,9,5,6],[3,4,0,1,2,8,9,5,6,7],[4,0,1,2,3,9,5,6,7,8],[5,9,8,7,6,0,4,3,2,1],[6,5,9,8,7,1,0,4,3,2],[7,6,5,9,8,2,1,0,4,3],[8,7,6,5,9,3,2,1,0,4],[9,8,7,6,5,4,3,2,1,0]],pl=[[0,1,2,3,4,5,6,7,8,9],[1,5,7,6,2,8,3,0,9,4],[5,8,0,3,7,9,6,1,4,2],[8,9,1,6,0,4,3,5,2,7],[9,4,5,3,1,2,6,8,7,0],[4,2,8,6,5,7,3,9,0,1],[2,7,9,3,8,0,6,4,1,5],[7,0,4,6,9,1,3,2,5,8]];function hl(e){const t=e.replace(/\D+/g,"");if(12!==t.length)return!1;let n=0;const r=t.split("").reverse();for(let o=0;o<r.length;o++)n=ul[n][pl[o%8][parseInt(r[o],10)]];return 0===n}function fl(e){const t=e.replace(/\D+/g,"").slice(0,12);return[t.slice(0,4),t.slice(4,8),t.slice(8,12)].filter(Boolean).join(" ")}function ml(e){const t=e.replace(/\D+/g,"").slice(0,12);return 0===t.length?"":t.length<=8?"X".repeat(t.length).match(/.{1,4}/g).join(" "):`XXXX XXXX ${t.slice(8,12)}`}var gl=(0,a.forwardRef)(function({value:e,defaultValue:t,onChange:n,label:r,mask:o=!0,disabled:i,required:l,id:s,name:c,className:u,style:p},h){const f=J(),m=Ot(),g=(0,a.useId)(),x=s??g,b=void 0!==e,[y,v]=(0,a.useState)(()=>(t??"").replace(/\D+/g,"").slice(0,12)),w=b?(e??"").replace(/\D+/g,"").slice(0,12):y,k=o?ml(w):fl(w),$=hl(w),S={fontSize:13,fontWeight:600,color:f.text},C={width:"100%",padding:"0 12px",border:`1px solid ${12!==w.length||$?f.border:f.danger}`,borderRadius:8,background:f.surface,color:f.text,fontSize:14,minHeight:40,outline:"none",fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",letterSpacing:1.5};return(0,d.jsxs)("div",{className:u,style:{display:"flex",flexDirection:"column",gap:6,...p},children:[r&&(0,d.jsxs)("label",{htmlFor:x,style:S,children:[r,l&&(0,d.jsx)("span",{style:{color:f.danger,marginLeft:4},children:"*"})]}),(0,d.jsx)("input",{ref:h,id:x,name:c,type:"text",inputMode:"numeric",autoComplete:"off",maxLength:14,value:k,onChange:e=>(e=>{const t=e.replace(/\D+/g,"").slice(0,12);b||v(t),n?.({raw:fl(t),digits:t,display:o?ml(t):fl(t),valid:hl(t)})})(e.target.value),disabled:i,required:l,"aria-invalid":12===w.length&&!$,"aria-describedby":12!==w.length||$?void 0:`${x}-err`,style:C,placeholder:"XXXX XXXX XXXX"}),12===w.length&&!$&&(0,d.jsx)("div",{id:`${x}-err`,role:"alert",style:{fontSize:12,color:f.danger},children:m.invalidFormat??"Invalid Aadhaar — checksum mismatch."}),w.length>0&&w.length<12&&(0,d.jsxs)("div",{style:{fontSize:12,color:f.textMuted},children:[12-w.length," digit",12-w.length==1?"":"s"," remaining"]})]})});gl.displayName="TkxAadhaarInput";var xl=/^[A-Z]{5}[0-9]{4}[A-Z]$/;function bl(e){const t=e.toUpperCase().trim();return!!xl.test(t)&&"PFCHATBLJG".includes(t[3])}var yl=(0,a.forwardRef)(function({value:e,defaultValue:t,onChange:n,label:r,disabled:o,required:i,id:l,name:s,className:c,style:u},p){const h=J(),f=Ot(),m=(0,a.useId)(),g=l??m,x=void 0!==e,[b,y]=(0,a.useState)((t??"").toUpperCase().slice(0,10)),v=(x?e??"":b).toUpperCase().slice(0,10),w=bl(v);return(0,d.jsxs)("div",{className:c,style:{display:"flex",flexDirection:"column",gap:6,...u},children:[r&&(0,d.jsxs)("label",{htmlFor:g,style:{fontSize:13,fontWeight:600,color:h.text},children:[r,i&&(0,d.jsx)("span",{style:{color:h.danger,marginLeft:4},children:"*"})]}),(0,d.jsx)("input",{ref:p,id:g,name:s,type:"text",inputMode:"text",autoComplete:"off",maxLength:10,value:v,onChange:e=>(e=>{const t=e.toUpperCase().replace(/[^A-Z0-9]/g,"").slice(0,10);x||y(t),n?.({raw:e,normalised:t,valid:bl(t)})})(e.target.value),disabled:o,required:i,"aria-invalid":10===v.length&&!w,style:{width:"100%",padding:"0 12px",minHeight:40,border:`1px solid ${10!==v.length||w?h.border:h.danger}`,borderRadius:8,background:h.surface,color:h.text,fontSize:14,fontFamily:"ui-monospace, monospace",letterSpacing:2,outline:"none",textTransform:"uppercase"},placeholder:"ABCDE1234F"}),10===v.length&&!w&&(0,d.jsx)("div",{role:"alert",style:{fontSize:12,color:h.danger},children:f.invalidFormat??"Invalid PAN format."})]})});yl.displayName="TkxPanInput";var vl=/^[A-Z]{3}[0-9]{7}$/;function wl(e){const t=e.toUpperCase().trim();return vl.test(t)}var kl=(0,a.forwardRef)(function({value:e,defaultValue:t,onChange:n,label:r,disabled:o,required:i,id:l,name:s,className:c,style:u},p){const h=J(),f=Ot(),m=(0,a.useId)(),g=l??m,x=void 0!==e,[b,y]=(0,a.useState)((t??"").toUpperCase().slice(0,10)),v=(x?e??"":b).toUpperCase().slice(0,10),w=wl(v);return(0,d.jsxs)("div",{className:c,style:{display:"flex",flexDirection:"column",gap:6,...u},children:[r&&(0,d.jsxs)("label",{htmlFor:g,style:{fontSize:13,fontWeight:600,color:h.text},children:[r,i&&(0,d.jsx)("span",{style:{color:h.danger,marginLeft:4},children:"*"})]}),(0,d.jsx)("input",{ref:p,id:g,name:s,type:"text",autoComplete:"off",maxLength:10,value:v,onChange:e=>(e=>{const t=e.toUpperCase().replace(/[^A-Z0-9]/g,"").slice(0,10);x||y(t),n?.({raw:e,normalised:t,valid:wl(t)})})(e.target.value),disabled:o,required:i,"aria-invalid":10===v.length&&!w,style:{width:"100%",padding:"0 12px",minHeight:40,border:`1px solid ${10!==v.length||w?h.border:h.danger}`,borderRadius:8,background:h.surface,color:h.text,fontSize:14,fontFamily:"ui-monospace, monospace",letterSpacing:1.5,outline:"none",textTransform:"uppercase"},placeholder:"ABC1234567"}),10===v.length&&!w&&(0,d.jsx)("div",{role:"alert",style:{fontSize:12,color:h.danger},children:f.invalidFormat??"Invalid Voter ID format."})]})});kl.displayName="TkxVoterIdInput";var $l=15;function Sl(e){const t=e.toUpperCase().replace(/[\s-]/g,"");return t.length===$l&&/^[A-Z]{2}[0-9]{13}$/.test(t)}function Cl(e){const t=e.toUpperCase().replace(/[\s-]/g,"");return 0===t.length?"":[t.slice(0,2),t.slice(2,4),t.slice(4,8),t.slice(8)].filter(Boolean).join("-")}var zl=(0,a.forwardRef)(function({value:e,defaultValue:t,onChange:n,label:r,disabled:o,required:i,id:l,name:s,className:c,style:u},p){const h=J(),f=Ot(),m=(0,a.useId)(),g=l??m,x=void 0!==e,[b,y]=(0,a.useState)((t??"").toUpperCase()),v=x?e??"":b,w=v.toUpperCase().replace(/[\s-]/g,"").slice(0,$l),k=Sl(w);return(0,d.jsxs)("div",{className:c,style:{display:"flex",flexDirection:"column",gap:6,...u},children:[r&&(0,d.jsxs)("label",{htmlFor:g,style:{fontSize:13,fontWeight:600,color:h.text},children:[r,i&&(0,d.jsx)("span",{style:{color:h.danger,marginLeft:4},children:"*"})]}),(0,d.jsx)("input",{ref:p,id:g,name:s,type:"text",autoComplete:"off",maxLength:20,value:v,onChange:e=>(e=>{const t=e.toUpperCase();x||y(t);const r=t.replace(/[\s-]/g,"").slice(0,$l);n?.({raw:e,normalised:r,pretty:Cl(r),valid:Sl(r)})})(e.target.value),disabled:o,required:i,"aria-invalid":w.length===$l&&!k,style:{width:"100%",padding:"0 12px",minHeight:40,border:`1px solid ${w.length!==$l||k?h.border:h.danger}`,borderRadius:8,background:h.surface,color:h.text,fontSize:14,fontFamily:"ui-monospace, monospace",letterSpacing:1.2,outline:"none",textTransform:"uppercase"},placeholder:"MH-12-2010-0012345"}),w.length===$l&&!k&&(0,d.jsx)("div",{role:"alert",style:{fontSize:12,color:h.danger},children:f.invalidFormat??"Invalid Driving Licence format."})]})});function Ml(e,t,n){try{return new Intl.NumberFormat(n??"en-US",{style:"currency",currency:t,maximumFractionDigits:e%1==0?0:2}).format(e)}catch{return`${t} ${e.toFixed(2)}`}}zl.displayName="TkxDrivingLicenceInput";var Nl=(0,a.forwardRef)(function({plans:e,cycle:t,selectedId:n,onSelect:r,className:o,style:i},a){const l=J();return(0,d.jsx)("div",{ref:a,className:o,style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(240px, 1fr))",gap:16,...i},role:"radiogroup","aria-label":"Plans",children:e.map(e=>{const o=e.id===n;return(0,d.jsxs)("button",{type:"button",role:"radio","aria-checked":o,disabled:e.disabled,onClick:()=>!e.disabled&&r?.(e),style:{position:"relative",padding:20,borderRadius:12,border:`${e.highlighted?2:1}px solid ${o||e.highlighted?l.primary:l.border}`,background:l.surface,color:l.text,textAlign:"left",cursor:e.disabled?"not-allowed":"pointer",opacity:e.disabled?.5:1,transition:"border-color 0.15s, transform 0.05s",fontFamily:"inherit",fontSize:"inherit",width:"100%"},children:[e.highlighted&&(0,d.jsx)("span",{style:{position:"absolute",top:-10,right:16,background:l.primary,color:l.bg,fontSize:11,fontWeight:700,padding:"2px 8px",borderRadius:4,letterSpacing:.4,textTransform:"uppercase"},"aria-hidden":"true",children:"Most popular"}),(0,d.jsx)("div",{style:{fontSize:12,fontWeight:700,color:l.textMuted,textTransform:"uppercase",letterSpacing:.5},children:e.name}),e.tagline&&(0,d.jsx)("div",{style:{fontSize:12,color:l.textMuted,marginTop:2},children:e.tagline}),(0,d.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:4,marginTop:12},children:[(0,d.jsx)("span",{style:{fontSize:32,fontWeight:800,color:l.text},children:Ml(e.prices[t],e.currency,e.locale)}),(0,d.jsxs)("span",{style:{fontSize:12,color:l.textMuted},children:["/ ","monthly"===t?"mo":"yr"]})]}),(0,d.jsx)("ul",{style:{listStyle:"none",padding:0,margin:"16px 0 0",fontSize:13,lineHeight:1.7},children:e.features.map(e=>(0,d.jsxs)("li",{style:{display:"flex",gap:6,alignItems:"flex-start",color:l.text},children:[(0,d.jsx)("span",{"aria-hidden":"true",style:{color:l.success},children:"✓"}),(0,d.jsx)("span",{children:e})]},e))}),(0,d.jsx)("div",{style:{marginTop:16,padding:"8px 12px",borderRadius:6,background:o?l.primary:"transparent",color:o?l.bg:l.primary,border:`1px solid ${l.primary}`,textAlign:"center",fontWeight:600,fontSize:13},children:e.ctaLabel??(o?"Selected":`Choose ${e.name}`)})]},e.id)})})});function Dl(e,t,n,r,o){if("vertical"===o){const o=e.x+n/2,i=e.y+r,a=t.x+n/2,l=t.y,s=(i+l)/2;return`M${o},${i} C${o},${s} ${a},${s} ${a},${l}`}const i=e.x+n,a=e.y+r/2,l=t.x,s=t.y+r/2,d=(i+l)/2;return`M${i},${a} C${d},${a} ${d},${s} ${l},${s}`}function Rl({node:e,w:t,h:n,isActive:r,theme:o}){const i=e.accent??o.primary,a=function(e){if(!e)return;const t=e.trim();return!t||/^javascript:/i.test(t)||/^vbscript:/i.test(t)||/^data:/i.test(t)&&!/^data:image\//i.test(t)?void 0:t}(e.avatar),l=oe(e.label),s=e.subLabel?oe(e.subLabel):"",c=e.badge?oe(e.badge):"";return(0,d.jsxs)("div",{style:{width:t,height:n,boxSizing:"border-box",background:o.surface,border:`1.5px solid ${r?i:o.border}`,borderRadius:12,padding:"10px 12px",display:"flex",alignItems:"center",gap:10,boxShadow:r?`0 8px 24px -8px ${i}66`:`0 2px 8px -4px ${o.border}88`,transition:"border-color 0.15s ease, box-shadow 0.15s ease",overflow:"hidden"},children:[(0,d.jsx)("div",{style:{width:40,height:40,minWidth:40,borderRadius:"50%",overflow:"hidden",background:`${i}22`,color:i,display:"flex",alignItems:"center",justifyContent:"center",fontSize:14,fontWeight:700,border:`1.5px solid ${i}44`},"aria-hidden":"true",children:a?(0,d.jsx)("img",{src:a,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",style:{width:"100%",height:"100%",objectFit:"cover"}}):l.slice(0,2).toUpperCase()}),(0,d.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,d.jsx)("div",{style:{fontSize:13.5,fontWeight:700,color:o.text,lineHeight:1.25,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:l}),s&&(0,d.jsx)("div",{style:{fontSize:11.5,color:o.textMuted,lineHeight:1.3,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",marginTop:1},children:s})]}),c&&(0,d.jsx)("span",{style:{fontSize:10,fontWeight:700,padding:"3px 7px",borderRadius:999,color:i,background:`${i}18`,border:`1px solid ${i}33`,letterSpacing:"0.04em",textTransform:"uppercase",flexShrink:0},children:c})]})}function Pl({collapsed:e,onClick:t,theme:n,direction:r,w:o,h:i}){const a={position:"absolute",..."vertical"===r?{left:o/2-10,top:i-10}:{left:o-10,top:i/2-10},width:20,height:20,borderRadius:"50%",background:n.surfaceAlt,border:`1.5px solid ${n.border}`,color:n.text,fontSize:12,fontWeight:700,cursor:"pointer",padding:0,lineHeight:1,zIndex:2,display:"flex",alignItems:"center",justifyContent:"center"};return(0,d.jsx)("button",{type:"button","aria-label":e?"Expand subtree":"Collapse subtree","aria-expanded":!e,onClick:e=>{e.stopPropagation(),t(e)},onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.stopPropagation(),t(e))},style:a,children:e?"+":"−"})}function Fl({data:e,direction:t="vertical",interactive:n=!0,initialZoom:r=1,nodeWidth:o=200,nodeHeight:i=84,siblingGap:l=28,levelGap:s=64,onNodeClick:c,renderNode:u,collapsedByDefault:p=!1,height:h=560,ariaLabel:f="Organization chart",className:m,style:g}){const x=J(),b=(0,a.useRef)(null),y=(0,a.useRef)(null),[v,w]=(0,a.useState)(()=>{if(!p)return new Set;const t=new Set;return function n(r){r.id!==e.id&&t.add(r.id),(r.children??[]).forEach(n)}(e),t}),[k,$]=(0,a.useState)(Il(r)),[S,C]=(0,a.useState)({x:0,y:0}),[z,M]=(0,a.useState)(e.id),N=(0,a.useMemo)(()=>function(e,t,n){const{nodeWidth:r,nodeHeight:o,siblingGap:i,levelGap:a,direction:l}=n,s=[],d=function e(n,r,o){const i=t.has(n.id),a={id:n.id,node:n,x:0,y:0,depth:r,parent:o,children:[],collapsed:i};if(!i)for(const t of n.children??[])a.children.push(e(t,r+1,a));return s.push(a),a}(e,0,null);let c=0;!function e(t){if(0===t.children.length)return t.x=c,void(c+=r+i);t.children.forEach(e),t.x=(t.children[0].x+t.children[t.children.length-1].x)/2}(d);for(const m of s)m.y=m.depth*(o+a);if("horizontal"===l)for(const m of s){const e=m.x;m.x=m.y,m.y=e}let u=1/0,p=1/0,h=-1/0,f=-1/0;for(const m of s)m.x<u&&(u=m.x),m.y<p&&(p=m.y),m.x>h&&(h=m.x),m.y>f&&(f=m.y);Number.isFinite(u)||(u=0,p=0,h=0,f=0);for(const m of s)m.x-=u,m.y-=p;return{nodes:s,width:h-u+r,height:f-p+o}}(e,v,{nodeWidth:o,nodeHeight:i,siblingGap:l,levelGap:s,direction:t}),[e,v,o,i,l,s,t]),D=(0,a.useCallback)(e=>{w(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]);(0,a.useEffect)(()=>{if(!n)return;const e=b.current;if(!e)return;const t=e=>{if(!e.ctrlKey&&!e.metaKey){if(Math.abs(e.deltaY)<4&&Math.abs(e.deltaX)<4)return;return C(t=>({x:t.x-e.deltaX,y:t.y-e.deltaY})),void e.preventDefault()}e.preventDefault();const t=e.deltaY<0?.1:-.1;$(e=>Il(e+t))};return e.addEventListener("wheel",t,{passive:!1}),()=>e.removeEventListener("wheel",t)},[n]),(0,a.useEffect)(()=>{if(!n)return;const e=b.current;if(!e)return;let t=!1,r=0,o=0,i=0,a=0;const l=n=>{n.target.closest('button, [role="treeitem"], a, input')||(t=!0,r=n.clientX,o=n.clientY,i=S.x,a=S.y,e.setPointerCapture(n.pointerId))},s=e=>{t&&C({x:i+(e.clientX-r),y:a+(e.clientY-o)})},d=n=>{t=!1;try{e.releasePointerCapture(n.pointerId)}catch{}};return e.addEventListener("pointerdown",l),e.addEventListener("pointermove",s),e.addEventListener("pointerup",d),e.addEventListener("pointercancel",d),()=>{e.removeEventListener("pointerdown",l),e.removeEventListener("pointermove",s),e.removeEventListener("pointerup",d),e.removeEventListener("pointercancel",d)}},[n,S]);const R=(0,a.useCallback)(e=>{const t=N.nodes.find(e=>e.id===z);if(t)if("ArrowRight"===e.key||"ArrowDown"===e.key){const n=t.children[0];n&&(M(n.id),e.preventDefault())}else"ArrowLeft"===e.key||"ArrowUp"===e.key?t.parent&&(M(t.parent.id),e.preventDefault()):"Enter"===e.key||" "===e.key?(c?.(t.node),e.preventDefault()):"+"===e.key||"="===e.key?$(e=>Il(e+.1)):"-"===e.key?$(e=>Il(e-.1)):"0"===e.key&&($(1),C({x:0,y:0}))},[z,N,c]),P=(0,a.useMemo)(()=>{const e=[];for(const n of N.nodes)for(const r of n.children)e.push({id:`${n.id}→${r.id}`,d:Dl(n,r,o,i,t)});return e},[N,o,i,t]),F={position:"relative",width:"100%",height:h,overflow:"hidden",borderRadius:12,background:x.bg,border:`1px solid ${x.border}`,touchAction:"none",cursor:n?"grab":"default",boxSizing:"border-box",...g},I={position:"absolute",left:"50%",top:24,width:N.width,height:N.height,transform:`translate(calc(-50% + ${S.x}px), ${S.y}px) scale(${k})`,transformOrigin:"top center",transition:"transform 0.08s ease-out"};return(0,d.jsxs)("div",{ref:b,className:m,style:F,role:"tree","aria-label":oe(f),tabIndex:0,onKeyDown:R,children:[n&&(0,d.jsxs)("div",{style:{position:"absolute",top:12,right:12,zIndex:3,display:"flex",gap:6,background:x.surface,border:`1px solid ${x.border}`,borderRadius:8,padding:4,boxShadow:`0 4px 12px -6px ${x.border}88`},children:[(0,d.jsx)(Al,{theme:x,label:"Zoom out",onClick:()=>$(e=>Il(e-.1)),children:"−"}),(0,d.jsx)(Al,{theme:x,label:"Reset zoom",onClick:()=>{$(1),C({x:0,y:0})},children:"⟳"}),(0,d.jsx)(Al,{theme:x,label:"Zoom in",onClick:()=>$(e=>Il(e+.1)),children:"+"})]}),(0,d.jsxs)("div",{ref:y,style:I,children:[(0,d.jsx)("svg",{width:N.width,height:N.height,style:{position:"absolute",left:0,top:0,pointerEvents:"none"},"aria-hidden":"true",children:P.map(e=>(0,d.jsx)("path",{d:e.d,fill:"none",stroke:x.border,strokeWidth:1.5},e.id))}),N.nodes.map(e=>{const n=(e.node.children?.length??0)>0,r=e.id===z;return(0,d.jsxs)("div",{role:"treeitem","aria-label":oe(e.node.label),"aria-selected":r,"aria-level":e.depth+1,"aria-expanded":n?!e.collapsed:void 0,tabIndex:-1,onClick:t=>{t.stopPropagation(),M(e.id),c?.(e.node)},style:{position:"absolute",left:e.x,top:e.y,width:o,height:i,cursor:c?"pointer":"default"},children:[u?u(e.node,r):(0,d.jsx)(Rl,{node:e.node,w:o,h:i,isActive:r,theme:x}),n&&(0,d.jsx)(Pl,{collapsed:e.collapsed,onClick:()=>D(e.id),theme:x,direction:t,w:o,h:i})]},e.id)})]})]})}function Il(e){return e<.25?.25:e>4?4:e}function Al({children:e,onClick:t,label:n,theme:r}){return(0,d.jsx)("button",{type:"button","aria-label":n,onClick:t,style:{width:28,height:28,borderRadius:6,background:"transparent",border:"none",color:r.text,fontSize:14,fontWeight:700,cursor:"pointer",padding:0,display:"flex",alignItems:"center",justifyContent:"center"},onMouseEnter:e=>{e.currentTarget.style.background=r.surfaceAlt},onMouseLeave:e=>{e.currentTarget.style.background="transparent"},children:e})}function Ll(e,t,n,r){const o=e.getBoundingClientRect(),i=t?t.offsetHeight:320,a=t?t.offsetWidth:200,l=window.innerWidth,s=window.innerHeight,d=window.scrollX,c=window.scrollY;let u=0,p=0;switch(n){case"bottom-start":default:u=o.bottom+c+r,p=o.left+d;break;case"bottom-end":u=o.bottom+c+r,p=o.right+d-a;break;case"top-start":u=o.top+c-r-i,p=o.left+d;break;case"top-end":u=o.top+c-r-i,p=o.right+d-a;break;case"right":u=o.top+c,p=o.right+d+r;break;case"left":u=o.top+c,p=o.left+d-r-a}return n.startsWith("bottom")&&o.bottom+i>s&&(u=o.top+c-r-i),n.startsWith("top")&&o.top-i<0&&(u=o.bottom+c+r),p+a>l+d&&(p=l+d-a-8),p<d&&(p=d+8),{top:u,left:p,minWidth:o.width}}function Tl(e,t){if(!t)return e;const n=e.toLowerCase().indexOf(t.toLowerCase());return-1===n?e:(0,d.jsxs)(d.Fragment,{children:[e.slice(0,n),(0,d.jsx)("mark",{style:{background:"rgba(0,245,212,0.3)",color:"inherit",borderRadius:2},children:e.slice(n,n+t.length)}),e.slice(n+t.length)]})}function Wl({groups:e,position:t,maxHeight:n,minWidth:r,selectedKeys:o,multiSelect:i,searchable:l,searchPlaceholder:s,onSelect:c,onClose:u,renderItem:p,menuRef:h,isPortal:f,menuId:m}){const g=J(),x=Ot(),b=s??`${x.search}…`,[y,v]=(0,a.useState)(""),[w,k]=(0,a.useState)(0),[$,S]=(0,a.useState)(null),[C,z]=(0,a.useState)(0),M=(0,a.useRef)(null),N=(0,a.useRef)([]),D=(0,a.useRef)([]),R=y?e.map(e=>({...e,items:e.items.filter(e=>e.label.toLowerCase().includes(y.toLowerCase())||e.description?.toLowerCase().includes(y.toLowerCase())||e.children?.some(e=>e.label.toLowerCase().includes(y.toLowerCase())))})).filter(e=>e.items.length>0):e,P=function(e,t){const n=[];for(const r of e)for(const e of r.items)e.disabled||t&&!e.label.toLowerCase().includes(t.toLowerCase())||n.push(e);return n}(R,y);(0,a.useEffect)(()=>{l&&M.current?M.current.focus():N.current[0]?.focus(),k(0)},[l]),(0,a.useEffect)(()=>{l&&""===y||N.current[w]?.focus()},[w,l,y]);const F=(0,a.useCallback)(e=>{switch(e.key){case"ArrowDown":if(e.preventDefault(),$){const e=(P.find(e=>e.key===$)?.children??[]).filter(e=>!e.disabled);z(t=>Math.min(t+1,e.length-1))}else k(e=>Math.min(e+1,P.length-1));break;case"ArrowUp":e.preventDefault(),$?z(e=>Math.max(e-1,0)):k(e=>Math.max(e-1,0));break;case"ArrowRight":{e.preventDefault();const t=P[w];t?.children?.length&&(S(t.key),z(0));break}case"ArrowLeft":e.preventDefault(),S(null);break;case"Enter":case" ":if(e.preventDefault(),$){const e=(P.find(e=>e.key===$)?.children??[]).filter(e=>!e.disabled)[C];e&&c(e.key,e)}else{const e=P[w];e&&c(e.key,e)}break;case"Escape":e.preventDefault(),$?S(null):u();break;case"Tab":u()}},[P,w,u,c,$,C]);(0,a.useEffect)(()=>{$&&D.current[C]?.focus()},[C,$]);const I={position:f?"fixed":"absolute",top:f?t.top:void 0,left:f?t.left:void 0,minWidth:Math.max(r,t.minWidth),maxHeight:n,overflowY:"auto",background:g.surface,border:`1px solid ${g.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 A=0;return(0,d.jsxs)("div",{ref:h,id:m,role:"menu","aria-label":"Dropdown menu",tabIndex:-1,style:I,onKeyDown:F,children:[(0,d.jsx)("style",{children:"\n @keyframes tkx-dropdown-in {\n from { opacity: 0; transform: scale(0.95); }\n to { opacity: 1; transform: scale(1); }\n }\n "}),l&&(0,d.jsx)("div",{style:{padding:"8px 8px 4px"},children:(0,d.jsx)("input",{ref:M,type:"text",value:y,onChange:e=>{v(e.target.value),k(0)},placeholder:b,"aria-label":`${x.search} items`,style:{width:"100%",boxSizing:"border-box",padding:"6px 10px",background:g.surfaceAlt,border:`1px solid ${g.border}`,borderRadius:6,color:g.text,fontSize:13,outline:"none"}})}),0===R.length&&(0,d.jsx)("div",{style:{padding:"12px 16px",color:g.textMuted,fontSize:13,textAlign:"center"},children:"No results found"}),R.map((e,t)=>(0,d.jsxs)("div",{role:"group","aria-label":e.label,children:[e.label&&(0,d.jsx)("div",{style:{padding:"8px 12px 4px",fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:g.textMuted},children:oe(e.label)}),e.items.map(e=>{const t=A;e.disabled||A++;const n=o.includes(e.key),r=t===w&&!e.disabled,a=!!e.children?.length,l=$===e.key,s=p?p(e,n):(0,d.jsx)(jl,{item:e,isSelected:n,isFocused:r,multiSelect:i,query:y,theme:g,hasSubmenu:a});return(0,d.jsxs)("div",{children:[e.divider&&(0,d.jsx)("div",{role:"separator",style:{height:1,background:g.border,margin:"4px 0"}}),(0,d.jsxs)("div",{ref:e=>{N.current[t]=e},role:"menuitem","aria-disabled":e.disabled,"aria-checked":i?n:void 0,"aria-selected":i?void 0:n,"aria-haspopup":a?"menu":void 0,"aria-expanded":a?l:void 0,tabIndex:e.disabled?-1:0,style:{position:"relative",cursor:e.disabled?"not-allowed":"pointer",opacity:e.disabled?.5:1},onClick:()=>{e.disabled||(a?(S(l?null:e.key),z(0)):c(e.key,e))},onMouseEnter:()=>{e.disabled||(k(t),a?(S(e.key),z(0)):S(null))},onFocus:()=>{e.disabled||k(t)},children:[s,a&&l&&(0,d.jsx)("div",{role:"menu",style:{position:"absolute",top:0,left:"100%",minWidth:180,background:g.surface,border:`1px solid ${g.border}`,borderRadius:8,boxShadow:"0 8px 32px rgba(0,0,0,0.4)",zIndex:1e4,animation:"tkx-dropdown-in 120ms ease forwards"},children:e.children.map((e,t)=>{const n=o.includes(e.key),r=t===C;return(0,d.jsx)("div",{ref:e=>{D.current[t]=e},role:"menuitem","aria-disabled":e.disabled,"aria-selected":n,tabIndex:e.disabled?-1:0,style:{cursor:e.disabled?"not-allowed":"pointer",opacity:e.disabled?.5:1},onClick:t=>{t.stopPropagation(),e.disabled||c(e.key,e)},onMouseEnter:()=>z(t),children:(0,d.jsx)(jl,{item:e,isSelected:n,isFocused:r,multiSelect:i,query:y,theme:g,hasSubmenu:!1})},e.key)})})]})]},e.key)})]},t))]})}function jl({item:e,isSelected:t,isFocused:n,multiSelect:r,query:o,theme:i,hasSubmenu:a}){return(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px",background:n?e.danger?`${i.danger}20`:`${i.primary}18`:"transparent",transition:"background 80ms",color:e.danger?i.danger:i.text,fontSize:14,userSelect:"none"},children:[r&&(0,d.jsx)("div",{style:{width:16,height:16,border:`2px solid ${t?i.primary:i.border}`,borderRadius:4,background:t?i.primary:"transparent",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:"all 120ms"},children:t&&(0,d.jsx)("svg",{width:"10",height:"8",viewBox:"0 0 10 8",fill:"none",children:(0,d.jsx)("path",{d:"M1 4l3 3L9 1",stroke:i.bg,strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})}),e.icon&&(0,d.jsx)("span",{style:{display:"flex",alignItems:"center",flexShrink:0,color:e.danger?i.danger:i.textMuted},children:e.icon}),(0,d.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,d.jsx)("div",{style:{fontWeight:t&&!r?600:400},children:Tl(e.label,o)}),e.description&&(0,d.jsx)("div",{style:{fontSize:12,color:i.textMuted,marginTop:1},children:Tl(e.description,o)})]}),void 0!==e.badge&&(0,d.jsx)("span",{style:{background:i.primary,color:i.bg,fontSize:11,fontWeight:700,borderRadius:10,padding:"1px 7px",flexShrink:0},children:e.badge}),e.shortcut&&!a&&(0,d.jsx)("span",{style:{fontSize:12,color:i.textMuted,flexShrink:0},children:e.shortcut}),a&&(0,d.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",style:{flexShrink:0},children:(0,d.jsx)("path",{d:"M4 2l4 4-4 4",stroke:i.textMuted,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),!r&&t&&(0,d.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",style:{flexShrink:0},children:(0,d.jsx)("path",{d:"M2 7l4 4L12 3",stroke:i.primary,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})}Fl.displayName="TkxOrgChart";var El=!1,Bl="tkx-holographic-styles";function Vl(){Hl()}function Hl(){if(El||"undefined"==typeof document)return;if(document.getElementById(Bl))return void(El=!0);El=!0;const e=document.createElement("style");e.id=Bl,e.textContent="\n@keyframes tkx-holo-shimmer {\n 0% { background-position: 0% 50%; }\n 50% { background-position: 100% 50%; }\n 100% { background-position: 0% 50%; }\n}\n@keyframes tkx-holo-snapback {\n to { --tkx-holo-rx: 0deg; --tkx-holo-ry: 0deg; --tkx-holo-mx: 50%; --tkx-holo-my: 50%; }\n}\n.tkx-holo-root {\n --tkx-holo-rx: 0deg;\n --tkx-holo-ry: 0deg;\n --tkx-holo-mx: 50%;\n --tkx-holo-my: 50%;\n position: relative;\n transform-style: preserve-3d;\n transform: perspective(1000px) rotateX(var(--tkx-holo-rx)) rotateY(var(--tkx-holo-ry));\n transition: transform 280ms cubic-bezier(.2,.8,.2,1);\n will-change: transform;\n isolation: isolate;\n}\n.tkx-holo-root.tkx-holo-tracking {\n transition: none;\n}\n.tkx-holo-foil {\n position: absolute;\n inset: 0;\n border-radius: inherit;\n pointer-events: none;\n background:\n radial-gradient(circle at var(--tkx-holo-mx) var(--tkx-holo-my),\n rgba(255,255,255,0.32) 0%,\n rgba(255,255,255,0.08) 22%,\n transparent 55%),\n conic-gradient(from calc(var(--tkx-holo-mx) * 3.6deg) at 50% 50%,\n #ff006e, #ffbe0b, #06d6a0, #00f5d4, #3a86ff, #7b2ff7, #ff006e);\n background-size: 100% 100%, 280% 280%;\n background-position: 0 0, var(--tkx-holo-mx) var(--tkx-holo-my);\n mix-blend-mode: color-dodge;\n opacity: 0.55;\n filter: saturate(1.4) contrast(1.1);\n}\n.tkx-holo-foil.tkx-holo-foil-soft {\n mix-blend-mode: overlay;\n opacity: 0.35;\n}\n.tkx-holo-scan {\n position: absolute;\n inset: 0;\n border-radius: inherit;\n pointer-events: none;\n background: repeating-linear-gradient(\n 180deg,\n rgba(255,255,255,0.06) 0px,\n rgba(255,255,255,0.06) 1px,\n transparent 1px,\n transparent 3px\n );\n mix-blend-mode: overlay;\n opacity: 0.5;\n}\n.tkx-holo-content {\n position: relative;\n z-index: 1;\n transform: translateZ(20px);\n}\n.tkx-holo-root:focus-visible {\n outline: 2px solid currentColor;\n outline-offset: 4px;\n}\n@media (prefers-reduced-motion: reduce) {\n .tkx-holo-root, .tkx-holo-root.tkx-holo-tracking {\n transform: none !important;\n transition: none;\n }\n .tkx-holo-content { transform: none !important; }\n .tkx-holo-foil { animation: tkx-holo-shimmer 8s ease infinite; }\n}",document.head.appendChild(e)}function Ol(e={}){const{maxTilt:t=14,disabled:n=!1}=e,r=(0,a.useRef)(null),o=Te(),i=(0,a.useRef)(null),l=(0,a.useRef)({rx:0,ry:0,mx:50,my:50});return(0,a.useEffect)(()=>{Hl()},[]),(0,a.useEffect)(()=>{const e=r.current;if(e&&!n&&!o)return e.addEventListener("pointermove",d),e.addEventListener("pointerleave",c),()=>{e.removeEventListener("pointermove",d),e.removeEventListener("pointerleave",c),null!=i.current&&cancelAnimationFrame(i.current)};function a(){if(!e)return;const{rx:t,ry:n,mx:r,my:o}=l.current;e.style.setProperty("--tkx-holo-rx",`${t}deg`),e.style.setProperty("--tkx-holo-ry",`${n}deg`),e.style.setProperty("--tkx-holo-mx",`${r}%`),e.style.setProperty("--tkx-holo-my",`${o}%`),i.current=null}function s(){null==i.current&&(i.current=requestAnimationFrame(a))}function d(n){const r=e.getBoundingClientRect(),o=(n.clientX-r.left)/r.width,i=(n.clientY-r.top)/r.height,a=Math.max(0,Math.min(1,o)),d=Math.max(0,Math.min(1,i));l.current={rx:(.5-d)*t*2,ry:(a-.5)*t*2,mx:100*a,my:100*d},e.classList.add("tkx-holo-tracking"),s()}function c(){l.current={rx:0,ry:0,mx:50,my:50},e.classList.remove("tkx-holo-tracking"),s()}},[t,n,o]),r}var ql=(0,a.forwardRef)(function({children:e,maxTilt:t=14,scanLines:n=!0,foilIntensity:r="strong",radius:o=16,disabled:i=!1,className:l,style:s,...c},u){const p=J(),h=Ol({maxTilt:t,disabled:i});(0,a.useEffect)(()=>{if(!u)return;const e=h.current;"function"==typeof u?u(e):u.current=e},[u,h]);const f={borderRadius:"number"==typeof o?`${o}px`:o,background:`linear-gradient(135deg, ${p.surface}cc, ${p.surfaceAlt}cc)`,border:`1px solid ${p.border}`,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",color:p.text,...s};return(0,d.jsxs)("div",{ref:h,className:["tkx-holo-root",l].filter(Boolean).join(" "),style:f,...c,children:["none"!==r&&(0,d.jsx)("div",{className:"tkx-holo-foil "+("soft"===r?"tkx-holo-foil-soft":""),"aria-hidden":"true"}),n&&(0,d.jsx)("div",{className:"tkx-holo-scan","aria-hidden":"true"}),(0,d.jsx)("div",{className:"tkx-holo-content",children:e})]})}),Ul=(0,a.forwardRef)(function({title:e,subtitle:t,badge:n,children:r,padding:o=24,...i},l){const s=J(),c=(0,a.useId)(),u="number"==typeof o?`${o}px`:o;return(0,d.jsx)(ql,{ref:l,role:"article","aria-labelledby":e?c:void 0,...i,style:{minHeight:200,...i.style},children:(0,d.jsxs)("div",{style:{padding:u},children:[(e||n)&&(0,d.jsxs)("header",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:12,marginBottom:t?4:12},children:[e&&(0,d.jsx)("h3",{id:c,style:{margin:0,fontSize:20,fontWeight:700,letterSpacing:"-0.01em",color:s.text},children:e}),n]}),t&&(0,d.jsx)("p",{style:{margin:"0 0 16px",color:s.textMuted,fontSize:14},children:t}),r]})})}),Kl=(0,a.forwardRef)(function({src:e,alt:t,size:n=96,initials:r,scanLines:o=!1,...i},a){const l=J();return(0,d.jsx)(ql,{ref:a,radius:"50%",scanLines:o,...i,style:{width:n,height:n,...i.style},children:e?(0,d.jsx)("img",{src:e,alt:t,style:{width:"100%",height:"100%",borderRadius:"50%",objectFit:"cover",display:"block"}}):(0,d.jsx)("div",{role:"img","aria-label":t,style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:.36*n,fontWeight:700,color:l.text},children:r??t.charAt(0).toUpperCase()})})}),Yl={sm:"4px 10px",md:"6px 14px",lg:"8px 18px"},Xl={sm:11,md:13,lg:15},Zl={neutral:{fg:"#c4a8ff",bg:"rgba(196,168,255,0.10)",bd:"rgba(196,168,255,0.30)"},success:{fg:"#00f5d4",bg:"rgba(0,245,212,0.10)",bd:"rgba(0,245,212,0.40)"},info:{fg:"#7b8eff",bg:"rgba(123,142,255,0.10)",bd:"rgba(123,142,255,0.40)"},warning:{fg:"#ffbe0b",bg:"rgba(255,190,11,0.10)",bd:"rgba(255,190,11,0.40)"},danger:{fg:"#ff7eaf",bg:"rgba(255,0,110,0.10)",bd:"rgba(255,0,110,0.40)"}},Gl=(0,a.forwardRef)(function({children:e,size:t="md",tone:n="neutral",scanLines:r=!1,...o},i){const a=Zl[n];return(0,d.jsx)(ql,{ref:i,radius:999,scanLines:r,maxTilt:6,...o,style:{display:"inline-flex",padding:Yl[t],fontSize:Xl[t],fontWeight:700,letterSpacing:"0.04em",textTransform:"uppercase",color:a.fg,background:a.bg,border:`1px solid ${a.bd}`,...o.style},children:e})}),_l=(0,a.forwardRef)(function({children:e,onClick:t,isDisabled:n=!1,type:r="button",maxTilt:o=8,...i},l){const s=J(),c=Te(),u=(0,a.useRef)(null),p=Ol({maxTilt:o,disabled:n});return(0,a.useEffect)(()=>{const e=u.current;e&&(p.current=e,"function"==typeof l?l(e):l&&(l.current=e))},[l,p]),(0,d.jsxs)("button",{ref:u,type:r,onClick:n?void 0:t,disabled:n,className:"tkx-holo-root",style:{position:"relative",padding:"14px 28px",fontSize:15,fontWeight:700,letterSpacing:"0.02em",color:s.text,background:`linear-gradient(135deg, ${s.surface}, ${s.surfaceAlt})`,border:`1px solid ${s.primary}55`,borderRadius:12,cursor:n?"not-allowed":"pointer",opacity:n?.5:1,minHeight:44,transformStyle:"preserve-3d",...i.style},...i,children:[(0,d.jsx)("span",{className:"tkx-holo-foil","aria-hidden":"true"}),(0,d.jsx)("span",{className:"tkx-holo-content",style:{display:"inline-block"},children:e}),!c&&!n&&(0,d.jsx)("span",{"aria-hidden":"true",style:{position:"absolute",inset:-1,borderRadius:12,border:`1px solid ${s.primary}88`,boxShadow:`0 0 24px ${s.primary}44`,pointerEvents:"none",opacity:.6}})]})});function Jl(){(0,a.useEffect)(()=>{Vl()},[])}var Ql=(0,a.forwardRef)(function({header:e,footer:t,tabs:n,activeTabId:r,onTabChange:o,accent:i="#00f5d4",children:a,style:l,...s},c){return Jl(),(0,d.jsxs)("div",{ref:c,className:"tkx-holo-root",style:{position:"relative",display:"flex",flexDirection:"column",padding:0,borderRadius:14,background:"linear-gradient(180deg, rgba(13,13,20,0.85), rgba(8,8,14,0.85))",border:`1px solid ${i}33`,boxShadow:`0 0 0 1px ${i}11, 0 12px 40px rgba(0,0,0,0.5)`,overflow:"hidden",color:"#e8e8f4",...l},...s,children:[(0,d.jsx)("span",{className:"tkx-holo-foil","aria-hidden":"true"}),e&&(0,d.jsx)("div",{style:{padding:"12px 16px",borderBottom:`1px solid ${i}22`,display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,position:"relative",zIndex:1},children:e}),n&&n.length>0&&(0,d.jsx)("div",{role:"tablist",style:{display:"flex",gap:0,borderBottom:`1px solid ${i}22`,position:"relative",zIndex:1},children:n.map(e=>{const t=e.id===r;return(0,d.jsx)("button",{type:"button",role:"tab","aria-selected":t,onClick:()=>o?.(e.id),style:{padding:"10px 14px",minHeight:38,border:"none",background:"transparent",color:t?i:"#aaa",fontWeight:600,fontSize:12,cursor:"pointer",borderBottom:`2px solid ${t?i:"transparent"}`},children:e.label},e.id)})}),(0,d.jsx)("div",{style:{padding:16,flex:1,position:"relative",zIndex:1,minHeight:0},children:a}),t&&(0,d.jsx)("div",{style:{padding:"12px 16px",borderTop:`1px solid ${i}22`,position:"relative",zIndex:1},children:t})]})}),es=(0,a.forwardRef)(function({columns:e,onReorder:t,renderCard:n,onCardClick:r,maxHeight:o=720,minColumnWidth:i=280,isDragDisabled:l=!1,className:s,style:c},u){const p=J(),h=Te();(0,a.useId)();const[f,m]=(0,a.useState)(null),[g,x]=(0,a.useState)(""),b=(0,a.useRef)(new Map),y=(0,a.useCallback)((e,t,n,r)=>{l||t.isDragDisabled||0!==e.button&&"mouse"===e.pointerType||(e.currentTarget.setPointerCapture(e.pointerId),m({cardId:t.id,fromColumnId:n.id,fromIndex:r,mode:"pointer",ghostX:0,ghostY:0,toColumnId:n.id,toIndex:r}),x(`Picked up "${t.title}" from ${n.title}, position ${r+1}`))},[l]),v=(0,a.useCallback)((e,t,n)=>{if(!f||"pointer"!==f.mode)return;e.currentTarget;const r=b.current.get(f.cardId);if(!r)return;const o=r.getBoundingClientRect();m(r=>r?{...r,ghostX:e.clientX-(o.left+o.width/2),ghostY:e.clientY-(o.top+o.height/2),toColumnId:t.id,toIndex:n}:r)},[f]),w=(0,a.useCallback)(()=>{f&&"pointer"===f.mode&&$(f)},[f]),k=(0,a.useCallback)(()=>{f&&(x("Drag cancelled"),m(null))},[f]);function $(n){if(n.fromColumnId!==n.toColumnId||n.fromIndex!==n.toIndex){const r=e.find(e=>e.id===n.toColumnId),o=e.find(e=>e.id===n.fromColumnId)?.cards[n.fromIndex];t({cardId:n.cardId,fromColumnId:n.fromColumnId,fromIndex:n.fromIndex,toColumnId:n.toColumnId,toIndex:n.toIndex}),x(o&&r?`Moved "${o.title}" to ${r.title}, position ${n.toIndex+1}`:"Card moved")}else x("Returned to original position");m(null)}const S=(0,a.useCallback)((t,n,r,o)=>{if(l||n.isDragDisabled)return;if(" "===t.key||"Enter"===t.key)return t.preventDefault(),void(f?$(f):(m({cardId:n.id,fromColumnId:r.id,fromIndex:o,mode:"keyboard",toColumnId:r.id,toIndex:o}),x(`Grabbed "${n.title}". Use arrow keys to move. Enter to drop, Esc to cancel.`)));if("Escape"===t.key&&f)return t.preventDefault(),void k();if(!f||"keyboard"!==f.mode||f.cardId!==n.id)return;const i=e.findIndex(e=>e.id===f.toColumnId),a=e[i];if(a)switch(t.key){case"ArrowUp":t.preventDefault(),f.toIndex>0&&(m({...f,toIndex:f.toIndex-1}),x(`Position ${f.toIndex} of ${a.cards.length}`));break;case"ArrowDown":t.preventDefault(),f.toIndex<a.cards.length&&(m({...f,toIndex:f.toIndex+1}),x(`Position ${f.toIndex+2} of ${a.cards.length+1}`));break;case"ArrowLeft":if(t.preventDefault(),i>0){const t=e[i-1];m({...f,toColumnId:t.id,toIndex:Math.min(f.toIndex,t.cards.length)}),x(`Moved to ${t.title}`)}break;case"ArrowRight":if(t.preventDefault(),i<e.length-1){const t=e[i+1];m({...f,toColumnId:t.id,toIndex:Math.min(f.toIndex,t.cards.length)}),x(`Moved to ${t.title}`)}}},[e,f,k,l]);(0,a.useEffect)(()=>{if(!f)return;const e=e=>{"Escape"===e.key&&k()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[f,k]);const C=(0,a.useCallback)(e=>(0,d.jsxs)(d.Fragment,{children:[e.badges&&e.badges.length>0&&(0,d.jsx)("div",{style:{display:"flex",gap:6,marginBottom:8,flexWrap:"wrap"},children:e.badges.map((e,t)=>(0,d.jsx)("span",{style:{padding:"2px 8px",fontSize:10,fontWeight:700,borderRadius:999,background:e.color?`${e.color}22`:`${p.primary}22`,color:e.color??p.primary,letterSpacing:"0.05em",textTransform:"uppercase"},children:e.label},t))}),(0,d.jsx)("div",{style:{fontSize:14,fontWeight:600,color:p.text,lineHeight:1.4},children:e.title}),e.description&&(0,d.jsx)("div",{style:{fontSize:12,color:p.textMuted,marginTop:6,lineHeight:1.5},children:e.description}),e.assignee&&(0,d.jsxs)("div",{style:{marginTop:10,display:"flex",alignItems:"center",gap:6,fontSize:11,color:p.textMuted},children:[e.assignee.avatarUrl?(0,d.jsx)("img",{src:e.assignee.avatarUrl,alt:"",style:{width:20,height:20,borderRadius:"50%"}}):(0,d.jsx)("div",{"aria-hidden":"true",style:{width:20,height:20,borderRadius:"50%",background:p.primary,color:p.bg,display:"flex",alignItems:"center",justifyContent:"center",fontSize:10,fontWeight:700},children:e.assignee.name.charAt(0).toUpperCase()}),(0,d.jsx)("span",{children:e.assignee.name})]})]}),[p]),z=(0,a.useMemo)(()=>({display:"grid",gridAutoFlow:"column",gridAutoColumns:`minmax(${i}px, 1fr)`,gap:12,overflowX:"auto",maxHeight:"number"==typeof o?`${o}px`:o,padding:4,...c}),[o,i,c]);return(0,d.jsxs)("div",{ref:u,className:s,role:"grid","aria-label":"Kanban board","aria-rowcount":Math.max(...e.map(e=>e.cards.length),0)+1,"aria-colcount":e.length,style:z,children:[(0,d.jsx)("div",{"aria-live":"polite","aria-atomic":"true",style:{position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0},children:g}),e.map((e,t)=>{const o=f?.toColumnId===e.id,i=void 0!==e.wipLimit&&e.cards.length>=e.wipLimit;return(0,d.jsxs)("section",{role:"row","aria-rowindex":t+1,"aria-label":`Column: ${e.title}`,style:{background:p.surface,border:`1px solid ${o?e.color??p.primary:p.border}`,borderRadius:12,display:"flex",flexDirection:"column",minHeight:0,transition:"border-color 120ms"},children:[(0,d.jsxs)("header",{style:{padding:"12px 14px",borderBottom:`1px solid ${p.border}`,display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[(0,d.jsx)("span",{"aria-hidden":"true",style:{width:8,height:8,borderRadius:"50%",background:e.color??p.primary}}),(0,d.jsx)("h3",{style:{margin:0,fontSize:13,fontWeight:700,color:p.text,letterSpacing:"0.02em",flex:1},children:e.title}),(0,d.jsxs)("span",{style:{fontSize:12,color:i?p.danger:p.textMuted,fontFamily:"monospace",fontWeight:600},"aria-label":e.wipLimit?`${e.cards.length} of ${e.wipLimit} cards`:`${e.cards.length} cards`,children:[e.cards.length,e.wipLimit&&` / ${e.wipLimit}`]})]}),(0,d.jsxs)("div",{style:{padding:8,display:"flex",flexDirection:"column",gap:8,overflowY:"auto",flex:1,minHeight:60},children:[e.cards.map((o,i)=>{const a=f?.cardId===o.id;return(0,d.jsxs)("div",{children:[f&&f.toColumnId===e.id&&f.toIndex===i&&!a&&(0,d.jsx)(ts,{color:e.color??p.primary}),(0,d.jsx)("div",{ref:e=>{e?b.current.set(o.id,e):b.current.delete(o.id)},role:"gridcell","aria-rowindex":i+1,"aria-colindex":t+1,"aria-grabbed":a,"aria-label":o.title,tabIndex:0,"data-card-id":o.id,onPointerDown:t=>y(t,o,e,i),onPointerMove:t=>"pointer"===f?.mode?v(t,e,i):void 0,onPointerUp:w,onPointerCancel:k,onKeyDown:t=>S(t,o,e,i),onClick:()=>{f||r?.(o,e)},style:{padding:12,borderRadius:8,background:p.surfaceAlt,border:`1px solid ${a?e.color??p.primary:p.border}`,cursor:l||o.isDragDisabled?"default":"grab",touchAction:l||o.isDragDisabled?"auto":"none",opacity:a?.4:1,transform:a&&"pointer"===f.mode&&!h?`translate(${f.ghostX??0}px, ${f.ghostY??0}px) scale(1.02)`:void 0,transition:a||h?"none":"transform 120ms, border-color 120ms",userSelect:"none",outlineOffset:2},children:(n??C)(o,e)})]},`slot-${i}`)}),f&&f.toColumnId===e.id&&f.toIndex>=e.cards.length&&(0,d.jsx)(ts,{color:e.color??p.primary}),0===e.cards.length&&!f&&(0,d.jsx)("div",{style:{padding:24,textAlign:"center",color:p.textMuted,fontSize:12,border:`1px dashed ${p.border}`,borderRadius:8},children:"No cards"})]})]},e.id)})]})});function ts({color:e}){return(0,d.jsx)("div",{"aria-hidden":"true",style:{height:3,background:e,borderRadius:999,margin:"2px 0",boxShadow:`0 0 8px ${e}66`}})}var ns=new Set(["P","BR","DIV","SPAN","B","STRONG","I","EM","U","S","STRIKE","DEL","H1","H2","H3","H4","H5","H6","UL","OL","LI","BLOCKQUOTE","PRE","CODE","A","IMG","HR"]),rs=new Set(["SCRIPT","STYLE","IFRAME","OBJECT","EMBED","NOSCRIPT","TEMPLATE","META","LINK","BASE","FORM","INPUT","BUTTON","TEXTAREA","SELECT"]),os=new Set(["href","src","alt","title"]);function is(e){if(!e)return null;const t=e.trim().toLowerCase();return t.startsWith("javascript:")||t.startsWith("data:")||t.startsWith("vbscript:")?null:e.trim()}function as(e){if(!e)return null;const t=e.trim().toLowerCase();return t.startsWith("https://")||t.startsWith("http://")||t.startsWith("data:image/")?e.trim():null}function ls(e){if("undefined"==typeof document)return e;const t=document.createElement("div");return t.innerHTML=e,ss(t),t.innerHTML}function ss(e){const t=Array.from(e.childNodes);for(const n of t){if(n.nodeType===Node.TEXT_NODE){const e=n.textContent||"",t=Se(e);t!==e&&(n.textContent=t);continue}if(n.nodeType===Node.ELEMENT_NODE){const t=n;if(rs.has(t.tagName)){e.removeChild(t);continue}if(!ns.has(t.tagName)){for(;t.firstChild;)e.insertBefore(t.firstChild,t);e.removeChild(t);continue}const r=Array.from(t.attributes);for(const e of r)if(e.name.startsWith("on"))t.removeAttribute(e.name);else if(os.has(e.name)){if("href"===e.name&&"A"===t.tagName){const n=is(e.value);n?(t.setAttribute("href",n),t.setAttribute("rel","noopener noreferrer"),t.setAttribute("target","_blank")):t.removeAttribute("href")}"src"===e.name&&"IMG"===t.tagName&&(as(e.value)||t.removeAttribute("src"))}else t.removeAttribute(e.name);ss(t)}else n.nodeType===Node.COMMENT_NODE&&e.removeChild(n)}}var ds=[{id:"bold",label:"Bold",icon:"B",cmd:"bold",shortcut:"⌘B"},{id:"italic",label:"Italic",icon:"I",cmd:"italic",shortcut:"⌘I"},{id:"underline",label:"Underline",icon:"U",cmd:"underline",shortcut:"⌘U"},{id:"strike",label:"Strikethrough",icon:"S",cmd:"strikeThrough"},{id:"h1",label:"Heading 1",icon:"H1"},{id:"h2",label:"Heading 2",icon:"H2"},{id:"h3",label:"Heading 3",icon:"H3"},{id:"ul",label:"Bullet list",icon:"•",cmd:"insertUnorderedList"},{id:"ol",label:"Numbered list",icon:"1.",cmd:"insertOrderedList"},{id:"quote",label:"Quote",icon:'"'},{id:"code",label:"Inline code",icon:"<>"},{id:"codeblock",label:"Code block",icon:"{ }"},{id:"link",label:"Link",icon:"🔗",shortcut:"⌘K"},{id:"image",label:"Image",icon:"🖼"},{id:"hr",label:"Divider",icon:"—"}],cs=(0,a.forwardRef)(function({initialValue:e="",onChange:t,placeholder:n="Start writing…",tools:r,maxHeight:o,minHeight:i=200,label:l="Rich text editor",isDisabled:s=!1,className:c,style:u,topSlot:p,bottomSlot:h},f){const m=J(),g=(0,a.useRef)(null),x=(0,a.useId)(),[b,y]=(0,a.useState)(new Set),[v,w]=(0,a.useState)(!0),k=r??ds.map(e=>e.id),$=(0,a.useCallback)(()=>{if(!g.current)return;const e=ls(g.current.innerHTML);t?.(e),w(""===g.current.textContent?.trim())},[t]);(0,a.useImperativeHandle)(f,()=>({getHTML:()=>ls(g.current?.innerHTML??""),getMarkdown:()=>function(e){if("undefined"==typeof document)return e;const t=document.createElement("div");return t.innerHTML=ls(e),function e(t,n=0){if(t.nodeType===Node.TEXT_NODE)return t.textContent||"";if(t.nodeType!==Node.ELEMENT_NODE)return"";const r=t,o=Array.from(r.childNodes).map(t=>e(t,n)).join("");switch(r.tagName){case"B":case"STRONG":return`**${o}**`;case"I":case"EM":return`*${o}*`;case"U":return`<u>${o}</u>`;case"S":case"STRIKE":case"DEL":return`~~${o}~~`;case"H1":return`# ${o}\n\n`;case"H2":return`## ${o}\n\n`;case"H3":return`### ${o}\n\n`;case"H4":return`#### ${o}\n\n`;case"H5":return`##### ${o}\n\n`;case"H6":return`###### ${o}\n\n`;case"P":return`${o}\n\n`;case"BR":return"\n";case"HR":return"\n---\n\n";case"BLOCKQUOTE":return`> ${o.replace(/\n/g,"\n> ")}\n\n`;case"CODE":return"PRE"===r.parentElement?.tagName?o:`\`${o}\``;case"PRE":return`\`\`\`\n${o}\n\`\`\`\n\n`;case"UL":case"OL":return"\n"+Array.from(r.children).map((t,o)=>e(t,n+1).replace(/^/,"OL"===r.tagName?`${o+1}. `:"- ")).join("")+"\n";case"LI":return`${" ".repeat(Math.max(0,n-1))}${o}\n`;case"A":return`[${o}](${r.getAttribute("href")||""})`;case"IMG":{const e=r.getAttribute("src")||"";return`![${r.getAttribute("alt")||""}](${e})`}default:return o}}(t).trim()}(g.current?.innerHTML??""),getText:()=>g.current?.textContent??"",setHTML:e=>{g.current&&(g.current.innerHTML=ls(e),$())},focus:()=>g.current?.focus()})),(0,a.useEffect)(()=>{g.current&&e&&(g.current.innerHTML=ls(e),w(""===g.current.textContent?.trim()))},[]);const S=(0,a.useCallback)(()=>{if("undefined"==typeof document)return;const e=new Set;try{document.queryCommandState("bold")&&e.add("bold"),document.queryCommandState("italic")&&e.add("italic"),document.queryCommandState("underline")&&e.add("underline"),document.queryCommandState("strikeThrough")&&e.add("strike"),document.queryCommandState("insertUnorderedList")&&e.add("ul"),document.queryCommandState("insertOrderedList")&&e.add("ol")}catch{}y(e)},[]);(0,a.useEffect)(()=>(document.addEventListener("selectionchange",S),()=>document.removeEventListener("selectionchange",S)),[S]);const C=(0,a.useCallback)(e=>{if(s)return;g.current?.focus();const t=ds.find(t=>t.id===e);switch(e){case"h1":case"h2":case"h3":document.execCommand("formatBlock",!1,e);break;case"quote":document.execCommand("formatBlock",!1,"blockquote");break;case"code":!function(){if("undefined"==typeof window)return;const e=window.getSelection();if(!e||0===e.rangeCount)return;const t=e.getRangeAt(0),n=t.toString();if(!n)return;const r=document.createElement("code");r.textContent=n,t.deleteContents(),t.insertNode(r)}();break;case"codeblock":document.execCommand("formatBlock",!1,"pre");break;case"link":{const e=window.getSelection()?.toString()||"",t=window.prompt("Link URL","https://");if(!t)break;const r=is(t);if(!r){window.alert("That URL is not allowed.");break}const o=e||r;document.execCommand("insertHTML",!1,`<a href="${us(r)}" target="_blank" rel="noopener noreferrer">${n=o,n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}</a>`);break}case"image":{const e=window.prompt("Image URL (https:// or data:image/…)");if(!e)break;const t=as(e);if(!t){window.alert("That image URL is not allowed.");break}const n=window.prompt("Alt text (required for accessibility)")||"";document.execCommand("insertHTML",!1,`<img src="${us(t)}" alt="${us(n)}" />`);break}case"hr":document.execCommand("insertHTML",!1,"<hr />");break;default:t?.cmd&&document.execCommand(t.cmd,!1)}var n;$(),S()},[s,$,S]),z=(0,a.useCallback)(e=>{if(!e.metaKey&&!e.ctrlKey)return;const t=e.key.toLowerCase();"b"===t?(e.preventDefault(),C("bold")):"i"===t?(e.preventDefault(),C("italic")):"u"===t?(e.preventDefault(),C("underline")):"k"===t&&(e.preventDefault(),C("link"))},[C]),M=(0,a.useCallback)(e=>{e.preventDefault();const t=e.clipboardData.getData("text/html"),n=e.clipboardData.getData("text/plain");t?document.execCommand("insertHTML",!1,ls(t)):n&&document.execCommand("insertText",!1,n),$()},[$]),N=(0,a.useCallback)(e=>{const t=Array.from(e.currentTarget.querySelectorAll("button[data-tool]")),n=t.indexOf(document.activeElement);n<0||("ArrowRight"===e.key?(e.preventDefault(),t[(n+1)%t.length].focus()):"ArrowLeft"===e.key?(e.preventDefault(),t[(n-1+t.length)%t.length].focus()):"Home"===e.key?(e.preventDefault(),t[0].focus()):"End"===e.key&&(e.preventDefault(),t[t.length-1].focus()))},[]),D={border:`1px solid ${m.border}`,borderRadius:12,background:m.surface,...u},R={display:"flex",flexWrap:"wrap",gap:4,padding:8,borderBottom:`1px solid ${m.border}`,background:m.surfaceAlt,borderTopLeftRadius:12,borderTopRightRadius:12},P={padding:16,outline:"none",minHeight:"number"==typeof i?`${i}px`:i,maxHeight:"number"==typeof o?`${o}px`:o,overflowY:o?"auto":"visible",color:m.text,fontSize:15,lineHeight:1.6,borderBottomLeftRadius:12,borderBottomRightRadius:12,cursor:s?"not-allowed":"text",opacity:s?.6:1};return(0,d.jsxs)("div",{className:c,style:D,children:[p,(0,d.jsx)("div",{role:"toolbar","aria-label":"Formatting","aria-controls":x,onKeyDown:N,style:R,children:k.map((e,t)=>{const n=ds.find(t=>t.id===e);if(!n)return null;const r=b.has(e);return(0,d.jsx)("button",{type:"button","data-tool":n.id,tabIndex:0===t?0:-1,"aria-label":n.label+(n.shortcut?` (${n.shortcut})`:""),"aria-pressed":r,disabled:s,onMouseDown:e=>e.preventDefault(),onClick:()=>C(n.id),style:{background:r?m.primary:"transparent",color:r?m.bg:m.text,border:`1px solid ${r?m.primary:"transparent"}`,padding:"6px 10px",borderRadius:6,cursor:s?"not-allowed":"pointer",fontWeight:700,fontSize:13,minWidth:32,minHeight:32,display:"inline-flex",alignItems:"center",justifyContent:"center",transition:"background 120ms"},children:n.icon},n.id)})}),(0,d.jsxs)("div",{style:{position:"relative"},children:[(0,d.jsx)("div",{ref:g,id:x,role:"textbox","aria-label":l,"aria-multiline":"true","aria-readonly":s,contentEditable:!s,suppressContentEditableWarning:!0,onInput:$,onKeyDown:z,onPaste:M,spellCheck:!0,style:P}),v&&!s&&(0,d.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",top:16,left:16,color:m.textMuted,pointerEvents:"none",fontSize:15},children:n})]}),h]})});function us(e){return e.replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var ps=[{key:"bg",label:"Page background",group:"surface"},{key:"surface",label:"Card surface",group:"surface"},{key:"surfaceAlt",label:"Alt surface",group:"surface"},{key:"border",label:"Border",group:"surface"},{key:"text",label:"Body text",group:"text",contrastAgainst:"bg",threshold:7},{key:"textMuted",label:"Muted text",group:"text",contrastAgainst:"bg",threshold:4.5},{key:"primary",label:"Primary",group:"brand",contrastAgainst:"bg",threshold:4.5},{key:"secondary",label:"Secondary",group:"brand",contrastAgainst:"bg",threshold:4.5},{key:"success",label:"Success",group:"status",contrastAgainst:"bg",threshold:4.5},{key:"warning",label:"Warning",group:"status",contrastAgainst:"bg",threshold:4.5},{key:"danger",label:"Danger",group:"status",contrastAgainst:"bg",threshold:4.5},{key:"info",label:"Info",group:"status",contrastAgainst:"bg",threshold:4.5}],hs={surface:"Surfaces",text:"Text",brand:"Brand",status:"Status colors"};function fs(e){const t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)}function ms(e){const t=e.replace(/^#/,"").match(/^([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i);if(!t)return 0;const[n,r,o]=[t[1],t[2],t[3]].map(e=>parseInt(e,16));return.2126*fs(n)+.7152*fs(r)+.0722*fs(o)}function gs({slot:e,value:t,pairedValue:n,onChange:r}){const o=J(),i=n?function(e,t){const n=ms(e),r=ms(t),[o,i]=n>r?[n,r]:[r,n];return(o+.05)/(i+.05)}(t,n):null,a=i?function(e){return e>=7?{label:"AAA",color:"#06d6a0"}:e>=4.5?{label:"AA",color:"#ffbe0b"}:e>=3?{label:"AA Large",color:"#ff8500"}:{label:"fail",color:"#f72585"}}(i):null,l=e.threshold&&null!==i?i>=e.threshold:null;return(0,d.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"32px 1fr auto",gap:10,alignItems:"center"},children:[(0,d.jsx)("input",{type:"color",value:t,onChange:e=>r(e.target.value),"aria-label":`${e.label} color`,style:{width:32,height:32,padding:0,border:`1px solid ${o.border}`,borderRadius:6,background:"transparent",cursor:"pointer"}}),(0,d.jsxs)("div",{style:{minWidth:0},children:[(0,d.jsx)("div",{style:{fontSize:13,fontWeight:600,color:o.text},children:e.label}),(0,d.jsx)("input",{type:"text",value:t,onChange:e=>{const t=e.target.value;/^#[0-9a-f]{0,6}$/i.test(t)&&r(t)},"aria-label":`${e.label} hex`,style:{background:"transparent",border:"none",color:o.textMuted,fontFamily:"monospace",fontSize:12,padding:0,outline:"none",width:"100%"}})]}),a&&(0,d.jsxs)("span",{title:`Contrast vs ${e.contrastAgainst}: ${i?.toFixed(2)}:1 — needs ${e.threshold}:1`,style:{padding:"3px 8px",borderRadius:999,fontSize:10,fontWeight:700,background:!1===l?"#f7258522":`${a.color}22`,color:!1===l?"#f72585":a.color,letterSpacing:"0.04em",whiteSpace:"nowrap"},children:[i?.toFixed(1)," · ",a.label]})]})}function xs(){const e=J();return(0,d.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[(0,d.jsx)("h2",{style:{margin:0,fontSize:24,fontWeight:800,color:e.text},children:"Live preview"}),(0,d.jsx)("p",{style:{margin:0,color:e.textMuted},children:"Edit the tokens on the left. Sample components render here with the current theme. Contrast badges flag any token that fails WCAG."}),(0,d.jsxs)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[(0,d.jsx)("button",{style:ws(e.primary,e.bg),children:"Primary"}),(0,d.jsx)("button",{style:ws(e.secondary,e.bg),children:"Secondary"}),(0,d.jsx)("button",{style:ws(e.success,e.bg),children:"Success"}),(0,d.jsx)("button",{style:ws(e.warning,e.bg),children:"Warning"}),(0,d.jsx)("button",{style:ws(e.danger,e.bg),children:"Danger"}),(0,d.jsx)("button",{style:ws(e.info,e.bg),children:"Info"})]}),(0,d.jsxs)("div",{style:{padding:16,background:e.surface,border:`1px solid ${e.border}`,borderRadius:12},children:[(0,d.jsx)("h3",{style:{margin:"0 0 6px",fontSize:16,fontWeight:700,color:e.text},children:"Card surface"}),(0,d.jsxs)("p",{style:{margin:0,color:e.textMuted,fontSize:13},children:["Cards use the ",(0,d.jsx)("code",{children:"surface"})," token with ",(0,d.jsx)("code",{children:"border"})," as outline."]})]}),(0,d.jsxs)("div",{style:{padding:16,background:e.surfaceAlt,border:`1px solid ${e.border}`,borderRadius:12},children:[(0,d.jsx)("h3",{style:{margin:"0 0 6px",fontSize:16,fontWeight:700,color:e.text},children:"Alt surface"}),(0,d.jsx)("p",{style:{margin:0,color:e.textMuted,fontSize:13},children:"Used for nested panels (e.g. modal headers, kanban cards)."})]}),(0,d.jsx)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:["primary","secondary","success","warning","danger","info"].map(t=>(0,d.jsx)("span",{style:ks(e[t]),children:t},t))}),(0,d.jsx)("input",{type:"text",placeholder:"Sample input",style:{background:e.surface,border:`1px solid ${e.border}`,color:e.text,padding:"10px 14px",borderRadius:8,fontSize:14,outline:"none",minHeight:44}}),(0,d.jsx)("p",{style:{color:e.text,fontSize:14,margin:0},children:"Body text on page background — must be 7:1 for AAA."}),(0,d.jsx)("p",{style:{color:e.textMuted,fontSize:13,margin:0},children:"Muted text — must be at least 4.5:1."})]})}var bs=(e,t)=>({flex:1,background:t?e.primary:"transparent",color:t?e.bg:e.text,border:`1px solid ${t?e.primary:e.border}`,padding:"6px 10px",borderRadius:6,fontSize:11,fontWeight:700,cursor:"pointer",letterSpacing:"0.05em"}),ys=e=>({flex:1,background:e.primary,color:e.bg,border:"none",padding:"8px 14px",borderRadius:6,fontSize:12,fontWeight:700,cursor:"pointer",minHeight:36}),vs=(e,t)=>({flex:1,background:"transparent",color:e.textMuted,border:`1px solid ${e.border}`,padding:"8px 14px",borderRadius:6,fontSize:12,fontWeight:600,cursor:t?"not-allowed":"pointer",opacity:t?.5:1,minHeight:36}),ws=(e,t)=>({background:e,color:t,padding:"8px 14px",border:"none",borderRadius:6,fontWeight:700,fontSize:12,cursor:"pointer",minHeight:36}),ks=e=>({padding:"4px 10px",background:`${e}22`,color:e,fontSize:11,fontWeight:700,letterSpacing:"0.05em",textTransform:"uppercase",borderRadius:999,border:`1px solid ${e}55`}),$s=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Ss=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function Cs(e){return e.toISOString().slice(0,10)}function zs(e){return Date,new Date(e)}function Ms(e,t){const n=new Date(e);return n.setUTCHours(0,0,0,0),n.setUTCDate(n.getUTCDate()+t),n}var Ns={critical:"#f72585",serious:"#ff8500",moderate:"#ffbe0b",minor:"#3a86ff"};function Ds(e,t,n){const r=16,o={};return"bottom-right"===n&&Object.assign(o,{bottom:r,right:r}),"bottom-left"===n&&Object.assign(o,{bottom:r,left:r}),"top-right"===n&&Object.assign(o,{top:r,right:r}),"top-left"===n&&Object.assign(o,{top:r,left:r}),{position:"fixed",zIndex:99999,width:56,height:56,borderRadius:"50%",background:e.surface,border:`2px solid ${t}`,boxShadow:`0 0 24px ${t}55, 0 4px 12px rgba(0,0,0,0.3)`,color:t,cursor:"pointer",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:0,fontFamily:"inherit",transition:"transform 120ms",...o}}function Rs(e,t){const n={};return"bottom-right"===t&&Object.assign(n,{bottom:84,right:16}),"bottom-left"===t&&Object.assign(n,{bottom:84,left:16}),"top-right"===t&&Object.assign(n,{top:84,right:16}),"top-left"===t&&Object.assign(n,{top:84,left:16}),{position:"fixed",zIndex:99998,width:360,maxWidth:"calc(100vw - 32px)",background:e.surface,border:`1px solid ${e.border}`,borderRadius:12,boxShadow:"0 16px 40px rgba(0,0,0,0.4)",overflow:"hidden",color:e.text,...n}}function Ps(e,t,n,r){const o=!!e.children&&e.children.length>0,i=n.has(e.id);if(!o||i)return{node:e,depth:t,y:r+.5,span:1,children:[],hasChildren:o,collapsed:i};let a=r;const l=[];for(const u of e.children){const e=Ps(u,t+1,n,a);l.push(e),a+=e.span}const s=a-r,d=l[0],c=l[l.length-1];return{node:e,depth:t,y:(d.y+c.y)/2,span:s,children:l,hasChildren:o,collapsed:i}}function Fs(e,t,n,r=[],o=null){r.push({laid:e,x:e.depth*t,y:e.y*n,parentId:o});for(const i of e.children)Fs(i,t,n,r,e.node.id);return r}function Is(e){const t=e.width??160,n=e.height??60;return{out:[e.x+t,e.y+n/2],in:[e.x,e.y+n/2]}}function As(e,t){const n=Is(e).out,r=Is(t).in,o=Math.max(40,Math.abs(r[0]-n[0])/2),i=[n[0]+o,n[1]],a=[r[0]-o,r[1]];return`M ${n[0]} ${n[1]} C ${i[0]} ${i[1]}, ${a[0]} ${a[1]}, ${r[0]} ${r[1]}`}var Ls={x:0,y:0,scale:1},Ts=(0,a.forwardRef)(function({data:e,onChange:t,selectedId:n,onSelect:r,initialViewport:o,draggable:i=!0,pannable:l=!0,zoomable:s=!0,minZoom:c=.25,maxZoom:u=3,height:p=480,showGrid:h=!0,showControls:f=!0,renderNode:m,className:g,style:x},b){const[y,v]=(0,a.useState)(o??Ls),[w,k]=(0,a.useState)(null),$=void 0!==n?n:w,[S,C]=(0,a.useState)(null),[z,M]=(0,a.useState)(null),[N,D]=(0,a.useState)(null),[R,P]=(0,a.useState)(!1),F=(0,a.useRef)(null),I=(0,a.useId)(),A=(0,a.useCallback)(e=>{void 0===n&&k(e),r?.(e)},[n,r]),L=(0,a.useRef)(null),T=(0,a.useRef)(new Map),W=(0,a.useRef)(null),j=(0,a.useRef)(new Set),[E,B]=(0,a.useState)(null),V=n=>{const r=L.current;if(!r||"node"!==r.kind||r.pointerId!==n.pointerId)return;const o=(n.clientX-r.startX)/y.scale,i=(n.clientY-r.startY)/y.scale,a=r.nodeStartX+o,l=r.nodeStartY+i;t({...e,nodes:e.nodes.map(e=>e.id===r.id?{...e,x:a,y:l}:e)})},H=e=>{const t=L.current;t&&"node"===t.kind&&t.pointerId===e.pointerId&&(j.current.delete(t.id),L.current=null)},O=(0,a.useCallback)((e,t)=>{const n=F.current?.getBoundingClientRect();return n?[(e-n.left-y.x)/y.scale,(t-n.top-y.y)/y.scale]:[0,0]},[y.x,y.y,y.scale]),q=e=>{const t=L.current;if(!t||"edge"!==t.kind||t.pointerId!==e.pointerId)return;const[n,r]=O(e.clientX,e.clientY);B({fromNodeId:t.fromNodeId,gx:n,gy:r})},U=n=>{const r=L.current;if(!r||"edge"!==r.kind||r.pointerId!==n.pointerId)return;let o;n.stopPropagation();try{o=((document.elementFromPoint?.(n.clientX,n.clientY))?.closest("[data-tkx-node-id]"))?.dataset.tkxNodeId}catch{}if(o&&o!==r.fromNodeId&&!e.edges.some(e=>e.from===r.fromNodeId&&e.to===o)){const n={id:`e-${r.fromNodeId}-${o}-${Date.now().toString(36)}`,from:r.fromNodeId,to:o};t({...e,edges:[...e.edges,n]})}L.current=null,B(null)},K=e=>{T.current.delete(e.pointerId),T.current.size<2&&(W.current=null);const t=L.current;t&&"pan"===t.kind&&t.pointerId===e.pointerId&&(L.current=null)};function Y(e,t,n){return Math.max(t,Math.min(n,e))}const X=(0,a.useCallback)((e,t,n)=>{v(r=>{const o=Y(e,c,u),i=(t-r.x)/r.scale,a=(n-r.y)/r.scale;return{x:t-i*o,y:n-a*o,scale:o}})},[c,u]),Z=(0,a.useCallback)(()=>{const t=F.current?.getBoundingClientRect();if(!t||0===e.nodes.length)return void v(Ls);let n=1/0,r=1/0,o=-1/0,i=-1/0;for(const c of e.nodes){const e=c.width??160,t=c.height??60;c.x<n&&(n=c.x),c.y<r&&(r=c.y),c.x+e>o&&(o=c.x+e),c.y+t>i&&(i=c.y+t)}const a=o-n+80,l=i-r+80,s=t.width/a,d=t.height/l,p=Y(Math.min(s,d),c,u);v({x:-n*p+(t.width-(o-n)*p)/2,y:-r*p+(t.height-(i-r)*p)/2,scale:p})},[e.nodes,c,u]),G=`translate3d(${y.x}px, ${y.y}px, 0) scale(${y.scale})`,_=(0,a.useMemo)(()=>new Map(e.nodes.map(e=>[e.id,e])),[e.nodes]);return(0,d.jsxs)("div",{ref:e=>{F.current=e,"function"==typeof b?b(e):b&&(b.current=e)},className:g,role:"application","aria-label":"Flow chart editor",tabIndex:0,onKeyDown:n=>{if(z&&("Delete"===n.key||"Backspace"===n.key))return n.preventDefault(),t({...e,edges:e.edges.filter(e=>e.id!==z)}),void M(null);if(!$)return void("Tab"===n.key&&e.nodes.length>0&&(n.preventDefault(),A(e.nodes[0].id)));const r=e.nodes.findIndex(e=>e.id===$);switch(n.key){case"Tab":{n.preventDefault();const t=(r+(n.shiftKey?-1:1)+e.nodes.length)%e.nodes.length;A(e.nodes[t].id);break}case"Delete":case"Backspace":n.preventDefault(),t({nodes:e.nodes.filter(e=>e.id!==$),edges:e.edges.filter(e=>e.from!==$&&e.to!==$)}),A(null);break;case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"ArrowDown":{n.preventDefault();const r=n.shiftKey?10:1,o="ArrowRight"===n.key?r:"ArrowLeft"===n.key?-r:0,i="ArrowDown"===n.key?r:"ArrowUp"===n.key?-r:0;t({...e,nodes:e.nodes.map(e=>e.id===$?{...e,x:e.x+o,y:e.y+i}:e)});break}}},onPointerDown:e=>{if(T.current.set(e.pointerId,{x:e.clientX,y:e.clientY}),s&&2===T.current.size){const[e,t]=Array.from(T.current.values());return void(W.current={startDist:Math.hypot(t.x-e.x,t.y-e.y),startScale:y.scale,centerX:(e.x+t.x)/2,centerY:(e.y+t.y)/2})}if(e.target===e.currentTarget&&l){A(null);try{e.currentTarget.setPointerCapture?.(e.pointerId)}catch{}L.current={kind:"pan",pointerId:e.pointerId,startX:e.clientX,startY:e.clientY,vpStartX:y.x,vpStartY:y.y}}},onPointerMove:e=>{T.current.has(e.pointerId)&&T.current.set(e.pointerId,{x:e.clientX,y:e.clientY});const t=W.current;if(t&&2===T.current.size){const[e,n]=Array.from(T.current.values()),r=Math.hypot(n.x-e.x,n.y-e.y)/t.startDist,o=Y(t.startScale*r,c,u),i=F.current?.getBoundingClientRect();return void(i&&X(o,t.centerX-i.left,t.centerY-i.top))}const n=L.current;n&&"pan"===n.kind&&n.pointerId===e.pointerId&&v({x:n.vpStartX+(e.clientX-n.startX),y:n.vpStartY+(e.clientY-n.startY),scale:y.scale})},onPointerUp:K,onPointerCancel:K,onWheel:e=>{if(!s)return;e.preventDefault();const t=F.current?.getBoundingClientRect();if(!t)return;const n=Math.exp(.0015*-e.deltaY);X(y.scale*n,e.clientX-t.left,e.clientY-t.top)},"data-testid":"tkx-flowchart",style:{position:"relative",width:"100%",height:p,overflow:"hidden",background:"var(--tkx-bg, #0a0a0f)",color:"var(--tkx-fg, #e8e8f4)",border:"1px solid var(--tkx-border, #2a2a3e)",borderRadius:12,touchAction:s||l?"none":"auto",outline:"none",...x},children:[h&&(0,d.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",inset:0,backgroundImage:"linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px)",backgroundSize:`${24*y.scale}px ${24*y.scale}px`,backgroundPosition:`${y.x}px ${y.y}px`,pointerEvents:"none"}}),(0,d.jsx)("svg",{"aria-hidden":"true",width:"100%",height:"100%",style:{position:"absolute",inset:0,pointerEvents:"none",overflow:"visible"},children:(0,d.jsxs)("g",{style:{transform:G,transformOrigin:"0 0"},children:[(0,d.jsx)("defs",{children:(0,d.jsx)("marker",{id:`tkx-flow-arrow-${I}`,markerWidth:"6",markerHeight:"6",refX:"5",refY:"3",orient:"auto",children:(0,d.jsx)("path",{d:"M0,0 L6,3 L0,6 z",fill:"currentColor"})})}),E&&(()=>{const e=_.get(E.fromNodeId);if(!e)return null;const t=Is(e).out,n=[E.gx,E.gy],r=Math.max(40,Math.abs(n[0]-t[0])/2);return(0,d.jsx)("path",{"data-testid":"flow-edge-draft",d:`M ${t[0]} ${t[1]} C ${t[0]+r} ${t[1]}, ${n[0]-r} ${n[1]}, ${n[0]} ${n[1]}`,stroke:"var(--tkx-accent, #00f5d4)",strokeWidth:1.6/y.scale,strokeDasharray:`${4/y.scale} ${4/y.scale}`,fill:"none",strokeOpacity:.85})})(),e.edges.map(e=>{const t=_.get(e.from),n=_.get(e.to);if(!t||!n)return null;const r=e.color??t.color??"var(--tkx-accent, #00f5d4)",o=e.id===z;return(0,d.jsxs)("g",{"data-testid":`flow-edge-${e.id}`,style:{color:r,pointerEvents:"auto",cursor:"pointer"},children:[(0,d.jsx)("path",{d:As(t,n),stroke:"transparent",strokeWidth:12/y.scale,fill:"none",onClick:t=>{t.stopPropagation(),M(e.id),A(null)}}),(0,d.jsx)("path",{d:As(t,n),stroke:r,strokeWidth:(o?2.5:1.5)/y.scale,fill:"none",markerEnd:`url(#tkx-flow-arrow-${I})`,strokeOpacity:o?1:.8,style:{filter:o?`drop-shadow(0 0 4px ${r})`:"none",pointerEvents:"none"}}),e.label&&(0,d.jsx)("text",{x:(Is(t).out[0]+Is(n).in[0])/2,y:(Is(t).out[1]+Is(n).in[1])/2-6,textAnchor:"middle",fill:r,fontSize:11/y.scale,fontFamily:"ui-monospace, monospace",children:e.label})]},e.id)})]})}),(0,d.jsx)("div",{style:{position:"absolute",inset:0,transform:G,transformOrigin:"0 0",pointerEvents:"none"},children:e.nodes.map(n=>{const r=n.id===$,o=n.width??160,a=n.height??60,l=n.color??"var(--tkx-accent, #00f5d4)";return(0,d.jsxs)("div",{role:"button","aria-pressed":r,tabIndex:-1,"data-testid":`flow-node-${n.id}`,"data-tkx-node-id":n.id,onPointerDown:e=>((e,t)=>{if(i){e.stopPropagation(),A(t.id),j.current.add(t.id);try{e.currentTarget.setPointerCapture?.(e.pointerId)}catch{}L.current={kind:"node",id:t.id,pointerId:e.pointerId,startX:e.clientX,startY:e.clientY,nodeStartX:t.x,nodeStartY:t.y}}})(e,n),onPointerMove:V,onPointerUp:H,onPointerCancel:H,onDoubleClick:e=>{e.stopPropagation(),m||(A(n.id),C(n.id))},onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),A(n.id),D({x:e.clientX,y:e.clientY,nodeId:n.id})},style:{position:"absolute",left:n.x,top:n.y,width:o,height:a,pointerEvents:"auto",borderRadius:8,background:r?`${l}1f`:"rgba(18, 20, 38, 0.9)",border:`2px solid ${r?l:"rgba(255,255,255,0.12)"}`,boxShadow:r?`0 0 0 3px ${l}33`:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:"6px 10px",fontSize:13,fontWeight:600,color:"var(--tkx-fg, #e8e8f4)",textAlign:"center",cursor:"grab",userSelect:"none",touchAction:"none"},children:[S===n.id?(0,d.jsx)("input",{autoFocus:!0,"data-testid":`flow-node-rename-${n.id}`,defaultValue:n.label,onPointerDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),onBlur:r=>{const o=r.currentTarget.value.trim();o&&o!==n.label&&t({...e,nodes:e.nodes.map(e=>e.id===n.id?{...e,label:o}:e)}),C(null)},onKeyDown:e=>{"Enter"===e.key?e.currentTarget.blur():"Escape"===e.key&&(e.currentTarget.value=n.label,C(null)),e.stopPropagation()},style:{width:"100%",padding:"4px 6px",borderRadius:4,border:`1px solid ${l}`,background:"rgba(8,10,25,0.95)",color:"#fff",textAlign:"center",fontSize:"inherit",fontWeight:"inherit",fontFamily:"inherit",outline:"none"}}):m?m(n,r):n.label,(0,d.jsx)("span",{"aria-hidden":"true",style:{position:"absolute",left:-6,top:"50%",width:10,height:10,transform:"translateY(-50%)",borderRadius:"50%",background:l,boxShadow:`0 0 8px ${l}88`,pointerEvents:"none"}}),(0,d.jsx)("button",{type:"button","aria-label":`Connect from ${n.label} — drag to another node`,title:"Drag to connect to another node","data-testid":`flow-port-${n.id}`,onPointerDown:r=>((n,r)=>{n.stopPropagation(),n.preventDefault();const o=n.pointerId,[i,a]=O(n.clientX,n.clientY);L.current={kind:"edge",pointerId:o,fromNodeId:r},B({fromNodeId:r,gx:i,gy:a});const l=e=>{const t=L.current;if(!t||"edge"!==t.kind||t.pointerId!==e.pointerId)return;const[n,r]=O(e.clientX,e.clientY);B({fromNodeId:t.fromNodeId,gx:n,gy:r})},s=n=>{const r=L.current;if(!r||"edge"!==r.kind||r.pointerId!==n.pointerId)return;let o;try{o=((document.elementFromPoint?.(n.clientX,n.clientY))?.closest("[data-tkx-node-id]"))?.dataset.tkxNodeId}catch{}if(o&&o!==r.fromNodeId&&!e.edges.some(e=>e.from===r.fromNodeId&&e.to===o)){const n={id:`e-${r.fromNodeId}-${o}-${Date.now().toString(36)}`,from:r.fromNodeId,to:o};t({...e,edges:[...e.edges,n]})}L.current=null,B(null),window.removeEventListener("pointermove",l),window.removeEventListener("pointerup",s),window.removeEventListener("pointercancel",s)};window.addEventListener("pointermove",l),window.addEventListener("pointerup",s),window.addEventListener("pointercancel",s)})(r,n.id),onPointerMove:q,onPointerUp:U,onPointerCancel:U,onMouseEnter:e=>{e.currentTarget.style.transform="translateY(-50%) scale(1.25)",e.currentTarget.style.boxShadow=`0 0 18px ${l}, 0 0 6px ${l}`},onMouseLeave:e=>{e.currentTarget.style.transform="translateY(-50%) scale(1)",e.currentTarget.style.boxShadow=`0 0 12px ${l}aa`},style:{position:"absolute",right:-11,top:"50%",width:22,height:22,transform:"translateY(-50%)",borderRadius:"50%",background:l,boxShadow:`0 0 12px ${l}aa`,border:"2px solid rgba(8,10,25,0.95)",cursor:"crosshair",padding:0,touchAction:"none",color:"#0a0a0f",fontSize:12,fontWeight:900,fontFamily:"inherit",display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:1,transition:"transform 0.15s, box-shadow 0.15s",zIndex:2},children:(0,d.jsx)("span",{"aria-hidden":"true",children:"+"})})]},n.id)})}),f&&(0,d.jsxs)("div",{role:"toolbar","aria-label":"Flow chart controls",style:{position:"absolute",right:12,bottom:12,display:"flex",gap:4,padding:4,borderRadius:999,background:"rgba(8, 10, 25, 0.7)",border:"1px solid rgba(255,255,255,0.12)",backdropFilter:"blur(6px)"},children:[(0,d.jsx)(Vs,{label:"Zoom out",onClick:()=>{const e=F.current?.getBoundingClientRect();e&&X(.8*y.scale,e.width/2,e.height/2)},testId:"flow-zoom-out",children:"−"}),(0,d.jsx)(Vs,{label:"Reset zoom",onClick:Z,testId:"flow-fit",children:"⤢"}),(0,d.jsx)(Vs,{label:"Zoom in",onClick:()=>{const e=F.current?.getBoundingClientRect();e&&X(1.25*y.scale,e.width/2,e.height/2)},testId:"flow-zoom-in",children:"+"}),(0,d.jsxs)("span",{"data-testid":"flow-zoom-readout",style:{display:"inline-flex",alignItems:"center",padding:"0 10px",color:"#aaa",fontSize:11,fontFamily:"ui-monospace, monospace",fontVariantNumeric:"tabular-nums"},children:[Math.round(100*y.scale),"%"]}),(0,d.jsx)(Vs,{label:"Toggle inspector",onClick:()=>P(e=>!e),testId:"flow-toggle-inspector",children:"☰"})]}),N&&(0,d.jsx)(Bs,{x:N.x,y:N.y,containerEl:F.current,onClose:()=>D(null),actions:[{id:"rename",label:"Rename",icon:"✏️",run:()=>{C(N.nodeId)}},{id:"duplicate",label:"Duplicate",icon:"⎘",run:()=>{const n=e.nodes.find(e=>e.id===N.nodeId);if(!n)return;const r=`${n.id}-copy-${Date.now().toString(36)}`;t({...e,nodes:[...e.nodes,{...n,id:r,x:n.x+20,y:n.y+20}]}),A(r)}},{id:"bring-to-front",label:"Bring to front",icon:"⬆",run:()=>{const n=e.nodes.findIndex(e=>e.id===N.nodeId);if(n<0)return;const r=[...e.nodes.slice(0,n),...e.nodes.slice(n+1),e.nodes[n]];t({...e,nodes:r})}},{id:"delete",label:"Delete",icon:"🗑",danger:!0,run:()=>{t({nodes:e.nodes.filter(e=>e.id!==N.nodeId),edges:e.edges.filter(e=>e.from!==N.nodeId&&e.to!==N.nodeId)}),$===N.nodeId&&A(null)}}]}),R&&$&&(()=>{const n=e.nodes.find(e=>e.id===$);if(!n)return null;const r=n.color??"#00f5d4",o=n.width??160,i=n.height??60,a=n=>{t({...e,nodes:e.nodes.map(e=>e.id===$?{...e,...n}:e)})};return(0,d.jsxs)("div",{role:"region","aria-label":"Node properties","data-testid":"flow-inspector",style:{position:"absolute",top:12,right:12,width:220,padding:12,borderRadius:10,background:"rgba(8, 10, 25, 0.92)",border:"1px solid rgba(196,168,255,0.3)",color:"#dcdce8",fontSize:12,backdropFilter:"blur(8px)",boxShadow:"0 12px 32px rgba(0,0,0,0.45)",zIndex:5},children:[(0,d.jsx)("div",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.08em",textTransform:"uppercase",color:"#888",marginBottom:8},children:"Properties"}),(0,d.jsx)(Ws,{label:"Label",children:(0,d.jsx)("input",{"data-testid":"inspector-label",value:n.label,onChange:e=>a({label:e.target.value}),style:js})}),(0,d.jsx)(Ws,{label:"Color",children:(0,d.jsx)("input",{type:"color","data-testid":"inspector-color",value:Es(r),onChange:e=>a({color:e.target.value}),style:{...js,padding:0,height:32}})}),(0,d.jsx)(Ws,{label:`Width (${o}px)`,children:(0,d.jsx)("input",{type:"range",min:80,max:320,value:o,onChange:e=>a({width:+e.target.value}),style:{width:"100%"}})}),(0,d.jsx)(Ws,{label:`Height (${i}px)`,children:(0,d.jsx)("input",{type:"range",min:40,max:200,value:i,onChange:e=>a({height:+e.target.value}),style:{width:"100%"}})})]})})()]})});function Ws({label:e,children:t}){return(0,d.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:4,marginBottom:8,fontSize:11,color:"#aaa"},children:[e,t]})}var js={padding:"6px 8px",minHeight:30,borderRadius:5,border:"1px solid rgba(255,255,255,0.12)",background:"rgba(13, 13, 20, 0.6)",color:"#e8e8f4",fontSize:12,fontFamily:"inherit",width:"100%"};function Es(e){if(e.startsWith("#"))return 7===e.length?e:"#00f5d4";if(e.startsWith("rgb")){const t=e.match(/\d+/g);return!t||t.length<3?"#00f5d4":"#"+t.slice(0,3).map(e=>Number(e).toString(16).padStart(2,"0")).join("")}return"#00f5d4"}function Bs({x:e,y:t,containerEl:n,actions:r,onClose:o}){a.useEffect(()=>{const e=e=>{e.target.closest?.("[data-tkx-context-menu]")||o()},t=e=>{"Escape"===e.key&&o()};return window.addEventListener("mousedown",e),window.addEventListener("keydown",t),()=>{window.removeEventListener("mousedown",e),window.removeEventListener("keydown",t)}},[o]);const i=n?.getBoundingClientRect(),l=i?e-i.left:e,s=i?t-i.top:t;return(0,d.jsx)("div",{role:"menu","aria-label":"Node actions","data-testid":"flow-context-menu","data-tkx-context-menu":"",style:{position:"absolute",left:Math.max(4,Math.min(l,(i?.width??600)-180)),top:Math.max(4,Math.min(s,(i?.height??400)-200)),minWidth:180,padding:4,borderRadius:8,background:"rgba(8, 10, 25, 0.96)",border:"1px solid rgba(196,168,255,0.3)",color:"#dcdce8",backdropFilter:"blur(8px)",boxShadow:"0 12px 32px rgba(0,0,0,0.55)",zIndex:10},children:r.map(e=>(0,d.jsxs)("button",{type:"button",role:"menuitem","data-testid":`flow-menu-${e.id}`,onClick:()=>{e.run(),o()},style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"8px 12px",minHeight:36,border:"none",background:"transparent",color:e.danger?"#ff7eaf":"#dcdce8",cursor:"pointer",fontSize:13,fontWeight:500,fontFamily:"inherit",textAlign:"left",borderRadius:5},onMouseEnter:e=>e.currentTarget.style.background="rgba(196,168,255,0.12)",onMouseLeave:e=>e.currentTarget.style.background="transparent",children:[(0,d.jsx)("span",{"aria-hidden":"true",children:e.icon}),(0,d.jsx)("span",{children:e.label})]},e.id))})}function Vs({children:e,label:t,onClick:n,testId:r}){return(0,d.jsx)("button",{type:"button","aria-label":t,onClick:n,"data-testid":r,style:{width:44,height:44,minWidth:44,minHeight:44,borderRadius:999,border:"none",background:"transparent",color:"#dcdce8",cursor:"pointer",fontSize:18,fontFamily:"inherit",display:"inline-flex",alignItems:"center",justifyContent:"center"},children:e})}var Hs="undefined"!=typeof navigator&&/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform||"");function Os(e,t){if(!e)return 0;const n=e.toLowerCase(),r=t.toLowerCase();let o=0,i=0,a=-2,l=0;for(let s=0;s<r.length&&o<n.length;s++){if(r[s]!==n[o]){l=0;continue}let e=1;0===s?e+=8:/[\s_\-./]/.test(r[s-1])&&(e+=6),s===a+1?(l+=1,e+=2*l):l=1,i+=e,a=s,o+=1}return o<n.length?null:i-.05*r.length}var qs={ctrl:!0,key:"k"};function Us(e){return{display:"flex",alignItems:"center",gap:12,padding:"10px 12px",minHeight:44,borderRadius:8,cursor:"pointer",background:e?"rgba(123,142,255,0.16)":"transparent",outline:e?"1px solid rgba(123,142,255,0.4)":"none",color:"#e8e8f4",transition:"background 80ms"}}function Ks(e){return{fontSize:10,fontWeight:700,padding:"2px 6px",minWidth:18,borderRadius:4,textAlign:"center",border:"1px solid "+(e?"rgba(123,142,255,0.45)":"rgba(255,255,255,0.12)"),background:e?"rgba(123,142,255,0.14)":"rgba(255,255,255,0.04)",color:e?"#c4a8ff":"#aaa",fontFamily:"ui-monospace, monospace"}}function Ys(e){return 0===e.length?"":e.map((e,t)=>`${0===t?"M":"L"}${e.x.toFixed(2)},${e.y.toFixed(2)}`).join(" ")}var Xs=(0,a.forwardRef)(({data:e,variant:t="line",width:n=120,height:r=32,color:o,showPoints:i=!1,showLastPoint:a=!0,showValue:l=!1,smooth:s=!1,ariaLabel:c,className:u,style:p,...h},f)=>{const m=J(),g=o??m.primary,x=!Array.isArray(e)||0===e.length,b=c??(x?"Sparkline showing no data":`Sparkline showing ${e.length} value${1===e.length?"":"s"}, trending ${function(e){if(e.length<2)return"flat";const t=e[0],n=e[e.length-1];return n>t?"up":n<t?"down":"flat"}(e)}`);if(x)return(0,d.jsx)("span",{ref:f,role:"img","aria-label":b,className:xt(mt("inline-flex items-center"),u),style:p,...h,children:(0,d.jsx)("svg",{width:n,height:r,viewBox:`0 0 ${n} ${r}`,"aria-hidden":"true","data-tkx-sparkline-empty":""})});const y=function(e,t,n){if(0===e.length)return[];const r=Math.min(...e),o=Math.max(...e)-r||1,i=Math.max(0,t-4),a=Math.max(0,n-4);return 1===e.length?[{x:2+i/2,y:2+a/2}]:e.map((t,n)=>({x:2+n/(e.length-1)*i,y:2+a-(t-r)/o*a}))}(e,n,r),v=y[y.length-1],w=e[e.length-1];let k=null;if("bar"===t){const t=Math.max(0,n-4)/e.length,o=Math.max(1,.7*t),i=Math.min(...e),a=Math.max(...e)-i||1,l=Math.max(0,r-4);k=(0,d.jsx)("g",{"data-tkx-sparkline-variant":"bar",children:e.map((e,n)=>{const r=(e-i)/a*l,s=2+t*n+(t-o)/2,c=2+l-r;return(0,d.jsx)("rect",{x:s.toFixed(2),y:c.toFixed(2),width:o.toFixed(2),height:Math.max(1,r).toFixed(2),fill:g,rx:1},n)})})}else{const e=s?function(e){if(e.length<2)return Ys(e);const t=[`M${e[0].x.toFixed(2)},${e[0].y.toFixed(2)}`];for(let n=0;n<e.length-1;n++){const r=e[n-1]??e[n],o=e[n],i=e[n+1],a=e[n+2]??i,l=o.x+(i.x-r.x)/6,s=o.y+(i.y-r.y)/6,d=i.x-(a.x-o.x)/6,c=i.y-(a.y-o.y)/6;t.push(`C${l.toFixed(2)},${s.toFixed(2)} ${d.toFixed(2)},${c.toFixed(2)} ${i.x.toFixed(2)},${i.y.toFixed(2)}`)}return t.join(" ")}(y):Ys(y),n=(()=>{if("area"!==t||0===y.length)return"";const n=(r-2).toFixed(2);return`${e} L${y[y.length-1].x.toFixed(2)},${n} L${y[0].x.toFixed(2)},${n} Z`})();k=(0,d.jsxs)("g",{"data-tkx-sparkline-variant":t,children:["area"===t&&(0,d.jsx)("path",{d:n,fill:g,fillOpacity:.18,stroke:"none"}),(0,d.jsx)("path",{d:e,fill:"none",stroke:g,strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),i&&y.map((e,t)=>(0,d.jsx)("circle",{cx:e.x.toFixed(2),cy:e.y.toFixed(2),r:1.75,fill:g,"data-tkx-sparkline-point":""},t)),a&&!i&&v&&(0,d.jsx)("circle",{cx:v.x.toFixed(2),cy:v.y.toFixed(2),r:2.25,fill:g,"data-tkx-sparkline-last":""})]})}return(0,d.jsxs)("span",{ref:f,role:"img","aria-label":b,className:xt(mt("inline-flex items-center gap-2"),u),style:p,...h,children:[(0,d.jsx)("svg",{width:n,height:r,viewBox:`0 0 ${n} ${r}`,"aria-hidden":"true",style:{display:"block",overflow:"visible"},children:k}),l&&(0,d.jsx)("span",{className:mt("text-xs"),style:{color:m.textMuted,fontVariantNumeric:"tabular-nums"},"data-tkx-sparkline-value":"",children:String(w)})]})});Xs.displayName="TkxSparkline";var Zs={arc:{start:-135,end:135,sweep:270},speedometer:{start:-90,end:90,sweep:180}};function Gs(e,t,n,r){const o=(r-90)*Math.PI/180;return{x:e+n*Math.cos(o),y:t+n*Math.sin(o)}}function _s(e,t,n,r,o){if(Math.abs(o-r)<1e-4)return"";const i=Gs(e,t,n,r),a=Gs(e,t,n,o),l=o-r,s=Math.abs(l)>180?1:0,d=l>=0?1:0;return`M${i.x.toFixed(2)},${i.y.toFixed(2)} A${n.toFixed(2)},${n.toFixed(2)} 0 ${s} ${d} ${a.x.toFixed(2)},${a.y.toFixed(2)}`}function Js(e,t,n){if(!t||0===t.length)return n;const r=[...t].sort((e,t)=>e.at-t.at);let o=r[0].color;for(const i of r)e>=i.at&&(o=i.color);return o}var Qs=(0,a.forwardRef)(({value:e,min:t=0,max:n=100,size:r=200,thickness:o=16,variant:i="arc",thresholds:l,label:s,showValue:c=!0,showTicks:u=!1,formatValue:p,ariaLabel:h,className:f,style:m,...g},x)=>{const b=J(),y=Te(),v=Math.min(t,n),w=Math.max(t,n),k=(C=w,($=e)<(S=v)?S:$>C?C:$);var $,S,C;const z=w-v||1,M=(k-v)/z,{start:N,end:D,sweep:R}=Zs[i],P=N+R*M,F=r/2,I=r/2,A=(r-o)/2,[L,T]=(0,a.useState)(M),W=(0,a.useRef)(null),j=(0,a.useRef)(M),E=(0,a.useRef)(M),B=(0,a.useRef)(0);(0,a.useEffect)(()=>{if(y)return void T(M);j.current=L,E.current=M,B.current="undefined"!=typeof performance?performance.now():Date.now();const e=t=>{const n=Math.min(1,(t-B.current)/400),r=1-Math.pow(1-n,3);T(j.current+(E.current-j.current)*r),n<1&&(W.current=requestAnimationFrame(e))};return"undefined"!=typeof requestAnimationFrame?W.current=requestAnimationFrame(e):T(M),()=>{null!=W.current&&"undefined"!=typeof cancelAnimationFrame&&cancelAnimationFrame(W.current)}},[M,y]);const V=N+R*L,H=_s(F,I,A,N,D),O=[];if(l&&l.length>0){const e=[...l].sort((e,t)=>e.at-t.at),t=[v];for(const n of e)n.at>v&&n.at<w&&t.push(n.at);t.push(w);for(let n=0;n<t.length-1;n++){const e=t[n],r=N+R*((e-v)/z),o=N+R*((t[n+1]-v)/z),i=Math.min(o,V);if(i<=r)continue;const a=Js(e+1e-4,l,b.primary);O.push({d:_s(F,I,A,r,i),color:a})}}else O.push({d:_s(F,I,A,N,V),color:b.primary});const q=Js(k,l,b.primary),U=[];if(u){const e=5,t=A+o/2+1,n=A+o/2-4,r=A+o/2-2,i=10*e;for(let o=0;o<=i;o++){const a=o%e===0,l=N+R*o/i,s=Gs(F,I,t,l),c=Gs(F,I,a?n:r,l);U.push((0,d.jsx)("line",{x1:s.x.toFixed(2),y1:s.y.toFixed(2),x2:c.x.toFixed(2),y2:c.y.toFixed(2),stroke:b.textMuted,strokeWidth:a?1.5:.75,strokeLinecap:"round","data-tkx-gauge-tick":a?"major":"minor"},o))}}const K=p?p(k):String(k);return(0,d.jsxs)("div",{ref:x,role:"meter","aria-valuenow":k,"aria-valuemin":v,"aria-valuemax":w,"aria-valuetext":K,"aria-label":h??s??"Gauge",className:xt(mt("inline-flex flex-col items-center"),f),style:m,"data-tkx-gauge-variant":i,"data-tkx-reduced-motion":y?"true":"false",...g,children:[(0,d.jsxs)("svg",{width:r,height:r,viewBox:`0 0 ${r} ${r}`,"aria-hidden":"true",style:{display:"block",overflow:"visible"},children:[(0,d.jsx)("path",{d:H,fill:"none",stroke:b.border,strokeWidth:o,strokeLinecap:"round","data-tkx-gauge-track":""}),O.map((e,t)=>(0,d.jsx)("path",{d:e.d,fill:"none",stroke:e.color,strokeWidth:o,strokeLinecap:"round","data-tkx-gauge-segment":""},t)),u&&(0,d.jsx)("g",{"data-tkx-gauge-ticks":"",children:U}),c&&(0,d.jsx)("text",{x:F,y:I+("speedometer"===i?4:6),textAnchor:"middle",dominantBaseline:"middle",fill:q,style:{fontSize:.18*r+"px",fontWeight:700,fontFamily:"inherit",fontVariantNumeric:"tabular-nums"},"data-tkx-gauge-value":"",children:K})]}),s&&(0,d.jsx)("span",{className:mt("text-sm"),style:{color:b.textMuted,marginTop:"-8px"},"data-tkx-gauge-label":"",children:s}),(0,d.jsx)("span",{hidden:!0,"data-tkx-gauge-target-angle":P.toFixed(2)})]})});function ed(e){const t=new Set,n=[];for(const r of e){const e=String(r);t.has(e)||(t.add(e),n.push(r))}return n.every(e=>"number"==typeof e||/^-?\d+(\.\d+)?$/.test(String(e)))?n.sort((e,t)=>Number(e)-Number(t)):n.sort((e,t)=>String(e).localeCompare(String(t)))}function td(e){const t=e.replace("#",""),n=3===t.length?t.split("").map(e=>e+e).join(""):t,r=parseInt(n.slice(0,2),16),o=parseInt(n.slice(2,4),16),i=parseInt(n.slice(4,6),16);return[isNaN(r)?0:r,isNaN(o)?0:o,isNaN(i)?0:i]}function nd(e,t,n){return e+(t-e)*n}function rd(e,t){if(0===e.length)return"#000000";if(1===e.length)return e[0];if(t<=0)return e[0];if(t>=1)return e[e.length-1];const n=t*(e.length-1),r=Math.floor(n),o=n-r;return function(e,t,n){const[r,o,i]=td(e),[a,l,s]=td(t);return function(e,t,n){const r=e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0");return`#${r(e)}${r(t)}${r(n)}`}(nd(r,a,n),nd(o,l,n),nd(i,s,n))}(e[r],e[r+1],o)}function od(e,t,n,r){const[o,i]=t,a=i-o,l=0===a?.5:Math.max(0,Math.min(1,(e-o)/a));return Array.isArray(n)?rd(n.length>0?n:[r],l):rd("diverging"===n?["#d7191c","#ffffff","#2c7bb6"]:["#f7fbff",r],l)}function id(e){return A(e)>.179?"#000000":"#ffffff"}Qs.displayName="TkxGauge";var ad=(0,a.forwardRef)(({data:e,xLabels:t,yLabels:n,cellSize:r=32,gap:o=2,colorScale:i="sequential",domain:a,showValues:l=!1,showLegend:s=!0,legendPosition:c="right",formatValue:u,emptyCellColor:p,ariaLabel:h,onCellClick:f,className:m,style:g,...x},b)=>{const y=J(),v=Array.isArray(e)?e:[],w=u??(e=>String(e)),k=p??y.surfaceAlt;if(!(0!==v.length||t&&0!==t.length||n&&0!==n.length))return(0,d.jsxs)("div",{ref:b,role:"img","aria-label":h??"Heatmap with no data",className:xt(mt("inline-flex items-center justify-center"),m),style:{color:y.textMuted,fontSize:12,padding:16,...g},"data-tkx-heatmap-empty":"",...x,children:[(0,d.jsx)("svg",{width:4*r,height:2*r,"aria-hidden":"true"}),(0,d.jsx)("span",{style:{marginLeft:8},children:"No data"})]});const $=t??ed(v.map(e=>e.x)),S=n??ed(v.map(e=>e.y)),C=v.map(e=>e.value),z=C.length>0?Math.min(...C):0,M=C.length>0?Math.max(...C):1,[N,D]=a??[z,M],R=[N,D],P=new Map;for(const d of v)P.set(`${String(d.x)}\0${String(d.y)}`,d);const F=S.reduce((e,t)=>Math.max(e,String(t).length),0),I=Math.max(24,7*F+8),A=$.reduce((e,t)=>Math.max(e,String(t).length),0),L=7*A>r+o,T=L?Math.min(80,5*A+12):18,W=$.length*r+Math.max(0,$.length-1)*o,j=S.length*r+Math.max(0,S.length-1)*o,E=10,B=s&&"right"===c,V=s&&"bottom"===c,H=I+W+(B?58:0)+4,O=j+T+(V?36:0)+4,q=I,U=w(R[0]),K=w(R[1]),Y=h??`Heatmap with ${$.length}×${S.length} cells, values from ${U} to ${K}`,X=[];for(let J=0;J<S.length;J++){const e=String(S[J]);for(let t=0;t<$.length;t++){const n=String($[t]),a=P.get(`${n}\0${e}`),s=q+t*(r+o),c=2+J*(r+o),u=a?od(a.value,R,i,y.primary):k,p=!!f&&!!a,h=a?`${n} × ${e}: ${a.label??w(a.value)}`:`${n} × ${e}: no data`,m=p?()=>f(a):void 0;X.push((0,d.jsxs)("g",{"data-tkx-heatmap-cell":"","data-x":n,"data-y":e,"data-empty":a?void 0:"",onClick:m,style:{cursor:p?"pointer":"default"},children:[(0,d.jsx)("rect",{x:s,y:c,width:r,height:r,fill:u,rx:2,ry:2,children:(0,d.jsx)("title",{children:h})}),l&&a&&(0,d.jsx)("text",{x:s+r/2,y:c+r/2,textAnchor:"middle",dominantBaseline:"central",fill:id(u),style:{fontSize:Math.max(9,Math.min(13,.35*r)),fontFamily:"inherit",fontVariantNumeric:"tabular-nums",pointerEvents:"none"},"data-tkx-heatmap-value":"",children:a.label??w(a.value)})]},`${t}-${J}`))}}const Z=S.map((e,t)=>(0,d.jsx)("text",{x:I-6,y:2+t*(r+o)+r/2,textAnchor:"end",dominantBaseline:"central",fill:y.textMuted,style:{fontSize:11,fontFamily:"inherit"},"data-tkx-heatmap-ylabel":"",children:String(e)},`y-${t}`)),G=2+j+12,_=$.map((e,t)=>{const n=q+t*(r+o)+r/2;return L?(0,d.jsx)("text",{x:n,y:G,textAnchor:"end",dominantBaseline:"hanging",fill:y.textMuted,transform:`rotate(-45 ${n} ${G})`,style:{fontSize:11,fontFamily:"inherit"},"data-tkx-heatmap-xlabel":"",children:String(e)},`x-${t}`):(0,d.jsx)("text",{x:n,y:G,textAnchor:"middle",dominantBaseline:"hanging",fill:y.textMuted,style:{fontSize:11,fontFamily:"inherit"},"data-tkx-heatmap-xlabel":"",children:String(e)},`x-${t}`)});let Q=null;if(s){const e=Array.from({length:32},(e,t)=>od(R[0]+t/31*(R[1]-R[0]),R,i,y.primary));if(B){const t=q+W+12,n=2,r=j,o=r/32;Q=(0,d.jsxs)("g",{"data-tkx-heatmap-legend":"right",children:[e.map((e,r)=>(0,d.jsx)("rect",{x:t,y:n+(31-r)*o,width:E,height:o+.5,fill:e},r)),(0,d.jsx)("text",{x:t+E+4,y:n,dominantBaseline:"hanging",fill:y.textMuted,style:{fontSize:10,fontFamily:"inherit"},"data-tkx-heatmap-legend-max":"",children:K}),(0,d.jsx)("text",{x:t+E+4,y:n+r,dominantBaseline:"auto",fill:y.textMuted,style:{fontSize:10,fontFamily:"inherit"},"data-tkx-heatmap-legend-min":"",children:U})]})}else if(V){const t=q,n=2+j+T+12,r=W,o=r/32;Q=(0,d.jsxs)("g",{"data-tkx-heatmap-legend":"bottom",children:[e.map((e,r)=>(0,d.jsx)("rect",{x:t+r*o,y:n,width:o+.5,height:E,fill:e},r)),(0,d.jsx)("text",{x:t,y:n+E+11,textAnchor:"start",fill:y.textMuted,style:{fontSize:10,fontFamily:"inherit"},"data-tkx-heatmap-legend-min":"",children:U}),(0,d.jsx)("text",{x:t+r,y:n+E+11,textAnchor:"end",fill:y.textMuted,style:{fontSize:10,fontFamily:"inherit"},"data-tkx-heatmap-legend-max":"",children:K})]})}}return(0,d.jsx)("div",{ref:b,className:xt(mt("inline-block"),m),style:g,"data-tkx-heatmap":"",...x,children:(0,d.jsxs)("svg",{role:"img","aria-label":Y,width:H,height:O,viewBox:`0 0 ${H} ${O}`,style:{display:"block",overflow:"visible"},children:[(0,d.jsx)("g",{"data-tkx-heatmap-ylabels":"",children:Z}),(0,d.jsx)("g",{"data-tkx-heatmap-cells":"",children:X}),(0,d.jsx)("g",{"data-tkx-heatmap-xlabels":"",children:_}),Q]})})});ad.displayName="TkxHeatmap";var ld=["#00f5d4","#3a86ff","#7b2ff7","#f72585","#ffbe0b","#06d6a0"];function sd(e){return A(e)>.179?"#000000":"#ffffff"}var dd=(0,a.forwardRef)(({data:e,width:t=400,height:n=300,orientation:r="vertical",colors:o,showValues:i=!0,showPercentages:a=!0,formatValue:l,gap:s=4,ariaLabel:c,onStageClick:u,className:p,style:h,...f},m)=>{const g=J(),x=Array.isArray(e)?e:[],b=o&&o.length>0?o:ld,y=l??(e=>String(e));if(0===x.length)return(0,d.jsx)("div",{ref:m,role:"img","aria-label":c??"Funnel chart with no stages",className:xt(mt("inline-block"),p),style:h,"data-tkx-funnel-empty":"",...f,children:(0,d.jsx)("svg",{width:t,height:n,viewBox:`0 0 ${t} ${n}`,"aria-hidden":"true"})});const v=Math.max(x[0].value,1e-4),w=x[x.length-1].value,k=v>0?Math.round((v-w)/v*100):0,$=x.map(e=>Math.max(.04,Math.min(1,e.value/v))),S="vertical"===r,C=c??(1===x.length?`Funnel chart with 1 stage, value ${y(x[0].value)}`:`Funnel chart with ${x.length} stages, top value ${y(x[0].value)}, bottom value ${y(w)}, total drop-off ${k}%`),z=a&&x.length>1?28:0,M=[],N=[],D=[];if(S){const e=t-110,r=(n-s*Math.max(0,x.length-1))/x.length,o=e/2;x.forEach((t,n)=>{const l=0===n?1:$[n-1],c=$[n],p=l*e/2,h=c*e/2,f=n*(r+s),m=f+r,v=t.color??b[n%b.length],w=1===x.length,k=w?o+h:o+p,S=o-h,C=o+h,z=`M${(w?o-h:o-p).toFixed(2)},${f.toFixed(2)} L${k.toFixed(2)},${f.toFixed(2)} L${C.toFixed(2)},${m.toFixed(2)} L${S.toFixed(2)},${m.toFixed(2)} Z`,R=!!u,P=R?()=>u(t,n):void 0,F=sd(v);if(M.push((0,d.jsxs)("g",{"data-tkx-funnel-stage":"","data-index":n,onClick:P,style:{cursor:R?"pointer":"default"},children:[(0,d.jsx)("path",{d:z,fill:v,"data-tkx-funnel-shape":"",children:(0,d.jsx)("title",{children:`${t.label}: ${y(t.value)}`})}),i&&(0,d.jsx)("text",{x:o,y:(f+m)/2,textAnchor:"middle",dominantBaseline:"central",fill:F,style:{fontSize:12,fontFamily:"inherit",fontWeight:600,fontVariantNumeric:"tabular-nums",pointerEvents:"none"},"data-tkx-funnel-value":"",children:y(t.value)})]},`stage-${n}`)),N.push((0,d.jsx)("text",{x:e+8,y:(f+m)/2,textAnchor:"start",dominantBaseline:"central",fill:g.text,style:{fontSize:12,fontFamily:"inherit"},"data-tkx-funnel-label":"",children:t.label},`label-${n}`)),a&&n<x.length-1){const r=x[n+1],o=t.value>0?Math.round((t.value-r.value)/t.value*100):0;D.push((0,d.jsx)("text",{x:e+8,y:m+s/2,textAnchor:"start",dominantBaseline:"central",fill:g.textMuted,style:{fontSize:10,fontFamily:"inherit",fontVariantNumeric:"tabular-nums"},"data-tkx-funnel-pct":"",children:o>=0?`−${o}%`:`+${Math.abs(o)}%`},`pct-${n}`))}})}else{const e=n-110,r=(t-s*Math.max(0,x.length-1))/x.length,o=e/2;x.forEach((t,n)=>{const l=0===n?1:$[n-1],c=$[n],p=l*e/2,h=c*e/2,f=n*(r+s),m=f+r,v=t.color??b[n%b.length],w=1===x.length,k=w?o-h:o-p,S=w?o+h:o+p,C=o-h,z=o+h,R=`M${f.toFixed(2)},${k.toFixed(2)} L${f.toFixed(2)},${S.toFixed(2)} L${m.toFixed(2)},${z.toFixed(2)} L${m.toFixed(2)},${C.toFixed(2)} Z`,P=!!u,F=P?()=>u(t,n):void 0,I=sd(v);if(M.push((0,d.jsxs)("g",{"data-tkx-funnel-stage":"","data-index":n,onClick:F,style:{cursor:P?"pointer":"default"},children:[(0,d.jsx)("path",{d:R,fill:v,"data-tkx-funnel-shape":"",children:(0,d.jsx)("title",{children:`${t.label}: ${y(t.value)}`})}),i&&(0,d.jsx)("text",{x:(f+m)/2,y:o,textAnchor:"middle",dominantBaseline:"central",fill:I,style:{fontSize:12,fontFamily:"inherit",fontWeight:600,fontVariantNumeric:"tabular-nums",pointerEvents:"none"},"data-tkx-funnel-value":"",children:y(t.value)})]},`stage-${n}`)),N.push((0,d.jsx)("text",{x:(f+m)/2,y:e+16,textAnchor:"middle",dominantBaseline:"hanging",fill:g.text,style:{fontSize:12,fontFamily:"inherit"},"data-tkx-funnel-label":"",children:t.label},`label-${n}`)),a&&n<x.length-1){const r=x[n+1],o=t.value>0?Math.round((t.value-r.value)/t.value*100):0;D.push((0,d.jsx)("text",{x:m+s/2,y:e+36,textAnchor:"middle",dominantBaseline:"hanging",fill:g.textMuted,style:{fontSize:10,fontFamily:"inherit",fontVariantNumeric:"tabular-nums"},"data-tkx-funnel-pct":"",children:o>=0?`−${o}%`:`+${Math.abs(o)}%`},`pct-${n}`))}})}return(0,d.jsxs)("div",{ref:m,className:xt(mt("inline-block"),p),style:h,"data-tkx-funnel":"","data-orientation":r,...f,children:[(0,d.jsxs)("svg",{role:"img","aria-label":C,width:t,height:n,viewBox:`0 0 ${t} ${n}`,style:{display:"block",overflow:"visible"},children:[(0,d.jsx)("g",{"data-tkx-funnel-stages":"",children:M}),(0,d.jsx)("g",{"data-tkx-funnel-labels":"",children:N}),a&&x.length>1&&(0,d.jsx)("g",{"data-tkx-funnel-pcts":"",children:D})]}),(0,d.jsx)("span",{hidden:!0,"data-tkx-funnel-pct-area":z})]})});dd.displayName="TkxFunnelChart";var cd=["#00f5d4","#3a86ff","#7b2ff7","#f72585","#ffbe0b","#06d6a0","#ef476f","#118ab2"];function ud(e){return A(e)>.179?"#000000":"#ffffff"}function pd(e,t){if(0===e.length)return 1/0;const n=e.reduce((e,t)=>e+t,0),r=n*n,o=t*t;let i=-1/0,a=1/0,l=-1/0;for(const c of e)c>l&&(l=c),c<a&&(a=c);if(0===r)return 1/0;const s=o*l/r,d=r/(o*a);return i=Math.max(s,d),i}function hd(e,t,n){const r=[],o=t.w>=t.h,i=Math.min(t.w,t.h),a=e.reduce((e,t)=>e+t.value,0),l=0===i?0:a/i;if(o){let o=t.y;for(const i of e){const s=0===a?t.h/e.length:i.value/a*t.h;r.push({x:t.x,y:o,w:l,h:s,node:i.node,origIndex:i.origIndex,path:[...n,i.origIndex]}),o+=s}return{placed:r,remaining:{x:t.x+l,y:t.y,w:t.w-l,h:t.h}}}let s=t.x;for(const d of e){const o=0===a?t.w/e.length:d.value/a*t.w;r.push({x:s,y:t.y,w:o,h:l,node:d.node,origIndex:d.origIndex,path:[...n,d.origIndex]}),s+=o}return{placed:r,remaining:{x:t.x,y:t.y+l,w:t.w,h:t.h-l}}}var fd=(0,a.forwardRef)(({data:e,width:t=600,height:n=400,colors:r,showLabels:o=!0,showValues:i=!1,minLabelSize:a=80,formatValue:l,ariaLabel:s,onNodeClick:c,className:u,style:p,...h},f)=>{const m=J(),g=Array.isArray(e)?e:[],x=r&&r.length>0?r:cd,b=l??(e=>String(e));if(0===g.length)return(0,d.jsx)("div",{ref:f,role:"img","aria-label":s??"Treemap with no data",className:xt(mt("inline-block"),u),style:p,"data-tkx-treemap-empty":"",...h,children:(0,d.jsx)("svg",{width:t,height:n,viewBox:`0 0 ${t} ${n}`,"aria-hidden":"true"})});const y=g.reduce((e,t)=>e+Math.max(0,t.value),0),v=s??`Treemap with ${g.length} node${1===g.length?"":"s"}, total value ${b(y)}`,w=(e,t,n,r)=>{const l=function(e,t,n){const r=e.map((e,t)=>({node:e,value:Math.max(0,e.value),origIndex:t})).filter(e=>e.value>0);if(0===r.length)return[];if(1===r.length)return[{x:t.x,y:t.y,w:t.w,h:t.h,node:r[0].node,origIndex:r[0].origIndex,path:[...n,r[0].origIndex]}];const o=[...r].sort((e,t)=>t.value-e.value),i=o.reduce((e,t)=>e+t.value,0),a=t.w*t.h,l=0===i?0:a/i;return function(e,t,n){const r=[];let o={...t},i=[...e];for(;i.length>0;){const e=Math.min(o.w,o.h);if(e<=0)break;const t=[],a=[];let l=0;for(;l<i.length;){const n=i[l],r=[...a,n.value],o=0===t.length?1/0:pd(a,e),s=pd(r,e);if(!(0===t.length||s<=o))break;t.push(n),a.push(n.value),l+=1}if(0===t.length)break;const{placed:s,remaining:d}=hd(t,o,n);r.push(...s),i=i.slice(t.length),o=d}return r}(o.map(e=>({...e,value:e.value*l})),t,n)}(e,t,n),s=[];for(const u of l){const e=u.node.color??x[u.origIndex%x.length],t=u.w*u.h,n=o&&t>=a,l=u.node.label,p=ud(e),h=!!c,f=h?e=>{e.stopPropagation(),c(u.node,u.path)}:void 0,g=Array.isArray(u.node.children)&&u.node.children.length>0,y=g?{x:u.x+1,y:u.y+(n?16:1),w:Math.max(0,u.w-2),h:Math.max(0,u.h-(n?17:2))}:u;s.push((0,d.jsxs)("g",{"data-tkx-treemap-node":"","data-depth":r,"data-label":l,onClick:f,style:{cursor:h?"pointer":"default"},children:[(0,d.jsx)("rect",{x:u.x,y:u.y,width:u.w,height:u.h,fill:e,stroke:m.bg,strokeWidth:1,"data-tkx-treemap-rect":"",children:(0,d.jsx)("title",{children:`${l}: ${b(u.node.value)}`})}),n&&(0,d.jsx)("text",{x:u.x+4,y:u.y+(g?12:14),fill:p,style:{fontSize:11,fontFamily:"inherit",fontWeight:600,pointerEvents:"none"},"data-tkx-treemap-label":"",children:l}),n&&i&&!g&&t>=1.5*a&&(0,d.jsx)("text",{x:u.x+4,y:u.y+26,fill:p,style:{fontSize:10,fontFamily:"inherit",fontVariantNumeric:"tabular-nums",opacity:.85,pointerEvents:"none"},"data-tkx-treemap-value":"",children:b(u.node.value)}),g&&y.w>4&&y.h>4&&(0,d.jsx)("g",{"data-tkx-treemap-children":"",children:w(u.node.children,y,u.path,r+1)})]},`d${r}-${u.path.join("-")}`))}return s},k=w(g,{x:0,y:0,w:t,h:n},[],0);return(0,d.jsx)("div",{ref:f,className:xt(mt("inline-block"),u),style:p,"data-tkx-treemap":"",...h,children:(0,d.jsx)("svg",{role:"img","aria-label":v,width:t,height:n,viewBox:`0 0 ${t} ${n}`,style:{display:"block",overflow:"visible"},children:k})})});function md(e){if(e instanceof Date)return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()));const t=/^(\d{4})-(\d{2})-(\d{2})/.exec(e);if(!t)throw new Error(`TkxGantt: invalid date "${e}" (expected YYYY-MM-DD)`);return new Date(Date.UTC(+t[1],+t[2]-1,+t[3]))}function gd(e){return`${e.getUTCFullYear()}-${String(e.getUTCMonth()+1).padStart(2,"0")}-${String(e.getUTCDate()).padStart(2,"0")}`}fd.displayName="TkxTreemap";var xd=864e5;function bd(e,t){return Math.round((t.getTime()-e.getTime())/xd)}function yd(e,t){return new Date(e.getTime()+t*xd)}function vd(e){return e.toLocaleString("en",{month:"short",timeZone:"UTC"})}function wd(e,t){e.sum+=t,e.count+=1,t<e.min&&(e.min=t),t>e.max&&(e.max=t)}function kd(e,t){if(0===e.count)return null;switch(t){case"sum":return e.sum;case"avg":return e.sum/e.count;case"min":return e.min;case"max":return e.max;case"count":return e.count}}function $d(e,t){return t.map(t=>String(e[t]??""))}function Sd(e){return e.label??("count"===e.agg?"count":`${e.agg}(${e.field??""})`)}var Cd=e=>Number.isFinite(e)?Number.isInteger(e)?String(e):String(Math.round(1e4*e)/1e4):"";function zd(){return{keys:[],children:new Map}}function Md(e,t){let n=e.children.get(t);return n||(n=zd(),e.children.set(t,n),e.keys.push(t)),n}function Nd(e,t,n){e.keys.sort((e,r)=>n(e,r,t));for(const r of e.keys)Nd(e.children.get(r),t+1,n)}function Dd(e,t,n=[]){if(0===t)return[n];const r=[];for(const o of e.keys)r.push(...Dd(e.children.get(o),t-1,[...n,o]));return r}var Rd=(e,t)=>e<t?-1:e>t?1:0,Pd=/^([A-Z]+)([0-9]+)$/;function Fd(e){let t="",n=e;for(;t=String.fromCharCode(65+n%26)+t,n=Math.floor(n/26)-1,!(n<0););return t}function Id(e){let t=0;for(let n=0;n<e.length;n++)t=26*t+(e.charCodeAt(n)-64);return t-1}function Ad(e,t){return`${Fd(e)}${t+1}`}function Ld(e){const t=Pd.exec(e);return t?{col:Id(t[1]),row:+t[2]-1}:null}function Td(e,t){return Wd(e,{cells:t,stack:new Set,memo:new Map})}function Wd(e,t){if(t.memo.has(e))return t.memo.get(e);if(t.stack.has(e))return"#CYCLE!";const n=t.cells[e];if(void 0===n||""===n)return"";let r;if(n.startsWith("=")){t.stack.add(e);try{r=function(e,t){const n=function(e){const t=[];let n=e.trim();for(;n.length;){if(" "===n[0]){n=n.slice(1);continue}if("("===n[0]||")"===n[0]){t.push({type:"paren",value:n[0]}),n=n.slice(1);continue}if(","===n[0]){t.push({type:"comma"}),n=n.slice(1);continue}if("+-*/^".includes(n[0])){t.push({type:"op",value:n[0]}),n=n.slice(1);continue}let e;if(e=jd.exec(n),e)t.push({type:"fn",name:e[1]}),t.push({type:"paren",value:"("}),n=n.slice(e[0].length);else if(e=Ed.exec(n),e)t.push({type:"range",from:e[1],to:e[2]}),n=n.slice(e[0].length);else if(e=Bd.exec(n),e)t.push({type:"ref",addr:e[1]}),n=n.slice(e[0].length);else{if(e=Vd.exec(n),!e)throw new Error(`Unexpected token at "${n}"`);t.push({type:"num",value:+e[0]}),n=n.slice(e[0].length)}}return t}(e),r={tokens:n,pos:0},o=Ud(r,t,0);if(r.pos!==n.length)throw new Error("Trailing tokens");return o}(n.slice(1),t)}catch{r="#ERROR!"}t.stack.delete(e)}else{const e=Number(n);r=Number.isFinite(e)&&""!==n.trim()?e:n}return t.memo.set(e,r),r}var jd=/^([A-Z][A-Z0-9_]*)\s*\(/,Ed=/^([A-Z]+[0-9]+):([A-Z]+[0-9]+)/,Bd=/^([A-Z]+[0-9]+)/,Vd=/^(\d+(?:\.\d+)?|\.\d+)/;function Hd(e){return e.tokens[e.pos]??null}function Od(e){return e.tokens[e.pos++]}var qd={"+":1,"-":1,"*":2,"/":2,"^":3};function Ud(e,t,n){let r=function(e,t){const n=Od(e);if(!n)throw new Error("Unexpected end of formula");switch(n.type){case"num":return n.value;case"ref":return Wd(n.addr,t);case"range":throw new Error("Range used outside a function");case"op":if("-"===n.value||"+"===n.value){const r=Yd(Ud(e,t,4));return"-"===n.value?-r:r}throw new Error(`Unexpected operator ${n.value}`);case"paren":{if("("!==n.value)throw new Error("Unexpected )");const r=Ud(e,t,0),o=Od(e);if(!o||"paren"!==o.type||")"!==o.value)throw new Error("Missing )");return r}case"fn":{const r=[],o=Od(e);if(!o||"paren"!==o.type||"("!==o.value)throw new Error("Function missing (");if("paren"===Hd(e)?.type&&")"===Hd(e).value)return Od(e),Zd(n.name,r);for(;;){const n=Hd(e);n&&"range"===n.type?(Od(e),r.push(Kd(n.from,n.to,t))):r.push([Ud(e,t,0)]);const o=Hd(e);if(!o||"comma"!==o.type)break;Od(e)}const i=Od(e);if(!i||"paren"!==i.type||")"!==i.value)throw new Error("Function missing )");return Zd(n.name,r)}default:throw new Error(`Unexpected token ${n.type}`)}}(e,t);for(;;){const o=Hd(e);if(!o||"op"!==o.type)break;const i=qd[o.value];if(void 0===i||i<n)break;Od(e);const a=Ud(e,t,i+1);r=Xd(o.value,r,a)}return r}function Kd(e,t,n){const r=Ld(e),o=Ld(t);if(!r||!o)return["#REF!"];const i=Math.min(r.col,o.col),a=Math.max(r.col,o.col),l=Math.min(r.row,o.row),s=Math.max(r.row,o.row),d=[];for(let c=i;c<=a;c++)for(let e=l;e<=s;e++)d.push(Wd(Ad(c,e),n));return d}function Yd(e){if("number"==typeof e)return e;if("string"==typeof e&&e.startsWith("#"))throw new Error(e);const t=Number(e);return Number.isFinite(t)?t:0}function Xd(e,t,n){const r=Yd(t),o=Yd(n);switch(e){case"+":return r+o;case"-":return r-o;case"*":return r*o;case"/":return 0===o?"#DIV/0!":r/o;case"^":return Math.pow(r,o);default:throw new Error(`Unknown op ${e}`)}}function Zd(e,t){const n=t.flat().filter(e=>"number"==typeof e||"string"==typeof e&&""!==e&&!e.startsWith("#")).map(Yd);switch(e.toUpperCase()){case"SUM":return n.reduce((e,t)=>e+t,0);case"AVG":case"AVERAGE":return 0===n.length?0:n.reduce((e,t)=>e+t,0)/n.length;case"MIN":return 0===n.length?0:Math.min(...n);case"MAX":return 0===n.length?0:Math.max(...n);case"COUNT":return n.length;case"ROUND":{const e=Yd(t[0]?.[0]??0),n=t[1]?Yd(t[1][0]):0,r=Math.pow(10,n);return Math.round(e*r)/r}case"IF":{const e=Yd(t[0]?.[0]??0),n=t[1]?.[0]??"",r=t[2]?.[0]??"";return e?n:r}default:return"#NAME?"}}var Gd=["text","email","number","textarea","select","radio","checkbox","date"],_d={text:"Text",email:"Email",number:"Number",textarea:"Long text",select:"Dropdown",radio:"Radio group",checkbox:"Checkbox",date:"Date"},Jd={text:"🔤",email:"✉️",number:"#️⃣",textarea:"📝",select:"🔽",radio:"🔘",checkbox:"☑️",date:"📅"};function Qd(e,t){return`${_d[e]} ${t}`}function ec(e,t){return`${e}_${t}`}function tc(e,t){const n=null==t||""===t||Array.isArray(t)&&0===t.length;if(e.required&&n)return`${e.label} is required`;if(n)return null;if("email"===e.type&&"string"==typeof t&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t))return"Invalid email";if("number"===e.type&&"string"==typeof t){const n=Number(t);if(Number.isNaN(n))return"Must be a number";if(void 0!==e.min&&n<e.min)return`Must be ≥ ${e.min}`;if(void 0!==e.max&&n>e.max)return`Must be ≤ ${e.max}`}if(e.pattern&&"string"==typeof t)try{if(!new RegExp(e.pattern).test(t))return"Format is invalid"}catch{}return null}function nc({types:e,onAdd:t}){return(0,d.jsxs)("div",{role:"toolbar","aria-label":"Field types",style:{display:"flex",flexDirection:"column",gap:6,padding:12,borderRight:"1px solid var(--tkx-border, #2a2a3e)",minWidth:180,background:"var(--tkx-bg-subtle, #0d0d14)"},children:[(0,d.jsx)("div",{style:{fontSize:11,fontWeight:700,letterSpacing:"0.06em",textTransform:"uppercase",color:"#888",marginBottom:4},children:"Add field"}),e.map(e=>(0,d.jsxs)("button",{type:"button","data-testid":`palette-${e}`,onClick:()=>t(e),style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px",minHeight:44,borderRadius:6,border:"1px solid var(--tkx-border, #2a2a3e)",background:"transparent",color:"var(--tkx-fg, #e8e8f4)",fontSize:13,cursor:"pointer",textAlign:"left"},children:[(0,d.jsx)("span",{"aria-hidden":"true",children:Jd[e]}),(0,d.jsx)("span",{children:_d[e]})]},e))]})}function rc({fields:e,selectedId:t,onSelect:n,onMove:r,onRemove:o}){return(0,d.jsxs)("div",{role:"list","aria-label":"Form fields",style:{flex:1,padding:16,display:"flex",flexDirection:"column",gap:8,minWidth:0,overflowY:"auto"},children:[0===e.length&&(0,d.jsx)("div",{style:{padding:32,textAlign:"center",color:"#888",border:"1px dashed var(--tkx-border, #2a2a3e)",borderRadius:8},children:"No fields yet — pick one from the palette to get started."}),e.map((i,a)=>{const l=i.id===t;return(0,d.jsxs)("div",{role:"listitem","data-testid":`canvas-field-${i.id}`,onClick:()=>n(i.id),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n(i.id))},tabIndex:0,"aria-selected":l,style:{padding:12,borderRadius:8,border:"1px solid "+(l?"var(--tkx-accent, #00f5d4)":"var(--tkx-border, #2a2a3e)"),background:l?"rgba(0,245,212,0.06)":"var(--tkx-bg-subtle, #12121a)",cursor:"pointer",display:"flex",alignItems:"center",gap:12},children:[(0,d.jsx)("span",{"aria-hidden":"true",style:{fontSize:18},children:Jd[i.type]}),(0,d.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,d.jsxs)("div",{style:{fontWeight:600,fontSize:14,color:"var(--tkx-fg, #e8e8f4)"},children:[i.label,i.required&&(0,d.jsx)("span",{"aria-hidden":"true",style:{color:"#ff006e",marginLeft:4},children:"*"})]}),(0,d.jsxs)("div",{style:{fontSize:11,color:"#888",fontFamily:"ui-monospace, monospace"},children:[i.type," · ",i.name]})]}),(0,d.jsxs)("div",{style:{display:"flex",gap:4},children:[(0,d.jsx)("button",{type:"button","aria-label":`Move ${i.label} up`,disabled:0===a,onClick:e=>{e.stopPropagation(),r(i.id,-1)},style:oc,children:"↑"}),(0,d.jsx)("button",{type:"button","aria-label":`Move ${i.label} down`,disabled:a===e.length-1,onClick:e=>{e.stopPropagation(),r(i.id,1)},style:oc,children:"↓"}),(0,d.jsx)("button",{type:"button","aria-label":`Remove ${i.label}`,onClick:e=>{e.stopPropagation(),o(i.id)},style:{...oc,color:"#ff006e"},children:"✕"})]})]},i.id)})]})}var oc={width:32,height:32,borderRadius:6,border:"1px solid var(--tkx-border, #2a2a3e)",background:"transparent",color:"var(--tkx-fg, #e8e8f4)",cursor:"pointer",fontSize:14,display:"inline-flex",alignItems:"center",justifyContent:"center"};function ic({field:e,onPatch:t}){if(!e)return(0,d.jsx)("div",{style:{minWidth:260,padding:16,borderLeft:"1px solid var(--tkx-border, #2a2a3e)",background:"var(--tkx-bg-subtle, #0d0d14)",color:"#888",fontSize:13},children:"Select a field to edit its properties."});const n="select"===e.type||"radio"===e.type,r="text"===e.type||"email"===e.type,o="number"===e.type;return(0,d.jsxs)("div",{style:{minWidth:260,padding:16,borderLeft:"1px solid var(--tkx-border, #2a2a3e)",background:"var(--tkx-bg-subtle, #0d0d14)",display:"flex",flexDirection:"column",gap:12,overflowY:"auto"},children:[(0,d.jsx)("div",{style:{fontSize:11,fontWeight:700,letterSpacing:"0.06em",textTransform:"uppercase",color:"#888"},children:"Properties"}),(0,d.jsx)(ac,{label:"Label",value:e.label,onChange:e=>t({label:e})}),(0,d.jsx)(ac,{label:"Name (key)",value:e.name,onChange:e=>t({name:e.replace(/[^a-zA-Z0-9_]/g,"_")})}),(0,d.jsx)(ac,{label:"Placeholder",value:e.placeholder??"",onChange:e=>t({placeholder:e})}),(0,d.jsx)(ac,{label:"Help text",value:e.helpText??"",onChange:e=>t({helpText:e})}),(0,d.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,color:"var(--tkx-fg, #e8e8f4)"},children:[(0,d.jsx)("input",{type:"checkbox",checked:!!e.required,onChange:e=>t({required:e.target.checked})}),"Required"]}),o&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(ac,{label:"Min",value:e.min?.toString()??"",onChange:e=>t({min:""===e?void 0:Number(e)}),type:"number"}),(0,d.jsx)(ac,{label:"Max",value:e.max?.toString()??"",onChange:e=>t({max:""===e?void 0:Number(e)}),type:"number"})]}),r&&(0,d.jsx)(ac,{label:"Pattern (regex)",value:e.pattern??"",onChange:e=>t({pattern:e||void 0})}),n&&(0,d.jsx)(lc,{options:e.options??[],onChange:e=>t({options:e})})]})}function ac({label:e,value:t,onChange:n,type:r="text"}){const o=(0,a.useId)();return(0,d.jsxs)("label",{htmlFor:o,style:{display:"flex",flexDirection:"column",gap:4,fontSize:12,color:"#aaa"},children:[e,(0,d.jsx)("input",{id:o,type:r,value:t,onChange:e=>n(e.target.value),style:{padding:"8px 10px",minHeight:36,borderRadius:6,border:"1px solid var(--tkx-border, #2a2a3e)",background:"var(--tkx-bg, #0a0a0f)",color:"var(--tkx-fg, #e8e8f4)",fontSize:13}})]})}function lc({options:e,onChange:t}){return(0,d.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,d.jsx)("div",{style:{fontSize:12,color:"#aaa"},children:"Options"}),e.map((n,r)=>(0,d.jsxs)("div",{style:{display:"flex",gap:4},children:[(0,d.jsx)("input",{"aria-label":`Option ${r+1} label`,value:n.label,onChange:n=>{const o=e.slice();o[r]={...o[r],label:n.target.value},t(o)},style:sc}),(0,d.jsx)("input",{"aria-label":`Option ${r+1} value`,value:n.value,onChange:n=>{const o=e.slice();o[r]={...o[r],value:n.target.value},t(o)},style:sc}),(0,d.jsx)("button",{type:"button","aria-label":`Remove option ${r+1}`,onClick:()=>t(e.filter((e,t)=>t!==r)),style:{...oc,color:"#ff006e"},children:"✕"})]},r)),(0,d.jsx)("button",{type:"button",onClick:()=>t([...e,{label:`Option ${e.length+1}`,value:`option_${e.length+1}`}]),style:{padding:"6px 10px",minHeight:36,borderRadius:6,border:"1px dashed var(--tkx-border, #2a2a3e)",background:"transparent",color:"var(--tkx-fg, #e8e8f4)",cursor:"pointer",fontSize:12},children:"+ Add option"})]})}var sc={flex:1,minWidth:0,padding:"6px 8px",minHeight:32,borderRadius:6,border:"1px solid var(--tkx-border, #2a2a3e)",background:"var(--tkx-bg, #0a0a0f)",color:"var(--tkx-fg, #e8e8f4)",fontSize:12};function dc({schema:e}){const[t,n]=(0,a.useState)({}),[r,o]=(0,a.useState)({}),[i,l]=(0,a.useState)(null);return(0,d.jsxs)("form",{onSubmit:n=>{n.preventDefault();const r={};for(const o of e.fields)r[o.name]=tc(o,t[o.name]);o(r),Object.values(r).every(e=>null===e)?l(t):l(null)},style:{flex:1,padding:24,overflowY:"auto",display:"flex",flexDirection:"column",gap:16,maxWidth:640,margin:"0 auto",width:"100%"},children:[e.title&&(0,d.jsx)("h2",{style:{margin:0,color:"var(--tkx-fg, #e8e8f4)"},children:e.title}),e.description&&(0,d.jsx)("p",{style:{margin:0,color:"#aaa"},children:e.description}),e.fields.map(e=>(0,d.jsx)(cc,{field:e,value:t[e.name],error:r[e.name]??null,onChange:t=>{return r=e.name,o=t,void n(e=>({...e,[r]:o}));var r,o}},e.id)),(0,d.jsx)("button",{type:"submit",style:{padding:"12px 20px",minHeight:44,borderRadius:8,border:"none",background:"var(--tkx-accent, #00f5d4)",color:"#0a0a0f",fontWeight:700,cursor:"pointer",alignSelf:"flex-start"},children:"Submit"}),i&&(0,d.jsx)("pre",{"data-testid":"preview-submitted",style:{background:"var(--tkx-bg-subtle, #0d0d14)",border:"1px solid var(--tkx-border, #2a2a3e)",borderRadius:8,padding:12,color:"#00f5d4",fontSize:12,overflowX:"auto"},children:JSON.stringify(i,null,2)})]})}function cc({field:e,value:t,error:n,onChange:r}){const o=(0,a.useId)(),i=(0,d.jsxs)("label",{htmlFor:o,style:{display:"block",marginBottom:4,fontWeight:600,color:"var(--tkx-fg, #e8e8f4)"},children:[e.label,e.required&&(0,d.jsx)("span",{"aria-hidden":"true",style:{color:"#ff006e",marginLeft:4},children:"*"})]}),l=e.helpText&&(0,d.jsx)("div",{style:{fontSize:12,color:"#888",marginTop:4},children:e.helpText}),s=n&&(0,d.jsx)("div",{role:"alert",style:{fontSize:12,color:"#ff006e",marginTop:4},children:n});let c=null;switch(e.type){case"textarea":c=(0,d.jsx)("textarea",{id:o,value:t??"",placeholder:e.placeholder,onChange:e=>r(e.target.value),rows:4,style:uc});break;case"select":c=(0,d.jsxs)("select",{id:o,value:t??"",onChange:e=>r(e.target.value),style:uc,children:[(0,d.jsx)("option",{value:"",children:e.placeholder??"Choose…"}),(e.options??[]).map(e=>(0,d.jsx)("option",{value:e.value,children:e.label},e.value))]});break;case"radio":c=(0,d.jsx)("div",{role:"radiogroup","aria-labelledby":o,style:{display:"flex",flexDirection:"column",gap:6},children:(e.options??[]).map(n=>(0,d.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:8,color:"var(--tkx-fg, #e8e8f4)"},children:[(0,d.jsx)("input",{type:"radio",name:e.name,value:n.value,checked:t===n.value,onChange:()=>r(n.value)}),n.label]},n.value))});break;case"checkbox":c=(0,d.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:8,color:"var(--tkx-fg, #e8e8f4)"},children:[(0,d.jsx)("input",{id:o,type:"checkbox",checked:!!t,onChange:e=>r(e.target.checked)}),e.placeholder||"Yes"]});break;default:c=(0,d.jsx)("input",{id:o,type:"number"===e.type?"number":"date"===e.type?"date":e.type,value:t??"",placeholder:e.placeholder,min:e.min,max:e.max,onChange:e=>r(e.target.value),style:uc})}return(0,d.jsxs)("div",{children:[i,c,l,s]})}var uc={width:"100%",padding:"10px 12px",minHeight:44,borderRadius:8,border:"1px solid var(--tkx-border, #2a2a3e)",background:"var(--tkx-bg, #0a0a0f)",color:"var(--tkx-fg, #e8e8f4)",fontSize:14,boxSizing:"border-box"};exports.COUNTRIES=Ia,exports.FocusTrap=function({active:e,children:t,as:n="div"}){return(0,d.jsx)(n,{ref:We(e),children:t})},exports.I18nContext=Ht,exports.I18nProvider=function({locale:e="en-US",direction:t,strings:n,children:r}){const o=(0,a.useMemo)(()=>{const r=Et[e]??jt,o=n?{...r,...n}:r;return{locale:e,direction:t??(Vt(e)?"rtl":"ltr"),strings:o}},[e,t,n]);return(0,d.jsx)(Ht.Provider,{value:o,children:(0,d.jsx)("div",{dir:o.direction,style:{direction:o.direction,display:"contents"},children:r})})},exports.LRUCache=p,exports.LiveRegion=function({politeness:e="polite",children:t,atomic:n=!0}){return(0,d.jsx)("div",{role:"status","aria-live":e,"aria-atomic":n,className:"tkx-sr-only",children:t})},exports.Quantum=w,exports.SIZE_BORDER_RADIUS={sm:4,md:6,lg:8},exports.SIZE_FONT={sm:"0.75rem",md:"0.875rem",lg:"1rem"},exports.SIZE_HEIGHT={sm:32,md:40,lg:48},exports.SIZE_ICON={sm:14,md:16,lg:20},exports.SIZE_PADDING_X={sm:8,md:12,lg:16},exports.SIZE_PADDING_Y={sm:4,md:8,lg:12},exports.SecurityCore=Ae,exports.Shield=Le,exports.SkipNav=function({contentId:e="tkx-main-content",label:t="Skip to main content"}){return(0,d.jsx)("a",{href:`#${e}`,className:"tkx-skip-nav",children:t})},exports.TKX=I,exports.ThemeContext=G,exports.ThemeProvider=_,exports.TkxAadhaarInput=gl,exports.TkxAccessibilityChecker=function({show:e,intervalMs:t=4e3,position:n="bottom-right",scope:r,axeOptions:o,onScan:i}){const l=J(),[s,c]=(0,a.useState)([]),[u,p]=(0,a.useState)(!1),[h,f]=(0,a.useState)(null),[m,g]=(0,a.useState)(!1),[x,b]=(0,a.useState)(null),y="production"===(globalThis.process?.env)?.NODE_ENV,v=e??!y;if((0,a.useEffect)(()=>{if(!v)return;let e=!1,n=null,a=null;async function l(t){if(!e){g(!0);try{const n=r??document,a=await t.run(n,o);if(e)return;c(a.violations);const l={};a.violations.forEach(e=>{const t=e.impact??"unknown";l[t]=(l[t]??0)+1}),i?.({violations:a.violations.length,impacts:l}),b(null)}catch(n){b(n instanceof Error?n.message:"scan failed")}finally{e||g(!1)}}}return async function(){try{const e=await new Function("s","return import(s)")("axe-core");return e.default??e}catch{return null}}().then(r=>{e||(r?(f(!0),n=r,l(r),t>0&&(a=setInterval(()=>{n&&l(n)},t))):f(!1))}),()=>{e=!0,a&&clearInterval(a)}},[v,t,r]),!v||!1===h)return null;const w={};s.forEach(e=>{const t=e.impact??"unknown";w[t]=(w[t]??0)+1});const k=s.length,$=0===k?{color:l.success??"#06d6a0",label:"✓ AAA"}:w.critical||w.serious?{color:"#f72585",label:"Issues"}:{color:"#ffbe0b",label:"Warnings"};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("button",{type:"button","aria-label":`Accessibility status: ${k} violation${1===k?"":"s"}`,"aria-expanded":u,onClick:()=>p(e=>!e),style:Ds(l,$.color,n),children:[(0,d.jsx)("span",{style:{fontSize:14,fontWeight:700},children:m?"…":0===k?"✓":k}),(0,d.jsx)("span",{style:{fontSize:9,fontWeight:700,letterSpacing:"0.06em"},children:"A11Y"})]}),u&&(0,d.jsxs)("div",{role:"dialog","aria-label":"Accessibility violations","aria-modal":"false",style:Rs(l,n),children:[(0,d.jsxs)("header",{style:{display:"flex",alignItems:"center",gap:8,padding:"12px 16px",borderBottom:`1px solid ${l.border}`,background:l.surfaceAlt},children:[(0,d.jsx)("span",{style:{width:10,height:10,borderRadius:"50%",background:$.color,boxShadow:`0 0 12px ${$.color}`},"aria-hidden":"true"}),(0,d.jsxs)("h3",{style:{margin:0,fontSize:14,fontWeight:700,color:l.text,flex:1},children:["Accessibility — ",$.label]}),(0,d.jsx)("button",{type:"button",onClick:()=>p(!1),"aria-label":"Close panel",style:{background:"transparent",border:"none",color:l.textMuted,cursor:"pointer",fontSize:18,padding:4},children:"×"})]}),(0,d.jsxs)("div",{style:{padding:16,maxHeight:400,overflowY:"auto"},children:[x&&(0,d.jsxs)("div",{style:{color:"#f72585",fontSize:12,marginBottom:8},children:["Scan error: ",x]}),0===k?(0,d.jsx)("div",{style:{color:l.textMuted,fontSize:13},children:"No axe-core violations on this page. ✓"}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:{display:"flex",gap:6,flexWrap:"wrap",marginBottom:12},children:Object.entries(w).map(([e,t])=>(0,d.jsxs)("span",{style:{padding:"3px 8px",background:`${Ns[e]??l.textMuted}22`,color:Ns[e]??l.textMuted,borderRadius:999,fontSize:10,fontWeight:700,letterSpacing:"0.05em",textTransform:"uppercase"},children:[e,": ",t]},e))}),(0,d.jsx)("ol",{style:{listStyle:"none",padding:0,margin:0,display:"flex",flexDirection:"column",gap:10},children:s.slice(0,10).map(e=>(0,d.jsxs)("li",{style:{padding:10,background:l.surfaceAlt,border:`1px solid ${l.border}`,borderRadius:8,fontSize:12},children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:4},children:[(0,d.jsx)("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:Ns[e.impact??"minor"]??l.textMuted}}),(0,d.jsx)("strong",{style:{color:l.text,flex:1},children:e.help}),(0,d.jsxs)("span",{style:{fontSize:10,color:l.textMuted,fontFamily:"monospace"},children:[e.nodes.length,"×"]})]}),(0,d.jsx)("div",{style:{color:l.textMuted,marginBottom:6},children:e.description}),(0,d.jsx)("a",{href:e.helpUrl,target:"_blank",rel:"noopener noreferrer",style:{color:l.primary,fontSize:11},children:"Learn more →"})]},e.id))}),s.length>10&&(0,d.jsxs)("div",{style:{marginTop:10,color:l.textMuted,fontSize:11,textAlign:"center"},children:["+ ",s.length-10," more violations not shown"]})]})]}),(0,d.jsxs)("footer",{style:{padding:"8px 16px",borderTop:`1px solid ${l.border}`,fontSize:10,color:l.textMuted,fontFamily:"monospace",textAlign:"center"},children:["Powered by axe-core · scans every ",t/1e3,"s"]})]})]})},exports.TkxAccordion=Mn,exports.TkxAddressInput=Ga,exports.TkxAffix=function({children:e,offsetTop:t,offsetBottom:n,onChange:r,target:o}){const i=J(),l=Te(),s=(0,a.useRef)(null),c=(0,a.useRef)(null),[u,p]=(0,a.useState)(!1),[h,f]=(0,a.useState)({width:0,height:0}),m=(0,a.useRef)(!1),g=(0,a.useMemo)(()=>oe("Sticky content"),[]),x=(0,a.useCallback)(()=>{const e=s.current;if(!e)return;const i=e.getBoundingClientRect(),a=function(e){if(e instanceof Window)return{top:0,bottom:e.innerHeight};const t=e.getBoundingClientRect();return{top:t.top,bottom:t.bottom}}(ga(o));let l=!1;void 0!==t?l=i.top-a.top<=t:void 0!==n&&(l=a.bottom-i.bottom<=n),l!==m.current&&(m.current=l,p(l),f({width:i.width,height:i.height}),r?.(l))},[t,n,r,o]);(0,a.useEffect)(()=>{const e=ga(o);return x(),e.addEventListener("scroll",x,{passive:!0}),window.addEventListener("resize",x),()=>{e.removeEventListener("scroll",x),window.removeEventListener("resize",x)}},[x,o]);const b=u?{position:"fixed",zIndex:100,...void 0!==t?{top:t}:{},...void 0!==n?{bottom:n}:{},width:h.width||void 0,transition:l?"none":"box-shadow 0.2s ease",boxShadow:`0 2px 8px ${i.border}`}:{};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{ref:s,"aria-hidden":u,style:u?{height:h.height,width:h.width}:{}}),(0,d.jsx)("div",{ref:c,role:"region","aria-label":g,className:mt(u?"tkx-affixed":""),style:b,children:e})]})},exports.TkxAlert=function({variant:e,title:t,children:n,dismissible:r,onDismiss:o,icon:i,style:l,className:s}){const c=J(),u=je(),p=t?oe(t):void 0;(0,a.useEffect)(()=>{p&&u(p,"danger"===e||"warning"===e?"assertive":"polite")},[p,e]);const h={info:c.info,success:c.success,warning:c.warning,danger:c.danger}[e];return(0,d.jsxs)("div",{role:"danger"===e||"warning"===e?"alert":"status",className:mt("flex items-start gap-3 px-4 py-3 rounded-lg border animate-fade-in font-sans",s??""),style:{backgroundColor:`${h}18`,borderColor:h,color:c.text,...l},children:[(0,d.jsx)("span",{className:mt("shrink-0 mt-[1px]"),style:{color:h},children:i??Wt[e]}),(0,d.jsxs)("div",{className:mt("flex-1 min-w-0"),children:[p&&(0,d.jsx)("p",{className:mt("m-0 font-semibold text-sm mb-1"),children:p}),(0,d.jsx)("div",{className:mt("text-sm leading-relaxed"),children:n})]}),r&&o&&(0,d.jsx)("button",{"aria-label":"Dismiss alert",onClick:o,className:mt("bg-transparent border-none cursor-pointer rounded p-[2px] shrink-0 flex items-center justify-center focus-visible:focus-ring"),style:{color:c.textMuted},children:(0,d.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:[(0,d.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,d.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})},exports.TkxAnchor=function({items:e,offsetTop:t=0,getCurrentAnchor:n,onChange:r}){const o=J(),i=Te(),[l,s]=(0,a.useState)(e[0]?.key??""),c=(0,a.useRef)(!1),u=xa(e),p=(0,a.useCallback)(()=>{if(c.current)return;let e=u[0]?.key??"";for(const n of u){const r=ba(n.href),o=document.getElementById(r);o&&o.getBoundingClientRect().top<=t+10&&(e=n.key)}n&&(e=n(e)),e!==l&&(s(e),r?.(e))},[u,t,n,l,r]);(0,a.useEffect)(()=>(window.addEventListener("scroll",p,{passive:!0}),p(),()=>window.removeEventListener("scroll",p)),[p]);const h=(0,a.useCallback)(e=>{const n=ba(e),o=document.getElementById(n);if(!o)return;c.current=!0;const a=o.getBoundingClientRect().top+window.scrollY-t;window.scrollTo({top:a,behavior:i?"auto":"smooth"});const l=u.find(t=>t.href===e);l&&(s(l.key),r?.(l.key)),setTimeout(()=>{c.current=!1},800)},[u,t,i,r]);return(0,d.jsx)("nav",{role:"tree","aria-label":"Anchor navigation",className:mt("font-sans"),style:{borderLeft:`1px solid ${o.border}`,padding:"4px 0"},children:(0,d.jsx)("ul",{role:"group",style:{margin:0,padding:0},children:e.map(e=>(0,d.jsx)(ya,{item:e,activeKey:l,depth:0,onClick:h,theme:o,reducedMotion:i},e.key))})})},exports.TkxAppBar=function({title:e,leading:t,logo:n,actions:r,navigation:o,position:i="sticky",variant:l="default",color:s="surface"}){const c=J(),u=Te(),p=function(){const[e,t]=(0,a.useState)(()=>"undefined"!=typeof window&&window.innerWidth<768);return(0,a.useEffect)(()=>{if("undefined"==typeof window)return;const e=()=>t(window.innerWidth<768);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e}(),[h,f]=(0,a.useState)(!1),m=(0,a.useRef)(null),g=(0,a.useId)();Ee(()=>f(!1),h),(0,a.useEffect)(()=>{!p&&h&&f(!1)},[p,h]),(0,a.useEffect)(()=>{if(!h)return;const e=e=>{m.current&&!m.current.contains(e.target)&&f(!1)};return document.addEventListener("pointerdown",e),()=>document.removeEventListener("pointerdown",e)},[h]);const x=(0,a.useCallback)(()=>{f(e=>!e)},[]),b="primary"===s?c.primary:c.surface,y="primary"===s?c.bg:c.text,v={default:{backgroundColor:b,borderBottom:`1px solid ${c.border}`},transparent:{backgroundColor:"transparent",borderBottom:"none"},elevated:{backgroundColor:b,boxShadow:`0 2px 8px ${c.bg}66`,borderBottom:"none"}},w="string"==typeof e?oe(e):e,k=u?"none":"max-height 300ms cubic-bezier(0.4,0,0.2,1), opacity 300ms ease";return(0,d.jsxs)("header",{role:"banner",className:mt("font-sans w-full"),style:{...{fixed:{position:"fixed",top:0,left:0,right:0,zIndex:1100},sticky:{position:"sticky",top:0,zIndex:1100},static:{position:"static"}}[i],...v[l],color:y,height:56},children:[(0,d.jsxs)("div",{ref:m,className:mt("flex items-center h-full px-4"),style:{maxWidth:1440,margin:"0 auto"},children:[t&&(0,d.jsx)("div",{className:mt("flex items-center shrink-0 mr-2"),children:t}),n&&(0,d.jsx)("div",{className:mt("flex items-center shrink-0 mr-3"),"aria-hidden":"true",children:n}),w&&(0,d.jsx)("div",{className:mt("text-base font-semibold shrink-0 mr-4 leading-snug"),style:{color:y},children:w}),!p&&o&&(0,d.jsx)("nav",{id:g,"aria-label":"Main navigation",className:mt("flex items-center flex-1 gap-1"),children:o}),p&&(0,d.jsx)("div",{className:mt("flex-1")}),r&&(0,d.jsx)("div",{className:mt("flex items-center gap-2 ml-auto shrink-0"),children:r}),p&&o&&(0,d.jsx)("button",{onClick:x,"aria-expanded":h,"aria-controls":g,"aria-label":h?"Close navigation menu":"Open navigation menu",className:mt("bg-transparent border-none cursor-pointer p-2 ml-2 rounded flex items-center justify-center","focus-visible:focus-ring"),style:{color:y},children:(0,d.jsx)(Uo,{open:h})})]}),p&&o&&(0,d.jsx)("nav",{id:g,"aria-label":"Main navigation",style:{maxHeight:h?400:0,opacity:h?1:0,overflow:"hidden",transition:k,backgroundColor:c.surface,borderBottom:h?`1px solid ${c.border}`:"none"},children:(0,d.jsx)("div",{className:mt("flex flex-col gap-1 px-4 py-3"),role:"menu",children:o})})]})},exports.TkxAutocomplete=function({options:e,value:t,onChange:n,onInputChange:r,placeholder:o="",label:i,isLoading:l=!1,emptyMessage:s,filterFn:u,freeSolo:p=!1,className:h,style:f}){const m=J(),g=Ot(),x=s??g.noResults,b=Te(),y=(0,a.useId)(),v=(0,a.useId)(),w=(0,a.useRef)(null),k=(0,a.useRef)(null),[$,S]=(0,a.useState)(""),[C,z]=(0,a.useState)(!1),[M,N]=(0,a.useState)(-1),[D,R]=(0,a.useState)(null);(0,a.useEffect)(()=>{if(void 0!==t){const n=e.find(e=>e.value===t);S(n?n.label:t)}},[t,e]);const P=u??Io,F=(0,a.useMemo)(()=>C?e.filter(e=>P(e,$)):[],[e,$,C,P]),I=oe(i),A=oe(x);(0,a.useEffect)(()=>{if(!C||!k.current)return;const e=()=>{k.current&&R(function(e){const t=e.getBoundingClientRect(),n=window.innerHeight-t.bottom,r=t.top,o=n>=284||n>=r?"below":"above";return{top:"below"===o?t.bottom+window.scrollY+4:t.top+window.scrollY-280-4,left:t.left+window.scrollX,width:t.width,placement:o}}(k.current))};return e(),window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}},[C]),(0,a.useEffect)(()=>{if(!C)return;const e=e=>{const t=e.target;k.current?.contains(t)||document.getElementById(v)?.contains(t)||z(!1)};return document.addEventListener("pointerdown",e),()=>document.removeEventListener("pointerdown",e)},[C,v]),Ee(()=>z(!1),C);const L=(0,a.useCallback)(e=>{e.disabled||(S(e.label),n?.(e.value),z(!1),N(-1),w.current?.focus())},[n]);(0,a.useEffect)(()=>{if(M<0)return;const e=`${v}-opt-${M}`;document.getElementById(e)?.scrollIntoView({block:"nearest"})},[M,v]);const T=M>=0?`${v}-opt-${M}`:void 0,W=b?{}:{animation:"tkxAutoFadeIn 120ms ease forwards"},j=C&&"undefined"!=typeof document&&D?(0,c.createPortal)((0,d.jsx)("ul",{id:v,role:"listbox","aria-label":I,className:mt("absolute z-[9200] list-none m-0 p-1 rounded-lg overflow-y-auto font-sans"),style:{top:D.top,left:D.left,width:D.width,maxHeight:280,backgroundColor:m.surface,border:`1px solid ${m.border}`,boxShadow:"0 8px 24px rgba(0,0,0,0.15)",...W},children:l?(0,d.jsxs)("li",{role:"option","aria-selected":!1,"aria-disabled":"true",className:mt("flex items-center gap-2 px-3 py-2 text-sm"),style:{color:m.textMuted},children:[(0,d.jsx)(Ao,{color:m.primary}),"Loading..."]}):0===F.length?(0,d.jsx)("li",{role:"option","aria-selected":!1,"aria-disabled":"true",className:mt("px-3 py-2 text-sm text-center"),style:{color:m.textMuted},children:A}):F.map((e,n)=>{const r=n===M,o=oe(e.label),i=e.description?oe(e.description):null;return(0,d.jsxs)("li",{id:`${v}-opt-${n}`,role:"option","aria-selected":e.value===t,"aria-disabled":e.disabled||void 0,className:mt("flex items-center gap-2 px-3 py-2 text-sm rounded-md cursor-pointer",e.disabled?"opacity-50 cursor-not-allowed":""),style:{backgroundColor:r?m.surfaceAlt:"transparent",color:e.disabled?m.textMuted:m.text,transition:b?"none":"background-color 100ms ease"},onMouseEnter:()=>!e.disabled&&N(n),onMouseDown:t=>{t.preventDefault(),L(e)},children:[e.icon&&(0,d.jsx)("span",{"aria-hidden":"true",className:mt("flex-shrink-0"),children:e.icon}),(0,d.jsxs)("span",{className:mt("flex flex-col min-w-0"),children:[(0,d.jsx)("span",{className:mt("truncate"),children:o}),i&&(0,d.jsx)("span",{className:mt("text-xs truncate"),style:{color:m.textMuted},children:i})]}),e.value===t&&(0,d.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:mt("ml-auto flex-shrink-0"),children:(0,d.jsx)("path",{d:"M3 8l3.5 3.5L13 5",stroke:m.primary,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},e.value)})}),document.body):null;return(0,d.jsxs)("div",{ref:k,className:mt("relative font-sans",h??""),style:f,children:[(0,d.jsx)("label",{htmlFor:y,className:mt("block text-sm font-medium mb-1.5"),style:{color:m.text},children:I}),(0,d.jsxs)("div",{className:mt("relative flex items-center"),style:{backgroundColor:m.surface,border:`1px solid ${C?m.primary:m.border}`,borderRadius:8,transition:b?"none":"border-color 150ms ease"},children:[(0,d.jsx)("input",{ref:w,id:y,type:"text",role:"combobox","aria-expanded":C,"aria-controls":v,"aria-activedescendant":T,"aria-autocomplete":"list","aria-label":I,value:$,placeholder:o,onChange:e=>{const t=Se(e.target.value);S(t),r?.(t),C||z(!0),N(-1),p&&n?.(t)},onFocus:()=>z(!0),onKeyDown:e=>{if(C||"ArrowDown"!==e.key&&"ArrowUp"!==e.key)switch(e.key){case"ArrowDown":e.preventDefault(),N(e=>{let t=e+1;for(;t<F.length&&F[t].disabled;)t++;return t<F.length?t:e});break;case"ArrowUp":e.preventDefault(),N(e=>{let t=e-1;for(;t>=0&&F[t].disabled;)t--;return t>=0?t:e});break;case"Enter":e.preventDefault(),M>=0&&M<F.length?L(F[M]):p&&$&&(n?.($),z(!1));break;case"Escape":z(!1),N(-1)}else z(!0)},className:mt("w-full bg-transparent border-none outline-none text-sm py-2.5 px-3","placeholder:opacity-50"),style:{color:m.text}}),l&&(0,d.jsx)("span",{className:mt("pr-3"),children:(0,d.jsx)(Ao,{color:m.primary})})]}),j,C&&!b&&(0,d.jsx)("style",{children:"\n @keyframes tkxAutoFadeIn {\n from { opacity: 0; transform: translateY(4px); }\n to { opacity: 1; transform: translateY(0); }\n }\n "})]})},exports.TkxAvatar=en,exports.TkxBadge=Pt,exports.TkxBillingCycleToggle=function({value:e,onChange:t,annualSavingsLabel:n,className:r,style:o}){const i=J(),a={display:"inline-flex",alignItems:"center",gap:8,padding:4,border:`1px solid ${i.border}`,borderRadius:999,background:i.surface,...o},l=e=>({padding:"6px 16px",borderRadius:999,fontSize:13,fontWeight:600,background:e?i.primary:"transparent",color:e?i.bg:i.text,border:"none",cursor:"pointer",transition:"background 0.15s, color 0.15s",display:"inline-flex",alignItems:"center",gap:6});return(0,d.jsxs)("div",{role:"radiogroup","aria-label":"Billing cycle",className:r,style:a,children:[(0,d.jsx)("button",{type:"button",role:"radio","aria-checked":"monthly"===e,onClick:()=>t("monthly"),style:l("monthly"===e),children:"Monthly"}),(0,d.jsxs)("button",{type:"button",role:"radio","aria-checked":"annual"===e,onClick:()=>t("annual"),style:l("annual"===e),children:["Annual",n&&(0,d.jsx)("span",{style:{fontSize:10,padding:"2px 6px",borderRadius:4,background:"annual"===e?i.bg:i.success,color:"annual"===e?i.success:i.bg,fontWeight:700},children:n})]})]})},exports.TkxBottomNav=function({items:e,activeId:t,onChange:n,showLabels:r=!0}){const o=J(),i=Te(),l=(0,a.useRef)(null);(0,a.useEffect)(()=>{!function(){if(Ko||"undefined"==typeof document)return;Ko=!0;const e=document.createElement("style");e.id="tkx-bottom-nav-kf",e.textContent="\n @keyframes tkx-bottom-nav-pulse {\n 0% { transform: scale(1); }\n 50% { transform: scale(1.15); }\n 100% { transform: scale(1); }\n }\n ",document.head.appendChild(e)}()},[]);const s=e.slice(0,5),c=(0,a.useCallback)(e=>{n?.(e)},[n]),u=(0,a.useCallback)(e=>{const t=l.current;if(!t)return;const n=Array.from(t.querySelectorAll('[role="tab"]')),r=n.findIndex(e=>e===document.activeElement);if(-1===r)return;let o=r;"ArrowRight"===e.key||"ArrowDown"===e.key?(e.preventDefault(),o=(r+1)%n.length):"ArrowLeft"===e.key||"ArrowUp"===e.key?(e.preventDefault(),o=(r-1+n.length)%n.length):"Home"===e.key?(e.preventDefault(),o=0):"End"===e.key&&(e.preventDefault(),o=n.length-1),o!==r&&(n[o].focus(),c(s[o].id))},[c,s]),p=i?"none":"color 200ms ease, transform 150ms ease";return(0,d.jsx)("nav",{ref:l,role:"navigation","aria-label":"Bottom navigation",className:mt("fixed bottom-0 left-0 right-0 z-[1000] font-sans"),style:{height:56,backgroundColor:o.surface,borderTop:`1px solid ${o.border}`,boxShadow:`0 -2px 12px ${o.bg}44`},children:(0,d.jsx)("div",{role:"tablist","aria-label":"Navigation tabs",className:mt("flex items-center justify-around h-full"),onKeyDown:u,children:s.map(e=>{const n=e.id===t,a=oe(e.label),l=n?o.primary:o.textMuted;return(0,d.jsxs)("button",{role:"tab","aria-selected":n,"aria-label":a,tabIndex:n?0:-1,onClick:()=>c(e.id),className:mt("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:l,transition:p,outline:"none"},children:[n&&(0,d.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",top:0,left:"25%",right:"25%",height:3,borderRadius:"0 0 3px 3px",backgroundColor:o.primary,transition:i?"none":"width 200ms ease"}}),(0,d.jsxs)("div",{className:mt("relative flex items-center justify-center"),style:{animation:n&&!i?"tkx-bottom-nav-pulse 300ms ease-out":"none"},children:[e.icon,void 0!==e.badge&&e.badge>0&&(0,d.jsx)("span",{"aria-label":`${e.badge} notifications`,className:mt("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:o.danger,color:o.bg},children:e.badge>99?"99+":e.badge})]}),r&&(0,d.jsx)("span",{className:mt("text-[10px] leading-tight mt-0.5"),style:{fontWeight:n?600:400,maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a})]},e.id)})})})},exports.TkxBreadcrumb=function({items:e,separator:t,maxItems:n,onNavigate:r,className:o,style:i}){const l=J(),s=Ot(),c=Te(),u=void 0!==n&&n>1&&e.length>n,p=(0,a.useCallback)(()=>{if(!u||!n)return e.map((e,t)=>({item:e,originalIndex:t}));const t=Math.ceil((n-1)/2),r=n-1-t,o=e.slice(0,t).map((e,t)=>({item:e,originalIndex:t})),i=e.slice(e.length-r).map((t,n)=>({item:t,originalIndex:e.length-r+n}));return o.concat(i)},[e,n,u])(),h=u&&n?Math.ceil((n-1)/2):-1,f=(e,t)=>{r?.(e,t)},m=c?{}:{transition:"color 150ms ease, background-color 150ms ease"},g=e=>(0,d.jsx)("li",{role:"presentation","aria-hidden":"true",className:mt("flex items-center mx-1.5"),children:t??(0,d.jsx)(Po,{color:l.textMuted})},e),x=(e,t,n)=>{const o=oe(e.label);if(n)return(0,d.jsx)("li",{children:(0,d.jsxs)("span",{"aria-current":"page",className:mt("inline-flex items-center gap-1.5 text-sm font-medium"),style:{color:l.text},children:[e.icon&&(0,d.jsx)("span",{"aria-hidden":"true",className:mt("flex-shrink-0"),children:e.icon}),o]})},`item-${t}`);const i=!!e.href,a={color:l.textMuted,textDecoration:"none",...m},s={onMouseEnter:e=>{e.currentTarget.style.color=l.primary},onMouseLeave:e=>{e.currentTarget.style.color=l.textMuted}},c=(0,d.jsxs)(d.Fragment,{children:[e.icon&&(0,d.jsx)("span",{"aria-hidden":"true",className:mt("flex-shrink-0"),children:e.icon}),o]});return i?(0,d.jsx)("li",{children:(0,d.jsx)("a",{href:e.href,onClick:n=>{r&&(n.preventDefault(),f(e,t))},className:mt("inline-flex items-center gap-1.5 text-sm rounded","outline-none focus-visible:ring-2 focus-visible:ring-offset-1"),style:{...a,focusRingColor:l.primary},...s,children:c})},`item-${t}`):(0,d.jsx)("li",{children:(0,d.jsx)("button",{type:"button",onClick:()=>f(e,t),onKeyDown:n=>((e,t,n)=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),f(t,n))})(n,e,t),className:mt("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:a,...s,children:c})},`item-${t}`)},b=[];let y=!1;for(let a=0;a<p.length;a++){const{item:t,originalIndex:n}=p[a],r=n===e.length-1;u&&!y&&a===h&&(b.length>0&&b.push(g("sep-ellipsis-before")),b.push((0,d.jsx)("li",{role:"presentation",children:(0,d.jsx)(Fo,{onClick:()=>{},bgColor:l.surfaceAlt,hoverColor:l.surface,textColor:l.textMuted,label:s.showHiddenItems??"Show hidden breadcrumb items"})},"ellipsis")),y=!0),b.length>0&&null!==b[b.length-1]&&b.push(g(`sep-${n}`)),b.push(x(t,n,r))}return(0,d.jsx)("nav",{"aria-label":s.breadcrumb??"Breadcrumb",className:mt("font-sans",o??""),style:{...i},children:(0,d.jsx)("ol",{role:"list",className:mt("flex items-center flex-wrap list-none m-0 p-0"),children:b})})},exports.TkxButton=Ct,exports.TkxCalendarHeatmap=function({data:e,endDate:t,startDate:n,colors:r,cellSize:o=11,gap:i=3,showMonthLabels:l=!0,showWeekdayLabels:s=!0,onCellClick:c,formatTooltip:u,ariaLabel:p,className:h,style:f}){const m=J(),[g,x]=(0,a.useState)(null),{end:b,start:y,weeks:v,valuesByDate:w,max:k,total:$}=(0,a.useMemo)(()=>{const r=t?zs(t):new Date,o=new Date(r);o.setUTCHours(0,0,0,0);const i=n?zs(n):Ms(o,-365),a=new Map;let l=0,s=0;for(const t of e){const e=Cs(zs(t.date)),n=(a.get(e)??0)+t.value;a.set(e,n),l+=t.value,n>s&&(s=n)}const d=[];let c=function(e){const t=new Date(e);return t.setUTCHours(0,0,0,0),t.setUTCDate(t.getUTCDate()-t.getUTCDay()),t}(i);for(;c<=o;){const e=[];for(let t=0;t<7;t++)e.push(Ms(c,t));d.push(e),c=Ms(c,7)}return{end:o,start:i,weeks:d,valuesByDate:a,max:s,total:l}},[e,n,t]),S=(0,a.useMemo)(()=>{if(r)return r;const e=m.primary;return[m.surface,`${e}33`,`${e}66`,`${e}AA`,e]},[r,m.primary,m.surface]),C=(0,a.useCallback)(u??(e=>{const t=zs(e.date).toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric",year:"numeric"});return e.value>0?`${e.value} on ${t}`:`No activity on ${t}`}),[u]),z=(0,a.useMemo)(()=>{const e=[];let t=-1;return v.forEach((n,r)=>{const o=n[0].getUTCMonth();o!==t&&(e.push({week:r,label:$s[o]}),t=o)}),e},[v]),M=p??`Activity heatmap from ${Cs(y)} to ${Cs(b)}. ${$} total events.`;return(0,d.jsxs)("div",{className:h,style:{display:"inline-block",position:"relative",color:m.text,...f},role:"img","aria-label":M,children:[l&&(0,d.jsxs)("div",{"aria-hidden":"true",style:{display:"grid",gridTemplateColumns:`${s?"24px ":""}repeat(${v.length}, ${o+i}px)`,marginBottom:4,fontSize:10,color:m.textMuted,position:"relative",height:14},children:[s&&(0,d.jsx)("div",{}),v.map((e,t)=>{const n=z.find(e=>e.week===t);return(0,d.jsx)("div",{style:{position:"relative",overflow:"visible"},children:n&&(0,d.jsx)("span",{style:{position:"absolute",top:0,left:0,whiteSpace:"nowrap",fontWeight:600},children:n.label})},t)})]}),(0,d.jsxs)("div",{style:{display:"flex",alignItems:"flex-start"},children:[s&&(0,d.jsx)("div",{"aria-hidden":"true",style:{display:"grid",gridTemplateRows:`repeat(7, ${o}px)`,rowGap:i,marginRight:4,fontSize:9,color:m.textMuted},children:Ss.map((e,t)=>(0,d.jsx)("div",{style:{height:o,lineHeight:`${o}px`,visibility:t%2==1?"visible":"hidden"},children:e},e))}),(0,d.jsx)("div",{role:"grid",style:{display:"grid",gridTemplateColumns:`repeat(${v.length}, ${o}px)`,columnGap:i},children:v.map((e,t)=>(0,d.jsx)("div",{role:"row",style:{display:"grid",gridTemplateRows:`repeat(7, ${o}px)`,rowGap:i},children:e.map((e,n)=>{if(e<y||e>b)return(0,d.jsx)("div",{"aria-hidden":"true"},n);const r=Cs(e),i=w.get(r)??0,a=function(e,t,n){if(e<=0)return n[0];if(t<=0)return n[0];const r=e/t;return r>.75?n[4]:r>.5?n[3]:r>.25?n[2]:n[1]}(i,k,S),l=C({date:r,value:i});return(0,d.jsx)("div",{role:"gridcell",tabIndex:0===n&&0===t?0:-1,"data-cell":`${t}-${n}`,"aria-label":l,onClick:()=>c?.({date:r,value:i}),onKeyDown:e=>{"Enter"===e.key||" "===e.key?(e.preventDefault(),c?.({date:r,value:i})):((e,t,n)=>{let r=null;const o=e.currentTarget.parentElement?.parentElement;function i(e,t){return o.querySelector(`[data-cell="${e}-${t}"]`)}o&&("ArrowRight"===e.key?r=i(t+1,n):"ArrowLeft"===e.key?r=i(t-1,n):"ArrowDown"===e.key?r=i(t,n+1):"ArrowUp"===e.key&&(r=i(t,n-1)),r&&(e.preventDefault(),r.focus()))})(e,t,n)},onMouseEnter:e=>{const t=e.target.getBoundingClientRect(),n=e.currentTarget.closest('[role="img"]')?.getBoundingClientRect();x({date:r,value:i,x:t.left-(n?.left??0)+t.width/2,y:t.top-(n?.top??0)})},onMouseLeave:()=>x(null),onFocus:e=>{const t=e.target.getBoundingClientRect(),n=e.currentTarget.closest('[role="img"]')?.getBoundingClientRect();x({date:r,value:i,x:t.left-(n?.left??0)+t.width/2,y:t.top-(n?.top??0)})},onBlur:()=>x(null),style:{width:o,height:o,background:a,borderRadius:2,cursor:c?"pointer":"default",border:`1px solid ${m.border}33`,outline:"none"}},n)})},t))})]}),(0,d.jsxs)("div",{"aria-hidden":"true",style:{marginTop:8,display:"flex",alignItems:"center",justifyContent:"flex-end",gap:6,fontSize:10,color:m.textMuted},children:[(0,d.jsx)("span",{children:"Less"}),S.map((e,t)=>(0,d.jsx)("span",{style:{width:o,height:o,background:e,borderRadius:2,border:`1px solid ${m.border}33`}},t)),(0,d.jsx)("span",{children:"More"})]}),g&&(0,d.jsx)("div",{role:"tooltip",style:{position:"absolute",left:g.x,top:g.y-8,transform:"translate(-50%, -100%)",padding:"4px 10px",background:m.surface,border:`1px solid ${m.border}`,borderRadius:6,fontSize:11,color:m.text,pointerEvents:"none",whiteSpace:"nowrap",zIndex:10,boxShadow:"0 4px 12px rgba(0,0,0,0.3)"},children:C({date:g.date,value:g.value})})]})},exports.TkxCalendarLunar=dl,exports.TkxCaptcha=Ma,exports.TkxCard=Mt,exports.TkxCardBody=function({children:e,className:t,...n}){return(0,d.jsx)("div",{className:xt(mt(""),t),...n,children:e})},exports.TkxCardFooter=function({children:e,className:t,style:n,...r}){const o=J();return(0,d.jsx)("div",{className:xt(mt("flex items-center justify-end gap-2 mt-4 pt-4"),t),style:{borderTop:`1px solid ${o.border}`,...n},...r,children:e})},exports.TkxCardHeader=function({title:e,subtitle:t,action:n,children:r,className:o,...i}){const a=J();return(0,d.jsxs)("div",{className:xt(mt("flex justify-between items-start mb-4"),o),...i,children:[(0,d.jsxs)("div",{className:mt("flex-1 min-w-0"),children:[e&&(0,d.jsx)("h3",{className:mt("text-base font-semibold m-0"),style:{color:a.text},children:e}),t&&(0,d.jsx)("p",{className:mt("text-sm mt-1 mb-0"),style:{color:a.textMuted},children:t}),r]}),n&&(0,d.jsx)("div",{className:mt("ml-3 shrink-0"),children:n})]})},exports.TkxCarousel=Ro,exports.TkxCascader=function({options:e,value:t=[],onChange:n,placeholder:r="Select...",label:o,multiple:i=!1}){const l=J(),s=Te(),u=(0,a.useRef)(null),p=(0,a.useRef)(null),[h,f]=(0,a.useState)(!1),[m,g]=(0,a.useState)(t),[x,b]=(0,a.useState)({top:0,left:0,width:0}),y=o?oe(o):void 0,v=oe(r),w=t.length>0?function(e,t){return va(e,t).map(e=>oe(e.label)).join(" / ")}(e,t):"";(0,a.useEffect)(()=>{if(!h||!u.current)return;const e=u.current.getBoundingClientRect();b({top:e.bottom+4+window.scrollY,left:e.left+window.scrollX,width:Math.max(e.width,200)})},[h]),(0,a.useEffect)(()=>{if(!h)return;const e=e=>{u.current?.contains(e.target)||p.current?.contains(e.target)||f(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[h]);const k=(0,a.useCallback)((t,r)=>{if(r.disabled)return;const o=[...m.slice(0,t),r.value];if(g(o),!r.children?.length){const t=va(e,o);n?.(o,t),i||f(!1)}},[m,e,n,i]),$=(0,a.useCallback)(e=>{"Escape"===e.key?(f(!1),u.current?.focus()):"Enter"!==e.key&&" "!==e.key||h||(e.preventDefault(),f(!0))},[h]),S=function(e,t){const n=[e];let r=e;for(const o of t){const e=r.find(e=>e.value===o);if(!e?.children?.length)break;n.push(e.children),r=e.children}return n}(e,m),C=h?(0,c.createPortal)((0,d.jsx)("div",{ref:p,role:"tree","aria-label":y??"Cascader options",className:mt("flex rounded-lg border overflow-hidden"),style:{position:"absolute",zIndex:9999,top:x.top,left:x.left,backgroundColor:l.surface,borderColor:l.border,boxShadow:`0 4px 16px ${l.bg}80`,animation:s?"none":"tkxFadeIn 0.15s ease"},children:S.map((e,t)=>(0,d.jsx)("ul",{role:"group",className:mt("m-0 p-0 overflow-auto"),style:{listStyle:"none",minWidth:160,maxHeight:260,borderRight:t<S.length-1?`1px solid ${l.border}`:"none"},children:e.map(e=>{const n=m[t]===e.value,r=oe(e.label);return(0,d.jsxs)("li",{role:"treeitem","aria-selected":n,"aria-disabled":e.disabled||void 0,"aria-expanded":e.children?.length?n:void 0,className:mt("flex items-center justify-between px-3 py-2 cursor-pointer text-sm"),style:{backgroundColor:n?l.surfaceAlt:"transparent",color:e.disabled?l.textMuted:l.text,opacity:e.disabled?.5:1,cursor:e.disabled?"not-allowed":"pointer"},onClick:()=>k(t,e),onMouseEnter:()=>{e.disabled||g(n=>[...n.slice(0,t),e.value])},children:[(0,d.jsx)("span",{children:r}),e.children&&e.children.length>0&&(0,d.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",style:{color:l.textMuted,flexShrink:0},children:(0,d.jsx)("path",{d:"M10 6l6 6-6 6V6z"})})]},e.value)})},t))}),document.body):null;return(0,d.jsxs)("div",{className:mt("relative font-sans"),onKeyDown:$,children:[y&&(0,d.jsx)("label",{className:mt("block text-sm font-medium mb-1"),style:{color:l.text},children:y}),(0,d.jsxs)("button",{ref:u,type:"button",role:"combobox","aria-expanded":h,"aria-haspopup":"tree","aria-label":y??"Cascader",className:mt("w-full flex items-center justify-between rounded-lg border px-3 py-2 text-sm cursor-pointer"),style:{backgroundColor:l.surface,borderColor:h?l.primary:l.border,color:w?l.text:l.textMuted,outline:"none",minHeight:38,textAlign:"left"},onClick:()=>f(e=>!e),children:[(0,d.jsx)("span",{className:mt("truncate"),children:w||v}),(0,d.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",style:{color:l.textMuted,transform:h?"rotate(180deg)":"rotate(0deg)",transition:s?"none":"transform 0.2s ease",flexShrink:0},children:(0,d.jsx)("path",{d:"M7 10l5 5 5-5H7z"})})]}),C]})},exports.TkxChat=function({messages:e,onSend:t,isLoading:n=!1,placeholder:r="Type a message…",maxLength:o,showTimestamps:i=!1,avatarUser:l,avatarAssistant:s,height:c=480,inputPosition:u="bottom"}){const p=J(),h=Te(),[f,m]=(0,a.useState)(""),g=(0,a.useRef)(null),x=(0,a.useRef)(null);(0,a.useEffect)(()=>{!function(){if(ur||"undefined"==typeof document)return;ur=!0;const e=document.createElement("style");e.textContent="\n @keyframes tkx-blink { 0%,100% { opacity:1 } 50% { opacity:0 } }\n @keyframes tkx-bounce { 0%,100% { transform:translateY(0) } 50% { transform:translateY(-5px) } }\n .tkx-cursor::after { content:'▋'; display:inline-block; animation:tkx-blink 1s step-start infinite; margin-left:1px; }\n .tkx-dot1 { animation:tkx-bounce 1s ease-in-out infinite; }\n .tkx-dot2 { animation:tkx-bounce 1s ease-in-out 0.2s infinite; }\n .tkx-dot3 { animation:tkx-bounce 1s ease-in-out 0.4s infinite; }\n ",document.head.appendChild(e)}()},[]),(0,a.useEffect)(()=>{const e=g.current;e&&e.scrollTo({top:e.scrollHeight,behavior:h?"auto":"smooth"})},[e,n,h]);const b=(0,a.useCallback)(()=>{const e=f.trim();e&&t&&(t(e),m(""),x.current&&(x.current.style.height="auto"))},[f,t]),y=(0,a.useCallback)(e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),b())},[b]),v=(0,a.useCallback)(e=>{m(o?e.target.value.slice(0,o):e.target.value);const t=x.current;if(t){t.style.height="auto";const e=120;t.style.height=`${Math.min(t.scrollHeight,e)}px`}},[o]),w=f.trim().length>0&&!n,k="number"==typeof c?`${c}px`:c,$="floating"===u,S=(0,d.jsxs)("div",{className:mt("flex flex-col gap-1 p-3"),style:$?{position:"absolute",bottom:12,left:12,right:12,borderRadius:16,backgroundColor:p.surface,border:`1px solid ${p.border}`,boxShadow:"0 4px 24px rgba(0,0,0,0.18)"}:{borderTop:`1px solid ${p.border}`,backgroundColor:p.surface},children:[(0,d.jsxs)("div",{className:mt("flex items-end gap-2"),children:[(0,d.jsx)("textarea",{ref:x,rows:1,value:f,onChange:v,onKeyDown:y,placeholder:oe(r),"aria-label":"Message input","aria-multiline":"true",disabled:n,className:mt("flex-1 resize-none text-sm leading-6 bg-transparent outline-none py-1"),style:{color:p.text,caretColor:p.primary,minHeight:32,maxHeight:120}}),(0,d.jsx)("button",{onClick:b,disabled:!w,"aria-label":"Send message",className:mt("shrink-0 w-9 h-9 rounded-xl flex items-center justify-center",!h&&"transition-opacity duration-150",w?"cursor-pointer opacity-100":"opacity-40 cursor-not-allowed"),style:{backgroundColor:p.primary,color:p.bg},children:(0,d.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M2 14L14 8 2 2v4.5l8 1.5-8 1.5V14z",fill:"currentColor"})})})]}),o&&(0,d.jsxs)("div",{className:mt("text-right text-[10px]"),style:{color:p.textMuted},children:[f.length,"/",o]})]});return(0,d.jsxs)("div",{className:mt("flex flex-col overflow-hidden rounded-2xl"),style:{height:k,backgroundColor:p.bg,border:`1px solid ${p.border}`,position:"relative"},children:[(0,d.jsx)("div",{ref:g,role:"log","aria-live":"polite","aria-label":"Chat messages",className:mt("flex-1 overflow-y-auto p-4"),style:{paddingBottom:$?80:void 0},children:(0,d.jsxs)("div",{role:"list",children:[e.map(e=>(0,d.jsx)(mr,{message:e,showTimestamp:i,avatarUser:l,avatarAssistant:s},e.id)),n&&(0,d.jsxs)("div",{role:"listitem",className:mt("flex gap-2 mb-4"),children:[(0,d.jsx)("div",{className:mt("w-8 h-8 shrink-0")}),(0,d.jsx)(fr,{})]})]})}),S]})},exports.TkxChatBubble=mr,exports.TkxCheckbox=dn,exports.TkxCheckout=cl,exports.TkxClock=Kr,exports.TkxCol=Ki,exports.TkxColorPicker=function({value:e,defaultValue:t="#3b82f6",onChange:n,format:r="hex",showAlpha:o=!1,presets:i=po,disabled:l=!1,size:s="md",placeholder:u,label:p,style:h}){const f=J(),m=(0,a.useRef)(null),g=(0,a.useRef)(null),[x,b]=(0,a.useState)(!1),y=void 0!==e,[v,w]=(0,a.useState)(y&&e||t),k=y?e||t:v,[$,S]=(0,a.useState)(1),[C,z]=(0,a.useState)(k),[M,N]=(0,a.useState)({top:0,left:0}),[D,R,P]=io(co(k)?k:t);Math.round(P+R/100*Math.min(P/100,1-P/100)*100);const F=(0,a.useCallback)((e,t=$)=>{co(e)&&(z(e),y||w(e),n?.(uo(e,t,r),r))},[$,y,r,n]);(0,a.useEffect)(()=>{y&&e&&co(e)&&z(e)},[y,e]),(0,a.useEffect)(()=>{if(!x)return;const e=e=>{g.current&&!g.current.contains(e.target)&&m.current&&!m.current.contains(e.target)&&b(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[x]),(0,a.useEffect)(()=>{if(!x)return;const e=e=>{"Escape"===e.key&&b(!1)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[x]);const I=e=>{S(e),n?.(uo(k,e,r),r)},A={sm:28,md:34,lg:40}[s],[L,T,W]=lo(co(k)?k:t),j={display:"inline-flex",alignItems:"center",gap:"8px",height:`${A}px`,padding:"4px 10px 4px 6px",borderRadius:"8px",border:`1px solid ${f.border}`,backgroundColor:f.surface,cursor:l?"not-allowed":"pointer",opacity:l?.5:1,color:f.text,fontSize:"13px",fontFamily:"inherit",transition:"border-color 0.15s",...h},E={width:A-8+"px",height:A-8+"px",borderRadius:"4px",backgroundColor:`rgba(${L},${T},${W},${$})`,border:`1px solid ${f.border}`,flexShrink:0},B={position:"absolute",top:M.top,left:M.left,zIndex:9999,width:"260px",backgroundColor:f.surface,border:`1px solid ${f.border}`,borderRadius:"12px",padding:"16px",boxShadow:"0 8px 32px rgba(0,0,0,0.24)",display:"flex",flexDirection:"column",gap:"12px"},V={width:"100%",padding:"6px 10px",borderRadius:"6px",border:`1px solid ${f.border}`,backgroundColor:f.bg,color:f.text,fontSize:"12px",fontFamily:"monospace",outline:"none"},H={flex:1,padding:"5px 6px",borderRadius:"6px",border:`1px solid ${f.border}`,backgroundColor:f.bg,color:f.text,fontSize:"11px",textAlign:"center",fontFamily:"monospace",outline:"none"},O=e=>({width:"20px",height:"20px",borderRadius:"50%",backgroundColor:e,border:e.toLowerCase()===k.toLowerCase()?`2px solid ${f.primary}`:`1px solid ${f.border}`,cursor:"pointer",flexShrink:0,transition:"transform 0.1s"});return(0,d.jsxs)(d.Fragment,{children:[p&&(0,d.jsx)("label",{style:{display:"block",fontSize:"13px",color:f.text,marginBottom:"6px",fontWeight:500},children:p}),(0,d.jsxs)("button",{ref:m,type:"button",style:j,onClick:()=>{if(l)return;const e=m.current;if(!e)return;const t=e.getBoundingClientRect();N({top:(window.innerHeight-t.bottom>320?t.bottom+6:t.top-326)+window.scrollY,left:t.left+window.scrollX}),b(!0)},disabled:l,"aria-label":`Color picker, current color ${k}`,"aria-haspopup":"dialog","aria-expanded":x,children:[(0,d.jsx)("div",{style:E}),(0,d.jsx)("span",{style:{fontFamily:"monospace",fontSize:"12px",color:f.textMuted},children:u??uo(co(k)?k:t,$,r)})]}),x&&(0,c.createPortal)((0,d.jsxs)("div",{ref:g,style:B,role:"dialog","aria-label":"Color picker",children:[(0,d.jsx)(ho,{hue:D,sat:R,bright:P,onChange:(e,t)=>{const n=t/100,r=n*(1-e/100/2),o=0===r||1===r?0:(n-r)/Math.min(r,1-r);F(ao(D,Math.round(100*o),Math.round(100*r)))}}),(0,d.jsx)(fo,{hue:D,onChange:e=>{F(ao(e,R,P))}}),o&&(0,d.jsx)(mo,{alpha:$,hex:co(k)?k:t,onChange:I}),(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,d.jsx)("div",{style:{width:"28px",height:"28px",borderRadius:"6px",flexShrink:0,backgroundColor:`rgba(${L},${T},${W},${$})`,border:`1px solid ${f.border}`}}),(0,d.jsx)("input",{style:V,value:C,onChange:e=>{const t=e.target.value;z(t),co(t)&&F(t)},maxLength:7,spellCheck:!1,"aria-label":"Hex color value"})]}),(0,d.jsxs)("div",{style:{display:"flex",gap:"6px",alignItems:"center"},children:[["r","g","b"].map(e=>(0,d.jsxs)("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:"3px",alignItems:"center"},children:[(0,d.jsx)("input",{style:H,type:"number",min:0,max:255,value:"r"===e?L:"g"===e?T:W,onChange:t=>((e,t)=>{const n=Math.max(0,Math.min(255,parseInt(t)||0)),[r,o,i]=lo(k);F("r"===e?so(n,o,i):"g"===e?so(r,n,i):so(r,o,n))})(e,t.target.value),"aria-label":`${e.toUpperCase()} channel`}),(0,d.jsx)("span",{style:{fontSize:"10px",color:f.textMuted,textTransform:"uppercase"},children:e})]},e)),o&&(0,d.jsxs)("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:"3px",alignItems:"center"},children:[(0,d.jsx)("input",{style:H,type:"number",min:0,max:100,value:Math.round(100*$),onChange:e=>I(Math.max(0,Math.min(1,parseInt(e.target.value)/100||0))),"aria-label":"Alpha channel"}),(0,d.jsx)("span",{style:{fontSize:"10px",color:f.textMuted},children:"A%"})]})]}),i.length>0&&(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{style:{fontSize:"11px",color:f.textMuted,marginBottom:"6px",fontWeight:500},children:"Presets"}),(0,d.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px"},children:i.map(e=>(0,d.jsx)("button",{type:"button",style:O(e),onClick:()=>F(e),"aria-label":`Select color ${e}`,onMouseEnter:e=>{e.currentTarget.style.transform="scale(1.15)"},onMouseLeave:e=>{e.currentTarget.style.transform="scale(1)"}},e))})]})]}),document.body)]})},exports.TkxCommand=No,exports.TkxCommandPalette=function({commands:e,hotkey:t=qs,open:n,onOpenChange:r,placeholder:o="Type a command…",onSelect:i,recents:l=!0,maxRecents:s=5,emptyState:u,className:p}){const[h,f]=(0,a.useState)(!1),m=n??h,g=(0,a.useCallback)(e=>{void 0===n&&f(e),r?.(e)},[n,r]),[x,b]=(0,a.useState)(""),[y,v]=(0,a.useState)([]),[w,k]=(0,a.useState)(0),$=(0,a.useRef)(null),S=(0,a.useRef)(null),C=(0,a.useId)();(0,a.useEffect)(()=>{if(!t)return;const e=e=>{e.key.toLowerCase()===t.key.toLowerCase()&&function(e,t){return!t||(Hs?e.metaKey:e.ctrlKey)}(e,t.ctrl??!0)&&(t.shift??!1)===e.shiftKey&&(t.alt??!1)===e.altKey&&(e.preventDefault(),g(!m))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t,m,g]),(0,a.useEffect)(()=>{m&&(b(""),k(0),requestAnimationFrame(()=>$.current?.focus()))},[m]);const z=(0,a.useMemo)(()=>{const t=e.filter(e=>!e.hidden);if(""===x.trim()){const e=[],n=new Set(l?y:[]),r=new Map(t.map(e=>[e.id,e]));if(l)for(const t of y){const n=r.get(t);n&&e.push({cmd:n,section:"Recents",score:0,recent:!0})}for(const o of t)n.has(o.id)||e.push({cmd:o,section:o.section??"Commands",score:0});return e}const n=[];for(const e of t){const t=Os(x,e.title),r=e.subtitle?Os(x,e.subtitle):null;let o=null;null!==t&&(o=t),null!==r&&(o=null===o?r-4:Math.max(o,r-4)),null!==o&&n.push({cmd:e,section:e.section??"Commands",score:o})}return n.sort((e,t)=>t.score-e.score),n},[e,x,y,l]),M=(0,a.useMemo)(()=>{const e=new Map,t=[];for(const n of z)e.has(n.section)||(e.set(n.section,[]),t.push(n.section)),e.get(n.section).push(n);return t.map(t=>({section:t,items:e.get(t)}))},[z]),N=(0,a.useMemo)(()=>M.flatMap(e=>e.items),[M]);(0,a.useEffect)(()=>{w>=N.length&&k(Math.max(0,N.length-1))},[N.length,w]);const D=(0,a.useCallback)(e=>{i?.(e),e.onSelect?.(e),v(t=>[e.id,...t.filter(t=>t!==e.id)].slice(0,s)),g(!1)},[i,g,s]);if((0,a.useEffect)(()=>{S.current&&S.current.querySelector(`[data-idx="${w}"]`)?.scrollIntoView({block:"nearest"})},[w]),!m)return null;if("undefined"==typeof document)return null;const R=`${C}-opt-${w}`;return(0,c.createPortal)((0,d.jsx)("div",{role:"dialog","aria-modal":"true","aria-label":"Command palette",className:p,onClick:()=>g(!1),"data-testid":"tkx-command-palette",style:{position:"fixed",inset:0,zIndex:9999,display:"flex",alignItems:"flex-start",justifyContent:"center",padding:"min(15vh, 120px) 16px 16px",background:"rgba(8, 10, 25, 0.6)",backdropFilter:"blur(8px)"},children:(0,d.jsxs)("div",{onClick:e=>e.stopPropagation(),onKeyDown:e=>{switch(e.key){case"ArrowDown":e.preventDefault(),k(e=>Math.min(N.length-1,e+1));break;case"ArrowUp":e.preventDefault(),k(e=>Math.max(0,e-1));break;case"Enter":{e.preventDefault();const t=N[w];t&&D(t.cmd);break}case"Escape":e.preventDefault(),g(!1);break;case"Home":e.preventDefault(),k(0);break;case"End":e.preventDefault(),k(N.length-1)}},style:{width:"100%",maxWidth:560,maxHeight:"70vh",display:"flex",flexDirection:"column",background:"rgba(18, 20, 38, 0.92)",backdropFilter:"blur(20px) saturate(140%)",border:"1px solid rgba(196,168,255,0.25)",borderRadius:14,boxShadow:"0 24px 64px rgba(0,0,0,0.55), 0 0 0 1px rgba(0,245,212,0.08)",overflow:"hidden",color:"#e8e8f4"},children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"14px 18px",borderBottom:"1px solid rgba(255,255,255,0.08)"},children:[(0,d.jsx)("span",{"aria-hidden":"true",style:{fontSize:18,opacity:.7},children:"🔍"}),(0,d.jsx)("input",{ref:$,role:"combobox","aria-expanded":!0,"aria-controls":`${C}-list`,"aria-activedescendant":N.length?R:void 0,value:x,onChange:e=>{b(e.target.value),k(0)},placeholder:o,"data-testid":"cmdk-input",style:{flex:1,border:"none",outline:"none",background:"transparent",fontSize:15,color:"inherit",fontFamily:"inherit",minWidth:0}}),(0,d.jsx)("kbd",{"aria-hidden":"true",style:{fontSize:10,fontWeight:700,padding:"2px 6px",borderRadius:4,border:"1px solid rgba(255,255,255,0.12)",color:"#aaa",background:"rgba(255,255,255,0.04)",fontFamily:"ui-monospace, monospace"},children:"ESC"})]}),(0,d.jsxs)("ul",{ref:S,id:`${C}-list`,role:"listbox","data-testid":"cmdk-list",style:{listStyle:"none",margin:0,padding:6,overflow:"auto",flex:1,minHeight:0},children:[0===N.length&&(0,d.jsx)("li",{"data-testid":"cmdk-empty",style:{padding:"24px 16px",textAlign:"center",color:"#888",fontSize:13},children:u??`No matches for "${x}"`}),M.map(e=>{const t=N.indexOf(e.items[0]);return(0,d.jsxs)("li",{role:"presentation",children:[(0,d.jsx)("div",{style:{padding:"8px 12px 4px",fontSize:10,fontWeight:700,letterSpacing:"0.08em",textTransform:"uppercase",color:"#888"},children:e.section}),(0,d.jsx)("ul",{role:"presentation",style:{listStyle:"none",margin:0,padding:0},children:e.items.map((e,n)=>{const r=t+n,o=r===w;return(0,d.jsxs)("li",{id:r===w?R:void 0,role:"option","aria-selected":o,"data-testid":`cmdk-item-${e.cmd.id}`,"data-idx":r,onMouseMove:()=>k(r),onClick:()=>D(e.cmd),style:Us(o),children:[e.cmd.icon&&(0,d.jsx)("span",{"aria-hidden":"true",style:{fontSize:16,opacity:.9},children:e.cmd.icon}),(0,d.jsxs)("span",{style:{flex:1,minWidth:0},children:[(0,d.jsx)("span",{style:{fontWeight:600,fontSize:13.5,color:"#e8e8f4",display:"block"},children:e.cmd.title}),e.cmd.subtitle&&(0,d.jsx)("span",{style:{fontSize:12,color:"#aaa",display:"block"},children:e.cmd.subtitle})]}),e.cmd.shortcut&&(0,d.jsx)("span",{style:{display:"inline-flex",gap:4},children:e.cmd.shortcut.map((e,t)=>(0,d.jsx)("kbd",{style:Ks(o),children:e},t))})]},e.cmd.id)})})]},e.section)})]})]})}),document.body)},exports.TkxConfetti=tl,exports.TkxConfigProvider=Xi,exports.TkxContent=Ei,exports.TkxCountdown=function({title:e,value:t,format:n="HH:mm:ss",onFinish:r,prefix:o,suffix:i,style:l}){const s=J(),d=oe(e),c=(0,a.useRef)(r);c.current=r;const u=(0,a.useRef)(!1),[p,h]=(0,a.useState)(()=>Math.max(0,t-Date.now()));(0,a.useEffect)(()=>{u.current=!1;const e=()=>{const e=Math.max(0,t-Date.now());h(e),e<=0&&!u.current&&(u.current=!0,c.current?.())};e();const n=setInterval(e,1e3);return()=>clearInterval(n)},[t]);const f=function(e,t){if(e<=0)return t.replace(/DD?/g,"0").replace(/HH?/g,"00").replace(/mm?/g,"00").replace(/ss?/g,"00");const n=Math.floor(e/1e3),r=Math.floor(n/86400),o=Math.floor(n%86400/3600),i=Math.floor(n%3600/60),a=n%60,l=e=>String(e).padStart(2,"0");return t.replace(/DD/g,l(r)).replace(/D/g,String(r)).replace(/HH/g,l(o)).replace(/H/g,String(o)).replace(/mm/g,l(i)).replace(/m/g,String(i)).replace(/ss/g,l(a)).replace(/s/g,String(a))}(p,n);return(0,a.createElement)("div",{style:{display:"flex",flexDirection:"column",gap:"4px",...l}},(0,a.createElement)("div",{style:{color:s.textMuted,fontSize:"0.875rem",lineHeight:"1.4"}},d),(0,a.createElement)("div",{style:{display:"flex",alignItems:"baseline",gap:"4px",fontSize:"1.75rem",fontWeight:700,lineHeight:"1.2",color:p<=0?s.danger:s.text,fontVariantNumeric:"tabular-nums"}},o&&(0,a.createElement)("span",{style:{fontSize:"0.75em",fontWeight:400}},o),(0,a.createElement)("span",null,f),i&&(0,a.createElement)("span",{style:{fontSize:"0.6em",fontWeight:400,color:s.textMuted}},i)))},exports.TkxCurrencyInput=Ja,exports.TkxDataGrid=function({columns:e,data:t,rowKey:n,selectable:r=!1,selectedRows:o=[],onSelectionChange:i,sortable:l=!1,onSort:s,loading:c=!1,emptyMessage:u,stickyHeader:p=!1,striped:h=!1,bordered:f=!1,compact:m=!1,maxHeight:g,onRowClick:x,virtualScroll:b,rowHeight:y=40,showFilters:v=!1,filterValues:w,onFilterChange:k,pageSize:$=0,showExport:S=!1,exportFileName:C="export",onLoadMore:z,hasMore:M,loadingMore:N=!1,loadMoreThreshold:D=200,groupBy:R,defaultExpandedGroups:P="all",onGroupToggle:F,onCellEdit:I,onCellEditStart:A,onCellEditCancel:L,childRowsKey:T,defaultExpandedRows:W="none",onRowExpand:j,indentSize:E=24}){const B=J(),V=Ot(),H=u??V.noRows??V.noData??"No data to display",O=Te(),q=(0,a.useId)(),[U,K]=(0,a.useState)(null),[Y,X]=(0,a.useState)("asc"),Z=(0,a.useCallback)(e=>{const t=U===e&&"asc"===Y?"desc":"asc";K(e),X(t),s?.(e,t)},[U,Y,s]),G=(0,a.useMemo)(()=>s||!U?t:[...t].sort((e,t)=>{const n=ni(ti(e,U),ti(t,U));return"asc"===Y?n:-n}),[t,U,Y,s]),[_,Q]=(0,a.useState)({}),ee=w??_,te=(0,a.useCallback)((e,t)=>{k?k(e,t):Q(n=>({...n,[e]:t}))},[k]),ne=(0,a.useMemo)(()=>{const e=Object.entries(ee).filter(([,e])=>""!==e.trim());return 0===e.length?G:G.filter(t=>e.every(([e,n])=>{const r=ti(t,e);return String(r??"").toLowerCase().includes(n.toLowerCase())}))},[G,ee]),re=(0,a.useMemo)(()=>{if(R&&e.some(e=>e.key===R))return R},[R,e]),ie=(0,a.useMemo)(()=>{if(!re)return[];const e=new Map;for(const t of ne){const n=t[re],r=String(n??""),o=e.get(r);o?o.push(t):e.set(r,[t])}return Array.from(e.entries()).map(([e,t])=>({key:e,rows:t}))},[ne,re]),[ae,le]=(0,a.useState)((0,a.useMemo)(()=>"none"===P?new Set:Array.isArray(P)?new Set(P):new Set,[P])),se=(0,a.useRef)(new Set);(0,a.useEffect)(()=>{if(!re||"all"!==P)return;let e=!1;le(t=>{const n=new Set(t);for(const r of ie)se.current.has(r.key)||(se.current.add(r.key),n.add(r.key),e=!0);return e?n:t})},[ie,re,P]);const de=(0,a.useCallback)(e=>{le(t=>{const n=new Set(t),r=!n.has(e);return r?n.add(e):n.delete(e),F?.(e,r),n})},[F]),ce=(0,a.useMemo)(()=>{if(!re)return ne.map(e=>({type:"row",row:e}));const e=[];for(const t of ie)if(e.push({type:"group",key:t.key,rows:t.rows}),ae.has(t.key))for(const n of t.rows)e.push({type:"row",row:n});return e},[re,ne,ie,ae]),ue=(0,a.useRef)(!1),pe=(0,a.useRef)(!1),he=(0,a.useRef)(!1),fe=(0,a.useMemo)(()=>!(!T||re&&(ue.current||(ue.current=!0),1)),[T,re]),me=(0,a.useMemo)(()=>{if(fe)return e.find(e=>e.tree)?.key},[e,fe]),ge=(0,a.useCallback)((e,t,r)=>{if(!(t>32))for(const o of e){const e=o[T??""];if(Array.isArray(e)&&e.length>0){const i=ei(o,n);i&&"undefined"!==i&&"null"!==i&&r.add(i),ge(e,t+1,r)}}},[T,n]),[xe,be]=(0,a.useState)((0,a.useMemo)(()=>{if(!fe)return new Set;if("none"===W)return new Set;if("all"===W){const e=new Set;return ge(t,0,e),e}return new Set(W.map(String))},[fe,W,t,ge])),ye=(0,a.useRef)(null);(0,a.useEffect)(()=>{if(!fe)return;if("all"!==W)return;if(ye.current===t)return;ye.current=t;const e=new Set;ge(t,0,e),be(t=>{const n=new Set(t);for(const r of e)n.add(r);return n})},[fe,W,t,ge]);const ve=(0,a.useCallback)(e=>{be(t=>{const n=new Set(t),r=!n.has(e);return r?n.add(e):n.delete(e),j?.(e,r),n})},[j]),we=(0,a.useMemo)(()=>{if(!fe||!T)return[];const e=[];let t=!1,r=!1;const o=(i,a)=>{if(a>32)return void(t=!0);const l=0===a?i:(e=>s||!U?e:[...e].sort((e,t)=>{const n=ni(ti(e,U),ti(t,U));return"asc"===Y?n:-n}))(i);for(let t=0;t<l.length;t++){const i=l[t],s=ei(i,n);if(!s||"undefined"===s||"null"===s){r=!0;continue}const d=i[T],c=Array.isArray(d)?d:[],u=c.length>0,p=u&&xe.has(s);e.push({row:i,depth:a,hasChildren:u,isExpanded:p,siblingCount:l.length,siblingIndex:t,id:s}),p&&o(c,a+1)}};return o(ne,0),r&&!pe.current&&(pe.current=!0),t&&!he.current&&(he.current=!0),e},[fe,T,ne,xe,n,U,Y,s]),[ke,$e]=(0,a.useState)(1),Se=$>0,Ce=fe?we.length:ce.length,ze=Se?Math.max(1,Math.ceil(Ce/$)):1;(0,a.useEffect)(()=>{$e(1)},[ee,U,Y]);const Me=(0,a.useMemo)(()=>Se?ce.slice((ke-1)*$,ke*$):ce,[ce,Se,ke,$]),Ne=(0,a.useMemo)(()=>fe?Se?we.slice((ke-1)*$,ke*$):we:[],[fe,we,Se,ke,$]),De=(0,a.useMemo)(()=>re||fe?[]:Se?ne.slice((ke-1)*$,ke*$):ne,[ne,Se,ke,$,re,fe]),Re=void 0!==b?b:!Se&&void 0!==g&&De.length>=50,Pe=(0,a.useRef)(null),[Fe,Ie]=(0,a.useState)(0),[Ae,Le]=(0,a.useState)(0),We=(0,a.useCallback)(()=>{Pe.current&&Ie(Pe.current.scrollTop)},[]);(0,a.useEffect)(()=>{if(!Re||!Pe.current)return;const e=Pe.current;Le(e.clientHeight);const t=new ResizeObserver(()=>Le(e.clientHeight));return t.observe(e),()=>t.disconnect()},[Re]);const je=fe?Ne:De;je.length;const Ee=Re?Math.max(0,Math.floor(Fe/y)-10):0,Be=Re?Math.min(je.length,Math.ceil((Fe+Ae)/y)+10):je.length,Ve=Re?De.slice(Ee,Be):De,He=fe?Re?Ne.slice(Ee,Be):Ne:[],Oe=Ee*y,qe=(0,a.useRef)(null),Ue=(0,a.useRef)(!1);(0,a.useEffect)(()=>{Ue.current=!1},[t.length]),(0,a.useEffect)(()=>{if(!z)return;const e=qe.current;if(!e)return;const t=new IntersectionObserver(e=>{e[0].isIntersecting&&!Ue.current&&!1!==M&&(Ue.current=!0,z())},{root:Pe.current,rootMargin:`0px 0px ${D}px 0px`,threshold:0});return t.observe(e),()=>t.disconnect()},[z,M,D]);const Ke=(0,a.useMemo)(()=>new Set(o),[o]),Ye=(0,a.useMemo)(()=>ne.map(e=>ei(e,n)),[ne,n]),Xe=Ye.length>0&&Ye.every(e=>Ke.has(e)),Ze=Ye.some(e=>Ke.has(e)),Ge=(0,a.useCallback)(()=>{i?.(Xe?[]:Ye)},[Xe,Ye,i]),_e=(0,a.useCallback)(e=>{const t=Ke.has(e)?o.filter(t=>t!==e):[...o,e];i?.(t)},[Ke,o,i]),[Je,Qe]=(0,a.useState)({}),et=(0,a.useRef)(null),tt=(0,a.useMemo)(()=>{const t={},n=e.filter(e=>"left"===e.pinned),o=e.filter(e=>"right"===e.pinned),i=e=>{const t=Je[e.key]??e.width;if("number"==typeof t)return t;if("string"==typeof t){const e=parseFloat(t);if(!Number.isNaN(e))return e}return 150};let a=r?40:0;n.forEach((e,r)=>{t[e.key]={side:"left",offset:a,isEdge:r===n.length-1},a+=i(e)});let l=0;for(let e=o.length-1;e>=0;e--){const n=o[e];t[n.key]={side:"right",offset:l,isEdge:0===e},l+=i(n)}return t},[e,Je,r]),nt=Object.keys(tt).length>0,[rt,ot]=(0,a.useState)(!1),[it,at]=(0,a.useState)(!1),lt=(0,a.useRef)(null),st=(0,a.useCallback)(()=>{const e=Pe.current;e&&(ot(e.scrollLeft>0),at(e.scrollLeft+e.clientWidth<e.scrollWidth-1))},[]),dt=(0,a.useCallback)(()=>{null==lt.current&&(lt.current=requestAnimationFrame(()=>{lt.current=null,st()}))},[st]);(0,a.useEffect)(()=>{if(nt)return st(),()=>{null!=lt.current&&cancelAnimationFrame(lt.current)}},[nt,st,e.length]);const ct=(0,a.useCallback)((e,t)=>{const n=tt[e.key];if(!n)return{};const r="left"===n.side&&n.isEdge&&rt,o="right"===n.side&&n.isEdge&&it,i=r?"2px 0 4px rgba(0,0,0,0.15)":o?"-2px 0 4px rgba(0,0,0,0.15)":void 0;return{position:"sticky",[n.side]:n.offset,zIndex:t?3:2,backgroundColor:B.surface,boxShadow:i}},[tt,rt,it,B.surface]),ut=(0,a.useCallback)((e,t)=>{t.preventDefault(),t.stopPropagation();const n=t.target.closest("th");if(!n)return;const r=Je[e]||n.getBoundingClientRect().width;et.current={key:e,startX:t.clientX,startWidth:r};const o=e=>{if(!et.current)return;const t=Math.max(50,et.current.startWidth+e.clientX-et.current.startX);Qe(e=>({...e,[et.current.key]:t}))},i=()=>{et.current=null,document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",i)};document.addEventListener("mousemove",o),document.addEventListener("mouseup",i)},[Je]),pt=(0,a.useCallback)(()=>{const t=[e.map(e=>ri(e.header)).join(","),...ne.map(t=>e.map(e=>ri(ti(t,e.key))).join(","))].join("\n"),n=new Blob([t],{type:"text/csv;charset=utf-8;"}),r=URL.createObjectURL(n),o=document.createElement("a");o.href=r,o.download=`${C}.csv`,o.click(),URL.revokeObjectURL(r)},[e,ne,C]),[ht,ft]=(0,a.useState)(null),[gt,xt]=(0,a.useState)(null),bt=(0,a.useRef)(null),yt=(0,a.useRef)(new Map),vt=(0,a.useRef)(!1),wt=(0,a.useCallback)((e,t)=>{if(null==e.editable||!1===e.editable)return!1;if("function"==typeof e.editable)try{return e.editable(t)}catch{return!1}return!0===e.editable},[]),kt=(0,a.useCallback)((e,t,n)=>{"undefined"!==e&&"null"!==e&&""!==e?(ft({rowId:e,columnKey:t.key}),A?.({rowId:e,columnKey:t.key,row:n})):vt.current||(vt.current=!0)},[A]),$t=(0,a.useCallback)((e,t)=>{bt.current={rowId:e,columnKey:t},ft(null)},[]);(0,a.useEffect)(()=>{if(null!==ht||!bt.current)return;const{rowId:e,columnKey:t}=bt.current,n=`${e}::${t}`,r=yt.current.get(n);r&&r.focus(),bt.current=null},[ht]);const St=(0,a.useCallback)((e,t,r)=>{const o=ei(e,n),i=ti(e,t.key);if(i===r)return void $t(o,t.key);const a=I?.({rowId:o,columnKey:t.key,newValue:r,oldValue:i,row:e});a&&"function"==typeof a.then?(xt({rowId:o,columnKey:t.key}),$t(o,t.key),a.catch(()=>{}).finally(()=>{xt(e=>e&&e.rowId===o&&e.columnKey===t.key?null:e)})):$t(o,t.key)},[n,I,$t]),Ct=(0,a.useCallback)((e,t)=>{const r=ei(e,n);L?.({rowId:r,columnKey:t.key,row:e}),$t(r,t.key)},[n,L,$t]),zt=m?"4px":"8px",Mt=m?"8px":"12px",Nt=e=>{const t=Je[e.key]||e.width;return{width:null!=t?t:void 0,minWidth:null!=t?t:80,textAlign:e.align??"left",padding:`${zt} ${Mt}`}},Dt=f?`1px solid ${B.border}`:"none",Rt=oe(H),Pt=e.length+(r?1:0),Ft=e.some(e=>e.filterable);return(0,d.jsxs)("div",{role:fe?"treegrid":"grid","aria-label":"Data grid","aria-rowcount":Ce,id:q,className:mt("font-sans rounded-lg overflow-hidden"),style:{border:`1px solid ${B.border}`,backgroundColor:B.bg},children:[(0,d.jsx)(ii,{label:"data grid",showExport:S,onExport:pt,totalRows:Ce,selectedCount:o.length,theme:B}),(0,d.jsxs)("div",{ref:Pe,"data-scrolled-left":nt&&rt?"":void 0,"data-scrolled-right":nt&&it?"":void 0,onScroll:e=>{Re&&We(),nt&&dt()},style:{maxHeight:g??"none",overflowX:"auto",overflowY:g?"auto":"visible"},children:[(0,d.jsxs)("table",{className:mt("w-full"),style:{borderCollapse:"separate",borderSpacing:0,tableLayout:"auto"},children:[(0,d.jsxs)("thead",{children:[(0,d.jsxs)("tr",{role:"row",children:[r&&(0,d.jsx)("th",{scope:"col",role:"columnheader",style:{position:p||nt?"sticky":"static",top:0,left:nt?0:void 0,zIndex:3,backgroundColor:B.surface,borderBottom:`2px solid ${B.border}`,borderRight:Dt,padding:`${zt} ${Mt}`,width:40,textAlign:"center"},children:(0,d.jsxs)("label",{style:{display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",margin:"0 auto",width:16},children:[(0,d.jsx)("input",{type:"checkbox",checked:Xe,ref:e=>{e&&(e.indeterminate=Ze&&!Xe)},onChange:Ge,"aria-label":Xe?"Deselect all rows":"Select all rows",style:{position:"absolute",opacity:0,width:16,height:16,cursor:"pointer",margin:0}}),(0,d.jsx)(Qo,{checked:Xe,indeterminate:Ze&&!Xe})]})}),e.map(e=>{const t=(e.sortable??l)&&!1!==e.sortable,n=U===e.key,r=oe(e.header),o=ct(e,!0),i=!!tt[e.key];return(0,d.jsx)("th",{scope:"col",role:"columnheader","data-pinned":tt[e.key]?.side,"aria-sort":n?"asc"===Y?"ascending":"descending":t?"none":void 0,className:mt("text-xs font-semibold uppercase tracking-wider"),style:{...Nt(e),position:p||i?"sticky":"static",top:0,zIndex:i?o.zIndex:2,backgroundColor:B.surface,color:B.textMuted,borderBottom:`2px solid ${B.border}`,borderRight:Dt,cursor:t?"pointer":"default",userSelect:"none",whiteSpace:"nowrap",transition:O?"none":"background-color 150ms ease",...o},onClick:t?()=>Z(e.key):void 0,onKeyDown:t?t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),Z(e.key))}:void 0,tabIndex:t?0:void 0,children:(0,d.jsxs)("div",{className:mt("flex items-center gap-1"),style:{position:"relative"},children:[e.renderHeader?e.renderHeader(e):r,t&&(0,d.jsx)(Go,{direction:n?Y:null}),e.resizable&&(0,d.jsx)("div",{role:"separator","aria-orientation":"vertical","aria-label":`Resize column ${r}`,className:mt("cursor-col-resize shrink-0"),style:{position:"absolute",right:0,top:0,bottom:0,width:4,backgroundColor:"transparent"},onMouseDown:t=>ut(e.key,t)})]})},e.key)})]}),(v||Ft)&&(0,d.jsxs)("tr",{role:"row","aria-label":"Column filters",children:[r&&(0,d.jsx)("th",{scope:"col",style:{backgroundColor:B.surfaceAlt,borderBottom:`1px solid ${B.border}`,borderRight:Dt,padding:`4px ${Mt}`,width:40,...nt?{position:"sticky",left:0,zIndex:2}:{}}}),e.map(e=>{const t=tt[e.key];return(0,d.jsx)("th",{scope:"col","data-pinned":t?.side,style:{backgroundColor:B.surfaceAlt,borderBottom:`1px solid ${B.border}`,borderRight:Dt,padding:`4px ${Mt}`,...t?{position:"sticky",[t.side]:t.offset,zIndex:2}:{}},children:(e.filterable||v)&&(0,d.jsx)("input",{type:"text",value:ee[e.key]??"",onChange:t=>te(e.key,t.target.value),placeholder:`${V.filterPlaceholder.replace(/[.…]+$/,"")} ${e.header}…`,"aria-label":`Filter by ${e.header}`,style:{width:"100%",padding:"3px 8px",fontSize:12,borderRadius:4,border:`1px solid ${B.border}`,backgroundColor:B.bg,color:B.text,outline:"none"}})},e.key)})]})]}),c&&(0,d.jsx)(oi,{colCount:Pt}),!c&&(0,d.jsx)("tbody",{children:(fe?0===we.length:0===Me.length)?(0,d.jsx)("tr",{children:(0,d.jsx)("td",{colSpan:Pt,className:mt("text-center py-10"),style:{color:B.textMuted},children:Rt})}):fe?(0,d.jsx)(d.Fragment,{children:He.map(t=>{const{row:n,depth:o,hasChildren:i,isExpanded:a,siblingCount:l,siblingIndex:s,id:c}=t,u=Ke.has(c),p=h&&s%2==1;let f="transparent";return u?f=`${B.primary}22`:p&&(f=B.surfaceAlt),(0,d.jsxs)("tr",{role:"row","data-tree-row":"","data-tree-depth":o,"aria-level":o+1,"aria-setsize":l,"aria-posinset":s+1,"aria-expanded":i?a:void 0,"aria-selected":r?u:void 0,onClick:x?()=>x(n):void 0,onKeyDown:x?e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),x(n))}:void 0,tabIndex:x?0:void 0,className:mt(x?"cursor-pointer":""),style:{backgroundColor:f,transition:O?"none":"background-color 120ms ease"},children:[r&&(0,d.jsx)("td",{role:"gridcell",style:{borderBottom:`1px solid ${B.border}`,borderRight:Dt,padding:`${zt} ${Mt}`,textAlign:"center",width:40,...nt?{position:"sticky",left:0,zIndex:2,backgroundColor:B.surface}:{}},children:(0,d.jsxs)("label",{style:{display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",margin:"0 auto",width:16},onClick:e=>e.stopPropagation(),children:[(0,d.jsx)("input",{type:"checkbox",checked:u,onChange:()=>_e(c),"aria-label":u?`Deselect row ${c}`:`Select row ${c}`,style:{position:"absolute",opacity:0,width:16,height:16,cursor:"pointer",margin:0}}),(0,d.jsx)(Qo,{checked:u})]})}),e.map(e=>{const t=ti(n,e.key),r=e.renderCell?e.renderCell(t,n):"string"==typeof t?oe(t):String(t??""),l=ct(e,!1),s=wt(e,n),u=ht?.rowId===c&&ht.columnKey===e.key,p=gt?.rowId===c&&gt.columnKey===e.key,h=`${c}::${e.key}`,f=e.key===me,m="string"==typeof t&&t?t:String(c);return(0,d.jsx)("td",{role:"gridcell","data-pinned":tt[e.key]?.side,"data-tree-cell":f?"":void 0,"data-editing":u?"":void 0,"data-saving":p?"":void 0,"aria-readonly":s?"false":void 0,tabIndex:s?0:void 0,ref:e=>{e?yt.current.set(h,e):yt.current.delete(h)},onDoubleClick:s&&!u?t=>{t.stopPropagation(),kt(c,e,n)}:void 0,onKeyDown:s&&!u?t=>{"Enter"!==t.key&&"F2"!==t.key||(t.preventDefault(),t.stopPropagation(),kt(c,e,n))}:void 0,className:mt("text-sm"),style:{...Nt(e),borderBottom:`1px solid ${B.border}`,borderRight:Dt,color:B.text,overflow:u?"visible":"hidden",textOverflow:"ellipsis",whiteSpace:u?"normal":"nowrap",opacity:p?.6:1,cursor:s&&!u?"text":void 0,...l},children:u?(0,d.jsx)(li,{col:e,row:n,initialValue:t,onCommit:t=>St(n,e,t),onCancel:()=>Ct(n,e)}):f?(0,d.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:0},children:[(0,d.jsx)("span",{"aria-hidden":"true",style:{display:"inline-block",width:o*E,flexShrink:0}}),i?(0,d.jsx)("button",{type:"button","data-tree-caret":"","aria-label":a?`Collapse ${m}`:`Expand ${m}`,onClick:e=>{e.stopPropagation(),ve(c)},onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),e.stopPropagation(),ve(c))},style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:16,height:16,marginRight:6,padding:0,border:"none",background:"transparent",color:B.text,cursor:"pointer",flexShrink:0},children:(0,d.jsx)(Jo,{expanded:a})}):(0,d.jsx)("span",{"data-tree-leaf":"","aria-hidden":"true",style:{display:"inline-block",width:16,height:16,marginRight:6,flexShrink:0}}),(0,d.jsx)("span",{children:r})]}):r},e.key)})]},c)})}):re?(0,d.jsx)(d.Fragment,{children:Me.map((t,o)=>{if("group"===t.type){const n=ae.has(t.key),o=`${q}-group-${t.key}`;return(0,d.jsxs)("tr",{role:"row","data-group-row":"","data-group-key":t.key,tabIndex:0,onClick:()=>de(t.key),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),de(t.key))},style:{backgroundColor:B.surfaceAlt,cursor:"pointer",fontWeight:600},children:[r&&(0,d.jsx)("td",{style:{borderBottom:`1px solid ${B.border}`,borderRight:Dt,padding:`${zt} ${Mt}`,width:40,backgroundColor:B.surfaceAlt,...nt?{position:"sticky",left:0,zIndex:2}:{}}}),e.map((e,r)=>{const i=ct(e,!1),a=!!tt[e.key],l=function(e,t){const n=e.aggregate;if(null==n)return;if("function"==typeof n)try{return n(t)}catch{return}if("count"===n)return t.length;const r=[];for(const o of t){const t=o[e.key],n="number"==typeof t?t:Number(t);Number.isFinite(n)&&r.push(n)}if(0!==r.length)switch(n){case"sum":return r.reduce((e,t)=>e+t,0);case"avg":return r.reduce((e,t)=>e+t,0)/r.length;case"min":return Math.min(...r);case"max":return Math.max(...r);default:return}}(e,t.rows),s=0===r;return(0,d.jsx)("td",{role:s?"rowheader":"gridcell","data-pinned":tt[e.key]?.side,"aria-expanded":s?n:void 0,"aria-controls":s?o:void 0,className:mt("text-sm"),style:{...Nt(e),borderBottom:`1px solid ${B.border}`,borderRight:Dt,color:B.text,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",...i,...a?{backgroundColor:B.surfaceAlt}:{}},children:s?(0,d.jsxs)("span",{children:[(0,d.jsx)(_o,{expanded:n}),oe(t.key)||"(empty)",(0,d.jsxs)("span",{style:{marginLeft:8,fontWeight:400,color:B.textMuted,fontSize:12},children:["(",t.rows.length," row",1!==t.rows.length?"s":"",")"]}),void 0!==l&&e.key!==re&&(0,d.jsx)("span",{style:{marginLeft:12,fontWeight:400,color:B.textMuted,fontSize:12},"data-group-agg":e.key,children:String(l)})]}):void 0!==l?(0,d.jsx)("span",{"data-group-agg":e.key,children:String(l)}):null},e.key)})]},`group:${t.key}`)}const i=t.row,a=o,l=ei(i,n),s=Ke.has(l),c=h&&a%2==1;let u="transparent";return s?u=`${B.primary}22`:c&&(u=B.surfaceAlt),(0,d.jsxs)("tr",{role:"row","aria-rowindex":a+1,"aria-selected":r?s:void 0,"data-group-key":String(i[re]??""),onClick:x?()=>x(i):void 0,onKeyDown:x?e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),x(i))}:void 0,tabIndex:x?0:void 0,className:mt(x?"cursor-pointer":""),style:{backgroundColor:u,transition:O?"none":"background-color 120ms ease"},children:[r&&(0,d.jsx)("td",{role:"gridcell",style:{borderBottom:`1px solid ${B.border}`,borderRight:Dt,padding:`${zt} ${Mt}`,textAlign:"center",width:40,...nt?{position:"sticky",left:0,zIndex:2,backgroundColor:B.surface}:{}},children:(0,d.jsxs)("label",{style:{display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",margin:"0 auto",width:16},onClick:e=>e.stopPropagation(),children:[(0,d.jsx)("input",{type:"checkbox",checked:s,onChange:()=>_e(l),"aria-label":s?`Deselect row ${l}`:`Select row ${l}`,style:{position:"absolute",opacity:0,width:16,height:16,cursor:"pointer",margin:0}}),(0,d.jsx)(Qo,{checked:s})]})}),e.map(e=>{const t=ti(i,e.key),n=e.renderCell?e.renderCell(t,i):"string"==typeof t?oe(t):String(t??""),r=ct(e,!1),o=wt(e,i),a=ht?.rowId===l&&ht.columnKey===e.key,s=gt?.rowId===l&&gt.columnKey===e.key,c=`${l}::${e.key}`;return(0,d.jsx)("td",{role:"gridcell","data-pinned":tt[e.key]?.side,"data-editing":a?"":void 0,"data-saving":s?"":void 0,"aria-readonly":o?"false":void 0,tabIndex:o?0:void 0,ref:e=>{e?yt.current.set(c,e):yt.current.delete(c)},onDoubleClick:o&&!a?t=>{t.stopPropagation(),kt(l,e,i)}:void 0,onKeyDown:o&&!a?t=>{"Enter"!==t.key&&"F2"!==t.key||(t.preventDefault(),t.stopPropagation(),kt(l,e,i))}:void 0,className:mt("text-sm"),style:{...Nt(e),borderBottom:`1px solid ${B.border}`,borderRight:Dt,color:B.text,overflow:a?"visible":"hidden",textOverflow:"ellipsis",whiteSpace:a?"normal":"nowrap",opacity:s?.6:1,cursor:o&&!a?"text":void 0,...r},children:a?(0,d.jsx)(li,{col:e,row:i,initialValue:t,onCommit:t=>St(i,e,t),onCancel:()=>Ct(i,e)}):n},e.key)})]},l)})}):(0,d.jsxs)(d.Fragment,{children:[Re&&Oe>0&&(0,d.jsx)("tr",{"aria-hidden":"true",children:(0,d.jsx)("td",{colSpan:Pt,style:{height:Oe,padding:0,border:"none"}})}),Ve.map((t,o)=>{const i=Ee+o,a=ei(t,n),l=Ke.has(a),s=h&&i%2==1;let c="transparent";return l?c=`${B.primary}22`:s&&(c=B.surfaceAlt),(0,d.jsxs)("tr",{role:"row","aria-rowindex":i+1,"aria-selected":r?l:void 0,onClick:x?()=>x(t):void 0,onKeyDown:x?e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),x(t))}:void 0,tabIndex:x?0:void 0,className:mt(x?"cursor-pointer":""),style:{backgroundColor:c,transition:O?"none":"background-color 120ms ease",...Re?{height:y,boxSizing:"border-box"}:{}},onMouseEnter:x?e=>{e.currentTarget.style.backgroundColor=l?`${B.primary}30`:B.surfaceAlt}:void 0,onMouseLeave:x?e=>{e.currentTarget.style.backgroundColor=c}:void 0,children:[r&&(0,d.jsx)("td",{role:"gridcell",style:{borderBottom:`1px solid ${B.border}`,borderRight:Dt,padding:`${zt} ${Mt}`,textAlign:"center",width:40,...nt?{position:"sticky",left:0,zIndex:2,backgroundColor:B.surface}:{}},children:(0,d.jsxs)("label",{style:{display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",margin:"0 auto",width:16},onClick:e=>e.stopPropagation(),children:[(0,d.jsx)("input",{type:"checkbox",checked:l,onChange:()=>_e(a),"aria-label":l?`Deselect row ${a}`:`Select row ${a}`,style:{position:"absolute",opacity:0,width:16,height:16,cursor:"pointer",margin:0}}),(0,d.jsx)(Qo,{checked:l})]})}),e.map(e=>{const n=ti(t,e.key),r=e.renderCell?e.renderCell(n,t):"string"==typeof n?oe(n):String(n??""),o=ct(e,!1),i=wt(e,t),l=ht?.rowId===a&&ht.columnKey===e.key,s=gt?.rowId===a&&gt.columnKey===e.key,c=`${a}::${e.key}`;return(0,d.jsx)("td",{role:"gridcell","data-pinned":tt[e.key]?.side,"data-editing":l?"":void 0,"data-saving":s?"":void 0,"aria-readonly":i?"false":void 0,tabIndex:i?0:void 0,ref:e=>{e?yt.current.set(c,e):yt.current.delete(c)},onDoubleClick:i&&!l?n=>{n.stopPropagation(),kt(a,e,t)}:void 0,onKeyDown:i&&!l?n=>{"Enter"!==n.key&&"F2"!==n.key||(n.preventDefault(),n.stopPropagation(),kt(a,e,t))}:void 0,className:mt("text-sm"),style:{...Nt(e),borderBottom:`1px solid ${B.border}`,borderRight:Dt,color:B.text,overflow:l?"visible":"hidden",textOverflow:"ellipsis",whiteSpace:l?"normal":"nowrap",opacity:s?.6:1,cursor:i&&!l?"text":void 0,...o},children:l?(0,d.jsx)(li,{col:e,row:t,initialValue:n,onCommit:n=>St(t,e,n),onCancel:()=>Ct(t,e)}):r},e.key)})]},a)}),Re&&Be<De.length&&(0,d.jsx)("tr",{"aria-hidden":"true",children:(0,d.jsx)("td",{colSpan:Pt,style:{height:(De.length-Be)*y,padding:0,border:"none"}})})]})})]}),(M||N)&&(0,d.jsx)("div",{ref:qe,style:{height:1,width:"100%"},children:N&&(0,d.jsx)("table",{style:{width:"100%",borderCollapse:"collapse"},children:(0,d.jsx)("tbody",{children:Array.from({length:3},(t,n)=>(0,d.jsx)("tr",{children:e.map(e=>(0,d.jsx)("td",{style:{padding:"10px 16px"},children:(0,d.jsx)(_t,{variant:"text",height:"16px"})},e.key))},n))})})}),!M&&z&&(0,d.jsx)("div",{style:{padding:"16px",textAlign:"center",fontSize:13,color:B.textMuted},children:"✓ All rows loaded"})]}),Se&&!c&&(0,d.jsx)(ai,{page:ke,totalPages:ze,pageSize:$,totalRows:Ce,onPageChange:$e,theme:B})]})},exports.TkxDatePicker=On,exports.TkxDivider=nn,exports.TkxDrawer=function({isOpen:e,onClose:t,placement:n="right",size:r="md",title:o,children:i,footer:l,closeOnOverlayClick:s=!0,closeOnEsc:u=!0}){const p=J(),h=Te(),f=(0,a.useId)(),m=We(e);if(Ee(t,u&&e),(0,a.useEffect)(()=>{if(e){if(1===++Dn&&(document.body.style.overflow="hidden"),Me())try{window.dispatchEvent(new CustomEvent("tkx:framed-drawer",{detail:{placement:n,at:Date.now()}}))}catch{}}else Rn();return()=>{e&&Rn()}},[e,n]),"undefined"==typeof document)return null;const g=function(e,t){const n=Nn[t],r={position:"absolute"};return"left"===e||"right"===e?{...r,top:0,bottom:0,[e]:0,width:n,maxWidth:"100vw",height:"100%"}:{...r,left:0,right:0,[e]:0,height:n,maxHeight:"100vh",width:"100%"}}(n,r),x=function(e){switch(e){case"left":return"translateX(-100%)";case"right":return"translateX(100%)";case"top":return"translateY(-100%)";case"bottom":return"translateY(100%)"}}(n),b=h?"none":"transform 280ms cubic-bezier(0.4,0,0.2,1), opacity 280ms ease",y="string"==typeof o?oe(o):o;return(0,c.createPortal)((0,d.jsxs)("div",{role:"presentation",className:mt("fixed inset-0 z-[9000]"),style:{pointerEvents:e?"auto":"none",visibility:e?"visible":"hidden"},children:[(0,d.jsx)("div",{"aria-hidden":"true",onClick:s?t:void 0,className:mt("absolute inset-0"),style:{backgroundColor:"rgba(0,0,0,0.55)",backdropFilter:"blur(3px)",opacity:e?1:0,transition:h?"none":"opacity 280ms ease",cursor:s?"pointer":"default"}}),(0,d.jsxs)("div",{ref:m,role:"dialog","aria-modal":"true","aria-labelledby":o?f:void 0,className:mt("absolute flex flex-col font-sans"),style:{...g,backgroundColor:p.surface,borderLeft:"right"===n?`1px solid ${p.border}`:void 0,borderRight:"left"===n?`1px solid ${p.border}`:void 0,borderTop:"bottom"===n?`1px solid ${p.border}`:void 0,borderBottom:"top"===n?`1px solid ${p.border}`:void 0,boxShadow:`0 20px 60px ${p.bg}99`,transform:e?"translate(0,0)":x,opacity:e?1:0,transition:b,willChange:"transform"},children:[void 0!==o&&(0,d.jsxs)("div",{className:mt("flex items-center justify-between px-5 py-4 shrink-0"),style:{borderBottom:`1px solid ${p.border}`},children:[(0,d.jsx)("h2",{id:f,className:mt("m-0 text-base font-semibold leading-snug"),style:{color:p.text},children:y}),(0,d.jsx)("button",{onClick:t,"aria-label":"Close drawer",className:mt("bg-transparent border-none cursor-pointer rounded p-1 flex items-center justify-center focus-visible:focus-ring"),style:{color:p.textMuted},children:(0,d.jsx)(Pn,{})})]}),void 0===o&&(0,d.jsx)("div",{className:mt("flex justify-end px-3 pt-3 shrink-0"),children:(0,d.jsx)("button",{onClick:t,"aria-label":"Close drawer",className:mt("bg-transparent border-none cursor-pointer rounded p-1 flex items-center justify-center focus-visible:focus-ring"),style:{color:p.textMuted},children:(0,d.jsx)(Pn,{})})}),(0,d.jsx)("div",{className:mt("flex-1 overflow-y-auto px-5 py-4"),style:{color:p.text},children:i}),l&&(0,d.jsx)("div",{className:mt("flex items-center justify-end gap-2 px-5 py-4 shrink-0"),style:{borderTop:`1px solid ${p.border}`},children:l})]})]}),document.body)},exports.TkxDrivingLicenceInput=zl,exports.TkxDropdown=function({trigger:e,items:t,groups:n,placement:r="bottom-start",onSelect:o,selectedKeys:i,multiSelect:l=!1,searchable:s=!1,searchPlaceholder:u,closeOnSelect:p,disabled:h=!1,maxHeight:f=320,minWidth:m=200,open:g,onOpenChange:x,portal:b=!0,offset:y=6,renderItem:v}){const[w,k]=(0,a.useState)(!1),[$,S]=(0,a.useState)([]),[C,z]=(0,a.useState)({top:0,left:0,minWidth:m}),M=(0,a.useRef)(null),N=(0,a.useRef)(null),D=(0,a.useId)(),R=void 0!==g?g:w,P=void 0!==i?i:$,F=void 0!==p?p:!l,I=n??(t?[{items:t}]:[{items:[]}]),A=(0,a.useCallback)(e=>{void 0===g&&k(e),x?.(e)},[g,x]),L=(0,a.useCallback)((e,t)=>{l&&void 0===i&&S(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),o?.(e,t),F&&A(!1)},[l,i,o,F,A]),T=(0,a.useCallback)(()=>A(!1),[A]);(0,a.useEffect)(()=>{R&&M.current&&z(Ll(M.current,N.current,r,y))},[R,r,y]),(0,a.useEffect)(()=>{R&&M.current&&N.current&&z(Ll(M.current,N.current,r,y))},[R,r,y]),(0,a.useEffect)(()=>{if(!R)return;const e=e=>{const t=e.target;M.current&&!M.current.contains(t)&&N.current&&!N.current.contains(t)&&A(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[R,A]);const W=R?(0,d.jsx)(Wl,{groups:I,position:C,maxHeight:f,minWidth:m,selectedKeys:P,multiSelect:l,searchable:s,searchPlaceholder:u,onSelect:L,onClose:T,renderItem:v,menuRef:N,isPortal:b,menuId:D}):null;return(0,d.jsxs)("div",{style:{display:"inline-block",position:"relative"},children:[(0,d.jsx)("div",{ref:M,onClick:()=>{h||A(!R)},"aria-haspopup":"menu","aria-expanded":R,"aria-controls":R?D:void 0,"aria-disabled":h,style:{cursor:h?"not-allowed":"pointer",opacity:h?.5:1,display:"inline-block"},children:e}),b&&"undefined"!=typeof document?(0,c.createPortal)(W,document.body):W]})},exports.TkxEmpty=function({image:e="default",description:t="No data",children:n,style:r}){const o=J(),i="string"==typeof t?oe(t):t;let l;return l="default"===e?(0,a.createElement)(aa,{color:o.primary,mutedColor:o.textMuted}):"simple"===e?(0,a.createElement)(la,{mutedColor:o.textMuted}):e,(0,a.createElement)("div",{role:"status",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"32px 16px",textAlign:"center",...r}},(0,a.createElement)("div",{style:{marginBottom:"12px",opacity:.85}},l),i&&(0,a.createElement)("div",{style:{color:o.textMuted,fontSize:"0.875rem",lineHeight:"1.5",maxWidth:"320px"}},i),n&&(0,a.createElement)("div",{style:{marginTop:"16px"}},n))},exports.TkxFileUpload=function({accept:e,multiple:t=!1,maxSize:n,maxFiles:r,onChange:o,onError:i,label:l,hint:s,isDisabled:c=!1,preview:u=!0,dragDrop:p=!0,variant:h="dropzone"}){const f=J(),m=Ot(),g=l??m.uploadFiles??"Upload files",x=m.dropFiles?.replace(/^.*$/,m.dropFiles)??"Drop files here",b=Te(),y=(0,a.useId)(),v=(0,a.useRef)(null),[w,k]=(0,a.useState)(!1),[$,S]=(0,a.useState)([]);(0,a.useEffect)(()=>()=>{$.forEach(e=>{e.objectUrl&&URL.revokeObjectURL(e.objectUrl)})},[]);const C=(0,a.useCallback)(e=>{let t=0;const n=setInterval(()=>{t+=Math.floor(20*Math.random())+10,t>=100&&(t=100,clearInterval(n)),S(n=>n.map(n=>n.id===e?{...n,progress:t}:n))},100)},[]),z=(0,a.useCallback)(t=>n&&t.size>n?`"${oe(t.name)}" exceeds max size of ${tr(n)}`:/[\u0000-\u001F\u007F]|\.\.\/|\.\.\\/.test(t.name)?`"${oe(t.name)}" contains forbidden characters`:e&&!e.split(",").map(e=>e.trim()).some(e=>e.startsWith(".")?t.name.toLowerCase().endsWith(e.toLowerCase()):e.endsWith("/*")?t.type.startsWith(e.slice(0,-1)):t.type===e)?`"${oe(t.name)}" is not an accepted file type`:void 0,[e,n]),M=(0,a.useCallback)(async e=>{if(!e.error)try{const t=await Re(e.file);if(t&&e.file.type&&!e.file.type.startsWith(t.split("/")[0])){const t=`"${oe(e.file.name)}" file content does not match its type`;S(n=>n.map(n=>n.id===e.id?{...n,error:t}:n)),i?.(t)}}catch{}},[i]),N=(0,a.useCallback)(e=>{const n=r?r-$.length:1/0;if(n<=0)return void i?.(`Maximum of ${r} file${1===r?"":"s"} allowed`);const a=e.slice(0,n).map(e=>{const t=z(e),n=u&&e.type.startsWith("image/")&&!t?URL.createObjectURL(e):void 0;return{file:e,id:"tkx-file-"+ ++rr,objectUrl:n,progress:0,error:t}});S(e=>{const n=t?[...e,...a]:a,r=n.filter(e=>!e.error).map(e=>e.file);return o?.(r),n}),a.forEach(e=>{e.error?i?.(e.error):M(e)}),a.forEach(e=>{e.error||C(e.id)})},[$.length,r,t,o,i,u,C,z]),D=(0,a.useCallback)(e=>{const t=Array.from(e.target.files??[]);t.length&&N(t),e.target.value=""},[N]),R=(0,a.useCallback)(e=>{if(e.preventDefault(),k(!1),c)return;const t=Array.from(e.dataTransfer.files);t.length&&N(t)},[c,N]),P=(0,a.useCallback)(e=>{e.preventDefault(),c||k(!0)},[c]),F=(0,a.useCallback)(()=>k(!1),[]),I=(0,a.useCallback)(e=>{S(t=>{const n=t.find(t=>t.id===e);n?.objectUrl&&URL.revokeObjectURL(n.objectUrl);const r=t.filter(t=>t.id!==e);return o?.(r.filter(e=>!e.error).map(e=>e.file)),r})},[o]),A=(0,a.useCallback)(()=>{c||v.current?.click()},[c]),L=w?f.primary:f.border,T=oe(g),W=s?oe(s):"",j=(0,d.jsxs)("div",{role:"button",tabIndex:c?-1:0,"aria-label":T,"aria-describedby":s?y:void 0,"aria-disabled":c,onClick:A,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),A())},onDrop:p?R:void 0,onDragOver:p?P:void 0,onDragLeave:p?F:void 0,className:mt("flex flex-col items-center justify-center gap-3 w-full p-8 rounded-lg"),style:{border:`2px dashed ${L}`,backgroundColor:w?`${f.primary}10`:f.surface,cursor:c?"not-allowed":"pointer",opacity:c?.5:1,transition:b?"none":"border-color 150ms ease, background-color 150ms ease",outline:"none"},children:[(0,d.jsxs)("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:w?f.primary:f.textMuted,strokeWidth:1.5,"aria-hidden":"true",children:[(0,d.jsx)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,d.jsx)("polyline",{points:"17 8 12 3 7 8"}),(0,d.jsx)("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]}),(0,d.jsxs)("div",{className:mt("text-center"),children:[(0,d.jsx)("p",{className:mt("m-0 text-sm font-medium"),style:{color:f.text},children:w?x:T}),W&&(0,d.jsx)("p",{id:y,className:mt("m-0 text-xs mt-1"),style:{color:f.textMuted},children:W})]})]}),E=(0,d.jsxs)("button",{type:"button",disabled:c,onClick:A,"aria-describedby":s?y:void 0,className:mt("flex items-center gap-2 px-4 py-2 rounded-md text-sm font-medium font-sans border-none cursor-pointer"),style:{backgroundColor:f.primary,color:f.bg,opacity:c?.5:1,cursor:c?"not-allowed":"pointer"},children:[(0,d.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:[(0,d.jsx)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,d.jsx)("polyline",{points:"17 8 12 3 7 8"}),(0,d.jsx)("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]}),T,s&&(0,d.jsx)("span",{id:y,className:mt("sr-only"),children:W})]});return(0,d.jsxs)("div",{className:mt("flex flex-col gap-3 w-full font-sans"),children:[(0,d.jsx)("input",{ref:v,type:"file",accept:e,multiple:t,disabled:c,onChange:D,className:mt("sr-only"),tabIndex:-1,"aria-hidden":"true"}),"dropzone"===h?j:E,$.length>0&&(0,d.jsx)("ul",{role:"status","aria-live":"polite","aria-label":m.uploadFiles??"Uploaded files",className:mt("m-0 p-0 flex flex-col gap-2"),style:{listStyle:"none"},children:$.map(e=>(0,d.jsxs)("li",{className:mt("flex flex-col gap-1 rounded-md p-3"),style:{backgroundColor:f.surfaceAlt,border:`1px solid ${e.error?f.danger:f.border}`},children:[(0,d.jsxs)("div",{className:mt("flex items-center gap-3"),children:[e.objectUrl&&u?(0,d.jsx)("img",{src:e.objectUrl,alt:oe(e.file.name),className:mt("rounded"),style:{width:40,height:40,objectFit:"cover",flexShrink:0}}):(0,d.jsx)("span",{style:{flexShrink:0},children:(0,d.jsx)(nr,{mimeType:e.file.type,color:e.error?f.danger:f.textMuted})}),(0,d.jsxs)("div",{className:mt("flex flex-col gap-0.5 flex-1 min-w-0"),children:[(0,d.jsx)("span",{className:mt("text-sm font-medium truncate"),style:{color:e.error?f.danger:f.text},title:e.file.name,children:oe(e.file.name)}),(0,d.jsxs)("span",{className:mt("text-xs"),style:{color:f.textMuted},children:[tr(e.file.size),e.error&&` — ${e.error}`]})]}),(0,d.jsx)("button",{type:"button","aria-label":`Remove ${oe(e.file.name)}`,onClick:()=>I(e.id),className:mt("flex items-center justify-center bg-transparent border-none cursor-pointer rounded p-1"),style:{color:f.textMuted,flexShrink:0},children:(0,d.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:[(0,d.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,d.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),!e.error&&e.progress<100&&(0,d.jsx)("div",{className:mt("w-full overflow-hidden"),style:{height:"3px",borderRadius:"3px",backgroundColor:f.border},"aria-hidden":"true",children:(0,d.jsx)("div",{style:{height:"100%",borderRadius:"3px",backgroundColor:f.primary,width:`${e.progress}%`,transition:b?"none":"width 100ms ease"}})})]},e.id))})]})},exports.TkxFlowChart=Ts,exports.TkxFontProvider=function({scripts:e,language:t,preconnect:n=!0,children:r}){const o=e&&e.length>0?e:t?Fa(t):["latin"];return(0,a.useEffect)(()=>{n&&function(){if(Ra||"undefined"==typeof document)return;const e=document.head,t=(t,n)=>{if(e.querySelector(`link[rel="preconnect"][href="${t}"]`))return;const r=document.createElement("link");r.rel="preconnect",r.href=t,n&&(r.crossOrigin="anonymous"),e.appendChild(r)};t("https://fonts.googleapis.com"),t("https://fonts.gstatic.com",!0),Ra=!0}(),o.forEach(Pa)},[o.join(","),n]),null==r?null:(0,d.jsx)(d.Fragment,{children:r})},exports.TkxFooter=Bi,exports.TkxForm=Di,exports.TkxFormBuilder=function({schema:e,onChange:t,allowedTypes:n=Gd,defaultTab:r="design",style:o,className:i}){const[l,s]=(0,a.useState)(r),[c,u]=(0,a.useState)(e.fields[0]?.id??null),p=(0,a.useMemo)(()=>e.fields.find(e=>e.id===c)??null,[e.fields,c]),h=(0,a.useCallback)(n=>{const r=function(e,t){const n=t+1,r={id:`fld-${Math.random().toString(36).slice(2,9)}`,type:e,name:ec(e,n),label:Qd(e,n)};return"select"!==e&&"radio"!==e||(r.options=[{label:"Option 1",value:"option_1"},{label:"Option 2",value:"option_2"}]),r}(n,e.fields.length);t({...e,fields:[...e.fields,r]}),u(r.id)},[e,t]),f=(0,a.useCallback)((n,r)=>{const o=e.fields.findIndex(e=>e.id===n);if(o<0)return;const i=o+r;if(i<0||i>=e.fields.length)return;const a=e.fields.slice();[a[o],a[i]]=[a[i],a[o]],t({...e,fields:a})},[e,t]),m=(0,a.useCallback)(n=>{t({...e,fields:e.fields.filter(e=>e.id!==n)}),c===n&&u(null)},[e,t,c]),g=(0,a.useCallback)(n=>{p&&t({...e,fields:e.fields.map(e=>e.id===p.id?{...e,...n}:e)})},[e,t,p]);return(0,d.jsxs)("div",{className:i,"data-testid":"tkx-form-builder",style:{display:"flex",flexDirection:"column",height:600,border:"1px solid var(--tkx-border, #2a2a3e)",borderRadius:12,overflow:"hidden",background:"var(--tkx-bg, #0a0a0f)",color:"var(--tkx-fg, #e8e8f4)",fontFamily:"inherit",...o},children:[(0,d.jsx)("div",{role:"tablist","aria-label":"Form builder views",style:{display:"flex",borderBottom:"1px solid var(--tkx-border, #2a2a3e)",background:"var(--tkx-bg-subtle, #0d0d14)"},children:["design","preview","json"].map(e=>(0,d.jsx)("button",{type:"button",role:"tab","aria-selected":l===e,"data-testid":`tab-${e}`,onClick:()=>s(e),style:{padding:"12px 18px",minHeight:44,border:"none",background:l===e?"var(--tkx-bg, #0a0a0f)":"transparent",color:l===e?"var(--tkx-accent, #00f5d4)":"#aaa",borderBottom:l===e?"2px solid var(--tkx-accent, #00f5d4)":"2px solid transparent",cursor:"pointer",fontSize:13,fontWeight:600,textTransform:"capitalize"},children:e},e))}),"design"===l&&(0,d.jsxs)("div",{style:{display:"flex",flex:1,minHeight:0},children:[(0,d.jsx)(nc,{types:n,onAdd:h}),(0,d.jsx)(rc,{fields:e.fields,selectedId:c,onSelect:u,onMove:f,onRemove:m}),(0,d.jsx)(ic,{field:p,onPatch:g})]}),"preview"===l&&(0,d.jsx)("div",{style:{display:"flex",flex:1,minHeight:0},children:(0,d.jsx)(dc,{schema:e})}),"json"===l&&(0,d.jsx)("pre",{"data-testid":"json-view",style:{flex:1,margin:0,padding:16,overflow:"auto",background:"var(--tkx-bg-subtle, #0d0d14)",color:"#00f5d4",fontSize:12,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace"},children:JSON.stringify(e,null,2)})]})},exports.TkxFormField=Ri,exports.TkxFormulaBar=function({data:e,active:t,onChange:n,onActiveChange:r,showResult:o=!0,height:i=36,style:l,className:s}){const c=Ad(t.col,t.row),u=e.cells[c]??"",[p,h]=(0,a.useState)(u),[f,m]=(0,a.useState)(c);(0,a.useEffect)(()=>{h(u),m(c)},[c]);const g=o&&u.startsWith("=")?Td(c,e.cells):"",x=()=>{const t={...e.cells};""===p?delete t[c]:t[c]=p,n({cells:t})};return(0,d.jsxs)("div",{role:"toolbar","aria-label":"Formula bar","data-testid":"tkx-formula-bar",className:s,style:{display:"flex",alignItems:"stretch",gap:0,height:i,background:"var(--tkx-bg-subtle, #0d0d14)",border:"1px solid var(--tkx-border, #2a2a3e)",borderRadius:8,overflow:"hidden",fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",fontSize:13,...l},children:[(0,d.jsx)("input",{"aria-label":"Cell address","data-testid":"formula-bar-name",value:f,onChange:e=>m(Se(e.target.value)),onKeyDown:e=>{if("Enter"===e.key){e.preventDefault();const t=Ld(f.trim().toUpperCase());t?r?.(t):m(c)}else"Escape"===e.key&&(e.preventDefault(),m(c))},onBlur:()=>{Ld(f.trim().toUpperCase())||m(c)},style:{width:90,flex:"0 0 90px",padding:"0 10px",border:"none",borderRight:"1px solid var(--tkx-border, #2a2a3e)",background:"transparent",color:"var(--tkx-accent, #00f5d4)",fontWeight:700,textAlign:"center",textTransform:"uppercase",fontFamily:"inherit",fontSize:"inherit",outline:"none"}}),(0,d.jsxs)("span",{"aria-hidden":"true",style:{display:"inline-flex",alignItems:"center",padding:"0 12px",color:"#888",fontStyle:"italic",fontFamily:"serif",fontSize:14,borderRight:"1px solid var(--tkx-border-soft, #1a1a25)"},children:["f",(0,d.jsx)("sub",{style:{fontSize:9},children:"x"})]}),(0,d.jsx)("input",{"aria-label":"Cell content","data-testid":"formula-bar-input",value:p,onChange:e=>h(Se(e.target.value)),onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),x()):"Escape"===e.key&&(e.preventDefault(),h(u))},onBlur:x,placeholder:"Type a value or =formula",style:{flex:1,minWidth:0,padding:"0 12px",border:"none",background:"transparent",color:p.startsWith("=")?"var(--tkx-accent, #00f5d4)":"var(--tkx-fg, #e8e8f4)",fontFamily:"inherit",fontSize:"inherit",outline:"none"}}),o&&u.startsWith("=")&&(0,d.jsxs)("span",{"data-testid":"formula-bar-result","aria-label":"Evaluated value",style:{display:"inline-flex",alignItems:"center",padding:"0 12px",borderLeft:"1px solid var(--tkx-border-soft, #1a1a25)",background:"rgba(0,245,212,0.06)",color:"string"==typeof g&&g.startsWith("#")?"#ff006e":"#c4a8ff",fontWeight:600,minWidth:80,justifyContent:"flex-end"},children:["= ",String(g)]})]})},exports.TkxFunnelChart=dd,exports.TkxGantt=function({tasks:e,dayWidth:t=28,rowHeight:n=40,labelColumnWidth:r=220,selectedId:o,onSelect:i,onTaskChange:l,style:s,className:c}){const[u,p]=(0,a.useState)(e[0]?.id??null),h=void 0!==o?o:u,{rangeStart:f,rangeEnd:m,totalDays:g,parsed:x}=(0,a.useMemo)(()=>{if(0===e.length){const e=md(new Date);return{rangeStart:e,rangeEnd:yd(e,7),totalDays:7,parsed:[]}}const t=e.map(e=>({task:e,start:md(e.start),end:md(e.end)}));let n=t[0].start,r=t[0].end;for(const e of t)e.start.getTime()<n.getTime()&&(n=e.start),e.end.getTime()>r.getTime()&&(r=e.end);const o=yd(n,-1),i=yd(r,1);return{rangeStart:o,rangeEnd:i,totalDays:bd(o,i)+1,parsed:t}},[e]),b=(0,a.useCallback)(e=>bd(f,e)*t,[f,t]),y=(0,a.useMemo)(()=>{const e=new Map;return x.forEach((t,n)=>e.set(t.task.id,{...t,index:n})),e},[x]),v=(0,a.useCallback)(t=>{void 0===o&&p(t);const n=e.find(e=>e.id===t);n&&i?.(t,n)},[o,i,e]),w=(0,a.useCallback)(e=>{if(!h)return;const t=y.get(h);if(!t)return;const n=yd(t.start,e),r=yd(t.end,e);l?.(h,{start:gd(n),end:gd(r)},t.task)},[h,y,l]),k=g*t,$=e.length*n;return(0,d.jsxs)("div",{className:c,role:"application","aria-label":"Gantt chart",tabIndex:0,onKeyDown:t=>{if(!h)return;const n=e.findIndex(e=>e.id===h);switch(t.key){case"ArrowUp":n>0&&(t.preventDefault(),v(e[n-1].id));break;case"ArrowDown":n<e.length-1&&(t.preventDefault(),v(e[n+1].id));break;case"ArrowLeft":t.preventDefault(),w(-1);break;case"ArrowRight":t.preventDefault(),w(1)}},"data-testid":"tkx-gantt",style:{display:"flex",outline:"none",border:"1px solid var(--tkx-border, #2a2a3e)",borderRadius:12,overflow:"hidden",background:"var(--tkx-bg, #0a0a0f)",color:"var(--tkx-fg, #e8e8f4)",...s},children:[(0,d.jsxs)("div",{role:"list","aria-label":"Tasks",style:{width:r,flex:`0 0 ${r}px`,borderRight:"1px solid var(--tkx-border, #2a2a3e)",background:"var(--tkx-bg-subtle, #0d0d14)",overflow:"hidden"},children:[(0,d.jsx)("div",{style:{height:48,borderBottom:"1px solid var(--tkx-border, #2a2a3e)",display:"flex",alignItems:"center",padding:"0 12px",fontSize:11,fontWeight:700,letterSpacing:"0.06em",textTransform:"uppercase",color:"#888"},children:"Task"}),e.map(e=>{const t=e.id===h;return(0,d.jsx)("div",{role:"listitem","data-testid":`gantt-label-${e.id}`,onClick:()=>v(e.id),style:{height:n,display:"flex",alignItems:"center",padding:"0 12px",cursor:"pointer",borderBottom:"1px solid var(--tkx-border-soft, #1a1a25)",background:t?"rgba(0,245,212,0.08)":"transparent",fontSize:13,fontWeight:t?600:400,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},title:e.label,children:e.label},e.id)})]}),(0,d.jsx)("div",{style:{flex:1,overflow:"auto"},children:(0,d.jsxs)("div",{style:{position:"relative",width:k,minWidth:"100%"},children:[(0,d.jsx)("div",{style:{height:48,borderBottom:"1px solid var(--tkx-border, #2a2a3e)",position:"sticky",top:0,background:"var(--tkx-bg-subtle, #0d0d14)",zIndex:2},children:Array.from({length:g}).map((e,n)=>{const r=yd(f,n),o=1===r.getUTCDate()||0===n,i=r.getUTCDay(),a=0===i||6===i;return(0,d.jsxs)("div",{style:{position:"absolute",left:n*t,top:0,width:t,height:48,fontSize:10,color:a?"#666":"#aaa",textAlign:"center",borderRight:"1px solid var(--tkx-border-soft, #1a1a25)",paddingTop:4},children:[o&&(0,d.jsx)("div",{style:{fontSize:11,fontWeight:700,color:"var(--tkx-accent, #00f5d4)"},children:vd(r)}),(0,d.jsx)("div",{style:{marginTop:o?2:14},children:r.getUTCDate()})]},n)})}),(0,d.jsxs)("div",{style:{position:"relative",height:$},children:[Array.from({length:g}).map((e,n)=>{const r=yd(f,n).getUTCDay();return 0!==r&&6!==r?null:(0,d.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",left:n*t,top:0,width:t,height:$,background:"rgba(255,255,255,0.02)",pointerEvents:"none"}},`w${n}`)}),e.map((e,t)=>(0,d.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",left:0,right:0,top:(t+1)*n-1,height:1,background:"var(--tkx-border-soft, #1a1a25)",pointerEvents:"none"}},`r${t}`)),x.map((e,r)=>{const o=e.task.id===h,i=b(e.start),a=(bd(e.start,e.end)+1)*t,l=e.task.color||"var(--tkx-accent, #00f5d4)",s=Math.max(0,Math.min(1,e.task.progress??0));return(0,d.jsxs)("div",{role:"button","aria-pressed":o,"aria-label":`${e.task.label}: ${gd(e.start)} to ${gd(e.end)}`,"data-testid":`gantt-bar-${e.task.id}`,onClick:()=>v(e.task.id),style:{position:"absolute",left:i,top:r*n+6,width:a,height:n-12,borderRadius:6,border:`1px solid ${l}`,background:o?`${l}33`:`${l}1f`,cursor:"pointer",overflow:"hidden",boxShadow:o?`0 0 0 2px ${l}40`:"none",display:"flex",alignItems:"center",paddingLeft:8,fontSize:12,fontWeight:600,color:"var(--tkx-fg, #e8e8f4)",boxSizing:"border-box"},children:[s>0&&(0,d.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",inset:0,width:100*s+"%",background:`${l}55`,pointerEvents:"none"}}),(0,d.jsx)("span",{style:{position:"relative",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%",paddingRight:8},children:e.task.label})]},e.task.id)}),(0,d.jsxs)("svg",{"aria-hidden":"true",width:k,height:$,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[(0,d.jsx)("defs",{children:(0,d.jsx)("marker",{id:"tkx-gantt-arrowhead",markerWidth:"6",markerHeight:"6",refX:"5",refY:"3",orient:"auto",children:(0,d.jsx)("path",{d:"M0,0 L6,3 L0,6 z",fill:"var(--tkx-fg-muted, #aaa)"})})}),x.flatMap((e,r)=>e.task.dependencies?.length?e.task.dependencies.map(o=>{const i=y.get(o);if(!i)return null;const a=b(i.end)+t,l=i.index*n+n/2,s=b(e.start),c=r*n+n/2,u=Math.max(a+8,s-8),p=`M ${a} ${l} L ${u} ${l} L ${u} ${c} L ${s} ${c}`;return(0,d.jsx)("path",{"data-testid":`gantt-arrow-${o}-to-${e.task.id}`,d:p,stroke:"var(--tkx-fg-muted, #aaa)",strokeOpacity:.6,strokeWidth:1.5,fill:"none",markerEnd:"url(#tkx-gantt-arrowhead)"},`${o}->${e.task.id}`)}):[])]})]})]})})]})},exports.TkxGauge=Qs,exports.TkxHeader=Ti,exports.TkxHeatmap=ad,exports.TkxHolographicAvatar=Kl,exports.TkxHolographicBadge=Gl,exports.TkxHolographicButton=_l,exports.TkxHolographicCard=Ul,exports.TkxHolographicGauge=function({value:e,size:t=140,thickness:n=.12,accent:r="#00f5d4",label:o,caption:i,ariaValueText:l,className:s,style:c}){Jl();const u=Math.max(0,Math.min(100,e)),p=t*n,h=(t-p)/2,f=t/2,m=t/2,g=2*Math.PI*h,x=u/100*g,b=(0,a.useRef)(`holo-gauge-${Math.random().toString(36).slice(2,8)}`).current;return(0,d.jsxs)("div",{role:"meter","aria-valuenow":u,"aria-valuemin":0,"aria-valuemax":100,"aria-valuetext":l??`${u.toFixed(0)} percent`,className:s,style:{position:"relative",width:t,height:t,display:"inline-flex",alignItems:"center",justifyContent:"center",...c},children:[(0,d.jsxs)("svg",{width:t,height:t,"aria-hidden":"true",style:{position:"absolute",inset:0},children:[(0,d.jsx)("defs",{children:(0,d.jsxs)("linearGradient",{id:b,x1:"0",y1:"0",x2:"1",y2:"1",children:[(0,d.jsx)("stop",{offset:"0%",stopColor:r,stopOpacity:.95}),(0,d.jsx)("stop",{offset:"50%",stopColor:"#7b2ff7",stopOpacity:.95}),(0,d.jsx)("stop",{offset:"100%",stopColor:r,stopOpacity:.95})]})}),(0,d.jsx)("circle",{cx:f,cy:m,r:h,fill:"none",stroke:`${r}1a`,strokeWidth:p}),(0,d.jsx)("circle",{cx:f,cy:m,r:h,fill:"none",stroke:`url(#${b})`,strokeWidth:p,strokeLinecap:"round",strokeDasharray:`${x} ${g}`,transform:`rotate(-90 ${f} ${m})`,style:{filter:`drop-shadow(0 0 6px ${r}aa)`,transition:"stroke-dasharray 600ms cubic-bezier(.2,.8,.2,1)"}})]}),(0,d.jsxs)("div",{style:{position:"relative",textAlign:"center",zIndex:1,color:"#e8e8f4"},children:[(0,d.jsx)("div",{style:{fontSize:.22*t,fontWeight:800,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",fontVariantNumeric:"tabular-nums",color:r,lineHeight:1,textShadow:`0 0 16px ${r}88`},children:o??`${u.toFixed(0)}%`}),i&&(0,d.jsx)("div",{style:{fontSize:10,color:"#888",marginTop:4,textTransform:"uppercase",letterSpacing:"0.08em"},children:i})]})]})},exports.TkxHolographicPanel=Ql,exports.TkxHolographicProgress=function({value:e,label:t,valueLabel:n,height:r=8,accent:o="#00f5d4",shimmer:i=!0,className:a,style:l}){Jl();const s=Math.max(0,Math.min(1,e));return(0,d.jsxs)("div",{className:a,style:l,children:[(t||n)&&(0,d.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",marginBottom:6,fontSize:12},children:[(0,d.jsx)("span",{style:{color:"#aaa",fontWeight:600},children:t}),(0,d.jsx)("span",{style:{color:o,fontFamily:"ui-monospace, monospace",fontVariantNumeric:"tabular-nums"},children:n??`${(100*s).toFixed(0)}%`})]}),(0,d.jsx)("div",{role:"progressbar","aria-valuenow":Math.round(100*s),"aria-valuemin":0,"aria-valuemax":100,style:{position:"relative",height:r,width:"100%",borderRadius:r,background:`${o}14`,overflow:"hidden"},children:(0,d.jsx)("div",{style:{position:"absolute",inset:0,width:100*s+"%",background:`linear-gradient(90deg, ${o}, #7b2ff7, ${o})`,backgroundSize:"200% 100%",animation:i?"tkx-holo-shimmer 3s linear infinite":void 0,boxShadow:`0 0 12px ${o}88`,transition:"width 600ms cubic-bezier(.2,.8,.2,1)",borderRadius:r}})})]})},exports.TkxHolographicSurface=ql,exports.TkxHolographicTerminal=function({lines:e,typeSpeed:t=12,prompt:n="$ ",maxLines:r=10,height:o=220,accent:i="#00f5d4",className:l,style:s}){Jl();const c=(0,a.useRef)(null),[u,p]=(0,a.useState)(()=>0===t?e:[]),h=(0,a.useRef)(0);(0,a.useEffect)(()=>{if(0===t)return void p(e);if(e.length<=h.current)return p(e),void(h.current=e.length);let n=!1;const r=h.current,o=e[r]??"";let i=0;p(e=>[...e.slice(0,r),""]);const a=()=>{n||(i+=1,p(e=>{const t=e.slice();return t[r]=o.slice(0,i),t}),i<o.length?setTimeout(a,t):(h.current=r+1,e.length>h.current&&p(e=>[...e,""])))};return a(),()=>{n=!0}},[e,t]),(0,a.useEffect)(()=>{const e=c.current;e&&(e.scrollTop=e.scrollHeight)},[u]);const f=u.slice(-r);return(0,d.jsxs)("div",{ref:c,role:"log","aria-live":"polite",className:l,style:{position:"relative",height:o,padding:12,borderRadius:10,background:"linear-gradient(180deg, rgba(0,10,20,0.7), rgba(0,5,10,0.9))",border:`1px solid ${i}33`,color:i,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",fontSize:12,lineHeight:1.5,overflowY:"auto",boxShadow:`inset 0 0 24px ${i}14`,...s},children:[(0,d.jsx)("span",{className:"tkx-holo-foil","aria-hidden":"true",style:{borderRadius:10}}),(0,d.jsx)("pre",{style:{margin:0,position:"relative",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:f.map((e,t)=>(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{style:{color:"#666"},children:n}),(0,d.jsx)("span",{style:{color:i},children:e}),t===f.length-1&&(0,d.jsx)("span",{"aria-hidden":"true",style:{display:"inline-block",width:"0.6ch",height:"1em",marginLeft:2,background:i,verticalAlign:"text-bottom",animation:"tkx-holo-cursor 1.1s steps(2) infinite"}})]},t))}),(0,d.jsx)("style",{children:"\n @keyframes tkx-holo-cursor {\n 0%, 49% { opacity: 1; }\n 50%, 100% { opacity: 0; }\n }\n "})]})},exports.TkxImage=function({src:e,alt:t,fallback:n,placeholder:r="skeleton",fit:o="cover",ratio:i="auto",radius:l="none",caption:s,lazy:u=!0,preview:p=!1,className:h,style:f,...m}){const g=J(),x=Te(),[b,y]=(0,a.useState)(!1),[v,w]=(0,a.useState)(!1),[k,$]=(0,a.useState)(!1),S=(0,a.useRef)(null),C=oe(e),z=t?oe(t):"",M=s?oe(s):"",N=Qn[l];(0,a.useEffect)(()=>{S.current?.complete&&y(!0)},[]);const D=(0,a.useCallback)(()=>y(!0),[]),R=(0,a.useCallback)(()=>w(!0),[]),P=(0,a.useCallback)(()=>{p&&!v&&$(!0)},[p,v]),F=(0,a.useCallback)(()=>$(!1),[]);(0,a.useEffect)(()=>{if(!k)return;const e=e=>{"Escape"===e.key&&F()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[k,F]);const I="skeleton"===r&&!b&&!v,A=I&&!x?{animation:"tkx-shimmer 1.5s ease-in-out infinite"}:{},L=v?null:(0,d.jsx)("img",{ref:S,src:C,alt:z||void 0,role:z?void 0:"img","aria-label":z?void 0:"Image",loading:u?"lazy":void 0,onLoad:D,onError:R,onClick:p?P:void 0,className:xt(mt("block w-full h-full"),p&&!v?mt("cursor-pointer"):""),style:{objectFit:o,borderRadius:N,opacity:b?1:0,transition:x?"none":"opacity 200ms ease",position:"auto"===i?void 0:"absolute",inset:"auto"===i?void 0:0},...m}),T=v?n?(0,d.jsx)(d.Fragment,{children:n}):(0,d.jsxs)("div",{role:"img","aria-label":z||"Image failed to load",className:mt("flex flex-col items-center justify-center gap-2 w-full h-full"),style:{backgroundColor:g.surfaceAlt,borderRadius:N,color:g.textMuted,minHeight:"80px"},children:[(0,d.jsx)(er,{color:g.textMuted,size:32}),(0,d.jsx)("span",{className:mt("text-xs"),style:{color:g.textMuted},children:"Failed to load"})]}):null,W=I?(0,d.jsx)("div",{"aria-hidden":"true",style:{position:"auto"===i?void 0:"absolute",inset:"auto"===i?void 0:0,width:"100%",height:"auto"===i?"100%":void 0,minHeight:"auto"===i?"80px":void 0,borderRadius:N,backgroundColor:g.surfaceAlt,...A}}):null,j="auto"===i?(0,d.jsxs)("div",{className:mt("relative w-full"),style:{borderRadius:N},children:[W,L,T]}):(0,d.jsxs)("div",{className:mt("relative w-full overflow-hidden"),style:{paddingBottom:Jn[i],borderRadius:N},children:[W,L,T]}),E=M?(0,d.jsxs)("figure",{className:mt("m-0 p-0 flex flex-col gap-2"),style:{borderRadius:N},children:[j,(0,d.jsx)("figcaption",{className:mt("text-sm text-center"),style:{color:g.textMuted},children:M})]}):j;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:xt(mt("inline-block w-full"),h),style:f,children:E}),k&&"undefined"!=typeof document?(0,c.createPortal)((0,d.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":z||"Image preview",className:mt("fixed inset-0 z-[9500] flex items-center justify-center p-4"),onClick:F,children:[(0,d.jsx)("div",{"aria-hidden":"true",className:mt("absolute inset-0"),style:{backgroundColor:"rgba(0,0,0,0.85)",backdropFilter:"blur(6px)"}}),(0,d.jsx)("img",{src:C,alt:z||"Full-size preview",onClick:e=>e.stopPropagation(),className:mt("relative z-10 max-w-full max-h-full"),style:{objectFit:"contain",borderRadius:"8px",boxShadow:"0 25px 60px rgba(0,0,0,0.5)"}}),(0,d.jsx)("button",{"aria-label":"Close preview",onClick:F,className:mt("absolute top-4 right-4 z-10 flex items-center justify-center","bg-transparent border-none cursor-pointer rounded-full p-2"),style:{color:"#fff",backgroundColor:"rgba(255,255,255,0.15)"},children:(0,d.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:[(0,d.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,d.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),document.body):null]})},exports.TkxImageEditor=Va,exports.TkxInput=Nt,exports.TkxKanban=es,exports.TkxLayout=Li,exports.TkxList=function({items:e,header:t,footer:n,bordered:r=!0,size:o="md",loading:i=!1,emptyText:a="No data",grid:l}){const s=J(),c=Te(),u=oe(a),p=wa[o],h=!!l,f=l?.column??1,m=l?.gutter??16;return(0,d.jsxs)("div",{role:"list","aria-label":"List","aria-busy":i,className:mt("font-sans rounded-lg overflow-hidden"),style:{border:r?`1px solid ${s.border}`:"none",backgroundColor:s.surface},children:[t&&(0,d.jsx)("div",{className:mt("font-semibold text-sm"),style:{padding:p,color:s.text,borderBottom:`1px solid ${s.border}`,backgroundColor:s.surfaceAlt},children:t}),i&&(0,d.jsx)("div",{children:Array.from({length:3}).map((e,t)=>(0,d.jsx)(ka,{theme:s,reducedMotion:c},t))}),!i&&0===e.length&&(0,d.jsx)("div",{role:"status",className:mt("text-center py-12 text-sm"),style:{color:s.textMuted},children:u}),!i&&e.length>0&&(0,d.jsx)("div",{style:h?{display:"grid",gridTemplateColumns:`repeat(${f}, 1fr)`,gap:m,padding:m}:void 0,children:e.map((t,n)=>{const r=oe(t.title),o=t.description?oe(t.description):void 0;return(0,d.jsxs)("div",{role:"listitem",className:mt("flex items-start gap-3"),style:{padding:p,borderBottom:!h&&n<e.length-1?`1px solid ${s.border}`:"none",...h?{border:`1px solid ${s.border}`,borderRadius:8,backgroundColor:s.surface}:{},animation:c?"none":`tkxFadeIn 0.2s ease ${.03*n}s both`},children:[t.avatar&&(0,d.jsx)("div",{"aria-hidden":"true",className:mt("shrink-0"),children:t.avatar}),(0,d.jsxs)("div",{className:mt("flex-1 min-w-0"),children:[(0,d.jsx)("div",{className:mt("text-sm font-medium"),style:{color:s.text},children:r}),o&&(0,d.jsx)("div",{className:mt("text-xs mt-1 leading-relaxed"),style:{color:s.textMuted},children:o})]}),t.extra&&(0,d.jsx)("div",{className:mt("shrink-0 ml-auto"),style:{color:s.textMuted},children:t.extra}),t.actions&&(0,d.jsx)("div",{className:mt("shrink-0 flex items-center gap-2"),children:t.actions})]},t.key)})}),n&&(0,d.jsx)("div",{className:mt("text-sm"),style:{padding:p,color:s.textMuted,borderTop:`1px solid ${s.border}`,backgroundColor:s.surfaceAlt},children:n})]})},exports.TkxMarkdown=Ci,exports.TkxMasonry=function({columns:e,gap:t=16,children:n}){J();const r=Te(),o=function(){const[e,t]=(0,a.useState)(()=>{if("undefined"==typeof window)return"lg";const e=window.innerWidth;return e>=1024?"lg":e>=768?"md":"sm"});return(0,a.useEffect)(()=>{if("undefined"==typeof window)return;const e=()=>{const e=window.innerWidth;t(e>=1024?"lg":e>=768?"md":"sm")};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e}();(0,a.useEffect)(()=>{!function(){if(si||"undefined"==typeof document)return;si=!0;const e=document.createElement("style");e.id="tkx-masonry-kf",e.textContent="\n @keyframes tkx-masonry-fade-in {\n from { opacity: 0; transform: translateY(8px); }\n to { opacity: 1; transform: translateY(0); }\n }\n ",document.head.appendChild(e)}()},[]);const i=function(e,t){return void 0===e?3:"number"==typeof e?Math.max(1,e):"lg"===t?e.lg??e.md??e.sm??3:"md"===t?e.md??e.sm??2:e.sm??1}(e,o),l=a.Children.toArray(n),s=(0,a.useMemo)(()=>{const e=Array.from({length:i},()=>[]);return l.forEach((t,n)=>{e[n%i].push(t)}),e},[l,i]);return(0,d.jsx)("div",{role:"list","aria-label":"Masonry grid",className:mt("flex w-full"),style:{gap:t,alignItems:"flex-start"},children:s.map((e,n)=>(0,d.jsx)("div",{className:mt("flex flex-col"),style:{flex:1,gap:t,minWidth:0},children:e.map((e,t)=>{return(0,d.jsx)("div",{role:"listitem",style:(o=t*i+n,r?{}:{animation:"tkx-masonry-fade-in 300ms cubic-bezier(0.16,1,0.3,1) both",animationDelay:`${Math.min(40*o,400)}ms`}),children:e},t);var o})},n))})},exports.TkxMentions=function({options:e,value:t="",onChange:n,trigger:r="@",placeholder:o,label:i}){const l=J(),s=Te(),c=(0,a.useRef)(null),u=(0,a.useRef)(null),[p,h]=(0,a.useState)(t),[f,m]=(0,a.useState)(!1),[g,x]=(0,a.useState)(""),[b,y]=(0,a.useState)(0),[v,w]=(0,a.useState)(-1);(0,a.useEffect)(()=>{void 0!==t&&h(t)},[t]);const k=e.filter(e=>e.label.toLowerCase().includes(g.toLowerCase())),$=(0,a.useCallback)(e=>{const t=Se(e.target.value);h(t),n?.(t);const o=e.target.selectionStart??t.length,i=t.slice(0,o),a=i.lastIndexOf(r);if(a>=0){const e=i.slice(a+r.length);if(!/\s/.test(e))return x(e),w(a),m(!0),void y(0)}m(!1)},[r,n]),S=(0,a.useCallback)(e=>{const t=p.slice(0,v),o=p.slice(v+r.length+g.length),i=`${t}${r}${e.value} ${o}`;h(i),n?.(i),m(!1),c.current?.focus()},[p,v,r,g,n]),C=(0,a.useCallback)(e=>{f&&("ArrowDown"===e.key?(e.preventDefault(),y(e=>(e+1)%k.length)):"ArrowUp"===e.key?(e.preventDefault(),y(e=>(e-1+k.length)%k.length)):"Enter"===e.key&&k[b]?(e.preventDefault(),S(k[b])):"Escape"===e.key&&m(!1))},[f,k,b,S]);(0,a.useEffect)(()=>{f&&u.current&&u.current.children[b]?.scrollIntoView({block:"nearest"})},[b,f]);const z=i?oe(i):void 0,M=o?oe(o):void 0;return(0,d.jsxs)("div",{className:mt("relative font-sans"),style:{width:"100%"},children:[z&&(0,d.jsx)("label",{className:mt("block text-sm font-medium mb-1"),style:{color:l.text},children:z}),(0,d.jsx)("textarea",{ref:c,role:"combobox","aria-expanded":f,"aria-haspopup":"listbox","aria-autocomplete":"list","aria-label":z??"Mentions input",value:p,placeholder:M,onChange:$,onKeyDown:C,onBlur:()=>setTimeout(()=>m(!1),200),className:mt("w-full rounded-lg border px-3 py-2 text-sm resize-y"),style:{backgroundColor:l.surface,borderColor:l.border,color:l.text,minHeight:80,outline:"none"},rows:3}),f&&k.length>0&&(0,d.jsx)("ul",{ref:u,role:"listbox","aria-label":"Mention suggestions",className:mt("absolute left-0 right-0 z-50 rounded-lg border overflow-auto"),style:{backgroundColor:l.surface,borderColor:l.border,maxHeight:200,top:"100%",marginTop:4,listStyle:"none",padding:0,boxShadow:`0 4px 12px ${l.bg}80`,animation:s?"none":"tkxFadeIn 0.15s ease"},children:k.map((e,t)=>(0,d.jsxs)("li",{role:"option","aria-selected":t===b,className:mt("flex items-center gap-3 px-3 py-2 cursor-pointer text-sm"),style:{backgroundColor:t===b?l.surfaceAlt:"transparent",color:l.text},onMouseDown:t=>{t.preventDefault(),S(e)},onMouseEnter:()=>y(t),children:[e.avatar&&(0,d.jsx)("img",{src:oe(e.avatar),alt:"","aria-hidden":"true",width:24,height:24,className:mt("rounded-full"),style:{objectFit:"cover"}}),(0,d.jsx)("span",{children:oe(e.label)}),(0,d.jsxs)("span",{style:{color:l.textMuted,marginLeft:"auto"},children:[r,oe(e.value)]})]},e.value))})]})},exports.TkxMenu=Vr,exports.TkxMessageThread=$r,exports.TkxMindMap=function({root:e,selectedId:t,collapsedIds:n,onSelect:r,onToggle:o,leafHeight:i=44,levelWidth:l=200,nodeWidth:s=160,style:c,className:u}){const[p,h]=(0,a.useState)(e.id),[f,m]=(0,a.useState)(()=>{const t=new Set;return function e(n){n.collapsed&&t.add(n.id),n.children?.forEach(e)}(e),t}),g=void 0!==t?t:p,x=n??f,b=(0,a.useRef)(null),y=(0,a.useMemo)(()=>Ps(e,0,x,0),[e,x]),v=(0,a.useMemo)(()=>Fs(y,l,i),[y,l,i]),w=(0,a.useMemo)(()=>function(e){const t=new Map,n=new Map,r=new Map;return function e(o,i){if(t.set(o.node.id,i),r.set(o.node.id,o.children[0]?.node.id??null),n.has(o.node.id)||n.set(o.node.id,[o.node.id]),o.children.length){const t=o.children.map(e=>e.node.id);for(const r of o.children)n.set(r.node.id,t),e(r,o.node.id)}}(e,null),{parents:t,siblings:n,firstChild:r}}(y),[y]),k=Math.max(...v.map(e=>e.x),0)+s,$=Math.max(...v.map(e=>e.y),0)+i,S=Math.min(...v.map(e=>e.y),0),C=$-S+i,z=(0,a.useCallback)(e=>{void 0===t&&h(e);const n=v.find(t=>t.laid.node.id===e)?.laid.node;n&&r?.(e,n)},[t,r,v]),M=(0,a.useCallback)(e=>{const t=x.has(e);void 0===n&&m(n=>{const r=new Set(n);return t?r.delete(e):r.add(e),r}),o?.(e,!t)},[x,n,o]);return(0,d.jsx)("div",{ref:b,className:u,role:"tree","aria-label":"Mind map",tabIndex:0,onKeyDown:e=>{if(!g)return;const{parents:t,siblings:n,firstChild:r}=w;let o;switch(e.key){case"ArrowRight":x.has(g)?M(g):o=r.get(g)??void 0;break;case"ArrowLeft":{const e=t.get(g);e?o=e:!x.has(g)&&r.get(g)&&M(g);break}case"ArrowUp":case"ArrowDown":{const t=n.get(g);if(!t||t.length<2)break;const r=t.indexOf(g),i="ArrowUp"===e.key?r-1:r+1;i>=0&&i<t.length&&(o=t[i]);break}case"Enter":case" ":M(g),e.preventDefault();break;default:return}o&&(e.preventDefault(),z(o))},"data-testid":"tkx-mindmap",style:{position:"relative",width:"100%",overflow:"auto",outline:"none",background:"var(--tkx-bg, #0a0a0f)",color:"var(--tkx-fg, #e8e8f4)",...c},children:(0,d.jsxs)("div",{style:{position:"relative",width:k+24,height:C+24,padding:12},children:[(0,d.jsx)("svg",{"aria-hidden":"true",width:k+24,height:C+24,style:{position:"absolute",top:0,left:0,pointerEvents:"none",transform:`translate(0, ${12-S}px)`},children:v.map(e=>{if(!e.parentId)return null;const t=v.find(t=>t.laid.node.id===e.parentId);if(!t)return null;const n=t.x+s,r=t.y+i/2,o=e.x,a=e.y+i/2,l=(n+o)/2,c=e.laid.node.color||"var(--tkx-accent, #00f5d4)";return(0,d.jsx)("path",{d:`M ${n} ${r} C ${l} ${r}, ${l} ${a}, ${o} ${a}`,stroke:c,strokeOpacity:.5,strokeWidth:1.5,fill:"none"},`${e.parentId}->${e.laid.node.id}`)})}),v.map(e=>{const t=e.laid.node.id===g,n=e.laid.node.color||"var(--tkx-accent, #00f5d4)";return(0,d.jsxs)("div",{role:"treeitem","aria-selected":t,"aria-expanded":e.laid.hasChildren?!e.laid.collapsed:void 0,"data-testid":`mindmap-node-${e.laid.node.id}`,onClick:()=>z(e.laid.node.id),onDoubleClick:()=>e.laid.hasChildren&&M(e.laid.node.id),style:{position:"absolute",left:e.x+12,top:e.y-S+12,width:s,height:i-8,display:"flex",alignItems:"center",gap:6,padding:"4px 10px",borderRadius:8,border:`1px solid ${t?n:"var(--tkx-border, #2a2a3e)"}`,background:t?`${n}1a`:"var(--tkx-bg-subtle, #12121a)",cursor:"pointer",fontSize:13,lineHeight:1.3,boxShadow:t?`0 0 0 2px ${n}33`:"none",transition:"border-color 0.12s, box-shadow 0.12s",boxSizing:"border-box"},children:[e.laid.hasChildren&&(0,d.jsx)("button",{type:"button","aria-label":e.laid.collapsed?"Expand":"Collapse","data-testid":`mindmap-toggle-${e.laid.node.id}`,onClick:t=>{t.stopPropagation(),M(e.laid.node.id)},style:{width:20,height:20,flex:"0 0 20px",borderRadius:4,border:"none",background:n,color:"#0a0a0f",cursor:"pointer",fontSize:12,fontWeight:700,display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:1},children:e.laid.collapsed?"+":"−"}),(0,d.jsx)("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:e.laid.node.label,children:e.laid.node.label})]},e.laid.node.id)})]})})},exports.TkxModal=function({isOpen:e,onClose:t,title:n,size:r="md",closeOnOverlayClick:o=!0,closeOnEscape:i=!0,children:l,footer:s}){const u=J(),p=Ot(),h=(0,a.useId)(),f=We(e),m=Te(),g=je(),x=oe(n),b="full"===r;return Ee(t,i&&e),(0,a.useEffect)(()=>{if(e){if(1===++Ut&&(document.body.style.overflow="hidden"),g(x,"polite"),Me())try{window.dispatchEvent(new CustomEvent("tkx:framed-modal",{detail:{title:x,at:Date.now()}}))}catch{}}else Kt();return()=>{e&&Kt()}},[e,x,g]),e&&"undefined"!=typeof document?(0,c.createPortal)((0,d.jsxs)("div",{role:"presentation",className:mt("fixed inset-0 z-[9000] flex",b?"items-stretch":"items-center justify-center",b?"":"p-4"),children:[(0,d.jsx)("div",{"aria-hidden":"true",onClick:o?t:void 0,className:mt("absolute inset-0",!m&&"animate-fade-in"),style:{backgroundColor:"rgba(0,0,0,0.6)",backdropFilter:"blur(4px)"}}),(0,d.jsxs)("div",{ref:f,role:"dialog","aria-modal":"true","aria-labelledby":h,className:mt("relative z-10 flex flex-col overflow-hidden",!m&&"animate-slide-up",b?"":"rounded-xl"),style:{backgroundColor:u.surface,border:`1px solid ${u.border}`,width:qt[r],maxWidth:"100%",maxHeight:b?"100vh":"90vh",boxShadow:`0 20px 60px ${u.bg}80`},children:[(0,d.jsxs)("div",{className:mt("flex items-center justify-between px-6 py-5 shrink-0"),style:{borderBottom:`1px solid ${u.border}`},children:[(0,d.jsx)("h2",{id:h,className:mt("m-0 text-lg font-semibold font-sans"),style:{color:u.text},children:x}),(0,d.jsx)("button",{onClick:t,"aria-label":p.close,className:mt("bg-transparent border-none cursor-pointer rounded p-1 flex items-center justify-center focus-visible:focus-ring"),style:{color:u.textMuted},children:(0,d.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:[(0,d.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,d.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),(0,d.jsx)("div",{className:mt("flex-1 overflow-y-auto px-6 py-6 font-sans"),style:{color:u.text},children:l}),s&&(0,d.jsx)("div",{className:mt("flex justify-end gap-2 px-6 py-4 shrink-0"),style:{borderTop:`1px solid ${u.border}`},children:s})]})]}),document.body):null},exports.TkxNumberInput=vo,exports.TkxOTP=So,exports.TkxOrgChart=Fl,exports.TkxPagination=_n,exports.TkxPanInput=yl,exports.TkxParagraph=function({children:e,type:t="default",copyable:n=!1,ellipsis:r=!1,style:o}){const i=J(),l="secondary"===t?i.textMuted:i.text,s=Ji(e),d="string"==typeof e?oe(e):e,c={};if(r){const e="object"==typeof r?r.rows??3:3;c.display="-webkit-box",c.WebkitLineClamp=e,c.WebkitBoxOrient="vertical",c.overflow="hidden"}return(0,a.createElement)("div",{style:{color:l,fontSize:"1rem",lineHeight:"1.6",margin:"0 0 1em 0",...c,...o}},d,n&&(0,a.createElement)(Qi,{text:s}))},exports.TkxPaymentButton=Ka,exports.TkxPeerChat=$r,exports.TkxPhoneInput=ja,exports.TkxPivotTable=function({data:e,rows:t,cols:n=[],values:r,sortRows:o=Rd,sortCols:i=Rd,showTotals:l=!0,formatNumber:s=Cd,style:c,className:u}){if(0===r.length)throw new Error("TkxPivotTable: values must contain at least one entry");const{rowPaths:p,colPaths:h,lookup:f,rowTotals:m,colTotals:g,grandTotal:x}=(0,a.useMemo)(()=>{const a=zd(),l=zd(),s=new Map,d=new Map,c=new Map,u=r.map(()=>({sum:0,count:0,min:1/0,max:-1/0}));for(const o of e){const e=$d(o,t),i=$d(o,n),p=e.join(""),h=i.join("");let f=a;for(const t of e)f=Md(f,t);let m=l;for(const t of i)m=Md(m,t);let g=s.get(p);g||(g=new Map,s.set(p,g));let x=g.get(h);x||(x=r.map(()=>({sum:0,count:0,min:1/0,max:-1/0})),g.set(h,x));let b=d.get(p);b||(b=r.map(()=>({sum:0,count:0,min:1/0,max:-1/0})),d.set(p,b));let y=c.get(h);y||(y=r.map(()=>({sum:0,count:0,min:1/0,max:-1/0})),c.set(h,y)),r.forEach((e,t)=>{let n;if("count"===e.agg)n=1;else{const t=o[e.field??""];if("number"!=typeof t)return;n=t}wd(x[t],n),wd(b[t],n),wd(y[t],n),wd(u[t],n)})}return Nd(a,0,o),Nd(l,0,i),{rowPaths:t.length>0?Dd(a,t.length):[[]],colPaths:n.length>0?Dd(l,n.length):[[]],lookup:(e,t,n)=>{const o=s.get(e.join(""));if(!o)return null;const i=o.get(t.join(""));return i?kd(i[n],r[n].agg):null},rowTotals:(e,t)=>{const n=d.get(e.join(""));return n?kd(n[t],r[t].agg):null},colTotals:(e,t)=>{const n=c.get(e.join(""));return n?kd(n[t],r[t].agg):null},grandTotal:e=>kd(u[e],r[e].agg)}},[e,t,n,r,o,i]);h.length,r.length,l&&r.length;const b=n.length,y="6px 10px",v="var(--tkx-bg-subtle, #0d0d14)",w="var(--tkx-border, #2a2a3e)",k="var(--tkx-border-soft, #1a1a25)";return(0,d.jsx)("div",{className:u,style:{overflow:"auto",border:`1px solid ${w}`,borderRadius:8,background:"var(--tkx-bg, #0a0a0f)",color:"var(--tkx-fg, #e8e8f4)",...c},"data-testid":"tkx-pivot",children:(0,d.jsxs)("table",{role:"table",style:{borderCollapse:"collapse",width:"100%",fontSize:13,fontFamily:"inherit"},children:[(0,d.jsxs)("thead",{children:[Array.from({length:b}).map((e,n)=>(0,d.jsxs)("tr",{children:[0===n&&(0,d.jsx)("th",{rowSpan:b+1,colSpan:t.length,style:{background:v,border:`1px solid ${w}`,padding:y,fontWeight:700,color:"#888",textAlign:"left"},children:t.join(" / ")||""}),(()=>{const e=[];for(const t of h){const o=t[n]??"",i=e[e.length-1];i&&i.key===o?i.span+=r.length:e.push({key:o,span:r.length})}return e.map((e,t)=>(0,d.jsx)("th",{colSpan:e.span,"data-testid":`pivot-colhead-${n}-${e.key}`,style:{background:v,border:`1px solid ${w}`,padding:y,fontWeight:700,textAlign:"center"},children:e.key},t))})(),l&&0===n&&(0,d.jsx)("th",{rowSpan:b,colSpan:r.length,style:{background:v,border:`1px solid ${w}`,padding:y,fontWeight:700,color:"var(--tkx-accent, #00f5d4)",textAlign:"center"},children:"Total"})]},`ch${n}`)),(0,d.jsxs)("tr",{children:[0===b&&(0,d.jsx)("th",{colSpan:t.length,style:{background:v,border:`1px solid ${w}`,padding:y,fontWeight:700,color:"#888",textAlign:"left"},children:t.join(" / ")||""}),h.map((e,t)=>r.map((e,n)=>(0,d.jsx)("th",{"data-testid":`pivot-vhead-${t}-${n}`,style:{background:v,border:`1px solid ${k}`,padding:y,fontSize:11,fontWeight:600,color:"#aaa",textAlign:"right"},children:Sd(e)},`${t}-${n}`))),l&&r.map((e,t)=>(0,d.jsx)("th",{style:{background:v,border:`1px solid ${k}`,padding:y,fontSize:11,fontWeight:600,color:"var(--tkx-accent, #00f5d4)",textAlign:"right"},children:Sd(e)},`tv-${t}`))]})]}),(0,d.jsxs)("tbody",{children:[p.map((e,t)=>(0,d.jsxs)("tr",{"data-testid":`pivot-row-${t}`,children:[e.map((e,t)=>(0,d.jsx)("th",{scope:"row",style:{background:"var(--tkx-bg-subtle, #12121a)",border:`1px solid ${k}`,padding:y,fontWeight:600,textAlign:"left"},children:e},t)),h.map((n,o)=>r.map((r,i)=>{const a=f(e,n,i);return(0,d.jsx)("td",{"data-testid":`pivot-cell-${t}-${o}-${i}`,style:{border:`1px solid ${k}`,padding:y,textAlign:"right",fontVariantNumeric:"tabular-nums"},children:null===a?"":s(a)},`${o}-${i}`)})),l&&r.map((n,r)=>{const o=m(e,r);return(0,d.jsx)("td",{"data-testid":`pivot-rowtotal-${t}-${r}`,style:{border:`1px solid ${w}`,padding:y,textAlign:"right",fontWeight:700,background:"rgba(0,245,212,0.04)",fontVariantNumeric:"tabular-nums"},children:null===o?"":s(o)},`rt-${r}`)})]},t)),l&&(0,d.jsxs)("tr",{"data-testid":"pivot-totals-row",children:[(0,d.jsx)("th",{colSpan:Math.max(t.length,1),scope:"row",style:{background:v,border:`1px solid ${w}`,padding:y,fontWeight:700,color:"var(--tkx-accent, #00f5d4)",textAlign:"left"},children:"Total"}),h.map((e,t)=>r.map((n,r)=>{const o=g(e,r);return(0,d.jsx)("td",{"data-testid":`pivot-coltotal-${t}-${r}`,style:{border:`1px solid ${w}`,padding:y,textAlign:"right",fontWeight:700,background:"rgba(0,245,212,0.04)",fontVariantNumeric:"tabular-nums"},children:null===o?"":s(o)},`ct-${t}-${r}`)})),r.map((e,t)=>{const n=x(t);return(0,d.jsx)("td",{"data-testid":`pivot-grandtotal-${t}`,style:{border:`1px solid ${w}`,padding:y,textAlign:"right",fontWeight:700,background:"rgba(0,245,212,0.1)",color:"var(--tkx-accent, #00f5d4)",fontVariantNumeric:"tabular-nums"},children:null===n?"":s(n)},`gt-${t}`)})]})]})]})})},exports.TkxPlanSelector=Nl,exports.TkxPopover=function({trigger:e,content:t,placement:n="bottom",isOpen:r,onOpenChange:o,closeOnClickOutside:i=!0,className:l,style:s}){const u=J(),p=Te(),h=(0,a.useId)(),f=void 0!==r,[m,g]=(0,a.useState)(!1),x=f?r:m,b=(0,a.useRef)(null),y=(0,a.useRef)(null);(0,a.useRef)(null);const[v,w]=(0,a.useState)(null),k=(0,a.useCallback)(e=>{f||g(e),o?.(e)},[f,o]),$=(0,a.useCallback)(()=>k(!1),[k]),S=(0,a.useCallback)(()=>k(!x),[k,x]);Ee($,x),(0,a.useEffect)(()=>{if(!x||!i)return;const e=e=>{const t=e.target;b.current?.contains(t)||y.current?.contains(t)||$()};return document.addEventListener("pointerdown",e),()=>document.removeEventListener("pointerdown",e)},[x,i,$]),(0,a.useEffect)(()=>{if(!x||!b.current)return;const e=()=>{b.current&&y.current&&w(function(e,t,n){const r=t.getBoundingClientRect(),o=window.scrollX,i=window.scrollY,a=window.innerWidth,l=window.innerHeight;let s=0,d=0,c=n;const u={top:e.top-r.height-8-8>0,bottom:e.bottom+r.height+8+8<l,left:e.left-r.width-8-8>0,right:e.right+r.width+8+8<a};if(!u[n]){const e={top:"bottom",bottom:"top",left:"right",right:"left"};u[e[n]]&&(c=e[n])}switch(c){case"top":s=e.top+i-r.height-8-8,d=e.left+o+e.width/2-r.width/2;break;case"bottom":s=e.bottom+i+8+8,d=e.left+o+e.width/2-r.width/2;break;case"left":s=e.top+i+e.height/2-r.height/2,d=e.left+o-r.width-8-8;break;case"right":s=e.top+i+e.height/2-r.height/2,d=e.right+o+8+8}d=Math.max(8,Math.min(d,a+o-r.width-8)),s=Math.max(8,Math.min(s,l+i-r.height-8));const p={position:"absolute",width:0,height:0,borderStyle:"solid",borderWidth:8};switch(c){case"top":Object.assign(p,{bottom:-16,left:"50%",transform:"translateX(-50%)",borderColor:"var(--tkx-popover-bg) transparent transparent transparent"});break;case"bottom":Object.assign(p,{top:-16,left:"50%",transform:"translateX(-50%)",borderColor:"transparent transparent var(--tkx-popover-bg) transparent"});break;case"left":Object.assign(p,{right:-16,top:"50%",transform:"translateY(-50%)",borderColor:"transparent transparent transparent var(--tkx-popover-bg)"});break;case"right":Object.assign(p,{left:-16,top:"50%",transform:"translateY(-50%)",borderColor:"transparent var(--tkx-popover-bg) transparent transparent"})}return{top:s,left:d,arrowStyle:p,resolvedPlacement:c}}(b.current.getBoundingClientRect(),y.current,n))};return requestAnimationFrame(e),window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}},[x,n]);const C=p?{opacity:1}:{animation:"tkxPopoverFadeIn 150ms ease forwards",opacity:0},z=x&&"undefined"!=typeof document?(0,c.createPortal)((0,d.jsxs)("div",{ref:y,id:h,role:"dialog","aria-modal":"false",className:mt("absolute z-[9100] rounded-lg font-sans",l??""),style:{"--tkx-popover-bg":u.surface,top:v?.top??-9999,left:v?.left??-9999,backgroundColor:u.surface,border:`1px solid ${u.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:u.text,...C,...s},children:[v&&(0,d.jsx)("span",{style:v.arrowStyle,"aria-hidden":"true"}),t]}),document.body):null;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{ref:b,className:mt("inline-flex"),onClick:S,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),S())},"aria-expanded":x,"aria-haspopup":"dialog","aria-controls":x?h:void 0,children:e}),z,x&&!p&&(0,d.jsx)("style",{children:"\n @keyframes tkxPopoverFadeIn {\n from { opacity: 0; transform: translateY(4px); }\n to { opacity: 1; transform: translateY(0); }\n }\n "})]})},exports.TkxProgress=At,exports.TkxProrationPreview=function({newPlan:e,currentPlan:t,cycle:n,daysRemaining:r,cycleDays:o,className:i,style:a,children:l}){const s=J(),c=o>0?r/o:0,u=t.prices[n]*c,p=e.prices[n]*c,h=Math.max(0,p-u),f=Math.max(0,u-p),m={border:`1px solid ${s.border}`,borderRadius:12,padding:20,background:s.surface,...a},g={display:"flex",justifyContent:"space-between",fontSize:13,padding:"6px 0"},x=t=>Ml(t,e.currency,e.locale);return(0,d.jsxs)("div",{className:i,style:m,children:[(0,d.jsx)("div",{style:{fontSize:12,fontWeight:700,color:s.textMuted,textTransform:"uppercase",letterSpacing:.5,marginBottom:12},children:"Plan change"}),(0,d.jsxs)("div",{style:{...g,color:s.textMuted},children:[(0,d.jsxs)("span",{children:["From ",(0,d.jsx)("strong",{style:{color:s.text},children:t.name})]}),(0,d.jsx)("span",{children:"→"}),(0,d.jsxs)("span",{children:["To ",(0,d.jsx)("strong",{style:{color:s.primary},children:e.name})]})]}),(0,d.jsx)("hr",{style:{border:0,borderTop:`1px solid ${s.border}`,margin:"8px 0"}}),(0,d.jsxs)("div",{style:{...g,color:s.textMuted},children:[(0,d.jsx)("span",{children:"Days remaining in cycle"}),(0,d.jsxs)("span",{children:[r," / ",o]})]}),(0,d.jsxs)("div",{style:{...g,color:s.textMuted},children:[(0,d.jsxs)("span",{children:["Credit from ",t.name]}),(0,d.jsxs)("span",{children:["−",x(u)]})]}),(0,d.jsxs)("div",{style:{...g,color:s.textMuted},children:[(0,d.jsxs)("span",{children:["Charge for ",e.name," (prorated)"]}),(0,d.jsx)("span",{children:x(p)})]}),(0,d.jsx)("hr",{style:{border:0,borderTop:`1px solid ${s.border}`,margin:"8px 0"}}),h>0?(0,d.jsxs)("div",{style:{...g,fontSize:16,fontWeight:700},children:[(0,d.jsx)("span",{style:{color:s.text},children:"Due today"}),(0,d.jsx)("span",{style:{color:s.primary},children:x(h)})]}):(0,d.jsxs)("div",{style:{...g,fontSize:14,color:s.success},children:[(0,d.jsx)("span",{children:"Credit applied at next billing"}),(0,d.jsx)("span",{children:x(f)})]}),(0,d.jsx)("div",{style:{...g,color:s.textMuted,fontSize:12,marginTop:6},children:(0,d.jsxs)("span",{children:["Then ",x(e.prices[n])," / ","monthly"===n?"month":"year"]})}),l&&(0,d.jsx)("div",{style:{marginTop:16},children:l})]})},exports.TkxQRCode=function({value:e,size:t=160,color:n,bgColor:r,errorLevel:o="M",icon:i,bordered:l=!0}){const s=J(),c=Te(),u=(0,a.useRef)(null),p=oe(e),h=n??s.text,f=r??s.surface,m=(0,a.useMemo)(()=>function(e,t,n){const r=function(e){let t=e;return()=>(t=1664525*t+1013904223|0,(t>>>0)/4294967295)}(function(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n)|0;return Math.abs(t)}(e)),o=pa[n]??.42,i=Array.from({length:t},()=>Array.from({length:t},()=>!1)),a=(e,t)=>{for(let n=0;n<7;n++)for(let r=0;r<7;r++){const o=0===n||6===n||0===r||6===r,a=n>=2&&n<=4&&r>=2&&r<=4;i[e+n][t+r]=o||a}};a(0,0),a(0,18),a(18,0);for(let l=7;l<18;l++)i[6][l]=l%2==0,i[l][6]=l%2==0;for(let l=0;l<t;l++)for(let e=0;e<t;e++)l<8&&e<8||l<8&&e>=17||l>=17&&e<8||6===l||6===e||(i[l][e]=r()<o);return i}(p,25,o),[p,o]);return(0,a.useEffect)(()=>{const e=u.current;if(!e)return;const n=e.getContext("2d");if(!n)return;const r=window.devicePixelRatio||1;e.width=t*r,e.height=t*r,n.scale(r,r);const o=t/25;n.fillStyle=f,n.fillRect(0,0,t,t),n.fillStyle=h;for(let t=0;t<25;t++)for(let e=0;e<25;e++)m[t][e]&&n.fillRect(e*o,t*o,o,o);if(i){const e=.22*t,r=(t-e)/2;n.fillStyle=f,n.fillRect(r-2,r-2,e+4,e+4);const o=new Image;o.crossOrigin="anonymous",o.onload=()=>{n.drawImage(o,r,r,e,e)},o.src=oe(i)}},[m,t,h,f,i]),(0,d.jsx)("div",{role:"img","aria-label":`QR code for: ${p}`,className:mt("inline-block rounded-lg"),style:{padding:l?12:0,backgroundColor:l?f:"transparent",border:l?`1px solid ${s.border}`:"none",lineHeight:0,animation:c?"none":"tkxFadeIn 0.2s ease"},children:(0,d.jsx)("canvas",{ref:u,"aria-hidden":"true",style:{width:t,height:t,display:"block"}})})},exports.TkxRadio=pn,exports.TkxRadioGroup=function({name:e,value:t,defaultValue:n="",onChange:r,label:o,orientation:i="vertical",isDisabled:l=!1,isInvalid:s=!1,errorMessage:c,children:u}){const p=J(),h=`${(0,a.useId)()}-error`,[f,m]=(0,a.useState)(n),g=void 0!==t,x=g?t:f,b=s||!!c;return(0,d.jsx)(cn.Provider,{value:{name:e,value:x,onChange:e=>{g||m(e),r?.(e)},isDisabled:l,isInvalid:s},children:(0,d.jsxs)("div",{role:"radiogroup","aria-label":o?oe(o):void 0,"aria-describedby":b?h:void 0,"aria-invalid":b,children:[o&&(0,d.jsx)("div",{className:mt("text-sm font-medium font-sans mb-2"),style:{color:p.text},children:oe(o)}),(0,d.jsx)("div",{className:mt("horizontal"===i?"flex flex-row flex-wrap gap-4":"flex flex-col gap-2"),children:u}),b&&c&&(0,d.jsxs)("span",{id:h,role:"alert",className:mt("text-xs flex items-center gap-1 mt-1"),style:{color:p.danger},children:[(0,d.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.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"})}),oe(c)]})]})})},exports.TkxRating=function({value:e,defaultValue:t=0,onChange:n,max:r=5,precision:o=1,size:i="md",isReadOnly:l=!1,isDisabled:s=!1,label:c,showValue:u=!1,colorScheme:p="warning",emptyIcon:h="star",filledIcon:f="star"}){const m=J(),g=Te(),x=(0,a.useId)(),b=void 0!==e,[y,v]=(0,a.useState)(t),[w,k]=(0,a.useState)(null),$=(0,a.useRef)(null),S=b?e??0:y,C=w??S,z={warning:m.warning,primary:m.primary,danger:m.danger}[p]??m.warning,M=or[i],N=!l&&!s,D=(0,a.useCallback)(e=>{b||v(e),n?.(e)},[b,n]),R=(0,a.useCallback)((e,t)=>{N&&k(cr(e,t,o))},[N,o]),P=(0,a.useCallback)(()=>{N&&k(null)},[N]),F=(0,a.useCallback)((e,t)=>{if(!N)return;const n=cr(e,t,o);D(n===S?0:n)},[N,o,S,D]),I=(0,a.useCallback)(e=>{if(!N)return;const t=o;let n=S;if("ArrowRight"===e.key||"ArrowUp"===e.key)e.preventDefault(),n=dr(S+t,0,r);else if("ArrowLeft"===e.key||"ArrowDown"===e.key)e.preventDefault(),n=dr(S-t,0,r);else if("Home"===e.key)e.preventDefault(),n=0;else{if("End"!==e.key)return;e.preventDefault(),n=r}n=function(e,t){return 1===t?Math.round(e):Math.round(2*e)/2}(n,o),D(n)},[N,S,r,o,D]),A=c?oe(c):"Rating";return(0,d.jsxs)("div",{className:xt(mt("inline-flex items-center gap-2 font-sans"),s?mt("opacity-50"):""),children:[(0,d.jsx)("div",{ref:$,role:"radiogroup","aria-label":A,"aria-disabled":s,"aria-readonly":l,tabIndex:N?0:-1,onKeyDown:I,onMouseLeave:P,className:mt("flex items-center gap-0.5 outline-none"),style:{cursor:N?"pointer":"default"},children:Array.from({length:r},(e,t)=>{const n=t+1,r=t+.5,i=C>=n,a=!i&&.5===o&&C>=r,l=`${x}-${t}`;return(0,d.jsx)("span",{role:"radio","aria-checked":.5===o&&S===r||S===n,"aria-label":.5===o?`${r} star${1!==r?"s":""} / ${n} star${1!==n?"s":""}`:`${n} star${1!==n?"s":""}`,tabIndex:-1,onMouseMove:e=>R(e,t),onClick:e=>F(e,t),style:{display:"inline-flex",alignItems:"center",lineHeight:0,transition:g?"none":"transform 120ms ease",transform:null!==w&&C>=r&&N?"scale(1.15)":"scale(1)"},children:(0,d.jsx)(sr,{type:i||a?f:h,size:M,filled:i,halfFilled:a,color:i||a?z:m.border,uid:a?l:void 0})},t)})}),u&&(0,d.jsxs)("span",{className:mt("text-sm tabular-nums"),style:{color:m.textMuted},"aria-live":"polite","aria-atomic":"true",children:[S%1==0?S.toFixed(0):S.toFixed(1)," / ",r]})]})},exports.TkxResult=function({status:e,title:t,subTitle:n,icon:r,extra:o}){const i=J(),a=Te(),l=function(e,t){switch(e){case"success":return t.success;case"error":case"500":return t.danger;case"warning":return t.warning;case"info":return t.info;case"404":case"403":return t.textMuted}}(e,i),s=oe(t),c=n?oe(n):void 0;return(0,d.jsxs)("div",{role:"status","aria-live":"polite",className:mt("flex flex-col items-center text-center px-6 py-12 font-sans"),style:{animation:a?"none":"tkxFadeIn 0.3s ease"},children:[(0,d.jsx)("div",{className:mt("mb-6"),children:r??ha[e](l)}),(0,d.jsx)("h2",{className:mt("text-xl font-semibold m-0 mb-2"),style:{color:i.text},children:s}),c&&(0,d.jsx)("p",{className:mt("text-sm m-0 mb-6 max-w-md leading-relaxed"),style:{color:i.textMuted},children:c}),o&&(0,d.jsx)("div",{className:mt("flex items-center gap-3 mt-4"),children:o})]})},exports.TkxRichEditor=cs,exports.TkxRichTextDisplay=function({blocks:e,className:t,style:n}){const r=J(),o=Ot(),i=Te(),l=(0,a.useMemo)(()=>e.map((e,t)=>{const n=ui[e.type];return n?(0,d.jsx)("div",{style:i?void 0:{animation:"tkx-rich-text-fade-in 300ms ease both",animationDelay:`${Math.min(30*t,300)}ms`},children:(0,d.jsx)(n,{block:e,index:t})},t):null}),[e,i]);return(0,a.useMemo)(()=>{if("undefined"==typeof document)return;if(document.getElementById("tkx-rich-text-kf"))return;const e=document.createElement("style");e.id="tkx-rich-text-kf",e.textContent="\n @keyframes tkx-rich-text-fade-in {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n ",document.head.appendChild(e)},[]),(0,d.jsx)("article",{"aria-label":o.richTextContent??"Rich text content",className:mt("font-sans",t??""),style:{color:r.text,maxWidth:720,...n},children:l})},exports.TkxRow=Oi,exports.TkxSEO=function({title:e,description:t,canonical:n,keywords:r,image:o,twitterSite:i,twitterCreator:l,ogType:s="website",locale:d,robots:c="index, follow, max-snippet:-1, max-image-preview:large",schema:u}){return(0,a.useEffect)(()=>{if("undefined"!=typeof document)return rl(),e&&(document.title=e),t&&ol("description",t),r&&ol("keywords",r),ol("robots",c),e&&ol("og:title",e,"property"),t&&ol("og:description",t,"property"),ol("og:type",s,"property"),n&&ol("og:url",n,"property"),o&&(ol("og:image",o,"property"),ol("og:image:width","1200","property"),ol("og:image:height","630","property")),d&&ol("og:locale",d,"property"),ol("twitter:card",o?"summary_large_image":"summary"),e&&ol("twitter:title",e),t&&ol("twitter:description",t),o&&ol("twitter:image",o),i&&ol("twitter:site",i),l&&ol("twitter:creator",l),n&&function(e,t){if("undefined"==typeof document||!t)return;const n=document.createElement("link");n.rel="canonical",n.href=t,n.setAttribute(nl,"1"),document.head.appendChild(n)}(0,n),u&&function(e){if("undefined"==typeof document)return;const t=Array.isArray(e)?e:[e];for(const n of t){const e=document.createElement("script");e.type="application/ld+json",e.text=JSON.stringify(n),e.setAttribute(nl,"1"),document.head.appendChild(e)}}(u),()=>rl()},[e,t,n,r,o,i,l,s,d,c,u]),null},exports.TkxSegmented=function({options:e,value:t,onChange:n,size:r="md",block:o=!1}){const i=J(),l=Te(),s=(0,a.useRef)(null),[c,u]=(0,a.useState)(()=>Math.max(0,e.findIndex(e=>e.value===t))),[p,h]=(0,a.useState)({}),f=ua[r];(0,a.useEffect)(()=>{const n=e.findIndex(e=>e.value===t);n>=0&&u(n)},[t,e]),(0,a.useEffect)(()=>{const e=s.current;if(!e)return;const t=e.querySelectorAll("[data-seg-btn]")[c];t&&h({left:t.offsetLeft,width:t.offsetWidth,height:t.offsetHeight,transition:l?"none":"left 0.2s ease, width 0.2s ease"})},[c,e,l]);const m=(0,a.useCallback)(t=>{const r=e[t];r&&!r.disabled&&(u(t),n?.(r.value))},[e,n]),g=(0,a.useCallback)(t=>{let n=c;if("ArrowRight"===t.key||"ArrowDown"===t.key)for(t.preventDefault(),n=(c+1)%e.length;e[n]?.disabled&&n!==c;)n=(n+1)%e.length;else if("ArrowLeft"===t.key||"ArrowUp"===t.key)for(t.preventDefault(),n=(c-1+e.length)%e.length;e[n]?.disabled&&n!==c;)n=(n-1+e.length)%e.length;n!==c&&(m(n),(s.current?.querySelectorAll("[data-seg-btn]"))?.[n]?.focus())},[c,e,m]);return(0,d.jsxs)("div",{ref:s,role:"radiogroup","aria-label":"Segmented control",className:mt("relative inline-flex items-center rounded-lg p-1"),style:{backgroundColor:i.surfaceAlt,border:`1px solid ${i.border}`,width:o?"100%":void 0},onKeyDown:g,children:[(0,d.jsx)("div",{"aria-hidden":"true",className:mt("absolute top-1 rounded-md"),style:{...p,backgroundColor:i.surface,boxShadow:`0 1px 3px ${i.border}`,zIndex:0}}),e.map((e,t)=>{const n=t===c,r=oe(e.label);return(0,d.jsxs)("button",{"data-seg-btn":!0,type:"button",role:"radio","aria-checked":n,"aria-disabled":e.disabled||void 0,disabled:e.disabled,tabIndex:n?0:-1,className:mt("relative z-10 flex items-center justify-center gap-1 rounded-md border-0 cursor-pointer","font-sans whitespace-nowrap select-none"),style:{height:f.height,fontSize:f.fontSize,padding:`0 ${f.px}px`,flex:o?1:void 0,color:n?i.text:i.textMuted,backgroundColor:"transparent",opacity:e.disabled?.4:1,fontWeight:n?600:400,transition:l?"none":"color 0.15s ease"},onClick:()=>m(t),children:[e.icon&&(0,d.jsx)("span",{"aria-hidden":"true",children:e.icon}),r]},e.value)})]})},exports.TkxSelect=ln,exports.TkxSider=ji,exports.TkxSignaturePad=Ya,exports.TkxSkeleton=_t,exports.TkxSlider=Zn,exports.TkxSnackbar=function({message:e,isOpen:t,onClose:n,action:r,variant:o="default",position:i="bottom-center",autoHideDuration:l=5e3,icon:s}){const u=J(),p=Te(),h=(0,a.useId)(),f=(0,a.useRef)(null),[m,g]=(0,a.useState)(!1),[x,b]=(0,a.useState)(!1);(0,a.useEffect)(()=>{!function(){if(Yo||"undefined"==typeof document)return;Yo=!0;const e=document.createElement("style");e.id="tkx-snackbar-kf",e.textContent="\n @keyframes tkx-snackbar-slide-up {\n from { opacity: 0; transform: translateY(24px); }\n to { opacity: 1; transform: translateY(0); }\n }\n @keyframes tkx-snackbar-slide-down {\n from { opacity: 0; transform: translateY(-24px); }\n to { opacity: 1; transform: translateY(0); }\n }\n @keyframes tkx-snackbar-fade-out {\n from { opacity: 1; }\n to { opacity: 0; transform: translateY(8px); }\n }\n ",document.head.appendChild(e)}()},[]),(0,a.useEffect)(()=>{if(t)b(!1),g(!0);else if(m){if(!p){b(!0);const e=setTimeout(()=>{g(!1),b(!1)},250);return()=>clearTimeout(e)}g(!1)}},[t,p,m]),(0,a.useEffect)(()=>{if(t&&!(l<=0)&&n)return f.current=setTimeout(()=>{n()},l),()=>{f.current&&clearTimeout(f.current)}},[t,l,n]);const y=(0,a.useCallback)(()=>{f.current&&(clearTimeout(f.current),f.current=null)},[]),v=(0,a.useCallback)(()=>{t&&l>0&&n&&(f.current=setTimeout(()=>n(),l))},[t,l,n]),w={default:u.textMuted,success:u.success,error:u.danger,warning:u.warning,info:u.info}[o],k=oe(e);if(!m||"undefined"==typeof document)return null;let $={};p||($=x?{animation:"tkx-snackbar-fade-out 250ms ease forwards"}:{animation:("top-center"===i?"tkx-snackbar-slide-down":"tkx-snackbar-slide-up")+" 250ms cubic-bezier(0.16,1,0.3,1) both"});const S=s??Xo[o]??null;return(0,c.createPortal)((0,d.jsx)("div",{role:"error"===o?"alert":"status","aria-live":"error"===o?"assertive":"polite","aria-atomic":"true","aria-labelledby":h,className:mt("fixed z-[9500] font-sans"),style:{...Zo[i],...$,pointerEvents:"auto"},onMouseEnter:y,onMouseLeave:v,children:(0,d.jsxs)("div",{className:mt("flex items-center gap-3 px-4 py-3 rounded-lg shadow-lg","min-w-[280px] max-w-[480px]"),style:{backgroundColor:u.surface,border:`1px solid ${w}44`,boxShadow:`0 8px 24px ${u.bg}aa`,color:u.text},children:[S&&(0,d.jsx)("span",{className:mt("shrink-0 flex items-center"),style:{color:w},children:S}),(0,d.jsx)("span",{id:h,className:mt("flex-1 text-sm leading-snug"),children:k}),r&&(0,d.jsx)("button",{onClick:()=>{r.onClick(),n?.()},className:mt("bg-transparent border-none cursor-pointer p-0 ml-2","text-sm font-semibold shrink-0","focus-visible:focus-ring"),style:{color:u.primary},children:oe(r.label)}),n&&(0,d.jsx)("button",{"aria-label":"Dismiss snackbar",onClick:n,className:mt("bg-transparent border-none cursor-pointer rounded p-[2px] ml-1","shrink-0 flex items-center justify-center","focus-visible:focus-ring"),style:{color:u.textMuted},children:(0,d.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:[(0,d.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,d.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})}),document.body)},exports.TkxSortable=Qa,exports.TkxSparkline=Xs,exports.TkxSpeedDial=function({actions:e,icon:t,direction:n="up",position:r="bottom-right",className:o,style:i}){const l=J(),s=Te(),u=(0,a.useId)(),[p,h]=(0,a.useState)(!1),[f,m]=(0,a.useState)(-1),g=(0,a.useRef)(null),x=(0,a.useRef)(new Map),b=(0,a.useCallback)(()=>{h(e=>!e),m(-1)},[]),y=(0,a.useCallback)(()=>{h(!1),m(-1)},[]);Ee(y,p),(0,a.useEffect)(()=>{if(!p)return;const e=e=>{g.current?.contains(e.target)||y()};return document.addEventListener("pointerdown",e),()=>document.removeEventListener("pointerdown",e)},[p,y]),(0,a.useEffect)(()=>{f>=0&&x.current.get(f)?.focus()},[f]);const v=e=>s?"0ms":40*e+"ms";return(0,d.jsxs)(d.Fragment,{children:[p&&"undefined"!=typeof document&&(0,c.createPortal)((0,d.jsx)("div",{"aria-hidden":"true",onClick:y,style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.3)",zIndex:9e3,transition:s?"none":"opacity 200ms ease"}}),document.body),(0,d.jsxs)("div",{ref:g,className:mt("fixed z-[9100] font-sans",o??""),style:{...qo[r],...i},children:[p&&e.map((t,r)=>{const o=oe(t.label),i=function(e,t){const n=64*(t+1);switch(e){case"up":return{bottom:n,left:"50%",transform:"translateX(-50%)"};case"down":return{top:n,left:"50%",transform:"translateX(-50%)"};case"left":return{right:n,top:"50%",transform:"translateY(-50%)"};case"right":return{left:n,top:"50%",transform:"translateY(-50%)"}}}(n,r),a=function(e){switch(e){case"up":case"down":return{right:"100%",top:"50%",transform:"translateY(-50%)",marginRight:10};case"left":case"right":return{bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:10}}}(n);return(0,d.jsx)("div",{className:mt("absolute"),style:{...i,opacity:s?1:0,animation:s?"none":"tkxSpeedDialIn 180ms ease forwards",animationDelay:v(r)},children:(0,d.jsxs)("div",{className:mt("relative inline-flex"),children:[(0,d.jsx)("span",{className:mt("absolute z-10 whitespace-nowrap text-xs py-1 px-2 rounded-md pointer-events-none"),style:{...a,backgroundColor:l.surfaceAlt,color:l.text,border:`1px solid ${l.border}`,boxShadow:"0 2px 8px rgba(0,0,0,0.15)"},role:"tooltip",children:o}),(0,d.jsx)("button",{ref:e=>{e?x.current.set(r,e):x.current.delete(r)},type:"button","aria-label":o,tabIndex:p?0:-1,onClick:()=>{t.onClick?.(),y()},onKeyDown:t=>((t,n)=>{switch(t.key){case"ArrowUp":case"ArrowLeft":t.preventDefault(),m(n>0?n-1:e.length-1);break;case"ArrowDown":case"ArrowRight":t.preventDefault(),m(n<e.length-1?n+1:0);break;case"Enter":case" ":t.preventDefault(),e[n].onClick?.(),y();break;case"Escape":y();break;case"Home":t.preventDefault(),m(0);break;case"End":t.preventDefault(),m(e.length-1)}})(t,r),className:mt("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:48,height:48,backgroundColor:l.surface,color:l.text,border:`1px solid ${l.border}`,boxShadow:"0 4px 12px rgba(0,0,0,0.15)",transition:s?"none":"all 150ms ease"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor=l.surfaceAlt,e.currentTarget.style.transform="scale(1.1)"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=l.surface,e.currentTarget.style.transform="scale(1)"},children:t.icon})]})},t.id)}),(0,d.jsx)("button",{type:"button","aria-label":p?"Close actions menu":"Open actions menu","aria-expanded":p,"aria-controls":u,"aria-haspopup":"true",onClick:b,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),b()),p&&("ArrowUp"!==e.key&&"ArrowLeft"!==e.key||(e.preventDefault(),m(0)),"ArrowDown"!==e.key&&"ArrowRight"!==e.key||(e.preventDefault(),m(0)))},className:mt("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:56,height:56,backgroundColor:l.primary,color:l.bg,boxShadow:`0 6px 20px ${l.primary}40`,transition:s?"none":"all 200ms ease",position:"relative",zIndex:1},onMouseEnter:e=>{e.currentTarget.style.boxShadow=`0 8px 28px ${l.primary}60`,s||(e.currentTarget.style.transform="scale(1.05)")},onMouseLeave:e=>{e.currentTarget.style.boxShadow=`0 6px 20px ${l.primary}40`,e.currentTarget.style.transform="scale(1)"},children:t??(0,d.jsx)(Oo,{color:l.bg,rotated:p,reducedMotion:s})}),(0,d.jsx)("div",{id:u,role:"menu","aria-label":"Speed dial actions",style:{display:"none"},children:e.map(e=>(0,d.jsx)("div",{role:"menuitem",children:oe(e.label)},e.id))})]}),p&&!s&&(0,d.jsx)("style",{children:"\n @keyframes tkxSpeedDialIn {\n from { opacity: 0; transform: translateX(-50%) scale(0.5); }\n to { opacity: 1; transform: translateX(-50%) scale(1); }\n }\n "})]})},exports.TkxSpin=function({spinning:e=!0,size:t="md",tip:n,indicator:r,children:o,fullscreen:i=!1,delay:l=0,style:s}){const d=J(),c=Te(),[u,p]=(0,a.useState)(0===l&&e),h=(0,a.useRef)(null);if((0,a.useEffect)(()=>(e&&l>0?h.current=setTimeout(()=>p(!0),l):p(e),()=>{null!==h.current&&clearTimeout(h.current)}),[e,l]),!u)return o?(0,a.createElement)("div",{style:s},o):null;const f=na[t],m=n?oe(n):void 0,g=(0,a.createElement)("div",{role:"status","aria-live":"polite","aria-label":m??"Loading",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"8px"}},r??(0,a.createElement)(ia,{size:f.dimension,borderWidth:f.borderWidth,color:d.primary,reducedMotion:c}),m&&(0,a.createElement)("span",{style:{color:d.primary,fontSize:f.fontSize,marginTop:"4px"}},m));return i?(0,a.createElement)("div",{style:{position:"fixed",inset:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:`${d.bg}cc`,zIndex:9999,...s}},g):o?(0,a.createElement)("div",{style:{position:"relative",...s}},(0,a.createElement)("div",{style:{filter:"blur(1px)",opacity:.5,pointerEvents:"none",userSelect:"none",transition:c?"none":"opacity 0.2s, filter 0.2s"}},o),(0,a.createElement)("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:`${d.bg}66`,borderRadius:"4px"}},g)):(0,a.createElement)("div",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",...s}},g)},exports.TkxSpreadsheet=function({cols:e=8,rows:t=20,data:n,onChange:r,colWidth:o=96,rowHeight:i=28,style:l,className:s}){const[c,u]=(0,a.useState)({col:0,row:0}),[p,h]=(0,a.useState)(!1),[f,m]=(0,a.useState)(""),g=(0,a.useRef)(null),x=(0,a.useMemo)(()=>{const e=new Map,t={cells:n.cells,stack:new Set,memo:e};return e=>Wd(e,t)},[n]),b=Ad(c.col,c.row),y=(0,a.useCallback)(e=>{m(e??n.cells[b]??""),h(!0),requestAnimationFrame(()=>g.current?.focus())},[b,n.cells]),v=(0,a.useCallback)(()=>{const e={...n.cells};""===f?delete e[b]:e[b]=f,r({cells:e}),h(!1)},[b,n,f,r]),w=(0,a.useCallback)(()=>{h(!1),m("")},[]),k=(0,a.useCallback)((n,r)=>{u(o=>({col:Math.max(0,Math.min(e-1,o.col+n)),row:Math.max(0,Math.min(t-1,o.row+r))}))},[e,t]),$=e=>{switch(e.key){case"Enter":e.preventDefault(),v(),k(0,1);break;case"Tab":e.preventDefault(),v(),k(e.shiftKey?-1:1,0);break;case"Escape":e.preventDefault(),w()}};return(0,d.jsxs)("div",{className:s,tabIndex:0,role:"grid","aria-rowcount":t,"aria-colcount":e,"data-testid":"tkx-spreadsheet",onKeyDown:e=>{if(!p)switch(e.key){case"ArrowUp":e.preventDefault(),k(0,-1);break;case"ArrowDown":e.preventDefault(),k(0,1);break;case"ArrowLeft":e.preventDefault(),k(-1,0);break;case"ArrowRight":e.preventDefault(),k(1,0);break;case"Tab":e.preventDefault(),k(e.shiftKey?-1:1,0);break;case"Enter":case"F2":e.preventDefault(),y();break;case"Delete":case"Backspace":if(e.preventDefault(),void 0!==n.cells[b]){const e={...n.cells};delete e[b],r({cells:e})}break;default:1!==e.key.length||e.metaKey||e.ctrlKey||(e.preventDefault(),y(e.key))}},style:{position:"relative",width:48+e*o,maxWidth:"100%",height:28+t*i,outline:"none",border:"1px solid var(--tkx-border, #2a2a3e)",borderRadius:8,overflow:"auto",background:"var(--tkx-bg, #0a0a0f)",color:"var(--tkx-fg, #e8e8f4)",fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",fontSize:13,...l},children:[(0,d.jsxs)("div",{role:"row",style:{display:"flex",height:28,position:"sticky",top:0,background:"var(--tkx-bg-subtle, #0d0d14)",zIndex:2,borderBottom:"1px solid var(--tkx-border, #2a2a3e)"},children:[(0,d.jsx)("div",{role:"columnheader",style:{width:48,flex:"0 0 48px",borderRight:"1px solid var(--tkx-border, #2a2a3e)",background:"var(--tkx-bg-subtle, #0d0d14)"}}),Array.from({length:e}).map((e,t)=>(0,d.jsx)("div",{role:"columnheader","data-testid":`col-${Fd(t)}`,style:{width:o,flex:`0 0 ${o}px`,textAlign:"center",lineHeight:"28px",fontWeight:700,color:t===c.col?"var(--tkx-accent, #00f5d4)":"#888",borderRight:"1px solid var(--tkx-border-soft, #1a1a25)"},children:Fd(t)},t))]}),Array.from({length:t}).map((t,r)=>(0,d.jsxs)("div",{role:"row","aria-rowindex":r+1,style:{display:"flex",height:i},children:[(0,d.jsx)("div",{role:"rowheader",style:{width:48,flex:"0 0 48px",textAlign:"center",lineHeight:`${i}px`,fontWeight:700,color:r===c.row?"var(--tkx-accent, #00f5d4)":"#888",background:"var(--tkx-bg-subtle, #0d0d14)",borderRight:"1px solid var(--tkx-border, #2a2a3e)",borderBottom:"1px solid var(--tkx-border-soft, #1a1a25)",position:"sticky",left:0,zIndex:1},children:r+1}),Array.from({length:e}).map((e,t)=>{const a=Ad(t,r),l=t===c.col&&r===c.row,s=n.cells[a]??"",h=""===s?"":"number"==typeof(b=x(a))?Number.isFinite(b)?Number.isInteger(b)?String(b):String(Math.round(1e10*b)/1e10):"#NUM!":String(b);var b;const w=s.startsWith("=");return(0,d.jsx)("div",{role:"gridcell","aria-colindex":t+1,"aria-selected":l,"data-testid":`cell-${a}`,onClick:()=>u({col:t,row:r}),onDoubleClick:()=>{u({col:t,row:r}),y()},style:{width:o,flex:`0 0 ${o}px`,borderRight:"1px solid var(--tkx-border-soft, #1a1a25)",borderBottom:"1px solid var(--tkx-border-soft, #1a1a25)",padding:"0 6px",lineHeight:`${i}px`,background:l?"rgba(0,245,212,0.08)":"transparent",outline:l?"2px solid var(--tkx-accent, #00f5d4)":"none",outlineOffset:-2,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",color:"string"==typeof x(a)&&x(a).startsWith("#")?"#ff006e":w?"var(--tkx-accent, #00f5d4)":"var(--tkx-fg, #e8e8f4)",cursor:"cell",position:"relative"},children:l&&p?(0,d.jsx)("input",{ref:g,value:f,onChange:e=>m(e.target.value),onBlur:v,onKeyDown:$,"data-testid":`cell-input-${a}`,style:{position:"absolute",inset:0,width:"100%",height:"100%",padding:"0 6px",border:"none",background:"var(--tkx-bg, #0a0a0f)",color:"var(--tkx-fg, #e8e8f4)",fontFamily:"inherit",fontSize:"inherit",outline:"none"}}):h},t)})]},r))]})},exports.TkxStatistic=function({title:e,value:t,prefix:n,suffix:r,precision:o,groupSeparator:i=",",valueStyle:l,loading:s=!1,trend:d,trendValue:c,style:u}){const p=J(),h=Te(),f=oe(e),m=c?oe(c):void 0,g="up"===d?p.success:"down"===d?p.danger:void 0;return(0,a.createElement)("div",{style:{display:"flex",flexDirection:"column",gap:"4px",...u}},(0,a.createElement)("div",{style:{color:p.textMuted,fontSize:"0.875rem",lineHeight:"1.4"}},f),s?(0,a.createElement)(ca,{w:"120px",h:"32px",alt:p.surfaceAlt,bdr:p.border,rm:h}):(0,a.createElement)("div",{style:{display:"flex",alignItems:"baseline",gap:"4px",fontSize:"1.75rem",fontWeight:700,lineHeight:"1.2",color:p.text,fontVariantNumeric:"tabular-nums",...l}},n&&(0,a.createElement)("span",{style:{fontSize:"0.75em",fontWeight:400}},n),(0,a.createElement)("span",null,function(e,t,n=","){if("string"==typeof e)return e;const[r,o]=(void 0!==t?e.toFixed(t):String(e)).split("."),i=r.replace(/\B(?=(\d{3})+(?!\d))/g,n);return void 0!==o?`${i}.${o}`:i}(t,o,i)),r&&(0,a.createElement)("span",{style:{fontSize:"0.6em",fontWeight:400,color:p.textMuted}},r)),d&&(0,a.createElement)("div",{style:{display:"flex",alignItems:"center",gap:"4px",fontSize:"0.8125rem",color:g,marginTop:"2px"}},(0,a.createElement)(sa,{direction:d,color:g}),m&&(0,a.createElement)("span",null,m)))},exports.TkxStepper=oo,exports.TkxTab=function({index:e,children:t,disabled:n=!1,className:r,style:o}){const i=J(),{activeIndex:l,setActiveIndex:s,baseId:c,tabCount:u}=Xt(),p=(0,a.useRef)(null),h=l===e;return(0,d.jsx)("button",{ref:p,role:"tab",id:`${c}-tab-${e}`,"aria-controls":`${c}-panel-${e}`,"aria-selected":h,tabIndex:h?0:-1,disabled:n,className:xt(mt("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",n?"opacity-50 cursor-not-allowed":""),r),style:{color:h?i.primary:i.textMuted,fontWeight:h?600:400,borderBottom:h?`2px solid ${i.primary}`:"2px solid transparent",marginBottom:"-2px",...o},onClick:()=>!n&&s(e),onKeyDown:t=>H(t,e,u,e=>{s(e),document.getElementById(`${c}-tab-${e}`)?.focus()}),children:t})},exports.TkxTabList=function({children:e,className:t,style:n,...r}){const o=J();return(0,d.jsx)("div",{role:"tablist",className:xt(mt("flex gap-1"),t),style:{borderBottom:`2px solid ${o.border}`,...n},...r,children:e})},exports.TkxTabPanel=function({index:e,children:t,style:n,className:r}){const{activeIndex:o,baseId:i}=Xt();return o!==e?null:(0,d.jsx)("div",{role:"tabpanel",id:`${i}-panel-${e}`,"aria-labelledby":`${i}-tab-${e}`,tabIndex:0,className:xt(mt("pt-4"),r),style:n,children:t})},exports.TkxTabPanels=function({children:e,className:t,...n}){return(0,d.jsx)("div",{className:t,...n,children:e})},exports.TkxTable=function({columns:e,data:t,caption:n,sortable:r,stickyHeader:o,isLoading:i,emptyState:l,style:s,className:c,striped:u,maxHeight:p,rowHeight:h=44,virtualScroll:f,onLoadMore:m,hasMore:g,loadingMore:x=!1,onRowClick:b,selectedRows:y,bordered:v,compact:w}){const k=J(),[$,S]=(0,a.useState)(null),[C,z]=(0,a.useState)("asc"),M=(0,a.useMemo)(()=>$&&r?[...t].sort((e,t)=>{const n=e[$],r=t[$];let o=0;return"string"==typeof n&&"string"==typeof r?o=n.localeCompare(r):"number"==typeof n&&"number"==typeof r&&(o=n-r),"asc"===C?o:-o}):t,[t,$,C,r]),N=(0,a.useCallback)(e=>{$===e?z(e=>"asc"===e?"desc":"asc"):(S(e),z("asc"))},[$]),D=void 0!==f?f:void 0!==p&&M.length>=50,R=(0,a.useRef)(null),[P,F]=(0,a.useState)(0),[I,A]=(0,a.useState)(400),L=(0,a.useCallback)(()=>{R.current&&F(R.current.scrollTop)},[]);(0,a.useEffect)(()=>{if(!D||!R.current)return;const e=R.current;A(e.clientHeight);const t=new ResizeObserver(()=>A(e.clientHeight));return t.observe(e),()=>t.disconnect()},[D]);const T=D?Math.max(0,Math.floor(P/h)-5):0,W=D?Math.min(M.length,Math.ceil((P+I)/h)+5):M.length,j=D?M.slice(T,W):M,E=(0,a.useRef)(null),B=(0,a.useRef)(!1);(0,a.useEffect)(()=>{B.current=!1},[t.length]),(0,a.useEffect)(()=>{if(!m)return;const e=E.current;if(!e)return;const t=new IntersectionObserver(e=>{e[0].isIntersecting&&!B.current&&!1!==g&&(B.current=!0,m())},{root:R.current,rootMargin:"0px 0px 200px 0px",threshold:0});return t.observe(e),()=>t.disconnect()},[m,g]);const V=w?"4px":"12px",H=w?"8px":"16px",O=v?`1px solid ${k.border}`:"none",q=(0,a.useMemo)(()=>new Set(y??[]),[y]);return(0,d.jsx)("div",{className:mt("w-full rounded-lg",c??""),style:{border:`1px solid ${k.border}`,overflow:"hidden",...s},children:(0,d.jsxs)("div",{ref:R,onScroll:D?L:void 0,style:{overflowX:"auto",overflowY:p?"auto":"visible",maxHeight:p??"none"},children:[(0,d.jsxs)("table",{className:mt("w-full font-sans text-sm"),style:{borderCollapse:"collapse",color:k.text},children:[n&&(0,d.jsx)("caption",{className:mt("text-sm text-left p-2"),style:{color:k.textMuted},children:oe(n)}),(0,d.jsx)("thead",{style:o?{position:"sticky",top:0,backgroundColor:k.surfaceAlt,zIndex:1}:{backgroundColor:k.surfaceAlt},children:(0,d.jsx)("tr",{children:e.map(e=>{const t=r&&!1!==e.sortable,n=(o=e.key,$!==o?"none":C);var o;return(0,d.jsx)("th",{scope:"col","aria-sort":t?"none"===n?"none":"asc"===n?"ascending":"descending":void 0,className:mt("text-left font-semibold whitespace-nowrap",t?"cursor-pointer select-none":""),style:{padding:`${V} ${H}`,color:k.textMuted,borderBottom:`2px solid ${k.border}`,borderRight:O,width:e.width},onClick:()=>t&&N(e.key),onKeyDown:n=>{!t||"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),N(e.key))},tabIndex:t?0:void 0,children:(0,d.jsxs)("span",{className:mt("inline-flex items-center gap-1.5"),children:[oe(e.header),t&&(0,d.jsx)(tn,{dir:n})]})},String(e.key))})})}),(0,d.jsx)("tbody",{children:i?Array.from({length:5},(t,n)=>(0,d.jsx)("tr",{children:e.map(e=>(0,d.jsx)("td",{style:{padding:`${V} ${H}`},children:(0,d.jsx)(_t,{variant:"text",height:"16px"})},String(e.key)))},n)):0===M.length?(0,d.jsx)("tr",{children:(0,d.jsx)("td",{colSpan:e.length,className:mt("text-center"),style:{padding:"32px 16px",color:k.textMuted},children:l??"No data available"})}):(0,d.jsxs)(d.Fragment,{children:[D&&T>0&&(0,d.jsx)("tr",{"aria-hidden":"true",style:{height:T*h},children:(0,d.jsx)("td",{colSpan:e.length,style:{padding:0,border:"none"}})}),j.map((t,n)=>{const r=T+n,o=q.has(r);return(0,d.jsx)("tr",{"aria-rowindex":r+1,"aria-selected":o||void 0,onClick:b?()=>b(t,r):void 0,onKeyDown:b?e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),b(t,r))}:void 0,tabIndex:b?0:void 0,className:mt(b?"cursor-pointer":""),style:{backgroundColor:o?`${k.primary}22`:u&&r%2==1?k.surfaceAlt:"transparent",borderBottom:`1px solid ${k.border}`,...D?{height:h,boxSizing:"border-box"}:{}},children:e.map(e=>{const n=t[e.key],r=e.render?e.render(n,t):"string"==typeof n?oe(n):String(n??"");return(0,d.jsx)("td",{style:{padding:`${V} ${H}`,color:k.text,borderRight:O},children:r},String(e.key))})},r)}),D&&W<M.length&&(0,d.jsx)("tr",{"aria-hidden":"true",style:{height:(M.length-W)*h},children:(0,d.jsx)("td",{colSpan:e.length,style:{padding:0,border:"none"}})})]})})]}),(g||x)&&(0,d.jsx)("div",{ref:E,style:{height:1,width:"100%"},children:x&&(0,d.jsx)("table",{style:{width:"100%",borderCollapse:"collapse"},children:(0,d.jsx)("tbody",{children:Array.from({length:3},(t,n)=>(0,d.jsx)("tr",{children:e.map(e=>(0,d.jsx)("td",{style:{padding:"10px 16px"},children:(0,d.jsx)(_t,{variant:"text",height:"16px"})},String(e.key)))},n))})})}),!g&&m&&(0,d.jsx)("div",{style:{padding:"16px",textAlign:"center",fontSize:13,color:k.textMuted},children:"✓ All rows loaded"})]})})},exports.TkxTabs=function({defaultIndex:e=0,activeIndex:t,onChange:n,children:r,tabCount:o=0,style:i,className:l}){const[s,c]=(0,a.useState)(e),u=(0,a.useId)(),p=void 0!==t?t:s;return(0,d.jsx)(Yt.Provider,{value:{activeIndex:p,setActiveIndex:e=>{void 0===t&&c(e),n?.(e)},baseId:u,tabCount:o},children:(0,d.jsx)("div",{className:l,style:i,children:r})})},exports.TkxTag=Nr,exports.TkxTagInput=function({value:e,defaultValue:t=[],onChange:n,placeholder:r="Add tag…",maxTags:o,allowDuplicates:i=!1,validate:l,colorScheme:s="primary",size:c="md",label:u,hint:p,isDisabled:h=!1}){const f=J(),m=Te(),[g,x]=(0,a.useState)(t),[b,y]=(0,a.useState)(""),[v,w]=(0,a.useState)(null),k=(0,a.useRef)(null),$=void 0!==e,S=$?e:g,C=(0,a.useCallback)(e=>{$||x(e),n?.(e)},[$,n]),z=(0,a.useCallback)(e=>{const t=e.trim();if(t)if(void 0!==o&&S.length>=o)w(`Maximum ${o} tags allowed`);else if(i||!S.includes(t)){if(l){const e=l(t);if(!1===e)return void w("Invalid tag");if("string"==typeof e)return void w(e)}w(null),C([...S,t]),y("")}else w("Duplicate tags are not allowed")},[S,o,i,l,C]),M=(0,a.useCallback)(e=>{C(S.filter((t,n)=>n!==e)),w(null)},[S,C]),N=(0,a.useCallback)(e=>{"Enter"===e.key||","===e.key?(e.preventDefault(),z(b)):"Backspace"===e.key&&""===b&&S.length>0&&M(S.length-1)},[b,S,z,M]),D=(0,a.useCallback)(e=>{const t=e.target.value;t.endsWith(",")?z(t.slice(0,-1)):(y(t),v&&w(null))},[z,v]),R="sm"===c?"6px 8px":"lg"===c?"10px 12px":"8px 10px",P="sm"===c?11:"lg"===c?14:12;return(0,d.jsxs)("div",{className:mt("flex flex-col gap-1.5"),children:[u&&(0,d.jsx)("label",{className:mt("text-sm font-medium"),style:{color:f.text},onClick:()=>k.current?.focus(),children:oe(u)}),(0,d.jsxs)("div",{className:mt("flex flex-wrap items-center gap-1.5 rounded-lg cursor-text",!m&&"transition-colors duration-150"),style:{padding:R,backgroundColor:f.surface,border:`1.5px solid ${v?f.danger:f.border}`,opacity:h?.55:1,minHeight:"sm"===c?36:"lg"===c?48:40},onClick:()=>!h&&k.current?.focus(),children:[S.map((e,t)=>(0,d.jsx)(Nr,{size:c,variant:"subtle",colorScheme:s,onRemove:h?void 0:()=>M(t),isDisabled:h,children:e},`${e}-${t}`)),(!o||S.length<o)&&!h&&(0,d.jsx)("input",{ref:k,type:"text",value:b,onChange:D,onKeyDown:N,placeholder:0===S.length?oe(r):"",disabled:h,className:mt("flex-1 bg-transparent outline-none min-w-[80px]"),style:{fontSize:P,color:f.text,caretColor:f.primary},"aria-label":u??"Tag input"})]}),v&&(0,d.jsx)("p",{className:mt("text-xs"),style:{color:f.danger},role:"alert",children:v}),p&&!v&&(0,d.jsx)("p",{className:mt("text-xs"),style:{color:f.textMuted},children:oe(p)})]})},exports.TkxText=function({children:e,type:t="default",strong:n=!1,italic:r=!1,underline:o=!1,delete:i=!1,code:l=!1,mark:s=!1,copyable:d=!1,style:c}){const u=ea(t),p=J(),h=Ji(e),f="string"==typeof e?oe(e):e,m=[];o&&m.push("underline"),i&&m.push("line-through");let g=f;return l&&(g=(0,a.createElement)("code",{style:{padding:"0.15em 0.4em",fontSize:"0.875em",backgroundColor:p.surfaceAlt,border:`1px solid ${p.border}`,borderRadius:"4px",fontFamily:"monospace"}},g)),s&&(g=(0,a.createElement)("mark",{style:{backgroundColor:`${p.warning}33`,color:u,padding:"0 2px",borderRadius:"2px"}},g)),(0,a.createElement)(n?"strong":r?"em":"span",{style:{color:u,fontStyle:r?"italic":"normal",textDecoration:m.length>0?m.join(" "):"none",...c}},g,d&&(0,a.createElement)(Qi,{text:h}))},exports.TkxThemeStudio=function({initialTheme:e,onChange:t,onExport:n,preview:r,exportName:o="myTheme",className:i,style:l}){const s=J(),c=e??s,[u,p]=(0,a.useState)(c),[h,f]=(0,a.useState)("ts"),[m,g]=(0,a.useState)(!1),x=(0,a.useCallback)((e,n)=>{p(r=>{const o={...r,[e]:n};return t?.(o),o})},[t]),b=(0,a.useMemo)(()=>"json"===h?function(e){return JSON.stringify(e,null,2)}(u):"ts"===h?function(e,t="myTheme"){const n=["import type { ThemeTokens } from 'tekivex-ui';",""];n.push(`export const ${t}: ThemeTokens = {`);for(const[r,o]of Object.entries(e))n.push(` ${r}: ${JSON.stringify(o)},`);return n.push("};"),n.join("\n")}(u,o):function(e){const t=[":root {"];for(const[n,r]of Object.entries(e))t.push(` --tkx-${n}: ${r};`);return t.push("}"),t.join("\n")}(u),[u,h,o]),y=(0,a.useCallback)(()=>{p(c),t?.(c)},[c,t]),v=(0,a.useMemo)(()=>{const e={surface:[],text:[],brand:[],status:[]};for(const t of ps)e[t.group].push(t);return e},[]);return(0,d.jsxs)("div",{className:i,style:{display:"grid",gridTemplateColumns:"minmax(300px, 380px) 1fr",gap:16,color:s.text,...l},role:"region","aria-label":"Theme editor",children:[(0,d.jsx)("style",{children:"\n @media (max-width: 760px) {\n .tk-studio-grid { grid-template-columns: 1fr !important; }\n }\n "}),(0,d.jsxs)("aside",{style:{background:s.surface,border:`1px solid ${s.border}`,borderRadius:12,padding:16,display:"flex",flexDirection:"column",gap:16,maxHeight:"80vh",overflowY:"auto"},children:[(0,d.jsxs)("header",{style:{display:"flex",alignItems:"center",gap:8},children:[(0,d.jsx)("h2",{style:{margin:0,fontSize:16,fontWeight:800,letterSpacing:"-0.01em",flex:1},children:"Theme Studio"}),(0,d.jsx)("button",{type:"button",onClick:y,style:(w=s,{background:"transparent",border:`1px solid ${w.border}`,color:w.textMuted,padding:"6px 12px",borderRadius:6,fontSize:12,cursor:"pointer",fontWeight:600}),"aria-label":"Reset to original theme",children:"↺ Reset"})]}),Object.keys(v).map(e=>(0,d.jsxs)("section",{children:[(0,d.jsx)("h3",{style:{margin:"0 0 10px",fontSize:11,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.08em",color:s.textMuted},children:hs[e]}),(0,d.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:10},children:v[e].map(e=>(0,d.jsx)(gs,{slot:e,value:u[e.key],pairedValue:e.contrastAgainst?u[e.contrastAgainst]:void 0,onChange:t=>x(e.key,t)},e.key))})]},e)),(0,d.jsxs)("section",{style:{marginTop:8},children:[(0,d.jsx)("h3",{style:{margin:"0 0 10px",fontSize:11,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.08em",color:s.textMuted},children:"Export"}),(0,d.jsx)("div",{role:"tablist",style:{display:"flex",gap:4,marginBottom:8},children:["ts","json","css"].map(e=>(0,d.jsx)("button",{role:"tab",type:"button","aria-selected":h===e,onClick:()=>f(e),style:bs(s,h===e),children:e.toUpperCase()},e))}),(0,d.jsx)("pre",{style:{margin:0,padding:12,background:s.bg,border:`1px solid ${s.border}`,borderRadius:8,fontSize:11,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",color:s.text,maxHeight:200,overflow:"auto",lineHeight:1.5,whiteSpace:"pre"},children:(0,d.jsx)("code",{children:b})}),(0,d.jsxs)("div",{style:{display:"flex",gap:8,marginTop:8},children:[(0,d.jsx)("button",{type:"button",onClick:()=>{navigator.clipboard?.writeText(b),g(!0),setTimeout(()=>g(!1),1500)},style:ys(s),children:m?"✓ Copied":"📋 Copy"}),(0,d.jsx)("button",{type:"button",onClick:()=>n?.(h,b),disabled:!n,style:vs(s,!n),children:"Save…"})]})]})]}),(0,d.jsx)("section",{"aria-label":"Theme preview",style:{background:u.bg,border:`1px solid ${u.border}`,borderRadius:12,padding:24,minHeight:480,color:u.text},children:(0,d.jsx)(_,{theme:u,children:r??(0,d.jsx)(xs,{})})})]});var w},exports.TkxThinkingIndicator=fr,exports.TkxTimeline=function({items:e,variant:t="default",orientation:n="vertical",connectorStyle:r="solid"}){const o=J(),i=Te(),l=(0,a.useRef)(!1);(0,a.useEffect)(()=>{!function(){if(Dr||"undefined"==typeof document)return;Dr=!0;const e=document.createElement("style");e.textContent="\n @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; } }\n @keyframes tkx-draw-line { from { transform:scaleY(0); transform-origin:top center; } to { transform:scaleY(1); } }\n @keyframes tkx-draw-line-h { from { transform:scaleX(0); transform-origin:left center; } to { transform:scaleX(1); } }\n .tkx-pulse-dot { animation: tkx-pulse-dot 1.5s ease-in-out infinite; }\n .tkx-draw-v { animation: tkx-draw-line 0.6s ease forwards; }\n .tkx-draw-h { animation: tkx-draw-line-h 0.6s ease forwards; }\n ",document.head.appendChild(e)}(),l.current=!0},[]);const s=!i,c="compact"===t,u="alternating"===t&&"vertical"===n;return"horizontal"===n?(0,d.jsx)("div",{role:"list","aria-label":"Timeline",className:mt("flex items-start w-full overflow-x-auto"),children:e.map((t,n)=>{const i=t.status??"pending",a="completed"===i?o.success:o.border,l=n===e.length-1;return(0,d.jsx)("div",{role:"listitem",className:mt("flex items-start flex-1 min-w-0"),children:(0,d.jsxs)("div",{className:mt("flex flex-col items-center flex-1 min-w-0"),children:[(0,d.jsxs)("div",{className:mt("flex items-center w-full"),children:[n>0&&(0,d.jsx)(Fr,{style:r,color:a,animate:s}),(0,d.jsx)(Rr,{status:i,icon:t.icon,size:24}),!l&&(0,d.jsx)(Fr,{style:r,color:a,animate:s})]}),(0,d.jsxs)("div",{className:mt("mt-2 px-1 text-center min-w-0 w-full"),children:[(0,d.jsx)("div",{className:mt("text-xs font-semibold truncate"),style:{color:o.text},children:"string"==typeof t.title?oe(t.title):t.title}),t.timestamp&&(0,d.jsx)("div",{className:mt("text-[10px] mt-0.5"),style:{color:o.textMuted},children:oe(t.timestamp)})]})]})},t.id)})}):(0,d.jsx)("div",{role:"list","aria-label":"Timeline",className:mt("flex flex-col"),children:e.map((t,n)=>{const i=t.status??"pending",a=n===e.length-1,l="completed"===i?o.success:o.border,p=u&&n%2==0;return u?(0,d.jsxs)("div",{role:"listitem",className:mt("flex items-stretch gap-0"),children:[(0,d.jsx)("div",{className:mt("flex-1 flex flex-col items-end pr-4",p?"":"invisible"),children:p&&(0,d.jsx)(Ir,{item:t,compact:c})}),(0,d.jsxs)("div",{className:mt("flex flex-col items-center"),children:[(0,d.jsx)(Rr,{status:i,icon:t.icon,size:28}),!a&&(0,d.jsx)(Pr,{style:r,color:l,animate:s})]}),(0,d.jsx)("div",{className:mt("flex-1 flex flex-col items-start pl-4",p?"invisible":""),children:!p&&(0,d.jsx)(Ir,{item:t,compact:c})})]},t.id):(0,d.jsxs)("div",{role:"listitem",className:mt("flex gap-3 items-stretch"),children:[(0,d.jsxs)("div",{className:mt("flex flex-col items-center"),children:[(0,d.jsx)(Rr,{status:i,icon:t.icon,size:c?22:28}),!a&&(0,d.jsx)(Pr,{style:r,color:l,animate:s})]}),(0,d.jsx)("div",{className:mt("flex-1 min-w-0 pt-0.5"),children:(0,d.jsx)(Ir,{item:t,compact:c})})]},t.id)})})},exports.TkxTitle=function({level:e=1,children:t,copyable:n=!1,type:r="default",style:o}){const i=ea(r);J();const l=ta[e],s=`h${e}`,d="string"==typeof t?oe(t):t,c=Ji(t);return(0,a.createElement)(s,{style:{color:i,fontSize:l.fontSize,lineHeight:l.lineHeight,fontWeight:l.fontWeight,margin:"0 0 0.5em 0",fontFamily:"inherit",...o}},d,n&&(0,a.createElement)(Qi,{text:c}))},exports.TkxToastProvider=function({position:e="top-right",children:t}){const[n,r]=(0,a.useState)([...fn]),o=Te(),i=Ot();(0,a.useEffect)(()=>{r([...fn]);const e=e=>r([...e]);return mn.add(e),()=>{mn.delete(e)}},[]);const l=e.startsWith("bottom"),s=wn[e],u=(0,a.useRef)(!1);if((0,a.useEffect)(()=>{if(!u.current&&"undefined"!=typeof document&&(u.current=!0,!document.getElementById("tkx-toast-kf"))){const e=document.createElement("style");e.id="tkx-toast-kf",e.textContent="\n @keyframes tkx-toast-slide-down {\n from { opacity: 0; transform: translateY(-16px); }\n to { opacity: 1; transform: translateY(0); }\n }\n @keyframes tkx-toast-slide-up {\n from { opacity: 0; transform: translateY(16px); }\n to { opacity: 1; transform: translateY(0); }\n }\n ",document.head.appendChild(e)}},[]),"undefined"==typeof document)return(0,d.jsx)(d.Fragment,{children:t});const p=l?[...n].reverse():n;return(0,d.jsxs)(d.Fragment,{children:[t,(0,c.createPortal)((0,d.jsx)("div",{"aria-label":i.notifications??"Notifications",className:mt("fixed z-[9999] flex flex-col gap-2 pointer-events-none"),style:s,children:p.map(t=>(0,d.jsx)("div",{className:mt("pointer-events-auto"),children:(0,d.jsx)($n,{toast:t,position:e,onDismiss:yn,reduced:o})},t.id))}),document.body)]})},exports.TkxToggle=Tt,exports.TkxToolbar=function({items:e,orientation:t="horizontal",size:n="md",variant:r="default",ariaLabel:o="Toolbar",className:i,style:l}){const s=J(),c=Te(),u=Wo[n],p="horizontal"===t,h=(0,a.useRef)(new Map),f=e.filter(e=>"separator"!==e.type&&!e.disabled).map(e=>e.id),m=(0,a.useCallback)(e=>{h.current.get(e)?.focus()},[]),g=(0,a.useCallback)((e,t)=>{const n=f.indexOf(t);if(n<0)return;const r=p?"ArrowRight":"ArrowDown",o=p?"ArrowLeft":"ArrowUp";switch(e.key){case r:e.preventDefault(),m(f[n+1<f.length?n+1:0]);break;case o:e.preventDefault(),m(f[n-1>=0?n-1:f.length-1]);break;case"Home":e.preventDefault(),m(f[0]);break;case"End":e.preventDefault(),m(f[f.length-1])}},[f,m,p]),x=e=>{e.type;const t=e.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:e.disabled?"not-allowed":"pointer",backgroundColor:t?`${s.primary}20`:"transparent",color:t?s.primary:e.disabled?s.textMuted:s.text,opacity:e.disabled?.5:1,outline:"none",transition:c?"none":"all 100ms ease",whiteSpace:"nowrap",lineHeight:1}};return(0,d.jsx)("div",{role:"toolbar","aria-label":o,"aria-orientation":t,className:mt("inline-flex items-center rounded-lg font-sans",p?"flex-row":"flex-col",i??""),style:{...(()=>{switch(r){case"outlined":return{backgroundColor:"transparent",border:`1px solid ${s.border}`};case"filled":return{backgroundColor:s.surfaceAlt,border:"none"};default:return{backgroundColor:s.surface,border:`1px solid ${s.border}`}}})(),padding:u.gap,gap:u.gap,...l},children:e.map((e,t)=>{if("separator"===e.type)return(0,d.jsx)("div",{role:"separator","aria-orientation":p?"vertical":"horizontal",className:mt("flex-shrink-0"),style:{...p?{width:1,height:u.separatorSize,marginLeft:2,marginRight:2}:{height:1,width:u.separatorSize,marginTop:2,marginBottom:2},backgroundColor:s.border}},e.id);const n=oe(e.label),r=!e.disabled,o=f[0]===e.id;return(0,d.jsxs)("button",{ref:t=>{t?h.current.set(e.id,t):h.current.delete(e.id)},type:"button",role:void e.type,"aria-pressed":"toggle"===e.type?e.active:void 0,"aria-label":n,"aria-disabled":e.disabled||void 0,tabIndex:r&&o?0:-1,disabled:e.disabled,onClick:()=>{e.disabled||e.onClick?.()},onKeyDown:t=>{g(t,e.id),"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e.disabled||e.onClick?.())},className:mt("focus-visible:ring-2 focus-visible:ring-offset-1"),style:x(e),onMouseEnter:t=>{e.disabled||e.active||(t.currentTarget.style.backgroundColor=s.surfaceAlt)},onMouseLeave:t=>{e.disabled||(t.currentTarget.style.backgroundColor=e.active?`${s.primary}20`:"transparent")},children:[e.icon&&(0,d.jsx)("span",{"aria-hidden":"true",style:{width:u.iconSize,height:u.iconSize,display:"flex",alignItems:"center",justifyContent:"center"},children:e.icon}),!e.icon&&n]},e.id)})})},exports.TkxTooltip=function({content:e,children:t,placement:n="top",delay:r=300}){const o=J(),[i,l]=(0,a.useState)(!1),s=(0,a.useRef)(null),c=(0,a.useId)(),u=(0,a.useRef)(null),p=Te(),h=oe(e),f=j(o.surfaceAlt,[o.text,"#ffffff","#000000"]);function m(){u.current=setTimeout(()=>l(!0),r)}function g(){u.current&&clearTimeout(u.current),l(!1)}Ee(g,i),Be(s,g),(0,a.useEffect)(()=>()=>{u.current&&(clearTimeout(u.current),u.current=null)},[]);const x=t,b=(0,a.cloneElement)(x,{"aria-describedby":i?c:void 0,onMouseEnter:e=>{x.props.onMouseEnter?.(e),m()},onMouseLeave:e=>{x.props.onMouseLeave?.(e),g()},onFocus:e=>{x.props.onFocus?.(e),m()},onBlur:e=>{x.props.onBlur?.(e),g()}});return(0,d.jsxs)("span",{ref:s,className:mt("relative inline-flex"),children:[b,i&&(0,d.jsx)("span",{id:c,role:"tooltip",className:mt("absolute z-[9000] text-xs font-sans py-1.5 px-2.5 rounded-md whitespace-nowrap pointer-events-none",!p&&"animate-fade-in"),style:{backgroundColor:o.surfaceAlt,color:f,border:`1px solid ${o.border}`,boxShadow:`0 4px 12px ${o.bg}40`,maxWidth:280,...Zt[n]},children:h})]})},exports.TkxTour=function({steps:e,isOpen:t=!1,onClose:n,current:r,onChange:o}){const i=J(),l=Te(),[s,u]=(0,a.useState)(0),p=r??s,h=(0,a.useRef)(null),[f,m]=(0,a.useState)({top:0,left:0}),[g,x]=(0,a.useState)(null),b=e[p],y=(0,a.useCallback)(()=>{if(!b)return;const e=function(e){const t=document.querySelector(e);return t?t.getBoundingClientRect():null}(b.target);if(x(e),e&&h.current){const t=h.current.offsetWidth,n=h.current.offsetHeight;m(function(e,t,n,r){switch(t){case"top":return{top:e.top-r-12+window.scrollY,left:e.left+e.width/2-n/2+window.scrollX};case"bottom":return{top:e.bottom+12+window.scrollY,left:e.left+e.width/2-n/2+window.scrollX};case"left":return{top:e.top+e.height/2-r/2+window.scrollY,left:e.left-n-12+window.scrollX};case"right":return{top:e.top+e.height/2-r/2+window.scrollY,left:e.right+12+window.scrollX};default:return{top:e.bottom+12+window.scrollY,left:e.left+window.scrollX}}}(e,b.placement??"bottom",t,n))}},[b]);(0,a.useEffect)(()=>{if(t)return y(),window.addEventListener("resize",y),window.addEventListener("scroll",y,!0),()=>{window.removeEventListener("resize",y),window.removeEventListener("scroll",y,!0)}},[t,p,y]),(0,a.useEffect)(()=>{t&&h.current?.focus()},[t,p]);const v=(0,a.useCallback)(e=>{u(e),o?.(e)},[o]),w=(0,a.useCallback)(()=>{p<e.length-1?v(p+1):n?.()},[p,e.length,v,n]),k=(0,a.useCallback)(()=>{p>0&&v(p-1)},[p,v]);if(!t||!b)return null;const $=oe(b.title),S=oe(b.description);return(0,c.createPortal)((0,d.jsxs)("div",{"aria-hidden":"true",children:[(0,d.jsx)("div",{style:{position:"fixed",inset:0,zIndex:9998,backgroundColor:"rgba(0,0,0,0.55)",clipPath:g?`polygon(0% 0%, 0% 100%, ${g.left-6}px 100%, ${g.left-6}px ${g.top-6}px, ${g.right+6}px ${g.top-6}px, ${g.right+6}px ${g.bottom+6}px, ${g.left-6}px ${g.bottom+6}px, ${g.left-6}px 100%, 100% 100%, 100% 0%)`:void 0,transition:l?"none":"clip-path 0.25s ease"},onClick:n}),(0,d.jsxs)("div",{ref:h,role:"dialog","aria-modal":"true","aria-label":`Tour step ${p+1} of ${e.length}`,tabIndex:-1,style:{position:"absolute",zIndex:9999,top:f.top,left:f.left,width:300,backgroundColor:i.surface,border:`1px solid ${i.border}`,borderRadius:10,padding:20,boxShadow:`0 8px 24px ${i.bg}80`,animation:l?"none":"tkxFadeIn 0.2s ease",fontFamily:"inherit"},onKeyDown:e=>{"Escape"===e.key&&n?.()},children:[(0,d.jsx)("h3",{className:mt("m-0 mb-2 text-base font-semibold"),style:{color:i.text},children:$}),(0,d.jsx)("p",{className:mt("m-0 mb-4 text-sm leading-relaxed"),style:{color:i.textMuted},children:S}),(0,d.jsx)("div",{className:mt("flex items-center gap-1 mb-4"),"aria-label":"Tour progress",children:e.map((e,t)=>(0,d.jsx)("span",{"aria-hidden":"true",style:{width:8,height:8,borderRadius:"50%",backgroundColor:t===p?i.primary:i.border,transition:l?"none":"background-color 0.2s"}},t))}),(0,d.jsxs)("div",{className:mt("flex items-center justify-between gap-2"),children:[(0,d.jsx)("button",{type:"button","aria-label":"Skip tour",onClick:n,className:mt("border-0 bg-transparent cursor-pointer text-sm px-2 py-1"),style:{color:i.textMuted},children:"Skip"}),(0,d.jsxs)("div",{className:mt("flex gap-2"),children:[p>0&&(0,d.jsx)("button",{type:"button","aria-label":"Previous step",onClick:k,className:mt("rounded-md border px-3 py-1 text-sm cursor-pointer bg-transparent"),style:{borderColor:i.border,color:i.text},children:"Prev"}),(0,d.jsx)("button",{type:"button","aria-label":p===e.length-1?"Finish tour":"Next step",onClick:w,className:mt("rounded-md border-0 px-4 py-1 text-sm cursor-pointer font-medium"),style:{backgroundColor:i.primary,color:"#fff"},children:p===e.length-1?"Finish":"Next"})]})]})]})]}),document.body)},exports.TkxTransferList=function({sourceItems:e,targetItems:t,onTransfer:n,sourceTitle:r="Available",targetTitle:o="Selected",searchable:i=!1,height:l=300,className:s,style:c}){const u=J(),p=Te(),h=(0,a.useId)(),f=(0,a.useId)(),[m,g]=(0,a.useState)(new Set),[x,b]=(0,a.useState)(new Set),[y,v]=(0,a.useState)(""),[w,k]=(0,a.useState)(""),$=(0,a.useCallback)(e=>{g(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),S=(0,a.useCallback)(e=>{b(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),C=(0,a.useCallback)(()=>{const t=e.filter(e=>!e.disabled).map(e=>e.value);t.every(e=>m.has(e))?g(new Set):g(new Set(t))},[e,m]),z=(0,a.useCallback)(()=>{const e=t.filter(e=>!e.disabled).map(e=>e.value);e.every(e=>x.has(e))?b(new Set):b(new Set(e))},[t,x]),M=(0,a.useCallback)(()=>{if(0===m.size)return;const r=e.filter(e=>m.has(e.value)&&!e.disabled);n(e.filter(e=>!m.has(e.value)||e.disabled),[...t,...r]),g(new Set)},[e,t,m,n]),N=(0,a.useCallback)(()=>{if(0===x.size)return;const r=t.filter(e=>x.has(e.value)&&!e.disabled),o=t.filter(e=>!x.has(e.value)||e.disabled);n([...e,...r],o),b(new Set)},[e,t,x,n]),D=e=>({display:"inline-flex",alignItems:"center",justifyContent:"center",width:36,height:36,borderRadius:8,border:`1px solid ${u.border}`,backgroundColor:e?u.surface:u.surfaceAlt,cursor:e?"not-allowed":"pointer",opacity:e?.5:1,transition:p?"none":"all 100ms ease",outline:"none"});return(0,d.jsxs)("div",{className:mt("flex gap-3 font-sans","flex-col sm:flex-row",s??""),style:{color:u.text,...c},children:[(0,d.jsx)(Ho,{title:r,items:e,selected:m,onToggle:$,onToggleAll:C,search:y,onSearchChange:v,searchable:i,height:l,listId:h}),(0,d.jsxs)("div",{className:mt("flex items-center justify-center gap-2","flex-row sm:flex-col"),style:{padding:"8px 0"},children:[(0,d.jsx)("button",{type:"button","aria-label":"Move selected items to target list",disabled:0===m.size,onClick:M,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),M())},className:mt("focus-visible:ring-2 focus-visible:ring-offset-1"),style:D(0===m.size),onMouseEnter:e=>{m.size>0&&(e.currentTarget.style.backgroundColor=u.primary,e.currentTarget.style.borderColor=u.primary)},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=0===m.size?u.surface:u.surfaceAlt,e.currentTarget.style.borderColor=u.border},children:(0,d.jsx)(Bo,{color:u.text})}),(0,d.jsx)("button",{type:"button","aria-label":"Move selected items to source list",disabled:0===x.size,onClick:N,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),N())},className:mt("focus-visible:ring-2 focus-visible:ring-offset-1"),style:D(0===x.size),onMouseEnter:e=>{x.size>0&&(e.currentTarget.style.backgroundColor=u.primary,e.currentTarget.style.borderColor=u.primary)},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=0===x.size?u.surface:u.surfaceAlt,e.currentTarget.style.borderColor=u.border},children:(0,d.jsx)(Vo,{color:u.text})})]}),(0,d.jsx)(Ho,{title:o,items:t,selected:x,onToggle:S,onToggleAll:z,search:w,onSearchChange:k,searchable:i,height:l,listId:f})]})},exports.TkxTreeView=function({data:e,selected:t,onSelect:n,expanded:r,onExpand:o,multiSelect:i=!1,showCheckboxes:l=!1,showLines:s=!1,className:c,style:u}){const p=J(),h=Te();(0,a.useId)();const[f,m]=(0,a.useState)([]),[g,x]=(0,a.useState)([]),b=new Set(t??f),y=new Set(r??g),v=(0,a.useCallback)(e=>{void 0===r&&x(e),o?.(e)},[r,o]),w=(0,a.useCallback)(e=>{void 0===t&&m(e),n?.(e)},[t,n]),k=(0,a.useCallback)(e=>{const t=Array.from(y);y.has(e)?v(t.filter(t=>t!==e)):v([...t,e])},[y,v]),$=(0,a.useCallback)(e=>{if(i){const t=Array.from(b);b.has(e)?w(t.filter(t=>t!==e)):w([...t,e])}else w(b.has(e)?[]:[e])},[i,b,w]),S=function(e,t){const n=[];return function e(r,o){for(const i of r)n.push({node:i,depth:o}),i.children?.length&&t.has(i.id)&&e(i.children,o+1)}(e,0),n}(e,y),C=(0,a.useRef)(0),z=(0,a.useRef)(new Map),M=e=>{C.current=e,z.current.get(e)?.focus()};return(0,d.jsx)("ul",{role:"tree","aria-label":"Tree view","aria-multiselectable":i||void 0,className:mt("list-none m-0 p-0 font-sans select-none",c??""),style:{color:p.text,...u},children:S.map(({node:e,depth:t},n)=>{const r=(e.children?.length??0)>0,o=y.has(e.id),i=b.has(e.id),a=oe(e.label);return(0,d.jsxs)("li",{role:"treeitem","aria-selected":i,"aria-expanded":r?o:void 0,"aria-disabled":e.disabled||void 0,"aria-level":t+1,"aria-setsize":S.filter(e=>e.depth===t).length,tabIndex:0===n?0:-1,ref:e=>{e?z.current.set(n,e):z.current.delete(n)},onKeyDown:e=>((e,t)=>{const n=S[t];if(!n)return;const{node:r}=n,o=(r.children?.length??0)>0;switch(e.key){case"ArrowDown":e.preventDefault(),t<S.length-1&&M(t+1);break;case"ArrowUp":e.preventDefault(),t>0&&M(t-1);break;case"ArrowRight":e.preventDefault(),o&&!y.has(r.id)?k(r.id):o&&y.has(r.id)&&t<S.length-1&&M(t+1);break;case"ArrowLeft":if(e.preventDefault(),o&&y.has(r.id))k(r.id);else for(let e=t-1;e>=0;e--)if(S[e].depth<n.depth){M(e);break}break;case"Enter":case" ":e.preventDefault(),r.disabled||$(r.id);break;case"Home":e.preventDefault(),M(0);break;case"End":e.preventDefault(),M(S.length-1)}})(e,n),onClick:()=>{e.disabled||(r&&k(e.id),$(e.id))},className:mt("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:24*t+8,backgroundColor:i?`${p.primary}18`:"transparent",transition:h?"none":"background-color 100ms ease",minHeight:32},onMouseEnter:t=>{i||e.disabled||(t.currentTarget.style.backgroundColor=p.surfaceAlt)},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=i?`${p.primary}18`:"transparent"},children:[s&&t>0&&(0,d.jsx)("span",{"aria-hidden":"true",style:{position:"absolute",left:24*(t-1)+16,top:0,bottom:0,width:1,backgroundColor:p.border}}),r?(0,d.jsx)("span",{role:"presentation",onClick:t=>{t.stopPropagation(),k(e.id)},className:mt("inline-flex items-center justify-center cursor-pointer"),style:{width:20,height:20},children:(0,d.jsx)(Lo,{expanded:o,color:p.textMuted,reducedMotion:h})}):(0,d.jsx)("span",{style:{width:20,height:20},"aria-hidden":"true"}),l&&(0,d.jsx)(To,{checked:i,color:p.primary,borderColor:p.border}),e.icon&&(0,d.jsx)("span",{"aria-hidden":"true",className:mt("flex-shrink-0"),children:e.icon}),(0,d.jsx)("span",{className:mt("text-sm truncate"),style:{color:e.disabled?p.textMuted:p.text},children:a})]},e.id)})})},exports.TkxTreemap=fd,exports.TkxVideoPlayer=Jr,exports.TkxVoterIdInput=kl,exports.TkxWatermark=function({text:e,children:t,rotate:n=-22,gap:r=[100,100],fontSize:o=14,color:i,zIndex:l=10,pattern:s="tiled",dynamic:c=!1,refreshMs:u=0,intensifyOnDevtools:p=!1,fingerprintId:h}){const f=J(),m=Te(),g=(0,a.useRef)(null),[x,b]=(0,a.useState)(""),[y,v]=(0,a.useState)(0),w=ma(),k=(0,a.useMemo)(()=>{const t=(Array.isArray(e)?e:[e]).map(e=>oe(e));return"fingerprint"===s?function(e,t){return[...e,`id:${t||("undefined"!=typeof crypto&&"randomUUID"in crypto?crypto.randomUUID().slice(0,8):Math.random().toString(36).slice(2,10))} • ${(new Date).toISOString().slice(0,16).replace("T"," ")}`]}(t,h):t},[e,s,h,y]),$=p&&w?"66":"22",S=i??`${f.textMuted}${$}`,C=(0,a.useCallback)(()=>function(e,t,n,r,o,i){if("undefined"==typeof document)return"";const a=document.createElement("canvas"),l=a.getContext("2d");if(!l)return"";const s=1.5*r,d=e.length*s,c=Math.max(...e.map(e=>e.length))*r*.6;let u,p;return"single"===i?(u=Math.max(800,1.6*c),p=Math.max(600,4*d)):(u=n[0]+c,p=n[1]+d),a.width=2*u,a.height=2*p,l.scale(2,2),l.translate(u/2,p/2),l.rotate(t*Math.PI/180),l.font=`${r}px sans-serif`,l.fillStyle=o,l.textAlign="center",l.textBaseline="middle",e.forEach((t,n)=>{const r=(n-(e.length-1)/2)*s;l.fillText(t,0,r)}),a.toDataURL()}(k,n,r,o,S,s),[k,n,r,o,S,s]);(0,a.useEffect)(()=>{const e=C();e&&b(`url(${e})`)},[C]),(0,a.useEffect)(()=>{if(!u||u<=0)return;const e=window.setInterval(()=>v(e=>e+1),u);return()=>window.clearInterval(e)},[u]),(0,a.useEffect)(()=>{if(!c||"undefined"==typeof document)return;const e=()=>{"visible"===document.visibilityState&&v(e=>e+1)};return document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[c]),(0,a.useEffect)(()=>{const e=g.current?.querySelector("[data-watermark]");if(!e)return;const t=new MutationObserver(()=>{const t=C();t&&(e.style.backgroundImage=`url(${t})`)});return t.observe(e,{attributes:!0,attributeFilter:["style"]}),()=>t.disconnect()},[C]);const z={zIndex:l,backgroundImage:x,backgroundRepeat:"single"===s?"no-repeat":"repeat",backgroundPosition:"single"===s?"center center":void 0,animation:m?"none":"tkxFadeIn 0.3s ease"},M=p&&w?{filter:"blur(4px)",transition:"filter 0.2s"}:{};return(0,d.jsxs)("div",{ref:g,className:mt("relative"),style:{overflow:"hidden"},children:[(0,d.jsx)("div",{style:M,children:t}),(0,d.jsx)("div",{"data-watermark":!0,"aria-hidden":"true",className:mt("absolute inset-0 pointer-events-none"),style:z}),p&&w&&(0,d.jsx)("div",{"aria-live":"polite",style:{position:"absolute",top:12,right:12,padding:"6px 12px",background:f.danger,color:"#fff",fontSize:12,fontWeight:600,borderRadius:6,zIndex:l+1,pointerEvents:"none"},children:"Developer Tools detected — content protected"})]})},exports.VisuallyHidden=function({as:e,children:t,...n}){return(0,d.jsx)(e??"span",{className:"tkx-sr-only",...n,children:t})},exports.WCAGEngine=U,exports.audit=ce,exports.auroraLight=X,exports.batchUpdate=v,exports.breakpoints={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},exports.buildTkxCSP=Ce,exports.cellAddr=Ad,exports.colIndex=Id,exports.colLetter=Fd,exports.contrastRatio=L,exports.createFocusTrap=V,exports.createRateLimiter=De,exports.createTheme=function(e,t){const n={...e,...t};for(const[r,o]of Object.entries(n))if(!Z.test(o))throw new Error(`Invalid hex color for theme token '${r}': ${o}`);return T(n.text,n.bg),T(n.primary,n.bg),W(n.text,n.bg),n},exports.css=C,exports.cssVar=R,exports.cx=xt,exports.dayDiff=bd,exports.deepFreeze=Ie,exports.edgePath=As,exports.evaluateCell=Td,exports.extractAtomicCSS=function(){return Array.from(ct.values()).join("\n")},exports.extractCSS=P,exports.fnv1aHash=u,exports.formatDay=gd,exports.fromObject=z,exports.fuzzyScore=Os,exports.generatePalette=function(e){const[t,n]=function(e){const t=e.replace("#",""),n=parseInt(t.slice(0,2),16)/255,r=parseInt(t.slice(2,4),16)/255,o=parseInt(t.slice(4,6),16)/255,i=Math.max(n,r,o),a=Math.min(n,r,o);let l=0,s=0;const d=(i+a)/2;if(i!==a){const e=i-a;switch(s=d>.5?e/(2-i-a):e/(i+a),i){case n:l=((r-o)/e+(r<o?6:0))/6;break;case r:l=((o-n)/e+2)/6;break;case o:l=((n-r)/e+4)/6}}return[Math.round(360*l),Math.round(100*s),Math.round(100*d)]}(e);return{50:Q(t,Math.min(n,30),96),100:Q(t,Math.min(n,40),90),200:Q(t,Math.min(n,50),80),300:Q(t,n,70),400:Q(t,n,60),500:e,600:Q(t,n,45),700:Q(t,n,35),800:Q(t,n,25),900:Q(t,n,15)}},exports.getAccessibleForeground=j,exports.getAuditLog=ue,exports.getLocaleDisplayName=function(e){if(Gi[e])return Gi[e];if("undefined"!=typeof Intl&&Intl.DisplayNames)try{return new Intl.DisplayNames(["en"],{type:"language"}).of(e)??e}catch{return e}return e},exports.injectHolographicStyles=Vl,exports.injectStyles=F,exports.installFrameBuster=Ne,exports.installTrustedTypes=ze,exports.isFramed=Me,exports.isRTL=Vt,exports.isRtlLocale=function(e){return _i.has(e)||_i.has(e.split("-")[0])},exports.isSafeAttrName=$e,exports.isValidAadhaar=hl,exports.isValidDrivingLicence=Sl,exports.isValidPan=bl,exports.isValidVoterId=wl,exports.keyframes=D,exports.loadFontScript=function(e){Pa(e)},exports.meetsAA=T,exports.meetsAAA=W,exports.memoize=f,exports.nodeAnchors=Is,exports.parseCellAddr=Ld,exports.parseDay=md,exports.prefersHighContrast=q,exports.prefersReducedMotion=O,exports.quantumDark=Y,exports.radii={none:"0",sm:"4px",md:"6px",lg:"8px",xl:"12px","2xl":"16px",full:"9999px"},exports.recordsToSpreadsheet=function(e,t={}){const{base:n,preserveExtraCells:r=!1}=t,o=[],i=new Set;for(const l of e)for(const e of Object.keys(l))i.has(e)||(i.add(e),o.push(e));const a={};if(r&&n)for(const[l,s]of Object.entries(n.cells))a[l]=s;if(o.forEach((e,t)=>{a[Ad(t,0)]=e}),e.forEach((e,t)=>{const n=t+1;o.forEach((t,o)=>{const i=e[t];null==i||""===i?r||delete a[Ad(o,n)]:a[Ad(o,n)]=String(i)})}),!r&&n){o.length,e.length;for(const[e]of Object.entries(n.cells)){const t=/^([A-Z]+)([0-9]+)$/.exec(e);t&&(Id(t[1]),t[2])}}return{cells:a}},exports.resetAtomicCSS=function(){ct.clear(),ut=null,pt&&"undefined"!=typeof document&&(document.adoptedStyleSheets=document.adoptedStyleSheets.filter(e=>e!==pt),pt=null)},exports.resolvePluginUtility=yt,exports.responsive=N,exports.sanitizeCSS=ye,exports.sanitizeHTML=xe,exports.sanitizeHref=he,exports.sanitizeJSON=we,exports.sanitizeProps=ie,exports.sanitizeString=oe,exports.sanitizeUnicode=Se,exports.scriptsForLanguage=Fa,exports.scrubPII=Fe,exports.seoSchema={softwareApplication:e=>({"@context":"https://schema.org","@type":"SoftwareApplication",name:e.name,description:e.description,url:e.url,applicationCategory:"DeveloperApplication",operatingSystem:"Web",...e.version&&{softwareVersion:e.version,version:e.version},...e.license&&{license:e.license},...e.repository&&{codeRepository:e.repository},...e.downloadUrl&&{downloadUrl:e.downloadUrl},...void 0!==e.price&&{offers:{"@type":"Offer",price:e.price,priceCurrency:e.currency??"USD"}}}),article:e=>({"@context":"https://schema.org","@type":"Article",headline:e.headline,description:e.description,mainEntityOfPage:e.url,...e.image&&{image:e.image},author:{"@type":"Person",name:e.author},datePublished:e.datePublished,...e.dateModified&&{dateModified:e.dateModified}}),faqPage:e=>({"@context":"https://schema.org","@type":"FAQPage",mainEntity:e.map(e=>({"@type":"Question",name:e.question,acceptedAnswer:{"@type":"Answer",text:e.answer}}))}),breadcrumbList:e=>({"@context":"https://schema.org","@type":"BreadcrumbList",itemListElement:e.map((e,t)=>({"@type":"ListItem",position:t+1,name:e.name,item:e.url}))}),product:e=>({"@context":"https://schema.org","@type":"Product",name:e.name,description:e.description,image:e.image,brand:{"@type":"Brand",name:e.brand},...e.sku&&{sku:e.sku},offers:{"@type":"Offer",price:e.price,priceCurrency:e.currency,availability:`https://schema.org/${e.availability??"InStock"}`},...e.rating&&{aggregateRating:{"@type":"AggregateRating",ratingValue:e.rating.value,reviewCount:e.rating.count}}})},exports.shadows={none:"none",xs:"0 1px 2px 0 rgba(0,0,0,0.05)",sm:"0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1)",md:"0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1)",lg:"0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1)",xl:"0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1)","2xl":"0 25px 50px -12px rgba(0,0,0,0.25)",inner:"inset 0 2px 4px 0 rgba(0,0,0,0.06)"},exports.sniffMimeType=Re,exports.spacing={0:"0px",.5:"2px",1:"4px",1.5:"6px",2:"8px",2.5:"10px",3:"12px",4:"16px",5:"20px",6:"24px",8:"32px",10:"40px",12:"48px",16:"64px",20:"80px",24:"96px"},exports.spreadsheetToRecords=function(e,t){const n=new Map,r=e.cells,o=[];for(let a=0;a<t.cols;a++){const e=r[Ad(a,0)];o.push(e&&""!==e.trim()?e.trim():Ad(a,0))}const i=[];for(let a=1;a<t.rows;a++){const e={};let l=!1;for(let i=0;i<t.cols;i++){const t=Ad(i,a);let s;n.has(t)?s=n.get(t):(s=Td(t,r),n.set(t,s)),""===s||void 0===s||"string"==typeof s&&s.startsWith("#")?e[o[i]]=null:(e[o[i]]=s,l=!0)}l&&i.push(e)}return i},exports.tkx=mt,exports.tkxListPlugins=function(){return Array.from(bt.keys())},exports.tkxPlugin=function(e){bt.set(e.name,e.utilities)},exports.tkxRemovePlugin=function(e){bt.delete(e)},exports.tx=gt,exports.typography={xs:{fontSize:"0.75rem",lineHeight:"1rem"},sm:{fontSize:"0.875rem",lineHeight:"1.25rem"},base:{fontSize:"1rem",lineHeight:"1.5rem"},lg:{fontSize:"1.125rem",lineHeight:"1.75rem"},xl:{fontSize:"1.25rem",lineHeight:"1.75rem"},"2xl":{fontSize:"1.5rem",lineHeight:"2rem"},"3xl":{fontSize:"1.875rem",lineHeight:"2.25rem"},"4xl":{fontSize:"2.25rem",lineHeight:"2.5rem"},"5xl":{fontSize:"3rem",lineHeight:"1.15"}},exports.unloadFontScript=function(e){!function(e){if("undefined"==typeof document)return;const t=Na[e];if(!t)return;const n=document.getElementById(t.id);n&&n.remove()}(e)},exports.useAnnounce=je,exports.useClickOutside=Be,exports.useComponentSize=function(e,t){const{getSize:n}=Zi();return n(e,t)},exports.useConfig=Zi,exports.useDevtoolsOpen=ma,exports.useDirection=function(){return(0,a.useContext)(Ht).direction},exports.useEscapeKey=Ee,exports.useFocusTrap=We,exports.useHighContrast=function(){const[e,t]=(0,a.useState)(()=>"undefined"!=typeof window&&q());return(0,a.useEffect)(()=>{if("undefined"==typeof window)return;const e=window.matchMedia("(forced-colors: active)"),n=e=>t(e.matches);return e.addEventListener("change",n),()=>e.removeEventListener("change",n)},[]),e},exports.useI18n=function(){return(0,a.useContext)(Ht)},exports.useLocale=Ot,exports.useLogicalSpacing=function(e,t=0){const{direction:n}=Zi(),r="number"==typeof e?`${e}px`:e,o="number"==typeof t?`${t}px`:t;return"rtl"===n?{marginRight:r,marginLeft:o}:{marginLeft:r,marginRight:o}},exports.usePrefersColorScheme=function(){const[e,t]=(0,a.useState)(()=>"undefined"!=typeof window&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":"dark");return(0,a.useEffect)(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-color-scheme: dark)"),n=e=>t(e.matches?"dark":"light");return e.addEventListener?(e.addEventListener("change",n),()=>e.removeEventListener("change",n)):(e.addListener(n),()=>e.removeListener(n))},[]),e},exports.usePrefixCls=function(e,t){const{prefixCls:n}=Zi();return`${t??n}-${e}`},exports.useReducedMotion=Te,exports.useRtlFlip=function(){const{direction:e}=Zi();if("rtl"===e)return{transform:"scaleX(-1)"}},exports.useTheme=J,exports.useTkxCommand=function(){const[e,t]=(0,a.useState)(!1);return{isOpen:e,open:(0,a.useCallback)(()=>t(!0),[]),close:(0,a.useCallback)(()=>t(!1),[]),toggle:(0,a.useCallback)(()=>t(e=>!e),[])}},exports.useTkxForm=function(){const e=(0,a.useContext)(zi),t=(0,a.useRef)({}),n=(0,a.useRef)({}),r=(0,a.useRef)({}),o=(0,a.useMemo)(()=>({getFieldValue:e=>t.current[e],setFieldValue:(e,n)=>{t.current[e]=n},getFieldsValue:()=>({...t.current}),setFieldsValue:e=>{Object.assign(t.current,e)},validateFields:()=>Promise.resolve({...t.current}),validateField:e=>Promise.resolve(!0),resetFields:()=>{t.current={},n.current={},r.current={}},getFieldError:e=>n.current[e]??null,isFieldTouched:e=>r.current[e]??!1}),[]);return e?e.instance:o},exports.useToast=function(){return{toast:(0,a.useCallback)(e=>function(e){const t=`tkx-toast-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,n={...e,id:t,duration:e.duration??4e3};return fn.length<5?(fn=[...fn,n],bn(t,n.duration)):hn=[...hn,n],xn(),t}(e),[]),dismiss:(0,a.useCallback)(e=>yn(e),[]),dismissAll:(0,a.useCallback)(()=>(gn.forEach(e=>clearTimeout(e)),gn.clear(),fn=[],hn=[],void xn()),[])}},exports.validateField=tc,exports.validateProps=le,exports.verifyAuditIntegrity=pe,exports.zIndex={hide:-1,base:0,dropdown:1e3,sticky:1100,fixed:1200,overlay:1300,modal:1400,popover:1500,tooltip:1600,toast:1700,max:9999};
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,o=Object.getPrototypeOf,i=Object.prototype.hasOwnProperty;let a=require("react");var l,s;s=null!=(l=a)?e(o(l)):{},a=((e,o,a,l)=>{if(o&&"object"==typeof o||"function"==typeof o)for(var s,d=r(o),c=0,u=d.length;c<u;c++)s=d[c],i.call(e,s)||void 0===s||t(e,s,{get:(e=>o[e]).bind(null,s),enumerable:!(l=n(o,s))||l.enumerable});return e})(t(s,"default",{value:l,enumerable:!0}),l);let d=require("react/jsx-runtime"),c=require("react-dom");function u(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619)>>>0;return t.toString(16).padStart(8,"0")}var p=class{constructor(e=512){this.cache=new Map,this.hits=0,this.misses=0,this.ceiling=Math.min(e,512)}get(e){if(!this.cache.has(e))return void this.misses++;this.hits++;const t=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,t),t}set(e,t){this.cache.has(e)?this.cache.delete(e):this.cache.size>=this.ceiling&&this.cache.delete(this.cache.keys().next().value),this.cache.set(e,t)}has(e){return this.cache.has(e)}invalidate(e){void 0!==e?this.cache.delete(e):this.cache.clear()}get size(){return this.cache.size}get cacheHitRate(){const e=this.hits+this.misses;return 0===e?0:this.hits/e*100}},h=new p(512);function f(e,t){const n=h.get(e);if(void 0!==n)return n;const r=t();return h.set(e,r),r}var m=[],g=!1,x=[],y=0,b=0;function v(e){m.push(e),g||(g=!0,queueMicrotask(()=>{!function(){const e=m.splice(0),t=performance.now();for(const r of e)try{r()}catch{}const n=performance.now()-t;y+=n,b++,x.push({duration:n,timestamp:Date.now()}),x.length>100&&x.shift()}(),g=!1}))}var w={hash:u,memoize:f,batchUpdate:v,invalidate:function(e){void 0!==e?h.invalidate(e):h.invalidate()},get avgRenderTime(){return 0===b?0:y/b},get cacheHitRate(){return h.cacheHitRate},getMetrics:function(e){const t=void 0!==e?x.slice(-e):x.slice();return{avgRenderTime:0===b?0:y/b,cacheHitRate:h.cacheHitRate,renderCount:b,recent:t}}},k=new Map;function $(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}function S(e){const t=function(e){return"tkx-"+u(e)}(e);return k.has(t)||k.set(t,e),t}function C(e,...t){const n=e.reduce((e,n,r)=>e+n+(void 0!==t[r]?String(t[r]):""),"");return{className:S(n.trim()),styles:n.trim()}}function z(e){const t=Object.entries(e).map(([e,t])=>`${$(e)}: ${t};`).join(" ");return{className:S(t),styles:t}}var M={xs:"480px",sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"};function N(e,t){return`@media (min-width: ${M[e]}) { ${t} }`}function D(e,t){return`@keyframes ${e} { ${Object.entries(t).map(([e,t])=>`${e} { ${Object.entries(t).map(([e,t])=>`${$(e)}: ${t};`).join(" ")} }`).join(" ")} }`}function R(e,t){return void 0!==t?`--tkx-${e}: ${t};`:`var(--tkx-${e})`}function P(){return Array.from(k.entries()).map(([e,t])=>`.${e} { ${t} }`).join("\n")}function F(){if("undefined"==typeof document)return;let e=document.getElementById("tkx-styles");e||(e=document.createElement("style"),e.id="tkx-styles",document.head.appendChild(e)),e.textContent=P()}var A={css:C,fromObject:z,responsive:N,keyframes:D,cssVar:R,extractCSS:P,injectStyles:F,resetStyles:function(){k.clear()}};function I(e){const[t,n,r]=function(e){if(!e||"string"!=typeof e)return[0,0,0];const t=e.replace("#",""),n=3===t.length?t.split("").map(e=>e+e).join(""):t,r=parseInt(n.slice(0,2),16),o=parseInt(n.slice(2,4),16),i=parseInt(n.slice(4,6),16);return[isNaN(r)?0:r,isNaN(o)?0:o,isNaN(i)?0:i]}(e).map(e=>{const t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4});return.2126*t+.7152*n+.0722*r}function L(e,t){const n=I(e),r=I(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function T(e,t,n=!1){return L(e,t)>=(n?3:4.5)}function W(e,t,n=!1){return L(e,t)>=(n?4.5:7)}function j(e,t){const n=t??["#ffffff","#000000"];return n.reduce((t,n)=>L(n,e)>L(t,e)?n:t,n[0])}function E(){const e=document.createElement("div"),t=document.createElement("div");for(const n of[e,t])n.setAttribute("aria-atomic","true"),n.style.cssText="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;",document.body.appendChild(n);return e.setAttribute("aria-live","polite"),t.setAttribute("aria-live","assertive"),{announce(n,r="polite"){const o="assertive"===r?t:e;o.textContent="",setTimeout(()=>{o.textContent=n},0)},destroy(){e.remove(),t.remove()}}}var B=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])',"details > summary"].join(", ");function V(e){let t=null,n=null;function r(){return Array.from(e.querySelectorAll(B)).filter(e=>!e.closest("[hidden]")&&!e.closest('[aria-hidden="true"]'))}return{activate(){t=document.activeElement;const o=r();o.length>0&&o[0].focus(),n=e=>{if("Tab"!==e.key)return;const t=r();if(0===t.length)return;const n=t[0],o=t[t.length-1];e.shiftKey?document.activeElement===n&&(e.preventDefault(),o.focus()):document.activeElement===o&&(e.preventDefault(),n.focus())},e.addEventListener("keydown",n)},deactivate(){n&&e.removeEventListener("keydown",n),t instanceof HTMLElement&&t.focus(),t=null,n=null}}}function H(e,t,n,r){let o=t;switch(e.key){case"ArrowLeft":case"ArrowUp":e.preventDefault(),o=0===t?n-1:t-1;break;case"ArrowRight":case"ArrowDown":e.preventDefault(),o=t===n-1?0:t+1;break;case"Home":e.preventDefault(),o=0;break;case"End":e.preventDefault(),o=n-1;break;case"Enter":case" ":return e.preventDefault(),void r(t);default:return}r(o)}function O(){return"undefined"!=typeof window&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function q(){return"undefined"!=typeof window&&window.matchMedia("(forced-colors: active)").matches}var U={contrastRatio:L,meetsAA:T,meetsAAA:W,getAccessibleForeground:j,createAnnouncer:E,createFocusTrap:V,handleTabsKeyboard:H,handleMenuKeyboard:function(e,t,n,r,o){let i=t;switch(e.key){case"ArrowUp":e.preventDefault(),i=0===t?n-1:t-1;break;case"ArrowDown":e.preventDefault(),i=t===n-1?0:t+1;break;case"Home":e.preventDefault(),i=0;break;case"End":e.preventDefault(),i=n-1;break;case"Enter":case" ":return e.preventDefault(),void r(t);case"Escape":return e.preventDefault(),void o?.();default:return}r(i)},prefersReducedMotion:O,prefersHighContrast:q,announce:function(e,t="polite"){if("undefined"==typeof document)return;let n=document.getElementById("tkx-live-region");n||(n=document.createElement("div"),n.id="tkx-live-region",n.setAttribute("aria-live",t),n.setAttribute("aria-atomic","true"),n.style.cssText="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;",document.body.appendChild(n)),n.textContent="",setTimeout(()=>{n&&(n.textContent=e)},0)}},K="undefined"!=typeof window?a.useLayoutEffect:a.useEffect,Y={bg:"#0a0a0f",surface:"#12121a",surfaceAlt:"#1a1a2e",border:"#2a2a3e",text:"#e8e8f4",textMuted:"#8888aa",primary:"#00f5d4",secondary:"#7b2ff7",danger:"#f72585",warning:"#ffbe0b",success:"#06d6a0",info:"#3a86ff"},Z={bg:"#f8f6f1",surface:"#ffffff",surfaceAlt:"#f0ede6",border:"#ddd8cc",text:"#1a1815",textMuted:"#6b6560",primary:"#0d7c5f",secondary:"#6930c3",danger:"#c1121f",warning:"#d4a017",success:"#0d7c5f",info:"#1d4ed8"},X=/^#[0-9a-fA-F]{3,8}$/,G=(0,a.createContext)(Y);function _({theme:e,mode:t,lightTheme:n=Z,darkTheme:r=Y,defaultMode:o="light",suppressHydrationWarning:i=!1,children:l}){const s=void 0!==e,d=function(e){const[t,n]=(0,a.useState)(null);return(0,a.useEffect)(()=>{if(!e||"undefined"==typeof window||!window.matchMedia)return;const t=window.matchMedia("(prefers-color-scheme: dark)");n(t.matches);const r=e=>n(e.matches);return t.addEventListener?(t.addEventListener("change",r),()=>t.removeEventListener("change",r)):(t.addListener(r),()=>t.removeListener(r))},[e]),t}(!s&&("auto"===t||void 0===t)),c=function(){const[e,t]=(0,a.useState)(!1);return(0,a.useEffect)(()=>t(!0),[]),e}();let u;u=s?e:"light"===t?n:"dark"===t?r:null===d?"dark"===o?r:n:d?r:n;const p=i&&!c;K(()=>{if(p)return;const e=Object.entries(u).map(([e,t])=>R(e,t)).join(" ");let t=document.getElementById("tkx-theme");if(!t){t=document.createElement("style"),t.id="tkx-theme";const e=document.head.querySelector("style");e?document.head.insertBefore(t,e):document.head.appendChild(t)}t.textContent=`:root { ${e} }`,document.documentElement.setAttribute("data-tkx-scheme",u===r?"dark":u===n?"light":"custom")},[u,r,n,p]);const h=p?{}:Object.fromEntries(Object.entries(u).map(([e,t])=>[`--tkx-${e}`,t]));return(0,a.createElement)(G.Provider,{value:u},(0,a.createElement)("div",{style:{display:"contents",...h}},l))}function J(){return(0,a.useContext)(G)}function Q(e){return{"--tkx-bg":e.bg,"--tkx-bg-subtle":e.surface,"--tkx-fg":e.text,"--tkx-fg-muted":e.textMuted,"--tkx-accent":e.primary,"--tkx-border":e.border,"--tkx-border-soft":e.surfaceAlt}}function ee(e,t,n){n/=100;const r=(t/=100)*Math.min(n,1-n),o=t=>{const o=(t+e/30)%12,i=n-r*Math.max(Math.min(o-3,9-o,1),-1);return Math.round(255*i).toString(16).padStart(2,"0")};return`#${o(0)}${o(8)}${o(4)}`}var te=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function ne(e,t){return e>>>t|e<<32-t}function re(e){const t=[];for(let a=0;a<e.length;a++){let n=e.charCodeAt(a);n<128?t.push(n):n<2048?t.push(192|n>>6,128|63&n):n<55296||n>=57344?t.push(224|n>>12,128|n>>6&63,128|63&n):(a++,n=65536+((1023&n)<<10|1023&e.charCodeAt(a)),t.push(240|n>>18,128|n>>12&63,128|n>>6&63,128|63&n))}const n=8*t.length;for(t.push(128);t.length%64!=56;)t.push(0);for(let a=0;a<4;a++)t.push(0);t.push(n>>>24&255,n>>>16&255,n>>>8&255,255&n);const r=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),o=new Uint32Array(64);for(let a=0;a<t.length;a+=64){for(let r=0;r<16;r++)o[r]=t[a+4*r]<<24|t[a+4*r+1]<<16|t[a+4*r+2]<<8|t[a+4*r+3];for(let t=16;t<64;t++){const e=ne(o[t-15],7)^ne(o[t-15],18)^o[t-15]>>>3,n=ne(o[t-2],17)^ne(o[t-2],19)^o[t-2]>>>10;o[t]=o[t-16]+e+o[t-7]+n|0}let[e,n,i,l,s,d,c,u]=r;for(let t=0;t<64;t++){const r=u+(ne(s,6)^ne(s,11)^ne(s,25))+(s&d^~s&c)+te[t]+o[t]|0,a=(ne(e,2)^ne(e,13)^ne(e,22))+(e&n^e&i^n&i)|0;u=c,c=d,d=s,s=l+r|0,l=i,i=n,n=e,e=r+a|0}r[0]=r[0]+e|0,r[1]=r[1]+n|0,r[2]=r[2]+i|0,r[3]=r[3]+l|0,r[4]=r[4]+s|0,r[5]=r[5]+d|0,r[6]=r[6]+c|0,r[7]=r[7]+u|0}let i="";for(let a=0;a<8;a++)i+=(r[a]>>>0).toString(16).padStart(8,"0");return i}var oe={"<":"&lt;",">":"&gt;","&":"&amp;","'":"&#39;",'"':"&quot;","`":"&#96;"},ie=new Set,ae=[],le=0;function se(e){return ie.add(e),()=>{ie.delete(e)}}function de(){return ae.slice()}function ce(){ae.length=0}function ue(e,t,n="info",r){const o=Object.freeze({id:"se_"+ ++le,type:e,timestamp:Date.now(),severity:n,message:t,detail:r?Object.freeze({...r}):void 0});ae.push(o),ae.length>500&&ae.shift();for(const i of ie)try{i(o)}catch{}return o}function pe(e){if(null==e)return"";let t=String(e);t=t.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/g,"");let n=0;const r=t.replace(/[<>&'"`]/g,e=>(n++,oe[e]??e));return n>0&&ue("xss-sanitized",`Escaped ${n} HTML-sensitive character${1===n?"":"s"} before render`,"warning",{escapes:n}),r}function he(e){const t={};for(const n of Object.keys(e))t[n]=fe(e[n]);return t}function fe(e){return"string"==typeof e?pe(e):Array.isArray(e)?e.map(fe):null===e||"object"!=typeof e||function(e){return"object"==typeof e&&null!==e&&"$$typeof"in e}(e)?e:he(e)}function me(e,t){const n=[];for(const[r,o]of Object.entries(t)){const t=e[r],i=null==t;o.required&&i?n.push(`prop '${r}' is required`):i||(typeof t===o.type?("number"===o.type&&"number"==typeof t&&(void 0!==o.min&&t<o.min&&n.push(`prop '${r}' must be >= ${o.min}`),void 0!==o.max&&t>o.max&&n.push(`prop '${r}' must be <= ${o.max}`)),"string"===o.type&&"string"==typeof t&&o.pattern&&!o.pattern.test(t)&&n.push(`prop '${r}' does not match pattern ${o.pattern}`),o.enum&&!o.enum.includes(t)&&n.push(`prop '${r}' must be one of: ${o.enum.join(", ")}`)):n.push(`prop '${r}' must be of type ${o.type}, got ${typeof t}`))}return{valid:0===n.length,errors:n}}var ge=new Map,xe=[];function ye(e,t,n){const r=re(JSON.stringify(n??{})),o=re((xe.length>0?xe[xe.length-1].chainHash:"0000000000000000000000000000000000000000000000000000000000000000")+r+t+e),i=Object.freeze({timestamp:Date.now(),component:t,action:e,propsHash:r,chainHash:o});return xe=Object.freeze([...xe,i]),ue("audit",`${t}: ${e}`,"info",{component:t,action:e,chainHash:i.chainHash}),i}function be(e){let t=xe;return e?.component&&(t=t.filter(t=>t.component===e.component)),e?.action&&(t=t.filter(t=>t.action===e.action)),e?.limit&&(t=t.slice(-e.limit)),t}function ve(){let e="0000000000000000000000000000000000000000000000000000000000000000";for(const t of xe){if(re(e+t.propsHash+t.component+t.action)!==t.chainHash)return!1;e=t.chainHash}return!0}function we(e){if("string"!=typeof e)return null;const t=e.trim();if(!t)return null;const n=t.replace(/[\u0000-\u001F\u007F]/g,"");return/^javascript:/i.test(n)||/^vbscript:/i.test(n)||/^data:/i.test(n)&&!/^data:image\//i.test(n)||/^file:/i.test(n)?null:n}var ke=new Set(["a","abbr","b","blockquote","br","code","del","div","em","h1","h2","h3","h4","h5","h6","hr","i","img","ins","kbd","li","mark","ol","p","pre","q","s","samp","small","span","strong","sub","sup","table","tbody","td","tfoot","th","thead","tr","u","ul"]),$e={a:new Set(["href","title","target","rel"]),img:new Set(["src","alt","title","width","height","loading","decoding"]),th:new Set(["scope","colspan","rowspan","align"]),td:new Set(["colspan","rowspan","align"]),"*":new Set(["id","class","lang","dir","title"])},Se=new Set(["constructor","prototype","__proto__","submit","reset","action","method","enctype","target","elements","children","firstChild","nextSibling","parentNode","ownerDocument","cookie","domain","location","documentElement","body","head","title","contentWindow","contentDocument"]);function Ce(e){if("string"!=typeof e)return"";if("undefined"==typeof DOMParser)return pe(e);const t=(new DOMParser).parseFromString(`<div>${e}</div>`,"text/html").body.firstElementChild;return t?(ze(t),t.innerHTML):""}function ze(e){const t=Array.from(e.children);for(const n of t){const e=n.tagName.toLowerCase();if(ke.has(e)){for(const t of Array.from(n.attributes)){const r=t.name.toLowerCase();if(r.startsWith("on"))n.removeAttribute(t.name);else if(Se.has(r))n.removeAttribute(t.name);else if("style"!==r)if(($e[e]??new Set).has(r)||$e["*"].has(r)){if(("href"===r||"src"===r)&&"string"==typeof t.value){const e=we(t.value);null===e?n.removeAttribute(t.name):n.setAttribute(t.name,e)}"name"!==r&&"id"!==r||!Se.has(t.value.toLowerCase())||n.removeAttribute(t.name)}else n.removeAttribute(t.name);else n.setAttribute("style",Me(t.value))}ze(n)}else n.remove()}}function Me(e){if("string"!=typeof e)return"";let t=e;return t=t.replace(/expression\s*\([^)]*\)/gi,""),t=t.replace(/url\s*\(\s*['"]?\s*(javascript|vbscript|data)\s*:[^)]*\)/gi,"url(#)"),t=t.replace(/@import[^;]*;?/gi,""),t=t.replace(/behavior\s*:[^;]*;?/gi,""),t=t.replace(/-moz-binding[^;]*;?/gi,""),t=t.replace(/[<>]/g,""),t=t.replace(/[\u0000-\u001F\u007F]/g,""),t.trim()}var Ne=new Set(["__proto__","constructor","prototype"]);function De(e){try{return Re(JSON.parse(e,(e,t)=>{if(!Ne.has(e))return t}))}catch{return null}}function Re(e){if(Array.isArray(e))return e.map(Re);if(e&&"object"==typeof e){const t={};for(const[n,r]of Object.entries(e))Ne.has(n)||(t[n]=Re(r));return t}return e}function Pe(e){return!("string"!=typeof e||!e||/[\u0000-\u001F\u007F<>"]/.test(e)||Se.has(e.toLowerCase()))}function Fe(e){if("string"!=typeof e)return"";const t=e.replace(/[\u200B-\u200F\u202A-\u202E\u2060-\u206F\uFEFF\u00AD]/g,"");return t.length!==e.length&&ue("unicode-stripped","Removed bidirectional / zero-width control characters (Trojan-Source vector)","critical",{charsRemoved:e.length-t.length}),t}function Ae(e={}){const{allowInlineStyles:t=!0,imgHosts:n=[],connectHosts:r=[],fontHosts:o=[],scriptNonce:i,reportUri:a}=e,l=["default-src 'self'","script-src "+(i?`'self' 'nonce-${i}'`:"'self'"),"style-src "+(t?"'self' 'unsafe-inline'":"'self'"),`img-src ${["'self'","data:","https:",...n].join(" ")}`,`font-src ${["'self'","https:","data:",...o].join(" ")}`,`connect-src ${["'self'",...r].join(" ")}`,"frame-ancestors 'none'","form-action 'self'","base-uri 'self'","object-src 'none'","upgrade-insecure-requests"];return a&&l.push(`report-uri ${a}`),l.join("; ")}function Ie(){if("undefined"==typeof window)return;const e=window.trustedTypes;if(e)try{e.createPolicy("tkx",{createHTML:Ce,createScriptURL:e=>we(e)??"",createScript:()=>{throw new Error("TekiVex: inline script creation forbidden")}})}catch{}}function Le(){if("undefined"==typeof window)return!1;try{return window.top!==window.self}catch{return!0}}function Te(e){if("undefined"!=typeof window&&Le())if(ue("clickjacking-detected","Page is embedded in a cross-origin frame — clickjacking precondition","critical"),e)e();else try{window.top.location.href=window.self.location.href}catch{}}function We(e,t){let n=e,r=Date.now();return{check(){const o=Date.now(),i=o-r,a=Math.floor(i/t);return a>0&&(n=Math.min(e,n+a),r=o),n<=0?(ue("rate-limited","Action throttled — token bucket exhausted","warning",{capacity:e,intervalMs:t}),!1):(n-=1,!0)},reset(){n=e,r=Date.now()}}}async function je(e){const t=new Uint8Array(await e.slice(0,12).arrayBuffer()),n=(...e)=>e.every((e,n)=>t[n]===e);return n(137,80,78,71)?"image/png":n(255,216,255)?"image/jpeg":n(71,73,70,56)?"image/gif":n(66,77)?"image/bmp":n(82,73,70,70)&&87===t[8]&&69===t[9]&&66===t[10]&&80===t[11]?"image/webp":n(37,80,68,70)?"application/pdf":n(80,75,3,4)?"application/zip":123===t[0]||91===t[0]?"application/json":[...t].includes(0)?(ue("mime-rejected",`File "${e.name}" rejected — magic bytes match no allow-listed type (claimed: ${e.type||"unknown"})`,"critical",{name:e.name,claimedType:e.type}),null):"text/plain"}var Ee=[{name:"ssn",re:/\b\d{3}-\d{2}-\d{4}\b/g,repl:"[redacted-ssn]"},{name:"credit",re:/\b(?:\d[ -]?){13,19}\b/g,repl:e=>{const t=e.replace(/[ -]/g,"");return t.length<13||t.length>19?e:function(e){let t=0,n=!1;for(let r=e.length-1;r>=0;r--){let o=e.charCodeAt(r)-48;if(o<0||o>9)return!1;n&&(o*=2,o>9&&(o-=9)),t+=o,n=!n}return t>0&&t%10==0}(t)?"[redacted-card]":e}},{name:"email",re:/\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b/gi,repl:"[redacted-email]"},{name:"phone",re:/\b(\+?\d{1,3}[ -])?\(?\d{3}\)?[ -]?\d{3}[ -]?\d{4}\b/g,repl:"[redacted-phone]"},{name:"apikey",re:/\b(sk|pk|rk)-[A-Za-z0-9]{20,}\b/g,repl:"[redacted-key]"}];function Be(e){if("string"!=typeof e)return"";let t=e,n=0;for(const{re:r,repl:o}of Ee)t="function"==typeof o?t.replace(r,e=>(n++,o(e))):t.replace(r,e=>(n++,o));return n>0&&ue("pii-redacted",`Redacted ${n} PII token${1===n?"":"s"} before the text left the trust boundary`,"warning",{redactions:n}),t}function Ve(e){if(e&&"object"==typeof e&&!Object.isFrozen(e)){for(const t of Object.keys(e))Ve(e[t]);Object.freeze(e)}return e}var He=Object.freeze({sanitizeString:pe,sanitizeHref:we,sanitizeHTML:Ce,sanitizeCSS:Me,sanitizeJSON:De,sanitizeUnicode:Fe,isSafeAttrName:Pe,buildTkxCSP:Ae,installTrustedTypes:Ie,isFramed:Le,installFrameBuster:Te,createRateLimiter:We,sniffMimeType:je,scrubPII:Be,deepFreeze:Ve,__brand:"TekiVex SecurityCore v2.6.0 © 007krcs"}),Oe={sanitize:pe,sanitizeProps:he,validateProps:me,createCSP:function(e,t){const n={componentId:e,permissions:t,directives:{"default-src":["'self'"],"style-src":t.allowInlineStyles?["'self'","'unsafe-inline'"]:["'self'"],"img-src":t.allowDataUrls?["'self'","data:"]:t.allowExternalSrc?["'self'","*"]:["'self'"],"script-src":t.allowScripts?["'self'"]:["'none'"]}};return ge.set(e,n),n},hasPermission:function(e,t){return!0===ge.get(e)?.permissions[t]},audit:ye,getAuditLog:be,verifyAuditIntegrity:ve};function qe(){const[e,t]=(0,a.useState)(()=>"undefined"!=typeof window&&O());return(0,a.useEffect)(()=>{if("undefined"==typeof window)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)"),n=e=>t(e.matches);return e.addEventListener("change",n),()=>e.removeEventListener("change",n)},[]),e}function Ue(e){const t=(0,a.useRef)(null);return(0,a.useEffect)(()=>{if(!e||!t.current)return;const n=V(t.current);return n.activate(),()=>n.deactivate()},[e]),t}function Ke(){const e=(0,a.useRef)(null);return(0,a.useEffect)(()=>{if("undefined"!=typeof document)return e.current=E(),()=>{e.current?.destroy()}},[]),(0,a.useCallback)((t,n="polite")=>{e.current?.announce(t,n)},[])}function Ye(e,t=!0){const n=(0,a.useRef)(e);n.current=e,(0,a.useEffect)(()=>{if(!t||"undefined"==typeof document)return;const e=e=>{"Escape"===e.key&&n.current()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[t])}function Ze(e,t){const n=(0,a.useRef)(t);n.current=t,(0,a.useEffect)(()=>{const t=t=>{e.current&&!e.current.contains(t.target)&&n.current()};return document.addEventListener("pointerdown",t),()=>document.removeEventListener("pointerdown",t)},[e])}var Xe={0:"0",px:"1px",.5:"2px",1:"4px",1.5:"6px",2:"8px",2.5:"10px",3:"12px",3.5:"14px",4:"16px",5:"20px",6:"24px",7:"28px",8:"32px",9:"36px",10:"40px",11:"44px",12:"48px",14:"56px",16:"64px",20:"80px",24:"96px",28:"112px",32:"128px",36:"144px",40:"160px",44:"176px",48:"192px",52:"208px",56:"224px",60:"240px",64:"256px",72:"288px",80:"320px",96:"384px",auto:"auto",full:"100%",screen:"100vw",svh:"100svh",dvh:"100dvh",fit:"fit-content",max:"max-content",min:"min-content"},Ge={...Xe,screen:"100vh"},_e={"1/2":"50%","1/3":"33.333333%","2/3":"66.666667%","1/4":"25%","2/4":"50%","3/4":"75%","1/5":"20%","2/5":"40%","3/5":"60%","4/5":"80%","1/6":"16.666667%","5/6":"83.333333%","1/12":"8.333333%","5/12":"41.666667%","7/12":"58.333333%","11/12":"91.666667%"},Je={none:"0",sm:"2px","":"4px",md:"6px",lg:"8px",xl:"12px","2xl":"16px","3xl":"24px",full:"9999px"},Qe={sm:"0 1px 2px 0 rgba(0,0,0,.05)","":"0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1)",md:"0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1)",lg:"0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1)",xl:"0 20px 25px -5px rgba(0,0,0,.1),0 8px 10px -6px rgba(0,0,0,.1)","2xl":"0 25px 50px -12px rgba(0,0,0,.25)",inner:"inset 0 2px 4px 0 rgba(0,0,0,.05)",none:"none"},et={xs:["0.75rem","1rem"],sm:["0.875rem","1.25rem"],base:["1rem","1.5rem"],lg:["1.125rem","1.75rem"],xl:["1.25rem","1.75rem"],"2xl":["1.5rem","2rem"],"3xl":["1.875rem","2.25rem"],"4xl":["2.25rem","2.5rem"],"5xl":["3rem","1"],"6xl":["3.75rem","1"],"7xl":["4.5rem","1"],"8xl":["6rem","1"],"9xl":["8rem","1"]},tt={thin:"100",extralight:"200",light:"300",normal:"400",medium:"500",semibold:"600",bold:"700",extrabold:"800",black:"900"},nt={none:"1",tight:"1.25",snug:"1.375",normal:"1.5",relaxed:"1.625",loose:"2",3:"0.75rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem"},rt={tighter:"-0.05em",tight:"-0.025em",normal:"0em",wide:"0.025em",wider:"0.05em",widest:"0.1em"},ot={none:"0",sm:"4px","":"8px",md:"12px",lg:"16px",xl:"24px","2xl":"40px","3xl":"64px"},it=Object.fromEntries([0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100].map(e=>[String(e),String(e/100)])),at=new Set(["bg","surface","surfaceAlt","border","text","textMuted","primary","secondary","danger","warning","success","info"]),lt={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},st=/javascript\s*:|vbscript\s*:|data\s*:\s*text\/html|data\s*:\s*text\/javascript|expression\s*\(|[\r\n\x00]/i,dt=new Set(["behavior","-moz-binding","-webkit-binding","src"]),ct=new Set(["width","min-width","max-width","height","min-height","max-height","margin","margin-top","margin-right","margin-bottom","margin-left","padding","padding-top","padding-right","padding-bottom","padding-left","position","top","right","bottom","left","z-index","inset","flex","flex-grow","flex-shrink","flex-basis","flex-direction","flex-wrap","align-items","align-self","align-content","justify-content","justify-items","justify-self","gap","row-gap","column-gap","grid-template-columns","grid-template-rows","grid-column","grid-row","grid-area","grid-template-areas","font-size","font-weight","font-family","font-style","line-height","letter-spacing","text-align","text-decoration","text-transform","text-overflow","white-space","word-break","word-wrap","overflow-wrap","color","background","background-color","background-image","background-position","background-size","background-repeat","opacity","border","border-top","border-right","border-bottom","border-left","border-width","border-style","border-color","border-radius","outline","outline-offset","box-shadow","text-shadow","filter","backdrop-filter","transform","transition","animation","display","overflow","overflow-x","overflow-y","visibility","pointer-events","cursor","user-select","aspect-ratio","object-fit","object-position","list-style","vertical-align","float","clear","resize","scroll-behavior","content"]);function ut(e){return st.test(e)||e.includes("}")||e.includes("{")||e.includes("<")||e.includes(">")?null:e}function pt(e){const t=e.match(/^\[(.+)]$/);return t?ut(t[1]):null}function ht(e){return at.has(e)?`var(--tkx-${e})`:"transparent"===e?"transparent":"current"===e?"currentColor":"white"===e?"#ffffff":"black"===e?"#000000":"inherit"===e?"inherit":pt(e)||(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(e),e)}function ft(e){const t=e.match(/^\[(--[a-zA-Z0-9_-]+):(.+)]$/);if(t){const e=ut(t[2]);return e?{[t[1]]:e}:null}const n=e.match(/^\[([a-zA-Z-]+):(.+)]$/);if(n){const e=function(e){const t=e.toLowerCase().trim();return dt.has(t)?null:ct.has(t)?t:null}(n[1]),t=ut(n[2]);return e&&t?{[e]:t}:null}const r={flex:"flex","inline-flex":"inline-flex",grid:"grid","inline-grid":"inline-grid",block:"block","inline-block":"inline-block",inline:"inline",hidden:"none",contents:"contents","flow-root":"flow-root",table:"table","table-row":"table-row","table-cell":"table-cell","table-caption":"table-caption","list-item":"list-item"};if(r[e])return{display:r[e]};const o={"flex-row":"row","flex-col":"column","flex-row-reverse":"row-reverse","flex-col-reverse":"column-reverse"};if(o[e])return{"flex-direction":o[e]};const i={"flex-wrap":"wrap","flex-nowrap":"nowrap","flex-wrap-reverse":"wrap-reverse"};if(i[e])return{"flex-wrap":i[e]};const a={"flex-1":"1 1 0%","flex-auto":"1 1 auto","flex-none":"none","flex-initial":"0 1 auto"};if(a[e])return{flex:a[e]};if("grow"===e||"flex-grow"===e)return{"flex-grow":"1"};if("grow-0"===e)return{"flex-grow":"0"};if("shrink"===e||"flex-shrink"===e)return{"flex-shrink":"1"};if("shrink-0"===e||"flex-shrink-0"===e)return{"flex-shrink":"0"};const l={"items-start":"flex-start","items-end":"flex-end","items-center":"center","items-stretch":"stretch","items-baseline":"baseline"};if(l[e])return{"align-items":l[e]};const s={"justify-start":"flex-start","justify-end":"flex-end","justify-center":"center","justify-between":"space-between","justify-around":"space-around","justify-evenly":"space-evenly","justify-stretch":"stretch","justify-normal":"normal"};if(s[e])return{"justify-content":s[e]};const d={"self-auto":"auto","self-start":"flex-start","self-end":"flex-end","self-center":"center","self-stretch":"stretch","self-baseline":"baseline"};if(d[e])return{"align-self":d[e]};const c={"content-start":"flex-start","content-end":"flex-end","content-center":"center","content-between":"space-between","content-around":"space-around","content-evenly":"space-evenly","content-stretch":"stretch"};if(c[e])return{"align-content":c[e]};let u;if(u=e.match(/^grid-cols-(\d+|none|subgrid)$/))return{"grid-template-columns":"none"===u[1]?"none":"subgrid"===u[1]?"subgrid":`repeat(${u[1]},minmax(0,1fr))`};if(u=e.match(/^grid-rows-(\d+|none|subgrid)$/))return{"grid-template-rows":"none"===u[1]?"none":"subgrid"===u[1]?"subgrid":`repeat(${u[1]},minmax(0,1fr))`};if(u=e.match(/^col-span-(full|\d+)$/))return{"grid-column":"full"===u[1]?"1 / -1":`span ${u[1]} / span ${u[1]}`};if(u=e.match(/^col-start-(\d+|auto)$/))return{"grid-column-start":u[1]};if(u=e.match(/^col-end-(\d+|auto)$/))return{"grid-column-end":u[1]};if(u=e.match(/^row-span-(full|\d+)$/))return{"grid-row":"full"===u[1]?"1 / -1":`span ${u[1]} / span ${u[1]}`};if(u=e.match(/^row-start-(\d+|auto)$/))return{"grid-row-start":u[1]};if(u=e.match(/^row-end-(\d+|auto)$/))return{"grid-row-end":u[1]};if("grid-flow-row"===e)return{"grid-auto-flow":"row"};if("grid-flow-col"===e)return{"grid-auto-flow":"column"};if("grid-flow-dense"===e)return{"grid-auto-flow":"dense"};if("grid-flow-row-dense"===e)return{"grid-auto-flow":"row dense"};if("grid-flow-col-dense"===e)return{"grid-auto-flow":"column dense"};if(u=e.match(/^p-(.+)$/)){const e=Xe[u[1]]??pt(u[1]);if(e)return{padding:e}}if(u=e.match(/^px-(.+)$/)){const e=Xe[u[1]]??pt(u[1]);if(e)return{"padding-left":e,"padding-right":e}}if(u=e.match(/^py-(.+)$/)){const e=Xe[u[1]]??pt(u[1]);if(e)return{"padding-top":e,"padding-bottom":e}}if(u=e.match(/^pt-(.+)$/)){const e=Xe[u[1]]??pt(u[1]);if(e)return{"padding-top":e}}if(u=e.match(/^pr-(.+)$/)){const e=Xe[u[1]]??pt(u[1]);if(e)return{"padding-right":e}}if(u=e.match(/^pb-(.+)$/)){const e=Xe[u[1]]??pt(u[1]);if(e)return{"padding-bottom":e}}if(u=e.match(/^pl-(.+)$/)){const e=Xe[u[1]]??pt(u[1]);if(e)return{"padding-left":e}}if(u=e.match(/^-?m-(.+)$/)){const t=e.startsWith("-"),n=Xe[u[1]]??pt(u[1]);if(n)return{margin:t&&"0"!==n?`-${n}`:n}}if(u=e.match(/^-?mx-(.+)$/)){const t=e.startsWith("-"),n=Xe[u[1]]??pt(u[1]);if(n){const e=t&&"0"!==n?`-${n}`:n;return{"margin-left":e,"margin-right":e}}}if(u=e.match(/^-?my-(.+)$/)){const t=e.startsWith("-"),n=Xe[u[1]]??pt(u[1]);if(n){const e=t&&"0"!==n?`-${n}`:n;return{"margin-top":e,"margin-bottom":e}}}if(u=e.match(/^-?mt-(.+)$/)){const t=e.startsWith("-"),n=Xe[u[1]]??pt(u[1]);if(n)return{"margin-top":t&&"0"!==n?`-${n}`:n}}if(u=e.match(/^-?mr-(.+)$/)){const t=e.startsWith("-"),n=Xe[u[1]]??pt(u[1]);if(n)return{"margin-right":t&&"0"!==n?`-${n}`:n}}if(u=e.match(/^-?mb-(.+)$/)){const t=e.startsWith("-"),n=Xe[u[1]]??pt(u[1]);if(n)return{"margin-bottom":t&&"0"!==n?`-${n}`:n}}if(u=e.match(/^-?ml-(.+)$/)){const t=e.startsWith("-"),n=Xe[u[1]]??pt(u[1]);if(n)return{"margin-left":t&&"0"!==n?`-${n}`:n}}if("mx-auto"===e)return{"margin-left":"auto","margin-right":"auto"};if("my-auto"===e)return{"margin-top":"auto","margin-bottom":"auto"};if(u=e.match(/^gap-(.+)$/)){const e=Xe[u[1]]??pt(u[1]);if(e)return{gap:e}}if(u=e.match(/^gap-x-(.+)$/)){const e=Xe[u[1]]??pt(u[1]);if(e)return{"column-gap":e}}if(u=e.match(/^gap-y-(.+)$/)){const e=Xe[u[1]]??pt(u[1]);if(e)return{"row-gap":e}}if(u=e.match(/^w-(.+)$/)){const e=u[1],t=Xe[e]??_e[e]??pt(e);if(t)return{width:t}}if(u=e.match(/^min-w-(.+)$/)){const e=Xe[u[1]]??pt(u[1]);if(e)return{"min-width":e}}if(u=e.match(/^max-w-(.+)$/)){const e={none:"none",xs:"20rem",sm:"24rem",md:"28rem",lg:"32rem",xl:"36rem","2xl":"42rem","3xl":"48rem","4xl":"56rem","5xl":"64rem","6xl":"72rem","7xl":"80rem",full:"100%",screen:"100vw",min:"min-content",max:"max-content",fit:"fit-content"}[u[1]]??Xe[u[1]]??pt(u[1]);if(e)return{"max-width":e}}if(u=e.match(/^h-(.+)$/)){const e=u[1],t=Ge[e]??_e[e]??pt(e);if(t)return{height:t}}if(u=e.match(/^min-h-(.+)$/)){const e={0:"0",full:"100%",screen:"100vh",svh:"100svh",dvh:"100dvh"}[u[1]]??Xe[u[1]]??pt(u[1]);if(e)return{"min-height":e}}if(u=e.match(/^max-h-(.+)$/)){const e=Ge[u[1]]??pt(u[1]);if(e)return{"max-height":e}}if(u=e.match(/^size-(.+)$/)){const e=Xe[u[1]]??_e[u[1]]??pt(u[1]);if(e)return{width:e,height:e}}if(u=e.match(/^text-(xs|sm|base|lg|[2-9]xl|\d+xl)$/)){const[e,t]=et[u[1]]??["1rem","1.5rem"];return{"font-size":e,"line-height":t}}if(u=e.match(/^font-(thin|extralight|light|normal|medium|semibold|bold|extrabold|black|\d+)$/))return{"font-weight":tt[u[1]]??u[1]};if(u=e.match(/^leading-(.+)$/)){const e=nt[u[1]]??pt(u[1]);if(e)return{"line-height":e}}if(u=e.match(/^tracking-(.+)$/)){const e=rt[u[1]]??pt(u[1]);if(e)return{"letter-spacing":e}}const p={"text-left":"left","text-center":"center","text-right":"right","text-justify":"justify","text-start":"start","text-end":"end"};if(p[e])return{"text-align":p[e]};if("italic"===e)return{"font-style":"italic"};if("not-italic"===e)return{"font-style":"normal"};if("uppercase"===e)return{"text-transform":"uppercase"};if("lowercase"===e)return{"text-transform":"lowercase"};if("capitalize"===e)return{"text-transform":"capitalize"};if("normal-case"===e)return{"text-transform":"none"};if("underline"===e)return{"text-decoration-line":"underline"};if("overline"===e)return{"text-decoration-line":"overline"};if("line-through"===e)return{"text-decoration-line":"line-through"};if("no-underline"===e)return{"text-decoration-line":"none"};if("truncate"===e)return{overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap"};if("text-ellipsis"===e)return{"text-overflow":"ellipsis"};if("text-clip"===e)return{"text-overflow":"clip"};if("whitespace-normal"===e)return{"white-space":"normal"};if("whitespace-nowrap"===e)return{"white-space":"nowrap"};if("whitespace-pre"===e)return{"white-space":"pre"};if("whitespace-pre-wrap"===e)return{"white-space":"pre-wrap"};if("whitespace-pre-line"===e)return{"white-space":"pre-line"};if("break-words"===e)return{"overflow-wrap":"break-word"};if("break-all"===e)return{"word-break":"break-all"};if("break-keep"===e)return{"word-break":"keep-all"};if("font-mono"===e)return{"font-family":"var(--tkx-font-mono,monospace)"};if("font-sans"===e)return{"font-family":"var(--tkx-font-family,system-ui,sans-serif)"};if("font-serif"===e)return{"font-family":"ui-serif,Georgia,serif"};if("antialiased"===e)return{"-webkit-font-smoothing":"antialiased","-moz-osx-font-smoothing":"grayscale"};if(u=e.match(/^indent-(.+)$/)){const e=Xe[u[1]]??pt(u[1]);if(e)return{"text-indent":e}}if(u=e.match(/^line-clamp-(\d+)$/))return{overflow:"hidden",display:"-webkit-box","-webkit-line-clamp":u[1],"-webkit-box-orient":"vertical"};if(u=e.match(/^text-(.+)$/)){const[e,t]=u[1].split("/"),n=ht(e);if(!["left","center","right","justify","start","end","xs","sm","base","lg","xl","2xl","3xl","4xl","5xl","6xl","7xl","8xl","9xl"].includes(e)){if(t){const e=parseInt(t)/100;return{color:n,opacity:String(e)}}return{color:n}}}if(u=e.match(/^bg-(.+)$/)){const[e,t]=u[1].split("/"),n=ht(e);return t?{"background-color":n,opacity:String(parseInt(t)/100)}:"none"===e?{background:"none"}:{"background-color":n}}if(u=e.match(/^border-color-(.+)$/))return{"border-color":ht(u[1])};if(u=e.match(/^fill-(.+)$/))return{fill:ht(u[1])};if(u=e.match(/^stroke-(.+)$/))return{stroke:ht(u[1])};if(u=e.match(/^shadow-color-(.+)$/))return{"--tkx-shadow-color":ht(u[1])};if(u=e.match(/^ring-color-(.+)$/))return{"--tkx-ring-color":ht(u[1])};if(u=e.match(/^accent-(.+)$/))return{"accent-color":ht(u[1])};if(u=e.match(/^caret-(.+)$/))return{"caret-color":ht(u[1])};if(u=e.match(/^outline-color-(.+)$/))return{"outline-color":ht(u[1])};if("border"===e)return{"border-width":"1px"};if(u=e.match(/^border-(\d+)$/))return{"border-width":`${u[1]}px`};if("border-t"===e)return{"border-top-width":"1px"};if(u=e.match(/^border-t-(\d+)$/))return{"border-top-width":`${u[1]}px`};if("border-r"===e)return{"border-right-width":"1px"};if(u=e.match(/^border-r-(\d+)$/))return{"border-right-width":`${u[1]}px`};if("border-b"===e)return{"border-bottom-width":"1px"};if(u=e.match(/^border-b-(\d+)$/))return{"border-bottom-width":`${u[1]}px`};if("border-l"===e)return{"border-left-width":"1px"};if(u=e.match(/^border-l-(\d+)$/))return{"border-left-width":`${u[1]}px`};if("border-x"===e)return{"border-left-width":"1px","border-right-width":"1px"};if("border-y"===e)return{"border-top-width":"1px","border-bottom-width":"1px"};if("border-none"===e)return{"border-style":"none"};if("border-solid"===e)return{"border-style":"solid"};if("border-dashed"===e)return{"border-style":"dashed"};if("border-dotted"===e)return{"border-style":"dotted"};if("border-double"===e)return{"border-style":"double"};if((u=e.match(/^border-([a-zA-Z].*)$/))&&at.has(u[1]))return{"border-color":`var(--tkx-${u[1]})`};if(u=e.match(/^border-\[(.+)]$/))return{"border-color":u[1]};if("border-0"===e)return{"border-width":"0"};if("rounded"===e)return{"border-radius":Je[""]};if(u=e.match(/^rounded-(none|sm|md|lg|xl|2xl|3xl|full|\[.+])$/))return{"border-radius":Je[u[1]]??pt(u[1])??u[1]};if(u=e.match(/^rounded-(t|r|b|l|tl|tr|br|bl)(?:-(none|sm|md|lg|xl|2xl|3xl|full))?$/)){const e=u[1],t=Je[u[2]??""]??Je[""];return{t:{"border-top-left-radius":t,"border-top-right-radius":t},r:{"border-top-right-radius":t,"border-bottom-right-radius":t},b:{"border-bottom-left-radius":t,"border-bottom-right-radius":t},l:{"border-top-left-radius":t,"border-bottom-left-radius":t},tl:{"border-top-left-radius":t},tr:{"border-top-right-radius":t},br:{"border-bottom-right-radius":t},bl:{"border-bottom-left-radius":t}}[e]??{}}const h={0:"0",1:"1px",2:"2px",ring:"3px",4:"4px",8:"8px"};if("ring"===e)return{"box-shadow":"0 0 0 3px var(--tkx-ring-color,var(--tkx-primary))"};if((u=e.match(/^ring-(\d+)$/))&&h[u[1]])return{"box-shadow":`0 0 0 ${h[u[1]]} var(--tkx-ring-color,var(--tkx-primary))`};if("ring-inset"===e)return{"--tkx-ring-offset":"inset"};if(u=e.match(/^ring-offset-(\d+)$/))return{"--tkx-ring-offset-width":`${u[1]}px`,"box-shadow":`0 0 0 ${u[1]}px var(--tkx-bg)`};if("shadow"===e)return{"box-shadow":Qe[""]};if(u=e.match(/^shadow-(sm|md|lg|xl|2xl|inner|none)$/))return{"box-shadow":Qe[u[1]]};if(u=e.match(/^opacity-(\d+)$/)){const e=it[u[1]];if(void 0!==e)return{opacity:e}}if("bg-none"===e)return{background:"none"};const f={"bg-auto":"auto","bg-cover":"cover","bg-contain":"contain"};if(f[e])return{"background-size":f[e]};const m={"bg-center":"center","bg-top":"top","bg-bottom":"bottom","bg-left":"left","bg-right":"right"};if(m[e])return{"background-position":m[e]};const g={"bg-repeat":"repeat","bg-no-repeat":"no-repeat","bg-repeat-x":"repeat-x","bg-repeat-y":"repeat-y"};if(g[e])return{"background-repeat":g[e]};if("backdrop-blur"===e)return{"backdrop-filter":`blur(${ot[""]})`};if(u=e.match(/^backdrop-blur-(none|sm|md|lg|xl|2xl|3xl)$/))return{"backdrop-filter":`blur(${ot[u[1]]})`};if("blur"===e)return{filter:`blur(${ot[""]})`};if(u=e.match(/^blur-(none|sm|md|lg|xl|2xl|3xl)$/))return{filter:`blur(${ot[u[1]]})`};if("grayscale"===e)return{filter:"grayscale(100%)"};if("grayscale-0"===e)return{filter:"grayscale(0)"};if("invert"===e)return{filter:"invert(100%)"};if("invert-0"===e)return{filter:"invert(0)"};const x={static:"static",relative:"relative",absolute:"absolute",fixed:"fixed",sticky:"sticky"};if(x[e])return{position:x[e]};if("inset-0"===e)return{top:"0",right:"0",bottom:"0",left:"0"};if("inset-auto"===e)return{top:"auto",right:"auto",bottom:"auto",left:"auto"};if("inset-full"===e)return{top:"100%",right:"100%",bottom:"100%",left:"100%"};if("inset-x-0"===e)return{left:"0",right:"0"};if("inset-y-0"===e)return{top:"0",bottom:"0"};if(u=e.match(/^-?top-(.+)$/)){const t=e.startsWith("-"),n=Xe[u[1]]??_e[u[1]]??pt(u[1]);if(n)return{top:t&&"0"!==n?`-${n}`:n}}if(u=e.match(/^-?right-(.+)$/)){const t=e.startsWith("-"),n=Xe[u[1]]??_e[u[1]]??pt(u[1]);if(n)return{right:t&&"0"!==n?`-${n}`:n}}if(u=e.match(/^-?bottom-(.+)$/)){const t=e.startsWith("-"),n=Xe[u[1]]??_e[u[1]]??pt(u[1]);if(n)return{bottom:t&&"0"!==n?`-${n}`:n}}if(u=e.match(/^-?left-(.+)$/)){const t=e.startsWith("-"),n=Xe[u[1]]??_e[u[1]]??pt(u[1]);if(n)return{left:t&&"0"!==n?`-${n}`:n}}const y={0:"0",10:"10",20:"20",30:"30",40:"40",50:"50",100:"100",1e3:"1000",9e3:"9000",auto:"auto"};if(u=e.match(/^z-(.+)$/)){const e=y[u[1]]??pt(u[1]);if(e)return{"z-index":e}}const b={"overflow-auto":"auto","overflow-hidden":"hidden","overflow-visible":"visible","overflow-scroll":"scroll","overflow-clip":"clip"};if(b[e])return{overflow:b[e]};if(u=e.match(/^overflow-(x|y)-(auto|hidden|visible|scroll|clip)$/))return{[`overflow-${u[1]}`]:u[2]};if("scrollbar-hide"===e)return{"-ms-overflow-style":"none","scrollbar-width":"none"};if("visible"===e)return{visibility:"visible"};if("invisible"===e)return{visibility:"hidden"};if("collapse"===e)return{visibility:"collapse"};const v={"cursor-auto":"auto","cursor-default":"default","cursor-pointer":"pointer","cursor-wait":"wait","cursor-text":"text","cursor-move":"move","cursor-help":"help","cursor-not-allowed":"not-allowed","cursor-none":"none","cursor-grab":"grab","cursor-grabbing":"grabbing","cursor-zoom-in":"zoom-in","cursor-zoom-out":"zoom-out","cursor-crosshair":"crosshair"};if(v[e])return{cursor:v[e]};if("select-none"===e)return{"user-select":"none"};if("select-text"===e)return{"user-select":"text"};if("select-all"===e)return{"user-select":"all"};if("select-auto"===e)return{"user-select":"auto"};if("pointer-events-none"===e)return{"pointer-events":"none"};if("pointer-events-auto"===e)return{"pointer-events":"auto"};const w={0:"0",50:".5",75:".75",90:".9",95:".95",100:"1",105:"1.05",110:"1.1",125:"1.25",150:"1.5"};if(u=e.match(/^scale-(.+)$/)){const e=w[u[1]]??pt(u[1]);if(e)return{transform:`scale(${e})`}}if(u=e.match(/^scale-x-(.+)$/)){const e=w[u[1]]??pt(u[1]);if(e)return{transform:`scaleX(${e})`}}if(u=e.match(/^scale-y-(.+)$/)){const e=w[u[1]]??pt(u[1]);if(e)return{transform:`scaleY(${e})`}}const k={0:"0deg",1:"1deg",2:"2deg",3:"3deg",6:"6deg",12:"12deg",45:"45deg",90:"90deg",180:"180deg"};if(u=e.match(/^-?rotate-(.+)$/)){const t=e.startsWith("-"),n=k[u[1]]??pt(u[1]);if(n)return{transform:t?`rotate(-${n})`:`rotate(${n})`}}if(u=e.match(/^-?translate-x-(.+)$/)){const t=e.startsWith("-"),n=Xe[u[1]]??_e[u[1]]??pt(u[1]);if(n)return{transform:`translateX(${t&&"0"!==n?`-${n}`:n})`}}if(u=e.match(/^-?translate-y-(.+)$/)){const t=e.startsWith("-"),n=Xe[u[1]]??_e[u[1]]??pt(u[1]);if(n)return{transform:`translateY(${t&&"0"!==n?`-${n}`:n})`}}if(u=e.match(/^-?skew-x-(.+)$/)){const t=e.startsWith("-"),n=pt(u[1])??`${u[1]}deg`;return{transform:t?`skewX(-${n})`:`skewX(${n})`}}if(u=e.match(/^-?skew-y-(.+)$/)){const t=e.startsWith("-"),n=pt(u[1])??`${u[1]}deg`;return{transform:t?`skewY(-${n})`:`skewY(${n})`}}const $={"origin-center":"center","origin-top":"top","origin-top-right":"top right","origin-right":"right","origin-bottom-right":"bottom right","origin-bottom":"bottom","origin-bottom-left":"bottom left","origin-left":"left","origin-top-left":"top left"};if($[e])return{"transform-origin":$[e]};const S={transition:"color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter","transition-all":"all","transition-colors":"color,background-color,border-color,text-decoration-color,fill,stroke","transition-opacity":"opacity","transition-shadow":"box-shadow","transition-transform":"transform","transition-none":"none"};if(S[e])return{"transition-property":S[e],"transition-timing-function":"cubic-bezier(0.4,0,0.2,1)","transition-duration":"150ms"};const C={75:"75ms",100:"100ms",150:"150ms",200:"200ms",300:"300ms",500:"500ms",700:"700ms",1e3:"1000ms"};if(u=e.match(/^duration-(.+)$/)){const e=C[u[1]]??pt(u[1]);if(e)return{"transition-duration":e}}if(u=e.match(/^delay-(.+)$/)){const e=C[u[1]]??pt(u[1]);if(e)return{"transition-delay":e}}const z={"ease-linear":"linear","ease-in":"cubic-bezier(0.4,0,1,1)","ease-out":"cubic-bezier(0,0,0.2,1)","ease-in-out":"cubic-bezier(0.4,0,0.2,1)"};if(z[e])return{"transition-timing-function":z[e]};const M={"animate-none":"none","animate-spin":"tkx-spin 1s linear infinite","animate-ping":"tkx-ping 1s cubic-bezier(0,0,0.2,1) infinite","animate-pulse":"tkx-pulse 2s cubic-bezier(0.4,0,0.6,1) infinite","animate-bounce":"tkx-bounce 1s infinite","animate-fade-in":"tkx-fade-in 200ms ease both","animate-slide-up":"tkx-slide-up 200ms ease both","animate-shimmer":"tkx-shimmer 1.5s infinite"};if(M[e])return{animation:M[e]};const N={"object-contain":"contain","object-cover":"cover","object-fill":"fill","object-none":"none","object-scale-down":"scale-down"};return N[e]?{"object-fit":N[e]}:"aspect-square"===e?{"aspect-ratio":"1 / 1"}:"aspect-video"===e?{"aspect-ratio":"16 / 9"}:"aspect-auto"===e?{"aspect-ratio":"auto"}:(u=e.match(/^aspect-\[(.+)]$/))?{"aspect-ratio":u[1]}:"list-none"===e?{"list-style-type":"none"}:"list-disc"===e?{"list-style-type":"disc"}:"list-decimal"===e?{"list-style-type":"decimal"}:"list-inside"===e?{"list-style-position":"inside"}:"list-outside"===e?{"list-style-position":"outside"}:(u=e.match(/^columns-(\d+)$/))?{columns:u[1]}:"resize"===e?{resize:"both"}:"resize-none"===e?{resize:"none"}:"resize-x"===e?{resize:"horizontal"}:"resize-y"===e?{resize:"vertical"}:"sr-only"===e?{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0,0,0,0)","white-space":"nowrap",border:"0"}:"not-sr-only"===e?{position:"static",width:"auto",height:"auto",padding:"0",margin:"0",overflow:"visible",clip:"auto","white-space":"normal"}:"focus-ring"===e?{outline:"2px solid var(--tkx-primary)","outline-offset":"2px","border-radius":"2px"}:"appearance-none"===e?{appearance:"none"}:"outline-none"===e?{outline:"none"}:"outline"===e?{outline:"2px solid currentColor","outline-offset":"2px"}:"float-left"===e?{float:"left"}:"float-right"===e?{float:"right"}:"float-none"===e?{float:"none"}:"clear-both"===e?{clear:"both"}:"isolate"===e?{isolation:"isolate"}:"isolation-auto"===e?{isolation:"auto"}:(u=e.match(/^will-change-(.+)$/))?{"will-change":u[1]}:"touch-manipulation"===e?{"touch-action":"manipulation"}:"touch-none"===e?{"touch-action":"none"}:"touch-pan-x"===e?{"touch-action":"pan-x"}:"touch-pan-y"===e?{"touch-action":"pan-y"}:"scroll-smooth"===e?{"scroll-behavior":"smooth"}:"scroll-auto"===e?{"scroll-behavior":"auto"}:(u=e.match(/^\[(--[a-zA-Z0-9-]+):(.+)]$/))?{[u[1]]:u[2]}:Mt(e)||null}function mt(e){let t=0,n=-1;for(let r=0;r<e.length;r++)if("["===e[r])t++;else if("]"===e[r])t--;else if(":"===e[r]&&0===t){n=r;break}return-1===n?{variant:null,utility:e}:{variant:e.slice(0,n),utility:e.slice(n+1)}}function gt(e,t){for(const[n,r]of Object.entries(t))e[n]=r}function xt(e){return Object.entries(e).map(([e,t])=>`${e}:${t}`).join(";")}var yt=new Map,bt=null,vt=null;function wt(){return bt&&bt.isConnected||(bt=document.getElementById("tkx-atomic"))||((bt=document.createElement("style")).id="tkx-atomic",document.head.appendChild(bt)),bt}function kt(e){const t=[];for(const n of e)if(n)if("string"==typeof n)t.push(...n.split(/\s+/).filter(Boolean));else if(Array.isArray(n))t.push(...kt(n));else if("object"==typeof n)for(const[e,r]of Object.entries(n))r&&t.push(e);return t}function $t(...e){const t=kt(e);if(0===t.length)return"";const n={base:{},variants:{}};for(const l of t){const{variant:e,utility:t}=mt(l),r=ft(t);r&&(e?(n.variants[e]||(n.variants[e]={}),gt(n.variants[e],r)):gt(n.base,r))}const r=[],o=xt(n.base),i=u([o,...Object.entries(n.variants).map(([e,t])=>`${e}{${xt(t)}}`)].join("|")),a=`tkx-${i}`;o&&r.push(`.${a}{${o}}`);for(const[l,s]of Object.entries(n.variants)){const e=xt(s);if(e)if(l.startsWith("@")){const t=lt[l.slice(1)];t&&r.push(`@media(min-width:${t}){.${a}{${e}}}`)}else if("motion-safe"===l)r.push(`@media(prefers-reduced-motion:no-preference){.${a}{${e}}}`);else if("motion-reduce"===l)r.push(`@media(prefers-reduced-motion:reduce){.${a}{${e}}}`);else if("contrast-more"===l)r.push(`@media(prefers-contrast:more){.${a}{${e}}}`);else if("forced-colors"===l)r.push(`@media(forced-colors:active){.${a}{${e}}}`);else if("dark"===l)r.push(`@media(prefers-color-scheme:dark){.${a}{${e}}}`);else if("print"===l)r.push(`@media print{.${a}{${e}}}`);else if("group-hover"===l)r.push(`.group:hover .${a}{${e}}`);else if("group-focus"===l)r.push(`.group:focus-within .${a}{${e}}`);else if("peer-hover"===l)r.push(`.peer:hover~.${a}{${e}}`);else{const t={hover:":hover",focus:":focus","focus-visible":":focus-visible","focus-within":":focus-within",active:":active",disabled:":disabled",checked:":checked",required:":required",valid:":valid",invalid:":invalid",first:":first-child",last:":last-child",odd:":nth-child(odd)",even:":nth-child(even)","first-of-type":":first-of-type","last-of-type":":last-of-type","only-child":":only-child","only-of-type":":only-of-type",empty:":empty",visited:":visited",target:":target","placeholder-shown":":placeholder-shown","read-only":":read-only",before:"::before",after:"::after",placeholder:"::placeholder",selection:"::selection","file-selector":"::file-selector-button",marker:"::marker"}[l]??`:${l}`;r.push(`.${a}${t}{${e}}`)}}return r.length>0&&function(e,t){if(yt.has(e))return;if(yt.set(e,t),"undefined"==typeof document)return;const n=function(){if(vt)return vt;try{const e=new CSSStyleSheet;return document.adoptedStyleSheets=[...document.adoptedStyleSheets,e],vt=e,e}catch{return null}}();if(n){const e=function(e){const t=[];let n=0,r=0;for(let o=0;o<e.length;o++)if("{"===e[o])n++;else if("}"===e[o]&&(n--,0===n)){const n=e.slice(r,o+1).trim();n&&t.push(n),r=o+1}return t}(t);for(const t of e)try{n.insertRule(t,n.cssRules.length)}catch{wt().textContent+=t+"\n"}}else wt().textContent+=t+"\n"}(i,r.join("")),a}var St=$t;function Ct(...e){return e.filter(Boolean).join(" ")}var zt=new Map;function Mt(e){for(const t of zt.values())if(t[e])return t[e];return null}var Nt={sm:"text-xs font-semibold",md:"text-sm font-semibold",lg:"text-base font-semibold",xl:"text-lg font-semibold"},Dt={sm:"py-1.5 px-3",md:"py-2 px-4",lg:"py-2.5 px-5",xl:"py-3 px-6"},Rt={sm:"min-h-[32px]",md:"min-h-[40px]",lg:"min-h-[48px]",xl:"min-h-[56px]"},Pt={sm:14,md:16,lg:18,xl:20};function Ft({size:e}){const t=Pt[e];return(0,d.jsxs)("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",className:$t("animate-spin shrink-0"),children:[(0,d.jsx)("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",strokeOpacity:"0.25"}),(0,d.jsx)("path",{d:"M12 2a10 10 0 0 1 10 10",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]})}var At=(0,a.forwardRef)(({variant:e="solid",size:t="md",colorScheme:n="primary",isLoading:r=!1,loadingText:o,leftIcon:i,rightIcon:a,isFullWidth:l=!1,glow:s=!1,disabled:c,isDisabled:u,children:p,className:h,style:f,...m},g)=>{globalThis.process;const x=J(),y=qe(),b=(c??u??!1)||r,v={primary:x.primary,secondary:x.secondary,danger:x.danger,warning:x.warning,success:x.success}[n],w=j(v,["#ffffff","#000000",x.bg]),k="string"==typeof p?pe(p):p,$=o?pe(o):void 0,S="solid"===e?{backgroundColor:v,color:w,border:"none",boxShadow:s&&!y?`0 0 20px ${v}55`:void 0}:"outline"===e?{backgroundColor:"transparent",color:v,border:`2px solid ${v}`}:"ghost"===e?{backgroundColor:"transparent",color:v,border:"none"}:{backgroundColor:"transparent",color:v,border:"none",textDecoration:"underline"};return(0,d.jsx)("button",{ref:g,"aria-busy":r,"aria-disabled":b,disabled:b,className:Ct($t("inline-flex items-center justify-center gap-2","rounded-lg font-sans font-semibold","select-none relative overflow-hidden",Nt[t],Dt[t],Rt[t],"link"!==e&&Rt[t],l&&"w-full",b?"cursor-not-allowed opacity-60":"cursor-pointer",!y&&"transition-all duration-200","focus-visible:focus-ring"),h),style:{...S,...f},...m,children:r?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(Ft,{size:t}),$??k]}):(0,d.jsxs)(d.Fragment,{children:[i&&(0,d.jsx)("span",{"aria-hidden":"true",children:i}),k,a&&(0,d.jsx)("span",{"aria-hidden":"true",children:a})]})})});At.displayName="TkxButton";var It={none:"",sm:"p-3",md:"p-5",lg:"p-7"},Lt=(0,a.forwardRef)(({variant:e="default",isHoverable:t,isClickable:n,padding:r="md",as:o,children:i,className:a,style:l,...s},c)=>{const u=J(),p=qe(),h=o??(n?"button":"div"),f={default:{backgroundColor:u.surface,border:`1px solid ${u.border}`},glass:{backgroundColor:`${u.surface}cc`,backdropFilter:"blur(12px)",border:`1px solid ${u.border}55`,boxShadow:`0 4px 24px ${u.bg}40`},quantum:{backgroundColor:u.surfaceAlt,border:`1px solid ${u.primary}33`,boxShadow:`0 0 24px ${u.primary}18`},elevated:{backgroundColor:u.surface,boxShadow:`0 4px 20px ${u.bg}60`},outlined:{backgroundColor:"transparent",border:`2px solid ${u.border}`}}[e];return(0,d.jsx)(h,{ref:c,className:Ct("tkx-card",$t("rounded-xl w-full text-left block font-sans focus-visible:focus-ring",It[r],(t||n)&&!p&&"transition-transform duration-150 hover:scale-[1.01]",n?"cursor-pointer":"cursor-default"),a),style:{color:u.text,...f,...l},...s,children:i})});Lt.displayName="TkxCard";var Tt=(0,a.forwardRef)(({label:e,id:t,error:n,hint:r,leftAddon:o,rightAddon:i,isInvalid:l,isRequired:s,disabled:c,className:u,style:p,unicodeSafe:h=!0,onChange:f,...m},g)=>{const x=J(),y=(0,a.useId)(),b=t??y,v=`${b}-hint`,w=`${b}-error`,k=l||!!n,$=[r&&v,k&&w].filter(Boolean).join(" ")||void 0,S=pe(e),C=n?pe(n):void 0,z=r?pe(r):void 0,M=k?x.danger:x.border;return(0,d.jsxs)("div",{className:Ct($t("flex flex-col gap-1 w-full"),u),style:p,children:[(0,d.jsxs)("label",{htmlFor:b,className:$t("text-sm font-medium font-sans"),style:{color:x.text},children:[S,s&&(0,d.jsx)("span",{"aria-hidden":"true",className:$t("ml-1"),style:{color:x.danger},children:"*"})]}),(0,d.jsxs)("div",{className:$t("flex items-center rounded-lg overflow-hidden","transition-colors duration-150",c?"opacity-60":""),style:{border:`1.5px solid ${M}`,backgroundColor:x.surface},children:[o&&(0,d.jsx)("div",{className:$t("px-2.5 self-stretch flex items-center text-sm shrink-0"),style:{backgroundColor:x.surfaceAlt,color:x.textMuted,borderRight:`1px solid ${x.border}`},children:o}),(0,d.jsx)("input",{ref:g,id:b,"aria-invalid":k,"aria-required":s,"aria-describedby":$,disabled:c,className:Ct($t("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:x.text},onChange:h?e=>{const t=Fe(e.target.value);t!==e.target.value&&(e.target.value=t),f?.(e)}:f,...m}),i&&(0,d.jsx)("div",{className:$t("px-2.5 self-stretch flex items-center text-sm shrink-0"),style:{backgroundColor:x.surfaceAlt,color:x.textMuted,borderLeft:`1px solid ${x.border}`},children:i})]}),z&&!C&&(0,d.jsx)("span",{id:v,className:$t("text-xs"),style:{color:x.textMuted},children:z}),C&&(0,d.jsxs)("span",{id:w,role:"alert",className:$t("text-xs flex items-center gap-1"),style:{color:x.danger},children:[(0,d.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.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"})}),C]})]})});Tt.displayName="TkxInput";var Wt={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]"},jt={sm:"size-[6px]",md:"size-2",lg:"size-2.5"},Et=(0,a.forwardRef)(({variant:e="default",size:t="md",dot:n=!1,pulse:r=!1,outlined:o=!1,children:i,className:a,style:l,...s},c)=>{const u=J(),p={default:u.border,primary:u.primary,secondary:u.secondary,danger:u.danger,warning:u.warning,success:u.success,info:u.info}[e]||"#666666",h=j(p,["#ffffff","#000000",u.bg||"#000000"]),f="string"==typeof i?pe(i):i;return n?(0,d.jsx)("span",{ref:c,"aria-label":"string"==typeof i?pe(i):void 0,className:Ct($t("inline-block rounded-full",jt[t],r&&"animate-pulse"),a),style:{backgroundColor:p,...l},...s}):(0,d.jsx)("span",{ref:c,className:Ct($t("inline-flex items-center justify-center rounded-full font-semibold font-sans tracking-wide",Wt[t],r&&"animate-pulse"),a),style:{backgroundColor:o?"transparent":p,color:o?p:h,border:o?`1px solid ${p}`:"none",...l},...s,children:f})});Et.displayName="TkxBadge";var Bt={sm:"4px",md:"8px",lg:"12px"},Vt={sm:32,md:48,lg:64},Ht=(0,a.forwardRef)(({value:e,variant:t="linear",size:n="md",label:r,showValue:o,color:i,className:a,style:l,...s},c)=>{const u=J(),p=qe(),h=i??u.primary,f=void 0===e,m=void 0!==e?Math.min(100,Math.max(0,e)):0;if(void 0!==e){const{errors:t}=me({value:e},{value:{type:"number",min:0,max:100}});t.length}if("circular"===t){const e=Vt[n],t="sm"===n?3:"md"===n?4:5,i=(e-2*t)/2,s=2*Math.PI*i,g=f?0:s-m/100*s;return(0,d.jsxs)("div",{ref:c,role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":f?void 0:m,"aria-label":r??(f?"Loading":`${m}%`),className:Ct($t("inline-flex flex-col items-center gap-1"),a),style:l,children:[(0,d.jsxs)("svg",{width:e,height:e,viewBox:`0 0 ${e} ${e}`,"aria-hidden":"true",children:[(0,d.jsx)("circle",{cx:e/2,cy:e/2,r:i,fill:"none",stroke:u.border,strokeWidth:t}),(0,d.jsx)("circle",{cx:e/2,cy:e/2,r:i,fill:"none",stroke:h,strokeWidth:t,strokeLinecap:"round",strokeDasharray:s,strokeDashoffset:g,transform:`rotate(-90 ${e/2} ${e/2})`,style:{transition:p?"none":"stroke-dashoffset 300ms ease",animation:f&&!p?"tkx-spin 1s linear infinite":void 0}})]}),o&&!f&&(0,d.jsxs)("span",{className:$t("text-xs"),style:{color:u.textMuted},children:[m,"%"]})]})}const g=Bt[n];return(0,d.jsxs)("div",{ref:c,role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":f?void 0:m,"aria-label":r??(f?"Loading":`${m}%`),className:Ct($t("flex flex-col gap-1 w-full"),a),style:l,children:[r&&(0,d.jsxs)("div",{className:$t("flex justify-between text-sm"),style:{color:u.text},children:[(0,d.jsx)("span",{children:r}),o&&!f&&(0,d.jsxs)("span",{children:[m,"%"]})]}),(0,d.jsx)("div",{className:$t("w-full overflow-hidden"),style:{height:g,borderRadius:g,backgroundColor:u.border},children:(0,d.jsx)("div",{style:{height:"100%",borderRadius:g,backgroundColor:h,width:f?"40%":`${m}%`,transition:p?"none":"width 300ms ease",animation:f&&!p?"tkx-shimmer 1.5s ease-in-out infinite":void 0}})})]})});Ht.displayName="TkxProgress";var Ot={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}},qt=(0,a.forwardRef)(({checked:e,onChange:t,label:n,size:r="md",hideLabel:o,disabled:i,className:l,style:s,...c},u)=>{const p=J(),h=qe(),f=(0,a.useId)();me({label:n,checked:e},{label:{type:"string",required:!0},checked:{type:"boolean",required:!0}});const{tw:m,th:g,td:x,gap:y}=Ot[r],b=e?m-x-y:y,v=e?p.primary:p.border;return(0,d.jsxs)("div",{className:Ct($t("inline-flex items-center gap-2",i?"opacity-50":""),l),style:s,children:[!o&&(0,d.jsx)("label",{htmlFor:f,className:$t("text-sm font-sans",i?"cursor-not-allowed":"cursor-pointer","select-none"),style:{color:p.text},children:n}),(0,d.jsx)("button",{ref:u,id:f,role:"switch","aria-checked":e,"aria-label":o?n:void 0,disabled:i,onClick:()=>!i&&t(!e),onKeyDown:n=>{"Enter"!==n.key&&" "!==n.key||i||(n.preventDefault(),t(!e))},className:Ct($t("relative border-none p-0 outline-none shrink-0 focus-visible:focus-ring",i?"cursor-not-allowed":"cursor-pointer",!h&&"transition-colors duration-200")),style:{width:m,height:g,borderRadius:g,backgroundColor:v},...c,children:(0,d.jsx)("span",{"aria-hidden":"true",className:$t("absolute rounded-full"),style:{top:"50%",left:b,width:x,height:x,transform:"translateY(-50%)",backgroundColor:p.surface,boxShadow:"0 1px 3px rgba(0,0,0,0.3)",transition:h?"none":"left 200ms ease"}})})]})});qt.displayName="TkxToggle";var Ut={info:(0,d.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"})}),success:(0,d.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm-2 14.5l-4-4 1.41-1.41L10 13.67l6.59-6.59L18 8.5l-8 8z"})}),warning:(0,d.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"})}),danger:(0,d.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.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"})})},Kt={close:"Close",cancel:"Cancel",confirm:"Confirm",save:"Save",delete:"Delete",search:"Search",loading:"Loading...",noResults:"No results found",required:"Required",previous:"Previous",next:"Next",pageOf:(e,t)=>`Page ${e} of ${t}`,selectPlaceholder:"Select...",clearSelection:"Clear selection",selectDate:"Select a date",today:"Today",dropFiles:"Drop files here or",browse:"Browse",noData:"No data available",sortAscending:"Sort ascending",sortDescending:"Sort descending",filterPlaceholder:"Filter...",exportCsv:"Export CSV",rowsSelected:e=>`${e} row${1===e?"":"s"} selected`},Yt={"en-US":Kt,"es-ES":{close:"Cerrar",cancel:"Cancelar",confirm:"Confirmar",save:"Guardar",delete:"Eliminar",search:"Buscar",loading:"Cargando...",noResults:"No se encontraron resultados",required:"Requerido",previous:"Anterior",next:"Siguiente",pageOf:(e,t)=>`Página ${e} de ${t}`,selectPlaceholder:"Seleccionar...",clearSelection:"Limpiar selección",selectDate:"Seleccionar fecha",today:"Hoy",dropFiles:"Suelte archivos aquí o",browse:"Explorar",noData:"No hay datos disponibles",sortAscending:"Orden ascendente",sortDescending:"Orden descendente",filterPlaceholder:"Filtrar...",exportCsv:"Exportar CSV",rowsSelected:e=>`${e} fila${1===e?"":"s"} seleccionada${1===e?"":"s"}`,firstPage:"Primera página",lastPage:"Última página",previousPage:"Página anterior",nextPage:"Página siguiente",showingRange:(e,t,n)=>`Mostrando ${e}–${t} de ${n}`,itemsPerPage:"Por página",uploadFiles:"Subir archivos",yesterday:"Ayer",last7Days:"Últimos 7 días",last30Days:"Últimos 30 días",thisMonth:"Este mes",lastMonth:"Mes pasado",notifications:"Notificaciones",commandSearch:"Escribir un comando o buscar…",noCommandsFound:"No se encontraron comandos",closeDrawer:"Cerrar panel",fieldRequired:"Este campo es obligatorio",invalidFormat:"Formato inválido",minLength:e=>`Mínimo ${e} caracteres`,maxLength:e=>`Máximo ${e} caracteres`,minValue:e=>`Mínimo ${e}`,maxValue:e=>`Máximo ${e}`,noRows:"Sin filas",resetFilters:"Restablecer filtros"},"pt-BR":{close:"Fechar",cancel:"Cancelar",confirm:"Confirmar",save:"Salvar",delete:"Excluir",search:"Pesquisar",loading:"Carregando...",noResults:"Nenhum resultado encontrado",required:"Obrigatório",previous:"Anterior",next:"Próximo",pageOf:(e,t)=>`Página ${e} de ${t}`,selectPlaceholder:"Selecionar...",clearSelection:"Limpar seleção",selectDate:"Selecionar data",today:"Hoje",dropFiles:"Solte arquivos aqui ou",browse:"Procurar",noData:"Nenhum dado disponível",sortAscending:"Ordenar crescente",sortDescending:"Ordenar decrescente",filterPlaceholder:"Filtrar...",exportCsv:"Exportar CSV",rowsSelected:e=>`${e} linha${1===e?"":"s"} selecionada${1===e?"":"s"}`,firstPage:"Primeira página",lastPage:"Última página",previousPage:"Página anterior",nextPage:"Próxima página",showingRange:(e,t,n)=>`Exibindo ${e}–${t} de ${n}`,itemsPerPage:"Por página",uploadFiles:"Enviar arquivos",yesterday:"Ontem",last7Days:"Últimos 7 dias",last30Days:"Últimos 30 dias",thisMonth:"Este mês",lastMonth:"Mês passado",notifications:"Notificações",commandSearch:"Digite um comando ou pesquise…",noCommandsFound:"Nenhum comando encontrado",closeDrawer:"Fechar painel",fieldRequired:"Este campo é obrigatório",invalidFormat:"Formato inválido",minLength:e=>`Mínimo de ${e} caracteres`,maxLength:e=>`Máximo de ${e} caracteres`,minValue:e=>`Mínimo ${e}`,maxValue:e=>`Máximo ${e}`,noRows:"Sem linhas",resetFilters:"Redefinir filtros"},"pt-PT":{close:"Fechar",cancel:"Cancelar",confirm:"Confirmar",save:"Guardar",delete:"Eliminar",search:"Pesquisar",loading:"A carregar...",noResults:"Sem resultados",required:"Obrigatório",previous:"Anterior",next:"Próximo",pageOf:(e,t)=>`Página ${e} de ${t}`,selectPlaceholder:"Selecionar...",clearSelection:"Limpar seleção",selectDate:"Selecionar data",today:"Hoje",dropFiles:"Largue ficheiros aqui ou",browse:"Procurar",noData:"Sem dados disponíveis",sortAscending:"Ordenar crescente",sortDescending:"Ordenar decrescente",filterPlaceholder:"Filtrar...",exportCsv:"Exportar CSV",rowsSelected:e=>`${e} linha${1===e?"":"s"} selecionada${1===e?"":"s"}`,firstPage:"Primeira página",lastPage:"Última página",previousPage:"Página anterior",nextPage:"Página seguinte",showingRange:(e,t,n)=>`A mostrar ${e}–${t} de ${n}`,itemsPerPage:"Por página",uploadFiles:"Carregar ficheiros",yesterday:"Ontem",last7Days:"Últimos 7 dias",last30Days:"Últimos 30 dias",thisMonth:"Este mês",lastMonth:"Mês passado",notifications:"Notificações",commandSearch:"Digite um comando ou pesquise…",noCommandsFound:"Nenhum comando encontrado",closeDrawer:"Fechar painel",fieldRequired:"Este campo é obrigatório",invalidFormat:"Formato inválido",minLength:e=>`Mínimo ${e} caracteres`,maxLength:e=>`Máximo ${e} caracteres`,minValue:e=>`Mínimo ${e}`,maxValue:e=>`Máximo ${e}`,noRows:"Sem linhas",resetFilters:"Repor filtros"},"fr-FR":{close:"Fermer",cancel:"Annuler",confirm:"Confirmer",save:"Enregistrer",delete:"Supprimer",search:"Rechercher",loading:"Chargement...",noResults:"Aucun résultat trouvé",required:"Obligatoire",previous:"Précédent",next:"Suivant",pageOf:(e,t)=>`Page ${e} sur ${t}`,selectPlaceholder:"Sélectionner...",clearSelection:"Effacer la sélection",selectDate:"Sélectionner une date",today:"Aujourd'hui",dropFiles:"Déposez les fichiers ici ou",browse:"Parcourir",noData:"Aucune donnée disponible",sortAscending:"Tri croissant",sortDescending:"Tri décroissant",filterPlaceholder:"Filtrer...",exportCsv:"Exporter CSV",rowsSelected:e=>`${e} ligne${1===e?"":"s"} sélectionnée${1===e?"":"s"}`,firstPage:"Première page",lastPage:"Dernière page",previousPage:"Page précédente",nextPage:"Page suivante",showingRange:(e,t,n)=>`Affichage de ${e}–${t} sur ${n}`,itemsPerPage:"Par page",uploadFiles:"Téléverser des fichiers",yesterday:"Hier",last7Days:"7 derniers jours",last30Days:"30 derniers jours",thisMonth:"Ce mois-ci",lastMonth:"Le mois dernier",notifications:"Notifications",commandSearch:"Tapez une commande ou recherchez…",noCommandsFound:"Aucune commande trouvée",closeDrawer:"Fermer le panneau",fieldRequired:"Ce champ est obligatoire",invalidFormat:"Format invalide",minLength:e=>`Au moins ${e} caractères`,maxLength:e=>`Au plus ${e} caractères`,minValue:e=>`Au moins ${e}`,maxValue:e=>`Au plus ${e}`,noRows:"Aucune ligne",resetFilters:"Réinitialiser les filtres"},"de-DE":{close:"Schließen",cancel:"Abbrechen",confirm:"Bestätigen",save:"Speichern",delete:"Löschen",search:"Suchen",loading:"Wird geladen...",noResults:"Keine Ergebnisse gefunden",required:"Erforderlich",previous:"Zurück",next:"Weiter",pageOf:(e,t)=>`Seite ${e} von ${t}`,selectPlaceholder:"Auswählen...",clearSelection:"Auswahl löschen",selectDate:"Datum auswählen",today:"Heute",dropFiles:"Dateien hier ablegen oder",browse:"Durchsuchen",noData:"Keine Daten verfügbar",sortAscending:"Aufsteigend sortieren",sortDescending:"Absteigend sortieren",filterPlaceholder:"Filtern...",exportCsv:"CSV exportieren",rowsSelected:e=>`${e} Zeile${1===e?"":"n"} ausgewählt`,firstPage:"Erste Seite",lastPage:"Letzte Seite",previousPage:"Vorherige Seite",nextPage:"Nächste Seite",showingRange:(e,t,n)=>`${e}–${t} von ${n} angezeigt`,itemsPerPage:"Pro Seite",uploadFiles:"Dateien hochladen",yesterday:"Gestern",last7Days:"Letzte 7 Tage",last30Days:"Letzte 30 Tage",thisMonth:"Dieser Monat",lastMonth:"Letzter Monat",notifications:"Benachrichtigungen",commandSearch:"Befehl eingeben oder suchen…",noCommandsFound:"Keine Befehle gefunden",closeDrawer:"Panel schließen",fieldRequired:"Dieses Feld ist erforderlich",invalidFormat:"Ungültiges Format",minLength:e=>`Mindestens ${e} Zeichen`,maxLength:e=>`Höchstens ${e} Zeichen`,minValue:e=>`Mindestens ${e}`,maxValue:e=>`Höchstens ${e}`,noRows:"Keine Zeilen",resetFilters:"Filter zurücksetzen"},"it-IT":{close:"Chiudi",cancel:"Annulla",confirm:"Conferma",save:"Salva",delete:"Elimina",search:"Cerca",loading:"Caricamento...",noResults:"Nessun risultato trovato",required:"Obbligatorio",previous:"Precedente",next:"Successivo",pageOf:(e,t)=>`Pagina ${e} di ${t}`,selectPlaceholder:"Seleziona...",clearSelection:"Cancella selezione",selectDate:"Seleziona una data",today:"Oggi",dropFiles:"Trascina file qui o",browse:"Sfoglia",noData:"Nessun dato disponibile",sortAscending:"Ordinamento crescente",sortDescending:"Ordinamento decrescente",filterPlaceholder:"Filtra...",exportCsv:"Esporta CSV",rowsSelected:e=>`${e} riga${1===e?"":"i"} selezionat${1===e?"a":"e"}`,firstPage:"Prima pagina",lastPage:"Ultima pagina",previousPage:"Pagina precedente",nextPage:"Pagina successiva",showingRange:(e,t,n)=>`Visualizzazione ${e}–${t} di ${n}`,itemsPerPage:"Per pagina",uploadFiles:"Carica file",yesterday:"Ieri",last7Days:"Ultimi 7 giorni",last30Days:"Ultimi 30 giorni",thisMonth:"Questo mese",lastMonth:"Mese scorso",notifications:"Notifiche",commandSearch:"Digita un comando o cerca…",noCommandsFound:"Nessun comando trovato",closeDrawer:"Chiudi pannello",fieldRequired:"Questo campo è obbligatorio",invalidFormat:"Formato non valido",minLength:e=>`Almeno ${e} caratteri`,maxLength:e=>`Massimo ${e} caratteri`,minValue:e=>`Almeno ${e}`,maxValue:e=>`Massimo ${e}`,noRows:"Nessuna riga",resetFilters:"Reimposta filtri"},"nl-NL":{close:"Sluiten",cancel:"Annuleren",confirm:"Bevestigen",save:"Opslaan",delete:"Verwijderen",search:"Zoeken",loading:"Laden...",noResults:"Geen resultaten gevonden",required:"Verplicht",previous:"Vorige",next:"Volgende",pageOf:(e,t)=>`Pagina ${e} van ${t}`,selectPlaceholder:"Selecteer...",clearSelection:"Selectie wissen",selectDate:"Selecteer een datum",today:"Vandaag",dropFiles:"Zet bestanden hier neer of",browse:"Bladeren",noData:"Geen gegevens beschikbaar",sortAscending:"Oplopend sorteren",sortDescending:"Aflopend sorteren",filterPlaceholder:"Filteren...",exportCsv:"CSV exporteren",rowsSelected:e=>`${e} rij${1===e?"":"en"} geselecteerd`,firstPage:"Eerste pagina",lastPage:"Laatste pagina",previousPage:"Vorige pagina",nextPage:"Volgende pagina",showingRange:(e,t,n)=>`${e}–${t} van ${n} weergegeven`,itemsPerPage:"Per pagina",uploadFiles:"Bestanden uploaden",yesterday:"Gisteren",last7Days:"Laatste 7 dagen",last30Days:"Laatste 30 dagen",thisMonth:"Deze maand",lastMonth:"Vorige maand",notifications:"Meldingen",commandSearch:"Typ een opdracht of zoek…",noCommandsFound:"Geen opdrachten gevonden",closeDrawer:"Paneel sluiten",fieldRequired:"Dit veld is verplicht",invalidFormat:"Ongeldig formaat",minLength:e=>`Minimaal ${e} tekens`,maxLength:e=>`Maximaal ${e} tekens`,minValue:e=>`Minimaal ${e}`,maxValue:e=>`Maximaal ${e}`,noRows:"Geen rijen",resetFilters:"Filters herstellen"},"pl-PL":{close:"Zamknij",cancel:"Anuluj",confirm:"Potwierdź",save:"Zapisz",delete:"Usuń",search:"Szukaj",loading:"Ładowanie...",noResults:"Nie znaleziono wyników",required:"Wymagane",previous:"Poprzednia",next:"Następna",pageOf:(e,t)=>`Strona ${e} z ${t}`,selectPlaceholder:"Wybierz...",clearSelection:"Wyczyść wybór",selectDate:"Wybierz datę",today:"Dzisiaj",dropFiles:"Upuść pliki tutaj lub",browse:"Przeglądaj",noData:"Brak danych",sortAscending:"Sortuj rosnąco",sortDescending:"Sortuj malejąco",filterPlaceholder:"Filtruj...",exportCsv:"Eksportuj CSV",rowsSelected:e=>`Wybrano ${e} wier${1===e?"sz":"sze"}`,firstPage:"Pierwsza strona",lastPage:"Ostatnia strona",previousPage:"Poprzednia strona",nextPage:"Następna strona",showingRange:(e,t,n)=>`Wyświetlanie ${e}–${t} z ${n}`,itemsPerPage:"Na stronę",uploadFiles:"Prześlij pliki",yesterday:"Wczoraj",last7Days:"Ostatnie 7 dni",last30Days:"Ostatnie 30 dni",thisMonth:"Ten miesiąc",lastMonth:"Poprzedni miesiąc",notifications:"Powiadomienia",commandSearch:"Wpisz polecenie lub wyszukaj…",noCommandsFound:"Nie znaleziono poleceń",closeDrawer:"Zamknij panel",fieldRequired:"To pole jest wymagane",invalidFormat:"Nieprawidłowy format",minLength:e=>`Minimum ${e} znaków`,maxLength:e=>`Maksymalnie ${e} znaków`,minValue:e=>`Minimum ${e}`,maxValue:e=>`Maksymalnie ${e}`,noRows:"Brak wierszy",resetFilters:"Resetuj filtry"},"ru-RU":{close:"Закрыть",cancel:"Отмена",confirm:"Подтвердить",save:"Сохранить",delete:"Удалить",search:"Поиск",loading:"Загрузка...",noResults:"Результаты не найдены",required:"Обязательно",previous:"Назад",next:"Вперёд",pageOf:(e,t)=>`Страница ${e} из ${t}`,selectPlaceholder:"Выбрать...",clearSelection:"Снять выделение",selectDate:"Выбрать дату",today:"Сегодня",dropFiles:"Перетащите файлы сюда или",browse:"Обзор",noData:"Нет данных",sortAscending:"По возрастанию",sortDescending:"По убыванию",filterPlaceholder:"Фильтр...",exportCsv:"Экспорт CSV",rowsSelected:e=>`Выбрано ${e} строк`,firstPage:"Первая страница",lastPage:"Последняя страница",previousPage:"Предыдущая страница",nextPage:"Следующая страница",showingRange:(e,t,n)=>`Показано ${e}–${t} из ${n}`,itemsPerPage:"На странице",uploadFiles:"Загрузить файлы",yesterday:"Вчера",last7Days:"Последние 7 дней",last30Days:"Последние 30 дней",thisMonth:"Этот месяц",lastMonth:"Прошлый месяц",notifications:"Уведомления",commandSearch:"Введите команду или найдите…",noCommandsFound:"Команды не найдены",closeDrawer:"Закрыть панель",fieldRequired:"Это поле обязательно",invalidFormat:"Неверный формат",minLength:e=>`Не менее ${e} символов`,maxLength:e=>`Не более ${e} символов`,minValue:e=>`Не менее ${e}`,maxValue:e=>`Не более ${e}`,noRows:"Нет строк",resetFilters:"Сбросить фильтры"},"uk-UA":{close:"Закрити",cancel:"Скасувати",confirm:"Підтвердити",save:"Зберегти",delete:"Видалити",search:"Пошук",loading:"Завантаження...",noResults:"Результати не знайдено",required:"Обов'язково",previous:"Назад",next:"Далі",pageOf:(e,t)=>`Сторінка ${e} з ${t}`,selectPlaceholder:"Вибрати...",clearSelection:"Очистити вибір",selectDate:"Вибрати дату",today:"Сьогодні",dropFiles:"Перетягніть файли або",browse:"Огляд",noData:"Немає даних",sortAscending:"За зростанням",sortDescending:"За спаданням",filterPlaceholder:"Фільтр...",exportCsv:"Експорт CSV",rowsSelected:e=>`Вибрано ${e} рядків`,firstPage:"Перша сторінка",lastPage:"Остання сторінка",previousPage:"Попередня сторінка",nextPage:"Наступна сторінка",showingRange:(e,t,n)=>`Показано ${e}–${t} з ${n}`,itemsPerPage:"На сторінці",uploadFiles:"Завантажити файли",yesterday:"Вчора",last7Days:"Останні 7 днів",last30Days:"Останні 30 днів",thisMonth:"Цей місяць",lastMonth:"Минулий місяць",notifications:"Сповіщення",commandSearch:"Введіть команду або знайдіть…",noCommandsFound:"Команд не знайдено",closeDrawer:"Закрити панель",fieldRequired:"Це поле обов'язкове",invalidFormat:"Невірний формат",minLength:e=>`Не менше ${e} символів`,maxLength:e=>`Не більше ${e} символів`,minValue:e=>`Не менше ${e}`,maxValue:e=>`Не більше ${e}`,noRows:"Немає рядків",resetFilters:"Скинути фільтри"},"tr-TR":{close:"Kapat",cancel:"İptal",confirm:"Onayla",save:"Kaydet",delete:"Sil",search:"Ara",loading:"Yükleniyor...",noResults:"Sonuç bulunamadı",required:"Zorunlu",previous:"Önceki",next:"Sonraki",pageOf:(e,t)=>`${t} sayfadan ${e}. sayfa`,selectPlaceholder:"Seçin...",clearSelection:"Seçimi temizle",selectDate:"Tarih seçin",today:"Bugün",dropFiles:"Dosyaları buraya bırakın veya",browse:"Gözat",noData:"Veri yok",sortAscending:"Artan sıralama",sortDescending:"Azalan sıralama",filterPlaceholder:"Filtrele...",exportCsv:"CSV dışa aktar",rowsSelected:e=>`${e} satır seçildi`,firstPage:"İlk sayfa",lastPage:"Son sayfa",previousPage:"Önceki sayfa",nextPage:"Sonraki sayfa",showingRange:(e,t,n)=>`${n} öğeden ${e}–${t} gösteriliyor`,itemsPerPage:"Sayfa başına",uploadFiles:"Dosya yükle",yesterday:"Dün",last7Days:"Son 7 gün",last30Days:"Son 30 gün",thisMonth:"Bu ay",lastMonth:"Geçen ay",notifications:"Bildirimler",commandSearch:"Komut yazın veya arayın…",noCommandsFound:"Komut bulunamadı",closeDrawer:"Paneli kapat",fieldRequired:"Bu alan zorunludur",invalidFormat:"Geçersiz biçim",minLength:e=>`En az ${e} karakter`,maxLength:e=>`En fazla ${e} karakter`,minValue:e=>`En az ${e}`,maxValue:e=>`En fazla ${e}`,noRows:"Satır yok",resetFilters:"Filtreleri sıfırla"},"sv-SE":{close:"Stäng",cancel:"Avbryt",confirm:"Bekräfta",save:"Spara",delete:"Ta bort",search:"Sök",loading:"Laddar...",noResults:"Inga resultat hittades",required:"Obligatoriskt",previous:"Föregående",next:"Nästa",pageOf:(e,t)=>`Sida ${e} av ${t}`,selectPlaceholder:"Välj...",clearSelection:"Rensa val",selectDate:"Välj ett datum",today:"Idag",dropFiles:"Släpp filer här eller",browse:"Bläddra",noData:"Inga data tillgängliga",sortAscending:"Sortera stigande",sortDescending:"Sortera fallande",filterPlaceholder:"Filtrera...",exportCsv:"Exportera CSV",rowsSelected:e=>`${e} rad${1===e?"":"er"} vald${1===e?"":"a"}`,firstPage:"Första sidan",lastPage:"Sista sidan",previousPage:"Föregående sida",nextPage:"Nästa sida",showingRange:(e,t,n)=>`Visar ${e}–${t} av ${n}`,itemsPerPage:"Per sida",uploadFiles:"Ladda upp filer",yesterday:"Igår",last7Days:"Senaste 7 dagarna",last30Days:"Senaste 30 dagarna",thisMonth:"Denna månad",lastMonth:"Förra månaden",notifications:"Aviseringar",commandSearch:"Skriv ett kommando eller sök…",noCommandsFound:"Inga kommandon hittades",closeDrawer:"Stäng panel",fieldRequired:"Detta fält är obligatoriskt",invalidFormat:"Ogiltigt format",minLength:e=>`Minst ${e} tecken`,maxLength:e=>`Högst ${e} tecken`,minValue:e=>`Minst ${e}`,maxValue:e=>`Högst ${e}`,noRows:"Inga rader",resetFilters:"Återställ filter"},"da-DK":{close:"Luk",cancel:"Annuller",confirm:"Bekræft",save:"Gem",delete:"Slet",search:"Søg",loading:"Indlæser...",noResults:"Ingen resultater fundet",required:"Påkrævet",previous:"Forrige",next:"Næste",pageOf:(e,t)=>`Side ${e} af ${t}`,selectPlaceholder:"Vælg...",clearSelection:"Ryd valg",selectDate:"Vælg en dato",today:"I dag",dropFiles:"Slip filer her eller",browse:"Gennemse",noData:"Ingen data tilgængelige",sortAscending:"Sorter stigende",sortDescending:"Sorter faldende",filterPlaceholder:"Filtrer...",exportCsv:"Eksporter CSV",rowsSelected:e=>`${e} række${1===e?"":"r"} valgt`,firstPage:"Første side",lastPage:"Sidste side",previousPage:"Forrige side",nextPage:"Næste side",showingRange:(e,t,n)=>`Viser ${e}–${t} af ${n}`,itemsPerPage:"Per side",uploadFiles:"Upload filer",yesterday:"I går",last7Days:"Sidste 7 dage",last30Days:"Sidste 30 dage",thisMonth:"Denne måned",lastMonth:"Sidste måned",notifications:"Notifikationer",commandSearch:"Skriv en kommando eller søg…",noCommandsFound:"Ingen kommandoer fundet",closeDrawer:"Luk panel",fieldRequired:"Dette felt er påkrævet",invalidFormat:"Ugyldigt format",minLength:e=>`Mindst ${e} tegn`,maxLength:e=>`Højst ${e} tegn`,minValue:e=>`Mindst ${e}`,maxValue:e=>`Højst ${e}`,noRows:"Ingen rækker",resetFilters:"Nulstil filtre"},"cs-CZ":{close:"Zavřít",cancel:"Zrušit",confirm:"Potvrdit",save:"Uložit",delete:"Smazat",search:"Hledat",loading:"Načítání...",noResults:"Žádné výsledky",required:"Povinné",previous:"Předchozí",next:"Další",pageOf:(e,t)=>`Stránka ${e} z ${t}`,selectPlaceholder:"Vyberte...",clearSelection:"Vymazat výběr",selectDate:"Vyberte datum",today:"Dnes",dropFiles:"Přetáhněte soubory nebo",browse:"Procházet",noData:"Žádná data",sortAscending:"Seřadit vzestupně",sortDescending:"Seřadit sestupně",filterPlaceholder:"Filtrovat...",exportCsv:"Exportovat CSV",rowsSelected:e=>`Vybráno ${e} řádků`,firstPage:"První stránka",lastPage:"Poslední stránka",previousPage:"Předchozí stránka",nextPage:"Další stránka",showingRange:(e,t,n)=>`Zobrazeno ${e}–${t} z ${n}`,itemsPerPage:"Na stránku",uploadFiles:"Nahrát soubory",yesterday:"Včera",last7Days:"Posledních 7 dní",last30Days:"Posledních 30 dní",thisMonth:"Tento měsíc",lastMonth:"Minulý měsíc",notifications:"Oznámení",commandSearch:"Zadejte příkaz nebo hledejte…",noCommandsFound:"Žádné příkazy nenalezeny",closeDrawer:"Zavřít panel",fieldRequired:"Toto pole je povinné",invalidFormat:"Neplatný formát",minLength:e=>`Minimálně ${e} znaků`,maxLength:e=>`Maximálně ${e} znaků`,minValue:e=>`Minimálně ${e}`,maxValue:e=>`Maximálně ${e}`,noRows:"Žádné řádky",resetFilters:"Resetovat filtry"},"hu-HU":{close:"Bezárás",cancel:"Mégse",confirm:"Megerősítés",save:"Mentés",delete:"Törlés",search:"Keresés",loading:"Betöltés...",noResults:"Nincs találat",required:"Kötelező",previous:"Előző",next:"Következő",pageOf:(e,t)=>`${e}. oldal / ${t}`,selectPlaceholder:"Válasszon...",clearSelection:"Kijelölés törlése",selectDate:"Válasszon dátumot",today:"Ma",dropFiles:"Húzza ide a fájlokat vagy",browse:"Tallózás",noData:"Nincs adat",sortAscending:"Növekvő sorrend",sortDescending:"Csökkenő sorrend",filterPlaceholder:"Szűrés...",exportCsv:"CSV exportálása",rowsSelected:e=>`${e} sor kiválasztva`,firstPage:"Első oldal",lastPage:"Utolsó oldal",previousPage:"Előző oldal",nextPage:"Következő oldal",showingRange:(e,t,n)=>`${e}–${t} megjelenítése a(z) ${n}-ből`,itemsPerPage:"Oldalanként",uploadFiles:"Fájlok feltöltése",yesterday:"Tegnap",last7Days:"Elmúlt 7 nap",last30Days:"Elmúlt 30 nap",thisMonth:"Ez a hónap",lastMonth:"Múlt hónap",notifications:"Értesítések",commandSearch:"Írjon parancsot vagy keressen…",noCommandsFound:"Nincsenek parancsok",closeDrawer:"Panel bezárása",fieldRequired:"Ez a mező kötelező",invalidFormat:"Érvénytelen formátum",minLength:e=>`Legalább ${e} karakter`,maxLength:e=>`Legfeljebb ${e} karakter`,minValue:e=>`Legalább ${e}`,maxValue:e=>`Legfeljebb ${e}`,noRows:"Nincsenek sorok",resetFilters:"Szűrők visszaállítása"},"ar-SA":{close:"إغلاق",cancel:"إلغاء",confirm:"تأكيد",save:"حفظ",delete:"حذف",search:"بحث",loading:"...جارٍ التحميل",noResults:"لم يتم العثور على نتائج",required:"مطلوب",previous:"السابق",next:"التالي",pageOf:(e,t)=>`صفحة ${e} من ${t}`,selectPlaceholder:"...اختر",clearSelection:"مسح الاختيار",selectDate:"اختر تاريخ",today:"اليوم",dropFiles:"أفلت الملفات هنا أو",browse:"تصفح",noData:"لا توجد بيانات",sortAscending:"ترتيب تصاعدي",sortDescending:"ترتيب تنازلي",filterPlaceholder:"...فلترة",exportCsv:"تصدير CSV",rowsSelected:e=>`تم تحديد ${e} صفوف`,firstPage:"الصفحة الأولى",lastPage:"الصفحة الأخيرة",previousPage:"الصفحة السابقة",nextPage:"الصفحة التالية",showingRange:(e,t,n)=>`عرض ${e}–${t} من ${n}`,itemsPerPage:"لكل صفحة",uploadFiles:"رفع الملفات",yesterday:"الأمس",last7Days:"آخر 7 أيام",last30Days:"آخر 30 يوم",thisMonth:"هذا الشهر",lastMonth:"الشهر الماضي",notifications:"إشعارات",commandSearch:"اكتب أمرًا أو ابحث…",noCommandsFound:"لم يتم العثور على أوامر",closeDrawer:"إغلاق اللوحة",fieldRequired:"هذا الحقل مطلوب",invalidFormat:"تنسيق غير صالح",minLength:e=>`الحد الأدنى ${e} حرفًا`,maxLength:e=>`الحد الأقصى ${e} حرفًا`,minValue:e=>`الحد الأدنى ${e}`,maxValue:e=>`الحد الأقصى ${e}`,noRows:"لا توجد صفوف",resetFilters:"إعادة ضبط الفلاتر"},"he-IL":{close:"סגור",cancel:"ביטול",confirm:"אישור",save:"שמור",delete:"מחק",search:"חיפוש",loading:"טוען...",noResults:"לא נמצאו תוצאות",required:"חובה",previous:"הקודם",next:"הבא",pageOf:(e,t)=>`עמוד ${e} מתוך ${t}`,selectPlaceholder:"בחר...",clearSelection:"נקה בחירה",selectDate:"בחר תאריך",today:"היום",dropFiles:"גרור קבצים לכאן או",browse:"עיון",noData:"אין נתונים",sortAscending:"מיון עולה",sortDescending:"מיון יורד",filterPlaceholder:"סינון...",exportCsv:"ייצוא CSV",rowsSelected:e=>`נבחרו ${e} שורות`,firstPage:"עמוד ראשון",lastPage:"עמוד אחרון",previousPage:"עמוד קודם",nextPage:"עמוד הבא",showingRange:(e,t,n)=>`מציג ${e}–${t} מתוך ${n}`,itemsPerPage:"לעמוד",uploadFiles:"העלאת קבצים",yesterday:"אתמול",last7Days:"7 ימים אחרונים",last30Days:"30 ימים אחרונים",thisMonth:"החודש",lastMonth:"החודש שעבר",notifications:"התראות",commandSearch:"הקלד פקודה או חפש…",noCommandsFound:"לא נמצאו פקודות",closeDrawer:"סגור פאנל",fieldRequired:"שדה זה הוא חובה",invalidFormat:"פורמט לא חוקי",minLength:e=>`מינימום ${e} תווים`,maxLength:e=>`מקסימום ${e} תווים`,minValue:e=>`מינימום ${e}`,maxValue:e=>`מקסימום ${e}`,noRows:"אין שורות",resetFilters:"איפוס מסננים"},"fa-IR":{close:"بستن",cancel:"لغو",confirm:"تأیید",save:"ذخیره",delete:"حذف",search:"جستجو",loading:"...در حال بارگذاری",noResults:"نتیجه‌ای یافت نشد",required:"الزامی",previous:"قبلی",next:"بعدی",pageOf:(e,t)=>`صفحه ${e} از ${t}`,selectPlaceholder:"...انتخاب کنید",clearSelection:"پاک کردن انتخاب",selectDate:"تاریخ را انتخاب کنید",today:"امروز",dropFiles:"فایل‌ها را اینجا رها کنید یا",browse:"مرور",noData:"داده‌ای موجود نیست",sortAscending:"مرتب‌سازی صعودی",sortDescending:"مرتب‌سازی نزولی",filterPlaceholder:"...فیلتر",exportCsv:"خروجی CSV",rowsSelected:e=>`${e} ردیف انتخاب شده`,firstPage:"صفحه اول",lastPage:"صفحه آخر",previousPage:"صفحه قبل",nextPage:"صفحه بعد",showingRange:(e,t,n)=>`نمایش ${e}–${t} از ${n}`,itemsPerPage:"در هر صفحه",uploadFiles:"آپلود فایل‌ها",yesterday:"دیروز",last7Days:"۷ روز گذشته",last30Days:"۳۰ روز گذشته",thisMonth:"این ماه",lastMonth:"ماه گذشته",notifications:"اعلان‌ها",commandSearch:"دستور را تایپ یا جستجو کنید…",noCommandsFound:"هیچ دستوری یافت نشد",closeDrawer:"بستن پنل",fieldRequired:"این فیلد الزامی است",invalidFormat:"فرمت نامعتبر",minLength:e=>`حداقل ${e} کاراکتر`,maxLength:e=>`حداکثر ${e} کاراکتر`,minValue:e=>`حداقل ${e}`,maxValue:e=>`حداکثر ${e}`,noRows:"هیچ ردیفی نیست",resetFilters:"بازنشانی فیلترها"},"ja-JP":{close:"閉じる",cancel:"キャンセル",confirm:"確認",save:"保存",delete:"削除",search:"検索",loading:"読み込み中...",noResults:"結果が見つかりません",required:"必須",previous:"前へ",next:"次へ",pageOf:(e,t)=>`${t}ページ中${e}ページ`,selectPlaceholder:"選択...",clearSelection:"選択解除",selectDate:"日付を選択",today:"今日",dropFiles:"ファイルをドロップまたは",browse:"参照",noData:"データなし",sortAscending:"昇順",sortDescending:"降順",filterPlaceholder:"フィルター...",exportCsv:"CSVエクスポート",rowsSelected:e=>`${e}行選択中`,firstPage:"最初のページ",lastPage:"最後のページ",previousPage:"前のページ",nextPage:"次のページ",showingRange:(e,t,n)=>`${n}件中 ${e}–${t}件を表示`,itemsPerPage:"ページあたり",uploadFiles:"ファイルをアップロード",yesterday:"昨日",last7Days:"過去7日間",last30Days:"過去30日間",thisMonth:"今月",lastMonth:"先月",notifications:"通知",commandSearch:"コマンドを入力するか検索…",noCommandsFound:"コマンドが見つかりません",closeDrawer:"パネルを閉じる",fieldRequired:"この項目は必須です",invalidFormat:"無効な形式",minLength:e=>`${e}文字以上で入力してください`,maxLength:e=>`${e}文字以内で入力してください`,minValue:e=>`${e}以上`,maxValue:e=>`${e}以下`,noRows:"行がありません",resetFilters:"フィルターをリセット"},"ko-KR":{close:"닫기",cancel:"취소",confirm:"확인",save:"저장",delete:"삭제",search:"검색",loading:"로딩 중...",noResults:"검색 결과 없음",required:"필수",previous:"이전",next:"다음",pageOf:(e,t)=>`${t}페이지 중 ${e}페이지`,selectPlaceholder:"선택...",clearSelection:"선택 해제",selectDate:"날짜 선택",today:"오늘",dropFiles:"여기에 파일을 놓거나",browse:"찾아보기",noData:"데이터 없음",sortAscending:"오름차순 정렬",sortDescending:"내림차순 정렬",filterPlaceholder:"필터...",exportCsv:"CSV 내보내기",rowsSelected:e=>`${e}개 행 선택됨`,firstPage:"첫 페이지",lastPage:"마지막 페이지",previousPage:"이전 페이지",nextPage:"다음 페이지",showingRange:(e,t,n)=>`총 ${n}개 중 ${e}–${t}개 표시`,itemsPerPage:"페이지당",uploadFiles:"파일 업로드",yesterday:"어제",last7Days:"지난 7일",last30Days:"지난 30일",thisMonth:"이번 달",lastMonth:"지난달",notifications:"알림",commandSearch:"명령을 입력하거나 검색…",noCommandsFound:"명령을 찾을 수 없음",closeDrawer:"패널 닫기",fieldRequired:"이 필드는 필수입니다",invalidFormat:"잘못된 형식",minLength:e=>`최소 ${e}자`,maxLength:e=>`최대 ${e}자`,minValue:e=>`최소 ${e}`,maxValue:e=>`최대 ${e}`,noRows:"행 없음",resetFilters:"필터 재설정"},"zh-CN":{close:"关闭",cancel:"取消",confirm:"确认",save:"保存",delete:"删除",search:"搜索",loading:"加载中...",noResults:"未找到结果",required:"必填",previous:"上一页",next:"下一页",pageOf:(e,t)=>`第 ${e} 页,共 ${t} 页`,selectPlaceholder:"请选择...",clearSelection:"清除选择",selectDate:"选择日期",today:"今天",dropFiles:"将文件拖到此处或",browse:"浏览",noData:"暂无数据",sortAscending:"升序排列",sortDescending:"降序排列",filterPlaceholder:"筛选...",exportCsv:"导出 CSV",rowsSelected:e=>`已选择 ${e} 行`,firstPage:"第一页",lastPage:"最后一页",previousPage:"上一页",nextPage:"下一页",showingRange:(e,t,n)=>`显示 ${e}–${t} 项,共 ${n} 项`,itemsPerPage:"每页",uploadFiles:"上传文件",yesterday:"昨天",last7Days:"最近 7 天",last30Days:"最近 30 天",thisMonth:"本月",lastMonth:"上个月",notifications:"通知",commandSearch:"输入命令或搜索…",noCommandsFound:"未找到命令",closeDrawer:"关闭面板",fieldRequired:"此字段为必填项",invalidFormat:"格式无效",minLength:e=>`至少 ${e} 个字符`,maxLength:e=>`最多 ${e} 个字符`,minValue:e=>`最小 ${e}`,maxValue:e=>`最大 ${e}`,noRows:"无数据",resetFilters:"重置筛选"},"zh-TW":{close:"關閉",cancel:"取消",confirm:"確認",save:"儲存",delete:"刪除",search:"搜尋",loading:"載入中...",noResults:"未找到結果",required:"必填",previous:"上一頁",next:"下一頁",pageOf:(e,t)=>`第 ${e} 頁,共 ${t} 頁`,selectPlaceholder:"請選擇...",clearSelection:"清除選擇",selectDate:"選擇日期",today:"今天",dropFiles:"將檔案拖曳至此或",browse:"瀏覽",noData:"暫無資料",sortAscending:"升冪排列",sortDescending:"降冪排列",filterPlaceholder:"篩選...",exportCsv:"匯出 CSV",rowsSelected:e=>`已選擇 ${e} 行`,firstPage:"第一頁",lastPage:"最後一頁",previousPage:"上一頁",nextPage:"下一頁",showingRange:(e,t,n)=>`顯示 ${e}–${t} 項,共 ${n} 項`,itemsPerPage:"每頁",uploadFiles:"上傳檔案",yesterday:"昨天",last7Days:"最近 7 天",last30Days:"最近 30 天",thisMonth:"本月",lastMonth:"上個月",notifications:"通知",commandSearch:"輸入命令或搜尋…",noCommandsFound:"找不到命令",closeDrawer:"關閉面板",fieldRequired:"此欄位為必填",invalidFormat:"格式無效",minLength:e=>`至少 ${e} 個字元`,maxLength:e=>`最多 ${e} 個字元`,minValue:e=>`最小 ${e}`,maxValue:e=>`最大 ${e}`,noRows:"無資料",resetFilters:"重設篩選"},"th-TH":{close:"ปิด",cancel:"ยกเลิก",confirm:"ยืนยัน",save:"บันทึก",delete:"ลบ",search:"ค้นหา",loading:"กำลังโหลด...",noResults:"ไม่พบผลลัพธ์",required:"จำเป็น",previous:"ก่อนหน้า",next:"ถัดไป",pageOf:(e,t)=>`หน้า ${e} จาก ${t}`,selectPlaceholder:"เลือก...",clearSelection:"ล้างการเลือก",selectDate:"เลือกวันที่",today:"วันนี้",dropFiles:"วางไฟล์ที่นี่หรือ",browse:"เรียกดู",noData:"ไม่มีข้อมูล",sortAscending:"เรียงจากน้อยไปมาก",sortDescending:"เรียงจากมากไปน้อย",filterPlaceholder:"กรอง...",exportCsv:"ส่งออก CSV",rowsSelected:e=>`เลือก ${e} แถว`,firstPage:"หน้าแรก",lastPage:"หน้าสุดท้าย",previousPage:"หน้าก่อนหน้า",nextPage:"หน้าถัดไป",showingRange:(e,t,n)=>`แสดง ${e}–${t} จาก ${n}`,itemsPerPage:"ต่อหน้า",uploadFiles:"อัปโหลดไฟล์",yesterday:"เมื่อวาน",last7Days:"7 วันที่ผ่านมา",last30Days:"30 วันที่ผ่านมา",thisMonth:"เดือนนี้",lastMonth:"เดือนที่แล้ว",notifications:"การแจ้งเตือน",commandSearch:"พิมพ์คำสั่งหรือค้นหา…",noCommandsFound:"ไม่พบคำสั่ง",closeDrawer:"ปิดแผง",fieldRequired:"ช่องนี้จำเป็นต้องกรอก",invalidFormat:"รูปแบบไม่ถูกต้อง",minLength:e=>`อย่างน้อย ${e} ตัวอักษร`,maxLength:e=>`ไม่เกิน ${e} ตัวอักษร`,minValue:e=>`อย่างน้อย ${e}`,maxValue:e=>`ไม่เกิน ${e}`,noRows:"ไม่มีแถว",resetFilters:"รีเซ็ตตัวกรอง"},"vi-VN":{close:"Đóng",cancel:"Hủy",confirm:"Xác nhận",save:"Lưu",delete:"Xóa",search:"Tìm kiếm",loading:"Đang tải...",noResults:"Không tìm thấy kết quả",required:"Bắt buộc",previous:"Trước",next:"Tiếp",pageOf:(e,t)=>`Trang ${e} / ${t}`,selectPlaceholder:"Chọn...",clearSelection:"Xóa lựa chọn",selectDate:"Chọn ngày",today:"Hôm nay",dropFiles:"Thả tệp vào đây hoặc",browse:"Duyệt",noData:"Không có dữ liệu",sortAscending:"Sắp xếp tăng dần",sortDescending:"Sắp xếp giảm dần",filterPlaceholder:"Lọc...",exportCsv:"Xuất CSV",rowsSelected:e=>`Đã chọn ${e} hàng`,firstPage:"Trang đầu",lastPage:"Trang cuối",previousPage:"Trang trước",nextPage:"Trang sau",showingRange:(e,t,n)=>`Hiển thị ${e}–${t} trong ${n}`,itemsPerPage:"Mỗi trang",uploadFiles:"Tải lên tệp",yesterday:"Hôm qua",last7Days:"7 ngày qua",last30Days:"30 ngày qua",thisMonth:"Tháng này",lastMonth:"Tháng trước",notifications:"Thông báo",commandSearch:"Nhập lệnh hoặc tìm kiếm…",noCommandsFound:"Không tìm thấy lệnh",closeDrawer:"Đóng bảng",fieldRequired:"Trường này là bắt buộc",invalidFormat:"Định dạng không hợp lệ",minLength:e=>`Tối thiểu ${e} ký tự`,maxLength:e=>`Tối đa ${e} ký tự`,minValue:e=>`Tối thiểu ${e}`,maxValue:e=>`Tối đa ${e}`,noRows:"Không có hàng",resetFilters:"Đặt lại bộ lọc"},"id-ID":{close:"Tutup",cancel:"Batal",confirm:"Konfirmasi",save:"Simpan",delete:"Hapus",search:"Cari",loading:"Memuat...",noResults:"Tidak ada hasil",required:"Wajib",previous:"Sebelumnya",next:"Berikutnya",pageOf:(e,t)=>`Halaman ${e} dari ${t}`,selectPlaceholder:"Pilih...",clearSelection:"Hapus pilihan",selectDate:"Pilih tanggal",today:"Hari ini",dropFiles:"Seret file ke sini atau",browse:"Jelajahi",noData:"Tidak ada data",sortAscending:"Urutkan naik",sortDescending:"Urutkan turun",filterPlaceholder:"Filter...",exportCsv:"Ekspor CSV",rowsSelected:e=>`${e} baris dipilih`,firstPage:"Halaman pertama",lastPage:"Halaman terakhir",previousPage:"Halaman sebelumnya",nextPage:"Halaman berikutnya",showingRange:(e,t,n)=>`Menampilkan ${e}–${t} dari ${n}`,itemsPerPage:"Per halaman",uploadFiles:"Unggah berkas",yesterday:"Kemarin",last7Days:"7 hari terakhir",last30Days:"30 hari terakhir",thisMonth:"Bulan ini",lastMonth:"Bulan lalu",notifications:"Notifikasi",commandSearch:"Ketik perintah atau cari…",noCommandsFound:"Tidak ada perintah ditemukan",closeDrawer:"Tutup panel",fieldRequired:"Bidang ini wajib diisi",invalidFormat:"Format tidak valid",minLength:e=>`Minimal ${e} karakter`,maxLength:e=>`Maksimal ${e} karakter`,minValue:e=>`Minimal ${e}`,maxValue:e=>`Maksimal ${e}`,noRows:"Tidak ada baris",resetFilters:"Atur ulang filter"},"ro-RO":{close:"Închide",cancel:"Anulează",confirm:"Confirmă",save:"Salvează",delete:"Șterge",search:"Caută",loading:"Se încarcă...",noResults:"Nu s-au găsit rezultate",required:"Obligatoriu",previous:"Anterior",next:"Următor",pageOf:(e,t)=>`Pagina ${e} din ${t}`,selectPlaceholder:"Selectați...",clearSelection:"Șterge selecția",selectDate:"Selectați o dată",today:"Astăzi",dropFiles:"Trageți fișierele aici sau",browse:"Răsfoiți",noData:"Nu există date",sortAscending:"Sortare crescătoare",sortDescending:"Sortare descrescătoare",filterPlaceholder:"Filtrați...",exportCsv:"Exportați CSV",rowsSelected:e=>`${e} rând${1===e?"":"uri"} selectat${1===e?"":"e"}`,firstPage:"Prima pagină",lastPage:"Ultima pagină",previousPage:"Pagina anterioară",nextPage:"Pagina următoare",showingRange:(e,t,n)=>`Se afișează ${e}–${t} din ${n}`,itemsPerPage:"Pe pagină",uploadFiles:"Încărcare fișiere",yesterday:"Ieri",last7Days:"Ultimele 7 zile",last30Days:"Ultimele 30 de zile",thisMonth:"Această lună",lastMonth:"Luna trecută",notifications:"Notificări",commandSearch:"Tastați o comandă sau căutați…",noCommandsFound:"Nu s-au găsit comenzi",closeDrawer:"Închidere panou",fieldRequired:"Acest câmp este obligatoriu",invalidFormat:"Format invalid",minLength:e=>`Minim ${e} caractere`,maxLength:e=>`Maxim ${e} caractere`,minValue:e=>`Minim ${e}`,maxValue:e=>`Maxim ${e}`,noRows:"Niciun rând",resetFilters:"Resetare filtre"},"hi-IN":{close:"बंद करें",cancel:"रद्द करें",confirm:"पुष्टि करें",save:"सहेजें",delete:"हटाएँ",search:"खोजें",loading:"लोड हो रहा है...",noResults:"कोई परिणाम नहीं मिला",required:"आवश्यक",previous:"पिछला",next:"अगला",pageOf:(e,t)=>`पृष्ठ ${e} / ${t}`,selectPlaceholder:"चुनें...",clearSelection:"चयन साफ़ करें",selectDate:"दिनांक चुनें",today:"आज",dropFiles:"यहाँ फ़ाइलें छोड़ें या",browse:"ब्राउज़ करें",noData:"कोई डेटा उपलब्ध नहीं",sortAscending:"आरोही क्रम में",sortDescending:"अवरोही क्रम में",filterPlaceholder:"फ़िल्टर...",exportCsv:"CSV निर्यात करें",rowsSelected:e=>`${e} पंक्ति${1===e?"":"याँ"} चयनित`,firstPage:"पहला पृष्ठ",lastPage:"अंतिम पृष्ठ",previousPage:"पिछला पृष्ठ",nextPage:"अगला पृष्ठ",showingRange:(e,t,n)=>`${n} में से ${e}–${t} दिखा रहे हैं`,itemsPerPage:"प्रति पृष्ठ",uploadFiles:"फ़ाइलें अपलोड करें",yesterday:"कल",last7Days:"पिछले 7 दिन",last30Days:"पिछले 30 दिन",thisMonth:"इस महीने",lastMonth:"पिछले महीने",notifications:"सूचनाएँ",commandSearch:"कमांड खोजें या टाइप करें…",noCommandsFound:"कोई कमांड नहीं मिली",closeDrawer:"पैनल बंद करें",fieldRequired:"यह फ़ील्ड आवश्यक है",invalidFormat:"अमान्य प्रारूप",minLength:e=>`कम से कम ${e} वर्ण होने चाहिए`,maxLength:e=>`${e} वर्णों से अधिक नहीं हो सकते`,minValue:e=>`${e} या उससे अधिक होना चाहिए`,maxValue:e=>`${e} या उससे कम होना चाहिए`,noRows:"कोई पंक्ति नहीं",resetFilters:"फ़िल्टर रीसेट करें"},"mr-IN":{close:"बंद करा",cancel:"रद्द करा",confirm:"पुष्टी करा",save:"जतन करा",delete:"हटवा",search:"शोधा",loading:"लोड होत आहे...",noResults:"कोणतेही परिणाम सापडले नाहीत",required:"आवश्यक",previous:"मागील",next:"पुढील",pageOf:(e,t)=>`पृष्ठ ${e} / ${t}`,selectPlaceholder:"निवडा...",clearSelection:"निवड साफ करा",selectDate:"तारीख निवडा",today:"आज",dropFiles:"फाइल्स येथे टाका किंवा",browse:"ब्राउझ करा",noData:"डेटा उपलब्ध नाही",sortAscending:"चढत्या क्रमाने",sortDescending:"उतरत्या क्रमाने",filterPlaceholder:"फिल्टर...",exportCsv:"CSV निर्यात करा",rowsSelected:e=>`${e} पंक्ती निवडली${1===e?"":"या"}`,firstPage:"पहिले पृष्ठ",lastPage:"शेवटचे पृष्ठ",previousPage:"मागील पृष्ठ",nextPage:"पुढील पृष्ठ",showingRange:(e,t,n)=>`${n} पैकी ${e}–${t} दाखवत आहे`,itemsPerPage:"प्रति पृष्ठ",uploadFiles:"फाइल्स अपलोड करा",yesterday:"काल",last7Days:"गेले 7 दिवस",last30Days:"गेले 30 दिवस",thisMonth:"हा महिना",lastMonth:"मागील महिना",notifications:"सूचना",commandSearch:"आदेश टाइप करा किंवा शोधा…",noCommandsFound:"कोणतेही आदेश सापडले नाहीत",closeDrawer:"पॅनेल बंद करा",fieldRequired:"हे फील्ड आवश्यक आहे",invalidFormat:"अवैध स्वरूप",minLength:e=>`किमान ${e} अक्षरे असणे आवश्यक`,maxLength:e=>`${e} अक्षरांपेक्षा जास्त नसावी`,minValue:e=>`किमान ${e}`,maxValue:e=>`कमाल ${e}`,noRows:"कोणत्याही पंक्ती नाहीत",resetFilters:"फिल्टर रीसेट करा"},"bn-IN":{close:"বন্ধ করুন",cancel:"বাতিল",confirm:"নিশ্চিত করুন",save:"সংরক্ষণ",delete:"মুছুন",search:"খুঁজুন",loading:"লোড হচ্ছে...",noResults:"কোনো ফলাফল পাওয়া যায়নি",required:"আবশ্যক",previous:"পূর্ববর্তী",next:"পরবর্তী",pageOf:(e,t)=>`পৃষ্ঠা ${e} / ${t}`,selectPlaceholder:"নির্বাচন করুন...",clearSelection:"নির্বাচন মুছুন",selectDate:"তারিখ নির্বাচন",today:"আজ",dropFiles:"এখানে ফাইল ছাড়ুন বা",browse:"ব্রাউজ",noData:"কোনো ডেটা নেই",sortAscending:"ক্রমবর্ধমান",sortDescending:"ক্রমহ্রাসমান",filterPlaceholder:"ফিল্টার...",exportCsv:"CSV রপ্তানি",rowsSelected:e=>`${e}টি সারি নির্বাচিত`,firstPage:"প্রথম পৃষ্ঠা",lastPage:"শেষ পৃষ্ঠা",previousPage:"পূর্ববর্তী পৃষ্ঠা",nextPage:"পরবর্তী পৃষ্ঠা",showingRange:(e,t,n)=>`${n}টির মধ্যে ${e}–${t} দেখাচ্ছে`,itemsPerPage:"প্রতি পৃষ্ঠায়",uploadFiles:"ফাইল আপলোড",yesterday:"গতকাল",last7Days:"গত 7 দিন",last30Days:"গত 30 দিন",thisMonth:"এই মাস",lastMonth:"গত মাস",notifications:"বিজ্ঞপ্তি",commandSearch:"কমান্ড টাইপ বা অনুসন্ধান করুন…",noCommandsFound:"কোনো কমান্ড পাওয়া যায়নি",closeDrawer:"প্যানেল বন্ধ",fieldRequired:"এই ক্ষেত্রটি প্রয়োজন",invalidFormat:"অবৈধ ফর্ম্যাট",minLength:e=>`কমপক্ষে ${e}টি অক্ষর`,maxLength:e=>`সর্বাধিক ${e}টি অক্ষর`,minValue:e=>`কমপক্ষে ${e}`,maxValue:e=>`সর্বাধিক ${e}`,noRows:"কোনো সারি নেই",resetFilters:"ফিল্টার রিসেট"},"ta-IN":{close:"மூடு",cancel:"ரத்து",confirm:"உறுதிப்படுத்து",save:"சேமி",delete:"நீக்கு",search:"தேடு",loading:"ஏற்றுகிறது...",noResults:"முடிவுகள் இல்லை",required:"தேவை",previous:"முந்தைய",next:"அடுத்து",pageOf:(e,t)=>`பக்கம் ${e} / ${t}`,selectPlaceholder:"தேர்ந்தெடு...",clearSelection:"அழி",selectDate:"தேதி தேர்ந்தெடு",today:"இன்று",dropFiles:"இங்கே கோப்புகளை விடவும் அல்லது",browse:"உலாவு",noData:"தரவு இல்லை",sortAscending:"ஏறுவரிசை",sortDescending:"இறங்குவரிசை",filterPlaceholder:"வடிகட்டு...",exportCsv:"CSV ஏற்றுமதி",rowsSelected:e=>`${e} வரிசை${1===e?"":"கள்"} தேர்ந்தெடுக்கப்பட்டது`,firstPage:"முதல் பக்கம்",lastPage:"கடைசி பக்கம்",previousPage:"முந்தைய பக்கம்",nextPage:"அடுத்த பக்கம்",showingRange:(e,t,n)=>`${n}-ல் ${e}–${t} காட்டப்படுகிறது`,itemsPerPage:"பக்கத்திற்கு",uploadFiles:"கோப்புகளை பதிவேற்று",yesterday:"நேற்று",last7Days:"கடந்த 7 நாட்கள்",last30Days:"கடந்த 30 நாட்கள்",thisMonth:"இந்த மாதம்",lastMonth:"கடந்த மாதம்",notifications:"அறிவிப்புகள்",commandSearch:"கட்டளை தட்டச்சு செய்யவும் அல்லது தேடவும்…",noCommandsFound:"கட்டளைகள் இல்லை",closeDrawer:"பலகத்தை மூடு",fieldRequired:"இந்த புலம் அவசியம்",invalidFormat:"தவறான வடிவம்",minLength:e=>`குறைந்தது ${e} எழுத்துகள்`,maxLength:e=>`அதிகபட்சம் ${e} எழுத்துகள்`,minValue:e=>`குறைந்தது ${e}`,maxValue:e=>`அதிகபட்சம் ${e}`,noRows:"வரிசைகள் இல்லை",resetFilters:"வடிகட்டிகளை மீட்டமை"},"te-IN":{close:"మూసివేయి",cancel:"రద్దు",confirm:"నిర్ధారించు",save:"సేవ్",delete:"తొలగించు",search:"వెతుకు",loading:"లోడ్ అవుతోంది...",noResults:"ఫలితాలు లేవు",required:"అవసరం",previous:"మునుపటి",next:"తరువాత",pageOf:(e,t)=>`పేజీ ${e} / ${t}`,selectPlaceholder:"ఎంచుకోండి...",clearSelection:"ఎంపిక క్లియర్",selectDate:"తేదీ ఎంచుకోండి",today:"నేడు",dropFiles:"ఇక్కడ ఫైల్‌లను వదలండి లేదా",browse:"బ్రౌజ్",noData:"డేటా అందుబాటులో లేదు",sortAscending:"ఆరోహణ",sortDescending:"అవరోహణ",filterPlaceholder:"ఫిల్టర్...",exportCsv:"CSV ఎగుమతి",rowsSelected:e=>`${e} అడ్డువరుస${1===e?"":"లు"} ఎంచుకోబడ్డాయి`,firstPage:"మొదటి పేజీ",lastPage:"చివరి పేజీ",previousPage:"మునుపటి పేజీ",nextPage:"తదుపరి పేజీ",showingRange:(e,t,n)=>`${n}లో ${e}–${t} చూపుతోంది`,itemsPerPage:"పేజీకి",uploadFiles:"ఫైల్‌లను అప్‌లోడ్ చేయండి",yesterday:"నిన్న",last7Days:"గత 7 రోజులు",last30Days:"గత 30 రోజులు",thisMonth:"ఈ నెల",lastMonth:"గత నెల",notifications:"నోటిఫికేషన్‌లు",commandSearch:"ఆదేశాన్ని టైప్ చేయండి లేదా శోధించండి…",noCommandsFound:"ఆదేశాలు కనుగొనబడలేదు",closeDrawer:"ప్యానెల్‌ను మూసివేయండి",fieldRequired:"ఈ ఫీల్డ్ తప్పనిసరి",invalidFormat:"చెల్లని ఫార్మాట్",minLength:e=>`కనీసం ${e} అక్షరాలు`,maxLength:e=>`గరిష్టంగా ${e} అక్షరాలు`,minValue:e=>`కనీసం ${e}`,maxValue:e=>`గరిష్టంగా ${e}`,noRows:"వరుసలు లేవు",resetFilters:"ఫిల్టర్‌లను రీసెట్ చేయండి"},"gu-IN":{close:"બંધ",cancel:"રદ",confirm:"પુષ્ટિ",save:"સાચવો",delete:"કાઢી નાંખો",search:"શોધો",loading:"લોડ થઈ રહ્યું છે...",noResults:"કોઈ પરિણામ મળ્યું નથી",required:"આવશ્યક",previous:"પાછલું",next:"આગલું",pageOf:(e,t)=>`પૃષ્ઠ ${e} / ${t}`,selectPlaceholder:"પસંદ કરો...",clearSelection:"પસંદગી સાફ",selectDate:"તારીખ પસંદ કરો",today:"આજે",dropFiles:"અહીં ફાઇલો છોડો અથવા",browse:"બ્રાઉઝ",noData:"કોઈ ડેટા ઉપલબ્ધ નથી",sortAscending:"ચઢતા ક્રમ",sortDescending:"ઉતરતા ક્રમ",filterPlaceholder:"ફિલ્ટર...",exportCsv:"CSV નિકાસ",rowsSelected:e=>`${e} પંક્તિ${1===e?"":"ઓ"} પસંદ`,firstPage:"પ્રથમ પૃષ્ઠ",lastPage:"છેલ્લું પૃષ્ઠ",previousPage:"પાછલું પૃષ્ઠ",nextPage:"આગલું પૃષ્ઠ",showingRange:(e,t,n)=>`${n} માંથી ${e}–${t} બતાવી રહ્યું છે`,itemsPerPage:"પ્રતિ પૃષ્ઠ",uploadFiles:"ફાઇલો અપલોડ કરો",yesterday:"ગઈ કાલે",last7Days:"છેલ્લા 7 દિવસ",last30Days:"છેલ્લા 30 દિવસ",thisMonth:"આ મહિને",lastMonth:"ગયા મહિને",notifications:"સૂચનાઓ",commandSearch:"આદેશ લખો અથવા શોધો…",noCommandsFound:"કોઈ આદેશ મળ્યો નથી",closeDrawer:"પેનલ બંધ કરો",fieldRequired:"આ ફીલ્ડ આવશ્યક છે",invalidFormat:"અમાન્ય ફોર્મેટ",minLength:e=>`ઓછામાં ઓછા ${e} અક્ષરો`,maxLength:e=>`વધુમાં વધુ ${e} અક્ષરો`,minValue:e=>`ઓછામાં ઓછું ${e}`,maxValue:e=>`વધુમાં વધુ ${e}`,noRows:"કોઈ પંક્તિ નથી",resetFilters:"ફિલ્ટર્સ રીસેટ કરો"},"pa-IN":{close:"ਬੰਦ ਕਰੋ",cancel:"ਰੱਦ ਕਰੋ",confirm:"ਪੁਸ਼ਟੀ ਕਰੋ",save:"ਸੰਭਾਲੋ",delete:"ਮਿਟਾਓ",search:"ਖੋਜੋ",loading:"ਲੋਡ ਹੋ ਰਿਹਾ...",noResults:"ਕੋਈ ਨਤੀਜਾ ਨਹੀਂ ਮਿਲਿਆ",required:"ਲੋੜੀਂਦਾ",previous:"ਪਿਛਲਾ",next:"ਅਗਲਾ",pageOf:(e,t)=>`ਪੰਨਾ ${e} / ${t}`,selectPlaceholder:"ਚੁਣੋ...",clearSelection:"ਚੋਣ ਸਾਫ਼",selectDate:"ਮਿਤੀ ਚੁਣੋ",today:"ਅੱਜ",dropFiles:"ਇੱਥੇ ਫਾਈਲਾਂ ਛੱਡੋ ਜਾਂ",browse:"ਬ੍ਰਾਊਜ਼",noData:"ਕੋਈ ਡਾਟਾ ਉਪਲਬਧ ਨਹੀਂ",sortAscending:"ਚੜ੍ਹਦੇ ਕ੍ਰਮ",sortDescending:"ਉਤਰਦੇ ਕ੍ਰਮ",filterPlaceholder:"ਫਿਲਟਰ...",exportCsv:"CSV ਨਿਰਯਾਤ",rowsSelected:e=>`${e} ਕਤਾਰ${1===e?"":"ਾਂ"} ਚੁਣੀਆਂ`,firstPage:"ਪਹਿਲਾ ਪੰਨਾ",lastPage:"ਆਖਰੀ ਪੰਨਾ",previousPage:"ਪਿਛਲਾ ਪੰਨਾ",nextPage:"ਅਗਲਾ ਪੰਨਾ",showingRange:(e,t,n)=>`${n} ਵਿੱਚੋਂ ${e}–${t} ਦਿਖਾ ਰਿਹਾ ਹੈ`,itemsPerPage:"ਪ੍ਰਤੀ ਪੰਨਾ",uploadFiles:"ਫਾਈਲਾਂ ਅੱਪਲੋਡ ਕਰੋ",yesterday:"ਕੱਲ੍ਹ",last7Days:"ਪਿਛਲੇ 7 ਦਿਨ",last30Days:"ਪਿਛਲੇ 30 ਦਿਨ",thisMonth:"ਇਸ ਮਹੀਨੇ",lastMonth:"ਪਿਛਲੇ ਮਹੀਨੇ",notifications:"ਸੂਚਨਾਵਾਂ",commandSearch:"ਕਮਾਂਡ ਟਾਈਪ ਕਰੋ ਜਾਂ ਖੋਜੋ…",noCommandsFound:"ਕੋਈ ਕਮਾਂਡ ਨਹੀਂ ਮਿਲੀ",closeDrawer:"ਪੈਨਲ ਬੰਦ ਕਰੋ",fieldRequired:"ਇਹ ਖੇਤਰ ਲੋੜੀਂਦਾ ਹੈ",invalidFormat:"ਅਵੈਧ ਫਾਰਮੈਟ",minLength:e=>`ਘੱਟੋ-ਘੱਟ ${e} ਅੱਖਰ`,maxLength:e=>`ਵੱਧ ਤੋਂ ਵੱਧ ${e} ਅੱਖਰ`,minValue:e=>`ਘੱਟੋ-ਘੱਟ ${e}`,maxValue:e=>`ਵੱਧ ਤੋਂ ਵੱਧ ${e}`,noRows:"ਕੋਈ ਕਤਾਰਾਂ ਨਹੀਂ",resetFilters:"ਫਿਲਟਰ ਰੀਸੈੱਟ ਕਰੋ"},"ur-PK":{close:"بند کریں",cancel:"منسوخ",confirm:"تصدیق",save:"محفوظ کریں",delete:"حذف کریں",search:"تلاش",loading:"لوڈ ہو رہا ہے...",noResults:"کوئی نتیجہ نہیں ملا",required:"ضروری",previous:"پچھلا",next:"اگلا",pageOf:(e,t)=>`صفحہ ${e} / ${t}`,selectPlaceholder:"منتخب کریں...",clearSelection:"انتخاب صاف کریں",selectDate:"تاریخ منتخب کریں",today:"آج",dropFiles:"یہاں فائلیں چھوڑیں یا",browse:"براؤز",noData:"کوئی ڈیٹا دستیاب نہیں",sortAscending:"صعودی ترتیب",sortDescending:"نزولی ترتیب",filterPlaceholder:"فلٹر...",exportCsv:"CSV برآمد",rowsSelected:e=>`${e} قطار${1===e?"":"یں"} منتخب`,firstPage:"پہلا صفحہ",lastPage:"آخری صفحہ",previousPage:"پچھلا صفحہ",nextPage:"اگلا صفحہ",showingRange:(e,t,n)=>`${n} میں سے ${e}–${t} دکھایا جا رہا ہے`,itemsPerPage:"فی صفحہ",uploadFiles:"فائلیں اپ لوڈ کریں",yesterday:"کل",last7Days:"پچھلے 7 دن",last30Days:"پچھلے 30 دن",thisMonth:"اس مہینے",lastMonth:"پچھلے مہینے",notifications:"اطلاعات",commandSearch:"کمانڈ ٹائپ کریں یا تلاش کریں…",noCommandsFound:"کوئی کمانڈ نہیں ملی",closeDrawer:"پینل بند کریں",fieldRequired:"یہ فیلڈ ضروری ہے",invalidFormat:"غلط فارمیٹ",minLength:e=>`کم از کم ${e} حروف`,maxLength:e=>`زیادہ سے زیادہ ${e} حروف`,minValue:e=>`کم از کم ${e}`,maxValue:e=>`زیادہ سے زیادہ ${e}`,noRows:"کوئی قطاریں نہیں",resetFilters:"فلٹر دوبارہ ترتیب دیں"},"bg-BG":{close:"Затвори",cancel:"Отказ",confirm:"Потвърди",save:"Запази",delete:"Изтрий",search:"Търсене",loading:"Зареждане...",noResults:"Няма намерени резултати",required:"Задължително",previous:"Предишна",next:"Следваща",pageOf:(e,t)=>`Страница ${e} от ${t}`,selectPlaceholder:"Изберете...",clearSelection:"Изчисти избора",selectDate:"Изберете дата",today:"Днес",dropFiles:"Пуснете файлове тук или",browse:"Прегледай",noData:"Няма налични данни",sortAscending:"Възходящо сортиране",sortDescending:"Низходящо сортиране",filterPlaceholder:"Филтър...",exportCsv:"Експортиране в CSV",rowsSelected:e=>`${e} ${1===e?"избран ред":"избрани реда"}`,firstPage:"Първа страница",lastPage:"Последна страница",previousPage:"Предишна страница",nextPage:"Следваща страница",showingRange:(e,t,n)=>`Показани ${e}–${t} от ${n}`,itemsPerPage:"На страница",uploadFiles:"Качване на файлове",yesterday:"Вчера",last7Days:"Последни 7 дни",last30Days:"Последни 30 дни",thisMonth:"Този месец",lastMonth:"Миналия месец",notifications:"Известия",commandSearch:"Въведете команда или потърсете…",noCommandsFound:"Няма намерени команди",closeDrawer:"Затвори панела",fieldRequired:"Това поле е задължително",invalidFormat:"Невалиден формат",minLength:e=>`Минимум ${e} символа`,maxLength:e=>`Максимум ${e} символа`,minValue:e=>`Минимум ${e}`,maxValue:e=>`Максимум ${e}`,noRows:"Няма редове",resetFilters:"Нулирай филтрите"},"hr-HR":{close:"Zatvori",cancel:"Odustani",confirm:"Potvrdi",save:"Spremi",delete:"Obriši",search:"Pretraži",loading:"Učitavanje...",noResults:"Nema pronađenih rezultata",required:"Obavezno",previous:"Prethodno",next:"Sljedeće",pageOf:(e,t)=>`Stranica ${e} od ${t}`,selectPlaceholder:"Odaberi...",clearSelection:"Obriši odabir",selectDate:"Odaberi datum",today:"Danas",dropFiles:"Ispustite datoteke ovdje ili",browse:"Pregledaj",noData:"Nema dostupnih podataka",sortAscending:"Uzlazno sortiranje",sortDescending:"Silazno sortiranje",filterPlaceholder:"Filtriraj...",exportCsv:"Izvezi CSV",rowsSelected:e=>`Odabrano ${e} ${1===e?"redak":"redaka"}`,firstPage:"Prva stranica",lastPage:"Posljednja stranica",previousPage:"Prethodna stranica",nextPage:"Sljedeća stranica",showingRange:(e,t,n)=>`Prikaz ${e}–${t} od ${n}`,itemsPerPage:"Po stranici",uploadFiles:"Prenesi datoteke",yesterday:"Jučer",last7Days:"Posljednjih 7 dana",last30Days:"Posljednjih 30 dana",thisMonth:"Ovaj mjesec",lastMonth:"Prošli mjesec",notifications:"Obavijesti",commandSearch:"Upišite naredbu ili pretražite…",noCommandsFound:"Nema pronađenih naredbi",closeDrawer:"Zatvori ploču",fieldRequired:"Ovo polje je obavezno",invalidFormat:"Neispravan format",minLength:e=>`Najmanje ${e} znakova`,maxLength:e=>`Najviše ${e} znakova`,minValue:e=>`Najmanje ${e}`,maxValue:e=>`Najviše ${e}`,noRows:"Nema redaka",resetFilters:"Poništi filtre"},"et-EE":{close:"Sulge",cancel:"Tühista",confirm:"Kinnita",save:"Salvesta",delete:"Kustuta",search:"Otsi",loading:"Laadimine...",noResults:"Tulemusi ei leitud",required:"Kohustuslik",previous:"Eelmine",next:"Järgmine",pageOf:(e,t)=>`Lehekülg ${e} / ${t}`,selectPlaceholder:"Vali...",clearSelection:"Tühjenda valik",selectDate:"Vali kuupäev",today:"Täna",dropFiles:"Lohista failid siia või",browse:"Sirvi",noData:"Andmeid pole",sortAscending:"Sorteeri kasvavalt",sortDescending:"Sorteeri kahanevalt",filterPlaceholder:"Filtreeri...",exportCsv:"Ekspordi CSV",rowsSelected:e=>`${e} rida valitud`,firstPage:"Esimene lehekülg",lastPage:"Viimane lehekülg",previousPage:"Eelmine lehekülg",nextPage:"Järgmine lehekülg",showingRange:(e,t,n)=>`Kuvatud ${e}–${t} kokku ${n}-st`,itemsPerPage:"Lehekülje kohta",uploadFiles:"Laadi failid üles",yesterday:"Eile",last7Days:"Viimased 7 päeva",last30Days:"Viimased 30 päeva",thisMonth:"See kuu",lastMonth:"Eelmine kuu",notifications:"Teavitused",commandSearch:"Sisesta käsk või otsi…",noCommandsFound:"Käske ei leitud",closeDrawer:"Sulge paneel",fieldRequired:"See väli on kohustuslik",invalidFormat:"Vigane vorming",minLength:e=>`Vähemalt ${e} tähemärki`,maxLength:e=>`Maksimaalselt ${e} tähemärki`,minValue:e=>`Vähemalt ${e}`,maxValue:e=>`Maksimaalselt ${e}`,noRows:"Ridu pole",resetFilters:"Lähtesta filtrid"},"fi-FI":{close:"Sulje",cancel:"Peruuta",confirm:"Vahvista",save:"Tallenna",delete:"Poista",search:"Hae",loading:"Ladataan...",noResults:"Ei tuloksia",required:"Pakollinen",previous:"Edellinen",next:"Seuraava",pageOf:(e,t)=>`Sivu ${e} / ${t}`,selectPlaceholder:"Valitse...",clearSelection:"Tyhjennä valinta",selectDate:"Valitse päivämäärä",today:"Tänään",dropFiles:"Pudota tiedostot tähän tai",browse:"Selaa",noData:"Ei tietoja",sortAscending:"Lajittele nousevasti",sortDescending:"Lajittele laskevasti",filterPlaceholder:"Suodata...",exportCsv:"Vie CSV",rowsSelected:e=>`${e} ${1===e?"rivi":"riviä"} valittu`,firstPage:"Ensimmäinen sivu",lastPage:"Viimeinen sivu",previousPage:"Edellinen sivu",nextPage:"Seuraava sivu",showingRange:(e,t,n)=>`Näytetään ${e}–${t} / ${n}`,itemsPerPage:"Sivua kohti",uploadFiles:"Lataa tiedostot",yesterday:"Eilen",last7Days:"Viimeiset 7 päivää",last30Days:"Viimeiset 30 päivää",thisMonth:"Tämä kuukausi",lastMonth:"Viime kuukausi",notifications:"Ilmoitukset",commandSearch:"Kirjoita komento tai hae…",noCommandsFound:"Komentoja ei löytynyt",closeDrawer:"Sulje paneeli",fieldRequired:"Tämä kenttä on pakollinen",invalidFormat:"Virheellinen muoto",minLength:e=>`Vähintään ${e} merkkiä`,maxLength:e=>`Enintään ${e} merkkiä`,minValue:e=>`Vähintään ${e}`,maxValue:e=>`Enintään ${e}`,noRows:"Ei rivejä",resetFilters:"Palauta suodattimet"},"lt-LT":{close:"Uždaryti",cancel:"Atšaukti",confirm:"Patvirtinti",save:"Išsaugoti",delete:"Ištrinti",search:"Ieškoti",loading:"Įkeliama...",noResults:"Rezultatų nerasta",required:"Privaloma",previous:"Ankstesnis",next:"Kitas",pageOf:(e,t)=>`Puslapis ${e} iš ${t}`,selectPlaceholder:"Pasirinkite...",clearSelection:"Išvalyti pasirinkimą",selectDate:"Pasirinkite datą",today:"Šiandien",dropFiles:"Nuvilkite failus čia arba",browse:"Naršyti",noData:"Duomenų nėra",sortAscending:"Rikiuoti didėjančiai",sortDescending:"Rikiuoti mažėjančiai",filterPlaceholder:"Filtruoti...",exportCsv:"Eksportuoti CSV",rowsSelected:e=>`Pasirinkta ${e} ${1===e?"eilutė":"eilučių"}`,firstPage:"Pirmas puslapis",lastPage:"Paskutinis puslapis",previousPage:"Ankstesnis puslapis",nextPage:"Kitas puslapis",showingRange:(e,t,n)=>`Rodoma ${e}–${t} iš ${n}`,itemsPerPage:"Puslapyje",uploadFiles:"Įkelti failus",yesterday:"Vakar",last7Days:"Paskutinės 7 dienos",last30Days:"Paskutinės 30 dienų",thisMonth:"Šis mėnuo",lastMonth:"Praėjęs mėnuo",notifications:"Pranešimai",commandSearch:"Įveskite komandą arba ieškokite…",noCommandsFound:"Komandų nerasta",closeDrawer:"Uždaryti skydelį",fieldRequired:"Šis laukas yra privalomas",invalidFormat:"Neteisingas formatas",minLength:e=>`Bent ${e} simbolių`,maxLength:e=>`Ne daugiau kaip ${e} simbolių`,minValue:e=>`Bent ${e}`,maxValue:e=>`Ne daugiau kaip ${e}`,noRows:"Eilučių nėra",resetFilters:"Atstatyti filtrus"},"lv-LV":{close:"Aizvērt",cancel:"Atcelt",confirm:"Apstiprināt",save:"Saglabāt",delete:"Dzēst",search:"Meklēt",loading:"Notiek ielāde...",noResults:"Rezultāti nav atrasti",required:"Obligāts",previous:"Iepriekšējais",next:"Nākamais",pageOf:(e,t)=>`Lapa ${e} no ${t}`,selectPlaceholder:"Izvēlieties...",clearSelection:"Notīrīt izvēli",selectDate:"Izvēlieties datumu",today:"Šodien",dropFiles:"Nometiet failus šeit vai",browse:"Pārlūkot",noData:"Nav pieejamu datu",sortAscending:"Kārtot augošā secībā",sortDescending:"Kārtot dilstošā secībā",filterPlaceholder:"Filtrēt...",exportCsv:"Eksportēt CSV",rowsSelected:e=>`Atlasītas ${e} ${1===e?"rinda":"rindas"}`,firstPage:"Pirmā lapa",lastPage:"Pēdējā lapa",previousPage:"Iepriekšējā lapa",nextPage:"Nākamā lapa",showingRange:(e,t,n)=>`Rāda ${e}–${t} no ${n}`,itemsPerPage:"Lapā",uploadFiles:"Augšupielādēt failus",yesterday:"Vakar",last7Days:"Pēdējās 7 dienas",last30Days:"Pēdējās 30 dienas",thisMonth:"Šis mēnesis",lastMonth:"Iepriekšējais mēnesis",notifications:"Paziņojumi",commandSearch:"Ievadiet komandu vai meklējiet…",noCommandsFound:"Komandas nav atrastas",closeDrawer:"Aizvērt paneli",fieldRequired:"Šis lauks ir obligāts",invalidFormat:"Nederīgs formāts",minLength:e=>`Vismaz ${e} rakstzīmes`,maxLength:e=>`Ne vairāk kā ${e} rakstzīmes`,minValue:e=>`Vismaz ${e}`,maxValue:e=>`Ne vairāk kā ${e}`,noRows:"Nav rindu",resetFilters:"Atiestatīt filtrus"},"sk-SK":{close:"Zavrieť",cancel:"Zrušiť",confirm:"Potvrdiť",save:"Uložiť",delete:"Odstrániť",search:"Hľadať",loading:"Načítava sa...",noResults:"Žiadne výsledky",required:"Povinné",previous:"Predchádzajúce",next:"Ďalšie",pageOf:(e,t)=>`Strana ${e} z ${t}`,selectPlaceholder:"Vyberte...",clearSelection:"Vymazať výber",selectDate:"Vyberte dátum",today:"Dnes",dropFiles:"Pretiahnite súbory sem alebo",browse:"Prehľadávať",noData:"Žiadne údaje",sortAscending:"Zoradiť vzostupne",sortDescending:"Zoradiť zostupne",filterPlaceholder:"Filtrovať...",exportCsv:"Exportovať CSV",rowsSelected:e=>`Vybraných ${e} riadkov`,firstPage:"Prvá strana",lastPage:"Posledná strana",previousPage:"Predchádzajúca strana",nextPage:"Ďalšia strana",showingRange:(e,t,n)=>`Zobrazené ${e}–${t} z ${n}`,itemsPerPage:"Na stranu",uploadFiles:"Nahrať súbory",yesterday:"Včera",last7Days:"Posledných 7 dní",last30Days:"Posledných 30 dní",thisMonth:"Tento mesiac",lastMonth:"Minulý mesiac",notifications:"Oznámenia",commandSearch:"Zadajte príkaz alebo hľadajte…",noCommandsFound:"Žiadne príkazy sa nenašli",closeDrawer:"Zavrieť panel",fieldRequired:"Toto pole je povinné",invalidFormat:"Neplatný formát",minLength:e=>`Minimálne ${e} znakov`,maxLength:e=>`Maximálne ${e} znakov`,minValue:e=>`Minimálne ${e}`,maxValue:e=>`Maximálne ${e}`,noRows:"Žiadne riadky",resetFilters:"Obnoviť filtre"},"sl-SI":{close:"Zapri",cancel:"Prekliči",confirm:"Potrdi",save:"Shrani",delete:"Izbriši",search:"Iskanje",loading:"Nalaganje...",noResults:"Ni najdenih rezultatov",required:"Obvezno",previous:"Prejšnje",next:"Naslednje",pageOf:(e,t)=>`Stran ${e} od ${t}`,selectPlaceholder:"Izberite...",clearSelection:"Počisti izbor",selectDate:"Izberite datum",today:"Danes",dropFiles:"Spustite datoteke sem ali",browse:"Prebrskaj",noData:"Ni razpoložljivih podatkov",sortAscending:"Razvrsti naraščajoče",sortDescending:"Razvrsti padajoče",filterPlaceholder:"Filtriraj...",exportCsv:"Izvozi CSV",rowsSelected:e=>`Izbranih ${e} vrstic`,firstPage:"Prva stran",lastPage:"Zadnja stran",previousPage:"Prejšnja stran",nextPage:"Naslednja stran",showingRange:(e,t,n)=>`Prikaz ${e}–${t} od ${n}`,itemsPerPage:"Na stran",uploadFiles:"Naloži datoteke",yesterday:"Včeraj",last7Days:"Zadnjih 7 dni",last30Days:"Zadnjih 30 dni",thisMonth:"Ta mesec",lastMonth:"Prejšnji mesec",notifications:"Obvestila",commandSearch:"Vnesite ukaz ali poiščite…",noCommandsFound:"Ni najdenih ukazov",closeDrawer:"Zapri ploščo",fieldRequired:"To polje je obvezno",invalidFormat:"Neveljavna oblika",minLength:e=>`Najmanj ${e} znakov`,maxLength:e=>`Največ ${e} znakov`,minValue:e=>`Najmanj ${e}`,maxValue:e=>`Največ ${e}`,noRows:"Ni vrstic",resetFilters:"Ponastavi filtre"},"nb-NO":{close:"Lukk",cancel:"Avbryt",confirm:"Bekreft",save:"Lagre",delete:"Slett",search:"Søk",loading:"Laster...",noResults:"Ingen resultater funnet",required:"Påkrevd",previous:"Forrige",next:"Neste",pageOf:(e,t)=>`Side ${e} av ${t}`,selectPlaceholder:"Velg...",clearSelection:"Fjern valg",selectDate:"Velg en dato",today:"I dag",dropFiles:"Slipp filer her eller",browse:"Bla gjennom",noData:"Ingen data tilgjengelig",sortAscending:"Sorter stigende",sortDescending:"Sorter synkende",filterPlaceholder:"Filtrer...",exportCsv:"Eksporter CSV",rowsSelected:e=>`${e} ${1===e?"rad":"rader"} valgt`,firstPage:"Første side",lastPage:"Siste side",previousPage:"Forrige side",nextPage:"Neste side",showingRange:(e,t,n)=>`Viser ${e}–${t} av ${n}`,itemsPerPage:"Per side",uploadFiles:"Last opp filer",yesterday:"I går",last7Days:"Siste 7 dager",last30Days:"Siste 30 dager",thisMonth:"Denne måneden",lastMonth:"Forrige måned",notifications:"Varsler",commandSearch:"Skriv en kommando eller søk…",noCommandsFound:"Ingen kommandoer funnet",closeDrawer:"Lukk panel",fieldRequired:"Dette feltet er påkrevd",invalidFormat:"Ugyldig format",minLength:e=>`Minst ${e} tegn`,maxLength:e=>`Maks ${e} tegn`,minValue:e=>`Minst ${e}`,maxValue:e=>`Maks ${e}`,noRows:"Ingen rader",resetFilters:"Tilbakestill filtre"}},Zt=new Set(["ar-SA","he-IL","fa-IR","ur-PK"]);function Xt(e){return Zt.has(e)}var Gt=(0,a.createContext)({locale:"en-US",direction:"ltr",strings:Kt});function _t(){return(0,a.useContext)(Gt).strings}var Jt={sm:"400px",md:"560px",lg:"720px",full:"100vw"},Qt=0;function en(){--Qt<=0&&(Qt=0,document.body.style.overflow="")}var tn=(0,a.createContext)(null);function nn(){const e=(0,a.useContext)(tn);if(!e)throw new Error("TkxTab must be used inside TkxTabs");return e}var rn={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 on({variant:e,width:t,height:n,animation:r,bgColor:o,accentColor:i}){const a=void 0!==t?"number"==typeof t?`${t}px`:t:"100%",l=void 0!==n?"number"==typeof n?`${n}px`:n:{text:"1em",circular:a,rectangular:"80px"}[e],s=$t("circular"===e?"rounded-full":"text"===e?"rounded":"rounded-lg"),c="pulse"===r?$t("animate-pulse"):"wave"===r?$t("animate-shimmer"):"",u="wave"===r?{background:`linear-gradient(90deg,${o} 25%,${i} 50%,${o} 75%)`,backgroundSize:"200% 100%"}:{backgroundColor:o};return(0,d.jsx)("div",{className:Ct(s,c),style:{width:a,height:l,...u}})}var an=(0,a.forwardRef)(({variant:e="rectangular",width:t,height:n,lines:r,animation:o="pulse",className:i,style:a,...l},s)=>{const c=J(),u=!qe()&&o;return"text"===e&&r&&r>1?(0,d.jsx)("div",{ref:s,role:"progressbar","aria-busy":"true","aria-label":"Loading...",className:Ct($t("flex flex-col gap-2"),i),style:a,...l,children:Array.from({length:r},(e,o)=>(0,d.jsx)(on,{variant:"text",width:o===r-1?"75%":t,height:n,animation:u,bgColor:c.surfaceAlt,accentColor:c.border},o))}):(0,d.jsx)("div",{ref:s,role:"progressbar","aria-busy":"true","aria-label":"Loading...",className:i,style:a,...l,children:(0,d.jsx)(on,{variant:e,width:t,height:n,animation:u,bgColor:c.surfaceAlt,accentColor:c.border})})});an.displayName="TkxSkeleton";var ln={xs:24,sm:32,md:40,lg:56,xl:72},sn=(0,a.forwardRef)(({src:e,alt:t,initials:n,size:r="md",shape:o="circle",status:i,className:l,style:s,...c},u)=>{const p=J(),[h,f]=(0,a.useState)(!1),m=ln[r],g="circle"===o,x=p.surfaceAlt,y=j(x,[p.text,p.textMuted]),b=e&&!h,v=!b&&n,w=Math.max(8,.22*m),k={online:p.success,away:p.warning,busy:p.danger,offline:p.textMuted},$=$t("relative inline-flex shrink-0",g?"rounded-full":"rounded-lg"),S=$t("block object-cover",g?"rounded-full":"rounded-lg"),C=$t("flex items-center justify-center font-semibold font-sans select-none",g?"rounded-full":"rounded-lg");return(0,d.jsxs)("div",{ref:u,className:Ct($,l),style:{width:m,height:m,...s},...c,children:[b?(0,d.jsx)("img",{src:pe(e),alt:pe(t),onError:()=>f(!0),className:S,style:{width:m,height:m}}):(0,d.jsx)("div",{role:"img","aria-label":pe(t),className:C,style:{width:m,height:m,backgroundColor:x,color:y,fontSize:.38*m},children:v?pe(n).slice(0,2).toUpperCase():(0,d.jsxs)("svg",{width:.5*m,height:.5*m,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:[(0,d.jsx)("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),(0,d.jsx)("circle",{cx:"12",cy:"7",r:"4"})]})}),i&&(0,d.jsx)("span",{"aria-label":`Status: ${i}`,className:$t("absolute bottom-0 right-0 rounded-full"),style:{width:w,height:w,backgroundColor:k[i],border:`2px solid ${p.bg}`}})]})});function dn({dir:e}){return(0,d.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:$t("shrink-0"),children:"asc"===e?(0,d.jsx)("path",{d:"M7 14l5-5 5 5H7z"}):"desc"===e?(0,d.jsx)("path",{d:"M7 10l5 5 5-5H7z"}):(0,d.jsx)("path",{d:"M7 10l5 5 5-5H7zM7 14l5-5 5 5H7z",opacity:"0.4"})})}sn.displayName="TkxAvatar";var cn=(0,a.forwardRef)(({orientation:e="horizontal",label:t,variant:n="solid",className:r,style:o,...i},a)=>{const l=J(),s=t?pe(t):void 0,c="vertical"===e,u=c?"borderLeft":"borderTop",p=`1px ${n} ${l.border}`;return s?(0,d.jsxs)("div",{role:"separator","aria-orientation":e,className:Ct($t("flex items-center gap-3 text-xs"),r),style:{color:l.textMuted,...o},...i,children:[(0,d.jsx)("hr",{className:$t("flex-1 m-0 border-none"),style:{[u]:p}}),(0,d.jsx)("span",{children:s}),(0,d.jsx)("hr",{className:$t("flex-1 m-0 border-none"),style:{[u]:p}})]}):(0,d.jsx)("hr",{ref:a,role:"separator","aria-orientation":e,className:Ct($t(c?"inline-block self-stretch border-none w-0 h-full":"w-full border-none m-0"),r),style:{[u]:p,...o},...i})});cn.displayName="TkxDivider";var un={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 pn(e){return void 0===e?[]:Array.isArray(e)?e:[e]}function hn({size:e,color:t}){return(0,d.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:"2.5",strokeLinecap:"round","aria-hidden":"true",style:{animation:"tkx-spin 0.7s linear infinite"},children:[(0,d.jsx)("style",{children:"@keyframes tkx-spin{to{transform:rotate(360deg)}}"}),(0,d.jsx)("path",{d:"M12 2a10 10 0 0 1 10 10"})]})}function fn({options:e,value:t,defaultValue:n,placeholder:r,size:o="md",isDisabled:i=!1,isInvalid:l=!1,label:s,hint:u,errorMessage:p,multiple:h=!1,searchable:f=!1,clearable:m=!1,isLoading:g=!1,onChange:x,renderOption:y,maxMenuHeight:b=280,virtualScroll:v,optionHeight:w=36,id:k,className:$,style:S}){const C=J(),z=_t(),M=r??z.selectPlaceholder,N=(0,a.useId)(),D=k??N,R=`${D}-listbox`,P=`${D}-hint`,F=`${D}-error`,A=void 0!==t,[I,L]=(0,a.useState)(pn(n)),T=A?pn(t):I,[W,j]=(0,a.useState)(!1),[E,B]=(0,a.useState)(""),[V,H]=(0,a.useState)(-1),[O,q]=(0,a.useState)(null),[U,K]=(0,a.useState)(""),Y=(0,a.useRef)(null),Z=(0,a.useRef)(null),X=(0,a.useRef)(null),G=(0,a.useRef)(null),_=(0,a.useRef)(null),Q=un[o],ee=l||!!p,te=(0,a.useRef)(null),[ne,re]=(0,a.useState)(0),[oe,ie]=(0,a.useState)(0),ae=(0,a.useCallback)(()=>{te.current&&re(te.current.scrollTop)},[]);(0,a.useEffect)(()=>{if(!W)return void re(0);const e=te.current;if(!e)return;ie(e.clientHeight);const t=new ResizeObserver(()=>{ie(e.clientHeight)});return t.observe(e),()=>t.disconnect()},[W]);const le=f&&E?e.filter(e=>e.label.toLowerCase().includes(E.toLowerCase())):e,se=le.filter(e=>!e.disabled),de=le.some(e=>!!e.group),ce=(void 0!==v?v:le.length>=100)&&!de,ue=le.length*w,he=ce?Math.max(0,Math.floor(ne/w)-8):0,fe=ce?Math.min(le.length,Math.ceil((ne+oe)/w)+8):le.length,me=ce?le.slice(he,fe):le,ge=he*w,xe=le.reduce((e,t)=>{const n=t.group??"";return e[n]||(e[n]=[]),e[n].push(t),e},{}),ye=(0,a.useCallback)(e=>{let t;t=h?T.includes(e)?T.filter(t=>t!==e):[...T,e]:[e],A||L(t),x?.(h?t:t[0]??""),h||(j(!1),B(""),H(-1),Z.current?.focus())},[A,h,x,T]),be=(0,a.useCallback)((e,t)=>{t.stopPropagation();const n=T.filter(t=>t!==e);A||L(n),x?.(h?n:n[0]??"")},[A,h,x,T]),ve=(0,a.useCallback)(e=>{e.stopPropagation(),A||L([]),x?.(h?[]:"")},[A,h,x]),we=(0,a.useCallback)(()=>{Z.current&&W&&q(function(e,t){const n=e.getBoundingClientRect(),r=window.innerHeight-n.bottom-6,o=n.top-6,i=r>=Math.min(t,200)||r>=o?"below":"above";return{top:"below"===i?n.bottom+window.scrollY+6:n.top+window.scrollY-6-Math.min(t,280),left:n.left+window.scrollX,width:n.width,placement:i}}(Z.current,b))},[W,b]);function ke(){if(i||g)return;j(!0);const e=se.findIndex(e=>T.includes(e.value));H(e>=0?e:0)}(0,a.useEffect)(()=>{if(W)return we(),window.addEventListener("scroll",we,!0),window.addEventListener("resize",we),()=>{window.removeEventListener("scroll",we,!0),window.removeEventListener("resize",we)}},[W,we]),(0,a.useEffect)(()=>{if(!W)return;const e=e=>{const t=e.target;Z.current?.contains(t)||G.current?.contains(t)||(j(!1),B(""))};return document.addEventListener("pointerdown",e),()=>document.removeEventListener("pointerdown",e)},[W]),(0,a.useEffect)(()=>{W&&f&&setTimeout(()=>X.current?.focus(),0)},[W,f]),(0,a.useEffect)(()=>{if(W&&!(V<0))if(ce&&te.current){const e=V*w,t=e+w,n=te.current;e<n.scrollTop?n.scrollTop=e:t>n.scrollTop+n.clientHeight&&(n.scrollTop=t-n.clientHeight)}else(_.current?.querySelector(`[data-idx="${V}"]`))?.scrollIntoView({block:"nearest"})},[V,W,ce,w]);const $e=ee?C.danger:W?C.primary:C.border,Se=V>=0&&se[V]?`${D}-opt-${se[V].value}`:void 0,Ce=[u&&P,ee&&F].filter(Boolean).join(" ")||void 0,ze=T.map(t=>e.find(e=>e.value===t)).filter(Boolean),Me=W&&O?(0,c.createPortal)((0,d.jsxs)("div",{ref:G,role:"listbox",id:R,"aria-label":s?pe(s):"Options","aria-multiselectable":h,style:{position:"absolute",top:O.top,left:O.left,width:O.width,zIndex:9999,backgroundColor:C.surface,border:`1.5px solid ${C.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:O.width,maxHeight:b,display:"flex",flexDirection:"column"},children:[f&&(0,d.jsxs)("div",{style:{padding:"8px 10px",borderBottom:`1px solid ${C.border}`,flexShrink:0,display:"flex",alignItems:"center",gap:6},children:[(0,d.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:C.textMuted,strokeWidth:"2","aria-hidden":"true",style:{flexShrink:0},children:[(0,d.jsx)("circle",{cx:"11",cy:"11",r:"8"}),(0,d.jsx)("path",{d:"M21 21l-4.35-4.35"})]}),(0,d.jsx)("input",{ref:X,type:"text",value:E,onChange:e=>{B(e.target.value),H(0)},onKeyDown:e=>{switch(e.key){case"Escape":e.preventDefault(),j(!1),B(""),Z.current?.focus();break;case"ArrowDown":e.preventDefault(),H(e=>Math.min(e+1,se.length-1));break;case"ArrowUp":e.preventDefault(),H(e=>Math.max(e-1,0));break;case"Home":e.preventDefault(),H(0);break;case"End":e.preventDefault(),H(se.length-1);break;case"Enter":e.preventDefault(),V>=0&&se[V]&&ye(se[V].value)}},placeholder:`${z.search}…`,"aria-label":`${z.search} options`,style:{border:"none",outline:"none",background:"transparent",color:C.text,fontSize:Q.fontSize,fontFamily:"inherit",width:"100%"}})]}),(0,d.jsx)("div",{ref:e=>{_.current=e,te.current=e},onScroll:ce?ae:void 0,style:{overflowY:"auto",flexGrow:1,maxHeight:b-(f?48:0)},children:ce?(0,d.jsxs)("div",{style:{height:ue,position:"relative"},children:[(0,d.jsx)("div",{style:{position:"absolute",top:ge,left:0,right:0},children:me.map(e=>{const t=se.indexOf(e),n=t===V,r=T.includes(e.value),o=y?y(e,r):(0,d.jsxs)("span",{style:{display:"flex",flexDirection:"column",flex:1,minWidth:0},children:[(0,d.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:8},children:[e.icon&&(0,d.jsx)("span",{style:{flexShrink:0,display:"flex"},children:e.icon}),(0,d.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:pe(e.label)})]}),e.description&&(0,d.jsx)("span",{style:{fontSize:"12px",color:C.textMuted,marginTop:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:pe(e.description)})]});return(0,d.jsxs)("div",{id:`${D}-opt-${e.value}`,"data-idx":t>=0?t:void 0,role:"option","aria-selected":r,"aria-disabled":e.disabled||void 0,onClick:()=>!e.disabled&&ye(e.value),onMouseEnter:()=>!e.disabled&&t>=0&&H(t),style:{height:w,boxSizing:"border-box",padding:`0 ${Q.px}`,fontSize:Q.fontSize,fontFamily:"inherit",color:e.disabled?C.textMuted:C.text,backgroundColor:n?`${C.primary}22`:r?`${C.primary}12`:"transparent",cursor:e.disabled?"not-allowed":"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,transition:"background-color 80ms",opacity:e.disabled?.5:1,userSelect:"none",touchAction:"manipulation"},children:[o,r&&!y&&(0,d.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:C.primary,strokeWidth:"2.5","aria-hidden":"true",style:{flexShrink:0},children:(0,d.jsx)("path",{d:"M20 6L9 17l-5-5"})})]},e.value)})}),0===le.length&&(0,d.jsx)("div",{style:{padding:`${Q.py} ${Q.px}`,fontSize:Q.fontSize,fontFamily:"inherit",color:C.textMuted,textAlign:"center",position:"absolute",top:0,left:0,right:0},children:g?"Loading…":"No options found"})]}):(0,d.jsxs)(d.Fragment,{children:[Object.entries(xe).map(([e,t])=>(0,d.jsxs)("div",{children:[e&&(0,d.jsx)("div",{"aria-hidden":"true",style:{padding:"8px 12px 4px",fontSize:"11px",fontWeight:700,letterSpacing:"0.08em",textTransform:"uppercase",color:C.textMuted,fontFamily:"inherit",position:"sticky",top:0,backgroundColor:C.surface,zIndex:1,borderBottom:`1px solid ${C.border}`},children:pe(e)}),t.map(e=>{const t=se.indexOf(e),n=t===V,r=T.includes(e.value),o=y?y(e,r):(0,d.jsxs)("span",{style:{display:"flex",flexDirection:"column",flex:1,minWidth:0},children:[(0,d.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:8},children:[e.icon&&(0,d.jsx)("span",{style:{flexShrink:0,display:"flex"},children:e.icon}),(0,d.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:pe(e.label)})]}),e.description&&(0,d.jsx)("span",{style:{fontSize:"12px",color:C.textMuted,marginTop:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:pe(e.description)})]});return(0,d.jsxs)("div",{id:`${D}-opt-${e.value}`,"data-idx":t>=0?t:void 0,role:"option","aria-selected":r,"aria-disabled":e.disabled||void 0,onClick:()=>!e.disabled&&ye(e.value),onMouseEnter:()=>!e.disabled&&t>=0&&H(t),style:{padding:`${Q.py} ${Q.px}`,fontSize:Q.fontSize,fontFamily:"inherit",color:e.disabled?C.textMuted:C.text,backgroundColor:n?`${C.primary}22`:r?`${C.primary}12`:"transparent",cursor:e.disabled?"not-allowed":"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,transition:"background-color 80ms",opacity:e.disabled?.5:1,userSelect:"none",touchAction:"manipulation"},children:[o,r&&!y&&(0,d.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:C.primary,strokeWidth:"2.5","aria-hidden":"true",style:{flexShrink:0},children:(0,d.jsx)("path",{d:"M20 6L9 17l-5-5"})})]},e.value)})]},e)),0===le.length&&(0,d.jsx)("div",{style:{padding:`${Q.py} ${Q.px}`,fontSize:Q.fontSize,fontFamily:"inherit",color:C.textMuted,textAlign:"center"},children:g?"Loading…":"No options found"})]})})]}),document.body):null,Ne=m&&T.length>0&&!i&&!g;return(0,d.jsxs)("div",{className:Ct($t("flex flex-col gap-1 w-full"),$),style:S,children:[s&&(0,d.jsx)("label",{htmlFor:D,style:{fontSize:"14px",fontWeight:500,fontFamily:"inherit",color:C.text,userSelect:"none"},children:pe(s)}),(0,d.jsx)("div",{style:{position:"relative",width:"100%",opacity:i?.55:1},children:(0,d.jsxs)("button",{ref:Z,id:D,type:"button",role:"combobox","aria-haspopup":"listbox","aria-expanded":W,"aria-controls":R,"aria-activedescendant":Se,"aria-invalid":ee||void 0,"aria-describedby":Ce,"aria-multiselectable":h,disabled:i,onClick:()=>W?j(!1):ke(),onKeyDown:e=>{switch(e.key){case"Enter":case" ":e.preventDefault(),W?V>=0&&se[V]&&ye(se[V].value):ke();break;case"Escape":e.preventDefault(),j(!1),B("");break;case"ArrowDown":e.preventDefault(),W?H(e=>Math.min(e+1,se.length-1)):ke();break;case"ArrowUp":e.preventDefault(),W?H(e=>Math.max(e-1,0)):ke();break;case"Home":e.preventDefault(),W&&H(0);break;case"End":e.preventDefault(),W&&H(se.length-1);break;default:1!==e.key.length||e.ctrlKey||e.metaKey||(W||ke(),function(e){Y.current&&clearTimeout(Y.current);const t=U+e.toLowerCase();K(t);const n=se.findIndex(e=>e.label.toLowerCase().startsWith(t));n>=0&&H(n),Y.current=setTimeout(()=>K(""),800)}(e.key))}},style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:h&&T.length>0?`4px ${Q.px}`:`${Q.py} ${Q.px}`,fontSize:Q.fontSize,fontFamily:"inherit",backgroundColor:C.surface,color:T.length>0?C.text:C.textMuted,border:`1.5px solid ${$e}`,borderRadius:8,boxSizing:"border-box",transition:"border-color 150ms",textAlign:"left",cursor:i?"not-allowed":"pointer",outline:"none",minHeight:"sm"===o?34:"lg"===o?50:42,flexWrap:"wrap",touchAction:"manipulation"},children:[(0,d.jsx)("span",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:4,flex:1,minWidth:0},children:h&&ze.length>0?ze.map(e=>(0,d.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:4,padding:`${Q.tagPy} ${Q.tagPx}`,fontSize:`calc(${Q.fontSize} - 1px)`,fontFamily:"inherit",backgroundColor:`${C.primary}22`,color:C.primary,borderRadius:6,border:`1px solid ${C.primary}44`,lineHeight:1.4,maxWidth:150,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[(0,d.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:110},children:pe(e.label)}),(0,d.jsx)("span",{role:"button","aria-label":`Remove ${pe(e.label)}`,tabIndex:-1,onClick:t=>be(e.value,t),style:{cursor:"pointer",flexShrink:0,display:"flex",alignItems:"center",opacity:.8},children:(0,d.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M18 6L6 18M6 6l12 12"})})})]},e.value)):!h&&T.length>0?(()=>{const t=e.find(e=>e.value===T[0]);return(0,d.jsxs)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"flex",alignItems:"center",gap:6},children:[t?.icon&&(0,d.jsx)("span",{style:{flexShrink:0,display:"flex"},children:t.icon}),t?pe(t.label):""]})})():(0,d.jsx)("span",{style:{opacity:.6},children:pe(M)})}),(0,d.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:4,flexShrink:0,color:C.textMuted},children:[g&&(0,d.jsx)(hn,{size:Q.iconSize,color:C.primary}),Ne&&!g&&(0,d.jsx)("span",{role:"button","aria-label":z.clearSelection,tabIndex:-1,onClick:ve,style:{cursor:"pointer",display:"flex",alignItems:"center",lineHeight:1,opacity:.7,transition:"opacity 120ms"},onMouseEnter:e=>e.currentTarget.style.opacity="1",onMouseLeave:e=>e.currentTarget.style.opacity="0.7",children:(0,d.jsx)("svg",{width:Q.iconSize,height:Q.iconSize,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M18 6L6 18M6 6l12 12"})})}),(0,d.jsx)("svg",{width:Q.iconSize,height:Q.iconSize,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",style:{transform:W?"rotate(180deg)":"rotate(0deg)",transition:"transform 150ms",flexShrink:0},children:(0,d.jsx)("path",{d:"M6 9l6 6 6-6"})})]})]})}),u&&!ee&&(0,d.jsx)("span",{id:P,style:{fontSize:"12px",color:C.textMuted,fontFamily:"inherit"},children:pe(u)}),ee&&p&&(0,d.jsxs)("span",{id:F,role:"alert",style:{fontSize:"12px",color:C.danger,display:"flex",alignItems:"center",gap:4,fontFamily:"inherit"},children:[(0,d.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.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"})}),pe(p)]}),Me]})}fn.displayName="TkxSelect";var mn={sm:{box:16,fontSize:"13px",iconStroke:2.5},md:{box:20,fontSize:"14px",iconStroke:2.5},lg:{box:24,fontSize:"15px",iconStroke:2}},gn=(0,a.forwardRef)(({label:e,hint:t,isInvalid:n,errorMessage:r,isIndeterminate:o=!1,size:i="md",colorScheme:l="primary",checked:s,defaultChecked:c,onChange:u,disabled:p,className:h,style:f,id:m,...g},x)=>{const y=J(),b=qe(),v=(0,a.useId)(),w=m??v,k=`${w}-hint`,$=`${w}-error`,S=(0,a.useRef)(null),[C,z]=(0,a.useState)(!1),M=mn[i],N=n||!!r,D={primary:y.primary,success:y.success,danger:y.danger,warning:y.warning}[l]??y.primary,R=void 0!==s?s:void 0;(0,a.useEffect)(()=>{const e=x?.current??S.current;e&&(e.indeterminate=o)},[o,x]);const P=o||(R??!1),F=P?D:y.surface,A=N?y.danger:P?D:y.border,I=j(D),L=C?{outline:`2px solid ${D}`,outlineOffset:"2px"}:{},T=[t&&k,N&&$].filter(Boolean).join(" ")||void 0,W=!b&&P?{animation:"tkx-check-scale-in 120ms ease forwards"}:{};return(0,d.jsxs)("div",{className:Ct($t("flex flex-col gap-1"),h),style:{opacity:p?.5:1,...f},children:[(0,d.jsx)("style",{children:"\n @keyframes tkx-check-scale-in {\n from { transform: scale(0.4); opacity: 0; }\n to { transform: scale(1); opacity: 1; }\n }\n "}),(0,d.jsxs)("label",{htmlFor:w,className:$t("flex items-center gap-2 select-none"),style:{cursor:p?"not-allowed":"pointer",fontFamily:"inherit"},children:[(0,d.jsx)("input",{ref:e=>{S.current=e,"function"==typeof x?x(e):x&&(x.current=e)},id:w,type:"checkbox",checked:s,defaultChecked:c,onChange:u,disabled:p,"aria-invalid":N,"aria-describedby":T,onFocus:e=>{e.target.matches(":focus-visible")&&z(!0)},onBlur:()=>z(!1),className:$t("sr-only"),...g}),(0,d.jsx)("span",{"aria-hidden":"true",style:{width:M.box,height:M.box,minWidth:M.box,borderRadius:"4px",border:`2px solid ${A}`,backgroundColor:F,display:"flex",alignItems:"center",justifyContent:"center",transition:b?"none":"background-color 120ms, border-color 120ms",boxSizing:"border-box",...L},children:o?(0,d.jsx)("span",{"aria-hidden":"true",style:{display:"block",width:.5*M.box,height:2,backgroundColor:I,borderRadius:"1px",...W}}):P?(0,d.jsx)("svg",{width:.6*M.box,height:.6*M.box,viewBox:"0 0 24 24",fill:"none",stroke:I,strokeWidth:M.iconStroke,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:W,children:(0,d.jsx)("path",{d:"M20 6L9 17l-5-5"})}):null}),e&&(0,d.jsx)("span",{style:{fontSize:M.fontSize,color:y.text,lineHeight:1.4},children:"string"==typeof e?pe(e):e})]}),t&&!N&&(0,d.jsx)("span",{id:k,className:$t("text-xs ml-7"),style:{color:y.textMuted,marginLeft:M.box+8},children:pe(t)}),N&&r&&(0,d.jsxs)("span",{id:$,role:"alert",className:$t("text-xs flex items-center gap-1"),style:{color:y.danger,marginLeft:M.box+8},children:[(0,d.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.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"})}),pe(r)]})]})});gn.displayName="TkxCheckbox";var xn=(0,a.createContext)(null),yn={sm:{outer:16,inner:7,fontSize:"13px"},md:{outer:20,inner:9,fontSize:"14px"},lg:{outer:24,inner:11,fontSize:"15px"}},bn=(0,a.forwardRef)(({label:e,hint:t,size:n="md",colorScheme:r="primary",value:o,checked:i,onChange:l,disabled:s,name:c,className:u,style:p,id:h,...f},m)=>{const g=J(),x=qe(),y=(0,a.useId)(),b=h??y,v=(0,a.useContext)(xn),w=v?v.value===String(o??""):i??!1,k=s??v?.isDisabled??!1,$=c??v?.name??"",S=yn[n],C={primary:g.primary,success:g.success,danger:g.danger}[r]??g.primary;j(C);const z=w?C:g.border,M=g.surface;return(0,d.jsxs)("div",{className:Ct($t("flex flex-col gap-0.5"),u),style:{opacity:k?.5:1,...p},children:[(0,d.jsx)("style",{children:"\n @keyframes tkx-radio-dot-in {\n from { transform: scale(0) translate(-50%, -50%); opacity: 0; }\n to { transform: scale(1) translate(-50%, -50%); opacity: 1; }\n }\n "}),(0,d.jsxs)("label",{htmlFor:b,className:$t("flex items-center gap-2 select-none"),style:{cursor:k?"not-allowed":"pointer",fontFamily:"inherit"},children:[(0,d.jsx)("input",{ref:m,id:b,type:"radio",name:$,value:o,checked:w,onChange:()=>{k||(v?v.onChange(String(o??"")):l?.({target:{value:String(o??"")}}))},disabled:k,"aria-invalid":v?.isInvalid,className:$t("sr-only"),...f}),(0,d.jsx)("span",{"aria-hidden":"true",style:{position:"relative",width:S.outer,height:S.outer,minWidth:S.outer,borderRadius:"50%",border:`2px solid ${z}`,backgroundColor:M,display:"inline-block",boxSizing:"border-box",transition:x?"none":"border-color 120ms"},children:w&&(0,d.jsx)("span",{"aria-hidden":"true",style:{position:"absolute",top:"50%",left:"50%",width:S.inner,height:S.inner,borderRadius:"50%",backgroundColor:C,transform:"translate(-50%, -50%)",transformOrigin:"center",...x?{}:{animation:"tkx-radio-dot-in 130ms ease forwards"}}})}),e&&(0,d.jsx)("span",{style:{fontSize:S.fontSize,color:g.text,lineHeight:1.4},children:"string"==typeof e?pe(e):e})]}),t&&(0,d.jsx)("span",{className:$t("text-xs"),style:{color:g.textMuted,marginLeft:S.outer+8},children:pe(t)})]})});bn.displayName="TkxRadio";var vn=[],wn=[],kn=new Set,$n=new Map;function Sn(){const e=[...wn];kn.forEach(t=>t(e))}function Cn(e,t){0!==t&&$n.set(e,setTimeout(()=>zn(e),t))}function zn(e){clearTimeout($n.get(e)),$n.delete(e);const t=wn.some(t=>t.id===e);if(wn=wn.filter(t=>t.id!==e),vn=vn.filter(t=>t.id!==e),t&&vn.length>0&&wn.length<5){const e=vn.shift();wn=[...wn,e],Cn(e.id,e.duration??4e3)}Sn()}var Mn={default:(0,d.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"})}),success:(0,d.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm-2 14.5l-4-4 1.41-1.41L10 13.67l6.59-6.59L18 8.5l-8 8z"})}),danger:(0,d.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),warning:(0,d.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"})}),info:(0,d.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.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"})})},Nn={"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 Dn(e,t){return t?{}:{animation:`tkx-toast-slide-${e.startsWith("top")?"down":"up"} 220ms cubic-bezier(0.16,1,0.3,1) both`}}function Rn({toast:e,position:t,onDismiss:n,reduced:r}){const o=J(),i=_t(),l=(0,a.useId)(),s={default:o.textMuted,success:o.success,danger:o.danger,warning:o.warning,info:o.info},c=e.variant??"default",u=s[c],p="danger"===c,h=e.title?pe(e.title):void 0,f=e.description?pe(e.description):void 0;return(0,d.jsxs)("div",{role:p?"alert":"status","aria-live":p?"assertive":"polite","aria-atomic":"true","aria-labelledby":h?l:void 0,className:$t("flex items-start gap-3 px-4 py-3 rounded-lg shadow-lg font-sans min-w-[280px] max-w-[380px]"),style:{backgroundColor:o.surface,border:`1px solid ${u}55`,boxShadow:`0 8px 24px ${o.bg}cc`,color:o.text,...Dn(t,r)},children:[(0,d.jsx)("span",{className:$t("shrink-0 mt-[2px]"),style:{color:u},children:Mn[c]}),(0,d.jsxs)("div",{className:$t("flex-1 min-w-0"),children:[h&&(0,d.jsx)("p",{id:l,className:$t("m-0 font-semibold text-sm leading-snug"),children:h}),f&&(0,d.jsx)("p",{className:$t("m-0 text-xs mt-[2px] leading-relaxed"),style:{color:o.textMuted},children:f}),e.action&&(0,d.jsx)("button",{onClick:()=>{e.action.onClick(),n(e.id)},className:$t("border-none bg-transparent cursor-pointer p-0 mt-2 text-xs font-semibold focus-visible:focus-ring"),style:{color:u},children:pe(e.action.label)})]}),(0,d.jsx)("button",{"aria-label":i.close,onClick:()=>n(e.id),className:$t("bg-transparent border-none cursor-pointer rounded p-[2px] shrink-0 flex items-center justify-center focus-visible:focus-ring"),style:{color:o.textMuted},children:(0,d.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:[(0,d.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,d.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})}var Pn={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 Fn({open:e,reduced:t,iconStyle:n,size:r,color:o}){const i=t?"none":"transform 240ms cubic-bezier(0.4, 0, 0.2, 1)";return"chevron"===n?(0,d.jsx)("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:o,strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{transform:e?"rotate(180deg)":"rotate(0deg)",transition:i,flexShrink:0},children:(0,d.jsx)("polyline",{points:"6 9 12 15 18 9"})}):"plus"===n?(0,d.jsxs)("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:o,strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{transform:e?"rotate(45deg)":"rotate(0deg)",transition:i,flexShrink:0},children:[(0,d.jsx)("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),(0,d.jsx)("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}):(0,d.jsxs)("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:o,strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{transform:e?"rotate(90deg)":"rotate(0deg)",transition:i,flexShrink:0},children:[(0,d.jsx)("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),(0,d.jsx)("polyline",{points:"12 5 19 12 12 19"})]})}function An({isOpen:e,reduced:t,children:n,id:r,triggerId:o}){const i=(0,a.useRef)(null),l=(0,a.useRef)(null),s=(0,a.useRef)(e),c=(0,a.useRef)(!1);return(0,a.useEffect)(()=>{const t=i.current;t&&(e?(t.style.height="auto",t.style.overflow="visible"):(t.style.height="0px",t.style.overflow="hidden"))},[]),(0,a.useEffect)(()=>{if(s.current===e)return;s.current=e;const n=i.current,r=l.current;if(n&&r){if(t)return n.style.height=e?"auto":"0px",void(n.style.overflow=e?"visible":"hidden");if(c.current){const e=n.getBoundingClientRect().height;n.style.transition="none",n.style.height=`${e}px`,n.offsetHeight}c.current=!0,n.style.overflow="hidden",e?(n.style.height="0px",n.style.transition="height 280ms cubic-bezier(0.4, 0, 0.2, 1)",requestAnimationFrame(()=>{requestAnimationFrame(()=>{n.style.height=`${r.scrollHeight}px`})})):(n.style.height=`${r.scrollHeight}px`,n.style.transition="height 280ms cubic-bezier(0.4, 0, 0.2, 1)",requestAnimationFrame(()=>{requestAnimationFrame(()=>{n.style.height="0px"})}))}},[e,t]),(0,d.jsx)("div",{ref:i,id:r,role:"region","aria-labelledby":o,onTransitionEnd:t=>{if("height"!==t.propertyName)return;c.current=!1;const n=i.current;n&&(e?(n.style.height="auto",n.style.overflow="visible"):n.style.overflow="hidden")},style:{willChange:"height"},children:(0,d.jsx)("div",{ref:l,children:n})})}function In({items:e,multiple:t=!1,defaultOpen:n,value:r,onChange:o,variant:i="default",size:l="md",iconPosition:s="right",iconStyle:c="chevron",flush:u=!1,className:p,style:h}){const f=J(),m=qe(),g=(0,a.useId)(),x=void 0!==r,y=e=>e?Array.isArray(e)?new Set(e):new Set([e]):new Set,[b,v]=(0,a.useState)(()=>y(n)),w=x?y(r):b,k=(0,a.useCallback)((e,n)=>{if(n)return;let i;if(!x)return void v(n=>{i=new Set(n),i.has(e)?i.delete(e):(t||i.clear(),i.add(e));const r=[...i];return o?.(t?r:r[0]??""),i});{const n=y(r);i=new Set(n),i.has(e)?i.delete(e):(t||i.clear(),i.add(e))}const a=[...i];o?.(t?a:a[0]??"")},[t,o,x,r]),$=Pn[l],S=(e,t,n)=>{if(u)return{};switch(i){case"default":case"bordered":return{borderBottom:n?"none":`1px solid ${f.border}`};case"separated":return{border:`1px solid ${f.border}`,borderRadius:"10px",overflow:"hidden",boxShadow:"0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04)"};default:return{}}},C="separated"===i;return(0,d.jsx)("div",{className:$t(p??""),style:{...u?{}:"bordered"===i?{border:`1px solid ${f.border}`,borderRadius:"10px",overflow:"hidden"}:{},display:C?"flex":void 0,flexDirection:C?"column":void 0,gap:C?"8px":void 0,...h},children:e.map((t,n)=>{const r=w.has(t.id),o=n===e.length-1,a=`${g}-trigger-${t.id}`,l=`${g}-panel-${t.id}`;return(0,d.jsxs)("div",{className:t.className,style:S(0,0,o),children:[(0,d.jsxs)("button",{id:a,type:"button",role:"button","aria-expanded":r,"aria-controls":l,disabled:t.disabled,onClick:()=>k(t.id,t.disabled),style:{width:"100%",display:"flex",alignItems:t.subtitle?"flex-start":"center",gap:"8px",padding:$.triggerPadding,border:"none",background:"transparent",cursor:t.disabled?"not-allowed":"pointer",textAlign:"left",fontFamily:"inherit",fontSize:$.fontSize,fontWeight:500,color:t.disabled?f.textMuted:f.text,opacity:t.disabled?.5:1,transition:m?"none":"background-color 160ms ease",outline:"none"},onMouseEnter:e=>{t.disabled||(e.currentTarget.style.backgroundColor=(e=>"ghost"===i||"flush"===i?e?`${f.primary}10`:`${f.surfaceAlt}80`:e?`${f.primary}0d`:`${f.surfaceAlt}60`)(r))},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=r?`${f.primary}0d`:"transparent"},onFocus:e=>{t.disabled||(e.currentTarget.style.outline=`2px solid ${f.primary}`,e.currentTarget.style.outlineOffset="2px")},onBlur:e=>{e.currentTarget.style.outline="none"},children:[t.icon&&(0,d.jsx)("span",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",flexShrink:0,color:f.primary,marginTop:t.subtitle?"1px":void 0},children:t.icon}),"left"===s&&(0,d.jsx)("span",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",flexShrink:0,color:r?f.primary:f.textMuted,marginTop:t.subtitle?"1px":void 0},children:(0,d.jsx)(Fn,{open:r,reduced:m,iconStyle:c,size:$.iconSize,color:r?f.primary:f.textMuted})}),(0,d.jsxs)("span",{style:{flex:1,minWidth:0},children:[(0,d.jsx)("span",{style:{display:"block",lineHeight:1.4},children:t.title}),t.subtitle&&(0,d.jsx)("span",{style:{display:"block",fontSize:$.subtitleSize,color:f.textMuted,fontWeight:400,marginTop:"2px",lineHeight:1.3},children:t.subtitle})]}),t.badge&&(0,d.jsx)("span",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",flexShrink:0},children:t.badge}),"right"===s&&(0,d.jsx)("span",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",flexShrink:0,color:r?f.primary:f.textMuted,marginTop:t.subtitle?"1px":void 0},children:(0,d.jsx)(Fn,{open:r,reduced:m,iconStyle:c,size:$.iconSize,color:r?f.primary:f.textMuted})})]}),(0,d.jsx)(An,{isOpen:r,reduced:m,id:l,triggerId:a,children:(0,d.jsx)("div",{style:{padding:$.contentPadding,fontSize:$.fontSize,lineHeight:1.6,color:f.textMuted,fontFamily:"inherit"},children:t.content})})]},t.id)})})}In.displayName="TkxAccordion";var Ln={sm:"280px",md:"380px",lg:"480px",xl:"600px",full:"100%"},Tn=0;function Wn(){--Tn<=0&&(Tn=0,document.body.style.overflow="")}function jn(){return(0,d.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:[(0,d.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,d.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}var En=["Su","Mo","Tu","We","Th","Fr","Sa"],Bn=["January","February","March","April","May","June","July","August","September","October","November","December"],Vn=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Hn(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function On(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())}function qn(e,t,n){return!(!t||!Hn(e,t))||!(!n||!Hn(e,n))}function Un(e,t="en-US",n){if(!e)return"";if(n){const t=String(e.getFullYear()),r=t.slice(-2),o=e.getMonth()+1,i=String(o).padStart(2,"0"),a=Vn[e.getMonth()],l=Bn[e.getMonth()],s=e.getDate(),d=String(s).padStart(2,"0");return n.replace(/YYYY/g,t).replace(/YY/g,r).replace(/MMMM/g,l).replace(/MMM/g,a).replace(/MM/g,i).replace(/\bM\b/g,String(o)).replace(/DD/g,d).replace(/\bD\b/g,String(s))}return e.toLocaleDateString(t,{month:"2-digit",day:"2-digit",year:"numeric"})}function Kn(e,t){return new Date(e,t+1,0).getDate()}function Yn(e){return 10*Math.floor(e/10)}function Zn({values:e,selected:t,onSelect:n,label:r,theme:o,format:i}){const l=(0,a.useRef)([]),s=(0,a.useRef)(null);(0,a.useEffect)(()=>{const e=l.current[t];e&&s.current&&e.scrollIntoView({block:"nearest"})},[t]);const c=i??(e=>String(e).padStart(2,"0"));return(0,d.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"4px"},children:[(0,d.jsx)("div",{style:{fontSize:"11px",fontWeight:600,color:o.textMuted,textTransform:"uppercase",letterSpacing:"0.05em"},children:r}),(0,d.jsx)("div",{ref:s,style:{height:"160px",overflowY:"auto",width:"52px",scrollbarWidth:"thin",border:`1px solid ${o.border}`,borderRadius:"8px",padding:"4px"},children:e.map(e=>{const r=e===t;return(0,d.jsx)("button",{ref:t=>{l.current[e]=t},type:"button",onClick:()=>n(e),style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"32px",borderRadius:"6px",border:"none",cursor:"pointer",fontSize:"13px",fontWeight:r?600:400,backgroundColor:r?o.primary:"transparent",color:r?o.bg:o.text,fontFamily:"monospace",transition:"background-color 100ms ease"},children:c(e)},e)})})]})}function Xn({year:e,month:t,today:n,mode:r,selectedDate:o,selectedRange:i,multiDates:a,hoverDate:l,focusedDate:s,isDateDisabled:c,onSelectDate:u,onHoverDate:p,onSetFocused:h,theme:f,locale:m}){const g=function(e,t){const n=new Date(e,t,1).getDay(),r=Kn(e,t),o=[],i=Kn(e,t-1);for(let l=n-1;l>=0;l--)o.push(new Date(e,t-1,i-l));for(let l=1;l<=r;l++)o.push(new Date(e,t,l));let a=1;for(;o.length<42;)o.push(new Date(e,t+1,a++));return o}(e,t);return(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:"2px",marginBottom:"4px"},children:En.map(e=>(0,d.jsx)("div",{style:{textAlign:"center",fontSize:"11px",fontWeight:600,color:f.textMuted,padding:"4px 0",textTransform:"uppercase",letterSpacing:"0.05em"},children:e},e))}),(0,d.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:"2px"},children:g.map((e,g)=>{const x=e.getMonth()===t,y=Hn(e,n),b=0===e.getDay()||6===e.getDay(),v=c(e),w="single"===r&&null!=o&&Hn(e,o),k="multiple"===r&&a.some(t=>Hn(t,e)),$="range"===r&&qn(e,i[0],null),S="range"===r&&qn(e,null,i[1]),C=$||S,z="range"===r&&i[0]&&!i[1]&&l?l:i[1],M="range"===r&&function(e,t,n){if(!t||!n)return!1;const r=On(e).getTime(),o=On(t).getTime(),i=On(n).getTime();return r>Math.min(o,i)&&r<Math.max(o,i)}(e,i[0],z),N="range"===r&&i[0]&&!i[1]&&l&&Hn(e,l),D=w||k||C,R=null!=s&&Hn(e,s);let P="transparent",F=x?b?`${f.text}cc`:f.text:`${f.textMuted}60`,A="none",I=400;return D||N?(P=f.primary,F=f.bg,I=600):M&&(P=`${f.primary}18`),y&&!D&&(A=`2px solid ${f.primary}`,I=600),v&&(F=`${f.textMuted}50`),R&&!D&&(A=`2px solid ${f.secondary}`),(0,d.jsx)("button",{type:"button","aria-label":e.toLocaleDateString(m,{weekday:"long",year:"numeric",month:"long",day:"numeric"}),"aria-pressed":D,"aria-disabled":v,disabled:v,onClick:()=>!v&&u(e),onMouseEnter:()=>p(e),onMouseLeave:()=>p(null),onFocus:()=>h(e),style:{width:"34px",height:"34px",borderRadius:"8px",backgroundColor:P,color:F,border:A,fontSize:"13px",fontWeight:I,cursor:v?"not-allowed":"pointer",opacity:v?.35:1,display:"flex",alignItems:"center",justifyContent:"center",fontFamily:"inherit",position:"relative",outline:"none",textDecoration:v?"line-through":"none",transition:"background-color 80ms ease"},children:e.getDate()},g)})})]})}function Gn({value:e,onChange:t,rangeValue:n,onRangeChange:r,multiValue:o,onMultiChange:i,mode:l="single",minDate:s,maxDate:u,disabledDates:p,locale:h="en-US",dateFormat:f,showTime:m=!1,timeValue:g,onTimeChange:x,showPresets:y=!1,customPresets:b,label:v,placeholder:w="MM/DD/YYYY",hint:k,isDisabled:$=!1,isInvalid:S=!1,errorMessage:C,numberOfMonths:z=1,id:M,className:N,style:D}){const R=J(),P=_t(),F=(0,a.useId)(),A=M??F,I=qe(),L=On(new Date),T=e=>e instanceof Date&&!Number.isNaN(e.getTime())?e:null,W=void 0!==e,[j,E]=(0,a.useState)(null),B=W?T(e):j,V=void 0!==n,[H,O]=(0,a.useState)([null,null]),q=V?(U=n,Array.isArray(U)?[T(U[0]),T(U[1])]:[null,null]):H;var U;const K=void 0!==o,[Y,Z]=(0,a.useState)([]),X=K?(o??[]).filter(e=>e instanceof Date&&!Number.isNaN(e.getTime())):Y,[G,_]=(0,a.useState)("start"),Q="range"===l||"single"===l&&m,[ee,te]=(0,a.useState)([null,null]),[ne,re]=(0,a.useState)(null),oe=B??q[0]??L,[ie,ae]=(0,a.useState)(oe.getFullYear()),[le,se]=(0,a.useState)(oe.getMonth()),[de,ce]=(0,a.useState)("day"),[ue,he]=(0,a.useState)({h:0,m:0}),fe=g??ue,[me,ge]=(0,a.useState)(!1),[xe,ye]=(0,a.useState)(()=>{if("single"===l)return Un(B,h,f);if("range"===l){const[e,t]=q;if(e&&t)return`${Un(e,h,f)} – ${Un(t,h,f)}`}return""}),[be,ve]=(0,a.useState)(null),[we,ke]=(0,a.useState)(null),[$e,Se]=(0,a.useState)({top:0,left:0,flipUp:!1}),[,Ce]=(0,a.useReducer)(e=>e+1,0),ze=(0,a.useRef)(null),Me=(0,a.useRef)(null),Ne=(0,a.useRef)(null),De=(0,a.useRef)(!1),Re=y?420:m?480:360;(0,a.useEffect)(()=>{if("single"===l)ye(Un(B,h,f));else if("range"===l){const[e,t]=q;ye(e&&t?`${Un(e,h,f)} – ${Un(t,h,f)}`:e?Un(e,h,f):"")}else"multiple"===l&&ye(X.length>0?`${X.length} date${1!==X.length?"s":""} selected`:"")},[B,q,X,l,h,f]);const Pe=(0,a.useCallback)(()=>{ze.current&&Se(function(e,t){const n=e.getBoundingClientRect(),r=window.innerHeight,o=window.scrollY,i=window.scrollX,a=r-n.bottom<t+8&&n.top>t+8;return{top:a?o+n.top-t-4:o+n.bottom+4,left:i+n.left,flipUp:a}}(ze.current,Re))},[Re]);(0,a.useEffect)(()=>{if(me)return Pe(),window.addEventListener("scroll",Pe,!0),window.addEventListener("resize",Pe),()=>{window.removeEventListener("scroll",Pe,!0),window.removeEventListener("resize",Pe)}},[me,Pe]),(0,a.useEffect)(()=>{if(!me)return;const e=e=>{ze.current?.contains(e.target)||Me.current?.contains(e.target)||ge(!1)};return document.addEventListener("pointerdown",e),()=>document.removeEventListener("pointerdown",e)},[me]),(0,a.useEffect)(()=>{if(!me)return;const e=e=>{"Escape"===e.key&&(ge(!1),De.current=!0,Ne.current?.focus())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[me]);const Fe=(0,a.useCallback)(e=>!!(s&&On(e)<On(s))||!!(u&&On(e)>On(u))||!!p&&("function"==typeof p?p(e):p.some(t=>Hn(t,e))),[s,u,p]),Ae=(0,a.useCallback)(e=>{if(!Fe(e)){if("single"===l)Q?re(e):(W||E(e),t?.(e),ye(Un(e,h,f)),ge(!1));else if("range"===l)if("start"===G){const t=[e,null];te(t),V||O(t),r?.(t),_("end")}else{const t=ee[0]??q[0],n=t&&e<t?[e,t]:[t,e];te(n),Q?_("start"):(V||O(n),r?.(n),_("start"),ge(!1))}else if("multiple"===l){const t=X.some(t=>Hn(t,e))?X.filter(t=>!Hn(t,e)):[...X,e];K||Z(t),i?.(t)}Ce()}},[l,Fe,W,V,K,t,r,i,G,ee,q,X,Q,h]),Ie=(0,a.useCallback)(()=>{if("single"===l){const e=ne??B;W||E(e),t?.(e)}else"range"===l&&(V||O(ee),r?.(ee));ge(!1),_("start")},[l,ne,ee,B,W,V,t,r]),Le=(0,a.useCallback)(()=>{re(null),te([null,null]),_("start"),ge(!1)},[]),Te=b??function(e){const t={today:e?.today??"Today",yesterday:e?.yesterday??"Yesterday",last7:e?.last7Days??"Last 7 days",last30:e?.last30Days??"Last 30 days",last90:"Last 90 days",thisWeek:"This week",lastWeek:"Last week",thisMonth:e?.thisMonth??"This month",lastMonth:e?.lastMonth??"Last month"};return[{label:t.today,getValue:()=>{const e=On(new Date);return[e,e]}},{label:t.yesterday,getValue:()=>{const e=On(new Date);return e.setDate(e.getDate()-1),[e,e]}},{label:t.last7,getValue:()=>{const e=On(new Date),t=new Date(e);return t.setDate(t.getDate()-6),[t,e]}},{label:t.last30,getValue:()=>{const e=On(new Date),t=new Date(e);return t.setDate(t.getDate()-29),[t,e]}},{label:t.last90,getValue:()=>{const e=On(new Date),t=new Date(e);return t.setDate(t.getDate()-89),[t,e]}},{label:t.thisWeek,getValue:()=>{const e=On(new Date),t=new Date(e);t.setDate(t.getDate()-t.getDay());const n=new Date(t);return n.setDate(n.getDate()+6),[t,n]}},{label:t.lastWeek,getValue:()=>{const e=On(new Date),t=new Date(e);t.setDate(t.getDate()-t.getDay()-1);const n=new Date(t);return n.setDate(n.getDate()-6),[n,t]}},{label:t.thisMonth,getValue:()=>{const e=new Date;return[new Date(e.getFullYear(),e.getMonth(),1),new Date(e.getFullYear(),e.getMonth()+1,0)]}},{label:t.lastMonth,getValue:()=>{const e=new Date;return[new Date(e.getFullYear(),e.getMonth()-1,1),new Date(e.getFullYear(),e.getMonth(),0)]}},{label:"This quarter",getValue:()=>{const e=new Date,t=Math.floor(e.getMonth()/3);return[new Date(e.getFullYear(),3*t,1),new Date(e.getFullYear(),3*t+3,0)]}},{label:"Last quarter",getValue:()=>{const e=new Date,t=Math.floor(e.getMonth()/3),n=0===t?3:t-1,r=0===t?e.getFullYear()-1:e.getFullYear();return[new Date(r,3*n,1),new Date(r,3*n+3,0)]}},{label:"This year",getValue:()=>{const e=(new Date).getFullYear();return[new Date(e,0,1),new Date(e,11,31)]}},{label:"Last year",getValue:()=>{const e=(new Date).getFullYear()-1;return[new Date(e,0,1),new Date(e,11,31)]}}]}(P),We=11===le?0:le+1,je=11===le?ie+1:ie,Ee=z>=2,Be=v?pe(v):void 0,Ve=k?pe(k):void 0,He=C?pe(C):void 0,Oe=pe(w),Ue="single"===l&&null!=B||"range"===l&&(null!=q[0]||null!=q[1])||"multiple"===l&&X.length>0,Ke="range"===l?Q?ee:q:[null,null],Ye=S?R.danger:me?R.primary:R.border,Ze=Array.from({length:24},(e,t)=>t),Xe=Array.from({length:60},(e,t)=>t),Ge=(0,d.jsxs)("div",{ref:Me,role:"dialog","aria-label":"Date picker","aria-modal":"false",onKeyDown:e=>{if("day"!==de)return;const t=be??B??L;let n=null;if("ArrowRight"===e.key)n=new Date(t.getFullYear(),t.getMonth(),t.getDate()+1);else if("ArrowLeft"===e.key)n=new Date(t.getFullYear(),t.getMonth(),t.getDate()-1);else if("ArrowDown"===e.key)n=new Date(t.getFullYear(),t.getMonth(),t.getDate()+7);else if("ArrowUp"===e.key)n=new Date(t.getFullYear(),t.getMonth(),t.getDate()-7);else if("Enter"===e.key&&be)return void Ae(be);n&&(e.preventDefault(),ve(n),n.getMonth()===le&&n.getFullYear()===ie||(se(n.getMonth()),ae(n.getFullYear())))},style:{position:"absolute",top:$e.top,left:$e.left,zIndex:9999,backgroundColor:R.surface,border:`1px solid ${R.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:Ee?"580px":"300px",maxWidth:Ee&&y?"780px":Ee?"620px":y?"520px":"300px",opacity:me?1:0,transform:me?"translateY(0) scale(1)":$e.flipUp?"translateY(4px) scale(0.98)":"translateY(-4px) scale(0.98)",transition:I?"none":"opacity 120ms ease, transform 120ms ease",fontFamily:"inherit"},children:[y&&"range"===l&&(0,d.jsxs)("div",{style:{width:"148px",flexShrink:0,borderRight:`1px solid ${R.border}`,padding:"8px 6px",overflowY:"auto",display:"flex",flexDirection:"column",gap:"1px"},children:[(0,d.jsx)("div",{style:{fontSize:"11px",fontWeight:600,color:R.textMuted,textTransform:"uppercase",letterSpacing:"0.07em",padding:"4px 8px 8px"},children:"Quick select"}),Te.map(e=>{const[t,n]=e.getValue(),o=Ke[0]&&Ke[1]&&Hn(Ke[0],t)&&Hn(Ke[1],n);return(0,d.jsx)("button",{type:"button",onClick:()=>(e=>{const[t,n]=e.getValue(),o=[t,n];te(o),V||O(o),r?.(o),ae(t.getFullYear()),se(t.getMonth()),_("start"),Q||ge(!1)})(e),style:{width:"100%",textAlign:"left",padding:"7px 10px",borderRadius:"7px",border:"none",cursor:"pointer",fontSize:"13px",backgroundColor:o?`${R.primary}20`:"transparent",color:o?R.primary:R.text,fontWeight:o?600:400,fontFamily:"inherit",transition:"background-color 80ms ease"},onMouseEnter:e=>{o||(e.currentTarget.style.backgroundColor=`${R.surfaceAlt}`)},onMouseLeave:e=>{o||(e.currentTarget.style.backgroundColor="transparent")},children:e.label},e.label)})]}),(0,d.jsxs)("div",{style:{flex:1,padding:"16px",display:"flex",flexDirection:"column",gap:"12px",minWidth:0},children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,d.jsx)("button",{type:"button","aria-label":"day"===de?"Previous month":"month"===de?"Previous year":"Previous decade",onClick:()=>{"day"===de?(0===le?(se(11),ae(e=>e-1)):se(e=>e-1),ce("day")):ae("month"===de?e=>e-1:e=>e-10)},style:{border:"none",background:"transparent",cursor:"pointer",color:R.textMuted,padding:"6px",borderRadius:"6px",display:"flex",alignItems:"center"},children:(0,d.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,d.jsx)("polyline",{points:"15 18 9 12 15 6"})})}),(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:["day"===de&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("button",{type:"button",onClick:()=>ce("month"),style:{border:"none",background:"transparent",cursor:"pointer",fontSize:"14px",fontWeight:600,color:R.text,padding:"4px 6px",borderRadius:"6px",fontFamily:"inherit"},children:Bn[le]}),(0,d.jsx)("button",{type:"button",onClick:()=>ce("year"),style:{border:"none",background:"transparent",cursor:"pointer",fontSize:"14px",fontWeight:600,color:R.text,padding:"4px 6px",borderRadius:"6px",fontFamily:"inherit"},children:ie}),Ee&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{style:{color:R.textMuted,fontSize:"14px"},children:"–"}),(0,d.jsxs)("span",{style:{fontSize:"14px",fontWeight:600,color:R.text},children:[Bn[We]," ",je]})]})]}),"month"===de&&(0,d.jsx)("button",{type:"button",onClick:()=>ce("year"),style:{border:"none",background:"transparent",cursor:"pointer",fontSize:"14px",fontWeight:600,color:R.text,padding:"4px 6px",borderRadius:"6px",fontFamily:"inherit"},children:ie}),"year"===de&&(0,d.jsxs)("span",{style:{fontSize:"14px",fontWeight:600,color:R.text},children:[Yn(ie),"–",Yn(ie)+9]})]}),(0,d.jsx)("button",{type:"button","aria-label":"day"===de?"Next month":"month"===de?"Next year":"Next decade",onClick:()=>{"day"===de?(11===le?(se(0),ae(e=>e+1)):se(e=>e+1),ce("day")):ae("month"===de?e=>e+1:e=>e+10)},style:{border:"none",background:"transparent",cursor:"pointer",color:R.textMuted,padding:"6px",borderRadius:"6px",display:"flex",alignItems:"center"},children:(0,d.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,d.jsx)("polyline",{points:"9 18 15 12 9 6"})})})]}),"day"===de&&(0,d.jsxs)("div",{style:{display:"flex",gap:"20px"},children:[(0,d.jsx)(Xn,{year:ie,month:le,today:L,mode:l,selectedDate:B,selectedRange:Ke,multiDates:X,hoverDate:we,focusedDate:be,isDateDisabled:Fe,onSelectDate:Ae,onHoverDate:ke,onSetFocused:ve,theme:R,locale:h}),Ee&&(0,d.jsx)(Xn,{year:je,month:We,today:L,mode:l,selectedDate:B,selectedRange:Ke,multiDates:X,hoverDate:we,focusedDate:be,isDateDisabled:Fe,onSelectDate:Ae,onHoverDate:ke,onSetFocused:ve,theme:R,locale:h})]}),"month"===de&&(0,d.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:"6px"},children:Vn.map((e,t)=>{const n=t===le;return(0,d.jsx)("button",{type:"button",onClick:()=>{se(t),ce("day")},style:{padding:"10px",borderRadius:"8px",border:t!==L.getMonth()||ie!==L.getFullYear()||n?"none":`2px solid ${R.primary}`,cursor:"pointer",fontSize:"13px",fontWeight:n?600:400,backgroundColor:n?R.primary:"transparent",color:n?R.bg:R.text,fontFamily:"inherit",transition:"background-color 80ms ease"},children:e},e)})}),"year"===de&&(0,d.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:"6px"},children:Array.from({length:12},(e,t)=>{const n=Yn(ie)-1+t,r=n===ie,o=n===L.getFullYear(),i=0===t||11===t;return(0,d.jsx)("button",{type:"button",onClick:()=>{ae(n),ce("month")},style:{padding:"10px 6px",borderRadius:"8px",border:o&&!r?`2px solid ${R.primary}`:"none",cursor:"pointer",fontSize:"13px",fontWeight:r?600:400,backgroundColor:r?R.primary:"transparent",color:r?R.bg:i?R.textMuted:R.text,fontFamily:"inherit",transition:"background-color 80ms ease",opacity:i?.5:1},children:n},n)})}),m&&"day"===de&&(0,d.jsxs)("div",{style:{borderTop:`1px solid ${R.border}`,paddingTop:"12px",display:"flex",alignItems:"flex-start",gap:"8px",justifyContent:"center"},children:[(0,d.jsx)(Zn,{values:Ze,selected:fe.h,onSelect:e=>{g||he(t=>({...t,h:e})),x?.({...fe,h:e})},label:"Hour",theme:R}),(0,d.jsx)("div",{style:{display:"flex",alignItems:"center",height:"40px",marginTop:"28px",fontSize:"16px",fontWeight:700,color:R.textMuted},children:":"}),(0,d.jsx)(Zn,{values:Xe,selected:fe.m,onSelect:e=>{g||he(t=>({...t,m:e})),x?.({...fe,m:e})},label:"Min",theme:R})]}),"multiple"===l&&"day"===de&&X.length>0&&(0,d.jsxs)("div",{style:{borderTop:`1px solid ${R.border}`,paddingTop:"8px",fontSize:"12px",color:R.textMuted,textAlign:"center"},children:[X.length," date",1!==X.length?"s":""," selected"]}),(0,d.jsxs)("div",{style:{borderTop:`1px solid ${R.border}`,paddingTop:"10px",display:"flex",alignItems:"center",justifyContent:Q?"space-between":"flex-start",gap:"8px"},children:[(0,d.jsx)("button",{type:"button",onClick:()=>{ae(L.getFullYear()),se(L.getMonth()),ce("day"),Ae(L)},style:{border:"none",background:"transparent",cursor:"pointer",fontSize:"13px",color:R.primary,fontWeight:500,padding:"6px 10px",borderRadius:"6px",fontFamily:"inherit"},children:"Today"}),Q&&(0,d.jsxs)("div",{style:{display:"flex",gap:"6px"},children:[(0,d.jsx)("button",{type:"button",onClick:Le,style:{padding:"6px 14px",borderRadius:"7px",border:`1px solid ${R.border}`,cursor:"pointer",fontSize:"13px",fontWeight:500,backgroundColor:"transparent",color:R.text,fontFamily:"inherit"},children:"Cancel"}),(0,d.jsx)("button",{type:"button",onClick:Ie,style:{padding:"6px 14px",borderRadius:"7px",border:"none",cursor:"pointer",fontSize:"13px",fontWeight:600,backgroundColor:R.primary,color:R.bg,fontFamily:"inherit"},children:"Apply"})]})]})]})]});return(0,d.jsxs)("div",{className:N,style:{display:"flex",flexDirection:"column",gap:"4px",width:"100%",position:"relative",...D},children:[Be&&(0,d.jsx)("label",{htmlFor:A,style:{fontSize:"13px",fontWeight:500,color:R.text,marginBottom:"2px"},children:Be}),(0,d.jsxs)("div",{ref:ze,style:{display:"flex",alignItems:"center",border:`1.5px solid ${Ye}`,borderRadius:"8px",backgroundColor:R.surface,overflow:"hidden",transition:I?"none":"border-color 120ms ease",opacity:$?.5:1},children:[(0,d.jsx)("span",{style:{display:"flex",alignItems:"center",paddingLeft:"10px",color:R.textMuted,flexShrink:0},children:(0,d.jsxs)("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,d.jsx)("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2"}),(0,d.jsx)("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),(0,d.jsx)("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),(0,d.jsx)("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]})}),(0,d.jsx)("input",{ref:Ne,id:A,type:"text",value:xe,placeholder:Oe,disabled:$,"aria-invalid":S,"aria-haspopup":"dialog","aria-expanded":me,readOnly:"range"===l||"multiple"===l,onChange:e=>(e=>{if(ye(e),"single"===l){const n=function(e,t){const n=e.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);if(n){const[,e,t,r]=n.map(Number);if(e>=1&&e<=12&&t>=1&&t<=31){const n=new Date(r,e-1,t);if(n.getMonth()===e-1)return n}}const r=e.match(/^(\d{4})-(\d{1,2})-(\d{1,2})$/);if(r){const[,e,t,n]=r.map(Number),o=new Date(e,t-1,n);if(o.getMonth()===t-1)return o}if(t&&/^DD/.test(t)){const t=e.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);if(t){const[,e,n,r]=t.map(Number),o=new Date(r,n-1,e);if(o.getMonth()===n-1)return o}}return null}(e,f);n&&!Fe(n)&&(W||E(n),t?.(n),ae(n.getFullYear()),se(n.getMonth()))}})(e.target.value),onFocus:()=>{$||(De.current?De.current=!1:ge(!0))},style:{flex:1,backgroundColor:"transparent",border:"none",outline:"none",fontSize:"14px",padding:"9px 8px",color:R.text,cursor:"single"!==l?"pointer":"text",fontFamily:"inherit",minWidth:0}}),Ue&&!$&&(0,d.jsx)("button",{type:"button","aria-label":"Clear selection",onClick:e=>{if(e.stopPropagation(),"single"===l)W||E(null),t?.(null),ye("");else if("range"===l){const e=[null,null];V||O(e),r?.(e),te(e),ye(""),_("start")}else"multiple"===l&&(K||Z([]),i?.([]),ye(""))},style:{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",border:"none",background:"transparent",cursor:"pointer",color:R.textMuted,flexShrink:0,borderRadius:"4px",marginRight:"4px"},children:(0,d.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,d.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,d.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),(0,d.jsx)("button",{type:"button","aria-label":me?"Close calendar":"Open calendar",tabIndex:-1,disabled:$,onClick:()=>{$||ge(e=>!e)},style:{display:"flex",alignItems:"center",justifyContent:"center",width:"34px",height:"36px",border:"none",background:"transparent",cursor:$?"not-allowed":"pointer",color:R.textMuted,flexShrink:0},children:(0,d.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:I?"none":"transform 160ms ease"},children:(0,d.jsx)("polyline",{points:"6 9 12 15 18 9"})})})]}),Ve&&!S&&(0,d.jsx)("span",{style:{fontSize:"12px",color:R.textMuted},children:Ve}),S&&He&&(0,d.jsx)("span",{role:"alert",style:{fontSize:"12px",color:R.danger},children:He}),me&&"undefined"!=typeof document&&(0,c.createPortal)(Ge,document.body)]})}Gn.displayName="TkxDatePicker";var _n={sm:{track:4,thumb:14,fontSize:"0.75rem"},md:{track:6,thumb:18,fontSize:"0.875rem"},lg:{track:8,thumb:22,fontSize:"1rem"}};function Jn(e,t,n){return Math.min(Math.max(e,t),n)}function Qn(e,t,n){return Math.round((e-t)/n)*n+t}function er(e,t,n){return(e-t)/(n-t)*100}function tr({value:e,min:t,max:n,step:r,isDisabled:o,trackColor:i,surfaceColor:l,disabledColor:s,thumbSize:c,ariaLabel:u,tooltipMode:p,formatValue:h,orientation:f,onChange:m,onChangeEnd:g}){const[x,y]=(0,a.useState)(!1),[b,v]=(0,a.useState)(!1),[w,k]=(0,a.useState)(!1),$="vertical"===f,S=er(e,t,n),C="always"===p||"hover"===p&&(w||b||x),z=$?{position:"absolute",bottom:`${S}%`,transform:"translateY(50%)",left:"50%",marginLeft:`-${c/2}px`,zIndex:2,cursor:o?"not-allowed":"grab"}:{position:"absolute",left:`${S}%`,transform:"translateX(-50%)",top:"50%",marginTop:`-${c/2}px`,zIndex:2,cursor:o?"not-allowed":"grab"},M=$?{position:"absolute",left:c+6,top:"50%",transform:"translateY(-50%)",backgroundColor:i,color:"#fff",borderRadius:"4px",padding:"2px 6px",fontSize:"0.75rem",whiteSpace:"nowrap",pointerEvents:"none"}:{position:"absolute",bottom:c+6,left:"50%",transform:"translateX(-50%)",backgroundColor:i,color:"#fff",borderRadius:"4px",padding:"2px 6px",fontSize:"0.75rem",whiteSpace:"nowrap",pointerEvents:"none"};return(0,d.jsxs)("div",{style:z,children:[C&&(0,d.jsx)("div",{style:M,children:h(e)}),(0,d.jsx)("div",{role:"slider",tabIndex:o?-1:0,"aria-label":u,"aria-valuemin":t,"aria-valuemax":n,"aria-valuenow":e,"aria-disabled":o,"aria-orientation":f,onKeyDown:i=>{o||("ArrowRight"===i.key||"ArrowUp"===i.key?(i.preventDefault(),m(Jn(Qn(e+r,t,r),t,n))):"ArrowLeft"===i.key||"ArrowDown"===i.key?(i.preventDefault(),m(Jn(Qn(e-r,t,r),t,n))):"Home"===i.key?(i.preventDefault(),m(t)):"End"===i.key&&(i.preventDefault(),m(n)))},onFocus:()=>y(!0),onBlur:()=>y(!1),onPointerEnter:()=>k(!0),onPointerLeave:()=>k(!1),onPointerDown:e=>{o||(v(!0),e.target.setPointerCapture(e.pointerId))},onPointerUp:()=>{v(!1),g?.()},style:{width:c,height:c,borderRadius:"50%",backgroundColor:o?s:i,border:`3px solid ${l}`,boxShadow:x?`0 0 0 3px ${i}44`:"0 1px 4px rgba(0,0,0,0.3)",outline:"none",display:"block",transition:"box-shadow 150ms ease"}})]})}function nr({value:e,defaultValue:t=0,onChange:n,rangeValue:r,onRangeChange:o,min:i=0,max:l=100,step:s=1,isRange:c=!1,label:u,showValue:p=!1,showTicks:h=!1,tickCount:f=5,isDisabled:m=!1,colorScheme:g="primary",size:x="md",marks:y,orientation:b="horizontal",showTooltip:v=!1,formatValue:w,onChangeEnd:k,onRangeChangeEnd:$,gradient:S=!1}){const C=J(),z=(0,a.useId)(),M=qe(),N=void 0!==e,[D,R]=(0,a.useState)(t),P=N?e:D,F=void 0!==r,[A,I]=(0,a.useState)([i,l]),L=F?r:A,T=(0,a.useRef)(null),W=(0,a.useRef)(P);W.current=P;const j=(0,a.useRef)(L);j.current=L;const E={primary:C.primary,success:C.success,danger:C.danger,warning:C.warning}[g],B=_n[x],V="vertical"===b,H=!0===v?"hover":!1!==v&&v,O=w??(e=>String(e)),q=E+"66",U=(0,a.useCallback)((e,t)=>{const n=T.current;if(!n)return i;const r=n.getBoundingClientRect();let o;return o=Jn(V?(r.bottom-(t??0))/r.height:(e-r.left)/r.width,0,1),Jn(Qn(o*(l-i)+i,i,s),i,l)},[i,l,s,V]),K=(0,a.useCallback)(e=>{if(m)return;const t=U(e.clientX,e.clientY);if(c){const[e,n]=L,r=Math.abs(t-e)<=Math.abs(t-n)?[t,n]:[e,t];F||I(r),o?.(r)}else N||R(t),n?.(t)},[m,c,N,F,U,n,o,L]),Y=c?er(L[0],i,l):0,Z=er(c?L[1]:P,i,l),X=h?Array.from({length:f},(e,t)=>i+t/(f-1)*(l-i)):[],G=u?pe(u):void 0,_=M?"none":"background 150ms ease";return(0,d.jsxs)("div",{className:$t("flex flex-col gap-2"),style:{opacity:m?.55:1,...V?{height:200,width:"auto",display:"inline-flex"}:{width:"100%"}},children:[(G||p)&&(0,d.jsxs)("div",{className:$t("flex items-center justify-between"),children:[G&&(0,d.jsx)("label",{htmlFor:z,className:$t("text-sm font-medium"),style:{color:C.text,fontSize:B.fontSize},children:G}),p&&!c&&(0,d.jsx)("span",{className:$t("text-sm tabular-nums"),style:{color:C.textMuted,fontSize:B.fontSize},children:O(P)}),p&&c&&(0,d.jsxs)("span",{className:$t("text-sm tabular-nums"),style:{color:C.textMuted,fontSize:B.fontSize},children:[O(L[0])," – ",O(L[1])]})]}),(0,d.jsxs)("div",{style:{position:"relative",...V?{paddingLeft:B.thumb/2,paddingRight:B.thumb/2,flex:1}:{paddingTop:B.thumb/2,paddingBottom:B.thumb/2}},children:[(0,d.jsxs)("div",{ref:T,onPointerDown:K,style:{position:"relative",...V?{width:B.track,height:"100%"}:{height:B.track},borderRadius:9999,backgroundColor:C.border,cursor:m?"not-allowed":"pointer",userSelect:"none",touchAction:"none"},children:[(0,d.jsx)("div",{style:{position:"absolute",...V?{left:0,bottom:`${Y}%`,height:Z-Y+"%",width:"100%"}:{top:0,left:`${Y}%`,width:Z-Y+"%",height:"100%"},borderRadius:9999,...m?{backgroundColor:C.textMuted}:S?{background:V?`linear-gradient(to top, ${q}, ${E})`:`linear-gradient(to right, ${q}, ${E})`}:{backgroundColor:E},transition:_}}),X.map((e,t)=>(0,d.jsx)("div",{style:{position:"absolute",...V?{bottom:`${er(e,i,l)}%`,left:"50%",transform:"translate(-50%, 50%)",height:3,width:B.track+4}:{left:`${er(e,i,l)}%`,top:"50%",transform:"translate(-50%, -50%)",width:3,height:B.track+4},backgroundColor:C.surface,borderRadius:9999,pointerEvents:"none"}},t)),c?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(tr,{value:L[0],min:i,max:L[1],step:s,isDisabled:m,trackColor:E,surfaceColor:C.surface,disabledColor:C.textMuted,trackHeight:B.track,thumbSize:B.thumb,ariaLabel:`${G??"Range"} start`,tooltipMode:H,formatValue:O,orientation:b,onChange:e=>{const t=[Jn(e,i,L[1]),L[1]];F||I(t),o?.(t)},onChangeEnd:$?()=>$(j.current):void 0}),(0,d.jsx)(tr,{value:L[1],min:L[0],max:l,step:s,isDisabled:m,trackColor:E,surfaceColor:C.surface,disabledColor:C.textMuted,trackHeight:B.track,thumbSize:B.thumb,ariaLabel:`${G??"Range"} end`,tooltipMode:H,formatValue:O,orientation:b,onChange:e=>{const t=[L[0],Jn(e,L[0],l)];F||I(t),o?.(t)},onChangeEnd:$?()=>$(j.current):void 0})]}):(0,d.jsx)(tr,{value:P,min:i,max:l,step:s,isDisabled:m,trackColor:E,surfaceColor:C.surface,disabledColor:C.textMuted,trackHeight:B.track,thumbSize:B.thumb,ariaLabel:G??"Slider",tooltipMode:H,formatValue:O,orientation:b,onChange:e=>{N||R(e),n?.(e)},onChangeEnd:k?()=>k(W.current):void 0})]}),y&&y.length>0&&(0,d.jsx)("div",{style:{position:V?"absolute":"relative",...V?{left:"100%",top:0,bottom:0,marginLeft:8}:{marginTop:8}},children:y.map((e,t)=>(0,d.jsx)("div",{style:{position:"absolute",...V?{bottom:`${er(e.value,i,l)}%`,transform:"translateY(50%)",left:0}:{left:`${er(e.value,i,l)}%`,transform:"translateX(-50%)"},fontSize:"0.6875rem",color:C.textMuted,whiteSpace:"nowrap"},children:pe(e.label)},t))})]}),h&&!y&&!V&&(0,d.jsx)("div",{style:{position:"relative",height:"1rem"},children:X.map((e,t)=>(0,d.jsx)("span",{style:{position:"absolute",left:`${er(e,i,l)}%`,transform:"translateX(-50%)",fontSize:"0.6875rem",color:C.textMuted},children:O(Math.round(e))},t))})]})}nr.displayName="TkxSlider";var rr={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 or({total:e,pageSize:t,page:n,defaultPage:r=1,onChange:o,siblingCount:i=1,showEdges:l=!0,showPageSize:s=!1,onPageSizeChange:c,pageSizeOptions:u=[10,25,50,100],size:p="md",variant:h="default"}){const f=J(),m=_t(),g=(0,a.useId)(),x={pagination:"Pagination",firstPage:m.firstPage??"First page",lastPage:m.lastPage??"Last page",previousPage:m.previousPage??"Previous page",nextPage:m.nextPage??"Next page",pageN:e=>`Page ${e}`,showing:(e,t,n)=>m.showingRange?m.showingRange(e,t,n):`Showing ${e}–${t} of ${n} items`},y=void 0!==n,[b,v]=(0,a.useState)(r),w=y?n:b,k=void 0!==t,[$,S]=(0,a.useState)(t??10),C=k?t:$,z=Math.max(1,Math.ceil(e/C)),M=e=>{const t=Math.min(Math.max(e,1),z);t!==w&&(y||v(t),o?.(t))},N=function(e,t,n,r){if(t<=1)return[1];const o=(e,t)=>Array.from({length:Math.max(0,t-e+1)},(t,n)=>e+n),i=Math.max(e-n,1),a=Math.min(e+n,t);if(!r){const e=[];return i>1&&e.push("..."),e.push(...o(i,a)),a<t&&e.push("..."),e}const l=i>3,s=a<t-2,d=[];d.push(1),l?d.push("left-ellipsis"):d.push(...o(2,i-1)),d.push(...o(Math.max(i,2),Math.min(a,t-1))),s?d.push("right-ellipsis"):d.push(...o(a+1,t-1)),t>1&&d.push(t);const c=new Set,u=[];for(const p of d)"number"==typeof p?c.has(p)||(c.add(p),u.push(p)):u.push(p);return u}(w,z,i,l),D=rr[p],R=Math.min((w-1)*C+1,e),P=Math.min(w*C,e),F=(e,t)=>{const n={height:D.height,minWidth:D.minWidth,paddingLeft:D.px,paddingRight:D.px,fontSize:D.fontSize,borderRadius:"8px",display:"inline-flex",alignItems:"center",justifyContent:"center",cursor:t?"not-allowed":"pointer",border:"none",outline:"none",fontFamily:"inherit",transition:"background 120ms ease, color 120ms ease",opacity:t?.4:1};return e?{...n,backgroundColor:f.primary,color:f.bg,fontWeight:600,boxShadow:`0 0 0 2px ${f.primary}44`}:"default"===h?{...n,backgroundColor:f.surface,color:f.text,border:`1px solid ${f.border}`}:"outline"===h?{...n,backgroundColor:"transparent",color:f.text,border:`1px solid ${f.border}`}:{...n,backgroundColor:"transparent",color:f.text}},A=({d:e})=>(0,d.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5","aria-hidden":"true",children:(0,d.jsx)("polyline",{points:e})});return(0,d.jsxs)("nav",{"aria-label":x.pagination,className:$t("flex flex-col gap-2"),children:[e>0&&(0,d.jsx)("p",{className:$t("text-sm"),style:{color:f.textMuted,fontSize:D.fontSize},children:pe(x.showing(R,P,e))}),(0,d.jsxs)("div",{className:$t("flex items-center gap-1 flex-wrap"),children:[l&&(0,d.jsxs)("button",{type:"button","aria-label":x.firstPage,disabled:1===w,onClick:()=>M(1),style:F(!1,1===w),children:[(0,d.jsx)(A,{d:"15 18 9 12 15 6"}),(0,d.jsx)(A,{d:"20 18 14 12 20 6"})]}),(0,d.jsx)("button",{type:"button","aria-label":x.previousPage,disabled:1===w,onClick:()=>M(w-1),style:F(!1,1===w),children:(0,d.jsx)(A,{d:"15 18 9 12 15 6"})}),N.map((e,t)=>{if("string"==typeof e)return(0,d.jsx)("span",{"aria-hidden":"true",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:D.minWidth,height:D.height,fontSize:D.fontSize,color:f.textMuted,userSelect:"none"},children:"…"},`${e}-${t}`);const n=e,r=n===w;return(0,d.jsx)("button",{type:"button","aria-label":x.pageN(n),"aria-current":r?"page":void 0,onClick:()=>M(n),style:F(r,!1),children:n},n)}),(0,d.jsx)("button",{type:"button","aria-label":x.nextPage,disabled:w===z,onClick:()=>M(w+1),style:F(!1,w===z),children:(0,d.jsx)(A,{d:"9 18 15 12 9 6"})}),l&&(0,d.jsxs)("button",{type:"button","aria-label":x.lastPage,disabled:w===z,onClick:()=>M(z),style:F(!1,w===z),children:[(0,d.jsx)(A,{d:"4 18 10 12 4 6"}),(0,d.jsx)(A,{d:"14 18 20 12 14 6"})]}),s&&(0,d.jsxs)("div",{className:$t("flex items-center gap-2 ml-2"),children:[(0,d.jsx)("label",{htmlFor:g,className:$t("text-sm"),style:{color:f.textMuted,fontSize:D.fontSize,whiteSpace:"nowrap"},children:m.itemsPerPage??"Rows per page"}),(0,d.jsx)("select",{id:g,value:C,onChange:e=>{return t=Number(e.target.value),k||S(t),c?.(t),void M(1);var t},style:{height:D.height,paddingLeft:D.px,paddingRight:D.px,fontSize:D.fontSize,borderRadius:"8px",border:`1px solid ${f.border}`,backgroundColor:f.surface,color:f.text,cursor:"pointer",outline:"none",fontFamily:"inherit"},children:u.map(e=>(0,d.jsx)("option",{value:e,children:e},e))})]})]})]})}or.displayName="TkxPagination";var ir={"1/1":"100%","4/3":"75%","16/9":"56.25%","3/2":"66.666%","9/16":"177.777%"},ar={none:"0",sm:"4px",md:"8px",lg:"16px",full:"9999px"};function lr({color:e,size:t}){return(0,d.jsxs)("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:e,strokeWidth:1.5,"aria-hidden":"true",children:[(0,d.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),(0,d.jsx)("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),(0,d.jsx)("path",{d:"M21 15l-5-5L5 21"})]})}function sr(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function dr({mimeType:e,color:t}){return e.startsWith("image/")?(0,d.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:1.5,"aria-hidden":"true",children:[(0,d.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),(0,d.jsx)("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),(0,d.jsx)("path",{d:"M21 15l-5-5L5 21"})]}):"application/pdf"===e?(0,d.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:1.5,"aria-hidden":"true",children:[(0,d.jsx)("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),(0,d.jsx)("polyline",{points:"14 2 14 8 20 8"}),(0,d.jsx)("line",{x1:"9",y1:"13",x2:"15",y2:"13"}),(0,d.jsx)("line",{x1:"9",y1:"17",x2:"11",y2:"17"})]}):(0,d.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:1.5,"aria-hidden":"true",children:[(0,d.jsx)("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),(0,d.jsx)("polyline",{points:"14 2 14 8 20 8"})]})}var cr=0,ur={sm:16,md:24,lg:32,xl:40};function pr({size:e,filled:t,color:n,halfFilled:r,id:o}){const i=o?`hg-${o}`:void 0;return(0,d.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24","aria-hidden":"true",style:{display:"block"},children:[r&&i&&(0,d.jsx)("defs",{children:(0,d.jsxs)("linearGradient",{id:i,x1:"0",x2:"1",y1:"0",y2:"0",children:[(0,d.jsx)("stop",{offset:"50%",stopColor:n}),(0,d.jsx)("stop",{offset:"50%",stopColor:"transparent"})]})}),(0,d.jsx)("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2",fill:r&&i?`url(#${i})`:t?n:"none",stroke:n,strokeWidth:1.5,strokeLinejoin:"round"})]})}function hr({size:e,filled:t,color:n,halfFilled:r,id:o}){const i=o?`hg-${o}`:void 0;return(0,d.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24","aria-hidden":"true",style:{display:"block"},children:[r&&i&&(0,d.jsx)("defs",{children:(0,d.jsxs)("linearGradient",{id:i,x1:"0",x2:"1",y1:"0",y2:"0",children:[(0,d.jsx)("stop",{offset:"50%",stopColor:n}),(0,d.jsx)("stop",{offset:"50%",stopColor:"transparent"})]})}),(0,d.jsx)("path",{d:"M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z",fill:r&&i?`url(#${i})`:t?n:"none",stroke:n,strokeWidth:1.5,strokeLinejoin:"round"})]})}function fr({size:e,filled:t,color:n,halfFilled:r,id:o}){const i=o?`hg-${o}`:void 0;return(0,d.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24","aria-hidden":"true",style:{display:"block"},children:[r&&i&&(0,d.jsx)("defs",{children:(0,d.jsxs)("linearGradient",{id:i,x1:"0",x2:"1",y1:"0",y2:"0",children:[(0,d.jsx)("stop",{offset:"50%",stopColor:n}),(0,d.jsx)("stop",{offset:"50%",stopColor:"transparent"})]})}),(0,d.jsx)("circle",{cx:"12",cy:"12",r:"9",fill:r&&i?`url(#${i})`:t?n:"none",stroke:n,strokeWidth:1.5})]})}function mr({type:e,size:t,filled:n,color:r,halfFilled:o,uid:i}){const a={size:t,filled:n,color:r,halfFilled:o,id:i};return"heart"===e?(0,d.jsx)(hr,{...a}):"circle"===e?(0,d.jsx)(fr,{...a}):(0,d.jsx)(pr,{...a})}function gr(e,t,n){return Math.min(n,Math.max(t,e))}function xr(e,t,n){if(1===n)return t+1;const r=e.currentTarget.getBoundingClientRect(),o=r.left+r.width/2;return e.clientX<o?t+.5:t+1}var yr=!1;function br(){return(0,d.jsxs)("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none","aria-hidden":"true",children:[(0,d.jsx)("circle",{cx:"14",cy:"14",r:"14",fill:"currentColor",fillOpacity:"0.15"}),(0,d.jsx)("circle",{cx:"14",cy:"11",r:"4",fill:"currentColor"}),(0,d.jsx)("path",{d:"M6 24c0-4.418 3.582-8 8-8s8 3.582 8 8",fill:"currentColor"})]})}function vr(){return(0,d.jsxs)("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none","aria-hidden":"true",children:[(0,d.jsx)("circle",{cx:"14",cy:"14",r:"14",fill:"currentColor",fillOpacity:"0.15"}),(0,d.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 wr(){const e=J();return(0,d.jsxs)("div",{className:$t("flex items-center gap-1.5 px-4 py-3 rounded-2xl w-fit"),style:{backgroundColor:e.surface,border:`1px solid ${e.border}`},"aria-label":"Assistant is thinking",children:[(0,d.jsx)("span",{className:"tkx-dot1 inline-block w-2 h-2 rounded-full",style:{backgroundColor:e.textMuted}}),(0,d.jsx)("span",{className:"tkx-dot2 inline-block w-2 h-2 rounded-full",style:{backgroundColor:e.textMuted}}),(0,d.jsx)("span",{className:"tkx-dot3 inline-block w-2 h-2 rounded-full",style:{backgroundColor:e.textMuted}})]})}function kr({message:e,showTimestamp:t,avatarUser:n,avatarAssistant:r}){const o=J(),i=qe(),{role:a,content:l,timestamp:s,isStreaming:c,error:u}=e,p=pe(l),h=s?new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}).format(s):null;if("system"===a)return(0,d.jsx)("div",{role:"listitem",className:$t("flex justify-center my-2"),children:(0,d.jsx)("p",{className:$t("text-xs italic px-3 py-1 rounded-full"),style:{color:o.textMuted,backgroundColor:o.surfaceAlt},children:p})});const f="user"===a,m=f?n??(0,d.jsx)(br,{}):r??(0,d.jsx)(vr,{}),g=f?{backgroundColor:o.primary,color:o.bg}:{backgroundColor:o.surface,color:o.text,border:`1px solid ${u?o.danger:o.border}`};return u&&(g.borderColor=o.danger,g.borderWidth="2px"),(0,d.jsxs)("div",{role:"listitem",className:$t("flex gap-2 mb-4",f?"flex-row-reverse":"flex-row"),children:[(0,d.jsx)("div",{className:$t("shrink-0 w-8 h-8 rounded-full flex items-center justify-center overflow-hidden"),style:{color:f?o.primary:o.secondary},children:m}),(0,d.jsxs)("div",{className:$t("flex flex-col gap-1 max-w-[75%]",f?"items-end":"items-start"),children:[(0,d.jsxs)("div",{className:Ct($t("px-4 py-2.5 rounded-2xl text-sm leading-relaxed break-words whitespace-pre-wrap"),c&&!i?"tkx-cursor":""),style:g,children:[p,u&&(0,d.jsx)("span",{"aria-label":"Error",style:{marginLeft:6,color:o.danger},children:"⚠"})]}),t&&h&&(0,d.jsx)("span",{className:$t("text-[10px]"),style:{color:o.textMuted},children:h})]})]})}var $r=["👍","❤️","😂","🎉","😢","👀"];function Sr(e){return e instanceof Date?e:new Date(e)}function Cr(e){return new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit"}).format(e)}function zr(e){const t=new Date,n=new Date(t);n.setDate(t.getDate()-1);const r=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate();return r(e,t)?"Today":r(e,n)?"Yesterday":e.toLocaleDateString()}function Mr({state:e,color:t,danger:n}){if("sending"===e)return(0,d.jsx)("span",{"aria-label":"Sending",title:"Sending",style:{display:"inline-block",width:8,height:8,borderRadius:"50%",backgroundColor:t,opacity:.6}});if("failed"===e)return(0,d.jsx)("span",{"aria-label":"Failed",title:"Failed",style:{color:n,fontWeight:700,fontSize:12},children:"!"});if("sent"===e)return(0,d.jsx)("svg",{width:14,height:14,viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,"aria-label":"Sent",children:(0,d.jsx)("path",{d:"M2 8l4 4 8-8",stroke:t,strokeWidth:1.6,strokeLinecap:"round",strokeLinejoin:"round"})});const r="read"===e?2.2:1.4;return(0,d.jsxs)("svg",{width:18,height:14,viewBox:"0 0 22 16",fill:"none","aria-label":"read"===e?"Read":"Delivered",children:[(0,d.jsx)("path",{d:"M2 8l4 4 8-8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),(0,d.jsx)("path",{d:"M8 12l4 4 8-8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Nr({sender:e,color:t,bg:n}){return e.avatar?(0,d.jsx)("img",{src:e.avatar,alt:pe(e.name),className:$t("rounded-full"),style:{width:32,height:32,objectFit:"cover"}}):(0,d.jsx)("div",{className:$t("rounded-full flex items-center justify-center text-xs font-medium"),style:{width:32,height:32,backgroundColor:n,color:t},"aria-hidden":"true",children:(r=e.name,pe(r).split(/\s+/).filter(Boolean).slice(0,2).map(e=>e[0]?.toUpperCase()??"").join("")||"?")});var r}function Dr({att:e,theme:t}){const n=pe(e.name);return"image"===e.kind?(0,d.jsx)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:$t("block mt-2"),children:(0,d.jsx)("img",{src:e.url,alt:n,loading:"lazy",className:$t("rounded-md"),style:{maxWidth:260,maxHeight:260,display:"block"}})}):"audio"===e.kind?(0,d.jsx)("audio",{controls:!0,src:e.url,className:$t("mt-2 block"),style:{maxWidth:260},"aria-label":n}):"video"===e.kind?(0,d.jsx)("video",{controls:!0,src:e.url,poster:e.thumbnail,className:$t("mt-2 rounded-md"),style:{maxWidth:260,display:"block"},"aria-label":n}):(0,d.jsxs)("a",{href:e.url,download:e.name,target:"_blank",rel:"noopener noreferrer",className:$t("flex items-center gap-2 mt-2 px-2.5 py-2 rounded-md text-xs no-underline"),style:{backgroundColor:t.surfaceAlt,color:t.text,border:`1px solid ${t.border}`},children:[(0,d.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,"aria-hidden":"true",children:[(0,d.jsx)("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),(0,d.jsx)("polyline",{points:"14 2 14 8 20 8"})]}),(0,d.jsxs)("div",{className:$t("flex flex-col min-w-0"),children:[(0,d.jsx)("span",{className:$t("truncate font-medium"),style:{maxWidth:200},children:n}),(0,d.jsxs)("span",{style:{color:t.textMuted,fontSize:10},children:[pe(e.mimeType),null!=e.size?" · "+(r=e.size,r<1024?`${r} B`:r<1048576?`${(r/1024).toFixed(1)} KB`:`${(r/1048576).toFixed(1)} MB`):""]})]}),(0,d.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,"aria-hidden":"true",children:(0,d.jsx)("path",{d:"M12 3v12m0 0l-4-4m4 4l4-4M4 21h16"})})]});var r}function Rr({messages:e,senders:t,currentUserId:n,onSend:r,onReact:o,onEdit:i,onDelete:l,onAttach:s,height:c=520,placeholder:u="Type a message…",showTimeSeparators:p=!0,groupConsecutive:h=!0,emojiPickerOptions:f=$r,className:m,style:g,typingUserIds:x,onTypingStart:y,onTypingStop:b}){const v=J(),w=qe(),[k,$]=(0,a.useState)(""),[S,C]=(0,a.useState)(null),[z,M]=(0,a.useState)(null),[N,D]=(0,a.useState)(null),[R,P]=(0,a.useState)(""),[F,A]=(0,a.useState)(null),I=(0,a.useRef)(null),L=(0,a.useRef)(null),T=(0,a.useRef)(null),W=(0,a.useRef)(!1),j=(0,a.useRef)(null),E=(0,a.useCallback)(()=>{null!=j.current&&(clearTimeout(j.current),j.current=null),W.current&&(W.current=!1,b?.())},[b]),B=(0,a.useCallback)(()=>{W.current||(W.current=!0,y?.()),null!=j.current&&clearTimeout(j.current),j.current=setTimeout(()=>{j.current=null,W.current&&(W.current=!1,b?.())},3e3)},[y,b]);(0,a.useEffect)(()=>()=>{null!=j.current&&(clearTimeout(j.current),j.current=null)},[]),(0,a.useEffect)(()=>{const e=I.current;e&&e.scrollTo({top:e.scrollHeight,behavior:w?"auto":"smooth"})},[e.length,w]);const V=(0,a.useMemo)(()=>{const t={};for(const n of e)t[n.id]=n;return t},[e]),H=(0,a.useCallback)(()=>{const e=k.trim();e&&r&&(r(pe(e),S??void 0),$(""),C(null),L.current&&(L.current.style.height="auto"),E())},[k,r,S,E]),O=(0,a.useCallback)(e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),H())},[H]),q=(0,a.useCallback)(e=>{const t=e.target.value;$(t);const n=L.current;if(n){n.style.height="auto";const e=160;n.style.height=`${Math.min(n.scrollHeight,e)}px`}0===t.length?E():B()},[B,E]),U=(0,a.useCallback)(()=>{E()},[E]),K=(0,a.useCallback)(async e=>{const t=Array.from(e.target.files??[]);if(e.target.value="",!t.length||!s)return;A(null);const n=[],r=[];for(const o of t)try{const e=await je(o),t=(o.type||"").split("/")[0],i=e?e.split("/")[0]:null;if(!e||t&&i&&t!==i){r.push(o.name);continue}n.push(o)}catch{r.push(o.name)}r.length&&A(`File type does not match its content — refusing to attach: ${r.map(pe).join(", ")}`),n.length&&await s(n)},[s]),Y=(0,a.useCallback)((e,t)=>{M(null),o?.(e,t)},[o]),Z=(0,a.useCallback)(e=>{("undefined"==typeof window||window.confirm("Delete this message?"))&&l?.(e)},[l]),X=(0,a.useCallback)(e=>{D(e.id),P(e.text??"")},[]),G=(0,a.useCallback)(e=>{const t=R.trim();t&&(i?.(e,pe(t)),D(null),P(""))},[R,i]),_="number"==typeof c?`${c}px`:c,Q=S?V[S]:null,ee=Q?t[Q.senderId]:null,te=(0,a.useMemo)(()=>{if(!x||0===x.length)return null;const e=x.map(e=>pe(t[e]?.name??"Unknown"));return 1===e.length?`${e[0]} is typing`:2===e.length?`${e[0]} and ${e[1]} are typing`:"Several people are typing"},[x,t]),ne=[];let re=null;for(const a of e){const e=Sr(a.timestamp);p&&(re?Sr(re.timestamp).toDateString():null)!==e.toDateString()&&ne.push({kind:"sep",key:`sep-${a.id}`,label:zr(e)});const t=h&&null!=re&&re.senderId===a.senderId&&Sr(re.timestamp).toDateString()===e.toDateString()&&e.getTime()-Sr(re.timestamp).getTime()<3e5;ne.push({kind:"msg",key:a.id,msg:a,showHeader:!t}),re=a}return(0,d.jsxs)("div",{className:Ct($t("flex flex-col overflow-hidden rounded-2xl"),m),style:{height:_,backgroundColor:v.bg,border:`1px solid ${v.border}`,...g},children:[(0,d.jsx)("div",{ref:I,role:"log","aria-live":"polite","aria-label":"Message thread",className:$t("flex-1 overflow-y-auto p-4"),children:ne.map(e=>{if("sep"===e.kind)return(0,d.jsx)("div",{className:$t("flex items-center justify-center my-3"),children:(0,d.jsx)("span",{className:$t("text-[11px] px-2.5 py-0.5 rounded-full"),style:{color:v.textMuted,backgroundColor:v.surfaceAlt},children:e.label})},e.key);const r=e.msg,a=t[r.senderId]??{id:r.senderId,name:"Unknown"},s=r.senderId===n,c=Sr(r.timestamp),u=!!r.deletedAt,p=r.replyTo?V[r.replyTo]:null,h=p?t[p.senderId]:null,m=N===r.id,g=s?{backgroundColor:v.primary,color:v.bg}:{backgroundColor:v.surface,color:v.text,border:`1px solid ${v.border}`};return(0,d.jsxs)("div",{role:"article","aria-label":`${pe(a.name)}, ${Cr(c)}`,"data-own":s?"true":"false","data-grouped":e.showHeader?"false":"true",className:$t("flex gap-2 mb-1",s?"flex-row-reverse":"flex-row"),style:{marginTop:e.showHeader?12:2},children:[(0,d.jsx)("div",{className:$t("shrink-0"),style:{width:32},children:e.showHeader?(0,d.jsx)(Nr,{sender:a,color:v.primary,bg:v.surfaceAlt}):null}),(0,d.jsxs)("div",{className:$t("flex flex-col max-w-[75%]",s?"items-end":"items-start"),children:[e.showHeader&&(0,d.jsxs)("div",{className:$t("flex items-center gap-2 mb-0.5 text-xs"),style:{color:v.textMuted},children:[(0,d.jsx)("span",{style:{fontWeight:600,color:v.text},children:pe(a.name)}),a.role&&(0,d.jsxs)("span",{children:["· ",pe(a.role)]}),(0,d.jsxs)("span",{children:["· ",Cr(c)]}),r.editedAt&&!u&&(0,d.jsx)("span",{children:"(edited)"})]}),p&&!u&&(0,d.jsxs)("div",{className:$t("mb-1 px-2 py-1 rounded text-xs"),style:{backgroundColor:v.surfaceAlt,borderLeft:`3px solid ${v.primary}`,color:v.textMuted,maxWidth:"100%"},children:[(0,d.jsxs)("span",{style:{fontWeight:600},children:[pe(h?.name??"Unknown"),":"," "]}),pe((p.text??"").slice(0,80)),(p.text??"").length>80?"…":""]}),(0,d.jsx)("div",{className:$t("px-3 py-2 rounded-2xl text-sm leading-relaxed break-words whitespace-pre-wrap"),style:g,children:u?(0,d.jsx)("span",{style:{fontStyle:"italic",opacity:.7},children:"Message deleted"}):m?(0,d.jsxs)("div",{className:$t("flex flex-col gap-1"),children:[(0,d.jsx)("textarea",{value:R,onChange:e=>P(e.target.value),"aria-label":"Edit message",className:$t("text-sm leading-relaxed bg-transparent outline-none resize-none w-full"),style:{color:"inherit",minHeight:48,border:`1px solid ${v.border}`,borderRadius:8,padding:4}}),(0,d.jsxs)("div",{className:$t("flex gap-2 justify-end"),children:[(0,d.jsx)("button",{type:"button",onClick:()=>D(null),className:$t("text-xs px-2 py-1 rounded bg-transparent border-none cursor-pointer"),style:{color:"inherit"},children:"Cancel"}),(0,d.jsx)("button",{type:"button",onClick:()=>G(r.id),className:$t("text-xs px-2 py-1 rounded border-none cursor-pointer"),style:{backgroundColor:v.bg,color:v.primary},children:"Save"})]})]}):(0,d.jsxs)(d.Fragment,{children:[r.text&&pe(r.text),r.attachments?.map(e=>(0,d.jsx)(Dr,{att:e,theme:v},e.id))]})}),!u&&(0,d.jsxs)("div",{className:$t("flex items-center gap-1 mt-1 flex-wrap",s?"justify-end":"justify-start"),children:[r.reactions?.map(e=>{const t=e.by.includes(n);return(0,d.jsxs)("button",{type:"button",onClick:()=>o?.(r.id,e.emoji),"aria-label":`React ${e.emoji} (${e.by.length})`,"aria-pressed":t,className:$t("text-xs px-1.5 py-0.5 rounded-full cursor-pointer"),style:{backgroundColor:t?v.primary+"33":v.surfaceAlt,border:`1px solid ${t?v.primary:v.border}`,color:v.text},children:[e.emoji," ",e.by.length]},e.emoji)}),s&&r.delivery&&(0,d.jsx)("span",{className:$t("inline-flex items-center ml-1"),children:(0,d.jsx)(Mr,{state:r.delivery,color:v.textMuted,danger:v.danger})})]}),!u&&!m&&(0,d.jsxs)("div",{className:$t("flex items-center gap-1 mt-1 text-xs"),style:{color:v.textMuted,opacity:.85},children:[(0,d.jsx)("button",{type:"button",onClick:()=>C(r.id),"aria-label":"Reply to message",className:$t("bg-transparent border-none cursor-pointer px-1 py-0.5 rounded"),style:{color:"inherit"},children:"Reply"}),(0,d.jsx)("button",{type:"button",onClick:()=>M(e=>e===r.id?null:r.id),"aria-label":"React to message","aria-expanded":z===r.id,className:$t("bg-transparent border-none cursor-pointer px-1 py-0.5 rounded"),style:{color:"inherit"},children:"React"}),s&&i&&(0,d.jsx)("button",{type:"button",onClick:()=>X(r),"aria-label":"Edit message",className:$t("bg-transparent border-none cursor-pointer px-1 py-0.5 rounded"),style:{color:"inherit"},children:"Edit"}),s&&l&&(0,d.jsx)("button",{type:"button",onClick:()=>Z(r.id),"aria-label":"Delete message",className:$t("bg-transparent border-none cursor-pointer px-1 py-0.5 rounded"),style:{color:"inherit"},children:"Delete"}),z===r.id&&(0,d.jsx)("div",{role:"menu","aria-label":"Pick a reaction",className:$t("flex items-center gap-1 ml-1 px-1.5 py-1 rounded-full"),style:{backgroundColor:v.surface,border:`1px solid ${v.border}`},children:f.map(e=>(0,d.jsx)("button",{type:"button",role:"menuitem",onClick:()=>Y(r.id,e),"aria-label":`React with ${e}`,className:$t("bg-transparent border-none cursor-pointer text-sm px-1"),style:{color:"inherit"},children:e},e))})]})]})]},e.key)})}),te&&(0,d.jsxs)("div",{role:"status","aria-live":"polite",className:$t("px-4 py-1 flex items-center gap-1"),style:{color:v.textMuted,fontSize:12,fontStyle:"italic",borderTop:`1px solid ${v.border}`,backgroundColor:v.bg},children:[(0,d.jsx)("span",{children:te}),w?(0,d.jsx)("span",{"aria-hidden":"true",children:"…"}):(0,d.jsxs)("span",{"aria-hidden":"true",className:$t("inline-flex items-end gap-0.5"),style:{marginLeft:2},children:[(0,d.jsx)("span",{style:{width:3,height:3,borderRadius:"50%",backgroundColor:"currentColor",animation:"tkx-typing-dot 1.2s infinite ease-in-out",animationDelay:"0s",display:"inline-block"}}),(0,d.jsx)("span",{style:{width:3,height:3,borderRadius:"50%",backgroundColor:"currentColor",animation:"tkx-typing-dot 1.2s infinite ease-in-out",animationDelay:"0.15s",display:"inline-block"}}),(0,d.jsx)("span",{style:{width:3,height:3,borderRadius:"50%",backgroundColor:"currentColor",animation:"tkx-typing-dot 1.2s infinite ease-in-out",animationDelay:"0.3s",display:"inline-block"}}),(0,d.jsx)("style",{children:"@keyframes tkx-typing-dot { 0%, 60%, 100% { opacity: 0.25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2px); } } @media (prefers-reduced-motion: reduce) { @keyframes tkx-typing-dot { 0%, 100% { opacity: 1; transform: none; } } }"})]})]}),(0,d.jsxs)("div",{className:$t("flex flex-col gap-1 p-3"),style:{borderTop:`1px solid ${v.border}`,backgroundColor:v.surface},children:[F&&(0,d.jsx)("div",{role:"alert",className:$t("text-xs px-2 py-1 rounded"),style:{backgroundColor:v.danger+"20",color:v.danger,border:`1px solid ${v.danger}`},children:F}),Q&&(0,d.jsxs)("div",{className:$t("flex items-center gap-2 px-2 py-1 rounded text-xs"),style:{backgroundColor:v.surfaceAlt,color:v.textMuted},children:[(0,d.jsxs)("span",{className:$t("truncate flex-1"),children:["Replying to"," ",(0,d.jsx)("span",{style:{fontWeight:600,color:v.text},children:pe(ee?.name??"Unknown")}),": ",pe((Q.text??"").slice(0,80))]}),(0,d.jsx)("button",{type:"button",onClick:()=>C(null),"aria-label":"Cancel reply",className:$t("bg-transparent border-none cursor-pointer"),style:{color:"inherit"},children:"×"})]}),(0,d.jsxs)("div",{className:$t("flex items-end gap-2"),children:[s&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("input",{ref:T,type:"file",multiple:!0,onChange:K,className:$t("sr-only"),tabIndex:-1,"aria-hidden":"true"}),(0,d.jsx)("button",{type:"button",onClick:()=>T.current?.click(),"aria-label":"Attach files",className:$t("shrink-0 w-9 h-9 rounded-xl flex items-center justify-center cursor-pointer border-none"),style:{backgroundColor:v.surfaceAlt,color:v.text},children:(0,d.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.8,"aria-hidden":"true",children:(0,d.jsx)("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"})})})]}),(0,d.jsx)("textarea",{ref:L,rows:1,value:k,onChange:q,onKeyDown:O,onBlur:U,placeholder:pe(u),"aria-label":"Message input","aria-multiline":"true",className:$t("flex-1 resize-none text-sm leading-6 bg-transparent outline-none py-1"),style:{color:v.text,caretColor:v.primary,minHeight:32,maxHeight:160}}),(0,d.jsx)("button",{type:"button",onClick:H,disabled:!k.trim(),"aria-label":"Send message",className:$t("shrink-0 w-9 h-9 rounded-xl flex items-center justify-center border-none",k.trim()?"cursor-pointer opacity-100":"opacity-40 cursor-not-allowed"),style:{backgroundColor:v.primary,color:v.bg},children:(0,d.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M2 14L14 8 2 2v4.5l8 1.5-8 1.5V14z",fill:"currentColor"})})})]})]})]})}var Pr={sm:"text-[11px]",md:"text-xs",lg:"text-sm"},Fr={sm:"px-2 py-0.5",md:"px-2.5 py-1",lg:"px-3 py-1.5"},Ar={sm:"gap-1",md:"gap-1.5",lg:"gap-2"},Ir={sm:12,md:14,lg:16};function Lr({variant:e="subtle",size:t="md",colorScheme:n="default",onRemove:r,leftIcon:o,isDisabled:i=!1,clickable:a=!1,children:l,className:s,style:c,onClick:u,...p}){J();const h=qe(),f=function(e,t){const n=J(),r={default:n.textMuted,primary:n.primary,secondary:n.secondary,success:n.success,danger:n.danger,warning:n.warning,info:n.info}[e];return"solid"===t?{bg:r,color:n.bg,border:"transparent"}:"subtle"===t?{bg:`${r}22`,color:r,border:"transparent"}:{bg:"transparent",color:r,border:r}}(n,e),m="string"==typeof l?pe(l):l,g=Ir[t],x=$t("inline-flex items-center font-medium rounded-full select-none",Pr[t],Fr[t],Ar[t],i?"opacity-50 cursor-not-allowed":a?"cursor-pointer":"cursor-default",a&&!h&&"transition-opacity duration-150");return(0,d.jsxs)("span",{role:a?"button":void 0,tabIndex:a&&!i?0:void 0,"aria-disabled":i||void 0,className:Ct(x,s),style:{backgroundColor:f.bg,color:f.color,border:`1px solid ${"transparent"===f.border?"transparent":f.border}`,...c},onClick:i?void 0:u,onKeyDown:a&&!i&&u?e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),u(e))}:void 0,...p,children:[o&&(0,d.jsx)("span",{"aria-hidden":"true",className:$t("shrink-0 flex items-center"),children:o}),(0,d.jsx)("span",{children:m}),r&&!i&&(0,d.jsx)("button",{type:"button","aria-label":`Remove ${"string"==typeof l?l:"tag"}`,onClick:e=>{e.stopPropagation(),r()},className:$t("shrink-0 flex items-center justify-center rounded-full cursor-pointer"),style:{width:g+4,height:g+4,color:f.color,backgroundColor:"transparent",border:"none",padding:0},tabIndex:0,children:(0,d.jsx)("svg",{width:g,height:g,viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M2 2l8 8M10 2L2 10",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})})})]})}var Tr=!1;function Wr({status:e="pending",icon:t,size:n=28}){const r=J(),o=qe(),i=function(e="pending"){const t=J();return{completed:t.success,active:t.primary,pending:t.border,error:t.danger}[e]}(e),a="active"===e;return(0,d.jsx)("div",{className:Ct($t("relative flex items-center justify-center rounded-full shrink-0 z-10"),a&&!o?"tkx-pulse-dot":""),style:{width:n,height:n,backgroundColor:"pending"===e?r.surface:i,border:`2px solid ${i}`,color:"pending"===e?i:r.bg},"aria-hidden":"true",children:t?(0,d.jsx)("span",{style:{fontSize:.45*n,lineHeight:1},children:t}):(0,d.jsx)("span",{style:{width:.35*n,height:.35*n,borderRadius:"50%",backgroundColor:"pending"===e?i:r.bg,display:"block"}})})}function jr({style:e,color:t,animate:n}){return J(),(0,d.jsx)("div",{className:Ct($t("w-0.5 flex-1 min-h-[24px]"),n?"tkx-draw-v":""),style:{borderLeft:`2px ${e} ${t}`,backgroundColor:"transparent",alignSelf:"stretch",borderColor:t,marginLeft:1},"aria-hidden":"true"})}function Er({style:e,color:t,animate:n}){return(0,d.jsx)("div",{className:Ct($t("h-0.5 flex-1 min-w-[24px]"),n?"tkx-draw-h":""),style:{borderTop:`2px ${e} ${t}`,borderColor:t},"aria-hidden":"true"})}function Br({item:e,compact:t}){const n=J(),r=e.timestamp?pe(e.timestamp):null;return(0,d.jsxs)("div",{className:$t("flex flex-col gap-0.5",t?"pb-3":"pb-5"),children:[(0,d.jsxs)("div",{className:$t("flex items-center gap-2 flex-wrap"),children:[(0,d.jsx)("span",{className:$t("text-sm font-semibold leading-snug"),style:{color:n.text},children:"string"==typeof e.title?pe(e.title):e.title}),e.badge&&(0,d.jsx)("span",{children:e.badge}),r&&(0,d.jsx)("span",{className:$t("text-[11px] ml-auto"),style:{color:n.textMuted},children:r})]}),e.description&&!t&&(0,d.jsx)("div",{className:$t("text-xs leading-relaxed mt-0.5"),style:{color:n.textMuted},children:"string"==typeof e.description?pe(e.description):e.description})]})}function Vr(e,t,n,r){const o=window.innerWidth,i=window.innerHeight;let a=0,l=0,s="top left";switch(t){case"bottom-start":a=e.bottom+6,l=e.left,s="top left",a+r>i&&e.top-6-r>0&&(a=e.top-6-r,s="bottom left"),l+n>o&&(l=Math.max(0,o-n-8));break;case"bottom-end":a=e.bottom+6,l=e.right-n,s="top right",a+r>i&&e.top-6-r>0&&(a=e.top-6-r,s="bottom right"),l<0&&(l=8);break;case"top-start":a=e.top-6-r,l=e.left,s="bottom left",a<0&&(a=e.bottom+6,s="top left"),l+n>o&&(l=Math.max(0,o-n-8));break;case"top-end":a=e.top-6-r,l=e.right-n,s="bottom right",a<0&&(a=e.bottom+6,s="top right"),l<0&&(l=8);break;case"right-start":a=e.top,l=e.right+6,s="top left",l+n>o&&(l=e.left-6-n,s="top right"),a+r>i&&(a=Math.max(8,i-r-8));break;case"left-start":a=e.top,l=e.left-6-n,s="top right",l<0&&(l=e.right+6,s="top left"),a+r>i&&(a=Math.max(8,i-r-8))}return{top:a+window.scrollY,left:l+window.scrollX,transformOrigin:s}}function Hr(e,t){return{position:"absolute",top:t.top,left:t.left,zIndex:9999,minWidth:200,maxWidth:320,backgroundColor:e.surface,border:`1.5px solid ${e.border}`,borderRadius:10,boxShadow:"0 8px 32px rgba(0,0,0,0.28), 0 2px 8px rgba(0,0,0,0.14)",padding:"4px 0",transformOrigin:t.transformOrigin,overflow:"hidden"}}function Or({color:e}){return(0,d.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:e,strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M20 6L9 17l-5-5"})})}function qr({color:e}){return(0,d.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,d.jsx)("circle",{cx:"12",cy:"12",r:"5",fill:e}),(0,d.jsx)("circle",{cx:"12",cy:"12",r:"9",fill:"none",stroke:e,strokeWidth:"2"})]})}function Ur({color:e}){return(0,d.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:e,strokeWidth:"2","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M9 18l6-6-6-6"})})}function Kr({items:e,pos:t,panelId:n,onClose:r,onCloseAll:o,isSubmenu:i=!1}){const l=J(),[s,u]=(0,a.useState)(-1),[p,h]=(0,a.useState)(null),[f,m]=(0,a.useState)(null),g=(0,a.useRef)(null),[x,y]=(0,a.useState)(""),b=(0,a.useRef)(null),v=function(e){const t=[];let n=0;for(const r of e)if("separator"!==r.type)if("radio-group"===r.type)for(let e=0;e<r.options.length;e++)t.push({kind:"radio",item:r,optionIdx:e,idx:n++});else"check"===r.type?t.push({kind:"check",item:r,idx:n++}):"submenu"===r.type?t.push({kind:"submenu",item:r,idx:n++}):t.push({kind:"action",item:r,idx:n++});return t}(e);(0,a.useEffect)(()=>{g.current?.focus()},[]),(0,a.useEffect)(()=>{s<0||(g.current?.querySelector(`[data-midx="${s}"]`))?.scrollIntoView({block:"nearest"})},[s]);const w=(0,a.useCallback)(e=>{if("action"===e.kind){if(e.item.disabled)return;e.item.onClick?.(),o()}else if("check"===e.kind){if(e.item.disabled)return;e.item.onChange?.(!e.item.checked)}else if("radio"===e.kind){if(e.item.disabled)return;e.item.onChange?.(e.item.options[e.optionIdx].value)}else if("submenu"===e.kind){if(e.item.disabled)return;const t=g.current?.querySelector(`[data-midx="${e.idx}"]`);t?k(e.item,t):h(e.item.id)}},[o]);function k(e,t){const n=t.getBoundingClientRect();h(e.id),m(function(e,t,n){const r=window.innerWidth,o=window.innerHeight;let i=e.right+4,a="top left";i+220>r&&(i=e.left-4-220,a="top right");let l=e.top;return l+n>o&&(l=Math.max(8,o-n-8)),{top:l+window.scrollY,left:i+window.scrollX,transformOrigin:a}}(n,0,Math.min(38*e.items.length+12,360)))}function $(){h(null),m(null)}return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("style",{children:"\n@keyframes tkxMenuIn {\n from { opacity: 0; transform: scale(0.94); }\n to { opacity: 1; transform: scale(1); }\n}\n@keyframes tkxMenuInReduced {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n@media (prefers-reduced-motion: no-preference) {\n .tkx-menu-panel {\n animation: tkxMenuIn 130ms cubic-bezier(0.16, 1, 0.3, 1) forwards;\n }\n}\n@media (prefers-reduced-motion: reduce) {\n .tkx-menu-panel {\n animation: tkxMenuInReduced 100ms ease forwards;\n }\n}\n"}),(0,d.jsx)("div",{ref:g,id:n,role:"menu",tabIndex:-1,className:"tkx-menu-panel",onKeyDown:e=>{switch(e.key){case"ArrowDown":e.preventDefault(),u(e=>{const t=e+1;return t<v.length?t:0});break;case"ArrowUp":e.preventDefault(),u(e=>{const t=e-1;return t>=0?t:v.length-1});break;case"Home":e.preventDefault(),u(0);break;case"End":e.preventDefault(),u(v.length-1);break;case"Enter":case" ":e.preventDefault(),s>=0&&v[s]&&w(v[s]);break;case"Escape":e.preventDefault(),i?r():o();break;case"Tab":e.preventDefault(),o();break;case"ArrowRight":if(e.preventDefault(),s>=0&&"submenu"===v[s]?.kind){const e=v[s],t=g.current?.querySelector(`[data-midx="${e.idx}"]`);t?k(e.item,t):h(e.item.id)}break;case"ArrowLeft":e.preventDefault(),i&&r();break;default:1!==e.key.length||e.ctrlKey||e.metaKey||function(e){b.current&&clearTimeout(b.current);const t=x+e.toLowerCase();y(t);const n=v.findIndex(e=>("radio"===e.kind?e.item.options[e.optionIdx].label:e.item.label).toLowerCase().startsWith(t));n>=0&&u(n),b.current=setTimeout(()=>y(""),800)}(e.key)}},style:{...Hr(l,t),maxHeight:400,overflowY:"auto"},children:(()=>{let t=-1;return e.map(e=>{if("separator"===e.type)return(0,d.jsx)("div",{role:"separator",style:{margin:(e.label,"4px 0"),display:"flex",alignItems:"center",gap:8},children:e.label?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:{flex:1,height:1,backgroundColor:l.border,marginLeft:14}}),(0,d.jsx)("span",{style:{fontSize:"11px",fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:l.textMuted,fontFamily:"inherit",whiteSpace:"nowrap"},children:pe(e.label)}),(0,d.jsx)("div",{style:{flex:1,height:1,backgroundColor:l.border,marginRight:14}})]}):(0,d.jsx)("div",{style:{flex:1,height:1,backgroundColor:l.border,margin:"0 10px"}})},e.id);if("radio-group"===e.type)return(0,d.jsxs)("div",{role:"group","aria-label":e.label,children:[e.label&&(0,d.jsx)("div",{style:{padding:"6px 14px 2px",fontSize:"11px",fontWeight:700,letterSpacing:"0.07em",textTransform:"uppercase",color:l.textMuted,fontFamily:"inherit"},"aria-hidden":"true",children:pe(e.label)}),e.options.map((n,r)=>{t++;const o=t,i=o===s,a=n.value===e.value,c=!!e.disabled,p=Yr(l,i,!1,c);return(0,d.jsxs)("div",{role:"menuitemradio","aria-checked":a,"aria-disabled":c||void 0,"data-midx":o,tabIndex:-1,style:p,onClick:()=>!c&&e.onChange?.(n.value),onMouseEnter:()=>!c&&u(o),children:[(0,d.jsx)("span",{style:{width:16,flexShrink:0,display:"flex",alignItems:"center"},children:a?(0,d.jsx)(qr,{color:l.primary}):(0,d.jsx)("span",{style:{width:14,height:14,borderRadius:"50%",border:`2px solid ${l.border}`,display:"inline-block"}})}),n.icon&&(0,d.jsx)("span",{style:{flexShrink:0,display:"flex",color:l.textMuted},children:n.icon}),(0,d.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:pe(n.label)})]},n.value)})]},e.id);if("check"===e.type){t++;const n=t,r=n===s,o=!!e.disabled,i=Yr(l,r,!1,o);return(0,d.jsxs)("div",{role:"menuitemcheckbox","aria-checked":e.checked,"aria-disabled":o||void 0,"data-midx":n,tabIndex:-1,style:i,onClick:()=>!o&&e.onChange?.(!e.checked),onMouseEnter:()=>!o&&u(n),children:[(0,d.jsx)("span",{style:{width:16,flexShrink:0,display:"flex",alignItems:"center"},children:e.checked?(0,d.jsx)(Or,{color:l.primary}):(0,d.jsx)("span",{style:{width:14,height:14,display:"inline-block"}})}),e.icon&&(0,d.jsx)("span",{style:{flexShrink:0,display:"flex",color:l.textMuted},children:e.icon}),(0,d.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:pe(e.label)})]},e.id)}if("submenu"===e.type){t++;const r=t,i=r===s,a=!!e.disabled,h=p===e.id,m=Yr(l,i||h,!1,a);return(0,d.jsxs)("div",{style:{position:"relative"},children:[(0,d.jsxs)("div",{role:"menuitem","aria-haspopup":"menu","aria-expanded":h,"aria-disabled":a||void 0,"data-midx":r,tabIndex:-1,style:m,onMouseEnter:t=>{a||(u(r),k(e,t.currentTarget))},onMouseLeave:()=>{},onClick:t=>{a||(h?$():k(e,t.currentTarget))},children:[(0,d.jsx)("span",{style:{width:16,flexShrink:0,display:"flex",alignItems:"center"},children:e.icon?(0,d.jsx)("span",{style:{display:"flex",color:l.textMuted},children:e.icon}):(0,d.jsx)("span",{style:{width:14}})}),(0,d.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:pe(e.label)}),(0,d.jsx)(Ur,{color:l.textMuted})]}),h&&f&&(0,c.createPortal)((0,d.jsx)(Kr,{items:e.items,pos:f,panelId:`${n}-sub-${e.id}`,onClose:$,onCloseAll:o,isSubmenu:!0}),document.body)]},e.id)}const r=e;t++;const i=t,a=i===s,h=!!r.disabled,m=!!r.danger,g=Yr(l,a,m,h);return(0,d.jsxs)("div",{role:"menuitem","aria-disabled":h||void 0,"data-midx":i,tabIndex:-1,style:g,onClick:()=>{h||(r.onClick?.(),o())},onMouseEnter:()=>{h||(u(i),$())},children:[(0,d.jsx)("span",{style:{width:16,flexShrink:0,display:"flex",alignItems:"center"},children:r.icon?(0,d.jsx)("span",{style:{display:"flex",color:m?l.danger:l.textMuted},children:r.icon}):(0,d.jsx)("span",{style:{width:14}})}),(0,d.jsxs)("span",{style:{flex:1,minWidth:0},children:[(0,d.jsx)("span",{style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:pe(r.label)}),r.description&&(0,d.jsx)("span",{style:{display:"block",fontSize:"12px",color:l.textMuted,marginTop:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:pe(r.description)})]}),r.shortcut&&(0,d.jsx)("span",{style:{fontSize:"12px",color:l.textMuted,fontFamily:"inherit",flexShrink:0,marginLeft:16,opacity:.8},children:pe(r.shortcut)})]},r.id)})})()})]})}function Yr(e,t,n,r){const o=n?e.danger:e.text;return{display:"flex",alignItems:"center",gap:8,padding:"7px 14px",fontSize:"14px",fontFamily:"inherit",cursor:r?"not-allowed":"pointer",userSelect:"none",color:r?e.textMuted:t&&n?e.danger:o,backgroundColor:t?n?`${e.danger}18`:`${e.primary}18`:"transparent",transition:"background-color 80ms",opacity:r?.5:1,outline:"none"}}function Zr({trigger:e,items:t,placement:n="bottom-start",isDisabled:r=!1,onOpen:o,onClose:i,className:l,style:s}){const u=`tkx-menu-${(0,a.useId)().replace(/:/g,"")}`,[p,h]=(0,a.useState)(!1),[f,m]=(0,a.useState)(null),g=(0,a.useRef)(null),x=(0,a.useCallback)(()=>{if(r)return;const e=g.current;e&&(m(Vr(e.getBoundingClientRect(),n,220,Math.min(38*t.length+12,360))),h(!0),o?.())},[r,t.length,o,n]),y=(0,a.useCallback)(()=>{h(!1),i?.(),(g.current?.firstElementChild)?.focus?.()},[i]);return(0,a.useEffect)(()=>{if(!p)return;const e=e=>{const t=e.target;if(g.current?.contains(t))return;const n=document.querySelectorAll(".tkx-menu-panel");for(const r of n)if(r.contains(t))return;y()};return document.addEventListener("pointerdown",e),()=>document.removeEventListener("pointerdown",e)},[p,y]),(0,a.useEffect)(()=>{if(!p)return;const e=()=>{const e=g.current;e&&m(Vr(e.getBoundingClientRect(),n,220,Math.min(38*t.length+12,360)))};return window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}},[p,t.length,n]),(0,d.jsxs)("span",{ref:g,className:l,style:{display:"inline-flex",...s},children:[(0,d.jsx)("span",{role:"button",tabIndex:r?-1:0,"aria-haspopup":"menu","aria-expanded":p,"aria-controls":p?u:void 0,"aria-disabled":r||void 0,onClick:()=>p?y():x(),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key&&"ArrowDown"!==e.key||(e.preventDefault(),p||x()),"Escape"===e.key&&p&&(e.preventDefault(),y())},style:{display:"inline-flex",cursor:r?"not-allowed":"pointer",opacity:r?.55:1,outline:"none"},children:e}),p&&f&&(0,c.createPortal)((0,d.jsx)(Kr,{items:t,pos:f,panelId:u,onClose:y,onCloseAll:y}),document.body)]})}Zr.displayName="TkxMenu";var Xr={sm:120,md:180,lg:240,xl:320};function Gr(e){const t=new Date;if(e)try{const n=new Intl.DateTimeFormat("en-US",{timeZone:e,hour:"numeric",minute:"numeric",second:"numeric",hour12:!1,weekday:"long",month:"long",day:"2-digit",year:"numeric"}).formatToParts(t),r=e=>n.find(t=>t.type===e)?.value??"0";let o=parseInt(r("hour"),10);24===o&&(o=0);const i=parseInt(r("minute"),10),a=parseInt(r("second"),10),l=`${r("weekday")}, ${r("month")} ${r("day")}, ${r("year")}`;return{hours:o,minutes:i,seconds:a,milliseconds:t.getMilliseconds(),dateString:l}}catch{}const n=t.getHours(),r=t.getMinutes(),o=t.getSeconds(),i=t.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"2-digit",year:"numeric"});return{hours:n,minutes:r,seconds:o,milliseconds:t.getMilliseconds(),dateString:i}}function _r({time:e,size:t,analogStyle:n,showSeconds:r,reducedMotion:o,primary:i,danger:a,text:l,textMuted:s,border:c,surface:u,bg:p}){const h=t/2,f=t/2,m=t/2-4,{hours:g,minutes:x,seconds:y,milliseconds:b}=e,v=(y+(o?0:b)/1e3)/60*360,w=x/60*360+y/60*6,k=g%12/12*360+x/60*30,$=(e,t)=>{const n=(e-90)*Math.PI/180;return{x:h+Math.cos(n)*t,y:f+Math.sin(n)*t}},S=o?"none":"transform 0.15s cubic-bezier(0.4, 2.08, 0.55, 0.44)";if("modern"===n){const e=(e,t)=>{const n=360*e-90;return`M ${h+Math.cos(-90*Math.PI/180)*t} ${f+Math.sin(-90*Math.PI/180)*t} A ${t} ${t} 0 ${e>.5?1:0} 1 ${h+Math.cos(n*Math.PI/180)*t} ${f+Math.sin(n*Math.PI/180)*t}`},n=g%12/12+x/60/12,u=x/60+y/3600,p=(y+(o?0:b/1e3))/60,v=m-2,w=m-10,k=m-18;return(0,d.jsxs)("svg",{width:t,height:t,viewBox:`0 0 ${t} ${t}`,"aria-hidden":"true",children:[(0,d.jsx)("circle",{cx:h,cy:f,r:v,fill:"none",stroke:c,strokeWidth:4}),(0,d.jsx)("circle",{cx:h,cy:f,r:w,fill:"none",stroke:c,strokeWidth:4}),r&&(0,d.jsx)("circle",{cx:h,cy:f,r:k,fill:"none",stroke:c,strokeWidth:3}),(0,d.jsx)("path",{d:e(n,v),fill:"none",stroke:i,strokeWidth:4,strokeLinecap:"round"}),(0,d.jsx)("path",{d:e(u,w),fill:"none",stroke:l,strokeWidth:4,strokeLinecap:"round"}),r&&(0,d.jsx)("path",{d:e(p,k),fill:"none",stroke:a,strokeWidth:3,strokeLinecap:"round"}),(0,d.jsx)("circle",{cx:h,cy:f,r:4,fill:i}),(0,d.jsxs)("text",{x:h,y:f+20,textAnchor:"middle",fontSize:.12*t,fill:s,fontFamily:"monospace",style:{fontVariantNumeric:"tabular-nums"},children:[String(g).padStart(2,"0"),":",String(x).padStart(2,"0")]})]})}const C=$(k,.5*m),z=$(w,.75*m),M=$(v,.85*m),N=$(v+180,.2*m),D=[];if("classic"===n){for(let e=0;e<60;e++){const t=e%5==0,n=(e/60*360-90)*Math.PI/180,r=t?m-10:m-6,o=h+Math.cos(n)*m,i=f+Math.sin(n)*m,a=h+Math.cos(n)*r,c=f+Math.sin(n)*r;D.push((0,d.jsx)("line",{x1:o,y1:i,x2:a,y2:c,stroke:t?l:s,strokeWidth:t?2:1,strokeLinecap:"round"},e))}for(const{n:e,angle:n}of[{n:12,angle:0},{n:3,angle:90},{n:6,angle:180},{n:9,angle:270}]){const r=(n-90)*Math.PI/180,o=m-20;D.push((0,d.jsx)("text",{x:h+Math.cos(r)*o,y:f+Math.sin(r)*o,textAnchor:"middle",dominantBaseline:"central",fontSize:.09*t,fill:l,fontFamily:"system-ui, sans-serif",fontWeight:"600",children:e},`n${e}`))}}else for(let R=0;R<12;R++){const e=(R/12*360-90)*Math.PI/180,t=m-8;D.push((0,d.jsx)("circle",{cx:h+Math.cos(e)*t,cy:f+Math.sin(e)*t,r:R%3==0?3:2,fill:R%3==0?l:s},R))}return(0,d.jsxs)("svg",{width:t,height:t,viewBox:`0 0 ${t} ${t}`,"aria-hidden":"true",style:{display:"block"},children:[(0,d.jsx)("circle",{cx:h,cy:f,r:m,fill:u,stroke:c,strokeWidth:2}),D,(0,d.jsx)("line",{x1:h,y1:f,x2:C.x,y2:C.y,stroke:i,strokeWidth:"minimal"===n?3:4,strokeLinecap:"round",style:{transformOrigin:`${h}px ${f}px`,transition:S}}),(0,d.jsx)("line",{x1:h,y1:f,x2:z.x,y2:z.y,stroke:l,strokeWidth:"minimal"===n?2:3,strokeLinecap:"round",style:{transformOrigin:`${h}px ${f}px`,transition:S}}),r&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("line",{x1:N.x,y1:N.y,x2:M.x,y2:M.y,stroke:a,strokeWidth:1.5,strokeLinecap:"round",style:{transformOrigin:`${h}px ${f}px`,transition:"none"}}),(0,d.jsx)("circle",{cx:h,cy:f,r:3,fill:a})]}),(0,d.jsx)("circle",{cx:h,cy:f,r:"minimal"===n?3:5,fill:i})]})}function Jr({time:e,format:t,showSeconds:n,showDate:r,label:o,size:i,primary:a,text:l,textMuted:s,colonVisible:c}){const{hours:u,minutes:p,seconds:h,dateString:f}=e;let m=u,g="";"12h"===t&&(g=u>=12?"PM":"AM",m=u%12||12);const x=.2*i,y={opacity:c?1:0,transition:"opacity 0.1s",display:"inline-block",minWidth:"0.5ch",textAlign:"center"};return(0,d.jsxs)("div",{style:{textAlign:"center",fontFamily:"'Courier New', Courier, monospace",fontVariantNumeric:"tabular-nums",lineHeight:1.1},children:[(0,d.jsxs)("div",{style:{fontSize:x,color:a,fontWeight:700,letterSpacing:"0.05em",display:"flex",alignItems:"center",justifyContent:"center",gap:0},children:[(0,d.jsx)("span",{children:String(m).padStart(2,"0")}),(0,d.jsx)("span",{style:y,children:":"}),(0,d.jsx)("span",{children:String(p).padStart(2,"0")}),n&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{style:y,children:":"}),(0,d.jsx)("span",{children:String(h).padStart(2,"0")})]}),"12h"===t&&(0,d.jsx)("span",{style:{fontSize:.45*x,color:s,marginLeft:"0.4ch",alignSelf:"flex-end",marginBottom:.05*x},children:g})]}),r&&(0,d.jsx)("div",{style:{fontSize:.072*i,color:s,marginTop:.025*i,letterSpacing:"0.03em"},children:f}),o&&(0,d.jsx)("div",{style:{fontSize:.065*i,color:s,marginTop:.015*i,textTransform:"uppercase",letterSpacing:"0.08em"},children:pe(o)})]})}function Qr({variant:e="both",size:t="md",showSeconds:n=!0,showDate:r=!1,format:o="24h",timezone:i,timezone2:l,label:s,analogStyle:c="classic",className:u,style:p}){const h=J(),f=qe(),[m,g]=(0,a.useState)(()=>Gr(i)),[x,y]=(0,a.useState)(()=>l?Gr(l):null),[b,v]=(0,a.useState)(!0),[w,k]=(0,a.useState)(!1),$=(0,a.useRef)(null);(0,a.useEffect)(()=>{k(!0)},[]),(0,a.useEffect)(()=>{const e=()=>{g(Gr(i)),l&&y(Gr(l))};e();const t=setInterval(e,1e3);return()=>clearInterval(t)},[i,l]),(0,a.useEffect)(()=>($.current=setInterval(()=>{v(e=>!e)},500),()=>{$.current&&clearInterval($.current)}),[]);const S=Xr[t],C="analog"===e||"both"===e,z="digital"===e||"both"===e;return(0,d.jsxs)("div",{className:u,style:{display:"inline-flex",flexDirection:"column",alignItems:"center",gap:"both"===e?.06*S+"px":0,opacity:w?1:0,transition:f?"none":"opacity 0.4s ease",...p},role:"timer","aria-live":"off",children:[C&&(0,d.jsx)(_r,{time:m,size:S,analogStyle:c,showSeconds:n,reducedMotion:f,primary:h.primary,danger:h.danger,text:h.text,textMuted:h.textMuted,border:h.border,surface:h.surface,bg:h.bg}),z&&(0,d.jsx)(Jr,{time:m,format:o,showSeconds:n,showDate:r,label:s,size:S,primary:h.primary,text:h.text,textMuted:h.textMuted,colonVisible:b}),x&&l&&(0,d.jsx)("div",{style:{marginTop:.04*S,padding:`${.03*S}px ${.06*S}px`,borderTop:`1px solid ${h.border}`,textAlign:"center"},children:(0,d.jsx)(Jr,{time:x,format:o,showSeconds:!1,showDate:!1,label:l,size:.7*S,primary:h.secondary,text:h.text,textMuted:h.textMuted,colonVisible:b})})]})}function eo(e){if(!isFinite(e)||isNaN(e))return"0:00";const t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=Math.floor(e%60);return t>0?`${t}:${String(n).padStart(2,"0")}:${String(r).padStart(2,"0")}`:`${n}:${String(r).padStart(2,"0")}`}function to({path:e,size:t=20,color:n="currentColor",title:r}){return(0,d.jsx)("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:n,"aria-hidden":r?void 0:"true",role:r?"img":void 0,"aria-label":r,style:{display:"block",flexShrink:0},children:(0,d.jsx)("path",{d:e})})}Qr.displayName="TkxClock";var no="M8 5v14l11-7z",ro="M6 19h4V5H6v14zm8-14v14h4V5h-4z";function oo({onClick:e,title:t,children:n,active:r,primary:o}){const[i,l]=(0,a.useState)(!1);return(0,d.jsx)("button",{type:"button",onClick:e,title:t,"aria-label":t,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),style:{background:"none",border:"none",padding:"6px",cursor:"pointer",color:r||i?o:"#ffffff",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"4px",flexShrink:0,transition:"color 0.15s ease"},children:n})}function io({src:e,poster:t,title:n,width:r="100%",height:o,autoPlay:i=!1,loop:l=!1,muted:s=!1,controls:c=!0,showTitle:u=!0,allowFullscreen:p=!0,allowPiP:h=!0,allowDownload:f=!1,chapters:m=[],subtitles:g=[],startTime:x,onPlay:y,onPause:b,onEnded:v,onTimeUpdate:w,className:k,style:$}){const S=J(),C=qe(),z=(0,a.useRef)(null),M=(0,a.useRef)(null),N=(0,a.useRef)(null),D=(0,a.useRef)(null),[R,P]=(0,a.useState)(!1),[F,A]=(0,a.useState)(0),[I,L]=(0,a.useState)(0),[T,W]=(0,a.useState)(0),[j,E]=(0,a.useState)(1),[B,V]=(0,a.useState)(s),[H,O]=(0,a.useState)(!1),[q,U]=(0,a.useState)(!0),[K,Y]=(0,a.useState)(!1),[Z,X]=(0,a.useState)(1),[G,_]=(0,a.useState)(!1),[Q,ee]=(0,a.useState)(-1),[te,ne]=(0,a.useState)(null),[re,oe]=(0,a.useState)(0),[ie,ae]=(0,a.useState)(null),[le,se]=(0,a.useState)(!1),[de,ce]=(0,a.useState)(!1),[ue,he]=(0,a.useState)(null),[fe,me]=(0,a.useState)(!1);(0,a.useEffect)(()=>{const e=z.current;if(!e)return;void 0!==x&&(e.currentTime=x);const t=()=>{A(e.currentTime),e.buffered.length>0&&W(e.buffered.end(e.buffered.length-1))},n=()=>L(e.duration),r=()=>P(!0),o=()=>{P(!1),Y(!0)},i=()=>{P(!1),Y(!0),v?.()},a=()=>se(!0),l=()=>se(!1),s=()=>ce(!0),d=()=>ce(!1),c=()=>{const t=e.error;he(t?`Error ${t.code}: ${t.message||"Failed to load video"}`:"Failed to load video"),ce(!1)};return e.addEventListener("timeupdate",t),e.addEventListener("durationchange",n),e.addEventListener("play",r),e.addEventListener("pause",o),e.addEventListener("ended",i),e.addEventListener("enterpictureinpicture",a),e.addEventListener("leavepictureinpicture",l),e.addEventListener("waiting",s),e.addEventListener("canplay",d),e.addEventListener("error",c),()=>{e.removeEventListener("timeupdate",t),e.removeEventListener("durationchange",n),e.removeEventListener("play",r),e.removeEventListener("pause",o),e.removeEventListener("ended",i),e.removeEventListener("enterpictureinpicture",a),e.removeEventListener("leavepictureinpicture",l),e.removeEventListener("waiting",s),e.removeEventListener("canplay",d),e.removeEventListener("error",c)}},[v,x]),(0,a.useEffect)(()=>{z.current&&(R?y?.():b?.())},[R,y,b]),(0,a.useEffect)(()=>{w?.(F,I)},[F,I,w]),(0,a.useEffect)(()=>{const e=z.current;if(!e)return;const t=e.textTracks;for(let n=0;n<t.length;n++)t[n].mode=n===Q?"showing":"disabled"},[Q]),(0,a.useEffect)(()=>{const e=()=>O(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]),(0,a.useEffect)(()=>{const e=M.current;if(!e)return;const t=e=>{const t=z.current;if(t&&"INPUT"!==e.target.tagName)switch(e.key){case" ":case"k":e.preventDefault(),xe();break;case"f":case"F":p&&be();break;case"m":case"M":ye();break;case"ArrowRight":e.preventDefault(),t.currentTime=Math.min(t.currentTime+10,t.duration);break;case"ArrowLeft":e.preventDefault(),t.currentTime=Math.max(t.currentTime-10,0);break;case"ArrowUp":e.preventDefault(),E(Math.min(j+.1,1)),z.current&&(z.current.volume=Math.min(j+.1,1));break;case"ArrowDown":e.preventDefault(),E(Math.max(j-.1,0)),z.current&&(z.current.volume=Math.max(j-.1,0))}};return e.addEventListener("keydown",t),()=>e.removeEventListener("keydown",t)},[j,p]);const ge=(0,a.useCallback)(()=>{U(!0),D.current&&clearTimeout(D.current),D.current=setTimeout(()=>{R&&U(!1)},3e3)},[R]);(0,a.useEffect)(()=>(ge(),()=>{D.current&&clearTimeout(D.current)}),[R,ge]);const xe=(0,a.useCallback)(()=>{const e=z.current;e&&(e.paused?(e.play().catch(()=>{}),ae("play"),Y(!1)):(e.pause(),ae("pause")),setTimeout(()=>ae(null),600))},[]),ye=(0,a.useCallback)(()=>{const e=z.current;if(!e)return;const t=!B;V(t),e.muted=t},[B]),be=(0,a.useCallback)(()=>{const e=M.current;e&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):e.requestFullscreen().catch(()=>{}))},[]),ve=(0,a.useCallback)(async()=>{const e=z.current;if(e)try{document.pictureInPictureElement?await document.exitPictureInPicture():await e.requestPictureInPicture()}catch{}},[]),we=(0,a.useCallback)(()=>{0!==g.length&&(ee(e=>(e+1)%(g.length+1)-1),ee(e=>{const t=e+1;return t>=g.length?-1:t}))},[g.length]),ke=(0,a.useCallback)(()=>{const e=z.current;e&&(e.currentTime=Math.min(e.currentTime+10,e.duration||0))},[]),$e=(0,a.useCallback)(()=>{const e=z.current;e&&(e.currentTime=Math.max(e.currentTime-10,0))},[]),Se=(0,a.useCallback)(()=>{const e=z.current;e&&(he(null),e.load())},[]),Ce=(0,a.useCallback)(()=>{p&&be()},[p,be]),ze=(0,a.useCallback)(e=>{const t=z.current,n=N.current;if(!t||!n||!I)return;const r=n.getBoundingClientRect();t.currentTime=Math.max(0,Math.min(1,(e.clientX-r.left)/r.width))*I},[I]),Me=(0,a.useCallback)(e=>{const t=N.current;if(!t||!I)return;const n=t.getBoundingClientRect();ne(Math.max(0,Math.min(1,(e.clientX-n.left)/n.width))*I),oe(e.clientX-n.left)},[I]),Ne=(0,a.useCallback)(e=>{const t=parseFloat(e.target.value);E(t),z.current&&(z.current.volume=t,z.current.muted=0===t,V(0===t))},[]),De=(0,a.useCallback)(e=>{X(e),z.current&&(z.current.playbackRate=e),_(!1)},[]),Re=m.length>0?[...m].reverse().find(e=>F>=e.time):null,Pe=e=>[...m].reverse().find(t=>e>=t.time)??null,Fe=Array.isArray(e)?e:[{src:e,type:"video/mp4"}],Ae=Array.isArray(e)?e[0].src:e,Ie=q||K||!R,Le=C?"none":"opacity 0.25s ease",Te=B||0===j?"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":j<.5?"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":"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",We=I>0?F/I*100:0,je=I>0?T/I*100:0;return(0,d.jsxs)("div",{ref:M,className:k,tabIndex:0,onMouseMove:ge,onMouseLeave:()=>{R&&U(!1)},style:{position:"relative",width:r,height:o??"auto",background:"#000",borderRadius:"8px",overflow:"hidden",outline:"none",userSelect:"none",...$},children:[(0,d.jsxs)("video",{ref:z,style:{width:"100%",height:"100%",display:"block",objectFit:"contain"},poster:t,autoPlay:i,loop:l,muted:s,playsInline:!0,onClick:xe,onDoubleClick:Ce,children:[Fe.map((e,t)=>(0,d.jsx)("source",{src:e.src,type:e.type},t)),g.map((e,t)=>(0,d.jsx)("track",{kind:"subtitles",label:pe(e.label),srcLang:e.lang,src:e.src,default:e.default},t))]}),u&&n&&(0,d.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:Ie?1:0,transition:Le,pointerEvents:"none"},children:[(0,d.jsx)("span",{style:{color:"#fff",fontSize:"0.95rem",fontWeight:600,textShadow:"0 1px 3px rgba(0,0,0,0.7)"},children:pe(n)}),Re&&(0,d.jsxs)("span",{style:{color:"rgba(255,255,255,0.65)",fontSize:"0.8rem",marginLeft:8},children:["— ",pe(Re.label)]})]}),ie&&(0,d.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:C?"none":"tkxvp-flash 0.6s ease forwards",pointerEvents:"none"},children:(0,d.jsx)(to,{path:"play"===ie?no:ro,size:32,color:"#fff"})}),de&&!ue&&(0,d.jsx)("div",{"aria-label":"Loading",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",pointerEvents:"none",zIndex:10},children:(0,d.jsx)("div",{style:{width:48,height:48,border:"4px solid rgba(255,255,255,0.25)",borderTopColor:S.primary,borderRadius:"50%",animation:C?"none":"tkxvp-spin 0.8s linear infinite"}})}),ue&&(0,d.jsxs)("div",{style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",background:"rgba(0,0,0,0.8)",zIndex:20,gap:12},children:[(0,d.jsx)(to,{path:"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",size:48,color:"#ef4444"}),(0,d.jsx)("span",{style:{color:"#fff",fontSize:"0.9rem",maxWidth:"80%",textAlign:"center"},children:ue}),(0,d.jsxs)("button",{type:"button",onClick:Se,style:{display:"flex",alignItems:"center",gap:6,background:S.primary,color:"#fff",border:"none",borderRadius:6,padding:"8px 18px",fontSize:"0.85rem",fontWeight:600,cursor:"pointer",marginTop:4},children:[(0,d.jsx)(to,{path:"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",size:18,color:"#fff"}),"Retry"]})]}),c&&(0,d.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:Ie?1:0,transition:Le},onMouseEnter:()=>Y(!0),onMouseLeave:()=>Y(!1),children:[(0,d.jsxs)("div",{ref:N,role:"slider","aria-label":"Seek","aria-valuemin":0,"aria-valuemax":Math.floor(I),"aria-valuenow":Math.floor(F),tabIndex:0,onClick:ze,onMouseMove:Me,style:{position:"relative",height:4,borderRadius:2,background:"rgba(255,255,255,0.25)",cursor:"pointer",marginBottom:8,transition:"height 0.15s ease"},onMouseEnter:e=>{e.currentTarget.style.height="8px"},onMouseLeave:e=>{e.currentTarget.style.height="4px",ne(null)},children:[(0,d.jsx)("div",{style:{position:"absolute",top:0,left:0,bottom:0,width:`${je}%`,background:"rgba(255,255,255,0.3)",borderRadius:2,pointerEvents:"none"}}),(0,d.jsx)("div",{style:{position:"absolute",top:0,left:0,bottom:0,width:`${We}%`,background:S.primary,borderRadius:2,pointerEvents:"none"}}),(0,d.jsx)("div",{style:{position:"absolute",top:"50%",left:`${We}%`,transform:"translate(-50%, -50%)",width:12,height:12,borderRadius:"50%",background:S.primary,pointerEvents:"none"}}),m.map((e,t)=>{const n=I>0?e.time/I*100:0;return(0,d.jsx)("div",{title:pe(e.label),style:{position:"absolute",top:"50%",left:`${n}%`,transform:"translate(-50%, -50%)",width:8,height:8,borderRadius:"50%",background:"#fff",border:`2px solid ${S.primary}`,zIndex:2,cursor:"pointer",pointerEvents:"auto"}},t)}),null!==te&&(0,d.jsxs)("div",{style:{position:"absolute",bottom:12,left:re,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:[eo(te),Pe(te)&&(0,d.jsx)("span",{style:{display:"block",fontSize:"0.65rem",color:"rgba(255,255,255,0.7)"},children:pe(Pe(te).label)})]})]}),(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:2},children:[(0,d.jsx)(oo,{onClick:xe,title:R?"Pause":"Play",primary:S.primary,children:(0,d.jsx)(to,{path:R?ro:no,size:22})}),(0,d.jsx)(oo,{onClick:$e,title:"Skip back 10 seconds",primary:S.primary,children:(0,d.jsxs)("div",{style:{position:"relative",display:"flex",alignItems:"center",justifyContent:"center"},children:[(0,d.jsx)(to,{path:"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",size:22}),(0,d.jsx)("span",{style:{position:"absolute",fontSize:"7px",fontWeight:700,color:"currentColor",marginTop:1},children:"10"})]})}),(0,d.jsx)(oo,{onClick:ke,title:"Skip forward 10 seconds",primary:S.primary,children:(0,d.jsxs)("div",{style:{position:"relative",display:"flex",alignItems:"center",justifyContent:"center"},children:[(0,d.jsx)(to,{path:"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",size:22}),(0,d.jsx)("span",{style:{position:"absolute",fontSize:"7px",fontWeight:700,color:"currentColor",marginTop:1},children:"10"})]})}),(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",position:"relative"},onMouseEnter:()=>me(!0),onMouseLeave:()=>me(!1),children:[(0,d.jsx)(oo,{onClick:ye,title:B?"Unmute":"Mute",primary:S.primary,children:(0,d.jsx)(to,{path:Te,size:20})}),(0,d.jsx)("div",{style:{overflow:"hidden",width:fe?64:0,opacity:fe?1:0,transition:C?"none":"width 0.2s ease, opacity 0.2s ease",display:"flex",alignItems:"center"},children:(0,d.jsx)("input",{type:"range",min:0,max:1,step:.05,value:B?0:j,onChange:Ne,"aria-label":"Volume",style:{width:64,accentColor:S.primary,cursor:"pointer",height:4}})})]}),(0,d.jsxs)("span",{style:{color:"#fff",fontSize:"0.78rem",fontFamily:"monospace",fontVariantNumeric:"tabular-nums",marginLeft:6,whiteSpace:"nowrap",flexShrink:0},children:[eo(F)," / ",eo(I)]}),(0,d.jsx)("div",{style:{flex:1}}),g.length>0&&(0,d.jsx)(oo,{onClick:we,title:"Subtitles",primary:S.primary,active:Q>=0,children:(0,d.jsx)(to,{path:"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",size:20})}),(0,d.jsxs)("div",{style:{position:"relative",display:"flex",alignItems:"center"},children:[(0,d.jsxs)("button",{type:"button",onClick:()=>_(e=>!e),title:"Playback speed",style:{background:"none",border:"none",cursor:"pointer",color:"#fff",fontSize:"0.75rem",fontWeight:600,padding:"6px 8px",letterSpacing:"0.02em",position:"relative"},children:[Z,"×"]}),1!==Z&&(0,d.jsxs)("span",{style:{position:"absolute",top:0,right:0,background:S.primary,color:"#fff",fontSize:"0.55rem",fontWeight:700,borderRadius:6,padding:"1px 4px",lineHeight:1.2,pointerEvents:"none"},children:[Z,"x"]}),G&&(0,d.jsx)("div",{style:{position:"absolute",bottom:"100%",right:0,background:"rgba(20,20,20,0.97)",border:`1px solid ${S.border}`,borderRadius:6,overflow:"hidden",zIndex:100,minWidth:80},children:[.5,.75,1,1.25,1.5,2].map(e=>(0,d.jsxs)("button",{type:"button",onClick:()=>De(e),style:{display:"block",width:"100%",padding:"6px 14px",background:e===Z?S.primary+"30":"none",border:"none",color:e===Z?S.primary:"#fff",fontSize:"0.8rem",cursor:"pointer",textAlign:"left"},children:[e,"×"]},e))})]}),h&&"undefined"!=typeof document&&"pictureInPictureEnabled"in document&&(0,d.jsx)(oo,{onClick:ve,title:"Picture-in-Picture",primary:S.primary,active:le,children:(0,d.jsx)(to,{path:"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",size:20})}),f&&(0,d.jsx)("a",{href:Ae,download:!0,title:"Download",style:{color:"#fff",display:"flex",alignItems:"center",padding:"6px"},children:(0,d.jsx)(to,{path:"M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z",size:20})}),p&&(0,d.jsx)(oo,{onClick:be,title:H?"Exit fullscreen":"Fullscreen",primary:S.primary,children:(0,d.jsx)(to,{path:H?"M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z":"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z",size:20})})]})]}),(0,d.jsx)("style",{children:"\n @keyframes tkxvp-flash {\n 0% { opacity: 1; transform: translate(-50%,-50%) scale(1); }\n 100% { opacity: 0; transform: translate(-50%,-50%) scale(1.5); }\n }\n @keyframes tkxvp-spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "})]})}io.displayName="TkxVideoPlayer";var ao={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 lo({size:e}){const t=.55*e;return(0,d.jsx)("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z"})})}function so({size:e}){const t=.55*e;return(0,d.jsx)("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.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 co({status:e,index:t,showStepNumbers:n,icon:r,circleSize:o,fontSize:i,primary:a,danger:l,success:s,text:c,textMuted:u,border:p,surface:h,bg:f,variant:m,reducedMotion:g,clickable:x}){const y="completed"===e,b="active"===e,v="error"===e;let w=h,k=p,$=u,S=2;y?(w="filled"===m?s:h,k=s,$="filled"===m?f:s):b?(w="outlined"===m?h:a,k=a,$="outlined"===m?a:f,S=2):v?(w="filled"===m?l:h,k=l,$="filled"===m?f:l):"pending"===e&&(w=h,k=p,$=u);const C=b&&!g?{boxShadow:`0 0 0 4px ${a}30`,animation:"tkxstepper-pulse 2s ease-in-out infinite"}:{},z=x?{cursor:"pointer",transition:"transform 0.15s ease, box-shadow 0.15s ease"}:{};let M;return M=!r||y||v?y?(0,d.jsx)(lo,{size:o}):v?(0,d.jsx)(so,{size:o}):n?(0,d.jsx)("span",{style:{fontSize:i,fontWeight:600,lineHeight:1},children:t+1}):(0,d.jsx)("span",{style:{fontSize:.22*o,lineHeight:1,background:$,borderRadius:"50%",width:.22*o,height:.22*o,display:"block"}}):(0,d.jsx)("span",{style:{fontSize:i,lineHeight:1},children:r}),(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("style",{children:`\n @keyframes tkxstepper-pulse {\n 0%, 100% { box-shadow: 0 0 0 0 ${a}50; }\n 50% { box-shadow: 0 0 0 6px ${a}20; }\n }\n `}),(0,d.jsx)("div",{style:{width:o,height:o,minWidth:o,borderRadius:"50%",border:`${S}px solid ${k}`,backgroundColor:w,color:$,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:g?"none":"background-color 0.2s, border-color 0.2s",...C,...z},children:M})]})}function uo({completed:e,orientation:t,connectorStyle:n,connectorWidth:r,primary:o,border:i,reducedMotion:a}){const l=e?o:i;return"horizontal"===t?(0,d.jsx)("div",{"aria-hidden":"true",style:{flex:1,height:r,backgroundColor:"solid"===n?l:"transparent",backgroundImage:"solid"!==n?`repeating-linear-gradient(90deg, ${l} 0, ${l} 6px, transparent 6px, transparent ${"dashed"===n?12:9}px)`:"none",borderRadius:1,transition:a?"none":"background-color 0.3s ease, background-image 0.3s ease",alignSelf:"center",marginLeft:4,marginRight:4}}):(0,d.jsx)("div",{"aria-hidden":"true",style:{width:r,flex:1,minHeight:20,backgroundColor:"solid"===n?l:"transparent",backgroundImage:"solid"!==n?`repeating-linear-gradient(180deg, ${l} 0, ${l} 6px, transparent 6px, transparent ${"dashed"===n?12:9}px)`:"none",borderRadius:1,transition:a?"none":"background-color 0.3s ease, background-image 0.3s ease",alignSelf:"stretch",marginTop:4,marginBottom:4,marginLeft:"auto",marginRight:"auto"}})}function po({steps:e,activeStep:t=0,orientation:n="horizontal",variant:r="default",size:o="md",clickable:i=!1,onStepClick:a,showStepNumbers:l=!0,alternateLabel:s=!1,connector:c="solid",className:u,style:p}){const h=J(),f=qe(),m=ao[o],g="horizontal"===n;return(0,d.jsx)("div",{className:u,role:"list","aria-label":"Steps",style:{display:"flex",flexDirection:g?"row":"column",alignItems:g?s?"flex-start":"center":"stretch",width:"100%",gap:0,...p},children:e.map((n,o)=>{const u=((e,n)=>e.status?e.status:n<t?"completed":n===t?"active":"pending")(n,o),p=o===e.length-1,x="completed"===u||o<t,y=o%2==0,b=()=>{i&&a?.(o)},v=(0,d.jsx)(co,{status:u,index:o,showStepNumbers:l,icon:n.icon,circleSize:m.circle,fontSize:m.fontSize,primary:h.primary,danger:h.danger,success:h.success,text:h.text,textMuted:h.textMuted,border:h.border,surface:h.surface,bg:h.bg,variant:r,reducedMotion:f,clickable:i}),w=(0,d.jsxs)("div",{style:{textAlign:g&&!s?"center":"left",maxWidth:g?120:void 0},children:[(0,d.jsxs)("div",{style:{fontSize:m.titleSize,fontWeight:"active"===u?600:500,color:"pending"===u?h.textMuted:"error"===u?h.danger:h.text,lineHeight:1.3,transition:f?"none":"color 0.2s"},children:[pe(n.title),n.optional&&(0,d.jsx)("span",{style:{fontSize:m.descSize,color:h.textMuted,fontWeight:400,marginLeft:4},children:"(optional)"})]}),n.description&&(0,d.jsx)("div",{style:{fontSize:m.descSize,color:h.textMuted,marginTop:2,lineHeight:1.4},children:pe(n.description)}),n.error&&"error"===u&&(0,d.jsx)("div",{style:{fontSize:m.descSize,color:h.danger,marginTop:2},children:pe(n.error)})]});return g?(0,d.jsxs)("div",{role:"listitem",style:{display:"flex",flex:p?0:1,alignItems:"center",minWidth:0},children:[(0,d.jsxs)("div",{onClick:b,style:{display:"flex",flexDirection:"column",alignItems:"center",gap:6,cursor:i?"pointer":"default",flexShrink:0},"aria-current":"active"===u?"step":void 0,children:[s&&!y&&(0,d.jsx)("div",{style:{minHeight:1.5*m.circle+6,display:"flex",alignItems:"flex-end",paddingBottom:6},children:w}),v,!s&&w,s&&y&&(0,d.jsx)("div",{style:{marginTop:6},children:w})]}),!p&&(0,d.jsx)(uo,{completed:x,orientation:"horizontal",connectorStyle:c,connectorWidth:m.connectorWidth,primary:h.primary,border:h.border,reducedMotion:f})]},n.id):(0,d.jsxs)("div",{role:"listitem",style:{display:"flex",flexDirection:"row",minHeight:0},children:[(0,d.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",marginRight:14,flexShrink:0},children:[(0,d.jsx)("div",{onClick:b,style:{cursor:i?"pointer":"default"},"aria-current":"active"===u?"step":void 0,children:v}),!p&&(0,d.jsx)(uo,{completed:x,orientation:"vertical",connectorStyle:c,connectorWidth:m.connectorWidth,primary:h.primary,border:h.border,reducedMotion:f})]}),(0,d.jsx)("div",{style:{paddingTop:(m.circle-16*parseFloat(m.titleSize))/2,paddingBottom:p?0:16,flex:1,minWidth:0},children:w})]},n.id)})})}function ho(e){let t=0,n=0,r=0;const o=e.replace("#","");3===o.length?(t=parseInt(o[0]+o[0],16),n=parseInt(o[1]+o[1],16),r=parseInt(o[2]+o[2],16)):o.length>=6&&(t=parseInt(o.slice(0,2),16),n=parseInt(o.slice(2,4),16),r=parseInt(o.slice(4,6),16)),t/=255,n/=255,r/=255;const i=Math.max(t,n,r),a=Math.min(t,n,r);let l=0,s=0;const d=(i+a)/2;if(i!==a){const e=i-a;switch(s=d>.5?e/(2-i-a):e/(i+a),i){case t:l=((n-r)/e+(n<r?6:0))/6;break;case n:l=((r-t)/e+2)/6;break;case r:l=((t-n)/e+4)/6}}return[Math.round(360*l),Math.round(100*s),Math.round(100*d)]}function fo(e,t,n){n/=100;const r=(t/=100)*Math.min(n,1-n),o=t=>{const o=(t+e/30)%12,i=n-r*Math.max(Math.min(o-3,9-o,1),-1);return Math.round(255*i).toString(16).padStart(2,"0")};return`#${o(0)}${o(8)}${o(4)}`}function mo(e){const t=e.replace("#",""),n=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),o=parseInt(t.slice(4,6),16);return[isNaN(n)?0:n,isNaN(r)?0:r,isNaN(o)?0:o]}function go(e,t,n){return`#${e.toString(16).padStart(2,"0")}${t.toString(16).padStart(2,"0")}${n.toString(16).padStart(2,"0")}`}function xo(e){return/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(e)}function yo(e,t,n){if("hex"===n)return t<1?`${e}${Math.round(255*t).toString(16).padStart(2,"0")}`:e;const[r,o,i]=mo(e);if("rgb"===n)return t<1?`rgba(${r}, ${o}, ${i}, ${t.toFixed(2)})`:`rgb(${r}, ${o}, ${i})`;const[a,l,s]=ho(e);return"hsl"===n?t<1?`hsla(${a}, ${l}%, ${s}%, ${t.toFixed(2)})`:`hsl(${a}, ${l}%, ${s}%)`:e}po.displayName="TkxStepper";var bo=["#ef4444","#f97316","#eab308","#22c55e","#06b6d4","#3b82f6","#8b5cf6","#ec4899","#ffffff","#94a3b8","#475569","#0f172a"];function vo({hue:e,sat:t,bright:n,onChange:r}){const o=(0,a.useRef)(null),i=(0,a.useRef)(!1),l=(0,a.useCallback)(e=>{const t=o.current;if(!t)return;const n=t.getBoundingClientRect(),i=Math.max(0,Math.min(1,(e.clientX-n.left)/n.width)),a=Math.max(0,Math.min(1,(e.clientY-n.top)/n.height));r(Math.round(100*i),Math.round(100*(1-a)))},[r]);(0,a.useEffect)(()=>{const e=e=>{i.current&&l(e)},t=()=>{i.current=!1};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",t),()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",t)}},[l]);const s=`${t}%`,c=100-n+"%";return(0,d.jsxs)("div",{ref:o,style:{position:"relative",width:"100%",height:"160px",borderRadius:"6px",cursor:"crosshair",background:`hsl(${e}, 100%, 50%)`,flexShrink:0},onMouseDown:e=>{i.current=!0,l(e)},children:[(0,d.jsx)("div",{style:{position:"absolute",inset:0,borderRadius:"6px",background:"linear-gradient(to right, #ffffff, transparent)"}}),(0,d.jsx)("div",{style:{position:"absolute",inset:0,borderRadius:"6px",background:"linear-gradient(to bottom, transparent, #000000)"}}),(0,d.jsx)("div",{style:{position:"absolute",left:s,top:c,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:fo(e,t,n/2+25)}})]})}function wo({hue:e,onChange:t}){const n=(0,a.useRef)(null),r=(0,a.useRef)(!1),o=(0,a.useCallback)(e=>{const r=n.current;if(!r)return;const o=r.getBoundingClientRect(),i=Math.max(0,Math.min(1,(e.clientX-o.left)/o.width));t(Math.round(360*i))},[t]);return(0,a.useEffect)(()=>{const e=e=>{r.current&&o(e)},t=()=>{r.current=!1};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",t),()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",t)}},[o]),(0,d.jsx)("div",{ref:n,style:{position:"relative",height:"12px",borderRadius:"6px",cursor:"pointer",background:"linear-gradient(to right, #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000)"},onMouseDown:e=>{r.current=!0,o(e)},children:(0,d.jsx)("div",{style:{position:"absolute",left:e/360*100+"%",top:"50%",transform:"translate(-50%, -50%)",width:"16px",height:"16px",borderRadius:"50%",border:"2px solid white",boxShadow:"0 0 0 1px rgba(0,0,0,0.3)",backgroundColor:`hsl(${e}, 100%, 50%)`,pointerEvents:"none"}})})}function ko({alpha:e,hex:t,onChange:n}){const r=(0,a.useRef)(null),o=(0,a.useRef)(!1),i=(0,a.useCallback)(e=>{const t=r.current;if(!t)return;const o=t.getBoundingClientRect(),i=Math.max(0,Math.min(1,(e.clientX-o.left)/o.width));n(Math.round(100*i)/100)},[n]);(0,a.useEffect)(()=>{const e=e=>{o.current&&i(e)},t=()=>{o.current=!1};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",t),()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",t)}},[i]);const[l,s,c]=mo(t);return(0,d.jsxs)("div",{style:{position:"relative"},children:[(0,d.jsx)("div",{style:{position:"absolute",inset:0,borderRadius:"6px",backgroundImage:"repeating-conic-gradient(#ccc 0% 25%, white 0% 50%)",backgroundSize:"8px 8px"}}),(0,d.jsx)("div",{ref:r,style:{position:"relative",height:"12px",borderRadius:"6px",cursor:"pointer",background:`linear-gradient(to right, rgba(${l},${s},${c},0), rgba(${l},${s},${c},1))`},onMouseDown:e=>{o.current=!0,i(e)},children:(0,d.jsx)("div",{style:{position:"absolute",left:100*e+"%",top:"50%",transform:"translate(-50%, -50%)",width:"16px",height:"16px",borderRadius:"50%",border:"2px solid white",boxShadow:"0 0 0 1px rgba(0,0,0,0.3)",backgroundColor:`rgba(${l},${s},${c},${e})`,pointerEvents:"none"}})})]})}var $o={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 So(e,t,n){let r=e;return void 0!==t&&(r=Math.max(r,t)),void 0!==n&&(r=Math.min(r,n)),r}function Co(e,t){if(void 0===t)return e;const n=Math.pow(10,t);return Math.round(e*n)/n}function zo({direction:e,isDisabled:t,btnW:n,height:r,primaryColor:o,borderColor:i,textMuted:l,iconSz:s,onStep:c,incrementLabel:u,decrementLabel:p}){const h=(0,a.useRef)(null),f=(0,a.useRef)(null),m="inc"===e?1:-1,g=(0,a.useCallback)(()=>{c(m),h.current=setTimeout(()=>{f.current=setInterval(()=>c(m),60)},400)},[m,c]),x=(0,a.useCallback)(()=>{h.current&&(clearTimeout(h.current),h.current=null),f.current&&(clearInterval(f.current),f.current=null)},[]);(0,a.useEffect)(()=>()=>x(),[x]);const y="inc"===e;return(0,d.jsx)("button",{type:"button","aria-label":y?u:p,disabled:t,onMouseDown:g,onMouseUp:x,onMouseLeave:x,onTouchStart:e=>{e.preventDefault(),g()},onTouchEnd:x,style:{width:n,height:r,minWidth:n,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",background:"transparent",border:"none",borderRight:y?void 0:`1px solid ${i}`,borderLeft:y?`1px solid ${i}`:void 0,cursor:t?"not-allowed":"pointer",color:t?l:o,transition:"color 120ms ease, background 120ms ease",outline:"none"},onFocus:e=>{t||(e.currentTarget.style.background=`${o}12`)},onBlur:e=>{e.currentTarget.style.background="transparent"},children:y?(0,d.jsxs)("svg",{width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:[(0,d.jsx)("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),(0,d.jsx)("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}):(0,d.jsx)("svg",{width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:(0,d.jsx)("line",{x1:"5",y1:"12",x2:"19",y2:"12"})})})}function Mo({value:e,defaultValue:t=0,onChange:n,min:r,max:o,step:i=1,precision:l,prefix:s,suffix:c,format:u,currency:p,locale:h,clampOnBlur:f=!0,allowMouseWheel:m=!1,size:g="md",label:x,hint:y,isDisabled:b=!1,isReadOnly:v=!1,isInvalid:w=!1,errorMessage:k,id:$,className:S,style:C}){const z=J(),M=_t(),N=M.increment??"Increment",D=M.decrement??"Decrement",R=(0,a.useId)(),P=$??R,F=`${P}-hint`,A=`${P}-error`,I=void 0!==e,[L,T]=(0,a.useState)(t),W=I?e:L,[j,E]=(0,a.useState)(!1),[B,V]=(0,a.useState)(""),H=$o[g],O=w||!!k,q=O?z.danger:j?z.primary:z.border,U=[y&&F,O&&A].filter(Boolean).join(" ")||void 0,K=x?pe(x):void 0,Y=y?pe(y):void 0,Z=k?pe(k):void 0,X=s?pe(s):void 0,G=c?pe(c):void 0,_=(0,a.useCallback)(e=>{const t=Co(e,l);I||T(t),n?.(t)},[I,n,l]),Q=(0,a.useCallback)(e=>{b||v||_(So(Co(W+e*i,l),r,o))},[b,v,W,i,l,r,o,_]),ee=j?B:function(e,t,n,r,o){const i=r??"en-US";return"currency"===t?new Intl.NumberFormat(i,{style:"currency",currency:n??"USD",minimumFractionDigits:o??2,maximumFractionDigits:o??2}).format(e):"percent"===t?new Intl.NumberFormat(i,{style:"percent",minimumFractionDigits:o??0,maximumFractionDigits:o??0}).format(e/100):"decimal"===t||void 0!==o?new Intl.NumberFormat(i,{minimumFractionDigits:o??0,maximumFractionDigits:o??20}).format(e):String(e)}(W,u,p,h,l),te=(X||G)&&!j;return(0,d.jsxs)("div",{className:Ct($t("flex flex-col gap-1 w-full"),S),style:C,children:[K&&(0,d.jsx)("label",{htmlFor:P,className:$t("text-sm font-medium font-sans"),style:{color:z.text},children:K}),(0,d.jsxs)("div",{className:$t("flex items-stretch overflow-hidden rounded-lg transition-colors duration-150"),style:{border:`1.5px solid ${q}`,backgroundColor:b?z.surfaceAlt:z.surface,opacity:b?.65:1,height:H.height},children:[(0,d.jsx)(zo,{direction:"dec",isDisabled:b||v,btnW:H.btnW,height:H.height,primaryColor:z.primary,borderColor:z.border,textMuted:z.textMuted,iconSz:H.iconSz,onStep:Q,incrementLabel:N,decrementLabel:D}),(0,d.jsxs)("div",{className:$t("relative flex-1 flex items-center overflow-hidden"),children:[te&&X&&(0,d.jsx)("span",{style:{position:"absolute",left:H.px,fontSize:H.fontSize,color:z.textMuted,pointerEvents:"none",userSelect:"none"},children:X}),(0,d.jsx)("input",{id:P,type:"text",inputMode:"decimal",value:j?B:ee,readOnly:v,disabled:b,"aria-invalid":O,"aria-describedby":U,"aria-valuemin":r,"aria-valuemax":o,"aria-valuenow":W,style:{width:"100%",height:"100%",border:"none",background:"transparent",outline:"none",textAlign:"center",fontSize:H.fontSize,fontFamily:"inherit",color:z.text,paddingLeft:te&&X?`calc(${H.px} + 1.2em)`:H.px,paddingRight:te&&G?`calc(${H.px} + 1.2em)`:H.px,cursor:b?"not-allowed":v?"default":"text"},onFocus:()=>{E(!0),V(String(W))},onBlur:()=>{E(!1);const e=parseFloat(B);if(isNaN(e))return n?.(null),void V(String(W));let t=Co(e,l);f&&(t=So(t,r,o)),_(t)},onChange:e=>{V(Fe(e.target.value))},onKeyDown:e=>{"ArrowUp"===e.key&&(e.preventDefault(),Q(1)),"ArrowDown"===e.key&&(e.preventDefault(),Q(-1))},onWheel:e=>{m&&j&&(e.preventDefault(),Q(e.deltaY<0?1:-1))}}),te&&G&&(0,d.jsx)("span",{style:{position:"absolute",right:H.px,fontSize:H.fontSize,color:z.textMuted,pointerEvents:"none",userSelect:"none"},children:G})]}),(0,d.jsx)(zo,{direction:"inc",isDisabled:b||v,btnW:H.btnW,height:H.height,primaryColor:z.primary,borderColor:z.border,textMuted:z.textMuted,iconSz:H.iconSz,onStep:Q,incrementLabel:N,decrementLabel:D})]}),Y&&!Z&&(0,d.jsx)("span",{id:F,className:$t("text-xs"),style:{color:z.textMuted},children:Y}),Z&&(0,d.jsxs)("span",{id:A,role:"alert",className:$t("text-xs flex items-center gap-1"),style:{color:z.danger},children:[(0,d.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.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]})]})}Mo.displayName="TkxNumberInput";var No={sm:{box:"36px",fontSize:"1rem",gap:"6px"},md:{box:"44px",fontSize:"1.25rem",gap:"8px"},lg:{box:"52px",fontSize:"1.5rem",gap:"10px"}},Do={number:/^\d$/,alphanumeric:/^[a-zA-Z0-9]$/,alpha:/^[a-zA-Z]$/};function Ro(e,t){return Do[t].test(e)?e.toUpperCase():""}function Po({length:e=6,value:t,onChange:n,onComplete:r,type:o="number",mask:i=!1,autoFocus:l=!1,isDisabled:s=!1,isInvalid:c=!1,errorMessage:u,hint:p,size:h="md",separator:f,separatorPosition:m,webOTP:g=!0,className:x,style:y}){const b=J(),v=_t(),w=(0,a.useId)(),k=`${w}-hint`,$=`${w}-error`,S=void 0!==t,C=t=>{const n=t.split("").slice(0,e);for(;n.length<e;)n.push("");return n},[z,M]=(0,a.useState)(()=>C(S?t:"")),N=S?C(t):z,D=(0,a.useRef)([]),R=No[h],P=c||!!u,F=N.every(e=>""!==e),A=p?pe(p):void 0,I=u?pe(u):void 0,L=e=>P?b.danger:F?b.success:b.border;(0,a.useEffect)(()=>{l&&D.current[0]?.focus()},[]);const T=(0,a.useCallback)(e=>{S||M(e);const t=e.join("");n?.(t),e.every(e=>""!==e)&&r?.(t)},[S,n,r]);(0,a.useEffect)(()=>{if(!g||s)return;if("undefined"==typeof window||!("OTPCredential"in window))return;const t=new AbortController;return navigator.credentials?.get({otp:{transport:["sms"]},signal:t.signal}).then(t=>{if(!t?.code)return;const n=String(t.code).slice(0,e).split("").map(e=>Ro(e,o));for(;n.length<e;)n.push("");T(n)}).catch(()=>{}),()=>t.abort()},[g,s,e,o]);const W=t=>{const n=Math.max(0,Math.min(e-1,t));D.current[n]?.focus()},j=t=>n=>{if(!s){if("Backspace"!==n.key){if("Delete"===n.key){n.preventDefault();const e=[...N];return e[t]="",void T(e)}return"ArrowLeft"===n.key?(n.preventDefault(),void W(t-1)):"ArrowRight"===n.key?(n.preventDefault(),void W(t+1)):"Home"===n.key?(n.preventDefault(),void W(0)):"End"===n.key?(n.preventDefault(),void W(e-1)):void 0}if(n.preventDefault(),""!==N[t]){const e=[...N];e[t]="",T(e)}else if(t>0){const e=[...N];e[t-1]="",T(e),W(t-1)}}},E=t=>n=>{if(s)return;const r=Fe(n.target.value).slice(-1);if(!r)return;const i=Ro(r,o);if(!i)return;const a=[...N];a[t]=i,T(a),t<e-1&&W(t+1)},B=t=>n=>{if(n.preventDefault(),s)return;const r=Fe(n.clipboardData.getData("text")).split("").map(e=>Ro(e,o)).filter(Boolean);if(!r.length)return;const i=[...N];let a=t;for(const t of r){if(a>=e)break;i[a]=t,a++}T(i),W(Math.min(a,e-1))},V=[A&&k,P&&$].filter(Boolean).join(" ")||void 0;return(0,d.jsxs)("div",{className:Ct($t("flex flex-col gap-2 w-fit"),x),style:y,children:[(0,d.jsx)("div",{role:"group","aria-label":v.oneTimePassword??"One-time password","aria-describedby":V,className:$t("flex items-center"),style:{gap:R.gap},children:Array.from({length:e},(t,n)=>{const r=L();return"undefined"!=typeof document&&(document.activeElement,D.current[n]),(0,d.jsxs)("div",{className:$t("flex items-center"),style:{gap:R.gap},children:[f&&m===n&&0!==n&&(0,d.jsx)("span",{"aria-hidden":"true",style:{color:b.textMuted,userSelect:"none",flexShrink:0},children:f}),(0,d.jsx)("input",{ref:e=>{D.current[n]=e},type:i?"password":"text",inputMode:"number"===o?"numeric":"text",maxLength:1,value:N[n],disabled:s,"aria-label":`Digit ${n+1} of ${e}`,autoComplete:"one-time-code",spellCheck:!1,onChange:E(n),onKeyDown:j(n),onPaste:B(n),onFocus:e=>e.target.select(),style:{width:R.box,height:R.box,textAlign:"center",fontSize:R.fontSize,fontFamily:"monospace",fontWeight:600,border:`1.5px solid ${r}`,borderRadius:"8px",backgroundColor:s?b.surfaceAlt:b.surface,color:b.text,outline:"none",boxShadow:"none",cursor:s?"not-allowed":"text",transition:"border-color 150ms ease, box-shadow 150ms ease",opacity:s?.6:1},onFocusCapture:e=>{s||(e.currentTarget.style.borderColor=P?b.danger:b.primary,e.currentTarget.style.boxShadow=`0 0 0 3px ${P?b.danger:b.primary}33`)},onBlurCapture:e=>{e.currentTarget.style.borderColor=L(),e.currentTarget.style.boxShadow="none"}})]},n)})}),A&&!I&&(0,d.jsx)("span",{id:k,className:$t("text-xs"),style:{color:b.textMuted},children:A}),I&&(0,d.jsxs)("span",{id:$,role:"alert",className:$t("text-xs flex items-center gap-1"),style:{color:b.danger},children:[(0,d.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.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]})]})}function Fo(e,t){if(!e)return{matched:!0,ranges:[],score:0};const n=e.toLowerCase(),r=t.toLowerCase(),o=r.indexOf(n);if(-1!==o)return{matched:!0,ranges:[[o,o+n.length-1]],score:0===o?100:80};const i=[];let a=0,l=-1,s=-1;for(let d=0;d<r.length&&a<n.length;d++)r[d]===n[a]&&(-1!==s&&d===s+1||(-1!==l&&i.push([l,s]),l=d),s=d,a++);return-1!==l&&-1!==s&&i.push([l,s]),a<n.length?{matched:!1,ranges:[],score:0}:{matched:!0,ranges:i,score:40}}function Ao({text:e,ranges:t,color:n}){if(!t.length)return(0,d.jsx)(d.Fragment,{children:e});const r=[];let o=0;for(const[i,a]of t)o<i&&r.push((0,d.jsx)("span",{children:e.slice(o,i)},`t-${o}`)),r.push((0,d.jsx)("span",{style:{color:n,fontWeight:700},children:e.slice(i,a+1)},`h-${i}`)),o=a+1;return o<e.length&&r.push((0,d.jsx)("span",{children:e.slice(o)},"t-end")),(0,d.jsx)(d.Fragment,{children:r})}function Io({surface:e,border:t}){return(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"10px 12px",borderRadius:8,overflow:"hidden"},children:[(0,d.jsx)("div",{style:{width:24,height:24,borderRadius:6,background:`linear-gradient(90deg, ${t} 25%, ${e} 50%, ${t} 75%)`,backgroundSize:"200% 100%",animation:"tkx-shimmer 1.4s ease-in-out infinite",flexShrink:0}}),(0,d.jsxs)("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:5},children:[(0,d.jsx)("div",{style:{height:13,borderRadius:4,width:"60%",background:`linear-gradient(90deg, ${t} 25%, ${e} 50%, ${t} 75%)`,backgroundSize:"200% 100%",animation:"tkx-shimmer 1.4s ease-in-out infinite"}}),(0,d.jsx)("div",{style:{height:10,borderRadius:4,width:"40%",background:`linear-gradient(90deg, ${t} 25%, ${e} 50%, ${t} 75%)`,backgroundSize:"200% 100%",animation:"tkx-shimmer 1.4s ease-in-out 0.2s infinite"}})]})]})}function Lo({items:e,isOpen:t=!1,onClose:n,placeholder:r,emptyMessage:o,maxItems:i=8,onItemSelect:l,className:s,style:u}){const p=J(),h=_t(),f=r??h.commandSearch??"Type a command or search…",[m,g]=(0,a.useState)(""),[x,y]=(0,a.useState)(0),[b,v]=(0,a.useState)(!1),w=(0,a.useRef)(null),k=(0,a.useRef)(null),$=(0,a.useId)(),S=function(e){const t=(0,a.useRef)(null);return(0,a.useEffect)(()=>{if(!e||!t.current)return;const n=t.current,r=n.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),o=r[0],i=r[r.length-1],a=e=>{"Tab"===e.key&&(e.shiftKey?document.activeElement===o&&(e.preventDefault(),i?.focus()):document.activeElement===i&&(e.preventDefault(),o?.focus()))};return n.addEventListener("keydown",a),()=>n.removeEventListener("keydown",a)},[e]),t}(t),C=function(e,t){if(!e.trim())return t.filter(e=>!e.disabled).map(e=>({item:e,score:0,labelRanges:[]}));const n=[];for(const r of t){if(r.disabled)continue;const t=Fo(e,r.label),o=r.description?Fo(e,r.description):{matched:!1,score:0},i=(r.keywords??[]).some(t=>Fo(e,t).matched);t.matched?n.push({item:r,score:t.score+20,labelRanges:t.ranges}):o.matched?n.push({item:r,score:o.score,labelRanges:[]}):i&&n.push({item:r,score:20,labelRanges:[]})}return n.sort((e,t)=>t.score-e.score)}(m,e).slice(0,i),z=[];for(const a of C){const e=a.item.group,t=z.find(t=>t.group===e);t?t.items.push(a):z.push({group:e,items:[a]})}const M=z.flatMap(e=>e.items);var N,D;N=()=>{n?.()},D=t,(0,a.useEffect)(()=>{if(!D)return;const e=e=>{"Escape"===e.key&&N()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[N,D]),(0,a.useEffect)(()=>{t&&(g(""),y(0),setTimeout(()=>w.current?.focus(),30))},[t]),(0,a.useEffect)(()=>{x>=M.length&&y(Math.max(0,M.length-1))},[M.length,x]);const R=(0,a.useCallback)(e=>{const t=k.current;t&&t.querySelectorAll("[data-command-item]")[e]?.scrollIntoView({block:"nearest"})},[]),P=e=>{e.disabled||(e.onSelect?.(),l?.(e),n?.())};if(!t||"undefined"==typeof document)return null;const F=pe(f),A=h.noCommandsFound??`No results for "${pe(m)}"`,I=o?pe(o):A;if("undefined"!=typeof document&&!document.getElementById("tkx-shimmer-style")){const e=document.createElement("style");e.id="tkx-shimmer-style",e.textContent="@keyframes tkx-shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }",document.head.appendChild(e)}return(0,c.createPortal)((0,d.jsxs)("div",{role:"presentation",style:{position:"fixed",inset:0,zIndex:1e4,display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"15vh",paddingLeft:16,paddingRight:16},children:[(0,d.jsx)("div",{"aria-hidden":"true",onClick:n,style:{position:"absolute",inset:0,backgroundColor:"rgba(0,0,0,0.55)",backdropFilter:"blur(4px)",animation:"tkx-fade-in 120ms ease"}}),(0,d.jsxs)("div",{ref:S,role:"dialog","aria-modal":"true","aria-label":"Command palette",id:$,className:Ct(s),style:{position:"relative",zIndex:1,width:"100%",maxWidth:560,backgroundColor:p.surface,border:`1px solid ${p.border}`,borderRadius:16,boxShadow:`0 24px 64px rgba(0,0,0,0.5), 0 0 0 1px ${p.border}`,overflow:"hidden",display:"flex",flexDirection:"column",maxHeight:"70vh",...u},children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 16px",borderBottom:`1px solid ${p.border}`},children:[(0,d.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:p.textMuted,strokeWidth:2,"aria-hidden":"true",style:{flexShrink:0},children:[(0,d.jsx)("circle",{cx:"11",cy:"11",r:"8"}),(0,d.jsx)("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),(0,d.jsx)("input",{ref:w,type:"text",role:"combobox","aria-expanded":!0,"aria-autocomplete":"list","aria-controls":`${$}-list`,"aria-activedescendant":M[x]?`${$}-item-${M[x].item.id}`:void 0,value:m,onChange:e=>{g(e.target.value),y(0)},onKeyDown:e=>{if("ArrowDown"===e.key){e.preventDefault();const t=Math.min(M.length-1,x+1);y(t),R(t)}else if("ArrowUp"===e.key){e.preventDefault();const t=Math.max(0,x-1);y(t),R(t)}else if("Enter"===e.key){e.preventDefault();const t=M[x];t&&P(t.item)}},placeholder:F,style:{flex:1,border:"none",background:"transparent",outline:"none",fontSize:16,fontFamily:"inherit",color:p.text}}),m&&(0,d.jsx)("button",{type:"button","aria-label":h.clearSelection,onClick:()=>{g(""),y(0),w.current?.focus()},style:{border:"none",background:"transparent",cursor:"pointer",color:p.textMuted,display:"flex",alignItems:"center",padding:0},children:(0,d.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:[(0,d.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,d.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),(0,d.jsx)("div",{id:`${$}-list`,ref:k,role:"listbox","aria-label":"Command results",style:{overflowY:"auto",flex:1,padding:"6px 8px"},children:b?Array.from({length:4},(e,t)=>(0,d.jsx)(Io,{surface:p.surface,border:p.border},t)):0===M.length?(0,d.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:8,padding:"32px 16px",color:p.textMuted},children:[(0,d.jsxs)("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,"aria-hidden":"true",children:[(0,d.jsx)("circle",{cx:"11",cy:"11",r:"8"}),(0,d.jsx)("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"}),(0,d.jsx)("line",{x1:"8",y1:"11",x2:"14",y2:"11"})]}),(0,d.jsx)("span",{style:{fontSize:"0.875rem"},children:I})]}):z.map(({group:e,items:t},n)=>{const r=z.slice(0,n).reduce((e,t)=>e+t.items.length,0);return(0,d.jsxs)("div",{children:[e&&(0,d.jsx)("div",{role:"presentation",style:{fontSize:"0.6875rem",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.08em",color:p.textMuted,padding:"10px 12px 4px"},children:pe(e)}),t.map((e,t)=>{const n=r+t,o=n===x,i=e.item;return(0,d.jsxs)("div",{id:`${$}-item-${i.id}`,role:"option","aria-selected":o,"aria-disabled":i.disabled,"data-command-item":!0,onClick:()=>P(i),onMouseEnter:()=>y(n),style:{display:"flex",alignItems:"center",gap:10,padding:"9px 12px",borderRadius:8,cursor:i.disabled?"not-allowed":"pointer",opacity:i.disabled?.45:1,backgroundColor:o?`${p.primary}18`:"transparent",borderLeft:o?`2px solid ${p.primary}`:"2px solid transparent",transition:"background 80ms ease",userSelect:"none"},children:[i.icon&&(0,d.jsx)("span",{style:{width:20,height:20,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",color:o?p.primary:p.textMuted},children:i.icon}),(0,d.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,d.jsx)("div",{style:{fontSize:"0.875rem",fontWeight:500,color:p.text,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:(0,d.jsx)(Ao,{text:i.label,ranges:e.labelRanges,color:p.primary})}),i.description&&(0,d.jsx)("div",{style:{fontSize:"0.75rem",color:p.textMuted,marginTop:1,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:pe(i.description)})]}),i.shortcut&&(0,d.jsx)("span",{style:{flexShrink:0,fontSize:"0.6875rem",fontWeight:500,color:p.textMuted,backgroundColor:p.surfaceAlt,border:`1px solid ${p.border}`,borderRadius:6,padding:"2px 6px",fontFamily:"monospace",letterSpacing:"0.04em"},children:pe(i.shortcut)})]},i.id)})]},e??"__default__")})}),M.length>0&&(0,d.jsxs)("div",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",gap:12,padding:"8px 16px",borderTop:`1px solid ${p.border}`,fontSize:"0.6875rem",color:p.textMuted},children:[(0,d.jsxs)("span",{children:[(0,d.jsx)("kbd",{style:{fontFamily:"monospace"},children:"↑↓"})," navigate"]}),(0,d.jsxs)("span",{children:[(0,d.jsx)("kbd",{style:{fontFamily:"monospace"},children:"↵"})," select"]}),(0,d.jsxs)("span",{children:[(0,d.jsx)("kbd",{style:{fontFamily:"monospace"},children:"Esc"})," close"]})]})]})]}),document.body)}function To({direction:e,onClick:t,isDisabled:n,primaryColor:r,surfaceColor:o,textColor:i,position:a,orientation:l}){const s="vertical"===l,c="prev"===e,u="inside"===a?{position:"absolute",zIndex:3,...s?{[c?"top":"bottom"]:10,left:"50%",transform:"translateX(-50%)"}:{[c?"left":"right"]:10,top:"50%",transform:"translateY(-50%)"}}:{flexShrink:0,position:"relative"};return(0,d.jsx)("button",{type:"button","aria-label":c?"Previous slide":"Next slide",disabled:n,onClick:t,style:{...u,width:36,height:36,borderRadius:"50%",border:"none",backgroundColor:`${o}cc`,backdropFilter:"blur(4px)",color:i,display:"flex",alignItems:"center",justifyContent:"center",cursor:n?"not-allowed":"pointer",opacity:n?.35:1,transition:"background 150ms ease, opacity 150ms ease",outline:"none"},onFocus:e=>{e.currentTarget.style.boxShadow=`0 0 0 3px ${r}55`},onBlur:e=>{e.currentTarget.style.boxShadow="none"},onMouseEnter:e=>{n||(e.currentTarget.style.backgroundColor=o)},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=`${o}cc`},children:s?c?(0,d.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:(0,d.jsx)("polyline",{points:"18 15 12 9 6 15"})}):(0,d.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:(0,d.jsx)("polyline",{points:"6 9 12 15 18 9"})}):c?(0,d.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:(0,d.jsx)("polyline",{points:"15 18 9 12 15 6"})}):(0,d.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:(0,d.jsx)("polyline",{points:"9 18 15 12 9 6"})})})}function Wo({slides:e,autoPlay:t=!1,autoPlayInterval:n=4e3,pauseOnHover:r=!0,loop:o=!0,showArrows:i=!0,showDots:l=!0,showThumbnails:s=!1,orientation:c="horizontal",slidesToShow:u=1,gap:p=0,transitionDuration:h=400,swipeable:f=!0,initialIndex:m=0,onChange:g,arrowPosition:x="inside",height:y=320,className:b,style:v}){const w=J(),k=qe(),$=(0,a.useId)(),S=e.length,[C,z]=(0,a.useState)(m),[M,N]=(0,a.useState)(o?m+1:m),[D,R]=(0,a.useState)(!1),[P,F]=(0,a.useState)(!1),A=(0,a.useRef)(null),I=(0,a.useRef)(null),L=(0,a.useRef)(null),T=(0,a.useRef)(0),W=(0,a.useRef)(!1),j="vertical"===c,E=k?0:h,B=o&&S>1?[e[S-1],...e,e[0]]:e,V=B.length,H=100/u,O=(e,t=0)=>{const n=0!==t?` - ${t}px`:"";return j?`translateY(calc(-${e*H}%${n}))`:`translateX(calc(-${e*H}%${n}))`},q=(0,a.useCallback)((e,t=!1)=>{const n=o?(e%S+S)%S:Math.max(0,Math.min(S-1,e)),r=o?n+1:n;t&&A.current?(A.current.style.transition="none",N(r),z(n),A.current.offsetHeight,A.current.style.transition=""):(R(!0),N(r),z(n)),g?.(n)},[S,o,g]),U=(0,a.useCallback)(()=>q(C-1),[C,q]),K=(0,a.useCallback)(()=>q(C+1),[C,q]),Y=(0,a.useCallback)(()=>{R(!1),!o||S<=1||(0===M?q(S-1,!0):M===V-1&&q(0,!0))},[o,S,M,V,q]);(0,a.useEffect)(()=>{if(!(!t||P||S<=1))return I.current=setInterval(K,n),()=>{I.current&&clearInterval(I.current)}},[t,P,n,K,S]),(0,a.useEffect)(()=>{const e=e=>{const t=document.activeElement;document.getElementById($)?.contains(t)&&(e.key===(j?"ArrowUp":"ArrowLeft")&&(e.preventDefault(),U()),e.key===(j?"ArrowDown":"ArrowRight")&&(e.preventDefault(),K()))};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[$,j,U,K]);const Z=e=>"touches"in e?j?e.touches[0].clientY:e.touches[0].clientX:j?e.clientY:e.clientX,X=e=>{f&&(L.current=Z(e),T.current=0,W.current=!0)},G=e=>{if(!W.current||null===L.current)return;const t=Z(e)-L.current;T.current=t,A.current&&(A.current.style.transition="none",A.current.style.transform=O(M,-t))},_=()=>{if(!W.current)return;W.current=!1;const e=T.current;A.current&&(A.current.style.transition="",A.current.style.transform=""),e<-50?K():e>50?U():A.current&&(A.current.style.transform=O(M)),L.current=null,T.current=0},Q="number"==typeof y?`${y}px`:y,ee={display:"flex",flexDirection:j?"column":"row",width:j?"100%":V/u*100+"%",height:j?V/u*100+"%":"100%",transform:O(M),transition:D||!k?`transform ${E}ms cubic-bezier(0.4, 0, 0.2, 1)`:"none",willChange:"transform",gap:p>0?p:void 0},te={flexShrink:0,width:j?"100%":H/(V/u)+"%",height:j?H/(V/u)+"%":"100%",overflow:"hidden",position:"relative"},ne=o||C>0,re=o||C<S-1,oe="outside"===x;return(0,d.jsxs)("div",{id:$,className:Ct($t("flex flex-col gap-2"),b),style:v,"aria-roledescription":"carousel","aria-label":"Content carousel",children:[(0,d.jsxs)("div",{className:$t("flex items-center gap-2"),style:{gap:oe&&i?8:0},children:[i&&oe&&(0,d.jsx)(To,{direction:"prev",onClick:U,isDisabled:!ne,primaryColor:w.primary,surfaceColor:w.surface,textColor:w.text,position:"outside",orientation:c}),(0,d.jsxs)("div",{style:{position:"relative",flex:1,overflow:"hidden",height:Q,borderRadius:12,cursor:f?W.current?"grabbing":"grab":"default",userSelect:"none"},onMouseEnter:()=>r&&F(!0),onMouseLeave:()=>{F(!1),_()},onTouchStart:X,onTouchMove:G,onTouchEnd:_,onMouseDown:X,onMouseMove:G,onMouseUp:_,"aria-live":"polite","aria-atomic":"false",children:[i&&!oe&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(To,{direction:"prev",onClick:U,isDisabled:!ne,primaryColor:w.primary,surfaceColor:w.surface,textColor:w.text,position:"inside",orientation:c}),(0,d.jsx)(To,{direction:"next",onClick:K,isDisabled:!re,primaryColor:w.primary,surfaceColor:w.surface,textColor:w.text,position:"inside",orientation:c})]}),(0,d.jsx)("div",{ref:A,style:ee,onTransitionEnd:Y,children:B.map((e,t)=>(0,d.jsx)("div",{style:te,role:"group","aria-roledescription":"slide","aria-label":`Slide ${(t-(o?1:0)+S)%S+1} of ${S}`,"aria-hidden":(t-(o?1:0)+S)%S!==C,children:e.content},`${e.id}-${t}`))}),l&&!s&&(0,d.jsx)("div",{"aria-label":"Slide indicators",style:{position:"absolute",bottom:12,left:"50%",transform:"translateX(-50%)",display:"flex",gap:6,zIndex:2},children:e.map((e,t)=>(0,d.jsx)("button",{type:"button","aria-label":`Go to slide ${t+1}`,"aria-current":t===C?"true":void 0,onClick:()=>q(t),style:{width:t===C?20:8,height:8,borderRadius:9999,border:"none",backgroundColor:t===C?w.primary:w.textMuted,cursor:"pointer",padding:0,transition:"width 250ms ease, background 250ms ease",outline:"none"},onFocus:e=>{e.currentTarget.style.boxShadow=`0 0 0 3px ${w.primary}66`},onBlur:e=>{e.currentTarget.style.boxShadow="none"}},e.id))})]}),i&&oe&&(0,d.jsx)(To,{direction:"next",onClick:K,isDisabled:!re,primaryColor:w.primary,surfaceColor:w.surface,textColor:w.text,position:"outside",orientation:c})]}),s&&(0,d.jsx)("div",{role:"tablist","aria-label":"Slide thumbnails",style:{display:"flex",gap:6,overflowX:"auto",paddingBottom:4,scrollbarWidth:"thin"},children:e.map((e,t)=>(0,d.jsxs)("button",{type:"button",role:"tab","aria-selected":t===C,"aria-label":`Thumbnail for slide ${t+1}`,onClick:()=>q(t),style:{flexShrink:0,width:60,height:42,border:`2px solid ${t===C?w.primary:w.border}`,borderRadius:6,overflow:"hidden",cursor:"pointer",padding:0,background:w.surfaceAlt,transition:"border-color 150ms ease",outline:"none",position:"relative"},onFocus:e=>{e.currentTarget.style.boxShadow=`0 0 0 3px ${w.primary}55`},onBlur:e=>{e.currentTarget.style.boxShadow="none"},children:[e.thumbnail?(0,d.jsx)("img",{src:e.thumbnail,alt:"","aria-hidden":"true",style:{width:"100%",height:"100%",objectFit:"cover",display:"block"}}):(0,d.jsx)("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"0.625rem",color:w.textMuted,fontWeight:600},children:t+1}),t===C&&(0,d.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",inset:0,backgroundColor:`${w.primary}22`}})]},e.id))})]})}function jo({color:e}){return(0,d.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",style:{flexShrink:0},children:(0,d.jsx)("path",{d:"M6 3l5 5-5 5",stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Eo({onClick:e,bgColor:t,hoverColor:n,textColor:r,label:o}){return(0,d.jsx)("button",{type:"button",onClick:e,onKeyDown:t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e())},"aria-label":o,className:$t("inline-flex items-center justify-center rounded px-1.5 py-0.5","text-sm font-medium cursor-pointer border-none outline-none","focus-visible:ring-2 focus-visible:ring-offset-1"),style:{backgroundColor:t,color:r,transition:"background-color 150ms ease"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor=n},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=t},children:"…"})}function Bo(e,t){if(!t)return!0;const n=t.toLowerCase(),r=e.label.toLowerCase();let o=0;for(let i=0;i<r.length&&o<n.length;i++)r[i]===n[o]&&o++;return o===n.length}function Vo({color:e}){return(0,d.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",style:{animation:"spin 0.8s linear infinite",flexShrink:0},children:[(0,d.jsx)("circle",{cx:"8",cy:"8",r:"6",stroke:e,strokeWidth:"2",opacity:"0.3"}),(0,d.jsx)("path",{d:"M14 8a6 6 0 00-6-6",stroke:e,strokeWidth:"2",strokeLinecap:"round"})]})}function Ho({expanded:e,color:t,reducedMotion:n}){return(0,d.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",style:{transform:e?"rotate(90deg)":"rotate(0deg)",transition:n?"none":"transform 150ms ease",flexShrink:0},children:(0,d.jsx)("path",{d:"M6 3l5 5-5 5",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Oo({checked:e,color:t,borderColor:n}){return(0,d.jsx)("span",{role:"presentation","aria-hidden":"true",className:$t("inline-flex items-center justify-center flex-shrink-0"),style:{width:16,height:16,borderRadius:3,border:`1.5px solid ${e?t:n}`,backgroundColor:e?t:"transparent",transition:"all 100ms ease"},children:e&&(0,d.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:(0,d.jsx)("path",{d:"M2 5l2.5 2.5L8 3",stroke:"#fff",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})}Po.displayName="TkxOTP",Lo.displayName="TkxCommand",Wo.displayName="TkxCarousel";var qo={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 Uo({color:e}){return(0,d.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[(0,d.jsx)("circle",{cx:"6",cy:"6",r:"4.5",stroke:e,strokeWidth:"1.5"}),(0,d.jsx)("path",{d:"M9.5 9.5L13 13",stroke:e,strokeWidth:"1.5",strokeLinecap:"round"})]})}function Ko({checked:e,primaryColor:t,borderColor:n}){return(0,d.jsx)("span",{"aria-hidden":"true",className:$t("inline-flex items-center justify-center flex-shrink-0"),style:{width:16,height:16,borderRadius:3,border:`1.5px solid ${e?t:n}`,backgroundColor:e?t:"transparent",transition:"all 100ms ease"},children:e&&(0,d.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:(0,d.jsx)("path",{d:"M2 5l2.5 2.5L8 3",stroke:"#fff",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})}function Yo({color:e}){return(0,d.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M3 8h10M9 4l4 4-4 4",stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Zo({color:e}){return(0,d.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M13 8H3M7 4l-4 4 4 4",stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Xo({title:e,items:t,selected:n,onToggle:r,onToggleAll:o,search:i,onSearchChange:l,searchable:s,height:c,listId:u}){const p=J(),h=qe(),f=pe(e),m=(0,a.useMemo)(()=>{if(!i)return t;const e=i.toLowerCase();return t.filter(t=>t.label.toLowerCase().includes(e))},[t,i]),g=m.filter(e=>!e.disabled),x=g.length>0&&g.every(e=>n.has(e.value));g.some(e=>n.has(e.value));const y=(0,a.useRef)(new Map),[b,v]=(0,a.useState)(null),w=null!==b&&m.some(e=>e.value===b)?b:m[0]?.value;return(0,d.jsxs)("div",{className:$t("flex flex-col rounded-lg overflow-hidden flex-1 min-w-0"),style:{border:`1px solid ${p.border}`,backgroundColor:p.surface},children:[(0,d.jsxs)("div",{className:$t("flex items-center gap-2 px-3 py-2 border-b"),style:{borderColor:p.border,backgroundColor:p.surfaceAlt},children:[(0,d.jsx)("button",{type:"button","aria-label":x?`Deselect all ${f}`:`Select all ${f}`,onClick:o,className:$t("border-none bg-transparent cursor-pointer p-0 outline-none focus-visible:ring-2"),children:(0,d.jsx)(Ko,{checked:x,primaryColor:p.primary,borderColor:p.border})}),(0,d.jsx)("span",{className:$t("text-sm font-medium flex-1 truncate"),style:{color:p.text},children:f}),(0,d.jsxs)("span",{className:$t("text-xs"),style:{color:p.textMuted},children:[n.size,"/",t.length]})]}),s&&(0,d.jsxs)("div",{className:$t("flex items-center gap-1.5 px-3 py-1.5 border-b"),style:{borderColor:p.border},children:[(0,d.jsx)(Uo,{color:p.textMuted}),(0,d.jsx)("input",{type:"text","aria-label":`Search ${f}`,value:i,onChange:e=>l(e.target.value),placeholder:"Search...",className:$t("flex-1 bg-transparent border-none outline-none text-xs"),style:{color:p.text}})]}),(0,d.jsx)("ul",{id:u,role:"listbox","aria-label":f,"aria-multiselectable":"true",className:$t("list-none m-0 p-1 overflow-y-auto"),style:{height:c,minHeight:100},children:0===m.length?(0,d.jsx)("li",{className:$t("text-xs text-center py-4"),style:{color:p.textMuted},"aria-disabled":"true",children:"No items"}):m.map(e=>{const t=n.has(e.value),o=pe(e.label);return(0,d.jsxs)("li",{ref:t=>{t?y.current.set(e.value,t):y.current.delete(e.value)},role:"option","aria-selected":t,"aria-disabled":e.disabled||void 0,tabIndex:w===e.value?0:-1,onFocus:()=>v(e.value),onClick:()=>!e.disabled&&r(e.value),onKeyDown:t=>((e,t)=>{if("Enter"===e.key||" "===e.key)return e.preventDefault(),void r(t);if("ArrowDown"===e.key||"ArrowUp"===e.key||"Home"===e.key||"End"===e.key){if(e.preventDefault(),0===m.length)return;const n=m.findIndex(e=>e.value===t);if(n<0)return;let r=n;"ArrowDown"===e.key?r=(n+1)%m.length:"ArrowUp"===e.key?r=(n-1+m.length)%m.length:"Home"===e.key?r=0:"End"===e.key&&(r=m.length-1);const o=m[r]?.value;o&&y.current.get(o)?.focus()}})(t,e.value),className:$t("flex items-center gap-2 px-2 py-1.5 rounded-md cursor-pointer text-sm","outline-none focus-visible:ring-2 focus-visible:ring-offset-1",e.disabled?"opacity-50 cursor-not-allowed":""),style:{color:e.disabled?p.textMuted:p.text,backgroundColor:t?`${p.primary}10`:"transparent",transition:h?"none":"background-color 100ms ease"},onMouseEnter:n=>{e.disabled||t||(n.currentTarget.style.backgroundColor=p.surfaceAlt)},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=t?`${p.primary}10`:"transparent"},children:[(0,d.jsx)(Ko,{checked:t,primaryColor:p.primary,borderColor:p.border}),(0,d.jsx)("span",{className:$t("truncate"),children:o})]},e.value)})})]})}function Go({color:e,rotated:t,reducedMotion:n}){return(0,d.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",style:{transform:t?"rotate(45deg)":"rotate(0deg)",transition:n?"none":"transform 200ms ease"},children:(0,d.jsx)("path",{d:"M12 5v14M5 12h14",stroke:e,strokeWidth:"2.5",strokeLinecap:"round"})})}var _o={"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 Jo({open:e}){return(0,d.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round","aria-hidden":"true",children:e?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,d.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),(0,d.jsx)("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),(0,d.jsx)("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]})})}var Qo=!1,ei=!1,ti={success:(0,d.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm-2 14.5l-4-4 1.41-1.41L10 13.67l6.59-6.59L18 8.5l-8 8z"})}),error:(0,d.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),warning:(0,d.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"})}),info:(0,d.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.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"})})},ni={"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 ri({direction:e}){return(0,d.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:$t("shrink-0 ml-1"),children:"asc"===e?(0,d.jsx)("path",{d:"M7 14l5-5 5 5H7z"}):"desc"===e?(0,d.jsx)("path",{d:"M7 10l5 5 5-5H7z"}):(0,d.jsx)("path",{d:"M7 10l5 5 5-5H7zM7 14l5-5 5 5H7z",opacity:"0.35"})})}function oi({expanded:e}){return(0,d.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10","aria-hidden":"true",style:{display:"inline-block",marginRight:6,transform:e?"rotate(90deg)":"rotate(0deg)",transition:"transform 120ms ease"},children:(0,d.jsx)("path",{d:"M2 1l6 4-6 4z",fill:"currentColor"})})}function ii({expanded:e}){return(0,d.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10","aria-hidden":"true",style:{display:"inline-block",transform:e?"rotate(90deg)":"rotate(0deg)",transition:"transform 120ms ease"},children:(0,d.jsx)("path",{d:"M2 1l6 4-6 4z",fill:"currentColor"})})}function ai({checked:e,indeterminate:t}){const n=J();return(0,d.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16","aria-hidden":"true",children:[(0,d.jsx)("rect",{x:"1",y:"1",width:"14",height:"14",rx:"2",fill:e||t?n.primary:"transparent",stroke:e||t?n.primary:n.border,strokeWidth:"1.5"}),t&&(0,d.jsx)("line",{x1:"4",y1:"8",x2:"12",y2:"8",stroke:n.bg,strokeWidth:"2"}),e&&!t&&(0,d.jsx)("path",{d:"M4.5 8L7 10.5L11.5 5.5",fill:"none",stroke:n.bg,strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function li(e,t){return"function"==typeof t?t(e):String(e[t])}function si(e,t){return e[t]}function di(e,t){return null==e&&null==t?0:null==e?1:null==t?-1:"number"==typeof e&&"number"==typeof t?e-t:String(e).localeCompare(String(t),void 0,{numeric:!0,sensitivity:"base"})}function ci(e){const t=String(e??"");return t.includes(",")||t.includes('"')||t.includes("\n")?`"${t.replace(/"/g,'""')}"`:t}function ui({colCount:e}){const t=J();return(0,d.jsx)("tbody",{children:Array.from({length:5},(n,r)=>(0,d.jsx)("tr",{children:Array.from({length:e},(e,n)=>(0,d.jsx)("td",{className:$t("px-3 py-2"),style:{borderBottom:`1px solid ${t.border}`},children:(0,d.jsx)(an,{height:16})},n))},r))})}function pi({label:e,showExport:t,onExport:n,totalRows:r,selectedCount:o,theme:i}){return t||0!==o?(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",borderBottom:`1px solid ${i.border}`,backgroundColor:i.surface,gap:8},children:[(0,d.jsx)("span",{style:{fontSize:13,color:i.textMuted},children:o>0?`${o} of ${r} row${1!==r?"s":""} selected`:`${r} row${1!==r?"s":""}`}),t&&(0,d.jsxs)("button",{onClick:n,"aria-label":`Export ${e} as CSV`,style:{display:"inline-flex",alignItems:"center",gap:6,padding:"5px 12px",fontSize:13,fontWeight:500,borderRadius:6,border:`1px solid ${i.border}`,backgroundColor:"transparent",color:i.text,cursor:"pointer"},children:[(0,d.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,d.jsx)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,d.jsx)("polyline",{points:"7 10 12 15 17 10"}),(0,d.jsx)("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]}),"Export CSV"]})]}):null}function hi({page:e,totalPages:t,pageSize:n,totalRows:r,onPageChange:o,theme:i}){const a=(e-1)*n+1,l=Math.min(e*n,r),s={display:"inline-flex",alignItems:"center",justifyContent:"center",width:32,height:32,borderRadius:6,border:`1px solid ${i.border}`,backgroundColor:"transparent",color:i.text,cursor:"pointer",fontSize:13,fontWeight:500};return(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",borderTop:`1px solid ${i.border}`,backgroundColor:i.surface,gap:8,flexWrap:"wrap"},role:"navigation","aria-label":"Pagination",children:[(0,d.jsx)("span",{style:{fontSize:13,color:i.textMuted},children:0===r?"0 rows":`${a}–${l} of ${r}`}),(0,d.jsxs)("div",{style:{display:"flex",gap:4},children:[(0,d.jsx)("button",{onClick:()=>o(1),disabled:1===e,"aria-label":"First page",style:{...s,opacity:1===e?.4:1},children:"«"}),(0,d.jsx)("button",{onClick:()=>o(e-1),disabled:1===e,"aria-label":"Previous page",style:{...s,opacity:1===e?.4:1},children:"‹"}),Array.from({length:Math.min(5,t)},(n,r)=>{let a=r+1;return t>5&&(a=Math.max(1,Math.min(e-Math.floor(2.5),t-4))+r),(0,d.jsx)("button",{onClick:()=>o(a),"aria-label":`Page ${a}`,"aria-current":a===e?"page":void 0,style:{...s,backgroundColor:a===e?i.primary:"transparent",color:a===e?i.bg:i.text,borderColor:a===e?i.primary:i.border},children:a},a)}),(0,d.jsx)("button",{onClick:()=>o(e+1),disabled:e===t,"aria-label":"Next page",style:{...s,opacity:e===t?.4:1},children:"›"}),(0,d.jsx)("button",{onClick:()=>o(t),disabled:e===t,"aria-label":"Last page",style:{...s,opacity:e===t?.4:1},children:"»"})]})]})}function fi({col:e,row:t,initialValue:n,onCommit:r,onCancel:o}){const i=J(),[l,s]=(0,a.useState)(n),[c,u]=(0,a.useState)(null),p=(0,a.useRef)(null),h=(0,a.useId)(),f=(0,a.useRef)(!1);(0,a.useEffect)(()=>{if(p.current&&(p.current.focus(),"select"in p.current&&"function"==typeof p.current.select))try{p.current.select()}catch{}},[]);const m=(0,a.useCallback)(n=>{if(e.validateCell){const r=e.validateCell(n,t);if(r)return u(r),!1}return u(null),r(n),!0},[e,t,r]),g=(0,a.useCallback)(e=>{"Enter"===e.key?(e.preventDefault(),e.stopPropagation(),m(l)):"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),f.current=!0,o())},[l,m,o]),x=(0,a.useCallback)(()=>{f.current?f.current=!1:m(l)},[m,l]);if("function"==typeof e.editor)return(0,d.jsxs)(d.Fragment,{children:[e.editor({value:n,row:t,onCommit:e=>m(e),onCancel:o}),c&&(0,d.jsx)("span",{id:h,role:"alert",style:{display:"block",marginTop:2,fontSize:11,color:"#dc2626"},children:c})]});const y=`Edit ${e.header}`,b={width:"100%",padding:"3px 6px",fontSize:13,borderRadius:4,border:`1px solid ${c?"#dc2626":i.primary}`,backgroundColor:i.bg,color:i.text,outline:"none",boxSizing:"border-box"};let v;if("select"===e.editor){const t=e.editorOptions?.options??[];v=(0,d.jsx)("select",{ref:e=>{p.current=e},value:l,onChange:e=>s(e.target.value),onKeyDown:g,onBlur:x,"aria-label":y,"aria-describedby":c?h:void 0,style:b,children:t.map(e=>(0,d.jsx)("option",{value:e.value,children:e.label},String(e.value)))})}else v="number"===e.editor?(0,d.jsx)("input",{ref:e=>{p.current=e},type:"number",value:null==l?"":String(l),onChange:e=>{const t=e.target.value;s(""===t?"":Number(t))},onKeyDown:g,onBlur:x,"aria-label":y,"aria-describedby":c?h:void 0,style:b}):(0,d.jsx)("input",{ref:e=>{p.current=e},type:"text",value:null==l?"":String(l),onChange:e=>s(e.target.value),onKeyDown:g,onBlur:x,"aria-label":y,"aria-describedby":c?h:void 0,style:b});return(0,d.jsxs)(d.Fragment,{children:[v,c&&(0,d.jsx)("span",{id:h,role:"alert","data-cell-error":"",style:{display:"block",marginTop:2,fontSize:11,color:"#dc2626"},children:c})]})}var mi=!1,gi={info:(0,d.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"})}),warning:(0,d.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"})}),success:(0,d.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm-2 14.5l-4-4 1.41-1.41L10 13.67l6.59-6.59L18 8.5l-8 8z"})}),danger:(0,d.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.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"})})},xi={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}},yi={heading:function({block:e}){const t=J(),n=e.level??1,r=`h${n}`,o=pe(e.content??"");return(0,d.jsx)(r,{className:$t("m-0"),style:{...xi[n],color:t.text},children:o})},paragraph:function({block:e}){const t=J(),n=pe(e.content??"");return(0,d.jsx)("p",{className:$t("m-0"),style:{fontSize:"0.938rem",lineHeight:1.7,color:t.text,marginBottom:12},children:n})},blockquote:function({block:e}){const t=J(),n=pe(e.content??"");return(0,d.jsx)("blockquote",{className:$t("m-0"),style:{borderLeft:`3px solid ${t.primary}`,paddingLeft:16,paddingTop:8,paddingBottom:8,marginTop:12,marginBottom:12,backgroundColor:`${t.surfaceAlt}`,borderRadius:"0 6px 6px 0",color:t.textMuted,fontStyle:"italic",fontSize:"0.938rem",lineHeight:1.6},children:n})},code:function({block:e}){const t=J(),n=pe(e.content??""),r=e.language?pe(e.language):null;return(0,d.jsxs)("div",{className:$t("rounded-lg overflow-hidden"),style:{marginTop:12,marginBottom:12,border:`1px solid ${t.border}`,backgroundColor:t.surfaceAlt},children:[r&&(0,d.jsx)("div",{className:$t("px-3 py-1 text-[11px] font-semibold uppercase tracking-wider"),style:{color:t.textMuted,borderBottom:`1px solid ${t.border}`,backgroundColor:t.surface},children:r}),(0,d.jsx)("pre",{className:$t("m-0 p-4 overflow-x-auto"),style:{fontFamily:"'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace",fontSize:"0.85rem",lineHeight:1.6,color:t.text,tabSize:2},children:(0,d.jsx)("code",{"aria-label":r?`Code block in ${r}`:"Code block",children:n})})]})},list:function({block:e}){const t=J(),n=e.ordered?"ol":"ul",r=(e.items??[]).map(e=>pe(e));return(0,d.jsx)(n,{className:$t("m-0"),style:{paddingLeft:24,marginTop:8,marginBottom:12,color:t.text,fontSize:"0.938rem",lineHeight:1.7,listStyleType:e.ordered?"decimal":"disc"},role:"list",children:r.map((e,t)=>(0,d.jsx)("li",{role:"listitem",style:{marginBottom:4},children:e},t))})},divider:function(){return(0,d.jsx)("hr",{"aria-hidden":"true",style:{border:"none",borderTop:`1px solid ${J().border}`,marginTop:20,marginBottom:20}})},image:function({block:e}){const t=J(),n=pe(e.src??""),r=pe(e.alt??"Image");return(0,d.jsxs)("figure",{className:$t("m-0"),style:{marginTop:12,marginBottom:12},children:[(0,d.jsx)("img",{src:n,alt:r,loading:"lazy",className:$t("rounded-lg"),style:{maxWidth:"100%",height:"auto",display:"block",border:`1px solid ${t.border}`}}),e.alt&&(0,d.jsx)("figcaption",{className:$t("text-xs mt-2 text-center"),style:{color:t.textMuted},children:r})]})},callout:function({block:e}){const t=J(),n=e.variant??"info",r=pe(e.content??""),o={info:t.info,warning:t.warning,success:t.success,danger:t.danger}[n],i=gi[n];return(0,d.jsxs)("div",{role:{info:"note",warning:"alert",success:"status",danger:"alert"}[n],className:$t("flex gap-3 px-4 py-3 rounded-lg"),style:{backgroundColor:`${o}12`,border:`1px solid ${o}33`,marginTop:12,marginBottom:12},children:[(0,d.jsx)("span",{className:$t("shrink-0 mt-[2px]"),style:{color:o},children:i}),(0,d.jsx)("div",{className:$t("flex-1"),style:{fontSize:"0.9rem",lineHeight:1.6,color:t.text},children:r})]})}};function bi(e){const t=[];let n=0,r="";const o=()=>{r&&(t.push({kind:"text",value:r}),r="")};for(;n<e.length;){const i=e[n];if("\\"===i&&n+1<e.length)r+=e[n+1],n+=2;else{if("!"===i&&"["===e[n+1]){const r=e.indexOf("]",n+2);if(-1!==r&&"("===e[r+1]){const i=e.indexOf(")",r+2);if(-1!==i){o(),t.push({kind:"image",alt:e.slice(n+2,r),src:e.slice(r+2,i)}),n=i+1;continue}}}if("["===i){const r=vi(e,n,"[","]");if(-1!==r&&"("===e[r+1]){const i=e.indexOf(")",r+2);if(-1!==i){o(),t.push({kind:"link",href:e.slice(r+2,i).trim(),children:bi(e.slice(n+1,r))}),n=i+1;continue}}}if("<"===i){const r=e.indexOf(">",n+1);if(-1!==r){const i=e.slice(n+1,r);if(/^(https?:\/\/|mailto:)/i.test(i)||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i)){o();const e=/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i)?`mailto:${i}`:i;t.push({kind:"link",href:e,children:[{kind:"text",value:i}]}),n=r+1;continue}}}if("`"===i){const r=e.indexOf("`",n+1);if(-1!==r){o(),t.push({kind:"code",value:e.slice(n+1,r)}),n=r+1;continue}}if("~"===i&&"~"===e[n+1]){const r=e.indexOf("~~",n+2);if(-1!==r){o(),t.push({kind:"strike",children:bi(e.slice(n+2,r))}),n=r+2;continue}}if("*"===i&&"*"===e[n+1]||"_"===i&&"_"===e[n+1]){const r=i+i,a=e.indexOf(r,n+2);if(-1!==a){o(),t.push({kind:"bold",children:bi(e.slice(n+2,a))}),n=a+2;continue}}if(("*"===i||"_"===i)&&e[n+1]!==i){const r=e.indexOf(i,n+1);if(-1!==r&&e.slice(n+1,r).trim().length>0){o(),t.push({kind:"italic",children:bi(e.slice(n+1,r))}),n=r+1;continue}}r+=i,n++}}return o(),t}function vi(e,t,n,r){let o=0;for(let i=t;i<e.length;i++)if("\\"!==e[i]){if(e[i]===n)o++;else if(e[i]===r&&(o--,0===o))return i}else i++;return-1}function wi(e){const t=e.replace(/^\uFEFF/,"").replace(/\r\n?/g,"\n").split("\n"),n=[];let r=0;for(;r<t.length;){const e=t[r];if(/^\s*$/.test(e)){r++;continue}const o=e.match(/^\s*```(.*)$/);if(o){const e=o[1].trim();r++;const i=[];for(;r<t.length&&!/^\s*```\s*$/.test(t[r]);)i.push(t[r]),r++;r<t.length&&r++,n.push({kind:"code",language:e,value:i.join("\n")});continue}const i=e.match(/^(#{1,6})\s+(.*?)\s*#*\s*$/);if(i){n.push({kind:"heading",level:i[1].length,inline:bi(i[2])}),r++;continue}if(/^\s*([-*_])\s*(?:\1\s*){2,}$/.test(e)){n.push({kind:"hr"}),r++;continue}if(Si(e)&&r+1<t.length&&Ci(t[r+1])){const o=zi(e).map(bi),i=Mi(t[r+1]);r+=2;const a=[];for(;r<t.length&&Si(t[r]);)a.push(zi(t[r]).map(bi)),r++;n.push({kind:"table",headers:o,rows:a,align:i});continue}if(/^\s*>/.test(e)){const e=[];for(;r<t.length&&/^\s*>/.test(t[r]);)e.push(t[r].replace(/^\s*>\s?/,"")),r++;n.push({kind:"blockquote",children:wi(e.join("\n"))});continue}if(ki(e)){const[e,o]=$i(t,r);n.push(e),r=o;continue}const a=[e];for(r++;r<t.length&&!/^\s*$/.test(t[r])&&!/^#{1,6}\s/.test(t[r])&&!/^\s*```/.test(t[r])&&!/^\s*>/.test(t[r])&&!ki(t[r])&&!/^\s*([-*_])\s*(?:\1\s*){2,}$/.test(t[r]);)a.push(t[r]),r++;n.push({kind:"paragraph",inline:bi(a.join(" "))})}return n}function ki(e){return/^(\s*)([-*+]|\d+[.)])\s+/.test(e)}function $i(e,t){const n=e[t].match(/^(\s*)([-*+]|\d+[.)])\s+/),r=n[1].length,o=/\d/.test(n[2]),i=[];let a=t;for(;a<e.length;){const t=e[a].match(/^(\s*)([-*+]|\d+[.)])\s+(.*)$/);if(!t||t[1].length!==r)break;const n=t[3];let o=null,l=n;const s=n.match(/^\[([ xX])\]\s+(.*)$/);s&&(o="x"===s[1].toLowerCase()?"checked":"unchecked",l=s[2]);const d=[l];for(a++;a<e.length;){if(/^\s*$/.test(e[a])){if(a+1<e.length&&/^\s+\S/.test(e[a+1])){d.push(""),a++;continue}break}const t=e[a].match(/^(\s*)(\S)/);if(!(t&&t[1].length>r))break;d.push(e[a].slice(r+2)),a++}i.push({blocks:wi(d.join("\n")),task:o})}return[{kind:"list",ordered:o,items:i},a]}function Si(e){return/^\s*\|.+\|\s*$/.test(e.trim())||e.includes("|")&&e.trim().startsWith("|")}function Ci(e){return/^\s*\|?\s*:?-{2,}:?\s*(\|\s*:?-{2,}:?\s*)+\|?\s*$/.test(e)}function zi(e){return e.trim().replace(/^\|/,"").replace(/\|$/,"").split("|").map(e=>e.trim())}function Mi(e){return zi(e).map(e=>{const t=e.startsWith(":"),n=e.endsWith(":");return t&&n?"center":n?"right":t?"left":null})}function Ni(e,t,n="i"){return e.map((e,r)=>{const o=`${n}-${r}`;switch(e.kind){case"text":return(0,d.jsx)("span",{children:pe(e.value)},o);case"bold":return(0,d.jsx)("strong",{children:Ni(e.children,t,o)},o);case"italic":return(0,d.jsx)("em",{children:Ni(e.children,t,o)},o);case"strike":return(0,d.jsx)("s",{children:Ni(e.children,t,o)},o);case"code":return(0,d.jsx)("code",{style:{background:t.theme.surfaceAlt,border:`1px solid ${t.theme.border}`,borderRadius:4,padding:"0.15em 0.4em",fontSize:"0.9em",fontFamily:"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",wordBreak:"break-word"},children:pe(e.value)},o);case"link":{const n=Di(e.href);if(!n)return(0,d.jsx)("span",{children:Ni(e.children,t,o)},o);const r=/^(https?:)?\/\//i.test(n)||n.startsWith("mailto:");return(0,d.jsx)("a",{href:n,target:r?t.externalLinkTarget:void 0,rel:r?t.externalLinkRel:void 0,onClick:e=>{!1===t.onLinkClick?.(n,e)&&e.preventDefault()},style:{color:t.theme.primary,textDecoration:"underline",wordBreak:"break-word"},children:Ni(e.children,t,o)},o)}case"image":return(0,d.jsx)("img",{src:Di(e.src)||"",alt:pe(e.alt),loading:"lazy",decoding:"async",style:{maxWidth:"100%",height:"auto",borderRadius:6,display:"inline-block"}},o)}})}function Di(e){const t=e.trim();return t?/^javascript:/i.test(t)||/^data:/i.test(t)&&!/^data:image\//i.test(t)||/^vbscript:/i.test(t)?null:t:null}function Ri({text:e,theme:t}){const[n,r]=(0,a.useState)(!1);return(0,d.jsx)("button",{type:"button",onClick:()=>{"undefined"!=typeof navigator&&navigator.clipboard&&navigator.clipboard.writeText(e).then(()=>{r(!0),setTimeout(()=>r(!1),1500)})},"aria-label":n?"Copied to clipboard":"Copy code",style:{position:"absolute",top:6,right:6,padding:"2px 8px",fontSize:11,background:t.surface,color:n?t.success:t.textMuted,border:`1px solid ${t.border}`,borderRadius:4,cursor:"pointer",fontFamily:"inherit",transition:"color 120ms"},children:n?"Copied":"Copy"})}function Pi(e,t,n="b"){return e.map((e,r)=>{const o=`${n}-${r}`;switch(e.kind){case"heading":{const n=`h${e.level}`,r={1:{fs:t.compact?"1.75rem":"2rem",lh:"1.2",mt:"0.6em",mb:"0.5em",fw:700},2:{fs:t.compact?"1.4rem":"1.6rem",lh:"1.25",mt:"1em",mb:"0.5em",fw:700},3:{fs:t.compact?"1.2rem":"1.3rem",lh:"1.3",mt:"1em",mb:"0.4em",fw:600},4:{fs:"1.1rem",lh:"1.35",mt:"1em",mb:"0.4em",fw:600},5:{fs:"1rem",lh:"1.4",mt:"1em",mb:"0.3em",fw:600},6:{fs:"0.9rem",lh:"1.4",mt:"1em",mb:"0.3em",fw:600}}[e.level];return(0,d.jsx)(n,{style:{fontSize:r.fs,lineHeight:r.lh,marginTop:r.mt,marginBottom:r.mb,fontWeight:r.fw,color:t.theme.text,scrollMarginTop:"1em"},children:Ni(e.inline,t,o)},o)}case"paragraph":return(0,d.jsx)("p",{style:{margin:"0 0 "+(t.compact?"0.7em":"1em"),lineHeight:1.65,color:t.theme.text,wordBreak:"break-word"},children:Ni(e.inline,t,o)},o);case"blockquote":return(0,d.jsx)("blockquote",{style:{margin:"0 0 1em",padding:"0.5em 1em",borderLeft:`4px solid ${t.theme.primary}`,background:`${t.theme.surfaceAlt}`,color:t.theme.textMuted,borderRadius:"0 6px 6px 0"},children:Pi(e.children,t,o)},o);case"code":{const n=e.value;return(0,d.jsxs)("div",{style:{position:"relative",margin:"0 0 1em",border:`1px solid ${t.theme.border}`,borderRadius:8,background:t.theme.surfaceAlt,overflow:"hidden"},children:[e.language&&(0,d.jsx)("div",{style:{padding:"4px 10px",fontSize:11,color:t.theme.textMuted,borderBottom:`1px solid ${t.theme.border}`,textTransform:"uppercase",letterSpacing:"0.05em"},children:pe(e.language)}),t.copyableCode&&(0,d.jsx)(Ri,{text:n,theme:t.theme}),(0,d.jsx)("pre",{style:{margin:0,padding:12,overflowX:"auto",fontSize:13,lineHeight:1.55,fontFamily:"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",color:t.theme.text,whiteSpace:"pre"},children:(0,d.jsx)("code",{children:pe(n)})})]},o)}case"list":return(0,d.jsx)(e.ordered?"ol":"ul",{style:{margin:"0 0 1em",paddingLeft:"1.5em",color:t.theme.text,lineHeight:1.65},children:e.items.map((e,n)=>(0,d.jsxs)("li",{style:{listStyle:null!==e.task?"none":void 0,marginLeft:null!==e.task?"-1.25em":void 0},children:[null!==e.task&&(0,d.jsx)("input",{type:"checkbox",disabled:!0,checked:"checked"===e.task,readOnly:!0,style:{marginRight:6,verticalAlign:"middle"},"aria-label":"checked"===e.task?"Completed task":"Uncompleted task"}),Pi(e.blocks,t,`${o}-${n}`)]},`${o}-${n}`))},o);case"hr":return(0,d.jsx)("hr",{style:{border:"none",borderTop:`1px solid ${t.theme.border}`,margin:"1.5em 0"}},o);case"table":return(0,d.jsx)("div",{style:{overflowX:"auto",margin:"0 0 1em",border:`1px solid ${t.theme.border}`,borderRadius:6,WebkitOverflowScrolling:"touch"},children:(0,d.jsxs)("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:14,color:t.theme.text},children:[(0,d.jsx)("thead",{children:(0,d.jsx)("tr",{children:e.headers.map((n,r)=>(0,d.jsx)("th",{style:{padding:"8px 12px",textAlign:e.align[r]??"left",borderBottom:`2px solid ${t.theme.border}`,background:t.theme.surfaceAlt,fontWeight:600},children:Ni(n,t,`${o}-h-${r}`)},r))})}),(0,d.jsx)("tbody",{children:e.rows.map((n,r)=>(0,d.jsx)("tr",{children:n.map((n,i)=>(0,d.jsx)("td",{style:{padding:"8px 12px",textAlign:e.align[i]??"left",borderBottom:`1px solid ${t.theme.border}`},children:Ni(n,t,`${o}-r-${r}-${i}`)},i))},r))})]})},o)}})}function Fi({source:e,src:t,maxWidth:n="100%",compact:r=!1,copyableCode:o=!0,onLinkClick:i,externalLinkRel:l="noopener noreferrer",externalLinkTarget:s="_blank",loadingFallback:c,errorFallback:u,className:p,style:h}){const f=J(),[m,g]=(0,a.useState)({text:null,error:null,loading:!!t&&void 0===e}),x=(0,a.useRef)(null);(0,a.useEffect)(()=>{if(void 0!==e||!t)return;x.current?.abort();const n=new AbortController;return x.current=n,g({text:null,error:null,loading:!0}),fetch(t,{signal:n.signal}).then(async e=>{if(!e.ok)throw new Error(`Failed to load markdown (HTTP ${e.status})`);g({text:await e.text(),error:null,loading:!1})}).catch(e=>{"AbortError"!==e.name&&g({text:null,error:e.message,loading:!1})}),()=>n.abort()},[t,e]);const y=e??m.text??"",b=(0,a.useMemo)(()=>y?wi(y):[],[y]),v={theme:f,compact:r,copyableCode:o,externalLinkRel:l,externalLinkTarget:s,onLinkClick:i},w={maxWidth:n,width:"100%",color:f.text,fontFamily:"inherit",fontSize:r?14:15,lineHeight:1.65,wordBreak:"break-word",overflowWrap:"anywhere",boxSizing:"border-box",...h};if(void 0===e&&t){if(m.loading)return(0,d.jsx)("div",{className:p,style:w,"aria-busy":"true","aria-live":"polite",children:c??(0,d.jsx)("span",{style:{color:f.textMuted},children:"Loading…"})});if(m.error)return(0,d.jsx)("div",{className:p,style:w,role:"alert",children:u?u(m.error):(0,d.jsx)("span",{style:{color:f.danger},children:pe(m.error)})})}return(0,d.jsx)("div",{className:p,style:w,children:Pi(b,v)})}Fi.displayName="TkxMarkdown";var Ai=(0,a.createContext)(null),Ii={required:"This field is required",invalidFormat:"Invalid format",minLength:e=>`Must be at least ${e} characters`,maxLength:e=>`Must be no more than ${e} characters`,minValue:e=>`Must be at least ${e}`,maxValue:e=>`Must be no more than ${e}`};async function Li(e,t,n=Ii){for(const r of t){if(r.required&&(null==e||""===e||Array.isArray(e)&&0===e.length))return r.message??n.required;if(null!=e&&""!==e){if(void 0!==r.min){if("string"==typeof e&&e.length<r.min)return r.message??n.minLength(r.min);if("number"==typeof e&&e<r.min)return r.message??n.minValue(r.min)}if(void 0!==r.max){if("string"==typeof e&&e.length>r.max)return r.message??n.maxLength(r.max);if("number"==typeof e&&e>r.max)return r.message??n.maxValue(r.max)}if(r.pattern&&"string"==typeof e&&!r.pattern.test(e))return r.message??n.invalidFormat;if(r.validator){const t=await r.validator(e);if(t)return t}}}return null}function Ti({onSubmit:e,onValuesChange:t,initialValues:n={},layout:r="vertical",disabled:o=!1,children:i,className:l,style:s,form:c}){const u=J(),p=_t(),h=(0,a.useMemo)(()=>({required:p.fieldRequired??Ii.required,invalidFormat:p.invalidFormat??Ii.invalidFormat,minLength:p.minLength??Ii.minLength,maxLength:p.maxLength??Ii.maxLength,minValue:p.minValue??Ii.minValue,maxValue:p.maxValue??Ii.maxValue}),[p]),[f,m]=(0,a.useState)({values:{...n},errors:{},touched:{}}),g=(0,a.useRef)(n),x=(0,a.useRef)({}),y=(0,a.useRef)(f);y.current=f;const b=(0,a.useCallback)((e,t)=>{x.current[e]=t},[]),v=(0,a.useCallback)(e=>{delete x.current[e]},[]),w=(0,a.useCallback)((e,n)=>{m(r=>{const o={...r,values:{...r.values,[e]:n}};return t?.({[e]:n},o.values),o})},[t]),k=(0,a.useCallback)((e,t)=>{m(n=>({...n,errors:{...n.errors,[e]:t}}))},[]),$=(0,a.useCallback)(e=>{m(t=>({...t,touched:{...t.touched,[e]:!0}}))},[]),S=(0,a.useCallback)(async e=>{const t=x.current[e];if(!t)return!0;const n=y.current.values[e],r=await Li(n,t.rules,h);return m(t=>({...t,errors:{...t.errors,[e]:r},touched:{...t.touched,[e]:!0}})),null===r},[h]),C=(0,a.useCallback)(async()=>{const e=Object.keys(x.current),t=await Promise.all(e.map(async e=>{const t=x.current[e],n=y.current.values[e];return{name:e,error:await Li(n,t.rules,h)}})),n={},r={};let o=!1;for(const{name:i,error:a}of t)n[i]=a,r[i]=!0,a&&(o=!0);if(m(e=>({...e,errors:{...e.errors,...n},touched:{...e.touched,...r}})),o){const e=Object.fromEntries(t.filter(e=>e.error).map(e=>[e.name,e.error]));return Promise.reject(e)}return{...y.current.values}},[]),z=(0,a.useCallback)(()=>{m({values:{...g.current},errors:{},touched:{}})},[]),M=(0,a.useMemo)(()=>({getFieldValue:e=>y.current.values[e],setFieldValue:w,getFieldsValue:()=>({...y.current.values}),setFieldsValue:e=>{m(n=>{const r={...n.values,...e};return t?.(e,r),{...n,values:r}})},validateFields:C,validateField:S,resetFields:z,getFieldError:e=>y.current.errors[e]??null,isFieldTouched:e=>!!y.current.touched[e]}),[w,C,S,z,t]),N=(0,a.useCallback)(async t=>{t.preventDefault();try{const t=await C();await(e?.(t))}catch{}},[C,e]),D=$t("inline"===r?"flex flex-row flex-wrap items-end gap-4":"flex flex-col gap-5");(0,a.useEffect)(()=>{if(!c)return;const e=c;e.getFieldValue=M.getFieldValue,e.setFieldValue=M.setFieldValue,e.getFieldsValue=M.getFieldsValue,e.setFieldsValue=M.setFieldsValue,e.validateFields=M.validateFields,e.validateField=M.validateField,e.resetFields=M.resetFields,e.getFieldError=M.getFieldError,e.isFieldTouched=M.isFieldTouched},[c,M]);const R=c??M,P=(0,a.useMemo)(()=>({state:f,initialValues:g.current,layout:r,disabled:o,fieldMeta:x,setFieldValue:w,setFieldError:k,setFieldTouched:$,registerField:b,unregisterField:v,validateField:S,instance:R}),[f,r,o,w,k,$,b,v,S,R]);return(0,d.jsx)(Ai.Provider,{value:P,children:(0,d.jsx)("form",{noValidate:!0,role:"form","aria-label":"Form",onSubmit:N,className:Ct(D,l),style:{color:u.text,...s},children:i})})}function Wi({name:e,label:t,rules:n,help:r,required:o,children:i,className:l,style:s}){const c=J(),u=function(){const e=(0,a.useContext)(Ai);if(!e)throw new Error("TkxFormField must be used inside a <TkxForm>. Wrap your fields in a TkxForm component.");return e}(),{state:p,layout:h,disabled:f}=u,m=(0,a.useMemo)(()=>function(e,t,n=Ii.required){const r=e?[...e]:[];return t&&!r.some(e=>e.required)&&r.unshift({required:!0,message:n}),r}(n,o),[n,o]),g=function(e){return e.some(e=>e.required)}(m),x=(0,a.useRef)({rules:m});x.current.rules=m;const y=(0,a.useRef)(!1);y.current||(u.registerField(e,x.current),y.current=!0),(0,a.useMemo)(()=>{u.registerField(e,x.current)},[m,e,u]);const b=p.values[e],v=p.touched[e]?p.errors[e]??null:null,w=v?pe(v):null,k=t?pe(t):void 0,$=r?pe(r):void 0,S=(0,a.useCallback)(t=>{let n;if(null!==t&&"object"==typeof t&&"target"in t){const e=t.target;n="checkbox"===e.type?e.checked:e.value}else n=t;u.setFieldValue(e,n)},[u,e]),C=(0,a.useCallback)(()=>{u.setFieldTouched(e),u.validateField(e)},[u,e]),z=i,M=(0,a.cloneElement)(z,{value:b??"",onChange:S,onBlur:C,error:w??void 0,isInvalid:!!w,isRequired:g,disabled:f||z.props.disabled,name:e}),N="horizontal"===h,D="inline"===h,R=(0,d.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),P=k?(0,d.jsxs)("label",{className:$t("text-sm font-medium font-sans",N?"min-w-[140px] pt-2.5":""),style:{color:c.text},children:[k,g&&(0,d.jsx)("span",{"aria-hidden":"true",className:$t("ml-1"),style:{color:c.danger},children:"*"})]}):null,F=(0,d.jsxs)(d.Fragment,{children:[$&&!w&&(0,d.jsx)("span",{className:$t("text-xs mt-0.5"),style:{color:c.textMuted},children:$}),w&&(0,d.jsxs)("span",{role:"alert",className:$t("text-xs flex items-center gap-1 mt-0.5"),style:{color:c.danger,animation:"tkxFormErrorReveal 200ms ease-out"},children:[R,w]})]});return D?(0,d.jsxs)("div",{className:Ct($t("flex flex-col gap-1"),l),style:s,children:[P,M,F]}):N?(0,d.jsxs)("div",{className:Ct($t("flex flex-row gap-4 items-start"),l),style:s,children:[P,(0,d.jsxs)("div",{className:$t("flex flex-col gap-1 flex-1 min-w-0"),children:[M,F]})]}):(0,d.jsxs)("div",{className:Ct($t("flex flex-col gap-1"),l),style:s,children:[P,M,F]})}Ti.displayName="TkxForm",Wi.displayName="TkxFormField";var ji=!1;!function(){if(ji)return;if("undefined"==typeof document)return;ji=!0;const e=document.createElement("style");e.setAttribute("data-tkx-form",""),e.textContent="\n @keyframes tkxFormErrorReveal {\n from {\n opacity: 0;\n transform: translateY(-4px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n }\n ",document.head.appendChild(e)}();var Ei={sm:576,md:768,lg:992,xl:1200};function Bi(e){return"number"==typeof e?`${e}px`:e}var Vi=(0,a.createContext)({h:0,v:0}),Hi=(0,a.forwardRef)(({children:e,hasSider:t=!1,className:n,style:r,...o},i)=>{const a=J(),l=$t("flex min-h-0 w-full font-sans"),s=t?{flexDirection:"row"}:{flexDirection:"column"};return(0,d.jsx)("section",{ref:i,className:Ct("tkx-layout",l,n),style:{minHeight:"100%",color:a.text,backgroundColor:a.bg,...s,...r},...o,children:e})});Hi.displayName="TkxLayout";var Oi=(0,a.forwardRef)(({children:e,height:t=64,fixed:n=!1,className:r,style:o,...i},a)=>{const l=J(),s=Bi(t),c=$t("flex items-center px-6 shrink-0 w-full"),u=n?{position:"fixed",top:0,left:0,right:0,zIndex:1e3}:{};return(0,d.jsx)("header",{ref:a,className:Ct("tkx-layout-header",c,r),style:{height:s,minHeight:s,backgroundColor:l.surface,borderBottom:`1px solid ${l.border}`,...u,...o},...i,children:e})});function qi({collapsed:e,onClick:t,color:n}){const r=qe();return(0,d.jsx)("button",{type:"button","aria-label":e?"Expand sidebar":"Collapse sidebar",onClick:t,className:$t("flex items-center justify-center w-full py-3 cursor-pointer","border-0 bg-transparent"),style:{color:n},children:(0,d.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",style:{transform:e?"rotate(0deg)":"rotate(180deg)",transition:r?"none":"transform 200ms ease"},"aria-hidden":"true",children:(0,d.jsx)("path",{d:"M6 3l5 5-5 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}Oi.displayName="TkxHeader";var Ui=(0,a.forwardRef)(({children:e,width:t=240,collapsedWidth:n=64,collapsed:r,onCollapse:o,collapsible:i=!1,breakpoint:l,trigger:s,className:c,style:u,...p},h)=>{const f=J(),m=qe(),[g,x]=(0,a.useState)(!1),y=r??g,b=(0,a.useCallback)(e=>{void 0===r&&x(e),o?.(e)},[r,o]);(0,a.useEffect)(()=>{if(!l)return;const e=Ei[l];if(!e)return;const t=window.matchMedia(`(max-width: ${e-1}px)`),n=e=>{b(e.matches)};return b(t.matches),t.addEventListener("change",n),()=>t.removeEventListener("change",n)},[l,b]);const v=Bi(t),w=y?`${n}px`:v,k=i&&null!==s,$=m?"none":"width 200ms ease, min-width 200ms ease, max-width 200ms ease";return(0,d.jsxs)("aside",{ref:h,className:Ct("tkx-layout-sider",$t("shrink-0 overflow-hidden flex flex-col"),c),style:{width:w,minWidth:w,maxWidth:w,backgroundColor:f.surface,borderRight:`1px solid ${f.border}`,transition:$,...u},...p,children:[(0,d.jsx)("div",{className:$t("flex-1 overflow-y-auto overflow-x-hidden"),style:{width:w,transition:$},children:e}),k&&(0,d.jsx)("div",{className:$t("shrink-0"),style:{borderTop:`1px solid ${f.border}`},children:void 0!==s?s:(0,d.jsx)(qi,{collapsed:y,onClick:()=>b(!y),color:f.textMuted})})]})});Ui.displayName="TkxSider";var Ki=(0,a.forwardRef)(({children:e,className:t,style:n,...r},o)=>{const i=J();return(0,d.jsx)("main",{ref:o,className:Ct("tkx-layout-content",$t("flex-1 min-w-0 min-h-0"),t),style:{backgroundColor:i.bg,padding:"24px",...n},...r,children:e})});Ki.displayName="TkxContent";var Yi=(0,a.forwardRef)(({children:e,className:t,style:n,...r},o)=>{const i=J();return(0,d.jsx)("footer",{ref:o,className:Ct("tkx-layout-footer",$t("flex items-center px-6 py-4 shrink-0"),t),style:{backgroundColor:i.surface,borderTop:`1px solid ${i.border}`,color:i.textMuted,...n},...r,children:e})});Yi.displayName="TkxFooter";var Zi={start:"flex-start",center:"center",end:"flex-end","space-between":"space-between","space-around":"space-around","space-evenly":"space-evenly"},Xi={top:"flex-start",middle:"center",bottom:"flex-end",stretch:"stretch"},Gi=(0,a.forwardRef)(({children:e,gutter:t,justify:n="start",align:r="top",wrap:o=!0,className:i,style:a,...l},s)=>{const[c,u]=Array.isArray(t)?t:[t??0,0],p=c/2,h=u/2,f=c||u?{marginLeft:-p,marginRight:-p,marginTop:-h,marginBottom:-h}:{},m={h:p,v:h};return(0,d.jsx)(Vi.Provider,{value:m,children:(0,d.jsx)("div",{ref:s,className:Ct("tkx-row",$t("flex w-full"),i),style:{flexWrap:o?"wrap":"nowrap",justifyContent:Zi[n]??"flex-start",alignItems:Xi[r]??"flex-start",...f,...a},...l,children:e})})});Gi.displayName="TkxRow";var _i=!1;function Ji(e){if(void 0!==e)return"number"==typeof e?{span:e}:e}var Qi=(0,a.forwardRef)(({children:e,span:t,offset:n=0,push:r,pull:o,order:i,sm:l,md:s,lg:c,xl:u,className:p,style:h,...f},m)=>{(0,a.useEffect)(()=>{!function(){if(_i||"undefined"==typeof document)return;_i=!0;const e=[];for(const[n,r]of Object.entries(Ei)){for(let t=1;t<=24;t++){const o=t/24*100+"%";e.push(`@media (min-width: ${r}px) { .tkx-col-${n}-${t} { flex: 0 0 ${o} !important; max-width: ${o} !important; } }`)}for(let t=0;t<=24;t++){const o=t/24*100+"%";e.push(`@media (min-width: ${r}px) { .tkx-col-${n}-offset-${t} { margin-left: ${o} !important; } }`)}}const t=document.createElement("style");t.id="tkx-col-responsive",t.textContent=e.join("\n"),document.head.appendChild(t)}()},[]);const g=(0,a.useContext)(Vi),x=void 0!==t?t/24*100+"%":void 0,y=n?n/24*100+"%":void 0,b=[],v=[["sm",l],["md",s],["lg",c],["xl",u]];for(const[a,d]of v){const e=Ji(d);e&&(b.push(`tkx-col-${a}-${e.span}`),void 0!==e.offset&&e.offset>0&&b.push(`tkx-col-${a}-offset-${e.offset}`))}const w={};return void 0!==r&&(w.left=r/24*100+"%",w.position="relative"),void 0!==o&&(w.right=o/24*100+"%",w.position="relative"),void 0!==i&&(w.order=i),(0,d.jsx)("div",{ref:m,className:Ct("tkx-col",$t("box-border min-h-[1px]"),...b,p),style:{flex:x?`0 0 ${x}`:"1",maxWidth:x??"100%",marginLeft:y,paddingLeft:g.h||void 0,paddingRight:g.h||void 0,paddingTop:g.v||void 0,paddingBottom:g.v||void 0,...w,...h},...f,children:e})});Qi.displayName="TkxCol";var ea=(0,a.createContext)({locale:"en-US",direction:"ltr",componentDefaults:{size:"md",variant:"default",animation:!0,bordered:!0},componentOverrides:{},prefixCls:"tkx",configured:!1,cls:e=>`tkx-${e}`,getSize:()=>"md",getAnimation:()=>!0,getBordered:()=>!0});function ta({children:e,locale:t,direction:n,componentDefaults:r,componentOverrides:o,prefixCls:i}){const l=(0,a.useContext)(ea),s=(0,a.useMemo)(()=>({size:r?.size??l.componentDefaults.size,variant:r?.variant??l.componentDefaults.variant,animation:r?.animation??l.componentDefaults.animation,bordered:r?.bordered??l.componentDefaults.bordered}),[r,l.componentDefaults]),c=(0,a.useMemo)(()=>{const e=l.componentOverrides,t=o??{};return{button:{...e.button,...t.button},input:{...e.input,...t.input},table:{...e.table,...t.table},modal:{...e.modal,...t.modal}}},[o,l.componentOverrides]),u=t??l.locale,p=n??l.direction,h=i??l.prefixCls,f=(0,a.useCallback)(e=>`${h}-${e}`,[h]),m=(0,a.useCallback)((e,t)=>{if(void 0!==t)return t;if(e){const t=c[e];if(t?.size)return t.size}return s.size},[s.size,c]),g=(0,a.useCallback)(e=>void 0!==e?e:s.animation,[s.animation]),x=(0,a.useCallback)((e,t)=>{if(void 0!==t)return t;if(e){const t=c[e];if(void 0!==t?.bordered)return t.bordered}return s.bordered},[s.bordered,c]),y=(0,a.useMemo)(()=>({locale:u,direction:p,componentDefaults:s,componentOverrides:c,prefixCls:h,configured:!0,cls:f,getSize:m,getAnimation:g,getBordered:x}),[u,p,s,c,h,f,m,g,x]);return(0,d.jsx)(ea.Provider,{value:y,children:(0,d.jsx)("div",{dir:p,lang:u,className:`${h}-config-root`,style:{direction:p},children:e})})}function na(){return(0,a.useContext)(ea)}ta.displayName="TkxConfigProvider";var ra={"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"},oa=new Set(["ar","ar-SA","ar-EG","ar-AE","he","he-IL","fa","fa-IR","ur","ur-PK","ps","ps-AF"]);function ia(e){return"string"==typeof e?e:"number"==typeof e?String(e):Array.isArray(e)?e.map(ia).join(""):e&&"object"==typeof e&&"props"in e?ia(e.props.children):""}function aa({text:e}){const t=J(),[n,r]=(0,a.useState)(!1);return(0,a.createElement)("button",{type:"button",onClick:(0,a.useCallback)(()=>{navigator.clipboard.writeText(e).then(()=>{r(!0),setTimeout(()=>r(!1),2e3)})},[e]),"aria-label":n?"Copied":"Copy to clipboard",style:{display:"inline-flex",alignItems:"center",marginLeft:"4px",padding:"2px 6px",border:"none",background:"transparent",color:n?t.success:t.textMuted,cursor:"pointer",fontSize:"0.8em",borderRadius:"4px",transition:"color 0.2s"}},n?"Copied!":"⎘")}function la(e="default"){const t=J();return{default:t.text,secondary:t.textMuted,success:t.success,warning:t.warning,danger:t.danger}[e]}var sa={1:{fontSize:"2.25rem",lineHeight:"1.2",fontWeight:700},2:{fontSize:"1.875rem",lineHeight:"1.25",fontWeight:700},3:{fontSize:"1.5rem",lineHeight:"1.3",fontWeight:600},4:{fontSize:"1.25rem",lineHeight:"1.35",fontWeight:600},5:{fontSize:"1rem",lineHeight:"1.4",fontWeight:600}},da={sm:{dimension:20,borderWidth:2,fontSize:"0.75rem"},md:{dimension:32,borderWidth:3,fontSize:"0.875rem"},lg:{dimension:48,borderWidth:4,fontSize:"1rem"}},ca=!1;function ua({size:e,color:t}){return(0,a.createElement)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",role:"img","aria-label":"Loading"},(0,a.createElement)("circle",{cx:12,cy:12,r:10,stroke:`${t}33`,strokeWidth:2.5,fill:"none"}),(0,a.createElement)("path",{d:"M12 2a10 10 0 0 1 10 10",stroke:t,strokeWidth:2.5,strokeLinecap:"round",fill:"none"}))}function pa({size:e,borderWidth:t,color:n,reducedMotion:r}){return r?(0,a.createElement)(ua,{size:e,color:n}):(function(){if(ca||"undefined"==typeof document)return;ca=!0;const e=document.createElement("style");e.id="tkx-spin-styles",e.textContent="\n @keyframes tkx-spin-rotate {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n ",document.head.appendChild(e)}(),(0,a.createElement)("div",{role:"img","aria-label":"Loading",style:{width:`${e}px`,height:`${e}px`,border:`${t}px solid ${n}33`,borderTopColor:n,borderRadius:"50%",animation:"tkx-spin-rotate 0.8s linear infinite",boxSizing:"border-box"}}))}function ha({color:e,mutedColor:t}){return(0,a.createElement)("svg",{width:120,height:100,viewBox:"0 0 120 100",fill:"none","aria-hidden":"true"},(0,a.createElement)("path",{d:"M20 40 L60 20 L100 40 L60 60 Z",fill:`${t}18`,stroke:t,strokeWidth:1.5,strokeLinejoin:"round"}),(0,a.createElement)("path",{d:"M20 40 L20 65 L60 85 L60 60 Z",fill:`${t}10`,stroke:t,strokeWidth:1.5,strokeLinejoin:"round"}),(0,a.createElement)("path",{d:"M100 40 L100 65 L60 85 L60 60 Z",fill:`${t}0d`,stroke:t,strokeWidth:1.5,strokeLinejoin:"round"}),(0,a.createElement)("path",{d:"M20 40 L40 28 L60 40 L40 52 Z",fill:`${e}15`,stroke:e,strokeWidth:1,strokeLinejoin:"round",strokeDasharray:"3 2"}),(0,a.createElement)("path",{d:"M60 40 L80 28 L100 40 L80 52 Z",fill:`${e}15`,stroke:e,strokeWidth:1,strokeLinejoin:"round",strokeDasharray:"3 2"}))}function fa({mutedColor:e}){return(0,a.createElement)("svg",{width:64,height:64,viewBox:"0 0 64 64",fill:"none","aria-hidden":"true"},(0,a.createElement)("rect",{x:16,y:8,width:32,height:40,rx:3,fill:`${e}12`,stroke:e,strokeWidth:1.5}),(0,a.createElement)("line",{x1:24,y1:20,x2:40,y2:20,stroke:e,strokeWidth:1.5,strokeLinecap:"round"}),(0,a.createElement)("line",{x1:24,y1:28,x2:36,y2:28,stroke:e,strokeWidth:1.5,strokeLinecap:"round"}),(0,a.createElement)("line",{x1:24,y1:36,x2:32,y2:36,stroke:e,strokeWidth:1.5,strokeLinecap:"round"}),(0,a.createElement)("circle",{cx:32,cy:54,r:6,stroke:e,strokeWidth:1.2,fill:"none"}),(0,a.createElement)("line",{x1:28,y1:54,x2:36,y2:54,stroke:e,strokeWidth:1.2,strokeLinecap:"round"}))}function ma({direction:e,color:t}){return(0,a.createElement)("svg",{width:16,height:14,viewBox:"0 0 20 14",fill:"none","aria-hidden":"true",style:{display:"inline-block",verticalAlign:"middle"}},(0,a.createElement)("path",{d:"up"===e?"M6 10 L10 4 L14 10":"M6 4 L10 10 L14 4",stroke:t,strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}))}var ga=!1;function xa({w:e,h:t,alt:n,bdr:r,rm:o}){return o||function(){if(ga||"undefined"==typeof document)return;ga=!0;const e=document.createElement("style");e.id="tkx-statistic-skeleton",e.textContent="@keyframes tkx-stat-shimmer{0%{background-position:-200% 0}100%{background-position:200% 0}}",document.head.appendChild(e)}(),(0,a.createElement)("div",{"aria-hidden":"true",style:{width:e,height:t,borderRadius:"4px",background:o?n:`linear-gradient(90deg, ${n} 25%, ${r} 50%, ${n} 75%)`,backgroundSize:"200% 100%",animation:o?"none":"tkx-stat-shimmer 1.5s ease-in-out infinite"}})}var ya={sm:{height:28,fontSize:12,px:10},md:{height:36,fontSize:14,px:16},lg:{height:44,fontSize:16,px:20}},ba=new Uint8Array(512),va=new Uint8Array(256);function wa(e,t){return 0===e||0===t?0:ba[va[e]+va[t]]}function ka(e,t){const n=function(e){let t=[1];for(let n=0;n<e;n++){const e=new Array(t.length+1).fill(0);for(let r=0;r<t.length;r++)e[r]^=t[r],e[r+1]^=wa(t[r],ba[n]);t=e}return t}(t),r=new Array(t).fill(0);for(let o=0;o<e.length;o++){const t=e[o]^r[0];if(r.shift(),r.push(0),0!==t)for(let e=0;e<n.length;e++)r[e]^=wa(n[e],t)}return r}(()=>{let e=1;for(let t=0;t<255;t++)ba[t]=e,va[e]=t,e<<=1,256&e&&(e^=285);for(let t=255;t<512;t++)ba[t]=ba[t-255]})();var $a={L:[[7,1,19,0,0],[10,1,34,0,0],[15,1,55,0,0],[20,1,80,0,0],[26,1,108,0,0],[18,2,68,0,0],[20,2,78,0,0],[24,2,97,0,0],[30,2,116,0,0],[18,2,68,2,69]],M:[[10,1,16,0,0],[16,1,28,0,0],[26,1,44,0,0],[18,2,32,0,0],[24,2,43,0,0],[16,4,27,0,0],[18,4,31,0,0],[22,2,38,2,39],[22,3,36,2,37],[26,4,43,1,44]],Q:[[13,1,13,0,0],[22,1,22,0,0],[18,2,17,0,0],[26,2,24,0,0],[18,2,15,2,16],[24,4,19,0,0],[18,2,14,4,15],[22,4,18,2,19],[20,4,16,4,17],[24,6,19,2,20]],H:[[17,1,9,0,0],[28,1,16,0,0],[22,2,13,0,0],[16,4,9,0,0],[22,2,11,2,12],[28,4,15,0,0],[26,4,13,1,14],[26,4,14,2,15],[24,4,12,4,13],[28,6,15,2,16]]};function Sa(e,t){const[,n,r,o,i]=$a[t][e-1];return n*r+o*i}var Ca=[[],[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50]];function za(e,t){return"byte"===t?e<=9?8:16:e<=9?9:11}var Ma="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",Na=class{constructor(){this.bits=[]}put(e,t){for(let n=t-1;n>=0;n--)this.bits.push(e>>>n&1)}get length(){return this.bits.length}};function Da(e){const t=[];for(const n of e){let e=n.codePointAt(0);e<128?t.push(e):e<2048?t.push(192|e>>6,128|63&e):e<65536?t.push(224|e>>12,128|e>>6&63,128|63&e):t.push(240|e>>18,128|e>>12&63,128|e>>6&63,128|63&e)}return t}function Ra(e,t,n){for(let r=-1;r<=7;r++)for(let o=-1;o<=7;o++){const i=t+r,a=n+o;if(i<0||i>=e.length||a<0||a>=e.length)continue;const l=r>=0&&r<=6&&(0===o||6===o)||o>=0&&o<=6&&(0===r||6===r)||r>=2&&r<=4&&o>=2&&o<=4;e[i][a]={dark:l,reserved:!0}}}function Pa(e,t,n){switch(e){case 0:return(t+n)%2==0;case 1:return t%2==0;case 2:return n%3==0;case 3:return(t+n)%3==0;case 4:return(Math.floor(t/2)+Math.floor(n/3))%2==0;case 5:return t*n%2+t*n%3==0;case 6:return(t*n%2+t*n%3)%2==0;case 7:return((t+n)%2+t*n%3)%2==0;default:return!1}}function Fa(e,t){const n=e.length,r=Array.from({length:n},()=>new Array(n).fill(!1));for(let o=0;o<n;o++)for(let i=0;i<n;i++){let n=e[o][i].dark;!e[o][i].reserved&&Pa(t,o,i)&&(n=!n),r[o][i]=n}return r}var Aa={L:1,M:0,Q:3,H:2};function Ia(e,t,n){const r=e.length,o=function(e,t){const n=Aa[e]<<3|t;let r=n<<10;for(let o=14;o>=10;o--)r>>o&1&&(r^=1335<<o-10);return 21522^(n<<10|r)}(t,n),i=e=>1==(o>>e&1);for(let a=0;a<=5;a++)e[8][a]=i(a);e[8][7]=i(6),e[8][8]=i(7),e[7][8]=i(8);for(let a=9;a<=14;a++)e[14-a][8]=i(a);for(let a=0;a<=7;a++)e[r-1-a][8]=i(a);for(let a=8;a<=14;a++)e[8][r-15+a]=i(a);e[r-8][8]=!0}function La(e,t){if(t<7)return;const n=e.length,r=function(e){let t=e<<12;for(let n=17;n>=12;n--)t>>n&1&&(t^=7973<<n-12);return e<<12|t}(t);for(let o=0;o<18;o++){const t=1==(r>>o&1),i=Math.floor(o/3),a=o%3;e[i][n-11+a]=t,e[n-11+a][i]=t}}function Ta(e){const t=e.length;let n=0;const r=e=>{let n=0,r=1;for(let o=1;o<t;o++)e[o]===e[o-1]?(r++,5===r?n+=3:r>5&&(n+=1)):r=1;return n};for(let p=0;p<t;p++)n+=r(e[p]);for(let p=0;p<t;p++)n+=r(e.map(e=>e[p]));for(let p=0;p<t-1;p++)for(let r=0;r<t-1;r++){const t=e[p][r];t===e[p][r+1]&&t===e[p+1][r]&&t===e[p+1][r+1]&&(n+=3)}const o=[!0,!1,!0,!0,!0,!1,!0,!1,!1,!1,!1],i=[!1,!1,!1,!1,!0,!1,!0,!0,!0,!1,!0],a=(e,t,n)=>{for(let r=0;r<n.length;r++)if(e[t+r]!==n[r])return!1;return!0},l=e=>{let n=0;for(let r=0;r+11<=t;r++)(a(e,r,o)||a(e,r,i))&&(n+=40);return n};for(let p=0;p<t;p++)n+=l(e[p]);for(let p=0;p<t;p++)n+=l(e.map(e=>e[p]));let s=0;for(let p=0;p<t;p++)for(let n=0;n<t;n++)e[p][n]&&s++;const d=100*s/(t*t),c=5*Math.floor(d/5),u=c+5;return n+=Math.min(Math.abs(c-50),Math.abs(u-50))/5*10,n}function Wa(e,t={}){const n=t.level??"M",r=function(e){return function(e){for(const t of e)if(-1===Ma.indexOf(t))return!1;return!0}(e)?"alphanumeric":"byte"}(e),o=t.version??function(e,t,n){const r="byte"===t?Da(e).length:0,o=e.length;for(let i=1;i<=10;i++){const e=za(i,t);let a;if(a="byte"===t?4+e+8*r:4+e+11*Math.floor(o/2)+(o%2?6:0),a<=8*Sa(i,n))return i}throw new Error("TkxQRCode: value too large for supported versions (1–10).")}(e,r,n),i=4*o+17,a=function(e,t,n,r){const o=new Na,i=za(n,t);if("byte"===t){const t=Da(e);o.put(4,4),o.put(t.length,i);for(const e of t)o.put(e,8)}else{o.put(2,4),o.put(e.length,i);for(let t=0;t<e.length;t+=2)if(t+1<e.length){const n=45*Ma.indexOf(e[t])+Ma.indexOf(e[t+1]);o.put(n,11)}else o.put(Ma.indexOf(e[t]),6)}const a=8*Sa(n,r)-o.length;for(o.put(0,Math.min(4,Math.max(0,a)));o.length%8!=0;)o.bits.push(0);const l=[];for(let c=0;c<o.length;c+=8){let e=0;for(let t=0;t<8;t++)e=e<<1|o.bits[c+t];l.push(e)}const s=[236,17];let d=0;for(;l.length<Sa(n,r);)l.push(s[d%2]),d++;return l}(e,r,o,n),l=function(e,t,n){const[r,o,i,a,l]=$a[n][t-1],s=[];let d=0;for(let p=0;p<o;p++){const t=e.slice(d,d+i);d+=i,s.push({data:t,ec:ka(t,r)})}for(let p=0;p<a;p++){const t=e.slice(d,d+l);d+=l,s.push({data:t,ec:ka(t,r)})}const c=[],u=Math.max(i,l);for(let p=0;p<u;p++)for(const e of s)p<e.data.length&&c.push(e.data[p]);for(let p=0;p<r;p++)for(const e of s)c.push(e.ec[p]);return c}(a,o,n),s=function(e){return Array.from({length:e},()=>Array.from({length:e},()=>({dark:!1,reserved:!1})))}(i);Ra(s,0,0),Ra(s,0,i-7),Ra(s,i-7,0),function(e,t){const n=Ca[t];for(const r of n)for(const t of n)if(6===r&&6===t||6===r&&t===n[n.length-1]||n[n.length-1],!e[r][t].reserved)for(let n=-2;n<=2;n++)for(let o=-2;o<=2;o++){const i=1!==Math.max(Math.abs(n),Math.abs(o));e[r+n][t+o]={dark:i,reserved:!0}}}(s,o),function(e){const t=e.length;for(let n=8;n<t-8;n++)e[6][n].reserved||(e[6][n]={dark:n%2==0,reserved:!0}),e[n][6].reserved||(e[n][6]={dark:n%2==0,reserved:!0})}(s),function(e,t){const n=e.length;for(let r=0;r<=8;r++)6!==r&&(e[8][r].reserved||(e[8][r]={dark:!1,reserved:!0}),e[r][8].reserved||(e[r][8]={dark:!1,reserved:!0}));for(let r=0;r<8;r++)e[8][n-1-r].reserved||(e[8][n-1-r]={dark:!1,reserved:!0}),e[n-1-r][8].reserved||(e[n-1-r][8]={dark:!1,reserved:!0});if(e[n-8][8]={dark:!0,reserved:!0},t>=7)for(let r=0;r<6;r++)for(let t=0;t<3;t++)e[r][n-11+t]={dark:!1,reserved:!0},e[n-11+t][r]={dark:!1,reserved:!0}}(s,o),function(e,t){const n=e.length,r=[];for(const a of t)for(let e=7;e>=0;e--)r.push(a>>e&1);let o=0,i=!0;for(let a=n-1;a>0;a-=2){6===a&&a--;for(let t=0;t<n;t++){const l=i?n-1-t:t;for(let t=0;t<2;t++){const n=a-t;if(e[l][n].reserved)continue;const i=o<r.length?r[o]:0;e[l][n].dark=1===i,o++}}i=!i}}(s,l);let d=t.forceMask??0,c=null;if(void 0===t.forceMask){let e=1/0;for(let t=0;t<8;t++){const r=Fa(s,t);Ia(r,n,t),La(r,o);const i=Ta(r);i<e&&(e=i,d=t,c=r)}}else c=Fa(s,d),Ia(c,n,d),La(c,o);return{version:o,level:n,size:i,matrix:c,dataCodewords:a,mask:d}}var ja=(0,a.forwardRef)(function({value:e,size:t=160,color:n,bgColor:r,errorLevel:o,level:i,icon:l,bordered:s=!0,className:c,style:u},p){const h=J(),f=qe(),m=(0,a.useRef)(null),g=pe(e),x=n??h.text,y=r??h.surface,b=o??i??"M",v=(0,a.useMemo)(()=>{try{return Wa(g||" ",{level:b})}catch{return Wa((g||" ").slice(0,200),{level:b})}},[g,b]);return(0,a.useEffect)(()=>{const e=m.current;if(!e)return;const n=e.getContext("2d");if(!n)return;const r="undefined"!=typeof window&&window.devicePixelRatio||1;e.width=t*r,e.height=t*r,n.setTransform(r,0,0,r,0,0);const{matrix:o}=v,i=o.length,a=t/(i+8);n.fillStyle=y,n.fillRect(0,0,t,t),n.fillStyle=x;for(let t=0;t<i;t++)for(let e=0;e<i;e++)o[t][e]&&n.fillRect((e+4)*a,(t+4)*a,a+.5,a+.5);if(l){const e=.2*t,r=(t-e)/2;n.fillStyle=y,n.fillRect(r-3,r-3,e+6,e+6);const o=new Image;o.crossOrigin="anonymous",o.onload=()=>{n.drawImage(o,r,r,e,e)},o.src=pe(l)}},[v,t,x,y,l]),(0,d.jsx)("div",{ref:p,role:"img","aria-label":`QR code for: ${g}`,className:[$t("inline-block rounded-lg"),c].filter(Boolean).join(" "),style:{padding:s?12:0,backgroundColor:s?y:"transparent",border:s?`1px solid ${h.border}`:"none",lineHeight:0,animation:f?"none":"tkxFadeIn 0.2s ease",...u},children:(0,d.jsx)("canvas",{ref:m,"aria-hidden":"true",style:{width:t,height:t,display:"block"}})})}),Ea={success:e=>(0,d.jsxs)("svg",{width:"72",height:"72",viewBox:"0 0 72 72",fill:"none","aria-hidden":"true",children:[(0,d.jsx)("circle",{cx:"36",cy:"36",r:"34",stroke:e,strokeWidth:"3",fill:`${e}18`}),(0,d.jsx)("path",{d:"M22 37l9 9 19-19",stroke:e,strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]}),error:e=>(0,d.jsxs)("svg",{width:"72",height:"72",viewBox:"0 0 72 72",fill:"none","aria-hidden":"true",children:[(0,d.jsx)("circle",{cx:"36",cy:"36",r:"34",stroke:e,strokeWidth:"3",fill:`${e}18`}),(0,d.jsx)("path",{d:"M26 26l20 20M46 26L26 46",stroke:e,strokeWidth:"4",strokeLinecap:"round"})]}),warning:e=>(0,d.jsxs)("svg",{width:"72",height:"72",viewBox:"0 0 72 72",fill:"none","aria-hidden":"true",children:[(0,d.jsx)("path",{d:"M36 6L4 64h64L36 6z",stroke:e,strokeWidth:"3",fill:`${e}18`}),(0,d.jsx)("path",{d:"M36 30v16",stroke:e,strokeWidth:"4",strokeLinecap:"round"}),(0,d.jsx)("circle",{cx:"36",cy:"54",r:"2.5",fill:e})]}),info:e=>(0,d.jsxs)("svg",{width:"72",height:"72",viewBox:"0 0 72 72",fill:"none","aria-hidden":"true",children:[(0,d.jsx)("circle",{cx:"36",cy:"36",r:"34",stroke:e,strokeWidth:"3",fill:`${e}18`}),(0,d.jsx)("path",{d:"M36 32v18",stroke:e,strokeWidth:"4",strokeLinecap:"round"}),(0,d.jsx)("circle",{cx:"36",cy:"22",r:"2.5",fill:e})]}),404:e=>(0,d.jsxs)("svg",{width:"72",height:"72",viewBox:"0 0 72 72",fill:"none","aria-hidden":"true",children:[(0,d.jsx)("circle",{cx:"36",cy:"36",r:"34",stroke:e,strokeWidth:"3",fill:`${e}18`}),(0,d.jsx)("text",{x:"36",y:"44",textAnchor:"middle",fontSize:"22",fontWeight:"bold",fill:e,children:"404"})]}),403:e=>(0,d.jsxs)("svg",{width:"72",height:"72",viewBox:"0 0 72 72",fill:"none","aria-hidden":"true",children:[(0,d.jsx)("circle",{cx:"36",cy:"36",r:"34",stroke:e,strokeWidth:"3",fill:`${e}18`}),(0,d.jsx)("path",{d:"M28 30h16v16H28z",stroke:e,strokeWidth:"3",fill:"none"}),(0,d.jsx)("path",{d:"M32 30v-4a4 4 0 018 0v4",stroke:e,strokeWidth:"3",fill:"none"})]}),500:e=>(0,d.jsxs)("svg",{width:"72",height:"72",viewBox:"0 0 72 72",fill:"none","aria-hidden":"true",children:[(0,d.jsx)("circle",{cx:"36",cy:"36",r:"34",stroke:e,strokeWidth:"3",fill:`${e}18`}),(0,d.jsx)("text",{x:"36",y:"44",textAnchor:"middle",fontSize:"22",fontWeight:"bold",fill:e,children:"500"})]})};function Ba(){if("undefined"==typeof window)return!1;const e=window.outerWidth-window.innerWidth,t=window.outerHeight-window.innerHeight;return e>160||t>160}function Va(e=!0){const[t,n]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{if(!e||"undefined"==typeof window)return;n(Ba());const t=()=>n(Ba());window.addEventListener("resize",t);const r=window.setInterval(t,1e3);return()=>{window.removeEventListener("resize",t),window.clearInterval(r)}},[e]),!!e&&t}function Ha(e){if(e)try{return e()}catch{return window}return window}function Oa(e){const t=[];for(const n of e)t.push(n),n.children&&t.push(...Oa(n.children));return t}function qa(e){return e.startsWith("#")?e.slice(1):e}function Ua({item:e,activeKey:t,depth:n,onClick:r,theme:o,reducedMotion:i}){const a=e.key===t,l=pe(e.title);return(0,d.jsxs)("li",{role:"none",style:{listStyle:"none"},children:[(0,d.jsx)("a",{role:"treeitem","aria-current":a?"location":void 0,href:e.href,onClick:t=>{t.preventDefault(),r(e.href)},className:$t("block text-sm py-1 no-underline"),style:{paddingLeft:12+16*n,color:a?o.primary:o.textMuted,fontWeight:a?600:400,borderLeft:`2px solid ${a?o.primary:"transparent"}`,transition:i?"none":"color 0.15s ease, border-color 0.15s ease"},children:l}),e.children&&e.children.length>0&&(0,d.jsx)("ul",{role:"group",style:{margin:0,padding:0},children:e.children.map(e=>(0,d.jsx)(Ua,{item:e,activeKey:t,depth:n+1,onClick:r,theme:o,reducedMotion:i},e.key))})]})}function Ka(e,t){const n=[];let r=e;for(const o of t){const e=r.find(e=>e.value===o);if(!e)break;n.push(e),r=e.children??[]}return n}var Ya={sm:"8px 12px",md:"12px 16px",lg:"16px 20px"};function Za({theme:e,reducedMotion:t}){return(0,d.jsxs)("div",{className:$t("flex items-center gap-3 px-4 py-3"),"aria-hidden":"true",children:[(0,d.jsx)("div",{style:{width:40,height:40,borderRadius:"50%",backgroundColor:e.surfaceAlt,animation:t?"none":"tkxPulse 1.5s ease infinite"}}),(0,d.jsxs)("div",{className:$t("flex-1"),children:[(0,d.jsx)("div",{style:{width:"60%",height:14,borderRadius:4,backgroundColor:e.surfaceAlt,marginBottom:8,animation:t?"none":"tkxPulse 1.5s ease infinite"}}),(0,d.jsx)("div",{style:{width:"40%",height:12,borderRadius:4,backgroundColor:e.surfaceAlt,animation:t?"none":"tkxPulse 1.5s ease infinite"}})]})]})}var Xa={home:[{type:"path",d:"M3 9.5L12 3l9 6.5V20a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V9.5z"},{type:"path",d:"M9 21V12h6v9"}],menu:[{type:"line",x1:3,y1:6,x2:21,y2:6},{type:"line",x1:3,y1:12,x2:21,y2:12},{type:"line",x1:3,y1:18,x2:21,y2:18}],x:[{type:"line",x1:18,y1:6,x2:6,y2:18},{type:"line",x1:6,y1:6,x2:18,y2:18}],"chevron-up":[{type:"polyline",points:"18 15 12 9 6 15"}],"chevron-down":[{type:"polyline",points:"6 9 12 15 18 9"}],"chevron-left":[{type:"polyline",points:"15 18 9 12 15 6"}],"chevron-right":[{type:"polyline",points:"9 18 15 12 9 6"}],"arrow-up":[{type:"line",x1:12,y1:19,x2:12,y2:5},{type:"polyline",points:"5 12 12 5 19 12"}],"arrow-down":[{type:"line",x1:12,y1:5,x2:12,y2:19},{type:"polyline",points:"19 12 12 19 5 12"}],"arrow-left":[{type:"line",x1:19,y1:12,x2:5,y2:12},{type:"polyline",points:"12 19 5 12 12 5"}],"arrow-right":[{type:"line",x1:5,y1:12,x2:19,y2:12},{type:"polyline",points:"12 5 19 12 12 19"}],"arrow-up-right":[{type:"line",x1:7,y1:17,x2:17,y2:7},{type:"polyline",points:"7 7 17 7 17 17"}],"external-link":[{type:"path",d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"},{type:"polyline",points:"15 3 21 3 21 9"},{type:"line",x1:10,y1:14,x2:21,y2:3}],link:[{type:"path",d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"},{type:"path",d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"}],anchor:[{type:"circle",cx:12,cy:5,r:3},{type:"line",x1:12,y1:8,x2:12,y2:21},{type:"path",d:"M5 12H2a10 10 0 0 0 20 0h-3"}],search:[{type:"circle",cx:11,cy:11,r:8},{type:"line",x1:21,y1:21,x2:16.65,y2:16.65}],filter:[{type:"polygon",points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"}],sort:[{type:"line",x1:3,y1:6,x2:21,y2:6},{type:"line",x1:6,y1:12,x2:18,y2:12},{type:"line",x1:9,y1:18,x2:15,y2:18}],refresh:[{type:"polyline",points:"23 4 23 10 17 10"},{type:"polyline",points:"1 20 1 14 7 14"},{type:"path",d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"}],download:[{type:"path",d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"},{type:"polyline",points:"7 10 12 15 17 10"},{type:"line",x1:12,y1:15,x2:12,y2:3}],upload:[{type:"path",d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"},{type:"polyline",points:"17 8 12 3 7 8"},{type:"line",x1:12,y1:3,x2:12,y2:15}],share:[{type:"circle",cx:18,cy:5,r:3},{type:"circle",cx:6,cy:12,r:3},{type:"circle",cx:18,cy:19,r:3},{type:"line",x1:8.59,y1:13.51,x2:15.42,y2:17.49},{type:"line",x1:15.41,y1:6.51,x2:8.59,y2:10.49}],copy:[{type:"rect",x:9,y:9,width:13,height:13,rx:2},{type:"path",d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"}],edit:[{type:"path",d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"},{type:"path",d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"}],trash:[{type:"polyline",points:"3 6 5 6 21 6"},{type:"path",d:"M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"},{type:"path",d:"M10 11v6M14 11v6"},{type:"path",d:"M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"}],plus:[{type:"line",x1:12,y1:5,x2:12,y2:19},{type:"line",x1:5,y1:12,x2:19,y2:12}],minus:[{type:"line",x1:5,y1:12,x2:19,y2:12}],check:[{type:"polyline",points:"20 6 9 17 4 12"}],"x-circle":[{type:"circle",cx:12,cy:12,r:10},{type:"line",x1:15,y1:9,x2:9,y2:15},{type:"line",x1:9,y1:9,x2:15,y2:15}],"check-circle":[{type:"path",d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"},{type:"polyline",points:"22 4 12 14.01 9 11.01"}],"info-circle":[{type:"circle",cx:12,cy:12,r:10},{type:"line",x1:12,y1:8,x2:12,y2:12},{type:"line",x1:12,y1:16,x2:12.01,y2:16}],"alert-triangle":[{type:"path",d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"},{type:"line",x1:12,y1:9,x2:12,y2:13},{type:"line",x1:12,y1:17,x2:12.01,y2:17}],"alert-circle":[{type:"circle",cx:12,cy:12,r:10},{type:"line",x1:12,y1:8,x2:12,y2:12},{type:"line",x1:12,y1:16,x2:12.01,y2:16}],eye:[{type:"path",d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"},{type:"circle",cx:12,cy:12,r:3}],"eye-off":[{type:"path",d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94"},{type:"path",d:"M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19"},{type:"line",x1:1,y1:1,x2:23,y2:23},{type:"path",d:"M10.73 10.73a3 3 0 0 0 4.24 4.24"}],settings:[{type:"circle",cx:12,cy:12,r:3},{type:"path",d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"}],sliders:[{type:"line",x1:4,y1:21,x2:4,y2:14},{type:"line",x1:4,y1:10,x2:4,y2:3},{type:"line",x1:12,y1:21,x2:12,y2:12},{type:"line",x1:12,y1:8,x2:12,y2:3},{type:"line",x1:20,y1:21,x2:20,y2:16},{type:"line",x1:20,y1:12,x2:20,y2:3},{type:"line",x1:1,y1:14,x2:7,y2:14},{type:"line",x1:9,y1:8,x2:15,y2:8},{type:"line",x1:17,y1:16,x2:23,y2:16}],grid:[{type:"rect",x:3,y:3,width:7,height:7},{type:"rect",x:14,y:3,width:7,height:7},{type:"rect",x:14,y:14,width:7,height:7},{type:"rect",x:3,y:14,width:7,height:7}],list:[{type:"line",x1:8,y1:6,x2:21,y2:6},{type:"line",x1:8,y1:12,x2:21,y2:12},{type:"line",x1:8,y1:18,x2:21,y2:18},{type:"line",x1:3,y1:6,x2:3.01,y2:6},{type:"line",x1:3,y1:12,x2:3.01,y2:12},{type:"line",x1:3,y1:18,x2:3.01,y2:18}],columns:[{type:"path",d:"M12 3h7a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-7m0-18H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h7m0-18v18"}],layout:[{type:"rect",x:3,y:3,width:18,height:18,rx:2},{type:"line",x1:3,y1:9,x2:21,y2:9},{type:"line",x1:9,y1:21,x2:9,y2:9}],sidebar:[{type:"rect",x:3,y:3,width:18,height:18,rx:2},{type:"line",x1:9,y1:3,x2:9,y2:21}],maximize:[{type:"path",d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"}],minimize:[{type:"path",d:"M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 1 2-2h3M3 16h3a2 2 0 0 1 2 2v3"}],moon:[{type:"path",d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"}],sun:[{type:"circle",cx:12,cy:12,r:5},{type:"line",x1:12,y1:1,x2:12,y2:3},{type:"line",x1:12,y1:21,x2:12,y2:23},{type:"line",x1:4.22,y1:4.22,x2:5.64,y2:5.64},{type:"line",x1:18.36,y1:18.36,x2:19.78,y2:19.78},{type:"line",x1:1,y1:12,x2:3,y2:12},{type:"line",x1:21,y1:12,x2:23,y2:12},{type:"line",x1:4.22,y1:19.78,x2:5.64,y2:18.36},{type:"line",x1:18.36,y1:5.64,x2:19.78,y2:4.22}],bell:[{type:"path",d:"M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"},{type:"path",d:"M13.73 21a2 2 0 0 1-3.46 0"}],"bell-off":[{type:"path",d:"M13.73 21a2 2 0 0 1-3.46 0"},{type:"path",d:"M18.63 13A17.89 17.89 0 0 1 18 8"},{type:"path",d:"M6.26 6.26A5.86 5.86 0 0 0 6 8c0 7-3 9-3 9h14"},{type:"path",d:"M18 8a6 6 0 0 0-9.33-5"},{type:"line",x1:1,y1:1,x2:23,y2:23}],play:[{type:"polygon",points:"5 3 19 12 5 21 5 3"}],pause:[{type:"rect",x:6,y:4,width:4,height:16},{type:"rect",x:14,y:4,width:4,height:16}],stop:[{type:"rect",x:4,y:4,width:16,height:16}],"skip-back":[{type:"polygon",points:"19 20 9 12 19 4 19 20"},{type:"line",x1:5,y1:19,x2:5,y2:5}],"skip-forward":[{type:"polygon",points:"5 4 15 12 5 20 5 4"},{type:"line",x1:19,y1:5,x2:19,y2:19}],volume:[{type:"polygon",points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5"},{type:"path",d:"M15.54 8.46a5 5 0 0 1 0 7.07"},{type:"path",d:"M19.07 4.93a10 10 0 0 1 0 14.14"}],"volume-off":[{type:"polygon",points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5"},{type:"line",x1:23,y1:9,x2:17,y2:15},{type:"line",x1:17,y1:9,x2:23,y2:15}],image:[{type:"rect",x:3,y:3,width:18,height:18,rx:2},{type:"circle",cx:8.5,cy:8.5,r:1.5},{type:"polyline",points:"21 15 16 10 5 21"}],video:[{type:"polygon",points:"23 7 16 12 23 17 23 7"},{type:"rect",x:1,y:5,width:15,height:14,rx:2}],mic:[{type:"path",d:"M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"},{type:"path",d:"M19 10v2a7 7 0 0 1-14 0v-2"},{type:"line",x1:12,y1:19,x2:12,y2:23},{type:"line",x1:8,y1:23,x2:16,y2:23}],"mic-off":[{type:"line",x1:1,y1:1,x2:23,y2:23},{type:"path",d:"M9 9v3a3 3 0 0 0 5.12 2.12M15 9.34V4a3 3 0 0 0-5.94-.6"},{type:"path",d:"M17 16.95A7 7 0 0 1 5 12v-2m14 0v2a7 7 0 0 1-.11 1.23"},{type:"line",x1:12,y1:19,x2:12,y2:23},{type:"line",x1:8,y1:23,x2:16,y2:23}],camera:[{type:"path",d:"M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"},{type:"circle",cx:12,cy:13,r:4}],"chart-bar":[{type:"line",x1:18,y1:20,x2:18,y2:10},{type:"line",x1:12,y1:20,x2:12,y2:4},{type:"line",x1:6,y1:20,x2:6,y2:14},{type:"line",x1:2,y1:20,x2:22,y2:20}],"chart-line":[{type:"polyline",points:"22 12 18 12 15 21 9 3 6 12 2 12"}],"chart-pie":[{type:"path",d:"M21.21 15.89A10 10 0 1 1 8 2.83"},{type:"path",d:"M22 12A10 10 0 0 0 12 2v10z"}],"trending-up":[{type:"polyline",points:"23 6 13.5 15.5 8.5 10.5 1 18"},{type:"polyline",points:"17 6 23 6 23 12"}],"trending-down":[{type:"polyline",points:"23 18 13.5 8.5 8.5 13.5 1 6"},{type:"polyline",points:"17 18 23 18 23 12"}],activity:[{type:"polyline",points:"22 12 18 12 15 21 9 3 6 12 2 12"}],database:[{type:"ellipse",cx:12,cy:5,rx:9,ry:3},{type:"path",d:"M21 12c0 1.66-4 3-9 3s-9-1.34-9-3"},{type:"path",d:"M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"}],server:[{type:"rect",x:2,y:2,width:20,height:8,rx:2},{type:"rect",x:2,y:14,width:20,height:8,rx:2},{type:"line",x1:6,y1:6,x2:6.01,y2:6},{type:"line",x1:6,y1:18,x2:6.01,y2:18}],cpu:[{type:"rect",x:4,y:4,width:16,height:16,rx:2},{type:"rect",x:9,y:9,width:6,height:6},{type:"line",x1:9,y1:1,x2:9,y2:4},{type:"line",x1:15,y1:1,x2:15,y2:4},{type:"line",x1:9,y1:20,x2:9,y2:23},{type:"line",x1:15,y1:20,x2:15,y2:23},{type:"line",x1:20,y1:9,x2:23,y2:9},{type:"line",x1:20,y1:14,x2:23,y2:14},{type:"line",x1:1,y1:9,x2:4,y2:9},{type:"line",x1:1,y1:14,x2:4,y2:14}],memory:[{type:"path",d:"M6 19v-3M10 19v-3M14 19v-3M18 19v-3"},{type:"rect",x:2,y:6,width:20,height:10,rx:2},{type:"path",d:"M6 10h.01M10 10h.01M14 10h.01M18 10h.01"}],"shopping-cart":[{type:"circle",cx:9,cy:21,r:1},{type:"circle",cx:20,cy:21,r:1},{type:"path",d:"M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6"}],package:[{type:"line",x1:16.5,y1:9.4,x2:7.55,y2:4.24},{type:"path",d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"},{type:"polyline",points:"3.27 6.96 12 12.01 20.73 6.96"},{type:"line",x1:12,y1:22.08,x2:12,y2:12}],tag:[{type:"path",d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"},{type:"line",x1:7,y1:7,x2:7.01,y2:7}],"credit-card":[{type:"rect",x:1,y:4,width:22,height:16,rx:2},{type:"line",x1:1,y1:10,x2:23,y2:10}],dollar:[{type:"line",x1:12,y1:1,x2:12,y2:23},{type:"path",d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"}],percent:[{type:"line",x1:19,y1:5,x2:5,y2:19},{type:"circle",cx:6.5,cy:6.5,r:2.5},{type:"circle",cx:17.5,cy:17.5,r:2.5}],gift:[{type:"polyline",points:"20 12 20 22 4 22 4 12"},{type:"rect",x:2,y:7,width:20,height:5},{type:"line",x1:12,y1:22,x2:12,y2:7},{type:"path",d:"M12 7H7.5a2.5 2.5 0 0 1 0-5C11 2 12 7 12 7z"},{type:"path",d:"M12 7h4.5a2.5 2.5 0 0 0 0-5C13 2 12 7 12 7z"}],truck:[{type:"rect",x:1,y:3,width:15,height:13},{type:"polygon",points:"16 8 20 8 23 11 23 16 16 16 16 8"},{type:"circle",cx:5.5,cy:18.5,r:2.5},{type:"circle",cx:18.5,cy:18.5,r:2.5}],warehouse:[{type:"path",d:"M22 20v-9H2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2z"},{type:"path",d:"M2 11L12 2l10 9"},{type:"path",d:"M9 20v-5h6v5"}],box:[{type:"path",d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"},{type:"polyline",points:"3.27 6.96 12 12.01 20.73 6.96"},{type:"line",x1:12,y1:22.08,x2:12,y2:12}],mail:[{type:"path",d:"M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"},{type:"polyline",points:"22 6 12 13 2 6"}],message:[{type:"path",d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"}],phone:[{type:"path",d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6A19.79 19.79 0 0 1 2.12 4.18 2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"}],user:[{type:"path",d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"},{type:"circle",cx:12,cy:7,r:4}],users:[{type:"path",d:"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"},{type:"circle",cx:9,cy:7,r:4},{type:"path",d:"M23 21v-2a4 4 0 0 0-3-3.87"},{type:"path",d:"M16 3.13a4 4 0 0 1 0 7.75"}],team:[{type:"path",d:"M12 20v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"},{type:"circle",cx:9,cy:10,r:3},{type:"path",d:"M22 20v-2a4 4 0 0 0-3-3.87"},{type:"path",d:"M15 6.13a4 4 0 0 1 0 7.75"},{type:"circle",cx:17,cy:10,r:3}],star:[{type:"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"}],heart:[{type:"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"}],bookmark:[{type:"path",d:"M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"}],flag:[{type:"path",d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"},{type:"line",x1:4,y1:22,x2:4,y2:15}],globe:[{type:"circle",cx:12,cy:12,r:10},{type:"line",x1:2,y1:12,x2:22,y2:12},{type:"path",d:"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"}],file:[{type:"path",d:"M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"},{type:"polyline",points:"13 2 13 9 20 9"}],"file-text":[{type:"path",d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"},{type:"polyline",points:"14 2 14 8 20 8"},{type:"line",x1:16,y1:13,x2:8,y2:13},{type:"line",x1:16,y1:17,x2:8,y2:17},{type:"polyline",points:"10 9 9 9 8 9"}],folder:[{type:"path",d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"}],"folder-open":[{type:"path",d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"},{type:"line",x1:2,y1:10,x2:22,y2:10}],code:[{type:"polyline",points:"16 18 22 12 16 6"},{type:"polyline",points:"8 6 2 12 8 18"}],terminal:[{type:"polyline",points:"4 17 10 11 4 5"},{type:"line",x1:12,y1:19,x2:20,y2:19}],lock:[{type:"rect",x:3,y:11,width:18,height:11,rx:2},{type:"path",d:"M7 11V7a5 5 0 0 1 10 0v4"}],unlock:[{type:"rect",x:3,y:11,width:18,height:11,rx:2},{type:"path",d:"M7 11V7a5 5 0 0 1 9.9-1"}],key:[{type:"path",d:"M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3L22 7l-3-3m-3.5 3.5L19 4"}],shield:[{type:"path",d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"}]},Ga=new Set(["bg","surface","surfaceAlt","border","text","textMuted","primary","secondary","danger","warning","success","info"]),_a=(0,a.forwardRef)(({name:e,size:t=24,color:n="currentColor",strokeWidth:r=2,filled:o=!1,label:i,className:a,style:l,children:s,...c},u)=>{const p=function(e,t){return Ga.has(e)?t[e]??e:e}(n,J()),h=e?Xa[e]:null,f=o?{fill:p,stroke:"none"}:{fill:"none",stroke:p,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"},m=!i;return(0,d.jsxs)("svg",{ref:u,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:t,height:t,className:Ct($t("inline-block shrink-0",a??""),a),style:l,"aria-hidden":m?"true":void 0,role:m?void 0:"img","aria-label":m?void 0:i,focusable:"false",...c,children:[!m&&(0,d.jsx)("title",{children:i}),s??(h?h.map((e,t)=>function(e,t,n){const r=t;switch(e.type){case"path":return(0,d.jsx)("path",{d:e.d,...n},r);case"circle":return(0,d.jsx)("circle",{cx:e.cx,cy:e.cy,r:e.r,...n},r);case"rect":return(0,d.jsx)("rect",{x:e.x,y:e.y,width:e.width,height:e.height,rx:e.rx,...n},r);case"line":return(0,d.jsx)("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,...n},r);case"polyline":return(0,d.jsx)("polyline",{points:e.points,...n},r);case"polygon":return(0,d.jsx)("polygon",{points:e.points,...n},r);default:return null}}(e,t,f)):null)]})});_a.displayName="TkxIcon";var Ja={sm:{markSize:24,fontSize:14,taglineSize:10,gap:6,letterSpacing:"-0.01em"},md:{markSize:32,fontSize:18,taglineSize:11,gap:8,letterSpacing:"-0.02em"},lg:{markSize:44,fontSize:26,taglineSize:13,gap:12,letterSpacing:"-0.03em"},xl:{markSize:60,fontSize:36,taglineSize:15,gap:16,letterSpacing:"-0.04em"}};function Qa({size:e,primaryColor:t,reducedMotion:n}){const r="tkx-logo-gradient",o="tkx-logo-glow";return(0,d.jsxs)("svg",{width:e,height:e,viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",style:{filter:n?void 0:`drop-shadow(0 0 ${.15*e}px ${t}60)`,flexShrink:0},children:[(0,d.jsxs)("defs",{children:[(0,d.jsxs)("linearGradient",{id:r,x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[(0,d.jsx)("stop",{offset:"0%",stopColor:t,stopOpacity:"1"}),(0,d.jsx)("stop",{offset:"100%",stopColor:t,stopOpacity:"0.6"})]}),(0,d.jsxs)("filter",{id:o,x:"-20%",y:"-20%",width:"140%",height:"140%",children:[(0,d.jsx)("feGaussianBlur",{stdDeviation:"1.5",result:"blur"}),(0,d.jsxs)("feMerge",{children:[(0,d.jsx)("feMergeNode",{in:"blur"}),(0,d.jsx)("feMergeNode",{in:"SourceGraphic"})]})]})]}),(0,d.jsx)("polygon",{points:"24,3 42,13.5 42,34.5 24,45 6,34.5 6,13.5",stroke:t,strokeWidth:"2",fill:`${t}12`,strokeLinejoin:"round"}),(0,d.jsx)("polygon",{points:"24,9 37,16.5 37,31.5 24,39 11,31.5 11,16.5",stroke:t,strokeWidth:"1",strokeOpacity:"0.3",fill:"none",strokeLinejoin:"round"}),(0,d.jsx)("path",{d:"M27 10 L18 26 L24 26 L21 38 L30 22 L24 22 Z",fill:`url(#${r})`,stroke:t,strokeWidth:"0.5",strokeLinejoin:"round",filter:`url(#${o})`}),(0,d.jsx)("circle",{cx:"24",cy:"3",r:"1.5",fill:t,opacity:"0.7"}),(0,d.jsx)("circle",{cx:"42",cy:"13.5",r:"1.5",fill:t,opacity:"0.5"}),(0,d.jsx)("circle",{cx:"42",cy:"34.5",r:"1.5",fill:t,opacity:"0.5"}),(0,d.jsx)("circle",{cx:"24",cy:"45",r:"1.5",fill:t,opacity:"0.7"}),(0,d.jsx)("circle",{cx:"6",cy:"34.5",r:"1.5",fill:t,opacity:"0.5"}),(0,d.jsx)("circle",{cx:"6",cy:"13.5",r:"1.5",fill:t,opacity:"0.5"})]})}var el=!1;function tl({text:e="TekiVex",tagline:t,variant:n="full",size:r="md",orientation:o="horizontal",mark:i,color:a,className:l,style:s,onClick:c}){const u=J(),p=qe(),h=a??u.primary,f=Ja[r];!function(){if(el||"undefined"==typeof document)return;el=!0;const e=document.createElement("style");e.id="tkx-logo-glow-anim",e.textContent="\n @media (prefers-reduced-motion: no-preference) {\n .tkx-logo-glow {\n animation: tkx-logo-pulse 3s ease-in-out infinite;\n }\n @keyframes tkx-logo-pulse {\n 0%, 100% { opacity: 1; }\n 50% { opacity: 0.75; }\n }\n }\n ",document.head.appendChild(e)}();const m="text-only"!==n,g="icon-only"!==n,x="stacked"===o,y="function"==typeof c,b={display:"inline-flex",flexDirection:x?"column":"row",alignItems:"center",gap:f.gap,cursor:y?"pointer":"default",userSelect:"none",textDecoration:"none",...s},v={display:"flex",flexDirection:"column",alignItems:x?"center":"flex-start",gap:2},w={fontSize:f.fontSize,fontWeight:800,letterSpacing:f.letterSpacing,lineHeight:1,color:u.text,fontFamily:"inherit",margin:0,padding:0},k={fontSize:f.taglineSize,fontWeight:500,color:u.textMuted,letterSpacing:"0.04em",lineHeight:1,margin:0,padding:0},$=function(e,t,n){if(e.length<=3)return(0,d.jsx)("span",{style:{color:t},children:e});const r=e.match(/^([A-Za-z]+?)([A-Z][a-z]*)$/);if(r)return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{style:{color:n},children:r[1]}),(0,d.jsx)("span",{style:{color:t},children:r[2]})]});const o=e.length-3;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{style:{color:n},children:e.slice(0,o)}),(0,d.jsx)("span",{style:{color:t},children:e.slice(o)})]})}(e,h,u.text),S=t?`${e} — ${t}`:e;return(0,d.jsxs)("div",{className:Ct("tkx-logo-glow",l??""),style:b,role:"img","aria-label":S,onClick:y?c:void 0,onKeyDown:y?e=>{!y||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),c?.())}:void 0,tabIndex:y?0:void 0,children:[m&&(i??(0,d.jsx)(Qa,{size:f.markSize,primaryColor:h,reducedMotion:p})),g&&(0,d.jsxs)("div",{style:v,children:[(0,d.jsx)("span",{style:w,"aria-hidden":"true",children:$}),t&&(0,d.jsx)("span",{style:k,"aria-hidden":"true",children:t})]})]})}function nl(e=200){const t=(0,a.useContext)(rl),[n,r]=(0,a.useState)(()=>t?t.events:de().slice(-e));(0,a.useEffect)(()=>{if(!t)return se(t=>{r(n=>{const r=[...n,t];return r.length>e?r.slice(-e):r})})},[t,e]);const o=t?t.events:n;return{events:o,counts:(0,a.useMemo)(()=>{const e={"xss-sanitized":0,"unicode-stripped":0,"pii-redacted":0,audit:0,"clickjacking-detected":0,"rate-limited":0,"mime-rejected":0};for(const t of o)e[t.type]=(e[t.type]??0)+1;return e},[o]),bySeverity:(0,a.useMemo)(()=>{const e={info:0,warning:0,critical:0};for(const t of o)e[t.severity]=(e[t.severity]??0)+1;return e},[o]),clear:(0,a.useCallback)(()=>{ce(),t?t.clear():r([])},[t]),toJSON:(0,a.useCallback)(()=>JSON.stringify({exportedAt:(new Date).toISOString(),events:o},null,2),[o])}}tl.displayName="TkxLogo";var rl=(0,a.createContext)(null),ol={turnstile:"https://challenges.cloudflare.com/turnstile/v0/api.js",hcaptcha:"https://js.hcaptcha.com/1/api.js",recaptcha:"https://www.google.com/recaptcha/api.js"},il={turnstile:"turnstile",hcaptcha:"hcaptcha",recaptcha:"grecaptcha"},al=/^[A-Za-z0-9_-]{20,80}$/,ll={},sl=(0,a.forwardRef)(function({provider:e="turnstile",sitekey:t,theme:n="auto",size:r="normal",language:o,execution:i="render",onVerify:l,onExpire:s,onError:c,className:u,style:p,testMode:h=!1},f){const m=(0,a.useRef)(null),g=(0,a.useRef)(null),x=(0,a.useRef)(null);return"string"!=typeof t||al.test(t),(0,a.useImperativeHandle)(f,()=>({reset:()=>{if(h)return void(x.current=null);const t=window[il[e]];if(t&&null!=g.current){try{t.reset?.(g.current)}catch{}x.current=null}},execute:()=>{if(h)return void setTimeout(()=>{x.current="TEST_TOKEN",l("TEST_TOKEN")},200);const t=window[il[e]];if(t&&null!=g.current)try{t.execute?.(g.current)}catch{}},getResponse:()=>x.current}),[e,l,h]),(0,a.useEffect)(()=>{if(h){const e=window.setTimeout(()=>{x.current="TEST_TOKEN",l("TEST_TOKEN")},200);return()=>window.clearTimeout(e)}let a=!1,d=null;const u=m.current;if(u)return function(e,t){if("undefined"==typeof window)return Promise.resolve();if(window[il[e]])return Promise.resolve();if(ll[e])return ll[e];const n=new Promise((n,r)=>{const o=document.querySelector(`script[data-tkx-captcha="${e}"]`);if(o)return o.addEventListener("load",()=>n()),void o.addEventListener("error",()=>r(new Error("script-load-failed")));const i=document.createElement("script");let a=ol[e];t&&"turnstile"!==e&&(a+=`?hl=${encodeURIComponent(t)}`),i.src=a,i.async=!0,i.defer=!0,i.dataset.tkxCaptcha=e,i.addEventListener("load",()=>n()),i.addEventListener("error",()=>r(new Error("script-load-failed"))),document.head.appendChild(i)});return ll[e]=n,n}(e,o).then(()=>{if(a||!u)return;const p=window[il[e]];if(!p)return;const h={callback:e=>{x.current=e,l(e)},"expired-callback":()=>{x.current=null,s?.()},"error-callback":e=>{x.current=null,c?.("string"==typeof e?e:"unknown")}};try{"turnstile"===e?d=p.render(u,{sitekey:t,theme:n,size:"flexible"===r?"flexible":"compact"===r?"compact":"normal",execution:i,language:o||"auto",...h}):"hcaptcha"===e?d=p.render(u,{sitekey:t,theme:"auto"===n?"light":n,size:"invisible"===r?"invisible":"compact"===r?"compact":"normal",...h}):"recaptcha"===e&&(d=p.render(u,{sitekey:t,theme:"auto"===n?"light":n,size:"invisible"===r?"invisible":"normal",...h})),g.current=d}catch(f){c?.(f?.message||"render-failed")}}).catch(()=>{a||c?.("script-load-failed")}),()=>{a=!0;const t=window[il[e]];if(t&&null!=d)try{t.remove?.(d)}catch{}g.current=null,x.current=null}},[]),(0,d.jsx)("div",{ref:m,className:u,style:p,"data-tkx-captcha-provider":e,children:h&&(0,d.jsx)("div",{"aria-live":"polite",style:{padding:"12px 16px",border:"1px dashed currentColor",borderRadius:8,fontSize:13,opacity:.7,display:"inline-block"},children:"[TkxCaptcha test mode — auto-verifying with TEST_TOKEN]"})})});sl.displayName="TkxCaptcha";var dl={latin:{id:"tkx-font-latin",href:"https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;500;600;700&display=swap"},"latin-ext":{id:"tkx-font-latin-ext",href:"https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;500;600;700&display=swap&subset=latin-ext"},devanagari:{id:"tkx-font-devanagari",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Devanagari:wght@400;500;600;700&display=swap"},tamil:{id:"tkx-font-tamil",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Tamil:wght@400;500;600;700&display=swap"},telugu:{id:"tkx-font-telugu",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Telugu:wght@400;500;600;700&display=swap"},kannada:{id:"tkx-font-kannada",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Kannada:wght@400;500;600;700&display=swap"},malayalam:{id:"tkx-font-malayalam",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Malayalam:wght@400;500;600;700&display=swap"},bengali:{id:"tkx-font-bengali",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Bengali:wght@400;500;600;700&display=swap"},gujarati:{id:"tkx-font-gujarati",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Gujarati:wght@400;500;600;700&display=swap"},gurmukhi:{id:"tkx-font-gurmukhi",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Gurmukhi:wght@400;500;600;700&display=swap"},oriya:{id:"tkx-font-oriya",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Oriya:wght@400;500;600;700&display=swap"},sinhala:{id:"tkx-font-sinhala",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Sinhala:wght@400;500;600;700&display=swap"},arabic:{id:"tkx-font-arabic",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Arabic:wght@400;500;600;700&display=swap"},hebrew:{id:"tkx-font-hebrew",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Hebrew:wght@400;500;600;700&display=swap"},thai:{id:"tkx-font-thai",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Thai:wght@400;500;600;700&display=swap"},vietnamese:{id:"tkx-font-vietnamese",href:"https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;500;600;700&display=swap&subset=vietnamese"},cyrillic:{id:"tkx-font-cyrillic",href:"https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;500;600;700&display=swap&subset=cyrillic"},"cyrillic-ext":{id:"tkx-font-cyrillic-ext",href:"https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;500;600;700&display=swap&subset=cyrillic-ext"},greek:{id:"tkx-font-greek",href:"https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;500;600;700&display=swap&subset=greek"},"greek-ext":{id:"tkx-font-greek-ext",href:"https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;500;600;700&display=swap&subset=greek-ext"},jp:{id:"tkx-font-jp",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;600;700&display=swap"},kr:{id:"tkx-font-kr",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;600;700&display=swap"},sc:{id:"tkx-font-sc",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;600;700&display=swap"},tc:{id:"tkx-font-tc",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;500;600;700&display=swap"}},cl={en:["latin"],hi:["devanagari"],mr:["devanagari"],sa:["devanagari"],ne:["devanagari"],ta:["tamil"],te:["telugu"],kn:["kannada"],ml:["malayalam"],bn:["bengali"],as:["bengali"],gu:["gujarati"],pa:["gurmukhi"],or:["oriya"],si:["sinhala"],ar:["arabic"],ur:["arabic"],fa:["arabic"],he:["hebrew"],th:["thai"],vi:["vietnamese","latin"],ru:["cyrillic"],uk:["cyrillic"],bg:["cyrillic"],el:["greek"],ja:["jp"],ko:["kr"],zh:["sc"],"zh-CN":["sc"],"zh-TW":["tc"],"zh-HK":["tc"]},ul=!1;function pl(e){if("undefined"==typeof document)return;const t=dl[e];if(!t)return;if(document.getElementById(t.id))return;const n=document.createElement("link");n.id=t.id,n.rel="stylesheet",n.href=t.href,document.head.appendChild(n)}function hl(e){return e&&(cl[e]||cl[e.split("-")[0]])||["latin"]}var fl=[{iso2:"in",name:"India",dial:"91",length:10,format:"##### #####",flag:"🇮🇳"},{iso2:"us",name:"United States",dial:"1",length:10,format:"(###) ###-####",flag:"🇺🇸"},{iso2:"gb",name:"United Kingdom",dial:"44",length:[9,10],format:"#### ######",flag:"🇬🇧"},{iso2:"ca",name:"Canada",dial:"1",length:10,format:"(###) ###-####",flag:"🇨🇦"},{iso2:"au",name:"Australia",dial:"61",length:9,format:"### ### ###",flag:"🇦🇺"},{iso2:"de",name:"Germany",dial:"49",length:[10,11],format:"#### ########",flag:"🇩🇪"},{iso2:"fr",name:"France",dial:"33",length:9,format:"# ## ## ## ##",flag:"🇫🇷"},{iso2:"es",name:"Spain",dial:"34",length:9,format:"### ### ###",flag:"🇪🇸"},{iso2:"it",name:"Italy",dial:"39",length:[9,10],format:"### ### ####",flag:"🇮🇹"},{iso2:"nl",name:"Netherlands",dial:"31",length:9,format:"# #### ####",flag:"🇳🇱"},{iso2:"se",name:"Sweden",dial:"46",length:[7,9],format:"## ### ## ##",flag:"🇸🇪"},{iso2:"no",name:"Norway",dial:"47",length:8,format:"### ## ###",flag:"🇳🇴"},{iso2:"dk",name:"Denmark",dial:"45",length:8,format:"## ## ## ##",flag:"🇩🇰"},{iso2:"fi",name:"Finland",dial:"358",length:[9,10],format:"## ### ####",flag:"🇫🇮"},{iso2:"pl",name:"Poland",dial:"48",length:9,format:"### ### ###",flag:"🇵🇱"},{iso2:"ie",name:"Ireland",dial:"353",length:9,format:"## ### ####",flag:"🇮🇪"},{iso2:"pt",name:"Portugal",dial:"351",length:9,format:"### ### ###",flag:"🇵🇹"},{iso2:"ch",name:"Switzerland",dial:"41",length:9,format:"## ### ## ##",flag:"🇨🇭"},{iso2:"at",name:"Austria",dial:"43",length:[10,11],format:"### ### ####",flag:"🇦🇹"},{iso2:"be",name:"Belgium",dial:"32",length:9,format:"### ## ## ##",flag:"🇧🇪"},{iso2:"jp",name:"Japan",dial:"81",length:10,format:"## #### ####",flag:"🇯🇵"},{iso2:"kr",name:"South Korea",dial:"82",length:[9,10],format:"## #### ####",flag:"🇰🇷"},{iso2:"cn",name:"China",dial:"86",length:11,format:"### #### ####",flag:"🇨🇳"},{iso2:"hk",name:"Hong Kong",dial:"852",length:8,format:"#### ####",flag:"🇭🇰"},{iso2:"sg",name:"Singapore",dial:"65",length:8,format:"#### ####",flag:"🇸🇬"},{iso2:"my",name:"Malaysia",dial:"60",length:[9,10],format:"## ### ####",flag:"🇲🇾"},{iso2:"id",name:"Indonesia",dial:"62",length:[9,12],format:"### ### ####",flag:"🇮🇩"},{iso2:"th",name:"Thailand",dial:"66",length:9,format:"## ### ####",flag:"🇹🇭"},{iso2:"vn",name:"Vietnam",dial:"84",length:[9,10],format:"### ### ####",flag:"🇻🇳"},{iso2:"ph",name:"Philippines",dial:"63",length:10,format:"### ### ####",flag:"🇵🇭"},{iso2:"pk",name:"Pakistan",dial:"92",length:10,format:"### #######",flag:"🇵🇰"},{iso2:"bd",name:"Bangladesh",dial:"880",length:10,format:"#### ######",flag:"🇧🇩"},{iso2:"lk",name:"Sri Lanka",dial:"94",length:9,format:"## ### ####",flag:"🇱🇰"},{iso2:"np",name:"Nepal",dial:"977",length:10,format:"###-#######",flag:"🇳🇵"},{iso2:"ae",name:"UAE",dial:"971",length:9,format:"## ### ####",flag:"🇦🇪"},{iso2:"sa",name:"Saudi Arabia",dial:"966",length:9,format:"## ### ####",flag:"🇸🇦"},{iso2:"qa",name:"Qatar",dial:"974",length:8,format:"#### ####",flag:"🇶🇦"},{iso2:"kw",name:"Kuwait",dial:"965",length:8,format:"#### ####",flag:"🇰🇼"},{iso2:"om",name:"Oman",dial:"968",length:8,format:"#### ####",flag:"🇴🇲"},{iso2:"bh",name:"Bahrain",dial:"973",length:8,format:"#### ####",flag:"🇧🇭"},{iso2:"il",name:"Israel",dial:"972",length:9,format:"## ### ####",flag:"🇮🇱"},{iso2:"tr",name:"Turkey",dial:"90",length:10,format:"### ### ####",flag:"🇹🇷"},{iso2:"ru",name:"Russia",dial:"7",length:10,format:"### ### ####",flag:"🇷🇺"},{iso2:"ua",name:"Ukraine",dial:"380",length:9,format:"## ### ####",flag:"🇺🇦"},{iso2:"br",name:"Brazil",dial:"55",length:[10,11],format:"## ##### ####",flag:"🇧🇷"},{iso2:"mx",name:"Mexico",dial:"52",length:10,format:"## #### ####",flag:"🇲🇽"},{iso2:"ar",name:"Argentina",dial:"54",length:10,format:"## #### ####",flag:"🇦🇷"},{iso2:"cl",name:"Chile",dial:"56",length:9,format:"# #### ####",flag:"🇨🇱"},{iso2:"co",name:"Colombia",dial:"57",length:10,format:"### ### ####",flag:"🇨🇴"},{iso2:"pe",name:"Peru",dial:"51",length:9,format:"### ### ###",flag:"🇵🇪"},{iso2:"za",name:"South Africa",dial:"27",length:9,format:"## ### ####",flag:"🇿🇦"},{iso2:"ng",name:"Nigeria",dial:"234",length:10,format:"### ### ####",flag:"🇳🇬"},{iso2:"ke",name:"Kenya",dial:"254",length:9,format:"### ### ###",flag:"🇰🇪"},{iso2:"eg",name:"Egypt",dial:"20",length:10,format:"### ### ####",flag:"🇪🇬"},{iso2:"ma",name:"Morocco",dial:"212",length:9,format:"## ### ####",flag:"🇲🇦"},{iso2:"nz",name:"New Zealand",dial:"64",length:[8,9],format:"## ### ####",flag:"🇳🇿"}];function ml(e){return e.replace(/\D+/g,"")}function gl(e,t){if(!t)return e;let n="",r=0;for(const o of t)if("#"===o){if(r>=e.length)break;n+=e[r++]}else r<e.length&&(n+=o);return r<e.length&&(n+=e.slice(r)),n}function xl(e,t){return Array.isArray(t)?e.length>=t[0]&&e.length<=t[1]:e.length===t}function yl(e){return Array.isArray(e)?`${e[0]}–${e[1]}`:`${e}`}var bl=(0,a.forwardRef)(function({defaultCountry:e="in",value:t,defaultValue:n,onChange:r,onValid:o,label:i,placeholder:l,disabled:s,required:c,id:u,name:p,extraCountries:h=[],className:f,style:m},g){const x=J(),y=(0,a.useId)(),b=(0,a.useId)(),v=(0,a.useMemo)(()=>[...fl,...h].sort((e,t)=>e.name.localeCompare(t.name)),[h]),w=e=>v.find(t=>t.iso2===e.toLowerCase())||v[0],k=t=>{if(!t.startsWith("+"))return{country:w(e),digits:ml(t)};const n=ml(t);for(const e of[4,3,2,1]){const t=n.slice(0,e),r=v.find(e=>e.dial===t);if(r)return{country:r,digits:n.slice(e)}}return{country:w(e),digits:n}},$=t?k(t):{country:w(e),digits:ml(n||"")},[S,C]=(0,a.useState)($.country),[z,M]=(0,a.useState)($.digits),[N,D]=(0,a.useState)(!1),[R,P]=(0,a.useState)(""),[F,A]=(0,a.useState)(0),I=(0,a.useRef)(null),L=(0,a.useRef)(null);(0,a.useEffect)(()=>{if(void 0===t)return;const e=k(t);C(e.country),M(e.digits)},[t]);const T=gl(z,S.format),W=xl(z,S.length),j=z?`+${S.dial}${z}`:"",E=(e,t)=>{const n={raw:gl(e,t.format),digits:e,e164:e?`+${t.dial}${e}`:"",country:t,valid:xl(e,t.length)};r?.(n)},B=e=>{C(e),D(!1),E(z,e),I.current?.focus()},V=(0,a.useMemo)(()=>{const e=R.trim().toLowerCase();return e?v.filter(t=>t.name.toLowerCase().includes(e)||t.iso2.includes(e)||t.dial.includes(e.replace(/^\+/,""))):v},[v,R]);(0,a.useEffect)(()=>{A(0)},[R]),(0,a.useEffect)(()=>{if(N){const e=setTimeout(()=>L.current?.focus(),0);return()=>clearTimeout(e)}},[N]);const H=l??yl(S.length).replace(/\d/g,"#"),O={display:"inline-flex",flexDirection:"column",gap:6,width:"100%",maxWidth:360,...m},q={fontSize:13,fontWeight:600,color:x.text},U={display:"flex",alignItems:"stretch",border:`1px solid ${x.border}`,borderRadius:8,background:x.surface,overflow:"visible",position:"relative"},K={display:"inline-flex",alignItems:"center",gap:6,padding:"0 10px",background:"transparent",border:"none",borderRight:`1px solid ${x.border}`,cursor:s?"not-allowed":"pointer",color:x.text,fontSize:14,minHeight:40,fontWeight:500},Y={flex:1,border:"none",outline:"none",padding:"0 12px",fontSize:14,color:x.text,background:"transparent",minHeight:40,minWidth:0},Z={position:"absolute",top:"calc(100% + 4px)",left:0,right:0,maxHeight:280,overflow:"auto",background:x.surface,border:`1px solid ${x.border}`,borderRadius:8,zIndex:1e3,padding:6,boxShadow:"0 8px 24px rgba(0,0,0,0.18)"},X={width:"100%",padding:"8px 10px",border:`1px solid ${x.border}`,borderRadius:6,background:x.bg,color:x.text,fontSize:13,marginBottom:6,outline:"none"},G={fontSize:12,color:x.danger,marginTop:2};return(0,d.jsxs)("div",{className:f,style:O,onKeyDown:e=>{N&&("ArrowDown"===e.key?(e.preventDefault(),A(e=>Math.min(V.length-1,e+1))):"ArrowUp"===e.key?(e.preventDefault(),A(e=>Math.max(0,e-1))):"Enter"===e.key?(e.preventDefault(),V[F]&&B(V[F])):"Escape"===e.key&&(e.preventDefault(),D(!1),I.current?.focus()))},children:[i&&(0,d.jsxs)("label",{htmlFor:u||y,style:q,children:[i,c&&(0,d.jsx)("span",{style:{color:x.danger,marginLeft:4},"aria-hidden":"true",children:"*"})]}),(0,d.jsxs)("div",{style:U,children:[(0,d.jsxs)("button",{ref:I,type:"button",style:K,onClick:()=>!s&&D(e=>!e),"aria-haspopup":"listbox","aria-expanded":N,"aria-controls":b,"aria-label":`Country: ${S.name}, dial code +${S.dial}`,disabled:s,children:[(0,d.jsx)("span",{"aria-hidden":"true",style:{fontSize:18,lineHeight:1},children:S.flag}),(0,d.jsxs)("span",{"aria-hidden":"true",children:["+",S.dial]}),(0,d.jsx)("span",{"aria-hidden":"true",style:{fontSize:10,opacity:.6,marginLeft:2},children:"▾"})]}),(0,d.jsx)("input",{ref:g,id:u||y,name:p,type:"tel",inputMode:"tel",autoComplete:"tel-national",value:T,onChange:e=>{const t=ml(e.target.value).slice(0,15);M(t),E(t,S)},onBlur:()=>{W&&o&&o({raw:T,digits:z,e164:j,country:S,valid:!0})},placeholder:H,disabled:s,required:c,"aria-invalid":z.length>0&&!W,"aria-describedby":z.length>0&&!W?`${y}-err`:void 0,style:Y}),N&&!s&&(0,d.jsxs)("div",{id:b,role:"listbox","aria-label":"Select country",style:Z,children:[(0,d.jsx)("input",{ref:L,type:"text",placeholder:"Search country or dial code…",value:R,onChange:e=>P(e.target.value),style:X,"aria-label":"Filter countries"}),0===V.length&&(0,d.jsxs)("div",{style:{padding:"12px 10px",fontSize:13,color:x.textMuted},children:['No country matches "',R,'"']}),V.map((e,t)=>{return(0,d.jsxs)("div",{role:"option","aria-selected":t===F,onMouseEnter:()=>A(t),onClick:()=>B(e),style:(n=t===F,{display:"flex",alignItems:"center",gap:10,padding:"8px 10px",borderRadius:6,cursor:"pointer",background:n?x.surfaceAlt:"transparent",color:x.text,fontSize:13}),children:[(0,d.jsx)("span",{"aria-hidden":"true",style:{fontSize:16},children:e.flag}),(0,d.jsx)("span",{style:{flex:1},children:e.name}),(0,d.jsxs)("span",{style:{color:x.textMuted,fontVariantNumeric:"tabular-nums"},children:["+",e.dial]})]},e.iso2);var n})]})]}),z.length>0&&!W&&(0,d.jsxs)("div",{id:`${y}-err`,role:"alert",style:G,children:["Expected ",yl(S.length)," digits for ",S.name,"."]})]})});bl.displayName="TkxPhoneInput";var vl={free:null,"1:1":1,"3:4":3/4,"4:5":.8,"16:9":16/9,"4:3":4/3,"3:2":1.5},wl={drop:"Drop an image here, or",browse:"browse",rotate:"Rotate",apply:"Apply",cancel:"Cancel",brightness:"Brightness",contrast:"Contrast",aspect:"Aspect",free:"Free"},kl=(0,a.forwardRef)(function({src:e,aspectRatio:t="free",ratios:n=["free","1:1","3:4","4:5","16:9"],mimeType:r="image/png",quality:o=.92,maxOutputSize:i=2048,outputFilename:l="edited.png",onChange:s,onResult:c,onCancel:u,className:p,style:h,labels:f},m){const g={...wl,...f},x=J(),y=(0,a.useRef)(null),b=(0,a.useRef)(null),v=(0,a.useRef)(null),w=(0,a.useRef)(null),[k,$]=(0,a.useState)(e??null),[S,C]=(0,a.useState)(null),[z,M]=(0,a.useState)(t),[N,D]=(0,a.useState)(0),[R,P]=(0,a.useState)(100),[F,A]=(0,a.useState)(100),[I,L]=(0,a.useState)({x:0,y:0,w:0,h:0}),[T,W]=(0,a.useState)(!1),j=(0,a.useRef)({mode:null,startX:0,startY:0,startCrop:{x:0,y:0,w:0,h:0}});(0,a.useEffect)(()=>{if(!k)return w.current=null,void C(null);const e=new Image;e.crossOrigin="anonymous",e.onload=()=>{w.current=e,C({w:e.naturalWidth,h:e.naturalHeight});const t=vl[z];if(t){const n=Math.min(e.naturalWidth,e.naturalHeight*t),r=n/t;L({x:(e.naturalWidth-n)/2,y:(e.naturalHeight-r)/2,w:n,h:r})}else L({x:0,y:0,w:e.naturalWidth,h:e.naturalHeight})},e.src=k},[k,z]),(0,a.useEffect)(()=>{s?.({rotation:N,brightness:R,contrast:F})},[N,R,F,s]);const E=(0,a.useCallback)(()=>{const e=b.current,t=w.current,n=S;if(!e||!t||!n)return;const r=e.getContext("2d");if(!r)return;const o=v.current,i=o?Math.min(o.clientWidth,800):600,a=N%180!=0,l=a?n.h:n.w,s=a?n.w:n.h,d=Math.min(i/l,600/s,1),c=Math.floor(l*d),u=Math.floor(s*d);e.width=c,e.height=u,r.save(),r.filter=`brightness(${R}%) contrast(${F}%)`,r.translate(c/2,u/2),r.rotate(N*Math.PI/180),r.drawImage(t,-n.w*d/2,-n.h*d/2,n.w*d,n.h*d),r.restore()},[N,R,F,S]);(0,a.useEffect)(()=>{E()},[E]),(0,a.useEffect)(()=>{const e=S;if(!e)return;const t=vl[z];t&&L(n=>{const r=n.x+n.w/2,o=n.y+n.h/2;let i=n.w,a=i/t;return a>e.h&&(a=e.h,i=a*t),i>e.w&&(i=e.w,a=i/t),{x:Math.max(0,Math.min(e.w-i,r-i/2)),y:Math.max(0,Math.min(e.h-a,o-a/2)),w:i,h:a}})},[z,S]);const B=e=>{const t=new FileReader;t.onload=()=>{"string"==typeof t.result&&($(t.result),D(0),P(100),A(100))},t.readAsDataURL(e)},V=e=>t=>{t.preventDefault(),t.stopPropagation();const n="touches"in t?t.touches[0]:t;j.current={mode:e,startX:n.clientX,startY:n.clientY,startCrop:{...I}};const r=e=>{e.preventDefault();const t="touches"in e?e.touches[0]:e,n=t.clientX-j.current.startX,r=t.clientY-j.current.startY,o=S;if(!o)return;const i=b.current;if(!i)return;const a=n*(o.w/i.width),l=r*(o.h/i.height),s=j.current.startCrop,d=vl[z];let c={...s};if("move"===j.current.mode)c.x=Math.max(0,Math.min(o.w-s.w,s.x+a)),c.y=Math.max(0,Math.min(o.h-s.h,s.y+l));else{const e=j.current.mode;if("se"===e)c.w=Math.max(20,Math.min(o.w-s.x,s.w+a)),c.h=d?c.w/d:Math.max(20,Math.min(o.h-s.y,s.h+l));else if("sw"===e){const e=Math.max(20,s.w-a);c.x=Math.max(0,s.x+s.w-e),c.w=s.x+s.w-c.x,c.h=d?c.w/d:Math.max(20,Math.min(o.h-s.y,s.h+l))}else if("ne"===e){c.w=Math.max(20,Math.min(o.w-s.x,s.w+a));const e=d?c.w/d:Math.max(20,s.h-l);c.y=Math.max(0,s.y+s.h-e),c.h=s.y+s.h-c.y}else if("nw"===e){const e=Math.max(20,s.w-a);c.x=Math.max(0,s.x+s.w-e),c.w=s.x+s.w-c.x;const t=d?c.w/d:Math.max(20,s.h-l);c.y=Math.max(0,s.y+s.h-t),c.h=s.y+s.h-c.y}}L(c)},o=()=>{j.current.mode=null,window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",o),window.removeEventListener("touchmove",r),window.removeEventListener("touchend",o)};window.addEventListener("mousemove",r,{passive:!1}),window.addEventListener("mouseup",o),window.addEventListener("touchmove",r,{passive:!1}),window.addEventListener("touchend",o)},H=(0,a.useCallback)(()=>new Promise(e=>{const t=w.current,n=S;if(!t||!n)return e(null);const a=document.createElement("canvas"),s=N%180!=0,d=s?I.h:I.w,c=s?I.w:I.h,u=Math.min(1,i/Math.max(d,c));a.width=Math.round(d*u),a.height=Math.round(c*u);const p=a.getContext("2d");if(!p)return e(null);p.filter=`brightness(${R}%) contrast(${F}%)`;const h=document.createElement("canvas");h.width=s?n.h:n.w,h.height=s?n.w:n.h;const f=h.getContext("2d");if(!f)return e(null);f.translate(h.width/2,h.height/2),f.rotate(N*Math.PI/180),f.drawImage(t,-n.w/2,-n.h/2,n.w,n.h),p.drawImage(h,I.x,I.y,I.w,I.h,0,0,a.width,a.height),a.toBlob(t=>{if(!t)return e(null);const n="image/jpeg"===r?"jpg":"image/webp"===r?"webp":"png",o=l.endsWith(`.${n}`)?l:l.replace(/\.\w+$/,"")+`.${n}`;e({blob:t,file:new File([t],o,{type:r,lastModified:Date.now()}),url:URL.createObjectURL(t),width:a.width,height:a.height})},r,o)}),[I,N,R,F,S,r,o,i,l]);(0,a.useImperativeHandle)(m,()=>({getResult:H,reset:()=>{if(D(0),P(100),A(100),S){const e=vl[z];if(e){const t=Math.min(S.w,S.h*e),n=t/e;L({x:(S.w-t)/2,y:(S.h-n)/2,w:t,h:n})}else L({x:0,y:0,w:S.w,h:S.h})}},loadSource:e=>$(e)}),[H,z,S]);const O={border:`1px solid ${x.border}`,borderRadius:12,background:x.surface,padding:16,...h},q={border:`2px dashed ${T?x.primary:x.border}`,borderRadius:10,padding:48,textAlign:"center",color:x.textMuted,cursor:"pointer",transition:"border-color 0.15s",background:T?`${x.primary}10`:"transparent"},U={padding:"8px 14px",border:`1px solid ${x.border}`,borderRadius:6,background:x.bg,color:x.text,cursor:"pointer",fontSize:13,fontWeight:600,minHeight:36},K=(0,a.useMemo)(()=>{const e=b.current,t=S;if(!e||!t)return null;const n=N%180!=0,r=n?t.h:t.w,o=n?t.w:t.h,i=e.width/r,a=e.height/o;return{left:I.x*i,top:I.y*a,width:I.w*i,height:I.h*a}},[I,S,N]);return k?(0,d.jsxs)("div",{ref:v,className:p,style:O,children:[(0,d.jsxs)("div",{style:{display:"flex",gap:8,flexWrap:"wrap",marginBottom:12,alignItems:"center"},children:[(0,d.jsxs)("span",{style:{fontSize:13,fontWeight:600,marginRight:4},children:[g.aspect,":"]}),n.map(e=>{return(0,d.jsx)("button",{type:"button",onClick:()=>M(e),style:(t=z===e,{...U,background:t?x.primary:x.bg,color:t?x.bg:x.text,borderColor:t?x.primary:x.border}),"aria-pressed":z===e,children:"free"===e?g.free:e},e);var t}),(0,d.jsx)("div",{style:{width:1,height:24,background:x.border,margin:"0 4px"}}),(0,d.jsxs)("button",{type:"button",onClick:()=>D(e=>(e-90+360)%360),style:U,"aria-label":`${g.rotate} 90 degrees left`,children:["↺ ",g.rotate]}),(0,d.jsxs)("button",{type:"button",onClick:()=>D(e=>(e+90)%360),style:U,"aria-label":`${g.rotate} 90 degrees right`,children:["↻ ",g.rotate]})]}),(0,d.jsxs)("div",{style:{display:"flex",gap:16,marginBottom:12,flexWrap:"wrap"},children:[(0,d.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13},children:[(0,d.jsx)("span",{style:{minWidth:80},children:g.brightness}),(0,d.jsx)("input",{type:"range",min:50,max:150,value:R,onChange:e=>P(Number(e.target.value)),"aria-label":g.brightness,style:{width:140}}),(0,d.jsxs)("span",{style:{minWidth:40,color:x.textMuted,fontVariantNumeric:"tabular-nums"},children:[R,"%"]})]}),(0,d.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13},children:[(0,d.jsx)("span",{style:{minWidth:80},children:g.contrast}),(0,d.jsx)("input",{type:"range",min:50,max:150,value:F,onChange:e=>A(Number(e.target.value)),"aria-label":g.contrast,style:{width:140}}),(0,d.jsxs)("span",{style:{minWidth:40,color:x.textMuted,fontVariantNumeric:"tabular-nums"},children:[F,"%"]})]})]}),(0,d.jsxs)("div",{style:{position:"relative",display:"inline-block",maxWidth:"100%",userSelect:"none",touchAction:"none"},children:[(0,d.jsx)("canvas",{ref:b,style:{display:"block",maxWidth:"100%"}}),K&&(0,d.jsx)("div",{role:"region","aria-label":"Crop area",style:{position:"absolute",left:K.left,top:K.top,width:K.width,height:K.height,border:`2px solid ${x.primary}`,boxShadow:`0 0 0 9999px ${x.bg}aa`,cursor:"move",touchAction:"none"},onMouseDown:V("move"),onTouchStart:V("move"),tabIndex:0,onKeyDown:e=>{const t=S;if(!t)return;const n=e.shiftKey?20:5;"ArrowLeft"===e.key?L(e=>({...e,x:Math.max(0,e.x-n)})):"ArrowRight"===e.key?L(e=>({...e,x:Math.min(t.w-e.w,e.x+n)})):"ArrowUp"===e.key?L(e=>({...e,y:Math.max(0,e.y-n)})):"ArrowDown"===e.key&&L(e=>({...e,y:Math.min(t.h-e.h,e.y+n)}))},children:["nw","ne","sw","se"].map(e=>(0,d.jsx)("div",{onMouseDown:V(e),onTouchStart:V(e),style:{position:"absolute",width:14,height:14,background:x.primary,border:`2px solid ${x.bg}`,borderRadius:2,cursor:`${e}-resize`,top:e.startsWith("n")?-7:void 0,bottom:e.startsWith("s")?-7:void 0,left:e.endsWith("w")?-7:void 0,right:e.endsWith("e")?-7:void 0,touchAction:"none"},"aria-hidden":"true"},e))})]}),(0,d.jsxs)("div",{style:{display:"flex",gap:8,marginTop:16,justifyContent:"flex-end"},children:[u&&(0,d.jsx)("button",{type:"button",onClick:u,style:U,children:g.cancel}),(0,d.jsx)("button",{type:"button",onClick:async()=>{const e=await H();e&&c&&c(e)},style:{...U,background:x.primary,color:x.bg,borderColor:x.primary},children:g.apply})]})]}):(0,d.jsx)("div",{className:p,style:O,children:(0,d.jsxs)("div",{style:q,onClick:()=>y.current?.click(),onDrop:e=>{e.preventDefault(),W(!1);const t=e.dataTransfer.files?.[0];t&&t.type.startsWith("image/")&&B(t)},onDragOver:e=>{e.preventDefault(),W(!0)},onDragLeave:()=>W(!1),role:"button",tabIndex:0,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),y.current?.click())},"aria-label":"Upload image to edit",children:[(0,d.jsx)("div",{style:{fontSize:14,marginBottom:6},children:g.drop}),(0,d.jsx)("button",{type:"button",style:{...U,color:x.primary,borderColor:x.primary},children:g.browse}),(0,d.jsx)("input",{ref:y,type:"file",accept:"image/*",style:{display:"none"},onChange:e=>{const t=e.target.files?.[0];t&&B(t)}})]})})});kl.displayName="TkxImageEditor";var $l={razorpay:"https://checkout.razorpay.com/v1/checkout.js",stripe:"https://js.stripe.com/v3/",square:"https://web.squarecdn.com/v1/square.js"},Sl={razorpay:"Razorpay",stripe:"Stripe",square:"Square"},Cl=/^[A-Za-z0-9_-]{20,200}$/,zl={},Ml=(0,a.forwardRef)(function({config:e,onSuccess:t,onFailure:n,onDismiss:r,children:o,variant:i="primary",size:l="md",disabled:s,className:c,style:u},p){const h=J(),f=_t(),[m,g]=(0,a.useState)(!1),x="razorpay"===e.provider||"stripe"===e.provider?e.publicKey:e.applicationId;Cl.test(x);const y="sm"===l?13:"lg"===l?16:14,b="sm"===l?32:"lg"===l?48:40,v={padding:`${"sm"===l?6:"lg"===l?12:9}px ${"sm"===l?12:"lg"===l?22:16}px`,borderRadius:8,border:"outline"===i?`1.5px solid ${h.primary}`:"none",background:"outline"===i?"transparent":h.primary,color:"outline"===i?h.primary:h.bg,fontSize:y,fontWeight:600,cursor:s?"not-allowed":m?"progress":"pointer",opacity:s?.5:1,minHeight:b,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:8,transition:"opacity 0.15s, transform 0.05s",...u};return(0,d.jsx)("button",{ref:p,type:"button",onClick:async()=>{if(!m&&!s){g(!0);try{if(await function(e){if("undefined"==typeof window)return Promise.resolve();if(window[Sl[e]])return Promise.resolve();if(zl[e])return zl[e];const t=new Promise((t,n)=>{const r=document.querySelector(`script[data-tkx-payment="${e}"]`);if(r)return r.addEventListener("load",()=>t()),void r.addEventListener("error",()=>n(new Error("script-load-failed")));const o=document.createElement("script");o.src=$l[e],o.async=!0,o.dataset.tkxPayment=e,o.addEventListener("load",()=>t()),o.addEventListener("error",()=>n(new Error("script-load-failed"))),document.head.appendChild(o)});return zl[e]=t,t}(e.provider),"razorpay"===e.provider){const o=window.Razorpay;if(!o)throw new Error("Razorpay script loaded but global missing");const i=new o({key:e.publicKey,amount:e.amount,currency:e.currency,order_id:e.orderId,name:pe(e.brand?.name??"Payment"),description:pe(e.brand?.description??""),image:e.brand?.image,prefill:e.prefill,notes:e.notes,theme:{color:e.themeColor??h.primary},handler:e=>{t({provider:"razorpay",paymentId:e.razorpay_payment_id,orderId:e.razorpay_order_id,signature:e.razorpay_signature,raw:e})},modal:{ondismiss:()=>{g(!1),r?.()}}});return i.on("payment.failed",e=>{g(!1),n?.({provider:"razorpay",code:e?.error?.code??"unknown",message:e?.error?.description??"Payment failed",raw:e})}),void i.open()}if("stripe"===e.provider){const t=window.Stripe;if(!t)throw new Error("Stripe script loaded but global missing");const r=await t(e.publicKey).redirectToCheckout({sessionId:e.sessionId});return void(r?.error&&(g(!1),n?.({provider:"stripe",code:r.error.code??"unknown",message:r.error.message??"Stripe checkout failed",raw:r})))}if("square"===e.provider){if(!window.Square)throw new Error("Square script loaded but global missing");const r={applicationId:e.applicationId,locationId:e.locationId,orderId:e.orderId,amount:e.amount,currency:e.currency,success:(n,r)=>t({provider:"square",paymentId:n,orderId:e.orderId,raw:r}),failure:(e,t,r)=>n?.({provider:"square",code:e,message:t,raw:r})};return void window.dispatchEvent(new CustomEvent("tkx-payment-square-init",{detail:r}))}}catch(o){g(!1),n?.({provider:e.provider,code:"sdk-load-failed",message:o?.message??"Unable to load payment SDK",raw:o})}}},disabled:s||m,"aria-busy":m,className:c,style:v,"data-tkx-payment-provider":e.provider,children:m?(0,d.jsx)("span",{"aria-hidden":"true",children:f.loading}):o??"Pay"})});Ml.displayName="TkxPaymentButton";var Nl=(0,a.forwardRef)(function({label:e,width:t,height:n=180,strokeColor:r,strokeWidth:o=2,backgroundColor:i,onChange:l,disabled:s,className:c,style:u},p){const h=J(),f=(0,a.useRef)(null),m=(0,a.useRef)(null),g=(0,a.useRef)([]),x=(0,a.useRef)(null),y=(0,a.useRef)(1),[b,v]=(0,a.useState)(t??320),w=r??h.text,k=i??h.surface;(0,a.useEffect)(()=>{if(void 0!==t)return;const e=f.current;if(!e||"undefined"==typeof ResizeObserver)return;const n=new ResizeObserver(e=>{for(const t of e){const e=Math.floor(t.contentRect.width);e>0&&v(e)}});return n.observe(e),()=>n.disconnect()},[t]);const $=(0,a.useCallback)(()=>{const e=m.current;if(!e)return;const t=e.getContext("2d");if(!t)return;const n=y.current;t.fillStyle=k,t.fillRect(0,0,e.width,e.height),t.strokeStyle=w,t.lineWidth=o*n,t.lineCap="round",t.lineJoin="round";for(const r of g.current){if(r.length<2){1===r.length&&(t.beginPath(),t.arc(r[0].x*n,r[0].y*n,o*n/2,0,2*Math.PI),t.fillStyle=w,t.fill());continue}t.beginPath(),t.moveTo(r[0].x*n,r[0].y*n);for(let o=1;o<r.length-1;o++){const e=(r[o].x+r[o+1].x)/2,i=(r[o].y+r[o+1].y)/2;t.quadraticCurveTo(r[o].x*n,r[o].y*n,e*n,i*n)}const e=r[r.length-1];t.lineTo(e.x*n,e.y*n),t.stroke()}},[k,w,o]);(0,a.useEffect)(()=>{const e=m.current;if(!e)return;const t=window.devicePixelRatio||1;y.current=t,e.width=b*t,e.height=n*t,e.style.width=`${b}px`,e.style.height=`${n}px`,$()},[b,n,$]);const S=e=>{const t=e.currentTarget.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top}},C=e=>{if(x.current){try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}x.current=null,l?.(m.current?.toDataURL("image/png")??"")}},z=(0,a.useCallback)(()=>{g.current=[],x.current=null,$(),l?.(m.current?.toDataURL("image/png")??"")},[$,l]),M=(0,a.useCallback)(()=>{g.current.pop(),$(),l?.(m.current?.toDataURL("image/png")??"")},[$,l]);(0,a.useImperativeHandle)(p,()=>({clear:z,undo:M,isEmpty:()=>0===g.current.length,toDataURL:(e="image/png",t=.92)=>m.current?.toDataURL(e,t)??"",toBlob:(e="image/png",t=.92)=>new Promise(n=>{m.current?.toBlob(e=>n(e),e,t)})}),[z,M]);const N={display:"inline-flex",flexDirection:"column",gap:6,width:t??"100%",...u},D={fontSize:13,fontWeight:600,color:h.text},R={borderRadius:8,border:`1px solid ${h.border}`,background:k,cursor:s?"not-allowed":"crosshair",touchAction:"none",display:"block",width:"100%"};return(0,d.jsxs)("div",{ref:f,className:c,style:N,children:[e&&(0,d.jsx)("label",{style:D,children:e}),(0,d.jsx)("canvas",{ref:m,role:"img",tabIndex:s?-1:0,"aria-label":e??"Signature pad",style:R,onPointerDown:e=>{s||(e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),x.current=[S(e)],g.current.push(x.current))},onPointerMove:e=>{if(!x.current||s)return;e.preventDefault();const t=S(e),n=x.current,r=n[n.length-1];Math.abs(r.x-t.x)<1&&Math.abs(r.y-t.y)<1||(n.push(t),$())},onPointerUp:C,onPointerCancel:C,onKeyDown:e=>{s||("Backspace"===e.key||"Delete"===e.key?(e.preventDefault(),z()):!e.ctrlKey&&!e.metaKey||"z"!==e.key&&"Z"!==e.key||(e.preventDefault(),M()))}})]})});Nl.displayName="TkxSignaturePad";var Dl=async(e,t)=>{const n=await fetch(`https://api.postalpincode.in/pincode/${e}`,{signal:t});if(!n.ok)throw new Error(`HTTP ${n.status}`);const r=await n.json();return Array.isArray(r)&&r[0]&&"Success"===r[0].Status&&r[0].PostOffice?r[0].PostOffice:[]},Rl=/^\d{6}$/,Pl=(0,a.forwardRef)(function({value:e,onChange:t,lookup:n=Dl,divisionsSource:r,label:o,showAddressLines:i=!0,disabled:l,className:s,style:c},u){const p=J(),h=_t(),f=(0,a.useId)(),[m,g]=(0,a.useState)([]),[x,y]=(0,a.useState)(!1),[b,v]=(0,a.useState)(null),[w,k]=(0,a.useState)([]),[$,S]=(0,a.useState)([]),[C,z]=(0,a.useState)([]),[M,N]=(0,a.useState)([]),[D,R]=(0,a.useState)(null);(0,a.useEffect)(()=>{if(!r)return;const e=new AbortController;return R(null),r.countries(e.signal).then(k).catch(e=>{"AbortError"!==e?.name&&R(e?.message||"Failed to load countries")}),()=>e.abort()},[r]),(0,a.useEffect)(()=>{if(!r||!e.countryCode)return void S([]);const t=new AbortController;return r.states(e.countryCode,t.signal).then(S).catch(e=>{"AbortError"!==e?.name&&R(e?.message||"Failed to load states")}),()=>t.abort()},[r,e.countryCode]),(0,a.useEffect)(()=>{if(!r||!e.countryCode||!e.stateCode)return void z([]);const t=new AbortController;return r.districts(e.countryCode,e.stateCode,t.signal).then(z).catch(e=>{"AbortError"!==e?.name&&R(e?.message||"Failed to load districts")}),()=>t.abort()},[r,e.countryCode,e.stateCode]),(0,a.useEffect)(()=>{if(!(r&&e.countryCode&&e.stateCode&&e.districtCode))return void N([]);const t=new AbortController;return r.subDistricts(e.countryCode,e.stateCode,e.districtCode,t.signal).then(N).catch(e=>{"AbortError"!==e?.name&&R(e?.message||"Failed to load sub-districts")}),()=>t.abort()},[r,e.countryCode,e.stateCode,e.districtCode]);const P=(0,a.useMemo)(()=>{if(!r?.subDistrictLabel||!e.countryCode||!e.stateCode)return"Sub-district";try{return r.subDistrictLabel(e.countryCode,e.stateCode)||"Sub-district"}catch{return"Sub-district"}},[r,e.countryCode,e.stateCode]);(0,a.useEffect)(()=>{if(!e.pin||!Rl.test(e.pin))return g([]),void v(null);const t=new AbortController;return y(!0),v(null),n(e.pin,t.signal).then(e=>{g(e),0===e.length&&v(h.noResults)}).catch(e=>{"AbortError"!==e?.name&&(v(e?.message||"Lookup failed"),g([]))}).finally(()=>y(!1)),()=>t.abort()},[e.pin]);const F=n=>{t({...e,pin:n.Pincode,postOffice:n.Name,city:n.District,state:n.State,country:n.Country}),g([])},A=(n,r)=>{t({...e,pin:e.pin??"",[n]:r})},I={display:"flex",flexDirection:"column",gap:8,width:"100%",...c},L={display:"flex",gap:8,flexWrap:"wrap"},T={flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:4},W={width:"100%",padding:"8px 10px",border:`1px solid ${p.border}`,borderRadius:8,background:p.surface,color:p.text,fontSize:14,outline:"none",minHeight:40},j={...W,appearance:"none",WebkitAppearance:"none",MozAppearance:"none",paddingRight:28,backgroundImage:`url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='${encodeURIComponent(p.textMuted)}' d='M0 0l5 6 5-6z'/></svg>")`,backgroundRepeat:"no-repeat",backgroundPosition:"right 10px center"},E={border:`1px solid ${p.border}`,borderRadius:8,background:p.surface,maxHeight:200,overflow:"auto",padding:4},B={padding:"8px 10px",borderRadius:6,cursor:"pointer",fontSize:13,color:p.text},V={fontSize:12,color:p.textMuted};return(0,d.jsxs)("div",{className:s,style:I,children:[o&&(0,d.jsx)("label",{htmlFor:`${f}-pin`,style:{fontSize:13,fontWeight:600},children:o}),r&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{style:L,children:[(0,d.jsxs)("div",{style:T,children:[(0,d.jsx)("label",{style:V,htmlFor:`${f}-country`,children:"Country"}),(0,d.jsxs)("select",{id:`${f}-country`,value:e.countryCode??"",onChange:n=>(n=>{const r=w.find(e=>e.code===n);t({...e,pin:e.pin??"",countryCode:n||void 0,country:r?.name,stateCode:void 0,state:void 0,districtCode:void 0,city:void 0,subDistrictCode:void 0,subDistrict:void 0})})(n.target.value),disabled:l||0===w.length,style:j,children:[(0,d.jsx)("option",{value:"",children:0===w.length?"Loading…":"Select country"}),w.map(e=>(0,d.jsx)("option",{value:e.code,children:e.name},e.code))]})]}),(0,d.jsxs)("div",{style:T,children:[(0,d.jsx)("label",{style:V,htmlFor:`${f}-state`,children:"State / UT"}),(0,d.jsxs)("select",{id:`${f}-state`,value:e.stateCode??"",onChange:n=>(n=>{const r=$.find(e=>e.code===n);t({...e,pin:e.pin??"",stateCode:n||void 0,state:r?.name,districtCode:void 0,city:void 0,subDistrictCode:void 0,subDistrict:void 0})})(n.target.value),disabled:l||!e.countryCode||0===$.length,style:j,children:[(0,d.jsx)("option",{value:"",children:e.countryCode?0===$.length?"Loading…":"Select state":"Pick country first"}),$.map(e=>(0,d.jsx)("option",{value:e.code,children:e.name},e.code))]})]})]}),(0,d.jsxs)("div",{style:L,children:[(0,d.jsxs)("div",{style:T,children:[(0,d.jsx)("label",{style:V,htmlFor:`${f}-district`,children:"District"}),(0,d.jsxs)("select",{id:`${f}-district`,value:e.districtCode??"",onChange:n=>(n=>{const r=C.find(e=>e.code===n);t({...e,pin:e.pin??"",districtCode:n||void 0,city:r?.name,subDistrictCode:void 0,subDistrict:void 0})})(n.target.value),disabled:l||!e.stateCode||0===C.length,style:j,children:[(0,d.jsx)("option",{value:"",children:e.stateCode?0===C.length?"Loading…":"Select district":"Pick state first"}),C.map(e=>(0,d.jsx)("option",{value:e.code,children:e.name},e.code))]})]}),(0,d.jsxs)("div",{style:T,children:[(0,d.jsx)("label",{style:V,htmlFor:`${f}-subdistrict`,children:P}),(0,d.jsxs)("select",{id:`${f}-subdistrict`,value:e.subDistrictCode??"",onChange:n=>(n=>{const r=M.find(e=>e.code===n);t({...e,pin:e.pin??"",subDistrictCode:n||void 0,subDistrict:r?.name})})(n.target.value),disabled:l||!e.districtCode||0===M.length,style:j,children:[(0,d.jsx)("option",{value:"",children:e.districtCode?0===M.length?"Loading…":`Select ${P.toLowerCase()}`:"Pick district first"}),M.map(e=>(0,d.jsx)("option",{value:e.code,children:e.name},e.code))]})]})]}),D&&(0,d.jsx)("div",{role:"alert",style:{fontSize:12,color:p.danger},children:D})]}),(0,d.jsxs)("div",{style:L,children:[(0,d.jsxs)("div",{style:{...T,flex:"0 0 140px"},children:[(0,d.jsx)("span",{style:V,children:"PIN code"}),(0,d.jsx)("input",{ref:u,id:`${f}-pin`,type:"text",inputMode:"numeric",maxLength:6,autoComplete:"postal-code",value:e.pin??"",onChange:n=>(n=>{const r=n.replace(/\D+/g,"").slice(0,6);t({...e,pin:r})})(n.target.value),disabled:l,"aria-busy":x,"aria-invalid":null!==b,style:W,placeholder:"000000"})]}),(0,d.jsxs)("div",{style:T,children:[(0,d.jsx)("span",{style:V,children:"City"}),(0,d.jsx)("input",{type:"text",autoComplete:"address-level2",value:e.city??"",onChange:n=>t({...e,city:n.target.value,pin:e.pin??""}),disabled:l,style:W})]}),(0,d.jsxs)("div",{style:T,children:[(0,d.jsx)("span",{style:V,children:"State"}),(0,d.jsx)("input",{type:"text",autoComplete:"address-level1",value:e.state??"",onChange:n=>t({...e,state:n.target.value,pin:e.pin??""}),disabled:l,style:W})]})]}),m.length>1&&(0,d.jsx)("div",{role:"listbox","aria-label":"Matching post offices",style:E,children:m.map(t=>(0,d.jsxs)("div",{role:"option","aria-selected":e.postOffice===t.Name,onClick:()=>F(t),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),F(t))},tabIndex:0,style:{...B,background:e.postOffice===t.Name?p.surfaceAlt:"transparent"},children:[(0,d.jsx)("strong",{children:t.Name})," ",(0,d.jsxs)("span",{style:{color:p.textMuted},children:["· ",t.District,", ",t.State]})]},`${t.Pincode}-${t.Name}`))}),b&&(0,d.jsx)("div",{role:"alert",style:{fontSize:12,color:p.danger},children:b}),i&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("input",{type:"text",autoComplete:"address-line1",placeholder:"Address line 1",value:e.line1??"",onChange:e=>A("line1",e.target.value),disabled:l,style:W}),(0,d.jsx)("input",{type:"text",autoComplete:"address-line2",placeholder:"Address line 2 (optional)",value:e.line2??"",onChange:e=>A("line2",e.target.value),disabled:l,style:W})]})]})});Pl.displayName="TkxAddressInput";var Fl=new Set(["JPY","KRW"]),Al=(0,a.forwardRef)(function({value:e,onChange:t,currency:n="INR",locale:r,label:o,min:i,max:l,precision:s,required:c,disabled:u,showSymbol:p=!0,id:h,name:f,className:m,style:g},x){const y=J(),b=(0,a.useId)(),v=h??b,w=(0,a.useRef)(null),k=(0,a.useRef)(null),$=(0,a.useCallback)(e=>{w.current=e,"function"==typeof x?x(e):x&&(x.current=e)},[x]),S=r??function(e){return"INR"===e?"en-IN":"PKR"===e?"ur-PK":"BDT"===e?"bn-BD":"JPY"===e?"ja-JP":"KRW"===e?"ko-KR":"CNY"===e?"zh-CN":"undefined"!=typeof navigator&&navigator.language?navigator.language:"en-US"}(n),C=s??(Fl.has(n)?0:2),z=(0,a.useMemo)(()=>new Intl.NumberFormat(S,{minimumFractionDigits:0,maximumFractionDigits:C,useGrouping:!0}),[S,C]),M=(0,a.useMemo)(()=>{try{return new Intl.NumberFormat(S,{style:"currency",currency:n,currencyDisplay:"narrowSymbol",minimumFractionDigits:0,maximumFractionDigits:0}).formatToParts(0).find(e=>"currency"===e.type)?.value??n}catch{return n}},[S,n]),N=null===e||Number.isNaN(e)?"":z.format(e);(0,a.useLayoutEffect)(()=>{const e=k.current;k.current=null;const t=w.current;if(null===e||!t||t!==document.activeElement)return;let n=0,r=N.length;for(let o=0;o<N.length;o++)if(/\d/.test(N[o])&&(n++,n===e)){r=o+1;break}0===e&&(r=0);try{t.setSelectionRange(r,r)}catch{}},[N]);const D=(0,a.useCallback)((e,n)=>{k.current=null!==n?(e.slice(0,n).match(/\d/g)??[]).length:null;const r=e.replace(/[^\d.,\-]/g,""),o=z.format(1.5),a=o.includes(",")&&!o.includes(".")?",":".",s=r.replace(new RegExp(`[^\\d\\-${a}]`,"g"),"").replace(a,".");if(""===s||"-"===s)return void t(null);const d=Number(s);if(Number.isNaN(d))return;let c=d;void 0!==i&&c<i&&(c=i),void 0!==l&&c>l&&(c=l),t(c)},[z,i,l,t]),R={display:"inline-flex",flexDirection:"column",gap:6,width:"100%",maxWidth:320,...g},P={display:"flex",alignItems:"stretch",border:`1px solid ${y.border}`,borderRadius:8,background:y.surface,overflow:"hidden"},F={display:"inline-flex",alignItems:"center",padding:"0 12px",borderRight:`1px solid ${y.border}`,color:y.textMuted,fontSize:14,fontVariantNumeric:"tabular-nums",background:y.bg},A={flex:1,border:"none",outline:"none",padding:"0 12px",fontSize:14,color:y.text,background:"transparent",minHeight:40,minWidth:0,textAlign:"right",fontVariantNumeric:"tabular-nums"};return(0,d.jsxs)("div",{className:m,style:R,children:[o&&(0,d.jsxs)("label",{htmlFor:v,style:{fontSize:13,fontWeight:600,color:y.text},children:[o,c&&(0,d.jsx)("span",{style:{color:y.danger,marginLeft:4},"aria-hidden":"true",children:"*"})]}),(0,d.jsxs)("div",{style:P,children:[p&&(0,d.jsx)("span",{style:F,"aria-hidden":"true",children:M}),(0,d.jsx)("input",{ref:$,id:v,name:f,type:"text",inputMode:C>0?"decimal":"numeric",value:N,onChange:e=>D(e.target.value,e.target.selectionStart),disabled:u,required:c,"aria-label":o??`Amount in ${n}`,style:A})]})]})});Al.displayName="TkxCurrencyInput";var Il=(0,a.forwardRef)(function({items:e,onChange:t,renderItem:n,orientation:r="vertical",disabled:o,className:i,style:l,ariaLabel:s},c){const u=J(),p=(0,a.useId)(),[h,f]=(0,a.useState)(null),[m,g]=(0,a.useState)(null),x=(0,a.useRef)(null),y=(0,a.useCallback)((n,r)=>{if(n===r||n<0||r<0||r>=e.length)return;const o=[...e],[i]=o.splice(n,1);o.splice(r,0,i),t(o),x.current&&(x.current.textContent=`Moved item ${n+1} to position ${r+1}`)},[e,t]),b=e=>t=>{!o&&h&&(t.preventDefault(),t.dataTransfer.dropEffect="move",g(e))},v=()=>{f(null),g(null)},w=(t,n)=>t=>{if(o)return;const i="vertical"===r,a=i?"ArrowUp"===t.key:"ArrowLeft"===t.key,l=i?"ArrowDown"===t.key:"ArrowRight"===t.key;a&&n>0?(t.preventDefault(),y(n,n-1)):l&&n<e.length-1&&(t.preventDefault(),y(n,n+1))},k={display:"flex",flexDirection:"vertical"===r?"column":"row",gap:8,...l},$=e=>({cursor:o?"not-allowed":"grab",opacity:h===e?.5:1,transition:"opacity 0.15s, transform 0.05s",outline:m===e&&h!==e?`2px dashed ${u.primary}`:"none",outlineOffset:4,borderRadius:8});return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{ref:c,id:p,role:"list","aria-label":s??"Sortable list","aria-orientation":r,className:i,style:k,children:e.map((t,r)=>{return(0,d.jsx)("div",{role:"listitem",tabIndex:o?-1:0,draggable:!o,"data-tkx-sortable-handle":"true","aria-grabbed":h===t.id,"aria-posinset":r+1,"aria-setsize":e.length,onDragStart:(a=t.id,e=>{o||(f(a),e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",a))}),onDragOver:b(t.id),onDragEnd:v,onDrop:(i=t.id,t=>{t.preventDefault(),!o&&h&&(y(e.findIndex(e=>e.id===h),e.findIndex(e=>e.id===i)),f(null),g(null))}),onKeyDown:w(t.id,r),style:$(t.id),children:n(t,r)},t.id);var i,a})}),(0,d.jsx)("div",{ref:x,role:"status","aria-live":"polite","aria-atomic":"true",style:{position:"absolute",width:1,height:1,margin:-1,padding:0,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0}})]})});Il.displayName="TkxSortable";var Ll=["#00f5d4","#7b2ff7","#f72585","#ffbe0b","#06d6a0","#3a86ff"],Tl=(0,a.forwardRef)(function({trigger:e,particleCount:t=80,spread:n=60,origin:r,colors:o=Ll,zIndex:i=9999,className:l,style:s},c){const u=(0,a.useRef)(null),p=(0,a.useRef)([]),h=(0,a.useRef)(null),f=qe(),m=(0,a.useCallback)(()=>{const e=u.current;if(!e)return;const t=window.devicePixelRatio||1;e.width=window.innerWidth*t,e.height=window.innerHeight*t,e.style.width="100vw",e.style.height="100vh";const n=e.getContext("2d");n&&n.scale(t,t)},[]);(0,a.useEffect)(()=>(m(),window.addEventListener("resize",m),()=>window.removeEventListener("resize",m)),[m]);const g=(0,a.useCallback)(()=>{const e=u.current;if(!e)return;const t=e.getContext("2d");if(!t)return;const n=window.devicePixelRatio||1;t.clearRect(0,0,e.width/n,e.height/n);const r=p.current;for(const o of r)t.save(),t.globalAlpha=o.alpha,t.translate(o.x,o.y),t.rotate(o.rot*Math.PI/180),t.fillStyle=o.color,t.fillRect(-o.size/2,-o.size/4,o.size,o.size/2),t.restore()},[]),x=(0,a.useCallback)(()=>{const e=p.current;let t=!1;for(const n of e)n.ttl<=0||(n.x+=n.vx,n.y+=n.vy,n.vy+=.18,n.vx*=.99,n.rot+=n.vRot,n.ttl-=1,n.ttl<30&&(n.alpha=n.ttl/30),t=!0);e.length>1e3&&(p.current=e.filter(e=>e.ttl>0)),g(),h.current=t?requestAnimationFrame(x):null},[g]),y=(0,a.useCallback)(e=>{if(!u.current)return;const i=e?.x??r?.x??window.innerWidth/2,a=e?.y??r?.y??window.innerHeight/3,l=[];for(let r=0;r<t;r++){const e=((Math.random()-.5)*n-90)*(Math.PI/180),t=6+6*Math.random();l.push({x:i,y:a,vx:Math.cos(e)*t,vy:Math.sin(e)*t,rot:360*Math.random(),vRot:14*(Math.random()-.5),size:6+6*Math.random(),color:o[Math.floor(Math.random()*o.length)],alpha:1,ttl:90+Math.floor(30*Math.random())})}if(p.current.push(...l),f)return g(),void window.setTimeout(()=>{p.current=[],g()},1500);null===h.current&&(h.current=requestAnimationFrame(x))},[t,n,r,o,f,x,g]);return(0,a.useImperativeHandle)(c,()=>({fire:y}),[y]),(0,a.useEffect)(()=>{e&&y()},[e]),(0,a.useEffect)(()=>()=>{null!==h.current&&cancelAnimationFrame(h.current)},[]),(0,d.jsx)("canvas",{ref:u,"aria-hidden":"true",className:l,style:{position:"fixed",inset:0,pointerEvents:"none",zIndex:i,...s}})});Tl.displayName="TkxConfetti";var Wl="data-tkx-seo";function jl(){"undefined"!=typeof document&&document.querySelectorAll(`[${Wl}]`).forEach(e=>e.remove())}function El(e,t,n="name"){if("undefined"==typeof document||!t)return;const r=document.createElement("meta");r.setAttribute(n,e),r.content=t,r.setAttribute(Wl,"1"),document.head.appendChild(r)}var Bl=["Pratipada","Dwitiya","Tritiya","Chaturthi","Panchami","Shashthi","Saptami","Ashtami","Navami","Dashami","Ekadashi","Dwadashi","Trayodashi","Chaturdashi","Purnima","Pratipada","Dwitiya","Tritiya","Chaturthi","Panchami","Shashthi","Saptami","Ashtami","Navami","Dashami","Ekadashi","Dwadashi","Trayodashi","Chaturdashi","Amavasya"],Vl=["Ashwini","Bharani","Krittika","Rohini","Mrigashira","Ardra","Punarvasu","Pushya","Ashlesha","Magha","Purva Phalguni","Uttara Phalguni","Hasta","Chitra","Swati","Vishakha","Anuradha","Jyeshtha","Mula","Purva Ashadha","Uttara Ashadha","Shravana","Dhanishtha","Shatabhisha","Purva Bhadrapada","Uttara Bhadrapada","Revati"];function Hl(e,t,n){try{return{gregorian:e,display:new Intl.DateTimeFormat(`${t}-u-ca-${n}`,{day:"numeric",month:"long",year:"numeric"}).format(e)}}catch{return{gregorian:e,display:e.toISOString().slice(0,10)}}}function Ol(e,t,n,r){switch(t){case"hindu":return function(e,t,n){const{tithi:r,nakshatra:o}=n?n(e):function(e){const t=function(e){return e.getTime()/864e5-10957.5}(e),n=function(e){return(280.46+.9856474*e)%360}(t),r=function(e){return(218.316+13.176396*e)%360}(t);let o=(r-n+360)%360;const i=Math.floor(o/12)+1,a=Math.floor(r%360/(360/27))+1;return{tithi:Math.max(1,Math.min(30,i)),nakshatra:a}}(e);return{gregorian:e,display:`${new Intl.DateTimeFormat(t,{dateStyle:"medium"}).format(e)} · ${r<=15?"Shukla":"Krishna"} ${Bl[r-1]} · ${Vl[o-1]}`,tithi:r,nakshatra:o}}(e,n,r);case"hijri":return Hl(e,n,"islamic-civil");case"hebrew":return Hl(e,n,"hebrew");case"buddhist":return Hl(e,n,"buddhist");default:return function(e,t){return{gregorian:e,display:new Intl.DateTimeFormat(t,{dateStyle:"long"}).format(e)}}(e,n)}}var ql=(0,a.forwardRef)(function({value:e,onChange:t,calendar:n="gregorian",locale:r,tithiResolver:o,label:i,minDate:l,maxDate:s,disabled:c,className:u,style:p},h){const f=J(),m=_t(),g=r??("undefined"!=typeof navigator?navigator.language:"en-US"),[x,y]=(0,a.useState)(!1),b=(0,a.useMemo)(()=>e?Ol(e,n,g,o).display:"",[e,n,g,o]),v={display:"inline-flex",flexDirection:"column",gap:6,width:"100%",maxWidth:360,...p},w={display:"flex",alignItems:"stretch",border:`1px solid ${f.border}`,borderRadius:8,background:f.surface,overflow:"hidden"},k={flex:1,border:"none",outline:"none",padding:"0 12px",fontSize:14,color:f.text,background:"transparent",minHeight:40,minWidth:0};return(0,d.jsxs)("div",{className:u,style:v,children:[i&&(0,d.jsx)("label",{style:{fontSize:13,fontWeight:600,color:f.text},children:i}),(0,d.jsxs)("div",{style:w,children:[(0,d.jsx)("input",{ref:h,type:"text",readOnly:!0,value:b,onClick:()=>!c&&y(!0),onFocus:()=>!c&&y(!0),disabled:c,placeholder:m.selectDate,"aria-label":i??m.selectDate,style:k}),(0,d.jsx)("input",{type:"date",value:e?e.toISOString().slice(0,10):"",onChange:e=>(e=>{if(!e)return;const r=new Date(`${e}T00:00:00`);Number.isNaN(r.getTime())||l&&r<l||s&&r>s||(t(Ol(r,n,g,o)),y(!1))})(e.target.value),min:l?l.toISOString().slice(0,10):void 0,max:s?s.toISOString().slice(0,10):void 0,disabled:c,"aria-hidden":"true",tabIndex:-1,style:{width:36,border:"none",borderLeft:`1px solid ${f.border}`,padding:0,background:f.bg,color:f.text,cursor:c?"not-allowed":"pointer"}})]}),x&&e&&"gregorian"!==n&&(0,d.jsxs)("div",{role:"status",style:{padding:"6px 10px",borderRadius:6,background:f.surfaceAlt,fontSize:12,color:f.textMuted},children:[(0,d.jsxs)("strong",{style:{color:f.text},children:[n,":"]})," ",b]})]})});ql.displayName="TkxCalendarLunar";var Ul=(0,a.forwardRef)(function({items:e,currency:t,locale:n,taxRate:r=0,shipping:o=0,paymentConfigFor:i,onComplete:l,onCancel:s,initialAddress:c={},className:u,style:p},h){const f=J(),m=_t(),[g,x]=(0,a.useState)("address"),[y,b]=(0,a.useState)(c),[v,w]=(0,a.useState)(null),[k,$]=(0,a.useState)(null),S=e.reduce((e,t)=>e+t.quantity*t.unitPrice,0),C=S*r,z=S+C+o,M=e=>{try{return new Intl.NumberFormat(n??"en-IN",{style:"currency",currency:t}).format(e)}catch{return`${t} ${e.toFixed(2)}`}},N=Boolean(y.pin&&6===y.pin.length&&y.line1&&y.city),D={display:"grid",gridTemplateColumns:"minmax(0, 1fr) 320px",gap:24,maxWidth:960,width:"100%",...p},R={border:`1px solid ${f.border}`,borderRadius:12,padding:20,background:f.surface},P={...R,position:"sticky",top:16,height:"fit-content"},F={fontSize:11,fontWeight:600,letterSpacing:"0.05em",textTransform:"uppercase",color:f.textMuted,marginBottom:12};return(0,d.jsxs)("div",{ref:h,className:u,style:D,children:[(0,d.jsxs)("div",{style:R,children:[(0,d.jsxs)("div",{style:F,children:["Step ","address"===g?1:"payment"===g?2:3," of 3"]}),"address"===g&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("h2",{style:{margin:"0 0 16px",fontSize:20,fontWeight:700},children:"Shipping address"}),(0,d.jsx)(Pl,{value:y,onChange:b}),k&&(0,d.jsx)("div",{role:"alert",style:{marginTop:12,fontSize:13,color:f.danger},children:k}),(0,d.jsxs)("div",{style:{marginTop:20,display:"flex",justifyContent:"flex-end",gap:8},children:[s&&(0,d.jsx)("button",{type:"button",onClick:s,style:{padding:"8px 14px",borderRadius:6,border:`1px solid ${f.border}`,background:"transparent",color:f.text,cursor:"pointer",fontSize:13,fontWeight:600},children:m.cancel}),(0,d.jsx)("button",{type:"button",onClick:async()=>{if(N){$(null);try{w(await i(y)),x("payment")}catch(e){$(e?.message??"Could not initialise payment")}}else $(m.fieldRequired??"Address incomplete")},disabled:!N,style:{padding:"8px 14px",borderRadius:6,border:"none",background:N?f.primary:f.border,color:N?f.bg:f.textMuted,cursor:N?"pointer":"not-allowed",fontSize:13,fontWeight:600,minHeight:36},children:"Continue to payment"})]})]}),"payment"===g&&v&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("h2",{style:{margin:"0 0 16px",fontSize:20,fontWeight:700},children:"Payment"}),(0,d.jsxs)("p",{style:{margin:"0 0 16px",color:f.textMuted,fontSize:14},children:["Total ",(0,d.jsx)("strong",{style:{color:f.text,fontSize:18},children:M(z)})]}),(0,d.jsxs)(Ml,{config:v,onSuccess:e=>{x("confirm"),l({address:y,payment:e})},onFailure:e=>{$(e.message)},size:"lg",children:["Pay ",M(z)]}),k&&(0,d.jsx)("div",{role:"alert",style:{marginTop:12,fontSize:13,color:f.danger},children:k}),(0,d.jsx)("div",{style:{marginTop:20},children:(0,d.jsx)("button",{type:"button",onClick:()=>x("address"),style:{padding:"6px 10px",border:"none",background:"transparent",color:f.textMuted,cursor:"pointer",fontSize:13},children:"← Back to address"})})]}),"confirm"===g&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("h2",{style:{margin:"0 0 16px",fontSize:20,fontWeight:700},children:"Order confirmed"}),(0,d.jsx)("p",{style:{color:f.textMuted,fontSize:14,lineHeight:1.6},children:"Thank you. A receipt has been emailed to you. Your order will ship shortly."})]})]}),(0,d.jsxs)("div",{style:P,children:[(0,d.jsx)("div",{style:F,children:"Order summary"}),e.map(e=>(0,d.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",padding:"6px 0",fontSize:13},children:[(0,d.jsxs)("span",{style:{color:f.text},children:[e.label," ",(0,d.jsxs)("span",{style:{color:f.textMuted},children:["×",e.quantity]})]}),(0,d.jsx)("span",{style:{color:f.text,fontVariantNumeric:"tabular-nums"},children:M(e.quantity*e.unitPrice)})]},e.id)),(0,d.jsx)("hr",{style:{margin:"12px 0",border:0,borderTop:`1px solid ${f.border}`}}),r>0&&(0,d.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",fontSize:13,color:f.textMuted},children:[(0,d.jsxs)("span",{children:["Tax (",(100*r).toFixed(0),"%)"]}),(0,d.jsx)("span",{children:M(C)})]}),o>0&&(0,d.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",fontSize:13,color:f.textMuted},children:[(0,d.jsx)("span",{children:"Shipping"}),(0,d.jsx)("span",{children:M(o)})]}),(0,d.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",marginTop:12,paddingTop:12,borderTop:`2px solid ${f.text}`,fontSize:16,fontWeight:700},children:[(0,d.jsx)("span",{children:"Total"}),(0,d.jsx)("span",{children:M(z)})]})]})]})});Ul.displayName="TkxCheckout";var Kl=[[0,1,2,3,4,5,6,7,8,9],[1,2,3,4,0,6,7,8,9,5],[2,3,4,0,1,7,8,9,5,6],[3,4,0,1,2,8,9,5,6,7],[4,0,1,2,3,9,5,6,7,8],[5,9,8,7,6,0,4,3,2,1],[6,5,9,8,7,1,0,4,3,2],[7,6,5,9,8,2,1,0,4,3],[8,7,6,5,9,3,2,1,0,4],[9,8,7,6,5,4,3,2,1,0]],Yl=[[0,1,2,3,4,5,6,7,8,9],[1,5,7,6,2,8,3,0,9,4],[5,8,0,3,7,9,6,1,4,2],[8,9,1,6,0,4,3,5,2,7],[9,4,5,3,1,2,6,8,7,0],[4,2,8,6,5,7,3,9,0,1],[2,7,9,3,8,0,6,4,1,5],[7,0,4,6,9,1,3,2,5,8]];function Zl(e){const t=e.replace(/\D+/g,"");if(12!==t.length)return!1;let n=0;const r=t.split("").reverse();for(let o=0;o<r.length;o++)n=Kl[n][Yl[o%8][parseInt(r[o],10)]];return 0===n}function Xl(e){const t=e.replace(/\D+/g,"").slice(0,12);return[t.slice(0,4),t.slice(4,8),t.slice(8,12)].filter(Boolean).join(" ")}function Gl(e){const t=e.replace(/\D+/g,"").slice(0,12);return 0===t.length?"":t.length<=8?"X".repeat(t.length).match(/.{1,4}/g).join(" "):`XXXX XXXX ${t.slice(8,12)}`}var _l=(0,a.forwardRef)(function({value:e,defaultValue:t,onChange:n,label:r,mask:o=!0,disabled:i,required:l,id:s,name:c,className:u,style:p},h){const f=J(),m=_t(),g=(0,a.useId)(),x=s??g,y=void 0!==e,[b,v]=(0,a.useState)(()=>(t??"").replace(/\D+/g,"").slice(0,12)),w=y?(e??"").replace(/\D+/g,"").slice(0,12):b,k=o?Gl(w):Xl(w),$=Zl(w),S={fontSize:13,fontWeight:600,color:f.text},C={width:"100%",padding:"0 12px",border:`1px solid ${12!==w.length||$?f.border:f.danger}`,borderRadius:8,background:f.surface,color:f.text,fontSize:14,minHeight:40,outline:"none",fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",letterSpacing:1.5};return(0,d.jsxs)("div",{className:u,style:{display:"flex",flexDirection:"column",gap:6,...p},children:[r&&(0,d.jsxs)("label",{htmlFor:x,style:S,children:[r,l&&(0,d.jsx)("span",{style:{color:f.danger,marginLeft:4},children:"*"})]}),(0,d.jsx)("input",{ref:h,id:x,name:c,type:"text",inputMode:"numeric",autoComplete:"off",maxLength:14,value:k,onChange:e=>(e=>{const t=e.replace(/\D+/g,"").slice(0,12);y||v(t),n?.({raw:Xl(t),digits:t,display:o?Gl(t):Xl(t),valid:Zl(t)})})(e.target.value),disabled:i,required:l,"aria-invalid":12===w.length&&!$,"aria-describedby":12!==w.length||$?void 0:`${x}-err`,style:C,placeholder:"XXXX XXXX XXXX"}),12===w.length&&!$&&(0,d.jsx)("div",{id:`${x}-err`,role:"alert",style:{fontSize:12,color:f.danger},children:m.invalidFormat??"Invalid Aadhaar — checksum mismatch."}),w.length>0&&w.length<12&&(0,d.jsxs)("div",{style:{fontSize:12,color:f.textMuted},children:[12-w.length," digit",12-w.length==1?"":"s"," remaining"]})]})});_l.displayName="TkxAadhaarInput";var Jl=/^[A-Z]{5}[0-9]{4}[A-Z]$/;function Ql(e){const t=e.toUpperCase().trim();return!!Jl.test(t)&&"PFCHATBLJG".includes(t[3])}var es=(0,a.forwardRef)(function({value:e,defaultValue:t,onChange:n,label:r,disabled:o,required:i,id:l,name:s,className:c,style:u},p){const h=J(),f=_t(),m=(0,a.useId)(),g=l??m,x=void 0!==e,[y,b]=(0,a.useState)((t??"").toUpperCase().slice(0,10)),v=(x?e??"":y).toUpperCase().slice(0,10),w=Ql(v);return(0,d.jsxs)("div",{className:c,style:{display:"flex",flexDirection:"column",gap:6,...u},children:[r&&(0,d.jsxs)("label",{htmlFor:g,style:{fontSize:13,fontWeight:600,color:h.text},children:[r,i&&(0,d.jsx)("span",{style:{color:h.danger,marginLeft:4},children:"*"})]}),(0,d.jsx)("input",{ref:p,id:g,name:s,type:"text",inputMode:"text",autoComplete:"off",maxLength:10,value:v,onChange:e=>(e=>{const t=e.toUpperCase().replace(/[^A-Z0-9]/g,"").slice(0,10);x||b(t),n?.({raw:e,normalised:t,valid:Ql(t)})})(e.target.value),disabled:o,required:i,"aria-invalid":10===v.length&&!w,style:{width:"100%",padding:"0 12px",minHeight:40,border:`1px solid ${10!==v.length||w?h.border:h.danger}`,borderRadius:8,background:h.surface,color:h.text,fontSize:14,fontFamily:"ui-monospace, monospace",letterSpacing:2,outline:"none",textTransform:"uppercase"},placeholder:"ABCDE1234F"}),10===v.length&&!w&&(0,d.jsx)("div",{role:"alert",style:{fontSize:12,color:h.danger},children:f.invalidFormat??"Invalid PAN format."})]})});es.displayName="TkxPanInput";var ts=/^[A-Z]{3}[0-9]{7}$/;function ns(e){const t=e.toUpperCase().trim();return ts.test(t)}var rs=(0,a.forwardRef)(function({value:e,defaultValue:t,onChange:n,label:r,disabled:o,required:i,id:l,name:s,className:c,style:u},p){const h=J(),f=_t(),m=(0,a.useId)(),g=l??m,x=void 0!==e,[y,b]=(0,a.useState)((t??"").toUpperCase().slice(0,10)),v=(x?e??"":y).toUpperCase().slice(0,10),w=ns(v);return(0,d.jsxs)("div",{className:c,style:{display:"flex",flexDirection:"column",gap:6,...u},children:[r&&(0,d.jsxs)("label",{htmlFor:g,style:{fontSize:13,fontWeight:600,color:h.text},children:[r,i&&(0,d.jsx)("span",{style:{color:h.danger,marginLeft:4},children:"*"})]}),(0,d.jsx)("input",{ref:p,id:g,name:s,type:"text",autoComplete:"off",maxLength:10,value:v,onChange:e=>(e=>{const t=e.toUpperCase().replace(/[^A-Z0-9]/g,"").slice(0,10);x||b(t),n?.({raw:e,normalised:t,valid:ns(t)})})(e.target.value),disabled:o,required:i,"aria-invalid":10===v.length&&!w,style:{width:"100%",padding:"0 12px",minHeight:40,border:`1px solid ${10!==v.length||w?h.border:h.danger}`,borderRadius:8,background:h.surface,color:h.text,fontSize:14,fontFamily:"ui-monospace, monospace",letterSpacing:1.5,outline:"none",textTransform:"uppercase"},placeholder:"ABC1234567"}),10===v.length&&!w&&(0,d.jsx)("div",{role:"alert",style:{fontSize:12,color:h.danger},children:f.invalidFormat??"Invalid Voter ID format."})]})});rs.displayName="TkxVoterIdInput";var os=15;function is(e){const t=e.toUpperCase().replace(/[\s-]/g,"");return t.length===os&&/^[A-Z]{2}[0-9]{13}$/.test(t)}function as(e){const t=e.toUpperCase().replace(/[\s-]/g,"");return 0===t.length?"":[t.slice(0,2),t.slice(2,4),t.slice(4,8),t.slice(8)].filter(Boolean).join("-")}var ls=(0,a.forwardRef)(function({value:e,defaultValue:t,onChange:n,label:r,disabled:o,required:i,id:l,name:s,className:c,style:u},p){const h=J(),f=_t(),m=(0,a.useId)(),g=l??m,x=void 0!==e,[y,b]=(0,a.useState)((t??"").toUpperCase()),v=x?e??"":y,w=v.toUpperCase().replace(/[\s-]/g,"").slice(0,os),k=is(w);return(0,d.jsxs)("div",{className:c,style:{display:"flex",flexDirection:"column",gap:6,...u},children:[r&&(0,d.jsxs)("label",{htmlFor:g,style:{fontSize:13,fontWeight:600,color:h.text},children:[r,i&&(0,d.jsx)("span",{style:{color:h.danger,marginLeft:4},children:"*"})]}),(0,d.jsx)("input",{ref:p,id:g,name:s,type:"text",autoComplete:"off",maxLength:20,value:v,onChange:e=>(e=>{const t=e.toUpperCase();x||b(t);const r=t.replace(/[\s-]/g,"").slice(0,os);n?.({raw:e,normalised:r,pretty:as(r),valid:is(r)})})(e.target.value),disabled:o,required:i,"aria-invalid":w.length===os&&!k,style:{width:"100%",padding:"0 12px",minHeight:40,border:`1px solid ${w.length!==os||k?h.border:h.danger}`,borderRadius:8,background:h.surface,color:h.text,fontSize:14,fontFamily:"ui-monospace, monospace",letterSpacing:1.2,outline:"none",textTransform:"uppercase"},placeholder:"MH-12-2010-0012345"}),w.length===os&&!k&&(0,d.jsx)("div",{role:"alert",style:{fontSize:12,color:h.danger},children:f.invalidFormat??"Invalid Driving Licence format."})]})});function ss(e,t,n){try{return new Intl.NumberFormat(n??"en-US",{style:"currency",currency:t,maximumFractionDigits:e%1==0?0:2}).format(e)}catch{return`${t} ${e.toFixed(2)}`}}ls.displayName="TkxDrivingLicenceInput";var ds=(0,a.forwardRef)(function({plans:e,cycle:t,selectedId:n,onSelect:r,className:o,style:i},a){const l=J();return(0,d.jsx)("div",{ref:a,className:o,style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(240px, 1fr))",gap:16,...i},role:"radiogroup","aria-label":"Plans",children:e.map(e=>{const o=e.id===n;return(0,d.jsxs)("button",{type:"button",role:"radio","aria-checked":o,disabled:e.disabled,onClick:()=>!e.disabled&&r?.(e),style:{position:"relative",padding:20,borderRadius:12,border:`${e.highlighted?2:1}px solid ${o||e.highlighted?l.primary:l.border}`,background:l.surface,color:l.text,textAlign:"left",cursor:e.disabled?"not-allowed":"pointer",opacity:e.disabled?.5:1,transition:"border-color 0.15s, transform 0.05s",fontFamily:"inherit",fontSize:"inherit",width:"100%"},children:[e.highlighted&&(0,d.jsx)("span",{style:{position:"absolute",top:-10,right:16,background:l.primary,color:l.bg,fontSize:11,fontWeight:700,padding:"2px 8px",borderRadius:4,letterSpacing:.4,textTransform:"uppercase"},"aria-hidden":"true",children:"Most popular"}),(0,d.jsx)("div",{style:{fontSize:12,fontWeight:700,color:l.textMuted,textTransform:"uppercase",letterSpacing:.5},children:e.name}),e.tagline&&(0,d.jsx)("div",{style:{fontSize:12,color:l.textMuted,marginTop:2},children:e.tagline}),(0,d.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:4,marginTop:12},children:[(0,d.jsx)("span",{style:{fontSize:32,fontWeight:800,color:l.text},children:ss(e.prices[t],e.currency,e.locale)}),(0,d.jsxs)("span",{style:{fontSize:12,color:l.textMuted},children:["/ ","monthly"===t?"mo":"yr"]})]}),(0,d.jsx)("ul",{style:{listStyle:"none",padding:0,margin:"16px 0 0",fontSize:13,lineHeight:1.7},children:e.features.map(e=>(0,d.jsxs)("li",{style:{display:"flex",gap:6,alignItems:"flex-start",color:l.text},children:[(0,d.jsx)("span",{"aria-hidden":"true",style:{color:l.success},children:"✓"}),(0,d.jsx)("span",{children:e})]},e))}),(0,d.jsx)("div",{style:{marginTop:16,padding:"8px 12px",borderRadius:6,background:o?l.primary:"transparent",color:o?l.bg:l.primary,border:`1px solid ${l.primary}`,textAlign:"center",fontWeight:600,fontSize:13},children:e.ctaLabel??(o?"Selected":`Choose ${e.name}`)})]},e.id)})})});function cs(e,t,n,r,o){if("vertical"===o){const o=e.x+n/2,i=e.y+r,a=t.x+n/2,l=t.y,s=(i+l)/2;return`M${o},${i} C${o},${s} ${a},${s} ${a},${l}`}const i=e.x+n,a=e.y+r/2,l=t.x,s=t.y+r/2,d=(i+l)/2;return`M${i},${a} C${d},${a} ${d},${s} ${l},${s}`}function us({node:e,w:t,h:n,isActive:r,theme:o}){const i=e.accent??o.primary,a=function(e){if(!e)return;const t=e.trim();return!t||/^javascript:/i.test(t)||/^vbscript:/i.test(t)||/^data:/i.test(t)&&!/^data:image\//i.test(t)?void 0:t}(e.avatar),l=pe(e.label),s=e.subLabel?pe(e.subLabel):"",c=e.badge?pe(e.badge):"";return(0,d.jsxs)("div",{style:{width:t,height:n,boxSizing:"border-box",background:o.surface,border:`1.5px solid ${r?i:o.border}`,borderRadius:12,padding:"10px 12px",display:"flex",alignItems:"center",gap:10,boxShadow:r?`0 8px 24px -8px ${i}66`:`0 2px 8px -4px ${o.border}88`,transition:"border-color 0.15s ease, box-shadow 0.15s ease",overflow:"hidden"},children:[(0,d.jsx)("div",{style:{width:40,height:40,minWidth:40,borderRadius:"50%",overflow:"hidden",background:`${i}22`,color:i,display:"flex",alignItems:"center",justifyContent:"center",fontSize:14,fontWeight:700,border:`1.5px solid ${i}44`},"aria-hidden":"true",children:a?(0,d.jsx)("img",{src:a,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",style:{width:"100%",height:"100%",objectFit:"cover"}}):l.slice(0,2).toUpperCase()}),(0,d.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,d.jsx)("div",{style:{fontSize:13.5,fontWeight:700,color:o.text,lineHeight:1.25,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:l}),s&&(0,d.jsx)("div",{style:{fontSize:11.5,color:o.textMuted,lineHeight:1.3,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",marginTop:1},children:s})]}),c&&(0,d.jsx)("span",{style:{fontSize:10,fontWeight:700,padding:"3px 7px",borderRadius:999,color:i,background:`${i}18`,border:`1px solid ${i}33`,letterSpacing:"0.04em",textTransform:"uppercase",flexShrink:0},children:c})]})}function ps({collapsed:e,onClick:t,theme:n,direction:r,w:o,h:i}){const a={position:"absolute",..."vertical"===r?{left:o/2-10,top:i-10}:{left:o-10,top:i/2-10},width:20,height:20,borderRadius:"50%",background:n.surfaceAlt,border:`1.5px solid ${n.border}`,color:n.text,fontSize:12,fontWeight:700,cursor:"pointer",padding:0,lineHeight:1,zIndex:2,display:"flex",alignItems:"center",justifyContent:"center"};return(0,d.jsx)("button",{type:"button","aria-label":e?"Expand subtree":"Collapse subtree","aria-expanded":!e,onClick:e=>{e.stopPropagation(),t(e)},onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.stopPropagation(),t(e))},style:a,children:e?"+":"−"})}function hs({data:e,direction:t="vertical",interactive:n=!0,initialZoom:r=1,nodeWidth:o=200,nodeHeight:i=84,siblingGap:l=28,levelGap:s=64,onNodeClick:c,renderNode:u,collapsedByDefault:p=!1,height:h=560,ariaLabel:f="Organization chart",className:m,style:g}){const x=J(),y=(0,a.useRef)(null),b=(0,a.useRef)(null),[v,w]=(0,a.useState)(()=>{if(!p)return new Set;const t=new Set;return function n(r){r.id!==e.id&&t.add(r.id),(r.children??[]).forEach(n)}(e),t}),[k,$]=(0,a.useState)(fs(r)),[S,C]=(0,a.useState)({x:0,y:0}),[z,M]=(0,a.useState)(e.id),N=(0,a.useMemo)(()=>function(e,t,n){const{nodeWidth:r,nodeHeight:o,siblingGap:i,levelGap:a,direction:l}=n,s=[],d=function e(n,r,o){const i=t.has(n.id),a={id:n.id,node:n,x:0,y:0,depth:r,parent:o,children:[],collapsed:i};if(!i)for(const t of n.children??[])a.children.push(e(t,r+1,a));return s.push(a),a}(e,0,null);let c=0;!function e(t){if(0===t.children.length)return t.x=c,void(c+=r+i);t.children.forEach(e),t.x=(t.children[0].x+t.children[t.children.length-1].x)/2}(d);for(const m of s)m.y=m.depth*(o+a);if("horizontal"===l)for(const m of s){const e=m.x;m.x=m.y,m.y=e}let u=1/0,p=1/0,h=-1/0,f=-1/0;for(const m of s)m.x<u&&(u=m.x),m.y<p&&(p=m.y),m.x>h&&(h=m.x),m.y>f&&(f=m.y);Number.isFinite(u)||(u=0,p=0,h=0,f=0);for(const m of s)m.x-=u,m.y-=p;return{nodes:s,width:h-u+r,height:f-p+o}}(e,v,{nodeWidth:o,nodeHeight:i,siblingGap:l,levelGap:s,direction:t}),[e,v,o,i,l,s,t]),D=(0,a.useCallback)(e=>{w(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]);(0,a.useEffect)(()=>{if(!n)return;const e=y.current;if(!e)return;const t=e=>{if(!e.ctrlKey&&!e.metaKey){if(Math.abs(e.deltaY)<4&&Math.abs(e.deltaX)<4)return;return C(t=>({x:t.x-e.deltaX,y:t.y-e.deltaY})),void e.preventDefault()}e.preventDefault();const t=e.deltaY<0?.1:-.1;$(e=>fs(e+t))};return e.addEventListener("wheel",t,{passive:!1}),()=>e.removeEventListener("wheel",t)},[n]),(0,a.useEffect)(()=>{if(!n)return;const e=y.current;if(!e)return;let t=!1,r=0,o=0,i=0,a=0;const l=n=>{n.target.closest('button, [role="treeitem"], a, input')||(t=!0,r=n.clientX,o=n.clientY,i=S.x,a=S.y,e.setPointerCapture(n.pointerId))},s=e=>{t&&C({x:i+(e.clientX-r),y:a+(e.clientY-o)})},d=n=>{t=!1;try{e.releasePointerCapture(n.pointerId)}catch{}};return e.addEventListener("pointerdown",l),e.addEventListener("pointermove",s),e.addEventListener("pointerup",d),e.addEventListener("pointercancel",d),()=>{e.removeEventListener("pointerdown",l),e.removeEventListener("pointermove",s),e.removeEventListener("pointerup",d),e.removeEventListener("pointercancel",d)}},[n,S]);const R=(0,a.useCallback)(e=>{const t=N.nodes.find(e=>e.id===z);if(t)if("ArrowRight"===e.key||"ArrowDown"===e.key){const n=t.children[0];n&&(M(n.id),e.preventDefault())}else"ArrowLeft"===e.key||"ArrowUp"===e.key?t.parent&&(M(t.parent.id),e.preventDefault()):"Enter"===e.key||" "===e.key?(c?.(t.node),e.preventDefault()):"+"===e.key||"="===e.key?$(e=>fs(e+.1)):"-"===e.key?$(e=>fs(e-.1)):"0"===e.key&&($(1),C({x:0,y:0}))},[z,N,c]),P=(0,a.useMemo)(()=>{const e=[];for(const n of N.nodes)for(const r of n.children)e.push({id:`${n.id}→${r.id}`,d:cs(n,r,o,i,t)});return e},[N,o,i,t]),F={position:"relative",width:"100%",height:h,overflow:"hidden",borderRadius:12,background:x.bg,border:`1px solid ${x.border}`,touchAction:"none",cursor:n?"grab":"default",boxSizing:"border-box",...g},A={position:"absolute",left:"50%",top:24,width:N.width,height:N.height,transform:`translate(calc(-50% + ${S.x}px), ${S.y}px) scale(${k})`,transformOrigin:"top center",transition:"transform 0.08s ease-out"};return(0,d.jsxs)("div",{ref:y,className:m,style:F,role:"tree","aria-label":pe(f),tabIndex:0,onKeyDown:R,children:[n&&(0,d.jsxs)("div",{style:{position:"absolute",top:12,right:12,zIndex:3,display:"flex",gap:6,background:x.surface,border:`1px solid ${x.border}`,borderRadius:8,padding:4,boxShadow:`0 4px 12px -6px ${x.border}88`},children:[(0,d.jsx)(ms,{theme:x,label:"Zoom out",onClick:()=>$(e=>fs(e-.1)),children:"−"}),(0,d.jsx)(ms,{theme:x,label:"Reset zoom",onClick:()=>{$(1),C({x:0,y:0})},children:"⟳"}),(0,d.jsx)(ms,{theme:x,label:"Zoom in",onClick:()=>$(e=>fs(e+.1)),children:"+"})]}),(0,d.jsxs)("div",{ref:b,style:A,children:[(0,d.jsx)("svg",{width:N.width,height:N.height,style:{position:"absolute",left:0,top:0,pointerEvents:"none"},"aria-hidden":"true",children:P.map(e=>(0,d.jsx)("path",{d:e.d,fill:"none",stroke:x.border,strokeWidth:1.5},e.id))}),N.nodes.map(e=>{const n=(e.node.children?.length??0)>0,r=e.id===z;return(0,d.jsxs)("div",{role:"treeitem","aria-label":pe(e.node.label),"aria-selected":r,"aria-level":e.depth+1,"aria-expanded":n?!e.collapsed:void 0,tabIndex:-1,onClick:t=>{t.stopPropagation(),M(e.id),c?.(e.node)},style:{position:"absolute",left:e.x,top:e.y,width:o,height:i,cursor:c?"pointer":"default"},children:[u?u(e.node,r):(0,d.jsx)(us,{node:e.node,w:o,h:i,isActive:r,theme:x}),n&&(0,d.jsx)(ps,{collapsed:e.collapsed,onClick:()=>D(e.id),theme:x,direction:t,w:o,h:i})]},e.id)})]})]})}function fs(e){return e<.25?.25:e>4?4:e}function ms({children:e,onClick:t,label:n,theme:r}){return(0,d.jsx)("button",{type:"button","aria-label":n,onClick:t,style:{width:28,height:28,borderRadius:6,background:"transparent",border:"none",color:r.text,fontSize:14,fontWeight:700,cursor:"pointer",padding:0,display:"flex",alignItems:"center",justifyContent:"center"},onMouseEnter:e=>{e.currentTarget.style.background=r.surfaceAlt},onMouseLeave:e=>{e.currentTarget.style.background="transparent"},children:e})}function gs(e,t,n,r){const o=e.getBoundingClientRect(),i=t?t.offsetHeight:320,a=t?t.offsetWidth:200,l=window.innerWidth,s=window.innerHeight,d=window.scrollX,c=window.scrollY;let u=0,p=0;switch(n){case"bottom-start":default:u=o.bottom+c+r,p=o.left+d;break;case"bottom-end":u=o.bottom+c+r,p=o.right+d-a;break;case"top-start":u=o.top+c-r-i,p=o.left+d;break;case"top-end":u=o.top+c-r-i,p=o.right+d-a;break;case"right":u=o.top+c,p=o.right+d+r;break;case"left":u=o.top+c,p=o.left+d-r-a}return n.startsWith("bottom")&&o.bottom+i>s&&(u=o.top+c-r-i),n.startsWith("top")&&o.top-i<0&&(u=o.bottom+c+r),p+a>l+d&&(p=l+d-a-8),p<d&&(p=d+8),{top:u,left:p,minWidth:o.width}}function xs(e,t){if(!t)return e;const n=e.toLowerCase().indexOf(t.toLowerCase());return-1===n?e:(0,d.jsxs)(d.Fragment,{children:[e.slice(0,n),(0,d.jsx)("mark",{style:{background:"rgba(0,245,212,0.3)",color:"inherit",borderRadius:2},children:e.slice(n,n+t.length)}),e.slice(n+t.length)]})}function ys({groups:e,position:t,maxHeight:n,minWidth:r,selectedKeys:o,multiSelect:i,searchable:l,searchPlaceholder:s,onSelect:c,onClose:u,renderItem:p,menuRef:h,isPortal:f,menuId:m}){const g=J(),x=_t(),y=s??`${x.search}…`,[b,v]=(0,a.useState)(""),[w,k]=(0,a.useState)(0),[$,S]=(0,a.useState)(null),[C,z]=(0,a.useState)(0),M=(0,a.useRef)(null),N=(0,a.useRef)([]),D=(0,a.useRef)([]),R=b?e.map(e=>({...e,items:e.items.filter(e=>e.label.toLowerCase().includes(b.toLowerCase())||e.description?.toLowerCase().includes(b.toLowerCase())||e.children?.some(e=>e.label.toLowerCase().includes(b.toLowerCase())))})).filter(e=>e.items.length>0):e,P=function(e,t){const n=[];for(const r of e)for(const e of r.items)e.disabled||t&&!e.label.toLowerCase().includes(t.toLowerCase())||n.push(e);return n}(R,b);(0,a.useEffect)(()=>{l&&M.current?M.current.focus():N.current[0]?.focus(),k(0)},[l]),(0,a.useEffect)(()=>{l&&""===b||N.current[w]?.focus()},[w,l,b]);const F=(0,a.useCallback)(e=>{switch(e.key){case"ArrowDown":if(e.preventDefault(),$){const e=(P.find(e=>e.key===$)?.children??[]).filter(e=>!e.disabled);z(t=>Math.min(t+1,e.length-1))}else k(e=>Math.min(e+1,P.length-1));break;case"ArrowUp":e.preventDefault(),$?z(e=>Math.max(e-1,0)):k(e=>Math.max(e-1,0));break;case"ArrowRight":{e.preventDefault();const t=P[w];t?.children?.length&&(S(t.key),z(0));break}case"ArrowLeft":e.preventDefault(),S(null);break;case"Enter":case" ":if(e.preventDefault(),$){const e=(P.find(e=>e.key===$)?.children??[]).filter(e=>!e.disabled)[C];e&&c(e.key,e)}else{const e=P[w];e&&c(e.key,e)}break;case"Escape":e.preventDefault(),$?S(null):u();break;case"Tab":u()}},[P,w,u,c,$,C]);(0,a.useEffect)(()=>{$&&D.current[C]?.focus()},[C,$]);const A={position:f?"fixed":"absolute",top:f?t.top:void 0,left:f?t.left:void 0,minWidth:Math.max(r,t.minWidth),maxHeight:n,overflowY:"auto",background:g.surface,border:`1px solid ${g.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 I=0;return(0,d.jsxs)("div",{ref:h,id:m,role:"menu","aria-label":"Dropdown menu",tabIndex:-1,style:A,onKeyDown:F,children:[(0,d.jsx)("style",{children:"\n @keyframes tkx-dropdown-in {\n from { opacity: 0; transform: scale(0.95); }\n to { opacity: 1; transform: scale(1); }\n }\n "}),l&&(0,d.jsx)("div",{style:{padding:"8px 8px 4px"},children:(0,d.jsx)("input",{ref:M,type:"text",value:b,onChange:e=>{v(e.target.value),k(0)},placeholder:y,"aria-label":`${x.search} items`,style:{width:"100%",boxSizing:"border-box",padding:"6px 10px",background:g.surfaceAlt,border:`1px solid ${g.border}`,borderRadius:6,color:g.text,fontSize:13,outline:"none"}})}),0===R.length&&(0,d.jsx)("div",{style:{padding:"12px 16px",color:g.textMuted,fontSize:13,textAlign:"center"},children:"No results found"}),R.map((e,t)=>(0,d.jsxs)("div",{role:"group","aria-label":e.label,children:[e.label&&(0,d.jsx)("div",{style:{padding:"8px 12px 4px",fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:g.textMuted},children:pe(e.label)}),e.items.map(e=>{const t=I;e.disabled||I++;const n=o.includes(e.key),r=t===w&&!e.disabled,a=!!e.children?.length,l=$===e.key,s=p?p(e,n):(0,d.jsx)(bs,{item:e,isSelected:n,isFocused:r,multiSelect:i,query:b,theme:g,hasSubmenu:a});return(0,d.jsxs)("div",{children:[e.divider&&(0,d.jsx)("div",{role:"separator",style:{height:1,background:g.border,margin:"4px 0"}}),(0,d.jsxs)("div",{ref:e=>{N.current[t]=e},role:"menuitem","aria-disabled":e.disabled,"aria-checked":i?n:void 0,"aria-selected":i?void 0:n,"aria-haspopup":a?"menu":void 0,"aria-expanded":a?l:void 0,tabIndex:e.disabled?-1:0,style:{position:"relative",cursor:e.disabled?"not-allowed":"pointer",opacity:e.disabled?.5:1},onClick:()=>{e.disabled||(a?(S(l?null:e.key),z(0)):c(e.key,e))},onMouseEnter:()=>{e.disabled||(k(t),a?(S(e.key),z(0)):S(null))},onFocus:()=>{e.disabled||k(t)},children:[s,a&&l&&(0,d.jsx)("div",{role:"menu",style:{position:"absolute",top:0,left:"100%",minWidth:180,background:g.surface,border:`1px solid ${g.border}`,borderRadius:8,boxShadow:"0 8px 32px rgba(0,0,0,0.4)",zIndex:1e4,animation:"tkx-dropdown-in 120ms ease forwards"},children:e.children.map((e,t)=>{const n=o.includes(e.key),r=t===C;return(0,d.jsx)("div",{ref:e=>{D.current[t]=e},role:"menuitem","aria-disabled":e.disabled,"aria-selected":n,tabIndex:e.disabled?-1:0,style:{cursor:e.disabled?"not-allowed":"pointer",opacity:e.disabled?.5:1},onClick:t=>{t.stopPropagation(),e.disabled||c(e.key,e)},onMouseEnter:()=>z(t),children:(0,d.jsx)(bs,{item:e,isSelected:n,isFocused:r,multiSelect:i,query:b,theme:g,hasSubmenu:!1})},e.key)})})]})]},e.key)})]},t))]})}function bs({item:e,isSelected:t,isFocused:n,multiSelect:r,query:o,theme:i,hasSubmenu:a}){return(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px",background:n?e.danger?`${i.danger}20`:`${i.primary}18`:"transparent",transition:"background 80ms",color:e.danger?i.danger:i.text,fontSize:14,userSelect:"none"},children:[r&&(0,d.jsx)("div",{style:{width:16,height:16,border:`2px solid ${t?i.primary:i.border}`,borderRadius:4,background:t?i.primary:"transparent",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:"all 120ms"},children:t&&(0,d.jsx)("svg",{width:"10",height:"8",viewBox:"0 0 10 8",fill:"none",children:(0,d.jsx)("path",{d:"M1 4l3 3L9 1",stroke:i.bg,strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})}),e.icon&&(0,d.jsx)("span",{style:{display:"flex",alignItems:"center",flexShrink:0,color:e.danger?i.danger:i.textMuted},children:e.icon}),(0,d.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,d.jsx)("div",{style:{fontWeight:t&&!r?600:400},children:xs(e.label,o)}),e.description&&(0,d.jsx)("div",{style:{fontSize:12,color:i.textMuted,marginTop:1},children:xs(e.description,o)})]}),void 0!==e.badge&&(0,d.jsx)("span",{style:{background:i.primary,color:i.bg,fontSize:11,fontWeight:700,borderRadius:10,padding:"1px 7px",flexShrink:0},children:e.badge}),e.shortcut&&!a&&(0,d.jsx)("span",{style:{fontSize:12,color:i.textMuted,flexShrink:0},children:e.shortcut}),a&&(0,d.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",style:{flexShrink:0},children:(0,d.jsx)("path",{d:"M4 2l4 4-4 4",stroke:i.textMuted,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),!r&&t&&(0,d.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",style:{flexShrink:0},children:(0,d.jsx)("path",{d:"M2 7l4 4L12 3",stroke:i.primary,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})}hs.displayName="TkxOrgChart";var vs=!1,ws="tkx-holographic-styles";function ks(){$s()}function $s(){if(vs||"undefined"==typeof document)return;if(document.getElementById(ws))return void(vs=!0);vs=!0;const e=document.createElement("style");e.id=ws,e.textContent="\n@keyframes tkx-holo-shimmer {\n 0% { background-position: 0% 50%; }\n 50% { background-position: 100% 50%; }\n 100% { background-position: 0% 50%; }\n}\n@keyframes tkx-holo-snapback {\n to { --tkx-holo-rx: 0deg; --tkx-holo-ry: 0deg; --tkx-holo-mx: 50%; --tkx-holo-my: 50%; }\n}\n.tkx-holo-root {\n --tkx-holo-rx: 0deg;\n --tkx-holo-ry: 0deg;\n --tkx-holo-mx: 50%;\n --tkx-holo-my: 50%;\n position: relative;\n transform-style: preserve-3d;\n transform: perspective(1000px) rotateX(var(--tkx-holo-rx)) rotateY(var(--tkx-holo-ry));\n transition: transform 280ms cubic-bezier(.2,.8,.2,1);\n will-change: transform;\n isolation: isolate;\n}\n.tkx-holo-root.tkx-holo-tracking {\n transition: none;\n}\n.tkx-holo-foil {\n position: absolute;\n inset: 0;\n border-radius: inherit;\n pointer-events: none;\n background:\n radial-gradient(circle at var(--tkx-holo-mx) var(--tkx-holo-my),\n rgba(255,255,255,0.32) 0%,\n rgba(255,255,255,0.08) 22%,\n transparent 55%),\n conic-gradient(from calc(var(--tkx-holo-mx) * 3.6deg) at 50% 50%,\n #ff006e, #ffbe0b, #06d6a0, #00f5d4, #3a86ff, #7b2ff7, #ff006e);\n background-size: 100% 100%, 280% 280%;\n background-position: 0 0, var(--tkx-holo-mx) var(--tkx-holo-my);\n mix-blend-mode: color-dodge;\n opacity: 0.55;\n filter: saturate(1.4) contrast(1.1);\n}\n.tkx-holo-foil.tkx-holo-foil-soft {\n mix-blend-mode: overlay;\n opacity: 0.35;\n}\n.tkx-holo-scan {\n position: absolute;\n inset: 0;\n border-radius: inherit;\n pointer-events: none;\n background: repeating-linear-gradient(\n 180deg,\n rgba(255,255,255,0.06) 0px,\n rgba(255,255,255,0.06) 1px,\n transparent 1px,\n transparent 3px\n );\n mix-blend-mode: overlay;\n opacity: 0.5;\n}\n.tkx-holo-content {\n position: relative;\n z-index: 1;\n transform: translateZ(20px);\n}\n.tkx-holo-root:focus-visible {\n outline: 2px solid currentColor;\n outline-offset: 4px;\n}\n@media (prefers-reduced-motion: reduce) {\n .tkx-holo-root, .tkx-holo-root.tkx-holo-tracking {\n transform: none !important;\n transition: none;\n }\n .tkx-holo-content { transform: none !important; }\n .tkx-holo-foil { animation: tkx-holo-shimmer 8s ease infinite; }\n}",document.head.appendChild(e)}function Ss(e={}){const{maxTilt:t=14,disabled:n=!1}=e,r=(0,a.useRef)(null),o=qe(),i=(0,a.useRef)(null),l=(0,a.useRef)({rx:0,ry:0,mx:50,my:50});return(0,a.useEffect)(()=>{$s()},[]),(0,a.useEffect)(()=>{const e=r.current;if(e&&!n&&!o)return e.addEventListener("pointermove",d),e.addEventListener("pointerleave",c),()=>{e.removeEventListener("pointermove",d),e.removeEventListener("pointerleave",c),null!=i.current&&cancelAnimationFrame(i.current)};function a(){if(!e)return;const{rx:t,ry:n,mx:r,my:o}=l.current;e.style.setProperty("--tkx-holo-rx",`${t}deg`),e.style.setProperty("--tkx-holo-ry",`${n}deg`),e.style.setProperty("--tkx-holo-mx",`${r}%`),e.style.setProperty("--tkx-holo-my",`${o}%`),i.current=null}function s(){null==i.current&&(i.current=requestAnimationFrame(a))}function d(n){const r=e.getBoundingClientRect(),o=(n.clientX-r.left)/r.width,i=(n.clientY-r.top)/r.height,a=Math.max(0,Math.min(1,o)),d=Math.max(0,Math.min(1,i));l.current={rx:(.5-d)*t*2,ry:(a-.5)*t*2,mx:100*a,my:100*d},e.classList.add("tkx-holo-tracking"),s()}function c(){l.current={rx:0,ry:0,mx:50,my:50},e.classList.remove("tkx-holo-tracking"),s()}},[t,n,o]),r}var Cs=(0,a.forwardRef)(function({children:e,maxTilt:t=14,scanLines:n=!0,foilIntensity:r="strong",radius:o=16,disabled:i=!1,className:l,style:s,...c},u){const p=J(),h=Ss({maxTilt:t,disabled:i});(0,a.useEffect)(()=>{if(!u)return;const e=h.current;"function"==typeof u?u(e):u.current=e},[u,h]);const f={borderRadius:"number"==typeof o?`${o}px`:o,background:`linear-gradient(135deg, ${p.surface}cc, ${p.surfaceAlt}cc)`,border:`1px solid ${p.border}`,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",color:p.text,...s};return(0,d.jsxs)("div",{ref:h,className:["tkx-holo-root",l].filter(Boolean).join(" "),style:f,...c,children:["none"!==r&&(0,d.jsx)("div",{className:"tkx-holo-foil "+("soft"===r?"tkx-holo-foil-soft":""),"aria-hidden":"true"}),n&&(0,d.jsx)("div",{className:"tkx-holo-scan","aria-hidden":"true"}),(0,d.jsx)("div",{className:"tkx-holo-content",children:e})]})}),zs=(0,a.forwardRef)(function({title:e,subtitle:t,badge:n,children:r,padding:o=24,...i},l){const s=J(),c=(0,a.useId)(),u="number"==typeof o?`${o}px`:o;return(0,d.jsx)(Cs,{ref:l,role:"article","aria-labelledby":e?c:void 0,...i,style:{minHeight:200,...i.style},children:(0,d.jsxs)("div",{style:{padding:u},children:[(e||n)&&(0,d.jsxs)("header",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:12,marginBottom:t?4:12},children:[e&&(0,d.jsx)("h3",{id:c,style:{margin:0,fontSize:20,fontWeight:700,letterSpacing:"-0.01em",color:s.text},children:e}),n]}),t&&(0,d.jsx)("p",{style:{margin:"0 0 16px",color:s.textMuted,fontSize:14},children:t}),r]})})}),Ms=(0,a.forwardRef)(function({src:e,alt:t,size:n=96,initials:r,scanLines:o=!1,...i},a){const l=J();return(0,d.jsx)(Cs,{ref:a,radius:"50%",scanLines:o,...i,style:{width:n,height:n,...i.style},children:e?(0,d.jsx)("img",{src:e,alt:t,style:{width:"100%",height:"100%",borderRadius:"50%",objectFit:"cover",display:"block"}}):(0,d.jsx)("div",{role:"img","aria-label":t,style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:.36*n,fontWeight:700,color:l.text},children:r??t.charAt(0).toUpperCase()})})}),Ns={sm:"4px 10px",md:"6px 14px",lg:"8px 18px"},Ds={sm:11,md:13,lg:15},Rs={neutral:{fg:"#c4a8ff",bg:"rgba(196,168,255,0.10)",bd:"rgba(196,168,255,0.30)"},success:{fg:"#00f5d4",bg:"rgba(0,245,212,0.10)",bd:"rgba(0,245,212,0.40)"},info:{fg:"#7b8eff",bg:"rgba(123,142,255,0.10)",bd:"rgba(123,142,255,0.40)"},warning:{fg:"#ffbe0b",bg:"rgba(255,190,11,0.10)",bd:"rgba(255,190,11,0.40)"},danger:{fg:"#ff7eaf",bg:"rgba(255,0,110,0.10)",bd:"rgba(255,0,110,0.40)"}},Ps=(0,a.forwardRef)(function({children:e,size:t="md",tone:n="neutral",scanLines:r=!1,...o},i){const a=Rs[n];return(0,d.jsx)(Cs,{ref:i,radius:999,scanLines:r,maxTilt:6,...o,style:{display:"inline-flex",padding:Ns[t],fontSize:Ds[t],fontWeight:700,letterSpacing:"0.04em",textTransform:"uppercase",color:a.fg,background:a.bg,border:`1px solid ${a.bd}`,...o.style},children:e})}),Fs=(0,a.forwardRef)(function({children:e,onClick:t,isDisabled:n=!1,type:r="button",maxTilt:o=8,...i},l){const s=J(),c=qe(),u=(0,a.useRef)(null),p=Ss({maxTilt:o,disabled:n});return(0,a.useEffect)(()=>{const e=u.current;e&&(p.current=e,"function"==typeof l?l(e):l&&(l.current=e))},[l,p]),(0,d.jsxs)("button",{ref:u,type:r,onClick:n?void 0:t,disabled:n,className:"tkx-holo-root",style:{position:"relative",padding:"14px 28px",fontSize:15,fontWeight:700,letterSpacing:"0.02em",color:s.text,background:`linear-gradient(135deg, ${s.surface}, ${s.surfaceAlt})`,border:`1px solid ${s.primary}55`,borderRadius:12,cursor:n?"not-allowed":"pointer",opacity:n?.5:1,minHeight:44,transformStyle:"preserve-3d",...i.style},...i,children:[(0,d.jsx)("span",{className:"tkx-holo-foil","aria-hidden":"true"}),(0,d.jsx)("span",{className:"tkx-holo-content",style:{display:"inline-block"},children:e}),!c&&!n&&(0,d.jsx)("span",{"aria-hidden":"true",style:{position:"absolute",inset:-1,borderRadius:12,border:`1px solid ${s.primary}88`,boxShadow:`0 0 24px ${s.primary}44`,pointerEvents:"none",opacity:.6}})]})});function As(){(0,a.useEffect)(()=>{ks()},[])}var Is=(0,a.forwardRef)(function({header:e,footer:t,tabs:n,activeTabId:r,onTabChange:o,accent:i="#00f5d4",children:a,style:l,...s},c){As();const u=J();return(0,d.jsxs)("div",{ref:c,className:"tkx-holo-root",style:{...Q(u),position:"relative",display:"flex",flexDirection:"column",padding:0,borderRadius:14,background:"linear-gradient(180deg, rgba(13,13,20,0.85), rgba(8,8,14,0.85))",border:`1px solid ${i}33`,boxShadow:`0 0 0 1px ${i}11, 0 12px 40px rgba(0,0,0,0.5)`,overflow:"hidden",color:u.text,...l},...s,children:[(0,d.jsx)("span",{className:"tkx-holo-foil","aria-hidden":"true"}),e&&(0,d.jsx)("div",{style:{padding:"12px 16px",borderBottom:`1px solid ${i}22`,display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,position:"relative",zIndex:1},children:e}),n&&n.length>0&&(0,d.jsx)("div",{role:"tablist",style:{display:"flex",gap:0,borderBottom:`1px solid ${i}22`,position:"relative",zIndex:1},children:n.map(e=>{const t=e.id===r;return(0,d.jsx)("button",{type:"button",role:"tab","aria-selected":t,onClick:()=>o?.(e.id),style:{padding:"10px 14px",minHeight:38,border:"none",background:"transparent",color:t?i:u.textMuted,fontWeight:600,fontSize:12,cursor:"pointer",borderBottom:`2px solid ${t?i:"transparent"}`},children:e.label},e.id)})}),(0,d.jsx)("div",{style:{padding:16,flex:1,position:"relative",zIndex:1,minHeight:0},children:a}),t&&(0,d.jsx)("div",{style:{padding:"12px 16px",borderTop:`1px solid ${i}22`,position:"relative",zIndex:1},children:t})]})}),Ls=(0,a.forwardRef)(function({columns:e,onReorder:t,renderCard:n,onCardClick:r,maxHeight:o=720,minColumnWidth:i=280,isDragDisabled:l=!1,className:s,style:c},u){const p=J(),h=qe();(0,a.useId)();const[f,m]=(0,a.useState)(null),[g,x]=(0,a.useState)(""),y=(0,a.useRef)(new Map),b=(0,a.useCallback)((e,t,n,r)=>{l||t.isDragDisabled||0!==e.button&&"mouse"===e.pointerType||(e.currentTarget.setPointerCapture(e.pointerId),m({cardId:t.id,fromColumnId:n.id,fromIndex:r,mode:"pointer",ghostX:0,ghostY:0,toColumnId:n.id,toIndex:r}),x(`Picked up "${t.title}" from ${n.title}, position ${r+1}`))},[l]),v=(0,a.useCallback)((e,t,n)=>{if(!f||"pointer"!==f.mode)return;e.currentTarget;const r=y.current.get(f.cardId);if(!r)return;const o=r.getBoundingClientRect();m(r=>r?{...r,ghostX:e.clientX-(o.left+o.width/2),ghostY:e.clientY-(o.top+o.height/2),toColumnId:t.id,toIndex:n}:r)},[f]),w=(0,a.useCallback)(()=>{f&&"pointer"===f.mode&&$(f)},[f]),k=(0,a.useCallback)(()=>{f&&(x("Drag cancelled"),m(null))},[f]);function $(n){if(n.fromColumnId!==n.toColumnId||n.fromIndex!==n.toIndex){const r=e.find(e=>e.id===n.toColumnId),o=e.find(e=>e.id===n.fromColumnId)?.cards[n.fromIndex];t({cardId:n.cardId,fromColumnId:n.fromColumnId,fromIndex:n.fromIndex,toColumnId:n.toColumnId,toIndex:n.toIndex}),x(o&&r?`Moved "${o.title}" to ${r.title}, position ${n.toIndex+1}`:"Card moved")}else x("Returned to original position");m(null)}const S=(0,a.useCallback)((t,n,r,o)=>{if(l||n.isDragDisabled)return;if(" "===t.key||"Enter"===t.key)return t.preventDefault(),void(f?$(f):(m({cardId:n.id,fromColumnId:r.id,fromIndex:o,mode:"keyboard",toColumnId:r.id,toIndex:o}),x(`Grabbed "${n.title}". Use arrow keys to move. Enter to drop, Esc to cancel.`)));if("Escape"===t.key&&f)return t.preventDefault(),void k();if(!f||"keyboard"!==f.mode||f.cardId!==n.id)return;const i=e.findIndex(e=>e.id===f.toColumnId),a=e[i];if(a)switch(t.key){case"ArrowUp":t.preventDefault(),f.toIndex>0&&(m({...f,toIndex:f.toIndex-1}),x(`Position ${f.toIndex} of ${a.cards.length}`));break;case"ArrowDown":t.preventDefault(),f.toIndex<a.cards.length&&(m({...f,toIndex:f.toIndex+1}),x(`Position ${f.toIndex+2} of ${a.cards.length+1}`));break;case"ArrowLeft":if(t.preventDefault(),i>0){const t=e[i-1];m({...f,toColumnId:t.id,toIndex:Math.min(f.toIndex,t.cards.length)}),x(`Moved to ${t.title}`)}break;case"ArrowRight":if(t.preventDefault(),i<e.length-1){const t=e[i+1];m({...f,toColumnId:t.id,toIndex:Math.min(f.toIndex,t.cards.length)}),x(`Moved to ${t.title}`)}}},[e,f,k,l]);(0,a.useEffect)(()=>{if(!f)return;const e=e=>{"Escape"===e.key&&k()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[f,k]);const C=(0,a.useCallback)(e=>(0,d.jsxs)(d.Fragment,{children:[e.badges&&e.badges.length>0&&(0,d.jsx)("div",{style:{display:"flex",gap:6,marginBottom:8,flexWrap:"wrap"},children:e.badges.map((e,t)=>(0,d.jsx)("span",{style:{padding:"2px 8px",fontSize:10,fontWeight:700,borderRadius:999,background:e.color?`${e.color}22`:`${p.primary}22`,color:e.color??p.primary,letterSpacing:"0.05em",textTransform:"uppercase"},children:e.label},t))}),(0,d.jsx)("div",{style:{fontSize:14,fontWeight:600,color:p.text,lineHeight:1.4},children:e.title}),e.description&&(0,d.jsx)("div",{style:{fontSize:12,color:p.textMuted,marginTop:6,lineHeight:1.5},children:e.description}),e.assignee&&(0,d.jsxs)("div",{style:{marginTop:10,display:"flex",alignItems:"center",gap:6,fontSize:11,color:p.textMuted},children:[e.assignee.avatarUrl?(0,d.jsx)("img",{src:e.assignee.avatarUrl,alt:"",style:{width:20,height:20,borderRadius:"50%"}}):(0,d.jsx)("div",{"aria-hidden":"true",style:{width:20,height:20,borderRadius:"50%",background:p.primary,color:p.bg,display:"flex",alignItems:"center",justifyContent:"center",fontSize:10,fontWeight:700},children:e.assignee.name.charAt(0).toUpperCase()}),(0,d.jsx)("span",{children:e.assignee.name})]})]}),[p]),z=(0,a.useMemo)(()=>({display:"grid",gridAutoFlow:"column",gridAutoColumns:`minmax(${i}px, 1fr)`,gap:12,overflowX:"auto",maxHeight:"number"==typeof o?`${o}px`:o,padding:4,...c}),[o,i,c]);return(0,d.jsxs)("div",{ref:u,className:s,role:"grid","aria-label":"Kanban board","aria-rowcount":Math.max(...e.map(e=>e.cards.length),0)+1,"aria-colcount":e.length,style:z,children:[(0,d.jsx)("div",{"aria-live":"polite","aria-atomic":"true",style:{position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0},children:g}),e.map((e,t)=>{const o=f?.toColumnId===e.id,i=void 0!==e.wipLimit&&e.cards.length>=e.wipLimit;return(0,d.jsxs)("section",{role:"row","aria-rowindex":t+1,"aria-label":`Column: ${e.title}`,style:{background:p.surface,border:`1px solid ${o?e.color??p.primary:p.border}`,borderRadius:12,display:"flex",flexDirection:"column",minHeight:0,transition:"border-color 120ms"},children:[(0,d.jsxs)("header",{style:{padding:"12px 14px",borderBottom:`1px solid ${p.border}`,display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[(0,d.jsx)("span",{"aria-hidden":"true",style:{width:8,height:8,borderRadius:"50%",background:e.color??p.primary}}),(0,d.jsx)("h3",{style:{margin:0,fontSize:13,fontWeight:700,color:p.text,letterSpacing:"0.02em",flex:1},children:e.title}),(0,d.jsxs)("span",{style:{fontSize:12,color:i?p.danger:p.textMuted,fontFamily:"monospace",fontWeight:600},"aria-label":e.wipLimit?`${e.cards.length} of ${e.wipLimit} cards`:`${e.cards.length} cards`,children:[e.cards.length,e.wipLimit&&` / ${e.wipLimit}`]})]}),(0,d.jsxs)("div",{style:{padding:8,display:"flex",flexDirection:"column",gap:8,overflowY:"auto",flex:1,minHeight:60},children:[e.cards.map((o,i)=>{const a=f?.cardId===o.id;return(0,d.jsxs)("div",{children:[f&&f.toColumnId===e.id&&f.toIndex===i&&!a&&(0,d.jsx)(Ts,{color:e.color??p.primary}),(0,d.jsx)("div",{ref:e=>{e?y.current.set(o.id,e):y.current.delete(o.id)},role:"gridcell","aria-rowindex":i+1,"aria-colindex":t+1,"aria-grabbed":a,"aria-label":o.title,tabIndex:0,"data-card-id":o.id,onPointerDown:t=>b(t,o,e,i),onPointerMove:t=>"pointer"===f?.mode?v(t,e,i):void 0,onPointerUp:w,onPointerCancel:k,onKeyDown:t=>S(t,o,e,i),onClick:()=>{f||r?.(o,e)},style:{padding:12,borderRadius:8,background:p.surfaceAlt,border:`1px solid ${a?e.color??p.primary:p.border}`,cursor:l||o.isDragDisabled?"default":"grab",touchAction:l||o.isDragDisabled?"auto":"none",opacity:a?.4:1,transform:a&&"pointer"===f.mode&&!h?`translate(${f.ghostX??0}px, ${f.ghostY??0}px) scale(1.02)`:void 0,transition:a||h?"none":"transform 120ms, border-color 120ms",userSelect:"none",outlineOffset:2},children:(n??C)(o,e)})]},`slot-${i}`)}),f&&f.toColumnId===e.id&&f.toIndex>=e.cards.length&&(0,d.jsx)(Ts,{color:e.color??p.primary}),0===e.cards.length&&!f&&(0,d.jsx)("div",{style:{padding:24,textAlign:"center",color:p.textMuted,fontSize:12,border:`1px dashed ${p.border}`,borderRadius:8},children:"No cards"})]})]},e.id)})]})});function Ts({color:e}){return(0,d.jsx)("div",{"aria-hidden":"true",style:{height:3,background:e,borderRadius:999,margin:"2px 0",boxShadow:`0 0 8px ${e}66`}})}var Ws=new Set(["P","BR","DIV","SPAN","B","STRONG","I","EM","U","S","STRIKE","DEL","H1","H2","H3","H4","H5","H6","UL","OL","LI","BLOCKQUOTE","PRE","CODE","A","IMG","HR"]),js=new Set(["SCRIPT","STYLE","IFRAME","OBJECT","EMBED","NOSCRIPT","TEMPLATE","META","LINK","BASE","FORM","INPUT","BUTTON","TEXTAREA","SELECT"]),Es=new Set(["href","src","alt","title"]);function Bs(e){if(!e)return null;const t=e.trim().toLowerCase();return t.startsWith("javascript:")||t.startsWith("data:")||t.startsWith("vbscript:")?null:e.trim()}function Vs(e){if(!e)return null;const t=e.trim().toLowerCase();return t.startsWith("https://")||t.startsWith("http://")||t.startsWith("data:image/")?e.trim():null}function Hs(e){if("undefined"==typeof document)return e;const t=document.createElement("div");return t.innerHTML=e,Os(t),t.innerHTML}function Os(e){const t=Array.from(e.childNodes);for(const n of t){if(n.nodeType===Node.TEXT_NODE){const e=n.textContent||"",t=Fe(e);t!==e&&(n.textContent=t);continue}if(n.nodeType===Node.ELEMENT_NODE){const t=n;if(js.has(t.tagName)){e.removeChild(t);continue}if(!Ws.has(t.tagName)){for(;t.firstChild;)e.insertBefore(t.firstChild,t);e.removeChild(t);continue}const r=Array.from(t.attributes);for(const e of r)if(e.name.startsWith("on"))t.removeAttribute(e.name);else if(Es.has(e.name)){if("href"===e.name&&"A"===t.tagName){const n=Bs(e.value);n?(t.setAttribute("href",n),t.setAttribute("rel","noopener noreferrer"),t.setAttribute("target","_blank")):t.removeAttribute("href")}"src"===e.name&&"IMG"===t.tagName&&(Vs(e.value)||t.removeAttribute("src"))}else t.removeAttribute(e.name);Os(t)}else n.nodeType===Node.COMMENT_NODE&&e.removeChild(n)}}var qs=[{id:"bold",label:"Bold",icon:"B",cmd:"bold",shortcut:"⌘B"},{id:"italic",label:"Italic",icon:"I",cmd:"italic",shortcut:"⌘I"},{id:"underline",label:"Underline",icon:"U",cmd:"underline",shortcut:"⌘U"},{id:"strike",label:"Strikethrough",icon:"S",cmd:"strikeThrough"},{id:"h1",label:"Heading 1",icon:"H1"},{id:"h2",label:"Heading 2",icon:"H2"},{id:"h3",label:"Heading 3",icon:"H3"},{id:"ul",label:"Bullet list",icon:"•",cmd:"insertUnorderedList"},{id:"ol",label:"Numbered list",icon:"1.",cmd:"insertOrderedList"},{id:"quote",label:"Quote",icon:'"'},{id:"code",label:"Inline code",icon:"<>"},{id:"codeblock",label:"Code block",icon:"{ }"},{id:"link",label:"Link",icon:"🔗",shortcut:"⌘K"},{id:"image",label:"Image",icon:"🖼"},{id:"hr",label:"Divider",icon:"—"}],Us=(0,a.forwardRef)(function({initialValue:e="",onChange:t,placeholder:n="Start writing…",tools:r,maxHeight:o,minHeight:i=200,label:l="Rich text editor",isDisabled:s=!1,className:c,style:u,topSlot:p,bottomSlot:h},f){const m=J(),g=(0,a.useRef)(null),x=(0,a.useId)(),[y,b]=(0,a.useState)(new Set),[v,w]=(0,a.useState)(!0),k=r??qs.map(e=>e.id),$=(0,a.useCallback)(()=>{if(!g.current)return;const e=Hs(g.current.innerHTML);t?.(e),w(""===g.current.textContent?.trim())},[t]);(0,a.useImperativeHandle)(f,()=>({getHTML:()=>Hs(g.current?.innerHTML??""),getMarkdown:()=>function(e){if("undefined"==typeof document)return e;const t=document.createElement("div");return t.innerHTML=Hs(e),function e(t,n=0){if(t.nodeType===Node.TEXT_NODE)return t.textContent||"";if(t.nodeType!==Node.ELEMENT_NODE)return"";const r=t,o=Array.from(r.childNodes).map(t=>e(t,n)).join("");switch(r.tagName){case"B":case"STRONG":return`**${o}**`;case"I":case"EM":return`*${o}*`;case"U":return`<u>${o}</u>`;case"S":case"STRIKE":case"DEL":return`~~${o}~~`;case"H1":return`# ${o}\n\n`;case"H2":return`## ${o}\n\n`;case"H3":return`### ${o}\n\n`;case"H4":return`#### ${o}\n\n`;case"H5":return`##### ${o}\n\n`;case"H6":return`###### ${o}\n\n`;case"P":return`${o}\n\n`;case"BR":return"\n";case"HR":return"\n---\n\n";case"BLOCKQUOTE":return`> ${o.replace(/\n/g,"\n> ")}\n\n`;case"CODE":return"PRE"===r.parentElement?.tagName?o:`\`${o}\``;case"PRE":return`\`\`\`\n${o}\n\`\`\`\n\n`;case"UL":case"OL":return"\n"+Array.from(r.children).map((t,o)=>e(t,n+1).replace(/^/,"OL"===r.tagName?`${o+1}. `:"- ")).join("")+"\n";case"LI":return`${" ".repeat(Math.max(0,n-1))}${o}\n`;case"A":return`[${o}](${r.getAttribute("href")||""})`;case"IMG":{const e=r.getAttribute("src")||"";return`![${r.getAttribute("alt")||""}](${e})`}default:return o}}(t).trim()}(g.current?.innerHTML??""),getText:()=>g.current?.textContent??"",setHTML:e=>{g.current&&(g.current.innerHTML=Hs(e),$())},focus:()=>g.current?.focus()})),(0,a.useEffect)(()=>{g.current&&e&&(g.current.innerHTML=Hs(e),w(""===g.current.textContent?.trim()))},[]);const S=(0,a.useCallback)(()=>{if("undefined"==typeof document)return;const e=new Set;try{document.queryCommandState("bold")&&e.add("bold"),document.queryCommandState("italic")&&e.add("italic"),document.queryCommandState("underline")&&e.add("underline"),document.queryCommandState("strikeThrough")&&e.add("strike"),document.queryCommandState("insertUnorderedList")&&e.add("ul"),document.queryCommandState("insertOrderedList")&&e.add("ol")}catch{}b(e)},[]);(0,a.useEffect)(()=>(document.addEventListener("selectionchange",S),()=>document.removeEventListener("selectionchange",S)),[S]);const C=(0,a.useCallback)(e=>{if(s)return;g.current?.focus();const t=qs.find(t=>t.id===e);switch(e){case"h1":case"h2":case"h3":document.execCommand("formatBlock",!1,e);break;case"quote":document.execCommand("formatBlock",!1,"blockquote");break;case"code":!function(){if("undefined"==typeof window)return;const e=window.getSelection();if(!e||0===e.rangeCount)return;const t=e.getRangeAt(0),n=t.toString();if(!n)return;const r=document.createElement("code");r.textContent=n,t.deleteContents(),t.insertNode(r)}();break;case"codeblock":document.execCommand("formatBlock",!1,"pre");break;case"link":{const e=window.getSelection()?.toString()||"",t=window.prompt("Link URL","https://");if(!t)break;const r=Bs(t);if(!r){window.alert("That URL is not allowed.");break}const o=e||r;document.execCommand("insertHTML",!1,`<a href="${Ks(r)}" target="_blank" rel="noopener noreferrer">${n=o,n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}</a>`);break}case"image":{const e=window.prompt("Image URL (https:// or data:image/…)");if(!e)break;const t=Vs(e);if(!t){window.alert("That image URL is not allowed.");break}const n=window.prompt("Alt text (required for accessibility)")||"";document.execCommand("insertHTML",!1,`<img src="${Ks(t)}" alt="${Ks(n)}" />`);break}case"hr":document.execCommand("insertHTML",!1,"<hr />");break;default:t?.cmd&&document.execCommand(t.cmd,!1)}var n;$(),S()},[s,$,S]),z=(0,a.useCallback)(e=>{if(!e.metaKey&&!e.ctrlKey)return;const t=e.key.toLowerCase();"b"===t?(e.preventDefault(),C("bold")):"i"===t?(e.preventDefault(),C("italic")):"u"===t?(e.preventDefault(),C("underline")):"k"===t&&(e.preventDefault(),C("link"))},[C]),M=(0,a.useCallback)(e=>{e.preventDefault();const t=e.clipboardData.getData("text/html"),n=e.clipboardData.getData("text/plain");t?document.execCommand("insertHTML",!1,Hs(t)):n&&document.execCommand("insertText",!1,n),$()},[$]),N=(0,a.useCallback)(e=>{const t=Array.from(e.currentTarget.querySelectorAll("button[data-tool]")),n=t.indexOf(document.activeElement);n<0||("ArrowRight"===e.key?(e.preventDefault(),t[(n+1)%t.length].focus()):"ArrowLeft"===e.key?(e.preventDefault(),t[(n-1+t.length)%t.length].focus()):"Home"===e.key?(e.preventDefault(),t[0].focus()):"End"===e.key&&(e.preventDefault(),t[t.length-1].focus()))},[]),D={border:`1px solid ${m.border}`,borderRadius:12,background:m.surface,...u},R={display:"flex",flexWrap:"wrap",gap:4,padding:8,borderBottom:`1px solid ${m.border}`,background:m.surfaceAlt,borderTopLeftRadius:12,borderTopRightRadius:12},P={padding:16,outline:"none",minHeight:"number"==typeof i?`${i}px`:i,maxHeight:"number"==typeof o?`${o}px`:o,overflowY:o?"auto":"visible",color:m.text,fontSize:15,lineHeight:1.6,borderBottomLeftRadius:12,borderBottomRightRadius:12,cursor:s?"not-allowed":"text",opacity:s?.6:1};return(0,d.jsxs)("div",{className:c,style:D,children:[p,(0,d.jsx)("div",{role:"toolbar","aria-label":"Formatting","aria-controls":x,onKeyDown:N,style:R,children:k.map((e,t)=>{const n=qs.find(t=>t.id===e);if(!n)return null;const r=y.has(e);return(0,d.jsx)("button",{type:"button","data-tool":n.id,tabIndex:0===t?0:-1,"aria-label":n.label+(n.shortcut?` (${n.shortcut})`:""),"aria-pressed":r,disabled:s,onMouseDown:e=>e.preventDefault(),onClick:()=>C(n.id),style:{background:r?m.primary:"transparent",color:r?m.bg:m.text,border:`1px solid ${r?m.primary:"transparent"}`,padding:"6px 10px",borderRadius:6,cursor:s?"not-allowed":"pointer",fontWeight:700,fontSize:13,minWidth:32,minHeight:32,display:"inline-flex",alignItems:"center",justifyContent:"center",transition:"background 120ms"},children:n.icon},n.id)})}),(0,d.jsxs)("div",{style:{position:"relative"},children:[(0,d.jsx)("div",{ref:g,id:x,role:"textbox","aria-label":l,"aria-multiline":"true","aria-readonly":s,contentEditable:!s,suppressContentEditableWarning:!0,onInput:$,onKeyDown:z,onPaste:M,spellCheck:!0,style:P}),v&&!s&&(0,d.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",top:16,left:16,color:m.textMuted,pointerEvents:"none",fontSize:15},children:n})]}),h]})});function Ks(e){return e.replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var Ys=[{key:"bg",label:"Page background",group:"surface"},{key:"surface",label:"Card surface",group:"surface"},{key:"surfaceAlt",label:"Alt surface",group:"surface"},{key:"border",label:"Border",group:"surface"},{key:"text",label:"Body text",group:"text",contrastAgainst:"bg",threshold:7},{key:"textMuted",label:"Muted text",group:"text",contrastAgainst:"bg",threshold:4.5},{key:"primary",label:"Primary",group:"brand",contrastAgainst:"bg",threshold:4.5},{key:"secondary",label:"Secondary",group:"brand",contrastAgainst:"bg",threshold:4.5},{key:"success",label:"Success",group:"status",contrastAgainst:"bg",threshold:4.5},{key:"warning",label:"Warning",group:"status",contrastAgainst:"bg",threshold:4.5},{key:"danger",label:"Danger",group:"status",contrastAgainst:"bg",threshold:4.5},{key:"info",label:"Info",group:"status",contrastAgainst:"bg",threshold:4.5}],Zs={surface:"Surfaces",text:"Text",brand:"Brand",status:"Status colors"};function Xs(e){const t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Gs(e){const t=e.replace(/^#/,"").match(/^([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i);if(!t)return 0;const[n,r,o]=[t[1],t[2],t[3]].map(e=>parseInt(e,16));return.2126*Xs(n)+.7152*Xs(r)+.0722*Xs(o)}function _s({slot:e,value:t,pairedValue:n,onChange:r}){const o=J(),i=n?function(e,t){const n=Gs(e),r=Gs(t),[o,i]=n>r?[n,r]:[r,n];return(o+.05)/(i+.05)}(t,n):null,a=i?function(e){return e>=7?{label:"AAA",color:"#06d6a0"}:e>=4.5?{label:"AA",color:"#ffbe0b"}:e>=3?{label:"AA Large",color:"#ff8500"}:{label:"fail",color:"#f72585"}}(i):null,l=e.threshold&&null!==i?i>=e.threshold:null;return(0,d.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"32px 1fr auto",gap:10,alignItems:"center"},children:[(0,d.jsx)("input",{type:"color",value:t,onChange:e=>r(e.target.value),"aria-label":`${e.label} color`,style:{width:32,height:32,padding:0,border:`1px solid ${o.border}`,borderRadius:6,background:"transparent",cursor:"pointer"}}),(0,d.jsxs)("div",{style:{minWidth:0},children:[(0,d.jsx)("div",{style:{fontSize:13,fontWeight:600,color:o.text},children:e.label}),(0,d.jsx)("input",{type:"text",value:t,onChange:e=>{const t=e.target.value;/^#[0-9a-f]{0,6}$/i.test(t)&&r(t)},"aria-label":`${e.label} hex`,style:{background:"transparent",border:"none",color:o.textMuted,fontFamily:"monospace",fontSize:12,padding:0,outline:"none",width:"100%"}})]}),a&&(0,d.jsxs)("span",{title:`Contrast vs ${e.contrastAgainst}: ${i?.toFixed(2)}:1 — needs ${e.threshold}:1`,style:{padding:"3px 8px",borderRadius:999,fontSize:10,fontWeight:700,background:!1===l?"#f7258522":`${a.color}22`,color:!1===l?"#f72585":a.color,letterSpacing:"0.04em",whiteSpace:"nowrap"},children:[i?.toFixed(1)," · ",a.label]})]})}function Js(){const e=J();return(0,d.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[(0,d.jsx)("h2",{style:{margin:0,fontSize:24,fontWeight:800,color:e.text},children:"Live preview"}),(0,d.jsx)("p",{style:{margin:0,color:e.textMuted},children:"Edit the tokens on the left. Sample components render here with the current theme. Contrast badges flag any token that fails WCAG."}),(0,d.jsxs)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[(0,d.jsx)("button",{style:nd(e.primary,e.bg),children:"Primary"}),(0,d.jsx)("button",{style:nd(e.secondary,e.bg),children:"Secondary"}),(0,d.jsx)("button",{style:nd(e.success,e.bg),children:"Success"}),(0,d.jsx)("button",{style:nd(e.warning,e.bg),children:"Warning"}),(0,d.jsx)("button",{style:nd(e.danger,e.bg),children:"Danger"}),(0,d.jsx)("button",{style:nd(e.info,e.bg),children:"Info"})]}),(0,d.jsxs)("div",{style:{padding:16,background:e.surface,border:`1px solid ${e.border}`,borderRadius:12},children:[(0,d.jsx)("h3",{style:{margin:"0 0 6px",fontSize:16,fontWeight:700,color:e.text},children:"Card surface"}),(0,d.jsxs)("p",{style:{margin:0,color:e.textMuted,fontSize:13},children:["Cards use the ",(0,d.jsx)("code",{children:"surface"})," token with ",(0,d.jsx)("code",{children:"border"})," as outline."]})]}),(0,d.jsxs)("div",{style:{padding:16,background:e.surfaceAlt,border:`1px solid ${e.border}`,borderRadius:12},children:[(0,d.jsx)("h3",{style:{margin:"0 0 6px",fontSize:16,fontWeight:700,color:e.text},children:"Alt surface"}),(0,d.jsx)("p",{style:{margin:0,color:e.textMuted,fontSize:13},children:"Used for nested panels (e.g. modal headers, kanban cards)."})]}),(0,d.jsx)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:["primary","secondary","success","warning","danger","info"].map(t=>(0,d.jsx)("span",{style:rd(e[t]),children:t},t))}),(0,d.jsx)("input",{type:"text",placeholder:"Sample input",style:{background:e.surface,border:`1px solid ${e.border}`,color:e.text,padding:"10px 14px",borderRadius:8,fontSize:14,outline:"none",minHeight:44}}),(0,d.jsx)("p",{style:{color:e.text,fontSize:14,margin:0},children:"Body text on page background — must be 7:1 for AAA."}),(0,d.jsx)("p",{style:{color:e.textMuted,fontSize:13,margin:0},children:"Muted text — must be at least 4.5:1."})]})}var Qs=(e,t)=>({flex:1,background:t?e.primary:"transparent",color:t?e.bg:e.text,border:`1px solid ${t?e.primary:e.border}`,padding:"6px 10px",borderRadius:6,fontSize:11,fontWeight:700,cursor:"pointer",letterSpacing:"0.05em"}),ed=e=>({flex:1,background:e.primary,color:e.bg,border:"none",padding:"8px 14px",borderRadius:6,fontSize:12,fontWeight:700,cursor:"pointer",minHeight:36}),td=(e,t)=>({flex:1,background:"transparent",color:e.textMuted,border:`1px solid ${e.border}`,padding:"8px 14px",borderRadius:6,fontSize:12,fontWeight:600,cursor:t?"not-allowed":"pointer",opacity:t?.5:1,minHeight:36}),nd=(e,t)=>({background:e,color:t,padding:"8px 14px",border:"none",borderRadius:6,fontWeight:700,fontSize:12,cursor:"pointer",minHeight:36}),rd=e=>({padding:"4px 10px",background:`${e}22`,color:e,fontSize:11,fontWeight:700,letterSpacing:"0.05em",textTransform:"uppercase",borderRadius:999,border:`1px solid ${e}55`}),od=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],id=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function ad(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function ld(e){if(e instanceof Date)return new Date(e);const t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e.trim());return t?new Date(Number(t[1]),Number(t[2])-1,Number(t[3])):new Date(e)}function sd(e,t){const n=new Date(e);return n.setHours(0,0,0,0),n.setDate(n.getDate()+t),n}var dd={critical:"#f72585",serious:"#ff8500",moderate:"#ffbe0b",minor:"#3a86ff"};function cd(e,t,n){const r=16,o={};return"bottom-right"===n&&Object.assign(o,{bottom:r,right:r}),"bottom-left"===n&&Object.assign(o,{bottom:r,left:r}),"top-right"===n&&Object.assign(o,{top:r,right:r}),"top-left"===n&&Object.assign(o,{top:r,left:r}),{position:"fixed",zIndex:99999,width:56,height:56,borderRadius:"50%",background:e.surface,border:`2px solid ${t}`,boxShadow:`0 0 24px ${t}55, 0 4px 12px rgba(0,0,0,0.3)`,color:t,cursor:"pointer",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:0,fontFamily:"inherit",transition:"transform 120ms",...o}}function ud(e,t){const n={};return"bottom-right"===t&&Object.assign(n,{bottom:84,right:16}),"bottom-left"===t&&Object.assign(n,{bottom:84,left:16}),"top-right"===t&&Object.assign(n,{top:84,right:16}),"top-left"===t&&Object.assign(n,{top:84,left:16}),{position:"fixed",zIndex:99998,width:360,maxWidth:"calc(100vw - 32px)",background:e.surface,border:`1px solid ${e.border}`,borderRadius:12,boxShadow:"0 16px 40px rgba(0,0,0,0.4)",overflow:"hidden",color:e.text,...n}}function pd(e,t,n,r){const o=!!e.children&&e.children.length>0,i=n.has(e.id);if(!o||i)return{node:e,depth:t,y:r+.5,span:1,children:[],hasChildren:o,collapsed:i};let a=r;const l=[];for(const u of e.children){const e=pd(u,t+1,n,a);l.push(e),a+=e.span}const s=a-r,d=l[0],c=l[l.length-1];return{node:e,depth:t,y:(d.y+c.y)/2,span:s,children:l,hasChildren:o,collapsed:i}}function hd(e,t,n,r=[],o=null){r.push({laid:e,x:e.depth*t,y:e.y*n,parentId:o});for(const i of e.children)hd(i,t,n,r,e.node.id);return r}function fd(e){const t=e.width??160,n=e.height??60;return{out:[e.x+t,e.y+n/2],in:[e.x,e.y+n/2]}}function md(e,t){const n=fd(e).out,r=fd(t).in,o=Math.max(40,Math.abs(r[0]-n[0])/2),i=[n[0]+o,n[1]],a=[r[0]-o,r[1]];return`M ${n[0]} ${n[1]} C ${i[0]} ${i[1]}, ${a[0]} ${a[1]}, ${r[0]} ${r[1]}`}var gd={x:0,y:0,scale:1},xd=(0,a.forwardRef)(function({data:e,onChange:t,selectedId:n,onSelect:r,initialViewport:o,draggable:i=!0,pannable:l=!0,zoomable:s=!0,minZoom:c=.25,maxZoom:u=3,height:p=480,showGrid:h=!0,showControls:f=!0,renderNode:m,className:g,style:x},y){const b=J(),[v,w]=(0,a.useState)(o??gd),[k,$]=(0,a.useState)(null),S=void 0!==n?n:k,[C,z]=(0,a.useState)(null),[M,N]=(0,a.useState)(null),[D,R]=(0,a.useState)(null),[P,F]=(0,a.useState)(!1),A=(0,a.useRef)(null),I=(0,a.useId)(),L=(0,a.useCallback)(e=>{void 0===n&&$(e),r?.(e)},[n,r]),T=(0,a.useRef)(null),W=(0,a.useRef)(new Map),j=(0,a.useRef)(null),E=(0,a.useRef)(new Set),[B,V]=(0,a.useState)(null),H=n=>{const r=T.current;if(!r||"node"!==r.kind||r.pointerId!==n.pointerId)return;const o=(n.clientX-r.startX)/v.scale,i=(n.clientY-r.startY)/v.scale,a=r.nodeStartX+o,l=r.nodeStartY+i;t({...e,nodes:e.nodes.map(e=>e.id===r.id?{...e,x:a,y:l}:e)})},O=e=>{const t=T.current;t&&"node"===t.kind&&t.pointerId===e.pointerId&&(E.current.delete(t.id),T.current=null)},q=(0,a.useCallback)((e,t)=>{const n=A.current?.getBoundingClientRect();return n?[(e-n.left-v.x)/v.scale,(t-n.top-v.y)/v.scale]:[0,0]},[v.x,v.y,v.scale]),U=e=>{const t=T.current;if(!t||"edge"!==t.kind||t.pointerId!==e.pointerId)return;const[n,r]=q(e.clientX,e.clientY);V({fromNodeId:t.fromNodeId,gx:n,gy:r})},K=n=>{const r=T.current;if(!r||"edge"!==r.kind||r.pointerId!==n.pointerId)return;let o;n.stopPropagation();try{o=((document.elementFromPoint?.(n.clientX,n.clientY))?.closest("[data-tkx-node-id]"))?.dataset.tkxNodeId}catch{}if(o&&o!==r.fromNodeId&&!e.edges.some(e=>e.from===r.fromNodeId&&e.to===o)){const n={id:`e-${r.fromNodeId}-${o}-${Date.now().toString(36)}`,from:r.fromNodeId,to:o};t({...e,edges:[...e.edges,n]})}T.current=null,V(null)},Y=e=>{W.current.delete(e.pointerId),W.current.size<2&&(j.current=null);const t=T.current;t&&"pan"===t.kind&&t.pointerId===e.pointerId&&(T.current=null)};function Z(e,t,n){return Math.max(t,Math.min(n,e))}const X=(0,a.useCallback)((e,t,n)=>{w(r=>{const o=Z(e,c,u),i=(t-r.x)/r.scale,a=(n-r.y)/r.scale;return{x:t-i*o,y:n-a*o,scale:o}})},[c,u]),G=(0,a.useCallback)(()=>{const t=A.current?.getBoundingClientRect();if(!t||0===e.nodes.length)return void w(gd);let n=1/0,r=1/0,o=-1/0,i=-1/0;for(const c of e.nodes){const e=c.width??160,t=c.height??60;c.x<n&&(n=c.x),c.y<r&&(r=c.y),c.x+e>o&&(o=c.x+e),c.y+t>i&&(i=c.y+t)}const a=o-n+80,l=i-r+80,s=t.width/a,d=t.height/l,p=Z(Math.min(s,d),c,u);w({x:-n*p+(t.width-(o-n)*p)/2,y:-r*p+(t.height-(i-r)*p)/2,scale:p})},[e.nodes,c,u]),_=`translate3d(${v.x}px, ${v.y}px, 0) scale(${v.scale})`,ee=(0,a.useMemo)(()=>new Map(e.nodes.map(e=>[e.id,e])),[e.nodes]);return(0,d.jsxs)("div",{ref:e=>{A.current=e,"function"==typeof y?y(e):y&&(y.current=e)},className:g,role:"application","aria-label":"Flow chart editor",tabIndex:0,onKeyDown:n=>{if(M&&("Delete"===n.key||"Backspace"===n.key))return n.preventDefault(),t({...e,edges:e.edges.filter(e=>e.id!==M)}),void N(null);if(!S)return void("Tab"===n.key&&e.nodes.length>0&&(n.preventDefault(),L(e.nodes[0].id)));const r=e.nodes.findIndex(e=>e.id===S);switch(n.key){case"Tab":{n.preventDefault();const t=(r+(n.shiftKey?-1:1)+e.nodes.length)%e.nodes.length;L(e.nodes[t].id);break}case"Delete":case"Backspace":n.preventDefault(),t({nodes:e.nodes.filter(e=>e.id!==S),edges:e.edges.filter(e=>e.from!==S&&e.to!==S)}),L(null);break;case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"ArrowDown":{n.preventDefault();const r=n.shiftKey?10:1,o="ArrowRight"===n.key?r:"ArrowLeft"===n.key?-r:0,i="ArrowDown"===n.key?r:"ArrowUp"===n.key?-r:0;t({...e,nodes:e.nodes.map(e=>e.id===S?{...e,x:e.x+o,y:e.y+i}:e)});break}}},onPointerDown:e=>{if(W.current.set(e.pointerId,{x:e.clientX,y:e.clientY}),s&&2===W.current.size){const[e,t]=Array.from(W.current.values());return void(j.current={startDist:Math.hypot(t.x-e.x,t.y-e.y),startScale:v.scale,centerX:(e.x+t.x)/2,centerY:(e.y+t.y)/2})}if(e.target===e.currentTarget&&l){L(null);try{e.currentTarget.setPointerCapture?.(e.pointerId)}catch{}T.current={kind:"pan",pointerId:e.pointerId,startX:e.clientX,startY:e.clientY,vpStartX:v.x,vpStartY:v.y}}},onPointerMove:e=>{W.current.has(e.pointerId)&&W.current.set(e.pointerId,{x:e.clientX,y:e.clientY});const t=j.current;if(t&&2===W.current.size){const[e,n]=Array.from(W.current.values()),r=Math.hypot(n.x-e.x,n.y-e.y)/t.startDist,o=Z(t.startScale*r,c,u),i=A.current?.getBoundingClientRect();return void(i&&X(o,t.centerX-i.left,t.centerY-i.top))}const n=T.current;n&&"pan"===n.kind&&n.pointerId===e.pointerId&&w({x:n.vpStartX+(e.clientX-n.startX),y:n.vpStartY+(e.clientY-n.startY),scale:v.scale})},onPointerUp:Y,onPointerCancel:Y,onWheel:e=>{if(!s)return;e.preventDefault();const t=A.current?.getBoundingClientRect();if(!t)return;const n=Math.exp(.0015*-e.deltaY);X(v.scale*n,e.clientX-t.left,e.clientY-t.top)},"data-testid":"tkx-flowchart",style:{...Q(b),position:"relative",width:"100%",height:p,overflow:"hidden",background:"var(--tkx-bg, #0a0a0f)",color:"var(--tkx-fg, #e8e8f4)",border:"1px solid var(--tkx-border, #2a2a3e)",borderRadius:12,touchAction:s||l?"none":"auto",outline:"none",...x},children:[h&&(0,d.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",inset:0,backgroundImage:"linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px)",backgroundSize:`${24*v.scale}px ${24*v.scale}px`,backgroundPosition:`${v.x}px ${v.y}px`,pointerEvents:"none"}}),(0,d.jsx)("svg",{"aria-hidden":"true",width:"100%",height:"100%",style:{position:"absolute",inset:0,pointerEvents:"none",overflow:"visible"},children:(0,d.jsxs)("g",{style:{transform:_,transformOrigin:"0 0"},children:[(0,d.jsx)("defs",{children:(0,d.jsx)("marker",{id:`tkx-flow-arrow-${I}`,markerWidth:"6",markerHeight:"6",refX:"5",refY:"3",orient:"auto",children:(0,d.jsx)("path",{d:"M0,0 L6,3 L0,6 z",fill:"currentColor"})})}),B&&(()=>{const e=ee.get(B.fromNodeId);if(!e)return null;const t=fd(e).out,n=[B.gx,B.gy],r=Math.max(40,Math.abs(n[0]-t[0])/2);return(0,d.jsx)("path",{"data-testid":"flow-edge-draft",d:`M ${t[0]} ${t[1]} C ${t[0]+r} ${t[1]}, ${n[0]-r} ${n[1]}, ${n[0]} ${n[1]}`,stroke:"var(--tkx-accent, #00f5d4)",strokeWidth:1.6/v.scale,strokeDasharray:`${4/v.scale} ${4/v.scale}`,fill:"none",strokeOpacity:.85})})(),e.edges.map(e=>{const t=ee.get(e.from),n=ee.get(e.to);if(!t||!n)return null;const r=e.color??t.color??"var(--tkx-accent, #00f5d4)",o=e.id===M;return(0,d.jsxs)("g",{"data-testid":`flow-edge-${e.id}`,style:{color:r,pointerEvents:"auto",cursor:"pointer"},children:[(0,d.jsx)("path",{d:md(t,n),stroke:"transparent",strokeWidth:12/v.scale,fill:"none",onClick:t=>{t.stopPropagation(),N(e.id),L(null)}}),(0,d.jsx)("path",{d:md(t,n),stroke:r,strokeWidth:(o?2.5:1.5)/v.scale,fill:"none",markerEnd:`url(#tkx-flow-arrow-${I})`,strokeOpacity:o?1:.8,style:{filter:o?`drop-shadow(0 0 4px ${r})`:"none",pointerEvents:"none"}}),e.label&&(0,d.jsx)("text",{x:(fd(t).out[0]+fd(n).in[0])/2,y:(fd(t).out[1]+fd(n).in[1])/2-6,textAnchor:"middle",fill:r,fontSize:11/v.scale,fontFamily:"ui-monospace, monospace",children:e.label})]},e.id)})]})}),(0,d.jsx)("div",{style:{position:"absolute",inset:0,transform:_,transformOrigin:"0 0",pointerEvents:"none"},children:e.nodes.map(n=>{const r=n.id===S,o=n.width??160,a=n.height??60,l=n.color??"var(--tkx-accent, #00f5d4)";return(0,d.jsxs)("div",{role:"button","aria-pressed":r,tabIndex:-1,"data-testid":`flow-node-${n.id}`,"data-tkx-node-id":n.id,onPointerDown:e=>((e,t)=>{if(i){e.stopPropagation(),L(t.id),E.current.add(t.id);try{e.currentTarget.setPointerCapture?.(e.pointerId)}catch{}T.current={kind:"node",id:t.id,pointerId:e.pointerId,startX:e.clientX,startY:e.clientY,nodeStartX:t.x,nodeStartY:t.y}}})(e,n),onPointerMove:H,onPointerUp:O,onPointerCancel:O,onDoubleClick:e=>{e.stopPropagation(),m||(L(n.id),z(n.id))},onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),L(n.id),R({x:e.clientX,y:e.clientY,nodeId:n.id})},style:{position:"absolute",left:n.x,top:n.y,width:o,height:a,pointerEvents:"auto",borderRadius:8,background:r?`${l}1f`:"rgba(18, 20, 38, 0.9)",border:`2px solid ${r?l:"rgba(255,255,255,0.12)"}`,boxShadow:r?`0 0 0 3px ${l}33`:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:"6px 10px",fontSize:13,fontWeight:600,color:"var(--tkx-fg, #e8e8f4)",textAlign:"center",cursor:"grab",userSelect:"none",touchAction:"none"},children:[C===n.id?(0,d.jsx)("input",{autoFocus:!0,"data-testid":`flow-node-rename-${n.id}`,defaultValue:n.label,onPointerDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),onBlur:r=>{const o=r.currentTarget.value.trim();o&&o!==n.label&&t({...e,nodes:e.nodes.map(e=>e.id===n.id?{...e,label:o}:e)}),z(null)},onKeyDown:e=>{"Enter"===e.key?e.currentTarget.blur():"Escape"===e.key&&(e.currentTarget.value=n.label,z(null)),e.stopPropagation()},style:{width:"100%",padding:"4px 6px",borderRadius:4,border:`1px solid ${l}`,background:"rgba(8,10,25,0.95)",color:b.text,textAlign:"center",fontSize:"inherit",fontWeight:"inherit",fontFamily:"inherit",outline:"none"}}):m?m(n,r):n.label,(0,d.jsx)("span",{"aria-hidden":"true",style:{position:"absolute",left:-6,top:"50%",width:10,height:10,transform:"translateY(-50%)",borderRadius:"50%",background:l,boxShadow:`0 0 8px ${l}88`,pointerEvents:"none"}}),(0,d.jsx)("button",{type:"button","aria-label":`Connect from ${n.label} — drag to another node`,title:"Drag to connect to another node","data-testid":`flow-port-${n.id}`,onPointerDown:r=>((n,r)=>{n.stopPropagation(),n.preventDefault();const o=n.pointerId,[i,a]=q(n.clientX,n.clientY);T.current={kind:"edge",pointerId:o,fromNodeId:r},V({fromNodeId:r,gx:i,gy:a});const l=e=>{const t=T.current;if(!t||"edge"!==t.kind||t.pointerId!==e.pointerId)return;const[n,r]=q(e.clientX,e.clientY);V({fromNodeId:t.fromNodeId,gx:n,gy:r})},s=n=>{const r=T.current;if(!r||"edge"!==r.kind||r.pointerId!==n.pointerId)return;let o;try{o=((document.elementFromPoint?.(n.clientX,n.clientY))?.closest("[data-tkx-node-id]"))?.dataset.tkxNodeId}catch{}if(o&&o!==r.fromNodeId&&!e.edges.some(e=>e.from===r.fromNodeId&&e.to===o)){const n={id:`e-${r.fromNodeId}-${o}-${Date.now().toString(36)}`,from:r.fromNodeId,to:o};t({...e,edges:[...e.edges,n]})}T.current=null,V(null),window.removeEventListener("pointermove",l),window.removeEventListener("pointerup",s),window.removeEventListener("pointercancel",s)};window.addEventListener("pointermove",l),window.addEventListener("pointerup",s),window.addEventListener("pointercancel",s)})(r,n.id),onPointerMove:U,onPointerUp:K,onPointerCancel:K,onMouseEnter:e=>{e.currentTarget.style.transform="translateY(-50%) scale(1.25)",e.currentTarget.style.boxShadow=`0 0 18px ${l}, 0 0 6px ${l}`},onMouseLeave:e=>{e.currentTarget.style.transform="translateY(-50%) scale(1)",e.currentTarget.style.boxShadow=`0 0 12px ${l}aa`},style:{position:"absolute",right:-11,top:"50%",width:22,height:22,transform:"translateY(-50%)",borderRadius:"50%",background:l,boxShadow:`0 0 12px ${l}aa`,border:"2px solid rgba(8,10,25,0.95)",cursor:"crosshair",padding:0,touchAction:"none",color:b.bg,fontSize:12,fontWeight:900,fontFamily:"inherit",display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:1,transition:"transform 0.15s, box-shadow 0.15s",zIndex:2},children:(0,d.jsx)("span",{"aria-hidden":"true",children:"+"})})]},n.id)})}),f&&(0,d.jsxs)("div",{role:"toolbar","aria-label":"Flow chart controls",style:{position:"absolute",right:12,bottom:12,display:"flex",gap:4,padding:4,borderRadius:999,background:"rgba(8, 10, 25, 0.7)",border:"1px solid rgba(255,255,255,0.12)",backdropFilter:"blur(6px)"},children:[(0,d.jsx)(kd,{label:"Zoom out",onClick:()=>{const e=A.current?.getBoundingClientRect();e&&X(.8*v.scale,e.width/2,e.height/2)},testId:"flow-zoom-out",children:"−"}),(0,d.jsx)(kd,{label:"Reset zoom",onClick:G,testId:"flow-fit",children:"⤢"}),(0,d.jsx)(kd,{label:"Zoom in",onClick:()=>{const e=A.current?.getBoundingClientRect();e&&X(1.25*v.scale,e.width/2,e.height/2)},testId:"flow-zoom-in",children:"+"}),(0,d.jsxs)("span",{"data-testid":"flow-zoom-readout",style:{display:"inline-flex",alignItems:"center",padding:"0 10px",color:b.textMuted,fontSize:11,fontFamily:"ui-monospace, monospace",fontVariantNumeric:"tabular-nums"},children:[Math.round(100*v.scale),"%"]}),(0,d.jsx)(kd,{label:"Toggle inspector",onClick:()=>F(e=>!e),testId:"flow-toggle-inspector",children:"☰"})]}),D&&(0,d.jsx)(wd,{x:D.x,y:D.y,containerEl:A.current,onClose:()=>R(null),actions:[{id:"rename",label:"Rename",icon:"✏️",run:()=>{z(D.nodeId)}},{id:"duplicate",label:"Duplicate",icon:"⎘",run:()=>{const n=e.nodes.find(e=>e.id===D.nodeId);if(!n)return;const r=`${n.id}-copy-${Date.now().toString(36)}`;t({...e,nodes:[...e.nodes,{...n,id:r,x:n.x+20,y:n.y+20}]}),L(r)}},{id:"bring-to-front",label:"Bring to front",icon:"⬆",run:()=>{const n=e.nodes.findIndex(e=>e.id===D.nodeId);if(n<0)return;const r=[...e.nodes.slice(0,n),...e.nodes.slice(n+1),e.nodes[n]];t({...e,nodes:r})}},{id:"delete",label:"Delete",icon:"🗑",danger:!0,run:()=>{t({nodes:e.nodes.filter(e=>e.id!==D.nodeId),edges:e.edges.filter(e=>e.from!==D.nodeId&&e.to!==D.nodeId)}),S===D.nodeId&&L(null)}}]}),P&&S&&(()=>{const n=e.nodes.find(e=>e.id===S);if(!n)return null;const r=n.color??b.primary,o=n.width??160,i=n.height??60,a=n=>{t({...e,nodes:e.nodes.map(e=>e.id===S?{...e,...n}:e)})};return(0,d.jsxs)("div",{role:"region","aria-label":"Node properties","data-testid":"flow-inspector",style:{position:"absolute",top:12,right:12,width:220,padding:12,borderRadius:10,background:"rgba(8, 10, 25, 0.92)",border:"1px solid rgba(196,168,255,0.3)",color:"#dcdce8",fontSize:12,backdropFilter:"blur(8px)",boxShadow:"0 12px 32px rgba(0,0,0,0.45)",zIndex:5},children:[(0,d.jsx)("div",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.08em",textTransform:"uppercase",color:b.textMuted,marginBottom:8},children:"Properties"}),(0,d.jsx)(yd,{label:"Label",children:(0,d.jsx)("input",{"data-testid":"inspector-label",value:n.label,onChange:e=>a({label:e.target.value}),style:bd})}),(0,d.jsx)(yd,{label:"Color",children:(0,d.jsx)("input",{type:"color","data-testid":"inspector-color",value:vd(r),onChange:e=>a({color:e.target.value}),style:{...bd,padding:0,height:32}})}),(0,d.jsx)(yd,{label:`Width (${o}px)`,children:(0,d.jsx)("input",{type:"range",min:80,max:320,value:o,onChange:e=>a({width:+e.target.value}),style:{width:"100%"}})}),(0,d.jsx)(yd,{label:`Height (${i}px)`,children:(0,d.jsx)("input",{type:"range",min:40,max:200,value:i,onChange:e=>a({height:+e.target.value}),style:{width:"100%"}})})]})})()]})});function yd({label:e,children:t}){return(0,d.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:4,marginBottom:8,fontSize:11,color:"#aaa"},children:[e,t]})}var bd={padding:"6px 8px",minHeight:30,borderRadius:5,border:"1px solid rgba(255,255,255,0.12)",background:"rgba(13, 13, 20, 0.6)",color:"#e8e8f4",fontSize:12,fontFamily:"inherit",width:"100%"};function vd(e){if(e.startsWith("#"))return 7===e.length?e:"#00f5d4";if(e.startsWith("rgb")){const t=e.match(/\d+/g);return!t||t.length<3?"#00f5d4":"#"+t.slice(0,3).map(e=>Number(e).toString(16).padStart(2,"0")).join("")}return"#00f5d4"}function wd({x:e,y:t,containerEl:n,actions:r,onClose:o}){a.useEffect(()=>{const e=e=>{e.target.closest?.("[data-tkx-context-menu]")||o()},t=e=>{"Escape"===e.key&&o()};return window.addEventListener("mousedown",e),window.addEventListener("keydown",t),()=>{window.removeEventListener("mousedown",e),window.removeEventListener("keydown",t)}},[o]);const i=n?.getBoundingClientRect(),l=i?e-i.left:e,s=i?t-i.top:t;return(0,d.jsx)("div",{role:"menu","aria-label":"Node actions","data-testid":"flow-context-menu","data-tkx-context-menu":"",style:{position:"absolute",left:Math.max(4,Math.min(l,(i?.width??600)-180)),top:Math.max(4,Math.min(s,(i?.height??400)-200)),minWidth:180,padding:4,borderRadius:8,background:"rgba(8, 10, 25, 0.96)",border:"1px solid rgba(196,168,255,0.3)",color:"#dcdce8",backdropFilter:"blur(8px)",boxShadow:"0 12px 32px rgba(0,0,0,0.55)",zIndex:10},children:r.map(e=>(0,d.jsxs)("button",{type:"button",role:"menuitem","data-testid":`flow-menu-${e.id}`,onClick:()=>{e.run(),o()},style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"8px 12px",minHeight:36,border:"none",background:"transparent",color:e.danger?"#ff7eaf":"#dcdce8",cursor:"pointer",fontSize:13,fontWeight:500,fontFamily:"inherit",textAlign:"left",borderRadius:5},onMouseEnter:e=>e.currentTarget.style.background="rgba(196,168,255,0.12)",onMouseLeave:e=>e.currentTarget.style.background="transparent",children:[(0,d.jsx)("span",{"aria-hidden":"true",children:e.icon}),(0,d.jsx)("span",{children:e.label})]},e.id))})}function kd({children:e,label:t,onClick:n,testId:r}){return(0,d.jsx)("button",{type:"button","aria-label":t,onClick:n,"data-testid":r,style:{width:44,height:44,minWidth:44,minHeight:44,borderRadius:999,border:"none",background:"transparent",color:"#dcdce8",cursor:"pointer",fontSize:18,fontFamily:"inherit",display:"inline-flex",alignItems:"center",justifyContent:"center"},children:e})}var $d="undefined"!=typeof navigator&&/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform||"");function Sd(e,t){if(!e)return 0;const n=e.toLowerCase(),r=t.toLowerCase();let o=0,i=0,a=-2,l=0;for(let s=0;s<r.length&&o<n.length;s++){if(r[s]!==n[o]){l=0;continue}let e=1;0===s?e+=8:/[\s_\-./]/.test(r[s-1])&&(e+=6),s===a+1?(l+=1,e+=2*l):l=1,i+=e,a=s,o+=1}return o<n.length?null:i-.05*r.length}var Cd={ctrl:!0,key:"k"};function zd(e){return{display:"flex",alignItems:"center",gap:12,padding:"10px 12px",minHeight:44,borderRadius:8,cursor:"pointer",background:e?"rgba(123,142,255,0.16)":"transparent",outline:e?"1px solid rgba(123,142,255,0.4)":"none",color:"#e8e8f4",transition:"background 80ms"}}function Md(e){return{fontSize:10,fontWeight:700,padding:"2px 6px",minWidth:18,borderRadius:4,textAlign:"center",border:"1px solid "+(e?"rgba(123,142,255,0.45)":"rgba(255,255,255,0.12)"),background:e?"rgba(123,142,255,0.14)":"rgba(255,255,255,0.04)",color:e?"#c4a8ff":"#aaa",fontFamily:"ui-monospace, monospace"}}function Nd(e){return 0===e.length?"":e.map((e,t)=>`${0===t?"M":"L"}${e.x.toFixed(2)},${e.y.toFixed(2)}`).join(" ")}var Dd=(0,a.forwardRef)(({data:e,variant:t="line",width:n=120,height:r=32,color:o,showPoints:i=!1,showLastPoint:a=!0,showValue:l=!1,smooth:s=!1,ariaLabel:c,className:u,style:p,...h},f)=>{const m=J(),g=o??m.primary,x=!Array.isArray(e)||0===e.length,y=c??(x?"Sparkline showing no data":`Sparkline showing ${e.length} value${1===e.length?"":"s"}, trending ${function(e){if(e.length<2)return"flat";const t=e[0],n=e[e.length-1];return n>t?"up":n<t?"down":"flat"}(e)}`);if(x)return(0,d.jsx)("span",{ref:f,role:"img","aria-label":y,className:Ct($t("inline-flex items-center"),u),style:p,...h,children:(0,d.jsx)("svg",{width:n,height:r,viewBox:`0 0 ${n} ${r}`,"aria-hidden":"true","data-tkx-sparkline-empty":""})});const b=function(e,t,n){if(0===e.length)return[];const r=Math.min(...e),o=Math.max(...e)-r||1,i=Math.max(0,t-4),a=Math.max(0,n-4);return 1===e.length?[{x:2+i/2,y:2+a/2}]:e.map((t,n)=>({x:2+n/(e.length-1)*i,y:2+a-(t-r)/o*a}))}(e,n,r),v=b[b.length-1],w=e[e.length-1];let k=null;if("bar"===t){const t=Math.max(0,n-4)/e.length,o=Math.max(1,.7*t),i=Math.min(...e),a=Math.max(...e)-i||1,l=Math.max(0,r-4);k=(0,d.jsx)("g",{"data-tkx-sparkline-variant":"bar",children:e.map((e,n)=>{const r=(e-i)/a*l,s=2+t*n+(t-o)/2,c=2+l-r;return(0,d.jsx)("rect",{x:s.toFixed(2),y:c.toFixed(2),width:o.toFixed(2),height:Math.max(1,r).toFixed(2),fill:g,rx:1},n)})})}else{const e=s?function(e){if(e.length<2)return Nd(e);const t=[`M${e[0].x.toFixed(2)},${e[0].y.toFixed(2)}`];for(let n=0;n<e.length-1;n++){const r=e[n-1]??e[n],o=e[n],i=e[n+1],a=e[n+2]??i,l=o.x+(i.x-r.x)/6,s=o.y+(i.y-r.y)/6,d=i.x-(a.x-o.x)/6,c=i.y-(a.y-o.y)/6;t.push(`C${l.toFixed(2)},${s.toFixed(2)} ${d.toFixed(2)},${c.toFixed(2)} ${i.x.toFixed(2)},${i.y.toFixed(2)}`)}return t.join(" ")}(b):Nd(b),n=(()=>{if("area"!==t||0===b.length)return"";const n=(r-2).toFixed(2);return`${e} L${b[b.length-1].x.toFixed(2)},${n} L${b[0].x.toFixed(2)},${n} Z`})();k=(0,d.jsxs)("g",{"data-tkx-sparkline-variant":t,children:["area"===t&&(0,d.jsx)("path",{d:n,fill:g,fillOpacity:.18,stroke:"none"}),(0,d.jsx)("path",{d:e,fill:"none",stroke:g,strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),i&&b.map((e,t)=>(0,d.jsx)("circle",{cx:e.x.toFixed(2),cy:e.y.toFixed(2),r:1.75,fill:g,"data-tkx-sparkline-point":""},t)),a&&!i&&v&&(0,d.jsx)("circle",{cx:v.x.toFixed(2),cy:v.y.toFixed(2),r:2.25,fill:g,"data-tkx-sparkline-last":""})]})}return(0,d.jsxs)("span",{ref:f,role:"img","aria-label":y,className:Ct($t("inline-flex items-center gap-2"),u),style:p,...h,children:[(0,d.jsx)("svg",{width:n,height:r,viewBox:`0 0 ${n} ${r}`,"aria-hidden":"true",style:{display:"block",overflow:"visible"},children:k}),l&&(0,d.jsx)("span",{className:$t("text-xs"),style:{color:m.textMuted,fontVariantNumeric:"tabular-nums"},"data-tkx-sparkline-value":"",children:String(w)})]})});Dd.displayName="TkxSparkline";var Rd={arc:{start:-135,end:135,sweep:270},speedometer:{start:-90,end:90,sweep:180}};function Pd(e,t,n,r){const o=(r-90)*Math.PI/180;return{x:e+n*Math.cos(o),y:t+n*Math.sin(o)}}function Fd(e,t,n,r,o){if(Math.abs(o-r)<1e-4)return"";const i=Pd(e,t,n,r),a=Pd(e,t,n,o),l=o-r,s=Math.abs(l)>180?1:0,d=l>=0?1:0;return`M${i.x.toFixed(2)},${i.y.toFixed(2)} A${n.toFixed(2)},${n.toFixed(2)} 0 ${s} ${d} ${a.x.toFixed(2)},${a.y.toFixed(2)}`}function Ad(e,t,n){if(!t||0===t.length)return n;const r=[...t].sort((e,t)=>e.at-t.at);let o=r[0].color;for(const i of r)e>=i.at&&(o=i.color);return o}var Id=(0,a.forwardRef)(({value:e,min:t=0,max:n=100,size:r=200,thickness:o=16,variant:i="arc",thresholds:l,label:s,showValue:c=!0,showTicks:u=!1,formatValue:p,ariaLabel:h,className:f,style:m,...g},x)=>{const y=J(),b=qe(),v=Math.min(t,n),w=Math.max(t,n),k=(C=w,($=e)<(S=v)?S:$>C?C:$);var $,S,C;const z=w-v||1,M=(k-v)/z,{start:N,end:D,sweep:R}=Rd[i],P=N+R*M,F=r/2,A=r/2,I=(r-o)/2,[L,T]=(0,a.useState)(M),W=(0,a.useRef)(null),j=(0,a.useRef)(M),E=(0,a.useRef)(M),B=(0,a.useRef)(0);(0,a.useEffect)(()=>{if(b)return void T(M);j.current=L,E.current=M,B.current="undefined"!=typeof performance?performance.now():Date.now();const e=t=>{const n=Math.min(1,(t-B.current)/400),r=1-Math.pow(1-n,3);T(j.current+(E.current-j.current)*r),n<1&&(W.current=requestAnimationFrame(e))};return"undefined"!=typeof requestAnimationFrame?W.current=requestAnimationFrame(e):T(M),()=>{null!=W.current&&"undefined"!=typeof cancelAnimationFrame&&cancelAnimationFrame(W.current)}},[M,b]);const V=N+R*L,H=Fd(F,A,I,N,D),O=[];if(l&&l.length>0){const e=[...l].sort((e,t)=>e.at-t.at),t=[v];for(const n of e)n.at>v&&n.at<w&&t.push(n.at);t.push(w);for(let n=0;n<t.length-1;n++){const e=t[n],r=N+R*((e-v)/z),o=N+R*((t[n+1]-v)/z),i=Math.min(o,V);if(i<=r)continue;const a=Ad(e+1e-4,l,y.primary);O.push({d:Fd(F,A,I,r,i),color:a})}}else O.push({d:Fd(F,A,I,N,V),color:y.primary});const q=Ad(k,l,y.primary),U=[];if(u){const e=5,t=I+o/2+1,n=I+o/2-4,r=I+o/2-2,i=10*e;for(let o=0;o<=i;o++){const a=o%e===0,l=N+R*o/i,s=Pd(F,A,t,l),c=Pd(F,A,a?n:r,l);U.push((0,d.jsx)("line",{x1:s.x.toFixed(2),y1:s.y.toFixed(2),x2:c.x.toFixed(2),y2:c.y.toFixed(2),stroke:y.textMuted,strokeWidth:a?1.5:.75,strokeLinecap:"round","data-tkx-gauge-tick":a?"major":"minor"},o))}}const K=p?p(k):String(k);return(0,d.jsxs)("div",{ref:x,role:"meter","aria-valuenow":k,"aria-valuemin":v,"aria-valuemax":w,"aria-valuetext":K,"aria-label":h??s??"Gauge",className:Ct($t("inline-flex flex-col items-center"),f),style:m,"data-tkx-gauge-variant":i,"data-tkx-reduced-motion":b?"true":"false",...g,children:[(0,d.jsxs)("svg",{width:r,height:r,viewBox:`0 0 ${r} ${r}`,"aria-hidden":"true",style:{display:"block",overflow:"visible"},children:[(0,d.jsx)("path",{d:H,fill:"none",stroke:y.border,strokeWidth:o,strokeLinecap:"round","data-tkx-gauge-track":""}),O.map((e,t)=>(0,d.jsx)("path",{d:e.d,fill:"none",stroke:e.color,strokeWidth:o,strokeLinecap:"round","data-tkx-gauge-segment":""},t)),u&&(0,d.jsx)("g",{"data-tkx-gauge-ticks":"",children:U}),c&&(0,d.jsx)("text",{x:F,y:A+("speedometer"===i?4:6),textAnchor:"middle",dominantBaseline:"middle",fill:q,style:{fontSize:.18*r+"px",fontWeight:700,fontFamily:"inherit",fontVariantNumeric:"tabular-nums"},"data-tkx-gauge-value":"",children:K})]}),s&&(0,d.jsx)("span",{className:$t("text-sm"),style:{color:y.textMuted,marginTop:"-8px"},"data-tkx-gauge-label":"",children:s}),(0,d.jsx)("span",{hidden:!0,"data-tkx-gauge-target-angle":P.toFixed(2)})]})});function Ld(e){const t=new Set,n=[];for(const r of e){const e=String(r);t.has(e)||(t.add(e),n.push(r))}return n.every(e=>"number"==typeof e||/^-?\d+(\.\d+)?$/.test(String(e)))?n.sort((e,t)=>Number(e)-Number(t)):n.sort((e,t)=>String(e).localeCompare(String(t)))}function Td(e){const t=e.replace("#",""),n=3===t.length?t.split("").map(e=>e+e).join(""):t,r=parseInt(n.slice(0,2),16),o=parseInt(n.slice(2,4),16),i=parseInt(n.slice(4,6),16);return[isNaN(r)?0:r,isNaN(o)?0:o,isNaN(i)?0:i]}function Wd(e,t,n){return e+(t-e)*n}function jd(e,t){if(0===e.length)return"#000000";if(1===e.length)return e[0];if(t<=0)return e[0];if(t>=1)return e[e.length-1];const n=t*(e.length-1),r=Math.floor(n),o=n-r;return function(e,t,n){const[r,o,i]=Td(e),[a,l,s]=Td(t);return function(e,t,n){const r=e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0");return`#${r(e)}${r(t)}${r(n)}`}(Wd(r,a,n),Wd(o,l,n),Wd(i,s,n))}(e[r],e[r+1],o)}function Ed(e,t,n,r){const[o,i]=t,a=i-o,l=0===a?.5:Math.max(0,Math.min(1,(e-o)/a));return Array.isArray(n)?jd(n.length>0?n:[r],l):jd("diverging"===n?["#d7191c","#ffffff","#2c7bb6"]:["#f7fbff",r],l)}function Bd(e){return I(e)>.179?"#000000":"#ffffff"}Id.displayName="TkxGauge";var Vd=(0,a.forwardRef)(({data:e,xLabels:t,yLabels:n,cellSize:r=32,gap:o=2,colorScale:i="sequential",domain:a,showValues:l=!1,showLegend:s=!0,legendPosition:c="right",formatValue:u,emptyCellColor:p,ariaLabel:h,onCellClick:f,className:m,style:g,...x},y)=>{const b=J(),v=Array.isArray(e)?e:[],w=u??(e=>String(e)),k=p??b.surfaceAlt;if(!(0!==v.length||t&&0!==t.length||n&&0!==n.length))return(0,d.jsxs)("div",{ref:y,role:"img","aria-label":h??"Heatmap with no data",className:Ct($t("inline-flex items-center justify-center"),m),style:{color:b.textMuted,fontSize:12,padding:16,...g},"data-tkx-heatmap-empty":"",...x,children:[(0,d.jsx)("svg",{width:4*r,height:2*r,"aria-hidden":"true"}),(0,d.jsx)("span",{style:{marginLeft:8},children:"No data"})]});const $=t??Ld(v.map(e=>e.x)),S=n??Ld(v.map(e=>e.y)),C=v.map(e=>e.value),z=C.length>0?Math.min(...C):0,M=C.length>0?Math.max(...C):1,[N,D]=a??[z,M],R=[N,D],P=new Map;for(const d of v)P.set(`${String(d.x)}\0${String(d.y)}`,d);const F=S.reduce((e,t)=>Math.max(e,String(t).length),0),A=Math.max(24,7*F+8),I=$.reduce((e,t)=>Math.max(e,String(t).length),0),L=7*I>r+o,T=L?Math.min(80,5*I+12):18,W=$.length*r+Math.max(0,$.length-1)*o,j=S.length*r+Math.max(0,S.length-1)*o,E=10,B=s&&"right"===c,V=s&&"bottom"===c,H=A+W+(B?58:0)+4,O=j+T+(V?36:0)+4,q=A,U=w(R[0]),K=w(R[1]),Y=h??`Heatmap with ${$.length}×${S.length} cells, values from ${U} to ${K}`,Z=[];for(let J=0;J<S.length;J++){const e=String(S[J]);for(let t=0;t<$.length;t++){const n=String($[t]),a=P.get(`${n}\0${e}`),s=q+t*(r+o),c=2+J*(r+o),u=a?Ed(a.value,R,i,b.primary):k,p=!!f&&!!a,h=a?`${n} × ${e}: ${a.label??w(a.value)}`:`${n} × ${e}: no data`,m=p?()=>f(a):void 0;Z.push((0,d.jsxs)("g",{"data-tkx-heatmap-cell":"","data-x":n,"data-y":e,"data-empty":a?void 0:"",onClick:m,style:{cursor:p?"pointer":"default"},children:[(0,d.jsx)("rect",{x:s,y:c,width:r,height:r,fill:u,rx:2,ry:2,children:(0,d.jsx)("title",{children:h})}),l&&a&&(0,d.jsx)("text",{x:s+r/2,y:c+r/2,textAnchor:"middle",dominantBaseline:"central",fill:Bd(u),style:{fontSize:Math.max(9,Math.min(13,.35*r)),fontFamily:"inherit",fontVariantNumeric:"tabular-nums",pointerEvents:"none"},"data-tkx-heatmap-value":"",children:a.label??w(a.value)})]},`${t}-${J}`))}}const X=S.map((e,t)=>(0,d.jsx)("text",{x:A-6,y:2+t*(r+o)+r/2,textAnchor:"end",dominantBaseline:"central",fill:b.textMuted,style:{fontSize:11,fontFamily:"inherit"},"data-tkx-heatmap-ylabel":"",children:String(e)},`y-${t}`)),G=2+j+12,_=$.map((e,t)=>{const n=q+t*(r+o)+r/2;return L?(0,d.jsx)("text",{x:n,y:G,textAnchor:"end",dominantBaseline:"hanging",fill:b.textMuted,transform:`rotate(-45 ${n} ${G})`,style:{fontSize:11,fontFamily:"inherit"},"data-tkx-heatmap-xlabel":"",children:String(e)},`x-${t}`):(0,d.jsx)("text",{x:n,y:G,textAnchor:"middle",dominantBaseline:"hanging",fill:b.textMuted,style:{fontSize:11,fontFamily:"inherit"},"data-tkx-heatmap-xlabel":"",children:String(e)},`x-${t}`)});let Q=null;if(s){const e=Array.from({length:32},(e,t)=>Ed(R[0]+t/31*(R[1]-R[0]),R,i,b.primary));if(B){const t=q+W+12,n=2,r=j,o=r/32;Q=(0,d.jsxs)("g",{"data-tkx-heatmap-legend":"right",children:[e.map((e,r)=>(0,d.jsx)("rect",{x:t,y:n+(31-r)*o,width:E,height:o+.5,fill:e},r)),(0,d.jsx)("text",{x:t+E+4,y:n,dominantBaseline:"hanging",fill:b.textMuted,style:{fontSize:10,fontFamily:"inherit"},"data-tkx-heatmap-legend-max":"",children:K}),(0,d.jsx)("text",{x:t+E+4,y:n+r,dominantBaseline:"auto",fill:b.textMuted,style:{fontSize:10,fontFamily:"inherit"},"data-tkx-heatmap-legend-min":"",children:U})]})}else if(V){const t=q,n=2+j+T+12,r=W,o=r/32;Q=(0,d.jsxs)("g",{"data-tkx-heatmap-legend":"bottom",children:[e.map((e,r)=>(0,d.jsx)("rect",{x:t+r*o,y:n,width:o+.5,height:E,fill:e},r)),(0,d.jsx)("text",{x:t,y:n+E+11,textAnchor:"start",fill:b.textMuted,style:{fontSize:10,fontFamily:"inherit"},"data-tkx-heatmap-legend-min":"",children:U}),(0,d.jsx)("text",{x:t+r,y:n+E+11,textAnchor:"end",fill:b.textMuted,style:{fontSize:10,fontFamily:"inherit"},"data-tkx-heatmap-legend-max":"",children:K})]})}}return(0,d.jsx)("div",{ref:y,className:Ct($t("inline-block"),m),style:g,"data-tkx-heatmap":"",...x,children:(0,d.jsxs)("svg",{role:"img","aria-label":Y,width:H,height:O,viewBox:`0 0 ${H} ${O}`,style:{display:"block",overflow:"visible"},children:[(0,d.jsx)("g",{"data-tkx-heatmap-ylabels":"",children:X}),(0,d.jsx)("g",{"data-tkx-heatmap-cells":"",children:Z}),(0,d.jsx)("g",{"data-tkx-heatmap-xlabels":"",children:_}),Q]})})});Vd.displayName="TkxHeatmap";var Hd=["#00f5d4","#3a86ff","#7b2ff7","#f72585","#ffbe0b","#06d6a0"];function Od(e){return I(e)>.179?"#000000":"#ffffff"}var qd=(0,a.forwardRef)(({data:e,width:t=400,height:n=300,orientation:r="vertical",colors:o,showValues:i=!0,showPercentages:a=!0,formatValue:l,gap:s=4,ariaLabel:c,onStageClick:u,className:p,style:h,...f},m)=>{const g=J(),x=Array.isArray(e)?e:[],y=o&&o.length>0?o:Hd,b=l??(e=>String(e));if(0===x.length)return(0,d.jsx)("div",{ref:m,role:"img","aria-label":c??"Funnel chart with no stages",className:Ct($t("inline-block"),p),style:h,"data-tkx-funnel-empty":"",...f,children:(0,d.jsx)("svg",{width:t,height:n,viewBox:`0 0 ${t} ${n}`,"aria-hidden":"true"})});const v=Math.max(x[0].value,1e-4),w=x[x.length-1].value,k=v>0?Math.round((v-w)/v*100):0,$=x.map(e=>Math.max(.04,Math.min(1,e.value/v))),S="vertical"===r,C=c??(1===x.length?`Funnel chart with 1 stage, value ${b(x[0].value)}`:`Funnel chart with ${x.length} stages, top value ${b(x[0].value)}, bottom value ${b(w)}, total drop-off ${k}%`),z=a&&x.length>1?28:0,M=[],N=[],D=[];if(S){const e=t-110,r=(n-s*Math.max(0,x.length-1))/x.length,o=e/2;x.forEach((t,n)=>{const l=0===n?1:$[n-1],c=$[n],p=l*e/2,h=c*e/2,f=n*(r+s),m=f+r,v=t.color??y[n%y.length],w=1===x.length,k=w?o+h:o+p,S=o-h,C=o+h,z=`M${(w?o-h:o-p).toFixed(2)},${f.toFixed(2)} L${k.toFixed(2)},${f.toFixed(2)} L${C.toFixed(2)},${m.toFixed(2)} L${S.toFixed(2)},${m.toFixed(2)} Z`,R=!!u,P=R?()=>u(t,n):void 0,F=Od(v);if(M.push((0,d.jsxs)("g",{"data-tkx-funnel-stage":"","data-index":n,onClick:P,style:{cursor:R?"pointer":"default"},children:[(0,d.jsx)("path",{d:z,fill:v,"data-tkx-funnel-shape":"",children:(0,d.jsx)("title",{children:`${t.label}: ${b(t.value)}`})}),i&&(0,d.jsx)("text",{x:o,y:(f+m)/2,textAnchor:"middle",dominantBaseline:"central",fill:F,style:{fontSize:12,fontFamily:"inherit",fontWeight:600,fontVariantNumeric:"tabular-nums",pointerEvents:"none"},"data-tkx-funnel-value":"",children:b(t.value)})]},`stage-${n}`)),N.push((0,d.jsx)("text",{x:e+8,y:(f+m)/2,textAnchor:"start",dominantBaseline:"central",fill:g.text,style:{fontSize:12,fontFamily:"inherit"},"data-tkx-funnel-label":"",children:t.label},`label-${n}`)),a&&n<x.length-1){const r=x[n+1],o=t.value>0?Math.round((t.value-r.value)/t.value*100):0;D.push((0,d.jsx)("text",{x:e+8,y:m+s/2,textAnchor:"start",dominantBaseline:"central",fill:g.textMuted,style:{fontSize:10,fontFamily:"inherit",fontVariantNumeric:"tabular-nums"},"data-tkx-funnel-pct":"",children:o>=0?`−${o}%`:`+${Math.abs(o)}%`},`pct-${n}`))}})}else{const e=n-110,r=(t-s*Math.max(0,x.length-1))/x.length,o=e/2;x.forEach((t,n)=>{const l=0===n?1:$[n-1],c=$[n],p=l*e/2,h=c*e/2,f=n*(r+s),m=f+r,v=t.color??y[n%y.length],w=1===x.length,k=w?o-h:o-p,S=w?o+h:o+p,C=o-h,z=o+h,R=`M${f.toFixed(2)},${k.toFixed(2)} L${f.toFixed(2)},${S.toFixed(2)} L${m.toFixed(2)},${z.toFixed(2)} L${m.toFixed(2)},${C.toFixed(2)} Z`,P=!!u,F=P?()=>u(t,n):void 0,A=Od(v);if(M.push((0,d.jsxs)("g",{"data-tkx-funnel-stage":"","data-index":n,onClick:F,style:{cursor:P?"pointer":"default"},children:[(0,d.jsx)("path",{d:R,fill:v,"data-tkx-funnel-shape":"",children:(0,d.jsx)("title",{children:`${t.label}: ${b(t.value)}`})}),i&&(0,d.jsx)("text",{x:(f+m)/2,y:o,textAnchor:"middle",dominantBaseline:"central",fill:A,style:{fontSize:12,fontFamily:"inherit",fontWeight:600,fontVariantNumeric:"tabular-nums",pointerEvents:"none"},"data-tkx-funnel-value":"",children:b(t.value)})]},`stage-${n}`)),N.push((0,d.jsx)("text",{x:(f+m)/2,y:e+16,textAnchor:"middle",dominantBaseline:"hanging",fill:g.text,style:{fontSize:12,fontFamily:"inherit"},"data-tkx-funnel-label":"",children:t.label},`label-${n}`)),a&&n<x.length-1){const r=x[n+1],o=t.value>0?Math.round((t.value-r.value)/t.value*100):0;D.push((0,d.jsx)("text",{x:m+s/2,y:e+36,textAnchor:"middle",dominantBaseline:"hanging",fill:g.textMuted,style:{fontSize:10,fontFamily:"inherit",fontVariantNumeric:"tabular-nums"},"data-tkx-funnel-pct":"",children:o>=0?`−${o}%`:`+${Math.abs(o)}%`},`pct-${n}`))}})}return(0,d.jsxs)("div",{ref:m,className:Ct($t("inline-block"),p),style:h,"data-tkx-funnel":"","data-orientation":r,...f,children:[(0,d.jsxs)("svg",{role:"img","aria-label":C,width:t,height:n,viewBox:`0 0 ${t} ${n}`,style:{display:"block",overflow:"visible"},children:[(0,d.jsx)("g",{"data-tkx-funnel-stages":"",children:M}),(0,d.jsx)("g",{"data-tkx-funnel-labels":"",children:N}),a&&x.length>1&&(0,d.jsx)("g",{"data-tkx-funnel-pcts":"",children:D})]}),(0,d.jsx)("span",{hidden:!0,"data-tkx-funnel-pct-area":z})]})});qd.displayName="TkxFunnelChart";var Ud=["#00f5d4","#3a86ff","#7b2ff7","#f72585","#ffbe0b","#06d6a0","#ef476f","#118ab2"];function Kd(e){return I(e)>.179?"#000000":"#ffffff"}function Yd(e,t){if(0===e.length)return 1/0;const n=e.reduce((e,t)=>e+t,0),r=n*n,o=t*t;let i=-1/0,a=1/0,l=-1/0;for(const c of e)c>l&&(l=c),c<a&&(a=c);if(0===r)return 1/0;const s=o*l/r,d=r/(o*a);return i=Math.max(s,d),i}function Zd(e,t,n){const r=[],o=t.w>=t.h,i=Math.min(t.w,t.h),a=e.reduce((e,t)=>e+t.value,0),l=0===i?0:a/i;if(o){let o=t.y;for(const i of e){const s=0===a?t.h/e.length:i.value/a*t.h;r.push({x:t.x,y:o,w:l,h:s,node:i.node,origIndex:i.origIndex,path:[...n,i.origIndex]}),o+=s}return{placed:r,remaining:{x:t.x+l,y:t.y,w:t.w-l,h:t.h}}}let s=t.x;for(const d of e){const o=0===a?t.w/e.length:d.value/a*t.w;r.push({x:s,y:t.y,w:o,h:l,node:d.node,origIndex:d.origIndex,path:[...n,d.origIndex]}),s+=o}return{placed:r,remaining:{x:t.x,y:t.y+l,w:t.w,h:t.h-l}}}var Xd=(0,a.forwardRef)(({data:e,width:t=600,height:n=400,colors:r,showLabels:o=!0,showValues:i=!1,minLabelSize:a=80,formatValue:l,ariaLabel:s,onNodeClick:c,className:u,style:p,...h},f)=>{const m=J(),g=Array.isArray(e)?e:[],x=r&&r.length>0?r:Ud,y=l??(e=>String(e));if(0===g.length)return(0,d.jsx)("div",{ref:f,role:"img","aria-label":s??"Treemap with no data",className:Ct($t("inline-block"),u),style:p,"data-tkx-treemap-empty":"",...h,children:(0,d.jsx)("svg",{width:t,height:n,viewBox:`0 0 ${t} ${n}`,"aria-hidden":"true"})});const b=g.reduce((e,t)=>e+Math.max(0,t.value),0),v=s??`Treemap with ${g.length} node${1===g.length?"":"s"}, total value ${y(b)}`,w=(e,t,n,r)=>{const l=function(e,t,n){const r=e.map((e,t)=>({node:e,value:Math.max(0,e.value),origIndex:t})).filter(e=>e.value>0);if(0===r.length)return[];if(1===r.length)return[{x:t.x,y:t.y,w:t.w,h:t.h,node:r[0].node,origIndex:r[0].origIndex,path:[...n,r[0].origIndex]}];const o=[...r].sort((e,t)=>t.value-e.value),i=o.reduce((e,t)=>e+t.value,0),a=t.w*t.h,l=0===i?0:a/i;return function(e,t,n){const r=[];let o={...t},i=[...e];for(;i.length>0;){const e=Math.min(o.w,o.h);if(e<=0)break;const t=[],a=[];let l=0;for(;l<i.length;){const n=i[l],r=[...a,n.value],o=0===t.length?1/0:Yd(a,e),s=Yd(r,e);if(!(0===t.length||s<=o))break;t.push(n),a.push(n.value),l+=1}if(0===t.length)break;const{placed:s,remaining:d}=Zd(t,o,n);r.push(...s),i=i.slice(t.length),o=d}return r}(o.map(e=>({...e,value:e.value*l})),t,n)}(e,t,n),s=[];for(const u of l){const e=u.node.color??x[u.origIndex%x.length],t=u.w*u.h,n=o&&t>=a,l=u.node.label,p=Kd(e),h=!!c,f=h?e=>{e.stopPropagation(),c(u.node,u.path)}:void 0,g=Array.isArray(u.node.children)&&u.node.children.length>0,b=g?{x:u.x+1,y:u.y+(n?16:1),w:Math.max(0,u.w-2),h:Math.max(0,u.h-(n?17:2))}:u;s.push((0,d.jsxs)("g",{"data-tkx-treemap-node":"","data-depth":r,"data-label":l,onClick:f,style:{cursor:h?"pointer":"default"},children:[(0,d.jsx)("rect",{x:u.x,y:u.y,width:u.w,height:u.h,fill:e,stroke:m.bg,strokeWidth:1,"data-tkx-treemap-rect":"",children:(0,d.jsx)("title",{children:`${l}: ${y(u.node.value)}`})}),n&&(0,d.jsx)("text",{x:u.x+4,y:u.y+(g?12:14),fill:p,style:{fontSize:11,fontFamily:"inherit",fontWeight:600,pointerEvents:"none"},"data-tkx-treemap-label":"",children:l}),n&&i&&!g&&t>=1.5*a&&(0,d.jsx)("text",{x:u.x+4,y:u.y+26,fill:p,style:{fontSize:10,fontFamily:"inherit",fontVariantNumeric:"tabular-nums",opacity:.85,pointerEvents:"none"},"data-tkx-treemap-value":"",children:y(u.node.value)}),g&&b.w>4&&b.h>4&&(0,d.jsx)("g",{"data-tkx-treemap-children":"",children:w(u.node.children,b,u.path,r+1)})]},`d${r}-${u.path.join("-")}`))}return s},k=w(g,{x:0,y:0,w:t,h:n},[],0);return(0,d.jsx)("div",{ref:f,className:Ct($t("inline-block"),u),style:p,"data-tkx-treemap":"",...h,children:(0,d.jsx)("svg",{role:"img","aria-label":v,width:t,height:n,viewBox:`0 0 ${t} ${n}`,style:{display:"block",overflow:"visible"},children:k})})});function Gd(e){if(e instanceof Date)return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()));const t=/^(\d{4})-(\d{2})-(\d{2})/.exec(e);if(!t)throw new Error(`TkxGantt: invalid date "${e}" (expected YYYY-MM-DD)`);return new Date(Date.UTC(+t[1],+t[2]-1,+t[3]))}function _d(e){return`${e.getUTCFullYear()}-${String(e.getUTCMonth()+1).padStart(2,"0")}-${String(e.getUTCDate()).padStart(2,"0")}`}Xd.displayName="TkxTreemap";var Jd=864e5;function Qd(e,t){return Math.round((t.getTime()-e.getTime())/Jd)}function ec(e,t){return new Date(e.getTime()+t*Jd)}function tc(e){return e.toLocaleString("en",{month:"short",timeZone:"UTC"})}function nc(e,t){e.sum+=t,e.count+=1,t<e.min&&(e.min=t),t>e.max&&(e.max=t)}function rc(e,t){if(0===e.count)return null;switch(t){case"sum":return e.sum;case"avg":return e.sum/e.count;case"min":return e.min;case"max":return e.max;case"count":return e.count}}function oc(e,t){return t.map(t=>String(e[t]??""))}function ic(e){return e.label??("count"===e.agg?"count":`${e.agg}(${e.field??""})`)}var ac=e=>Number.isFinite(e)?Number.isInteger(e)?String(e):String(Math.round(1e4*e)/1e4):"";function lc(){return{keys:[],children:new Map}}function sc(e,t){let n=e.children.get(t);return n||(n=lc(),e.children.set(t,n),e.keys.push(t)),n}function dc(e,t,n){e.keys.sort((e,r)=>n(e,r,t));for(const r of e.keys)dc(e.children.get(r),t+1,n)}function cc(e,t,n=[]){if(0===t)return[n];const r=[];for(const o of e.keys)r.push(...cc(e.children.get(o),t-1,[...n,o]));return r}var uc=(e,t)=>e<t?-1:e>t?1:0,pc=/^([A-Z]+)([0-9]+)$/;function hc(e){let t="",n=e;for(;t=String.fromCharCode(65+n%26)+t,n=Math.floor(n/26)-1,!(n<0););return t}function fc(e){let t=0;for(let n=0;n<e.length;n++)t=26*t+(e.charCodeAt(n)-64);return t-1}function mc(e,t){return`${hc(e)}${t+1}`}function gc(e){const t=pc.exec(e);return t?{col:fc(t[1]),row:+t[2]-1}:null}function xc(e,t){return yc(e,{cells:t,stack:new Set,memo:new Map})}function yc(e,t){if(t.memo.has(e))return t.memo.get(e);if(t.stack.has(e))return"#CYCLE!";const n=t.cells[e];if(void 0===n||""===n)return"";let r;if(n.startsWith("=")){t.stack.add(e);try{r=function(e,t){const n=function(e){const t=[];let n=e.trim();for(;n.length;){if(" "===n[0]){n=n.slice(1);continue}if("("===n[0]||")"===n[0]){t.push({type:"paren",value:n[0]}),n=n.slice(1);continue}if(","===n[0]){t.push({type:"comma"}),n=n.slice(1);continue}if("+-*/^".includes(n[0])){t.push({type:"op",value:n[0]}),n=n.slice(1);continue}let e;if(e=bc.exec(n),e)t.push({type:"fn",name:e[1]}),t.push({type:"paren",value:"("}),n=n.slice(e[0].length);else if(e=vc.exec(n),e)t.push({type:"range",from:e[1],to:e[2]}),n=n.slice(e[0].length);else if(e=wc.exec(n),e)t.push({type:"ref",addr:e[1]}),n=n.slice(e[0].length);else{if(e=kc.exec(n),!e)throw new Error(`Unexpected token at "${n}"`);t.push({type:"num",value:+e[0]}),n=n.slice(e[0].length)}}return t}(e),r={tokens:n,pos:0},o=zc(r,t,0);if(r.pos!==n.length)throw new Error("Trailing tokens");return o}(n.slice(1),t)}catch{r="#ERROR!"}t.stack.delete(e)}else{const e=Number(n);r=Number.isFinite(e)&&""!==n.trim()?e:n}return t.memo.set(e,r),r}var bc=/^([A-Z][A-Z0-9_]*)\s*\(/,vc=/^([A-Z]+[0-9]+):([A-Z]+[0-9]+)/,wc=/^([A-Z]+[0-9]+)/,kc=/^(\d+(?:\.\d+)?|\.\d+)/;function $c(e){return e.tokens[e.pos]??null}function Sc(e){return e.tokens[e.pos++]}var Cc={"+":1,"-":1,"*":2,"/":2,"^":3};function zc(e,t,n){let r=function(e,t){const n=Sc(e);if(!n)throw new Error("Unexpected end of formula");switch(n.type){case"num":return n.value;case"ref":return yc(n.addr,t);case"range":throw new Error("Range used outside a function");case"op":if("-"===n.value||"+"===n.value){const r=Nc(zc(e,t,4));return"-"===n.value?-r:r}throw new Error(`Unexpected operator ${n.value}`);case"paren":{if("("!==n.value)throw new Error("Unexpected )");const r=zc(e,t,0),o=Sc(e);if(!o||"paren"!==o.type||")"!==o.value)throw new Error("Missing )");return r}case"fn":{const r=[],o=Sc(e);if(!o||"paren"!==o.type||"("!==o.value)throw new Error("Function missing (");if("paren"===$c(e)?.type&&")"===$c(e).value)return Sc(e),Rc(n.name,r);for(;;){const n=$c(e);n&&"range"===n.type?(Sc(e),r.push(Mc(n.from,n.to,t))):r.push([zc(e,t,0)]);const o=$c(e);if(!o||"comma"!==o.type)break;Sc(e)}const i=Sc(e);if(!i||"paren"!==i.type||")"!==i.value)throw new Error("Function missing )");return Rc(n.name,r)}default:throw new Error(`Unexpected token ${n.type}`)}}(e,t);for(;;){const o=$c(e);if(!o||"op"!==o.type)break;const i=Cc[o.value];if(void 0===i||i<n)break;Sc(e);const a=zc(e,t,i+1);r=Dc(o.value,r,a)}return r}function Mc(e,t,n){const r=gc(e),o=gc(t);if(!r||!o)return["#REF!"];const i=Math.min(r.col,o.col),a=Math.max(r.col,o.col),l=Math.min(r.row,o.row),s=Math.max(r.row,o.row),d=[];for(let c=i;c<=a;c++)for(let e=l;e<=s;e++)d.push(yc(mc(c,e),n));return d}function Nc(e){if("number"==typeof e)return e;if("string"==typeof e&&e.startsWith("#"))throw new Error(e);const t=Number(e);return Number.isFinite(t)?t:0}function Dc(e,t,n){const r=Nc(t),o=Nc(n);switch(e){case"+":return r+o;case"-":return r-o;case"*":return r*o;case"/":return 0===o?"#DIV/0!":r/o;case"^":return Math.pow(r,o);default:throw new Error(`Unknown op ${e}`)}}function Rc(e,t){const n=t.flat().filter(e=>"number"==typeof e||"string"==typeof e&&""!==e&&!e.startsWith("#")).map(Nc);switch(e.toUpperCase()){case"SUM":return n.reduce((e,t)=>e+t,0);case"AVG":case"AVERAGE":return 0===n.length?0:n.reduce((e,t)=>e+t,0)/n.length;case"MIN":return 0===n.length?0:Math.min(...n);case"MAX":return 0===n.length?0:Math.max(...n);case"COUNT":return n.length;case"ROUND":{const e=Nc(t[0]?.[0]??0),n=t[1]?Nc(t[1][0]):0,r=Math.pow(10,n);return Math.round(e*r)/r}case"IF":{const e=Nc(t[0]?.[0]??0),n=t[1]?.[0]??"",r=t[2]?.[0]??"";return e?n:r}default:return"#NAME?"}}var Pc=["text","email","number","textarea","select","radio","checkbox","date"],Fc={text:"Text",email:"Email",number:"Number",textarea:"Long text",select:"Dropdown",radio:"Radio group",checkbox:"Checkbox",date:"Date"},Ac={text:"🔤",email:"✉️",number:"#️⃣",textarea:"📝",select:"🔽",radio:"🔘",checkbox:"☑️",date:"📅"};function Ic(e,t){return`${Fc[e]} ${t}`}function Lc(e,t){return`${e}_${t}`}function Tc(e,t){const n=null==t||""===t||Array.isArray(t)&&0===t.length;if(e.required&&n)return`${e.label} is required`;if(n)return null;if("email"===e.type&&"string"==typeof t&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t))return"Invalid email";if("number"===e.type&&"string"==typeof t){const n=Number(t);if(Number.isNaN(n))return"Must be a number";if(void 0!==e.min&&n<e.min)return`Must be ≥ ${e.min}`;if(void 0!==e.max&&n>e.max)return`Must be ≤ ${e.max}`}if(e.pattern&&"string"==typeof t)try{if(!new RegExp(e.pattern).test(t))return"Format is invalid"}catch{}return null}function Wc({types:e,onAdd:t}){return(0,d.jsxs)("div",{role:"toolbar","aria-label":"Field types",style:{display:"flex",flexDirection:"column",gap:6,padding:12,borderRight:"1px solid var(--tkx-border, #2a2a3e)",minWidth:180,background:"var(--tkx-bg-subtle, #0d0d14)"},children:[(0,d.jsx)("div",{style:{fontSize:11,fontWeight:700,letterSpacing:"0.06em",textTransform:"uppercase",color:"#888",marginBottom:4},children:"Add field"}),e.map(e=>(0,d.jsxs)("button",{type:"button","data-testid":`palette-${e}`,onClick:()=>t(e),style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px",minHeight:44,borderRadius:6,border:"1px solid var(--tkx-border, #2a2a3e)",background:"transparent",color:"var(--tkx-fg, #e8e8f4)",fontSize:13,cursor:"pointer",textAlign:"left"},children:[(0,d.jsx)("span",{"aria-hidden":"true",children:Ac[e]}),(0,d.jsx)("span",{children:Fc[e]})]},e))]})}function jc({fields:e,selectedId:t,onSelect:n,onMove:r,onRemove:o}){return(0,d.jsxs)("div",{role:"list","aria-label":"Form fields",style:{flex:1,padding:16,display:"flex",flexDirection:"column",gap:8,minWidth:0,overflowY:"auto"},children:[0===e.length&&(0,d.jsx)("div",{style:{padding:32,textAlign:"center",color:"#888",border:"1px dashed var(--tkx-border, #2a2a3e)",borderRadius:8},children:"No fields yet — pick one from the palette to get started."}),e.map((i,a)=>{const l=i.id===t;return(0,d.jsxs)("div",{role:"listitem","data-testid":`canvas-field-${i.id}`,onClick:()=>n(i.id),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n(i.id))},tabIndex:0,"aria-selected":l,style:{padding:12,borderRadius:8,border:"1px solid "+(l?"var(--tkx-accent, #00f5d4)":"var(--tkx-border, #2a2a3e)"),background:l?"rgba(0,245,212,0.06)":"var(--tkx-bg-subtle, #12121a)",cursor:"pointer",display:"flex",alignItems:"center",gap:12},children:[(0,d.jsx)("span",{"aria-hidden":"true",style:{fontSize:18},children:Ac[i.type]}),(0,d.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,d.jsxs)("div",{style:{fontWeight:600,fontSize:14,color:"var(--tkx-fg, #e8e8f4)"},children:[i.label,i.required&&(0,d.jsx)("span",{"aria-hidden":"true",style:{color:"#ff006e",marginLeft:4},children:"*"})]}),(0,d.jsxs)("div",{style:{fontSize:11,color:"#888",fontFamily:"ui-monospace, monospace"},children:[i.type," · ",i.name]})]}),(0,d.jsxs)("div",{style:{display:"flex",gap:4},children:[(0,d.jsx)("button",{type:"button","aria-label":`Move ${i.label} up`,disabled:0===a,onClick:e=>{e.stopPropagation(),r(i.id,-1)},style:Ec,children:"↑"}),(0,d.jsx)("button",{type:"button","aria-label":`Move ${i.label} down`,disabled:a===e.length-1,onClick:e=>{e.stopPropagation(),r(i.id,1)},style:Ec,children:"↓"}),(0,d.jsx)("button",{type:"button","aria-label":`Remove ${i.label}`,onClick:e=>{e.stopPropagation(),o(i.id)},style:{...Ec,color:"#ff006e"},children:"✕"})]})]},i.id)})]})}var Ec={width:32,height:32,borderRadius:6,border:"1px solid var(--tkx-border, #2a2a3e)",background:"transparent",color:"var(--tkx-fg, #e8e8f4)",cursor:"pointer",fontSize:14,display:"inline-flex",alignItems:"center",justifyContent:"center"};function Bc({field:e,onPatch:t}){if(!e)return(0,d.jsx)("div",{style:{minWidth:260,padding:16,borderLeft:"1px solid var(--tkx-border, #2a2a3e)",background:"var(--tkx-bg-subtle, #0d0d14)",color:"#888",fontSize:13},children:"Select a field to edit its properties."});const n="select"===e.type||"radio"===e.type,r="text"===e.type||"email"===e.type,o="number"===e.type;return(0,d.jsxs)("div",{style:{minWidth:260,padding:16,borderLeft:"1px solid var(--tkx-border, #2a2a3e)",background:"var(--tkx-bg-subtle, #0d0d14)",display:"flex",flexDirection:"column",gap:12,overflowY:"auto"},children:[(0,d.jsx)("div",{style:{fontSize:11,fontWeight:700,letterSpacing:"0.06em",textTransform:"uppercase",color:"#888"},children:"Properties"}),(0,d.jsx)(Vc,{label:"Label",value:e.label,onChange:e=>t({label:e})}),(0,d.jsx)(Vc,{label:"Name (key)",value:e.name,onChange:e=>t({name:e.replace(/[^a-zA-Z0-9_]/g,"_")})}),(0,d.jsx)(Vc,{label:"Placeholder",value:e.placeholder??"",onChange:e=>t({placeholder:e})}),(0,d.jsx)(Vc,{label:"Help text",value:e.helpText??"",onChange:e=>t({helpText:e})}),(0,d.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,color:"var(--tkx-fg, #e8e8f4)"},children:[(0,d.jsx)("input",{type:"checkbox",checked:!!e.required,onChange:e=>t({required:e.target.checked})}),"Required"]}),o&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(Vc,{label:"Min",value:e.min?.toString()??"",onChange:e=>t({min:""===e?void 0:Number(e)}),type:"number"}),(0,d.jsx)(Vc,{label:"Max",value:e.max?.toString()??"",onChange:e=>t({max:""===e?void 0:Number(e)}),type:"number"})]}),r&&(0,d.jsx)(Vc,{label:"Pattern (regex)",value:e.pattern??"",onChange:e=>t({pattern:e||void 0})}),n&&(0,d.jsx)(Hc,{options:e.options??[],onChange:e=>t({options:e})})]})}function Vc({label:e,value:t,onChange:n,type:r="text"}){const o=(0,a.useId)();return(0,d.jsxs)("label",{htmlFor:o,style:{display:"flex",flexDirection:"column",gap:4,fontSize:12,color:"#aaa"},children:[e,(0,d.jsx)("input",{id:o,type:r,value:t,onChange:e=>n(e.target.value),style:{padding:"8px 10px",minHeight:36,borderRadius:6,border:"1px solid var(--tkx-border, #2a2a3e)",background:"var(--tkx-bg, #0a0a0f)",color:"var(--tkx-fg, #e8e8f4)",fontSize:13}})]})}function Hc({options:e,onChange:t}){return(0,d.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,d.jsx)("div",{style:{fontSize:12,color:"#aaa"},children:"Options"}),e.map((n,r)=>(0,d.jsxs)("div",{style:{display:"flex",gap:4},children:[(0,d.jsx)("input",{"aria-label":`Option ${r+1} label`,value:n.label,onChange:n=>{const o=e.slice();o[r]={...o[r],label:n.target.value},t(o)},style:Oc}),(0,d.jsx)("input",{"aria-label":`Option ${r+1} value`,value:n.value,onChange:n=>{const o=e.slice();o[r]={...o[r],value:n.target.value},t(o)},style:Oc}),(0,d.jsx)("button",{type:"button","aria-label":`Remove option ${r+1}`,onClick:()=>t(e.filter((e,t)=>t!==r)),style:{...Ec,color:"#ff006e"},children:"✕"})]},r)),(0,d.jsx)("button",{type:"button",onClick:()=>t([...e,{label:`Option ${e.length+1}`,value:`option_${e.length+1}`}]),style:{padding:"6px 10px",minHeight:36,borderRadius:6,border:"1px dashed var(--tkx-border, #2a2a3e)",background:"transparent",color:"var(--tkx-fg, #e8e8f4)",cursor:"pointer",fontSize:12},children:"+ Add option"})]})}var Oc={flex:1,minWidth:0,padding:"6px 8px",minHeight:32,borderRadius:6,border:"1px solid var(--tkx-border, #2a2a3e)",background:"var(--tkx-bg, #0a0a0f)",color:"var(--tkx-fg, #e8e8f4)",fontSize:12};function qc({schema:e}){const[t,n]=(0,a.useState)({}),[r,o]=(0,a.useState)({}),[i,l]=(0,a.useState)(null);return(0,d.jsxs)("form",{onSubmit:n=>{n.preventDefault();const r={};for(const o of e.fields)r[o.name]=Tc(o,t[o.name]);o(r),Object.values(r).every(e=>null===e)?l(t):l(null)},style:{flex:1,padding:24,overflowY:"auto",display:"flex",flexDirection:"column",gap:16,maxWidth:640,margin:"0 auto",width:"100%"},children:[e.title&&(0,d.jsx)("h2",{style:{margin:0,color:"var(--tkx-fg, #e8e8f4)"},children:e.title}),e.description&&(0,d.jsx)("p",{style:{margin:0,color:"#aaa"},children:e.description}),e.fields.map(e=>(0,d.jsx)(Uc,{field:e,value:t[e.name],error:r[e.name]??null,onChange:t=>{return r=e.name,o=t,void n(e=>({...e,[r]:o}));var r,o}},e.id)),(0,d.jsx)("button",{type:"submit",style:{padding:"12px 20px",minHeight:44,borderRadius:8,border:"none",background:"var(--tkx-accent, #00f5d4)",color:"#0a0a0f",fontWeight:700,cursor:"pointer",alignSelf:"flex-start"},children:"Submit"}),i&&(0,d.jsx)("pre",{"data-testid":"preview-submitted",style:{background:"var(--tkx-bg-subtle, #0d0d14)",border:"1px solid var(--tkx-border, #2a2a3e)",borderRadius:8,padding:12,color:"#00f5d4",fontSize:12,overflowX:"auto"},children:JSON.stringify(i,null,2)})]})}function Uc({field:e,value:t,error:n,onChange:r}){const o=(0,a.useId)(),i=(0,d.jsxs)("label",{htmlFor:o,style:{display:"block",marginBottom:4,fontWeight:600,color:"var(--tkx-fg, #e8e8f4)"},children:[e.label,e.required&&(0,d.jsx)("span",{"aria-hidden":"true",style:{color:"#ff006e",marginLeft:4},children:"*"})]}),l=e.helpText&&(0,d.jsx)("div",{style:{fontSize:12,color:"#888",marginTop:4},children:e.helpText}),s=n&&(0,d.jsx)("div",{role:"alert",style:{fontSize:12,color:"#ff006e",marginTop:4},children:n});let c=null;switch(e.type){case"textarea":c=(0,d.jsx)("textarea",{id:o,value:t??"",placeholder:e.placeholder,onChange:e=>r(e.target.value),rows:4,style:Kc});break;case"select":c=(0,d.jsxs)("select",{id:o,value:t??"",onChange:e=>r(e.target.value),style:Kc,children:[(0,d.jsx)("option",{value:"",children:e.placeholder??"Choose…"}),(e.options??[]).map(e=>(0,d.jsx)("option",{value:e.value,children:e.label},e.value))]});break;case"radio":c=(0,d.jsx)("div",{role:"radiogroup","aria-labelledby":o,style:{display:"flex",flexDirection:"column",gap:6},children:(e.options??[]).map(n=>(0,d.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:8,color:"var(--tkx-fg, #e8e8f4)"},children:[(0,d.jsx)("input",{type:"radio",name:e.name,value:n.value,checked:t===n.value,onChange:()=>r(n.value)}),n.label]},n.value))});break;case"checkbox":c=(0,d.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:8,color:"var(--tkx-fg, #e8e8f4)"},children:[(0,d.jsx)("input",{id:o,type:"checkbox",checked:!!t,onChange:e=>r(e.target.checked)}),e.placeholder||"Yes"]});break;default:c=(0,d.jsx)("input",{id:o,type:"number"===e.type?"number":"date"===e.type?"date":e.type,value:t??"",placeholder:e.placeholder,min:e.min,max:e.max,onChange:e=>r(e.target.value),style:Kc})}return(0,d.jsxs)("div",{children:[i,c,l,s]})}var Kc={width:"100%",padding:"10px 12px",minHeight:44,borderRadius:8,border:"1px solid var(--tkx-border, #2a2a3e)",background:"var(--tkx-bg, #0a0a0f)",color:"var(--tkx-fg, #e8e8f4)",fontSize:14,boxSizing:"border-box"};function Yc(e,t,n){let r=e;return t&&(r=pe(Fe(r))),n&&(r=Be(r)),r}function Zc({field:e,value:t,error:n,onChange:r,onBlur:o}){const i=J(),l=(0,a.useId)(),s=`tkx-af-${e.name}`,c=`${l}-help`,u=`${l}-err`,p=[e.helpText?c:null,n?u:null].filter(Boolean).join(" ")||void 0,h={width:"100%",padding:"10px 12px",minHeight:44,borderRadius:8,border:`1px solid ${n?i.danger:i.border}`,background:i.surface,color:i.text,fontSize:14,fontFamily:"inherit",boxSizing:"border-box"},f=(0,d.jsxs)("label",{htmlFor:"radio"===e.type?void 0:s,id:"radio"===e.type?s:void 0,style:{display:"block",marginBottom:4,fontWeight:600,color:i.text,fontSize:14},children:[e.label,e.required&&(0,d.jsx)("span",{"aria-hidden":"true",style:{color:i.danger,marginLeft:4},children:"*"})]});let m;switch(e.type){case"textarea":m=(0,d.jsx)("textarea",{id:s,value:t??"",placeholder:e.placeholder,rows:4,"aria-invalid":!!n,"aria-describedby":p,onChange:e=>r(e.target.value),onBlur:o,style:h});break;case"select":m=(0,d.jsxs)("select",{id:s,value:t??"","aria-invalid":!!n,"aria-describedby":p,onChange:e=>r(e.target.value),onBlur:o,style:h,children:[(0,d.jsx)("option",{value:"",children:e.placeholder??"Choose…"}),(e.options??[]).map(e=>(0,d.jsx)("option",{value:e.value,children:e.label},e.value))]});break;case"radio":m=(0,d.jsx)("div",{role:"radiogroup","aria-labelledby":s,"aria-invalid":!!n,"aria-describedby":p,style:{display:"flex",flexDirection:"column",gap:6},children:(e.options??[]).map(n=>(0,d.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:8,color:i.text},children:[(0,d.jsx)("input",{type:"radio",name:e.name,value:n.value,checked:t===n.value,onChange:()=>r(n.value),onBlur:o}),n.label]},n.value))});break;case"checkbox":m=(0,d.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:8,color:i.text},children:[(0,d.jsx)("input",{id:s,type:"checkbox",checked:!!t,"aria-invalid":!!n,"aria-describedby":p,onChange:e=>r(e.target.checked),onBlur:o}),e.placeholder||e.label]});break;default:m=(0,d.jsx)("input",{id:s,type:"number"===e.type?"number":"date"===e.type?"date":e.type,value:t??"",placeholder:e.placeholder,min:e.min,max:e.max,pattern:e.pattern,"aria-invalid":!!n,"aria-describedby":p,onChange:e=>r(e.target.value),onBlur:o,style:h})}return(0,d.jsxs)("div",{children:["checkbox"!==e.type&&f,m,e.helpText&&(0,d.jsx)("div",{id:c,style:{fontSize:12,color:i.textMuted,marginTop:4},children:e.helpText}),n&&(0,d.jsx)("div",{id:u,role:"alert",style:{fontSize:12,color:i.danger,marginTop:4},children:n})]})}exports.COUNTRIES=fl,exports.FocusTrap=function({active:e,children:t,as:n="div"}){return(0,d.jsx)(n,{ref:Ue(e),children:t})},exports.I18nContext=Gt,exports.I18nProvider=function({locale:e="en-US",direction:t,strings:n,children:r}){const o=(0,a.useMemo)(()=>{const r=Yt[e]??Kt,o=n?{...r,...n}:r;return{locale:e,direction:t??(Xt(e)?"rtl":"ltr"),strings:o}},[e,t,n]);return(0,d.jsx)(Gt.Provider,{value:o,children:(0,d.jsx)("div",{dir:o.direction,style:{direction:o.direction,display:"contents"},children:r})})},exports.ICON_CATEGORIES={Navigation:["home","menu","x","chevron-up","chevron-down","chevron-left","chevron-right","arrow-up","arrow-down","arrow-left","arrow-right","arrow-up-right","external-link","link","anchor"],Actions:["search","filter","sort","refresh","download","upload","share","copy","edit","trash","plus","minus","check","x-circle","check-circle","info-circle","alert-triangle","alert-circle"],UI:["eye","eye-off","settings","sliders","grid","list","columns","layout","sidebar","maximize","minimize","moon","sun","bell","bell-off"],Media:["play","pause","stop","skip-back","skip-forward","volume","volume-off","image","video","mic","mic-off","camera"],Data:["chart-bar","chart-line","chart-pie","trending-up","trending-down","activity","database","server","cpu","memory"],Commerce:["shopping-cart","package","tag","credit-card","dollar","percent","gift","truck","warehouse","box"],Communication:["mail","message","phone","user","users","team","star","heart","bookmark","flag","globe"],Files:["file","file-text","folder","folder-open","code","terminal","lock","unlock","key","shield"]},exports.LRUCache=p,exports.LiveRegion=function({politeness:e="polite",children:t,atomic:n=!0}){return(0,d.jsx)("div",{role:"status","aria-live":e,"aria-atomic":n,className:"tkx-sr-only",children:t})},exports.Quantum=w,exports.SIZE_BORDER_RADIUS={sm:4,md:6,lg:8},exports.SIZE_FONT={sm:"0.75rem",md:"0.875rem",lg:"1rem"},exports.SIZE_HEIGHT={sm:32,md:40,lg:48},exports.SIZE_ICON={sm:14,md:16,lg:20},exports.SIZE_PADDING_X={sm:8,md:12,lg:16},exports.SIZE_PADDING_Y={sm:4,md:8,lg:12},exports.SecurityCore=He,exports.SecurityProvider=function({children:e,maxEvents:t=200}){const[n,r]=(0,a.useState)(()=>de().slice(-t));(0,a.useEffect)(()=>se(e=>{r(n=>{const r=[...n,e];return r.length>t?r.slice(-t):r})}),[t]);const o=(0,a.useMemo)(()=>({events:n,clear:()=>{ce(),r([])}}),[n]);return(0,d.jsx)(rl.Provider,{value:o,children:e})},exports.Shield=Oe,exports.SkipNav=function({contentId:e="tkx-main-content",label:t="Skip to main content"}){return(0,d.jsx)("a",{href:`#${e}`,className:"tkx-skip-nav",children:t})},exports.TKX=A,exports.ThemeContext=G,exports.ThemeProvider=_,exports.TkxAadhaarInput=_l,exports.TkxAccessibilityChecker=function({show:e,intervalMs:t=4e3,position:n="bottom-right",scope:r,axeOptions:o,onScan:i}){const l=J(),[s,c]=(0,a.useState)([]),[u,p]=(0,a.useState)(!1),[h,f]=(0,a.useState)(null),[m,g]=(0,a.useState)(!1),[x,y]=(0,a.useState)(null),b="production"===(globalThis.process?.env)?.NODE_ENV,v=e??!b;if((0,a.useEffect)(()=>{if(!v)return;let e=!1,n=null,a=null;async function l(t){if(!e){g(!0);try{const n=r??document,a=await t.run(n,o);if(e)return;c(a.violations);const l={};a.violations.forEach(e=>{const t=e.impact??"unknown";l[t]=(l[t]??0)+1}),i?.({violations:a.violations.length,impacts:l}),y(null)}catch(n){y(n instanceof Error?n.message:"scan failed")}finally{e||g(!1)}}}return async function(){try{const e=await new Function("s","return import(s)")("axe-core");return e.default??e}catch{return null}}().then(r=>{e||(r?(f(!0),n=r,l(r),t>0&&(a=setInterval(()=>{n&&l(n)},t))):f(!1))}),()=>{e=!0,a&&clearInterval(a)}},[v,t,r]),!v||!1===h)return null;const w={};s.forEach(e=>{const t=e.impact??"unknown";w[t]=(w[t]??0)+1});const k=s.length,$=0===k?{color:l.success??"#06d6a0",label:"✓ AAA"}:w.critical||w.serious?{color:"#f72585",label:"Issues"}:{color:"#ffbe0b",label:"Warnings"};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("button",{type:"button","aria-label":`Accessibility status: ${k} violation${1===k?"":"s"}`,"aria-expanded":u,onClick:()=>p(e=>!e),style:cd(l,$.color,n),children:[(0,d.jsx)("span",{style:{fontSize:14,fontWeight:700},children:m?"…":0===k?"✓":k}),(0,d.jsx)("span",{style:{fontSize:9,fontWeight:700,letterSpacing:"0.06em"},children:"A11Y"})]}),u&&(0,d.jsxs)("div",{role:"dialog","aria-label":"Accessibility violations","aria-modal":"false",style:ud(l,n),children:[(0,d.jsxs)("header",{style:{display:"flex",alignItems:"center",gap:8,padding:"12px 16px",borderBottom:`1px solid ${l.border}`,background:l.surfaceAlt},children:[(0,d.jsx)("span",{style:{width:10,height:10,borderRadius:"50%",background:$.color,boxShadow:`0 0 12px ${$.color}`},"aria-hidden":"true"}),(0,d.jsxs)("h3",{style:{margin:0,fontSize:14,fontWeight:700,color:l.text,flex:1},children:["Accessibility — ",$.label]}),(0,d.jsx)("button",{type:"button",onClick:()=>p(!1),"aria-label":"Close panel",style:{background:"transparent",border:"none",color:l.textMuted,cursor:"pointer",fontSize:18,padding:4},children:"×"})]}),(0,d.jsxs)("div",{style:{padding:16,maxHeight:400,overflowY:"auto"},children:[x&&(0,d.jsxs)("div",{style:{color:"#f72585",fontSize:12,marginBottom:8},children:["Scan error: ",x]}),0===k?(0,d.jsx)("div",{style:{color:l.textMuted,fontSize:13},children:"No axe-core violations on this page. ✓"}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:{display:"flex",gap:6,flexWrap:"wrap",marginBottom:12},children:Object.entries(w).map(([e,t])=>(0,d.jsxs)("span",{style:{padding:"3px 8px",background:`${dd[e]??l.textMuted}22`,color:dd[e]??l.textMuted,borderRadius:999,fontSize:10,fontWeight:700,letterSpacing:"0.05em",textTransform:"uppercase"},children:[e,": ",t]},e))}),(0,d.jsx)("ol",{style:{listStyle:"none",padding:0,margin:0,display:"flex",flexDirection:"column",gap:10},children:s.slice(0,10).map(e=>(0,d.jsxs)("li",{style:{padding:10,background:l.surfaceAlt,border:`1px solid ${l.border}`,borderRadius:8,fontSize:12},children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:4},children:[(0,d.jsx)("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:dd[e.impact??"minor"]??l.textMuted}}),(0,d.jsx)("strong",{style:{color:l.text,flex:1},children:e.help}),(0,d.jsxs)("span",{style:{fontSize:10,color:l.textMuted,fontFamily:"monospace"},children:[e.nodes.length,"×"]})]}),(0,d.jsx)("div",{style:{color:l.textMuted,marginBottom:6},children:e.description}),(0,d.jsx)("a",{href:e.helpUrl,target:"_blank",rel:"noopener noreferrer",style:{color:l.primary,fontSize:11},children:"Learn more →"})]},e.id))}),s.length>10&&(0,d.jsxs)("div",{style:{marginTop:10,color:l.textMuted,fontSize:11,textAlign:"center"},children:["+ ",s.length-10," more violations not shown"]})]})]}),(0,d.jsxs)("footer",{style:{padding:"8px 16px",borderTop:`1px solid ${l.border}`,fontSize:10,color:l.textMuted,fontFamily:"monospace",textAlign:"center"},children:["Powered by axe-core · scans every ",t/1e3,"s"]})]})]})},exports.TkxAccordion=In,exports.TkxAddressInput=Pl,exports.TkxAffix=function({children:e,offsetTop:t,offsetBottom:n,onChange:r,target:o,ariaLabel:i}){const l=J(),s=qe(),c=(0,a.useRef)(null),u=(0,a.useRef)(null),[p,h]=(0,a.useState)(!1),[f,m]=(0,a.useState)({width:0,height:0}),g=(0,a.useRef)(!1),x=(0,a.useCallback)(()=>{const e=c.current;if(!e)return;const i=e.getBoundingClientRect(),a=function(e){if(e instanceof Window)return{top:0,bottom:e.innerHeight};const t=e.getBoundingClientRect();return{top:t.top,bottom:t.bottom}}(Ha(o));let l=!1;void 0!==t?l=i.top-a.top<=t:void 0!==n&&(l=a.bottom-i.bottom<=n),l!==g.current&&(g.current=l,h(l),m({width:i.width,height:i.height}),r?.(l))},[t,n,r,o]);(0,a.useEffect)(()=>{const e=Ha(o);return x(),e.addEventListener("scroll",x,{passive:!0}),window.addEventListener("resize",x),()=>{e.removeEventListener("scroll",x),window.removeEventListener("resize",x)}},[x,o]);const y=p?{position:"fixed",zIndex:100,...void 0!==t?{top:t}:{},...void 0!==n?{bottom:n}:{},width:f.width||void 0,transition:s?"none":"box-shadow 0.2s ease",boxShadow:`0 2px 8px ${l.border}`}:{};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{ref:c,"aria-hidden":p,style:p?{height:f.height,width:f.width}:{}}),(0,d.jsx)("div",{ref:u,role:"region","aria-label":i,className:$t(p?"tkx-affixed":""),style:y,children:e})]})},exports.TkxAlert=function({variant:e,title:t,children:n,dismissible:r,onDismiss:o,icon:i,style:l,className:s}){const c=J(),u=Ke(),p=t?pe(t):void 0;(0,a.useEffect)(()=>{p&&u(p,"danger"===e||"warning"===e?"assertive":"polite")},[p,e]);const h={info:c.info,success:c.success,warning:c.warning,danger:c.danger}[e];return(0,d.jsxs)("div",{role:"danger"===e||"warning"===e?"alert":"status",className:$t("flex items-start gap-3 px-4 py-3 rounded-lg border animate-fade-in font-sans",s??""),style:{backgroundColor:`${h}18`,borderColor:h,color:c.text,...l},children:[(0,d.jsx)("span",{className:$t("shrink-0 mt-[1px]"),style:{color:h},children:i??Ut[e]}),(0,d.jsxs)("div",{className:$t("flex-1 min-w-0"),children:[p&&(0,d.jsx)("p",{className:$t("m-0 font-semibold text-sm mb-1"),children:p}),(0,d.jsx)("div",{className:$t("text-sm leading-relaxed"),children:n})]}),r&&o&&(0,d.jsx)("button",{"aria-label":"Dismiss alert",onClick:o,className:$t("bg-transparent border-none cursor-pointer rounded p-[2px] shrink-0 flex items-center justify-center focus-visible:focus-ring"),style:{color:c.textMuted},children:(0,d.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:[(0,d.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,d.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})},exports.TkxAnchor=function({items:e,offsetTop:t=0,getCurrentAnchor:n,onChange:r}){const o=J(),i=qe(),[l,s]=(0,a.useState)(e[0]?.key??""),c=(0,a.useRef)(!1),u=Oa(e),p=(0,a.useCallback)(()=>{if(c.current)return;let e=u[0]?.key??"";for(const n of u){const r=qa(n.href),o=document.getElementById(r);o&&o.getBoundingClientRect().top<=t+10&&(e=n.key)}n&&(e=n(e)),e!==l&&(s(e),r?.(e))},[u,t,n,l,r]);(0,a.useEffect)(()=>(window.addEventListener("scroll",p,{passive:!0}),p(),()=>window.removeEventListener("scroll",p)),[p]);const h=(0,a.useCallback)(e=>{const n=qa(e),o=document.getElementById(n);if(!o)return;c.current=!0;const a=o.getBoundingClientRect().top+window.scrollY-t;window.scrollTo({top:a,behavior:i?"auto":"smooth"});const l=u.find(t=>t.href===e);l&&(s(l.key),r?.(l.key)),setTimeout(()=>{c.current=!1},800)},[u,t,i,r]);return(0,d.jsx)("nav",{role:"tree","aria-label":"Anchor navigation",className:$t("font-sans"),style:{borderLeft:`1px solid ${o.border}`,padding:"4px 0"},children:(0,d.jsx)("ul",{role:"group",style:{margin:0,padding:0},children:e.map(e=>(0,d.jsx)(Ua,{item:e,activeKey:l,depth:0,onClick:h,theme:o,reducedMotion:i},e.key))})})},exports.TkxAppBar=function({title:e,leading:t,logo:n,actions:r,navigation:o,position:i="sticky",variant:l="default",color:s="surface",className:c,style:u}){const p=J(),h=qe(),f=function(){const[e,t]=(0,a.useState)(()=>"undefined"!=typeof window&&window.innerWidth<768);return(0,a.useEffect)(()=>{if("undefined"==typeof window)return;const e=()=>t(window.innerWidth<768);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e}(),[m,g]=(0,a.useState)(!1),x=(0,a.useRef)(null),y=(0,a.useId)();Ye(()=>g(!1),m),(0,a.useEffect)(()=>{!f&&m&&g(!1)},[f,m]),(0,a.useEffect)(()=>{if(!m)return;const e=e=>{x.current&&!x.current.contains(e.target)&&g(!1)};return document.addEventListener("pointerdown",e),()=>document.removeEventListener("pointerdown",e)},[m]);const b=(0,a.useCallback)(()=>{g(e=>!e)},[]),v="primary"===s?p.primary:p.surface,w="primary"===s?p.bg:p.text,k={default:{backgroundColor:v,borderBottom:`1px solid ${p.border}`},transparent:{backgroundColor:"transparent",borderBottom:"none"},elevated:{backgroundColor:v,boxShadow:`0 2px 8px ${p.bg}66`,borderBottom:"none"}},$="string"==typeof e?pe(e):e,S=h?"none":"max-height 300ms cubic-bezier(0.4,0,0.2,1), opacity 300ms ease";return(0,d.jsxs)("header",{role:"banner",className:$t("font-sans w-full",c??""),style:{...{fixed:{position:"fixed",top:0,left:0,right:0,zIndex:1100},sticky:{position:"sticky",top:0,zIndex:1100},static:{position:"static"}}[i],...k[l],color:w,height:56,...u},children:[(0,d.jsxs)("div",{ref:x,className:$t("flex items-center h-full px-4"),style:{maxWidth:1440,margin:"0 auto"},children:[t&&(0,d.jsx)("div",{className:$t("flex items-center shrink-0 mr-2"),children:t}),n&&(0,d.jsx)("div",{className:$t("flex items-center shrink-0 mr-3"),"aria-hidden":"true",children:n}),$&&(0,d.jsx)("div",{className:$t("text-base font-semibold shrink-0 mr-4 leading-snug"),style:{color:w},children:$}),!f&&o&&(0,d.jsx)("nav",{id:y,"aria-label":"Main navigation",className:$t("flex items-center flex-1 gap-1"),children:o}),f&&(0,d.jsx)("div",{className:$t("flex-1")}),r&&(0,d.jsx)("div",{className:$t("flex items-center gap-2 ml-auto shrink-0"),children:r}),f&&o&&(0,d.jsx)("button",{onClick:b,"aria-expanded":m,"aria-controls":y,"aria-label":m?"Close navigation menu":"Open navigation menu",className:$t("bg-transparent border-none cursor-pointer p-2 ml-2 rounded flex items-center justify-center","focus-visible:focus-ring"),style:{color:w},children:(0,d.jsx)(Jo,{open:m})})]}),f&&o&&(0,d.jsx)("nav",{id:y,"aria-label":"Main navigation",style:{maxHeight:m?400:0,opacity:m?1:0,overflow:"hidden",transition:S,backgroundColor:p.surface,borderBottom:m?`1px solid ${p.border}`:"none"},children:(0,d.jsx)("div",{className:$t("flex flex-col gap-1 px-4 py-3"),role:"menu",children:o})})]})},exports.TkxAutoForm=function({schema:e,defaultValues:t,onSubmit:n,onChange:r,submitLabel:o="Submit",sanitize:i=!0,redactPII:l=!1,validateOnBlur:s=!0,className:c,style:u}){const p=J(),[h,f]=(0,a.useState)(()=>({...t})),[m,g]=(0,a.useState)({}),[x,y]=(0,a.useState)(!1),b=(0,a.useRef)(null),v=(0,a.useRef)(null),w=(0,a.useCallback)((e,t)=>{f(n=>{const o={...n,[e]:t};return r?.(o),o})},[r]),k=(0,a.useCallback)(e=>{const t=Tc(e,h[e.name]);return g(n=>({...n,[e.name]:t})),t},[h]),$=(0,a.useCallback)(t=>{t.preventDefault();const r={};let o=null;for(const n of e.fields){const e=Tc(n,h[n.name]);r[n.name]=e,e&&null===o&&(o=n.name)}if(g(r),o)return y(!0),void requestAnimationFrame(()=>b.current?.focus());y(!1);const a={};for(const n of e.fields){const e=h[n.name];a[n.name]="string"==typeof e?Yc(e,i,l):e}n?.(a)},[e.fields,h,i,l,n]),S=e.fields.filter(e=>m[e.name]);return(0,d.jsxs)("form",{ref:v,onSubmit:$,noValidate:!0,className:c,"aria-label":e.title??"Form",style:{display:"flex",flexDirection:"column",gap:16,color:p.text,fontFamily:"inherit",...u},children:[e.title&&(0,d.jsx)("h2",{style:{margin:0,fontSize:20,fontWeight:700,color:p.text},children:e.title}),e.description&&(0,d.jsx)("p",{style:{margin:0,color:p.textMuted,fontSize:14},children:e.description}),x&&S.length>0&&(0,d.jsxs)("div",{ref:b,role:"alert",tabIndex:-1,style:{border:`1px solid ${p.danger}`,background:p.surfaceAlt,borderRadius:8,padding:"12px 14px",outline:"none"},children:[(0,d.jsxs)("strong",{style:{color:p.danger,fontSize:14},children:[S.length," field",1===S.length?"":"s"," need",1===S.length?"s":""," attention"]}),(0,d.jsx)("ul",{style:{margin:"8px 0 0",paddingLeft:18,fontSize:13},children:S.map(e=>(0,d.jsx)("li",{children:(0,d.jsxs)("a",{href:`#tkx-af-${e.name}`,style:{color:p.danger},onClick:t=>{t.preventDefault(),v.current?.querySelector(`#tkx-af-${CSS.escape(e.name)}`)?.focus()},children:[e.label,": ",m[e.name]]})},e.id))})]}),e.fields.map(e=>(0,d.jsx)(Zc,{field:e,value:h[e.name],error:m[e.name]??null,onChange:t=>w(e.name,t),onBlur:()=>s&&k(e)},e.id)),(0,d.jsx)("button",{type:"submit",style:{alignSelf:"flex-start",padding:"12px 22px",minHeight:44,borderRadius:8,border:"none",background:p.primary,color:p.bg,fontWeight:700,fontSize:14,cursor:"pointer",fontFamily:"inherit"},children:o})]})},exports.TkxAutocomplete=function({options:e,value:t,onChange:n,onInputChange:r,placeholder:o="",label:i,isLoading:l=!1,emptyMessage:s,filterFn:u,freeSolo:p=!1,className:h,style:f}){const m=J(),g=_t(),x=s??g.noResults,y=qe(),b=(0,a.useId)(),v=(0,a.useId)(),w=(0,a.useRef)(null),k=(0,a.useRef)(null),[$,S]=(0,a.useState)(""),[C,z]=(0,a.useState)(!1),[M,N]=(0,a.useState)(-1),[D,R]=(0,a.useState)(null);(0,a.useEffect)(()=>{if(void 0!==t){const n=e.find(e=>e.value===t);S(n?n.label:t)}},[t,e]);const P=u??Bo,F=(0,a.useMemo)(()=>C?e.filter(e=>P(e,$)):[],[e,$,C,P]),A=pe(i),I=pe(x);(0,a.useEffect)(()=>{if(!C||!k.current)return;const e=()=>{k.current&&R(function(e){const t=e.getBoundingClientRect(),n=window.innerHeight-t.bottom,r=t.top,o=n>=284||n>=r?"below":"above";return{top:"below"===o?t.bottom+window.scrollY+4:t.top+window.scrollY-280-4,left:t.left+window.scrollX,width:t.width,placement:o}}(k.current))};return e(),window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}},[C]),(0,a.useEffect)(()=>{if(!C)return;const e=e=>{const t=e.target;k.current?.contains(t)||document.getElementById(v)?.contains(t)||z(!1)};return document.addEventListener("pointerdown",e),()=>document.removeEventListener("pointerdown",e)},[C,v]),Ye(()=>z(!1),C);const L=(0,a.useCallback)(e=>{e.disabled||(S(e.label),n?.(e.value),z(!1),N(-1),w.current?.focus())},[n]);(0,a.useEffect)(()=>{if(M<0)return;const e=`${v}-opt-${M}`;document.getElementById(e)?.scrollIntoView({block:"nearest"})},[M,v]);const T=M>=0?`${v}-opt-${M}`:void 0,W=y?{}:{animation:"tkxAutoFadeIn 120ms ease forwards"},j=C&&"undefined"!=typeof document&&D?(0,c.createPortal)((0,d.jsx)("ul",{id:v,role:"listbox","aria-label":A,className:$t("absolute z-[9200] list-none m-0 p-1 rounded-lg overflow-y-auto font-sans"),style:{top:D.top,left:D.left,width:D.width,maxHeight:280,backgroundColor:m.surface,border:`1px solid ${m.border}`,boxShadow:"0 8px 24px rgba(0,0,0,0.15)",...W},children:l?(0,d.jsxs)("li",{role:"option","aria-selected":!1,"aria-disabled":"true",className:$t("flex items-center gap-2 px-3 py-2 text-sm"),style:{color:m.textMuted},children:[(0,d.jsx)(Vo,{color:m.primary}),"Loading..."]}):0===F.length?(0,d.jsx)("li",{role:"option","aria-selected":!1,"aria-disabled":"true",className:$t("px-3 py-2 text-sm text-center"),style:{color:m.textMuted},children:I}):F.map((e,n)=>{const r=n===M,o=pe(e.label),i=e.description?pe(e.description):null;return(0,d.jsxs)("li",{id:`${v}-opt-${n}`,role:"option","aria-selected":e.value===t,"aria-disabled":e.disabled||void 0,className:$t("flex items-center gap-2 px-3 py-2 text-sm rounded-md cursor-pointer",e.disabled?"opacity-50 cursor-not-allowed":""),style:{backgroundColor:r?m.surfaceAlt:"transparent",color:e.disabled?m.textMuted:m.text,transition:y?"none":"background-color 100ms ease"},onMouseEnter:()=>!e.disabled&&N(n),onMouseDown:t=>{t.preventDefault(),L(e)},children:[e.icon&&(0,d.jsx)("span",{"aria-hidden":"true",className:$t("flex-shrink-0"),children:e.icon}),(0,d.jsxs)("span",{className:$t("flex flex-col min-w-0"),children:[(0,d.jsx)("span",{className:$t("truncate"),children:o}),i&&(0,d.jsx)("span",{className:$t("text-xs truncate"),style:{color:m.textMuted},children:i})]}),e.value===t&&(0,d.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:$t("ml-auto flex-shrink-0"),children:(0,d.jsx)("path",{d:"M3 8l3.5 3.5L13 5",stroke:m.primary,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},e.value)})}),document.body):null;return(0,d.jsxs)("div",{ref:k,className:$t("relative font-sans",h??""),style:f,children:[(0,d.jsx)("label",{htmlFor:b,className:$t("block text-sm font-medium mb-1.5"),style:{color:m.text},children:A}),(0,d.jsxs)("div",{className:$t("relative flex items-center"),style:{backgroundColor:m.surface,border:`1px solid ${C?m.primary:m.border}`,borderRadius:8,transition:y?"none":"border-color 150ms ease"},children:[(0,d.jsx)("input",{ref:w,id:b,type:"text",role:"combobox","aria-expanded":C,"aria-controls":v,"aria-activedescendant":T,"aria-autocomplete":"list","aria-label":A,value:$,placeholder:o,onChange:e=>{const t=Fe(e.target.value);S(t),r?.(t),C||z(!0),N(-1),p&&n?.(t)},onFocus:()=>z(!0),onKeyDown:e=>{if(C||"ArrowDown"!==e.key&&"ArrowUp"!==e.key)switch(e.key){case"ArrowDown":e.preventDefault(),N(e=>{let t=e+1;for(;t<F.length&&F[t].disabled;)t++;return t<F.length?t:e});break;case"ArrowUp":e.preventDefault(),N(e=>{let t=e-1;for(;t>=0&&F[t].disabled;)t--;return t>=0?t:e});break;case"Enter":e.preventDefault(),M>=0&&M<F.length?L(F[M]):p&&$&&(n?.($),z(!1));break;case"Escape":z(!1),N(-1)}else z(!0)},className:$t("w-full bg-transparent border-none outline-none text-sm py-2.5 px-3","placeholder:opacity-50"),style:{color:m.text}}),l&&(0,d.jsx)("span",{className:$t("pr-3"),children:(0,d.jsx)(Vo,{color:m.primary})})]}),j,C&&!y&&(0,d.jsx)("style",{children:"\n @keyframes tkxAutoFadeIn {\n from { opacity: 0; transform: translateY(4px); }\n to { opacity: 1; transform: translateY(0); }\n }\n "})]})},exports.TkxAvatar=sn,exports.TkxBadge=Et,exports.TkxBillingCycleToggle=function({value:e,onChange:t,annualSavingsLabel:n,className:r,style:o}){const i=J(),a={display:"inline-flex",alignItems:"center",gap:8,padding:4,border:`1px solid ${i.border}`,borderRadius:999,background:i.surface,...o},l=e=>({padding:"6px 16px",borderRadius:999,fontSize:13,fontWeight:600,background:e?i.primary:"transparent",color:e?i.bg:i.text,border:"none",cursor:"pointer",transition:"background 0.15s, color 0.15s",display:"inline-flex",alignItems:"center",gap:6});return(0,d.jsxs)("div",{role:"radiogroup","aria-label":"Billing cycle",className:r,style:a,children:[(0,d.jsx)("button",{type:"button",role:"radio","aria-checked":"monthly"===e,onClick:()=>t("monthly"),style:l("monthly"===e),children:"Monthly"}),(0,d.jsxs)("button",{type:"button",role:"radio","aria-checked":"annual"===e,onClick:()=>t("annual"),style:l("annual"===e),children:["Annual",n&&(0,d.jsx)("span",{style:{fontSize:10,padding:"2px 6px",borderRadius:4,background:"annual"===e?i.bg:i.success,color:"annual"===e?i.success:i.bg,fontWeight:700},children:n})]})]})},exports.TkxBottomNav=function({items:e,activeId:t,onChange:n,showLabels:r=!0,className:o,style:i}){const l=J(),s=qe(),c=(0,a.useRef)(null);(0,a.useEffect)(()=>{!function(){if(Qo||"undefined"==typeof document)return;Qo=!0;const e=document.createElement("style");e.id="tkx-bottom-nav-kf",e.textContent="\n @keyframes tkx-bottom-nav-pulse {\n 0% { transform: scale(1); }\n 50% { transform: scale(1.15); }\n 100% { transform: scale(1); }\n }\n ",document.head.appendChild(e)}()},[]);const u=e.slice(0,5),p=(0,a.useCallback)(e=>{n?.(e)},[n]),h=(0,a.useCallback)(e=>{const t=c.current;if(!t)return;const n=Array.from(t.querySelectorAll('[role="tab"]')),r=n.findIndex(e=>e===document.activeElement);if(-1===r)return;let o=r;"ArrowRight"===e.key||"ArrowDown"===e.key?(e.preventDefault(),o=(r+1)%n.length):"ArrowLeft"===e.key||"ArrowUp"===e.key?(e.preventDefault(),o=(r-1+n.length)%n.length):"Home"===e.key?(e.preventDefault(),o=0):"End"===e.key&&(e.preventDefault(),o=n.length-1),o!==r&&(n[o].focus(),p(u[o].id))},[p,u]),f=s?"none":"color 200ms ease, transform 150ms ease";return(0,d.jsx)("nav",{ref:c,role:"navigation","aria-label":"Bottom navigation",className:$t("fixed bottom-0 left-0 right-0 z-[1000] font-sans",o??""),style:{height:56,backgroundColor:l.surface,borderTop:`1px solid ${l.border}`,boxShadow:`0 -2px 12px ${l.bg}44`,...i},children:(0,d.jsx)("div",{role:"tablist","aria-label":"Navigation tabs",className:$t("flex items-center justify-around h-full"),onKeyDown:h,children:u.map(e=>{const n=e.id===t,o=pe(e.label),i=n?l.primary:l.textMuted;return(0,d.jsxs)("button",{role:"tab","aria-selected":n,"aria-label":o,tabIndex:n?0:-1,onClick:()=>p(e.id),className:$t("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:i,transition:f,outline:"none"},children:[n&&(0,d.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",top:0,left:"25%",right:"25%",height:3,borderRadius:"0 0 3px 3px",backgroundColor:l.primary,transition:s?"none":"width 200ms ease"}}),(0,d.jsxs)("div",{className:$t("relative flex items-center justify-center"),style:{animation:n&&!s?"tkx-bottom-nav-pulse 300ms ease-out":"none"},children:[e.icon,void 0!==e.badge&&e.badge>0&&(0,d.jsx)("span",{"aria-label":`${e.badge} notifications`,className:$t("absolute flex items-center justify-center","text-[10px] font-bold leading-none rounded-full"),style:{top:-4,right:-8,minWidth:16,height:16,padding:"0 4px",backgroundColor:l.danger,color:l.bg},children:e.badge>99?"99+":e.badge})]}),r&&(0,d.jsx)("span",{className:$t("text-[10px] leading-tight mt-0.5"),style:{fontWeight:n?600:400,maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o})]},e.id)})})})},exports.TkxBreadcrumb=function({items:e,separator:t,maxItems:n,onNavigate:r,className:o,style:i}){const l=J(),s=_t(),c=qe(),[u,p]=(0,a.useState)(!1);(0,a.useEffect)(()=>{p(!1)},[e]);const h=!u&&void 0!==n&&n>1&&e.length>n,f=(0,a.useCallback)(()=>{if(!h||!n)return e.map((e,t)=>({item:e,originalIndex:t}));const t=Math.ceil((n-1)/2),r=n-1-t,o=e.slice(0,t).map((e,t)=>({item:e,originalIndex:t})),i=e.slice(e.length-r).map((t,n)=>({item:t,originalIndex:e.length-r+n}));return o.concat(i)},[e,n,h])(),m=h&&n?Math.ceil((n-1)/2):-1,g=(e,t)=>{r?.(e,t)},x=c?{}:{transition:"color 150ms ease, background-color 150ms ease"},y=e=>(0,d.jsx)("li",{role:"presentation","aria-hidden":"true",className:$t("flex items-center mx-1.5"),children:t??(0,d.jsx)(jo,{color:l.textMuted})},e),b=(e,t,n)=>{const o=pe(e.label);if(n)return(0,d.jsx)("li",{children:(0,d.jsxs)("span",{"aria-current":"page",className:$t("inline-flex items-center gap-1.5 text-sm font-medium"),style:{color:l.text},children:[e.icon&&(0,d.jsx)("span",{"aria-hidden":"true",className:$t("flex-shrink-0"),children:e.icon}),o]})},`item-${t}`);const i=!!e.href,a={color:l.textMuted,textDecoration:"none",...x},s={onMouseEnter:e=>{e.currentTarget.style.color=l.primary},onMouseLeave:e=>{e.currentTarget.style.color=l.textMuted}},c=(0,d.jsxs)(d.Fragment,{children:[e.icon&&(0,d.jsx)("span",{"aria-hidden":"true",className:$t("flex-shrink-0"),children:e.icon}),o]});return i?(0,d.jsx)("li",{children:(0,d.jsx)("a",{href:e.href,onClick:n=>{r&&(n.preventDefault(),g(e,t))},className:$t("inline-flex items-center gap-1.5 text-sm rounded","outline-none focus-visible:ring-2 focus-visible:ring-offset-1"),style:{...a,focusRingColor:l.primary},...s,children:c})},`item-${t}`):(0,d.jsx)("li",{children:(0,d.jsx)("button",{type:"button",onClick:()=>g(e,t),onKeyDown:n=>((e,t,n)=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),g(t,n))})(n,e,t),className:$t("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:a,...s,children:c})},`item-${t}`)},v=[];let w=!1;for(let a=0;a<f.length;a++){const{item:t,originalIndex:n}=f[a],r=n===e.length-1;h&&!w&&a===m&&(v.length>0&&v.push(y("sep-ellipsis-before")),v.push((0,d.jsx)("li",{role:"presentation",children:(0,d.jsx)(Eo,{onClick:()=>{p(!0)},bgColor:l.surfaceAlt,hoverColor:l.surface,textColor:l.textMuted,label:s.showHiddenItems??"Show hidden breadcrumb items"})},"ellipsis")),w=!0),v.length>0&&null!==v[v.length-1]&&v.push(y(`sep-${n}`)),v.push(b(t,n,r))}return(0,d.jsx)("nav",{"aria-label":s.breadcrumb??"Breadcrumb",className:$t("font-sans",o??""),style:{...i},children:(0,d.jsx)("ol",{role:"list",className:$t("flex items-center flex-wrap list-none m-0 p-0"),children:v})})},exports.TkxButton=At,exports.TkxCalendarHeatmap=function({data:e,endDate:t,startDate:n,colors:r,cellSize:o=11,gap:i=3,showMonthLabels:l=!0,showWeekdayLabels:s=!0,onCellClick:c,formatTooltip:u,ariaLabel:p,className:h,style:f}){const m=J(),[g,x]=(0,a.useState)(null),{end:y,start:b,weeks:v,valuesByDate:w,max:k,total:$}=(0,a.useMemo)(()=>{const r=t?ld(t):new Date,o=new Date(r);o.setHours(0,0,0,0);const i=n?ld(n):sd(o,-365),a=new Map;let l=0,s=0;for(const t of e){const e=ad(ld(t.date)),n=(a.get(e)??0)+t.value;a.set(e,n),l+=t.value,n>s&&(s=n)}const d=[];let c=function(e){const t=new Date(e);return t.setHours(0,0,0,0),t.setDate(t.getDate()-t.getDay()),t}(i);for(;c<=o;){const e=[];for(let t=0;t<7;t++)e.push(sd(c,t));d.push(e),c=sd(c,7)}return{end:o,start:i,weeks:d,valuesByDate:a,max:s,total:l}},[e,n,t]),S=(0,a.useMemo)(()=>{if(r)return r;const e=m.primary;return[m.surface,`${e}33`,`${e}66`,`${e}AA`,e]},[r,m.primary,m.surface]),C=(0,a.useCallback)(u??(e=>{const t=ld(e.date).toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric",year:"numeric"});return e.value>0?`${e.value} on ${t}`:`No activity on ${t}`}),[u]),z=(0,a.useMemo)(()=>{const e=[];let t=-1;return v.forEach((n,r)=>{const o=n[0].getMonth();o!==t&&(e.push({week:r,label:od[o]}),t=o)}),e},[v]),M=p??`Activity heatmap from ${ad(b)} to ${ad(y)}. ${$} total events.`;return(0,d.jsxs)("div",{className:h,style:{display:"inline-block",position:"relative",color:m.text,...f},role:"img","aria-label":M,children:[l&&(0,d.jsxs)("div",{"aria-hidden":"true",style:{display:"grid",gridTemplateColumns:`${s?"24px ":""}repeat(${v.length}, ${o+i}px)`,marginBottom:4,fontSize:10,color:m.textMuted,position:"relative",height:14},children:[s&&(0,d.jsx)("div",{}),v.map((e,t)=>{const n=z.find(e=>e.week===t);return(0,d.jsx)("div",{style:{position:"relative",overflow:"visible"},children:n&&(0,d.jsx)("span",{style:{position:"absolute",top:0,left:0,whiteSpace:"nowrap",fontWeight:600},children:n.label})},t)})]}),(0,d.jsxs)("div",{style:{display:"flex",alignItems:"flex-start"},children:[s&&(0,d.jsx)("div",{"aria-hidden":"true",style:{display:"grid",gridTemplateRows:`repeat(7, ${o}px)`,rowGap:i,marginRight:4,fontSize:9,color:m.textMuted},children:id.map((e,t)=>(0,d.jsx)("div",{style:{height:o,lineHeight:`${o}px`,visibility:t%2==1?"visible":"hidden"},children:e},e))}),(0,d.jsx)("div",{role:"grid",style:{display:"grid",gridTemplateColumns:`repeat(${v.length}, ${o}px)`,columnGap:i},children:v.map((e,t)=>(0,d.jsx)("div",{role:"row",style:{display:"grid",gridTemplateRows:`repeat(7, ${o}px)`,rowGap:i},children:e.map((e,n)=>{if(e<b||e>y)return(0,d.jsx)("div",{"aria-hidden":"true"},n);const r=ad(e),i=w.get(r)??0,a=function(e,t,n){if(e<=0)return n[0];if(t<=0)return n[0];const r=e/t;return r>.75?n[4]:r>.5?n[3]:r>.25?n[2]:n[1]}(i,k,S),l=C({date:r,value:i});return(0,d.jsx)("div",{role:"gridcell",tabIndex:0===n&&0===t?0:-1,"data-cell":`${t}-${n}`,"aria-label":l,onClick:()=>c?.({date:r,value:i}),onKeyDown:e=>{"Enter"===e.key||" "===e.key?(e.preventDefault(),c?.({date:r,value:i})):((e,t,n)=>{let r=null;const o=e.currentTarget.parentElement?.parentElement;function i(e,t){return o.querySelector(`[data-cell="${e}-${t}"]`)}o&&("ArrowRight"===e.key?r=i(t+1,n):"ArrowLeft"===e.key?r=i(t-1,n):"ArrowDown"===e.key?r=i(t,n+1):"ArrowUp"===e.key&&(r=i(t,n-1)),r&&(e.preventDefault(),r.focus()))})(e,t,n)},onMouseEnter:e=>{const t=e.target.getBoundingClientRect(),n=e.currentTarget.closest('[role="img"]')?.getBoundingClientRect();x({date:r,value:i,x:t.left-(n?.left??0)+t.width/2,y:t.top-(n?.top??0)})},onMouseLeave:()=>x(null),onFocus:e=>{const t=e.target.getBoundingClientRect(),n=e.currentTarget.closest('[role="img"]')?.getBoundingClientRect();x({date:r,value:i,x:t.left-(n?.left??0)+t.width/2,y:t.top-(n?.top??0)})},onBlur:()=>x(null),style:{width:o,height:o,background:a,borderRadius:2,cursor:c?"pointer":"default",border:`1px solid ${m.border}33`,outline:"none"}},n)})},t))})]}),(0,d.jsxs)("div",{"aria-hidden":"true",style:{marginTop:8,display:"flex",alignItems:"center",justifyContent:"flex-end",gap:6,fontSize:10,color:m.textMuted},children:[(0,d.jsx)("span",{children:"Less"}),S.map((e,t)=>(0,d.jsx)("span",{style:{width:o,height:o,background:e,borderRadius:2,border:`1px solid ${m.border}33`}},t)),(0,d.jsx)("span",{children:"More"})]}),g&&(0,d.jsx)("div",{role:"tooltip",style:{position:"absolute",left:g.x,top:g.y-8,transform:"translate(-50%, -100%)",padding:"4px 10px",background:m.surface,border:`1px solid ${m.border}`,borderRadius:6,fontSize:11,color:m.text,pointerEvents:"none",whiteSpace:"nowrap",zIndex:10,boxShadow:"0 4px 12px rgba(0,0,0,0.3)"},children:C({date:g.date,value:g.value})})]})},exports.TkxCalendarLunar=ql,exports.TkxCaptcha=sl,exports.TkxCard=Lt,exports.TkxCardBody=function({children:e,className:t,...n}){return(0,d.jsx)("div",{className:Ct($t(""),t),...n,children:e})},exports.TkxCardFooter=function({children:e,className:t,style:n,...r}){const o=J();return(0,d.jsx)("div",{className:Ct($t("flex items-center justify-end gap-2 mt-4 pt-4"),t),style:{borderTop:`1px solid ${o.border}`,...n},...r,children:e})},exports.TkxCardHeader=function({title:e,subtitle:t,action:n,children:r,className:o,...i}){const a=J();return(0,d.jsxs)("div",{className:Ct($t("flex justify-between items-start mb-4"),o),...i,children:[(0,d.jsxs)("div",{className:$t("flex-1 min-w-0"),children:[e&&(0,d.jsx)("h3",{className:$t("text-base font-semibold m-0"),style:{color:a.text},children:e}),t&&(0,d.jsx)("p",{className:$t("text-sm mt-1 mb-0"),style:{color:a.textMuted},children:t}),r]}),n&&(0,d.jsx)("div",{className:$t("ml-3 shrink-0"),children:n})]})},exports.TkxCarousel=Wo,exports.TkxCascader=function({options:e,value:t=[],onChange:n,placeholder:r="Select...",label:o}){const i=J(),l=qe(),s=(0,a.useRef)(null),u=(0,a.useRef)(null),[p,h]=(0,a.useState)(!1),[f,m]=(0,a.useState)(t),[g,x]=(0,a.useState)({top:0,left:0,width:0}),y=o?pe(o):void 0,b=pe(r),v=t.length>0?function(e,t){return Ka(e,t).map(e=>pe(e.label)).join(" / ")}(e,t):"";(0,a.useEffect)(()=>{if(!p||!s.current)return;const e=s.current.getBoundingClientRect();x({top:e.bottom+4+window.scrollY,left:e.left+window.scrollX,width:Math.max(e.width,200)})},[p]),(0,a.useEffect)(()=>{if(!p)return;const e=e=>{s.current?.contains(e.target)||u.current?.contains(e.target)||h(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[p]);const w=(0,a.useCallback)((t,r)=>{if(r.disabled)return;const o=[...f.slice(0,t),r.value];if(m(o),!r.children?.length){const t=Ka(e,o);n?.(o,t),h(!1)}},[f,e,n]),k=(0,a.useCallback)(e=>{"Escape"===e.key?(h(!1),s.current?.focus()):"Enter"!==e.key&&" "!==e.key||p||(e.preventDefault(),h(!0))},[p]),$=function(e,t){const n=[e];let r=e;for(const o of t){const e=r.find(e=>e.value===o);if(!e?.children?.length)break;n.push(e.children),r=e.children}return n}(e,f),S=p?(0,c.createPortal)((0,d.jsx)("div",{ref:u,role:"tree","aria-label":y??"Cascader options",className:$t("flex rounded-lg border overflow-hidden"),style:{position:"absolute",zIndex:9999,top:g.top,left:g.left,backgroundColor:i.surface,borderColor:i.border,boxShadow:`0 4px 16px ${i.bg}80`,animation:l?"none":"tkxFadeIn 0.15s ease"},children:$.map((e,t)=>(0,d.jsx)("ul",{role:"group",className:$t("m-0 p-0 overflow-auto"),style:{listStyle:"none",minWidth:160,maxHeight:260,borderRight:t<$.length-1?`1px solid ${i.border}`:"none"},children:e.map(e=>{const n=f[t]===e.value,r=pe(e.label);return(0,d.jsxs)("li",{role:"treeitem","aria-selected":n,"aria-disabled":e.disabled||void 0,"aria-expanded":e.children?.length?n:void 0,className:$t("flex items-center justify-between px-3 py-2 cursor-pointer text-sm"),style:{backgroundColor:n?i.surfaceAlt:"transparent",color:e.disabled?i.textMuted:i.text,opacity:e.disabled?.5:1,cursor:e.disabled?"not-allowed":"pointer"},onClick:()=>w(t,e),onMouseEnter:()=>{e.disabled||m(n=>[...n.slice(0,t),e.value])},children:[(0,d.jsx)("span",{children:r}),e.children&&e.children.length>0&&(0,d.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",style:{color:i.textMuted,flexShrink:0},children:(0,d.jsx)("path",{d:"M10 6l6 6-6 6V6z"})})]},e.value)})},t))}),document.body):null;return(0,d.jsxs)("div",{className:$t("relative font-sans"),onKeyDown:k,children:[y&&(0,d.jsx)("label",{className:$t("block text-sm font-medium mb-1"),style:{color:i.text},children:y}),(0,d.jsxs)("button",{ref:s,type:"button",role:"combobox","aria-expanded":p,"aria-haspopup":"tree","aria-label":y??"Cascader",className:$t("w-full flex items-center justify-between rounded-lg border px-3 py-2 text-sm cursor-pointer"),style:{backgroundColor:i.surface,borderColor:p?i.primary:i.border,color:v?i.text:i.textMuted,outline:"none",minHeight:38,textAlign:"left"},onClick:()=>h(e=>!e),children:[(0,d.jsx)("span",{className:$t("truncate"),children:v||b}),(0,d.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",style:{color:i.textMuted,transform:p?"rotate(180deg)":"rotate(0deg)",transition:l?"none":"transform 0.2s ease",flexShrink:0},children:(0,d.jsx)("path",{d:"M7 10l5 5 5-5H7z"})})]}),S]})},exports.TkxChat=function({messages:e,onSend:t,isLoading:n=!1,placeholder:r="Type a message…",maxLength:o,showTimestamps:i=!1,avatarUser:l,avatarAssistant:s,height:c=480,inputPosition:u="bottom"}){const p=J(),h=qe(),[f,m]=(0,a.useState)(""),g=(0,a.useRef)(null),x=(0,a.useRef)(null);(0,a.useEffect)(()=>{!function(){if(yr||"undefined"==typeof document)return;yr=!0;const e=document.createElement("style");e.textContent="\n @keyframes tkx-blink { 0%,100% { opacity:1 } 50% { opacity:0 } }\n @keyframes tkx-bounce { 0%,100% { transform:translateY(0) } 50% { transform:translateY(-5px) } }\n .tkx-cursor::after { content:'▋'; display:inline-block; animation:tkx-blink 1s step-start infinite; margin-left:1px; }\n .tkx-dot1 { animation:tkx-bounce 1s ease-in-out infinite; }\n .tkx-dot2 { animation:tkx-bounce 1s ease-in-out 0.2s infinite; }\n .tkx-dot3 { animation:tkx-bounce 1s ease-in-out 0.4s infinite; }\n ",document.head.appendChild(e)}()},[]),(0,a.useEffect)(()=>{const e=g.current;e&&e.scrollTo({top:e.scrollHeight,behavior:h?"auto":"smooth"})},[e,n,h]);const y=(0,a.useCallback)(()=>{const e=f.trim();e&&t&&(t(e),m(""),x.current&&(x.current.style.height="auto"))},[f,t]),b=(0,a.useCallback)(e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),y())},[y]),v=(0,a.useCallback)(e=>{m(o?e.target.value.slice(0,o):e.target.value);const t=x.current;if(t){t.style.height="auto";const e=120;t.style.height=`${Math.min(t.scrollHeight,e)}px`}},[o]),w=f.trim().length>0&&!n,k="number"==typeof c?`${c}px`:c,$="floating"===u,S=(0,d.jsxs)("div",{className:$t("flex flex-col gap-1 p-3"),style:$?{position:"absolute",bottom:12,left:12,right:12,borderRadius:16,backgroundColor:p.surface,border:`1px solid ${p.border}`,boxShadow:"0 4px 24px rgba(0,0,0,0.18)"}:{borderTop:`1px solid ${p.border}`,backgroundColor:p.surface},children:[(0,d.jsxs)("div",{className:$t("flex items-end gap-2"),children:[(0,d.jsx)("textarea",{ref:x,rows:1,value:f,onChange:v,onKeyDown:b,placeholder:pe(r),"aria-label":"Message input","aria-multiline":"true",disabled:n,className:$t("flex-1 resize-none text-sm leading-6 bg-transparent outline-none py-1"),style:{color:p.text,caretColor:p.primary,minHeight:32,maxHeight:120}}),(0,d.jsx)("button",{onClick:y,disabled:!w,"aria-label":"Send message",className:$t("shrink-0 w-9 h-9 rounded-xl flex items-center justify-center",!h&&"transition-opacity duration-150",w?"cursor-pointer opacity-100":"opacity-40 cursor-not-allowed"),style:{backgroundColor:p.primary,color:p.bg},children:(0,d.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M2 14L14 8 2 2v4.5l8 1.5-8 1.5V14z",fill:"currentColor"})})})]}),o&&(0,d.jsxs)("div",{className:$t("text-right text-[10px]"),style:{color:p.textMuted},children:[f.length,"/",o]})]});return(0,d.jsxs)("div",{className:$t("flex flex-col overflow-hidden rounded-2xl"),style:{height:k,backgroundColor:p.bg,border:`1px solid ${p.border}`,position:"relative"},children:[(0,d.jsx)("div",{ref:g,role:"log","aria-live":"polite","aria-label":"Chat messages",className:$t("flex-1 overflow-y-auto p-4"),style:{paddingBottom:$?80:void 0},children:(0,d.jsxs)("div",{role:"list",children:[e.map(e=>(0,d.jsx)(kr,{message:e,showTimestamp:i,avatarUser:l,avatarAssistant:s},e.id)),n&&(0,d.jsxs)("div",{role:"listitem",className:$t("flex gap-2 mb-4"),children:[(0,d.jsx)("div",{className:$t("w-8 h-8 shrink-0")}),(0,d.jsx)(wr,{})]})]})}),S]})},exports.TkxChatBubble=kr,exports.TkxCheckbox=gn,exports.TkxCheckout=Ul,exports.TkxClock=Qr,exports.TkxCol=Qi,exports.TkxColorPicker=function({value:e,defaultValue:t="#3b82f6",onChange:n,format:r="hex",showAlpha:o=!1,presets:i=bo,disabled:l=!1,size:s="md",placeholder:u,label:p,style:h}){const f=J(),m=(0,a.useRef)(null),g=(0,a.useRef)(null),[x,y]=(0,a.useState)(!1),b=void 0!==e,[v,w]=(0,a.useState)(b&&e||t),k=b?e||t:v,[$,S]=(0,a.useState)(1),[C,z]=(0,a.useState)(k),[M,N]=(0,a.useState)({top:0,left:0}),[D,R,P]=ho(xo(k)?k:t);Math.round(P+R/100*Math.min(P/100,1-P/100)*100);const F=(0,a.useCallback)((e,t=$)=>{xo(e)&&(z(e),b||w(e),n?.(yo(e,t,r),r))},[$,b,r,n]);(0,a.useEffect)(()=>{b&&e&&xo(e)&&z(e)},[b,e]),(0,a.useEffect)(()=>{if(!x)return;const e=e=>{g.current&&!g.current.contains(e.target)&&m.current&&!m.current.contains(e.target)&&y(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[x]),(0,a.useEffect)(()=>{if(!x)return;const e=e=>{"Escape"===e.key&&y(!1)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[x]);const A=e=>{S(e),n?.(yo(k,e,r),r)},I={sm:28,md:34,lg:40}[s],[L,T,W]=mo(xo(k)?k:t),j={display:"inline-flex",alignItems:"center",gap:"8px",height:`${I}px`,padding:"4px 10px 4px 6px",borderRadius:"8px",border:`1px solid ${f.border}`,backgroundColor:f.surface,cursor:l?"not-allowed":"pointer",opacity:l?.5:1,color:f.text,fontSize:"13px",fontFamily:"inherit",transition:"border-color 0.15s",...h},E={width:I-8+"px",height:I-8+"px",borderRadius:"4px",backgroundColor:`rgba(${L},${T},${W},${$})`,border:`1px solid ${f.border}`,flexShrink:0},B={position:"absolute",top:M.top,left:M.left,zIndex:9999,width:"260px",backgroundColor:f.surface,border:`1px solid ${f.border}`,borderRadius:"12px",padding:"16px",boxShadow:"0 8px 32px rgba(0,0,0,0.24)",display:"flex",flexDirection:"column",gap:"12px"},V={width:"100%",padding:"6px 10px",borderRadius:"6px",border:`1px solid ${f.border}`,backgroundColor:f.bg,color:f.text,fontSize:"12px",fontFamily:"monospace",outline:"none"},H={flex:1,padding:"5px 6px",borderRadius:"6px",border:`1px solid ${f.border}`,backgroundColor:f.bg,color:f.text,fontSize:"11px",textAlign:"center",fontFamily:"monospace",outline:"none"},O=e=>({width:"20px",height:"20px",borderRadius:"50%",backgroundColor:e,border:e.toLowerCase()===k.toLowerCase()?`2px solid ${f.primary}`:`1px solid ${f.border}`,cursor:"pointer",flexShrink:0,transition:"transform 0.1s"});return(0,d.jsxs)(d.Fragment,{children:[p&&(0,d.jsx)("label",{style:{display:"block",fontSize:"13px",color:f.text,marginBottom:"6px",fontWeight:500},children:p}),(0,d.jsxs)("button",{ref:m,type:"button",style:j,onClick:()=>{if(l)return;const e=m.current;if(!e)return;const t=e.getBoundingClientRect();N({top:(window.innerHeight-t.bottom>320?t.bottom+6:t.top-326)+window.scrollY,left:t.left+window.scrollX}),y(!0)},disabled:l,"aria-label":`Color picker, current color ${k}`,"aria-haspopup":"dialog","aria-expanded":x,children:[(0,d.jsx)("div",{style:E}),(0,d.jsx)("span",{style:{fontFamily:"monospace",fontSize:"12px",color:f.textMuted},children:u??yo(xo(k)?k:t,$,r)})]}),x&&(0,c.createPortal)((0,d.jsxs)("div",{ref:g,style:B,role:"dialog","aria-label":"Color picker",children:[(0,d.jsx)(vo,{hue:D,sat:R,bright:P,onChange:(e,t)=>{const n=t/100,r=n*(1-e/100/2),o=0===r||1===r?0:(n-r)/Math.min(r,1-r);F(fo(D,Math.round(100*o),Math.round(100*r)))}}),(0,d.jsx)(wo,{hue:D,onChange:e=>{F(fo(e,R,P))}}),o&&(0,d.jsx)(ko,{alpha:$,hex:xo(k)?k:t,onChange:A}),(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,d.jsx)("div",{style:{width:"28px",height:"28px",borderRadius:"6px",flexShrink:0,backgroundColor:`rgba(${L},${T},${W},${$})`,border:`1px solid ${f.border}`}}),(0,d.jsx)("input",{style:V,value:C,onChange:e=>{const t=e.target.value;z(t),xo(t)&&F(t)},maxLength:7,spellCheck:!1,"aria-label":"Hex color value"})]}),(0,d.jsxs)("div",{style:{display:"flex",gap:"6px",alignItems:"center"},children:[["r","g","b"].map(e=>(0,d.jsxs)("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:"3px",alignItems:"center"},children:[(0,d.jsx)("input",{style:H,type:"number",min:0,max:255,value:"r"===e?L:"g"===e?T:W,onChange:t=>((e,t)=>{const n=Math.max(0,Math.min(255,parseInt(t)||0)),[r,o,i]=mo(k);F("r"===e?go(n,o,i):"g"===e?go(r,n,i):go(r,o,n))})(e,t.target.value),"aria-label":`${e.toUpperCase()} channel`}),(0,d.jsx)("span",{style:{fontSize:"10px",color:f.textMuted,textTransform:"uppercase"},children:e})]},e)),o&&(0,d.jsxs)("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:"3px",alignItems:"center"},children:[(0,d.jsx)("input",{style:H,type:"number",min:0,max:100,value:Math.round(100*$),onChange:e=>A(Math.max(0,Math.min(1,parseInt(e.target.value)/100||0))),"aria-label":"Alpha channel"}),(0,d.jsx)("span",{style:{fontSize:"10px",color:f.textMuted},children:"A%"})]})]}),i.length>0&&(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{style:{fontSize:"11px",color:f.textMuted,marginBottom:"6px",fontWeight:500},children:"Presets"}),(0,d.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px"},children:i.map(e=>(0,d.jsx)("button",{type:"button",style:O(e),onClick:()=>F(e),"aria-label":`Select color ${e}`,onMouseEnter:e=>{e.currentTarget.style.transform="scale(1.15)"},onMouseLeave:e=>{e.currentTarget.style.transform="scale(1)"}},e))})]})]}),document.body)]})},exports.TkxCommand=Lo,exports.TkxCommandPalette=function({commands:e,hotkey:t=Cd,open:n,onOpenChange:r,placeholder:o="Type a command…",onSelect:i,recents:l=!0,maxRecents:s=5,emptyState:u,className:p}){const[h,f]=(0,a.useState)(!1),m=n??h,g=(0,a.useCallback)(e=>{void 0===n&&f(e),r?.(e)},[n,r]),[x,y]=(0,a.useState)(""),[b,v]=(0,a.useState)([]),[w,k]=(0,a.useState)(0),$=(0,a.useRef)(null),S=(0,a.useRef)(null),C=(0,a.useId)();(0,a.useEffect)(()=>{if(!t)return;const e=e=>{e.key.toLowerCase()===t.key.toLowerCase()&&function(e,t){return!t||($d?e.metaKey:e.ctrlKey)}(e,t.ctrl??!0)&&(t.shift??!1)===e.shiftKey&&(t.alt??!1)===e.altKey&&(e.preventDefault(),g(!m))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t,m,g]),(0,a.useEffect)(()=>{m&&(y(""),k(0),requestAnimationFrame(()=>$.current?.focus()))},[m]);const z=(0,a.useMemo)(()=>{const t=e.filter(e=>!e.hidden);if(""===x.trim()){const e=[],n=new Set(l?b:[]),r=new Map(t.map(e=>[e.id,e]));if(l)for(const t of b){const n=r.get(t);n&&e.push({cmd:n,section:"Recents",score:0,recent:!0})}for(const o of t)n.has(o.id)||e.push({cmd:o,section:o.section??"Commands",score:0});return e}const n=[];for(const e of t){const t=Sd(x,e.title),r=e.subtitle?Sd(x,e.subtitle):null;let o=null;null!==t&&(o=t),null!==r&&(o=null===o?r-4:Math.max(o,r-4)),null!==o&&n.push({cmd:e,section:e.section??"Commands",score:o})}return n.sort((e,t)=>t.score-e.score),n},[e,x,b,l]),M=(0,a.useMemo)(()=>{const e=new Map,t=[];for(const n of z)e.has(n.section)||(e.set(n.section,[]),t.push(n.section)),e.get(n.section).push(n);return t.map(t=>({section:t,items:e.get(t)}))},[z]),N=(0,a.useMemo)(()=>M.flatMap(e=>e.items),[M]);(0,a.useEffect)(()=>{w>=N.length&&k(Math.max(0,N.length-1))},[N.length,w]);const D=(0,a.useCallback)(e=>{i?.(e),e.onSelect?.(e),v(t=>[e.id,...t.filter(t=>t!==e.id)].slice(0,s)),g(!1)},[i,g,s]);if((0,a.useEffect)(()=>{S.current&&S.current.querySelector(`[data-idx="${w}"]`)?.scrollIntoView({block:"nearest"})},[w]),!m)return null;if("undefined"==typeof document)return null;const R=`${C}-opt-${w}`;return(0,c.createPortal)((0,d.jsx)("div",{role:"dialog","aria-modal":"true","aria-label":"Command palette",className:p,onClick:()=>g(!1),"data-testid":"tkx-command-palette",style:{position:"fixed",inset:0,zIndex:9999,display:"flex",alignItems:"flex-start",justifyContent:"center",padding:"min(15vh, 120px) 16px 16px",background:"rgba(8, 10, 25, 0.6)",backdropFilter:"blur(8px)"},children:(0,d.jsxs)("div",{onClick:e=>e.stopPropagation(),onKeyDown:e=>{switch(e.key){case"ArrowDown":e.preventDefault(),k(e=>Math.min(N.length-1,e+1));break;case"ArrowUp":e.preventDefault(),k(e=>Math.max(0,e-1));break;case"Enter":{e.preventDefault();const t=N[w];t&&D(t.cmd);break}case"Escape":e.preventDefault(),g(!1);break;case"Home":e.preventDefault(),k(0);break;case"End":e.preventDefault(),k(N.length-1)}},style:{width:"100%",maxWidth:560,maxHeight:"70vh",display:"flex",flexDirection:"column",background:"rgba(18, 20, 38, 0.92)",backdropFilter:"blur(20px) saturate(140%)",border:"1px solid rgba(196,168,255,0.25)",borderRadius:14,boxShadow:"0 24px 64px rgba(0,0,0,0.55), 0 0 0 1px rgba(0,245,212,0.08)",overflow:"hidden",color:"#e8e8f4"},children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"14px 18px",borderBottom:"1px solid rgba(255,255,255,0.08)"},children:[(0,d.jsx)("span",{"aria-hidden":"true",style:{fontSize:18,opacity:.7},children:"🔍"}),(0,d.jsx)("input",{ref:$,role:"combobox","aria-expanded":!0,"aria-controls":`${C}-list`,"aria-activedescendant":N.length?R:void 0,value:x,onChange:e=>{y(e.target.value),k(0)},placeholder:o,"data-testid":"cmdk-input",style:{flex:1,border:"none",outline:"none",background:"transparent",fontSize:15,color:"inherit",fontFamily:"inherit",minWidth:0}}),(0,d.jsx)("kbd",{"aria-hidden":"true",style:{fontSize:10,fontWeight:700,padding:"2px 6px",borderRadius:4,border:"1px solid rgba(255,255,255,0.12)",color:"#aaa",background:"rgba(255,255,255,0.04)",fontFamily:"ui-monospace, monospace"},children:"ESC"})]}),(0,d.jsxs)("ul",{ref:S,id:`${C}-list`,role:"listbox","data-testid":"cmdk-list",style:{listStyle:"none",margin:0,padding:6,overflow:"auto",flex:1,minHeight:0},children:[0===N.length&&(0,d.jsx)("li",{"data-testid":"cmdk-empty",style:{padding:"24px 16px",textAlign:"center",color:"#888",fontSize:13},children:u??`No matches for "${x}"`}),M.map(e=>{const t=N.indexOf(e.items[0]);return(0,d.jsxs)("li",{role:"presentation",children:[(0,d.jsx)("div",{style:{padding:"8px 12px 4px",fontSize:10,fontWeight:700,letterSpacing:"0.08em",textTransform:"uppercase",color:"#888"},children:e.section}),(0,d.jsx)("ul",{role:"presentation",style:{listStyle:"none",margin:0,padding:0},children:e.items.map((e,n)=>{const r=t+n,o=r===w;return(0,d.jsxs)("li",{id:r===w?R:void 0,role:"option","aria-selected":o,"data-testid":`cmdk-item-${e.cmd.id}`,"data-idx":r,onMouseMove:()=>k(r),onClick:()=>D(e.cmd),style:zd(o),children:[e.cmd.icon&&(0,d.jsx)("span",{"aria-hidden":"true",style:{fontSize:16,opacity:.9},children:e.cmd.icon}),(0,d.jsxs)("span",{style:{flex:1,minWidth:0},children:[(0,d.jsx)("span",{style:{fontWeight:600,fontSize:13.5,color:"#e8e8f4",display:"block"},children:e.cmd.title}),e.cmd.subtitle&&(0,d.jsx)("span",{style:{fontSize:12,color:"#aaa",display:"block"},children:e.cmd.subtitle})]}),e.cmd.shortcut&&(0,d.jsx)("span",{style:{display:"inline-flex",gap:4},children:e.cmd.shortcut.map((e,t)=>(0,d.jsx)("kbd",{style:Md(o),children:e},t))})]},e.cmd.id)})})]},e.section)})]})]})}),document.body)},exports.TkxConfetti=Tl,exports.TkxConfigProvider=ta,exports.TkxContent=Ki,exports.TkxCountdown=function({title:e,value:t,format:n="HH:mm:ss",onFinish:r,prefix:o,suffix:i,style:l}){const s=J(),d=pe(e),c=(0,a.useRef)(r);c.current=r;const u=(0,a.useRef)(!1),[p,h]=(0,a.useState)(()=>Math.max(0,t-Date.now()));(0,a.useEffect)(()=>{u.current=!1;const e=()=>{const e=Math.max(0,t-Date.now());h(e),e<=0&&!u.current&&(u.current=!0,c.current?.())};e();const n=setInterval(e,1e3);return()=>clearInterval(n)},[t]);const f=function(e,t){if(e<=0)return t.replace(/DD?/g,"0").replace(/HH?/g,"00").replace(/mm?/g,"00").replace(/ss?/g,"00");const n=Math.floor(e/1e3),r=Math.floor(n/86400),o=Math.floor(n%86400/3600),i=Math.floor(n%3600/60),a=n%60,l=e=>String(e).padStart(2,"0");return t.replace(/DD/g,l(r)).replace(/D/g,String(r)).replace(/HH/g,l(o)).replace(/H/g,String(o)).replace(/mm/g,l(i)).replace(/m/g,String(i)).replace(/ss/g,l(a)).replace(/s/g,String(a))}(p,n);return(0,a.createElement)("div",{style:{display:"flex",flexDirection:"column",gap:"4px",...l}},(0,a.createElement)("div",{style:{color:s.textMuted,fontSize:"0.875rem",lineHeight:"1.4"}},d),(0,a.createElement)("div",{style:{display:"flex",alignItems:"baseline",gap:"4px",fontSize:"1.75rem",fontWeight:700,lineHeight:"1.2",color:p<=0?s.danger:s.text,fontVariantNumeric:"tabular-nums"}},o&&(0,a.createElement)("span",{style:{fontSize:"0.75em",fontWeight:400}},o),(0,a.createElement)("span",null,f),i&&(0,a.createElement)("span",{style:{fontSize:"0.6em",fontWeight:400,color:s.textMuted}},i)))},exports.TkxCurrencyInput=Al,exports.TkxDataGrid=function({columns:e,data:t,rowKey:n,selectable:r=!1,selectedRows:o=[],onSelectionChange:i,sortable:l=!1,onSort:s,loading:c=!1,emptyMessage:u,stickyHeader:p=!1,striped:h=!1,bordered:f=!1,compact:m=!1,maxHeight:g,onRowClick:x,virtualScroll:y,rowHeight:b=40,showFilters:v=!1,filterValues:w,onFilterChange:k,pageSize:$=0,showExport:S=!1,exportFileName:C="export",onLoadMore:z,hasMore:M,loadingMore:N=!1,loadMoreThreshold:D=200,groupBy:R,defaultExpandedGroups:P="all",onGroupToggle:F,onCellEdit:A,onCellEditStart:I,onCellEditCancel:L,childRowsKey:T,defaultExpandedRows:W="none",onRowExpand:j,indentSize:E=24}){const B=J(),V=_t(),H=u??V.noRows??V.noData??"No data to display",O=qe(),q=(0,a.useId)(),[U,K]=(0,a.useState)(null),[Y,Z]=(0,a.useState)("asc"),X=(0,a.useCallback)(e=>{const t=U===e&&"asc"===Y?"desc":"asc";K(e),Z(t),s?.(e,t)},[U,Y,s]),G=(0,a.useMemo)(()=>s||!U?t:[...t].sort((e,t)=>{const n=di(si(e,U),si(t,U));return"asc"===Y?n:-n}),[t,U,Y,s]),[_,Q]=(0,a.useState)({}),ee=w??_,te=(0,a.useCallback)((e,t)=>{k?k(e,t):Q(n=>({...n,[e]:t}))},[k]),ne=(0,a.useMemo)(()=>{const e=Object.entries(ee).filter(([,e])=>""!==e.trim());return 0===e.length?G:G.filter(t=>e.every(([e,n])=>{const r=si(t,e);return String(r??"").toLowerCase().includes(n.toLowerCase())}))},[G,ee]),re=(0,a.useMemo)(()=>{if(R&&e.some(e=>e.key===R))return R},[R,e]),oe=(0,a.useMemo)(()=>{if(!re)return[];const e=new Map;for(const t of ne){const n=t[re],r=String(n??""),o=e.get(r);o?o.push(t):e.set(r,[t])}return Array.from(e.entries()).map(([e,t])=>({key:e,rows:t}))},[ne,re]),[ie,ae]=(0,a.useState)((0,a.useMemo)(()=>"none"===P?new Set:Array.isArray(P)?new Set(P):new Set,[P])),le=(0,a.useRef)(new Set);(0,a.useEffect)(()=>{if(!re||"all"!==P)return;let e=!1;ae(t=>{const n=new Set(t);for(const r of oe)le.current.has(r.key)||(le.current.add(r.key),n.add(r.key),e=!0);return e?n:t})},[oe,re,P]);const se=(0,a.useCallback)(e=>{ae(t=>{const n=new Set(t),r=!n.has(e);return r?n.add(e):n.delete(e),F?.(e,r),n})},[F]),de=(0,a.useMemo)(()=>{if(!re)return ne.map(e=>({type:"row",row:e}));const e=[];for(const t of oe)if(e.push({type:"group",key:t.key,rows:t.rows}),ie.has(t.key))for(const n of t.rows)e.push({type:"row",row:n});return e},[re,ne,oe,ie]),ce=(0,a.useRef)(!1),ue=(0,a.useRef)(!1),he=(0,a.useRef)(!1),fe=(0,a.useMemo)(()=>!(!T||re&&(ce.current||(ce.current=!0),1)),[T,re]),me=(0,a.useMemo)(()=>{if(fe)return e.find(e=>e.tree)?.key},[e,fe]),ge=(0,a.useCallback)((e,t,r)=>{if(!(t>32))for(const o of e){const e=o[T??""];if(Array.isArray(e)&&e.length>0){const i=li(o,n);i&&"undefined"!==i&&"null"!==i&&r.add(i),ge(e,t+1,r)}}},[T,n]),[xe,ye]=(0,a.useState)((0,a.useMemo)(()=>{if(!fe)return new Set;if("none"===W)return new Set;if("all"===W){const e=new Set;return ge(t,0,e),e}return new Set(W.map(String))},[fe,W,t,ge])),be=(0,a.useRef)(null);(0,a.useEffect)(()=>{if(!fe)return;if("all"!==W)return;if(be.current===t)return;be.current=t;const e=new Set;ge(t,0,e),ye(t=>{const n=new Set(t);for(const r of e)n.add(r);return n})},[fe,W,t,ge]);const ve=(0,a.useCallback)(e=>{ye(t=>{const n=new Set(t),r=!n.has(e);return r?n.add(e):n.delete(e),j?.(e,r),n})},[j]),we=(0,a.useMemo)(()=>{if(!fe||!T)return[];const e=[];let t=!1,r=!1;const o=(i,a)=>{if(a>32)return void(t=!0);const l=0===a?i:(e=>s||!U?e:[...e].sort((e,t)=>{const n=di(si(e,U),si(t,U));return"asc"===Y?n:-n}))(i);for(let t=0;t<l.length;t++){const i=l[t],s=li(i,n);if(!s||"undefined"===s||"null"===s){r=!0;continue}const d=i[T],c=Array.isArray(d)?d:[],u=c.length>0,p=u&&xe.has(s);e.push({row:i,depth:a,hasChildren:u,isExpanded:p,siblingCount:l.length,siblingIndex:t,id:s}),p&&o(c,a+1)}};return o(ne,0),r&&!ue.current&&(ue.current=!0),t&&!he.current&&(he.current=!0),e},[fe,T,ne,xe,n,U,Y,s]),[ke,$e]=(0,a.useState)(1),Se=$>0,Ce=fe?we.length:de.length,ze=Se?Math.max(1,Math.ceil(Ce/$)):1;(0,a.useEffect)(()=>{$e(1)},[ee,U,Y]);const Me=(0,a.useMemo)(()=>Se?de.slice((ke-1)*$,ke*$):de,[de,Se,ke,$]),Ne=(0,a.useMemo)(()=>fe?Se?we.slice((ke-1)*$,ke*$):we:[],[fe,we,Se,ke,$]),De=(0,a.useMemo)(()=>re||fe?[]:Se?ne.slice((ke-1)*$,ke*$):ne,[ne,Se,ke,$,re,fe]),Re=void 0!==y?y:!Se&&void 0!==g&&De.length>=50,Pe=(0,a.useRef)(null),[Fe,Ae]=(0,a.useState)(0),[Ie,Le]=(0,a.useState)(0),Te=(0,a.useCallback)(()=>{Pe.current&&Ae(Pe.current.scrollTop)},[]);(0,a.useEffect)(()=>{if(!Re||!Pe.current)return;const e=Pe.current;Le(e.clientHeight);const t=new ResizeObserver(()=>Le(e.clientHeight));return t.observe(e),()=>t.disconnect()},[Re]);const We=fe?Ne:De;We.length;const je=Re?Math.max(0,Math.floor(Fe/b)-10):0,Ee=Re?Math.min(We.length,Math.ceil((Fe+Ie)/b)+10):We.length,Be=Re?De.slice(je,Ee):De,Ve=fe?Re?Ne.slice(je,Ee):Ne:[],He=je*b,Oe=(0,a.useRef)(null),Ue=(0,a.useRef)(!1);(0,a.useEffect)(()=>{Ue.current=!1},[t.length]),(0,a.useEffect)(()=>{if(!z)return;const e=Oe.current;if(!e)return;const t=new IntersectionObserver(e=>{e[0].isIntersecting&&!Ue.current&&!1!==M&&(Ue.current=!0,z())},{root:Pe.current,rootMargin:`0px 0px ${D}px 0px`,threshold:0});return t.observe(e),()=>t.disconnect()},[z,M,D]);const Ke=(0,a.useMemo)(()=>new Set(o),[o]),Ye=(0,a.useMemo)(()=>ne.map(e=>li(e,n)),[ne,n]),Ze=Ye.length>0&&Ye.every(e=>Ke.has(e)),Xe=Ye.some(e=>Ke.has(e)),Ge=(0,a.useCallback)(()=>{i?.(Ze?[]:Ye)},[Ze,Ye,i]),_e=(0,a.useCallback)(e=>{const t=Ke.has(e)?o.filter(t=>t!==e):[...o,e];i?.(t)},[Ke,o,i]),[Je,Qe]=(0,a.useState)({}),et=(0,a.useRef)(null),tt=(0,a.useMemo)(()=>{const t={},n=e.filter(e=>"left"===e.pinned),o=e.filter(e=>"right"===e.pinned),i=e=>{const t=Je[e.key]??e.width;if("number"==typeof t)return t;if("string"==typeof t){const e=parseFloat(t);if(!Number.isNaN(e))return e}return 150};let a=r?40:0;n.forEach((e,r)=>{t[e.key]={side:"left",offset:a,isEdge:r===n.length-1},a+=i(e)});let l=0;for(let e=o.length-1;e>=0;e--){const n=o[e];t[n.key]={side:"right",offset:l,isEdge:0===e},l+=i(n)}return t},[e,Je,r]),nt=Object.keys(tt).length>0,[rt,ot]=(0,a.useState)(!1),[it,at]=(0,a.useState)(!1),lt=(0,a.useRef)(null),st=(0,a.useCallback)(()=>{const e=Pe.current;e&&(ot(e.scrollLeft>0),at(e.scrollLeft+e.clientWidth<e.scrollWidth-1))},[]),dt=(0,a.useCallback)(()=>{null==lt.current&&(lt.current=requestAnimationFrame(()=>{lt.current=null,st()}))},[st]);(0,a.useEffect)(()=>{if(nt)return st(),()=>{null!=lt.current&&cancelAnimationFrame(lt.current)}},[nt,st,e.length]);const ct=(0,a.useCallback)((e,t)=>{const n=tt[e.key];if(!n)return{};const r="left"===n.side&&n.isEdge&&rt,o="right"===n.side&&n.isEdge&&it,i=r?"2px 0 4px rgba(0,0,0,0.15)":o?"-2px 0 4px rgba(0,0,0,0.15)":void 0;return{position:"sticky",[n.side]:n.offset,zIndex:t?3:2,backgroundColor:B.surface,boxShadow:i}},[tt,rt,it,B.surface]),ut=(0,a.useCallback)((e,t)=>{t.preventDefault(),t.stopPropagation();const n=t.target.closest("th");if(!n)return;const r=Je[e]||n.getBoundingClientRect().width;et.current={key:e,startX:t.clientX,startWidth:r};const o=e=>{if(!et.current)return;const t=Math.max(50,et.current.startWidth+e.clientX-et.current.startX);Qe(e=>({...e,[et.current.key]:t}))},i=()=>{et.current=null,document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",i)};document.addEventListener("mousemove",o),document.addEventListener("mouseup",i)},[Je]),pt=(0,a.useCallback)(()=>{const t=[e.map(e=>ci(e.header)).join(","),...ne.map(t=>e.map(e=>ci(si(t,e.key))).join(","))].join("\n"),n=new Blob([t],{type:"text/csv;charset=utf-8;"}),r=URL.createObjectURL(n),o=document.createElement("a");o.href=r,o.download=`${C}.csv`,o.click(),URL.revokeObjectURL(r)},[e,ne,C]),[ht,ft]=(0,a.useState)(null),[mt,gt]=(0,a.useState)(null),xt=(0,a.useRef)(null),yt=(0,a.useRef)(new Map),bt=(0,a.useRef)(!1),vt=(0,a.useCallback)((e,t)=>{if(null==e.editable||!1===e.editable)return!1;if("function"==typeof e.editable)try{return e.editable(t)}catch{return!1}return!0===e.editable},[]),wt=(0,a.useCallback)((e,t,n)=>{"undefined"!==e&&"null"!==e&&""!==e?(ft({rowId:e,columnKey:t.key}),I?.({rowId:e,columnKey:t.key,row:n})):bt.current||(bt.current=!0)},[I]),kt=(0,a.useCallback)((e,t)=>{xt.current={rowId:e,columnKey:t},ft(null)},[]);(0,a.useEffect)(()=>{if(null!==ht||!xt.current)return;const{rowId:e,columnKey:t}=xt.current,n=`${e}::${t}`,r=yt.current.get(n);r&&r.focus(),xt.current=null},[ht]);const St=(0,a.useCallback)((e,t,r)=>{const o=li(e,n),i=si(e,t.key);if(i===r)return void kt(o,t.key);const a=A?.({rowId:o,columnKey:t.key,newValue:r,oldValue:i,row:e});a&&"function"==typeof a.then?(gt({rowId:o,columnKey:t.key}),kt(o,t.key),a.catch(()=>{}).finally(()=>{gt(e=>e&&e.rowId===o&&e.columnKey===t.key?null:e)})):kt(o,t.key)},[n,A,kt]),Ct=(0,a.useCallback)((e,t)=>{const r=li(e,n);L?.({rowId:r,columnKey:t.key,row:e}),kt(r,t.key)},[n,L,kt]),zt=m?"4px":"8px",Mt=m?"8px":"12px",Nt=e=>{const t=Je[e.key]||e.width;return{width:null!=t?t:void 0,minWidth:null!=t?t:80,textAlign:e.align??"left",padding:`${zt} ${Mt}`}},Dt=f?`1px solid ${B.border}`:"none",Rt=pe(H),Pt=e.length+(r?1:0),Ft=e.some(e=>e.filterable);return(0,d.jsxs)("div",{role:fe?"treegrid":"grid","aria-label":"Data grid","aria-rowcount":Ce,id:q,className:$t("font-sans rounded-lg overflow-hidden"),style:{border:`1px solid ${B.border}`,backgroundColor:B.bg},children:[(0,d.jsx)(pi,{label:"data grid",showExport:S,onExport:pt,totalRows:Ce,selectedCount:o.length,theme:B}),(0,d.jsxs)("div",{ref:Pe,"data-scrolled-left":nt&&rt?"":void 0,"data-scrolled-right":nt&&it?"":void 0,onScroll:e=>{Re&&Te(),nt&&dt()},style:{maxHeight:g??"none",overflowX:"auto",overflowY:g?"auto":"visible"},children:[(0,d.jsxs)("table",{className:$t("w-full"),style:{borderCollapse:"separate",borderSpacing:0,tableLayout:"auto"},children:[(0,d.jsxs)("thead",{children:[(0,d.jsxs)("tr",{role:"row",children:[r&&(0,d.jsx)("th",{scope:"col",role:"columnheader",style:{position:p||nt?"sticky":"static",top:0,left:nt?0:void 0,zIndex:3,backgroundColor:B.surface,borderBottom:`2px solid ${B.border}`,borderRight:Dt,padding:`${zt} ${Mt}`,width:40,textAlign:"center"},children:(0,d.jsxs)("label",{style:{display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",margin:"0 auto",width:16},children:[(0,d.jsx)("input",{type:"checkbox",checked:Ze,ref:e=>{e&&(e.indeterminate=Xe&&!Ze)},onChange:Ge,"aria-label":Ze?"Deselect all rows":"Select all rows",style:{position:"absolute",opacity:0,width:16,height:16,cursor:"pointer",margin:0}}),(0,d.jsx)(ai,{checked:Ze,indeterminate:Xe&&!Ze})]})}),e.map(e=>{const t=(e.sortable??l)&&!1!==e.sortable,n=U===e.key,r=pe(e.header),o=ct(e,!0),i=!!tt[e.key];return(0,d.jsx)("th",{scope:"col",role:"columnheader","data-pinned":tt[e.key]?.side,"aria-sort":n?"asc"===Y?"ascending":"descending":t?"none":void 0,className:$t("text-xs font-semibold uppercase tracking-wider"),style:{...Nt(e),position:p||i?"sticky":"static",top:0,zIndex:i?o.zIndex:2,backgroundColor:B.surface,color:B.textMuted,borderBottom:`2px solid ${B.border}`,borderRight:Dt,cursor:t?"pointer":"default",userSelect:"none",whiteSpace:"nowrap",transition:O?"none":"background-color 150ms ease",...o},onClick:t?()=>X(e.key):void 0,onKeyDown:t?t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),X(e.key))}:void 0,tabIndex:t?0:void 0,children:(0,d.jsxs)("div",{className:$t("flex items-center gap-1"),style:{position:"relative"},children:[e.renderHeader?e.renderHeader(e):r,t&&(0,d.jsx)(ri,{direction:n?Y:null}),e.resizable&&(0,d.jsx)("div",{role:"separator","aria-orientation":"vertical","aria-label":`Resize column ${r}`,className:$t("cursor-col-resize shrink-0"),style:{position:"absolute",right:0,top:0,bottom:0,width:4,backgroundColor:"transparent"},onMouseDown:t=>ut(e.key,t)})]})},e.key)})]}),(v||Ft)&&(0,d.jsxs)("tr",{role:"row","aria-label":"Column filters",children:[r&&(0,d.jsx)("th",{scope:"col",style:{backgroundColor:B.surfaceAlt,borderBottom:`1px solid ${B.border}`,borderRight:Dt,padding:`4px ${Mt}`,width:40,...nt?{position:"sticky",left:0,zIndex:2}:{}}}),e.map(e=>{const t=tt[e.key];return(0,d.jsx)("th",{scope:"col","data-pinned":t?.side,style:{backgroundColor:B.surfaceAlt,borderBottom:`1px solid ${B.border}`,borderRight:Dt,padding:`4px ${Mt}`,...t?{position:"sticky",[t.side]:t.offset,zIndex:2}:{}},children:(e.filterable||v)&&(0,d.jsx)("input",{type:"text",value:ee[e.key]??"",onChange:t=>te(e.key,t.target.value),placeholder:`${V.filterPlaceholder.replace(/[.…]+$/,"")} ${e.header}…`,"aria-label":`Filter by ${e.header}`,style:{width:"100%",padding:"3px 8px",fontSize:12,borderRadius:4,border:`1px solid ${B.border}`,backgroundColor:B.bg,color:B.text,outline:"none"}})},e.key)})]})]}),c&&(0,d.jsx)(ui,{colCount:Pt}),!c&&(0,d.jsx)("tbody",{children:(fe?0===we.length:0===Me.length)?(0,d.jsx)("tr",{children:(0,d.jsx)("td",{colSpan:Pt,className:$t("text-center py-10"),style:{color:B.textMuted},children:Rt})}):fe?(0,d.jsx)(d.Fragment,{children:Ve.map(t=>{const{row:n,depth:o,hasChildren:i,isExpanded:a,siblingCount:l,siblingIndex:s,id:c}=t,u=Ke.has(c),p=h&&s%2==1;let f="transparent";return u?f=`${B.primary}22`:p&&(f=B.surfaceAlt),(0,d.jsxs)("tr",{role:"row","data-tree-row":"","data-tree-depth":o,"aria-level":o+1,"aria-setsize":l,"aria-posinset":s+1,"aria-expanded":i?a:void 0,"aria-selected":r?u:void 0,onClick:x?()=>x(n):void 0,onKeyDown:x?e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),x(n))}:void 0,tabIndex:x?0:void 0,className:$t(x?"cursor-pointer":""),style:{backgroundColor:f,transition:O?"none":"background-color 120ms ease"},children:[r&&(0,d.jsx)("td",{role:"gridcell",style:{borderBottom:`1px solid ${B.border}`,borderRight:Dt,padding:`${zt} ${Mt}`,textAlign:"center",width:40,...nt?{position:"sticky",left:0,zIndex:2,backgroundColor:B.surface}:{}},children:(0,d.jsxs)("label",{style:{display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",margin:"0 auto",width:16},onClick:e=>e.stopPropagation(),children:[(0,d.jsx)("input",{type:"checkbox",checked:u,onChange:()=>_e(c),"aria-label":u?`Deselect row ${c}`:`Select row ${c}`,style:{position:"absolute",opacity:0,width:16,height:16,cursor:"pointer",margin:0}}),(0,d.jsx)(ai,{checked:u})]})}),e.map(e=>{const t=si(n,e.key),r=e.renderCell?e.renderCell(t,n):"string"==typeof t?pe(t):String(t??""),l=ct(e,!1),s=vt(e,n),u=ht?.rowId===c&&ht.columnKey===e.key,p=mt?.rowId===c&&mt.columnKey===e.key,h=`${c}::${e.key}`,f=e.key===me,m="string"==typeof t&&t?t:String(c);return(0,d.jsx)("td",{role:"gridcell","data-pinned":tt[e.key]?.side,"data-tree-cell":f?"":void 0,"data-editing":u?"":void 0,"data-saving":p?"":void 0,"aria-readonly":s?"false":void 0,tabIndex:s?0:void 0,ref:e=>{e?yt.current.set(h,e):yt.current.delete(h)},onDoubleClick:s&&!u?t=>{t.stopPropagation(),wt(c,e,n)}:void 0,onKeyDown:s&&!u?t=>{"Enter"!==t.key&&"F2"!==t.key||(t.preventDefault(),t.stopPropagation(),wt(c,e,n))}:void 0,className:$t("text-sm"),style:{...Nt(e),borderBottom:`1px solid ${B.border}`,borderRight:Dt,color:B.text,overflow:u?"visible":"hidden",textOverflow:"ellipsis",whiteSpace:u?"normal":"nowrap",opacity:p?.6:1,cursor:s&&!u?"text":void 0,...l},children:u?(0,d.jsx)(fi,{col:e,row:n,initialValue:t,onCommit:t=>St(n,e,t),onCancel:()=>Ct(n,e)}):f?(0,d.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:0},children:[(0,d.jsx)("span",{"aria-hidden":"true",style:{display:"inline-block",width:o*E,flexShrink:0}}),i?(0,d.jsx)("button",{type:"button","data-tree-caret":"","aria-label":a?`Collapse ${m}`:`Expand ${m}`,onClick:e=>{e.stopPropagation(),ve(c)},onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),e.stopPropagation(),ve(c))},style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:16,height:16,marginRight:6,padding:0,border:"none",background:"transparent",color:B.text,cursor:"pointer",flexShrink:0},children:(0,d.jsx)(ii,{expanded:a})}):(0,d.jsx)("span",{"data-tree-leaf":"","aria-hidden":"true",style:{display:"inline-block",width:16,height:16,marginRight:6,flexShrink:0}}),(0,d.jsx)("span",{children:r})]}):r},e.key)})]},c)})}):re?(0,d.jsx)(d.Fragment,{children:Me.map((t,o)=>{if("group"===t.type){const n=ie.has(t.key),o=`${q}-group-${t.key}`;return(0,d.jsxs)("tr",{role:"row","data-group-row":"","data-group-key":t.key,tabIndex:0,onClick:()=>se(t.key),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),se(t.key))},style:{backgroundColor:B.surfaceAlt,cursor:"pointer",fontWeight:600},children:[r&&(0,d.jsx)("td",{style:{borderBottom:`1px solid ${B.border}`,borderRight:Dt,padding:`${zt} ${Mt}`,width:40,backgroundColor:B.surfaceAlt,...nt?{position:"sticky",left:0,zIndex:2}:{}}}),e.map((e,r)=>{const i=ct(e,!1),a=!!tt[e.key],l=function(e,t){const n=e.aggregate;if(null==n)return;if("function"==typeof n)try{return n(t)}catch{return}if("count"===n)return t.length;const r=[];for(const o of t){const t=o[e.key],n="number"==typeof t?t:Number(t);Number.isFinite(n)&&r.push(n)}if(0!==r.length)switch(n){case"sum":return r.reduce((e,t)=>e+t,0);case"avg":return r.reduce((e,t)=>e+t,0)/r.length;case"min":return Math.min(...r);case"max":return Math.max(...r);default:return}}(e,t.rows),s=0===r;return(0,d.jsx)("td",{role:s?"rowheader":"gridcell","data-pinned":tt[e.key]?.side,"aria-expanded":s?n:void 0,"aria-controls":s?o:void 0,className:$t("text-sm"),style:{...Nt(e),borderBottom:`1px solid ${B.border}`,borderRight:Dt,color:B.text,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",...i,...a?{backgroundColor:B.surfaceAlt}:{}},children:s?(0,d.jsxs)("span",{children:[(0,d.jsx)(oi,{expanded:n}),pe(t.key)||"(empty)",(0,d.jsxs)("span",{style:{marginLeft:8,fontWeight:400,color:B.textMuted,fontSize:12},children:["(",t.rows.length," row",1!==t.rows.length?"s":"",")"]}),void 0!==l&&e.key!==re&&(0,d.jsx)("span",{style:{marginLeft:12,fontWeight:400,color:B.textMuted,fontSize:12},"data-group-agg":e.key,children:String(l)})]}):void 0!==l?(0,d.jsx)("span",{"data-group-agg":e.key,children:String(l)}):null},e.key)})]},`group:${t.key}`)}const i=t.row,a=o,l=li(i,n),s=Ke.has(l),c=h&&a%2==1;let u="transparent";return s?u=`${B.primary}22`:c&&(u=B.surfaceAlt),(0,d.jsxs)("tr",{role:"row","aria-rowindex":a+1,"aria-selected":r?s:void 0,"data-group-key":String(i[re]??""),onClick:x?()=>x(i):void 0,onKeyDown:x?e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),x(i))}:void 0,tabIndex:x?0:void 0,className:$t(x?"cursor-pointer":""),style:{backgroundColor:u,transition:O?"none":"background-color 120ms ease"},children:[r&&(0,d.jsx)("td",{role:"gridcell",style:{borderBottom:`1px solid ${B.border}`,borderRight:Dt,padding:`${zt} ${Mt}`,textAlign:"center",width:40,...nt?{position:"sticky",left:0,zIndex:2,backgroundColor:B.surface}:{}},children:(0,d.jsxs)("label",{style:{display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",margin:"0 auto",width:16},onClick:e=>e.stopPropagation(),children:[(0,d.jsx)("input",{type:"checkbox",checked:s,onChange:()=>_e(l),"aria-label":s?`Deselect row ${l}`:`Select row ${l}`,style:{position:"absolute",opacity:0,width:16,height:16,cursor:"pointer",margin:0}}),(0,d.jsx)(ai,{checked:s})]})}),e.map(e=>{const t=si(i,e.key),n=e.renderCell?e.renderCell(t,i):"string"==typeof t?pe(t):String(t??""),r=ct(e,!1),o=vt(e,i),a=ht?.rowId===l&&ht.columnKey===e.key,s=mt?.rowId===l&&mt.columnKey===e.key,c=`${l}::${e.key}`;return(0,d.jsx)("td",{role:"gridcell","data-pinned":tt[e.key]?.side,"data-editing":a?"":void 0,"data-saving":s?"":void 0,"aria-readonly":o?"false":void 0,tabIndex:o?0:void 0,ref:e=>{e?yt.current.set(c,e):yt.current.delete(c)},onDoubleClick:o&&!a?t=>{t.stopPropagation(),wt(l,e,i)}:void 0,onKeyDown:o&&!a?t=>{"Enter"!==t.key&&"F2"!==t.key||(t.preventDefault(),t.stopPropagation(),wt(l,e,i))}:void 0,className:$t("text-sm"),style:{...Nt(e),borderBottom:`1px solid ${B.border}`,borderRight:Dt,color:B.text,overflow:a?"visible":"hidden",textOverflow:"ellipsis",whiteSpace:a?"normal":"nowrap",opacity:s?.6:1,cursor:o&&!a?"text":void 0,...r},children:a?(0,d.jsx)(fi,{col:e,row:i,initialValue:t,onCommit:t=>St(i,e,t),onCancel:()=>Ct(i,e)}):n},e.key)})]},l)})}):(0,d.jsxs)(d.Fragment,{children:[Re&&He>0&&(0,d.jsx)("tr",{"aria-hidden":"true",children:(0,d.jsx)("td",{colSpan:Pt,style:{height:He,padding:0,border:"none"}})}),Be.map((t,o)=>{const i=je+o,a=li(t,n),l=Ke.has(a),s=h&&i%2==1;let c="transparent";return l?c=`${B.primary}22`:s&&(c=B.surfaceAlt),(0,d.jsxs)("tr",{role:"row","aria-rowindex":i+1,"aria-selected":r?l:void 0,onClick:x?()=>x(t):void 0,onKeyDown:x?e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),x(t))}:void 0,tabIndex:x?0:void 0,className:$t(x?"cursor-pointer":""),style:{backgroundColor:c,transition:O?"none":"background-color 120ms ease",...Re?{height:b,boxSizing:"border-box"}:{}},onMouseEnter:x?e=>{e.currentTarget.style.backgroundColor=l?`${B.primary}30`:B.surfaceAlt}:void 0,onMouseLeave:x?e=>{e.currentTarget.style.backgroundColor=c}:void 0,children:[r&&(0,d.jsx)("td",{role:"gridcell",style:{borderBottom:`1px solid ${B.border}`,borderRight:Dt,padding:`${zt} ${Mt}`,textAlign:"center",width:40,...nt?{position:"sticky",left:0,zIndex:2,backgroundColor:B.surface}:{}},children:(0,d.jsxs)("label",{style:{display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",margin:"0 auto",width:16},onClick:e=>e.stopPropagation(),children:[(0,d.jsx)("input",{type:"checkbox",checked:l,onChange:()=>_e(a),"aria-label":l?`Deselect row ${a}`:`Select row ${a}`,style:{position:"absolute",opacity:0,width:16,height:16,cursor:"pointer",margin:0}}),(0,d.jsx)(ai,{checked:l})]})}),e.map(e=>{const n=si(t,e.key),r=e.renderCell?e.renderCell(n,t):"string"==typeof n?pe(n):String(n??""),o=ct(e,!1),i=vt(e,t),l=ht?.rowId===a&&ht.columnKey===e.key,s=mt?.rowId===a&&mt.columnKey===e.key,c=`${a}::${e.key}`;return(0,d.jsx)("td",{role:"gridcell","data-pinned":tt[e.key]?.side,"data-editing":l?"":void 0,"data-saving":s?"":void 0,"aria-readonly":i?"false":void 0,tabIndex:i?0:void 0,ref:e=>{e?yt.current.set(c,e):yt.current.delete(c)},onDoubleClick:i&&!l?n=>{n.stopPropagation(),wt(a,e,t)}:void 0,onKeyDown:i&&!l?n=>{"Enter"!==n.key&&"F2"!==n.key||(n.preventDefault(),n.stopPropagation(),wt(a,e,t))}:void 0,className:$t("text-sm"),style:{...Nt(e),borderBottom:`1px solid ${B.border}`,borderRight:Dt,color:B.text,overflow:l?"visible":"hidden",textOverflow:"ellipsis",whiteSpace:l?"normal":"nowrap",opacity:s?.6:1,cursor:i&&!l?"text":void 0,...o},children:l?(0,d.jsx)(fi,{col:e,row:t,initialValue:n,onCommit:n=>St(t,e,n),onCancel:()=>Ct(t,e)}):r},e.key)})]},a)}),Re&&Ee<De.length&&(0,d.jsx)("tr",{"aria-hidden":"true",children:(0,d.jsx)("td",{colSpan:Pt,style:{height:(De.length-Ee)*b,padding:0,border:"none"}})})]})})]}),(M||N)&&(0,d.jsx)("div",{ref:Oe,style:{height:1,width:"100%"},children:N&&(0,d.jsx)("table",{style:{width:"100%",borderCollapse:"collapse"},children:(0,d.jsx)("tbody",{children:Array.from({length:3},(t,n)=>(0,d.jsx)("tr",{children:e.map(e=>(0,d.jsx)("td",{style:{padding:"10px 16px"},children:(0,d.jsx)(an,{variant:"text",height:"16px"})},e.key))},n))})})}),!M&&z&&(0,d.jsx)("div",{style:{padding:"16px",textAlign:"center",fontSize:13,color:B.textMuted},children:"✓ All rows loaded"})]}),Se&&!c&&(0,d.jsx)(hi,{page:ke,totalPages:ze,pageSize:$,totalRows:Ce,onPageChange:$e,theme:B})]})},exports.TkxDatePicker=Gn,exports.TkxDivider=cn,exports.TkxDrawer=function({isOpen:e,onClose:t,placement:n="right",size:r="md",title:o,children:i,footer:l,closeOnOverlayClick:s=!0,closeOnEsc:u=!0}){const p=J(),h=qe(),f=(0,a.useId)(),m=Ue(e);if(Ye(t,u&&e),(0,a.useEffect)(()=>{if(e){if(1===++Tn&&(document.body.style.overflow="hidden"),Le())try{window.dispatchEvent(new CustomEvent("tkx:framed-drawer",{detail:{placement:n,at:Date.now()}}))}catch{}}else Wn();return()=>{e&&Wn()}},[e,n]),"undefined"==typeof document)return null;const g=function(e,t){const n=Ln[t],r={position:"absolute"};return"left"===e||"right"===e?{...r,top:0,bottom:0,[e]:0,width:n,maxWidth:"100vw",height:"100%"}:{...r,left:0,right:0,[e]:0,height:n,maxHeight:"100vh",width:"100%"}}(n,r),x=function(e){switch(e){case"left":return"translateX(-100%)";case"right":return"translateX(100%)";case"top":return"translateY(-100%)";case"bottom":return"translateY(100%)"}}(n),y=h?"none":"transform 280ms cubic-bezier(0.4,0,0.2,1), opacity 280ms ease",b="string"==typeof o?pe(o):o;return(0,c.createPortal)((0,d.jsxs)("div",{role:"presentation",className:$t("fixed inset-0 z-[9000]"),style:{pointerEvents:e?"auto":"none",visibility:e?"visible":"hidden"},children:[(0,d.jsx)("div",{"aria-hidden":"true",onClick:s?t:void 0,className:$t("absolute inset-0"),style:{backgroundColor:"rgba(0,0,0,0.55)",backdropFilter:"blur(3px)",opacity:e?1:0,transition:h?"none":"opacity 280ms ease",cursor:s?"pointer":"default"}}),(0,d.jsxs)("div",{ref:m,role:"dialog","aria-modal":"true","aria-labelledby":o?f:void 0,className:$t("absolute flex flex-col font-sans"),style:{...g,backgroundColor:p.surface,borderLeft:"right"===n?`1px solid ${p.border}`:void 0,borderRight:"left"===n?`1px solid ${p.border}`:void 0,borderTop:"bottom"===n?`1px solid ${p.border}`:void 0,borderBottom:"top"===n?`1px solid ${p.border}`:void 0,boxShadow:`0 20px 60px ${p.bg}99`,transform:e?"translate(0,0)":x,opacity:e?1:0,transition:y,willChange:"transform"},children:[void 0!==o&&(0,d.jsxs)("div",{className:$t("flex items-center justify-between px-5 py-4 shrink-0"),style:{borderBottom:`1px solid ${p.border}`},children:[(0,d.jsx)("h2",{id:f,className:$t("m-0 text-base font-semibold leading-snug"),style:{color:p.text},children:b}),(0,d.jsx)("button",{onClick:t,"aria-label":"Close drawer",className:$t("bg-transparent border-none cursor-pointer rounded p-1 flex items-center justify-center focus-visible:focus-ring"),style:{color:p.textMuted},children:(0,d.jsx)(jn,{})})]}),void 0===o&&(0,d.jsx)("div",{className:$t("flex justify-end px-3 pt-3 shrink-0"),children:(0,d.jsx)("button",{onClick:t,"aria-label":"Close drawer",className:$t("bg-transparent border-none cursor-pointer rounded p-1 flex items-center justify-center focus-visible:focus-ring"),style:{color:p.textMuted},children:(0,d.jsx)(jn,{})})}),(0,d.jsx)("div",{className:$t("flex-1 overflow-y-auto px-5 py-4"),style:{color:p.text},children:i}),l&&(0,d.jsx)("div",{className:$t("flex items-center justify-end gap-2 px-5 py-4 shrink-0"),style:{borderTop:`1px solid ${p.border}`},children:l})]})]}),document.body)},exports.TkxDrivingLicenceInput=ls,exports.TkxDropdown=function({trigger:e,items:t,groups:n,placement:r="bottom-start",onSelect:o,selectedKeys:i,multiSelect:l=!1,searchable:s=!1,searchPlaceholder:u,closeOnSelect:p,disabled:h=!1,maxHeight:f=320,minWidth:m=200,open:g,onOpenChange:x,portal:y=!0,offset:b=6,renderItem:v}){const[w,k]=(0,a.useState)(!1),[$,S]=(0,a.useState)([]),[C,z]=(0,a.useState)({top:0,left:0,minWidth:m}),M=(0,a.useRef)(null),N=(0,a.useRef)(null),D=(0,a.useId)(),R=void 0!==g?g:w,P=void 0!==i?i:$,F=void 0!==p?p:!l,A=n??(t?[{items:t}]:[{items:[]}]),I=(0,a.useCallback)(e=>{void 0===g&&k(e),x?.(e)},[g,x]),L=(0,a.useCallback)((e,t)=>{l&&void 0===i&&S(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),o?.(e,t),F&&I(!1)},[l,i,o,F,I]),T=(0,a.useCallback)(()=>I(!1),[I]);(0,a.useEffect)(()=>{R&&M.current&&z(gs(M.current,N.current,r,b))},[R,r,b]),(0,a.useEffect)(()=>{R&&M.current&&N.current&&z(gs(M.current,N.current,r,b))},[R,r,b]),(0,a.useEffect)(()=>{if(!R)return;const e=e=>{const t=e.target;M.current&&!M.current.contains(t)&&N.current&&!N.current.contains(t)&&I(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[R,I]);const W=R?(0,d.jsx)(ys,{groups:A,position:C,maxHeight:f,minWidth:m,selectedKeys:P,multiSelect:l,searchable:s,searchPlaceholder:u,onSelect:L,onClose:T,renderItem:v,menuRef:N,isPortal:y,menuId:D}):null;return(0,d.jsxs)("div",{style:{display:"inline-block",position:"relative"},children:[(0,d.jsx)("div",{ref:M,onClick:()=>{h||I(!R)},"aria-haspopup":"menu","aria-expanded":R,"aria-controls":R?D:void 0,"aria-disabled":h,style:{cursor:h?"not-allowed":"pointer",opacity:h?.5:1,display:"inline-block"},children:e}),y&&"undefined"!=typeof document?(0,c.createPortal)(W,document.body):W]})},exports.TkxEmpty=function({image:e="default",description:t="No data",children:n,style:r}){const o=J(),i="string"==typeof t?pe(t):t;let l;return l="default"===e?(0,a.createElement)(ha,{color:o.primary,mutedColor:o.textMuted}):"simple"===e?(0,a.createElement)(fa,{mutedColor:o.textMuted}):e,(0,a.createElement)("div",{role:"status",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"32px 16px",textAlign:"center",...r}},(0,a.createElement)("div",{style:{marginBottom:"12px",opacity:.85}},l),i&&(0,a.createElement)("div",{style:{color:o.textMuted,fontSize:"0.875rem",lineHeight:"1.5",maxWidth:"320px"}},i),n&&(0,a.createElement)("div",{style:{marginTop:"16px"}},n))},exports.TkxFileUpload=function({accept:e,multiple:t=!1,maxSize:n,maxFiles:r,onChange:o,onError:i,label:l,hint:s,isDisabled:c=!1,preview:u=!0,dragDrop:p=!0,variant:h="dropzone"}){const f=J(),m=_t(),g=l??m.uploadFiles??"Upload files",x=m.dropFiles?.replace(/^.*$/,m.dropFiles)??"Drop files here",y=qe(),b=(0,a.useId)(),v=(0,a.useRef)(null),[w,k]=(0,a.useState)(!1),[$,S]=(0,a.useState)([]);(0,a.useEffect)(()=>()=>{$.forEach(e=>{e.objectUrl&&URL.revokeObjectURL(e.objectUrl)})},[]);const C=(0,a.useCallback)(e=>{let t=0;const n=setInterval(()=>{t+=Math.floor(20*Math.random())+10,t>=100&&(t=100,clearInterval(n)),S(n=>n.map(n=>n.id===e?{...n,progress:t}:n))},100)},[]),z=(0,a.useCallback)(t=>n&&t.size>n?`"${pe(t.name)}" exceeds max size of ${sr(n)}`:/[\u0000-\u001F\u007F]|\.\.\/|\.\.\\/.test(t.name)?`"${pe(t.name)}" contains forbidden characters`:e&&!e.split(",").map(e=>e.trim()).some(e=>e.startsWith(".")?t.name.toLowerCase().endsWith(e.toLowerCase()):e.endsWith("/*")?t.type.startsWith(e.slice(0,-1)):t.type===e)?`"${pe(t.name)}" is not an accepted file type`:void 0,[e,n]),M=(0,a.useCallback)(async e=>{if(!e.error)try{const t=await je(e.file);if(t&&e.file.type&&!e.file.type.startsWith(t.split("/")[0])){const t=`"${pe(e.file.name)}" file content does not match its type`;S(n=>n.map(n=>n.id===e.id?{...n,error:t}:n)),i?.(t)}}catch{}},[i]),N=(0,a.useCallback)(e=>{const n=r?r-$.length:1/0;if(n<=0)return void i?.(`Maximum of ${r} file${1===r?"":"s"} allowed`);const a=e.slice(0,n).map(e=>{const t=z(e),n=u&&e.type.startsWith("image/")&&!t?URL.createObjectURL(e):void 0;return{file:e,id:"tkx-file-"+ ++cr,objectUrl:n,progress:0,error:t}});S(e=>{const n=t?[...e,...a]:a,r=n.filter(e=>!e.error).map(e=>e.file);return o?.(r),n}),a.forEach(e=>{e.error?i?.(e.error):M(e)}),a.forEach(e=>{e.error||C(e.id)})},[$.length,r,t,o,i,u,C,z]),D=(0,a.useCallback)(e=>{const t=Array.from(e.target.files??[]);t.length&&N(t),e.target.value=""},[N]),R=(0,a.useCallback)(e=>{if(e.preventDefault(),k(!1),c)return;const t=Array.from(e.dataTransfer.files);t.length&&N(t)},[c,N]),P=(0,a.useCallback)(e=>{e.preventDefault(),c||k(!0)},[c]),F=(0,a.useCallback)(()=>k(!1),[]),A=(0,a.useCallback)(e=>{S(t=>{const n=t.find(t=>t.id===e);n?.objectUrl&&URL.revokeObjectURL(n.objectUrl);const r=t.filter(t=>t.id!==e);return o?.(r.filter(e=>!e.error).map(e=>e.file)),r})},[o]),I=(0,a.useCallback)(()=>{c||v.current?.click()},[c]),L=w?f.primary:f.border,T=pe(g),W=s?pe(s):"",j=(0,d.jsxs)("div",{role:"button",tabIndex:c?-1:0,"aria-label":T,"aria-describedby":s?b:void 0,"aria-disabled":c,onClick:I,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),I())},onDrop:p?R:void 0,onDragOver:p?P:void 0,onDragLeave:p?F:void 0,className:$t("flex flex-col items-center justify-center gap-3 w-full p-8 rounded-lg"),style:{border:`2px dashed ${L}`,backgroundColor:w?`${f.primary}10`:f.surface,cursor:c?"not-allowed":"pointer",opacity:c?.5:1,transition:y?"none":"border-color 150ms ease, background-color 150ms ease",outline:"none"},children:[(0,d.jsxs)("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:w?f.primary:f.textMuted,strokeWidth:1.5,"aria-hidden":"true",children:[(0,d.jsx)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,d.jsx)("polyline",{points:"17 8 12 3 7 8"}),(0,d.jsx)("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]}),(0,d.jsxs)("div",{className:$t("text-center"),children:[(0,d.jsx)("p",{className:$t("m-0 text-sm font-medium"),style:{color:f.text},children:w?x:T}),W&&(0,d.jsx)("p",{id:b,className:$t("m-0 text-xs mt-1"),style:{color:f.textMuted},children:W})]})]}),E=(0,d.jsxs)("button",{type:"button",disabled:c,onClick:I,"aria-describedby":s?b:void 0,className:$t("flex items-center gap-2 px-4 py-2 rounded-md text-sm font-medium font-sans border-none cursor-pointer"),style:{backgroundColor:f.primary,color:f.bg,opacity:c?.5:1,cursor:c?"not-allowed":"pointer"},children:[(0,d.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:[(0,d.jsx)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,d.jsx)("polyline",{points:"17 8 12 3 7 8"}),(0,d.jsx)("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]}),T,s&&(0,d.jsx)("span",{id:b,className:$t("sr-only"),children:W})]});return(0,d.jsxs)("div",{className:$t("flex flex-col gap-3 w-full font-sans"),children:[(0,d.jsx)("input",{ref:v,type:"file",accept:e,multiple:t,disabled:c,onChange:D,className:$t("sr-only"),tabIndex:-1,"aria-hidden":"true"}),"dropzone"===h?j:E,$.length>0&&(0,d.jsx)("ul",{role:"status","aria-live":"polite","aria-label":m.uploadFiles??"Uploaded files",className:$t("m-0 p-0 flex flex-col gap-2"),style:{listStyle:"none"},children:$.map(e=>(0,d.jsxs)("li",{className:$t("flex flex-col gap-1 rounded-md p-3"),style:{backgroundColor:f.surfaceAlt,border:`1px solid ${e.error?f.danger:f.border}`},children:[(0,d.jsxs)("div",{className:$t("flex items-center gap-3"),children:[e.objectUrl&&u?(0,d.jsx)("img",{src:e.objectUrl,alt:pe(e.file.name),className:$t("rounded"),style:{width:40,height:40,objectFit:"cover",flexShrink:0}}):(0,d.jsx)("span",{style:{flexShrink:0},children:(0,d.jsx)(dr,{mimeType:e.file.type,color:e.error?f.danger:f.textMuted})}),(0,d.jsxs)("div",{className:$t("flex flex-col gap-0.5 flex-1 min-w-0"),children:[(0,d.jsx)("span",{className:$t("text-sm font-medium truncate"),style:{color:e.error?f.danger:f.text},title:e.file.name,children:pe(e.file.name)}),(0,d.jsxs)("span",{className:$t("text-xs"),style:{color:f.textMuted},children:[sr(e.file.size),e.error&&` — ${e.error}`]})]}),(0,d.jsx)("button",{type:"button","aria-label":`Remove ${pe(e.file.name)}`,onClick:()=>A(e.id),className:$t("flex items-center justify-center bg-transparent border-none cursor-pointer rounded p-1"),style:{color:f.textMuted,flexShrink:0},children:(0,d.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:[(0,d.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,d.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),!e.error&&e.progress<100&&(0,d.jsx)("div",{className:$t("w-full overflow-hidden"),style:{height:"3px",borderRadius:"3px",backgroundColor:f.border},"aria-hidden":"true",children:(0,d.jsx)("div",{style:{height:"100%",borderRadius:"3px",backgroundColor:f.primary,width:`${e.progress}%`,transition:y?"none":"width 100ms ease"}})})]},e.id))})]})},exports.TkxFlowChart=xd,exports.TkxFontProvider=function({scripts:e,language:t,preconnect:n=!0,children:r}){const o=e&&e.length>0?e:t?hl(t):["latin"];return(0,a.useEffect)(()=>{n&&function(){if(ul||"undefined"==typeof document)return;const e=document.head,t=(t,n)=>{if(e.querySelector(`link[rel="preconnect"][href="${t}"]`))return;const r=document.createElement("link");r.rel="preconnect",r.href=t,n&&(r.crossOrigin="anonymous"),e.appendChild(r)};t("https://fonts.googleapis.com"),t("https://fonts.gstatic.com",!0),ul=!0}(),o.forEach(pl)},[o.join(","),n]),null==r?null:(0,d.jsx)(d.Fragment,{children:r})},exports.TkxFooter=Yi,exports.TkxForm=Ti,exports.TkxFormBuilder=function({schema:e,onChange:t,allowedTypes:n=Pc,defaultTab:r="design",style:o,className:i}){const l=J(),[s,c]=(0,a.useState)(r),[u,p]=(0,a.useState)(e.fields[0]?.id??null),h=(0,a.useMemo)(()=>e.fields.find(e=>e.id===u)??null,[e.fields,u]),f=(0,a.useCallback)(n=>{const r=function(e,t){const n=t+1,r={id:`fld-${Math.random().toString(36).slice(2,9)}`,type:e,name:Lc(e,n),label:Ic(e,n)};return"select"!==e&&"radio"!==e||(r.options=[{label:"Option 1",value:"option_1"},{label:"Option 2",value:"option_2"}]),r}(n,e.fields.length);t({...e,fields:[...e.fields,r]}),p(r.id)},[e,t]),m=(0,a.useCallback)((n,r)=>{const o=e.fields.findIndex(e=>e.id===n);if(o<0)return;const i=o+r;if(i<0||i>=e.fields.length)return;const a=e.fields.slice();[a[o],a[i]]=[a[i],a[o]],t({...e,fields:a})},[e,t]),g=(0,a.useCallback)(n=>{t({...e,fields:e.fields.filter(e=>e.id!==n)}),u===n&&p(null)},[e,t,u]),x=(0,a.useCallback)(n=>{h&&t({...e,fields:e.fields.map(e=>e.id===h.id?{...e,...n}:e)})},[e,t,h]);return(0,d.jsxs)("div",{className:i,"data-testid":"tkx-form-builder",style:{...Q(l),display:"flex",flexDirection:"column",height:600,border:"1px solid var(--tkx-border, #2a2a3e)",borderRadius:12,overflow:"hidden",background:"var(--tkx-bg, #0a0a0f)",color:"var(--tkx-fg, #e8e8f4)",fontFamily:"inherit",...o},children:[(0,d.jsx)("div",{role:"tablist","aria-label":"Form builder views",style:{display:"flex",borderBottom:"1px solid var(--tkx-border, #2a2a3e)",background:"var(--tkx-bg-subtle, #0d0d14)"},children:["design","preview","json"].map(e=>(0,d.jsx)("button",{type:"button",role:"tab","aria-selected":s===e,"data-testid":`tab-${e}`,onClick:()=>c(e),style:{padding:"12px 18px",minHeight:44,border:"none",background:s===e?"var(--tkx-bg, #0a0a0f)":"transparent",color:s===e?"var(--tkx-accent, #00f5d4)":l.textMuted,borderBottom:s===e?"2px solid var(--tkx-accent, #00f5d4)":"2px solid transparent",cursor:"pointer",fontSize:13,fontWeight:600,textTransform:"capitalize"},children:e},e))}),"design"===s&&(0,d.jsxs)("div",{style:{display:"flex",flex:1,minHeight:0},children:[(0,d.jsx)(Wc,{types:n,onAdd:f}),(0,d.jsx)(jc,{fields:e.fields,selectedId:u,onSelect:p,onMove:m,onRemove:g}),(0,d.jsx)(Bc,{field:h,onPatch:x})]}),"preview"===s&&(0,d.jsx)("div",{style:{display:"flex",flex:1,minHeight:0},children:(0,d.jsx)(qc,{schema:e})}),"json"===s&&(0,d.jsx)("pre",{"data-testid":"json-view",style:{flex:1,margin:0,padding:16,overflow:"auto",background:"var(--tkx-bg-subtle, #0d0d14)",color:l.primary,fontSize:12,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace"},children:JSON.stringify(e,null,2)})]})},exports.TkxFormField=Wi,exports.TkxFormulaBar=function({data:e,active:t,onChange:n,onActiveChange:r,showResult:o=!0,height:i=36,style:l,className:s}){const c=J(),u=mc(t.col,t.row),p=e.cells[u]??"",[h,f]=(0,a.useState)(p),[m,g]=(0,a.useState)(u);(0,a.useEffect)(()=>{f(p),g(u)},[u]);const x=o&&p.startsWith("=")?xc(u,e.cells):"",y=()=>{const t={...e.cells};""===h?delete t[u]:t[u]=h,n({cells:t})};return(0,d.jsxs)("div",{role:"toolbar","aria-label":"Formula bar","data-testid":"tkx-formula-bar",className:s,style:{...Q(c),display:"flex",alignItems:"stretch",gap:0,height:i,background:"var(--tkx-bg-subtle, #0d0d14)",border:"1px solid var(--tkx-border, #2a2a3e)",borderRadius:8,overflow:"hidden",fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",fontSize:13,...l},children:[(0,d.jsx)("input",{"aria-label":"Cell address","data-testid":"formula-bar-name",value:m,onChange:e=>g(Fe(e.target.value)),onKeyDown:e=>{if("Enter"===e.key){e.preventDefault();const t=gc(m.trim().toUpperCase());t?r?.(t):g(u)}else"Escape"===e.key&&(e.preventDefault(),g(u))},onBlur:()=>{gc(m.trim().toUpperCase())||g(u)},style:{width:90,flex:"0 0 90px",padding:"0 10px",border:"none",borderRight:"1px solid var(--tkx-border, #2a2a3e)",background:"transparent",color:"var(--tkx-accent, #00f5d4)",fontWeight:700,textAlign:"center",textTransform:"uppercase",fontFamily:"inherit",fontSize:"inherit",outline:"none"}}),(0,d.jsxs)("span",{"aria-hidden":"true",style:{display:"inline-flex",alignItems:"center",padding:"0 12px",color:c.textMuted,fontStyle:"italic",fontFamily:"serif",fontSize:14,borderRight:"1px solid var(--tkx-border-soft, #1a1a25)"},children:["f",(0,d.jsx)("sub",{style:{fontSize:9},children:"x"})]}),(0,d.jsx)("input",{"aria-label":"Cell content","data-testid":"formula-bar-input",value:h,onChange:e=>f(Fe(e.target.value)),onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),y()):"Escape"===e.key&&(e.preventDefault(),f(p))},onBlur:y,placeholder:"Type a value or =formula",style:{flex:1,minWidth:0,padding:"0 12px",border:"none",background:"transparent",color:h.startsWith("=")?"var(--tkx-accent, #00f5d4)":"var(--tkx-fg, #e8e8f4)",fontFamily:"inherit",fontSize:"inherit",outline:"none"}}),o&&p.startsWith("=")&&(0,d.jsxs)("span",{"data-testid":"formula-bar-result","aria-label":"Evaluated value",style:{display:"inline-flex",alignItems:"center",padding:"0 12px",borderLeft:"1px solid var(--tkx-border-soft, #1a1a25)",background:"rgba(0,245,212,0.06)",color:"string"==typeof x&&x.startsWith("#")?c.danger:c.text,fontWeight:600,minWidth:80,justifyContent:"flex-end"},children:["= ",String(x)]})]})},exports.TkxFunnelChart=qd,exports.TkxGantt=function({tasks:e,dayWidth:t=28,rowHeight:n=40,labelColumnWidth:r=220,selectedId:o,onSelect:i,onTaskChange:l,style:s,className:c}){const u=J(),[p,h]=(0,a.useState)(e[0]?.id??null),f=void 0!==o?o:p,{rangeStart:m,rangeEnd:g,totalDays:x,parsed:y}=(0,a.useMemo)(()=>{if(0===e.length){const e=Gd(new Date);return{rangeStart:e,rangeEnd:ec(e,7),totalDays:7,parsed:[]}}const t=e.map(e=>({task:e,start:Gd(e.start),end:Gd(e.end)}));let n=t[0].start,r=t[0].end;for(const e of t)e.start.getTime()<n.getTime()&&(n=e.start),e.end.getTime()>r.getTime()&&(r=e.end);const o=ec(n,-1),i=ec(r,1);return{rangeStart:o,rangeEnd:i,totalDays:Qd(o,i)+1,parsed:t}},[e]),b=(0,a.useCallback)(e=>Qd(m,e)*t,[m,t]),v=(0,a.useMemo)(()=>{const e=new Map;return y.forEach((t,n)=>e.set(t.task.id,{...t,index:n})),e},[y]),w=(0,a.useCallback)(t=>{void 0===o&&h(t);const n=e.find(e=>e.id===t);n&&i?.(t,n)},[o,i,e]),k=(0,a.useCallback)(e=>{if(!f)return;const t=v.get(f);if(!t)return;const n=ec(t.start,e),r=ec(t.end,e);l?.(f,{start:_d(n),end:_d(r)},t.task)},[f,v,l]),$=x*t,S=e.length*n;return(0,d.jsxs)("div",{className:c,role:"application","aria-label":"Gantt chart",tabIndex:0,onKeyDown:t=>{if(!f)return;const n=e.findIndex(e=>e.id===f);switch(t.key){case"ArrowUp":n>0&&(t.preventDefault(),w(e[n-1].id));break;case"ArrowDown":n<e.length-1&&(t.preventDefault(),w(e[n+1].id));break;case"ArrowLeft":t.preventDefault(),k(-1);break;case"ArrowRight":t.preventDefault(),k(1)}},"data-testid":"tkx-gantt",style:{...Q(u),display:"flex",outline:"none",border:"1px solid var(--tkx-border, #2a2a3e)",borderRadius:12,overflow:"hidden",background:"var(--tkx-bg, #0a0a0f)",color:"var(--tkx-fg, #e8e8f4)",...s},children:[(0,d.jsxs)("div",{role:"list","aria-label":"Tasks",style:{width:r,flex:`0 0 ${r}px`,borderRight:"1px solid var(--tkx-border, #2a2a3e)",background:"var(--tkx-bg-subtle, #0d0d14)",overflow:"hidden"},children:[(0,d.jsx)("div",{style:{height:48,borderBottom:"1px solid var(--tkx-border, #2a2a3e)",display:"flex",alignItems:"center",padding:"0 12px",fontSize:11,fontWeight:700,letterSpacing:"0.06em",textTransform:"uppercase",color:u.textMuted},children:"Task"}),e.map(e=>{const t=e.id===f;return(0,d.jsx)("div",{role:"listitem","data-testid":`gantt-label-${e.id}`,onClick:()=>w(e.id),style:{height:n,display:"flex",alignItems:"center",padding:"0 12px",cursor:"pointer",borderBottom:"1px solid var(--tkx-border-soft, #1a1a25)",background:t?"rgba(0,245,212,0.08)":"transparent",fontSize:13,fontWeight:t?600:400,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},title:e.label,children:e.label},e.id)})]}),(0,d.jsx)("div",{style:{flex:1,overflow:"auto"},children:(0,d.jsxs)("div",{style:{position:"relative",width:$,minWidth:"100%"},children:[(0,d.jsx)("div",{style:{height:48,borderBottom:"1px solid var(--tkx-border, #2a2a3e)",position:"sticky",top:0,background:"var(--tkx-bg-subtle, #0d0d14)",zIndex:2},children:Array.from({length:x}).map((e,n)=>{const r=ec(m,n),o=1===r.getUTCDate()||0===n,i=r.getUTCDay(),a=0===i||6===i;return(0,d.jsxs)("div",{style:{position:"absolute",left:n*t,top:0,width:t,height:48,fontSize:10,color:a?u.textMuted:u.text,textAlign:"center",borderRight:"1px solid var(--tkx-border-soft, #1a1a25)",paddingTop:4},children:[o&&(0,d.jsx)("div",{style:{fontSize:11,fontWeight:700,color:"var(--tkx-accent, #00f5d4)"},children:tc(r)}),(0,d.jsx)("div",{style:{marginTop:o?2:14},children:r.getUTCDate()})]},n)})}),(0,d.jsxs)("div",{style:{position:"relative",height:S},children:[Array.from({length:x}).map((e,n)=>{const r=ec(m,n).getUTCDay();return 0!==r&&6!==r?null:(0,d.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",left:n*t,top:0,width:t,height:S,background:"rgba(255,255,255,0.02)",pointerEvents:"none"}},`w${n}`)}),e.map((e,t)=>(0,d.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",left:0,right:0,top:(t+1)*n-1,height:1,background:"var(--tkx-border-soft, #1a1a25)",pointerEvents:"none"}},`r${t}`)),y.map((e,r)=>{const o=e.task.id===f,i=b(e.start),a=(Qd(e.start,e.end)+1)*t,l=e.task.color||"var(--tkx-accent, #00f5d4)",s=Math.max(0,Math.min(1,e.task.progress??0));return(0,d.jsxs)("div",{role:"button","aria-pressed":o,"aria-label":`${e.task.label}: ${_d(e.start)} to ${_d(e.end)}`,"data-testid":`gantt-bar-${e.task.id}`,onClick:()=>w(e.task.id),style:{position:"absolute",left:i,top:r*n+6,width:a,height:n-12,borderRadius:6,border:`1px solid ${l}`,background:o?`${l}33`:`${l}1f`,cursor:"pointer",overflow:"hidden",boxShadow:o?`0 0 0 2px ${l}40`:"none",display:"flex",alignItems:"center",paddingLeft:8,fontSize:12,fontWeight:600,color:"var(--tkx-fg, #e8e8f4)",boxSizing:"border-box"},children:[s>0&&(0,d.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",inset:0,width:100*s+"%",background:`${l}55`,pointerEvents:"none"}}),(0,d.jsx)("span",{style:{position:"relative",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%",paddingRight:8},children:e.task.label})]},e.task.id)}),(0,d.jsxs)("svg",{"aria-hidden":"true",width:$,height:S,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[(0,d.jsx)("defs",{children:(0,d.jsx)("marker",{id:"tkx-gantt-arrowhead",markerWidth:"6",markerHeight:"6",refX:"5",refY:"3",orient:"auto",children:(0,d.jsx)("path",{d:"M0,0 L6,3 L0,6 z",fill:"var(--tkx-fg-muted, #aaa)"})})}),y.flatMap((e,r)=>e.task.dependencies?.length?e.task.dependencies.map(o=>{const i=v.get(o);if(!i)return null;const a=b(i.end)+t,l=i.index*n+n/2,s=b(e.start),c=r*n+n/2,u=Math.max(a+8,s-8),p=`M ${a} ${l} L ${u} ${l} L ${u} ${c} L ${s} ${c}`;return(0,d.jsx)("path",{"data-testid":`gantt-arrow-${o}-to-${e.task.id}`,d:p,stroke:"var(--tkx-fg-muted, #aaa)",strokeOpacity:.6,strokeWidth:1.5,fill:"none",markerEnd:"url(#tkx-gantt-arrowhead)"},`${o}->${e.task.id}`)}):[])]})]})]})})]})},exports.TkxGauge=Id,exports.TkxHeader=Oi,exports.TkxHeatmap=Vd,exports.TkxHolographicAvatar=Ms,exports.TkxHolographicBadge=Ps,exports.TkxHolographicButton=Fs,exports.TkxHolographicCard=zs,exports.TkxHolographicGauge=function({value:e,size:t=140,thickness:n=.12,accent:r="#00f5d4",label:o,caption:i,ariaValueText:l,className:s,style:c}){As();const u=J(),p=Math.max(0,Math.min(100,e)),h=t*n,f=(t-h)/2,m=t/2,g=t/2,x=2*Math.PI*f,y=p/100*x,b=(0,a.useRef)(`holo-gauge-${Math.random().toString(36).slice(2,8)}`).current;return(0,d.jsxs)("div",{role:"meter","aria-valuenow":p,"aria-valuemin":0,"aria-valuemax":100,"aria-valuetext":l??`${p.toFixed(0)} percent`,className:s,style:{...Q(u),position:"relative",width:t,height:t,display:"inline-flex",alignItems:"center",justifyContent:"center",...c},children:[(0,d.jsxs)("svg",{width:t,height:t,"aria-hidden":"true",style:{position:"absolute",inset:0},children:[(0,d.jsx)("defs",{children:(0,d.jsxs)("linearGradient",{id:b,x1:"0",y1:"0",x2:"1",y2:"1",children:[(0,d.jsx)("stop",{offset:"0%",stopColor:r,stopOpacity:.95}),(0,d.jsx)("stop",{offset:"50%",stopColor:"#7b2ff7",stopOpacity:.95}),(0,d.jsx)("stop",{offset:"100%",stopColor:r,stopOpacity:.95})]})}),(0,d.jsx)("circle",{cx:m,cy:g,r:f,fill:"none",stroke:`${r}1a`,strokeWidth:h}),(0,d.jsx)("circle",{cx:m,cy:g,r:f,fill:"none",stroke:`url(#${b})`,strokeWidth:h,strokeLinecap:"round",strokeDasharray:`${y} ${x}`,transform:`rotate(-90 ${m} ${g})`,style:{filter:`drop-shadow(0 0 6px ${r}aa)`,transition:"stroke-dasharray 600ms cubic-bezier(.2,.8,.2,1)"}})]}),(0,d.jsxs)("div",{style:{position:"relative",textAlign:"center",zIndex:1,color:u.text},children:[(0,d.jsx)("div",{style:{fontSize:.22*t,fontWeight:800,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",fontVariantNumeric:"tabular-nums",color:r,lineHeight:1,textShadow:`0 0 16px ${r}88`},children:o??`${p.toFixed(0)}%`}),i&&(0,d.jsx)("div",{style:{fontSize:10,color:u.textMuted,marginTop:4,textTransform:"uppercase",letterSpacing:"0.08em"},children:i})]})]})},exports.TkxHolographicPanel=Is,exports.TkxHolographicProgress=function({value:e,label:t,valueLabel:n,height:r=8,accent:o="#00f5d4",shimmer:i=!0,className:a,style:l}){As();const s=J(),c=Math.max(0,Math.min(1,e));return(0,d.jsxs)("div",{className:a,style:{...Q(s),...l},children:[(t||n)&&(0,d.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",marginBottom:6,fontSize:12},children:[(0,d.jsx)("span",{style:{color:s.textMuted,fontWeight:600},children:t}),(0,d.jsx)("span",{style:{color:o,fontFamily:"ui-monospace, monospace",fontVariantNumeric:"tabular-nums"},children:n??`${(100*c).toFixed(0)}%`})]}),(0,d.jsx)("div",{role:"progressbar","aria-valuenow":Math.round(100*c),"aria-valuemin":0,"aria-valuemax":100,style:{position:"relative",height:r,width:"100%",borderRadius:r,background:`${o}14`,overflow:"hidden"},children:(0,d.jsx)("div",{style:{position:"absolute",inset:0,width:100*c+"%",background:`linear-gradient(90deg, ${o}, #7b2ff7, ${o})`,backgroundSize:"200% 100%",animation:i?"tkx-holo-shimmer 3s linear infinite":void 0,boxShadow:`0 0 12px ${o}88`,transition:"width 600ms cubic-bezier(.2,.8,.2,1)",borderRadius:r}})})]})},exports.TkxHolographicSurface=Cs,exports.TkxHolographicTerminal=function({lines:e,typeSpeed:t=12,prompt:n="$ ",maxLines:r=10,height:o=220,accent:i="#00f5d4",className:l,style:s}){As();const c=J(),u=(0,a.useRef)(null),[p,h]=(0,a.useState)(()=>0===t?e:[]),f=(0,a.useRef)(0);(0,a.useEffect)(()=>{if(0===t)return void h(e);if(e.length<=f.current)return h(e),void(f.current=e.length);let n=!1;const r=f.current,o=e[r]??"";let i=0;h(e=>[...e.slice(0,r),""]);const a=()=>{n||(i+=1,h(e=>{const t=e.slice();return t[r]=o.slice(0,i),t}),i<o.length?setTimeout(a,t):(f.current=r+1,e.length>f.current&&h(e=>[...e,""])))};return a(),()=>{n=!0}},[e,t]),(0,a.useEffect)(()=>{const e=u.current;e&&(e.scrollTop=e.scrollHeight)},[p]);const m=p.slice(-r);return(0,d.jsxs)("div",{ref:u,role:"log","aria-live":"polite",className:l,style:{...Q(c),position:"relative",height:o,padding:12,borderRadius:10,background:"linear-gradient(180deg, rgba(0,10,20,0.7), rgba(0,5,10,0.9))",border:`1px solid ${i}33`,color:i,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",fontSize:12,lineHeight:1.5,overflowY:"auto",boxShadow:`inset 0 0 24px ${i}14`,...s},children:[(0,d.jsx)("span",{className:"tkx-holo-foil","aria-hidden":"true",style:{borderRadius:10}}),(0,d.jsx)("pre",{style:{margin:0,position:"relative",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:m.map((e,t)=>(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{style:{color:c.textMuted},children:n}),(0,d.jsx)("span",{style:{color:i},children:e}),t===m.length-1&&(0,d.jsx)("span",{"aria-hidden":"true",style:{display:"inline-block",width:"0.6ch",height:"1em",marginLeft:2,background:i,verticalAlign:"text-bottom",animation:"tkx-holo-cursor 1.1s steps(2) infinite"}})]},t))}),(0,d.jsx)("style",{children:"\n @keyframes tkx-holo-cursor {\n 0%, 49% { opacity: 1; }\n 50%, 100% { opacity: 0; }\n }\n "})]})},exports.TkxIcon=_a,exports.TkxImage=function({src:e,alt:t,fallback:n,placeholder:r="skeleton",fit:o="cover",ratio:i="auto",radius:l="none",caption:s,lazy:u=!0,preview:p=!1,className:h,style:f,...m}){const g=J(),x=qe(),[y,b]=(0,a.useState)(!1),[v,w]=(0,a.useState)(!1),[k,$]=(0,a.useState)(!1),S=(0,a.useRef)(null),C=pe(e),z=t?pe(t):"",M=s?pe(s):"",N=ar[l];(0,a.useEffect)(()=>{S.current?.complete&&b(!0)},[]);const D=(0,a.useCallback)(()=>b(!0),[]),R=(0,a.useCallback)(()=>w(!0),[]),P=(0,a.useCallback)(()=>{p&&!v&&$(!0)},[p,v]),F=(0,a.useCallback)(()=>$(!1),[]);(0,a.useEffect)(()=>{if(!k)return;const e=e=>{"Escape"===e.key&&F()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[k,F]);const A="skeleton"===r&&!y&&!v,I=A&&!x?{animation:"tkx-shimmer 1.5s ease-in-out infinite"}:{},L=v?null:(0,d.jsx)("img",{ref:S,src:C,alt:z||void 0,role:z?void 0:"img","aria-label":z?void 0:"Image",loading:u?"lazy":void 0,onLoad:D,onError:R,onClick:p?P:void 0,className:Ct($t("block w-full h-full"),p&&!v?$t("cursor-pointer"):""),style:{objectFit:o,borderRadius:N,opacity:y?1:0,transition:x?"none":"opacity 200ms ease",position:"auto"===i?void 0:"absolute",inset:"auto"===i?void 0:0},...m}),T=v?n?(0,d.jsx)(d.Fragment,{children:n}):(0,d.jsxs)("div",{role:"img","aria-label":z||"Image failed to load",className:$t("flex flex-col items-center justify-center gap-2 w-full h-full"),style:{backgroundColor:g.surfaceAlt,borderRadius:N,color:g.textMuted,minHeight:"80px"},children:[(0,d.jsx)(lr,{color:g.textMuted,size:32}),(0,d.jsx)("span",{className:$t("text-xs"),style:{color:g.textMuted},children:"Failed to load"})]}):null,W=A?(0,d.jsx)("div",{"aria-hidden":"true",style:{position:"auto"===i?void 0:"absolute",inset:"auto"===i?void 0:0,width:"100%",height:"auto"===i?"100%":void 0,minHeight:"auto"===i?"80px":void 0,borderRadius:N,backgroundColor:g.surfaceAlt,...I}}):null,j="auto"===i?(0,d.jsxs)("div",{className:$t("relative w-full"),style:{borderRadius:N},children:[W,L,T]}):(0,d.jsxs)("div",{className:$t("relative w-full overflow-hidden"),style:{paddingBottom:ir[i],borderRadius:N},children:[W,L,T]}),E=M?(0,d.jsxs)("figure",{className:$t("m-0 p-0 flex flex-col gap-2"),style:{borderRadius:N},children:[j,(0,d.jsx)("figcaption",{className:$t("text-sm text-center"),style:{color:g.textMuted},children:M})]}):j;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:Ct($t("inline-block w-full"),h),style:f,children:E}),k&&"undefined"!=typeof document?(0,c.createPortal)((0,d.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":z||"Image preview",className:$t("fixed inset-0 z-[9500] flex items-center justify-center p-4"),onClick:F,children:[(0,d.jsx)("div",{"aria-hidden":"true",className:$t("absolute inset-0"),style:{backgroundColor:"rgba(0,0,0,0.85)",backdropFilter:"blur(6px)"}}),(0,d.jsx)("img",{src:C,alt:z||"Full-size preview",onClick:e=>e.stopPropagation(),className:$t("relative z-10 max-w-full max-h-full"),style:{objectFit:"contain",borderRadius:"8px",boxShadow:"0 25px 60px rgba(0,0,0,0.5)"}}),(0,d.jsx)("button",{"aria-label":"Close preview",onClick:F,className:$t("absolute top-4 right-4 z-10 flex items-center justify-center","bg-transparent border-none cursor-pointer rounded-full p-2"),style:{color:"#fff",backgroundColor:"rgba(255,255,255,0.15)"},children:(0,d.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:[(0,d.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,d.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),document.body):null]})},exports.TkxImageEditor=kl,exports.TkxInput=Tt,exports.TkxKanban=Ls,exports.TkxLayout=Hi,exports.TkxList=function({items:e,header:t,footer:n,bordered:r=!0,size:o="md",loading:i=!1,emptyText:a="No data",grid:l,className:s,style:c}){const u=J(),p=qe(),h=pe(a),f=Ya[o],m=!!l,g=l?.column??1,x=l?.gutter??16;return(0,d.jsxs)("div",{role:"list","aria-label":"List","aria-busy":i,className:$t("font-sans rounded-lg overflow-hidden",s??""),style:{border:r?`1px solid ${u.border}`:"none",backgroundColor:u.surface,...c},children:[t&&(0,d.jsx)("div",{className:$t("font-semibold text-sm"),style:{padding:f,color:u.text,borderBottom:`1px solid ${u.border}`,backgroundColor:u.surfaceAlt},children:t}),i&&(0,d.jsx)("div",{children:Array.from({length:3}).map((e,t)=>(0,d.jsx)(Za,{theme:u,reducedMotion:p},t))}),!i&&0===e.length&&(0,d.jsx)("div",{role:"status",className:$t("text-center py-12 text-sm"),style:{color:u.textMuted},children:h}),!i&&e.length>0&&(0,d.jsx)("div",{style:m?{display:"grid",gridTemplateColumns:`repeat(${g}, 1fr)`,gap:x,padding:x}:void 0,children:e.map((t,n)=>{const r=pe(t.title),o=t.description?pe(t.description):void 0;return(0,d.jsxs)("div",{role:"listitem",className:$t("flex items-start gap-3"),style:{padding:f,borderBottom:!m&&n<e.length-1?`1px solid ${u.border}`:"none",...m?{border:`1px solid ${u.border}`,borderRadius:8,backgroundColor:u.surface}:{},animation:p?"none":`tkxFadeIn 0.2s ease ${.03*n}s both`},children:[t.avatar&&(0,d.jsx)("div",{"aria-hidden":"true",className:$t("shrink-0"),children:t.avatar}),(0,d.jsxs)("div",{className:$t("flex-1 min-w-0"),children:[(0,d.jsx)("div",{className:$t("text-sm font-medium"),style:{color:u.text},children:r}),o&&(0,d.jsx)("div",{className:$t("text-xs mt-1 leading-relaxed"),style:{color:u.textMuted},children:o})]}),t.extra&&(0,d.jsx)("div",{className:$t("shrink-0 ml-auto"),style:{color:u.textMuted},children:t.extra}),t.actions&&(0,d.jsx)("div",{className:$t("shrink-0 flex items-center gap-2"),children:t.actions})]},t.key)})}),n&&(0,d.jsx)("div",{className:$t("text-sm"),style:{padding:f,color:u.textMuted,borderTop:`1px solid ${u.border}`,backgroundColor:u.surfaceAlt},children:n})]})},exports.TkxLogo=tl,exports.TkxMarkdown=Fi,exports.TkxMasonry=function({columns:e,gap:t=16,children:n}){const r=qe(),o=function(){const[e,t]=(0,a.useState)(()=>{if("undefined"==typeof window)return"lg";const e=window.innerWidth;return e>=1024?"lg":e>=768?"md":"sm"});return(0,a.useEffect)(()=>{if("undefined"==typeof window)return;const e=()=>{const e=window.innerWidth;t(e>=1024?"lg":e>=768?"md":"sm")};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e}();(0,a.useEffect)(()=>{!function(){if(mi||"undefined"==typeof document)return;mi=!0;const e=document.createElement("style");e.id="tkx-masonry-kf",e.textContent="\n @keyframes tkx-masonry-fade-in {\n from { opacity: 0; transform: translateY(8px); }\n to { opacity: 1; transform: translateY(0); }\n }\n ",document.head.appendChild(e)}()},[]);const i=function(e,t){return void 0===e?3:"number"==typeof e?Math.max(1,e):"lg"===t?e.lg??e.md??e.sm??3:"md"===t?e.md??e.sm??2:e.sm??1}(e,o),l=a.Children.toArray(n),s=(0,a.useMemo)(()=>{const e=Array.from({length:i},()=>[]);return l.forEach((t,n)=>{e[n%i].push(t)}),e},[l,i]);return(0,d.jsx)("div",{role:"list","aria-label":"Masonry grid",className:$t("flex w-full"),style:{gap:t,alignItems:"flex-start"},children:s.map((e,n)=>(0,d.jsx)("div",{className:$t("flex flex-col"),style:{flex:1,gap:t,minWidth:0},children:e.map((e,t)=>{return(0,d.jsx)("div",{role:"listitem",style:(o=t*i+n,r?{}:{animation:"tkx-masonry-fade-in 300ms cubic-bezier(0.16,1,0.3,1) both",animationDelay:`${Math.min(40*o,400)}ms`}),children:e},t);var o})},n))})},exports.TkxMentions=function({options:e,value:t="",onChange:n,trigger:r="@",placeholder:o,label:i}){const l=J(),s=qe(),c=(0,a.useRef)(null),u=(0,a.useRef)(null),[p,h]=(0,a.useState)(t),[f,m]=(0,a.useState)(!1),[g,x]=(0,a.useState)(""),[y,b]=(0,a.useState)(0),[v,w]=(0,a.useState)(-1);(0,a.useEffect)(()=>{void 0!==t&&h(t)},[t]);const k=e.filter(e=>e.label.toLowerCase().includes(g.toLowerCase())),$=(0,a.useCallback)(e=>{const t=Fe(e.target.value);h(t),n?.(t);const o=e.target.selectionStart??t.length,i=t.slice(0,o),a=i.lastIndexOf(r);if(a>=0){const e=i.slice(a+r.length);if(!/\s/.test(e))return x(e),w(a),m(!0),void b(0)}m(!1)},[r,n]),S=(0,a.useCallback)(e=>{const t=p.slice(0,v),o=p.slice(v+r.length+g.length),i=`${t}${r}${e.value} ${o}`;h(i),n?.(i),m(!1),c.current?.focus()},[p,v,r,g,n]),C=(0,a.useCallback)(e=>{f&&("ArrowDown"===e.key?(e.preventDefault(),b(e=>(e+1)%k.length)):"ArrowUp"===e.key?(e.preventDefault(),b(e=>(e-1+k.length)%k.length)):"Enter"===e.key&&k[y]?(e.preventDefault(),S(k[y])):"Escape"===e.key&&m(!1))},[f,k,y,S]);(0,a.useEffect)(()=>{f&&u.current&&u.current.children[y]?.scrollIntoView({block:"nearest"})},[y,f]);const z=i?pe(i):void 0,M=o?pe(o):void 0;return(0,d.jsxs)("div",{className:$t("relative font-sans"),style:{width:"100%"},children:[z&&(0,d.jsx)("label",{className:$t("block text-sm font-medium mb-1"),style:{color:l.text},children:z}),(0,d.jsx)("textarea",{ref:c,role:"combobox","aria-expanded":f,"aria-haspopup":"listbox","aria-autocomplete":"list","aria-label":z??"Mentions input",value:p,placeholder:M,onChange:$,onKeyDown:C,onBlur:()=>setTimeout(()=>m(!1),200),className:$t("w-full rounded-lg border px-3 py-2 text-sm resize-y"),style:{backgroundColor:l.surface,borderColor:l.border,color:l.text,minHeight:80,outline:"none"},rows:3}),f&&k.length>0&&(0,d.jsx)("ul",{ref:u,role:"listbox","aria-label":"Mention suggestions",className:$t("absolute left-0 right-0 z-50 rounded-lg border overflow-auto"),style:{backgroundColor:l.surface,borderColor:l.border,maxHeight:200,top:"100%",marginTop:4,listStyle:"none",padding:0,boxShadow:`0 4px 12px ${l.bg}80`,animation:s?"none":"tkxFadeIn 0.15s ease"},children:k.map((e,t)=>(0,d.jsxs)("li",{role:"option","aria-selected":t===y,className:$t("flex items-center gap-3 px-3 py-2 cursor-pointer text-sm"),style:{backgroundColor:t===y?l.surfaceAlt:"transparent",color:l.text},onMouseDown:t=>{t.preventDefault(),S(e)},onMouseEnter:()=>b(t),children:[e.avatar&&(0,d.jsx)("img",{src:pe(e.avatar),alt:"","aria-hidden":"true",width:24,height:24,className:$t("rounded-full"),style:{objectFit:"cover"}}),(0,d.jsx)("span",{children:pe(e.label)}),(0,d.jsxs)("span",{style:{color:l.textMuted,marginLeft:"auto"},children:[r,pe(e.value)]})]},e.value))})]})},exports.TkxMenu=Zr,exports.TkxMessageThread=Rr,exports.TkxMindMap=function({root:e,selectedId:t,collapsedIds:n,onSelect:r,onToggle:o,leafHeight:i=44,levelWidth:l=200,nodeWidth:s=160,style:c,className:u}){const p=J(),[h,f]=(0,a.useState)(e.id),[m,g]=(0,a.useState)(()=>{const t=new Set;return function e(n){n.collapsed&&t.add(n.id),n.children?.forEach(e)}(e),t}),x=void 0!==t?t:h,y=n??m,b=(0,a.useRef)(null),v=(0,a.useMemo)(()=>pd(e,0,y,0),[e,y]),w=(0,a.useMemo)(()=>hd(v,l,i),[v,l,i]),k=(0,a.useMemo)(()=>function(e){const t=new Map,n=new Map,r=new Map;return function e(o,i){if(t.set(o.node.id,i),r.set(o.node.id,o.children[0]?.node.id??null),n.has(o.node.id)||n.set(o.node.id,[o.node.id]),o.children.length){const t=o.children.map(e=>e.node.id);for(const r of o.children)n.set(r.node.id,t),e(r,o.node.id)}}(e,null),{parents:t,siblings:n,firstChild:r}}(v),[v]),$=Math.max(...w.map(e=>e.x),0)+s,S=Math.max(...w.map(e=>e.y),0)+i,C=Math.min(...w.map(e=>e.y),0),z=S-C+i,M=(0,a.useCallback)(e=>{void 0===t&&f(e);const n=w.find(t=>t.laid.node.id===e)?.laid.node;n&&r?.(e,n)},[t,r,w]),N=(0,a.useCallback)(e=>{const t=y.has(e);void 0===n&&g(n=>{const r=new Set(n);return t?r.delete(e):r.add(e),r}),o?.(e,!t)},[y,n,o]);return(0,d.jsx)("div",{ref:b,className:u,role:"tree","aria-label":"Mind map",tabIndex:0,onKeyDown:e=>{if(!x)return;const{parents:t,siblings:n,firstChild:r}=k;let o;switch(e.key){case"ArrowRight":y.has(x)?N(x):o=r.get(x)??void 0;break;case"ArrowLeft":{const e=t.get(x);e?o=e:!y.has(x)&&r.get(x)&&N(x);break}case"ArrowUp":case"ArrowDown":{const t=n.get(x);if(!t||t.length<2)break;const r=t.indexOf(x),i="ArrowUp"===e.key?r-1:r+1;i>=0&&i<t.length&&(o=t[i]);break}case"Enter":case" ":N(x),e.preventDefault();break;default:return}o&&(e.preventDefault(),M(o))},"data-testid":"tkx-mindmap",style:{position:"relative",width:"100%",overflow:"auto",outline:"none",...Q(p),background:"var(--tkx-bg)",color:"var(--tkx-fg)",...c},children:(0,d.jsxs)("div",{style:{position:"relative",width:$+24,height:z+24,padding:12},children:[(0,d.jsx)("svg",{"aria-hidden":"true",width:$+24,height:z+24,style:{position:"absolute",top:0,left:0,pointerEvents:"none",transform:`translate(0, ${12-C}px)`},children:w.map(e=>{if(!e.parentId)return null;const t=w.find(t=>t.laid.node.id===e.parentId);if(!t)return null;const n=t.x+s,r=t.y+i/2,o=e.x,a=e.y+i/2,l=(n+o)/2,c=e.laid.node.color||"var(--tkx-accent, #00f5d4)";return(0,d.jsx)("path",{d:`M ${n} ${r} C ${l} ${r}, ${l} ${a}, ${o} ${a}`,stroke:c,strokeOpacity:.5,strokeWidth:1.5,fill:"none"},`${e.parentId}->${e.laid.node.id}`)})}),w.map(e=>{const t=e.laid.node.id===x,n=e.laid.node.color||"var(--tkx-accent, #00f5d4)";return(0,d.jsxs)("div",{role:"treeitem","aria-selected":t,"aria-expanded":e.laid.hasChildren?!e.laid.collapsed:void 0,"data-testid":`mindmap-node-${e.laid.node.id}`,onClick:()=>M(e.laid.node.id),onDoubleClick:()=>e.laid.hasChildren&&N(e.laid.node.id),style:{position:"absolute",left:e.x+12,top:e.y-C+12,width:s,height:i-8,display:"flex",alignItems:"center",gap:6,padding:"4px 10px",borderRadius:8,border:`1px solid ${t?n:"var(--tkx-border, #2a2a3e)"}`,background:t?`${n}1a`:"var(--tkx-bg-subtle, #12121a)",cursor:"pointer",fontSize:13,lineHeight:1.3,boxShadow:t?`0 0 0 2px ${n}33`:"none",transition:"border-color 0.12s, box-shadow 0.12s",boxSizing:"border-box"},children:[e.laid.hasChildren&&(0,d.jsx)("button",{type:"button","aria-label":e.laid.collapsed?"Expand":"Collapse","data-testid":`mindmap-toggle-${e.laid.node.id}`,onClick:t=>{t.stopPropagation(),N(e.laid.node.id)},style:{width:20,height:20,flex:"0 0 20px",borderRadius:4,border:"none",background:n,color:"var(--tkx-bg)",cursor:"pointer",fontSize:12,fontWeight:700,display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:1},children:e.laid.collapsed?"+":"−"}),(0,d.jsx)("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:pe(e.laid.node.label),children:pe(e.laid.node.label)})]},e.laid.node.id)})]})})},exports.TkxModal=function({isOpen:e,onClose:t,title:n,size:r="md",closeOnOverlayClick:o=!0,closeOnEscape:i=!0,children:l,footer:s}){const u=J(),p=_t(),h=(0,a.useId)(),f=Ue(e),m=qe(),g=Ke(),x=pe(n),y="full"===r;return Ye(t,i&&e),(0,a.useEffect)(()=>{if(e){if(1===++Qt&&(document.body.style.overflow="hidden"),g(x,"polite"),Le())try{window.dispatchEvent(new CustomEvent("tkx:framed-modal",{detail:{title:x,at:Date.now()}}))}catch{}}else en();return()=>{e&&en()}},[e,x,g]),e&&"undefined"!=typeof document?(0,c.createPortal)((0,d.jsxs)("div",{role:"presentation",className:$t("fixed inset-0 z-[9000] flex",y?"items-stretch":"items-center justify-center",y?"":"p-4"),children:[(0,d.jsx)("div",{"aria-hidden":"true",onClick:o?t:void 0,className:$t("absolute inset-0",!m&&"animate-fade-in"),style:{backgroundColor:"rgba(0,0,0,0.6)",backdropFilter:"blur(4px)"}}),(0,d.jsxs)("div",{ref:f,role:"dialog","aria-modal":"true","aria-labelledby":h,className:$t("relative z-10 flex flex-col overflow-hidden",!m&&"animate-slide-up",y?"":"rounded-xl"),style:{backgroundColor:u.surface,border:`1px solid ${u.border}`,width:Jt[r],maxWidth:"100%",maxHeight:y?"100vh":"90vh",boxShadow:`0 20px 60px ${u.bg}80`},children:[(0,d.jsxs)("div",{className:$t("flex items-center justify-between px-6 py-5 shrink-0"),style:{borderBottom:`1px solid ${u.border}`},children:[(0,d.jsx)("h2",{id:h,className:$t("m-0 text-lg font-semibold font-sans"),style:{color:u.text},children:x}),(0,d.jsx)("button",{onClick:t,"aria-label":p.close,className:$t("bg-transparent border-none cursor-pointer rounded p-1 flex items-center justify-center focus-visible:focus-ring"),style:{color:u.textMuted},children:(0,d.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:[(0,d.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,d.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),(0,d.jsx)("div",{className:$t("flex-1 overflow-y-auto px-6 py-6 font-sans"),style:{color:u.text},children:l}),s&&(0,d.jsx)("div",{className:$t("flex justify-end gap-2 px-6 py-4 shrink-0"),style:{borderTop:`1px solid ${u.border}`},children:s})]})]}),document.body):null},exports.TkxNumberInput=Mo,exports.TkxOTP=Po,exports.TkxOrgChart=hs,exports.TkxPagination=or,exports.TkxPanInput=es,exports.TkxParagraph=function({children:e,type:t="default",copyable:n=!1,ellipsis:r=!1,style:o}){const i=J(),l="secondary"===t?i.textMuted:i.text,s=ia(e),d="string"==typeof e?pe(e):e,c={};if(r){const e="object"==typeof r?r.rows??3:3;c.display="-webkit-box",c.WebkitLineClamp=e,c.WebkitBoxOrient="vertical",c.overflow="hidden"}return(0,a.createElement)("div",{style:{color:l,fontSize:"1rem",lineHeight:"1.6",margin:"0 0 1em 0",...c,...o}},d,n&&(0,a.createElement)(aa,{text:s}))},exports.TkxPaymentButton=Ml,exports.TkxPeerChat=Rr,exports.TkxPhoneInput=bl,exports.TkxPivotTable=function({data:e,rows:t,cols:n=[],values:r,sortRows:o=uc,sortCols:i=uc,showTotals:l=!0,formatNumber:s=ac,style:c,className:u}){if(0===r.length)throw new Error("TkxPivotTable: values must contain at least one entry");const p=J(),{rowPaths:h,colPaths:f,lookup:m,rowTotals:g,colTotals:x,grandTotal:y}=(0,a.useMemo)(()=>{const a=lc(),l=lc(),s=new Map,d=new Map,c=new Map,u=r.map(()=>({sum:0,count:0,min:1/0,max:-1/0}));for(const o of e){const e=oc(o,t),i=oc(o,n),p=e.join(""),h=i.join("");let f=a;for(const t of e)f=sc(f,t);let m=l;for(const t of i)m=sc(m,t);let g=s.get(p);g||(g=new Map,s.set(p,g));let x=g.get(h);x||(x=r.map(()=>({sum:0,count:0,min:1/0,max:-1/0})),g.set(h,x));let y=d.get(p);y||(y=r.map(()=>({sum:0,count:0,min:1/0,max:-1/0})),d.set(p,y));let b=c.get(h);b||(b=r.map(()=>({sum:0,count:0,min:1/0,max:-1/0})),c.set(h,b)),r.forEach((e,t)=>{let n;if("count"===e.agg)n=1;else{const t=o[e.field??""];if("number"!=typeof t)return;n=t}nc(x[t],n),nc(y[t],n),nc(b[t],n),nc(u[t],n)})}return dc(a,0,o),dc(l,0,i),{rowPaths:t.length>0?cc(a,t.length):[[]],colPaths:n.length>0?cc(l,n.length):[[]],lookup:(e,t,n)=>{const o=s.get(e.join(""));if(!o)return null;const i=o.get(t.join(""));return i?rc(i[n],r[n].agg):null},rowTotals:(e,t)=>{const n=d.get(e.join(""));return n?rc(n[t],r[t].agg):null},colTotals:(e,t)=>{const n=c.get(e.join(""));return n?rc(n[t],r[t].agg):null},grandTotal:e=>rc(u[e],r[e].agg)}},[e,t,n,r,o,i]);f.length,r.length,l&&r.length;const b=n.length,v="6px 10px",w="var(--tkx-bg-subtle, #0d0d14)",k="var(--tkx-border, #2a2a3e)",$="var(--tkx-border-soft, #1a1a25)";return(0,d.jsx)("div",{className:u,style:{...Q(p),overflow:"auto",border:`1px solid ${k}`,borderRadius:8,background:"var(--tkx-bg, #0a0a0f)",color:"var(--tkx-fg, #e8e8f4)",...c},"data-testid":"tkx-pivot",children:(0,d.jsxs)("table",{role:"table",style:{borderCollapse:"collapse",width:"100%",fontSize:13,fontFamily:"inherit"},children:[(0,d.jsxs)("thead",{children:[Array.from({length:b}).map((e,n)=>(0,d.jsxs)("tr",{children:[0===n&&(0,d.jsx)("th",{rowSpan:b+1,colSpan:t.length,style:{background:w,border:`1px solid ${k}`,padding:v,fontWeight:700,color:p.textMuted,textAlign:"left"},children:t.join(" / ")||""}),(()=>{const e=[];for(const t of f){const o=t[n]??"",i=e[e.length-1];i&&i.key===o?i.span+=r.length:e.push({key:o,span:r.length})}return e.map((e,t)=>(0,d.jsx)("th",{colSpan:e.span,"data-testid":`pivot-colhead-${n}-${e.key}`,style:{background:w,border:`1px solid ${k}`,padding:v,fontWeight:700,textAlign:"center"},children:e.key},t))})(),l&&0===n&&(0,d.jsx)("th",{rowSpan:b,colSpan:r.length,style:{background:w,border:`1px solid ${k}`,padding:v,fontWeight:700,color:"var(--tkx-accent, #00f5d4)",textAlign:"center"},children:"Total"})]},`ch${n}`)),(0,d.jsxs)("tr",{children:[0===b&&(0,d.jsx)("th",{colSpan:t.length,style:{background:w,border:`1px solid ${k}`,padding:v,fontWeight:700,color:p.textMuted,textAlign:"left"},children:t.join(" / ")||""}),f.map((e,t)=>r.map((e,n)=>(0,d.jsx)("th",{"data-testid":`pivot-vhead-${t}-${n}`,style:{background:w,border:`1px solid ${$}`,padding:v,fontSize:11,fontWeight:600,color:p.textMuted,textAlign:"right"},children:ic(e)},`${t}-${n}`))),l&&r.map((e,t)=>(0,d.jsx)("th",{style:{background:w,border:`1px solid ${$}`,padding:v,fontSize:11,fontWeight:600,color:"var(--tkx-accent, #00f5d4)",textAlign:"right"},children:ic(e)},`tv-${t}`))]})]}),(0,d.jsxs)("tbody",{children:[h.map((e,t)=>(0,d.jsxs)("tr",{"data-testid":`pivot-row-${t}`,children:[e.map((e,t)=>(0,d.jsx)("th",{scope:"row",style:{background:"var(--tkx-bg-subtle, #12121a)",border:`1px solid ${$}`,padding:v,fontWeight:600,textAlign:"left"},children:e},t)),f.map((n,o)=>r.map((r,i)=>{const a=m(e,n,i);return(0,d.jsx)("td",{"data-testid":`pivot-cell-${t}-${o}-${i}`,style:{border:`1px solid ${$}`,padding:v,textAlign:"right",fontVariantNumeric:"tabular-nums"},children:null===a?"":s(a)},`${o}-${i}`)})),l&&r.map((n,r)=>{const o=g(e,r);return(0,d.jsx)("td",{"data-testid":`pivot-rowtotal-${t}-${r}`,style:{border:`1px solid ${k}`,padding:v,textAlign:"right",fontWeight:700,background:"rgba(0,245,212,0.04)",fontVariantNumeric:"tabular-nums"},children:null===o?"":s(o)},`rt-${r}`)})]},t)),l&&(0,d.jsxs)("tr",{"data-testid":"pivot-totals-row",children:[(0,d.jsx)("th",{colSpan:Math.max(t.length,1),scope:"row",style:{background:w,border:`1px solid ${k}`,padding:v,fontWeight:700,color:"var(--tkx-accent, #00f5d4)",textAlign:"left"},children:"Total"}),f.map((e,t)=>r.map((n,r)=>{const o=x(e,r);return(0,d.jsx)("td",{"data-testid":`pivot-coltotal-${t}-${r}`,style:{border:`1px solid ${k}`,padding:v,textAlign:"right",fontWeight:700,background:"rgba(0,245,212,0.04)",fontVariantNumeric:"tabular-nums"},children:null===o?"":s(o)},`ct-${t}-${r}`)})),r.map((e,t)=>{const n=y(t);return(0,d.jsx)("td",{"data-testid":`pivot-grandtotal-${t}`,style:{border:`1px solid ${k}`,padding:v,textAlign:"right",fontWeight:700,background:"rgba(0,245,212,0.1)",color:"var(--tkx-accent, #00f5d4)",fontVariantNumeric:"tabular-nums"},children:null===n?"":s(n)},`gt-${t}`)})]})]})]})})},exports.TkxPlanSelector=ds,exports.TkxPopover=function({trigger:e,content:t,placement:n="bottom",isOpen:r,onOpenChange:o,closeOnClickOutside:i=!0,className:l,style:s}){const u=J(),p=qe(),h=(0,a.useId)(),f=void 0!==r,[m,g]=(0,a.useState)(!1),x=f?r:m,y=(0,a.useRef)(null),b=(0,a.useRef)(null);(0,a.useRef)(null);const[v,w]=(0,a.useState)(null),k=(0,a.useCallback)(e=>{f||g(e),o?.(e)},[f,o]),$=(0,a.useCallback)(()=>k(!1),[k]),S=(0,a.useCallback)(()=>k(!x),[k,x]);Ye($,x),(0,a.useEffect)(()=>{if(!x||!i)return;const e=e=>{const t=e.target;y.current?.contains(t)||b.current?.contains(t)||$()};return document.addEventListener("pointerdown",e),()=>document.removeEventListener("pointerdown",e)},[x,i,$]),(0,a.useEffect)(()=>{if(!x||!y.current)return;const e=()=>{y.current&&b.current&&w(function(e,t,n){const r=t.getBoundingClientRect(),o=window.scrollX,i=window.scrollY,a=window.innerWidth,l=window.innerHeight;let s=0,d=0,c=n;const u={top:e.top-r.height-8-8>0,bottom:e.bottom+r.height+8+8<l,left:e.left-r.width-8-8>0,right:e.right+r.width+8+8<a};if(!u[n]){const e={top:"bottom",bottom:"top",left:"right",right:"left"};u[e[n]]&&(c=e[n])}switch(c){case"top":s=e.top+i-r.height-8-8,d=e.left+o+e.width/2-r.width/2;break;case"bottom":s=e.bottom+i+8+8,d=e.left+o+e.width/2-r.width/2;break;case"left":s=e.top+i+e.height/2-r.height/2,d=e.left+o-r.width-8-8;break;case"right":s=e.top+i+e.height/2-r.height/2,d=e.right+o+8+8}d=Math.max(8,Math.min(d,a+o-r.width-8)),s=Math.max(8,Math.min(s,l+i-r.height-8));const p={position:"absolute",width:0,height:0,borderStyle:"solid",borderWidth:8};switch(c){case"top":Object.assign(p,{bottom:-16,left:"50%",transform:"translateX(-50%)",borderColor:"var(--tkx-popover-bg) transparent transparent transparent"});break;case"bottom":Object.assign(p,{top:-16,left:"50%",transform:"translateX(-50%)",borderColor:"transparent transparent var(--tkx-popover-bg) transparent"});break;case"left":Object.assign(p,{right:-16,top:"50%",transform:"translateY(-50%)",borderColor:"transparent transparent transparent var(--tkx-popover-bg)"});break;case"right":Object.assign(p,{left:-16,top:"50%",transform:"translateY(-50%)",borderColor:"transparent var(--tkx-popover-bg) transparent transparent"})}return{top:s,left:d,arrowStyle:p,resolvedPlacement:c}}(y.current.getBoundingClientRect(),b.current,n))};return requestAnimationFrame(e),window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}},[x,n]);const C=p?{opacity:1}:{animation:"tkxPopoverFadeIn 150ms ease forwards",opacity:0},z=x&&"undefined"!=typeof document?(0,c.createPortal)((0,d.jsxs)("div",{ref:b,id:h,role:"dialog","aria-modal":"false",className:$t("absolute z-[9100] rounded-lg font-sans",l??""),style:{"--tkx-popover-bg":u.surface,top:v?.top??-9999,left:v?.left??-9999,backgroundColor:u.surface,border:`1px solid ${u.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:u.text,...C,...s},children:[v&&(0,d.jsx)("span",{style:v.arrowStyle,"aria-hidden":"true"}),t]}),document.body):null;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{ref:y,className:$t("inline-flex"),onClick:S,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),S())},"aria-expanded":x,"aria-haspopup":"dialog","aria-controls":x?h:void 0,children:e}),z,x&&!p&&(0,d.jsx)("style",{children:"\n @keyframes tkxPopoverFadeIn {\n from { opacity: 0; transform: translateY(4px); }\n to { opacity: 1; transform: translateY(0); }\n }\n "})]})},exports.TkxProgress=Ht,exports.TkxProrationPreview=function({newPlan:e,currentPlan:t,cycle:n,daysRemaining:r,cycleDays:o,className:i,style:a,children:l}){const s=J(),c=o>0?r/o:0,u=t.prices[n]*c,p=e.prices[n]*c,h=Math.max(0,p-u),f=Math.max(0,u-p),m={border:`1px solid ${s.border}`,borderRadius:12,padding:20,background:s.surface,...a},g={display:"flex",justifyContent:"space-between",fontSize:13,padding:"6px 0"},x=t=>ss(t,e.currency,e.locale);return(0,d.jsxs)("div",{className:i,style:m,children:[(0,d.jsx)("div",{style:{fontSize:12,fontWeight:700,color:s.textMuted,textTransform:"uppercase",letterSpacing:.5,marginBottom:12},children:"Plan change"}),(0,d.jsxs)("div",{style:{...g,color:s.textMuted},children:[(0,d.jsxs)("span",{children:["From ",(0,d.jsx)("strong",{style:{color:s.text},children:t.name})]}),(0,d.jsx)("span",{children:"→"}),(0,d.jsxs)("span",{children:["To ",(0,d.jsx)("strong",{style:{color:s.primary},children:e.name})]})]}),(0,d.jsx)("hr",{style:{border:0,borderTop:`1px solid ${s.border}`,margin:"8px 0"}}),(0,d.jsxs)("div",{style:{...g,color:s.textMuted},children:[(0,d.jsx)("span",{children:"Days remaining in cycle"}),(0,d.jsxs)("span",{children:[r," / ",o]})]}),(0,d.jsxs)("div",{style:{...g,color:s.textMuted},children:[(0,d.jsxs)("span",{children:["Credit from ",t.name]}),(0,d.jsxs)("span",{children:["−",x(u)]})]}),(0,d.jsxs)("div",{style:{...g,color:s.textMuted},children:[(0,d.jsxs)("span",{children:["Charge for ",e.name," (prorated)"]}),(0,d.jsx)("span",{children:x(p)})]}),(0,d.jsx)("hr",{style:{border:0,borderTop:`1px solid ${s.border}`,margin:"8px 0"}}),h>0?(0,d.jsxs)("div",{style:{...g,fontSize:16,fontWeight:700},children:[(0,d.jsx)("span",{style:{color:s.text},children:"Due today"}),(0,d.jsx)("span",{style:{color:s.primary},children:x(h)})]}):(0,d.jsxs)("div",{style:{...g,fontSize:14,color:s.success},children:[(0,d.jsx)("span",{children:"Credit applied at next billing"}),(0,d.jsx)("span",{children:x(f)})]}),(0,d.jsx)("div",{style:{...g,color:s.textMuted,fontSize:12,marginTop:6},children:(0,d.jsxs)("span",{children:["Then ",x(e.prices[n])," / ","monthly"===n?"month":"year"]})}),l&&(0,d.jsx)("div",{style:{marginTop:16},children:l})]})},exports.TkxQRCode=ja,exports.TkxRadio=bn,exports.TkxRadioGroup=function({name:e,value:t,defaultValue:n="",onChange:r,label:o,orientation:i="vertical",isDisabled:l=!1,isInvalid:s=!1,errorMessage:c,children:u}){const p=J(),h=`${(0,a.useId)()}-error`,[f,m]=(0,a.useState)(n),g=void 0!==t,x=g?t:f,y=s||!!c;return(0,d.jsx)(xn.Provider,{value:{name:e,value:x,onChange:e=>{g||m(e),r?.(e)},isDisabled:l,isInvalid:s},children:(0,d.jsxs)("div",{role:"radiogroup","aria-label":o?pe(o):void 0,"aria-describedby":y?h:void 0,"aria-invalid":y,children:[o&&(0,d.jsx)("div",{className:$t("text-sm font-medium font-sans mb-2"),style:{color:p.text},children:pe(o)}),(0,d.jsx)("div",{className:$t("horizontal"===i?"flex flex-row flex-wrap gap-4":"flex flex-col gap-2"),children:u}),y&&c&&(0,d.jsxs)("span",{id:h,role:"alert",className:$t("text-xs flex items-center gap-1 mt-1"),style:{color:p.danger},children:[(0,d.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,d.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"})}),pe(c)]})]})})},exports.TkxRating=function({value:e,defaultValue:t=0,onChange:n,max:r=5,precision:o=1,size:i="md",isReadOnly:l=!1,isDisabled:s=!1,label:c,showValue:u=!1,colorScheme:p="warning",emptyIcon:h="star",filledIcon:f="star"}){const m=J(),g=qe(),x=(0,a.useId)(),y=void 0!==e,[b,v]=(0,a.useState)(t),[w,k]=(0,a.useState)(null),$=(0,a.useRef)(null),S=y?e??0:b,C=w??S,z={warning:m.warning,primary:m.primary,danger:m.danger}[p]??m.warning,M=ur[i],N=!l&&!s,D=(0,a.useCallback)(e=>{y||v(e),n?.(e)},[y,n]),R=(0,a.useCallback)((e,t)=>{N&&k(xr(e,t,o))},[N,o]),P=(0,a.useCallback)(()=>{N&&k(null)},[N]),F=(0,a.useCallback)((e,t)=>{if(!N)return;const n=xr(e,t,o);D(n===S?0:n)},[N,o,S,D]),A=(0,a.useCallback)(e=>{if(!N)return;const t=o;let n=S;if("ArrowRight"===e.key||"ArrowUp"===e.key)e.preventDefault(),n=gr(S+t,0,r);else if("ArrowLeft"===e.key||"ArrowDown"===e.key)e.preventDefault(),n=gr(S-t,0,r);else if("Home"===e.key)e.preventDefault(),n=0;else{if("End"!==e.key)return;e.preventDefault(),n=r}n=function(e,t){return 1===t?Math.round(e):Math.round(2*e)/2}(n,o),D(n)},[N,S,r,o,D]),I=c?pe(c):"Rating";return(0,d.jsxs)("div",{className:Ct($t("inline-flex items-center gap-2 font-sans"),s?$t("opacity-50"):""),children:[(0,d.jsx)("div",{ref:$,role:"radiogroup","aria-label":I,"aria-disabled":s,"aria-readonly":l,tabIndex:N?0:-1,onKeyDown:A,onMouseLeave:P,className:$t("flex items-center gap-0.5 outline-none"),style:{cursor:N?"pointer":"default"},children:Array.from({length:r},(e,t)=>{const n=t+1,r=t+.5,i=C>=n,a=!i&&.5===o&&C>=r,l=`${x}-${t}`;return(0,d.jsx)("span",{role:"radio","aria-checked":.5===o&&S===r||S===n,"aria-label":.5===o?`${r} star${1!==r?"s":""} / ${n} star${1!==n?"s":""}`:`${n} star${1!==n?"s":""}`,tabIndex:-1,onMouseMove:e=>R(e,t),onClick:e=>F(e,t),style:{display:"inline-flex",alignItems:"center",lineHeight:0,transition:g?"none":"transform 120ms ease",transform:null!==w&&C>=r&&N?"scale(1.15)":"scale(1)"},children:(0,d.jsx)(mr,{type:i||a?f:h,size:M,filled:i,halfFilled:a,color:i||a?z:m.border,uid:a?l:void 0})},t)})}),u&&(0,d.jsxs)("span",{className:$t("text-sm tabular-nums"),style:{color:m.textMuted},"aria-live":"polite","aria-atomic":"true",children:[S%1==0?S.toFixed(0):S.toFixed(1)," / ",r]})]})},exports.TkxResult=function({status:e,title:t,subTitle:n,icon:r,extra:o,className:i,style:a}){const l=J(),s=qe(),c=function(e,t){switch(e){case"success":return t.success;case"error":case"500":return t.danger;case"warning":return t.warning;case"info":return t.info;case"404":case"403":return t.textMuted}}(e,l),u=pe(t),p=n?pe(n):void 0;return(0,d.jsxs)("div",{role:"status","aria-live":"polite",className:$t("flex flex-col items-center text-center px-6 py-12 font-sans",i??""),style:{animation:s?"none":"tkxFadeIn 0.3s ease",...a},children:[(0,d.jsx)("div",{className:$t("mb-6"),children:r??Ea[e](c)}),(0,d.jsx)("h2",{className:$t("text-xl font-semibold m-0 mb-2"),style:{color:l.text},children:u}),p&&(0,d.jsx)("p",{className:$t("text-sm m-0 mb-6 max-w-md leading-relaxed"),style:{color:l.textMuted},children:p}),o&&(0,d.jsx)("div",{className:$t("flex items-center gap-3 mt-4"),children:o})]})},exports.TkxRichEditor=Us,exports.TkxRichTextDisplay=function({blocks:e,className:t,style:n}){const r=J(),o=_t(),i=qe(),l=(0,a.useMemo)(()=>e.map((e,t)=>{const n=yi[e.type];return n?(0,d.jsx)("div",{style:i?void 0:{animation:"tkx-rich-text-fade-in 300ms ease both",animationDelay:`${Math.min(30*t,300)}ms`},children:(0,d.jsx)(n,{block:e,index:t})},t):null}),[e,i]);return(0,a.useMemo)(()=>{if("undefined"==typeof document)return;if(document.getElementById("tkx-rich-text-kf"))return;const e=document.createElement("style");e.id="tkx-rich-text-kf",e.textContent="\n @keyframes tkx-rich-text-fade-in {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n ",document.head.appendChild(e)},[]),(0,d.jsx)("article",{"aria-label":o.richTextContent??"Rich text content",className:$t("font-sans",t??""),style:{color:r.text,maxWidth:720,...n},children:l})},exports.TkxRow=Gi,exports.TkxSEO=function({title:e,description:t,canonical:n,keywords:r,image:o,twitterSite:i,twitterCreator:l,ogType:s="website",locale:d,robots:c="index, follow, max-snippet:-1, max-image-preview:large",schema:u}){return(0,a.useEffect)(()=>{if("undefined"!=typeof document)return jl(),e&&(document.title=e),t&&El("description",t),r&&El("keywords",r),El("robots",c),e&&El("og:title",e,"property"),t&&El("og:description",t,"property"),El("og:type",s,"property"),n&&El("og:url",n,"property"),o&&(El("og:image",o,"property"),El("og:image:width","1200","property"),El("og:image:height","630","property")),d&&El("og:locale",d,"property"),El("twitter:card",o?"summary_large_image":"summary"),e&&El("twitter:title",e),t&&El("twitter:description",t),o&&El("twitter:image",o),i&&El("twitter:site",i),l&&El("twitter:creator",l),n&&function(e,t){if("undefined"==typeof document||!t)return;const n=document.createElement("link");n.rel="canonical",n.href=t,n.setAttribute(Wl,"1"),document.head.appendChild(n)}(0,n),u&&function(e){if("undefined"==typeof document)return;const t=Array.isArray(e)?e:[e];for(const n of t){const e=document.createElement("script");e.type="application/ld+json",e.text=JSON.stringify(n),e.setAttribute(Wl,"1"),document.head.appendChild(e)}}(u),()=>jl()},[e,t,n,r,o,i,l,s,d,c,u]),null},exports.TkxSecurityDashboard=function({maxEvents:e=200,hideExport:t=!1,compact:n=!1,className:r,style:o}){const i=J(),{events:l,counts:s,bySeverity:c,clear:u,toJSON:p}=nl(e),h=(0,a.useCallback)(()=>{if("undefined"==typeof document)return;const e=new Blob([p()],{type:"application/json"}),t=URL.createObjectURL(e),n=document.createElement("a");n.href=t,n.download=`tekivex-security-events-${Date.now()}.json`,n.click(),URL.revokeObjectURL(t)},[p]);return(0,d.jsxs)("section",{className:r,style:{background:i.surface,border:`1px solid ${i.border}`,borderRadius:12,padding:16,color:i.text,fontFamily:"inherit",...o},role:"region","aria-label":"Security event dashboard",children:[(0,d.jsxs)("header",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:14,gap:12,flexWrap:"wrap"},children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{style:{margin:0,fontSize:15,fontWeight:700,color:i.text},children:"Security kernel — live events"}),(0,d.jsx)("p",{style:{margin:"2px 0 0",fontSize:12,color:i.textMuted},children:0===l.length?"No defensive actions yet. Events appear as the kernel blocks threats.":`${l.length} event${1===l.length?"":"s"} · ${c.critical} critical · ${c.warning} warning`})]}),(0,d.jsxs)("div",{style:{display:"flex",gap:8},children:[!t&&(0,d.jsx)("button",{type:"button",onClick:h,disabled:0===l.length,style:{padding:"6px 12px",fontSize:12,fontWeight:600,borderRadius:6,border:`1px solid ${i.border}`,background:i.surfaceAlt,color:i.text,cursor:l.length?"pointer":"not-allowed",opacity:l.length?1:.5,fontFamily:"inherit"},children:"Export JSON"}),(0,d.jsx)("button",{type:"button",onClick:u,disabled:0===l.length,style:{padding:"6px 12px",fontSize:12,fontWeight:600,borderRadius:6,border:`1px solid ${i.border}`,background:"transparent",color:i.textMuted,cursor:l.length?"pointer":"not-allowed",opacity:l.length?1:.5,fontFamily:"inherit"},children:"Clear"})]})]}),(0,d.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(120px, 1fr))",gap:10,marginBottom:n?0:16},children:[{key:"xss-sanitized",label:"XSS sanitized"},{key:"unicode-stripped",label:"Trojan-Source stripped"},{key:"pii-redacted",label:"PII redacted"},{key:"audit",label:"Audit entries"}].map(e=>(0,d.jsxs)("div",{style:{background:i.surfaceAlt,border:`1px solid ${i.border}`,borderRadius:8,padding:"10px 12px"},children:[(0,d.jsx)("div",{style:{fontSize:22,fontWeight:800,color:s[e.key]>0?i.primary:i.textMuted,lineHeight:1.1,fontVariantNumeric:"tabular-nums"},children:s[e.key]}),(0,d.jsx)("div",{style:{fontSize:11,color:i.textMuted,marginTop:2},children:e.label})]},e.key))}),!n&&(0,d.jsx)("div",{role:"log","aria-live":"polite","aria-label":"Security event log",style:{maxHeight:260,overflowY:"auto",border:`1px solid ${i.border}`,borderRadius:8,background:i.bg,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",fontSize:12},children:0===l.length?(0,d.jsx)("div",{style:{padding:16,color:i.textMuted},children:"Waiting for security events…"}):[...l].reverse().map(e=>{return(0,d.jsxs)("div",{style:{display:"flex",gap:10,padding:"8px 12px",borderBottom:`1px solid ${i.border}`,alignItems:"baseline"},children:[(0,d.jsx)("span",{style:{color:i.textMuted,flexShrink:0,fontVariantNumeric:"tabular-nums"},children:new Date(e.timestamp).toLocaleTimeString()}),(0,d.jsx)("span",{style:{flexShrink:0,fontWeight:700,color:(t=e.severity,"critical"===t?i.danger:"warning"===t?i.warning:i.textMuted),textTransform:"uppercase",fontSize:10,letterSpacing:"0.04em",minWidth:56},children:e.severity}),(0,d.jsx)("span",{style:{color:i.text},children:e.message})]},e.id);var t})})]})},exports.TkxSegmented=function({options:e,value:t,onChange:n,size:r="md",block:o=!1,className:i,style:l}){const s=J(),c=qe(),u=(0,a.useRef)(null),[p,h]=(0,a.useState)(()=>Math.max(0,e.findIndex(e=>e.value===t))),[f,m]=(0,a.useState)({}),g=ya[r];(0,a.useEffect)(()=>{const n=e.findIndex(e=>e.value===t);n>=0&&h(n)},[t,e]),(0,a.useEffect)(()=>{const e=u.current;if(!e)return;const t=e.querySelectorAll("[data-seg-btn]")[p];t&&m({left:t.offsetLeft,width:t.offsetWidth,height:t.offsetHeight,transition:c?"none":"left 0.2s ease, width 0.2s ease"})},[p,e,c]);const x=(0,a.useCallback)(t=>{const r=e[t];r&&!r.disabled&&(h(t),n?.(r.value))},[e,n]),y=(0,a.useCallback)(t=>{let n=p;if("ArrowRight"===t.key||"ArrowDown"===t.key)for(t.preventDefault(),n=(p+1)%e.length;e[n]?.disabled&&n!==p;)n=(n+1)%e.length;else if("ArrowLeft"===t.key||"ArrowUp"===t.key)for(t.preventDefault(),n=(p-1+e.length)%e.length;e[n]?.disabled&&n!==p;)n=(n-1+e.length)%e.length;n!==p&&(x(n),(u.current?.querySelectorAll("[data-seg-btn]"))?.[n]?.focus())},[p,e,x]);return(0,d.jsxs)("div",{ref:u,role:"radiogroup","aria-label":"Segmented control",className:$t("relative inline-flex items-center rounded-lg p-1",i??""),style:{backgroundColor:s.surfaceAlt,border:`1px solid ${s.border}`,width:o?"100%":void 0,...l},onKeyDown:y,children:[(0,d.jsx)("div",{"aria-hidden":"true",className:$t("absolute top-1 rounded-md"),style:{...f,backgroundColor:s.surface,boxShadow:`0 1px 3px ${s.border}`,zIndex:0}}),e.map((e,t)=>{const n=t===p,r=pe(e.label);return(0,d.jsxs)("button",{"data-seg-btn":!0,type:"button",role:"radio","aria-checked":n,"aria-disabled":e.disabled||void 0,disabled:e.disabled,tabIndex:n?0:-1,className:$t("relative z-10 flex items-center justify-center gap-1 rounded-md border-0 cursor-pointer","font-sans whitespace-nowrap select-none"),style:{height:g.height,fontSize:g.fontSize,padding:`0 ${g.px}px`,flex:o?1:void 0,color:n?s.text:s.textMuted,backgroundColor:"transparent",opacity:e.disabled?.4:1,fontWeight:n?600:400,transition:c?"none":"color 0.15s ease"},onClick:()=>x(t),children:[e.icon&&(0,d.jsx)("span",{"aria-hidden":"true",children:e.icon}),r]},e.value)})]})},exports.TkxSelect=fn,exports.TkxSider=Ui,exports.TkxSignaturePad=Nl,exports.TkxSkeleton=an,exports.TkxSlider=nr,exports.TkxSnackbar=function({message:e,isOpen:t,onClose:n,action:r,variant:o="default",position:i="bottom-center",autoHideDuration:l=5e3,icon:s}){const u=J(),p=qe(),h=(0,a.useId)(),f=(0,a.useRef)(null),[m,g]=(0,a.useState)(!1),[x,y]=(0,a.useState)(!1);(0,a.useEffect)(()=>{!function(){if(ei||"undefined"==typeof document)return;ei=!0;const e=document.createElement("style");e.id="tkx-snackbar-kf",e.textContent="\n @keyframes tkx-snackbar-slide-up {\n from { opacity: 0; transform: translateY(24px); }\n to { opacity: 1; transform: translateY(0); }\n }\n @keyframes tkx-snackbar-slide-down {\n from { opacity: 0; transform: translateY(-24px); }\n to { opacity: 1; transform: translateY(0); }\n }\n @keyframes tkx-snackbar-fade-out {\n from { opacity: 1; }\n to { opacity: 0; transform: translateY(8px); }\n }\n ",document.head.appendChild(e)}()},[]),(0,a.useEffect)(()=>{if(t)y(!1),g(!0);else if(m){if(!p){y(!0);const e=setTimeout(()=>{g(!1),y(!1)},250);return()=>clearTimeout(e)}g(!1)}},[t,p,m]),(0,a.useEffect)(()=>{if(t&&!(l<=0)&&n)return f.current=setTimeout(()=>{n()},l),()=>{f.current&&clearTimeout(f.current)}},[t,l,n]);const b=(0,a.useCallback)(()=>{f.current&&(clearTimeout(f.current),f.current=null)},[]),v=(0,a.useCallback)(()=>{t&&l>0&&n&&(f.current=setTimeout(()=>n(),l))},[t,l,n]),w={default:u.textMuted,success:u.success,error:u.danger,warning:u.warning,info:u.info}[o],k=pe(e);if(!m||"undefined"==typeof document)return null;let $={};p||($=x?{animation:"tkx-snackbar-fade-out 250ms ease forwards"}:{animation:("top-center"===i?"tkx-snackbar-slide-down":"tkx-snackbar-slide-up")+" 250ms cubic-bezier(0.16,1,0.3,1) both"});const S=s??ti[o]??null;return(0,c.createPortal)((0,d.jsx)("div",{role:"error"===o?"alert":"status","aria-live":"error"===o?"assertive":"polite","aria-atomic":"true","aria-labelledby":h,className:$t("fixed z-[9500] font-sans"),style:{...ni[i],...$,pointerEvents:"auto"},onMouseEnter:b,onMouseLeave:v,children:(0,d.jsxs)("div",{className:$t("flex items-center gap-3 px-4 py-3 rounded-lg shadow-lg","min-w-[280px] max-w-[480px]"),style:{backgroundColor:u.surface,border:`1px solid ${w}44`,boxShadow:`0 8px 24px ${u.bg}aa`,color:u.text},children:[S&&(0,d.jsx)("span",{className:$t("shrink-0 flex items-center"),style:{color:w},children:S}),(0,d.jsx)("span",{id:h,className:$t("flex-1 text-sm leading-snug"),children:k}),r&&(0,d.jsx)("button",{onClick:()=>{r.onClick(),n?.()},className:$t("bg-transparent border-none cursor-pointer p-0 ml-2","text-sm font-semibold shrink-0","focus-visible:focus-ring"),style:{color:u.primary},children:pe(r.label)}),n&&(0,d.jsx)("button",{"aria-label":"Dismiss snackbar",onClick:n,className:$t("bg-transparent border-none cursor-pointer rounded p-[2px] ml-1","shrink-0 flex items-center justify-center","focus-visible:focus-ring"),style:{color:u.textMuted},children:(0,d.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:[(0,d.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,d.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})}),document.body)},exports.TkxSortable=Il,exports.TkxSparkline=Dd,exports.TkxSpeedDial=function({actions:e,icon:t,direction:n="up",position:r="bottom-right",className:o,style:i}){const l=J(),s=qe(),u=(0,a.useId)(),[p,h]=(0,a.useState)(!1),[f,m]=(0,a.useState)(-1),g=(0,a.useRef)(null),x=(0,a.useRef)(new Map),y=(0,a.useCallback)(()=>{h(e=>!e),m(-1)},[]),b=(0,a.useCallback)(()=>{h(!1),m(-1)},[]);Ye(b,p),(0,a.useEffect)(()=>{if(!p)return;const e=e=>{g.current?.contains(e.target)||b()};return document.addEventListener("pointerdown",e),()=>document.removeEventListener("pointerdown",e)},[p,b]),(0,a.useEffect)(()=>{f>=0&&x.current.get(f)?.focus()},[f]);const v=e=>s?"0ms":40*e+"ms";return(0,d.jsxs)(d.Fragment,{children:[p&&"undefined"!=typeof document&&(0,c.createPortal)((0,d.jsx)("div",{"aria-hidden":"true",onClick:b,style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.3)",zIndex:9e3,transition:s?"none":"opacity 200ms ease"}}),document.body),(0,d.jsxs)("div",{ref:g,className:$t("fixed z-[9100] font-sans",o??""),style:{..._o[r],...i},children:[p&&e.map((t,r)=>{const o=pe(t.label),i=function(e,t){const n=64*(t+1);switch(e){case"up":return{bottom:n,left:"50%",transform:"translateX(-50%)"};case"down":return{top:n,left:"50%",transform:"translateX(-50%)"};case"left":return{right:n,top:"50%",transform:"translateY(-50%)"};case"right":return{left:n,top:"50%",transform:"translateY(-50%)"}}}(n,r),a=function(e){switch(e){case"up":case"down":return{right:"100%",top:"50%",transform:"translateY(-50%)",marginRight:10};case"left":case"right":return{bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:10}}}(n);return(0,d.jsx)("div",{className:$t("absolute"),style:{...i,opacity:s?1:0,animation:s?"none":"tkxSpeedDialIn 180ms ease forwards",animationDelay:v(r)},children:(0,d.jsxs)("div",{className:$t("relative inline-flex"),children:[(0,d.jsx)("span",{className:$t("absolute z-10 whitespace-nowrap text-xs py-1 px-2 rounded-md pointer-events-none"),style:{...a,backgroundColor:l.surfaceAlt,color:l.text,border:`1px solid ${l.border}`,boxShadow:"0 2px 8px rgba(0,0,0,0.15)"},role:"tooltip",children:o}),(0,d.jsx)("button",{ref:e=>{e?x.current.set(r,e):x.current.delete(r)},type:"button","aria-label":o,tabIndex:p?0:-1,onClick:()=>{t.onClick?.(),b()},onKeyDown:t=>((t,n)=>{switch(t.key){case"ArrowUp":case"ArrowLeft":t.preventDefault(),m(n>0?n-1:e.length-1);break;case"ArrowDown":case"ArrowRight":t.preventDefault(),m(n<e.length-1?n+1:0);break;case"Enter":case" ":t.preventDefault(),e[n].onClick?.(),b();break;case"Escape":b();break;case"Home":t.preventDefault(),m(0);break;case"End":t.preventDefault(),m(e.length-1)}})(t,r),className:$t("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:48,height:48,backgroundColor:l.surface,color:l.text,border:`1px solid ${l.border}`,boxShadow:"0 4px 12px rgba(0,0,0,0.15)",transition:s?"none":"all 150ms ease"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor=l.surfaceAlt,e.currentTarget.style.transform="scale(1.1)"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=l.surface,e.currentTarget.style.transform="scale(1)"},children:t.icon})]})},t.id)}),(0,d.jsx)("button",{type:"button","aria-label":p?"Close actions menu":"Open actions menu","aria-expanded":p,"aria-controls":u,"aria-haspopup":"true",onClick:y,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),y()),p&&("ArrowUp"!==e.key&&"ArrowLeft"!==e.key||(e.preventDefault(),m(0)),"ArrowDown"!==e.key&&"ArrowRight"!==e.key||(e.preventDefault(),m(0)))},className:$t("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:56,height:56,backgroundColor:l.primary,color:l.bg,boxShadow:`0 6px 20px ${l.primary}40`,transition:s?"none":"all 200ms ease",position:"relative",zIndex:1},onMouseEnter:e=>{e.currentTarget.style.boxShadow=`0 8px 28px ${l.primary}60`,s||(e.currentTarget.style.transform="scale(1.05)")},onMouseLeave:e=>{e.currentTarget.style.boxShadow=`0 6px 20px ${l.primary}40`,e.currentTarget.style.transform="scale(1)"},children:t??(0,d.jsx)(Go,{color:l.bg,rotated:p,reducedMotion:s})}),(0,d.jsx)("div",{id:u,role:"menu","aria-label":"Speed dial actions",style:{display:"none"},children:e.map(e=>(0,d.jsx)("div",{role:"menuitem",children:pe(e.label)},e.id))})]}),p&&!s&&(0,d.jsx)("style",{children:"\n @keyframes tkxSpeedDialIn {\n from { opacity: 0; transform: translateX(-50%) scale(0.5); }\n to { opacity: 1; transform: translateX(-50%) scale(1); }\n }\n "})]})},exports.TkxSpin=function({spinning:e=!0,size:t="md",tip:n,indicator:r,children:o,fullscreen:i=!1,delay:l=0,className:s,style:d}){const c=J(),u=qe(),[p,h]=(0,a.useState)(0===l&&e),f=(0,a.useRef)(null);if((0,a.useEffect)(()=>(e&&l>0?f.current=setTimeout(()=>h(!0),l):h(e),()=>{null!==f.current&&clearTimeout(f.current)}),[e,l]),!p)return o?(0,a.createElement)("div",{className:s,style:d},o):null;const m=da[t],g=n?pe(n):void 0,x=(0,a.createElement)("div",{role:"status","aria-live":"polite","aria-label":g??"Loading",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"8px"}},r??(0,a.createElement)(pa,{size:m.dimension,borderWidth:m.borderWidth,color:c.primary,reducedMotion:u}),g&&(0,a.createElement)("span",{style:{color:c.primary,fontSize:m.fontSize,marginTop:"4px"}},g));return i?(0,a.createElement)("div",{className:s,style:{position:"fixed",inset:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:`${c.bg}cc`,zIndex:9999,...d}},x):o?(0,a.createElement)("div",{className:s,style:{position:"relative",...d}},(0,a.createElement)("div",{style:{filter:"blur(1px)",opacity:.5,pointerEvents:"none",userSelect:"none",transition:u?"none":"opacity 0.2s, filter 0.2s"}},o),(0,a.createElement)("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:`${c.bg}66`,borderRadius:"4px"}},x)):(0,a.createElement)("div",{className:s,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",...d}},x)},exports.TkxSpreadsheet=function({cols:e=8,rows:t=20,data:n,onChange:r,colWidth:o=96,rowHeight:i=28,style:l,className:s}){const c=J(),[u,p]=(0,a.useState)({col:0,row:0}),[h,f]=(0,a.useState)(!1),[m,g]=(0,a.useState)(""),x=(0,a.useRef)(null),y=(0,a.useMemo)(()=>{const e=new Map,t={cells:n.cells,stack:new Set,memo:e};return e=>yc(e,t)},[n]),b=mc(u.col,u.row),v=(0,a.useCallback)(e=>{g(e??n.cells[b]??""),f(!0),requestAnimationFrame(()=>x.current?.focus())},[b,n.cells]),w=(0,a.useCallback)(()=>{const e={...n.cells};""===m?delete e[b]:e[b]=m,r({cells:e}),f(!1)},[b,n,m,r]),k=(0,a.useCallback)(()=>{f(!1),g("")},[]),$=(0,a.useCallback)((n,r)=>{p(o=>({col:Math.max(0,Math.min(e-1,o.col+n)),row:Math.max(0,Math.min(t-1,o.row+r))}))},[e,t]),S=e=>{switch(e.key){case"Enter":e.preventDefault(),w(),$(0,1);break;case"Tab":e.preventDefault(),w(),$(e.shiftKey?-1:1,0);break;case"Escape":e.preventDefault(),k()}},C=48+e*o,z=28+t*i;return(0,d.jsxs)("div",{className:s,tabIndex:0,role:"grid","aria-rowcount":t,"aria-colcount":e,"data-testid":"tkx-spreadsheet",onKeyDown:e=>{if(!h)switch(e.key){case"ArrowUp":e.preventDefault(),$(0,-1);break;case"ArrowDown":e.preventDefault(),$(0,1);break;case"ArrowLeft":e.preventDefault(),$(-1,0);break;case"ArrowRight":e.preventDefault(),$(1,0);break;case"Tab":e.preventDefault(),$(e.shiftKey?-1:1,0);break;case"Enter":case"F2":e.preventDefault(),v();break;case"Delete":case"Backspace":if(e.preventDefault(),void 0!==n.cells[b]){const e={...n.cells};delete e[b],r({cells:e})}break;default:1!==e.key.length||e.metaKey||e.ctrlKey||(e.preventDefault(),v(e.key))}},style:{...Q(c),position:"relative",width:C,maxWidth:"100%",height:z,outline:"none",border:"1px solid var(--tkx-border, #2a2a3e)",borderRadius:8,overflow:"auto",background:"var(--tkx-bg, #0a0a0f)",color:"var(--tkx-fg, #e8e8f4)",fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",fontSize:13,...l},children:[(0,d.jsxs)("div",{role:"row",style:{display:"flex",height:28,position:"sticky",top:0,background:"var(--tkx-bg-subtle, #0d0d14)",zIndex:2,borderBottom:"1px solid var(--tkx-border, #2a2a3e)"},children:[(0,d.jsx)("div",{role:"columnheader",style:{width:48,flex:"0 0 48px",borderRight:"1px solid var(--tkx-border, #2a2a3e)",background:"var(--tkx-bg-subtle, #0d0d14)"}}),Array.from({length:e}).map((e,t)=>(0,d.jsx)("div",{role:"columnheader","data-testid":`col-${hc(t)}`,style:{width:o,flex:`0 0 ${o}px`,textAlign:"center",lineHeight:"28px",fontWeight:700,color:t===u.col?"var(--tkx-accent, #00f5d4)":c.textMuted,borderRight:"1px solid var(--tkx-border-soft, #1a1a25)"},children:hc(t)},t))]}),Array.from({length:t}).map((t,r)=>(0,d.jsxs)("div",{role:"row","aria-rowindex":r+1,style:{display:"flex",height:i},children:[(0,d.jsx)("div",{role:"rowheader",style:{width:48,flex:"0 0 48px",textAlign:"center",lineHeight:`${i}px`,fontWeight:700,color:r===u.row?"var(--tkx-accent, #00f5d4)":c.textMuted,background:"var(--tkx-bg-subtle, #0d0d14)",borderRight:"1px solid var(--tkx-border, #2a2a3e)",borderBottom:"1px solid var(--tkx-border-soft, #1a1a25)",position:"sticky",left:0,zIndex:1},children:r+1}),Array.from({length:e}).map((e,t)=>{const a=mc(t,r),l=t===u.col&&r===u.row,s=n.cells[a]??"",f=""===s?"":"number"==typeof(b=y(a))?Number.isFinite(b)?Number.isInteger(b)?String(b):String(Math.round(1e10*b)/1e10):"#NUM!":String(b);var b;const k=s.startsWith("=");return(0,d.jsx)("div",{role:"gridcell","aria-colindex":t+1,"aria-selected":l,"data-testid":`cell-${a}`,onClick:()=>p({col:t,row:r}),onDoubleClick:()=>{p({col:t,row:r}),v()},style:{width:o,flex:`0 0 ${o}px`,borderRight:"1px solid var(--tkx-border-soft, #1a1a25)",borderBottom:"1px solid var(--tkx-border-soft, #1a1a25)",padding:"0 6px",lineHeight:`${i}px`,background:l?"rgba(0,245,212,0.08)":"transparent",outline:l?"2px solid var(--tkx-accent, #00f5d4)":"none",outlineOffset:-2,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",color:"string"==typeof y(a)&&y(a).startsWith("#")?c.danger:k?"var(--tkx-accent, #00f5d4)":"var(--tkx-fg, #e8e8f4)",cursor:"cell",position:"relative"},children:l&&h?(0,d.jsx)("input",{ref:x,value:m,onChange:e=>g(e.target.value),onBlur:w,onKeyDown:S,"data-testid":`cell-input-${a}`,style:{position:"absolute",inset:0,width:"100%",height:"100%",padding:"0 6px",border:"none",background:"var(--tkx-bg, #0a0a0f)",color:"var(--tkx-fg, #e8e8f4)",fontFamily:"inherit",fontSize:"inherit",outline:"none"}}):f},t)})]},r))]})},exports.TkxStatistic=function({title:e,value:t,prefix:n,suffix:r,precision:o,groupSeparator:i=",",valueStyle:l,loading:s=!1,trend:d,trendValue:c,style:u}){const p=J(),h=qe(),f=pe(e),m=c?pe(c):void 0,g="up"===d?p.success:"down"===d?p.danger:void 0;return(0,a.createElement)("div",{style:{display:"flex",flexDirection:"column",gap:"4px",...u}},(0,a.createElement)("div",{style:{color:p.textMuted,fontSize:"0.875rem",lineHeight:"1.4"}},f),s?(0,a.createElement)(xa,{w:"120px",h:"32px",alt:p.surfaceAlt,bdr:p.border,rm:h}):(0,a.createElement)("div",{style:{display:"flex",alignItems:"baseline",gap:"4px",fontSize:"1.75rem",fontWeight:700,lineHeight:"1.2",color:p.text,fontVariantNumeric:"tabular-nums",...l}},n&&(0,a.createElement)("span",{style:{fontSize:"0.75em",fontWeight:400}},n),(0,a.createElement)("span",null,function(e,t,n=","){if("string"==typeof e)return e;const[r,o]=(void 0!==t?e.toFixed(t):String(e)).split("."),i=r.replace(/\B(?=(\d{3})+(?!\d))/g,n);return void 0!==o?`${i}.${o}`:i}(t,o,i)),r&&(0,a.createElement)("span",{style:{fontSize:"0.6em",fontWeight:400,color:p.textMuted}},r)),d&&(0,a.createElement)("div",{style:{display:"flex",alignItems:"center",gap:"4px",fontSize:"0.8125rem",color:g,marginTop:"2px"}},(0,a.createElement)(ma,{direction:d,color:g}),m&&(0,a.createElement)("span",null,m)))},exports.TkxStepper=po,exports.TkxTab=function({index:e,children:t,disabled:n=!1,className:r,style:o}){const i=J(),{activeIndex:l,setActiveIndex:s,baseId:c,tabCount:u}=nn(),p=(0,a.useRef)(null),h=l===e;return(0,d.jsx)("button",{ref:p,role:"tab",id:`${c}-tab-${e}`,"aria-controls":`${c}-panel-${e}`,"aria-selected":h,tabIndex:h?0:-1,disabled:n,className:Ct($t("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",n?"opacity-50 cursor-not-allowed":""),r),style:{color:h?i.primary:i.textMuted,fontWeight:h?600:400,borderBottom:h?`2px solid ${i.primary}`:"2px solid transparent",marginBottom:"-2px",...o},onClick:()=>!n&&s(e),onKeyDown:t=>H(t,e,u,e=>{s(e),document.getElementById(`${c}-tab-${e}`)?.focus()}),children:t})},exports.TkxTabList=function({children:e,className:t,style:n,...r}){const o=J();return(0,d.jsx)("div",{role:"tablist",className:Ct($t("flex gap-1"),t),style:{borderBottom:`2px solid ${o.border}`,...n},...r,children:e})},exports.TkxTabPanel=function({index:e,children:t,style:n,className:r}){const{activeIndex:o,baseId:i}=nn();return o!==e?null:(0,d.jsx)("div",{role:"tabpanel",id:`${i}-panel-${e}`,"aria-labelledby":`${i}-tab-${e}`,tabIndex:0,className:Ct($t("pt-4"),r),style:n,children:t})},exports.TkxTabPanels=function({children:e,className:t,...n}){return(0,d.jsx)("div",{className:t,...n,children:e})},exports.TkxTable=function({columns:e,data:t,caption:n,sortable:r,stickyHeader:o,isLoading:i,emptyState:l,style:s,className:c,striped:u,maxHeight:p,rowHeight:h=44,virtualScroll:f,onLoadMore:m,hasMore:g,loadingMore:x=!1,onRowClick:y,selectedRows:b,bordered:v,compact:w}){const k=J(),[$,S]=(0,a.useState)(null),[C,z]=(0,a.useState)("asc"),M=(0,a.useMemo)(()=>$&&r?[...t].sort((e,t)=>{const n=e[$],r=t[$];let o=0;return"string"==typeof n&&"string"==typeof r?o=n.localeCompare(r):"number"==typeof n&&"number"==typeof r&&(o=n-r),"asc"===C?o:-o}):t,[t,$,C,r]),N=(0,a.useCallback)(e=>{$===e?z(e=>"asc"===e?"desc":"asc"):(S(e),z("asc"))},[$]),D=void 0!==f?f:void 0!==p&&M.length>=50,R=(0,a.useRef)(null),[P,F]=(0,a.useState)(0),[A,I]=(0,a.useState)(400),L=(0,a.useCallback)(()=>{R.current&&F(R.current.scrollTop)},[]);(0,a.useEffect)(()=>{if(!D||!R.current)return;const e=R.current;I(e.clientHeight);const t=new ResizeObserver(()=>I(e.clientHeight));return t.observe(e),()=>t.disconnect()},[D]);const T=D?Math.max(0,Math.floor(P/h)-5):0,W=D?Math.min(M.length,Math.ceil((P+A)/h)+5):M.length,j=D?M.slice(T,W):M,E=(0,a.useRef)(null),B=(0,a.useRef)(!1);(0,a.useEffect)(()=>{B.current=!1},[t.length]),(0,a.useEffect)(()=>{if(!m)return;const e=E.current;if(!e)return;const t=new IntersectionObserver(e=>{e[0].isIntersecting&&!B.current&&!1!==g&&(B.current=!0,m())},{root:R.current,rootMargin:"0px 0px 200px 0px",threshold:0});return t.observe(e),()=>t.disconnect()},[m,g]);const V=w?"4px":"12px",H=w?"8px":"16px",O=v?`1px solid ${k.border}`:"none",q=(0,a.useMemo)(()=>new Set(b??[]),[b]);return(0,d.jsx)("div",{className:$t("w-full rounded-lg",c??""),style:{border:`1px solid ${k.border}`,overflow:"hidden",...s},children:(0,d.jsxs)("div",{ref:R,onScroll:D?L:void 0,style:{overflowX:"auto",overflowY:p?"auto":"visible",maxHeight:p??"none"},children:[(0,d.jsxs)("table",{className:$t("w-full font-sans text-sm"),style:{borderCollapse:"collapse",color:k.text},children:[n&&(0,d.jsx)("caption",{className:$t("text-sm text-left p-2"),style:{color:k.textMuted},children:pe(n)}),(0,d.jsx)("thead",{style:o?{position:"sticky",top:0,backgroundColor:k.surfaceAlt,zIndex:1}:{backgroundColor:k.surfaceAlt},children:(0,d.jsx)("tr",{children:e.map(e=>{const t=r&&!1!==e.sortable,n=(o=e.key,$!==o?"none":C);var o;return(0,d.jsx)("th",{scope:"col","aria-sort":t?"none"===n?"none":"asc"===n?"ascending":"descending":void 0,className:$t("text-left font-semibold whitespace-nowrap",t?"cursor-pointer select-none":""),style:{padding:`${V} ${H}`,color:k.textMuted,borderBottom:`2px solid ${k.border}`,borderRight:O,width:e.width},onClick:()=>t&&N(e.key),onKeyDown:n=>{!t||"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),N(e.key))},tabIndex:t?0:void 0,children:(0,d.jsxs)("span",{className:$t("inline-flex items-center gap-1.5"),children:[pe(e.header),t&&(0,d.jsx)(dn,{dir:n})]})},String(e.key))})})}),(0,d.jsx)("tbody",{children:i?Array.from({length:5},(t,n)=>(0,d.jsx)("tr",{children:e.map(e=>(0,d.jsx)("td",{style:{padding:`${V} ${H}`},children:(0,d.jsx)(an,{variant:"text",height:"16px"})},String(e.key)))},n)):0===M.length?(0,d.jsx)("tr",{children:(0,d.jsx)("td",{colSpan:e.length,className:$t("text-center"),style:{padding:"32px 16px",color:k.textMuted},children:l??"No data available"})}):(0,d.jsxs)(d.Fragment,{children:[D&&T>0&&(0,d.jsx)("tr",{"aria-hidden":"true",style:{height:T*h},children:(0,d.jsx)("td",{colSpan:e.length,style:{padding:0,border:"none"}})}),j.map((t,n)=>{const r=T+n,o=q.has(r);return(0,d.jsx)("tr",{"aria-rowindex":r+1,"aria-selected":o||void 0,onClick:y?()=>y(t,r):void 0,onKeyDown:y?e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),y(t,r))}:void 0,tabIndex:y?0:void 0,className:$t(y?"cursor-pointer":""),style:{backgroundColor:o?`${k.primary}22`:u&&r%2==1?k.surfaceAlt:"transparent",borderBottom:`1px solid ${k.border}`,...D?{height:h,boxSizing:"border-box"}:{}},children:e.map(e=>{const n=t[e.key],r=e.render?e.render(n,t):"string"==typeof n?pe(n):String(n??"");return(0,d.jsx)("td",{style:{padding:`${V} ${H}`,color:k.text,borderRight:O},children:r},String(e.key))})},r)}),D&&W<M.length&&(0,d.jsx)("tr",{"aria-hidden":"true",style:{height:(M.length-W)*h},children:(0,d.jsx)("td",{colSpan:e.length,style:{padding:0,border:"none"}})})]})})]}),(g||x)&&(0,d.jsx)("div",{ref:E,style:{height:1,width:"100%"},children:x&&(0,d.jsx)("table",{style:{width:"100%",borderCollapse:"collapse"},children:(0,d.jsx)("tbody",{children:Array.from({length:3},(t,n)=>(0,d.jsx)("tr",{children:e.map(e=>(0,d.jsx)("td",{style:{padding:"10px 16px"},children:(0,d.jsx)(an,{variant:"text",height:"16px"})},String(e.key)))},n))})})}),!g&&m&&(0,d.jsx)("div",{style:{padding:"16px",textAlign:"center",fontSize:13,color:k.textMuted},children:"✓ All rows loaded"})]})})},exports.TkxTabs=function({defaultIndex:e=0,activeIndex:t,onChange:n,children:r,tabCount:o=0,style:i,className:l}){const[s,c]=(0,a.useState)(e),u=(0,a.useId)(),p=void 0!==t?t:s;return(0,d.jsx)(tn.Provider,{value:{activeIndex:p,setActiveIndex:e=>{void 0===t&&c(e),n?.(e)},baseId:u,tabCount:o},children:(0,d.jsx)("div",{className:l,style:i,children:r})})},exports.TkxTag=Lr,exports.TkxTagInput=function({value:e,defaultValue:t=[],onChange:n,placeholder:r="Add tag…",maxTags:o,allowDuplicates:i=!1,validate:l,colorScheme:s="primary",size:c="md",label:u,hint:p,isDisabled:h=!1}){const f=J(),m=qe(),[g,x]=(0,a.useState)(t),[y,b]=(0,a.useState)(""),[v,w]=(0,a.useState)(null),k=(0,a.useRef)(null),$=void 0!==e,S=$?e:g,C=(0,a.useCallback)(e=>{$||x(e),n?.(e)},[$,n]),z=(0,a.useCallback)(e=>{const t=e.trim();if(t)if(void 0!==o&&S.length>=o)w(`Maximum ${o} tags allowed`);else if(i||!S.includes(t)){if(l){const e=l(t);if(!1===e)return void w("Invalid tag");if("string"==typeof e)return void w(e)}w(null),C([...S,t]),b("")}else w("Duplicate tags are not allowed")},[S,o,i,l,C]),M=(0,a.useCallback)(e=>{C(S.filter((t,n)=>n!==e)),w(null)},[S,C]),N=(0,a.useCallback)(e=>{"Enter"===e.key||","===e.key?(e.preventDefault(),z(y)):"Backspace"===e.key&&""===y&&S.length>0&&M(S.length-1)},[y,S,z,M]),D=(0,a.useCallback)(e=>{const t=e.target.value;t.endsWith(",")?z(t.slice(0,-1)):(b(t),v&&w(null))},[z,v]),R="sm"===c?"6px 8px":"lg"===c?"10px 12px":"8px 10px",P="sm"===c?11:"lg"===c?14:12;return(0,d.jsxs)("div",{className:$t("flex flex-col gap-1.5"),children:[u&&(0,d.jsx)("label",{className:$t("text-sm font-medium"),style:{color:f.text},onClick:()=>k.current?.focus(),children:pe(u)}),(0,d.jsxs)("div",{className:$t("flex flex-wrap items-center gap-1.5 rounded-lg cursor-text",!m&&"transition-colors duration-150"),style:{padding:R,backgroundColor:f.surface,border:`1.5px solid ${v?f.danger:f.border}`,opacity:h?.55:1,minHeight:"sm"===c?36:"lg"===c?48:40},onClick:()=>!h&&k.current?.focus(),children:[S.map((e,t)=>(0,d.jsx)(Lr,{size:c,variant:"subtle",colorScheme:s,onRemove:h?void 0:()=>M(t),isDisabled:h,children:e},`${e}-${t}`)),(!o||S.length<o)&&!h&&(0,d.jsx)("input",{ref:k,type:"text",value:y,onChange:D,onKeyDown:N,placeholder:0===S.length?pe(r):"",disabled:h,className:$t("flex-1 bg-transparent outline-none min-w-[80px]"),style:{fontSize:P,color:f.text,caretColor:f.primary},"aria-label":u??"Tag input"})]}),v&&(0,d.jsx)("p",{className:$t("text-xs"),style:{color:f.danger},role:"alert",children:v}),p&&!v&&(0,d.jsx)("p",{className:$t("text-xs"),style:{color:f.textMuted},children:pe(p)})]})},exports.TkxText=function({children:e,type:t="default",strong:n=!1,italic:r=!1,underline:o=!1,delete:i=!1,code:l=!1,mark:s=!1,copyable:d=!1,style:c}){const u=la(t),p=J(),h=ia(e),f="string"==typeof e?pe(e):e,m=[];o&&m.push("underline"),i&&m.push("line-through");let g=f;return l&&(g=(0,a.createElement)("code",{style:{padding:"0.15em 0.4em",fontSize:"0.875em",backgroundColor:p.surfaceAlt,border:`1px solid ${p.border}`,borderRadius:"4px",fontFamily:"monospace"}},g)),s&&(g=(0,a.createElement)("mark",{style:{backgroundColor:`${p.warning}33`,color:u,padding:"0 2px",borderRadius:"2px"}},g)),(0,a.createElement)(n?"strong":r?"em":"span",{style:{color:u,fontStyle:r?"italic":"normal",textDecoration:m.length>0?m.join(" "):"none",...c}},g,d&&(0,a.createElement)(aa,{text:h}))},exports.TkxThemeStudio=function({initialTheme:e,onChange:t,onExport:n,preview:r,exportName:o="myTheme",className:i,style:l}){const s=J(),c=e??s,[u,p]=(0,a.useState)(c),[h,f]=(0,a.useState)("ts"),[m,g]=(0,a.useState)(!1),x=(0,a.useCallback)((e,n)=>{p(r=>{const o={...r,[e]:n};return t?.(o),o})},[t]),y=(0,a.useMemo)(()=>"json"===h?function(e){return JSON.stringify(e,null,2)}(u):"ts"===h?function(e,t="myTheme"){const n=["import type { ThemeTokens } from 'tekivex-ui';",""];n.push(`export const ${t}: ThemeTokens = {`);for(const[r,o]of Object.entries(e))n.push(` ${r}: ${JSON.stringify(o)},`);return n.push("};"),n.join("\n")}(u,o):function(e){const t=[":root {"];for(const[n,r]of Object.entries(e))t.push(` --tkx-${n}: ${r};`);return t.push("}"),t.join("\n")}(u),[u,h,o]),b=(0,a.useCallback)(()=>{p(c),t?.(c)},[c,t]),v=(0,a.useMemo)(()=>{const e={surface:[],text:[],brand:[],status:[]};for(const t of Ys)e[t.group].push(t);return e},[]);return(0,d.jsxs)("div",{className:i,style:{display:"grid",gridTemplateColumns:"minmax(300px, 380px) 1fr",gap:16,color:s.text,...l},role:"region","aria-label":"Theme editor",children:[(0,d.jsx)("style",{children:"\n @media (max-width: 760px) {\n .tk-studio-grid { grid-template-columns: 1fr !important; }\n }\n "}),(0,d.jsxs)("aside",{style:{background:s.surface,border:`1px solid ${s.border}`,borderRadius:12,padding:16,display:"flex",flexDirection:"column",gap:16,maxHeight:"80vh",overflowY:"auto"},children:[(0,d.jsxs)("header",{style:{display:"flex",alignItems:"center",gap:8},children:[(0,d.jsx)("h2",{style:{margin:0,fontSize:16,fontWeight:800,letterSpacing:"-0.01em",flex:1},children:"Theme Studio"}),(0,d.jsx)("button",{type:"button",onClick:b,style:(w=s,{background:"transparent",border:`1px solid ${w.border}`,color:w.textMuted,padding:"6px 12px",borderRadius:6,fontSize:12,cursor:"pointer",fontWeight:600}),"aria-label":"Reset to original theme",children:"↺ Reset"})]}),Object.keys(v).map(e=>(0,d.jsxs)("section",{children:[(0,d.jsx)("h3",{style:{margin:"0 0 10px",fontSize:11,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.08em",color:s.textMuted},children:Zs[e]}),(0,d.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:10},children:v[e].map(e=>(0,d.jsx)(_s,{slot:e,value:u[e.key],pairedValue:e.contrastAgainst?u[e.contrastAgainst]:void 0,onChange:t=>x(e.key,t)},e.key))})]},e)),(0,d.jsxs)("section",{style:{marginTop:8},children:[(0,d.jsx)("h3",{style:{margin:"0 0 10px",fontSize:11,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.08em",color:s.textMuted},children:"Export"}),(0,d.jsx)("div",{role:"tablist",style:{display:"flex",gap:4,marginBottom:8},children:["ts","json","css"].map(e=>(0,d.jsx)("button",{role:"tab",type:"button","aria-selected":h===e,onClick:()=>f(e),style:Qs(s,h===e),children:e.toUpperCase()},e))}),(0,d.jsx)("pre",{style:{margin:0,padding:12,background:s.bg,border:`1px solid ${s.border}`,borderRadius:8,fontSize:11,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",color:s.text,maxHeight:200,overflow:"auto",lineHeight:1.5,whiteSpace:"pre"},children:(0,d.jsx)("code",{children:y})}),(0,d.jsxs)("div",{style:{display:"flex",gap:8,marginTop:8},children:[(0,d.jsx)("button",{type:"button",onClick:()=>{navigator.clipboard?.writeText(y),g(!0),setTimeout(()=>g(!1),1500)},style:ed(s),children:m?"✓ Copied":"📋 Copy"}),(0,d.jsx)("button",{type:"button",onClick:()=>n?.(h,y),disabled:!n,style:td(s,!n),children:"Save…"})]})]})]}),(0,d.jsx)("section",{"aria-label":"Theme preview",style:{background:u.bg,border:`1px solid ${u.border}`,borderRadius:12,padding:24,minHeight:480,color:u.text},children:(0,d.jsx)(_,{theme:u,children:r??(0,d.jsx)(Js,{})})})]});var w},exports.TkxThinkingIndicator=wr,exports.TkxTimeline=function({items:e,variant:t="default",orientation:n="vertical",connectorStyle:r="solid",className:o,style:i}){const l=J(),s=qe(),c=(0,a.useRef)(!1);(0,a.useEffect)(()=>{!function(){if(Tr||"undefined"==typeof document)return;Tr=!0;const e=document.createElement("style");e.textContent="\n @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; } }\n @keyframes tkx-draw-line { from { transform:scaleY(0); transform-origin:top center; } to { transform:scaleY(1); } }\n @keyframes tkx-draw-line-h { from { transform:scaleX(0); transform-origin:left center; } to { transform:scaleX(1); } }\n .tkx-pulse-dot { animation: tkx-pulse-dot 1.5s ease-in-out infinite; }\n .tkx-draw-v { animation: tkx-draw-line 0.6s ease forwards; }\n .tkx-draw-h { animation: tkx-draw-line-h 0.6s ease forwards; }\n ",document.head.appendChild(e)}(),c.current=!0},[]);const u=!s,p="compact"===t,h="alternating"===t&&"vertical"===n;return"horizontal"===n?(0,d.jsx)("div",{role:"list","aria-label":"Timeline",className:$t("flex items-start w-full overflow-x-auto",o??""),style:i,children:e.map((t,n)=>{const o=t.status??"pending",i="completed"===o?l.success:l.border,a=n===e.length-1;return(0,d.jsx)("div",{role:"listitem",className:$t("flex items-start flex-1 min-w-0"),children:(0,d.jsxs)("div",{className:$t("flex flex-col items-center flex-1 min-w-0"),children:[(0,d.jsxs)("div",{className:$t("flex items-center w-full"),children:[n>0&&(0,d.jsx)(Er,{style:r,color:i,animate:u}),(0,d.jsx)(Wr,{status:o,icon:t.icon,size:24}),!a&&(0,d.jsx)(Er,{style:r,color:i,animate:u})]}),(0,d.jsxs)("div",{className:$t("mt-2 px-1 text-center min-w-0 w-full"),children:[(0,d.jsx)("div",{className:$t("text-xs font-semibold truncate"),style:{color:l.text},children:"string"==typeof t.title?pe(t.title):t.title}),t.timestamp&&(0,d.jsx)("div",{className:$t("text-[10px] mt-0.5"),style:{color:l.textMuted},children:pe(t.timestamp)})]})]})},t.id)})}):(0,d.jsx)("div",{role:"list","aria-label":"Timeline",className:$t("flex flex-col",o??""),style:i,children:e.map((t,n)=>{const o=t.status??"pending",i=n===e.length-1,a="completed"===o?l.success:l.border,s=h&&n%2==0;return h?(0,d.jsxs)("div",{role:"listitem",className:$t("flex items-stretch gap-0"),children:[(0,d.jsx)("div",{className:$t("flex-1 flex flex-col items-end pr-4",s?"":"invisible"),children:s&&(0,d.jsx)(Br,{item:t,compact:p})}),(0,d.jsxs)("div",{className:$t("flex flex-col items-center"),children:[(0,d.jsx)(Wr,{status:o,icon:t.icon,size:28}),!i&&(0,d.jsx)(jr,{style:r,color:a,animate:u})]}),(0,d.jsx)("div",{className:$t("flex-1 flex flex-col items-start pl-4",s?"invisible":""),children:!s&&(0,d.jsx)(Br,{item:t,compact:p})})]},t.id):(0,d.jsxs)("div",{role:"listitem",className:$t("flex gap-3 items-stretch"),children:[(0,d.jsxs)("div",{className:$t("flex flex-col items-center"),children:[(0,d.jsx)(Wr,{status:o,icon:t.icon,size:p?22:28}),!i&&(0,d.jsx)(jr,{style:r,color:a,animate:u})]}),(0,d.jsx)("div",{className:$t("flex-1 min-w-0 pt-0.5"),children:(0,d.jsx)(Br,{item:t,compact:p})})]},t.id)})})},exports.TkxTitle=function({level:e=1,children:t,copyable:n=!1,type:r="default",style:o}){const i=la(r);J();const l=sa[e],s=`h${e}`,d="string"==typeof t?pe(t):t,c=ia(t);return(0,a.createElement)(s,{style:{color:i,fontSize:l.fontSize,lineHeight:l.lineHeight,fontWeight:l.fontWeight,margin:"0 0 0.5em 0",fontFamily:"inherit",...o}},d,n&&(0,a.createElement)(aa,{text:c}))},exports.TkxToastProvider=function({position:e="top-right",children:t}){const[n,r]=(0,a.useState)([...wn]),o=qe(),i=_t();(0,a.useEffect)(()=>{r([...wn]);const e=e=>r([...e]);return kn.add(e),()=>{kn.delete(e)}},[]);const l=e.startsWith("bottom"),s=Nn[e],u=(0,a.useRef)(!1);if((0,a.useEffect)(()=>{if(!u.current&&"undefined"!=typeof document&&(u.current=!0,!document.getElementById("tkx-toast-kf"))){const e=document.createElement("style");e.id="tkx-toast-kf",e.textContent="\n @keyframes tkx-toast-slide-down {\n from { opacity: 0; transform: translateY(-16px); }\n to { opacity: 1; transform: translateY(0); }\n }\n @keyframes tkx-toast-slide-up {\n from { opacity: 0; transform: translateY(16px); }\n to { opacity: 1; transform: translateY(0); }\n }\n ",document.head.appendChild(e)}},[]),"undefined"==typeof document)return(0,d.jsx)(d.Fragment,{children:t});const p=l?[...n].reverse():n;return(0,d.jsxs)(d.Fragment,{children:[t,(0,c.createPortal)((0,d.jsx)("div",{"aria-label":i.notifications??"Notifications",className:$t("fixed z-[9999] flex flex-col gap-2 pointer-events-none"),style:s,children:p.map(t=>(0,d.jsx)("div",{className:$t("pointer-events-auto"),children:(0,d.jsx)(Rn,{toast:t,position:e,onDismiss:zn,reduced:o})},t.id))}),document.body)]})},exports.TkxToggle=qt,exports.TkxToolbar=function({items:e,orientation:t="horizontal",size:n="md",variant:r="default",ariaLabel:o="Toolbar",className:i,style:l}){const s=J(),c=qe(),u=qo[n],p="horizontal"===t,h=(0,a.useRef)(new Map),f=e.filter(e=>"separator"!==e.type&&!e.disabled).map(e=>e.id),[m,g]=(0,a.useState)(null),x=null!==m&&f.includes(m)?m:f[0],y=(0,a.useCallback)(e=>{h.current.get(e)?.focus()},[]),b=(0,a.useCallback)((e,t)=>{const n=f.indexOf(t);if(n<0)return;const r=p?"ArrowRight":"ArrowDown",o=p?"ArrowLeft":"ArrowUp";switch(e.key){case r:e.preventDefault(),y(f[n+1<f.length?n+1:0]);break;case o:e.preventDefault(),y(f[n-1>=0?n-1:f.length-1]);break;case"Home":e.preventDefault(),y(f[0]);break;case"End":e.preventDefault(),y(f[f.length-1])}},[f,y,p]),v=e=>{e.type;const t=e.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:e.disabled?"not-allowed":"pointer",backgroundColor:t?`${s.primary}20`:"transparent",color:t?s.primary:e.disabled?s.textMuted:s.text,opacity:e.disabled?.5:1,outline:"none",transition:c?"none":"all 100ms ease",whiteSpace:"nowrap",lineHeight:1}};return(0,d.jsx)("div",{role:"toolbar","aria-label":o,"aria-orientation":t,className:$t("inline-flex items-center rounded-lg font-sans",p?"flex-row":"flex-col",i??""),style:{...(()=>{switch(r){case"outlined":return{backgroundColor:"transparent",border:`1px solid ${s.border}`};case"filled":return{backgroundColor:s.surfaceAlt,border:"none"};default:return{backgroundColor:s.surface,border:`1px solid ${s.border}`}}})(),padding:u.gap,gap:u.gap,...l},children:e.map((e,t)=>{if("separator"===e.type)return(0,d.jsx)("div",{role:"separator","aria-orientation":p?"vertical":"horizontal",className:$t("flex-shrink-0"),style:{...p?{width:1,height:u.separatorSize,marginLeft:2,marginRight:2}:{height:1,width:u.separatorSize,marginTop:2,marginBottom:2},backgroundColor:s.border}},e.id);const n=pe(e.label),r=!e.disabled,o=x===e.id;return(0,d.jsxs)("button",{ref:t=>{t?h.current.set(e.id,t):h.current.delete(e.id)},type:"button",role:void e.type,"aria-pressed":"toggle"===e.type?e.active:void 0,"aria-label":n,"aria-disabled":e.disabled||void 0,tabIndex:r&&o?0:-1,disabled:e.disabled,onFocus:()=>{e.disabled||g(e.id)},onClick:()=>{e.disabled||e.onClick?.()},onKeyDown:t=>{b(t,e.id),"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e.disabled||e.onClick?.())},className:$t("focus-visible:ring-2 focus-visible:ring-offset-1"),style:v(e),onMouseEnter:t=>{e.disabled||e.active||(t.currentTarget.style.backgroundColor=s.surfaceAlt)},onMouseLeave:t=>{e.disabled||(t.currentTarget.style.backgroundColor=e.active?`${s.primary}20`:"transparent")},children:[e.icon&&(0,d.jsx)("span",{"aria-hidden":"true",style:{width:u.iconSize,height:u.iconSize,display:"flex",alignItems:"center",justifyContent:"center"},children:e.icon}),!e.icon&&n]},e.id)})})},exports.TkxTooltip=function({content:e,children:t,placement:n="top",delay:r=300}){const o=J(),[i,l]=(0,a.useState)(!1),s=(0,a.useRef)(null),c=(0,a.useId)(),u=(0,a.useRef)(null),p=qe(),h=pe(e),f=j(o.surfaceAlt,[o.text,"#ffffff","#000000"]);function m(){u.current=setTimeout(()=>l(!0),r)}function g(){u.current&&clearTimeout(u.current),l(!1)}Ye(g,i),Ze(s,g),(0,a.useEffect)(()=>()=>{u.current&&(clearTimeout(u.current),u.current=null)},[]);const x=t,y=(0,a.cloneElement)(x,{"aria-describedby":i?c:void 0,onMouseEnter:e=>{x.props.onMouseEnter?.(e),m()},onMouseLeave:e=>{x.props.onMouseLeave?.(e),g()},onFocus:e=>{x.props.onFocus?.(e),m()},onBlur:e=>{x.props.onBlur?.(e),g()}});return(0,d.jsxs)("span",{ref:s,className:$t("relative inline-flex"),children:[y,i&&(0,d.jsx)("span",{id:c,role:"tooltip",className:$t("absolute z-[9000] text-xs font-sans py-1.5 px-2.5 rounded-md whitespace-nowrap pointer-events-none",!p&&"animate-fade-in"),style:{backgroundColor:o.surfaceAlt,color:f,border:`1px solid ${o.border}`,boxShadow:`0 4px 12px ${o.bg}40`,maxWidth:280,...rn[n]},children:h})]})},exports.TkxTour=function({steps:e,isOpen:t=!1,onClose:n,current:r,onChange:o}){const i=J(),l=qe(),[s,u]=(0,a.useState)(0),p=r??s,h=(0,a.useRef)(null),[f,m]=(0,a.useState)({top:0,left:0}),[g,x]=(0,a.useState)(null),y=e[p],b=(0,a.useCallback)(()=>{if(!y)return;const e=function(e){const t=document.querySelector(e);return t?t.getBoundingClientRect():null}(y.target);if(x(e),e&&h.current){const t=h.current.offsetWidth,n=h.current.offsetHeight;m(function(e,t,n,r){switch(t){case"top":return{top:e.top-r-12+window.scrollY,left:e.left+e.width/2-n/2+window.scrollX};case"bottom":return{top:e.bottom+12+window.scrollY,left:e.left+e.width/2-n/2+window.scrollX};case"left":return{top:e.top+e.height/2-r/2+window.scrollY,left:e.left-n-12+window.scrollX};case"right":return{top:e.top+e.height/2-r/2+window.scrollY,left:e.right+12+window.scrollX};default:return{top:e.bottom+12+window.scrollY,left:e.left+window.scrollX}}}(e,y.placement??"bottom",t,n))}},[y]);(0,a.useEffect)(()=>{if(t)return b(),window.addEventListener("resize",b),window.addEventListener("scroll",b,!0),()=>{window.removeEventListener("resize",b),window.removeEventListener("scroll",b,!0)}},[t,p,b]),(0,a.useEffect)(()=>{t&&h.current?.focus()},[t,p]);const v=void 0!==r,w=(0,a.useCallback)(e=>{v||u(e),o?.(e)},[v,o]),k=(0,a.useCallback)(()=>{p<e.length-1?w(p+1):n?.()},[p,e.length,w,n]),$=(0,a.useCallback)(()=>{p>0&&w(p-1)},[p,w]);if(!t||!y)return null;const S=pe(y.title),C=pe(y.description);return(0,c.createPortal)((0,d.jsxs)("div",{"aria-hidden":"true",children:[(0,d.jsx)("div",{style:{position:"fixed",inset:0,zIndex:9998,backgroundColor:"rgba(0,0,0,0.55)",clipPath:g?`polygon(0% 0%, 0% 100%, ${g.left-6}px 100%, ${g.left-6}px ${g.top-6}px, ${g.right+6}px ${g.top-6}px, ${g.right+6}px ${g.bottom+6}px, ${g.left-6}px ${g.bottom+6}px, ${g.left-6}px 100%, 100% 100%, 100% 0%)`:void 0,transition:l?"none":"clip-path 0.25s ease"},onClick:n}),(0,d.jsxs)("div",{ref:h,role:"dialog","aria-modal":"true","aria-label":`Tour step ${p+1} of ${e.length}`,tabIndex:-1,style:{position:"absolute",zIndex:9999,top:f.top,left:f.left,width:300,backgroundColor:i.surface,border:`1px solid ${i.border}`,borderRadius:10,padding:20,boxShadow:`0 8px 24px ${i.bg}80`,animation:l?"none":"tkxFadeIn 0.2s ease",fontFamily:"inherit"},onKeyDown:e=>{if("Escape"!==e.key){if("Tab"===e.key){const t=h.current;if(!t)return;const n=Array.from(t.querySelectorAll('a[href], button:not([disabled]), textarea, input, select, [tabindex]:not([tabindex="-1"])')).filter(e=>null!==e.offsetParent||e===t);if(0===n.length)return e.preventDefault(),void t.focus();const r=n[0],o=n[n.length-1],i=document.activeElement;e.shiftKey?i!==r&&i!==t&&t.contains(i)||(e.preventDefault(),o.focus()):i===o&&(e.preventDefault(),r.focus())}}else n?.()},children:[(0,d.jsx)("h3",{className:$t("m-0 mb-2 text-base font-semibold"),style:{color:i.text},children:S}),(0,d.jsx)("p",{className:$t("m-0 mb-4 text-sm leading-relaxed"),style:{color:i.textMuted},children:C}),(0,d.jsx)("div",{className:$t("flex items-center gap-1 mb-4"),"aria-label":"Tour progress",children:e.map((e,t)=>(0,d.jsx)("span",{"aria-hidden":"true",style:{width:8,height:8,borderRadius:"50%",backgroundColor:t===p?i.primary:i.border,transition:l?"none":"background-color 0.2s"}},t))}),(0,d.jsxs)("div",{className:$t("flex items-center justify-between gap-2"),children:[(0,d.jsx)("button",{type:"button","aria-label":"Skip tour",onClick:n,className:$t("border-0 bg-transparent cursor-pointer text-sm px-2 py-1"),style:{color:i.textMuted},children:"Skip"}),(0,d.jsxs)("div",{className:$t("flex gap-2"),children:[p>0&&(0,d.jsx)("button",{type:"button","aria-label":"Previous step",onClick:$,className:$t("rounded-md border px-3 py-1 text-sm cursor-pointer bg-transparent"),style:{borderColor:i.border,color:i.text},children:"Prev"}),(0,d.jsx)("button",{type:"button","aria-label":p===e.length-1?"Finish tour":"Next step",onClick:k,className:$t("rounded-md border-0 px-4 py-1 text-sm cursor-pointer font-medium"),style:{backgroundColor:i.primary,color:"#fff"},children:p===e.length-1?"Finish":"Next"})]})]})]})]}),document.body)},exports.TkxTransferList=function({sourceItems:e,targetItems:t,onTransfer:n,sourceTitle:r="Available",targetTitle:o="Selected",searchable:i=!1,height:l=300,className:s,style:c}){const u=J(),p=qe(),h=(0,a.useId)(),f=(0,a.useId)(),[m,g]=(0,a.useState)(new Set),[x,y]=(0,a.useState)(new Set),[b,v]=(0,a.useState)(""),[w,k]=(0,a.useState)(""),$=(0,a.useCallback)(e=>{g(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),S=(0,a.useCallback)(e=>{y(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),C=(0,a.useCallback)(()=>{const t=e.filter(e=>!e.disabled).map(e=>e.value);t.every(e=>m.has(e))?g(new Set):g(new Set(t))},[e,m]),z=(0,a.useCallback)(()=>{const e=t.filter(e=>!e.disabled).map(e=>e.value);e.every(e=>x.has(e))?y(new Set):y(new Set(e))},[t,x]),M=(0,a.useCallback)(()=>{if(0===m.size)return;const r=e.filter(e=>m.has(e.value)&&!e.disabled);n(e.filter(e=>!m.has(e.value)||e.disabled),[...t,...r]),g(new Set)},[e,t,m,n]),N=(0,a.useCallback)(()=>{if(0===x.size)return;const r=t.filter(e=>x.has(e.value)&&!e.disabled),o=t.filter(e=>!x.has(e.value)||e.disabled);n([...e,...r],o),y(new Set)},[e,t,x,n]),D=e=>({display:"inline-flex",alignItems:"center",justifyContent:"center",width:36,height:36,borderRadius:8,border:`1px solid ${u.border}`,backgroundColor:e?u.surface:u.surfaceAlt,cursor:e?"not-allowed":"pointer",opacity:e?.5:1,transition:p?"none":"all 100ms ease",outline:"none"});return(0,d.jsxs)("div",{className:$t("flex gap-3 font-sans","flex-col sm:flex-row",s??""),style:{color:u.text,...c},children:[(0,d.jsx)(Xo,{title:r,items:e,selected:m,onToggle:$,onToggleAll:C,search:b,onSearchChange:v,searchable:i,height:l,listId:h}),(0,d.jsxs)("div",{className:$t("flex items-center justify-center gap-2","flex-row sm:flex-col"),style:{padding:"8px 0"},children:[(0,d.jsx)("button",{type:"button","aria-label":"Move selected items to target list",disabled:0===m.size,onClick:M,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),M())},className:$t("focus-visible:ring-2 focus-visible:ring-offset-1"),style:D(0===m.size),onMouseEnter:e=>{m.size>0&&(e.currentTarget.style.backgroundColor=u.primary,e.currentTarget.style.borderColor=u.primary)},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=0===m.size?u.surface:u.surfaceAlt,e.currentTarget.style.borderColor=u.border},children:(0,d.jsx)(Yo,{color:u.text})}),(0,d.jsx)("button",{type:"button","aria-label":"Move selected items to source list",disabled:0===x.size,onClick:N,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),N())},className:$t("focus-visible:ring-2 focus-visible:ring-offset-1"),style:D(0===x.size),onMouseEnter:e=>{x.size>0&&(e.currentTarget.style.backgroundColor=u.primary,e.currentTarget.style.borderColor=u.primary)},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=0===x.size?u.surface:u.surfaceAlt,e.currentTarget.style.borderColor=u.border},children:(0,d.jsx)(Zo,{color:u.text})})]}),(0,d.jsx)(Xo,{title:o,items:t,selected:x,onToggle:S,onToggleAll:z,search:w,onSearchChange:k,searchable:i,height:l,listId:f})]})},exports.TkxTreeView=function({data:e,selected:t,onSelect:n,expanded:r,onExpand:o,multiSelect:i=!1,showCheckboxes:l=!1,showLines:s=!1,className:c,style:u}){const p=J(),h=qe();(0,a.useId)();const[f,m]=(0,a.useState)([]),[g,x]=(0,a.useState)([]),y=new Set(t??f),b=new Set(r??g),v=(0,a.useCallback)(e=>{void 0===r&&x(e),o?.(e)},[r,o]),w=(0,a.useCallback)(e=>{void 0===t&&m(e),n?.(e)},[t,n]),k=(0,a.useCallback)(e=>{const t=Array.from(b);b.has(e)?v(t.filter(t=>t!==e)):v([...t,e])},[b,v]),$=(0,a.useCallback)(e=>{if(i){const t=Array.from(y);y.has(e)?w(t.filter(t=>t!==e)):w([...t,e])}else w(y.has(e)?[]:[e])},[i,y,w]),S=function(e,t){const n=[];return function e(r,o){for(const i of r)n.push({node:i,depth:o}),i.children?.length&&t.has(i.id)&&e(i.children,o+1)}(e,0),n}(e,b),C=(0,a.useRef)(0),z=(0,a.useRef)(new Map),M=e=>{C.current=e,z.current.get(e)?.focus()};return(0,d.jsx)("ul",{role:"tree","aria-label":"Tree view","aria-multiselectable":i||void 0,className:$t("list-none m-0 p-0 font-sans select-none",c??""),style:{color:p.text,...u},children:S.map(({node:e,depth:t},n)=>{const r=(e.children?.length??0)>0,o=b.has(e.id),i=y.has(e.id),a=pe(e.label);return(0,d.jsxs)("li",{role:"treeitem","aria-selected":i,"aria-expanded":r?o:void 0,"aria-disabled":e.disabled||void 0,"aria-level":t+1,"aria-setsize":S.filter(e=>e.depth===t).length,tabIndex:0===n?0:-1,ref:e=>{e?z.current.set(n,e):z.current.delete(n)},onKeyDown:e=>((e,t)=>{const n=S[t];if(!n)return;const{node:r}=n,o=(r.children?.length??0)>0;switch(e.key){case"ArrowDown":e.preventDefault(),t<S.length-1&&M(t+1);break;case"ArrowUp":e.preventDefault(),t>0&&M(t-1);break;case"ArrowRight":e.preventDefault(),o&&!b.has(r.id)?k(r.id):o&&b.has(r.id)&&t<S.length-1&&M(t+1);break;case"ArrowLeft":if(e.preventDefault(),o&&b.has(r.id))k(r.id);else for(let e=t-1;e>=0;e--)if(S[e].depth<n.depth){M(e);break}break;case"Enter":case" ":e.preventDefault(),r.disabled||$(r.id);break;case"Home":e.preventDefault(),M(0);break;case"End":e.preventDefault(),M(S.length-1)}})(e,n),onClick:()=>{e.disabled||(r&&k(e.id),$(e.id))},className:$t("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:24*t+8,backgroundColor:i?`${p.primary}18`:"transparent",transition:h?"none":"background-color 100ms ease",minHeight:32},onMouseEnter:t=>{i||e.disabled||(t.currentTarget.style.backgroundColor=p.surfaceAlt)},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=i?`${p.primary}18`:"transparent"},children:[s&&t>0&&(0,d.jsx)("span",{"aria-hidden":"true",style:{position:"absolute",left:24*(t-1)+16,top:0,bottom:0,width:1,backgroundColor:p.border}}),r?(0,d.jsx)("span",{role:"presentation",onClick:t=>{t.stopPropagation(),k(e.id)},className:$t("inline-flex items-center justify-center cursor-pointer"),style:{width:20,height:20},children:(0,d.jsx)(Ho,{expanded:o,color:p.textMuted,reducedMotion:h})}):(0,d.jsx)("span",{style:{width:20,height:20},"aria-hidden":"true"}),l&&(0,d.jsx)(Oo,{checked:i,color:p.primary,borderColor:p.border}),e.icon&&(0,d.jsx)("span",{"aria-hidden":"true",className:$t("flex-shrink-0"),children:e.icon}),(0,d.jsx)("span",{className:$t("text-sm truncate"),style:{color:e.disabled?p.textMuted:p.text},children:a})]},e.id)})})},exports.TkxTreemap=Xd,exports.TkxVideoPlayer=io,exports.TkxVoterIdInput=rs,exports.TkxWatermark=function({text:e,children:t,rotate:n=-22,gap:r=[100,100],fontSize:o=14,color:i,zIndex:l=10,pattern:s="tiled",dynamic:c=!1,refreshMs:u=0,intensifyOnDevtools:p=!1,fingerprintId:h}){const f=J(),m=qe(),g=(0,a.useRef)(null),[x,y]=(0,a.useState)(""),[b,v]=(0,a.useState)(0),w=Va(p),k=(0,a.useMemo)(()=>{const t=(Array.isArray(e)?e:[e]).map(e=>pe(e));return"fingerprint"===s?function(e,t){return[...e,`id:${t||("undefined"!=typeof crypto&&"randomUUID"in crypto?crypto.randomUUID().slice(0,8):Math.random().toString(36).slice(2,10))} • ${(new Date).toISOString().slice(0,16).replace("T"," ")}`]}(t,h):t},[e,s,h,b]),$=p&&w?"66":"22",S=i??`${f.textMuted}${$}`,C=(0,a.useCallback)(()=>function(e,t,n,r,o,i){if("undefined"==typeof document)return"";const a=document.createElement("canvas"),l=a.getContext("2d");if(!l)return"";const s=1.5*r,d=e.length*s,c=Math.max(...e.map(e=>e.length))*r*.6;let u,p;return"single"===i?(u=Math.max(800,1.6*c),p=Math.max(600,4*d)):(u=n[0]+c,p=n[1]+d),a.width=2*u,a.height=2*p,l.scale(2,2),l.translate(u/2,p/2),l.rotate(t*Math.PI/180),l.font=`${r}px sans-serif`,l.fillStyle=o,l.textAlign="center",l.textBaseline="middle",e.forEach((t,n)=>{const r=(n-(e.length-1)/2)*s;l.fillText(t,0,r)}),a.toDataURL()}(k,n,r,o,S,s),[k,n,r,o,S,s]);(0,a.useEffect)(()=>{const e=C();e&&y(`url(${e})`)},[C]),(0,a.useEffect)(()=>{if(!u||u<=0)return;const e=window.setInterval(()=>v(e=>e+1),u);return()=>window.clearInterval(e)},[u]),(0,a.useEffect)(()=>{if(!c||"undefined"==typeof document)return;const e=()=>{"visible"===document.visibilityState&&v(e=>e+1)};return document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[c]),(0,a.useEffect)(()=>{const e=g.current?.querySelector("[data-watermark]");if(!e)return;const t=new MutationObserver(()=>{const t=C();t&&(e.style.backgroundImage=`url(${t})`)});return t.observe(e,{attributes:!0,attributeFilter:["style"]}),()=>t.disconnect()},[C]);const z={zIndex:l,backgroundImage:x,backgroundRepeat:"single"===s?"no-repeat":"repeat",backgroundPosition:"single"===s?"center center":void 0,animation:m?"none":"tkxFadeIn 0.3s ease"},M=p&&w?{filter:"blur(4px)",transition:"filter 0.2s"}:{};return(0,d.jsxs)("div",{ref:g,className:$t("relative"),style:{overflow:"hidden"},children:[(0,d.jsx)("div",{style:M,children:t}),(0,d.jsx)("div",{"data-watermark":!0,"aria-hidden":"true",className:$t("absolute inset-0 pointer-events-none"),style:z}),p&&w&&(0,d.jsx)("div",{"aria-live":"polite",style:{position:"absolute",top:12,right:12,padding:"6px 12px",background:f.danger,color:"#fff",fontSize:12,fontWeight:600,borderRadius:6,zIndex:l+1,pointerEvents:"none"},children:"Developer Tools detected — content protected"})]})},exports.VisuallyHidden=function({as:e,children:t,...n}){return(0,d.jsx)(e??"span",{className:"tkx-sr-only",...n,children:t})},exports.WCAGEngine=U,exports.audit=ye,exports.auroraLight=Z,exports.batchUpdate=v,exports.breakpoints={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},exports.buildTkxCSP=Ae,exports.cellAddr=mc,exports.clearSecurityEvents=ce,exports.colIndex=fc,exports.colLetter=hc,exports.contrastRatio=L,exports.createFocusTrap=V,exports.createRateLimiter=We,exports.createTheme=function(e,t){const n={...e,...t};for(const[r,o]of Object.entries(n))if(!X.test(o))throw new Error(`Invalid hex color for theme token '${r}': ${o}`);return T(n.text,n.bg),T(n.primary,n.bg),W(n.text,n.bg),n},exports.css=C,exports.cssVar=R,exports.cx=Ct,exports.dayDiff=Qd,exports.deepFreeze=Ve,exports.edgePath=md,exports.emitSecurityEvent=ue,exports.encodeQR=Wa,exports.evaluateCell=xc,exports.extractAtomicCSS=function(){return Array.from(yt.values()).join("\n")},exports.extractCSS=P,exports.fnv1aHash=u,exports.formatDay=_d,exports.fromObject=z,exports.fuzzyScore=Sd,exports.generatePalette=function(e){const[t,n]=function(e){const t=e.replace("#",""),n=parseInt(t.slice(0,2),16)/255,r=parseInt(t.slice(2,4),16)/255,o=parseInt(t.slice(4,6),16)/255,i=Math.max(n,r,o),a=Math.min(n,r,o);let l=0,s=0;const d=(i+a)/2;if(i!==a){const e=i-a;switch(s=d>.5?e/(2-i-a):e/(i+a),i){case n:l=((r-o)/e+(r<o?6:0))/6;break;case r:l=((o-n)/e+2)/6;break;case o:l=((n-r)/e+4)/6}}return[Math.round(360*l),Math.round(100*s),Math.round(100*d)]}(e);return{50:ee(t,Math.min(n,30),96),100:ee(t,Math.min(n,40),90),200:ee(t,Math.min(n,50),80),300:ee(t,n,70),400:ee(t,n,60),500:e,600:ee(t,n,45),700:ee(t,n,35),800:ee(t,n,25),900:ee(t,n,15)}},exports.getAccessibleForeground=j,exports.getAuditLog=be,exports.getLocaleDisplayName=function(e){if(ra[e])return ra[e];if("undefined"!=typeof Intl&&Intl.DisplayNames)try{return new Intl.DisplayNames(["en"],{type:"language"}).of(e)??e}catch{return e}return e},exports.getRecentSecurityEvents=de,exports.injectHolographicStyles=ks,exports.injectStyles=F,exports.installFrameBuster=Te,exports.installTrustedTypes=Ie,exports.isFramed=Le,exports.isRTL=Xt,exports.isRtlLocale=function(e){return oa.has(e)||oa.has(e.split("-")[0])},exports.isSafeAttrName=Pe,exports.isValidAadhaar=Zl,exports.isValidDrivingLicence=is,exports.isValidPan=Ql,exports.isValidVoterId=ns,exports.keyframes=D,exports.loadFontScript=function(e){pl(e)},exports.meetsAA=T,exports.meetsAAA=W,exports.memoize=f,exports.nodeAnchors=fd,exports.onSecurityEvent=se,exports.parseCellAddr=gc,exports.parseDay=Gd,exports.prefersHighContrast=q,exports.prefersReducedMotion=O,exports.quantumDark=Y,exports.radii={none:"0",sm:"4px",md:"6px",lg:"8px",xl:"12px","2xl":"16px",full:"9999px"},exports.recordsToSpreadsheet=function(e,t={}){const{base:n,preserveExtraCells:r=!1}=t,o=[],i=new Set;for(const l of e)for(const e of Object.keys(l))i.has(e)||(i.add(e),o.push(e));const a={};if(r&&n)for(const[l,s]of Object.entries(n.cells))a[l]=s;if(o.forEach((e,t)=>{a[mc(t,0)]=e}),e.forEach((e,t)=>{const n=t+1;o.forEach((t,o)=>{const i=e[t];null==i||""===i?r||delete a[mc(o,n)]:a[mc(o,n)]=String(i)})}),!r&&n){o.length,e.length;for(const[e]of Object.entries(n.cells)){const t=/^([A-Z]+)([0-9]+)$/.exec(e);t&&(fc(t[1]),t[2])}}return{cells:a}},exports.resetAtomicCSS=function(){yt.clear(),bt=null,vt&&"undefined"!=typeof document&&(document.adoptedStyleSheets=document.adoptedStyleSheets.filter(e=>e!==vt),vt=null)},exports.resolvePluginUtility=Mt,exports.responsive=N,exports.sanitizeCSS=Me,exports.sanitizeHTML=Ce,exports.sanitizeHref=we,exports.sanitizeJSON=De,exports.sanitizeProps=he,exports.sanitizeString=pe,exports.sanitizeUnicode=Fe,exports.scriptsForLanguage=hl,exports.scrubPII=Be,exports.seoSchema={softwareApplication:e=>({"@context":"https://schema.org","@type":"SoftwareApplication",name:e.name,description:e.description,url:e.url,applicationCategory:"DeveloperApplication",operatingSystem:"Web",...e.version&&{softwareVersion:e.version,version:e.version},...e.license&&{license:e.license},...e.repository&&{codeRepository:e.repository},...e.downloadUrl&&{downloadUrl:e.downloadUrl},...void 0!==e.price&&{offers:{"@type":"Offer",price:e.price,priceCurrency:e.currency??"USD"}}}),article:e=>({"@context":"https://schema.org","@type":"Article",headline:e.headline,description:e.description,mainEntityOfPage:e.url,...e.image&&{image:e.image},author:{"@type":"Person",name:e.author},datePublished:e.datePublished,...e.dateModified&&{dateModified:e.dateModified}}),faqPage:e=>({"@context":"https://schema.org","@type":"FAQPage",mainEntity:e.map(e=>({"@type":"Question",name:e.question,acceptedAnswer:{"@type":"Answer",text:e.answer}}))}),breadcrumbList:e=>({"@context":"https://schema.org","@type":"BreadcrumbList",itemListElement:e.map((e,t)=>({"@type":"ListItem",position:t+1,name:e.name,item:e.url}))}),product:e=>({"@context":"https://schema.org","@type":"Product",name:e.name,description:e.description,image:e.image,brand:{"@type":"Brand",name:e.brand},...e.sku&&{sku:e.sku},offers:{"@type":"Offer",price:e.price,priceCurrency:e.currency,availability:`https://schema.org/${e.availability??"InStock"}`},...e.rating&&{aggregateRating:{"@type":"AggregateRating",ratingValue:e.rating.value,reviewCount:e.rating.count}}})},exports.shadows={none:"none",xs:"0 1px 2px 0 rgba(0,0,0,0.05)",sm:"0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1)",md:"0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1)",lg:"0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1)",xl:"0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1)","2xl":"0 25px 50px -12px rgba(0,0,0,0.25)",inner:"inset 0 2px 4px 0 rgba(0,0,0,0.06)"},exports.sniffMimeType=je,exports.spacing={0:"0px",.5:"2px",1:"4px",1.5:"6px",2:"8px",2.5:"10px",3:"12px",4:"16px",5:"20px",6:"24px",8:"32px",10:"40px",12:"48px",16:"64px",20:"80px",24:"96px"},exports.spreadsheetToRecords=function(e,t){const n=new Map,r=e.cells,o=[];for(let a=0;a<t.cols;a++){const e=r[mc(a,0)];o.push(e&&""!==e.trim()?e.trim():mc(a,0))}const i=[];for(let a=1;a<t.rows;a++){const e={};let l=!1;for(let i=0;i<t.cols;i++){const t=mc(i,a);let s;n.has(t)?s=n.get(t):(s=xc(t,r),n.set(t,s)),""===s||void 0===s||"string"==typeof s&&s.startsWith("#")?e[o[i]]=null:(e[o[i]]=s,l=!0)}l&&i.push(e)}return i},exports.tkx=$t,exports.tkxListPlugins=function(){return Array.from(zt.keys())},exports.tkxPlugin=function(e){zt.set(e.name,e.utilities)},exports.tkxRemovePlugin=function(e){zt.delete(e)},exports.tx=St,exports.typography={xs:{fontSize:"0.75rem",lineHeight:"1rem"},sm:{fontSize:"0.875rem",lineHeight:"1.25rem"},base:{fontSize:"1rem",lineHeight:"1.5rem"},lg:{fontSize:"1.125rem",lineHeight:"1.75rem"},xl:{fontSize:"1.25rem",lineHeight:"1.75rem"},"2xl":{fontSize:"1.5rem",lineHeight:"2rem"},"3xl":{fontSize:"1.875rem",lineHeight:"2.25rem"},"4xl":{fontSize:"2.25rem",lineHeight:"2.5rem"},"5xl":{fontSize:"3rem",lineHeight:"1.15"}},exports.unloadFontScript=function(e){!function(e){if("undefined"==typeof document)return;const t=dl[e];if(!t)return;const n=document.getElementById(t.id);n&&n.remove()}(e)},exports.useAnnounce=Ke,exports.useClickOutside=Ze,exports.useComponentSize=function(e,t){const{getSize:n}=na();return n(e,t)},exports.useConfig=na,exports.useDevtoolsOpen=Va,exports.useDirection=function(){return(0,a.useContext)(Gt).direction},exports.useEscapeKey=Ye,exports.useFocusTrap=Ue,exports.useHighContrast=function(){const[e,t]=(0,a.useState)(()=>"undefined"!=typeof window&&q());return(0,a.useEffect)(()=>{if("undefined"==typeof window)return;const e=window.matchMedia("(forced-colors: active)"),n=e=>t(e.matches);return e.addEventListener("change",n),()=>e.removeEventListener("change",n)},[]),e},exports.useI18n=function(){return(0,a.useContext)(Gt)},exports.useLocale=_t,exports.useLogicalSpacing=function(e,t=0){const{direction:n}=na(),r="number"==typeof e?`${e}px`:e,o="number"==typeof t?`${t}px`:t;return"rtl"===n?{marginRight:r,marginLeft:o}:{marginLeft:r,marginRight:o}},exports.usePrefersColorScheme=function(){const[e,t]=(0,a.useState)(()=>"undefined"!=typeof window&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":"dark");return(0,a.useEffect)(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-color-scheme: dark)"),n=e=>t(e.matches?"dark":"light");return e.addEventListener?(e.addEventListener("change",n),()=>e.removeEventListener("change",n)):(e.addListener(n),()=>e.removeListener(n))},[]),e},exports.usePrefixCls=function(e,t){const{prefixCls:n}=na();return`${t??n}-${e}`},exports.useReducedMotion=qe,exports.useRtlFlip=function(){const{direction:e}=na();if("rtl"===e)return{transform:"scaleX(-1)"}},exports.useSecurityEvents=nl,exports.useTheme=J,exports.useTkxCommand=function(){const[e,t]=(0,a.useState)(!1);return{isOpen:e,open:(0,a.useCallback)(()=>t(!0),[]),close:(0,a.useCallback)(()=>t(!1),[]),toggle:(0,a.useCallback)(()=>t(e=>!e),[])}},exports.useTkxForm=function(){const e=(0,a.useContext)(Ai),t=(0,a.useRef)({}),n=(0,a.useRef)({}),r=(0,a.useRef)({}),o=(0,a.useMemo)(()=>({getFieldValue:e=>t.current[e],setFieldValue:(e,n)=>{t.current[e]=n},getFieldsValue:()=>({...t.current}),setFieldsValue:e=>{Object.assign(t.current,e)},validateFields:()=>Promise.resolve({...t.current}),validateField:e=>Promise.resolve(!0),resetFields:()=>{t.current={},n.current={},r.current={}},getFieldError:e=>n.current[e]??null,isFieldTouched:e=>r.current[e]??!1}),[]);return e?e.instance:o},exports.useToast=function(){return{toast:(0,a.useCallback)(e=>function(e){const t=`tkx-toast-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,n={...e,id:t,duration:e.duration??4e3};return wn.length<5?(wn=[...wn,n],Cn(t,n.duration)):vn=[...vn,n],Sn(),t}(e),[]),dismiss:(0,a.useCallback)(e=>zn(e),[]),dismissAll:(0,a.useCallback)(()=>($n.forEach(e=>clearTimeout(e)),$n.clear(),wn=[],vn=[],void Sn()),[])}},exports.validateField=Tc,exports.validateProps=me,exports.verifyAuditIntegrity=ve,exports.zIndex={hide:-1,base:0,dropdown:1e3,sticky:1100,fixed:1200,overlay:1300,modal:1400,popover:1500,tooltip:1600,toast:1700,max:9999};