@jacshuo/onyx 2.2.0 → 2.4.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.
Files changed (135) hide show
  1. package/dist/Chart/BarChart.cjs +1 -1
  2. package/dist/Chart/BarChart.js +1 -1
  3. package/dist/Chart/PieChart.cjs +1 -1
  4. package/dist/Chart/PieChart.js +1 -1
  5. package/dist/Chart/ScatterChart.cjs +1 -1
  6. package/dist/Chart/ScatterChart.js +1 -1
  7. package/dist/Chart/index.cjs +1 -1
  8. package/dist/Chart/index.js +1 -1
  9. package/dist/DataDisplay/VirtualList.cjs +2 -0
  10. package/dist/DataDisplay/VirtualList.css +1 -0
  11. package/dist/DataDisplay/VirtualList.d.cts +5 -0
  12. package/dist/DataDisplay/VirtualList.d.ts +5 -0
  13. package/dist/DataDisplay/VirtualList.js +2 -0
  14. package/dist/DataDisplay/index.cjs +3 -2
  15. package/dist/DataDisplay/index.css +1 -0
  16. package/dist/DataDisplay/index.d.cts +5 -0
  17. package/dist/DataDisplay/index.d.ts +5 -0
  18. package/dist/DataDisplay/index.js +3 -2
  19. package/dist/Extras/FileExplorer.cjs +2 -2
  20. package/dist/Extras/FileExplorer.js +2 -2
  21. package/dist/Extras/LoginPanel.cjs +1 -0
  22. package/dist/Extras/LoginPanel.css +1 -0
  23. package/dist/Extras/LoginPanel.d.cts +3 -0
  24. package/dist/Extras/LoginPanel.d.ts +3 -0
  25. package/dist/Extras/LoginPanel.js +1 -0
  26. package/dist/Extras/RichTextEditor.cjs +45 -0
  27. package/dist/Extras/RichTextEditor.css +1 -0
  28. package/dist/Extras/RichTextEditor.d.cts +10 -0
  29. package/dist/Extras/RichTextEditor.d.ts +10 -0
  30. package/dist/Extras/RichTextEditor.js +45 -0
  31. package/dist/Extras/TypewriterText.cjs +2 -1
  32. package/dist/Extras/TypewriterText.css +1 -1
  33. package/dist/Extras/TypewriterText.js +2 -1
  34. package/dist/Extras/index.cjs +48 -4
  35. package/dist/Extras/index.css +1 -1
  36. package/dist/Extras/index.d.cts +7 -0
  37. package/dist/Extras/index.d.ts +7 -0
  38. package/dist/Extras/index.js +48 -4
  39. package/dist/Forms/Form.cjs +1 -1
  40. package/dist/Forms/Form.js +1 -1
  41. package/dist/Forms/OTPInput.cjs +1 -0
  42. package/dist/Forms/OTPInput.css +1 -0
  43. package/dist/Forms/OTPInput.d.cts +4 -0
  44. package/dist/Forms/OTPInput.d.ts +4 -0
  45. package/dist/Forms/OTPInput.js +1 -0
  46. package/dist/Forms/Select.cjs +1 -1
  47. package/dist/Forms/Select.js +1 -1
  48. package/dist/Forms/index.cjs +1 -1
  49. package/dist/Forms/index.css +1 -0
  50. package/dist/Forms/index.d.cts +4 -0
  51. package/dist/Forms/index.d.ts +4 -0
  52. package/dist/Forms/index.js +1 -1
  53. package/dist/Layout/SplitPanel.cjs +1 -0
  54. package/dist/Layout/SplitPanel.d.cts +3 -0
  55. package/dist/Layout/SplitPanel.d.ts +3 -0
  56. package/dist/Layout/SplitPanel.js +1 -0
  57. package/dist/Layout/index.cjs +1 -1
  58. package/dist/Layout/index.d.cts +3 -0
  59. package/dist/Layout/index.d.ts +3 -0
  60. package/dist/Layout/index.js +1 -1
  61. package/dist/Navigation/Header.cjs +1 -1
  62. package/dist/Navigation/Header.js +1 -1
  63. package/dist/Navigation/RibbonBar.d.cts +3 -3
  64. package/dist/Navigation/RibbonBar.d.ts +3 -3
  65. package/dist/Navigation/index.cjs +2 -2
  66. package/dist/Navigation/index.d.cts +3 -3
  67. package/dist/Navigation/index.d.ts +3 -3
  68. package/dist/Navigation/index.js +2 -2
  69. package/dist/Primitives/Avatar.cjs +1 -1
  70. package/dist/Primitives/Avatar.js +1 -1
  71. package/dist/Primitives/Badge.cjs +1 -1
  72. package/dist/Primitives/Badge.js +1 -1
  73. package/dist/Primitives/Button.cjs +1 -1
  74. package/dist/Primitives/Button.js +1 -1
  75. package/dist/Primitives/Checkbox.cjs +1 -1
  76. package/dist/Primitives/Checkbox.js +1 -1
  77. package/dist/Primitives/Dropdown.cjs +1 -1
  78. package/dist/Primitives/Dropdown.js +1 -1
  79. package/dist/Primitives/DropdownButton.cjs +1 -1
  80. package/dist/Primitives/DropdownButton.js +1 -1
  81. package/dist/Primitives/Indicator.cjs +1 -1
  82. package/dist/Primitives/Indicator.js +1 -1
  83. package/dist/Primitives/Input.cjs +1 -1
  84. package/dist/Primitives/Input.js +1 -1
  85. package/dist/Primitives/Kbd.cjs +1 -0
  86. package/dist/Primitives/Kbd.css +0 -0
  87. package/dist/Primitives/Kbd.d.cts +6 -0
  88. package/dist/Primitives/Kbd.d.ts +6 -0
  89. package/dist/Primitives/Kbd.js +1 -0
  90. package/dist/Primitives/Label.cjs +1 -1
  91. package/dist/Primitives/Label.js +1 -1
  92. package/dist/Primitives/Radio.cjs +1 -1
  93. package/dist/Primitives/Radio.js +1 -1
  94. package/dist/Primitives/Rating.cjs +2 -0
  95. package/dist/Primitives/Rating.css +0 -0
  96. package/dist/Primitives/Rating.d.cts +4 -0
  97. package/dist/Primitives/Rating.d.ts +4 -0
  98. package/dist/Primitives/Rating.js +2 -0
  99. package/dist/Primitives/Slider.cjs +1 -1
  100. package/dist/Primitives/Slider.js +1 -1
  101. package/dist/Primitives/Switch.cjs +1 -1
  102. package/dist/Primitives/Switch.js +1 -1
  103. package/dist/Primitives/Tag.cjs +1 -1
  104. package/dist/Primitives/Tag.js +1 -1
  105. package/dist/Primitives/index.cjs +2 -1
  106. package/dist/Primitives/index.d.cts +10 -0
  107. package/dist/Primitives/index.d.ts +10 -0
  108. package/dist/Primitives/index.js +2 -1
  109. package/dist/_tsup-dts-rollup.d.cts +843 -1
  110. package/dist/_tsup-dts-rollup.d.ts +843 -1
  111. package/dist/index.cjs +49 -5
  112. package/dist/index.css +1 -1
  113. package/dist/index.d.cts +35 -0
  114. package/dist/index.d.ts +35 -0
  115. package/dist/index.js +49 -5
  116. package/dist/styles/DataDisplay/VirtualList.css +35 -0
  117. package/dist/styles/Extras/CinePlayer.css +63 -1
  118. package/dist/styles/Extras/FileExplorer.css +39 -1
  119. package/dist/styles/Extras/FilmReel.css +24 -1
  120. package/dist/styles/Extras/LoginPanel.css +16 -0
  121. package/dist/styles/Extras/MiniPlayer.css +84 -1
  122. package/dist/styles/Extras/RichTextEditor.css +908 -0
  123. package/dist/styles/Extras/TypewriterText.css +254 -0
  124. package/dist/styles/Forms/OTPInput.css +11 -0
  125. package/dist/styles/Layout/SplitPanel.css +15 -0
  126. package/dist/styles/Primitives/DropdownButton.css +26 -1
  127. package/dist/styles/Primitives/Kbd.css +1 -0
  128. package/dist/styles/Primitives/Rating.css +1 -0
  129. package/dist/styles/base.css +281 -0
  130. package/dist/styles.css +281 -0
  131. package/dist/theme.cjs +1 -1
  132. package/dist/theme.d.cts +3 -0
  133. package/dist/theme.d.ts +3 -0
  134. package/dist/theme.js +1 -1
  135. package/package.json +22 -1
package/dist/index.cjs CHANGED
@@ -1,10 +1,10 @@
1
- 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),classVarianceAuthority=require('class-variance-authority'),jsxRuntime=require('react/jsx-runtime'),qr=require('react'),lucideReact=require('lucide-react'),reactDom=require('react-dom'),client=require('react-dom/client');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var qr__default=/*#__PURE__*/_interopDefault(qr);function s(...e){return tailwindMerge.twMerge(clsx.clsx(e))}var ur=classVarianceAuthority.cva("inline-flex cursor-pointer items-center justify-center gap-1.5 rounded font-medium transition-colors disabled:pointer-events-none disabled:opacity-50 [&_svg]:shrink-0",{variants:{intent:{primary:"bg-primary-500 text-white hover:bg-primary-600 active:bg-primary-700",secondary:"bg-secondary-500 text-white hover:bg-secondary-600 active:bg-secondary-700",danger:"bg-danger-500 text-white hover:bg-danger-600 active:bg-danger-700",warning:"bg-warning-500 text-white hover:bg-warning-600 active:bg-warning-700",ghost:"bg-transparent text-primary-700 hover:bg-primary-100 active:bg-primary-200 dark:text-primary-300 dark:hover:bg-primary-800",outline:"border border-primary-300 bg-transparent text-primary-700 hover:bg-primary-50 dark:border-primary-600 dark:text-primary-300 dark:hover:bg-primary-800"},size:{sm:"h-7 px-3 text-xs [&_svg]:h-3.5 [&_svg]:w-3.5",md:"h-9 px-4 text-sm [&_svg]:h-4 [&_svg]:w-4",lg:"h-11 px-6 text-base [&_svg]:h-5 [&_svg]:w-5"}},defaultVariants:{intent:"primary",size:"md"}}),Nn=classVarianceAuthority.cva("inline-flex items-center gap-1 rounded border font-semibold [&_svg]:shrink-0",{variants:{intent:{success:"border-success-200 bg-success-100 text-success-800 dark:border-success-800 dark:bg-success-900/30 dark:text-success-400",warning:"border-warning-200 bg-warning-100 text-warning-800 dark:border-warning-800 dark:bg-warning-900/30 dark:text-warning-400",error:"border-danger-200 bg-danger-100 text-danger-800 dark:border-danger-800 dark:bg-danger-900/30 dark:text-danger-400",info:"border-primary-200 bg-primary-100 text-primary-800 dark:border-primary-800 dark:bg-primary-900/30 dark:text-primary-400",primary:"border-secondary-200 bg-secondary-100 text-secondary-700 dark:border-secondary-700 dark:bg-secondary-800 dark:text-secondary-300"},size:{sm:"px-1.5 py-0 text-[0.625rem] [&_svg]:h-2.5 [&_svg]:w-2.5",md:"px-2.5 py-0.5 text-xs [&_svg]:h-3 [&_svg]:w-3",lg:"px-3 py-1 text-sm [&_svg]:h-3.5 [&_svg]:w-3.5"}},defaultVariants:{intent:"primary",size:"md"}}),Cn=classVarianceAuthority.cva("absolute flex items-center justify-center rounded-full font-bold leading-none ring-2 ring-white select-none pointer-events-none z-10 dark:ring-primary-900",{variants:{intent:{danger:"bg-danger-500 text-white",success:"bg-success-500 text-white",warning:"bg-warning-500 text-white",info:"bg-primary-500 text-white",primary:"bg-secondary-500 text-white"},size:{sm:"text-[0.5rem]",md:"text-[0.625rem]",lg:"text-xs"},dot:{true:"",false:""},placement:{"top-right":"top-0 right-0 translate-x-1/2 -translate-y-1/2","top-left":"top-0 left-0 -translate-x-1/2 -translate-y-1/2","bottom-right":"bottom-0 right-0 translate-x-1/2 translate-y-1/2","bottom-left":"bottom-0 left-0 -translate-x-1/2 translate-y-1/2"}},compoundVariants:[{dot:true,size:"sm",class:"h-1.5 w-1.5 min-w-0 ring-1"},{dot:true,size:"md",class:"h-2 w-2 min-w-0"},{dot:true,size:"lg",class:"h-2.5 w-2.5 min-w-0"},{dot:false,size:"sm",class:"h-4 min-w-4 px-1"},{dot:false,size:"md",class:"h-5 min-w-5 px-1.5"},{dot:false,size:"lg",class:"h-6 min-w-6 px-2"}],defaultVariants:{intent:"danger",size:"md",dot:false,placement:"top-right"}}),fr=classVarianceAuthority.cva("w-full rounded-md border bg-white text-secondary-900 transition-colors placeholder:text-secondary-400 focus:outline-none focus:ring-2 dark:bg-secondary-900 dark:text-secondary-100 dark:placeholder:text-secondary-600",{variants:{state:{default:"border-secondary-300 focus:border-primary-500 focus:ring-primary-500/20 dark:border-secondary-600",error:"border-danger-400 focus:border-danger-500 focus:ring-danger-500/20"},size:{sm:"h-7 px-2 text-xs",md:"h-9 px-3 py-2 text-sm",lg:"h-11 px-4 py-2.5 text-base"}},defaultVariants:{state:"default",size:"md"}}),Tn=classVarianceAuthority.cva("inline-flex items-center gap-1 font-medium [&_svg]:shrink-0",{variants:{size:{sm:"text-xs [&_svg]:h-3 [&_svg]:w-3",md:"text-sm [&_svg]:h-3.5 [&_svg]:w-3.5",lg:"text-base [&_svg]:h-4 [&_svg]:w-4"},intent:{default:"text-primary-700 dark:text-primary-300",muted:"text-primary-400 dark:text-primary-500",required:"text-primary-700 dark:text-primary-300 after:ml-0.5 after:text-danger-500 after:content-['*']"}},defaultVariants:{size:"md",intent:"default"}}),Mn=classVarianceAuthority.cva("relative inline-flex shrink-0 items-center justify-center rounded border-2 transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",{variants:{intent:{primary:"border-primary-300 dark:border-primary-600 focus-visible:ring-primary-500/40",secondary:"border-secondary-300 dark:border-secondary-600 focus-visible:ring-secondary-500/40",danger:"border-danger-300 dark:border-danger-600 focus-visible:ring-danger-500/40",warning:"border-warning-300 dark:border-warning-600 focus-visible:ring-warning-500/40",success:"border-success-300 dark:border-success-600 focus-visible:ring-success-500/40"},size:{sm:"h-4 w-4 rounded-[3px]",md:"h-5 w-5 rounded",lg:"h-6 w-6 rounded-[5px]"},checked:{on:"",off:"bg-white dark:bg-primary-900"}},compoundVariants:[{intent:"primary",checked:"on",class:"border-primary-500 bg-primary-500 dark:border-primary-500 dark:bg-primary-500"},{intent:"secondary",checked:"on",class:"border-secondary-500 bg-secondary-500 dark:border-secondary-500 dark:bg-secondary-500"},{intent:"danger",checked:"on",class:"border-danger-500 bg-danger-500 dark:border-danger-500 dark:bg-danger-500"},{intent:"warning",checked:"on",class:"border-warning-500 bg-warning-500 dark:border-warning-500 dark:bg-warning-500"},{intent:"success",checked:"on",class:"border-success-500 bg-success-500 dark:border-success-500 dark:bg-success-500"}],defaultVariants:{intent:"primary",size:"md",checked:"off"}}),Rn=classVarianceAuthority.cva("relative inline-flex shrink-0 items-center justify-center rounded-full border-2 transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",{variants:{intent:{primary:"border-primary-300 dark:border-primary-600 focus-visible:ring-primary-500/40",secondary:"border-secondary-300 dark:border-secondary-600 focus-visible:ring-secondary-500/40",danger:"border-danger-300 dark:border-danger-600 focus-visible:ring-danger-500/40",warning:"border-warning-300 dark:border-warning-600 focus-visible:ring-warning-500/40",success:"border-success-300 dark:border-success-600 focus-visible:ring-success-500/40"},size:{sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6"},checked:{on:"",off:"bg-white dark:bg-primary-900"}},compoundVariants:[{intent:"primary",checked:"on",class:"border-primary-500 bg-primary-500 dark:border-primary-500 dark:bg-primary-500"},{intent:"secondary",checked:"on",class:"border-secondary-500 bg-secondary-500 dark:border-secondary-500 dark:bg-secondary-500"},{intent:"danger",checked:"on",class:"border-danger-500 bg-danger-500 dark:border-danger-500 dark:bg-danger-500"},{intent:"warning",checked:"on",class:"border-warning-500 bg-warning-500 dark:border-warning-500 dark:bg-warning-500"},{intent:"success",checked:"on",class:"border-success-500 bg-success-500 dark:border-success-500 dark:bg-success-500"}],defaultVariants:{intent:"primary",size:"md",checked:"off"}}),Sn=classVarianceAuthority.cva("",{variants:{intent:{primary:"",secondary:"",danger:"",warning:"",success:""},size:{sm:"",md:"",lg:""},checked:{on:"",off:"bg-primary-300 dark:bg-primary-800"}},compoundVariants:[{intent:"primary",checked:"on",class:"bg-primary-500 dark:bg-primary-500"},{intent:"secondary",checked:"on",class:"bg-secondary-500 dark:bg-secondary-500"},{intent:"danger",checked:"on",class:"bg-danger-500 dark:bg-danger-500"},{intent:"warning",checked:"on",class:"bg-warning-500 dark:bg-warning-500"},{intent:"success",checked:"on",class:"bg-success-500 dark:bg-success-500"}],defaultVariants:{intent:"primary",size:"md",checked:"off"}}),Br=classVarianceAuthority.cva("bg-primary-200 text-primary-700 dark:bg-primary-700 dark:text-primary-200",{variants:{size:{xs:"h-6 w-6 text-[10px]",sm:"h-8 w-8 text-xs",md:"h-10 w-10 text-sm",lg:"h-12 w-12 text-base",xl:"h-16 w-16 text-lg"},shape:{circular:"rounded-full",rounded:"rounded-lg",square:"rounded-none"}},defaultVariants:{size:"md",shape:"circular"}}),Or=classVarianceAuthority.cva("relative flex w-full touch-none select-none items-center",{variants:{intent:{primary:"[&_.slider-fill]:bg-primary-500 [&_.slider-thumb]:border-primary-500",secondary:"[&_.slider-fill]:bg-secondary-500 [&_.slider-thumb]:border-secondary-500",success:"[&_.slider-fill]:bg-success-500 [&_.slider-thumb]:border-success-500",danger:"[&_.slider-fill]:bg-danger-500 [&_.slider-thumb]:border-danger-500",warning:"[&_.slider-fill]:bg-warning-500 [&_.slider-thumb]:border-warning-500"},size:{sm:"h-4",md:"h-5",lg:"h-6"}},defaultVariants:{intent:"primary",size:"md"}}),Pn=classVarianceAuthority.cva("inline-flex items-center gap-1 rounded-full font-medium select-none transition-colors [&_svg]:shrink-0",{variants:{intent:{primary:"bg-primary-100 text-primary-700 dark:bg-primary-800 dark:text-primary-200",secondary:"bg-secondary-100 text-secondary-700 dark:bg-secondary-800 dark:text-secondary-200",success:"bg-success-100 text-success-700 dark:bg-success-900/40 dark:text-success-300",danger:"bg-danger-100 text-danger-700 dark:bg-danger-900/40 dark:text-danger-300",warning:"bg-warning-100 text-warning-700 dark:bg-warning-900/40 dark:text-warning-300",info:"bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300"},size:{sm:"h-5 px-2 text-[0.6875rem] gap-0.5",md:"h-6 px-2.5 text-xs gap-1",lg:"h-7 px-3 text-sm gap-1"},variant:{solid:"",outline:"bg-transparent border",soft:""}},compoundVariants:[{intent:"primary",variant:"outline",class:"border-primary-300 text-primary-700 dark:border-primary-600 dark:text-primary-300"},{intent:"secondary",variant:"outline",class:"border-secondary-300 text-secondary-700 dark:border-secondary-600 dark:text-secondary-300"},{intent:"success",variant:"outline",class:"border-success-400 text-success-700 dark:border-success-600 dark:text-success-300"},{intent:"danger",variant:"outline",class:"border-danger-400 text-danger-700 dark:border-danger-600 dark:text-danger-300"},{intent:"warning",variant:"outline",class:"border-warning-400 text-warning-700 dark:border-warning-600 dark:text-warning-300"},{intent:"info",variant:"outline",class:"border-blue-400 text-blue-700 dark:border-blue-600 dark:text-blue-300"}],defaultVariants:{intent:"primary",size:"md",variant:"solid"}});classVarianceAuthority.cva("relative w-full cursor-pointer rounded-md border bg-white text-sm transition-colors dark:bg-primary-900",{variants:{intent:{default:"border-primary-300 text-primary-900 hover:border-primary-400 focus-within:border-primary-500 focus-within:ring-2 focus-within:ring-primary-500/20 dark:border-primary-600 dark:text-primary-100 dark:hover:border-primary-500 dark:focus-within:border-primary-400",danger:"border-danger-500 text-primary-900 focus-within:ring-2 focus-within:ring-danger-500/20 dark:border-danger-500 dark:text-primary-100"},size:{sm:"h-7 px-2 text-xs",md:"h-9 px-3 text-sm",lg:"h-11 px-4 text-base"}},defaultVariants:{intent:"default",size:"md"}});function gr({intent:e,size:t,className:r,...n}){return jsxRuntime.jsx("button",{className:s(ur({intent:e,size:t}),r),...n})}function Ua(e,t){for(let r of e){if(r.value===t)return r;if(r.children){let n=Ua(r.children,t);if(n)return n}}}function qa(e){let t=[];for(let r of e)r.children?.length||t.push(r),r.children&&t.push(...qa(r.children));return t}var Vn=40,Qc=200,Qa=150,ps=120;function En(e,t,r,n){if(!n)return {};if(r){let i=(t-1-e)*Vn;return {animation:`dropdown-item-out ${Qa}ms ease-in both ${i}ms`}}let a=e*Vn;return {animation:`dropdown-item-in ${Qc}ms ease-out both ${a}ms`}}function us(e,t,r){if(!r)return {};if(t){let n=Math.max(e-1,0)*Vn+Qa;return {animation:`dropdown-container-out ${ps}ms ease-in both ${n}ms`}}return {animation:"var(--animate-dropdown-container-in)"}}function fs({options:e,onSelect:t,animated:r=true,closing:n=false,depth:a=0}){let[i,o]=qr.useState(null),l=qr.useRef(void 0),c=d=>{l.current&&clearTimeout(l.current),o(d);},m=()=>{l.current=setTimeout(()=>o(null),150);};return qr.useEffect(()=>()=>{l.current&&clearTimeout(l.current);},[]),jsxRuntime.jsx("div",{className:s("absolute z-50 min-w-44 rounded-md border py-1 shadow-lg overflow-hidden","border-primary-200 dark:border-primary-700 dark:bg-primary-800 bg-white",a===0?"mt-1 w-full":"top-0 ml-0.5"),style:{...a>0?{left:"100%"}:{},...us(e.length,n,r)},role:"listbox",children:e.map((d,f)=>{let p=!!d.children?.length,u=i===d.value;return jsxRuntime.jsxs("div",{className:"relative",style:En(f,e.length,n,r),onMouseEnter:()=>c(d.value),onMouseLeave:m,children:[jsxRuntime.jsxs("div",{role:"option","aria-selected":false,"aria-disabled":d.disabled,className:s("flex w-full cursor-pointer items-center gap-2 px-3 py-1.5 text-left text-sm transition-colors","text-primary-700 hover:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-700/50",d.disabled&&"pointer-events-none opacity-50"),onClick:()=>{d.disabled||p||t(d.value,d);},children:[d.icon&&jsxRuntime.jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center",children:d.icon}),jsxRuntime.jsx("span",{className:"flex-1 truncate",children:d.label??d.value}),p&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"text-primary-400 h-3.5 w-3.5 shrink-0"})]}),p&&u&&jsxRuntime.jsx(fs,{options:d.children,onSelect:t,animated:r,depth:a+1})]},d.value)})})}function Zc({options:e,filter:t,multiple:r,selected:n,canAdd:a,animated:i=true,closing:o=false,onSelect:l,onToggle:c,onAdd:m}){let d=qr.useMemo(()=>qa(e),[e]),f=t.toLowerCase(),p=t?d.filter(g=>(g.label??g.value).toLowerCase().includes(f)||g.value.toLowerCase().includes(f)):d,u=p.length===0&&!a||a?1:0,h=p.length+u;return jsxRuntime.jsxs("div",{className:s("absolute z-50 mt-1 w-full max-h-60 min-w-44 overflow-y-auto rounded-md border py-1 shadow-lg","border-primary-200 dark:border-primary-700 dark:bg-primary-800 bg-white"),role:"listbox","aria-multiselectable":r||void 0,style:us(h,o,i),children:[p.map((g,b)=>{let N=r&&n.includes(g.value);return jsxRuntime.jsxs("div",{role:"option","aria-selected":r?N:false,"aria-disabled":g.disabled,className:s("flex w-full cursor-pointer items-center gap-2 px-3 py-1.5 text-left text-sm transition-colors","text-primary-700 hover:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-700/50",g.disabled&&"pointer-events-none opacity-50"),style:En(b,h,o,i),onClick:()=>{g.disabled||(r?c(g.value):l(g.value,g));},children:[r&&jsxRuntime.jsx("span",{className:s("flex h-4 w-4 shrink-0 items-center justify-center rounded border transition-colors",N?"border-primary-600 bg-primary-600 text-white dark:border-primary-500 dark:bg-primary-500":"border-secondary-300 bg-white dark:border-secondary-600 dark:bg-secondary-800"),children:N&&jsxRuntime.jsx(lucideReact.Check,{className:"h-3 w-3"})}),g.icon&&jsxRuntime.jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center",children:g.icon}),jsxRuntime.jsx("span",{className:"truncate",children:g.label??g.value})]},g.value)}),p.length===0&&!a&&jsxRuntime.jsx("div",{className:"text-primary-400 px-3 py-2 text-center text-sm",style:En(0,1,o,i),children:"No matches"}),a&&jsxRuntime.jsxs("div",{className:s("flex w-full cursor-pointer items-center gap-2 px-3 py-1.5 text-left text-sm transition-colors","text-primary-600 hover:bg-primary-50 dark:text-primary-400 dark:hover:bg-primary-900/30"),style:En(p.length,h,o,i),onClick:m,children:[jsxRuntime.jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center text-lg leading-none",children:"+"}),jsxRuntime.jsxs("span",{className:"truncate",children:["Add \u201C",t.trim(),"\u201D"]})]})]})}function Za(e){let{options:t,placeholder:r="Select\u2026",editable:n=false,onAddItem:a,disabled:i=false,align:o="left",className:l,size:c="md",animated:m=true,name:d,intent:f="default",clearable:p=false,id:u,"aria-describedby":h,"aria-invalid":g}=e,b=e.multiple===true,[N,x]=qr.useState(b?void 0:e.defaultValue),[T,w]=qr.useState(b?e.defaultSelected??[]:[]),C=b?e.selected??T:[],[S,R]=qr.useState(false),[V,I]=qr.useState(false),[E,v]=qr.useState(""),U=qr.useRef(null),k=qr.useRef(null),q=qr.useRef(void 0),M=qr.useCallback(()=>{if(!m||!S){R(false),v("");return}I(true);let ee=(Math.max(t.length,1)-1)*Vn+Qa+ps+20;q.current=setTimeout(()=>{R(false),I(false),v("");},ee);},[m,S,t.length]);qr.useEffect(()=>()=>{q.current&&clearTimeout(q.current);},[]);let W=b?void 0:e.value??N,$=qr.useMemo(()=>W?Ua(t,W):void 0,[t,W]);qr.useEffect(()=>{if(!S)return;let _=ee=>{U.current&&!U.current.contains(ee.target)&&M();};return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[S,M]),qr.useEffect(()=>{if(!S)return;let _=ee=>{ee.key==="Escape"&&M();};return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[S,M]);let ue=qr.useCallback((_,ee)=>{b||(e.value===void 0&&x(_),e.onChange?.(_,ee)),q.current&&clearTimeout(q.current),R(false),I(false),v("");},[b,e]),J=qr.useCallback(_=>{if(!b)return;let ee=e.selected??T,xe=ee.includes(_)?ee.filter(P=>P!==_):[...ee,_];e.selected===void 0&&w(xe),e.onSelectionChange?.(xe),e.onChange?.(xe);},[b,T,e]),de=E.toLowerCase(),re=qr.useMemo(()=>!n||!E.trim()?false:!qa(t).some(ee=>ee.value.toLowerCase()===de||(ee.label??ee.value).toLowerCase()===de),[n,de,t]),B=qr.useCallback(()=>{let _=E.trim();_&&(a?.(_),v(""));},[E,a]),j=qr.useCallback(_=>{_.stopPropagation(),b?(w([]),e.onSelectionChange?.([]),e.onChange?.([])):(x(void 0),e.onChange?.("",void 0));},[b,e]),pe=qr.useCallback(_=>{_.key==="Enter"&&re&&(_.preventDefault(),B());},[re,B]),ye=qr.useCallback(()=>{i||(S?M():(q.current&&clearTimeout(q.current),I(false),R(true),v(""),n&&requestAnimationFrame(()=>k.current?.focus())));},[i,S,M,n]),y;if(b){let _=C.length;_===0?y="":_<=2?y=C.map(ee=>Ua(t,ee)).map(ee=>ee?ee.label??ee.value:"").filter(Boolean).join(", "):y=`${_} selected`;}else y=$?$.label??$.value:"";let L=b||n,G=f==="danger"||g===true,O=p&&(b?C.length>0:!!y);return jsxRuntime.jsxs("div",{ref:U,className:s("relative inline-block min-w-44",l),children:[d&&!b&&jsxRuntime.jsx("input",{type:"hidden",name:d,value:W??""}),d&&b&&C.map(_=>jsxRuntime.jsx("input",{type:"hidden",name:`${d}[]`,value:_},_)),u&&!n&&jsxRuntime.jsx("input",{type:"text",id:u,className:"sr-only",readOnly:true,tabIndex:-1,value:y??"",onChange:()=>{}}),jsxRuntime.jsxs("div",{className:s(fr({state:G?"error":"default",size:c}),"flex cursor-pointer items-center gap-1",i&&"pointer-events-none opacity-50"),onClick:ye,role:"combobox","aria-expanded":S,"aria-haspopup":"listbox","aria-invalid":G||void 0,"aria-describedby":h,children:[n?jsxRuntime.jsx("input",{ref:k,id:u,className:"min-w-0 flex-1 bg-transparent outline-none placeholder:text-secondary-400 dark:placeholder:text-secondary-600",value:S?E:y,placeholder:r,disabled:i,onChange:_=>{v(_.target.value),S||R(true);},onKeyDown:pe,onClick:_=>{_.stopPropagation(),S||R(true);}}):jsxRuntime.jsx("span",{className:s("flex-1 truncate",!y&&"text-secondary-400 dark:text-secondary-600"),children:y||r}),$?.icon&&!n&&!b&&jsxRuntime.jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center",children:$.icon}),b&&C.length>0&&jsxRuntime.jsx("span",{className:"rounded-full bg-primary-100 px-1.5 text-xs font-semibold text-primary-700 dark:bg-primary-900 dark:text-primary-300",children:C.length}),O&&jsxRuntime.jsx("button",{type:"button","aria-label":"Clear selection",className:"flex h-4 w-4 shrink-0 items-center justify-center rounded-full text-secondary-400 transition-colors hover:bg-secondary-200 hover:text-secondary-600 dark:hover:bg-secondary-700 dark:hover:text-secondary-300",onClick:j,children:jsxRuntime.jsx(lucideReact.X,{className:"h-3 w-3"})}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:s("text-primary-400 h-4 w-4 shrink-0 transition-transform",S&&"rotate-180")})]}),S&&jsxRuntime.jsx("div",{className:s(o==="right"?"right-0":"left-0","absolute w-full"),children:L?jsxRuntime.jsx(Zc,{options:t,filter:E,multiple:b,selected:C,canAdd:re,animated:m,closing:V,onSelect:ue,onToggle:J,onAdd:B}):jsxRuntime.jsx(fs,{options:t,onSelect:ue,animated:m,closing:V})})]})}function rd(e,t){return e.key??(typeof e.label=="string"?e.label:String(t))}var In=40,nd=200,no=150,bs=120;function ro(e,t,r,n){if(!n)return {};if(r){let i=(t-1-e)*In;return {animation:`dropdown-item-out ${no}ms ease-in both ${i}ms`}}let a=e*In;return {animation:`dropdown-item-in ${nd}ms ease-out both ${a}ms`}}function ad(e,t,r){if(!r)return {};if(t){let n=Math.max(e-1,0)*In+no;return {animation:`dropdown-container-out ${bs}ms ease-in both ${n}ms`}}return {animation:"var(--animate-dropdown-container-in)"}}function hr({label:e,items:t,intent:r,size:n,align:a="left",className:i,disabled:o,editable:l=false,onAddItem:c,multiple:m=false,selected:d=[],onSelectionChange:f,animated:p=true,chevron:u=true,...h}){let[g,b]=qr.useState(false),[N,x]=qr.useState(false),[T,w]=qr.useState(""),C=qr.useRef(null),S=qr.useRef(null),R=qr.useRef(void 0);qr.useEffect(()=>()=>{R.current&&clearTimeout(R.current);},[]);let V=qr.useCallback(()=>{if(!p||!g){b(false),w("");return}x(true);let de=(Math.max(t.length,1)-1)*In+no+bs+20;R.current=setTimeout(()=>{b(false),x(false),w("");},de);},[p,g,t.length]),I=qr.useCallback(()=>{o||(g?V():(R.current&&clearTimeout(R.current),x(false),b(true),w(""),l&&requestAnimationFrame(()=>S.current?.focus())));},[o,g,V,l]);qr.useEffect(()=>{if(!g)return;let J=de=>{C.current&&!C.current.contains(de.target)&&V();};return document.addEventListener("mousedown",J),()=>document.removeEventListener("mousedown",J)},[g,V]),qr.useEffect(()=>{if(!g)return;let J=de=>{de.key==="Escape"&&V();};return document.addEventListener("keydown",J),()=>document.removeEventListener("keydown",J)},[g,V]);let E=T.toLowerCase(),v=qr.useMemo(()=>T?t.filter(J=>(typeof J.label=="string"?J.label:J.key??"").toLowerCase().includes(E)):t,[t,E]),U=qr.useMemo(()=>!l||!T.trim()?false:!t.some(J=>(typeof J.label=="string"?J.label:J.key??"").toLowerCase()===E),[l,E,t]),k=qr.useCallback(()=>{let J=T.trim();J&&(c?.(J),w(""));},[T,c]),q=qr.useCallback(J=>{J.key==="Enter"&&U&&(J.preventDefault(),k());},[U,k]),M=qr.useCallback(J=>{let de=d.includes(J)?d.filter(re=>re!==J):[...d,J];f?.(de);},[d,f]),W=m&&d.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[e," ",jsxRuntime.jsx("span",{className:"ml-1 rounded-full bg-white/20 px-1.5 text-xs font-semibold",children:d.length})]}):e,$=v.length===0&&!U||U?1:0,ue=v.length+$;return jsxRuntime.jsxs("div",{ref:C,className:"relative inline-block",children:[jsxRuntime.jsxs("button",{type:"button",onClick:I,disabled:o,className:s(ur({intent:r,size:n}),"inline-flex items-center gap-1",i),"aria-haspopup":m?"listbox":"true","aria-expanded":g?"true":"false",...h,children:[W,u&&jsxRuntime.jsx(lucideReact.ChevronDown,{className:s("h-3.5 w-3.5 transition-transform",g&&"rotate-180")})]}),g&&jsxRuntime.jsxs("div",{className:s("absolute z-50 mt-1 min-w-44 rounded-md border py-1 shadow-lg","border-primary-200 dark:border-primary-700 dark:bg-primary-800 bg-white",a==="right"?"right-0":"left-0"),style:ad(ue,N,p),role:m?"listbox":"menu","aria-multiselectable":m||void 0,children:[l&&jsxRuntime.jsx("div",{className:"border-primary-200 dark:border-primary-700 border-b px-2 pb-1.5 pt-1",children:jsxRuntime.jsx("input",{ref:S,type:"text",value:T,onChange:J=>w(J.target.value),onKeyDown:q,placeholder:"Type to filter or add\u2026",className:"w-full bg-transparent text-sm text-secondary-900 placeholder:text-secondary-400 focus:outline-none dark:text-secondary-100 dark:placeholder:text-secondary-600"})}),jsxRuntime.jsxs("div",{className:"max-h-60 overflow-y-auto",children:[v.map((J,de)=>{let re=rd(J,de),B=m&&d.includes(re);return jsxRuntime.jsxs(qr__default.default.Fragment,{children:[J.divider&&jsxRuntime.jsx("div",{className:"border-primary-200 dark:border-primary-700 my-1 border-t"}),jsxRuntime.jsxs("button",{type:"button",role:m?"option":"menuitem","aria-selected":m?B:void 0,disabled:J.disabled,className:s("flex w-full cursor-pointer items-center gap-2 px-3 py-1.5 text-left text-sm transition-colors","text-primary-700 hover:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-700/50",J.disabled&&"pointer-events-none opacity-50"),style:ro(de,ue,N,p),onClick:()=>{m?M(re):(J.onClick?.(),R.current&&clearTimeout(R.current),b(false),x(false),w(""));},children:[m&&jsxRuntime.jsx("span",{className:s("flex h-4 w-4 shrink-0 items-center justify-center rounded border transition-colors",B?"border-primary-600 bg-primary-600 text-white dark:border-primary-500 dark:bg-primary-500":"border-secondary-300 bg-white dark:border-secondary-600 dark:bg-secondary-800"),children:B&&jsxRuntime.jsx(lucideReact.Check,{className:"h-3 w-3"})}),jsxRuntime.jsx("span",{className:"flex-1 truncate",children:J.label})]})]},re)}),v.length===0&&!U&&jsxRuntime.jsx("div",{className:"text-primary-400 px-3 py-2 text-center text-sm",style:ro(0,1,N,p),children:"No matches"}),U&&jsxRuntime.jsxs("button",{type:"button",className:s("flex w-full cursor-pointer items-center gap-2 px-3 py-1.5 text-left text-sm transition-colors","text-primary-600 hover:bg-primary-50 dark:text-primary-400 dark:hover:bg-primary-900/30"),style:ro(v.length,ue,N,p),onClick:k,children:[jsxRuntime.jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center text-lg leading-none",children:"+"}),jsxRuntime.jsxs("span",{className:"truncate",children:["Add \u201C",T.trim(),"\u201D"]})]})]})]})]})}function ao({intent:e,size:t,className:r,...n}){return jsxRuntime.jsx("span",{className:s(Nn({intent:e,size:t}),r),...n})}function oo({intent:e,size:t,variant:r,icon:n,removable:a,onRemove:i,disabled:o,dot:l,className:c,children:m,...d}){return jsxRuntime.jsxs("span",{className:s(Pn({intent:e,size:t,variant:r}),o&&"pointer-events-none opacity-50",c),"aria-disabled":o,...d,children:[l&&jsxRuntime.jsx("span",{className:s("inline-block h-1.5 w-1.5 shrink-0 rounded-full",e==="success"&&"bg-success-500",e==="danger"&&"bg-danger-500",e==="warning"&&"bg-warning-500",(!e||e==="primary")&&"bg-primary-500",e==="secondary"&&"bg-secondary-500",e==="info"&&"bg-blue-500")}),n&&jsxRuntime.jsx("span",{className:"shrink-0 [&_svg]:h-[1em] [&_svg]:w-[1em]",children:n}),m&&jsxRuntime.jsx("span",{children:m}),a&&jsxRuntime.jsx("button",{type:"button","aria-label":"Remove tag",onClick:f=>{f.stopPropagation(),i?.();},disabled:o,className:s("ml-0.5 -mr-0.5 inline-flex items-center justify-center rounded-full p-0.5 transition-colors hover:bg-black/10 dark:hover:bg-white/20 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-current"),children:jsxRuntime.jsx(lucideReact.X,{className:"h-[0.75em] w-[0.75em]"})})]})}var cd={danger:"bg-danger-500",success:"bg-success-500",warning:"bg-warning-500",info:"bg-primary-500",primary:"bg-secondary-500"};function io({children:e,show:t=true,content:r,dot:n,intent:a="danger",size:i="md",placement:o="top-right",pulse:l=false,className:c}){let m=n??r==null,d=m?null:typeof r=="number"?r>99?"99+":String(r):r;return jsxRuntime.jsxs("div",{className:"relative inline-flex",children:[e,t&&jsxRuntime.jsxs("span",{className:s(Cn({intent:a,size:i,dot:m,placement:o}),c),role:typeof r=="number"?"status":void 0,"aria-label":typeof r=="number"?String(r):void 0,children:[l&&jsxRuntime.jsx("span",{className:s("absolute inset-0 rounded-full animate-ping opacity-60",cd[a??"danger"]),"aria-hidden":"true"}),d]})]})}function so({intent:e,size:t,className:r,...n}){return jsxRuntime.jsx("label",{className:s(Tn({intent:e,size:t}),r),...n})}var pd={sm:{wrapper:"h-7 text-xs",prefix:"px-2 text-xs [&_svg]:h-3 [&_svg]:w-3",input:"px-2 text-xs",icon:"px-1.5 [&_svg]:h-3 [&_svg]:w-3"},md:{wrapper:"h-9 text-sm",prefix:"px-3 text-sm [&_svg]:h-4 [&_svg]:w-4",input:"px-3 py-2 text-sm",icon:"px-2 [&_svg]:h-4 [&_svg]:w-4"},lg:{wrapper:"h-11 text-base",prefix:"px-4 text-base [&_svg]:h-5 [&_svg]:w-5",input:"px-4 py-2.5 text-base",icon:"px-2.5 [&_svg]:h-5 [&_svg]:w-5"}},ud={default:"border-secondary-300 focus-within:border-primary-500 focus-within:ring-2 focus-within:ring-primary-500/20 dark:border-secondary-600",error:"border-danger-400 focus-within:border-danger-500 focus-within:ring-2 focus-within:ring-danger-500/20"};function lo({state:e="default",inputSize:t="md",className:r,prefix:n,suffix:a,action:i,...o}){if(!n&&!a&&!i)return jsxRuntime.jsx("input",{className:s(fr({state:e,size:t}),r),...o});let l=pd[t??"md"],c=ud[e??"default"];return jsxRuntime.jsxs("div",{className:s("flex w-full items-center overflow-hidden rounded-md border bg-white transition-colors dark:bg-secondary-900",l.wrapper,c,r),children:[n&&jsxRuntime.jsx("span",{className:s("flex shrink-0 items-center gap-1.5 self-stretch border-r border-secondary-300 bg-secondary-50 font-medium text-secondary-600 dark:border-secondary-600 dark:bg-secondary-800 dark:text-secondary-300",l.prefix),children:n}),jsxRuntime.jsx("input",{className:s("min-w-0 flex-1 bg-transparent text-secondary-900 placeholder:text-secondary-400 focus:outline-none dark:text-secondary-100 dark:placeholder:text-secondary-600",l.input,n&&"pl-2"),...o}),a&&jsxRuntime.jsx("span",{className:s("flex shrink-0 items-center text-secondary-400 dark:text-secondary-500",l.icon),children:a}),i&&jsxRuntime.jsx("button",{type:"button",onClick:i.onClick,"aria-label":i["aria-label"]??"Action",className:s("flex shrink-0 items-center text-secondary-500 transition-colors hover:text-primary-600 dark:text-secondary-400 dark:hover:text-primary-400",l.icon),children:i.icon})]})}var yd={sm:"px-2 py-1.5 text-xs min-h-[60px]",md:"px-3 py-2 text-sm min-h-[80px]",lg:"px-4 py-2.5 text-base min-h-[100px]"},xd={default:"border-secondary-400 focus:border-primary-500 focus:ring-2 focus:ring-primary-500/20 dark:border-secondary-600",error:"border-danger-400 focus:border-danger-500 focus:ring-2 focus:ring-danger-500/20"};function vd(e){if(!e)return 0;let t="\u2E80-\u2EFF\u3000-\u303F\u3040-\u309F\u30A0-\u30FF\u3400-\u4DBF\u4E00-\u9FFF\uAC00-\uD7AF\uF900-\uFAFF\uFE30-\uFE4F\uFF00-\uFFEF",r=new RegExp(`[${t}]`),n=0,a="",i=()=>{let o=a.trim();o&&(n+=o.split(/\s+/).length),a="";};for(let o of e)r.test(o)?(i(),n+=1):a+=o;return i(),n}function co({state:e="default",size:t="md",showWordCount:r=false,maxWords:n,className:a,value:i,defaultValue:o,onChange:l,disabled:c,...m}){let[d,f]=qr.useState(()=>o??""),p=i!==void 0?String(i):d,u=qr.useCallback(b=>{i===void 0&&f(b.target.value),l?.(b);},[i,l]),h=qr.useMemo(()=>vd(p),[p]),g=n!=null&&h>n;return jsxRuntime.jsxs("div",{className:s("inline-flex w-full flex-col",a),children:[jsxRuntime.jsx("textarea",{value:p,onChange:u,disabled:c,className:s("w-full resize-y rounded-md border bg-white text-secondary-900 transition-colors placeholder:text-secondary-400 focus:outline-none dark:bg-secondary-900 dark:text-secondary-100 dark:placeholder:text-secondary-600",yd[t],xd[g?"error":e],c&&"pointer-events-none opacity-50"),...m}),(r||n!=null)&&jsxRuntime.jsx("span",{className:s("mt-1 self-end text-xs",g?"text-danger-500 dark:text-danger-400":"text-secondary-400 dark:text-secondary-500"),children:n!=null?`${h} / ${n} words`:`${h} words`})]})}var Td={sm:{trackFixed:"h-5 w-9",trackH:"h-5 min-w-9",thumb:"h-3.5 w-3.5",thumbTop:"top-[3px]",thumbOff:"left-[2px]",thumbOn:"left-[calc(100%-16px)]",pad:"pl-[6px] pr-[18px]",contentLeft:"left-[6px]",contentRight:"right-[6px]",icon:"text-[10px] [&_svg]:h-3 [&_svg]:w-3"},md:{trackFixed:"h-6 w-11",trackH:"h-6 min-w-11",thumb:"h-4.5 w-4.5",thumbTop:"top-[3px]",thumbOff:"left-[2px]",thumbOn:"left-[calc(100%-20px)]",pad:"pl-[7px] pr-[23px]",contentLeft:"left-[7px]",contentRight:"right-[7px]",icon:"text-xs [&_svg]:h-3.5 [&_svg]:w-3.5"},lg:{trackFixed:"h-7 w-14",trackH:"h-7 min-w-14",thumb:"h-5.5 w-5.5",thumbTop:"top-[3px]",thumbOff:"left-[3px]",thumbOn:"left-[calc(100%-25px)]",pad:"pl-[8px] pr-[28px]",contentLeft:"left-[8px]",contentRight:"right-[8px]",icon:"text-sm [&_svg]:h-4 [&_svg]:w-4"}},Md={primary:"text-primary-100",secondary:"text-secondary-100",danger:"text-danger-100",warning:"text-warning-100",success:"text-success-100"};function mo({checked:e,defaultChecked:t=false,onCheckedChange:r,checkedContent:n,uncheckedContent:a,intent:i,size:o,label:l,id:c,className:m,disabled:d,...f}){let p=qr.useId(),u=c??p,h=o??"md",g=i??"primary",b=Td[h],N=n!=null||a!=null,[x,T]=qr.useState(t),w=e??x,C=qr.useCallback(S=>{let R=S.target.checked;e===void 0&&T(R),r?.(R);},[e,r]);return jsxRuntime.jsxs("label",{htmlFor:u,className:s("inline-flex cursor-pointer items-center gap-2",d&&"pointer-events-none opacity-50",m),children:[jsxRuntime.jsx("input",{...f,id:u,type:"checkbox",role:"switch",className:"sr-only",checked:w,disabled:d,onChange:C,"aria-checked":w}),jsxRuntime.jsxs("span",{className:s("relative inline-flex shrink-0 items-center rounded-full transition-colors duration-200",N?b.trackH:b.trackFixed,Sn({intent:i,size:o,checked:w?"on":"off"})),children:[N?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("span",{className:s("pointer-events-none invisible inline-grid",b.icon),children:[jsxRuntime.jsx("span",{className:s("[grid-area:1/1] whitespace-nowrap",b.pad),children:n}),jsxRuntime.jsx("span",{className:s("[grid-area:1/1] whitespace-nowrap",b.pad),children:a})]}),jsxRuntime.jsx("span",{className:s("absolute top-1/2 -translate-y-1/2 whitespace-nowrap font-medium leading-none transition-opacity duration-200",b.contentLeft,b.icon,Md[g],w?"opacity-100":"opacity-0"),children:n}),jsxRuntime.jsx("span",{className:s("absolute top-1/2 -translate-y-1/2 whitespace-nowrap font-medium leading-none transition-opacity duration-200",b.contentRight,b.icon,"text-primary-400 dark:text-primary-500",w?"opacity-0":"opacity-100"),children:a})]}):null,jsxRuntime.jsx("span",{className:s("pointer-events-none absolute rounded-full bg-white shadow-sm transition-[left] duration-200 ease-in-out",b.thumb,b.thumbTop,w?b.thumbOn:b.thumbOff)})]}),l&&jsxRuntime.jsx("span",{className:"select-none text-sm text-primary-700 dark:text-primary-300",children:l})]})}var Ld={sm:"h-3 w-3",md:"h-3.5 w-3.5",lg:"h-4 w-4"};function po({checked:e,defaultChecked:t=false,indeterminate:r=false,onCheckedChange:n,intent:a,size:i,label:o,id:l,className:c,disabled:m,...d}){let f=qr.useId(),p=l??f,u=i??"md",[h,g]=qr.useState(t),b=e??h,N=qr.useCallback(T=>{let w=T.target.checked;e===void 0&&g(w),n?.(w);},[e,n]),x=b||r;return jsxRuntime.jsxs("label",{htmlFor:p,className:s("inline-flex cursor-pointer items-center gap-2 select-none",m&&"pointer-events-none opacity-50",c),children:[jsxRuntime.jsx("input",{...d,id:p,type:"checkbox",className:"sr-only",checked:b,disabled:m,onChange:N}),jsxRuntime.jsx("span",{className:s(Mn({intent:a,size:i,checked:x?"on":"off"})),children:jsxRuntime.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:s("text-white transition-all duration-200",Ld[u],x?"scale-100 opacity-100":"scale-0 opacity-0"),children:r?jsxRuntime.jsx("line",{x1:"3",y1:"8",x2:"13",y2:"8",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}):jsxRuntime.jsx("path",{d:"M3.5 8.5L6.5 11.5L12.5 4.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),o&&jsxRuntime.jsx("span",{className:"text-sm text-primary-700 dark:text-primary-300",children:o})]})}var ws=qr.createContext(null);function uo({name:e,value:t,defaultValue:r,onValueChange:n,intent:a,size:i,disabled:o,orientation:l="vertical",className:c,children:m}){let d=qr.useId(),f=e??d,[p,u]=qr.useState(r),h=t??p,g=qr.useCallback(b=>{t===void 0&&u(b),n?.(b);},[t,n]);return jsxRuntime.jsx(ws.Provider,{value:{name:f,value:h,onChange:g,intent:a,size:i,disabled:o},children:jsxRuntime.jsx("div",{role:"radiogroup",className:s("flex gap-2",l==="vertical"?"flex-col":"flex-row flex-wrap",c),children:m})})}var Hd={sm:"h-1.5 w-1.5",md:"h-2 w-2",lg:"h-2.5 w-2.5"};function fo({value:e,intent:t,size:r,label:n,id:a,className:i,disabled:o,...l}){let c=qr.useId(),m=a??c,d=qr.useContext(ws),f=t??d?.intent,p=r??d?.size,u=p??"md",h=o??d?.disabled,g=l.name??d?.name,b=d?d.value===e:void 0,N=qr.useCallback(x=>{x.target.checked&&d?.onChange(e);},[d,e]);return jsxRuntime.jsxs("label",{htmlFor:m,className:s("inline-flex cursor-pointer items-center gap-2 select-none",h&&"pointer-events-none opacity-50",i),children:[jsxRuntime.jsx("input",{...l,id:m,type:"radio",name:g,value:e,className:"sr-only",checked:b,disabled:h,onChange:N}),jsxRuntime.jsx("span",{className:s(Rn({intent:f,size:p,checked:b?"on":"off"})),children:jsxRuntime.jsx("span",{className:s("rounded-full bg-white transition-all duration-200",Hd[u],b?"scale-100 opacity-100":"scale-0 opacity-0")})}),n&&jsxRuntime.jsx("span",{className:"text-sm text-primary-700 dark:text-primary-300",children:n})]})}function Bd(e,t){if(t)return t.slice(0,2).toUpperCase();if(!e)return "?";let r=e.trim().split(/\s+/);return r.length>=2?(r[0][0]+r[r.length-1][0]).toUpperCase():e.slice(0,2).toUpperCase()}var Od={online:"ring-2 ring-success-500",offline:"ring-2 ring-secondary-400",busy:"ring-2 ring-danger-500",away:"ring-2 ring-warning-500"};function Fn({src:e,alt:t,initials:r,size:n,shape:a,status:i,className:o,...l}){let[c,m]=qr.useState(false),d=e&&!c,f=Bd(t,r);return jsxRuntime.jsx("span",{role:"img","aria-label":t??f,className:s(Br({size:n,shape:a}),i&&Od[i],"relative inline-flex shrink-0 select-none items-center justify-center overflow-hidden",o),...l,children:d?jsxRuntime.jsx("img",{src:e,alt:t,className:"h-full w-full object-cover",onError:()=>m(true),draggable:false}):jsxRuntime.jsx("span",{className:"font-semibold leading-none tracking-wide",children:f})})}function _n({children:e,max:t=4,overlap:r="left",className:n}){let a=qr__default.default.Children.toArray(e),i=a.slice(0,t),o=a.length-t;return jsxRuntime.jsxs("span",{className:s("inline-flex items-center",r==="left"?"-space-x-3":"flex-row-reverse -space-x-3",n),children:[i.map((c,m)=>jsxRuntime.jsx("span",{className:"ring-2 ring-white dark:ring-primary-900 rounded-full",children:c},m)),o>0&&jsxRuntime.jsxs("span",{"aria-label":`${o} more`,className:s(Br({size:"md",shape:"circular"}),"relative inline-flex shrink-0 select-none items-center justify-center","ring-2 ring-white dark:ring-primary-900","bg-secondary-200 text-secondary-700 dark:bg-secondary-700 dark:text-secondary-200 font-semibold text-xs"),children:["+",o]})]})}function Vt(e,t,r){return Math.min(Math.max(e,t),r)}function Yd(e,t,r){return Math.round((e-t)/r)*r+t}function go(e,t,r){return (e-t)/(r-t)*100}function Ns(e,t,r,n){let a=t+e/100*(r-t);return Yd(a,t,n)}function Ts(e,t,r,n,a,i){let o=qr.useRef(false),l=qr.useCallback(f=>{let p=e.current;if(!p)return 0;let u=p.getBoundingClientRect(),g=(("touches"in f?f.touches[0].clientX:f.clientX)-u.left)/u.width*100;return Vt(g,0,100)},[e]),c=qr.useCallback(f=>{if(a)return;f.currentTarget.setPointerCapture(f.pointerId),o.current=true;let p=e.current;if(!p)return;let u=p.getBoundingClientRect(),h=(f.clientX-u.left)/u.width*100;i?.(Ns(Vt(h,0,100),t,r,n));},[a,l,t,r,n,i,e]),m=qr.useCallback(f=>{if(!o.current||a)return;let p=e.current;if(!p)return;let u=p.getBoundingClientRect(),h=(f.clientX-u.left)/u.width*100;i?.(Ns(Vt(h,0,100),t,r,n));},[a,t,r,n,i,e]),d=qr.useCallback(()=>{o.current=false;},[]);return {startDrag:c,onPointerMove:m,stopDrag:d}}function Bn({mode:e,value:t,defaultValue:r=0,onChange:n,min:a=0,max:i=100,step:o=1,intent:l,size:c,disabled:m,showValue:d=false,formatValue:f=String,label:p,className:u,id:h,...g}){let[b,N]=qr.useState(r),x=t!==void 0,T=x?t:b,w=qr.useId(),C=h??w,S=qr.useRef(null),R=qr.useCallback(k=>{let q=Vt(k,a,i);x||N(q),n?.(q);},[x,a,i,n]),{startDrag:V,onPointerMove:I,stopDrag:E}=Ts(S,a,i,o,m,R),v=go(T,a,i),U=k=>{let q=k.key==="ArrowRight"||k.key==="ArrowUp"?o:k.key==="ArrowLeft"||k.key==="ArrowDown"?-o:k.key==="Home"?-(T-a):k.key==="End"?i-T:0;q!==0&&(k.preventDefault(),R(T+q));};return jsxRuntime.jsxs("div",{className:s("slider-root flex flex-col gap-1",u),children:[jsxRuntime.jsx("input",{type:"range",id:C,className:"sr-only",tabIndex:-1,min:a,max:i,step:o,value:T,disabled:m,readOnly:true,onChange:()=>{}}),(p||d)&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[p&&jsxRuntime.jsx("label",{htmlFor:C,className:"text-sm font-medium text-primary-700 dark:text-primary-300",children:p}),d&&jsxRuntime.jsx("span",{className:"text-sm font-semibold text-primary-600 dark:text-primary-400",children:f(T)})]}),jsxRuntime.jsx("div",{...g,ref:S,className:s(Or({intent:l,size:c}),m&&"opacity-40 cursor-not-allowed"),onPointerDown:V,onPointerMove:I,onPointerUp:E,onPointerCancel:E,style:{touchAction:"none"},children:jsxRuntime.jsxs("div",{className:"relative h-1.5 w-full grow rounded-full bg-primary-200 dark:bg-primary-700",children:[jsxRuntime.jsx("div",{className:"slider-fill absolute left-0 top-0 h-full rounded-full transition-none",style:{width:`${v}%`}}),jsxRuntime.jsx("div",{role:"slider",tabIndex:m?-1:0,"aria-valuemin":a,"aria-valuemax":i,"aria-valuenow":T,"aria-disabled":m,onKeyDown:U,className:s("slider-thumb absolute top-1/2 -translate-x-1/2 -translate-y-1/2","h-4 w-4 rounded-full border-2 bg-white shadow-md","transition-transform focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/40 focus-visible:scale-110",!m&&"cursor-grab active:cursor-grabbing active:scale-110"),style:{left:`${v}%`}})]})})]})}function On({value:e,defaultValue:t=[20,80],onChange:r,min:n=0,max:a=100,step:i=1,intent:o,size:l,disabled:c,showValue:m=false,formatValue:d=String,label:f,className:p,id:u,...h}){let[g,b]=qr.useState(t),N=e!==void 0,[x,T]=N?e:g,w=qr.useRef(null),C=qr.useRef("lo"),S=qr.useCallback(M=>{N||b(M),r?.(M);},[N,r]),R=qr.useCallback(M=>{C.current==="lo"?S([Vt(M,n,T),T]):S([x,Vt(M,x,a)]);},[x,T,n,a,S]),{startDrag:V,onPointerMove:I,stopDrag:E}=Ts(w,n,a,i,c,R),v=go(x,n,a),U=go(T,n,a),k=M=>W=>{C.current=M,V(W);},q=M=>W=>{let ue=W.key==="ArrowRight"||W.key==="ArrowUp"?i:W.key==="ArrowLeft"||W.key==="ArrowDown"?-i:0;ue!==0&&(W.preventDefault(),S(M==="lo"?[Vt(x+ue,n,T),T]:[x,Vt(T+ue,x,a)]));};return jsxRuntime.jsxs("div",{className:s("slider-root flex flex-col gap-1",p),children:[u&&jsxRuntime.jsx("input",{type:"range",id:u,className:"sr-only",tabIndex:-1,min:n,max:a,step:i,value:x,disabled:c,readOnly:true,onChange:()=>{}}),(f||m)&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[f&&jsxRuntime.jsx("span",{className:"text-sm font-medium text-primary-700 dark:text-primary-300",children:f}),m&&jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-primary-600 dark:text-primary-400",children:[d(x)," \u2013 ",d(T)]})]}),jsxRuntime.jsx("div",{...h,ref:w,className:s(Or({intent:o,size:l}),c&&"opacity-40 cursor-not-allowed"),onPointerMove:I,onPointerUp:E,onPointerCancel:E,style:{touchAction:"none"},children:jsxRuntime.jsxs("div",{className:"relative h-1.5 w-full rounded-full bg-primary-200 dark:bg-primary-700",children:[jsxRuntime.jsx("div",{className:"slider-fill absolute top-0 h-full rounded-full",style:{left:`${v}%`,width:`${U-v}%`}}),jsxRuntime.jsx("div",{role:"slider",tabIndex:c?-1:0,"aria-valuemin":n,"aria-valuemax":T,"aria-valuenow":x,"aria-label":"Range start","aria-disabled":c,onPointerDown:k("lo"),onKeyDown:q("lo"),className:s("slider-thumb absolute top-1/2 -translate-x-1/2 -translate-y-1/2","h-4 w-4 rounded-full border-2 bg-white shadow-md","transition-transform focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/40 focus-visible:scale-110",!c&&"cursor-grab active:cursor-grabbing active:scale-110"),style:{left:`${v}%`,zIndex:x>T-i?3:2}}),jsxRuntime.jsx("div",{role:"slider",tabIndex:c?-1:0,"aria-valuemin":x,"aria-valuemax":a,"aria-valuenow":T,"aria-label":"Range end","aria-disabled":c,onPointerDown:k("hi"),onKeyDown:q("hi"),className:s("slider-thumb absolute top-1/2 -translate-x-1/2 -translate-y-1/2","h-4 w-4 rounded-full border-2 bg-white shadow-md","transition-transform focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/40 focus-visible:scale-110",!c&&"cursor-grab active:cursor-grabbing active:scale-110"),style:{left:`${U}%`,zIndex:2}})]})})]})}var Kd={Button:gr,Dropdown:Za,DropdownButton:hr,Badge:ao,Tag:oo,Indicator:io,Label:so,Input:lo,TextBox:co,Switch:mo,Checkbox:po,Radio:fo,RadioGroup:uo,Avatar:Fn,AvatarGroup:_n,Slider:Bn,SliderRange:On},bo=Kd;var Xr=classVarianceAuthority.cva("rounded-lg transition-shadow",{variants:{intent:{default:"border border-primary-200 bg-white dark:border-primary-700 dark:bg-primary-900",elevated:"bg-white shadow-md hover:shadow-lg dark:bg-primary-800 dark:shadow-primary-300/25 dark:hover:shadow-primary-200/30",outlined:"border-2 border-primary-300 bg-transparent dark:border-primary-600",ghost:"bg-primary-50 dark:bg-primary-800/50"},size:{sm:"p-3",md:"p-5",lg:"p-7"}},defaultVariants:{intent:"default",size:"md"}}),$n=classVarianceAuthority.cva("rounded-md",{variants:{intent:{default:"border border-primary-200 bg-white dark:border-primary-700 dark:bg-primary-900",inset:"bg-primary-50 dark:bg-primary-800/50",elevated:"bg-white shadow-lg dark:bg-primary-800 dark:shadow-primary-300/25"},size:{sm:"p-3",md:"p-4",lg:"p-6"}},defaultVariants:{intent:"default",size:"md"}});function ho({intent:e,size:t,className:r,...n}){return jsxRuntime.jsx("div",{className:s(Xr({intent:e,size:t}),r),...n})}function Xd({className:e,...t}){return jsxRuntime.jsx("div",{className:s("mb-4 space-y-1",e),...t})}function Wd({className:e,...t}){return jsxRuntime.jsx("h3",{className:s("text-primary-900 dark:text-primary-100 text-lg font-semibold",e),...t})}function jd({className:e,...t}){return jsxRuntime.jsx("p",{className:s("text-primary-500 dark:text-primary-400 text-sm",e),...t})}function Gd({className:e,...t}){return jsxRuntime.jsx("div",{className:s("text-primary-700 dark:text-primary-300 text-sm",e),...t})}function Ud({className:e,...t}){return jsxRuntime.jsx("div",{className:s("border-primary-100 dark:border-primary-800 mt-4 flex items-center gap-2 border-t pt-4",e),...t})}function qd({intent:e,media:t,mediaPosition:r="left",stackOnMobile:n=false,className:a,children:i,...o}){let l=jsxRuntime.jsx("div",{className:s("relative shrink-0 overflow-hidden",n?"h-48 w-full rounded-t-lg sm:h-auto sm:w-auto":"",!n&&(r==="left"?"rounded-l-lg":"rounded-r-lg")),style:n?void 0:{width:t.width??"10rem"},children:t.src?jsxRuntime.jsx("img",{src:t.src,alt:t.alt??"",className:"h-full w-full object-cover",draggable:false}):t.icon?jsxRuntime.jsx("div",{className:"bg-primary-100 text-primary-500 dark:bg-primary-800 dark:text-primary-400 flex h-full w-full items-center justify-center",children:t.icon}):null});return jsxRuntime.jsxs("div",{className:s(Xr({intent:e}),"flex overflow-hidden p-0",n?"flex-col sm:flex-row":"",!n&&r==="right"&&"flex-row-reverse",!n&&r==="left"&&"flex-row",a),...o,children:[l,jsxRuntime.jsx("div",{className:"flex min-w-0 flex-1 flex-col p-4",children:i})]})}function yo({src:e,alt:t="",aspectRatio:r="16/9",className:n,children:a,...i}){return jsxRuntime.jsxs("div",{className:s("group overflow-hidden rounded-xl border transition-shadow duration-300","border-primary-200 dark:border-primary-700 dark:bg-primary-900 bg-white","dark:hover:shadow-primary-900/60 hover:shadow-lg",n),...i,children:[jsxRuntime.jsxs("div",{className:"relative overflow-hidden",style:{aspectRatio:r},children:[jsxRuntime.jsx("img",{src:e,alt:t,className:"h-full w-full object-cover transition-transform duration-500 ease-out group-hover:scale-110",draggable:false}),jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-0 opacity-0 transition-opacity duration-300 group-hover:opacity-100","aria-hidden":true,children:jsxRuntime.jsx("div",{className:"animate-light-sweep absolute inset-0"})})]}),a]})}function Zd({className:e,...t}){return jsxRuntime.jsx("div",{className:s("space-y-2 p-4",e),...t})}function Jd({className:e,...t}){return jsxRuntime.jsx("h3",{className:s("text-primary-900 dark:text-primary-100 text-base font-semibold",e),...t})}function em({className:e,...t}){return jsxRuntime.jsx("p",{className:s("text-primary-500 dark:text-primary-400 text-sm",e),...t})}function tm({className:e,...t}){return jsxRuntime.jsx("div",{className:s("border-primary-100 dark:border-primary-800 flex items-center gap-2 border-t px-4 py-3",e),...t})}function xo({intent:e,size:t,className:r,...n}){return jsxRuntime.jsx("div",{className:s($n({intent:e,size:t}),r),...n})}function rm({className:e,...t}){return jsxRuntime.jsx("div",{className:s("border-primary-200 text-primary-900 dark:border-primary-700 dark:text-primary-100 mb-3 flex items-center gap-1.5 border-b pb-3 text-sm font-semibold [&_svg]:h-4 [&_svg]:w-4 [&_svg]:shrink-0",e),...t})}function nm({className:e,...t}){return jsxRuntime.jsx("div",{className:s("text-primary-700 dark:text-primary-300 text-sm",e),...t})}var am={Card:ho,ImageCard:yo,Panel:xo},wo=am;var Yn=classVarianceAuthority.cva("w-full text-left text-sm",{variants:{intent:{default:"",striped:"[&_tbody_tr:nth-child(even)]:bg-primary-50 dark:[&_tbody_tr:nth-child(even)]:bg-primary-800/30",bordered:"[&_th]:border [&_td]:border [&_th]:border-primary-200 [&_td]:border-primary-200 dark:[&_th]:border-primary-700 dark:[&_td]:border-primary-700"},density:{compact:"[&_th]:px-2 [&_th]:py-1 [&_td]:px-2 [&_td]:py-1",default:"",relaxed:"[&_th]:px-6 [&_th]:py-5 [&_td]:px-6 [&_td]:py-5"}},defaultVariants:{intent:"default",density:"default"}}),Kn=classVarianceAuthority.cva("text-sm text-primary-700 dark:text-primary-300",{variants:{intent:{default:"space-y-1",bordered:"divide-y divide-primary-200 rounded-lg border border-primary-200 dark:divide-primary-700 dark:border-primary-700 [&>li]:px-4 [&>li]:py-2",hover:"[&>li]:rounded-md [&>li]:px-3 [&>li]:py-2 [&>li]:transition-colors [&>li:hover]:bg-primary-50 dark:[&>li:hover]:bg-primary-800/50"}},defaultVariants:{intent:"default"}}),Xn=classVarianceAuthority.cva("group flex w-full items-center gap-1.5 text-left [&_svg]:shrink-0",{variants:{size:{sm:"py-0.5 text-xs [&_svg]:h-3 [&_svg]:w-3",md:"py-1.5 text-sm [&_svg]:h-3.5 [&_svg]:w-3.5",lg:"py-2 text-base [&_svg]:h-4 [&_svg]:w-4"}},defaultVariants:{size:"md"}}),Wn=classVarianceAuthority.cva("flex cursor-pointer items-center gap-1 rounded transition-colors [&_svg]:shrink-0",{variants:{size:{sm:"py-0.5 text-xs [&_svg]:h-3.5 [&_svg]:w-3.5",md:"py-1 text-sm [&_svg]:h-4 [&_svg]:w-4",lg:"py-1.5 text-base [&_svg]:h-5 [&_svg]:w-5"}},defaultVariants:{size:"md"}}),jn=classVarianceAuthority.cva("relative rounded-xl border bg-white p-5 shadow-sm transition-shadow hover:shadow-md dark:bg-primary-900",{variants:{intent:{primary:"border-primary-200 dark:border-primary-700",success:"border-success-200 dark:border-success-800",danger:"border-danger-200 dark:border-danger-800",warning:"border-warning-200 dark:border-warning-800"},size:{sm:"p-4",md:"p-5",lg:"p-6"}},defaultVariants:{intent:"primary",size:"md"}}),Gn=classVarianceAuthority.cva("relative overflow-hidden rounded-xl border bg-white p-5 shadow-sm transition-all duration-300 hover:shadow-lg dark:bg-primary-900",{variants:{intent:{primary:"border-primary-200 dark:border-primary-700",success:"border-success-200 dark:border-success-800",danger:"border-danger-200 dark:border-danger-800",warning:"border-warning-200 dark:border-warning-800"},size:{sm:"p-4",md:"p-5",lg:"p-6"}},defaultVariants:{intent:"primary",size:"md"}}),Wr=classVarianceAuthority.cva("overflow-x-auto rounded-lg font-mono [background:var(--color-syntax-bg)] [&_pre]:m-0 [&_pre]:p-4 [&_code]:bg-transparent",{variants:{size:{sm:"text-xs",md:"text-sm",lg:"text-base"}},defaultVariants:{size:"md"}});function Ur({intent:e,density:t,className:r,...n}){return jsxRuntime.jsx("div",{className:"w-full overflow-auto",children:jsxRuntime.jsx("table",{className:s(Yn({intent:e,density:t}),r),...n})})}function No({className:e,...t}){return jsxRuntime.jsx("thead",{className:s("bg-primary-50 text-primary-600 dark:bg-primary-800/50 dark:text-primary-400",e),...t})}function Co({className:e,...t}){return jsxRuntime.jsx("tbody",{className:s("[&_tr:last-child]:border-0",e),...t})}function Gr({className:e,...t}){return jsxRuntime.jsx("tr",{className:s("border-primary-200 hover:bg-primary-50/50 dark:border-primary-700 dark:hover:bg-primary-800/30 border-b transition-colors",e),...t})}function rr({className:e,...t}){return jsxRuntime.jsx("th",{className:s("px-4 py-3 text-left text-xs font-semibold tracking-wider uppercase",e),...t})}function nr({className:e,...t}){return jsxRuntime.jsx("td",{className:s("text-primary-700 dark:text-primary-300 px-4 py-3",e),...t})}function To({icon:e,text:t="No data",className:r}){return jsxRuntime.jsxs("div",{className:s("flex flex-col items-center justify-center gap-3 py-16 text-primary-400 dark:text-primary-500",r),children:[e??jsxRuntime.jsx(lucideReact.Inbox,{className:"h-12 w-12 stroke-[1.2]"}),jsxRuntime.jsx("span",{className:"text-sm",children:t})]})}var Ss={sm:"hidden sm:table-cell",md:"hidden md:table-cell",lg:"hidden lg:table-cell"};function bm({columns:e,data:t,sort:r,onSortChange:n,defaultSort:a=null,rowKey:i,rowActions:o,intent:l,density:c,className:m,empty:d}){let[f,p]=qr.useState(a),u=r??f,h=qr.useCallback(b=>{let N=u?.column===b?u.direction==="asc"?{column:b,direction:"desc"}:null:{column:b,direction:"asc"};n?n(N):p(N);},[u,n]),g=qr.useMemo(()=>{if(!u)return t;let b=e.find(T=>T.key===u.column);if(!b)return t;let N=b.compareFn??((T,w)=>{let C=b.cell(T),S=b.cell(w);return C==null&&S==null?0:C==null?-1:S==null?1:typeof C=="number"&&typeof S=="number"?C-S:String(C).localeCompare(String(S))}),x=[...t].sort(N);return u.direction==="desc"?x.reverse():x},[t,u,e]);return jsxRuntime.jsxs(Ur,{intent:l,density:c,className:m,children:[jsxRuntime.jsx(No,{children:jsxRuntime.jsxs(Gr,{children:[e.map(b=>{let N=b.sortable!==false,x=u?.column===b.key;return jsxRuntime.jsx(rr,{className:s(N&&"cursor-pointer select-none",b.headerClassName,b.hideBelow&&Ss[b.hideBelow]),onClick:N?()=>h(b.key):void 0,"aria-sort":x?u.direction==="asc"?"ascending":"descending":void 0,children:jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1",children:[b.header,N&&jsxRuntime.jsx(Ps,{active:x,direction:x?u.direction:null})]})},b.key)}),o&&jsxRuntime.jsx(rr,{className:"w-20 text-right",children:"Actions"})]})}),jsxRuntime.jsx(Co,{children:g.length===0?jsxRuntime.jsx("tr",{children:jsxRuntime.jsx("td",{colSpan:e.length+(o?1:0),children:jsxRuntime.jsx(To,{...d})})}):g.map((b,N)=>jsxRuntime.jsxs(Gr,{children:[e.map(x=>jsxRuntime.jsx(nr,{className:s(x.cellClassName,x.hideBelow&&Ss[x.hideBelow]),children:x.cell(b)},x.key)),o&&jsxRuntime.jsx(nr,{className:"text-right",children:jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1",children:o(b)})})]},i?i(b,N):N))})]})}function hm({value:e,onCommit:t,onCancel:r}){let[n,a]=qr.useState(e),i=qr.useRef(null);qr.useEffect(()=>{i.current?.focus(),i.current?.select();},[]);let o=()=>t(n);return jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("input",{ref:i,type:"text",value:n,onChange:l=>a(l.target.value),onKeyDown:l=>{l.key==="Enter"&&o(),l.key==="Escape"&&r();},"aria-label":"Edit cell",className:"min-w-0 flex-1 rounded border border-primary-400 bg-white px-1.5 py-0.5 text-sm outline-none focus:ring-1 focus:ring-primary-400 dark:border-primary-600 dark:bg-secondary-800"}),jsxRuntime.jsx("button",{type:"button",onClick:o,className:"text-success-600 hover:text-success-700 dark:text-success-400","aria-label":"Confirm",children:jsxRuntime.jsx(lucideReact.Check,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("button",{type:"button",onClick:r,className:"text-danger-500 hover:text-danger-600 dark:text-danger-400","aria-label":"Cancel",children:jsxRuntime.jsx(lucideReact.X,{className:"h-3.5 w-3.5"})})]})}function ym({columns:e,data:t,rowKey:r,sort:n,onSortChange:a,defaultSort:i=null,selectionMode:o="none",selected:l,onSelectionChange:c,editable:m=false,onCellEdit:d,toolbar:f=false,onAdd:p,onDelete:u,rowActions:h,intent:g,density:b,className:N,empty:x}){let[T,w]=qr.useState(i),C=n??T,S=qr.useCallback(B=>{let j=C?.column===B?C.direction==="asc"?{column:B,direction:"desc"}:null:{column:B,direction:"asc"};a?a(j):w(j);},[C,a]),R=qr.useMemo(()=>{if(!C)return t;let B=e.find(ye=>ye.key===C.column);if(!B)return t;let j=B.compareFn??((ye,y)=>{let L=B.cell(ye),G=B.cell(y);return L==null&&G==null?0:L==null?-1:G==null?1:typeof L=="number"&&typeof G=="number"?L-G:String(L).localeCompare(String(G))}),pe=[...t].sort(j);return C.direction==="desc"?pe.reverse():pe},[t,C,e]),[V,I]=qr.useState([]),E=l??V,v=c??I,U=qr.useMemo(()=>R.map((B,j)=>r(B,j)),[R,r]),k=o==="multiple"&&U.length>0&&U.every(B=>E.includes(B)),q=o==="multiple"&&E.length>0&&!k,M=qr.useCallback(B=>{o==="single"?v(E.includes(B)?[]:[B]):o==="multiple"&&v(E.includes(B)?E.filter(j=>j!==B):[...E,B]);},[o,E,v]),W=qr.useCallback(()=>{v(k?[]:U);},[k,U,v]),[$,ue]=qr.useState(null),J=qr.useCallback((B,j,pe)=>{m&&pe!==false&&ue({rowKey:B,colKey:j});},[m]),de=qr.useCallback((B,j,pe)=>{d?.(B,j,pe),ue(null);},[d]);return jsxRuntime.jsxs("div",{className:"space-y-2",children:[f&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[p&&jsxRuntime.jsxs("button",{type:"button",onClick:p,className:"inline-flex items-center gap-1.5 rounded-md border border-secondary-300 bg-white px-3 py-1.5 text-sm font-medium text-secondary-700 transition-colors hover:bg-secondary-50 dark:border-secondary-600 dark:bg-secondary-800 dark:text-secondary-300 dark:hover:bg-secondary-700",children:[jsxRuntime.jsx(lucideReact.Plus,{className:"h-3.5 w-3.5"})," Add"]}),u&&jsxRuntime.jsxs("button",{type:"button",onClick:()=>u(E),disabled:E.length===0,className:"inline-flex items-center gap-1.5 rounded-md border border-secondary-300 bg-white px-3 py-1.5 text-sm font-medium text-danger-600 transition-colors hover:bg-danger-50 disabled:opacity-40 disabled:pointer-events-none dark:border-secondary-600 dark:bg-secondary-800 dark:text-danger-400 dark:hover:bg-danger-900/20",children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"h-3.5 w-3.5"})," Delete",E.length>0&&` (${E.length})`]}),m&&E.length===1&&jsxRuntime.jsxs("button",{type:"button",onClick:()=>{let B=e.find(j=>j.editable!==false);B&&ue({rowKey:E[0],colKey:B.key});},className:"inline-flex items-center gap-1.5 rounded-md border border-secondary-300 bg-white px-3 py-1.5 text-sm font-medium text-secondary-700 transition-colors hover:bg-secondary-50 dark:border-secondary-600 dark:bg-secondary-800 dark:text-secondary-300 dark:hover:bg-secondary-700",children:[jsxRuntime.jsx(lucideReact.Pencil,{className:"h-3.5 w-3.5"})," Edit"]}),E.length>0&&jsxRuntime.jsxs("span",{className:"ml-auto text-sm text-secondary-500 dark:text-secondary-400",children:[E.length," row",E.length>1?"s":""," selected"]})]}),jsxRuntime.jsxs(Ur,{intent:g,density:b,className:N,children:[jsxRuntime.jsx(No,{children:jsxRuntime.jsxs(Gr,{children:[o==="multiple"&&jsxRuntime.jsx(rr,{className:"w-10",children:jsxRuntime.jsx("input",{type:"checkbox",checked:k,ref:B=>{B&&(B.indeterminate=q);},onChange:W,className:"h-4 w-4 cursor-pointer rounded border-secondary-300 accent-primary-600","aria-label":"Select all"})}),o==="single"&&jsxRuntime.jsx(rr,{className:"w-10"}),e.map(B=>{let j=B.sortable!==false,pe=C?.column===B.key;return jsxRuntime.jsx(rr,{className:s(j&&"cursor-pointer select-none",B.headerClassName),onClick:j?()=>S(B.key):void 0,"aria-sort":pe?C.direction==="asc"?"ascending":"descending":void 0,children:jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1",children:[B.header,j&&jsxRuntime.jsx(Ps,{active:pe,direction:pe?C.direction:null})]})},B.key)}),h&&jsxRuntime.jsx(rr,{className:"w-20 text-right",children:"Actions"})]})}),jsxRuntime.jsx(Co,{children:R.length===0?jsxRuntime.jsx("tr",{children:jsxRuntime.jsx("td",{colSpan:e.length+(o!=="none"?1:0)+(h?1:0),children:jsxRuntime.jsx(To,{...x})})}):R.map((B,j)=>{let pe=r(B,j),ye=E.includes(pe);return jsxRuntime.jsxs(Gr,{className:s(ye&&"bg-primary-50/60 dark:bg-primary-900/20"),onClick:()=>{o!=="none"&&M(pe);},children:[o==="multiple"&&jsxRuntime.jsx(nr,{className:"w-10",children:jsxRuntime.jsx("input",{type:"checkbox",checked:ye,onChange:()=>M(pe),onClick:y=>y.stopPropagation(),className:"h-4 w-4 cursor-pointer rounded border-secondary-300 accent-primary-600","aria-label":"Select row"})}),o==="single"&&jsxRuntime.jsx(nr,{className:"w-10",children:jsxRuntime.jsx("input",{type:"radio",checked:ye,onChange:()=>M(pe),onClick:y=>y.stopPropagation(),className:"h-4 w-4 cursor-pointer accent-primary-600","aria-label":"Select row"})}),e.map(y=>{let L=$?.rowKey===pe&&$?.colKey===y.key,G=y.editValue?.(B)??(()=>{let O=y.cell(B);return typeof O=="string"||typeof O=="number"?String(O):""})();return jsxRuntime.jsx(nr,{className:s(y.cellClassName,m&&y.editable!==false&&"cursor-text"),onDoubleClick:O=>{O.stopPropagation(),J(pe,y.key,y.editable);},children:L?jsxRuntime.jsx(hm,{value:G,onCommit:O=>de(pe,y.key,O),onCancel:()=>ue(null)}):y.cell(B)},y.key)}),h&&jsxRuntime.jsx(nr,{className:"text-right",onClick:y=>y.stopPropagation(),children:jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1",children:h(B)})})]},pe)})})]})]})}function Ps({active:e,direction:t}){let r="h-3.5 w-3.5 shrink-0";return !e||!t?jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:s(r,"opacity-30")}):t==="asc"?jsxRuntime.jsx(lucideReact.ArrowUp,{className:s(r,"opacity-70")}):jsxRuntime.jsx(lucideReact.ArrowDown,{className:s(r,"opacity-70")})}var Ds=qr.createContext({size:"md"});function Mo({intent:e,size:t="md",className:r,...n}){return jsxRuntime.jsx(Ds.Provider,{value:{size:t},children:jsxRuntime.jsx("ul",{className:s(Kn({intent:e}),r),...n})})}function wm({actions:e,className:t,children:r,...n}){let{size:a}=qr.useContext(Ds);return jsxRuntime.jsxs("li",{className:s(Xn({size:a}),t),...n,children:[jsxRuntime.jsx("span",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:r}),e&&jsxRuntime.jsx("span",{className:"ml-auto flex shrink-0 items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100 [@media(hover:none)]:opacity-100 [@media(hover:none)]:[&>button]:min-h-(--row-action-touch-min) [@media(hover:none)]:[&>button]:min-w-(--row-action-touch-min) [@media(hover:none)]:[&>button]:flex [@media(hover:none)]:[&>button]:items-center [@media(hover:none)]:[&>button]:justify-center",children:e})]})}var Vs=qr.createContext({showLines:true,expandedKeys:null,onToggleKey:()=>{},size:"md"});function Ro({showLines:e=true,showRoot:t=true,expandedKeys:r,defaultExpandedKeys:n="all",onExpandedKeysChange:a,size:i="md",className:o,children:l,...c}){let [m,d]=qr.useState(()=>n),p=qr.useCallback(h=>{if(r){let g=new Set(r);g.has(h)?g.delete(h):g.add(h),a?.(g);}else d(g=>{if(g==="all")return new Set(["__ALL_MINUS__",h]);let b=new Set(g);return b.has(h)?b.delete(h):b.add(h),b});},[r,a]),u=r??(m==="all"?null:m);return jsxRuntime.jsx(Vs.Provider,{value:{showLines:e,expandedKeys:u,onToggleKey:p,size:i},children:t?jsxRuntime.jsx("ul",{className:s("text-sm",o),role:"tree",...c,children:l}):jsxRuntime.jsx("ul",{className:s("text-sm",o),role:"tree",...c,children:jsxRuntime.jsx(Rm,{children:l})})})}function Rm({children:e}){let t=Is(e);return jsxRuntime.jsx(jsxRuntime.Fragment,{children:t.map(r=>qr__default.default.isValidElement(r)&&r.props.children?r.props.children:null)})}function Is(e){let t=[];return qr__default.default.Children.forEach(e,r=>{qr__default.default.isValidElement(r)&&r.type===qr__default.default.Fragment?t.push(...Is(r.props.children)):t.push(r);}),t}function Sm({nodeKey:e,label:t,icon:r,actions:n,defaultExpanded:a=false,expanded:i,onToggle:o,children:l,className:c}){let{showLines:m,expandedKeys:d,onToggleKey:f,size:p}=qr.useContext(Vs),[u,h]=qr.useState(a),g=qr__default.default.Children.count(l)>0,b=e??(typeof t=="string"?t:""),N;i!=null?N=i:d!=null&&b?d.has("__ALL_MINUS__")?N=!d.has(b):N=d.has(b):N=u;let x=()=>{let T=!N;o?o(T):d!=null&&b?f(b):h(T);};return jsxRuntime.jsxs("li",{className:s("select-none",c),role:"treeitem","aria-expanded":g?N:void 0,children:[jsxRuntime.jsxs("div",{className:s("group hover:bg-primary-50 dark:hover:bg-primary-800/50 rounded-md px-1",Wn({size:p}),g?"cursor-pointer":"cursor-default"),onClick:g?x:void 0,children:[g?jsxRuntime.jsx(lucideReact.ChevronRight,{className:s("text-primary-400 h-4 w-4 shrink-0 transition-transform duration-200",N&&"rotate-90")}):jsxRuntime.jsx("span",{className:"w-4 shrink-0"}),r&&jsxRuntime.jsx("span",{className:"shrink-0",children:r}),jsxRuntime.jsx("span",{className:"text-primary-700 dark:text-primary-300 min-w-0 flex-1 truncate",children:t}),n&&jsxRuntime.jsx("span",{className:"ml-auto flex shrink-0 items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100 [@media(hover:none)]:opacity-100 [@media(hover:none)]:[&>button]:min-h-(--row-action-touch-min) [@media(hover:none)]:[&>button]:min-w-(--row-action-touch-min) [@media(hover:none)]:[&>button]:flex [@media(hover:none)]:[&>button]:items-center [@media(hover:none)]:[&>button]:justify-center",onClick:T=>T.stopPropagation(),children:n})]}),g&&jsxRuntime.jsx("div",{className:s("grid transition-[grid-template-rows] duration-200 ease-out",N?"grid-rows-[1fr]":"grid-rows-[0fr]"),children:jsxRuntime.jsx("div",{className:"overflow-hidden",children:jsxRuntime.jsx("ul",{className:s("ml-4 pl-2",m&&"border-primary-200 dark:border-primary-700 border-l"),role:"group",children:l})})})]})}function Em({avatar:e,sender:t}){return e?typeof e=="string"?/^(?:https?|data|blob):/.test(e)?jsxRuntime.jsx("img",{src:e,alt:t,className:"h-8 w-8 shrink-0 rounded-full object-cover",draggable:false}):jsxRuntime.jsx("div",{className:"bg-primary-200 text-primary-600 dark:bg-primary-700 dark:text-primary-300 flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-lg select-none",children:e}):jsxRuntime.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full",children:e}):jsxRuntime.jsx("div",{className:"bg-primary-200 text-primary-600 dark:bg-primary-700 dark:text-primary-300 flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-sm font-semibold select-none",children:t.charAt(0).toUpperCase()})}function Vm({msg:e,alignRight:t}){return jsxRuntime.jsxs("div",{className:s("flex gap-2.5",t?"flex-row-reverse":"flex-row"),children:[jsxRuntime.jsx(Em,{avatar:e.avatar,sender:e.sender}),jsxRuntime.jsxs("div",{className:s("flex max-w-[75%] flex-col gap-0.5",t?"items-end":"items-start"),children:[jsxRuntime.jsx("span",{className:"text-primary-500 dark:text-primary-400 text-xs",children:e.sender}),jsxRuntime.jsx("div",{className:s("rounded-xl px-3 py-2 text-sm leading-relaxed",t?"rounded-tr-sm bg-primary-500 text-white dark:bg-primary-600":"bg-primary-100 text-primary-800 dark:bg-primary-800 dark:text-primary-200 rounded-tl-sm"),children:e.content}),e.time&&jsxRuntime.jsx("span",{className:"text-primary-400 dark:text-primary-500 text-[10px]",children:e.time})]})]})}function Po({messages:e,mode:t="split",autoScroll:r=true,className:n,...a}){let i=qr.useRef(null);return qr.useEffect(()=>{r&&i.current?.scrollIntoView({behavior:"smooth"});},[e,r]),jsxRuntime.jsxs("div",{className:s("flex flex-col gap-4 overflow-y-auto rounded-lg border p-4","border-primary-200 dark:border-primary-700 dark:bg-primary-900 bg-white",n),...a,children:[e.map(o=>{let l=t==="split"&&!!o.self;return jsxRuntime.jsx(Vm,{msg:o,alignRight:l},o.id)}),jsxRuntime.jsx("div",{ref:i})]})}var Hm={name:"onyx-css-vars",type:"dark",settings:[{settings:{foreground:"var(--color-syntax-plain)",background:"var(--color-syntax-bg)"}},{scope:["comment","punctuation.definition.comment"],settings:{foreground:"var(--color-syntax-comment)",fontStyle:"italic"}},{scope:["keyword","keyword.control","keyword.operator.new","keyword.operator.expression","storage.type","storage.modifier"],settings:{foreground:"var(--color-syntax-keyword)"}},{scope:["string","string.quoted","string.template"],settings:{foreground:"var(--color-syntax-string)"}},{scope:["entity.name.function","support.function","meta.function-call"],settings:{foreground:"var(--color-syntax-function)"}},{scope:["variable","variable.other","variable.parameter","meta.definition.variable"],settings:{foreground:"var(--color-syntax-variable)"}},{scope:["constant.numeric","constant.language"],settings:{foreground:"var(--color-syntax-number)"}},{scope:["keyword.operator","keyword.operator.assignment","keyword.operator.comparison","keyword.operator.arithmetic"],settings:{foreground:"var(--color-syntax-operator)"}},{scope:["entity.name.tag","punctuation.definition.tag","support.class.component"],settings:{foreground:"var(--color-syntax-tag)"}},{scope:["entity.other.attribute-name","meta.tag.attributes"],settings:{foreground:"var(--color-syntax-attr)"}},{scope:["punctuation","meta.brace","punctuation.definition.block","punctuation.separator","punctuation.terminator"],settings:{foreground:"var(--color-syntax-punctuation)"}},{scope:["entity.name.type","support.type","support.class","entity.other.inherited-class"],settings:{foreground:"var(--color-syntax-type)"}}]},Fm={typescript:()=>import('@shikijs/langs/typescript'),javascript:()=>import('@shikijs/langs/javascript'),tsx:()=>import('@shikijs/langs/tsx'),jsx:()=>import('@shikijs/langs/jsx'),html:()=>import('@shikijs/langs/html'),css:()=>import('@shikijs/langs/css'),json:()=>import('@shikijs/langs/json'),markdown:()=>import('@shikijs/langs/markdown'),python:()=>import('@shikijs/langs/python'),rust:()=>import('@shikijs/langs/rust'),go:()=>import('@shikijs/langs/go'),java:()=>import('@shikijs/langs/java'),c:()=>import('@shikijs/langs/c'),cpp:()=>import('@shikijs/langs/cpp'),csharp:()=>import('@shikijs/langs/csharp'),vue:()=>import('@shikijs/langs/vue'),xml:()=>import('@shikijs/langs/xml'),yaml:()=>import('@shikijs/langs/yaml'),sql:()=>import('@shikijs/langs/sql'),bash:()=>import('@shikijs/langs/bash'),shell:()=>import('@shikijs/langs/shell')},Eo=null,As=new Set;function _m(){return Eo||(Eo=Promise.all([import('shiki/core'),import('shiki/engine/javascript')]).then(([{createHighlighterCore:e},{createJavaScriptRegexEngine:t}])=>e({themes:[Hm],langs:[],engine:t()}))),Eo}async function zm(e,t,r){let n=await _m();if(t&&!As.has(t)){let i=Fm[t];if(i)try{let o=await i();await n.loadLanguage(o.default??o),As.add(t);}catch{t="text";}else t="text";}let a=n.codeToHtml(e,{lang:t||"text",theme:"onyx-css-vars"});if(a=a.replace(/(<pre [^>]*style=")/,"$1line-height:1.7;tab-size:2;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;"),r){let i=0;a=a.replace(/<span class="line">/g,()=>(i++,`<span class="line"><span class="line-number" data-line="${i}"></span>`));}return a}function Vo({code:e,language:t="text",lineNumbers:r=false,editable:n=false,onCodeChange:a,size:i,className:o,...l}){let[c,m]=qr.useState(""),d=qr.useRef(null),f=qr.useRef(null),p=qr.useRef(null);qr.useEffect(()=>{let w=false;return zm(e,t,n?false:r).then(C=>{w||m(C);}),()=>{w=true;}},[e,t,r,n]);let u=qr.useCallback(()=>{let w=f.current,C=p.current?.querySelector("pre"),S=d.current?.querySelector("[data-gutter]");w&&C&&(C.scrollTop=w.scrollTop,C.scrollLeft=w.scrollLeft),w&&S&&(S.scrollTop=w.scrollTop);},[]),h=qr.useCallback(w=>{a?.(w.target.value);},[a]),g=qr.useCallback(w=>{if(w.key==="Tab"){w.preventDefault();let C=w.currentTarget,S=C.selectionStart,R=C.selectionEnd,V=C.value.substring(0,S)+" "+C.value.substring(R);a?.(V),requestAnimationFrame(()=>{C.selectionStart=C.selectionEnd=S+2;});}},[a]),b=r&&"[&_.line-number]:inline-block [&_.line-number]:w-8 [&_.line-number]:mr-4 [&_.line-number]:text-right [&_.line-number]:text-secondary-400 [&_.line-number]:select-none [&_.line-number]:before:content-[attr(data-line)]",N="ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",x=1.7,T=e.split(`
2
- `).length;return n?jsxRuntime.jsxs("div",{ref:d,className:s(Wr({size:i}),"flex border border-primary-200 dark:border-primary-700",o),style:{background:"var(--color-syntax-bg)"},...l,children:[r&&jsxRuntime.jsx("div",{"data-gutter":true,"aria-hidden":true,className:"shrink-0 select-none overflow-hidden py-4 pl-3 pr-1 text-right text-secondary-400",style:{fontFamily:N,lineHeight:x,width:"3rem"},children:Array.from({length:T},(w,C)=>jsxRuntime.jsx("div",{children:C+1},C))}),jsxRuntime.jsxs("div",{className:"relative min-w-0 flex-1",children:[jsxRuntime.jsx("textarea",{ref:f,value:e,onChange:h,onScroll:u,onKeyDown:g,spellCheck:false,autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",className:"relative z-2 m-0 block h-full w-full resize-none overflow-auto whitespace-pre border-none bg-transparent p-4 text-transparent caret-primary-600 outline-none dark:caret-primary-400",style:{fontFamily:N,lineHeight:x,tabSize:2,minHeight:"6rem"}}),jsxRuntime.jsx("div",{ref:p,"aria-hidden":true,className:"pointer-events-none absolute inset-0 z-1 overflow-hidden [&_pre]:m-0 [&_pre]:h-full [&_pre]:overflow-hidden [&_pre]:p-4 [&_code]:bg-transparent",dangerouslySetInnerHTML:c?{__html:c}:void 0})]})]}):jsxRuntime.jsx("div",{ref:d,className:s(Wr({size:i}),"border border-primary-200 dark:border-primary-700",b,o),style:{background:"var(--color-syntax-bg)"},...l,children:jsxRuntime.jsx("div",{ref:p,className:"[&_pre]:m-0 [&_pre]:p-4",dangerouslySetInnerHTML:c?{__html:c}:void 0,children:c?void 0:jsxRuntime.jsx("pre",{className:"m-0 p-4",style:{background:"var(--color-syntax-bg)"},children:jsxRuntime.jsx("code",{children:e})})})})}var Ym={up:lucideReact.TrendingUp,down:lucideReact.TrendingDown,neutral:lucideReact.Minus},Km={up:"text-success-600 dark:text-success-400",down:"text-danger-600 dark:text-danger-400",neutral:"text-secondary-500 dark:text-secondary-400"};function Io({title:e,value:t,prefix:r,suffix:n,icon:a,trend:i,trendValue:o,description:l,intent:c,size:m,className:d}){let f=i?Ym[i]:null,p=i?Km[i]:"";return jsxRuntime.jsx("div",{className:s(jn({intent:c,size:m}),d),children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-3",children:[jsxRuntime.jsxs("div",{className:"min-w-0 flex-1",children:[jsxRuntime.jsx("p",{className:"truncate text-xs font-medium tracking-wider uppercase text-secondary-500 dark:text-secondary-400",children:e}),jsxRuntime.jsxs("p",{className:"mt-1 flex items-baseline gap-1 text-2xl font-bold text-primary-900 dark:text-primary-50",children:[r&&jsxRuntime.jsx("span",{className:"text-base font-semibold text-secondary-500 dark:text-secondary-400",children:r}),jsxRuntime.jsx("span",{children:t}),n&&jsxRuntime.jsx("span",{className:"text-base font-semibold text-secondary-500 dark:text-secondary-400",children:n})]}),(i||l)&&jsxRuntime.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[i&&f&&jsxRuntime.jsxs("span",{className:s("flex items-center gap-0.5 text-xs font-semibold",p),children:[jsxRuntime.jsx(f,{className:"h-3.5 w-3.5"}),o]}),l&&jsxRuntime.jsx("span",{className:"text-xs text-secondary-500 dark:text-secondary-400",children:l})]})]}),a&&jsxRuntime.jsx("div",{className:s("flex h-10 w-10 shrink-0 items-center justify-center rounded-xl [&_svg]:h-5 [&_svg]:w-5",c==="success"&&"bg-success-100 text-success-600 dark:bg-success-900/30 dark:text-success-400",c==="danger"&&"bg-danger-100 text-danger-600 dark:bg-danger-900/30 dark:text-danger-400",c==="warning"&&"bg-warning-100 text-warning-600 dark:bg-warning-900/30 dark:text-warning-400",(!c||c==="primary")&&"bg-primary-100 text-primary-600 dark:bg-primary-800 dark:text-primary-400"),children:a})]})})}function qm(e){return 1-Math.pow(1-e,4)}function Qm(e,t,r,n,a){let[i,o]=qr.useState(()=>a?a(t):t.toFixed(n)),l=qr.useRef(null),c=qr.useRef(null);return qr.useEffect(()=>{l.current!==null&&cancelAnimationFrame(l.current),c.current=null;let m=d=>{c.current===null&&(c.current=d);let f=d-c.current,p=Math.min(f/r,1),u=qm(p),h=t+(e-t)*u;o(a?a(h):h.toFixed(n)),p<1&&(l.current=requestAnimationFrame(m));};return l.current=requestAnimationFrame(m),()=>{l.current!==null&&cancelAnimationFrame(l.current);}},[e,t,r,n,a]),i}var Zm={up:lucideReact.TrendingUp,down:lucideReact.TrendingDown,neutral:lucideReact.Minus},Jm={up:"text-success-600 dark:text-success-400",down:"text-danger-600 dark:text-danger-400",neutral:"text-secondary-500 dark:text-secondary-400"},_s={primary:"bg-primary-100 text-primary-600 dark:bg-primary-800/60 dark:text-primary-300",success:"bg-success-100 text-success-600 dark:bg-success-900/30 dark:text-success-400",danger:"bg-danger-100 text-danger-600 dark:bg-danger-900/30 dark:text-danger-400",warning:"bg-warning-100 text-warning-600 dark:bg-warning-900/30 dark:text-warning-400"};function Ao({title:e,value:t,decimals:r=0,prefix:n,suffix:a,icon:i,trend:o,trendValue:l,description:c,animateDuration:m=1200,formatter:d,from:f=0,intent:p,size:u,className:h}){let g=Qm(t,f,m,r,d),b=o?Zm[o]:null,N=o?Jm[o]:"";return jsxRuntime.jsxs("div",{className:s(Gn({intent:p,size:u}),h),children:[jsxRuntime.jsx("div",{className:s("pointer-events-none absolute inset-x-0 top-0 h-0.5 rounded-t-xl",p==="success"&&"bg-gradient-to-r from-success-400 to-success-600",p==="danger"&&"bg-gradient-to-r from-danger-400 to-danger-600",p==="warning"&&"bg-gradient-to-r from-warning-400 to-warning-600",(!p||p==="primary")&&"bg-gradient-to-r from-primary-400 to-primary-600")}),jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-4",children:[jsxRuntime.jsxs("div",{className:"min-w-0 flex-1",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold tracking-widest uppercase text-secondary-500 dark:text-secondary-400",children:e}),jsxRuntime.jsxs("p",{className:"mt-2 flex items-baseline gap-1",children:[n&&jsxRuntime.jsx("span",{className:"text-lg font-semibold text-secondary-400 dark:text-secondary-500",children:n}),jsxRuntime.jsx("span",{className:"font-mono text-3xl font-bold tabular-nums text-primary-900 dark:text-primary-50",children:g}),a&&jsxRuntime.jsx("span",{className:"text-lg font-semibold text-secondary-400 dark:text-secondary-500",children:a})]})]}),i&&jsxRuntime.jsx("div",{className:s("flex h-12 w-12 shrink-0 items-center justify-center rounded-2xl [&_svg]:h-6 [&_svg]:w-6",_s[p??"primary"]??_s.primary),children:i})]}),(o||c)&&jsxRuntime.jsxs("div",{className:"mt-3 flex items-center gap-2 border-t border-primary-100 pt-3 dark:border-primary-700/50",children:[o&&b&&jsxRuntime.jsxs("span",{className:s("flex items-center gap-0.5 text-xs font-bold",N),children:[jsxRuntime.jsx(b,{className:"h-3.5 w-3.5"}),l]}),c&&jsxRuntime.jsx("span",{className:"text-xs text-secondary-500 dark:text-secondary-400",children:c})]})]})}var ep={Table:Ur,List:Mo,Tree:Ro,Chat:Po,CodeBlock:Vo,Stat:Io,MetricCard:Ao},Ho=ep;var ar="flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-sm transition-colors cursor-pointer",Bs="bg-primary-200 dark:bg-primary-700/50 text-primary-900 dark:text-primary-100 font-medium",kr="text-primary-600 dark:text-primary-400 hover:bg-primary-100 dark:hover:bg-primary-800/50 hover:text-primary-900 dark:hover:text-primary-200",Nr="flex items-center justify-center rounded-md p-2 transition-colors cursor-pointer text-primary-600 dark:text-primary-400 hover:bg-primary-100 dark:hover:bg-primary-800/50 hover:text-primary-900 dark:hover:text-primary-200";function cp({to:e,className:t,style:r,children:n}){let a=typeof t=="function"?t({isActive:false}):t;return jsxRuntime.jsx("a",{href:e,className:a,style:r,children:n})}var Fo=["expanded","icons","mini"];function dp(e){let t=Fo.indexOf(e);return Fo[(t+1)%Fo.length]}function Os(e){let t=new Set;for(let r of e)if(r.children&&r.children.length>0){t.add(r.key??r.label);for(let n of Os(r.children))t.add(n);}return t}function $s({item:e,basePath:t,depth:r,onItemClick:n,LinkComponent:a,showLines:i,expandedKeys:o,onToggle:l}){let c=e.key??e.label,m=e.children&&e.children.length>0,[d,f]=qr.useState(e.defaultOpen??true),p=o?o.has(c):d,u=qr.useCallback(()=>{o?l(c):f(g=>!g);},[o,l,c]),h=r>0?`${r*1.25}rem`:void 0;if(m)return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:u,className:s(ar,kr,"justify-between"),style:{paddingLeft:h},children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-2",children:[e.icon,e.label]}),jsxRuntime.jsx(lucideReact.ChevronRight,{className:s("h-3.5 w-3.5 transition-transform",p&&"rotate-90")})]}),p&&jsxRuntime.jsx("div",{className:s("flex flex-col gap-0.5 pt-0.5",i?"ml-2.5 border-l border-primary-200 dark:border-primary-700":"ml-2"),children:e.children.map(g=>jsxRuntime.jsx($s,{item:g,basePath:t,depth:r+1,onItemClick:n,LinkComponent:a,showLines:i,expandedKeys:o,onToggle:l},g.key??g.path??g.label))})]});if(e.path!=null){let g=t+e.path;return n?jsxRuntime.jsxs("button",{type:"button",onClick:()=>n(e,g),className:s(ar,kr),style:{paddingLeft:h},children:[e.icon,e.label]}):jsxRuntime.jsxs(a,{to:g,className:({isActive:b})=>s(ar,b?Bs:kr),style:{paddingLeft:h},children:[e.icon,e.label]})}return jsxRuntime.jsxs("span",{className:s(ar,kr,"cursor-default"),style:{paddingLeft:h},children:[e.icon,e.label]})}function mp({item:e,basePath:t,onItemClick:r,LinkComponent:n}){let[a,i]=qr.useState(false),o=qr.useRef(null),l=qr.useRef(void 0),[c,m]=qr.useState({top:0,left:0}),d=()=>{clearTimeout(l.current),i(true);},f=()=>{l.current=setTimeout(()=>i(false),200);};qr.useLayoutEffect(()=>{if(a&&o.current){let u=o.current.getBoundingClientRect();m({top:u.top,left:u.right+4});}},[a]);let p=e.icon||jsxRuntime.jsx("span",{className:"text-xs font-bold leading-none",children:e.label.charAt(0).toUpperCase()});return jsxRuntime.jsxs("div",{onMouseEnter:d,onMouseLeave:f,children:[jsxRuntime.jsx("button",{ref:o,type:"button",className:s(Nr,"w-full"),title:e.label,onClick:()=>i(u=>!u),children:p}),a&&reactDom.createPortal(jsxRuntime.jsxs("div",{className:"fixed z-50 min-w-44 rounded-md border border-primary-200 bg-white p-1 shadow-lg dark:border-primary-700 dark:bg-primary-900",style:{top:c.top,left:c.left},onMouseEnter:d,onMouseLeave:f,children:[jsxRuntime.jsx("div",{className:"px-2.5 py-1.5 text-xs font-semibold uppercase text-primary-500 dark:text-primary-400",children:e.label}),jsxRuntime.jsx("div",{className:"flex flex-col gap-0.5",children:e.children?.map(u=>{let h=u.key??u.path??u.label;if(u.path!=null){let g=t+u.path;return r?jsxRuntime.jsxs("button",{type:"button",onClick:()=>{r(u,g),i(false);},className:s(ar,kr),children:[u.icon,u.label]},h):jsxRuntime.jsxs(n,{to:g,className:({isActive:b})=>s(ar,b?Bs:kr),children:[u.icon,u.label]},h)}return jsxRuntime.jsxs("span",{className:s(ar,"cursor-default text-primary-400"),children:[u.icon,u.label]},h)})})]}),document.body)]})}function pp({item:e,basePath:t,onItemClick:r,LinkComponent:n}){let a=e.icon||jsxRuntime.jsx("span",{className:"text-xs font-bold leading-none",children:e.label.charAt(0).toUpperCase()});if(e.path!=null){let i=t+e.path;return r?jsxRuntime.jsx("button",{type:"button",onClick:()=>r(e,i),className:s(Nr,"w-full"),title:e.label,children:a}):jsxRuntime.jsx(n,{to:i,className:({isActive:o})=>s(Nr,"w-full",o&&"bg-primary-200 dark:bg-primary-700/50 text-primary-900 dark:text-primary-100"),children:jsxRuntime.jsx("span",{title:e.label,children:a})})}return jsxRuntime.jsx("span",{className:s(Nr,"w-full cursor-default"),title:e.label,children:a})}function zo({items:e,title:t,basePath:r="/",onItemClick:n,LinkComponent:a=cp,collapsible:i,collapseMode:o,defaultCollapseMode:l="expanded",onCollapseModeChange:c,showLines:m=true,expandedKeys:d,defaultExpandedKeys:f="all",onExpandedKeysChange:p,className:u,responsive:h=true,mobileBreakpoint:g=768,mobileTopOffset:b=48,mobileDrawerSlot:N,...x}){let[T,w]=qr.useState(l),C=o??T,S=qr__default.default.useMemo(()=>Os(e),[e]),[R,V]=qr.useState(()=>f==="all"?new Set(S):new Set(f)),I=d??null,E=I??R,v=qr.useCallback(F=>{let K=new Set(E);K.has(F)?K.delete(F):K.add(F),V(K),p?.(K);},[E,p]),U=qr.useCallback(()=>{let F=dp(C);w(F),c?.(F);},[C,c]),[k,q]=qr.useState(()=>h&&typeof window<"u"&&window.innerWidth<g),[M,W]=qr.useState(false),[$,ue]=qr.useState(()=>{if(typeof window>"u")return "left";try{return localStorage.getItem("onyx-sidenav-side")||"left"}catch{return "left"}}),[J,de]=qr.useState(()=>{if(typeof window>"u")return 50;try{return Number(localStorage.getItem("onyx-sidenav-top"))||50}catch{return 50}}),[re,B]=qr.useState(null),j=qr.useRef({dragging:false,startX:0,startY:0,moved:false}),pe=qr.useCallback(F=>{if(F.pointerType==="mouse"&&F.button!==0)return;F.preventDefault(),j.current={dragging:true,startX:F.clientX,startY:F.clientY,moved:false};let K=X=>{if(!j.current.dragging)return;let fe=Math.abs(X.clientX-j.current.startX),we=Math.abs(X.clientY-j.current.startY);if((fe>6||we>6)&&(j.current.moved=true),!j.current.moved)return;let H=X.clientX<window.innerWidth/2?"left":"right",ne=b+28,Y=window.innerHeight-28,Q=Math.max(ne,Math.min(Y,X.clientY));B({side:H,y:Q});},oe=X=>{if(window.removeEventListener("pointermove",K),window.removeEventListener("pointerup",oe),window.removeEventListener("pointercancel",oe),!j.current.dragging)return;if(j.current.dragging=false,!j.current.moved){let Q=ke=>{ke.stopPropagation(),ke.preventDefault(),window.removeEventListener("click",Q,true);};window.addEventListener("click",Q,true),B(null),W(true);return}let fe=X.clientX<window.innerWidth/2?"left":"right",we=b+28,H=window.innerHeight-28,Y=Math.max(we,Math.min(H,X.clientY))/window.innerHeight*100;ue(fe),de(Y),B(null);try{localStorage.setItem("onyx-sidenav-side",fe),localStorage.setItem("onyx-sidenav-top",String(Y));}catch{}};window.addEventListener("pointermove",K),window.addEventListener("pointerup",oe),window.addEventListener("pointercancel",oe);},[b]);qr.useEffect(()=>{if(!h||typeof window>"u"||!window.matchMedia)return;let F=window.matchMedia(`(max-width: ${g-1}px)`),K=oe=>{q(oe.matches),oe.matches||W(false);};return F.addEventListener("change",K),()=>F.removeEventListener("change",K)},[h,g]);let ye=qr.useCallback(F=>{F.target.closest("a")&&W(false);},[]),y=qr.useRef(null),L=qr.useRef({startX:0,startY:0,dragging:false}),G=60,O=qr.useCallback(F=>{let K=F.touches[0];L.current={startX:K.clientX,startY:K.clientY,dragging:true};},[]),_=qr.useCallback(F=>{if(!L.current.dragging||!y.current)return;let K=F.touches[0],oe=K.clientX-L.current.startX,X=K.clientY-L.current.startY;if($==="left"){if(oe>=0||Math.abs(X)>Math.abs(oe))return;y.current.style.transform=`translateX(${Math.max(oe,-224)}px)`;}else {if(oe<=0||Math.abs(X)>Math.abs(oe))return;y.current.style.transform=`translateX(${Math.min(oe,224)}px)`;}y.current.style.transition="none";},[$]),ee=qr.useCallback(F=>{if(!L.current.dragging||!y.current)return;L.current.dragging=false;let K=F.changedTouches[0],oe=K.clientX-L.current.startX,X=K.clientY-L.current.startY;y.current.style.transition="",y.current.style.transform="",Math.abs(oe)>Math.abs(X)&&($==="left"&&oe<-G&&W(false),$==="right"&&oe>G&&W(false));},[$]),xe=qr.useMemo(()=>!k||!n?n:(F,K)=>{W(false),n(F,K);},[k,n]),P=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[i&&!k&&jsxRuntime.jsx("div",{className:s("flex shrink-0 mb-1",C==="expanded"?"justify-end":"justify-center"),children:jsxRuntime.jsx("button",{type:"button",onClick:U,className:Nr,"aria-label":C==="mini"?"Expand sidebar":"Collapse sidebar",title:C==="mini"?"Expand sidebar":"Collapse sidebar",children:C==="mini"?jsxRuntime.jsx(lucideReact.Menu,{className:"h-5 w-5"}):jsxRuntime.jsx(lucideReact.ChevronsLeft,{className:"h-4 w-4"})})}),(k||C==="expanded")&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[t&&jsxRuntime.jsx("h2",{className:"text-primary-500 dark:text-primary-400 mb-3 text-sm font-semibold uppercase",children:t}),e.map(F=>jsxRuntime.jsx($s,{item:F,basePath:r,depth:0,onItemClick:xe,LinkComponent:a,showLines:m,expandedKeys:I,onToggle:v},F.key??F.path??F.label))]}),!k&&C==="icons"&&e.map(F=>{let K=F.key??F.path??F.label;return F.children&&F.children.length>0?jsxRuntime.jsx(mp,{item:F,basePath:r,onItemClick:xe,LinkComponent:a},K):jsxRuntime.jsx(pp,{item:F,basePath:r,onItemClick:xe,LinkComponent:a},K)})]});if(h&&k){let F=re?re.side:$,K=re?re.y:J/100*(typeof window<"u"?window.innerHeight:600),oe=re?{top:K,transform:"translateY(-50%)",transition:"none",...F==="left"?{left:0}:{right:0}}:{top:`${J}%`,transform:"translateY(-50%)",transition:"top 0.15s ease",...$==="left"?{left:0}:{right:0}},X=$==="left"?{left:0,right:"auto"}:{right:0,left:"auto"},fe=M?"translate-x-0":$==="left"?"-translate-x-full":"translate-x-full",we=$==="left"?"border-r":"border-l";return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[M&&reactDom.createPortal(jsxRuntime.jsx("div",{className:"fixed inset-0 z-40 bg-black/50",style:{top:b},onClick:()=>W(false)}),document.body),reactDom.createPortal(jsxRuntime.jsxs("aside",{ref:y,className:s("fixed bottom-0 z-50 flex flex-col w-56 bg-white dark:bg-primary-900 shadow-xl transition-transform duration-200",we,"border-primary-200 dark:border-primary-700",fe),style:{top:b,...X},onClick:ye,onTouchStart:O,onTouchMove:_,onTouchEnd:ee,children:[jsxRuntime.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-primary-200 px-3 py-2 dark:border-primary-700",children:[jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-primary-500 dark:text-primary-400",children:"Navigation"}),jsxRuntime.jsx("button",{type:"button",onClick:H=>{H.stopPropagation(),W(false);},className:s(Nr,"h-7 w-7 p-1"),"aria-label":"Close navigation",children:jsxRuntime.jsx(lucideReact.X,{className:"h-4 w-4"})})]}),N&&jsxRuntime.jsx("div",{className:"shrink-0 border-b border-primary-200 px-3 py-2 dark:border-primary-700",children:N}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto overscroll-y-contain p-3",children:jsxRuntime.jsx("nav",{className:"flex flex-col gap-0.5",children:P})})]}),document.body),!M&&reactDom.createPortal(jsxRuntime.jsx("div",{className:s("fixed z-50 flex items-center",F==="left"?"justify-start":"justify-end",re?"cursor-grabbing":"cursor-grab"),style:{...oe,width:44,height:80,marginTop:-12,touchAction:"none",userSelect:"none"},onPointerDown:pe,onDragStart:H=>H.preventDefault(),role:"button","aria-label":"Open navigation",tabIndex:0,children:jsxRuntime.jsx("div",{className:s("flex h-16 w-6 items-center justify-center","bg-primary-800/80 text-white shadow-md backdrop-blur-sm","hover:bg-primary-700/90 dark:bg-primary-200/80 dark:text-primary-900 dark:hover:bg-primary-300/90",F==="left"?"rounded-r-xl":"rounded-l-xl"),children:F==="left"?jsxRuntime.jsx(lucideReact.ChevronRight,{className:"h-4 w-4"}):jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"h-4 w-4"})})}),document.body)]})}return jsxRuntime.jsx("nav",{className:s("flex flex-col gap-0.5",C==="mini"&&"items-center",u),...x,children:P})}function gp({href:e,className:t,onClick:r,children:n}){return jsxRuntime.jsx("a",{href:e,className:t,onClick:r,children:n})}function Bo({brand:e,onBrandClick:t,navItems:r=[],actions:n=[],linkComponent:a=gp,height:i="h-12",mobileMenu:o=false,navMenuIcon:l,actionsMenuIcon:c,className:m,children:d}){let f=o&&r.length>0,p=o&&n.length>0,u="md:hidden rounded-md px-1.5 py-1.5 text-primary-500 dark:text-primary-400 hover:text-primary-700 dark:hover:text-primary-200 [&_svg]:h-5 [&_svg]:w-5",h=x=>x?"text-primary-900 font-medium dark:text-primary-100":"text-primary-500 hover:text-primary-700 dark:text-primary-400 dark:hover:text-primary-200 transition-colors",g="rounded-md p-1.5 text-primary-500 hover:bg-primary-100 hover:text-primary-700 dark:text-primary-400 dark:hover:bg-primary-800 dark:hover:text-primary-200 transition-colors [&_svg]:h-5 [&_svg]:w-5",b=r.map((x,T)=>({key:typeof x.label=="string"?x.label:String(T),label:x.active?jsxRuntime.jsx("span",{className:"font-semibold text-primary-900 dark:text-primary-100",children:x.label}):x.label,onClick:()=>{x.onClick?x.onClick({preventDefault:()=>{},stopPropagation:()=>{}}):x.href&&(window.location.href=x.href);}})),N=n.map((x,T)=>({key:x.key??String(T),label:jsxRuntime.jsxs("span",{className:"flex items-center gap-2 [&_svg]:h-4 [&_svg]:w-4 [&_svg]:shrink-0",children:[x.icon,jsxRuntime.jsx("span",{children:x.ariaLabel})]}),onClick:()=>{x.onClick?x.onClick({preventDefault:()=>{},stopPropagation:()=>{}}):x.href&&(x.external?window.open(x.href,"_blank","noopener,noreferrer"):window.location.href=x.href);}}));return jsxRuntime.jsxs("header",{className:s("flex shrink-0 items-center justify-between border-b px-5","border-primary-200 bg-white dark:border-primary-700 dark:bg-primary-900",i,m),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 md:gap-6",children:[e&&jsxRuntime.jsx("div",{className:s("text-lg font-bold text-primary-800 dark:text-primary-100",t&&"cursor-pointer"),onClick:t,role:t?"button":void 0,tabIndex:t?0:void 0,onKeyDown:t?x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),t(x));}:void 0,children:e}),f&&jsxRuntime.jsx(hr,{intent:"ghost",size:"sm",className:u,label:l??jsxRuntime.jsx(lucideReact.PanelLeft,{className:"h-5 w-5"}),items:b,align:"left",chevron:false,"aria-label":"Open navigation"}),r.length>0&&jsxRuntime.jsx("nav",{className:s("flex items-center gap-4 text-sm",o?"hidden md:flex":"flex"),children:r.map((x,T)=>{let w=typeof x.label=="string"?x.label:T,C=h(x.active);return x.href?jsxRuntime.jsx(a,{href:x.href,className:C,onClick:x.onClick,children:x.label},w):jsxRuntime.jsx("button",{type:"button",className:s(C,"cursor-pointer"),onClick:x.onClick,children:x.label},w)})})]}),d&&jsxRuntime.jsx("div",{className:"flex items-center",children:d}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[n.length>0&&jsxRuntime.jsx("div",{className:s("flex items-center gap-1",o?"hidden md:flex":"flex"),children:n.map((x,T)=>x.href?jsxRuntime.jsx("a",{href:x.href,target:x.external?"_blank":void 0,rel:x.external?"noopener noreferrer":void 0,className:g,"aria-label":x.ariaLabel,onClick:x.onClick,children:x.icon},x.key??T):jsxRuntime.jsx("button",{type:"button",className:g,"aria-label":x.ariaLabel,onClick:x.onClick,children:x.icon},x.key??T))}),p&&jsxRuntime.jsx(hr,{intent:"ghost",size:"sm",className:u,label:c??jsxRuntime.jsx(lucideReact.MoreHorizontal,{className:"h-5 w-5"}),items:N,align:"right",chevron:false,"aria-label":"Open menu"})]})]})}var Zn=classVarianceAuthority.cva("inline-flex items-center gap-1 underline-offset-2 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/20 [&_svg]:shrink-0",{variants:{intent:{default:"text-primary-600 hover:text-primary-800 active:text-primary-900 dark:text-primary-400 dark:hover:text-primary-200 dark:active:text-primary-100",secondary:"text-secondary-500 hover:text-secondary-700 active:text-secondary-800 dark:text-secondary-400 dark:hover:text-secondary-200 dark:active:text-secondary-100",muted:"text-primary-400 hover:text-primary-600 dark:text-primary-500 dark:hover:text-primary-300"},size:{sm:"text-xs [&_svg]:h-3 [&_svg]:w-3",md:"text-sm [&_svg]:h-3.5 [&_svg]:w-3.5",lg:"text-base [&_svg]:h-4 [&_svg]:w-4"},underline:{always:"underline",hover:"hover:underline",none:"no-underline"}},defaultVariants:{intent:"default",size:"md",underline:"none"}});function hp(e,t){return !!(t==="_blank"||e&&/^https?:\/\//.test(e))}var yp=e=>jsxRuntime.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":true,...e,children:[jsxRuntime.jsx("path",{d:"M15 3h6v6"}),jsxRuntime.jsx("path",{d:"M10 14 21 3"}),jsxRuntime.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"})]});function Oo({intent:e,size:t,underline:r,external:n,className:a,children:i,href:o,target:l,rel:c,...m}){let d=n??hp(o,l);return jsxRuntime.jsxs("a",{href:o,target:d&&!l?"_blank":l,rel:d&&!c?"noopener noreferrer":c,className:s(Zn({intent:e,size:t,underline:r}),a),...m,children:[i,d&&jsxRuntime.jsx(yp,{})]})}function ta({items:e,separator:t=jsxRuntime.jsx(lucideReact.ChevronRight,{className:"h-3.5 w-3.5","aria-hidden":"true"}),homeIcon:r=false,LinkComponent:n="a",className:a}){return jsxRuntime.jsx("nav",{"aria-label":"Breadcrumb",className:s("flex",a),children:jsxRuntime.jsx("ol",{className:"flex flex-wrap items-center gap-1 text-sm",children:e.map((i,o)=>{let l=o===e.length-1,c=r===true?jsxRuntime.jsx(lucideReact.Home,{className:"h-3.5 w-3.5"}):r!==false&&r!==void 0?r:null,m=o===0&&c?c:i.icon;return jsxRuntime.jsxs("li",{className:"flex items-center gap-1",children:[o>0&&jsxRuntime.jsx("span",{className:"text-secondary-400 dark:text-secondary-500",children:t}),l?jsxRuntime.jsxs("span",{"aria-current":"page",className:s("flex items-center gap-1 font-medium text-primary-800 dark:text-primary-100",m&&"gap-1.5"),children:[m,i.label]}):i.href?jsxRuntime.jsxs(n,{href:i.href,className:s("flex items-center gap-1 text-secondary-500 transition-colors","hover:text-primary-700 dark:text-secondary-400 dark:hover:text-primary-200","rounded focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/30",m&&"gap-1.5"),children:[m,i.label]}):jsxRuntime.jsxs("span",{className:"flex items-center gap-1 text-secondary-500 dark:text-secondary-400",children:[m,i.label]})]},o)})})})}function ra(e,t){let r=[];for(let n=e;n<=t;n++)r.push(n);return r}function Mp(e,t,r){let n=r*2+5;if(t<=n)return ra(1,t);let a=Math.max(e-r,1),i=Math.min(e+r,t),o=a>2,l=i<t-1;return !o&&l?[...ra(1,3+r*2),"\u2026",t]:o&&!l?[1,"\u2026",...ra(t-(3+r*2)+1,t)]:[1,"\u2026",...ra(a,i),"\u2026",t]}var Xs={sm:"h-7 min-w-7 px-1.5 text-xs",md:"h-9 min-w-9 px-2 text-sm",lg:"h-11 min-w-11 px-2.5 text-base"},en={sm:"h-3.5 w-3.5",md:"h-4 w-4",lg:"h-5 w-5"};function tn({onClick:e,disabled:t,active:r,size:n,"aria-label":a,children:i}){return jsxRuntime.jsx("button",{type:"button",onClick:e,disabled:t,"aria-label":a,"aria-current":r?"page":void 0,className:s("inline-flex items-center justify-center rounded font-medium transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/30",Xs[n],r?"bg-primary-600 text-white dark:bg-primary-500":"border border-primary-200 bg-white text-primary-700 hover:bg-primary-50 dark:border-primary-700 dark:bg-primary-900 dark:text-primary-300 dark:hover:bg-primary-800",t&&"pointer-events-none opacity-40"),children:i})}function na({totalPages:e,currentPage:t,onPageChange:r,siblingCount:n=2,showFirstLast:a=true,showPageCount:i=false,size:o="md",className:l}){if(e<=1)return null;let c=Mp(t,e,n);return jsxRuntime.jsxs("nav",{"aria-label":"Pagination",className:s("flex items-center gap-1",l),children:[a&&jsxRuntime.jsx(tn,{size:o,onClick:()=>r(1),disabled:t===1,"aria-label":"First page",children:jsxRuntime.jsx(lucideReact.ChevronsLeft,{className:en[o]})}),jsxRuntime.jsx(tn,{size:o,onClick:()=>r(t-1),disabled:t===1,"aria-label":"Previous page",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:en[o]})}),c.map((m,d)=>m==="\u2026"?jsxRuntime.jsx("span",{className:s("inline-flex items-center justify-center text-secondary-400",Xs[o]),"aria-hidden":"true",children:jsxRuntime.jsx(lucideReact.MoreHorizontal,{className:en[o]})},`ellipsis-${d}`):jsxRuntime.jsx(tn,{size:o,active:m===t,onClick:()=>r(m),"aria-label":`Page ${m}`,children:m},m)),jsxRuntime.jsx(tn,{size:o,onClick:()=>r(t+1),disabled:t===e,"aria-label":"Next page",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:en[o]})}),a&&jsxRuntime.jsx(tn,{size:o,onClick:()=>r(e),disabled:t===e,"aria-label":"Last page",children:jsxRuntime.jsx(lucideReact.ChevronsRight,{className:en[o]})}),i&&jsxRuntime.jsxs("span",{className:"ml-2 text-sm text-secondary-500 dark:text-secondary-400",children:["Page ",t," of ",e]})]})}function Ws({item:e,mode:t}){return e.separator?jsxRuntime.jsx("div",{className:"mx-1 h-10 w-px self-center bg-primary-200 dark:bg-primary-700","aria-hidden":true}):jsxRuntime.jsxs("button",{type:"button",title:e.title??e.label,disabled:e.disabled,onClick:e.onClick,"aria-pressed":e.active,className:s("relative flex shrink-0 items-center justify-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition-all duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-400","disabled:cursor-not-allowed disabled:opacity-40",e.active?"bg-primary-100 text-primary-700 shadow-inner dark:bg-primary-800 dark:text-primary-200":"text-primary-700 hover:bg-primary-50 active:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-800",t==="full"?"min-w-[3.5rem] flex-col gap-0.5 py-2":"","[&_svg]:shrink-0",t==="full"?"[&_svg]:h-5 [&_svg]:w-5":"[&_svg]:h-4 [&_svg]:w-4"),children:[e.icon&&jsxRuntime.jsx("span",{children:e.icon}),t!=="icons"&&jsxRuntime.jsx("span",{className:s(t==="full"?"text-[0.6rem] leading-tight":""),children:e.label})]})}function Dp({group:e,mode:t,disabled:r=false}){return jsxRuntime.jsxs("div",{className:s("flex shrink-0 flex-col items-stretch",r&&"opacity-50"),children:[jsxRuntime.jsx("div",{className:"flex items-center gap-0.5 px-1",children:e.items.map(n=>jsxRuntime.jsx(Ws,{item:r?{...n,disabled:true}:n,mode:t},n.key))}),t==="full"&&jsxRuntime.jsx("div",{className:"mt-1 border-t border-primary-100 px-2 pt-0.5 text-center dark:border-primary-800",children:jsxRuntime.jsx("span",{className:"text-[0.55rem] text-secondary-400 dark:text-secondary-500",children:e.label})})]})}function Yo({tabs:e,defaultTab:t,activeTab:r,onTabChange:n,mode:a,onModeChange:i,sticky:o=false,className:l}){let c=e.filter(w=>!w.hidden),[m,d]=qr.useState(t??c[0]?.key??""),[f,p]=qr.useState(a??"full"),[u,h]=qr.useState(true),g=r??m,b=a??f,N=w=>{if(!c.find(S=>S.key===w)?.disabled){if(w===g&&b!=="icons"){h(S=>!S);return}d(w),n?.(w),h(true);}},T=c.find(w=>w.key===g)??c[0];return jsxRuntime.jsxs("div",{className:s("select-none border-b border-primary-200 bg-white dark:border-primary-700 dark:bg-primary-900",o&&"sticky top-0 z-30",l),children:[jsxRuntime.jsxs("div",{className:"flex items-center border-b border-primary-100 dark:border-primary-800",children:[jsxRuntime.jsx("div",{className:"flex flex-1 items-end overflow-x-auto",children:c.map(w=>jsxRuntime.jsxs("button",{type:"button",disabled:w.disabled,onClick:()=>N(w.key),className:s("flex shrink-0 items-center gap-1.5 border-b-2 px-4 py-2 text-sm font-medium transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-400 [&_svg]:h-4 [&_svg]:w-4",w.disabled?"cursor-not-allowed border-transparent text-secondary-300 opacity-50 dark:text-secondary-600":w.key===g&&u?"border-primary-500 text-primary-700 dark:border-primary-400 dark:text-primary-200":"border-transparent text-secondary-500 hover:border-primary-300 hover:text-primary-600 dark:text-secondary-400 dark:hover:text-primary-300"),children:[w.icon,w.label]},w.key))}),jsxRuntime.jsx("button",{type:"button",title:u?"Collapse ribbon":"Expand ribbon",onClick:()=>h(w=>!w),className:"ml-auto mr-2 rounded-md p-1.5 text-secondary-400 transition-colors hover:bg-primary-50 hover:text-primary-600 dark:hover:bg-primary-800 dark:hover:text-primary-300",children:u?jsxRuntime.jsx(lucideReact.ChevronUp,{className:"h-4 w-4"}):jsxRuntime.jsx(lucideReact.ChevronDown,{className:"h-4 w-4"})})]}),u&&T&&b!=="icons"&&jsxRuntime.jsx("div",{className:"flex items-stretch gap-1 overflow-x-auto px-2 py-1.5",children:T.groups.map((w,C)=>jsxRuntime.jsxs(qr__default.default.Fragment,{children:[C>0&&jsxRuntime.jsx("div",{className:"mx-1 h-auto w-px self-stretch bg-primary-100 dark:bg-primary-800"}),jsxRuntime.jsx(Dp,{group:w,mode:b,disabled:w.disabled||T.disabled})]},w.key))}),b==="icons"&&u&&T&&jsxRuntime.jsx("div",{className:"flex items-center gap-0.5 overflow-x-auto px-2 py-1",children:T.groups.flatMap(w=>w.items.map(C=>jsxRuntime.jsx(Ws,{item:w.disabled||T.disabled?{...C,disabled:true}:C,mode:"icons"},C.key)))})]})}var Lp={SideNav:zo,Header:Bo,NavLink:Oo,Breadcrumb:ta,Pagination:na,RibbonBar:Yo},Ko=Lp;var aa=classVarianceAuthority.cva("flex w-full items-center justify-between font-medium transition-all [&_svg]:shrink-0",{variants:{size:{sm:"py-2 text-xs [&_svg]:h-3.5 [&_svg]:w-3.5",md:"py-3 text-sm [&_svg]:h-4 [&_svg]:w-4",lg:"py-4 text-base [&_svg]:h-5 [&_svg]:w-5"}},defaultVariants:{size:"md"}}),oa=classVarianceAuthority.cva("",{variants:{size:{sm:"pb-2 text-xs",md:"pb-3 text-sm",lg:"pb-4 text-base"}},defaultVariants:{size:"md"}}),ia=classVarianceAuthority.cva("divide-y",{variants:{intent:{default:"divide-primary-300 dark:divide-primary-700",bordered:"divide-primary-300 rounded-lg border border-primary-300 bg-white px-3 shadow-sm dark:divide-primary-700 dark:border-primary-700 dark:bg-primary-800/50",ghost:"divide-transparent"}},defaultVariants:{intent:"default"}}),sa=classVarianceAuthority.cva("flex",{variants:{intent:{line:"border-b border-primary-200 dark:border-primary-700",pills:"gap-1 rounded-lg bg-primary-100 p-1 dark:bg-primary-800",underline:"gap-4"}},defaultVariants:{intent:"line"}}),la=classVarianceAuthority.cva("inline-flex cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap px-3 py-1.5 text-sm font-medium transition-all focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:h-4 [&_svg]:w-4 [&_svg]:shrink-0",{variants:{intent:{line:"text-primary-500 hover:text-primary-700 data-[active=true]:text-primary-900 dark:text-primary-400 dark:hover:text-primary-200 dark:data-[active=true]:text-primary-100",pills:"rounded-md text-primary-600 hover:text-primary-900 data-[active=true]:bg-white data-[active=true]:text-primary-900 data-[active=true]:shadow-sm dark:text-primary-400 dark:hover:text-primary-100 dark:data-[active=true]:bg-primary-700 dark:data-[active=true]:text-primary-100",underline:"text-primary-500 hover:text-primary-700 data-[active=true]:text-primary-900 dark:text-primary-400 dark:data-[active=true]:text-primary-100"}},defaultVariants:{intent:"line"}});var ca=qr.createContext(null),Xo=qr.createContext(null);function Wo({type:e="single",defaultValue:t=[],value:r,onValueChange:n,intent:a,size:i,className:o,children:l,...c}){let[m,d]=qr.useState(t),f=r??m,p=qr.useCallback(u=>{let h=g=>g.includes(u)?g.filter(b=>b!==u):e==="single"?[u]:[...g,u];n?n(h(f)):d(h);},[e,f,n]);return jsxRuntime.jsx(ca.Provider,{value:{expandedItems:f,toggleItem:p,size:i},children:jsxRuntime.jsx("div",{className:s(ia({intent:a}),o),...c,children:l})})}function Ap({value:e,className:t,children:r,...n}){let i=qr.useContext(ca)?.expandedItems.includes(e)??false;return jsxRuntime.jsx(Xo.Provider,{value:{value:e,isExpanded:i},children:jsxRuntime.jsx("div",{className:s("",t),...n,children:r})})}function Hp({className:e,children:t,...r}){let n=qr.useContext(ca),a=qr.useContext(Xo);return jsxRuntime.jsxs("button",{className:s("text-primary-800 hover:text-primary-600 dark:text-primary-100 dark:hover:text-primary-300 cursor-pointer gap-2 font-medium transition-colors",aa({size:n?.size}),e),onClick:()=>a&&n?.toggleItem(a.value),"aria-expanded":a?.isExpanded?"true":"false",...r,children:[jsxRuntime.jsx("span",{className:"flex items-center gap-1.5 [&_svg]:shrink-0",children:t}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:s("shrink-0 transition-transform duration-200",a?.isExpanded&&"rotate-180")})]})}function Fp({className:e,children:t,...r}){let n=qr.useContext(ca),a=qr.useContext(Xo);return jsxRuntime.jsx("div",{className:s("grid transition-[grid-template-rows] duration-200 ease-out",a?.isExpanded?"grid-rows-[1fr]":"grid-rows-[0fr]"),children:jsxRuntime.jsx("div",{className:"overflow-hidden",children:jsxRuntime.jsx("div",{className:s("text-primary-500 dark:text-primary-400",oa({size:n?.size}),e),...r,children:t})})})}var on=qr.createContext(null),Zs=qr.createContext(false);function jo({defaultValue:e="",value:t,onValueChange:r,intent:n,children:a,className:i}){let[o,l]=qr.useState(e),c=t??o,m=qr.useRef(new Map),d=qr.useCallback(p=>{r?r(p):l(p);},[r]),f=qr.useCallback((p,u)=>{u?m.current.set(p,u):m.current.delete(p);},[]);return jsxRuntime.jsx(on.Provider,{value:{activeValue:c,setActiveValue:d,intent:n,registerTrigger:f},children:jsxRuntime.jsx("div",{className:i,children:a})})}function Op({className:e,scrollable:t,...r}){let n=qr.useContext(on),a=qr.useRef(null),[i,o]=qr.useState(null),l=qr.useCallback(()=>{if(!n||!a.current)return;let f=a.current.querySelectorAll('[role="tab"][data-active="true"]')[0];if(!f){o(null);return}let p=a.current.getBoundingClientRect(),u=f.getBoundingClientRect();o({left:u.left-p.left,width:u.width});},[n]);qr.useLayoutEffect(l,[n?.activeValue,l]),qr.useEffect(()=>{let d=new ResizeObserver(l);return a.current&&d.observe(a.current),()=>d.disconnect()},[l]);let c=n?.intent??"line",m=i&&(c==="line"||c==="underline");return jsxRuntime.jsxs("div",{ref:a,className:s(sa({intent:n?.intent}),"relative",t&&"overflow-x-auto",e),role:"tablist",...r,children:[r.children,m&&jsxRuntime.jsx("span",{className:"absolute bottom-0 h-0.5 rounded-full bg-primary-600 dark:bg-primary-400 transition-all duration-300 ease-in-out",style:{left:i.left,width:i.width},"aria-hidden":true})]})}function $p({value:e,className:t,children:r,...n}){let a=qr.useContext(on),i=a?.activeValue===e,o=qr.useCallback(l=>a?.registerTrigger(e,l),[a,e]);return jsxRuntime.jsx("button",{ref:o,className:s(la({intent:a?.intent}),t),role:"tab","data-active":i,"aria-selected":i,onClick:()=>a?.setActiveValue(e),...n,children:r})}function Yp({className:e,children:t,...r}){let n=qr.useContext(on);if(!n)return null;let a=qr__default.default.Children.toArray(t).filter(o=>qr__default.default.isValidElement(o)),i=Math.max(0,a.findIndex(o=>o.props.value===n.activeValue));return jsxRuntime.jsx("div",{className:s("overflow-hidden",e),...r,children:jsxRuntime.jsx(Zs.Provider,{value:true,children:jsxRuntime.jsx("div",{className:"flex transition-transform duration-300 ease-in-out",style:{transform:`translateX(-${i*100}%)`},children:a.map((o,l)=>jsxRuntime.jsx("div",{className:"w-full shrink-0","aria-hidden":l!==i,children:o},o.props.value??l))})})})}function Kp({value:e,className:t,children:r,...n}){let a=qr.useContext(on);return qr.useContext(Zs)?jsxRuntime.jsx("div",{className:s("pt-4",t),role:"tabpanel",...n,children:r}):a?.activeValue!==e?null:jsxRuntime.jsx("div",{className:s("pt-4",t),role:"tabpanel",...n,children:r})}var Wp={Accordion:Wo,Tabs:jo},Go=Wp;var sn=classVarianceAuthority.cva("rounded-lg bg-white p-6 shadow-xl dark:bg-primary-900",{variants:{size:{sm:"w-full max-w-sm",md:"w-full max-w-lg",lg:"w-full max-w-2xl",xl:"w-full max-w-4xl",full:"h-[calc(100vh-4rem)] w-[calc(100vw-4rem)]"}},defaultVariants:{size:"md"}}),ma=classVarianceAuthority.cva("absolute z-50 rounded px-2 py-1 text-xs shadow-md animate-fade-in",{variants:{intent:{default:"bg-primary-900 text-white dark:bg-primary-100 dark:text-primary-900",light:"border border-primary-200 bg-white text-primary-700 dark:border-primary-600 dark:bg-primary-800 dark:text-primary-200"}},defaultVariants:{intent:"default"}});var _t=[];function Qp(e){_t.push(e);}function Zp(e){let t=_t.indexOf(e);t!==-1&&_t.splice(t,1);}function qo(e){return _t.length>0&&_t[_t.length-1]===e}function Jp(e){let t=_t.indexOf(e);return t!==-1?t:_t.length}var Qo=qr.createContext(null);function ln({open:e,onOpenChange:t,modal:r=true,closeOnOutsideClick:n=false,children:a}){let i=qr.useId();return qr.useEffect(()=>{if(e)return Qp(i),()=>Zp(i)},[e,i]),qr.useEffect(()=>{if(!e||!r)return;let o=l=>{l.key==="Escape"&&qo(i)&&t(false);};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[e,r,t,i]),qr.useEffect(()=>{if(!e||!r)return;let o=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=o;}},[e,r]),e?jsxRuntime.jsx(Qo.Provider,{value:{id:i,onOpenChange:t,modal:r,closeOnOutsideClick:n},children:reactDom.createPortal(a,document.body)}):null}function Zo({size:e,position:t="center",className:r,children:n,...a}){let i=qr.useContext(Qo);if(!i)return null;let l=200+Jp(i.id)*10,c=()=>{i.closeOnOutsideClick&&qo(i.id)&&i.onOpenChange(false);},m=t==="bottom";return i.modal?jsxRuntime.jsx("div",{className:s("animate-fade-in fixed inset-0 bg-black/50",m?"flex items-end justify-center":"flex items-center justify-center p-4"),style:{zIndex:l},onClick:c,children:jsxRuntime.jsx("div",{className:s(sn({size:e}),m?"animate-slide-in-bottom w-full rounded-b-none rounded-t-(--dialog-sheet-radius) max-h-[85vh] overflow-y-auto":"animate-scale-in",r),role:"dialog","aria-modal":"true",onClick:d=>d.stopPropagation(),...a,children:n})}):jsxRuntime.jsx("div",{className:s("fixed inset-0 flex items-center justify-center p-4",i.closeOnOutsideClick?"pointer-events-auto":"pointer-events-none"),style:{zIndex:l},onClick:i.closeOnOutsideClick&&qo(i.id)?()=>i.onOpenChange(false):void 0,children:jsxRuntime.jsx("div",{className:s(sn({size:e}),"animate-scale-in pointer-events-auto shadow-2xl",r),role:"dialog",onClick:i.closeOnOutsideClick?d=>d.stopPropagation():void 0,...a,children:n})})}function Jo({className:e,...t}){return jsxRuntime.jsx("div",{className:s("mb-4 space-y-1",e),...t})}function ei({className:e,...t}){return jsxRuntime.jsx("h2",{className:s("text-primary-900 dark:text-primary-100 flex items-center gap-1.5 text-lg font-semibold [&_svg]:h-5 [&_svg]:w-5 [&_svg]:shrink-0",e),...t})}function ti({className:e,...t}){return jsxRuntime.jsx("p",{className:s("text-primary-500 dark:text-primary-400 text-sm",e),...t})}function ri({className:e,...t}){return jsxRuntime.jsx("div",{className:s("mt-6 flex justify-end gap-2",e),...t})}function eu({className:e,...t}){let r=qr.useContext(Qo);return jsxRuntime.jsx("button",{className:s("text-primary-400 hover:text-primary-600 dark:hover:text-primary-200 absolute top-4 right-4 rounded-md p-1 transition-colors",e),onClick:()=>r?.onOpenChange(false),"aria-label":"Close",...t,children:jsxRuntime.jsx(lucideReact.X,{className:"h-4 w-4"})})}var tu={top:"bottom-full left-1/2 -translate-x-1/2 mb-2",bottom:"top-full left-1/2 -translate-x-1/2 mt-2",left:"right-full top-1/2 -translate-y-1/2 mr-2",right:"left-full top-1/2 -translate-y-1/2 ml-2"};function ni({content:e,position:t="top",intent:r,delay:n=200,maxWidth:a,children:i,className:o}){let[l,c]=qr.useState(false),[m,d]=qr.useState();return jsxRuntime.jsxs("span",{className:"relative inline-flex",onMouseEnter:()=>{let u=setTimeout(()=>c(true),n);d(u);},onMouseLeave:()=>{clearTimeout(m),c(false);},children:[i,l&&jsxRuntime.jsx("span",{className:s(ma({intent:r}),tu[t],"pointer-events-none",a?"whitespace-normal":"whitespace-nowrap",o),style:a!==void 0?{maxWidth:a}:void 0,role:"tooltip",children:e})]})}var su={right:"drawer-enter-right",left:"drawer-enter-left",top:"drawer-enter-top",bottom:"drawer-enter-bottom"},lu={right:e=>({width:e}),left:e=>({width:e}),top:e=>({height:e}),bottom:e=>({height:e})},cu={right:"right-0 top-0 bottom-0",left:"left-0 top-0 bottom-0",top:"top-0 left-0 right-0",bottom:"bottom-0 left-0 right-0"};function pa({open:e,onOpenChange:t,side:r="right",size:n=r==="top"||r==="bottom"?"50vh":"24rem",backdrop:a=true,closeOnBackdropClick:i=true,children:o,className:l}){let c=qr.useRef(null);return qr.useEffect(()=>{if(!e)return;let m=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=m;}},[e]),qr.useEffect(()=>{if(!e)return;function m(d){d.key==="Escape"&&t(false);}return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[e,t]),qr.useEffect(()=>{if(!e)return;let m=c.current;if(!m)return;let d=m.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');d[0]?.focus();function f(p){p.key!=="Tab"||d.length===0||(p.shiftKey?document.activeElement===d[0]&&(p.preventDefault(),d[d.length-1].focus()):document.activeElement===d[d.length-1]&&(p.preventDefault(),d[0].focus()));}return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[e]),e?reactDom.createPortal(jsxRuntime.jsxs("div",{className:"fixed inset-0 z-50",role:"presentation",children:[a&&jsxRuntime.jsx("div",{className:"drawer-backdrop absolute inset-0 bg-black/40 backdrop-blur-[2px]",onClick:()=>i&&t(false),"aria-hidden":"true"}),jsxRuntime.jsx("div",{ref:c,role:"dialog","aria-modal":"true",className:s("drawer-panel absolute flex flex-col","bg-white shadow-2xl dark:bg-primary-900",cu[r],su[r],l),style:lu[r](n),children:o})]}),document.body):null}function rl({children:e,className:t}){return jsxRuntime.jsx("div",{className:s("flex shrink-0 items-center justify-between border-b border-primary-100 px-5 py-4 dark:border-primary-800",t),children:e})}function nl({children:e,className:t}){return jsxRuntime.jsx("div",{className:s("flex-1 overflow-y-auto px-5 py-4",t),children:e})}function al({children:e,className:t}){return jsxRuntime.jsx("div",{className:s("flex shrink-0 items-center justify-end gap-3 border-t border-primary-100 px-5 py-4 dark:border-primary-800",t),children:e})}function ol({onClose:e,className:t}){return jsxRuntime.jsx("button",{type:"button",onClick:e,"aria-label":"Close drawer",className:s("rounded-md p-1.5 text-secondary-400 transition-colors","hover:bg-primary-100 hover:text-primary-700 dark:hover:bg-primary-800 dark:hover:text-primary-200","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/30",t),children:jsxRuntime.jsx(lucideReact.X,{className:"h-4 w-4"})})}function il({item:e,depth:t=0,onClose:r}){let[n,a]=qr.useState(false),i=qr.useRef(null),o=qr.useRef(null),l=e.children&&e.children.length>0,c=qr.useRef(null),m=()=>{c.current=setTimeout(()=>a(false),150);},d=()=>{c.current&&clearTimeout(c.current);};return e.separator?jsxRuntime.jsx("li",{role:"separator",className:"my-1 h-px bg-primary-100 dark:bg-primary-700","aria-hidden":true}):jsxRuntime.jsxs("li",{ref:i,role:"menuitem","aria-disabled":e.disabled,"aria-haspopup":l,"aria-expanded":l?n:void 0,className:s("relative flex cursor-pointer select-none items-center gap-2 rounded-md px-3 py-1.5 text-sm outline-none transition-colors",e.disabled?"cursor-not-allowed opacity-40":e.danger?"text-danger-600 hover:bg-danger-50 focus-visible:bg-danger-50 dark:text-danger-400 dark:hover:bg-danger-900/30":"text-primary-700 hover:bg-primary-50 focus-visible:bg-primary-50 dark:text-primary-200 dark:hover:bg-primary-800"),tabIndex:e.disabled?-1:0,onMouseEnter:()=>{d(),l&&a(true);},onMouseLeave:()=>{l&&m();},onClick:f=>{e.disabled||l||(e.onClick?.(f),r());},onKeyDown:f=>{e.disabled||((f.key==="Enter"||f.key===" ")&&(f.preventDefault(),l?a(p=>!p):(e.onClick?.(f),r())),f.key==="Escape"&&r());},children:[e.icon?jsxRuntime.jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center [&_svg]:h-4 [&_svg]:w-4",children:e.icon}):jsxRuntime.jsx("span",{className:"h-4 w-4 shrink-0"}),jsxRuntime.jsx("span",{className:"flex-1",children:e.label}),e.shortcut&&!l&&jsxRuntime.jsx("kbd",{className:"ml-auto rounded bg-primary-100 px-1.5 py-0.5 font-mono text-[0.6rem] text-secondary-500 dark:bg-primary-700 dark:text-secondary-400",children:e.shortcut}),l&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"ml-auto h-3.5 w-3.5 text-secondary-400"}),l&&n&&jsxRuntime.jsx("ul",{ref:o,role:"menu",onMouseEnter:d,onMouseLeave:m,className:s("absolute top-0 z-50 min-w-[11rem] animate-[fade-in_120ms_ease-out,scale-in_120ms_ease-out] rounded-xl border border-primary-200 bg-white p-1.5 shadow-xl dark:border-primary-700 dark:bg-primary-900",t%2===0?"left-full ml-1":"right-full mr-1"),children:e.children.map(f=>jsxRuntime.jsx(il,{item:f,depth:t+1,onClose:r},f.key))})]})}function pu({items:e,position:t,onClose:r}){let n=qr.useRef(null),[a,i]=qr.useState(t);return qr.useEffect(()=>{let o=n.current;if(!o)return;let l=o.getBoundingClientRect(),c=window.innerWidth,m=window.innerHeight,{x:d,y:f}=t;d+l.width>c-8&&(d=Math.max(8,c-l.width-8)),f+l.height>m-8&&(f=Math.max(8,m-l.height-8)),i({x:d,y:f});},[t]),qr.useEffect(()=>{let o=l=>{n.current&&!n.current.contains(l.target)&&r();};return document.addEventListener("mousedown",o,true),document.addEventListener("touchstart",o,true),document.addEventListener("scroll",r,{passive:true,capture:true}),()=>{document.removeEventListener("mousedown",o,true),document.removeEventListener("touchstart",o,true),document.removeEventListener("scroll",r,true);}},[r]),qr.useEffect(()=>{let o=l=>{l.key==="Escape"&&r(),l.key==="Tab"&&l.preventDefault();};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[r]),jsxRuntime.jsx("ul",{ref:n,role:"menu",style:{position:"fixed",left:a.x,top:a.y},className:"z-[9999] min-w-[12rem] animate-[fade-in_120ms_ease-out,scale-in_120ms_ease-out] rounded-xl border border-primary-200 bg-white p-1.5 shadow-2xl dark:border-primary-700 dark:bg-primary-900",children:e.map(o=>jsxRuntime.jsx(il,{item:o,onClose:r},o.key))})}function ii({items:e,children:t,disabled:r,onOpenChange:n,className:a}){let[i,o]=qr.useState(false),[l,c]=qr.useState({x:0,y:0}),m=qr.useRef(null),d=qr.useCallback((g,b)=>{r||(c({x:g,y:b}),o(true),n?.(true));},[r,n]),f=qr.useCallback(()=>{o(false),n?.(false);},[n]),p=qr.useCallback(g=>{g.preventDefault(),g.stopPropagation(),d(g.clientX,g.clientY);},[d]),u=qr.useCallback(g=>{let b=g.touches[0];m.current=setTimeout(()=>{document.addEventListener("contextmenu",N=>N.preventDefault(),{capture:true,once:true}),d(b.clientX,b.clientY);},500);},[d]),h=qr.useCallback(()=>{m.current&&clearTimeout(m.current);},[]);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:s("contents",a),style:{WebkitTouchCallout:"none",userSelect:"none"},onContextMenu:p,onTouchStart:u,onTouchEnd:h,onTouchMove:h,onTouchCancel:h,children:t}),i&&jsxRuntime.jsx(pu,{items:e,position:l,onClose:f})]})}var fu={Dialog:ln,Tooltip:ni,Drawer:pa,ContextMenu:ii},si=fu;var fa=classVarianceAuthority.cva("relative w-full overflow-hidden rounded-full bg-primary-200 dark:bg-primary-700",{variants:{size:{xs:"h-1",sm:"h-2",md:"h-3",lg:"h-4"},intent:{primary:"[&_.progress-fill]:bg-primary-500",success:"[&_.progress-fill]:bg-success-500",warning:"[&_.progress-fill]:bg-warning-500",danger:"[&_.progress-fill]:bg-danger-500"},edge:{none:"rounded-full",top:"fixed top-0 left-0 right-0 z-50 rounded-none",bottom:"fixed bottom-0 left-0 right-0 z-50 rounded-none"}},defaultVariants:{size:"md",intent:"primary",edge:"none"}}),Tr=classVarianceAuthority.cva("text-primary-500 dark:text-primary-400",{variants:{size:{sm:"text-xs",md:"text-sm",lg:"text-base"}},defaultVariants:{size:"md"}}),pn=classVarianceAuthority.cva("pointer-events-auto flex items-start gap-3 rounded-lg border p-4 shadow-lg transition-all",{variants:{intent:{success:"border-success-200 bg-success-50 text-success-800 dark:border-success-800 dark:bg-success-900/80 dark:text-success-200",warning:"border-warning-200 bg-warning-50 text-warning-800 dark:border-warning-800 dark:bg-warning-900/80 dark:text-warning-200",error:"border-danger-200 bg-danger-50 text-danger-800 dark:border-danger-800 dark:bg-danger-900/80 dark:text-danger-200",info:"border-primary-200 bg-primary-50 text-primary-800 dark:border-primary-800 dark:bg-primary-900/80 dark:text-primary-200"}},defaultVariants:{intent:"info"}}),un=classVarianceAuthority.cva("skeleton-base bg-secondary-200 dark:bg-secondary-700",{variants:{variant:{text:"skeleton-text w-full rounded-sm",circular:"rounded-full",rectangular:"rounded-none",rounded:"rounded-md"},animation:{pulse:"animate-pulse",wave:"skeleton-wave",none:""}},defaultVariants:{variant:"text",animation:"pulse"}}),ga=classVarianceAuthority.cva("border",{variants:{variant:{default:"bg-primary-800 text-primary-50 border-primary-700 dark:bg-primary-100 dark:text-primary-900 dark:border-primary-200",success:"bg-success-500 text-white border-success-600 dark:bg-success-600 dark:border-success-700",danger:"bg-danger-500 text-white border-danger-600 dark:bg-danger-600 dark:border-danger-700",warning:"bg-warning-500 text-warning-900 border-warning-600 dark:bg-warning-600 dark:text-white dark:border-warning-700",info:"bg-primary-500 text-white border-primary-600 dark:bg-primary-600 dark:border-primary-700"}},defaultVariants:{variant:"default"}});function mi({intent:e,className:t,children:r,...n}){return jsxRuntime.jsx("div",{className:s(pn({intent:e}),t),role:"alert",...n,children:r})}function Cu({className:e,...t}){return jsxRuntime.jsx("h5",{className:s("flex items-center gap-1.5 font-semibold [&_svg]:h-4 [&_svg]:w-4 [&_svg]:shrink-0",e),...t})}function Tu({className:e,...t}){return jsxRuntime.jsx("span",{className:s("mt-0.5 shrink-0 [&_svg]:h-5 [&_svg]:w-5",e),...t})}function Mu({className:e,...t}){return jsxRuntime.jsx("div",{className:s("flex-1 min-w-0 space-y-1",e),...t})}function Ru({className:e,...t}){return jsxRuntime.jsx("p",{className:s("text-sm opacity-90",e),...t})}var Su=0,ir=[],ba=new Map,li=new Set;function Pu(){return ir}function ci(){li.forEach(e=>e());}function pi(e){let t=ba.get(e);t&&(clearTimeout(t),ba.delete(e)),ir=ir.map(r=>r.id===e?{...r,exiting:true}:r),ci(),setTimeout(()=>{ir=ir.filter(r=>r.id!==e),ci();},200);}function Du(e){let t=`alert-${++Su}`;ir=[...ir,{...e,id:t}],ci();let r=e.duration??5e3;if(r>0){let n=setTimeout(()=>{ba.delete(t),pi(t);},r);ba.set(t,n);}return t}var di=16;function Lu(e){di=e;}var Eu={"top-right":"right-4 items-end","top-left":"left-4 items-start","bottom-right":"bottom-4 right-4 items-end","bottom-left":"bottom-4 left-4 items-start","top-center":"left-1/2 -translate-x-1/2 items-center","bottom-center":"bottom-4 left-1/2 -translate-x-1/2 items-center"},Vu={"top-right":"animate-slide-in-right","top-left":"animate-slide-in-left","bottom-right":"animate-slide-in-right","bottom-left":"animate-slide-in-left","top-center":"animate-slide-in-top","bottom-center":"animate-slide-in-bottom"},Iu={success:lucideReact.CircleCheck,warning:lucideReact.TriangleAlert,error:lucideReact.CircleX,info:lucideReact.Info};function Au({alert:e,onClose:t}){let r=e.intent??"info",n=Iu[r],a=e.position??"top-right";return jsxRuntime.jsxs("div",{className:s(pn({intent:r}),Vu[a],e.exiting&&"opacity-0 transition-opacity duration-200","w-80 max-w-[calc(100vw-2rem)]"),role:"alert",children:[jsxRuntime.jsx(n,{className:"mt-0.5 h-5 w-5 shrink-0"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[e.title&&jsxRuntime.jsx("p",{className:"font-semibold",children:e.title}),jsxRuntime.jsx("p",{className:s(e.title&&"text-sm opacity-90"),children:e.message})]}),jsxRuntime.jsx("button",{onClick:t,"aria-label":"Close notification",className:"shrink-0 cursor-pointer opacity-50 transition-opacity hover:opacity-100",children:jsxRuntime.jsx(lucideReact.X,{className:"h-4 w-4"})})]})}var Hu=e=>e.startsWith("top");function Fu(){let e=qr.useSyncExternalStore(n=>(li.add(n),()=>li.delete(n)),Pu),t=qr.useRef(di);if(qr.useEffect(()=>{t.current=di;},[]),e.length===0)return null;let r=e.reduce((n,a)=>{let i=a.position??"top-right";return (n[i]??(n[i]=[])).push(a),n},{});return reactDom.createPortal(jsxRuntime.jsx(jsxRuntime.Fragment,{children:Object.entries(r).map(([n,a])=>jsxRuntime.jsx("div",{style:Hu(n)?{top:`${t.current}px`}:void 0,className:s("pointer-events-none fixed z-100 flex flex-col gap-2",Eu[n]),children:a.map(i=>jsxRuntime.jsx(Au,{alert:i,onClose:()=>pi(i.id)},i.id))},n))}),document.body)}var ll=false;function _u(){if(ll)return;ll=true;let e=document.createElement("div");e.id="alert-toast-root",document.body.appendChild(e),client.createRoot(e).render(jsxRuntime.jsx(Fu,{}));}function zu(){return qr.useEffect(()=>{_u();},[]),{addAlert:Du,removeAlert:pi}}function fi({value:e=0,size:t,intent:r,edge:n,showLabel:a=false,indeterminate:i=false,animated:o=false,duration:l=500,className:c,...m}){let d=Math.max(0,Math.min(100,e)),[f,p]=qr.useState(0),u=qr.useRef(0);qr.useEffect(()=>{if(!i)return u.current=requestAnimationFrame(()=>{p(d);}),()=>{u.current&&cancelAnimationFrame(u.current);}},[d,i]);let h=a&&!i&&t!=="xs"&&t!=="sm",g=jsxRuntime.jsx("div",{role:"progressbar","aria-valuenow":i?void 0:d,"aria-valuemin":0,"aria-valuemax":100,className:s(fa({size:t,intent:r,edge:n}),c),...m,children:i?jsxRuntime.jsx("div",{className:"progress-fill absolute top-0 h-full rounded-full animate-progress-indeterminate"}):jsxRuntime.jsx("div",{className:s("progress-fill h-full rounded-full transition-[width] ease-out",o&&"animate-progress-shine"),style:{width:`${f}%`,transitionDuration:`${l}ms`},children:h&&jsxRuntime.jsxs("span",{className:"flex h-full items-center justify-end pr-2 text-[10px] font-semibold text-white",children:[Math.round(d),"%"]})})});return n==="top"||n==="bottom"?reactDom.createPortal(g,document.body):g}function ha({size:e}){let t=e==="sm"?20:e==="lg"?40:28;return jsxRuntime.jsx("svg",{className:"animate-spin-rotate",width:t,height:t,viewBox:"0 0 50 50",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("circle",{className:"animate-spin-dash stroke-current",cx:"25",cy:"25",r:"20",fill:"none",strokeWidth:"4",strokeLinecap:"round",strokeDasharray:"90 150",strokeDashoffset:"0"})})}function bi({spinning:e=true,tip:t,size:r,className:n,children:a,...i}){return a?jsxRuntime.jsxs("div",{className:s("relative w-fit",n),...i,children:[jsxRuntime.jsx("div",{className:s("transition-all duration-200",e&&"pointer-events-none select-none blur-[1px]"),children:a}),e&&jsxRuntime.jsxs("div",{className:"absolute inset-0 z-10 flex flex-col items-center justify-center gap-2 rounded-[inherit] bg-primary-50/60 dark:bg-primary-900/60",children:[jsxRuntime.jsx(ha,{size:r}),t&&jsxRuntime.jsx("span",{className:s(Tr({size:r}),"select-none"),children:t})]})]}):e?jsxRuntime.jsxs("div",{className:s("inline-flex flex-col items-center gap-2",n),...i,children:[jsxRuntime.jsx(ha,{size:r}),t&&jsxRuntime.jsx("span",{className:s(Tr({size:r}),"select-none"),children:t})]}):null}var Gu=0,gn=[],gi=new Set;function Uu(){return gn}function fl(){gi.forEach(e=>e());}function qu(e,t){let r=++Gu;return gn=[...gn,{id:r,target:e,tip:t}],fl(),()=>Qu(r)}function Qu(e){gn=gn.filter(t=>t.id!==e),fl();}function Zu(){return qu}var pl=false;function Ju(){if(pl||typeof document>"u")return;pl=true;let e=document.createElement("div");e.id="jac-spin-portal",document.body.appendChild(e),import('react-dom/client').then(({createRoot:t})=>{t(e).render(jsxRuntime.jsx(n0,{}));});}var ya=new Map;function e0(e){let t=ya.get(e);if(t){t.count++;return}let r=getComputedStyle(e),n=e.style.position;r.position==="static"&&(e.style.position="relative"),ya.set(e,{count:1,original:n});}function t0(e){let t=ya.get(e);t&&(t.count--,t.count<=0&&(e.style.position=t.original,ya.delete(e)));}function r0({entry:e}){return qr.useEffect(()=>{let t=e.target;if(!ul(t))return e0(t),()=>t0(t)},[e.target]),ul(e.target)?reactDom.createPortal(jsxRuntime.jsxs("div",{className:"fixed inset-0 z-50 flex flex-col items-center justify-center gap-3 bg-primary-900/40 dark:bg-primary-900/60",children:[jsxRuntime.jsx(ha,{size:"lg"}),e.tip&&jsxRuntime.jsx("span",{className:"select-none text-sm text-primary-100",children:e.tip})]}),document.body):reactDom.createPortal(jsxRuntime.jsxs("div",{className:"absolute inset-0 z-10 flex flex-col items-center justify-center gap-2 rounded-[inherit] bg-primary-50/60 dark:bg-primary-900/60",children:[jsxRuntime.jsx(ha,{size:"md"}),e.tip&&jsxRuntime.jsx("span",{className:s(Tr({size:"md"}),"select-none"),children:e.tip})]}),e.target)}function n0(){let e=qr.useSyncExternalStore(t=>(gi.add(t),()=>gi.delete(t)),()=>Uu());return e.length===0?null:jsxRuntime.jsx(jsxRuntime.Fragment,{children:e.map(t=>jsxRuntime.jsx(r0,{entry:t},t.id))})}function ul(e){return e===document.documentElement||e===document.body}typeof document<"u"&&Ju();function gl(e){if(e!==void 0)return typeof e=="number"?`${e}px`:e}function xa({variant:e="text",animation:t="pulse",width:r,height:n,lines:a,className:i,style:o,...l}){let c=gl(r),m=gl(n);return e==="text"&&a!==void 0&&a>1?jsxRuntime.jsx("span",{className:s("flex flex-col gap-2",i),"aria-hidden":"true",role:"presentation",style:o,...l,children:Array.from({length:a},(d,f)=>jsxRuntime.jsx("span",{className:un({variant:"text",animation:t}),style:{width:f===a-1?"60%":c??"100%",height:m}},f))}):jsxRuntime.jsx("span",{className:s(un({variant:e,animation:t}),i),"aria-hidden":"true",role:"presentation",style:{width:c,height:m,...o},...l})}var l0=0,bl=320;function hl(e,t){let[r,n]=qr.useState([]),a=qr.useRef(new Map),i=qr.useCallback(d=>{let f=a.current.get(d);f!==void 0&&(clearTimeout(f),a.current.delete(d));},[]),o=qr.useCallback(d=>{i(d),n(f=>f.map(p=>p.id===d?{...p,_exiting:true}:p)),setTimeout(()=>n(f=>f.filter(p=>p.id!==d)),bl);},[i]),l=qr.useCallback(d=>o(d),[o]),c=qr.useCallback(()=>{a.current.forEach(clearTimeout),a.current.clear(),n(d=>d.map(f=>({...f,_exiting:true}))),setTimeout(()=>n([]),bl);},[]),m=qr.useCallback(d=>{let f=`toast-${++l0}`,p=d.position??e,u=d.duration!==void 0?d.duration:t;if(n(h=>[...h,{...d,id:f,position:p,duration:u,_exiting:false}]),u>0){let h=setTimeout(()=>{a.current.delete(f),o(f);},u);a.current.set(f,h);}return f},[e,t,o]);return qr.useEffect(()=>{let d=a.current;return ()=>{d.forEach(clearTimeout),d.clear();}},[]),{items:r,toast:m,dismiss:l,dismissAll:c}}var hn=qr.createContext(null),h0={"top-right":"top-4 right-4 items-end","top-left":"top-4 left-4 items-start","top-center":"top-4 left-1/2 -translate-x-1/2 items-center","bottom-right":"bottom-4 right-4 items-end","bottom-left":"bottom-4 left-4 items-start","bottom-center":"bottom-4 left-1/2 -translate-x-1/2 items-center"},y0={"top-right":"animate-slide-in-right","top-left":"animate-slide-in-left","top-center":"animate-slide-in-top","bottom-right":"animate-slide-in-right","bottom-left":"animate-slide-in-left","bottom-center":"animate-slide-in-bottom"},x0={"top-right":"toast-exit-right","top-left":"toast-exit-left","top-center":"toast-exit-up","bottom-right":"toast-exit-right","bottom-left":"toast-exit-left","bottom-center":"toast-exit-down"},v0={default:lucideReact.Bell,success:lucideReact.CheckCircle2,danger:lucideReact.XCircle,warning:lucideReact.AlertTriangle,info:lucideReact.Info};function w0({item:e,onDismiss:t}){let r=e.variant??"default",n=e.position??"top-right",a=e.dismissible!==false,i=v0[r],o=()=>{e.onDismiss?.(e.id),t(e.id);};return jsxRuntime.jsx("div",{className:s("toast-wrapper",e._exiting&&`toast-wrapper-exiting ${x0[n]}`),children:jsxRuntime.jsxs("div",{role:"status","aria-live":"polite","aria-atomic":"true",className:s(ga({variant:r}),"toast-item pointer-events-auto",!e._exiting&&y0[n]),children:[jsxRuntime.jsx(i,{className:"mt-0.5 h-5 w-5 shrink-0","aria-hidden":"true"}),jsxRuntime.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[e.title&&jsxRuntime.jsx("p",{className:"text-sm font-semibold leading-snug",children:e.title}),e.description&&jsxRuntime.jsx("p",{className:s("text-sm leading-snug",e.title&&"opacity-80"),children:e.description}),e.action&&jsxRuntime.jsx("button",{type:"button",onClick:e.action.onClick,className:"toast-action-btn mt-1 self-start text-xs font-semibold underline underline-offset-2 transition-opacity hover:opacity-80",children:e.action.label})]}),a&&jsxRuntime.jsx("button",{type:"button",onClick:o,"aria-label":"Dismiss notification",className:"shrink-0 cursor-pointer opacity-60 transition-opacity hover:opacity-100",children:jsxRuntime.jsx(lucideReact.X,{className:"h-4 w-4"})})]})})}function va({children:e,defaultPosition:t="top-right",defaultDuration:r=4e3}){let{items:n,toast:a,dismiss:i,dismissAll:o}=hl(t,r),l=n.reduce((c,m)=>{let d=m.position??t;return (c[d]??(c[d]=[])).push(m),c},{});return jsxRuntime.jsxs(hn.Provider,{value:{toast:a,dismiss:i,dismissAll:o},children:[e,typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx(jsxRuntime.Fragment,{children:Object.entries(l).map(([c,m])=>jsxRuntime.jsx("div",{className:s("pointer-events-none fixed z-[100] flex flex-col gap-2",h0[c]),children:m.map(d=>jsxRuntime.jsx(w0,{item:d,onDismiss:i},d.id))},c))}),document.body)]})}function wa(){let e=qr.useContext(hn);if(!e)throw new Error("useToast must be used within a <ToastProvider>");return e}var C0={Alert:mi,ProgressBar:fi,Spin:bi,Skeleton:xa,ToastProvider:va,useToast:wa},xi=C0;var wl="#1c1914",kl="#130f0b",B0="#2e261e",wi="#504638",Mr="#6b5d4d",Na=`url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E")`,O0=[{key:"like",icon:jsxRuntime.jsx(lucideReact.Heart,{className:"h-5 w-5"}),activeIcon:jsxRuntime.jsx(lucideReact.Heart,{className:"h-5 w-5",fill:"currentColor"}),label:"Like",toggle:true},{key:"dislike",icon:jsxRuntime.jsx(lucideReact.ThumbsDown,{className:"h-5 w-5"}),label:"Dislike"},{key:"bookmark",icon:jsxRuntime.jsx(lucideReact.Bookmark,{className:"h-5 w-5"}),activeIcon:jsxRuntime.jsx(lucideReact.Bookmark,{className:"h-5 w-5",fill:"currentColor"}),label:"Bookmark",toggle:true},{key:"share",icon:jsxRuntime.jsx(lucideReact.Share2,{className:"h-5 w-5"}),label:"Share"},{key:"download",icon:jsxRuntime.jsx(lucideReact.Download,{className:"h-5 w-5"}),label:"Download"}];function ki({photos:e,layout:t="strip",actions:r=O0,onAction:n,className:a,showGrain:i=true,sheetTitle:o,sheetLabel:l}){let[c,m]=qr.useState(null),[d,f]=qr.useState(new Set),p=qr.useCallback(b=>m(b),[]),u=qr.useCallback(()=>m(null),[]),h=qr.useCallback((b,N)=>{if(r.find(T=>T.key===b)?.toggle){let T=`${N}-${b}`;f(w=>{let C=new Set(w);return C.has(T)?C.delete(T):C.add(T),C});}n?.(b,e[N],N);},[r,n,e]);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(t==="strip"?$0:t==="sheet"?Y0:K0,{photos:e,onPhotoClick:p,showGrain:i,className:a,sheetTitle:o,sheetLabel:l}),c!==null&&reactDom.createPortal(jsxRuntime.jsx(X0,{photos:e,currentIndex:c,onIndexChange:m,onClose:u,actions:r,activeActions:d,onAction:h,showGrain:i}),document.body)]})}function vl({count:e=30}){return jsxRuntime.jsx("div",{className:"flex shrink-0 items-center justify-between px-3",style:{height:22,background:wl},children:Array.from({length:e}).map((t,r)=>jsxRuntime.jsx("div",{className:"rounded-xs",style:{width:12,height:8,background:B0}},r))})}function $0({photos:e,onPhotoClick:t,showGrain:r,className:n}){let a=qr.useRef(null);return jsxRuntime.jsxs("div",{className:s("select-none rounded-lg overflow-hidden",n),style:{background:kl},children:[jsxRuntime.jsx(vl,{count:Math.max(30,e.length*6)}),jsxRuntime.jsx("div",{ref:a,className:"flex gap-1 overflow-x-auto scroll-smooth px-1 py-1",style:{background:wl,scrollSnapType:"x mandatory"},children:e.map((i,o)=>jsxRuntime.jsxs("div",{className:"group relative shrink-0 cursor-pointer",style:{scrollSnapAlign:"center"},onClick:()=>t(o),children:[jsxRuntime.jsxs("div",{className:"overflow-hidden rounded-xs border",style:{borderColor:wi,width:280,height:187},children:[jsxRuntime.jsx("img",{src:i.src,alt:i.alt??i.title??"",className:"h-full w-full object-cover transition-transform duration-700 ease-out group-hover:scale-110",draggable:false}),jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-0 mix-blend-multiply opacity-0 transition-opacity duration-300 group-hover:opacity-100",style:{background:"rgba(255, 175, 60, 0.06)"}}),r&&jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-0 opacity-0 transition-opacity duration-300 group-hover:opacity-[0.06]",style:{backgroundImage:Na,animation:"film-grain-shift 0.6s steps(5) infinite"}}),jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-0 opacity-30 transition-opacity duration-300 group-hover:opacity-50",style:{background:"radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.5) 100%)"}})]}),jsxRuntime.jsxs("div",{className:"mt-0.5 text-center font-mono text-[9px] tracking-widest",style:{color:Mr},children:[String(o+1).padStart(2,"0"),o%2===0?"":"A"]})]},o))}),jsxRuntime.jsx(vl,{count:Math.max(30,e.length*6)})]})}function Y0({photos:e,onPhotoClick:t,showGrain:r,className:n,sheetTitle:a,sheetLabel:i}){return jsxRuntime.jsxs("div",{className:s("rounded-lg p-5",n),style:{background:kl},children:[jsxRuntime.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.25em]",style:{color:Mr},children:a??`JAC\xB7Film 35mm \xB7 ${e.length} exposures`}),jsxRuntime.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.25em]",style:{color:Mr},children:i??"Contact Sheet"})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-3 gap-2 sm:grid-cols-4 md:grid-cols-5 lg:grid-cols-6",children:e.map((o,l)=>jsxRuntime.jsxs("div",{className:"group cursor-pointer",style:{animation:`reveal-up 0.4s ease-out ${l*50}ms both`},onClick:()=>t(l),children:[jsxRuntime.jsx("div",{className:"mb-0.5 font-mono text-[9px] tracking-wider",style:{color:Mr},children:String(l+1).padStart(2,"0")}),jsxRuntime.jsxs("div",{className:"relative overflow-hidden rounded-[1px] border transition-all duration-300 group-hover:border-amber-600/50 group-hover:shadow-[0_0_20px_rgba(217,171,89,0.15)]",style:{borderColor:wi,aspectRatio:"3/2"},children:[jsxRuntime.jsx("img",{src:o.src,alt:o.alt??"",className:"h-full w-full object-cover transition-transform duration-500 group-hover:scale-105",draggable:false}),r&&jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.04]",style:{backgroundImage:Na}}),jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 translate-y-full bg-linear-to-t from-black/70 to-transparent p-2 pt-6 transition-transform duration-300 group-hover:translate-y-0",children:jsxRuntime.jsx("span",{className:"text-xs font-medium text-white/90",children:o.title})})]})]},l))})]})}function K0({photos:e,onPhotoClick:t,showGrain:r,className:n}){let[a,i]=qr.useState(false),[o,l]=qr.useState(null),c=Math.min(e.length,8),m=e.slice(0,c),d=p=>{let u=Math.sin(p*137.508+1)*1e4,h=(u%12-6).toFixed(1),g=(u/7%8-4).toFixed(1),b=(u/13%6-3).toFixed(1);return `rotate(${h}deg) translate(${g}px, ${b}px)`},f=(p,u)=>{let h=(u-1)/2,g=((p-h)*7).toFixed(1),b=((p-h)*110).toFixed(0),N=(-Math.abs(p-h)*10+(o===p?-18:0)).toFixed(0);return `translateX(${b}px) translateY(${N}px) rotate(${g}deg)`};return jsxRuntime.jsxs("div",{className:s("flex flex-col items-center gap-4",n),children:[jsxRuntime.jsx("div",{className:"relative flex h-85 w-full items-center justify-center",onMouseEnter:()=>i(true),onMouseLeave:()=>{i(false),l(null);},children:m.map((p,u)=>jsxRuntime.jsx("div",{className:"absolute cursor-pointer rounded-lg shadow-xl transition-all duration-500",style:{transitionTimingFunction:"cubic-bezier(0.34, 1.56, 0.64, 1)",transitionDelay:a?`${u*35}ms`:`${(c-u)*25}ms`,transform:a?f(u,m.length):d(u),zIndex:a?u+1:m.length-u,width:220,height:147},onClick:()=>t(u),onMouseEnter:()=>a&&l(u),onMouseLeave:()=>l(null),children:jsxRuntime.jsxs("div",{className:"relative h-full w-full overflow-hidden rounded-lg border transition-shadow duration-300",style:{borderColor:a&&o===u?"rgba(217,171,89,0.5)":wi,boxShadow:a&&o===u?"0 25px 50px rgba(0,0,0,0.5), 0 0 30px rgba(217,171,89,0.1)":"0 10px 30px rgba(0,0,0,0.4)"},children:[jsxRuntime.jsx("img",{src:p.src,alt:p.alt??"",className:"h-full w-full object-cover",draggable:false}),r&&jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.04]",style:{backgroundImage:Na}}),jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-0",style:{background:"radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.35) 100%)"}}),a&&o===u&&jsxRuntime.jsx("div",{className:"absolute inset-x-0 bottom-0 bg-linear-to-t from-black/80 to-transparent p-3 pt-8",style:{animation:"reveal-up 0.25s ease-out"},children:jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90",children:p.title})})]})},u))}),e.length>c&&jsxRuntime.jsxs("span",{className:"font-mono text-xs",style:{color:Mr},children:["+ ",e.length-c," more"]}),jsxRuntime.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.3em] transition-opacity duration-300",style:{color:Mr,opacity:a?0:.7},children:"Hover to explore"})]})}function X0({photos:e,currentIndex:t,onIndexChange:r,onClose:n,actions:a,activeActions:i,onAction:o,showGrain:l}){let c=e[t],[m,d]=qr.useState(1),[f,p]=qr.useState({x:0,y:0}),[u,h]=qr.useState(false),[g,b]=qr.useState(false),N=qr.useRef(false),x=qr.useRef({x:0,y:0}),T=qr.useRef(null);qr.useLayoutEffect(()=>{requestAnimationFrame(()=>b(true));},[]),qr.useEffect(()=>{let v=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=v;}},[]),qr.useEffect(()=>{let v=U=>{switch(U.key){case "Escape":n();break;case "ArrowLeft":w(-1);break;case "ArrowRight":w(1);break;case "i":case "I":h(k=>!k);break}};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)}),qr.useEffect(()=>{let v=T.current;if(!v)return;let U=k=>{k.preventDefault();let q=k.deltaY<0?1.12:.89;d(M=>{let W=Math.min(8,Math.max(1,M*q));return W<=1&&p({x:0,y:0}),W});};return v.addEventListener("wheel",U,{passive:false}),()=>v.removeEventListener("wheel",U)},[]);let w=qr.useCallback(v=>{let U=t+v;U>=0&&U<e.length&&(r(U),d(1),p({x:0,y:0}));},[t,e.length,r]),C=qr.useCallback(v=>{m<=1||(N.current=true,x.current={x:v.clientX,y:v.clientY},v.target.setPointerCapture(v.pointerId));},[m]),S=qr.useCallback(v=>{if(!N.current)return;let U=v.clientX-x.current.x,k=v.clientY-x.current.y;x.current={x:v.clientX,y:v.clientY},p(q=>({x:q.x+U/m,y:q.y+k/m}));},[m]),R=qr.useCallback(()=>{N.current=false;},[]),V=qr.useCallback(()=>{m>1?(d(1),p({x:0,y:0})):d(2.5);},[m]),I=v=>i.has(`${t}-${v}`),E=c.metadata;return jsxRuntime.jsxs("div",{className:"fixed inset-0 z-200 flex flex-col",style:{animation:"lightbox-backdrop-in 0.35s ease-out"},children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/95",onClick:n}),l&&jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.025]",style:{backgroundImage:Na,animation:"film-grain-shift 0.6s steps(5) infinite"}}),jsxRuntime.jsxs("div",{className:"relative z-10 flex h-12 shrink-0 items-center justify-between px-4",children:[jsxRuntime.jsxs("span",{className:"font-mono text-sm text-white/50",children:[t+1," / ",e.length]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("span",{className:"mr-2 font-mono text-xs text-white/40",children:[m.toFixed(1),"x"]}),jsxRuntime.jsx("button",{className:"rounded-full p-2 text-white/60 transition-colors hover:bg-white/10 hover:text-white",onClick:()=>d(v=>Math.min(8,v*1.3)),title:"Zoom in",children:jsxRuntime.jsx(lucideReact.ZoomIn,{className:"h-4 w-4"})}),jsxRuntime.jsx("button",{className:"rounded-full p-2 text-white/60 transition-colors hover:bg-white/10 hover:text-white",onClick:()=>{d(v=>{let U=Math.max(1,v*.7);return U<=1&&p({x:0,y:0}),U});},title:"Zoom out",children:jsxRuntime.jsx(lucideReact.ZoomOut,{className:"h-4 w-4"})}),jsxRuntime.jsx("button",{className:"rounded-full p-2 text-white/60 transition-colors hover:bg-white/10 hover:text-white",onClick:n,title:"Close",children:jsxRuntime.jsx(lucideReact.X,{className:"h-5 w-5"})})]})]}),jsxRuntime.jsxs("div",{ref:T,className:"relative flex flex-1 items-center justify-center overflow-hidden",style:{cursor:m>1?"grab":"default"},onPointerDown:C,onPointerMove:S,onPointerUp:R,onDoubleClick:V,children:[jsxRuntime.jsx("img",{src:c.src,alt:c.alt??c.title??"",className:"max-h-full max-w-full select-none object-contain",style:{animation:"lightbox-photo-in 0.35s cubic-bezier(0.16, 1, 0.3, 1)",transform:`scale(${m}) translate(${f.x}px, ${f.y}px)`,transition:N.current?"none":"transform 0.15s ease-out"},draggable:false},t),t>0&&jsxRuntime.jsx("button",{className:"absolute left-3 top-1/2 -translate-y-1/2 rounded-full bg-black/40 p-2.5 text-white/70 backdrop-blur-sm transition-all hover:bg-black/60 hover:text-white",onClick:v=>{v.stopPropagation(),w(-1);},children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"h-6 w-6"})}),t<e.length-1&&jsxRuntime.jsx("button",{className:"absolute right-3 top-1/2 -translate-y-1/2 rounded-full bg-black/40 p-2.5 text-white/70 backdrop-blur-sm transition-all hover:bg-black/60 hover:text-white",onClick:v=>{v.stopPropagation(),w(1);},children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"h-6 w-6"})})]}),jsxRuntime.jsx("div",{className:s("absolute inset-x-0 bottom-0 z-20 transition-all duration-400",u?"translate-y-0 opacity-100":"pointer-events-none translate-y-full opacity-0"),children:jsxRuntime.jsxs("div",{className:"bg-linear-to-t from-black/90 via-black/75 to-transparent px-6 pb-24 pt-16",children:[c.title&&jsxRuntime.jsx("h3",{className:"mb-3 text-xl font-semibold text-white",children:c.title}),c.description&&jsxRuntime.jsx("p",{className:"mb-4 max-w-xl border-l-2 border-amber-500/40 pl-4 text-sm leading-relaxed text-white/60 italic",style:{animation:"reveal-up 0.4s ease-out 0.1s both"},children:c.description}),E&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-x-6 gap-y-2 text-sm text-white/70",children:[E.camera&&jsxRuntime.jsxs("span",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(lucideReact.Camera,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",E.camera,E.lens&&jsxRuntime.jsx("span",{className:"text-white/40",children:"\xB7"}),E.lens&&E.lens]}),(E.aperture||E.shutter||E.iso)&&jsxRuntime.jsxs("span",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(lucideReact.Aperture,{className:"h-3.5 w-3.5 text-amber-400/80"}),[E.aperture,E.shutter,E.iso&&`ISO ${E.iso}`].filter(Boolean).join(" \xB7 ")]}),E.date&&jsxRuntime.jsxs("span",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",E.date]}),E.location&&jsxRuntime.jsxs("span",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(lucideReact.MapPin,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",E.location]})]})]})}),jsxRuntime.jsx("div",{className:"relative z-20 flex h-16 shrink-0 items-center justify-center gap-1",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5 rounded-full bg-white/6 px-2 py-1.5 backdrop-blur-xl",children:[a.map(v=>{let U=v.toggle&&I(v.key);return jsxRuntime.jsx("button",{className:s("rounded-full p-2.5 transition-all duration-200",U?"text-amber-400 hover:text-amber-300":"text-white/60 hover:bg-white/10 hover:text-white"),onClick:()=>o(v.key,t),title:v.label,children:U&&v.activeIcon?v.activeIcon:v.icon},v.key)}),jsxRuntime.jsx("div",{className:"mx-1 h-5 w-px bg-white/10"}),jsxRuntime.jsx("button",{className:s("rounded-full p-2.5 transition-all duration-200",u?"text-amber-400 hover:text-amber-300":"text-white/60 hover:bg-white/10 hover:text-white"),onClick:()=>h(v=>!v),title:"Photo info (I)",children:jsxRuntime.jsx(lucideReact.Info,{className:"h-5 w-5"})})]})})]})}var Ni="data:image/svg+xml,"+encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 200 200">
1
+ 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),classVarianceAuthority=require('class-variance-authority'),jsxRuntime=require('react/jsx-runtime'),On=require('react'),lucideReact=require('lucide-react'),reactDom=require('react-dom'),client=require('react-dom/client'),marked=require('marked'),react=require('@tiptap/react'),transform=require('@tiptap/pm/transform'),commands=require('@tiptap/pm/commands'),state=require('@tiptap/pm/state'),model=require('@tiptap/pm/model'),schemaList=require('@tiptap/pm/schema-list'),view=require('@tiptap/pm/view');require('@tiptap/pm/keymap');var gk=require('@tiptap/starter-kit'),bk=require('@tiptap/extension-underline'),yk=require('@tiptap/extension-text-align'),extensionColor=require('@tiptap/extension-color'),xk=require('@tiptap/extension-highlight'),wk=require('@tiptap/extension-link'),kk=require('@tiptap/extension-youtube'),Nk=require('@tiptap/extension-placeholder'),Ck=require('@tiptap/extension-character-count'),Mk=require('@tiptap/extension-typography'),Tk=require('@tiptap/extension-subscript'),Sk=require('@tiptap/extension-superscript'),extensionTable=require('@tiptap/extension-table'),Rk=require('@tiptap/extension-table-row'),Ek=require('@tiptap/extension-table-header'),Lk=require('@tiptap/extension-table-cell'),ik=require('@tiptap/extension-image');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var On__default=/*#__PURE__*/_interopDefault(On);var gk__default=/*#__PURE__*/_interopDefault(gk);var bk__default=/*#__PURE__*/_interopDefault(bk);var yk__default=/*#__PURE__*/_interopDefault(yk);var xk__default=/*#__PURE__*/_interopDefault(xk);var wk__default=/*#__PURE__*/_interopDefault(wk);var kk__default=/*#__PURE__*/_interopDefault(kk);var Nk__default=/*#__PURE__*/_interopDefault(Nk);var Ck__default=/*#__PURE__*/_interopDefault(Ck);var Mk__default=/*#__PURE__*/_interopDefault(Mk);var Tk__default=/*#__PURE__*/_interopDefault(Tk);var Sk__default=/*#__PURE__*/_interopDefault(Sk);var Rk__default=/*#__PURE__*/_interopDefault(Rk);var Ek__default=/*#__PURE__*/_interopDefault(Ek);var Lk__default=/*#__PURE__*/_interopDefault(Lk);var ik__default=/*#__PURE__*/_interopDefault(ik);function f(...e){return tailwindMerge.twMerge(clsx.clsx(e))}var Ur=classVarianceAuthority.cva("inline-flex cursor-pointer items-center justify-center gap-1.5 rounded font-medium transition-colors disabled:pointer-events-none disabled:opacity-50 [&_svg]:shrink-0",{variants:{intent:{primary:"bg-primary-500 text-white hover:bg-primary-600 active:bg-primary-700",secondary:"bg-secondary-500 text-white hover:bg-secondary-600 active:bg-secondary-700",danger:"bg-danger-500 text-white hover:bg-danger-600 active:bg-danger-700",warning:"bg-warning-500 text-white hover:bg-warning-600 active:bg-warning-700",ghost:"bg-transparent text-primary-700 hover:bg-primary-100 active:bg-primary-200 dark:text-primary-300 dark:hover:bg-primary-800",outline:"border border-primary-300 bg-transparent text-primary-700 hover:bg-primary-50 dark:border-primary-600 dark:text-primary-300 dark:hover:bg-primary-800"},size:{sm:"h-7 px-3 text-xs [&_svg]:h-3.5 [&_svg]:w-3.5",md:"h-9 px-4 text-sm [&_svg]:h-4 [&_svg]:w-4",lg:"h-11 px-6 text-base [&_svg]:h-5 [&_svg]:w-5"}},defaultVariants:{intent:"primary",size:"md"}}),So=classVarianceAuthority.cva("inline-flex items-center gap-1 rounded border font-semibold [&_svg]:shrink-0",{variants:{intent:{success:"border-success-200 bg-success-100 text-success-800 dark:border-success-800 dark:bg-success-900/30 dark:text-success-400",warning:"border-warning-200 bg-warning-100 text-warning-800 dark:border-warning-800 dark:bg-warning-900/30 dark:text-warning-400",error:"border-danger-200 bg-danger-100 text-danger-800 dark:border-danger-800 dark:bg-danger-900/30 dark:text-danger-400",info:"border-primary-200 bg-primary-100 text-primary-800 dark:border-primary-800 dark:bg-primary-900/30 dark:text-primary-400",primary:"border-secondary-200 bg-secondary-100 text-secondary-700 dark:border-secondary-700 dark:bg-secondary-800 dark:text-secondary-300"},size:{sm:"px-1.5 py-0 text-[0.625rem] [&_svg]:h-2.5 [&_svg]:w-2.5",md:"px-2.5 py-0.5 text-xs [&_svg]:h-3 [&_svg]:w-3",lg:"px-3 py-1 text-sm [&_svg]:h-3.5 [&_svg]:w-3.5"}},defaultVariants:{intent:"primary",size:"md"}}),Po=classVarianceAuthority.cva("absolute flex items-center justify-center rounded-full font-bold leading-none ring-2 ring-white select-none pointer-events-none z-10 dark:ring-primary-900",{variants:{intent:{danger:"bg-danger-500 text-white",success:"bg-success-500 text-white",warning:"bg-warning-500 text-white",info:"bg-primary-500 text-white",primary:"bg-secondary-500 text-white"},size:{sm:"text-[0.5rem]",md:"text-[0.625rem]",lg:"text-xs"},dot:{true:"",false:""},placement:{"top-right":"top-0 right-0 translate-x-1/2 -translate-y-1/2","top-left":"top-0 left-0 -translate-x-1/2 -translate-y-1/2","bottom-right":"bottom-0 right-0 translate-x-1/2 translate-y-1/2","bottom-left":"bottom-0 left-0 -translate-x-1/2 translate-y-1/2"}},compoundVariants:[{dot:true,size:"sm",class:"h-1.5 w-1.5 min-w-0 ring-1"},{dot:true,size:"md",class:"h-2 w-2 min-w-0"},{dot:true,size:"lg",class:"h-2.5 w-2.5 min-w-0"},{dot:false,size:"sm",class:"h-4 min-w-4 px-1"},{dot:false,size:"md",class:"h-5 min-w-5 px-1.5"},{dot:false,size:"lg",class:"h-6 min-w-6 px-2"}],defaultVariants:{intent:"danger",size:"md",dot:false,placement:"top-right"}}),Xr=classVarianceAuthority.cva("w-full rounded-md border bg-white text-secondary-900 transition-colors placeholder:text-secondary-400 focus:outline-none focus:ring-2 dark:bg-secondary-900 dark:text-secondary-100 dark:placeholder:text-secondary-600",{variants:{state:{default:"border-secondary-300 focus:border-primary-500 focus:ring-primary-500/20 dark:border-secondary-600",error:"border-danger-400 focus:border-danger-500 focus:ring-danger-500/20"},size:{sm:"h-7 px-2 text-xs",md:"h-9 px-3 py-2 text-sm",lg:"h-11 px-4 py-2.5 text-base"}},defaultVariants:{state:"default",size:"md"}}),Ro=classVarianceAuthority.cva("inline-flex items-center gap-1 font-medium [&_svg]:shrink-0",{variants:{size:{sm:"text-xs [&_svg]:h-3 [&_svg]:w-3",md:"text-sm [&_svg]:h-3.5 [&_svg]:w-3.5",lg:"text-base [&_svg]:h-4 [&_svg]:w-4"},intent:{default:"text-primary-700 dark:text-primary-300",muted:"text-primary-400 dark:text-primary-500",required:"text-primary-700 dark:text-primary-300 after:ml-0.5 after:text-danger-500 after:content-['*']"}},defaultVariants:{size:"md",intent:"default"}}),Eo=classVarianceAuthority.cva("relative inline-flex shrink-0 items-center justify-center rounded border-2 transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",{variants:{intent:{primary:"border-primary-300 dark:border-primary-600 focus-visible:ring-primary-500/40",secondary:"border-secondary-300 dark:border-secondary-600 focus-visible:ring-secondary-500/40",danger:"border-danger-300 dark:border-danger-600 focus-visible:ring-danger-500/40",warning:"border-warning-300 dark:border-warning-600 focus-visible:ring-warning-500/40",success:"border-success-300 dark:border-success-600 focus-visible:ring-success-500/40"},size:{sm:"h-4 w-4 rounded-[3px]",md:"h-5 w-5 rounded",lg:"h-6 w-6 rounded-[5px]"},checked:{on:"",off:"bg-white dark:bg-primary-900"}},compoundVariants:[{intent:"primary",checked:"on",class:"border-primary-500 bg-primary-500 dark:border-primary-500 dark:bg-primary-500"},{intent:"secondary",checked:"on",class:"border-secondary-500 bg-secondary-500 dark:border-secondary-500 dark:bg-secondary-500"},{intent:"danger",checked:"on",class:"border-danger-500 bg-danger-500 dark:border-danger-500 dark:bg-danger-500"},{intent:"warning",checked:"on",class:"border-warning-500 bg-warning-500 dark:border-warning-500 dark:bg-warning-500"},{intent:"success",checked:"on",class:"border-success-500 bg-success-500 dark:border-success-500 dark:bg-success-500"}],defaultVariants:{intent:"primary",size:"md",checked:"off"}}),Lo=classVarianceAuthority.cva("relative inline-flex shrink-0 items-center justify-center rounded-full border-2 transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",{variants:{intent:{primary:"border-primary-300 dark:border-primary-600 focus-visible:ring-primary-500/40",secondary:"border-secondary-300 dark:border-secondary-600 focus-visible:ring-secondary-500/40",danger:"border-danger-300 dark:border-danger-600 focus-visible:ring-danger-500/40",warning:"border-warning-300 dark:border-warning-600 focus-visible:ring-warning-500/40",success:"border-success-300 dark:border-success-600 focus-visible:ring-success-500/40"},size:{sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6"},checked:{on:"",off:"bg-white dark:bg-primary-900"}},compoundVariants:[{intent:"primary",checked:"on",class:"border-primary-500 bg-primary-500 dark:border-primary-500 dark:bg-primary-500"},{intent:"secondary",checked:"on",class:"border-secondary-500 bg-secondary-500 dark:border-secondary-500 dark:bg-secondary-500"},{intent:"danger",checked:"on",class:"border-danger-500 bg-danger-500 dark:border-danger-500 dark:bg-danger-500"},{intent:"warning",checked:"on",class:"border-warning-500 bg-warning-500 dark:border-warning-500 dark:bg-warning-500"},{intent:"success",checked:"on",class:"border-success-500 bg-success-500 dark:border-success-500 dark:bg-success-500"}],defaultVariants:{intent:"primary",size:"md",checked:"off"}}),Do=classVarianceAuthority.cva("",{variants:{intent:{primary:"",secondary:"",danger:"",warning:"",success:""},size:{sm:"",md:"",lg:""},checked:{on:"",off:"bg-primary-300 dark:bg-primary-800"}},compoundVariants:[{intent:"primary",checked:"on",class:"bg-primary-500 dark:bg-primary-500"},{intent:"secondary",checked:"on",class:"bg-secondary-500 dark:bg-secondary-500"},{intent:"danger",checked:"on",class:"bg-danger-500 dark:bg-danger-500"},{intent:"warning",checked:"on",class:"bg-warning-500 dark:bg-warning-500"},{intent:"success",checked:"on",class:"bg-success-500 dark:bg-success-500"}],defaultVariants:{intent:"primary",size:"md",checked:"off"}}),Pn=classVarianceAuthority.cva("bg-primary-200 text-primary-700 dark:bg-primary-700 dark:text-primary-200",{variants:{size:{xs:"h-6 w-6 text-[10px]",sm:"h-8 w-8 text-xs",md:"h-10 w-10 text-sm",lg:"h-12 w-12 text-base",xl:"h-16 w-16 text-lg"},shape:{circular:"rounded-full",rounded:"rounded-lg",square:"rounded-none"}},defaultVariants:{size:"md",shape:"circular"}}),Ao=classVarianceAuthority.cva("inline-flex items-center",{variants:{size:{sm:"gap-0.5 [&_.rating-icon]:h-4 [&_.rating-icon]:w-4",md:"gap-1 [&_.rating-icon]:h-6 [&_.rating-icon]:w-6",lg:"gap-1.5 [&_.rating-icon]:h-8 [&_.rating-icon]:w-8"}},defaultVariants:{size:"md"}}),Io=classVarianceAuthority.cva("inline-flex items-center justify-center rounded font-mono font-medium select-none",{variants:{size:{xs:"h-4 min-w-4 px-1 text-[0.6rem]",sm:"h-5 min-w-5 px-1.5 text-xs",md:"h-6 min-w-6 px-2 text-sm",lg:"h-8 min-w-8 px-2.5 text-base"},variant:{default:"border border-secondary-300 bg-secondary-100 text-secondary-700 shadow-[0_2px_0_0_var(--color-secondary-300)] dark:border-secondary-600 dark:bg-secondary-800 dark:text-secondary-300 dark:shadow-[0_2px_0_0_var(--color-secondary-600)]",outline:"border border-secondary-400 bg-transparent text-secondary-700 dark:border-secondary-500 dark:text-secondary-300",ghost:"text-secondary-600 dark:text-secondary-400"}},defaultVariants:{size:"sm",variant:"default"}}),Rn=classVarianceAuthority.cva("relative flex w-full touch-none select-none items-center",{variants:{intent:{primary:"[&_.slider-fill]:bg-primary-500 [&_.slider-thumb]:border-primary-500",secondary:"[&_.slider-fill]:bg-secondary-500 [&_.slider-thumb]:border-secondary-500",success:"[&_.slider-fill]:bg-success-500 [&_.slider-thumb]:border-success-500",danger:"[&_.slider-fill]:bg-danger-500 [&_.slider-thumb]:border-danger-500",warning:"[&_.slider-fill]:bg-warning-500 [&_.slider-thumb]:border-warning-500"},size:{sm:"h-4",md:"h-5",lg:"h-6"}},defaultVariants:{intent:"primary",size:"md"}}),zo=classVarianceAuthority.cva("inline-flex items-center gap-1 rounded-full font-medium select-none transition-colors [&_svg]:shrink-0",{variants:{intent:{primary:"bg-primary-100 text-primary-700 dark:bg-primary-800 dark:text-primary-200",secondary:"bg-secondary-100 text-secondary-700 dark:bg-secondary-800 dark:text-secondary-200",success:"bg-success-100 text-success-700 dark:bg-success-900/40 dark:text-success-300",danger:"bg-danger-100 text-danger-700 dark:bg-danger-900/40 dark:text-danger-300",warning:"bg-warning-100 text-warning-700 dark:bg-warning-900/40 dark:text-warning-300",info:"bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300"},size:{sm:"h-5 px-2 text-[0.6875rem] gap-0.5",md:"h-6 px-2.5 text-xs gap-1",lg:"h-7 px-3 text-sm gap-1"},variant:{solid:"",outline:"bg-transparent border",soft:""}},compoundVariants:[{intent:"primary",variant:"outline",class:"border-primary-300 text-primary-700 dark:border-primary-600 dark:text-primary-300"},{intent:"secondary",variant:"outline",class:"border-secondary-300 text-secondary-700 dark:border-secondary-600 dark:text-secondary-300"},{intent:"success",variant:"outline",class:"border-success-400 text-success-700 dark:border-success-600 dark:text-success-300"},{intent:"danger",variant:"outline",class:"border-danger-400 text-danger-700 dark:border-danger-600 dark:text-danger-300"},{intent:"warning",variant:"outline",class:"border-warning-400 text-warning-700 dark:border-warning-600 dark:text-warning-300"},{intent:"info",variant:"outline",class:"border-blue-400 text-blue-700 dark:border-blue-600 dark:text-blue-300"}],defaultVariants:{intent:"primary",size:"md",variant:"solid"}});classVarianceAuthority.cva("relative w-full cursor-pointer rounded-md border bg-white text-sm transition-colors dark:bg-primary-900",{variants:{intent:{default:"border-primary-300 text-primary-900 hover:border-primary-400 focus-within:border-primary-500 focus-within:ring-2 focus-within:ring-primary-500/20 dark:border-primary-600 dark:text-primary-100 dark:hover:border-primary-500 dark:focus-within:border-primary-400",danger:"border-danger-500 text-primary-900 focus-within:ring-2 focus-within:ring-danger-500/20 dark:border-danger-500 dark:text-primary-100"},size:{sm:"h-7 px-2 text-xs",md:"h-9 px-3 text-sm",lg:"h-11 px-4 text-base"}},defaultVariants:{intent:"default",size:"md"}});function Vt({intent:e,size:t,className:r,...n}){return jsxRuntime.jsx("button",{className:f(Ur({intent:e,size:t}),r),...n})}function yi(e,t){for(let r of e){if(r.value===t)return r;if(r.children){let n=yi(r.children,t);if(n)return n}}}function vi(e){let t=[];for(let r of e)r.children?.length||t.push(r),r.children&&t.push(...vi(r.children));return t}var Fo=40,om=200,xi=150,ic=120;function _o(e,t,r,n){if(!n)return {};if(r){let a=(t-1-e)*Fo;return {animation:`dropdown-item-out ${xi}ms ease-in both ${a}ms`}}let o=e*Fo;return {animation:`dropdown-item-in ${om}ms ease-out both ${o}ms`}}function sc(e,t,r){if(!r)return {};if(t){let n=Math.max(e-1,0)*Fo+xi;return {animation:`dropdown-container-out ${ic}ms ease-in both ${n}ms`}}return {animation:"var(--animate-dropdown-container-in)"}}function lc({options:e,onSelect:t,animated:r=true,closing:n=false,depth:o=0}){let[a,i]=On.useState(null),s=On.useRef(void 0),l=u=>{s.current&&clearTimeout(s.current),i(u);},c=()=>{s.current=setTimeout(()=>i(null),150);};return On.useEffect(()=>()=>{s.current&&clearTimeout(s.current);},[]),jsxRuntime.jsx("div",{className:f("absolute z-50 min-w-44 rounded-md border py-1 shadow-lg overflow-hidden","border-primary-200 dark:border-primary-700 dark:bg-primary-800 bg-white",o===0?"mt-1 w-full":"top-0 ml-0.5"),style:{...o>0?{left:"100%"}:{},...sc(e.length,n,r)},role:"listbox",children:e.map((u,p)=>{let m=!!u.children?.length,d=a===u.value;return jsxRuntime.jsxs("div",{className:"relative",style:_o(p,e.length,n,r),onMouseEnter:()=>l(u.value),onMouseLeave:c,children:[jsxRuntime.jsxs("div",{role:"option","aria-selected":false,"aria-disabled":u.disabled,className:f("flex w-full cursor-pointer items-center gap-2 px-3 py-1.5 text-left text-sm transition-colors","text-primary-700 hover:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-700/50",u.disabled&&"pointer-events-none opacity-50"),onClick:()=>{u.disabled||m||t(u.value,u);},children:[u.icon&&jsxRuntime.jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center",children:u.icon}),jsxRuntime.jsx("span",{className:"flex-1 truncate",children:u.label??u.value}),m&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"text-primary-400 h-3.5 w-3.5 shrink-0"})]}),m&&d&&jsxRuntime.jsx(lc,{options:u.children,onSelect:t,animated:r,depth:o+1})]},u.value)})})}function am({options:e,filter:t,multiple:r,selected:n,canAdd:o,animated:a=true,closing:i=false,onSelect:s,onToggle:l,onAdd:c}){let u=On.useMemo(()=>vi(e),[e]),p=t.toLowerCase(),m=t?u.filter(h=>(h.label??h.value).toLowerCase().includes(p)||h.value.toLowerCase().includes(p)):u,d=m.length===0&&!o||o?1:0,g=m.length+d;return jsxRuntime.jsxs("div",{className:f("absolute z-50 mt-1 w-full max-h-60 min-w-44 overflow-y-auto rounded-md border py-1 shadow-lg","border-primary-200 dark:border-primary-700 dark:bg-primary-800 bg-white"),role:"listbox","aria-multiselectable":r||void 0,style:sc(g,i,a),children:[m.map((h,b)=>{let y=r&&n.includes(h.value);return jsxRuntime.jsxs("div",{role:"option","aria-selected":r?y:false,"aria-disabled":h.disabled,className:f("flex w-full cursor-pointer items-center gap-2 px-3 py-1.5 text-left text-sm transition-colors","text-primary-700 hover:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-700/50",h.disabled&&"pointer-events-none opacity-50"),style:_o(b,g,i,a),onClick:()=>{h.disabled||(r?l(h.value):s(h.value,h));},children:[r&&jsxRuntime.jsx("span",{className:f("flex h-4 w-4 shrink-0 items-center justify-center rounded border transition-colors",y?"border-primary-600 bg-primary-600 text-white dark:border-primary-500 dark:bg-primary-500":"border-secondary-300 bg-white dark:border-secondary-600 dark:bg-secondary-800"),children:y&&jsxRuntime.jsx(lucideReact.Check,{className:"h-3 w-3"})}),h.icon&&jsxRuntime.jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center",children:h.icon}),jsxRuntime.jsx("span",{className:"truncate",children:h.label??h.value})]},h.value)}),m.length===0&&!o&&jsxRuntime.jsx("div",{className:"text-primary-400 px-3 py-2 text-center text-sm",style:_o(0,1,i,a),children:"No matches"}),o&&jsxRuntime.jsxs("div",{className:f("flex w-full cursor-pointer items-center gap-2 px-3 py-1.5 text-left text-sm transition-colors","text-primary-600 hover:bg-primary-50 dark:text-primary-400 dark:hover:bg-primary-900/30"),style:_o(m.length,g,i,a),onClick:c,children:[jsxRuntime.jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center text-lg leading-none",children:"+"}),jsxRuntime.jsxs("span",{className:"truncate",children:["Add \u201C",t.trim(),"\u201D"]})]})]})}function wi(e){let{options:t,placeholder:r="Select\u2026",editable:n=false,onAddItem:o,disabled:a=false,align:i="left",className:s,size:l="md",animated:c=true,name:u,intent:p="default",clearable:m=false,id:d,"aria-describedby":g,"aria-invalid":h}=e,b=e.multiple===true,[y,v]=On.useState(b?void 0:e.defaultValue),[N,x]=On.useState(b?e.defaultSelected??[]:[]),w=b?e.selected??N:[],[L,P]=On.useState(false),[A,D]=On.useState(false),[S,C]=On.useState(""),I=On.useRef(null),k=On.useRef(null),T=On.useRef(void 0),R=On.useCallback(()=>{if(!c||!L){P(false),C("");return}D(true);let le=(Math.max(t.length,1)-1)*Fo+xi+ic+20;T.current=setTimeout(()=>{P(false),D(false),C("");},le);},[c,L,t.length]);On.useEffect(()=>()=>{T.current&&clearTimeout(T.current);},[]);let O=b?void 0:e.value??y,E=On.useMemo(()=>O?yi(t,O):void 0,[t,O]);On.useEffect(()=>{if(!L)return;let G=le=>{I.current&&!I.current.contains(le.target)&&R();};return document.addEventListener("mousedown",G),()=>document.removeEventListener("mousedown",G)},[L,R]),On.useEffect(()=>{if(!L)return;let G=le=>{le.key==="Escape"&&R();};return document.addEventListener("keydown",G),()=>document.removeEventListener("keydown",G)},[L,R]);let ne=On.useCallback((G,le)=>{b||(e.value===void 0&&v(G),e.onChange?.(G,le)),T.current&&clearTimeout(T.current),P(false),D(false),C("");},[b,e]),U=On.useCallback(G=>{if(!b)return;let le=e.selected??N,ke=le.includes(G)?le.filter(B=>B!==G):[...le,G];e.selected===void 0&&x(ke),e.onSelectionChange?.(ke),e.onChange?.(ke);},[b,N,e]),z=S.toLowerCase(),H=On.useMemo(()=>!n||!S.trim()?false:!vi(t).some(le=>le.value.toLowerCase()===z||(le.label??le.value).toLowerCase()===z),[n,z,t]),_=On.useCallback(()=>{let G=S.trim();G&&(o?.(G),C(""));},[S,o]),V=On.useCallback(G=>{G.stopPropagation(),b?(x([]),e.onSelectionChange?.([]),e.onChange?.([])):(v(void 0),e.onChange?.("",void 0));},[b,e]),oe=On.useCallback(G=>{G.key==="Enter"&&H&&(G.preventDefault(),_());},[H,_]),be=On.useCallback(()=>{a||(L?R():(T.current&&clearTimeout(T.current),D(false),P(true),C(""),n&&requestAnimationFrame(()=>k.current?.focus())));},[a,L,R,n]),M;if(b){let G=w.length;G===0?M="":G<=2?M=w.map(le=>yi(t,le)).map(le=>le?le.label??le.value:"").filter(Boolean).join(", "):M=`${G} selected`;}else M=E?E.label??E.value:"";let F=b||n,re=p==="danger"||h===true,W=m&&(b?w.length>0:!!M);return jsxRuntime.jsxs("div",{ref:I,className:f("relative inline-block min-w-44",s),children:[u&&!b&&jsxRuntime.jsx("input",{type:"hidden",name:u,value:O??""}),u&&b&&w.map(G=>jsxRuntime.jsx("input",{type:"hidden",name:`${u}[]`,value:G},G)),d&&!n&&jsxRuntime.jsx("input",{type:"text",id:d,className:"sr-only",readOnly:true,tabIndex:-1,value:M??"",onChange:()=>{}}),jsxRuntime.jsxs("div",{className:f(Xr({state:re?"error":"default",size:l}),"flex cursor-pointer items-center gap-1",a&&"pointer-events-none opacity-50"),onClick:be,role:"combobox","aria-expanded":L,"aria-haspopup":"listbox","aria-invalid":re||void 0,"aria-describedby":g,children:[n?jsxRuntime.jsx("input",{ref:k,id:d,className:"min-w-0 flex-1 bg-transparent outline-none placeholder:text-secondary-400 dark:placeholder:text-secondary-600",value:L?S:M,placeholder:r,disabled:a,onChange:G=>{C(G.target.value),L||P(true);},onKeyDown:oe,onClick:G=>{G.stopPropagation(),L||P(true);}}):jsxRuntime.jsx("span",{className:f("flex-1 truncate",!M&&"text-secondary-400 dark:text-secondary-600"),children:M||r}),E?.icon&&!n&&!b&&jsxRuntime.jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center",children:E.icon}),b&&w.length>0&&jsxRuntime.jsx("span",{className:"rounded-full bg-primary-100 px-1.5 text-xs font-semibold text-primary-700 dark:bg-primary-900 dark:text-primary-300",children:w.length}),W&&jsxRuntime.jsx("button",{type:"button","aria-label":"Clear selection",className:"flex h-4 w-4 shrink-0 items-center justify-center rounded-full text-secondary-400 transition-colors hover:bg-secondary-200 hover:text-secondary-600 dark:hover:bg-secondary-700 dark:hover:text-secondary-300",onClick:V,children:jsxRuntime.jsx(lucideReact.X,{className:"h-3 w-3"})}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("text-primary-400 h-4 w-4 shrink-0 transition-transform",L&&"rotate-180")})]}),L&&jsxRuntime.jsx("div",{className:f(i==="right"?"right-0":"left-0","absolute w-full"),children:F?jsxRuntime.jsx(am,{options:t,filter:S,multiple:b,selected:w,canAdd:H,animated:c,closing:A,onSelect:ne,onToggle:U,onAdd:_}):jsxRuntime.jsx(lc,{options:t,onSelect:ne,animated:c,closing:A})})]})}function cm(e,t){return e.key??(typeof e.label=="string"?e.label:String(t))}var Bo=40,dm=200,Ti=150,dc=120;function Mi(e,t,r,n){if(!n)return {};if(r){let a=(t-1-e)*Bo;return {animation:`dropdown-item-out ${Ti}ms ease-in both ${a}ms`}}let o=e*Bo;return {animation:`dropdown-item-in ${dm}ms ease-out both ${o}ms`}}function um(e,t,r){if(!r)return {};if(t){let n=Math.max(e-1,0)*Bo+Ti;return {animation:`dropdown-container-out ${dc}ms ease-in both ${n}ms`}}return {animation:"var(--animate-dropdown-container-in)"}}function qr({label:e,items:t,intent:r,size:n,align:o="left",className:a,disabled:i,editable:s=false,onAddItem:l,multiple:c=false,selected:u=[],onSelectionChange:p,animated:m=true,chevron:d=true,...g}){let[h,b]=On.useState(false),[y,v]=On.useState(false),[N,x]=On.useState(""),w=On.useRef(null),L=On.useRef(null),P=On.useRef(void 0);On.useEffect(()=>()=>{P.current&&clearTimeout(P.current);},[]);let A=On.useCallback(()=>{if(!m||!h){b(false),x("");return}v(true);let z=(Math.max(t.length,1)-1)*Bo+Ti+dc+20;P.current=setTimeout(()=>{b(false),v(false),x("");},z);},[m,h,t.length]),D=On.useCallback(()=>{i||(h?A():(P.current&&clearTimeout(P.current),v(false),b(true),x(""),s&&requestAnimationFrame(()=>L.current?.focus())));},[i,h,A,s]);On.useEffect(()=>{if(!h)return;let U=z=>{w.current&&!w.current.contains(z.target)&&A();};return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[h,A]),On.useEffect(()=>{if(!h)return;let U=z=>{z.key==="Escape"&&A();};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[h,A]);let S=N.toLowerCase(),C=On.useMemo(()=>N?t.filter(U=>(typeof U.label=="string"?U.label:U.key??"").toLowerCase().includes(S)):t,[t,S]),I=On.useMemo(()=>!s||!N.trim()?false:!t.some(U=>(typeof U.label=="string"?U.label:U.key??"").toLowerCase()===S),[s,S,t]),k=On.useCallback(()=>{let U=N.trim();U&&(l?.(U),x(""));},[N,l]),T=On.useCallback(U=>{U.key==="Enter"&&I&&(U.preventDefault(),k());},[I,k]),R=On.useCallback(U=>{let z=u.includes(U)?u.filter(H=>H!==U):[...u,U];p?.(z);},[u,p]),O=c&&u.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[e," ",jsxRuntime.jsx("span",{className:"ml-1 rounded-full bg-white/20 px-1.5 text-xs font-semibold",children:u.length})]}):e,E=C.length===0&&!I||I?1:0,ne=C.length+E;return jsxRuntime.jsxs("div",{ref:w,className:"relative inline-block",children:[jsxRuntime.jsxs("button",{type:"button",onClick:D,disabled:i,className:f(Ur({intent:r,size:n}),"inline-flex items-center gap-1",a),"aria-haspopup":c?"listbox":"true","aria-expanded":h?"true":"false",...g,children:[O,d&&jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("h-3.5 w-3.5 transition-transform",h&&"rotate-180")})]}),h&&jsxRuntime.jsxs("div",{className:f("absolute z-50 mt-1 min-w-44 rounded-md border py-1 shadow-lg","border-primary-200 dark:border-primary-700 dark:bg-primary-800 bg-white",o==="right"?"right-0":"left-0"),style:um(ne,y,m),role:c?"listbox":"menu","aria-multiselectable":c||void 0,children:[s&&jsxRuntime.jsx("div",{className:"border-primary-200 dark:border-primary-700 border-b px-2 pb-1.5 pt-1",children:jsxRuntime.jsx("input",{ref:L,type:"text",value:N,onChange:U=>x(U.target.value),onKeyDown:T,placeholder:"Type to filter or add\u2026",className:"w-full bg-transparent text-sm text-secondary-900 placeholder:text-secondary-400 focus:outline-none dark:text-secondary-100 dark:placeholder:text-secondary-600"})}),jsxRuntime.jsxs("div",{className:"max-h-60 overflow-y-auto",children:[C.map((U,z)=>{let H=cm(U,z),_=c&&u.includes(H);return jsxRuntime.jsxs(On__default.default.Fragment,{children:[U.divider&&jsxRuntime.jsx("div",{className:"border-primary-200 dark:border-primary-700 my-1 border-t"}),jsxRuntime.jsxs("button",{type:"button",role:c?"option":"menuitem","aria-selected":c?_:void 0,disabled:U.disabled,className:f("flex w-full cursor-pointer items-center gap-2 px-3 py-1.5 text-left text-sm transition-colors","text-primary-700 hover:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-700/50",U.disabled&&"pointer-events-none opacity-50"),style:Mi(z,ne,y,m),onClick:()=>{c?R(H):(U.onClick?.(),P.current&&clearTimeout(P.current),b(false),v(false),x(""));},children:[c&&jsxRuntime.jsx("span",{className:f("flex h-4 w-4 shrink-0 items-center justify-center rounded border transition-colors",_?"border-primary-600 bg-primary-600 text-white dark:border-primary-500 dark:bg-primary-500":"border-secondary-300 bg-white dark:border-secondary-600 dark:bg-secondary-800"),children:_&&jsxRuntime.jsx(lucideReact.Check,{className:"h-3 w-3"})}),jsxRuntime.jsx("span",{className:"flex-1 truncate",children:U.label})]})]},H)}),C.length===0&&!I&&jsxRuntime.jsx("div",{className:"text-primary-400 px-3 py-2 text-center text-sm",style:Mi(0,1,y,m),children:"No matches"}),I&&jsxRuntime.jsxs("button",{type:"button",className:f("flex w-full cursor-pointer items-center gap-2 px-3 py-1.5 text-left text-sm transition-colors","text-primary-600 hover:bg-primary-50 dark:text-primary-400 dark:hover:bg-primary-900/30"),style:Mi(C.length,ne,y,m),onClick:k,children:[jsxRuntime.jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center text-lg leading-none",children:"+"}),jsxRuntime.jsxs("span",{className:"truncate",children:["Add \u201C",N.trim(),"\u201D"]})]})]})]})]})}function Si({intent:e,size:t,className:r,...n}){return jsxRuntime.jsx("span",{className:f(So({intent:e,size:t}),r),...n})}function Pi({intent:e,size:t,variant:r,icon:n,removable:o,onRemove:a,disabled:i,dot:s,className:l,children:c,...u}){return jsxRuntime.jsxs("span",{className:f(zo({intent:e,size:t,variant:r}),i&&"pointer-events-none opacity-50",l),"aria-disabled":i,...u,children:[s&&jsxRuntime.jsx("span",{className:f("inline-block h-1.5 w-1.5 shrink-0 rounded-full",e==="success"&&"bg-success-500",e==="danger"&&"bg-danger-500",e==="warning"&&"bg-warning-500",(!e||e==="primary")&&"bg-primary-500",e==="secondary"&&"bg-secondary-500",e==="info"&&"bg-blue-500")}),n&&jsxRuntime.jsx("span",{className:"shrink-0 [&_svg]:h-[1em] [&_svg]:w-[1em]",children:n}),c&&jsxRuntime.jsx("span",{children:c}),o&&jsxRuntime.jsx("button",{type:"button","aria-label":"Remove tag",onClick:p=>{p.stopPropagation(),a?.();},disabled:i,className:f("ml-0.5 -mr-0.5 inline-flex items-center justify-center rounded-full p-0.5 transition-colors hover:bg-black/10 dark:hover:bg-white/20 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-current"),children:jsxRuntime.jsx(lucideReact.X,{className:"h-[0.75em] w-[0.75em]"})})]})}var gm={danger:"bg-danger-500",success:"bg-success-500",warning:"bg-warning-500",info:"bg-primary-500",primary:"bg-secondary-500"};function Ri({children:e,show:t=true,content:r,dot:n,intent:o="danger",size:a="md",placement:i="top-right",pulse:s=false,className:l}){let c=n??r==null,u=c?null:typeof r=="number"?r>99?"99+":String(r):r;return jsxRuntime.jsxs("div",{className:"relative inline-flex",children:[e,t&&jsxRuntime.jsxs("span",{className:f(Po({intent:o,size:a,dot:c,placement:i}),l),role:typeof r=="number"?"status":void 0,"aria-label":typeof r=="number"?String(r):void 0,children:[s&&jsxRuntime.jsx("span",{className:f("absolute inset-0 rounded-full animate-ping opacity-60",gm[o??"danger"]),"aria-hidden":"true"}),u]})]})}function _t({intent:e,size:t,className:r,...n}){return jsxRuntime.jsx("label",{className:f(Ro({intent:e,size:t}),r),...n})}var vm={sm:{wrapper:"h-7 text-xs",prefix:"px-2 text-xs [&_svg]:h-3 [&_svg]:w-3",input:"px-2 text-xs",icon:"px-1.5 [&_svg]:h-3 [&_svg]:w-3"},md:{wrapper:"h-9 text-sm",prefix:"px-3 text-sm [&_svg]:h-4 [&_svg]:w-4",input:"px-3 py-2 text-sm",icon:"px-2 [&_svg]:h-4 [&_svg]:w-4"},lg:{wrapper:"h-11 text-base",prefix:"px-4 text-base [&_svg]:h-5 [&_svg]:w-5",input:"px-4 py-2.5 text-base",icon:"px-2.5 [&_svg]:h-5 [&_svg]:w-5"}},xm={default:"border-secondary-300 focus-within:border-primary-500 focus-within:ring-2 focus-within:ring-primary-500/20 dark:border-secondary-600",error:"border-danger-400 focus-within:border-danger-500 focus-within:ring-2 focus-within:ring-danger-500/20"};function Ft({state:e="default",inputSize:t="md",className:r,prefix:n,suffix:o,action:a,...i}){if(!n&&!o&&!a)return jsxRuntime.jsx("input",{className:f(Xr({state:e,size:t}),r),...i});let s=vm[t??"md"],l=xm[e??"default"];return jsxRuntime.jsxs("div",{className:f("flex w-full items-center overflow-hidden rounded-md border bg-white transition-colors dark:bg-secondary-900",s.wrapper,l,r),children:[n&&jsxRuntime.jsx("span",{className:f("flex shrink-0 items-center gap-1.5 self-stretch border-r border-secondary-300 bg-secondary-50 font-medium text-secondary-600 dark:border-secondary-600 dark:bg-secondary-800 dark:text-secondary-300",s.prefix),children:n}),jsxRuntime.jsx("input",{className:f("min-w-0 flex-1 bg-transparent text-secondary-900 placeholder:text-secondary-400 focus:outline-none dark:text-secondary-100 dark:placeholder:text-secondary-600",s.input,n&&"pl-2"),...i}),o&&jsxRuntime.jsx("span",{className:f("flex shrink-0 items-center text-secondary-400 dark:text-secondary-500",s.icon),children:o}),a&&jsxRuntime.jsx("button",{type:"button",onClick:a.onClick,"aria-label":a["aria-label"]??"Action",className:f("flex shrink-0 items-center text-secondary-500 transition-colors hover:text-primary-600 dark:text-secondary-400 dark:hover:text-primary-400",s.icon),children:a.icon})]})}var Mm={sm:"px-2 py-1.5 text-xs min-h-[60px]",md:"px-3 py-2 text-sm min-h-[80px]",lg:"px-4 py-2.5 text-base min-h-[100px]"},Tm={default:"border-secondary-400 focus:border-primary-500 focus:ring-2 focus:ring-primary-500/20 dark:border-secondary-600",error:"border-danger-400 focus:border-danger-500 focus:ring-2 focus:ring-danger-500/20"};function Sm(e){if(!e)return 0;let t="\u2E80-\u2EFF\u3000-\u303F\u3040-\u309F\u30A0-\u30FF\u3400-\u4DBF\u4E00-\u9FFF\uAC00-\uD7AF\uF900-\uFAFF\uFE30-\uFE4F\uFF00-\uFFEF",r=new RegExp(`[${t}]`),n=0,o="",a=()=>{let i=o.trim();i&&(n+=i.split(/\s+/).length),o="";};for(let i of e)r.test(i)?(a(),n+=1):o+=i;return a(),n}function Ei({state:e="default",size:t="md",showWordCount:r=false,maxWords:n,className:o,value:a,defaultValue:i,onChange:s,disabled:l,...c}){let[u,p]=On.useState(()=>i??""),m=a!==void 0?String(a):u,d=On.useCallback(b=>{a===void 0&&p(b.target.value),s?.(b);},[a,s]),g=On.useMemo(()=>Sm(m),[m]),h=n!=null&&g>n;return jsxRuntime.jsxs("div",{className:f("inline-flex w-full flex-col",o),children:[jsxRuntime.jsx("textarea",{value:m,onChange:d,disabled:l,className:f("w-full resize-y rounded-md border bg-white text-secondary-900 transition-colors placeholder:text-secondary-400 focus:outline-none dark:bg-secondary-900 dark:text-secondary-100 dark:placeholder:text-secondary-600",Mm[t],Tm[h?"error":e],l&&"pointer-events-none opacity-50"),...c}),(r||n!=null)&&jsxRuntime.jsx("span",{className:f("mt-1 self-end text-xs",h?"text-danger-500 dark:text-danger-400":"text-secondary-400 dark:text-secondary-500"),children:n!=null?`${g} / ${n} words`:`${g} words`})]})}var Dm={sm:{trackFixed:"h-5 w-9",trackH:"h-5 min-w-9",thumb:"h-3.5 w-3.5",thumbTop:"top-[3px]",thumbOff:"left-[2px]",thumbOn:"left-[calc(100%-16px)]",pad:"pl-[6px] pr-[18px]",contentLeft:"left-[6px]",contentRight:"right-[6px]",icon:"text-[10px] [&_svg]:h-3 [&_svg]:w-3"},md:{trackFixed:"h-6 w-11",trackH:"h-6 min-w-11",thumb:"h-4.5 w-4.5",thumbTop:"top-[3px]",thumbOff:"left-[2px]",thumbOn:"left-[calc(100%-20px)]",pad:"pl-[7px] pr-[23px]",contentLeft:"left-[7px]",contentRight:"right-[7px]",icon:"text-xs [&_svg]:h-3.5 [&_svg]:w-3.5"},lg:{trackFixed:"h-7 w-14",trackH:"h-7 min-w-14",thumb:"h-5.5 w-5.5",thumbTop:"top-[3px]",thumbOff:"left-[3px]",thumbOn:"left-[calc(100%-25px)]",pad:"pl-[8px] pr-[28px]",contentLeft:"left-[8px]",contentRight:"right-[8px]",icon:"text-sm [&_svg]:h-4 [&_svg]:w-4"}},Am={primary:"text-primary-100",secondary:"text-secondary-100",danger:"text-danger-100",warning:"text-warning-100",success:"text-success-100"};function Rr({checked:e,defaultChecked:t=false,onCheckedChange:r,checkedContent:n,uncheckedContent:o,intent:a,size:i,label:s,id:l,className:c,disabled:u,...p}){let m=On.useId(),d=l??m,g=i??"md",h=a??"primary",b=Dm[g],y=n!=null||o!=null,[v,N]=On.useState(t),x=e??v,w=On.useCallback(L=>{let P=L.target.checked;e===void 0&&N(P),r?.(P);},[e,r]);return jsxRuntime.jsxs("label",{htmlFor:d,className:f("inline-flex cursor-pointer items-center gap-2",u&&"pointer-events-none opacity-50",c),children:[jsxRuntime.jsx("input",{...p,id:d,type:"checkbox",role:"switch",className:"sr-only",checked:x,disabled:u,onChange:w,"aria-checked":x}),jsxRuntime.jsxs("span",{className:f("relative inline-flex shrink-0 items-center rounded-full transition-colors duration-200",y?b.trackH:b.trackFixed,Do({intent:a,size:i,checked:x?"on":"off"})),children:[y?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("span",{className:f("pointer-events-none invisible inline-grid",b.icon),children:[jsxRuntime.jsx("span",{className:f("[grid-area:1/1] whitespace-nowrap",b.pad),children:n}),jsxRuntime.jsx("span",{className:f("[grid-area:1/1] whitespace-nowrap",b.pad),children:o})]}),jsxRuntime.jsx("span",{className:f("absolute top-1/2 -translate-y-1/2 whitespace-nowrap font-medium leading-none transition-opacity duration-200",b.contentLeft,b.icon,Am[h],x?"opacity-100":"opacity-0"),children:n}),jsxRuntime.jsx("span",{className:f("absolute top-1/2 -translate-y-1/2 whitespace-nowrap font-medium leading-none transition-opacity duration-200",b.contentRight,b.icon,"text-primary-400 dark:text-primary-500",x?"opacity-0":"opacity-100"),children:o})]}):null,jsxRuntime.jsx("span",{className:f("pointer-events-none absolute rounded-full bg-white shadow-sm transition-[left] duration-200 ease-in-out",b.thumb,b.thumbTop,x?b.thumbOn:b.thumbOff)})]}),s&&jsxRuntime.jsx("span",{className:"select-none text-sm text-primary-700 dark:text-primary-300",children:s})]})}var _m={sm:"h-3 w-3",md:"h-3.5 w-3.5",lg:"h-4 w-4"};function An({checked:e,defaultChecked:t=false,indeterminate:r=false,onCheckedChange:n,intent:o,size:a,label:i,id:s,className:l,disabled:c,...u}){let p=On.useId(),m=s??p,d=a??"md",[g,h]=On.useState(t),b=e??g,y=On.useCallback(N=>{let x=N.target.checked;e===void 0&&h(x),n?.(x);},[e,n]),v=b||r;return jsxRuntime.jsxs("label",{htmlFor:m,className:f("inline-flex cursor-pointer items-center gap-2 select-none",c&&"pointer-events-none opacity-50",l),children:[jsxRuntime.jsx("input",{...u,id:m,type:"checkbox",className:"sr-only",checked:b,disabled:c,onChange:y}),jsxRuntime.jsx("span",{className:f(Eo({intent:o,size:a,checked:v?"on":"off"})),children:jsxRuntime.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:f("text-white transition-all duration-200",_m[d],v?"scale-100 opacity-100":"scale-0 opacity-0"),children:r?jsxRuntime.jsx("line",{x1:"3",y1:"8",x2:"13",y2:"8",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}):jsxRuntime.jsx("path",{d:"M3.5 8.5L6.5 11.5L12.5 4.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),i&&jsxRuntime.jsx("span",{className:"text-sm text-primary-700 dark:text-primary-300",children:i})]})}var hc=On.createContext(null);function Li({name:e,value:t,defaultValue:r,onValueChange:n,intent:o,size:a,disabled:i,orientation:s="vertical",className:l,children:c}){let u=On.useId(),p=e??u,[m,d]=On.useState(r),g=t??m,h=On.useCallback(b=>{t===void 0&&d(b),n?.(b);},[t,n]);return jsxRuntime.jsx(hc.Provider,{value:{name:p,value:g,onChange:h,intent:o,size:a,disabled:i},children:jsxRuntime.jsx("div",{role:"radiogroup",className:f("flex gap-2",s==="vertical"?"flex-col":"flex-row flex-wrap",l),children:c})})}var Km={sm:"h-1.5 w-1.5",md:"h-2 w-2",lg:"h-2.5 w-2.5"};function Di({value:e,intent:t,size:r,label:n,id:o,className:a,disabled:i,...s}){let l=On.useId(),c=o??l,u=On.useContext(hc),p=t??u?.intent,m=r??u?.size,d=m??"md",g=i??u?.disabled,h=s.name??u?.name,b=u?u.value===e:void 0,y=On.useCallback(v=>{v.target.checked&&u?.onChange(e);},[u,e]);return jsxRuntime.jsxs("label",{htmlFor:c,className:f("inline-flex cursor-pointer items-center gap-2 select-none",g&&"pointer-events-none opacity-50",a),children:[jsxRuntime.jsx("input",{...s,id:c,type:"radio",name:h,value:e,className:"sr-only",checked:b,disabled:g,onChange:y}),jsxRuntime.jsx("span",{className:f(Lo({intent:p,size:m,checked:b?"on":"off"})),children:jsxRuntime.jsx("span",{className:f("rounded-full bg-white transition-all duration-200",Km[d],b?"scale-100 opacity-100":"scale-0 opacity-0")})}),n&&jsxRuntime.jsx("span",{className:"text-sm text-primary-700 dark:text-primary-300",children:n})]})}function Um(e,t){if(t)return t.slice(0,2).toUpperCase();if(!e)return "?";let r=e.trim().split(/\s+/);return r.length>=2?(r[0][0]+r[r.length-1][0]).toUpperCase():e.slice(0,2).toUpperCase()}var Xm={online:"ring-2 ring-success-500",offline:"ring-2 ring-secondary-400",busy:"ring-2 ring-danger-500",away:"ring-2 ring-warning-500"};function Ko({src:e,alt:t,initials:r,size:n,shape:o,status:a,className:i,...s}){let[l,c]=On.useState(false),u=e&&!l,p=Um(t,r);return jsxRuntime.jsx("span",{role:"img","aria-label":t??p,className:f(Pn({size:n,shape:o}),a&&Xm[a],"relative inline-flex shrink-0 select-none items-center justify-center overflow-hidden",i),...s,children:u?jsxRuntime.jsx("img",{src:e,alt:t,className:"h-full w-full object-cover",onError:()=>c(true),draggable:false}):jsxRuntime.jsx("span",{className:"font-semibold leading-none tracking-wide",children:p})})}function jo({children:e,max:t=4,overlap:r="left",className:n}){let o=On__default.default.Children.toArray(e),a=o.slice(0,t),i=o.length-t;return jsxRuntime.jsxs("span",{className:f("inline-flex items-center",r==="left"?"-space-x-3":"flex-row-reverse -space-x-3",n),children:[a.map((l,c)=>jsxRuntime.jsx("span",{className:"ring-2 ring-white dark:ring-primary-900 rounded-full",children:l},c)),i>0&&jsxRuntime.jsxs("span",{"aria-label":`${i} more`,className:f(Pn({size:"md",shape:"circular"}),"relative inline-flex shrink-0 select-none items-center justify-center","ring-2 ring-white dark:ring-primary-900","bg-secondary-200 text-secondary-700 dark:bg-secondary-700 dark:text-secondary-200 font-semibold text-xs"),children:["+",i]})]})}function lr(e,t,r){return Math.min(Math.max(e,t),r)}function qm(e,t,r){return Math.round((e-t)/r)*r+t}function Ai(e,t,r){return (e-t)/(r-t)*100}function bc(e,t,r,n){let o=t+e/100*(r-t);return qm(o,t,n)}function vc(e,t,r,n,o,a){let i=On.useRef(false),s=On.useCallback(p=>{let m=e.current;if(!m)return 0;let d=m.getBoundingClientRect(),h=(("touches"in p?p.touches[0].clientX:p.clientX)-d.left)/d.width*100;return lr(h,0,100)},[e]),l=On.useCallback(p=>{if(o)return;p.currentTarget.setPointerCapture(p.pointerId),i.current=true;let m=e.current;if(!m)return;let d=m.getBoundingClientRect(),g=(p.clientX-d.left)/d.width*100;a?.(bc(lr(g,0,100),t,r,n));},[o,s,t,r,n,a,e]),c=On.useCallback(p=>{if(!i.current||o)return;let m=e.current;if(!m)return;let d=m.getBoundingClientRect(),g=(p.clientX-d.left)/d.width*100;a?.(bc(lr(g,0,100),t,r,n));},[o,t,r,n,a,e]),u=On.useCallback(()=>{i.current=false;},[]);return {startDrag:l,onPointerMove:c,stopDrag:u}}function Yo({mode:e,value:t,defaultValue:r=0,onChange:n,min:o=0,max:a=100,step:i=1,intent:s,size:l,disabled:c,showValue:u=false,formatValue:p=String,label:m,className:d,id:g,...h}){let[b,y]=On.useState(r),v=t!==void 0,N=v?t:b,x=On.useId(),w=g??x,L=On.useRef(null),P=On.useCallback(k=>{let T=lr(k,o,a);v||y(T),n?.(T);},[v,o,a,n]),{startDrag:A,onPointerMove:D,stopDrag:S}=vc(L,o,a,i,c,P),C=Ai(N,o,a),I=k=>{let T=k.key==="ArrowRight"||k.key==="ArrowUp"?i:k.key==="ArrowLeft"||k.key==="ArrowDown"?-i:k.key==="Home"?-(N-o):k.key==="End"?a-N:0;T!==0&&(k.preventDefault(),P(N+T));};return jsxRuntime.jsxs("div",{className:f("slider-root flex flex-col gap-1",d),children:[jsxRuntime.jsx("input",{type:"range",id:w,className:"sr-only",tabIndex:-1,min:o,max:a,step:i,value:N,disabled:c,readOnly:true,onChange:()=>{}}),(m||u)&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[m&&jsxRuntime.jsx("label",{htmlFor:w,className:"text-sm font-medium text-primary-700 dark:text-primary-300",children:m}),u&&jsxRuntime.jsx("span",{className:"text-sm font-semibold text-primary-600 dark:text-primary-400",children:p(N)})]}),jsxRuntime.jsx("div",{...h,ref:L,className:f(Rn({intent:s,size:l}),c&&"opacity-40 cursor-not-allowed"),onPointerDown:A,onPointerMove:D,onPointerUp:S,onPointerCancel:S,style:{touchAction:"none"},children:jsxRuntime.jsxs("div",{className:"relative h-1.5 w-full grow rounded-full bg-primary-200 dark:bg-primary-700",children:[jsxRuntime.jsx("div",{className:"slider-fill absolute left-0 top-0 h-full rounded-full transition-none",style:{width:`${C}%`}}),jsxRuntime.jsx("div",{role:"slider",tabIndex:c?-1:0,"aria-valuemin":o,"aria-valuemax":a,"aria-valuenow":N,"aria-disabled":c,onKeyDown:I,className:f("slider-thumb absolute top-1/2 -translate-x-1/2 -translate-y-1/2","h-4 w-4 rounded-full border-2 bg-white shadow-md","transition-transform focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/40 focus-visible:scale-110",!c&&"cursor-grab active:cursor-grabbing active:scale-110"),style:{left:`${C}%`}})]})})]})}function Uo({value:e,defaultValue:t=[20,80],onChange:r,min:n=0,max:o=100,step:a=1,intent:i,size:s,disabled:l,showValue:c=false,formatValue:u=String,label:p,className:m,id:d,...g}){let[h,b]=On.useState(t),y=e!==void 0,[v,N]=y?e:h,x=On.useRef(null),w=On.useRef("lo"),L=On.useCallback(R=>{y||b(R),r?.(R);},[y,r]),P=On.useCallback(R=>{w.current==="lo"?L([lr(R,n,N),N]):L([v,lr(R,v,o)]);},[v,N,n,o,L]),{startDrag:A,onPointerMove:D,stopDrag:S}=vc(x,n,o,a,l,P),C=Ai(v,n,o),I=Ai(N,n,o),k=R=>O=>{w.current=R,A(O);},T=R=>O=>{let ne=O.key==="ArrowRight"||O.key==="ArrowUp"?a:O.key==="ArrowLeft"||O.key==="ArrowDown"?-a:0;ne!==0&&(O.preventDefault(),L(R==="lo"?[lr(v+ne,n,N),N]:[v,lr(N+ne,v,o)]));};return jsxRuntime.jsxs("div",{className:f("slider-root flex flex-col gap-1",m),children:[d&&jsxRuntime.jsx("input",{type:"range",id:d,className:"sr-only",tabIndex:-1,min:n,max:o,step:a,value:v,disabled:l,readOnly:true,onChange:()=>{}}),(p||c)&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[p&&jsxRuntime.jsx("span",{className:"text-sm font-medium text-primary-700 dark:text-primary-300",children:p}),c&&jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-primary-600 dark:text-primary-400",children:[u(v)," \u2013 ",u(N)]})]}),jsxRuntime.jsx("div",{...g,ref:x,className:f(Rn({intent:i,size:s}),l&&"opacity-40 cursor-not-allowed"),onPointerMove:D,onPointerUp:S,onPointerCancel:S,style:{touchAction:"none"},children:jsxRuntime.jsxs("div",{className:"relative h-1.5 w-full rounded-full bg-primary-200 dark:bg-primary-700",children:[jsxRuntime.jsx("div",{className:"slider-fill absolute top-0 h-full rounded-full",style:{left:`${C}%`,width:`${I-C}%`}}),jsxRuntime.jsx("div",{role:"slider",tabIndex:l?-1:0,"aria-valuemin":n,"aria-valuemax":N,"aria-valuenow":v,"aria-label":"Range start","aria-disabled":l,onPointerDown:k("lo"),onKeyDown:T("lo"),className:f("slider-thumb absolute top-1/2 -translate-x-1/2 -translate-y-1/2","h-4 w-4 rounded-full border-2 bg-white shadow-md","transition-transform focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/40 focus-visible:scale-110",!l&&"cursor-grab active:cursor-grabbing active:scale-110"),style:{left:`${C}%`,zIndex:v>N-a?3:2}}),jsxRuntime.jsx("div",{role:"slider",tabIndex:l?-1:0,"aria-valuemin":v,"aria-valuemax":o,"aria-valuenow":N,"aria-label":"Range end","aria-disabled":l,onPointerDown:k("hi"),onKeyDown:T("hi"),className:f("slider-thumb absolute top-1/2 -translate-x-1/2 -translate-y-1/2","h-4 w-4 rounded-full border-2 bg-white shadow-md","transition-transform focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/40 focus-visible:scale-110",!l&&"cursor-grab active:cursor-grabbing active:scale-110"),style:{left:`${I}%`,zIndex:2}})]})})]})}var Jm={warning:"text-warning-400",danger:"text-danger-400",success:"text-success-500",primary:"text-primary-500"},wc="text-secondary-200 dark:text-secondary-700";function kc({className:e}){return jsxRuntime.jsx("svg",{className:f("rating-icon transition-colors duration-150",e),viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:jsxRuntime.jsx("path",{d:"M12 2L15.09 8.26L22 9.27L17 14.14L18.18 21.02L12 17.77L5.82 21.02L7 14.14L2 9.27L8.91 8.26Z"})})}function Qm({fill:e,filledClass:t,icon:r,emptyIcon:n}){return jsxRuntime.jsxs("span",{className:"relative inline-flex",children:[n?jsxRuntime.jsx("span",{className:f("rating-icon",wc),children:n}):jsxRuntime.jsx(kc,{className:wc}),e>0&&jsxRuntime.jsx("span",{"aria-hidden":true,className:"absolute inset-0 overflow-hidden",style:{width:e===.5?"50%":"100%"},children:r?jsxRuntime.jsx("span",{className:f("rating-icon",t),children:r}):jsxRuntime.jsx(kc,{className:t})})]})}function Xo({value:e,defaultValue:t=0,max:r=5,size:n="md",intent:o="warning",precision:a=1,readOnly:i=false,disabled:s=false,onChange:l,icon:c,emptyIcon:u,label:p="Rating",className:m}){let[d,g]=On.useState(t),[h,b]=On.useState(null),y=e!==void 0,v=y?e:d,N=h??v,x=On.useCallback(S=>{s||i||(y||g(S),l?.(S));},[s,i,y,l]),w=On.useCallback(()=>{!s&&!i&&b(null);},[s,i]),L=On.useCallback(S=>{s||i||(S.key==="ArrowRight"||S.key==="ArrowUp"?(S.preventDefault(),x(Math.min(v+a,r))):S.key==="ArrowLeft"||S.key==="ArrowDown"?(S.preventDefault(),x(Math.max(v-a,0))):S.key==="Home"?(S.preventDefault(),x(0)):S.key==="End"&&(S.preventDefault(),x(r)));},[s,i,v,a,r,x]),P=S=>N>=S?1:a===.5&&N>=S-.5?.5:0,A=Jm[o],D=!i&&!s;return jsxRuntime.jsx("div",{role:"radiogroup","aria-label":p,className:f(Ao({size:n}),s&&"opacity-50 cursor-not-allowed",D&&"cursor-pointer",m),onMouseLeave:D?w:void 0,onKeyDown:D?L:void 0,children:Array.from({length:r},(S,C)=>{let I=C+1,k=P(I),T=jsxRuntime.jsx(Qm,{fill:k,filledClass:A,icon:c,emptyIcon:u});if(!D)return jsxRuntime.jsx("span",{role:"radio","aria-label":`${I} star${I!==1?"s":""}`,"aria-checked":Math.round(v)===I,children:T},I);let R=z=>{if(a===.5){let H=z.currentTarget.getBoundingClientRect(),_=z.clientX-H.left<H.width/2;b(_?I-.5:I);}else b(I);},O=z=>{if(a===.5){let H=z.currentTarget.getBoundingClientRect(),_=z.clientX-H.left<H.width/2;x(_?I-.5:I);}else x(I);},E=Math.round(v/a)*a,U=E===I||a===.5&&E===I-.5||v===0&&I===1?0:-1;return jsxRuntime.jsx("button",{type:"button",role:"radio","aria-label":`${I} star${I!==1?"s":""}`,"aria-checked":Math.round(v)===I,tabIndex:U,className:"border-0 bg-transparent p-0 cursor-pointer rounded transition-transform duration-100 hover:scale-110 focus:outline-none focus-visible:ring-2 focus-visible:ring-primary-500",onMouseMove:R,onMouseEnter:R,onClick:O,children:T},I)})})}function Zr({size:e="sm",variant:t="default",className:r,children:n,...o}){return jsxRuntime.jsx("kbd",{className:f(Io({size:e,variant:t}),r),...o,children:n})}function en({separator:e="+",className:t,children:r}){let n=On__default.default.Children.toArray(r);return jsxRuntime.jsx("span",{className:f("inline-flex items-center gap-1",t),children:n.map((o,a)=>jsxRuntime.jsxs(On__default.default.Fragment,{children:[o,a<n.length-1&&jsxRuntime.jsx("span",{className:"select-none text-xs text-secondary-400 dark:text-secondary-500","aria-hidden":true,children:e})]},a))})}var tf={Button:Vt,Dropdown:wi,DropdownButton:qr,Badge:Si,Tag:Pi,Indicator:Ri,Label:_t,Input:Ft,TextBox:Ei,Switch:Rr,Checkbox:An,Radio:Di,RadioGroup:Li,Avatar:Ko,AvatarGroup:jo,Slider:Yo,SliderRange:Uo,Rating:Xo,Kbd:Zr,KbdGroup:en},Vi=tf;var In=classVarianceAuthority.cva("rounded-lg transition-shadow",{variants:{intent:{default:"border border-primary-200 bg-white dark:border-primary-700 dark:bg-primary-900",elevated:"bg-white shadow-md hover:shadow-lg dark:bg-primary-800 dark:shadow-primary-300/25 dark:hover:shadow-primary-200/30",outlined:"border-2 border-primary-300 bg-transparent dark:border-primary-600",ghost:"bg-primary-50 dark:bg-primary-800/50"},size:{sm:"p-3",md:"p-5",lg:"p-7"}},defaultVariants:{intent:"default",size:"md"}}),Go=classVarianceAuthority.cva("rounded-md",{variants:{intent:{default:"border border-primary-200 bg-white dark:border-primary-700 dark:bg-primary-900",inset:"bg-primary-50 dark:bg-primary-800/50",elevated:"bg-white shadow-lg dark:bg-primary-800 dark:shadow-primary-300/25"},size:{sm:"p-3",md:"p-4",lg:"p-6"}},defaultVariants:{intent:"default",size:"md"}});function Hi({intent:e,size:t,className:r,...n}){return jsxRuntime.jsx("div",{className:f(In({intent:e,size:t}),r),...n})}function rf({className:e,...t}){return jsxRuntime.jsx("div",{className:f("mb-4 space-y-1",e),...t})}function nf({className:e,...t}){return jsxRuntime.jsx("h3",{className:f("text-primary-900 dark:text-primary-100 text-lg font-semibold",e),...t})}function of({className:e,...t}){return jsxRuntime.jsx("p",{className:f("text-primary-500 dark:text-primary-400 text-sm",e),...t})}function af({className:e,...t}){return jsxRuntime.jsx("div",{className:f("text-primary-700 dark:text-primary-300 text-sm",e),...t})}function sf({className:e,...t}){return jsxRuntime.jsx("div",{className:f("border-primary-100 dark:border-primary-800 mt-4 flex items-center gap-2 border-t pt-4",e),...t})}function lf({intent:e,media:t,mediaPosition:r="left",stackOnMobile:n=false,className:o,children:a,...i}){let s=jsxRuntime.jsx("div",{className:f("relative shrink-0 overflow-hidden",n?"h-48 w-full rounded-t-lg sm:h-auto sm:w-auto":"",!n&&(r==="left"?"rounded-l-lg":"rounded-r-lg")),style:n?void 0:{width:t.width??"10rem"},children:t.src?jsxRuntime.jsx("img",{src:t.src,alt:t.alt??"",className:"h-full w-full object-cover",draggable:false}):t.icon?jsxRuntime.jsx("div",{className:"bg-primary-100 text-primary-500 dark:bg-primary-800 dark:text-primary-400 flex h-full w-full items-center justify-center",children:t.icon}):null});return jsxRuntime.jsxs("div",{className:f(In({intent:e}),"flex overflow-hidden p-0",n?"flex-col sm:flex-row":"",!n&&r==="right"&&"flex-row-reverse",!n&&r==="left"&&"flex-row",o),...i,children:[s,jsxRuntime.jsx("div",{className:"flex min-w-0 flex-1 flex-col p-4",children:a})]})}function _i({src:e,alt:t="",aspectRatio:r="16/9",className:n,children:o,...a}){return jsxRuntime.jsxs("div",{className:f("group overflow-hidden rounded-xl border transition-shadow duration-300","border-primary-200 dark:border-primary-700 dark:bg-primary-900 bg-white","dark:hover:shadow-primary-900/60 hover:shadow-lg",n),...a,children:[jsxRuntime.jsxs("div",{className:"relative overflow-hidden",style:{aspectRatio:r},children:[jsxRuntime.jsx("img",{src:e,alt:t,className:"h-full w-full object-cover transition-transform duration-500 ease-out group-hover:scale-110",draggable:false}),jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-0 opacity-0 transition-opacity duration-300 group-hover:opacity-100","aria-hidden":true,children:jsxRuntime.jsx("div",{className:"animate-light-sweep absolute inset-0"})})]}),o]})}function df({className:e,...t}){return jsxRuntime.jsx("div",{className:f("space-y-2 p-4",e),...t})}function uf({className:e,...t}){return jsxRuntime.jsx("h3",{className:f("text-primary-900 dark:text-primary-100 text-base font-semibold",e),...t})}function pf({className:e,...t}){return jsxRuntime.jsx("p",{className:f("text-primary-500 dark:text-primary-400 text-sm",e),...t})}function mf({className:e,...t}){return jsxRuntime.jsx("div",{className:f("border-primary-100 dark:border-primary-800 flex items-center gap-2 border-t px-4 py-3",e),...t})}function Fi({intent:e,size:t,className:r,...n}){return jsxRuntime.jsx("div",{className:f(Go({intent:e,size:t}),r),...n})}function ff({className:e,...t}){return jsxRuntime.jsx("div",{className:f("border-primary-200 text-primary-900 dark:border-primary-700 dark:text-primary-100 mb-3 flex items-center gap-1.5 border-b pb-3 text-sm font-semibold [&_svg]:h-4 [&_svg]:w-4 [&_svg]:shrink-0",e),...t})}function hf({className:e,...t}){return jsxRuntime.jsx("div",{className:f("text-primary-700 dark:text-primary-300 text-sm",e),...t})}var Lc="onyx-split:",Pc=10;function Rc(e){if(!e)return {};try{let t=localStorage.getItem(Lc+e);if(t)return JSON.parse(t)}catch{}return {}}function Ec(e,t){if(e)try{localStorage.setItem(Lc+e,JSON.stringify(t));}catch{}}function Dc(e,t){return e.filter(r=>t[r.id]!==false).map(r=>r.id)}function Vn(e,t,r){return Math.max(t,Math.min(r,e))}function Ac({panes:e,direction:t,containerRef:r,visibility:n,autoSaveId:o,onResizeEnd:a}){let i=t==="horizontal",[s,l]=On.useState(()=>Rc(o)),c=On.useRef(false);On.useEffect(()=>{if(c.current)return;let y=r.current;if(!y)return;let v=i?y.clientWidth:y.clientHeight,N=Rc(o),x={},w=[],L=0;for(let P of e){if(!(n[P.id]!==false)){x[P.id]=N[P.id]??P.defaultSize??200;continue}N[P.id]!==void 0?(x[P.id]=N[P.id],L+=N[P.id]):P.defaultSize!==void 0?(x[P.id]=P.defaultSize,L+=P.defaultSize):w.push(P);}if(w.length>0){let A=Math.max(0,v-L)/w.length;for(let D of w)x[D.id]=Math.max(A,D.minSize??48);}c.current=true,l(x);},[]);let u=On.useRef(n),p=On.useRef(e.map(y=>y.id));On.useEffect(()=>{let y=u.current,v=p.current,N=e.map(A=>A.id);u.current=n,p.current=N;let x=N.filter(A=>!v.includes(A)),w=v.filter(A=>!N.includes(A)),L=[],P=[];for(let A of e){if(x.includes(A.id))continue;let D=y[A.id]!==false,S=n[A.id]!==false;D&&!S&&L.push(A.id),!D&&S&&P.push(A.id);}x.length===0&&w.length===0&&L.length===0&&P.length===0||l(A=>{let D={...A};for(let S of w){let C=D[S]??0;if(delete D[S],C>0){let I=v.indexOf(S),k=N.filter(R=>n[R]!==false),T=k.find((R,O)=>v.indexOf(N[N.indexOf(k[O])])>I);T||(T=k[k.length-1]),T&&(D[T]=(D[T]??0)+C);}}for(let S of x){let C=e.find(R=>R.id===S);if(n[S]===false){D[S]=C.defaultSize??200;continue}let I=C.defaultSize??200,k=Math.max(I,C.minSize??48),T=N.filter(R=>R!==S&&!x.includes(R)&&n[R]!==false).map(R=>({id:R,size:D[R]??0})).sort((R,O)=>O.size-R.size);if(T.length>0){let O=e.find(U=>U.id===T[0].id)?.minSize??48,E=Math.max(0,T[0].size-O),ne=Math.min(k,E);D[T[0].id]=T[0].size-ne,D[S]=ne;}else D[S]=k;}for(let S of L){let C=D[S]??0;if(C===0)continue;let I=e.findIndex(T=>T.id===S),k;for(let T=I+1;T<e.length;T++)if(n[e[T].id]!==false&&!L.includes(e[T].id)){k=e[T].id;break}if(!k){for(let T=I-1;T>=0;T--)if(n[e[T].id]!==false&&!L.includes(e[T].id)){k=e[T].id;break}}k&&(D[k]=(D[k]??0)+C),D[S]=C;}for(let S of P){let C=D[S]??e.find(T=>T.id===S)?.defaultSize??200,I=e.findIndex(T=>T.id===S),k;for(let T=I+1;T<e.length;T++)if(n[e[T].id]!==false&&!P.includes(e[T].id)){k=e[T].id;break}if(!k){for(let T=I-1;T>=0;T--)if(n[e[T].id]!==false&&!P.includes(e[T].id)){k=e[T].id;break}}if(k){let T=D[k]??0,R=e.find(ne=>ne.id===k)?.minSize??48,O=Math.max(0,T-R),E=Math.min(C,O);D[k]=T-E,D[S]=E;}else D[S]=C;}return D});},[n,e]);let m=On.useRef(null),[d,g]=On.useState(null),h=On.useRef(null),b=On.useCallback((y,v,N)=>{let x=v.minSize??48,w=v.maxSize??1/0,L=N.minSize??48,P=N.maxSize??1/0;return {onPointerDown:I=>{I.preventDefault();try{I.currentTarget.setPointerCapture(I.pointerId);}catch{}m.current={idA:v.id,idB:N.id,startPos:i?I.clientX:I.clientY,startA:s[v.id]??0,startB:s[N.id]??0,minA:x,maxA:w,minB:L,maxB:P},h.current=y,g(y);},onPointerMove:I=>{if(!m.current||h.current!==y)return;let{idA:k,idB:T,startPos:R,startA:O,startB:E,minA:ne,maxA:U,minB:z,maxB:H}=m.current,_=(i?I.clientX:I.clientY)-R,V=O+_,oe=E-_;V<ne&&(V=ne,oe=O+E-ne),V>U&&(V=U,oe=O+E-U),oe<z&&(oe=z,V=O+E-z),oe>H&&(oe=H,V=O+E-H),V=Vn(V,ne,U),oe=Vn(oe,z,H),l(be=>({...be,[k]:V,[T]:oe}));},onPointerUp:I=>{!m.current||h.current!==y||(m.current=null,h.current=null,g(null),l(k=>(Ec(o,k),a?.(k),k)));},onKeyDown:I=>{if(!(i?["ArrowLeft","ArrowRight"]:["ArrowUp","ArrowDown"]).includes(I.key))return;I.preventDefault();let T=I.key==="ArrowLeft"||I.key==="ArrowUp"?-Pc:Pc;l(R=>{let O=R[v.id]??0,E=R[N.id]??0,ne=Vn(O+T,x,w),U=O+E-ne;U=Vn(U,L,P),ne=O+E-U,ne=Vn(ne,x,w);let z={...R,[v.id]:ne,[N.id]:U};return Ec(o,z),a?.(z),z});}}},[i,s,o,a]);return {sizes:s,activeHandleIndex:d,buildHandlers:b}}var vf=8;function xf({isDragging:e,handleSize:t,isHorizontal:r,paneA:n,paneB:o,onPointerDown:a,onPointerMove:i,onPointerUp:s,onKeyDown:l}){let c=Math.max(1,t),u=Math.max(c,vf);return jsxRuntime.jsxs("div",{role:"separator","aria-orientation":r?"vertical":"horizontal","aria-label":`Resize handle between ${n.id} and ${o.id}`,tabIndex:0,className:f("group relative z-10 shrink-0 select-none outline-none",r?"cursor-col-resize":"cursor-row-resize"),style:r?{width:u,minWidth:u}:{height:u,minHeight:u},onPointerDown:a,onPointerMove:i,onPointerUp:s,onPointerCancel:s,onKeyDown:l,children:[jsxRuntime.jsx("div",{"aria-hidden":"true",className:f("pointer-events-none absolute rounded-sm transition-colors duration-150","bg-primary-200 dark:bg-primary-700","group-hover:bg-primary-400 dark:group-hover:bg-primary-500","group-focus-visible:bg-primary-400 dark:group-focus-visible:bg-primary-500",e?"bg-primary-500 dark:bg-primary-400":void 0,r?"top-0 bottom-0 left-1/2 -translate-x-1/2":"left-0 right-0 top-1/2 -translate-y-1/2"),style:r?{width:c}:{height:c}}),jsxRuntime.jsx("div",{"aria-hidden":"true",className:f("pointer-events-none absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2","flex gap-0.5 opacity-0 transition-opacity duration-150","group-hover:opacity-100",e?"opacity-100":void 0,r?"flex-col":"flex-row"),children:[0,1,2].map(p=>jsxRuntime.jsx("span",{className:f("rounded-full bg-primary-400 dark:bg-primary-500","h-0.5 w-0.5")},p))})]})}function wf({pane:e,sizeInPx:t,isHorizontal:r,defaultBackground:n}){let o=e.background??n;return jsxRuntime.jsx("div",{"data-split-pane-id":e.id,className:f("relative overflow-auto",e.className),style:{...r?{width:t,minWidth:0,flexShrink:0}:{height:t,minHeight:0,flexShrink:0},...o?{background:o}:{},...e.style},children:e.children})}function qo({direction:e="horizontal",panes:t,visibility:r={},onVisibilityChange:n,width:o="100%",height:a="100%",handleSize:i=4,defaultBackground:s,autoSaveId:l,onResizeEnd:c,className:u,style:p}){let m=On.useRef(null),d=e==="horizontal",{sizes:g,activeHandleIndex:h,buildHandlers:b}=Ac({panes:t,direction:e,containerRef:m,visibility:r,autoSaveId:l,onResizeEnd:c}),y=Dc(t,r),v=t.filter(x=>y.includes(x.id)),N=(x,w)=>x===void 0?w:typeof x=="number"?`${x}px`:x;return jsxRuntime.jsx("div",{ref:m,"data-split-panel":true,"data-direction":e,className:f("flex overflow-hidden",d?"flex-row":"flex-col",u),style:{width:N(o,"100%"),height:N(a,"100%"),...p},children:v.map((x,w)=>{let L=g[x.id]??x.defaultSize??200,P=w===v.length-1,A=v[w+1],D=w,S=h===D,C=!P&&A?b(D,x,A):null;return jsxRuntime.jsxs(On__default.default.Fragment,{children:[jsxRuntime.jsx(wf,{pane:x,sizeInPx:L,isHorizontal:d,defaultBackground:s}),!P&&A&&C&&jsxRuntime.jsx(xf,{index:D,paneA:x,paneB:A,isDragging:S,handleSize:i,isHorizontal:d,onPointerDown:C.onPointerDown,onPointerMove:C.onPointerMove,onPointerUp:C.onPointerUp,onKeyDown:C.onKeyDown})]},x.id)})})}var kf={Card:Hi,ImageCard:_i,Panel:Fi,SplitPanel:qo},Oi=kf;var Jo=classVarianceAuthority.cva("w-full text-left text-sm",{variants:{intent:{default:"",striped:"[&_tbody_tr:nth-child(even)]:bg-primary-50 dark:[&_tbody_tr:nth-child(even)]:bg-primary-800/30",bordered:"[&_th]:border [&_td]:border [&_th]:border-primary-200 [&_td]:border-primary-200 dark:[&_th]:border-primary-700 dark:[&_td]:border-primary-700"},density:{compact:"[&_th]:px-2 [&_th]:py-1 [&_td]:px-2 [&_td]:py-1",default:"",relaxed:"[&_th]:px-6 [&_th]:py-5 [&_td]:px-6 [&_td]:py-5"}},defaultVariants:{intent:"default",density:"default"}}),Qo=classVarianceAuthority.cva("text-sm text-primary-700 dark:text-primary-300",{variants:{intent:{default:"space-y-1",bordered:"divide-y divide-primary-200 rounded-lg border border-primary-200 dark:divide-primary-700 dark:border-primary-700 [&>li]:px-4 [&>li]:py-2",hover:"[&>li]:rounded-md [&>li]:px-3 [&>li]:py-2 [&>li]:transition-colors [&>li:hover]:bg-primary-50 dark:[&>li:hover]:bg-primary-800/50"}},defaultVariants:{intent:"default"}}),Zo=classVarianceAuthority.cva("group flex w-full items-center gap-1.5 text-left [&_svg]:shrink-0",{variants:{size:{sm:"py-0.5 text-xs [&_svg]:h-3 [&_svg]:w-3",md:"py-1.5 text-sm [&_svg]:h-3.5 [&_svg]:w-3.5",lg:"py-2 text-base [&_svg]:h-4 [&_svg]:w-4"}},defaultVariants:{size:"md"}}),ea=classVarianceAuthority.cva("flex cursor-pointer items-center gap-1 rounded transition-colors [&_svg]:shrink-0",{variants:{size:{sm:"py-0.5 text-xs [&_svg]:h-3.5 [&_svg]:w-3.5",md:"py-1 text-sm [&_svg]:h-4 [&_svg]:w-4",lg:"py-1.5 text-base [&_svg]:h-5 [&_svg]:w-5"}},defaultVariants:{size:"md"}}),ta=classVarianceAuthority.cva("relative rounded-xl border bg-white p-5 shadow-sm transition-shadow hover:shadow-md dark:bg-primary-900",{variants:{intent:{primary:"border-primary-200 dark:border-primary-700",success:"border-success-200 dark:border-success-800",danger:"border-danger-200 dark:border-danger-800",warning:"border-warning-200 dark:border-warning-800"},size:{sm:"p-4",md:"p-5",lg:"p-6"}},defaultVariants:{intent:"primary",size:"md"}}),ra=classVarianceAuthority.cva("relative overflow-hidden rounded-xl border bg-white p-5 shadow-sm transition-all duration-300 hover:shadow-lg dark:bg-primary-900",{variants:{intent:{primary:"border-primary-200 dark:border-primary-700",success:"border-success-200 dark:border-success-800",danger:"border-danger-200 dark:border-danger-800",warning:"border-warning-200 dark:border-warning-800"},size:{sm:"p-4",md:"p-5",lg:"p-6"}},defaultVariants:{intent:"primary",size:"md"}}),Hn=classVarianceAuthority.cva("overflow-x-auto rounded-lg font-mono [background:var(--color-syntax-bg)] [&_pre]:m-0 [&_pre]:p-4 [&_code]:bg-transparent",{variants:{size:{sm:"text-xs",md:"text-sm",lg:"text-base"}},defaultVariants:{size:"md"}});function Bn({intent:e,density:t,className:r,...n}){return jsxRuntime.jsx("div",{className:"w-full overflow-auto",children:jsxRuntime.jsx("table",{className:f(Jo({intent:e,density:t}),r),...n})})}function Ki({className:e,...t}){return jsxRuntime.jsx("thead",{className:f("bg-primary-50 text-primary-600 dark:bg-primary-800/50 dark:text-primary-400",e),...t})}function ji({className:e,...t}){return jsxRuntime.jsx("tbody",{className:f("[&_tr:last-child]:border-0",e),...t})}function Fn({className:e,...t}){return jsxRuntime.jsx("tr",{className:f("border-primary-200 hover:bg-primary-50/50 dark:border-primary-700 dark:hover:bg-primary-800/30 border-b transition-colors",e),...t})}function zr({className:e,...t}){return jsxRuntime.jsx("th",{className:f("px-4 py-3 text-left text-xs font-semibold tracking-wider uppercase",e),...t})}function Vr({className:e,...t}){return jsxRuntime.jsx("td",{className:f("text-primary-700 dark:text-primary-300 px-4 py-3",e),...t})}function Wi({icon:e,text:t="No data",className:r}){return jsxRuntime.jsxs("div",{className:f("flex flex-col items-center justify-center gap-3 py-16 text-primary-400 dark:text-primary-500",r),children:[e??jsxRuntime.jsx(lucideReact.Inbox,{className:"h-12 w-12 stroke-[1.2]"}),jsxRuntime.jsx("span",{className:"text-sm",children:t})]})}var zc={sm:"hidden sm:table-cell",md:"hidden md:table-cell",lg:"hidden lg:table-cell"};function If({columns:e,data:t,sort:r,onSortChange:n,defaultSort:o=null,rowKey:a,rowActions:i,intent:s,density:l,className:c,empty:u}){let[p,m]=On.useState(o),d=r??p,g=On.useCallback(b=>{let y=d?.column===b?d.direction==="asc"?{column:b,direction:"desc"}:null:{column:b,direction:"asc"};n?n(y):m(y);},[d,n]),h=On.useMemo(()=>{if(!d)return t;let b=e.find(N=>N.key===d.column);if(!b)return t;let y=b.compareFn??((N,x)=>{let w=b.cell(N),L=b.cell(x);return w==null&&L==null?0:w==null?-1:L==null?1:typeof w=="number"&&typeof L=="number"?w-L:String(w).localeCompare(String(L))}),v=[...t].sort(y);return d.direction==="desc"?v.reverse():v},[t,d,e]);return jsxRuntime.jsxs(Bn,{intent:s,density:l,className:c,children:[jsxRuntime.jsx(Ki,{children:jsxRuntime.jsxs(Fn,{children:[e.map(b=>{let y=b.sortable!==false,v=d?.column===b.key;return jsxRuntime.jsx(zr,{className:f(y&&"cursor-pointer select-none",b.headerClassName,b.hideBelow&&zc[b.hideBelow]),onClick:y?()=>g(b.key):void 0,"aria-sort":v?d.direction==="asc"?"ascending":"descending":void 0,children:jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1",children:[b.header,y&&jsxRuntime.jsx(Vc,{active:v,direction:v?d.direction:null})]})},b.key)}),i&&jsxRuntime.jsx(zr,{className:"w-20 text-right",children:"Actions"})]})}),jsxRuntime.jsx(ji,{children:h.length===0?jsxRuntime.jsx("tr",{children:jsxRuntime.jsx("td",{colSpan:e.length+(i?1:0),children:jsxRuntime.jsx(Wi,{...u})})}):h.map((b,y)=>jsxRuntime.jsxs(Fn,{children:[e.map(v=>jsxRuntime.jsx(Vr,{className:f(v.cellClassName,v.hideBelow&&zc[v.hideBelow]),children:v.cell(b)},v.key)),i&&jsxRuntime.jsx(Vr,{className:"text-right",children:jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1",children:i(b)})})]},a?a(b,y):y))})]})}function zf({value:e,onCommit:t,onCancel:r}){let[n,o]=On.useState(e),a=On.useRef(null);On.useEffect(()=>{a.current?.focus(),a.current?.select();},[]);let i=()=>t(n);return jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("input",{ref:a,type:"text",value:n,onChange:s=>o(s.target.value),onKeyDown:s=>{s.key==="Enter"&&i(),s.key==="Escape"&&r();},"aria-label":"Edit cell",className:"min-w-0 flex-1 rounded border border-primary-400 bg-white px-1.5 py-0.5 text-sm outline-none focus:ring-1 focus:ring-primary-400 dark:border-primary-600 dark:bg-secondary-800"}),jsxRuntime.jsx("button",{type:"button",onClick:i,className:"text-success-600 hover:text-success-700 dark:text-success-400","aria-label":"Confirm",children:jsxRuntime.jsx(lucideReact.Check,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("button",{type:"button",onClick:r,className:"text-danger-500 hover:text-danger-600 dark:text-danger-400","aria-label":"Cancel",children:jsxRuntime.jsx(lucideReact.X,{className:"h-3.5 w-3.5"})})]})}function Vf({columns:e,data:t,rowKey:r,sort:n,onSortChange:o,defaultSort:a=null,selectionMode:i="none",selected:s,onSelectionChange:l,editable:c=false,onCellEdit:u,toolbar:p=false,onAdd:m,onDelete:d,rowActions:g,intent:h,density:b,className:y,empty:v}){let[N,x]=On.useState(a),w=n??N,L=On.useCallback(_=>{let V=w?.column===_?w.direction==="asc"?{column:_,direction:"desc"}:null:{column:_,direction:"asc"};o?o(V):x(V);},[w,o]),P=On.useMemo(()=>{if(!w)return t;let _=e.find(be=>be.key===w.column);if(!_)return t;let V=_.compareFn??((be,M)=>{let F=_.cell(be),re=_.cell(M);return F==null&&re==null?0:F==null?-1:re==null?1:typeof F=="number"&&typeof re=="number"?F-re:String(F).localeCompare(String(re))}),oe=[...t].sort(V);return w.direction==="desc"?oe.reverse():oe},[t,w,e]),[A,D]=On.useState([]),S=s??A,C=l??D,I=On.useMemo(()=>P.map((_,V)=>r(_,V)),[P,r]),k=i==="multiple"&&I.length>0&&I.every(_=>S.includes(_)),T=i==="multiple"&&S.length>0&&!k,R=On.useCallback(_=>{i==="single"?C(S.includes(_)?[]:[_]):i==="multiple"&&C(S.includes(_)?S.filter(V=>V!==_):[...S,_]);},[i,S,C]),O=On.useCallback(()=>{C(k?[]:I);},[k,I,C]),[E,ne]=On.useState(null),U=On.useCallback((_,V,oe)=>{c&&oe!==false&&ne({rowKey:_,colKey:V});},[c]),z=On.useCallback((_,V,oe)=>{u?.(_,V,oe),ne(null);},[u]);return jsxRuntime.jsxs("div",{className:"space-y-2",children:[p&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[m&&jsxRuntime.jsxs("button",{type:"button",onClick:m,className:"inline-flex items-center gap-1.5 rounded-md border border-secondary-300 bg-white px-3 py-1.5 text-sm font-medium text-secondary-700 transition-colors hover:bg-secondary-50 dark:border-secondary-600 dark:bg-secondary-800 dark:text-secondary-300 dark:hover:bg-secondary-700",children:[jsxRuntime.jsx(lucideReact.Plus,{className:"h-3.5 w-3.5"})," Add"]}),d&&jsxRuntime.jsxs("button",{type:"button",onClick:()=>d(S),disabled:S.length===0,className:"inline-flex items-center gap-1.5 rounded-md border border-secondary-300 bg-white px-3 py-1.5 text-sm font-medium text-danger-600 transition-colors hover:bg-danger-50 disabled:opacity-40 disabled:pointer-events-none dark:border-secondary-600 dark:bg-secondary-800 dark:text-danger-400 dark:hover:bg-danger-900/20",children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"h-3.5 w-3.5"})," Delete",S.length>0&&` (${S.length})`]}),c&&S.length===1&&jsxRuntime.jsxs("button",{type:"button",onClick:()=>{let _=e.find(V=>V.editable!==false);_&&ne({rowKey:S[0],colKey:_.key});},className:"inline-flex items-center gap-1.5 rounded-md border border-secondary-300 bg-white px-3 py-1.5 text-sm font-medium text-secondary-700 transition-colors hover:bg-secondary-50 dark:border-secondary-600 dark:bg-secondary-800 dark:text-secondary-300 dark:hover:bg-secondary-700",children:[jsxRuntime.jsx(lucideReact.Pencil,{className:"h-3.5 w-3.5"})," Edit"]}),S.length>0&&jsxRuntime.jsxs("span",{className:"ml-auto text-sm text-secondary-500 dark:text-secondary-400",children:[S.length," row",S.length>1?"s":""," selected"]})]}),jsxRuntime.jsxs(Bn,{intent:h,density:b,className:y,children:[jsxRuntime.jsx(Ki,{children:jsxRuntime.jsxs(Fn,{children:[i==="multiple"&&jsxRuntime.jsx(zr,{className:"w-10",children:jsxRuntime.jsx("input",{type:"checkbox",checked:k,ref:_=>{_&&(_.indeterminate=T);},onChange:O,className:"h-4 w-4 cursor-pointer rounded border-secondary-300 accent-primary-600","aria-label":"Select all"})}),i==="single"&&jsxRuntime.jsx(zr,{className:"w-10"}),e.map(_=>{let V=_.sortable!==false,oe=w?.column===_.key;return jsxRuntime.jsx(zr,{className:f(V&&"cursor-pointer select-none",_.headerClassName),onClick:V?()=>L(_.key):void 0,"aria-sort":oe?w.direction==="asc"?"ascending":"descending":void 0,children:jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1",children:[_.header,V&&jsxRuntime.jsx(Vc,{active:oe,direction:oe?w.direction:null})]})},_.key)}),g&&jsxRuntime.jsx(zr,{className:"w-20 text-right",children:"Actions"})]})}),jsxRuntime.jsx(ji,{children:P.length===0?jsxRuntime.jsx("tr",{children:jsxRuntime.jsx("td",{colSpan:e.length+(i!=="none"?1:0)+(g?1:0),children:jsxRuntime.jsx(Wi,{...v})})}):P.map((_,V)=>{let oe=r(_,V),be=S.includes(oe);return jsxRuntime.jsxs(Fn,{className:f(be&&"bg-primary-50/60 dark:bg-primary-900/20"),onClick:()=>{i!=="none"&&R(oe);},children:[i==="multiple"&&jsxRuntime.jsx(Vr,{className:"w-10",children:jsxRuntime.jsx("input",{type:"checkbox",checked:be,onChange:()=>R(oe),onClick:M=>M.stopPropagation(),className:"h-4 w-4 cursor-pointer rounded border-secondary-300 accent-primary-600","aria-label":"Select row"})}),i==="single"&&jsxRuntime.jsx(Vr,{className:"w-10",children:jsxRuntime.jsx("input",{type:"radio",checked:be,onChange:()=>R(oe),onClick:M=>M.stopPropagation(),className:"h-4 w-4 cursor-pointer accent-primary-600","aria-label":"Select row"})}),e.map(M=>{let F=E?.rowKey===oe&&E?.colKey===M.key,re=M.editValue?.(_)??(()=>{let W=M.cell(_);return typeof W=="string"||typeof W=="number"?String(W):""})();return jsxRuntime.jsx(Vr,{className:f(M.cellClassName,c&&M.editable!==false&&"cursor-text"),onDoubleClick:W=>{W.stopPropagation(),U(oe,M.key,M.editable);},children:F?jsxRuntime.jsx(zf,{value:re,onCommit:W=>z(oe,M.key,W),onCancel:()=>ne(null)}):M.cell(_)},M.key)}),g&&jsxRuntime.jsx(Vr,{className:"text-right",onClick:M=>M.stopPropagation(),children:jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1",children:g(_)})})]},oe)})})]})]})}function Vc({active:e,direction:t}){let r="h-3.5 w-3.5 shrink-0";return !e||!t?jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:f(r,"opacity-30")}):t==="asc"?jsxRuntime.jsx(lucideReact.ArrowUp,{className:f(r,"opacity-70")}):jsxRuntime.jsx(lucideReact.ArrowDown,{className:f(r,"opacity-70")})}var Hc=On.createContext({size:"md"});function Yi({intent:e,size:t="md",className:r,...n}){return jsxRuntime.jsx(Hc.Provider,{value:{size:t},children:jsxRuntime.jsx("ul",{className:f(Qo({intent:e}),r),...n})})}function Ff({actions:e,className:t,children:r,...n}){let{size:o}=On.useContext(Hc);return jsxRuntime.jsxs("li",{className:f(Zo({size:o}),t),...n,children:[jsxRuntime.jsx("span",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:r}),e&&jsxRuntime.jsx("span",{className:"ml-auto flex shrink-0 items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100 [@media(hover:none)]:opacity-100 [@media(hover:none)]:[&>button]:min-h-(--row-action-touch-min) [@media(hover:none)]:[&>button]:min-w-(--row-action-touch-min) [@media(hover:none)]:[&>button]:flex [@media(hover:none)]:[&>button]:items-center [@media(hover:none)]:[&>button]:justify-center",children:e})]})}var Bc=On.createContext({showLines:true,expandedKeys:null,onToggleKey:()=>{},size:"md"});function Ui({showLines:e=true,showRoot:t=true,expandedKeys:r,defaultExpandedKeys:n="all",onExpandedKeysChange:o,size:a="md",className:i,children:s,...l}){let [c,u]=On.useState(()=>n),m=On.useCallback(g=>{if(r){let h=new Set(r);h.has(g)?h.delete(g):h.add(g),o?.(h);}else u(h=>{if(h==="all")return new Set(["__ALL_MINUS__",g]);let b=new Set(h);return b.has(g)?b.delete(g):b.add(g),b});},[r,o]),d=r??(c==="all"?null:c);return jsxRuntime.jsx(Bc.Provider,{value:{showLines:e,expandedKeys:d,onToggleKey:m,size:a},children:t?jsxRuntime.jsx("ul",{className:f("text-sm",i),role:"tree",...l,children:s}):jsxRuntime.jsx("ul",{className:f("text-sm",i),role:"tree",...l,children:jsxRuntime.jsx(Wf,{children:s})})})}function Wf({children:e}){let t=Oc(e);return jsxRuntime.jsx(jsxRuntime.Fragment,{children:t.map(r=>On__default.default.isValidElement(r)&&r.props.children?r.props.children:null)})}function Oc(e){let t=[];return On__default.default.Children.forEach(e,r=>{On__default.default.isValidElement(r)&&r.type===On__default.default.Fragment?t.push(...Oc(r.props.children)):t.push(r);}),t}function Yf({nodeKey:e,label:t,icon:r,actions:n,defaultExpanded:o=false,expanded:a,onToggle:i,children:s,className:l}){let{showLines:c,expandedKeys:u,onToggleKey:p,size:m}=On.useContext(Bc),[d,g]=On.useState(o),h=On__default.default.Children.count(s)>0,b=e??(typeof t=="string"?t:""),y;a!=null?y=a:u!=null&&b?u.has("__ALL_MINUS__")?y=!u.has(b):y=u.has(b):y=d;let v=()=>{let N=!y;i?i(N):u!=null&&b?p(b):g(N);};return jsxRuntime.jsxs("li",{className:f("select-none",l),role:"treeitem","aria-expanded":h?y:void 0,children:[jsxRuntime.jsxs("div",{className:f("group hover:bg-primary-50 dark:hover:bg-primary-800/50 rounded-md px-1",ea({size:m}),h?"cursor-pointer":"cursor-default"),onClick:h?v:void 0,children:[h?jsxRuntime.jsx(lucideReact.ChevronRight,{className:f("text-primary-400 h-4 w-4 shrink-0 transition-transform duration-200",y&&"rotate-90")}):jsxRuntime.jsx("span",{className:"w-4 shrink-0"}),r&&jsxRuntime.jsx("span",{className:"shrink-0",children:r}),jsxRuntime.jsx("span",{className:"text-primary-700 dark:text-primary-300 min-w-0 flex-1 truncate",children:t}),n&&jsxRuntime.jsx("span",{className:"ml-auto flex shrink-0 items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100 [@media(hover:none)]:opacity-100 [@media(hover:none)]:[&>button]:min-h-(--row-action-touch-min) [@media(hover:none)]:[&>button]:min-w-(--row-action-touch-min) [@media(hover:none)]:[&>button]:flex [@media(hover:none)]:[&>button]:items-center [@media(hover:none)]:[&>button]:justify-center",onClick:N=>N.stopPropagation(),children:n})]}),h&&jsxRuntime.jsx("div",{className:f("grid transition-[grid-template-rows] duration-200 ease-out",y?"grid-rows-[1fr]":"grid-rows-[0fr]"),children:jsxRuntime.jsx("div",{className:"overflow-hidden",children:jsxRuntime.jsx("ul",{className:f("ml-4 pl-2",c&&"border-primary-200 dark:border-primary-700 border-l"),role:"group",children:s})})})]})}function qf({avatar:e,sender:t}){return e?typeof e=="string"?/^(?:https?|data|blob):/.test(e)?jsxRuntime.jsx("img",{src:e,alt:t,className:"h-8 w-8 shrink-0 rounded-full object-cover",draggable:false}):jsxRuntime.jsx("div",{className:"bg-primary-200 text-primary-600 dark:bg-primary-700 dark:text-primary-300 flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-lg select-none",children:e}):jsxRuntime.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full",children:e}):jsxRuntime.jsx("div",{className:"bg-primary-200 text-primary-600 dark:bg-primary-700 dark:text-primary-300 flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-sm font-semibold select-none",children:t.charAt(0).toUpperCase()})}function Jf({msg:e,alignRight:t}){return jsxRuntime.jsxs("div",{className:f("flex gap-2.5",t?"flex-row-reverse":"flex-row"),children:[jsxRuntime.jsx(qf,{avatar:e.avatar,sender:e.sender}),jsxRuntime.jsxs("div",{className:f("flex max-w-[75%] flex-col gap-0.5",t?"items-end":"items-start"),children:[jsxRuntime.jsx("span",{className:"text-primary-500 dark:text-primary-400 text-xs",children:e.sender}),jsxRuntime.jsx("div",{className:f("rounded-xl px-3 py-2 text-sm leading-relaxed",t?"rounded-tr-sm bg-primary-500 text-white dark:bg-primary-600":"bg-primary-100 text-primary-800 dark:bg-primary-800 dark:text-primary-200 rounded-tl-sm"),children:e.content}),e.time&&jsxRuntime.jsx("span",{className:"text-primary-400 dark:text-primary-500 text-[10px]",children:e.time})]})]})}function Gi({messages:e,mode:t="split",autoScroll:r=true,className:n,...o}){let a=On.useRef(null);return On.useEffect(()=>{r&&a.current?.scrollIntoView({behavior:"smooth"});},[e,r]),jsxRuntime.jsxs("div",{className:f("flex flex-col gap-4 overflow-y-auto rounded-lg border p-4","border-primary-200 dark:border-primary-700 dark:bg-primary-900 bg-white",n),...o,children:[e.map(i=>{let s=t==="split"&&!!i.self;return jsxRuntime.jsx(Jf,{msg:i,alignRight:s},i.id)}),jsxRuntime.jsx("div",{ref:a})]})}var e0={name:"onyx-css-vars",type:"dark",settings:[{settings:{foreground:"var(--color-syntax-plain)",background:"var(--color-syntax-bg)"}},{scope:["comment","punctuation.definition.comment"],settings:{foreground:"var(--color-syntax-comment)",fontStyle:"italic"}},{scope:["keyword","keyword.control","keyword.operator.new","keyword.operator.expression","storage.type","storage.modifier"],settings:{foreground:"var(--color-syntax-keyword)"}},{scope:["string","string.quoted","string.template"],settings:{foreground:"var(--color-syntax-string)"}},{scope:["entity.name.function","support.function","meta.function-call"],settings:{foreground:"var(--color-syntax-function)"}},{scope:["variable","variable.other","variable.parameter","meta.definition.variable"],settings:{foreground:"var(--color-syntax-variable)"}},{scope:["constant.numeric","constant.language"],settings:{foreground:"var(--color-syntax-number)"}},{scope:["keyword.operator","keyword.operator.assignment","keyword.operator.comparison","keyword.operator.arithmetic"],settings:{foreground:"var(--color-syntax-operator)"}},{scope:["entity.name.tag","punctuation.definition.tag","support.class.component"],settings:{foreground:"var(--color-syntax-tag)"}},{scope:["entity.other.attribute-name","meta.tag.attributes"],settings:{foreground:"var(--color-syntax-attr)"}},{scope:["punctuation","meta.brace","punctuation.definition.block","punctuation.separator","punctuation.terminator"],settings:{foreground:"var(--color-syntax-punctuation)"}},{scope:["entity.name.type","support.type","support.class","entity.other.inherited-class"],settings:{foreground:"var(--color-syntax-type)"}}]},t0={typescript:()=>import('@shikijs/langs/typescript'),javascript:()=>import('@shikijs/langs/javascript'),tsx:()=>import('@shikijs/langs/tsx'),jsx:()=>import('@shikijs/langs/jsx'),html:()=>import('@shikijs/langs/html'),css:()=>import('@shikijs/langs/css'),json:()=>import('@shikijs/langs/json'),markdown:()=>import('@shikijs/langs/markdown'),python:()=>import('@shikijs/langs/python'),rust:()=>import('@shikijs/langs/rust'),go:()=>import('@shikijs/langs/go'),java:()=>import('@shikijs/langs/java'),c:()=>import('@shikijs/langs/c'),cpp:()=>import('@shikijs/langs/cpp'),csharp:()=>import('@shikijs/langs/csharp'),vue:()=>import('@shikijs/langs/vue'),xml:()=>import('@shikijs/langs/xml'),yaml:()=>import('@shikijs/langs/yaml'),sql:()=>import('@shikijs/langs/sql'),bash:()=>import('@shikijs/langs/bash'),shell:()=>import('@shikijs/langs/shell')},Qi=null,$c=new Set;function r0(){return Qi||(Qi=Promise.all([import('shiki/core'),import('shiki/engine/javascript')]).then(([{createHighlighterCore:e},{createJavaScriptRegexEngine:t}])=>e({themes:[e0],langs:[],engine:t()}))),Qi}async function n0(e,t,r){let n=await r0();if(t&&!$c.has(t)){let a=t0[t];if(a)try{let i=await a();await n.loadLanguage(i.default??i),$c.add(t);}catch{t="text";}else t="text";}let o=n.codeToHtml(e,{lang:t||"text",theme:"onyx-css-vars"});if(o=o.replace(/(<pre [^>]*style=")/,"$1line-height:1.7;tab-size:2;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;"),r){let a=0;o=o.replace(/<span class="line">/g,()=>(a++,`<span class="line"><span class="line-number" data-line="${a}"></span>`));}return o}function Zi({code:e,language:t="text",lineNumbers:r=false,editable:n=false,onCodeChange:o,size:a,className:i,...s}){let[l,c]=On.useState(""),u=On.useRef(null),p=On.useRef(null),m=On.useRef(null);On.useEffect(()=>{let x=false;return n0(e,t,n?false:r).then(w=>{x||c(w);}),()=>{x=true;}},[e,t,r,n]);let d=On.useCallback(()=>{let x=p.current,w=m.current?.querySelector("pre"),L=u.current?.querySelector("[data-gutter]");x&&w&&(w.scrollTop=x.scrollTop,w.scrollLeft=x.scrollLeft),x&&L&&(L.scrollTop=x.scrollTop);},[]),g=On.useCallback(x=>{o?.(x.target.value);},[o]),h=On.useCallback(x=>{if(x.key==="Tab"){x.preventDefault();let w=x.currentTarget,L=w.selectionStart,P=w.selectionEnd,A=w.value.substring(0,L)+" "+w.value.substring(P);o?.(A),requestAnimationFrame(()=>{w.selectionStart=w.selectionEnd=L+2;});}},[o]),b=r&&"[&_.line-number]:inline-block [&_.line-number]:w-8 [&_.line-number]:mr-4 [&_.line-number]:text-right [&_.line-number]:text-secondary-400 [&_.line-number]:select-none [&_.line-number]:before:content-[attr(data-line)]",y="ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",v=1.7,N=e.split(`
2
+ `).length;return n?jsxRuntime.jsxs("div",{ref:u,className:f(Hn({size:a}),"flex border border-primary-200 dark:border-primary-700",i),style:{background:"var(--color-syntax-bg)"},...s,children:[r&&jsxRuntime.jsx("div",{"data-gutter":true,"aria-hidden":true,className:"shrink-0 select-none overflow-hidden py-4 pl-3 pr-1 text-right text-secondary-400",style:{fontFamily:y,lineHeight:v,width:"3rem"},children:Array.from({length:N},(x,w)=>jsxRuntime.jsx("div",{children:w+1},w))}),jsxRuntime.jsxs("div",{className:"relative min-w-0 flex-1",children:[jsxRuntime.jsx("textarea",{ref:p,value:e,onChange:g,onScroll:d,onKeyDown:h,spellCheck:false,autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",className:"relative z-2 m-0 block h-full w-full resize-none overflow-auto whitespace-pre border-none bg-transparent p-4 text-transparent caret-primary-600 outline-none dark:caret-primary-400",style:{fontFamily:y,lineHeight:v,tabSize:2,minHeight:"6rem"}}),jsxRuntime.jsx("div",{ref:m,"aria-hidden":true,className:"pointer-events-none absolute inset-0 z-1 overflow-hidden [&_pre]:m-0 [&_pre]:h-full [&_pre]:overflow-hidden [&_pre]:p-4 [&_code]:bg-transparent",dangerouslySetInnerHTML:l?{__html:l}:void 0})]})]}):jsxRuntime.jsx("div",{ref:u,className:f(Hn({size:a}),"border border-primary-200 dark:border-primary-700",b,i),style:{background:"var(--color-syntax-bg)"},...s,children:jsxRuntime.jsx("div",{ref:m,className:"[&_pre]:m-0 [&_pre]:p-4",dangerouslySetInnerHTML:l?{__html:l}:void 0,children:l?void 0:jsxRuntime.jsx("pre",{className:"m-0 p-4",style:{background:"var(--color-syntax-bg)"},children:jsxRuntime.jsx("code",{children:e})})})})}var s0={up:lucideReact.TrendingUp,down:lucideReact.TrendingDown,neutral:lucideReact.Minus},l0={up:"text-success-600 dark:text-success-400",down:"text-danger-600 dark:text-danger-400",neutral:"text-secondary-500 dark:text-secondary-400"};function es({title:e,value:t,prefix:r,suffix:n,icon:o,trend:a,trendValue:i,description:s,intent:l,size:c,className:u}){let p=a?s0[a]:null,m=a?l0[a]:"";return jsxRuntime.jsx("div",{className:f(ta({intent:l,size:c}),u),children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-3",children:[jsxRuntime.jsxs("div",{className:"min-w-0 flex-1",children:[jsxRuntime.jsx("p",{className:"truncate text-xs font-medium tracking-wider uppercase text-secondary-500 dark:text-secondary-400",children:e}),jsxRuntime.jsxs("p",{className:"mt-1 flex items-baseline gap-1 text-2xl font-bold text-primary-900 dark:text-primary-50",children:[r&&jsxRuntime.jsx("span",{className:"text-base font-semibold text-secondary-500 dark:text-secondary-400",children:r}),jsxRuntime.jsx("span",{children:t}),n&&jsxRuntime.jsx("span",{className:"text-base font-semibold text-secondary-500 dark:text-secondary-400",children:n})]}),(a||s)&&jsxRuntime.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[a&&p&&jsxRuntime.jsxs("span",{className:f("flex items-center gap-0.5 text-xs font-semibold",m),children:[jsxRuntime.jsx(p,{className:"h-3.5 w-3.5"}),i]}),s&&jsxRuntime.jsx("span",{className:"text-xs text-secondary-500 dark:text-secondary-400",children:s})]})]}),o&&jsxRuntime.jsx("div",{className:f("flex h-10 w-10 shrink-0 items-center justify-center rounded-xl [&_svg]:h-5 [&_svg]:w-5",l==="success"&&"bg-success-100 text-success-600 dark:bg-success-900/30 dark:text-success-400",l==="danger"&&"bg-danger-100 text-danger-600 dark:bg-danger-900/30 dark:text-danger-400",l==="warning"&&"bg-warning-100 text-warning-600 dark:bg-warning-900/30 dark:text-warning-400",(!l||l==="primary")&&"bg-primary-100 text-primary-600 dark:bg-primary-800 dark:text-primary-400"),children:o})]})})}function f0(e){return 1-Math.pow(1-e,4)}function h0(e,t,r,n,o){let[a,i]=On.useState(()=>o?o(t):t.toFixed(n)),s=On.useRef(null),l=On.useRef(null);return On.useEffect(()=>{s.current!==null&&cancelAnimationFrame(s.current),l.current=null;let c=u=>{l.current===null&&(l.current=u);let p=u-l.current,m=Math.min(p/r,1),d=f0(m),g=t+(e-t)*d;i(o?o(g):g.toFixed(n)),m<1&&(s.current=requestAnimationFrame(c));};return s.current=requestAnimationFrame(c),()=>{s.current!==null&&cancelAnimationFrame(s.current);}},[e,t,r,n,o]),a}var g0={up:lucideReact.TrendingUp,down:lucideReact.TrendingDown,neutral:lucideReact.Minus},b0={up:"text-success-600 dark:text-success-400",down:"text-danger-600 dark:text-danger-400",neutral:"text-secondary-500 dark:text-secondary-400"},Wc={primary:"bg-primary-100 text-primary-600 dark:bg-primary-800/60 dark:text-primary-300",success:"bg-success-100 text-success-600 dark:bg-success-900/30 dark:text-success-400",danger:"bg-danger-100 text-danger-600 dark:bg-danger-900/30 dark:text-danger-400",warning:"bg-warning-100 text-warning-600 dark:bg-warning-900/30 dark:text-warning-400"};function ts({title:e,value:t,decimals:r=0,prefix:n,suffix:o,icon:a,trend:i,trendValue:s,description:l,animateDuration:c=1200,formatter:u,from:p=0,intent:m,size:d,className:g}){let h=h0(t,p,c,r,u),b=i?g0[i]:null,y=i?b0[i]:"";return jsxRuntime.jsxs("div",{className:f(ra({intent:m,size:d}),g),children:[jsxRuntime.jsx("div",{className:f("pointer-events-none absolute inset-x-0 top-0 h-0.5 rounded-t-xl",m==="success"&&"bg-gradient-to-r from-success-400 to-success-600",m==="danger"&&"bg-gradient-to-r from-danger-400 to-danger-600",m==="warning"&&"bg-gradient-to-r from-warning-400 to-warning-600",(!m||m==="primary")&&"bg-gradient-to-r from-primary-400 to-primary-600")}),jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-4",children:[jsxRuntime.jsxs("div",{className:"min-w-0 flex-1",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold tracking-widest uppercase text-secondary-500 dark:text-secondary-400",children:e}),jsxRuntime.jsxs("p",{className:"mt-2 flex items-baseline gap-1",children:[n&&jsxRuntime.jsx("span",{className:"text-lg font-semibold text-secondary-400 dark:text-secondary-500",children:n}),jsxRuntime.jsx("span",{className:"font-mono text-3xl font-bold tabular-nums text-primary-900 dark:text-primary-50",children:h}),o&&jsxRuntime.jsx("span",{className:"text-lg font-semibold text-secondary-400 dark:text-secondary-500",children:o})]})]}),a&&jsxRuntime.jsx("div",{className:f("flex h-12 w-12 shrink-0 items-center justify-center rounded-2xl [&_svg]:h-6 [&_svg]:w-6",Wc[m??"primary"]??Wc.primary),children:a})]}),(i||l)&&jsxRuntime.jsxs("div",{className:"mt-3 flex items-center gap-2 border-t border-primary-100 pt-3 dark:border-primary-700/50",children:[i&&b&&jsxRuntime.jsxs("span",{className:f("flex items-center gap-0.5 text-xs font-bold",y),children:[jsxRuntime.jsx(b,{className:"h-3.5 w-3.5"}),s]}),l&&jsxRuntime.jsx("span",{className:"text-xs text-secondary-500 dark:text-secondary-400",children:l})]})]})}var Yc="onyx-vlist:";function Uc(e,t){let r=0,n=e.length-2;for(;r<=n;){let o=r+n>>1;if(e[o+1]<=t)r=o+1;else if(e[o]>t)n=o-1;else return o}return Math.max(0,r)}function Xc(e,t){let{items:r,itemHeight:n,estimatedItemHeight:o=48,direction:a="vertical",overscan:i=3,onReachEnd:s,reachEndThreshold:l=120,isLoading:c,onScroll:u,onVisibleRangeChange:p,scrollRestorationId:m}=e,d=a==="vertical",g=typeof n=="number",h=g?n:0,b=On.useRef(null),[y,v]=On.useState(300);On.useEffect(()=>{let z=b.current;if(!z)return;let H=new ResizeObserver(([oe])=>{let be=d?oe.contentRect.height:oe.contentRect.width;be>0&&v(be);});H.observe(z);let _=z.getBoundingClientRect(),V=d?_.height:_.width;return V>0&&v(V),()=>H.disconnect()},[d]);let[N,x]=On.useState(0);On.useEffect(()=>{if(!m)return;let z=b.current;if(z)try{let H=localStorage.getItem(Yc+m);if(H!==null){let _=parseFloat(H);!Number.isNaN(_)&&_>0&&requestAnimationFrame(()=>{d?z.scrollTop=_:z.scrollLeft=_;});}}catch{}},[]);let w=On.useRef(false),L=On.useRef(r.length);r.length!==L.current&&(L.current=r.length,w.current=false);let P=On.useCallback(()=>{let z=b.current;if(!z)return;let H=d?z.scrollTop:z.scrollLeft;if(x(H),u?.(H),m)try{localStorage.setItem(Yc+m,String(H));}catch{}s&&!c&&(d?z.scrollHeight-z.clientHeight:z.scrollWidth-z.clientWidth)-H<=l&&(w.current||(w.current=true,s()));},[d,u,m,s,c,l]);On.useEffect(()=>{let z=b.current;if(z)return z.addEventListener("scroll",P,{passive:true}),()=>z.removeEventListener("scroll",P)},[P]),On.useEffect(()=>{if(d)return;let z=b.current;if(!z)return;let H=_=>{Math.abs(_.deltaX)>=Math.abs(_.deltaY)||(_.preventDefault(),z.scrollLeft+=_.deltaY);};return z.addEventListener("wheel",H,{passive:false}),()=>z.removeEventListener("wheel",H)},[d]),On.useEffect(()=>{if(d)return;let z=b.current;if(!z)return;let H=5,_=false,V=false,oe=0,be=0,M=W=>{W.target.closest("button,a,input,select,textarea,[role=button],[role=checkbox],[role=radio],[role=option]")||W.button===0&&(_=true,V=false,oe=W.clientX,be=z.scrollLeft,z.setPointerCapture(W.pointerId));},F=W=>{if(!_)return;let G=oe-W.clientX;if(!V){if(Math.abs(G)<H)return;V=true,z.style.cursor="grabbing",z.style.userSelect="none";}z.scrollLeft=be+G;},re=W=>{if(_){_=false,z.style.cursor="",z.style.userSelect="";try{z.releasePointerCapture(W.pointerId);}catch{}}};return z.addEventListener("pointerdown",M),z.addEventListener("pointermove",F),z.addEventListener("pointerup",re),z.addEventListener("pointercancel",re),()=>{z.removeEventListener("pointerdown",M),z.removeEventListener("pointermove",F),z.removeEventListener("pointerup",re),z.removeEventListener("pointercancel",re);}},[d]);let A=On.useRef(new Map),[D,S]=On.useState(0),C=On.useCallback((z,H)=>{if(g||!H)return;let _=d?H.offsetHeight:H.offsetWidth;_>0&&A.current.get(z)!==_&&(A.current.set(z,_),S(V=>V+1));},[g,d]),I=On.useRef(r);I.current!==r&&(I.current=r,g||(A.current=new Map));let k=On.useMemo(()=>{if(g)return [];let z=new Array(r.length+1);z[0]=0;for(let H=0;H<r.length;H++){let _=A.current.get(H),V;_!==void 0?V=_:typeof n=="function"?V=r[H]!==void 0?n(r[H],H):o:V=o,z[H+1]=z[H]+V;}return z},[g,r,n,o,D]),T=On.useCallback(z=>g?z*h:k[z]??0,[g,h,k]),R=On.useCallback(z=>{if(g)return h;let H=A.current.get(z);return H!==void 0?H:typeof n=="function"&&r[z]!==void 0?n(r[z],z):o},[g,h,n,r,o,D]),O,E,ne;if(g){O=h*r.length;let z=Math.floor(N/h),H=Math.ceil((N+y)/h);E=Math.max(0,z-i),ne=Math.min(r.length-1,H+i-1);}else if(O=k[r.length]??0,k.length>1){let z=Uc(k,N);E=Math.max(0,z-i);let H=z;for(;H<r.length&&k[H]<N+y;)H++;ne=Math.min(r.length-1,H+i-1);}else E=0,ne=Math.min(r.length-1,i*2);E=Math.max(0,E),ne=Math.max(E,Math.min(r.length-1,ne));let U=On.useRef({start:-1,end:-1});return On.useEffect(()=>{let z,H;if(g&&h>0)z=Math.max(0,Math.floor(N/h)),H=Math.min(r.length-1,Math.ceil((N+y)/h)-1);else {for(z=Uc(k,N),H=z;H<r.length&&k[H]<N+y;)H++;H=Math.max(0,H-1);}(U.current.start!==z||U.current.end!==H)&&(U.current={start:z,end:H},p?.(z,H));}),On.useImperativeHandle(t,()=>({scrollToIndex(z,H="auto"){let _=b.current;if(!_)return;let V=T(z),oe=R(z),be=d?_.clientHeight:_.clientWidth,M=d?_.scrollTop:_.scrollLeft,F;if(H==="start")F=V;else if(H==="end")F=V-be+oe;else if(H==="center")F=V-(be-oe)/2;else if(V<M)F=V;else if(V+oe>M+be)F=V-be+oe;else return;_.scrollTo({[d?"top":"left"]:Math.max(0,F),behavior:"smooth"});},scrollToOffset(z){let H=b.current;H&&H.scrollTo({[d?"top":"left"]:z,behavior:"smooth"});},getScrollOffset(){let z=b.current;return z?d?z.scrollTop:z.scrollLeft:0}}),[T,R,d]),{scrollerRef:b,startIndex:E,endIndex:ne,totalSize:O,getItemOffset:T,getItemSize:R,measureItem:C}}function w0({text:e="Loading\u2026"}){return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 py-4 text-sm text-primary-400",children:[jsxRuntime.jsx("span",{"aria-hidden":true,className:"h-4 w-4 animate-spin rounded-full border-2 border-primary-200 border-t-primary-500"}),jsxRuntime.jsx("span",{children:e})]})}function k0({text:e="No items"}){return jsxRuntime.jsxs("div",{className:"flex h-full min-h-[120px] flex-col items-center justify-center gap-2 text-sm text-primary-400",children:[jsxRuntime.jsx("svg",{"aria-hidden":true,xmlns:"http://www.w3.org/2000/svg",className:"h-8 w-8 opacity-40",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4"})}),jsxRuntime.jsx("span",{children:e})]})}function N0(e,t){let{items:r,renderItem:n,getItemKey:o,itemHeight:a,direction:i="vertical",height:s="100%",width:l="100%",isLoading:c=false,loadingRenderer:u,loadingText:p,emptyRenderer:m,emptyText:d,itemClassName:g,className:h,style:b}=e,y=i==="vertical",v=typeof a!="number",{scrollerRef:N,startIndex:x,endIndex:w,totalSize:L,getItemOffset:P,getItemSize:A,measureItem:D}=Xc(e,t),S={position:"relative",overflowX:y?"hidden":"auto",overflowY:y?"auto":"hidden",height:s,width:l,cursor:y?void 0:"grab"},C={position:"relative",[y?"height":"width"]:L,[y?"width":"height"]:"100%",overflow:"hidden"},I=[];for(let T=x;T<=w;T++){let R=r[T];if(R===void 0)continue;let O=P(T),E=A(T),ne=o?o(R,T):T,U={position:"absolute",[y?"top":"left"]:O,[y?"height":"width"]:v?void 0:E,[y?"width":"height"]:"100%",boxSizing:"border-box"};I.push(jsxRuntime.jsx("div",{role:"row","aria-rowindex":T+1,style:U,className:f("onyx-vlist-item",g),ref:v?z=>D(T,z):void 0,children:n(R,T)},ne));}let k=r.length===0;return jsxRuntime.jsxs("div",{ref:N,role:"grid","aria-rowcount":r.length,"data-virtual-list":true,"data-direction":i,className:f("onyx-virtual-list",h),style:{...S,...b},children:[k?m?m():jsxRuntime.jsx(k0,{text:d}):jsxRuntime.jsx("div",{style:C,children:I}),c&&(u?u():jsxRuntime.jsx(w0,{text:p}))]})}var aa=On.forwardRef(N0);var C0={Table:Bn,List:Yi,Tree:Ui,Chat:Gi,CodeBlock:Zi,Stat:es,MetricCard:ts,VirtualList:aa},os=C0;var Hr="flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-sm transition-colors cursor-pointer",qc="bg-primary-200 dark:bg-primary-700/50 text-primary-900 dark:text-primary-100 font-medium",an="text-primary-600 dark:text-primary-400 hover:bg-primary-100 dark:hover:bg-primary-800/50 hover:text-primary-900 dark:hover:text-primary-200",sn="flex items-center justify-center rounded-md p-2 transition-colors cursor-pointer text-primary-600 dark:text-primary-400 hover:bg-primary-100 dark:hover:bg-primary-800/50 hover:text-primary-900 dark:hover:text-primary-200";function A0({to:e,className:t,style:r,children:n}){let o=typeof t=="function"?t({isActive:false}):t;return jsxRuntime.jsx("a",{href:e,className:o,style:r,children:n})}var as=["expanded","icons","mini"];function I0(e){let t=as.indexOf(e);return as[(t+1)%as.length]}function Jc(e){let t=new Set;for(let r of e)if(r.children&&r.children.length>0){t.add(r.key??r.label);for(let n of Jc(r.children))t.add(n);}return t}function Qc({item:e,basePath:t,depth:r,onItemClick:n,LinkComponent:o,showLines:a,expandedKeys:i,onToggle:s}){let l=e.key??e.label,c=e.children&&e.children.length>0,[u,p]=On.useState(e.defaultOpen??true),m=i?i.has(l):u,d=On.useCallback(()=>{i?s(l):p(h=>!h);},[i,s,l]),g=r>0?`${r*1.25}rem`:void 0;if(c)return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:d,className:f(Hr,an,"justify-between"),style:{paddingLeft:g},children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-2",children:[e.icon,e.label]}),jsxRuntime.jsx(lucideReact.ChevronRight,{className:f("h-3.5 w-3.5 transition-transform",m&&"rotate-90")})]}),m&&jsxRuntime.jsx("div",{className:f("flex flex-col gap-0.5 pt-0.5",a?"ml-2.5 border-l border-primary-200 dark:border-primary-700":"ml-2"),children:e.children.map(h=>jsxRuntime.jsx(Qc,{item:h,basePath:t,depth:r+1,onItemClick:n,LinkComponent:o,showLines:a,expandedKeys:i,onToggle:s},h.key??h.path??h.label))})]});if(e.path!=null){let h=t+e.path;return n?jsxRuntime.jsxs("button",{type:"button",onClick:()=>n(e,h),className:f(Hr,an),style:{paddingLeft:g},children:[e.icon,e.label]}):jsxRuntime.jsxs(o,{to:h,className:({isActive:b})=>f(Hr,b?qc:an),style:{paddingLeft:g},children:[e.icon,e.label]})}return jsxRuntime.jsxs("span",{className:f(Hr,an,"cursor-default"),style:{paddingLeft:g},children:[e.icon,e.label]})}function z0({item:e,basePath:t,onItemClick:r,LinkComponent:n}){let[o,a]=On.useState(false),i=On.useRef(null),s=On.useRef(void 0),[l,c]=On.useState({top:0,left:0}),u=()=>{clearTimeout(s.current),a(true);},p=()=>{s.current=setTimeout(()=>a(false),200);};On.useLayoutEffect(()=>{if(o&&i.current){let d=i.current.getBoundingClientRect();c({top:d.top,left:d.right+4});}},[o]);let m=e.icon||jsxRuntime.jsx("span",{className:"text-xs font-bold leading-none",children:e.label.charAt(0).toUpperCase()});return jsxRuntime.jsxs("div",{onMouseEnter:u,onMouseLeave:p,children:[jsxRuntime.jsx("button",{ref:i,type:"button",className:f(sn,"w-full"),title:e.label,onClick:()=>a(d=>!d),children:m}),o&&reactDom.createPortal(jsxRuntime.jsxs("div",{className:"fixed z-50 min-w-44 rounded-md border border-primary-200 bg-white p-1 shadow-lg dark:border-primary-700 dark:bg-primary-900",style:{top:l.top,left:l.left},onMouseEnter:u,onMouseLeave:p,children:[jsxRuntime.jsx("div",{className:"px-2.5 py-1.5 text-xs font-semibold uppercase text-primary-500 dark:text-primary-400",children:e.label}),jsxRuntime.jsx("div",{className:"flex flex-col gap-0.5",children:e.children?.map(d=>{let g=d.key??d.path??d.label;if(d.path!=null){let h=t+d.path;return r?jsxRuntime.jsxs("button",{type:"button",onClick:()=>{r(d,h),a(false);},className:f(Hr,an),children:[d.icon,d.label]},g):jsxRuntime.jsxs(n,{to:h,className:({isActive:b})=>f(Hr,b?qc:an),children:[d.icon,d.label]},g)}return jsxRuntime.jsxs("span",{className:f(Hr,"cursor-default text-primary-400"),children:[d.icon,d.label]},g)})})]}),document.body)]})}function V0({item:e,basePath:t,onItemClick:r,LinkComponent:n}){let o=e.icon||jsxRuntime.jsx("span",{className:"text-xs font-bold leading-none",children:e.label.charAt(0).toUpperCase()});if(e.path!=null){let a=t+e.path;return r?jsxRuntime.jsx("button",{type:"button",onClick:()=>r(e,a),className:f(sn,"w-full"),title:e.label,children:o}):jsxRuntime.jsx(n,{to:a,className:({isActive:i})=>f(sn,"w-full",i&&"bg-primary-200 dark:bg-primary-700/50 text-primary-900 dark:text-primary-100"),children:jsxRuntime.jsx("span",{title:e.label,children:o})})}return jsxRuntime.jsx("span",{className:f(sn,"w-full cursor-default"),title:e.label,children:o})}function ss({items:e,title:t,basePath:r="/",onItemClick:n,LinkComponent:o=A0,collapsible:a,collapseMode:i,defaultCollapseMode:s="expanded",onCollapseModeChange:l,showLines:c=true,expandedKeys:u,defaultExpandedKeys:p="all",onExpandedKeysChange:m,className:d,responsive:g=true,mobileBreakpoint:h=768,mobileTopOffset:b=48,mobileDrawerSlot:y,...v}){let[N,x]=On.useState(s),w=i??N,L=On__default.default.useMemo(()=>Jc(e),[e]),[P,A]=On.useState(()=>p==="all"?new Set(L):new Set(p)),D=u??null,S=D??P,C=On.useCallback(q=>{let Z=new Set(S);Z.has(q)?Z.delete(q):Z.add(q),A(Z),m?.(Z);},[S,m]),I=On.useCallback(()=>{let q=I0(w);x(q),l?.(q);},[w,l]),[k,T]=On.useState(()=>g&&typeof window<"u"&&window.innerWidth<h),[R,O]=On.useState(false),[E,ne]=On.useState(()=>{if(typeof window>"u")return "left";try{return localStorage.getItem("onyx-sidenav-side")||"left"}catch{return "left"}}),[U,z]=On.useState(()=>{if(typeof window>"u")return 50;try{return Number(localStorage.getItem("onyx-sidenav-top"))||50}catch{return 50}}),[H,_]=On.useState(null),V=On.useRef({dragging:false,startX:0,startY:0,moved:false}),oe=On.useCallback(q=>{if(q.pointerType==="mouse"&&q.button!==0)return;q.preventDefault(),V.current={dragging:true,startX:q.clientX,startY:q.clientY,moved:false};let Z=te=>{if(!V.current.dragging)return;let ve=Math.abs(te.clientX-V.current.startX),Ne=Math.abs(te.clientY-V.current.startY);if((ve>6||Ne>6)&&(V.current.moved=true),!V.current.moved)return;let X=te.clientX<window.innerWidth/2?"left":"right",de=b+28,Q=window.innerHeight-28,ie=Math.max(de,Math.min(Q,te.clientY));_({side:X,y:ie});},ue=te=>{if(window.removeEventListener("pointermove",Z),window.removeEventListener("pointerup",ue),window.removeEventListener("pointercancel",ue),!V.current.dragging)return;if(V.current.dragging=false,!V.current.moved){let ie=Pe=>{Pe.stopPropagation(),Pe.preventDefault(),window.removeEventListener("click",ie,true);};window.addEventListener("click",ie,true),_(null),O(true);return}let ve=te.clientX<window.innerWidth/2?"left":"right",Ne=b+28,X=window.innerHeight-28,Q=Math.max(Ne,Math.min(X,te.clientY))/window.innerHeight*100;ne(ve),z(Q),_(null);try{localStorage.setItem("onyx-sidenav-side",ve),localStorage.setItem("onyx-sidenav-top",String(Q));}catch{}};window.addEventListener("pointermove",Z),window.addEventListener("pointerup",ue),window.addEventListener("pointercancel",ue);},[b]);On.useEffect(()=>{if(!g||typeof window>"u"||!window.matchMedia)return;let q=window.matchMedia(`(max-width: ${h-1}px)`),Z=ue=>{T(ue.matches),ue.matches||O(false);};return q.addEventListener("change",Z),()=>q.removeEventListener("change",Z)},[g,h]);let be=On.useCallback(q=>{q.target.closest("a")&&O(false);},[]),M=On.useRef(null),F=On.useRef({startX:0,startY:0,dragging:false}),re=60,W=On.useCallback(q=>{let Z=q.touches[0];F.current={startX:Z.clientX,startY:Z.clientY,dragging:true};},[]),G=On.useCallback(q=>{if(!F.current.dragging||!M.current)return;let Z=q.touches[0],ue=Z.clientX-F.current.startX,te=Z.clientY-F.current.startY;if(E==="left"){if(ue>=0||Math.abs(te)>Math.abs(ue))return;M.current.style.transform=`translateX(${Math.max(ue,-224)}px)`;}else {if(ue<=0||Math.abs(te)>Math.abs(ue))return;M.current.style.transform=`translateX(${Math.min(ue,224)}px)`;}M.current.style.transition="none";},[E]),le=On.useCallback(q=>{if(!F.current.dragging||!M.current)return;F.current.dragging=false;let Z=q.changedTouches[0],ue=Z.clientX-F.current.startX,te=Z.clientY-F.current.startY;M.current.style.transition="",M.current.style.transform="",Math.abs(ue)>Math.abs(te)&&(E==="left"&&ue<-re&&O(false),E==="right"&&ue>re&&O(false));},[E]),ke=On.useMemo(()=>!k||!n?n:(q,Z)=>{O(false),n(q,Z);},[k,n]),B=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[a&&!k&&jsxRuntime.jsx("div",{className:f("flex shrink-0 mb-1",w==="expanded"?"justify-end":"justify-center"),children:jsxRuntime.jsx("button",{type:"button",onClick:I,className:sn,"aria-label":w==="mini"?"Expand sidebar":"Collapse sidebar",title:w==="mini"?"Expand sidebar":"Collapse sidebar",children:w==="mini"?jsxRuntime.jsx(lucideReact.Menu,{className:"h-5 w-5"}):jsxRuntime.jsx(lucideReact.ChevronsLeft,{className:"h-4 w-4"})})}),(k||w==="expanded")&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[t&&jsxRuntime.jsx("h2",{className:"text-primary-500 dark:text-primary-400 mb-3 text-sm font-semibold uppercase",children:t}),e.map(q=>jsxRuntime.jsx(Qc,{item:q,basePath:r,depth:0,onItemClick:ke,LinkComponent:o,showLines:c,expandedKeys:D,onToggle:C},q.key??q.path??q.label))]}),!k&&w==="icons"&&e.map(q=>{let Z=q.key??q.path??q.label;return q.children&&q.children.length>0?jsxRuntime.jsx(z0,{item:q,basePath:r,onItemClick:ke,LinkComponent:o},Z):jsxRuntime.jsx(V0,{item:q,basePath:r,onItemClick:ke,LinkComponent:o},Z)})]});if(g&&k){let q=H?H.side:E,Z=H?H.y:U/100*(typeof window<"u"?window.innerHeight:600),ue=H?{top:Z,transform:"translateY(-50%)",transition:"none",...q==="left"?{left:0}:{right:0}}:{top:`${U}%`,transform:"translateY(-50%)",transition:"top 0.15s ease",...E==="left"?{left:0}:{right:0}},te=E==="left"?{left:0,right:"auto"}:{right:0,left:"auto"},ve=R?"translate-x-0":E==="left"?"-translate-x-full":"translate-x-full",Ne=E==="left"?"border-r":"border-l";return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[R&&reactDom.createPortal(jsxRuntime.jsx("div",{className:"fixed inset-0 z-40 bg-black/50",style:{top:b},onClick:()=>O(false)}),document.body),reactDom.createPortal(jsxRuntime.jsxs("aside",{ref:M,className:f("fixed bottom-0 z-50 flex flex-col w-56 bg-white dark:bg-primary-900 shadow-xl transition-transform duration-200",Ne,"border-primary-200 dark:border-primary-700",ve),style:{top:b,...te},onClick:be,onTouchStart:W,onTouchMove:G,onTouchEnd:le,children:[jsxRuntime.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-primary-200 px-3 py-2 dark:border-primary-700",children:[jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-primary-500 dark:text-primary-400",children:"Navigation"}),jsxRuntime.jsx("button",{type:"button",onClick:X=>{X.stopPropagation(),O(false);},className:f(sn,"h-7 w-7 p-1"),"aria-label":"Close navigation",children:jsxRuntime.jsx(lucideReact.X,{className:"h-4 w-4"})})]}),y&&jsxRuntime.jsx("div",{className:"shrink-0 border-b border-primary-200 px-3 py-2 dark:border-primary-700",children:y}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto overscroll-y-contain p-3",children:jsxRuntime.jsx("nav",{className:"flex flex-col gap-0.5",children:B})})]}),document.body),!R&&reactDom.createPortal(jsxRuntime.jsx("div",{className:f("fixed z-50 flex items-center",q==="left"?"justify-start":"justify-end",H?"cursor-grabbing":"cursor-grab"),style:{...ue,width:44,height:80,marginTop:-12,touchAction:"none",userSelect:"none"},onPointerDown:oe,onDragStart:X=>X.preventDefault(),role:"button","aria-label":"Open navigation",tabIndex:0,children:jsxRuntime.jsx("div",{className:f("flex h-16 w-6 items-center justify-center","bg-primary-800/80 text-white shadow-md backdrop-blur-sm","hover:bg-primary-700/90 dark:bg-primary-200/80 dark:text-primary-900 dark:hover:bg-primary-300/90",q==="left"?"rounded-r-xl":"rounded-l-xl"),children:q==="left"?jsxRuntime.jsx(lucideReact.ChevronRight,{className:"h-4 w-4"}):jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"h-4 w-4"})})}),document.body)]})}return jsxRuntime.jsx("nav",{className:f("flex flex-col gap-0.5",w==="mini"&&"items-center",d),...v,children:B})}function F0({href:e,className:t,onClick:r,children:n}){return jsxRuntime.jsx("a",{href:e,className:t,onClick:r,children:n})}function ls({brand:e,onBrandClick:t,navItems:r=[],actions:n=[],linkComponent:o=F0,height:a="h-12",mobileMenu:i=false,navMenuIcon:s,actionsMenuIcon:l,className:c,children:u}){let p=i&&r.length>0,m=i&&n.length>0,d="md:hidden rounded-md px-1.5 py-1.5 text-primary-500 dark:text-primary-400 hover:text-primary-700 dark:hover:text-primary-200 [&_svg]:h-5 [&_svg]:w-5",g=v=>v?"text-primary-900 font-medium dark:text-primary-100":"text-primary-500 hover:text-primary-700 dark:text-primary-400 dark:hover:text-primary-200 transition-colors",h="rounded-md p-1.5 text-primary-500 hover:bg-primary-100 hover:text-primary-700 dark:text-primary-400 dark:hover:bg-primary-800 dark:hover:text-primary-200 transition-colors [&_svg]:h-5 [&_svg]:w-5",b=r.map((v,N)=>({key:typeof v.label=="string"?v.label:String(N),label:v.active?jsxRuntime.jsx("span",{className:"font-semibold text-primary-900 dark:text-primary-100",children:v.label}):v.label,onClick:()=>{v.onClick?v.onClick({preventDefault:()=>{},stopPropagation:()=>{}}):v.href&&(window.location.href=v.href);}})),y=n.map((v,N)=>({key:v.key??String(N),label:jsxRuntime.jsxs("span",{className:"flex items-center gap-2 [&_svg]:h-4 [&_svg]:w-4 [&_svg]:shrink-0",children:[v.icon,jsxRuntime.jsx("span",{children:v.ariaLabel})]}),onClick:()=>{v.onClick?v.onClick({preventDefault:()=>{},stopPropagation:()=>{}}):v.href&&(v.external?window.open(v.href,"_blank","noopener,noreferrer"):window.location.href=v.href);}}));return jsxRuntime.jsxs("header",{className:f("flex shrink-0 items-center justify-between border-b px-5","border-primary-200 bg-white dark:border-primary-700 dark:bg-primary-900",a,c),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 md:gap-6",children:[e&&jsxRuntime.jsx("div",{className:f("text-lg font-bold text-primary-800 dark:text-primary-100",t&&"cursor-pointer"),onClick:t,role:t?"button":void 0,tabIndex:t?0:void 0,onKeyDown:t?v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),t(v));}:void 0,children:e}),p&&jsxRuntime.jsx(qr,{intent:"ghost",size:"sm",className:d,label:s??jsxRuntime.jsx(lucideReact.PanelLeft,{className:"h-5 w-5"}),items:b,align:"left",chevron:false,"aria-label":"Open navigation"}),r.length>0&&jsxRuntime.jsx("nav",{className:f("flex items-center gap-4 text-sm",i?"hidden md:flex":"flex"),children:r.map((v,N)=>{let x=typeof v.label=="string"?v.label:N,w=g(v.active);return v.href?jsxRuntime.jsx(o,{href:v.href,className:w,onClick:v.onClick,children:v.label},x):jsxRuntime.jsx("button",{type:"button",className:f(w,"cursor-pointer"),onClick:v.onClick,children:v.label},x)})})]}),u&&jsxRuntime.jsx("div",{className:"flex items-center",children:u}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[n.length>0&&jsxRuntime.jsx("div",{className:f("flex items-center gap-1",i?"hidden md:flex":"flex"),children:n.map((v,N)=>v.href?jsxRuntime.jsx("a",{href:v.href,target:v.external?"_blank":void 0,rel:v.external?"noopener noreferrer":void 0,className:h,"aria-label":v.ariaLabel,onClick:v.onClick,children:v.icon},v.key??N):jsxRuntime.jsx("button",{type:"button",className:h,"aria-label":v.ariaLabel,onClick:v.onClick,children:v.icon},v.key??N))}),m&&jsxRuntime.jsx(qr,{intent:"ghost",size:"sm",className:d,label:l??jsxRuntime.jsx(lucideReact.MoreHorizontal,{className:"h-5 w-5"}),items:y,align:"right",chevron:false,"aria-label":"Open menu"})]})]})}var la=classVarianceAuthority.cva("inline-flex items-center gap-1 underline-offset-2 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/20 [&_svg]:shrink-0",{variants:{intent:{default:"text-primary-600 hover:text-primary-800 active:text-primary-900 dark:text-primary-400 dark:hover:text-primary-200 dark:active:text-primary-100",secondary:"text-secondary-500 hover:text-secondary-700 active:text-secondary-800 dark:text-secondary-400 dark:hover:text-secondary-200 dark:active:text-secondary-100",muted:"text-primary-400 hover:text-primary-600 dark:text-primary-500 dark:hover:text-primary-300"},size:{sm:"text-xs [&_svg]:h-3 [&_svg]:w-3",md:"text-sm [&_svg]:h-3.5 [&_svg]:w-3.5",lg:"text-base [&_svg]:h-4 [&_svg]:w-4"},underline:{always:"underline",hover:"hover:underline",none:"no-underline"}},defaultVariants:{intent:"default",size:"md",underline:"none"}});function O0(e,t){return !!(t==="_blank"||e&&/^https?:\/\//.test(e))}var $0=e=>jsxRuntime.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":true,...e,children:[jsxRuntime.jsx("path",{d:"M15 3h6v6"}),jsxRuntime.jsx("path",{d:"M10 14 21 3"}),jsxRuntime.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"})]});function cs({intent:e,size:t,underline:r,external:n,className:o,children:a,href:i,target:s,rel:l,...c}){let u=n??O0(i,s);return jsxRuntime.jsxs("a",{href:i,target:u&&!s?"_blank":s,rel:u&&!l?"noopener noreferrer":l,className:f(la({intent:e,size:t,underline:r}),o),...c,children:[a,u&&jsxRuntime.jsx($0,{})]})}function ua({items:e,separator:t=jsxRuntime.jsx(lucideReact.ChevronRight,{className:"h-3.5 w-3.5","aria-hidden":"true"}),homeIcon:r=false,LinkComponent:n="a",className:o}){return jsxRuntime.jsx("nav",{"aria-label":"Breadcrumb",className:f("flex",o),children:jsxRuntime.jsx("ol",{className:"flex flex-wrap items-center gap-1 text-sm",children:e.map((a,i)=>{let s=i===e.length-1,l=r===true?jsxRuntime.jsx(lucideReact.Home,{className:"h-3.5 w-3.5"}):r!==false&&r!==void 0?r:null,c=i===0&&l?l:a.icon;return jsxRuntime.jsxs("li",{className:"flex items-center gap-1",children:[i>0&&jsxRuntime.jsx("span",{className:"text-secondary-400 dark:text-secondary-500",children:t}),s?jsxRuntime.jsxs("span",{"aria-current":"page",className:f("flex items-center gap-1 font-medium text-primary-800 dark:text-primary-100",c&&"gap-1.5"),children:[c,a.label]}):a.href?jsxRuntime.jsxs(n,{href:a.href,className:f("flex items-center gap-1 text-secondary-500 transition-colors","hover:text-primary-700 dark:text-secondary-400 dark:hover:text-primary-200","rounded focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/30",c&&"gap-1.5"),children:[c,a.label]}):jsxRuntime.jsxs("span",{className:"flex items-center gap-1 text-secondary-500 dark:text-secondary-400",children:[c,a.label]})]},i)})})})}function pa(e,t){let r=[];for(let n=e;n<=t;n++)r.push(n);return r}function q0(e,t,r){let n=r*2+5;if(t<=n)return pa(1,t);let o=Math.max(e-r,1),a=Math.min(e+r,t),i=o>2,s=a<t-1;return !i&&s?[...pa(1,3+r*2),"\u2026",t]:i&&!s?[1,"\u2026",...pa(t-(3+r*2)+1,t)]:[1,"\u2026",...pa(o,a),"\u2026",t]}var td={sm:"h-7 min-w-7 px-1.5 text-xs",md:"h-9 min-w-9 px-2 text-sm",lg:"h-11 min-w-11 px-2.5 text-base"},Wn={sm:"h-3.5 w-3.5",md:"h-4 w-4",lg:"h-5 w-5"};function Yn({onClick:e,disabled:t,active:r,size:n,"aria-label":o,children:a}){return jsxRuntime.jsx("button",{type:"button",onClick:e,disabled:t,"aria-label":o,"aria-current":r?"page":void 0,className:f("inline-flex items-center justify-center rounded font-medium transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/30",td[n],r?"bg-primary-600 text-white dark:bg-primary-500":"border border-primary-200 bg-white text-primary-700 hover:bg-primary-50 dark:border-primary-700 dark:bg-primary-900 dark:text-primary-300 dark:hover:bg-primary-800",t&&"pointer-events-none opacity-40"),children:a})}function ma({totalPages:e,currentPage:t,onPageChange:r,siblingCount:n=2,showFirstLast:o=true,showPageCount:a=false,size:i="md",className:s}){if(e<=1)return null;let l=q0(t,e,n);return jsxRuntime.jsxs("nav",{"aria-label":"Pagination",className:f("flex items-center gap-1",s),children:[o&&jsxRuntime.jsx(Yn,{size:i,onClick:()=>r(1),disabled:t===1,"aria-label":"First page",children:jsxRuntime.jsx(lucideReact.ChevronsLeft,{className:Wn[i]})}),jsxRuntime.jsx(Yn,{size:i,onClick:()=>r(t-1),disabled:t===1,"aria-label":"Previous page",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:Wn[i]})}),l.map((c,u)=>c==="\u2026"?jsxRuntime.jsx("span",{className:f("inline-flex items-center justify-center text-secondary-400",td[i]),"aria-hidden":"true",children:jsxRuntime.jsx(lucideReact.MoreHorizontal,{className:Wn[i]})},`ellipsis-${u}`):jsxRuntime.jsx(Yn,{size:i,active:c===t,onClick:()=>r(c),"aria-label":`Page ${c}`,children:c},c)),jsxRuntime.jsx(Yn,{size:i,onClick:()=>r(t+1),disabled:t===e,"aria-label":"Next page",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:Wn[i]})}),o&&jsxRuntime.jsx(Yn,{size:i,onClick:()=>r(e),disabled:t===e,"aria-label":"Last page",children:jsxRuntime.jsx(lucideReact.ChevronsRight,{className:Wn[i]})}),a&&jsxRuntime.jsxs("span",{className:"ml-2 text-sm text-secondary-500 dark:text-secondary-400",children:["Page ",t," of ",e]})]})}function rd({item:e,mode:t}){return e.separator?jsxRuntime.jsx("div",{className:"mx-1 h-10 w-px self-center bg-primary-200 dark:bg-primary-700","aria-hidden":true}):jsxRuntime.jsxs("button",{type:"button",title:e.title??e.label,disabled:e.disabled,onClick:e.onClick,"aria-pressed":e.active,className:f("relative flex shrink-0 items-center justify-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition-all duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-400","disabled:cursor-not-allowed disabled:opacity-40",e.active?"bg-primary-100 text-primary-700 shadow-inner dark:bg-primary-800 dark:text-primary-200":"text-primary-700 hover:bg-primary-50 active:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-800",t==="full"?"min-w-[3.5rem] flex-col gap-0.5 py-2":"","[&_svg]:shrink-0",t==="full"?"[&_svg]:h-5 [&_svg]:w-5":"[&_svg]:h-4 [&_svg]:w-4"),children:[e.icon&&jsxRuntime.jsx("span",{children:e.icon}),t!=="icons"&&jsxRuntime.jsx("span",{className:f(t==="full"?"text-[0.6rem] leading-tight":""),children:e.label})]})}function eh({group:e,mode:t,disabled:r=false}){return jsxRuntime.jsxs("div",{className:f("flex shrink-0 flex-col items-stretch",r&&"opacity-50"),children:[jsxRuntime.jsx("div",{className:"flex items-center gap-0.5 px-1",children:e.items.map(n=>jsxRuntime.jsx(rd,{item:r?{...n,disabled:true}:n,mode:t},n.key))}),t==="full"&&jsxRuntime.jsx("div",{className:"mt-1 border-t border-primary-100 px-2 pt-0.5 text-center dark:border-primary-800",children:jsxRuntime.jsx("span",{className:"text-[0.55rem] text-secondary-400 dark:text-secondary-500",children:e.label})})]})}function Un({tabs:e,defaultTab:t,activeTab:r,onTabChange:n,mode:o,onModeChange:a,sticky:i=false,className:s}){let l=e.filter(x=>!x.hidden),[c,u]=On.useState(t??l[0]?.key??""),[p,m]=On.useState(o??"full"),[d,g]=On.useState(true),h=r??c,b=o??p,y=x=>{if(!l.find(L=>L.key===x)?.disabled){if(x===h&&b!=="icons"){g(L=>!L);return}u(x),n?.(x),g(true);}},N=l.find(x=>x.key===h)??l[0];return jsxRuntime.jsxs("div",{className:f("select-none border-b border-primary-200 bg-white dark:border-primary-700 dark:bg-primary-900",i&&"sticky top-0 z-30",s),children:[jsxRuntime.jsxs("div",{className:"flex items-center border-b border-primary-100 dark:border-primary-800",children:[jsxRuntime.jsx("div",{className:"flex flex-1 items-end overflow-x-auto",children:l.map(x=>jsxRuntime.jsxs("button",{type:"button",disabled:x.disabled,onClick:()=>y(x.key),className:f("flex shrink-0 items-center gap-1.5 border-b-2 px-4 py-2 text-sm font-medium transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-400 [&_svg]:h-4 [&_svg]:w-4",x.disabled?"cursor-not-allowed border-transparent text-secondary-300 opacity-50 dark:text-secondary-600":x.key===h&&d?"border-primary-500 text-primary-700 dark:border-primary-400 dark:text-primary-200":"border-transparent text-secondary-500 hover:border-primary-300 hover:text-primary-600 dark:text-secondary-400 dark:hover:text-primary-300"),children:[x.icon,x.label]},x.key))}),jsxRuntime.jsx("button",{type:"button",title:d?"Collapse ribbon":"Expand ribbon",onClick:()=>g(x=>!x),className:"ml-auto mr-2 rounded-md p-1.5 text-secondary-400 transition-colors hover:bg-primary-50 hover:text-primary-600 dark:hover:bg-primary-800 dark:hover:text-primary-300",children:d?jsxRuntime.jsx(lucideReact.ChevronUp,{className:"h-4 w-4"}):jsxRuntime.jsx(lucideReact.ChevronDown,{className:"h-4 w-4"})})]}),d&&N&&b!=="icons"&&jsxRuntime.jsx("div",{className:"flex items-stretch gap-1 overflow-x-auto px-2 py-1.5",children:N.groups.map((x,w)=>jsxRuntime.jsxs(On__default.default.Fragment,{children:[w>0&&jsxRuntime.jsx("div",{className:"mx-1 h-auto w-px self-stretch bg-primary-100 dark:bg-primary-800"}),jsxRuntime.jsx(eh,{group:x,mode:b,disabled:x.disabled||N.disabled})]},x.key))}),b==="icons"&&d&&N&&jsxRuntime.jsx("div",{className:"flex items-center gap-0.5 overflow-x-auto px-2 py-1",children:N.groups.flatMap(x=>x.items.map(w=>jsxRuntime.jsx(rd,{item:x.disabled||N.disabled?{...w,disabled:true}:w,mode:"icons"},w.key)))})]})}var th={SideNav:ss,Header:ls,NavLink:cs,Breadcrumb:ua,Pagination:ma,RibbonBar:Un},us=th;var fa=classVarianceAuthority.cva("flex w-full items-center justify-between font-medium transition-all [&_svg]:shrink-0",{variants:{size:{sm:"py-2 text-xs [&_svg]:h-3.5 [&_svg]:w-3.5",md:"py-3 text-sm [&_svg]:h-4 [&_svg]:w-4",lg:"py-4 text-base [&_svg]:h-5 [&_svg]:w-5"}},defaultVariants:{size:"md"}}),ha=classVarianceAuthority.cva("",{variants:{size:{sm:"pb-2 text-xs",md:"pb-3 text-sm",lg:"pb-4 text-base"}},defaultVariants:{size:"md"}}),ga=classVarianceAuthority.cva("divide-y",{variants:{intent:{default:"divide-primary-300 dark:divide-primary-700",bordered:"divide-primary-300 rounded-lg border border-primary-300 bg-white px-3 shadow-sm dark:divide-primary-700 dark:border-primary-700 dark:bg-primary-800/50",ghost:"divide-transparent"}},defaultVariants:{intent:"default"}}),ba=classVarianceAuthority.cva("flex",{variants:{intent:{line:"border-b border-primary-200 dark:border-primary-700",pills:"gap-1 rounded-lg bg-primary-100 p-1 dark:bg-primary-800",underline:"gap-4"}},defaultVariants:{intent:"line"}}),ya=classVarianceAuthority.cva("inline-flex cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap px-3 py-1.5 text-sm font-medium transition-all focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:h-4 [&_svg]:w-4 [&_svg]:shrink-0",{variants:{intent:{line:"text-primary-500 hover:text-primary-700 data-[active=true]:text-primary-900 dark:text-primary-400 dark:hover:text-primary-200 dark:data-[active=true]:text-primary-100",pills:"rounded-md text-primary-600 hover:text-primary-900 data-[active=true]:bg-white data-[active=true]:text-primary-900 data-[active=true]:shadow-sm dark:text-primary-400 dark:hover:text-primary-100 dark:data-[active=true]:bg-primary-700 dark:data-[active=true]:text-primary-100",underline:"text-primary-500 hover:text-primary-700 data-[active=true]:text-primary-900 dark:text-primary-400 dark:data-[active=true]:text-primary-100"}},defaultVariants:{intent:"line"}});var va=On.createContext(null),ps=On.createContext(null);function ms({type:e="single",defaultValue:t=[],value:r,onValueChange:n,intent:o,size:a,className:i,children:s,...l}){let[c,u]=On.useState(t),p=r??c,m=On.useCallback(d=>{let g=h=>h.includes(d)?h.filter(b=>b!==d):e==="single"?[d]:[...h,d];n?n(g(p)):u(g);},[e,p,n]);return jsxRuntime.jsx(va.Provider,{value:{expandedItems:p,toggleItem:m,size:a},children:jsxRuntime.jsx("div",{className:f(ga({intent:o}),i),...l,children:s})})}function ah({value:e,className:t,children:r,...n}){let a=On.useContext(va)?.expandedItems.includes(e)??false;return jsxRuntime.jsx(ps.Provider,{value:{value:e,isExpanded:a},children:jsxRuntime.jsx("div",{className:f("",t),...n,children:r})})}function ih({className:e,children:t,...r}){let n=On.useContext(va),o=On.useContext(ps);return jsxRuntime.jsxs("button",{className:f("text-primary-800 hover:text-primary-600 dark:text-primary-100 dark:hover:text-primary-300 cursor-pointer gap-2 font-medium transition-colors",fa({size:n?.size}),e),onClick:()=>o&&n?.toggleItem(o.value),"aria-expanded":o?.isExpanded?"true":"false",...r,children:[jsxRuntime.jsx("span",{className:"flex items-center gap-1.5 [&_svg]:shrink-0",children:t}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("shrink-0 transition-transform duration-200",o?.isExpanded&&"rotate-180")})]})}function sh({className:e,children:t,...r}){let n=On.useContext(va),o=On.useContext(ps);return jsxRuntime.jsx("div",{className:f("grid transition-[grid-template-rows] duration-200 ease-out",o?.isExpanded?"grid-rows-[1fr]":"grid-rows-[0fr]"),children:jsxRuntime.jsx("div",{className:"overflow-hidden",children:jsxRuntime.jsx("div",{className:f("text-primary-500 dark:text-primary-400",ha({size:n?.size}),e),...r,children:t})})})}var Jn=On.createContext(null),ld=On.createContext(false);function fs({defaultValue:e="",value:t,onValueChange:r,intent:n,children:o,className:a}){let[i,s]=On.useState(e),l=t??i,c=On.useRef(new Map),u=On.useCallback(m=>{r?r(m):s(m);},[r]),p=On.useCallback((m,d)=>{d?c.current.set(m,d):c.current.delete(m);},[]);return jsxRuntime.jsx(Jn.Provider,{value:{activeValue:l,setActiveValue:u,intent:n,registerTrigger:p},children:jsxRuntime.jsx("div",{className:a,children:o})})}function uh({className:e,scrollable:t,...r}){let n=On.useContext(Jn),o=On.useRef(null),[a,i]=On.useState(null),s=On.useCallback(()=>{if(!n||!o.current)return;let p=o.current.querySelectorAll('[role="tab"][data-active="true"]')[0];if(!p){i(null);return}let m=o.current.getBoundingClientRect(),d=p.getBoundingClientRect();i({left:d.left-m.left,width:d.width});},[n]);On.useLayoutEffect(s,[n?.activeValue,s]),On.useEffect(()=>{let u=new ResizeObserver(s);return o.current&&u.observe(o.current),()=>u.disconnect()},[s]);let l=n?.intent??"line",c=a&&(l==="line"||l==="underline");return jsxRuntime.jsxs("div",{ref:o,className:f(ba({intent:n?.intent}),"relative",t&&"overflow-x-auto",e),role:"tablist",...r,children:[r.children,c&&jsxRuntime.jsx("span",{className:"absolute bottom-0 h-0.5 rounded-full bg-primary-600 dark:bg-primary-400 transition-all duration-300 ease-in-out",style:{left:a.left,width:a.width},"aria-hidden":true})]})}function ph({value:e,className:t,children:r,...n}){let o=On.useContext(Jn),a=o?.activeValue===e,i=On.useCallback(s=>o?.registerTrigger(e,s),[o,e]);return jsxRuntime.jsx("button",{ref:i,className:f(ya({intent:o?.intent}),t),role:"tab","data-active":a,"aria-selected":a,onClick:()=>o?.setActiveValue(e),...n,children:r})}function mh({className:e,children:t,...r}){let n=On.useContext(Jn);if(!n)return null;let o=On__default.default.Children.toArray(t).filter(i=>On__default.default.isValidElement(i)),a=Math.max(0,o.findIndex(i=>i.props.value===n.activeValue));return jsxRuntime.jsx("div",{className:f("overflow-hidden",e),...r,children:jsxRuntime.jsx(ld.Provider,{value:true,children:jsxRuntime.jsx("div",{className:"flex transition-transform duration-300 ease-in-out",style:{transform:`translateX(-${a*100}%)`},children:o.map((i,s)=>jsxRuntime.jsx("div",{className:"w-full shrink-0","aria-hidden":s!==a,children:i},i.props.value??s))})})})}function fh({value:e,className:t,children:r,...n}){let o=On.useContext(Jn);return On.useContext(ld)?jsxRuntime.jsx("div",{className:f("pt-4",t),role:"tabpanel",...n,children:r}):o?.activeValue!==e?null:jsxRuntime.jsx("div",{className:f("pt-4",t),role:"tabpanel",...n,children:r})}var gh={Accordion:ms,Tabs:fs},hs=gh;var Qn=classVarianceAuthority.cva("rounded-lg bg-white p-6 shadow-xl dark:bg-primary-900",{variants:{size:{sm:"w-full max-w-sm",md:"w-full max-w-lg",lg:"w-full max-w-2xl",xl:"w-full max-w-4xl",full:"h-[calc(100vh-4rem)] w-[calc(100vw-4rem)]"}},defaultVariants:{size:"md"}}),wa=classVarianceAuthority.cva("absolute z-50 rounded px-2 py-1 text-xs shadow-md animate-fade-in",{variants:{intent:{default:"bg-primary-900 text-white dark:bg-primary-100 dark:text-primary-900",light:"border border-primary-200 bg-white text-primary-700 dark:border-primary-600 dark:bg-primary-800 dark:text-primary-200"}},defaultVariants:{intent:"default"}});var mr=[];function wh(e){mr.push(e);}function kh(e){let t=mr.indexOf(e);t!==-1&&mr.splice(t,1);}function bs(e){return mr.length>0&&mr[mr.length-1]===e}function Nh(e){let t=mr.indexOf(e);return t!==-1?t:mr.length}var ys=On.createContext(null);function Zn({open:e,onOpenChange:t,modal:r=true,closeOnOutsideClick:n=false,children:o}){let a=On.useId();return On.useEffect(()=>{if(e)return wh(a),()=>kh(a)},[e,a]),On.useEffect(()=>{if(!e||!r)return;let i=s=>{s.key==="Escape"&&bs(a)&&t(false);};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[e,r,t,a]),On.useEffect(()=>{if(!e||!r)return;let i=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=i;}},[e,r]),e?jsxRuntime.jsx(ys.Provider,{value:{id:a,onOpenChange:t,modal:r,closeOnOutsideClick:n},children:reactDom.createPortal(o,document.body)}):null}function vs({size:e,position:t="center",className:r,children:n,...o}){let a=On.useContext(ys);if(!a)return null;let s=200+Nh(a.id)*10,l=()=>{a.closeOnOutsideClick&&bs(a.id)&&a.onOpenChange(false);},c=t==="bottom";return a.modal?jsxRuntime.jsx("div",{className:f("animate-fade-in fixed inset-0 bg-black/50",c?"flex items-end justify-center":"flex items-center justify-center p-4"),style:{zIndex:s},onClick:l,children:jsxRuntime.jsx("div",{className:f(Qn({size:e}),c?"animate-slide-in-bottom w-full rounded-b-none rounded-t-(--dialog-sheet-radius) max-h-[85vh] overflow-y-auto":"animate-scale-in",r),role:"dialog","aria-modal":"true",onClick:u=>u.stopPropagation(),...o,children:n})}):jsxRuntime.jsx("div",{className:f("fixed inset-0 flex items-center justify-center p-4",a.closeOnOutsideClick?"pointer-events-auto":"pointer-events-none"),style:{zIndex:s},onClick:a.closeOnOutsideClick&&bs(a.id)?()=>a.onOpenChange(false):void 0,children:jsxRuntime.jsx("div",{className:f(Qn({size:e}),"animate-scale-in pointer-events-auto shadow-2xl",r),role:"dialog",onClick:a.closeOnOutsideClick?u=>u.stopPropagation():void 0,...o,children:n})})}function xs({className:e,...t}){return jsxRuntime.jsx("div",{className:f("mb-4 space-y-1",e),...t})}function ws({className:e,...t}){return jsxRuntime.jsx("h2",{className:f("text-primary-900 dark:text-primary-100 flex items-center gap-1.5 text-lg font-semibold [&_svg]:h-5 [&_svg]:w-5 [&_svg]:shrink-0",e),...t})}function ks({className:e,...t}){return jsxRuntime.jsx("p",{className:f("text-primary-500 dark:text-primary-400 text-sm",e),...t})}function Ns({className:e,...t}){return jsxRuntime.jsx("div",{className:f("mt-6 flex justify-end gap-2",e),...t})}function Ch({className:e,...t}){let r=On.useContext(ys);return jsxRuntime.jsx("button",{className:f("text-primary-400 hover:text-primary-600 dark:hover:text-primary-200 absolute top-4 right-4 rounded-md p-1 transition-colors",e),onClick:()=>r?.onOpenChange(false),"aria-label":"Close",...t,children:jsxRuntime.jsx(lucideReact.X,{className:"h-4 w-4"})})}var Mh={top:"bottom-full left-1/2 -translate-x-1/2 mb-2",bottom:"top-full left-1/2 -translate-x-1/2 mt-2",left:"right-full top-1/2 -translate-y-1/2 mr-2",right:"left-full top-1/2 -translate-y-1/2 ml-2"};function Cs({content:e,position:t="top",intent:r,delay:n=200,maxWidth:o,children:a,className:i}){let[s,l]=On.useState(false),[c,u]=On.useState();return jsxRuntime.jsxs("span",{className:"relative inline-flex",onMouseEnter:()=>{let d=setTimeout(()=>l(true),n);u(d);},onMouseLeave:()=>{clearTimeout(c),l(false);},children:[a,s&&jsxRuntime.jsx("span",{className:f(wa({intent:r}),Mh[t],"pointer-events-none",o?"whitespace-normal":"whitespace-nowrap",i),style:o!==void 0?{maxWidth:o}:void 0,role:"tooltip",children:e})]})}var Lh={right:"drawer-enter-right",left:"drawer-enter-left",top:"drawer-enter-top",bottom:"drawer-enter-bottom"},Dh={right:e=>({width:e}),left:e=>({width:e}),top:e=>({height:e}),bottom:e=>({height:e})},Ah={right:"right-0 top-0 bottom-0",left:"left-0 top-0 bottom-0",top:"top-0 left-0 right-0",bottom:"bottom-0 left-0 right-0"};function ka({open:e,onOpenChange:t,side:r="right",size:n=r==="top"||r==="bottom"?"50vh":"24rem",backdrop:o=true,closeOnBackdropClick:a=true,children:i,className:s}){let l=On.useRef(null);return On.useEffect(()=>{if(!e)return;let c=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=c;}},[e]),On.useEffect(()=>{if(!e)return;function c(u){u.key==="Escape"&&t(false);}return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,t]),On.useEffect(()=>{if(!e)return;let c=l.current;if(!c)return;let u=c.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');u[0]?.focus();function p(m){m.key!=="Tab"||u.length===0||(m.shiftKey?document.activeElement===u[0]&&(m.preventDefault(),u[u.length-1].focus()):document.activeElement===u[u.length-1]&&(m.preventDefault(),u[0].focus()));}return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[e]),e?reactDom.createPortal(jsxRuntime.jsxs("div",{className:"fixed inset-0 z-50",role:"presentation",children:[o&&jsxRuntime.jsx("div",{className:"drawer-backdrop absolute inset-0 bg-black/40 backdrop-blur-[2px]",onClick:()=>a&&t(false),"aria-hidden":"true"}),jsxRuntime.jsx("div",{ref:l,role:"dialog","aria-modal":"true",className:f("drawer-panel absolute flex flex-col","bg-white shadow-2xl dark:bg-primary-900",Ah[r],Lh[r],s),style:Dh[r](n),children:i})]}),document.body):null}function pd({children:e,className:t}){return jsxRuntime.jsx("div",{className:f("flex shrink-0 items-center justify-between border-b border-primary-100 px-5 py-4 dark:border-primary-800",t),children:e})}function md({children:e,className:t}){return jsxRuntime.jsx("div",{className:f("flex-1 overflow-y-auto px-5 py-4",t),children:e})}function fd({children:e,className:t}){return jsxRuntime.jsx("div",{className:f("flex shrink-0 items-center justify-end gap-3 border-t border-primary-100 px-5 py-4 dark:border-primary-800",t),children:e})}function hd({onClose:e,className:t}){return jsxRuntime.jsx("button",{type:"button",onClick:e,"aria-label":"Close drawer",className:f("rounded-md p-1.5 text-secondary-400 transition-colors","hover:bg-primary-100 hover:text-primary-700 dark:hover:bg-primary-800 dark:hover:text-primary-200","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/30",t),children:jsxRuntime.jsx(lucideReact.X,{className:"h-4 w-4"})})}function gd({item:e,depth:t=0,onClose:r}){let[n,o]=On.useState(false),a=On.useRef(null),i=On.useRef(null),s=e.children&&e.children.length>0,l=On.useRef(null),c=()=>{l.current=setTimeout(()=>o(false),150);},u=()=>{l.current&&clearTimeout(l.current);};return e.separator?jsxRuntime.jsx("li",{role:"separator",className:"my-1 h-px bg-primary-100 dark:bg-primary-700","aria-hidden":true}):jsxRuntime.jsxs("li",{ref:a,role:"menuitem","aria-disabled":e.disabled,"aria-haspopup":s,"aria-expanded":s?n:void 0,className:f("relative flex cursor-pointer select-none items-center gap-2 rounded-md px-3 py-1.5 text-sm outline-none transition-colors",e.disabled?"cursor-not-allowed opacity-40":e.danger?"text-danger-600 hover:bg-danger-50 focus-visible:bg-danger-50 dark:text-danger-400 dark:hover:bg-danger-900/30":"text-primary-700 hover:bg-primary-50 focus-visible:bg-primary-50 dark:text-primary-200 dark:hover:bg-primary-800"),tabIndex:e.disabled?-1:0,onMouseEnter:()=>{u(),s&&o(true);},onMouseLeave:()=>{s&&c();},onClick:p=>{e.disabled||s||(e.onClick?.(p),r());},onKeyDown:p=>{e.disabled||((p.key==="Enter"||p.key===" ")&&(p.preventDefault(),s?o(m=>!m):(e.onClick?.(p),r())),p.key==="Escape"&&r());},children:[e.icon?jsxRuntime.jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center [&_svg]:h-4 [&_svg]:w-4",children:e.icon}):jsxRuntime.jsx("span",{className:"h-4 w-4 shrink-0"}),jsxRuntime.jsx("span",{className:"flex-1",children:e.label}),e.shortcut&&!s&&jsxRuntime.jsx("kbd",{className:"ml-auto rounded bg-primary-100 px-1.5 py-0.5 font-mono text-[0.6rem] text-secondary-500 dark:bg-primary-700 dark:text-secondary-400",children:e.shortcut}),s&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"ml-auto h-3.5 w-3.5 text-secondary-400"}),s&&n&&jsxRuntime.jsx("ul",{ref:i,role:"menu",onMouseEnter:u,onMouseLeave:c,className:f("absolute top-0 z-50 min-w-[11rem] animate-[fade-in_120ms_ease-out,scale-in_120ms_ease-out] rounded-xl border border-primary-200 bg-white p-1.5 shadow-xl dark:border-primary-700 dark:bg-primary-900",t%2===0?"left-full ml-1":"right-full mr-1"),children:e.children.map(p=>jsxRuntime.jsx(gd,{item:p,depth:t+1,onClose:r},p.key))})]})}function Vh({items:e,position:t,onClose:r}){let n=On.useRef(null),[o,a]=On.useState(t);return On.useEffect(()=>{let i=n.current;if(!i)return;let s=i.getBoundingClientRect(),l=window.innerWidth,c=window.innerHeight,{x:u,y:p}=t;u+s.width>l-8&&(u=Math.max(8,l-s.width-8)),p+s.height>c-8&&(p=Math.max(8,c-s.height-8)),a({x:u,y:p});},[t]),On.useEffect(()=>{let i=s=>{n.current&&!n.current.contains(s.target)&&r();};return document.addEventListener("mousedown",i,true),document.addEventListener("touchstart",i,true),document.addEventListener("scroll",r,{passive:true,capture:true}),()=>{document.removeEventListener("mousedown",i,true),document.removeEventListener("touchstart",i,true),document.removeEventListener("scroll",r,true);}},[r]),On.useEffect(()=>{let i=s=>{s.key==="Escape"&&r(),s.key==="Tab"&&s.preventDefault();};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[r]),jsxRuntime.jsx("ul",{ref:n,role:"menu",style:{position:"fixed",left:o.x,top:o.y},className:"z-[9999] min-w-[12rem] animate-[fade-in_120ms_ease-out,scale-in_120ms_ease-out] rounded-xl border border-primary-200 bg-white p-1.5 shadow-2xl dark:border-primary-700 dark:bg-primary-900",children:e.map(i=>jsxRuntime.jsx(gd,{item:i,onClose:r},i.key))})}function Ss({items:e,children:t,disabled:r,onOpenChange:n,className:o}){let[a,i]=On.useState(false),[s,l]=On.useState({x:0,y:0}),c=On.useRef(null),u=On.useCallback((h,b)=>{r||(l({x:h,y:b}),i(true),n?.(true));},[r,n]),p=On.useCallback(()=>{i(false),n?.(false);},[n]),m=On.useCallback(h=>{h.preventDefault(),h.stopPropagation(),u(h.clientX,h.clientY);},[u]),d=On.useCallback(h=>{let b=h.touches[0];c.current=setTimeout(()=>{document.addEventListener("contextmenu",y=>y.preventDefault(),{capture:true,once:true}),u(b.clientX,b.clientY);},500);},[u]),g=On.useCallback(()=>{c.current&&clearTimeout(c.current);},[]);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:f("contents",o),style:{WebkitTouchCallout:"none",userSelect:"none"},onContextMenu:m,onTouchStart:d,onTouchEnd:g,onTouchMove:g,onTouchCancel:g,children:t}),a&&jsxRuntime.jsx(Vh,{items:e,position:s,onClose:p})]})}var _h={Dialog:Zn,Tooltip:Cs,Drawer:ka,ContextMenu:Ss},Ps=_h;var Ca=classVarianceAuthority.cva("relative w-full overflow-hidden rounded-full bg-primary-200 dark:bg-primary-700",{variants:{size:{xs:"h-1",sm:"h-2",md:"h-3",lg:"h-4"},intent:{primary:"[&_.progress-fill]:bg-primary-500",success:"[&_.progress-fill]:bg-success-500",warning:"[&_.progress-fill]:bg-warning-500",danger:"[&_.progress-fill]:bg-danger-500"},edge:{none:"rounded-full",top:"fixed top-0 left-0 right-0 z-50 rounded-none",bottom:"fixed bottom-0 left-0 right-0 z-50 rounded-none"}},defaultVariants:{size:"md",intent:"primary",edge:"none"}}),cn=classVarianceAuthority.cva("text-primary-500 dark:text-primary-400",{variants:{size:{sm:"text-xs",md:"text-sm",lg:"text-base"}},defaultVariants:{size:"md"}}),no=classVarianceAuthority.cva("pointer-events-auto flex items-start gap-3 rounded-lg border p-4 shadow-lg transition-all",{variants:{intent:{success:"border-success-200 bg-success-50 text-success-800 dark:border-success-800 dark:bg-success-900/80 dark:text-success-200",warning:"border-warning-200 bg-warning-50 text-warning-800 dark:border-warning-800 dark:bg-warning-900/80 dark:text-warning-200",error:"border-danger-200 bg-danger-50 text-danger-800 dark:border-danger-800 dark:bg-danger-900/80 dark:text-danger-200",info:"border-primary-200 bg-primary-50 text-primary-800 dark:border-primary-800 dark:bg-primary-900/80 dark:text-primary-200"}},defaultVariants:{intent:"info"}}),oo=classVarianceAuthority.cva("skeleton-base bg-secondary-200 dark:bg-secondary-700",{variants:{variant:{text:"skeleton-text w-full rounded-sm",circular:"rounded-full",rectangular:"rounded-none",rounded:"rounded-md"},animation:{pulse:"animate-pulse",wave:"skeleton-wave",none:""}},defaultVariants:{variant:"text",animation:"pulse"}}),Ma=classVarianceAuthority.cva("border",{variants:{variant:{default:"bg-primary-800 text-primary-50 border-primary-700 dark:bg-primary-100 dark:text-primary-900 dark:border-primary-200",success:"bg-success-500 text-white border-success-600 dark:bg-success-600 dark:border-success-700",danger:"bg-danger-500 text-white border-danger-600 dark:bg-danger-600 dark:border-danger-700",warning:"bg-warning-500 text-warning-900 border-warning-600 dark:bg-warning-600 dark:text-white dark:border-warning-700",info:"bg-primary-500 text-white border-primary-600 dark:bg-primary-600 dark:border-primary-700"}},defaultVariants:{variant:"default"}});function Ds({intent:e,className:t,children:r,...n}){return jsxRuntime.jsx("div",{className:f(no({intent:e}),t),role:"alert",...n,children:r})}function Xh({className:e,...t}){return jsxRuntime.jsx("h5",{className:f("flex items-center gap-1.5 font-semibold [&_svg]:h-4 [&_svg]:w-4 [&_svg]:shrink-0",e),...t})}function Gh({className:e,...t}){return jsxRuntime.jsx("span",{className:f("mt-0.5 shrink-0 [&_svg]:h-5 [&_svg]:w-5",e),...t})}function qh({className:e,...t}){return jsxRuntime.jsx("div",{className:f("flex-1 min-w-0 space-y-1",e),...t})}function Jh({className:e,...t}){return jsxRuntime.jsx("p",{className:f("text-sm opacity-90",e),...t})}var Qh=0,Fr=[],Ta=new Map,Rs=new Set;function Zh(){return Fr}function Es(){Rs.forEach(e=>e());}function As(e){let t=Ta.get(e);t&&(clearTimeout(t),Ta.delete(e)),Fr=Fr.map(r=>r.id===e?{...r,exiting:true}:r),Es(),setTimeout(()=>{Fr=Fr.filter(r=>r.id!==e),Es();},200);}function eg(e){let t=`alert-${++Qh}`;Fr=[...Fr,{...e,id:t}],Es();let r=e.duration??5e3;if(r>0){let n=setTimeout(()=>{Ta.delete(t),As(t);},r);Ta.set(t,n);}return t}var Ls=16;function tg(e){Ls=e;}var rg={"top-right":"right-4 items-end","top-left":"left-4 items-start","bottom-right":"bottom-4 right-4 items-end","bottom-left":"bottom-4 left-4 items-start","top-center":"left-1/2 -translate-x-1/2 items-center","bottom-center":"bottom-4 left-1/2 -translate-x-1/2 items-center"},ng={"top-right":"animate-slide-in-right","top-left":"animate-slide-in-left","bottom-right":"animate-slide-in-right","bottom-left":"animate-slide-in-left","top-center":"animate-slide-in-top","bottom-center":"animate-slide-in-bottom"},og={success:lucideReact.CircleCheck,warning:lucideReact.TriangleAlert,error:lucideReact.CircleX,info:lucideReact.Info};function ag({alert:e,onClose:t}){let r=e.intent??"info",n=og[r],o=e.position??"top-right";return jsxRuntime.jsxs("div",{className:f(no({intent:r}),ng[o],e.exiting&&"opacity-0 transition-opacity duration-200","w-80 max-w-[calc(100vw-2rem)]"),role:"alert",children:[jsxRuntime.jsx(n,{className:"mt-0.5 h-5 w-5 shrink-0"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[e.title&&jsxRuntime.jsx("p",{className:"font-semibold",children:e.title}),jsxRuntime.jsx("p",{className:f(e.title&&"text-sm opacity-90"),children:e.message})]}),jsxRuntime.jsx("button",{onClick:t,"aria-label":"Close notification",className:"shrink-0 cursor-pointer opacity-50 transition-opacity hover:opacity-100",children:jsxRuntime.jsx(lucideReact.X,{className:"h-4 w-4"})})]})}var ig=e=>e.startsWith("top");function sg(){let e=On.useSyncExternalStore(n=>(Rs.add(n),()=>Rs.delete(n)),Zh),t=On.useRef(Ls);if(On.useEffect(()=>{t.current=Ls;},[]),e.length===0)return null;let r=e.reduce((n,o)=>{let a=o.position??"top-right";return (n[a]??(n[a]=[])).push(o),n},{});return reactDom.createPortal(jsxRuntime.jsx(jsxRuntime.Fragment,{children:Object.entries(r).map(([n,o])=>jsxRuntime.jsx("div",{style:ig(n)?{top:`${t.current}px`}:void 0,className:f("pointer-events-none fixed z-100 flex flex-col gap-2",rg[n]),children:o.map(a=>jsxRuntime.jsx(ag,{alert:a,onClose:()=>As(a.id)},a.id))},n))}),document.body)}var yd=false;function lg(){if(yd)return;yd=true;let e=document.createElement("div");e.id="alert-toast-root",document.body.appendChild(e),client.createRoot(e).render(jsxRuntime.jsx(sg,{}));}function cg(){return On.useEffect(()=>{lg();},[]),{addAlert:eg,removeAlert:As}}function zs({value:e=0,size:t,intent:r,edge:n,showLabel:o=false,indeterminate:a=false,animated:i=false,duration:s=500,className:l,...c}){let u=Math.max(0,Math.min(100,e)),[p,m]=On.useState(0),d=On.useRef(0);On.useEffect(()=>{if(!a)return d.current=requestAnimationFrame(()=>{m(u);}),()=>{d.current&&cancelAnimationFrame(d.current);}},[u,a]);let g=o&&!a&&t!=="xs"&&t!=="sm",h=jsxRuntime.jsx("div",{role:"progressbar","aria-valuenow":a?void 0:u,"aria-valuemin":0,"aria-valuemax":100,className:f(Ca({size:t,intent:r,edge:n}),l),...c,children:a?jsxRuntime.jsx("div",{className:"progress-fill absolute top-0 h-full rounded-full animate-progress-indeterminate"}):jsxRuntime.jsx("div",{className:f("progress-fill h-full rounded-full transition-[width] ease-out",i&&"animate-progress-shine"),style:{width:`${p}%`,transitionDuration:`${s}ms`},children:g&&jsxRuntime.jsxs("span",{className:"flex h-full items-center justify-end pr-2 text-[10px] font-semibold text-white",children:[Math.round(u),"%"]})})});return n==="top"||n==="bottom"?reactDom.createPortal(h,document.body):h}function Sa({size:e}){let t=e==="sm"?20:e==="lg"?40:28;return jsxRuntime.jsx("svg",{className:"animate-spin-rotate",width:t,height:t,viewBox:"0 0 50 50",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("circle",{className:"animate-spin-dash stroke-current",cx:"25",cy:"25",r:"20",fill:"none",strokeWidth:"4",strokeLinecap:"round",strokeDasharray:"90 150",strokeDashoffset:"0"})})}function Hs({spinning:e=true,tip:t,size:r,className:n,children:o,...a}){return o?jsxRuntime.jsxs("div",{className:f("relative w-fit",n),...a,children:[jsxRuntime.jsx("div",{className:f("transition-all duration-200",e&&"pointer-events-none select-none blur-[1px]"),children:o}),e&&jsxRuntime.jsxs("div",{className:"absolute inset-0 z-10 flex flex-col items-center justify-center gap-2 rounded-[inherit] bg-primary-50/60 dark:bg-primary-900/60",children:[jsxRuntime.jsx(Sa,{size:r}),t&&jsxRuntime.jsx("span",{className:f(cn({size:r}),"select-none"),children:t})]})]}):e?jsxRuntime.jsxs("div",{className:f("inline-flex flex-col items-center gap-2",n),...a,children:[jsxRuntime.jsx(Sa,{size:r}),t&&jsxRuntime.jsx("span",{className:f(cn({size:r}),"select-none"),children:t})]}):null}var yg=0,io=[],Vs=new Set;function vg(){return io}function Cd(){Vs.forEach(e=>e());}function xg(e,t){let r=++yg;return io=[...io,{id:r,target:e,tip:t}],Cd(),()=>wg(r)}function wg(e){io=io.filter(t=>t.id!==e),Cd();}function kg(){return xg}var kd=false;function Ng(){if(kd||typeof document>"u")return;kd=true;let e=document.createElement("div");e.id="jac-spin-portal",document.body.appendChild(e),import('react-dom/client').then(({createRoot:t})=>{t(e).render(jsxRuntime.jsx(Sg,{}));});}var Pa=new Map;function Cg(e){let t=Pa.get(e);if(t){t.count++;return}let r=getComputedStyle(e),n=e.style.position;r.position==="static"&&(e.style.position="relative"),Pa.set(e,{count:1,original:n});}function Mg(e){let t=Pa.get(e);t&&(t.count--,t.count<=0&&(e.style.position=t.original,Pa.delete(e)));}function Tg({entry:e}){return On.useEffect(()=>{let t=e.target;if(!Nd(t))return Cg(t),()=>Mg(t)},[e.target]),Nd(e.target)?reactDom.createPortal(jsxRuntime.jsxs("div",{className:"fixed inset-0 z-50 flex flex-col items-center justify-center gap-3 bg-primary-900/40 dark:bg-primary-900/60",children:[jsxRuntime.jsx(Sa,{size:"lg"}),e.tip&&jsxRuntime.jsx("span",{className:"select-none text-sm text-primary-100",children:e.tip})]}),document.body):reactDom.createPortal(jsxRuntime.jsxs("div",{className:"absolute inset-0 z-10 flex flex-col items-center justify-center gap-2 rounded-[inherit] bg-primary-50/60 dark:bg-primary-900/60",children:[jsxRuntime.jsx(Sa,{size:"md"}),e.tip&&jsxRuntime.jsx("span",{className:f(cn({size:"md"}),"select-none"),children:e.tip})]}),e.target)}function Sg(){let e=On.useSyncExternalStore(t=>(Vs.add(t),()=>Vs.delete(t)),()=>vg());return e.length===0?null:jsxRuntime.jsx(jsxRuntime.Fragment,{children:e.map(t=>jsxRuntime.jsx(Tg,{entry:t},t.id))})}function Nd(e){return e===document.documentElement||e===document.body}typeof document<"u"&&Ng();function Md(e){if(e!==void 0)return typeof e=="number"?`${e}px`:e}function Ra({variant:e="text",animation:t="pulse",width:r,height:n,lines:o,className:a,style:i,...s}){let l=Md(r),c=Md(n);return e==="text"&&o!==void 0&&o>1?jsxRuntime.jsx("span",{className:f("flex flex-col gap-2",a),"aria-hidden":"true",role:"presentation",style:i,...s,children:Array.from({length:o},(u,p)=>jsxRuntime.jsx("span",{className:oo({variant:"text",animation:t}),style:{width:p===o-1?"60%":l??"100%",height:c}},p))}):jsxRuntime.jsx("span",{className:f(oo({variant:e,animation:t}),a),"aria-hidden":"true",role:"presentation",style:{width:l,height:c,...i},...s})}var Dg=0,Td=320;function Sd(e,t){let[r,n]=On.useState([]),o=On.useRef(new Map),a=On.useCallback(u=>{let p=o.current.get(u);p!==void 0&&(clearTimeout(p),o.current.delete(u));},[]),i=On.useCallback(u=>{a(u),n(p=>p.map(m=>m.id===u?{...m,_exiting:true}:m)),setTimeout(()=>n(p=>p.filter(m=>m.id!==u)),Td);},[a]),s=On.useCallback(u=>i(u),[i]),l=On.useCallback(()=>{o.current.forEach(clearTimeout),o.current.clear(),n(u=>u.map(p=>({...p,_exiting:true}))),setTimeout(()=>n([]),Td);},[]),c=On.useCallback(u=>{let p=`toast-${++Dg}`,m=u.position??e,d=u.duration!==void 0?u.duration:t;if(n(g=>[...g,{...u,id:p,position:m,duration:d,_exiting:false}]),d>0){let g=setTimeout(()=>{o.current.delete(p),i(p);},d);o.current.set(p,g);}return p},[e,t,i]);return On.useEffect(()=>{let u=o.current;return ()=>{u.forEach(clearTimeout),u.clear();}},[]),{items:r,toast:c,dismiss:s,dismissAll:l}}var lo=On.createContext(null),Og={"top-right":"top-4 right-4 items-end","top-left":"top-4 left-4 items-start","top-center":"top-4 left-1/2 -translate-x-1/2 items-center","bottom-right":"bottom-4 right-4 items-end","bottom-left":"bottom-4 left-4 items-start","bottom-center":"bottom-4 left-1/2 -translate-x-1/2 items-center"},$g={"top-right":"animate-slide-in-right","top-left":"animate-slide-in-left","top-center":"animate-slide-in-top","bottom-right":"animate-slide-in-right","bottom-left":"animate-slide-in-left","bottom-center":"animate-slide-in-bottom"},Kg={"top-right":"toast-exit-right","top-left":"toast-exit-left","top-center":"toast-exit-up","bottom-right":"toast-exit-right","bottom-left":"toast-exit-left","bottom-center":"toast-exit-down"},jg={default:lucideReact.Bell,success:lucideReact.CheckCircle2,danger:lucideReact.XCircle,warning:lucideReact.AlertTriangle,info:lucideReact.Info};function Wg({item:e,onDismiss:t}){let r=e.variant??"default",n=e.position??"top-right",o=e.dismissible!==false,a=jg[r],i=()=>{e.onDismiss?.(e.id),t(e.id);};return jsxRuntime.jsx("div",{className:f("toast-wrapper",e._exiting&&`toast-wrapper-exiting ${Kg[n]}`),children:jsxRuntime.jsxs("div",{role:"status","aria-live":"polite","aria-atomic":"true",className:f(Ma({variant:r}),"toast-item pointer-events-auto",!e._exiting&&$g[n]),children:[jsxRuntime.jsx(a,{className:"mt-0.5 h-5 w-5 shrink-0","aria-hidden":"true"}),jsxRuntime.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[e.title&&jsxRuntime.jsx("p",{className:"text-sm font-semibold leading-snug",children:e.title}),e.description&&jsxRuntime.jsx("p",{className:f("text-sm leading-snug",e.title&&"opacity-80"),children:e.description}),e.action&&jsxRuntime.jsx("button",{type:"button",onClick:e.action.onClick,className:"toast-action-btn mt-1 self-start text-xs font-semibold underline underline-offset-2 transition-opacity hover:opacity-80",children:e.action.label})]}),o&&jsxRuntime.jsx("button",{type:"button",onClick:i,"aria-label":"Dismiss notification",className:"shrink-0 cursor-pointer opacity-60 transition-opacity hover:opacity-100",children:jsxRuntime.jsx(lucideReact.X,{className:"h-4 w-4"})})]})})}function Ea({children:e,defaultPosition:t="top-right",defaultDuration:r=4e3}){let{items:n,toast:o,dismiss:a,dismissAll:i}=Sd(t,r),s=n.reduce((l,c)=>{let u=c.position??t;return (l[u]??(l[u]=[])).push(c),l},{});return jsxRuntime.jsxs(lo.Provider,{value:{toast:o,dismiss:a,dismissAll:i},children:[e,typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx(jsxRuntime.Fragment,{children:Object.entries(s).map(([l,c])=>jsxRuntime.jsx("div",{className:f("pointer-events-none fixed z-[100] flex flex-col gap-2",Og[l]),children:c.map(u=>jsxRuntime.jsx(Wg,{item:u,onDismiss:a},u.id))},l))}),document.body)]})}function La(){let e=On.useContext(lo);if(!e)throw new Error("useToast must be used within a <ToastProvider>");return e}var Xg={Alert:Ds,ProgressBar:zs,Spin:Hs,Skeleton:Ra,ToastProvider:Ea,useToast:La},Bs=Xg;var Ld="#1c1914",Dd="#130f0b",db="#2e261e",$s="#504638",dn="#6b5d4d",Aa=`url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E")`,ub=[{key:"like",icon:jsxRuntime.jsx(lucideReact.Heart,{className:"h-5 w-5"}),activeIcon:jsxRuntime.jsx(lucideReact.Heart,{className:"h-5 w-5",fill:"currentColor"}),label:"Like",toggle:true},{key:"dislike",icon:jsxRuntime.jsx(lucideReact.ThumbsDown,{className:"h-5 w-5"}),label:"Dislike"},{key:"bookmark",icon:jsxRuntime.jsx(lucideReact.Bookmark,{className:"h-5 w-5"}),activeIcon:jsxRuntime.jsx(lucideReact.Bookmark,{className:"h-5 w-5",fill:"currentColor"}),label:"Bookmark",toggle:true},{key:"share",icon:jsxRuntime.jsx(lucideReact.Share2,{className:"h-5 w-5"}),label:"Share"},{key:"download",icon:jsxRuntime.jsx(lucideReact.Download,{className:"h-5 w-5"}),label:"Download"}];function Ks({photos:e,layout:t="strip",actions:r=ub,onAction:n,className:o,showGrain:a=true,sheetTitle:i,sheetLabel:s}){let[l,c]=On.useState(null),[u,p]=On.useState(new Set),m=On.useCallback(b=>c(b),[]),d=On.useCallback(()=>c(null),[]),g=On.useCallback((b,y)=>{if(r.find(N=>N.key===b)?.toggle){let N=`${y}-${b}`;p(x=>{let w=new Set(x);return w.has(N)?w.delete(N):w.add(N),w});}n?.(b,e[y],y);},[r,n,e]);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(t==="strip"?pb:t==="sheet"?mb:fb,{photos:e,onPhotoClick:m,showGrain:a,className:o,sheetTitle:i,sheetLabel:s}),l!==null&&reactDom.createPortal(jsxRuntime.jsx(hb,{photos:e,currentIndex:l,onIndexChange:c,onClose:d,actions:r,activeActions:u,onAction:g,showGrain:a}),document.body)]})}function Ed({count:e=30}){return jsxRuntime.jsx("div",{className:"flex shrink-0 items-center justify-between px-3",style:{height:22,background:Ld},children:Array.from({length:e}).map((t,r)=>jsxRuntime.jsx("div",{className:"rounded-xs",style:{width:12,height:8,background:db}},r))})}function pb({photos:e,onPhotoClick:t,showGrain:r,className:n}){let o=On.useRef(null);return jsxRuntime.jsxs("div",{className:f("select-none rounded-lg overflow-hidden",n),style:{background:Dd},children:[jsxRuntime.jsx(Ed,{count:Math.max(30,e.length*6)}),jsxRuntime.jsx("div",{ref:o,className:"flex gap-1 overflow-x-auto scroll-smooth px-1 py-1",style:{background:Ld,scrollSnapType:"x mandatory"},children:e.map((a,i)=>jsxRuntime.jsxs("div",{className:"group relative shrink-0 cursor-pointer",style:{scrollSnapAlign:"center"},onClick:()=>t(i),children:[jsxRuntime.jsxs("div",{className:"overflow-hidden rounded-xs border",style:{borderColor:$s,width:280,height:187},children:[jsxRuntime.jsx("img",{src:a.src,alt:a.alt??a.title??"",className:"h-full w-full object-cover transition-transform duration-700 ease-out group-hover:scale-110",draggable:false}),jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-0 mix-blend-multiply opacity-0 transition-opacity duration-300 group-hover:opacity-100",style:{background:"rgba(255, 175, 60, 0.06)"}}),r&&jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-0 opacity-0 transition-opacity duration-300 group-hover:opacity-[0.06]",style:{backgroundImage:Aa,animation:"film-grain-shift 0.6s steps(5) infinite"}}),jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-0 opacity-30 transition-opacity duration-300 group-hover:opacity-50",style:{background:"radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.5) 100%)"}})]}),jsxRuntime.jsxs("div",{className:"mt-0.5 text-center font-mono text-[9px] tracking-widest",style:{color:dn},children:[String(i+1).padStart(2,"0"),i%2===0?"":"A"]})]},i))}),jsxRuntime.jsx(Ed,{count:Math.max(30,e.length*6)})]})}function mb({photos:e,onPhotoClick:t,showGrain:r,className:n,sheetTitle:o,sheetLabel:a}){return jsxRuntime.jsxs("div",{className:f("rounded-lg p-5",n),style:{background:Dd},children:[jsxRuntime.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.25em]",style:{color:dn},children:o??`JAC\xB7Film 35mm \xB7 ${e.length} exposures`}),jsxRuntime.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.25em]",style:{color:dn},children:a??"Contact Sheet"})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-3 gap-2 sm:grid-cols-4 md:grid-cols-5 lg:grid-cols-6",children:e.map((i,s)=>jsxRuntime.jsxs("div",{className:"group cursor-pointer",style:{animation:`reveal-up 0.4s ease-out ${s*50}ms both`},onClick:()=>t(s),children:[jsxRuntime.jsx("div",{className:"mb-0.5 font-mono text-[9px] tracking-wider",style:{color:dn},children:String(s+1).padStart(2,"0")}),jsxRuntime.jsxs("div",{className:"relative overflow-hidden rounded-[1px] border transition-all duration-300 group-hover:border-amber-600/50 group-hover:shadow-[0_0_20px_rgba(217,171,89,0.15)]",style:{borderColor:$s,aspectRatio:"3/2"},children:[jsxRuntime.jsx("img",{src:i.src,alt:i.alt??"",className:"h-full w-full object-cover transition-transform duration-500 group-hover:scale-105",draggable:false}),r&&jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.04]",style:{backgroundImage:Aa}}),jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 translate-y-full bg-linear-to-t from-black/70 to-transparent p-2 pt-6 transition-transform duration-300 group-hover:translate-y-0",children:jsxRuntime.jsx("span",{className:"text-xs font-medium text-white/90",children:i.title})})]})]},s))})]})}function fb({photos:e,onPhotoClick:t,showGrain:r,className:n}){let[o,a]=On.useState(false),[i,s]=On.useState(null),l=Math.min(e.length,8),c=e.slice(0,l),u=m=>{let d=Math.sin(m*137.508+1)*1e4,g=(d%12-6).toFixed(1),h=(d/7%8-4).toFixed(1),b=(d/13%6-3).toFixed(1);return `rotate(${g}deg) translate(${h}px, ${b}px)`},p=(m,d)=>{let g=(d-1)/2,h=((m-g)*7).toFixed(1),b=((m-g)*110).toFixed(0),y=(-Math.abs(m-g)*10+(i===m?-18:0)).toFixed(0);return `translateX(${b}px) translateY(${y}px) rotate(${h}deg)`};return jsxRuntime.jsxs("div",{className:f("flex flex-col items-center gap-4",n),children:[jsxRuntime.jsx("div",{className:"relative flex h-85 w-full items-center justify-center",onMouseEnter:()=>a(true),onMouseLeave:()=>{a(false),s(null);},children:c.map((m,d)=>jsxRuntime.jsx("div",{className:"absolute cursor-pointer rounded-lg shadow-xl transition-all duration-500",style:{transitionTimingFunction:"cubic-bezier(0.34, 1.56, 0.64, 1)",transitionDelay:o?`${d*35}ms`:`${(l-d)*25}ms`,transform:o?p(d,c.length):u(d),zIndex:o?d+1:c.length-d,width:220,height:147},onClick:()=>t(d),onMouseEnter:()=>o&&s(d),onMouseLeave:()=>s(null),children:jsxRuntime.jsxs("div",{className:"relative h-full w-full overflow-hidden rounded-lg border transition-shadow duration-300",style:{borderColor:o&&i===d?"rgba(217,171,89,0.5)":$s,boxShadow:o&&i===d?"0 25px 50px rgba(0,0,0,0.5), 0 0 30px rgba(217,171,89,0.1)":"0 10px 30px rgba(0,0,0,0.4)"},children:[jsxRuntime.jsx("img",{src:m.src,alt:m.alt??"",className:"h-full w-full object-cover",draggable:false}),r&&jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.04]",style:{backgroundImage:Aa}}),jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-0",style:{background:"radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.35) 100%)"}}),o&&i===d&&jsxRuntime.jsx("div",{className:"absolute inset-x-0 bottom-0 bg-linear-to-t from-black/80 to-transparent p-3 pt-8",style:{animation:"reveal-up 0.25s ease-out"},children:jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90",children:m.title})})]})},d))}),e.length>l&&jsxRuntime.jsxs("span",{className:"font-mono text-xs",style:{color:dn},children:["+ ",e.length-l," more"]}),jsxRuntime.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.3em] transition-opacity duration-300",style:{color:dn,opacity:o?0:.7},children:"Hover to explore"})]})}function hb({photos:e,currentIndex:t,onIndexChange:r,onClose:n,actions:o,activeActions:a,onAction:i,showGrain:s}){let l=e[t],[c,u]=On.useState(1),[p,m]=On.useState({x:0,y:0}),[d,g]=On.useState(false),[h,b]=On.useState(false),y=On.useRef(false),v=On.useRef({x:0,y:0}),N=On.useRef(null);On.useLayoutEffect(()=>{requestAnimationFrame(()=>b(true));},[]),On.useEffect(()=>{let C=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=C;}},[]),On.useEffect(()=>{let C=I=>{switch(I.key){case "Escape":n();break;case "ArrowLeft":x(-1);break;case "ArrowRight":x(1);break;case "i":case "I":g(k=>!k);break}};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)}),On.useEffect(()=>{let C=N.current;if(!C)return;let I=k=>{k.preventDefault();let T=k.deltaY<0?1.12:.89;u(R=>{let O=Math.min(8,Math.max(1,R*T));return O<=1&&m({x:0,y:0}),O});};return C.addEventListener("wheel",I,{passive:false}),()=>C.removeEventListener("wheel",I)},[]);let x=On.useCallback(C=>{let I=t+C;I>=0&&I<e.length&&(r(I),u(1),m({x:0,y:0}));},[t,e.length,r]),w=On.useCallback(C=>{c<=1||(y.current=true,v.current={x:C.clientX,y:C.clientY},C.target.setPointerCapture(C.pointerId));},[c]),L=On.useCallback(C=>{if(!y.current)return;let I=C.clientX-v.current.x,k=C.clientY-v.current.y;v.current={x:C.clientX,y:C.clientY},m(T=>({x:T.x+I/c,y:T.y+k/c}));},[c]),P=On.useCallback(()=>{y.current=false;},[]),A=On.useCallback(()=>{c>1?(u(1),m({x:0,y:0})):u(2.5);},[c]),D=C=>a.has(`${t}-${C}`),S=l.metadata;return jsxRuntime.jsxs("div",{className:"fixed inset-0 z-200 flex flex-col",style:{animation:"lightbox-backdrop-in 0.35s ease-out"},children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/95",onClick:n}),s&&jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.025]",style:{backgroundImage:Aa,animation:"film-grain-shift 0.6s steps(5) infinite"}}),jsxRuntime.jsxs("div",{className:"relative z-10 flex h-12 shrink-0 items-center justify-between px-4",children:[jsxRuntime.jsxs("span",{className:"font-mono text-sm text-white/50",children:[t+1," / ",e.length]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("span",{className:"mr-2 font-mono text-xs text-white/40",children:[c.toFixed(1),"x"]}),jsxRuntime.jsx("button",{className:"rounded-full p-2 text-white/60 transition-colors hover:bg-white/10 hover:text-white",onClick:()=>u(C=>Math.min(8,C*1.3)),title:"Zoom in",children:jsxRuntime.jsx(lucideReact.ZoomIn,{className:"h-4 w-4"})}),jsxRuntime.jsx("button",{className:"rounded-full p-2 text-white/60 transition-colors hover:bg-white/10 hover:text-white",onClick:()=>{u(C=>{let I=Math.max(1,C*.7);return I<=1&&m({x:0,y:0}),I});},title:"Zoom out",children:jsxRuntime.jsx(lucideReact.ZoomOut,{className:"h-4 w-4"})}),jsxRuntime.jsx("button",{className:"rounded-full p-2 text-white/60 transition-colors hover:bg-white/10 hover:text-white",onClick:n,title:"Close",children:jsxRuntime.jsx(lucideReact.X,{className:"h-5 w-5"})})]})]}),jsxRuntime.jsxs("div",{ref:N,className:"relative flex flex-1 items-center justify-center overflow-hidden",style:{cursor:c>1?"grab":"default"},onPointerDown:w,onPointerMove:L,onPointerUp:P,onDoubleClick:A,children:[jsxRuntime.jsx("img",{src:l.src,alt:l.alt??l.title??"",className:"max-h-full max-w-full select-none object-contain",style:{animation:"lightbox-photo-in 0.35s cubic-bezier(0.16, 1, 0.3, 1)",transform:`scale(${c}) translate(${p.x}px, ${p.y}px)`,transition:y.current?"none":"transform 0.15s ease-out"},draggable:false},t),t>0&&jsxRuntime.jsx("button",{className:"absolute left-3 top-1/2 -translate-y-1/2 rounded-full bg-black/40 p-2.5 text-white/70 backdrop-blur-sm transition-all hover:bg-black/60 hover:text-white",onClick:C=>{C.stopPropagation(),x(-1);},children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"h-6 w-6"})}),t<e.length-1&&jsxRuntime.jsx("button",{className:"absolute right-3 top-1/2 -translate-y-1/2 rounded-full bg-black/40 p-2.5 text-white/70 backdrop-blur-sm transition-all hover:bg-black/60 hover:text-white",onClick:C=>{C.stopPropagation(),x(1);},children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"h-6 w-6"})})]}),jsxRuntime.jsx("div",{className:f("absolute inset-x-0 bottom-0 z-20 transition-all duration-400",d?"translate-y-0 opacity-100":"pointer-events-none translate-y-full opacity-0"),children:jsxRuntime.jsxs("div",{className:"bg-linear-to-t from-black/90 via-black/75 to-transparent px-6 pb-24 pt-16",children:[l.title&&jsxRuntime.jsx("h3",{className:"mb-3 text-xl font-semibold text-white",children:l.title}),l.description&&jsxRuntime.jsx("p",{className:"mb-4 max-w-xl border-l-2 border-amber-500/40 pl-4 text-sm leading-relaxed text-white/60 italic",style:{animation:"reveal-up 0.4s ease-out 0.1s both"},children:l.description}),S&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-x-6 gap-y-2 text-sm text-white/70",children:[S.camera&&jsxRuntime.jsxs("span",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(lucideReact.Camera,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",S.camera,S.lens&&jsxRuntime.jsx("span",{className:"text-white/40",children:"\xB7"}),S.lens&&S.lens]}),(S.aperture||S.shutter||S.iso)&&jsxRuntime.jsxs("span",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(lucideReact.Aperture,{className:"h-3.5 w-3.5 text-amber-400/80"}),[S.aperture,S.shutter,S.iso&&`ISO ${S.iso}`].filter(Boolean).join(" \xB7 ")]}),S.date&&jsxRuntime.jsxs("span",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",S.date]}),S.location&&jsxRuntime.jsxs("span",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(lucideReact.MapPin,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",S.location]})]})]})}),jsxRuntime.jsx("div",{className:"relative z-20 flex h-16 shrink-0 items-center justify-center gap-1",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5 rounded-full bg-white/6 px-2 py-1.5 backdrop-blur-xl",children:[o.map(C=>{let I=C.toggle&&D(C.key);return jsxRuntime.jsx("button",{className:f("rounded-full p-2.5 transition-all duration-200",I?"text-amber-400 hover:text-amber-300":"text-white/60 hover:bg-white/10 hover:text-white"),onClick:()=>i(C.key,t),title:C.label,children:I&&C.activeIcon?C.activeIcon:C.icon},C.key)}),jsxRuntime.jsx("div",{className:"mx-1 h-5 w-px bg-white/10"}),jsxRuntime.jsx("button",{className:f("rounded-full p-2.5 transition-all duration-200",d?"text-amber-400 hover:text-amber-300":"text-white/60 hover:bg-white/10 hover:text-white"),onClick:()=>g(C=>!C),title:"Photo info (I)",children:jsxRuntime.jsx(lucideReact.Info,{className:"h-5 w-5"})})]})})]})}var js="data:image/svg+xml,"+encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 200 200">
3
3
  <rect width="200" height="200" fill="#1e1b2e"/>
4
4
  <circle cx="100" cy="100" r="60" fill="none" stroke="#6366f1" stroke-width="1.5" opacity="0.3"/>
5
5
  <circle cx="100" cy="100" r="20" fill="none" stroke="#6366f1" stroke-width="1" opacity="0.4"/>
6
6
  <text x="100" y="108" text-anchor="middle" font-family="monospace" font-size="18" fill="#6366f1" opacity="0.6">\u266A</text>
7
- </svg>`);function Cl(e){if(!isFinite(e)||e<0)return "0:00";let t=Math.floor(e/60),r=Math.floor(e%60);return `${t}:${r.toString().padStart(2,"0")}`}function af(e){return e.startsWith("bottom")?"bottom":e.startsWith("top")?"top":"right"}var of={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"},sf={"bottom-right":"bottom-4 right-0","bottom-left":"bottom-4 left-0","top-right":"top-4 right-0","top-left":"top-4 left-0"},lf={"bottom-right":"bottom-8 right-0 w-1.5 h-16 rounded-l-full","bottom-left":"bottom-8 left-0 w-1.5 h-16 rounded-r-full","top-right":"top-8 right-0 w-1.5 h-16 rounded-l-full","top-left":"top-8 left-0 w-1.5 h-16 rounded-r-full"};function Ci({playlist:e,initialTrack:t=0,position:r="bottom-right",entrance:n,theme:a,docked:i=false,visible:o,onVisibleChange:l,onTrackChange:c,onLike:m,autoPlay:d=true,shuffle:f=false,loop:p=false,accent:u="#8b5cf6",className:h}){let [g,b]=qr.useState(t),[N,x]=qr.useState(false),[T,w]=qr.useState(0),[C,S]=qr.useState(0),[R,V]=qr.useState(.8),[I,E]=qr.useState(false),[v,U]=qr.useState(new Set),[k,q]=qr.useState(false),[M,W]=qr.useState(o??!i),[$,ue]=qr.useState(false),[J,de]=qr.useState(false),[re,B]=qr.useState(f),[j,pe]=qr.useState(p),ye=qr.useRef(false),y=qr.useRef(null),L=qr.useRef(null),G=qr.useRef(void 0),O=qr.useRef(null),_=qr.useRef(null),ee=o??M,xe=n??af(r),P=e[g],K=i,oe=a==="dark"?"dark":a==="light"?"light":"",X="bg-(--mp-bg)",fe="text-(--mp-text)",we="text-(--mp-text-muted)",H="text-(--accent)",ne="border-(--mp-border)";qr.useEffect(()=>{let z=y.current;z&&(z.src=P.src,z.load(),N&&z.play().catch(()=>{}));},[g,P.src]),qr.useEffect(()=>{if(!d||ye.current)return;let z=y.current;if(!z)return;let ve=()=>{ye.current=true,x(true),z.play().catch(()=>{});};return z.addEventListener("canplaythrough",ve,{once:true}),()=>z.removeEventListener("canplaythrough",ve)},[d]),qr.useEffect(()=>{let z=y.current;z&&(N?z.play().catch(()=>{}):z.pause());},[N]),qr.useEffect(()=>{let z=y.current;z&&(z.muted=I,_.current?_.current.gain.value=I?0:R:z.volume=R);},[R,I]),qr.useEffect(()=>{let z=y.current;if(!z)return;let ve=()=>w(z.currentTime),_e=()=>S(z.duration),mt=()=>{j?(z.currentTime=0,z.play().catch(()=>{})):Q();};return z.addEventListener("timeupdate",ve),z.addEventListener("loadedmetadata",_e),z.addEventListener("ended",mt),()=>{z.removeEventListener("timeupdate",ve),z.removeEventListener("loadedmetadata",_e),z.removeEventListener("ended",mt);}},[g,e.length]);let Y=qr.useCallback(z=>{let ve=(z%e.length+e.length)%e.length;b(ve),w(0),c?.(ve,e[ve]),ee||(W(true),l?.(true));},[e,ee,c,l]),Q=qr.useCallback(()=>{if(re){let z;do z=Math.floor(Math.random()*e.length);while(z===g&&e.length>1);Y(z);}else Y(g+1);},[Y,g,re,e.length]),ke=qr.useCallback(()=>{if(re){let z;do z=Math.floor(Math.random()*e.length);while(z===g&&e.length>1);Y(z);}else Y(g-1);},[Y,g,re,e.length]),He=qr.useCallback(()=>{let z=v.has(g);U(ve=>{let _e=new Set(ve);return z?_e.delete(g):_e.add(g),_e}),m?.(g,P,!z);},[g,v,m,P]),Fe=qr.useCallback(z=>{let ve=z.currentTarget.getBoundingClientRect(),mt=Math.max(0,Math.min(1,(z.clientX-ve.left)/ve.width))*C;y.current&&(y.current.currentTime=mt),w(mt);},[C]),Z=qr.useCallback(()=>{ue(true);let z=K?200:400;G.current=setTimeout(()=>{ue(false),W(false),l?.(false);},z);},[K,l]);qr.useEffect(()=>()=>{G.current&&clearTimeout(G.current);},[]),qr.useEffect(()=>()=>{O.current?.close();},[]);function Ne(){if(O.current||!y.current){O.current?.resume();return}try{let z=window.AudioContext??window.webkitAudioContext;if(!z)return;let ve=new z,_e=ve.createGain();_e.gain.value=I?0:R,ve.createMediaElementSource(y.current).connect(_e).connect(ve.destination),O.current=ve,_.current=_e,ve.resume();}catch{}}let A=J?"fade-in 0.2s ease-out both":`mp-enter-${xe} 0.45s cubic-bezier(0.16, 1, 0.3, 1) both`,ae=J?"fade-in 0.2s ease-in reverse both":`mp-exit-${xe} 0.4s cubic-bezier(0.7, 0, 0.84, 0) both`,se=C>0?T/C*100:0;return K&&!ee&&!$?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("audio",{ref:y,preload:"metadata",crossOrigin:"anonymous"}),jsxRuntime.jsxs("div",{className:s("fixed z-100 cursor-pointer transition-all duration-300",lf[r]),style:{"--accent":u},onMouseEnter:()=>{de(true),W(true),l?.(true);},children:[jsxRuntime.jsx("div",{className:s("h-full w-full rounded-full",N?"bg-(--accent)":"bg-(--mp-dock-strip)"),style:N?{animation:"mp-progress-glow 2s ease-in-out infinite",boxShadow:"0 0 12px color-mix(in srgb, var(--accent) 50%, transparent)"}:void 0}),N&&jsxRuntime.jsx("div",{className:"absolute inset-0 rounded-full bg-(--accent)/30",style:{animation:"mp-pulse-ring 2s ease-out infinite"}})]})]}):!ee&&!$?jsxRuntime.jsx("audio",{ref:y,preload:"metadata",crossOrigin:"anonymous"}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("audio",{ref:y,preload:"metadata",crossOrigin:"anonymous"}),jsxRuntime.jsx("div",{className:s("fixed z-100",K?sf[r]:of[r],oe),style:{"--accent":u,...$?{animation:ae}:{animation:A}},onMouseEnter:()=>{K&&(G.current&&(clearTimeout(G.current),G.current=void 0),$&&ue(false),de(true));},onMouseLeave:()=>{K&&(de(false),Z());},children:jsxRuntime.jsxs("div",{className:s("w-[320px] overflow-hidden rounded-2xl border shadow-2xl backdrop-blur-xl",X,ne,K&&"rounded-none",r.endsWith("right")&&K&&"rounded-l-2xl",r.endsWith("left")&&K&&"rounded-r-2xl",h),children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("div",{className:"absolute inset-0 overflow-hidden",children:jsxRuntime.jsx("img",{src:P.cover||Ni,alt:"",className:"h-full w-full scale-110 object-cover opacity-30 blur-2xl",draggable:false})}),jsxRuntime.jsxs("div",{className:"relative flex items-center gap-3.5 p-4 pb-3",children:[jsxRuntime.jsxs("div",{className:"relative h-14 w-14 shrink-0",children:[jsxRuntime.jsxs("div",{className:"h-14 w-14 overflow-hidden rounded-full border-2 border-white/10 shadow-lg",style:N?{animation:"mp-vinyl-spin 4s linear infinite"}:void 0,children:[jsxRuntime.jsx("img",{src:P.cover||Ni,alt:P.album??P.title,className:"h-full w-full object-cover",draggable:false}),jsxRuntime.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:jsxRuntime.jsx("div",{className:"h-3 w-3 rounded-full bg-black/60 ring-1 ring-white/10"})})]}),N&&jsxRuntime.jsx("div",{className:"absolute inset-0 rounded-full bg-(--accent)/20",style:{animation:"mp-pulse-ring 2.5s ease-out infinite"}})]}),jsxRuntime.jsxs("div",{className:"min-w-0 flex-1",children:[jsxRuntime.jsx("div",{className:s("truncate text-sm font-semibold",fe),children:P.title}),P.artist&&jsxRuntime.jsx("div",{className:s("truncate text-xs",we),children:P.artist}),P.album&&jsxRuntime.jsx("div",{className:s("mt-0.5 truncate text-[10px] tracking-wide",we,"opacity-60"),children:P.album})]}),jsxRuntime.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[jsxRuntime.jsx("button",{className:s("rounded-full p-1.5 transition-all duration-200",v.has(g)?"text-rose-500 hover:text-rose-400":s(we,"hover:text-rose-500")),onClick:He,title:"Like",children:jsxRuntime.jsx(lucideReact.Heart,{className:"h-4 w-4",fill:v.has(g)?"currentColor":"none"})}),jsxRuntime.jsx("button",{className:s("rounded-full p-1.5 transition-colors",we,"hover:"+fe.split(" ")[0]),onClick:()=>q(z=>!z),title:"Playlist",children:jsxRuntime.jsx(lucideReact.ListMusic,{className:"h-4 w-4"})}),!K&&jsxRuntime.jsx("button",{className:s("rounded-full p-1.5 transition-colors",we,"hover:"+fe.split(" ")[0]),onClick:Z,title:"Dismiss",children:jsxRuntime.jsx(lucideReact.X,{className:"h-3.5 w-3.5"})})]})]})]}),jsxRuntime.jsxs("div",{className:"px-4",children:[jsxRuntime.jsxs("div",{ref:L,className:"group relative h-1.5 cursor-pointer rounded-full bg-(--mp-surface)",onClick:Fe,children:[jsxRuntime.jsx("div",{className:"h-full rounded-full bg-(--accent) transition-[width] duration-150",style:{width:`${se}%`}}),jsxRuntime.jsx("div",{className:"absolute top-1/2 h-3 w-3 -translate-y-1/2 rounded-full bg-(--accent) opacity-0 shadow-md transition-opacity group-hover:opacity-100",style:{left:`calc(${se}% - 6px)`}})]}),jsxRuntime.jsxs("div",{className:s("mt-1 flex justify-between text-[10px] font-mono",we),children:[jsxRuntime.jsx("span",{children:Cl(T)}),jsxRuntime.jsx("span",{children:Cl(C)})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 px-4 pb-3 pt-1",children:[jsxRuntime.jsx("button",{className:s("rounded-full p-1.5 transition-colors",re?H:we,"hover:text-(--mp-text)"),onClick:()=>B(z=>!z),title:re?"Shuffle On":"Shuffle Off",children:jsxRuntime.jsx(lucideReact.Shuffle,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("button",{className:s("rounded-full p-1.5 transition-colors",j?H:we,"hover:text-(--mp-text)"),onClick:()=>pe(z=>!z),title:j?"Loop On":"Loop Off",children:jsxRuntime.jsx(lucideReact.Repeat1,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("button",{className:s("rounded-full p-2 transition-colors",we,"hover:text-(--mp-text)"),onClick:ke,title:"Previous",children:jsxRuntime.jsx(lucideReact.SkipBack,{className:"h-4 w-4",fill:"currentColor"})}),jsxRuntime.jsx("button",{className:s("flex h-10 w-10 items-center justify-center rounded-full transition-all duration-200","bg-(--accent) text-white shadow-lg active:scale-95"),style:{boxShadow:"0 6px 20px color-mix(in srgb, var(--accent) 35%, transparent)"},onClick:()=>{Ne(),x(z=>!z);},title:N?"Pause":"Play",children:N?jsxRuntime.jsx(lucideReact.Pause,{className:"h-4.5 w-4.5",fill:"currentColor"}):jsxRuntime.jsx(lucideReact.Play,{className:"h-4.5 w-4.5 translate-x-px",fill:"currentColor"})}),jsxRuntime.jsx("button",{className:s("rounded-full p-2 transition-colors",we,"hover:text-(--mp-text)"),onClick:Q,title:"Next",children:jsxRuntime.jsx(lucideReact.SkipForward,{className:"h-4 w-4",fill:"currentColor"})}),jsxRuntime.jsxs("div",{className:"ml-2 flex items-center gap-1.5",children:[jsxRuntime.jsx("button",{className:s("rounded-full p-1 transition-colors",we,"hover:text-(--mp-text)"),onClick:()=>{Ne();let z=!I;E(z),_.current&&(_.current.gain.value=z?0:R);},title:I?"Unmute":"Mute",children:I||R===0?jsxRuntime.jsx(lucideReact.VolumeX,{className:"h-3.5 w-3.5"}):jsxRuntime.jsx(lucideReact.Volume2,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("input",{type:"range",min:0,max:1,step:.01,value:I?0:R,onChange:z=>{Ne();let ve=Number(z.target.value);V(ve),I&&E(false),_.current&&(_.current.gain.value=ve);},className:"mp-volume-slider h-1 w-14 cursor-pointer appearance-none rounded-full bg-(--mp-surface) accent-(--accent)"})]})]}),jsxRuntime.jsx("div",{className:s("overflow-hidden transition-all duration-300 ease-in-out",k?"max-h-60":"max-h-0"),children:jsxRuntime.jsx("div",{className:s("border-t px-2 py-2",ne),children:jsxRuntime.jsx("div",{className:"max-h-52 space-y-0.5 overflow-y-auto",children:e.map((z,ve)=>{let _e=ve===g;return jsxRuntime.jsxs("button",{className:s("flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left transition-all duration-200",_e?"bg-(--accent)/10 dark:bg-(--accent)/15":"hover:bg-(--mp-surface-hover)"),onClick:()=>{Y(ve),x(true);},children:[jsxRuntime.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center",children:_e&&N?jsxRuntime.jsx("div",{className:"flex items-end gap-0.5",children:[1,2,3].map(mt=>jsxRuntime.jsx("div",{className:"w-0.75 rounded-full bg-(--accent)",style:{height:`${8+mt*4}px`,animation:`mp-eq-bar ${.4+mt*.15}s ease-in-out infinite alternate`}},mt))}):_e?jsxRuntime.jsx(lucideReact.Disc3,{className:s("h-4 w-4",H)}):jsxRuntime.jsx("span",{className:s("text-xs font-mono",we),children:ve+1})}),jsxRuntime.jsx("div",{className:"h-8 w-8 shrink-0 overflow-hidden rounded",children:jsxRuntime.jsx("img",{src:z.cover||Ni,alt:"",className:"h-full w-full object-cover",draggable:false})}),jsxRuntime.jsxs("div",{className:"min-w-0 flex-1",children:[jsxRuntime.jsx("div",{className:s("truncate text-xs font-medium",_e?H:fe),children:z.title}),z.artist&&jsxRuntime.jsx("div",{className:s("truncate text-[10px]",we),children:z.artist})]}),v.has(ve)&&jsxRuntime.jsx(lucideReact.Heart,{className:"h-3 w-3 shrink-0 text-rose-500",fill:"currentColor"})]},ve)})})})})]})})]})}function Ta(e){if(!isFinite(e)||e<0)return "0:00";let t=Math.floor(e/3600),r=Math.floor(e%3600/60),n=Math.floor(e%60);return t>0?`${t}:${r.toString().padStart(2,"0")}:${n.toString().padStart(2,"0")}`:`${r}:${n.toString().padStart(2,"0")}`}var Cf={title:(e,t)=>e.title.localeCompare(t.title),type:(e,t)=>(e.type??"").localeCompare(t.type??""),duration:(e,t)=>(e.duration??0)-(t.duration??0)};function Mi({playlist:e,initialTrack:t=0,autoPlay:r=false,shuffle:n=false,loop:a=false,onTrackChange:i,onPlayChange:o,accent:l="#8b5cf6",className:c}){let[m,d]=qr.useState(t),[f,p]=qr.useState(false),[u,h]=qr.useState(0),[g,b]=qr.useState(0),[N,x]=qr.useState(0),[T,w]=qr.useState(.8),[C,S]=qr.useState(false),[R,V]=qr.useState(n),[I,E]=qr.useState(a),[v,U]=qr.useState(false),[k,q]=qr.useState("title"),[M,W]=qr.useState(true),[$,ue]=qr.useState(false),[J,de]=qr.useState(false),[re,B]=qr.useState(false),[j,pe]=qr.useState(true),[ye,y]=qr.useState(false),[L,G]=qr.useState(null),O=qr.useRef(null),_=qr.useRef(null),ee=qr.useRef(void 0),xe=qr.useRef(false),P=e[m],F=qr__default.default.useMemo(()=>{let A=e.map((ae,se)=>({media:ae,originalIndex:se}));return A.sort((ae,se)=>{let z=Cf[k](ae.media,se.media);return M?z:-z}),A},[e,k,M]);qr.useEffect(()=>{let A=O.current;if(!A)return;y(true),A.src=P.src,P.poster&&(A.poster=P.poster),A.load();let ae=()=>{y(false),f&&A.play().catch(()=>{});};return A.addEventListener("loadeddata",ae,{once:true}),()=>A.removeEventListener("loadeddata",ae)},[m,P.src]),qr.useEffect(()=>{if(!r||xe.current)return;let A=O.current;if(!A)return;let ae=()=>{xe.current=true,p(true),A.play().catch(()=>{});};return A.addEventListener("canplaythrough",ae,{once:true}),()=>A.removeEventListener("canplaythrough",ae)},[r]),qr.useEffect(()=>{let A=O.current;A&&(f?A.play().catch(()=>{}):A.pause(),o?.(f));},[f]),qr.useEffect(()=>{let A=O.current;A&&(A.volume=C?0:T);},[T,C]),qr.useEffect(()=>{let A=O.current;if(!A)return;let ae=()=>h(A.currentTime),se=()=>b(A.duration),z=()=>{A.buffered.length>0&&x(A.buffered.end(A.buffered.length-1));},ve=()=>{I?(A.currentTime=0,A.play().catch(()=>{})):X();};return A.addEventListener("timeupdate",ae),A.addEventListener("loadedmetadata",se),A.addEventListener("progress",z),A.addEventListener("ended",ve),()=>{A.removeEventListener("timeupdate",ae),A.removeEventListener("loadedmetadata",se),A.removeEventListener("progress",z),A.removeEventListener("ended",ve);}},[m,e.length,I]);let K=qr.useCallback(()=>{pe(true),ee.current&&clearTimeout(ee.current),ee.current=setTimeout(()=>{f&&pe(false);},3e3);},[f]);qr.useEffect(()=>{f?K():(pe(true),ee.current&&clearTimeout(ee.current));},[f,K]),qr.useEffect(()=>()=>{ee.current&&clearTimeout(ee.current);},[]);let oe=qr.useCallback(A=>{let ae=(A%e.length+e.length)%e.length;d(ae),h(0),p(true),i?.(ae,e[ae]);},[e,i]),X=qr.useCallback(()=>{if(R){let A;do A=Math.floor(Math.random()*e.length);while(A===m&&e.length>1);oe(A);}else oe(m+1);},[oe,m,R,e.length]),fe=qr.useCallback(()=>{if(R){let A;do A=Math.floor(Math.random()*e.length);while(A===m&&e.length>1);oe(A);}else oe(m-1);},[oe,m,R,e.length]),we=qr.useCallback(A=>{let ae=A.currentTarget.getBoundingClientRect(),z=Math.max(0,Math.min(1,(A.clientX-ae.left)/ae.width))*g;O.current&&(O.current.currentTime=z),h(z);},[g]),H=qr.useCallback(A=>{let ae=A.currentTarget.getBoundingClientRect(),se=Math.max(0,Math.min(1,(A.clientX-ae.left)/ae.width));G(se*g);},[g]),ne=qr.useCallback(()=>{_.current&&(document.fullscreenElement?document.exitFullscreen():_.current.requestFullscreen());},[]);qr.useEffect(()=>{let A=()=>B(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",A),()=>document.removeEventListener("fullscreenchange",A)},[]);let Y=qr.useCallback(()=>{$?(de(true),setTimeout(()=>{ue(false),de(false);},500)):ue(true);},[$]),Q=qr.useCallback(()=>{U(A=>!A);},[]),ke=qr.useCallback(()=>{let A=["title","type","duration"],ae=A.indexOf(k);M?W(false):(W(true),q(A[(ae+1)%A.length]));},[k,M]);qr.useEffect(()=>{let A=ae=>{if(!(ae.target instanceof HTMLInputElement||ae.target instanceof HTMLTextAreaElement))switch(ae.key){case " ":case "k":ae.preventDefault(),p(se=>!se);break;case "f":ae.preventDefault(),ne();break;case "t":ae.preventDefault(),Y();break;case "ArrowLeft":ae.preventDefault(),O.current&&(O.current.currentTime=Math.max(0,u-5));break;case "ArrowRight":ae.preventDefault(),O.current&&(O.current.currentTime=Math.min(g,u+5));break;case "ArrowUp":ae.preventDefault(),w(se=>Math.min(1,se+.05));break;case "ArrowDown":ae.preventDefault(),w(se=>Math.max(0,se-.05));break;case "Escape":$&&Y();break;case "n":ae.preventDefault(),X();break;case "p":ae.preventDefault(),fe();break;case "l":ae.preventDefault(),Q();break}};return window.addEventListener("keydown",A),()=>window.removeEventListener("keydown",A)},[ne,Y,Q,X,fe,u,g,$]);let He=g>0?u/g*100:0,Fe=g>0?N/g*100:0,Z="text-(--accent)",Ne=jsxRuntime.jsxs("div",{ref:_,className:s("group flex overflow-hidden",re?"h-full w-full":"aspect-video w-full",!re&&"rounded-xl",!re&&f&&"shadow-2xl",!re&&!f&&"animate-[cp-glow-pulse_4s_ease-in-out_infinite] will-change-[box-shadow]",c),style:{"--accent":l,background:"var(--cp-bg)"},tabIndex:0,children:[jsxRuntime.jsxs("div",{className:s("relative flex-1 min-w-0 h-full overflow-hidden",ye&&"animate-[cp-track-transition_0.6s_ease-out]"),onMouseMove:K,onMouseLeave:()=>{f&&pe(false);},children:[jsxRuntime.jsx("video",{ref:O,className:"h-full w-full object-contain",poster:P.poster,playsInline:true,preload:"metadata",onClick:()=>p(A=>!A)}),!f&&!ye&&jsxRuntime.jsx("div",{className:"absolute inset-0 flex cursor-pointer items-center justify-center",style:{background:"var(--cp-overlay)"},onClick:()=>p(true),children:jsxRuntime.jsx("div",{className:"flex h-20 w-20 items-center justify-center rounded-full backdrop-blur-md transition-transform hover:scale-110 active:scale-95",style:{background:"var(--cp-surface-hover)"},children:jsxRuntime.jsx(lucideReact.Play,{className:"h-10 w-10 translate-x-0.5",fill:"currentColor",style:{color:"var(--cp-text-strong)"}})})}),ye&&!j&&jsxRuntime.jsx("div",{className:"absolute left-6 top-6 z-20 animate-[fade-in_0.4s_ease-out]",children:jsxRuntime.jsxs("div",{className:"rounded-lg px-4 py-2 backdrop-blur-md",style:{background:"var(--cp-panel-bg)"},children:[jsxRuntime.jsx("div",{className:"text-sm font-semibold",style:{color:"var(--cp-text-strong)"},children:P.title}),P.subtitle&&jsxRuntime.jsx("div",{className:"text-xs",style:{color:"var(--cp-text-muted)"},children:P.subtitle})]})}),jsxRuntime.jsx("div",{className:s("absolute inset-x-0 top-0 z-10 bg-linear-to-b from-black/70 to-transparent px-5 pb-8 pt-4 transition-opacity duration-500",j?"opacity-100":"pointer-events-none opacity-0"),children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold drop-shadow-md",style:{color:"var(--cp-text-strong)"},children:P.title}),P.subtitle&&jsxRuntime.jsx("p",{className:"text-xs",style:{color:"var(--cp-text-muted)"},children:P.subtitle})]}),P.type&&jsxRuntime.jsx("span",{className:"rounded-full bg-(--accent)/70 px-2.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider backdrop-blur-sm",style:{color:"var(--cp-text-strong)"},children:P.type})]})}),jsxRuntime.jsxs("div",{className:s("absolute inset-x-0 bottom-0 z-10 bg-linear-to-t from-black/80 via-black/40 to-transparent px-4 pb-3 pt-10 transition-all duration-500",j?"translate-y-0 opacity-100":"pointer-events-none translate-y-2 opacity-0"),children:[jsxRuntime.jsxs("div",{className:"group/seek relative mb-3 h-1 cursor-pointer rounded-full transition-[height] duration-200 hover:h-1.5",style:{background:"var(--cp-seek-track)"},onClick:we,onMouseMove:H,onMouseLeave:()=>G(null),children:[jsxRuntime.jsx("div",{className:"absolute inset-y-0 left-0 rounded-full",style:{width:`${Fe}%`,background:"var(--cp-seek-buffer)"}}),jsxRuntime.jsx("div",{className:"absolute inset-y-0 left-0 rounded-full bg-(--accent) transition-[width] duration-100",style:{width:`${He}%`}}),L!==null&&jsxRuntime.jsx("div",{className:"absolute -top-8 -translate-x-1/2 rounded px-2 py-0.5 text-[10px] font-mono",style:{left:`${L/g*100}%`,background:"var(--cp-panel-bg)",color:"var(--cp-text-strong)"},children:Ta(L)}),jsxRuntime.jsx("div",{className:"absolute top-1/2 h-3.5 w-3.5 -translate-y-1/2 rounded-full border-2 border-(--accent) bg-white opacity-0 shadow-lg transition-opacity group-hover/seek:opacity-100",style:{left:`calc(${He}% - 7px)`}})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{className:"cp-btn",onClick:()=>p(A=>!A),title:f?"Pause (k)":"Play (k)",children:f?jsxRuntime.jsx(lucideReact.Pause,{className:"h-5 w-5",fill:"currentColor"}):jsxRuntime.jsx(lucideReact.Play,{className:"h-5 w-5 translate-x-px",fill:"currentColor"})}),jsxRuntime.jsx("button",{className:"cp-btn",onClick:fe,title:"Previous (p)",children:jsxRuntime.jsx(lucideReact.SkipBack,{className:"h-4 w-4",fill:"currentColor"})}),jsxRuntime.jsx("button",{className:"cp-btn",onClick:X,title:"Next (n)",children:jsxRuntime.jsx(lucideReact.SkipForward,{className:"h-4 w-4",fill:"currentColor"})}),jsxRuntime.jsxs("div",{className:"group/vol ml-1 flex items-center",children:[jsxRuntime.jsx("button",{className:"cp-btn",onClick:()=>S(A=>!A),title:C?"Unmute":"Mute",children:C||T===0?jsxRuntime.jsx(lucideReact.VolumeX,{className:"h-4 w-4"}):jsxRuntime.jsx(lucideReact.Volume2,{className:"h-4 w-4"})}),jsxRuntime.jsx("div",{className:"flex w-0 items-center overflow-hidden transition-all duration-300 group-hover/vol:w-20",children:jsxRuntime.jsx("input",{type:"range",min:0,max:1,step:.01,value:C?0:T,onChange:A=>{w(Number(A.target.value)),C&&S(false);},className:"h-1 w-full cursor-pointer appearance-none rounded-full accent-(--accent)",style:{background:"var(--cp-seek-track)"}})})]}),jsxRuntime.jsxs("span",{className:"ml-2 min-w-0 shrink-0 font-mono text-xs",style:{color:"var(--cp-text-muted)"},children:[Ta(u)," / ",Ta(g)]}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{className:s("cp-btn",R&&Z),onClick:()=>V(A=>!A),title:"Shuffle",children:jsxRuntime.jsx(lucideReact.Shuffle,{className:"h-4 w-4"})}),jsxRuntime.jsx("button",{className:s("cp-btn",I&&Z),onClick:()=>E(A=>!A),title:"Loop",children:jsxRuntime.jsx(lucideReact.Repeat1,{className:"h-4 w-4"})}),jsxRuntime.jsx("button",{className:s("cp-btn",v&&Z),onClick:Q,title:"Playlist",children:jsxRuntime.jsx(lucideReact.ListVideo,{className:"h-4 w-4"})}),jsxRuntime.jsx("button",{className:s("cp-btn",$&&Z),onClick:Y,title:"Cinema mode (t)",children:jsxRuntime.jsx(lucideReact.Theater,{className:"h-4 w-4"})}),jsxRuntime.jsx("button",{className:"cp-btn",onClick:ne,title:"Fullscreen (f)",children:re?jsxRuntime.jsx(lucideReact.Minimize,{className:"h-4 w-4"}):jsxRuntime.jsx(lucideReact.Maximize,{className:"h-4 w-4"})})]})]})]}),jsxRuntime.jsx("div",{className:s("h-full shrink-0 overflow-hidden transition-[width] duration-300 ease-out",v?"w-72":"w-0"),children:jsxRuntime.jsxs("div",{className:"flex h-full w-72 flex-col backdrop-blur-xl",style:{borderLeft:"1px solid var(--cp-border)",background:"var(--cp-panel-bg)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{borderBottom:"1px solid var(--cp-border)"},children:[jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--cp-text)"},children:"Playlist"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("button",{className:"flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium transition-colors",style:{color:"var(--cp-text-muted)"},onClick:ke,title:`Sort: ${k} ${M?"\u2191":"\u2193"}`,children:[jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"h-3 w-3"}),k,M?" \u2191":" \u2193"]}),jsxRuntime.jsx("button",{className:"cp-btn p-1!",onClick:Q,title:"Close",children:jsxRuntime.jsx(lucideReact.X,{className:"h-3.5 w-3.5"})})]})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto",children:F.map(({media:A,originalIndex:ae})=>{let se=ae===m;return jsxRuntime.jsxs("button",{className:s("flex w-full items-center gap-3 px-4 py-2.5 text-left transition-all duration-200",se?"bg-(--accent)/20 text-(--accent)":"hover:text-(--cp-text-strong)"),style:se?void 0:{color:"var(--cp-text)"},onClick:()=>{oe(ae);},children:[jsxRuntime.jsxs("div",{className:"relative h-10 w-16 shrink-0 overflow-hidden rounded",style:{background:"var(--cp-surface)"},children:[A.poster?jsxRuntime.jsx("img",{src:A.poster,alt:"",className:"h-full w-full object-cover",draggable:false}):jsxRuntime.jsx("div",{className:"flex h-full w-full items-center justify-center",children:jsxRuntime.jsx(lucideReact.Play,{className:"h-4 w-4",style:{color:"var(--cp-seek-track)"}})}),se&&f&&jsxRuntime.jsx("div",{className:"absolute inset-0 flex items-center justify-center",style:{background:"var(--cp-overlay)"},children:jsxRuntime.jsx("div",{className:"flex items-end gap-px",children:[1,2,3,4].map(z=>jsxRuntime.jsx("div",{className:"w-0.5 rounded-full bg-(--accent)",style:{height:`${6+z*3}px`,animation:`mp-eq-bar ${.3+z*.12}s ease-in-out infinite alternate`}},z))})})]}),jsxRuntime.jsxs("div",{className:"min-w-0 flex-1",children:[jsxRuntime.jsx("div",{className:"truncate text-xs font-medium",children:A.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[A.type&&jsxRuntime.jsx("span",{className:"text-[10px] uppercase tracking-wide opacity-50",children:A.type}),A.duration!=null&&jsxRuntime.jsx("span",{className:"font-mono text-[10px] opacity-40",children:Ta(A.duration)})]})]}),se&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"h-3.5 w-3.5 shrink-0 text-(--accent)"})]},ae)})})]})}),jsxRuntime.jsx("style",{children:`
7
+ </svg>`);function Id(e){if(!isFinite(e)||e<0)return "0:00";let t=Math.floor(e/60),r=Math.floor(e%60);return `${t}:${r.toString().padStart(2,"0")}`}function Pb(e){return e.startsWith("bottom")?"bottom":e.startsWith("top")?"top":"right"}var Rb={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"},Eb={"bottom-right":"bottom-4 right-0","bottom-left":"bottom-4 left-0","top-right":"top-4 right-0","top-left":"top-4 left-0"},Lb={"bottom-right":"bottom-8 right-0 w-1.5 h-16 rounded-l-full","bottom-left":"bottom-8 left-0 w-1.5 h-16 rounded-r-full","top-right":"top-8 right-0 w-1.5 h-16 rounded-l-full","top-left":"top-8 left-0 w-1.5 h-16 rounded-r-full"};function Ws({playlist:e,initialTrack:t=0,position:r="bottom-right",entrance:n,theme:o,docked:a=false,visible:i,onVisibleChange:s,onTrackChange:l,onLike:c,autoPlay:u=true,shuffle:p=false,loop:m=false,accent:d="#8b5cf6",className:g}){let [h,b]=On.useState(t),[y,v]=On.useState(false),[N,x]=On.useState(0),[w,L]=On.useState(0),[P,A]=On.useState(.8),[D,S]=On.useState(false),[C,I]=On.useState(new Set),[k,T]=On.useState(false),[R,O]=On.useState(i??!a),[E,ne]=On.useState(false),[U,z]=On.useState(false),[H,_]=On.useState(p),[V,oe]=On.useState(m),be=On.useRef(false),M=On.useRef(null),F=On.useRef(null),re=On.useRef(void 0),W=On.useRef(null),G=On.useRef(null),le=i??R,ke=n??Pb(r),B=e[h],Z=a,ue=o==="dark"?"dark":o==="light"?"light":"",te="bg-(--mp-bg)",ve="text-(--mp-text)",Ne="text-(--mp-text-muted)",X="text-(--accent)",de="border-(--mp-border)";On.useEffect(()=>{let J=M.current;J&&(J.src=B.src,J.load(),y&&J.play().catch(()=>{}));},[h,B.src]),On.useEffect(()=>{if(!u||be.current)return;let J=M.current;if(!J)return;let Ce=()=>{be.current=true,v(true),J.play().catch(()=>{});};return J.addEventListener("canplaythrough",Ce,{once:true}),()=>J.removeEventListener("canplaythrough",Ce)},[u]),On.useEffect(()=>{let J=M.current;J&&(y?J.play().catch(()=>{}):J.pause());},[y]),On.useEffect(()=>{let J=M.current;J&&(J.muted=D,G.current?G.current.gain.value=D?0:P:J.volume=P);},[P,D]),On.useEffect(()=>{let J=M.current;if(!J)return;let Ce=()=>x(J.currentTime),Ye=()=>L(J.duration),vt=()=>{V?(J.currentTime=0,J.play().catch(()=>{})):ie();};return J.addEventListener("timeupdate",Ce),J.addEventListener("loadedmetadata",Ye),J.addEventListener("ended",vt),()=>{J.removeEventListener("timeupdate",Ce),J.removeEventListener("loadedmetadata",Ye),J.removeEventListener("ended",vt);}},[h,e.length]);let Q=On.useCallback(J=>{let Ce=(J%e.length+e.length)%e.length;b(Ce),x(0),l?.(Ce,e[Ce]),le||(O(true),s?.(true));},[e,le,l,s]),ie=On.useCallback(()=>{if(H){let J;do J=Math.floor(Math.random()*e.length);while(J===h&&e.length>1);Q(J);}else Q(h+1);},[Q,h,H,e.length]),Pe=On.useCallback(()=>{if(H){let J;do J=Math.floor(Math.random()*e.length);while(J===h&&e.length>1);Q(J);}else Q(h-1);},[Q,h,H,e.length]),Oe=On.useCallback(()=>{let J=C.has(h);I(Ce=>{let Ye=new Set(Ce);return J?Ye.delete(h):Ye.add(h),Ye}),c?.(h,B,!J);},[h,C,c,B]),Xe=On.useCallback(J=>{let Ce=J.currentTarget.getBoundingClientRect(),vt=Math.max(0,Math.min(1,(J.clientX-Ce.left)/Ce.width))*w;M.current&&(M.current.currentTime=vt),x(vt);},[w]),se=On.useCallback(()=>{ne(true);let J=Z?200:400;re.current=setTimeout(()=>{ne(false),O(false),s?.(false);},J);},[Z,s]);On.useEffect(()=>()=>{re.current&&clearTimeout(re.current);},[]),On.useEffect(()=>()=>{W.current?.close();},[]);function Re(){if(W.current||!M.current){W.current?.resume();return}try{let J=window.AudioContext??window.webkitAudioContext;if(!J)return;let Ce=new J,Ye=Ce.createGain();Ye.gain.value=D?0:P,Ce.createMediaElementSource(M.current).connect(Ye).connect(Ce.destination),W.current=Ce,G.current=Ye,Ce.resume();}catch{}}let K=U?"fade-in 0.2s ease-out both":`mp-enter-${ke} 0.45s cubic-bezier(0.16, 1, 0.3, 1) both`,ce=U?"fade-in 0.2s ease-in reverse both":`mp-exit-${ke} 0.4s cubic-bezier(0.7, 0, 0.84, 0) both`,me=w>0?N/w*100:0;return Z&&!le&&!E?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("audio",{ref:M,preload:"metadata",crossOrigin:"anonymous"}),jsxRuntime.jsxs("div",{className:f("fixed z-100 cursor-pointer transition-all duration-300",Lb[r]),style:{"--accent":d},onMouseEnter:()=>{z(true),O(true),s?.(true);},children:[jsxRuntime.jsx("div",{className:f("h-full w-full rounded-full",y?"bg-(--accent)":"bg-(--mp-dock-strip)"),style:y?{animation:"mp-progress-glow 2s ease-in-out infinite",boxShadow:"0 0 12px color-mix(in srgb, var(--accent) 50%, transparent)"}:void 0}),y&&jsxRuntime.jsx("div",{className:"absolute inset-0 rounded-full bg-(--accent)/30",style:{animation:"mp-pulse-ring 2s ease-out infinite"}})]})]}):!le&&!E?jsxRuntime.jsx("audio",{ref:M,preload:"metadata",crossOrigin:"anonymous"}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("audio",{ref:M,preload:"metadata",crossOrigin:"anonymous"}),jsxRuntime.jsx("div",{className:f("fixed z-100",Z?Eb[r]:Rb[r],ue),style:{"--accent":d,...E?{animation:ce}:{animation:K}},onMouseEnter:()=>{Z&&(re.current&&(clearTimeout(re.current),re.current=void 0),E&&ne(false),z(true));},onMouseLeave:()=>{Z&&(z(false),se());},children:jsxRuntime.jsxs("div",{className:f("w-[320px] overflow-hidden rounded-2xl border shadow-2xl backdrop-blur-xl",te,de,Z&&"rounded-none",r.endsWith("right")&&Z&&"rounded-l-2xl",r.endsWith("left")&&Z&&"rounded-r-2xl",g),children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("div",{className:"absolute inset-0 overflow-hidden",children:jsxRuntime.jsx("img",{src:B.cover||js,alt:"",className:"h-full w-full scale-110 object-cover opacity-30 blur-2xl",draggable:false})}),jsxRuntime.jsxs("div",{className:"relative flex items-center gap-3.5 p-4 pb-3",children:[jsxRuntime.jsxs("div",{className:"relative h-14 w-14 shrink-0",children:[jsxRuntime.jsxs("div",{className:"h-14 w-14 overflow-hidden rounded-full border-2 border-white/10 shadow-lg",style:y?{animation:"mp-vinyl-spin 4s linear infinite"}:void 0,children:[jsxRuntime.jsx("img",{src:B.cover||js,alt:B.album??B.title,className:"h-full w-full object-cover",draggable:false}),jsxRuntime.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:jsxRuntime.jsx("div",{className:"h-3 w-3 rounded-full bg-black/60 ring-1 ring-white/10"})})]}),y&&jsxRuntime.jsx("div",{className:"absolute inset-0 rounded-full bg-(--accent)/20",style:{animation:"mp-pulse-ring 2.5s ease-out infinite"}})]}),jsxRuntime.jsxs("div",{className:"min-w-0 flex-1",children:[jsxRuntime.jsx("div",{className:f("truncate text-sm font-semibold",ve),children:B.title}),B.artist&&jsxRuntime.jsx("div",{className:f("truncate text-xs",Ne),children:B.artist}),B.album&&jsxRuntime.jsx("div",{className:f("mt-0.5 truncate text-[10px] tracking-wide",Ne,"opacity-60"),children:B.album})]}),jsxRuntime.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[jsxRuntime.jsx("button",{className:f("rounded-full p-1.5 transition-all duration-200",C.has(h)?"text-rose-500 hover:text-rose-400":f(Ne,"hover:text-rose-500")),onClick:Oe,title:"Like",children:jsxRuntime.jsx(lucideReact.Heart,{className:"h-4 w-4",fill:C.has(h)?"currentColor":"none"})}),jsxRuntime.jsx("button",{className:f("rounded-full p-1.5 transition-colors",Ne,"hover:"+ve.split(" ")[0]),onClick:()=>T(J=>!J),title:"Playlist",children:jsxRuntime.jsx(lucideReact.ListMusic,{className:"h-4 w-4"})}),!Z&&jsxRuntime.jsx("button",{className:f("rounded-full p-1.5 transition-colors",Ne,"hover:"+ve.split(" ")[0]),onClick:se,title:"Dismiss",children:jsxRuntime.jsx(lucideReact.X,{className:"h-3.5 w-3.5"})})]})]})]}),jsxRuntime.jsxs("div",{className:"px-4",children:[jsxRuntime.jsxs("div",{ref:F,className:"group relative h-1.5 cursor-pointer rounded-full bg-(--mp-surface)",onClick:Xe,children:[jsxRuntime.jsx("div",{className:"h-full rounded-full bg-(--accent) transition-[width] duration-150",style:{width:`${me}%`}}),jsxRuntime.jsx("div",{className:"absolute top-1/2 h-3 w-3 -translate-y-1/2 rounded-full bg-(--accent) opacity-0 shadow-md transition-opacity group-hover:opacity-100",style:{left:`calc(${me}% - 6px)`}})]}),jsxRuntime.jsxs("div",{className:f("mt-1 flex justify-between text-[10px] font-mono",Ne),children:[jsxRuntime.jsx("span",{children:Id(N)}),jsxRuntime.jsx("span",{children:Id(w)})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 px-4 pb-3 pt-1",children:[jsxRuntime.jsx("button",{className:f("rounded-full p-1.5 transition-colors",H?X:Ne,"hover:text-(--mp-text)"),onClick:()=>_(J=>!J),title:H?"Shuffle On":"Shuffle Off",children:jsxRuntime.jsx(lucideReact.Shuffle,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("button",{className:f("rounded-full p-1.5 transition-colors",V?X:Ne,"hover:text-(--mp-text)"),onClick:()=>oe(J=>!J),title:V?"Loop On":"Loop Off",children:jsxRuntime.jsx(lucideReact.Repeat1,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("button",{className:f("rounded-full p-2 transition-colors",Ne,"hover:text-(--mp-text)"),onClick:Pe,title:"Previous",children:jsxRuntime.jsx(lucideReact.SkipBack,{className:"h-4 w-4",fill:"currentColor"})}),jsxRuntime.jsx("button",{className:f("flex h-10 w-10 items-center justify-center rounded-full transition-all duration-200","bg-(--accent) text-white shadow-lg active:scale-95"),style:{boxShadow:"0 6px 20px color-mix(in srgb, var(--accent) 35%, transparent)"},onClick:()=>{Re(),v(J=>!J);},title:y?"Pause":"Play",children:y?jsxRuntime.jsx(lucideReact.Pause,{className:"h-4.5 w-4.5",fill:"currentColor"}):jsxRuntime.jsx(lucideReact.Play,{className:"h-4.5 w-4.5 translate-x-px",fill:"currentColor"})}),jsxRuntime.jsx("button",{className:f("rounded-full p-2 transition-colors",Ne,"hover:text-(--mp-text)"),onClick:ie,title:"Next",children:jsxRuntime.jsx(lucideReact.SkipForward,{className:"h-4 w-4",fill:"currentColor"})}),jsxRuntime.jsxs("div",{className:"ml-2 flex items-center gap-1.5",children:[jsxRuntime.jsx("button",{className:f("rounded-full p-1 transition-colors",Ne,"hover:text-(--mp-text)"),onClick:()=>{Re();let J=!D;S(J),G.current&&(G.current.gain.value=J?0:P);},title:D?"Unmute":"Mute",children:D||P===0?jsxRuntime.jsx(lucideReact.VolumeX,{className:"h-3.5 w-3.5"}):jsxRuntime.jsx(lucideReact.Volume2,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("input",{type:"range",min:0,max:1,step:.01,value:D?0:P,onChange:J=>{Re();let Ce=Number(J.target.value);A(Ce),D&&S(false),G.current&&(G.current.gain.value=Ce);},className:"mp-volume-slider h-1 w-14 cursor-pointer appearance-none rounded-full bg-(--mp-surface) accent-(--accent)"})]})]}),jsxRuntime.jsx("div",{className:f("overflow-hidden transition-all duration-300 ease-in-out",k?"max-h-60":"max-h-0"),children:jsxRuntime.jsx("div",{className:f("border-t px-2 py-2",de),children:jsxRuntime.jsx("div",{className:"max-h-52 space-y-0.5 overflow-y-auto",children:e.map((J,Ce)=>{let Ye=Ce===h;return jsxRuntime.jsxs("button",{className:f("flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left transition-all duration-200",Ye?"bg-(--accent)/10 dark:bg-(--accent)/15":"hover:bg-(--mp-surface-hover)"),onClick:()=>{Q(Ce),v(true);},children:[jsxRuntime.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center",children:Ye&&y?jsxRuntime.jsx("div",{className:"flex items-end gap-0.5",children:[1,2,3].map(vt=>jsxRuntime.jsx("div",{className:"w-0.75 rounded-full bg-(--accent)",style:{height:`${8+vt*4}px`,animation:`mp-eq-bar ${.4+vt*.15}s ease-in-out infinite alternate`}},vt))}):Ye?jsxRuntime.jsx(lucideReact.Disc3,{className:f("h-4 w-4",X)}):jsxRuntime.jsx("span",{className:f("text-xs font-mono",Ne),children:Ce+1})}),jsxRuntime.jsx("div",{className:"h-8 w-8 shrink-0 overflow-hidden rounded",children:jsxRuntime.jsx("img",{src:J.cover||js,alt:"",className:"h-full w-full object-cover",draggable:false})}),jsxRuntime.jsxs("div",{className:"min-w-0 flex-1",children:[jsxRuntime.jsx("div",{className:f("truncate text-xs font-medium",Ye?X:ve),children:J.title}),J.artist&&jsxRuntime.jsx("div",{className:f("truncate text-[10px]",Ne),children:J.artist})]}),C.has(Ce)&&jsxRuntime.jsx(lucideReact.Heart,{className:"h-3 w-3 shrink-0 text-rose-500",fill:"currentColor"})]},Ce)})})})})]})})]})}function za(e){if(!isFinite(e)||e<0)return "0:00";let t=Math.floor(e/3600),r=Math.floor(e%3600/60),n=Math.floor(e%60);return t>0?`${t}:${r.toString().padStart(2,"0")}:${n.toString().padStart(2,"0")}`:`${r}:${n.toString().padStart(2,"0")}`}var Ub={title:(e,t)=>e.title.localeCompare(t.title),type:(e,t)=>(e.type??"").localeCompare(t.type??""),duration:(e,t)=>(e.duration??0)-(t.duration??0)};function Us({playlist:e,initialTrack:t=0,autoPlay:r=false,shuffle:n=false,loop:o=false,onTrackChange:a,onPlayChange:i,accent:s="#8b5cf6",className:l}){let[c,u]=On.useState(t),[p,m]=On.useState(false),[d,g]=On.useState(0),[h,b]=On.useState(0),[y,v]=On.useState(0),[N,x]=On.useState(.8),[w,L]=On.useState(false),[P,A]=On.useState(n),[D,S]=On.useState(o),[C,I]=On.useState(false),[k,T]=On.useState("title"),[R,O]=On.useState(true),[E,ne]=On.useState(false),[U,z]=On.useState(false),[H,_]=On.useState(false),[V,oe]=On.useState(true),[be,M]=On.useState(false),[F,re]=On.useState(null),W=On.useRef(null),G=On.useRef(null),le=On.useRef(void 0),ke=On.useRef(false),B=e[c],q=On__default.default.useMemo(()=>{let K=e.map((ce,me)=>({media:ce,originalIndex:me}));return K.sort((ce,me)=>{let J=Ub[k](ce.media,me.media);return R?J:-J}),K},[e,k,R]);On.useEffect(()=>{let K=W.current;if(!K)return;M(true),K.src=B.src,B.poster&&(K.poster=B.poster),K.load();let ce=()=>{M(false),p&&K.play().catch(()=>{});};return K.addEventListener("loadeddata",ce,{once:true}),()=>K.removeEventListener("loadeddata",ce)},[c,B.src]),On.useEffect(()=>{if(!r||ke.current)return;let K=W.current;if(!K)return;let ce=()=>{ke.current=true,m(true),K.play().catch(()=>{});};return K.addEventListener("canplaythrough",ce,{once:true}),()=>K.removeEventListener("canplaythrough",ce)},[r]),On.useEffect(()=>{let K=W.current;K&&(p?K.play().catch(()=>{}):K.pause(),i?.(p));},[p]),On.useEffect(()=>{let K=W.current;K&&(K.volume=w?0:N);},[N,w]),On.useEffect(()=>{let K=W.current;if(!K)return;let ce=()=>g(K.currentTime),me=()=>b(K.duration),J=()=>{K.buffered.length>0&&v(K.buffered.end(K.buffered.length-1));},Ce=()=>{D?(K.currentTime=0,K.play().catch(()=>{})):te();};return K.addEventListener("timeupdate",ce),K.addEventListener("loadedmetadata",me),K.addEventListener("progress",J),K.addEventListener("ended",Ce),()=>{K.removeEventListener("timeupdate",ce),K.removeEventListener("loadedmetadata",me),K.removeEventListener("progress",J),K.removeEventListener("ended",Ce);}},[c,e.length,D]);let Z=On.useCallback(()=>{oe(true),le.current&&clearTimeout(le.current),le.current=setTimeout(()=>{p&&oe(false);},3e3);},[p]);On.useEffect(()=>{p?Z():(oe(true),le.current&&clearTimeout(le.current));},[p,Z]),On.useEffect(()=>()=>{le.current&&clearTimeout(le.current);},[]);let ue=On.useCallback(K=>{let ce=(K%e.length+e.length)%e.length;u(ce),g(0),m(true),a?.(ce,e[ce]);},[e,a]),te=On.useCallback(()=>{if(P){let K;do K=Math.floor(Math.random()*e.length);while(K===c&&e.length>1);ue(K);}else ue(c+1);},[ue,c,P,e.length]),ve=On.useCallback(()=>{if(P){let K;do K=Math.floor(Math.random()*e.length);while(K===c&&e.length>1);ue(K);}else ue(c-1);},[ue,c,P,e.length]),Ne=On.useCallback(K=>{let ce=K.currentTarget.getBoundingClientRect(),J=Math.max(0,Math.min(1,(K.clientX-ce.left)/ce.width))*h;W.current&&(W.current.currentTime=J),g(J);},[h]),X=On.useCallback(K=>{let ce=K.currentTarget.getBoundingClientRect(),me=Math.max(0,Math.min(1,(K.clientX-ce.left)/ce.width));re(me*h);},[h]),de=On.useCallback(()=>{G.current&&(document.fullscreenElement?document.exitFullscreen():G.current.requestFullscreen());},[]);On.useEffect(()=>{let K=()=>_(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",K),()=>document.removeEventListener("fullscreenchange",K)},[]);let Q=On.useCallback(()=>{E?(z(true),setTimeout(()=>{ne(false),z(false);},500)):ne(true);},[E]),ie=On.useCallback(()=>{I(K=>!K);},[]),Pe=On.useCallback(()=>{let K=["title","type","duration"],ce=K.indexOf(k);R?O(false):(O(true),T(K[(ce+1)%K.length]));},[k,R]);On.useEffect(()=>{let K=ce=>{if(!(ce.target instanceof HTMLInputElement||ce.target instanceof HTMLTextAreaElement))switch(ce.key){case " ":case "k":ce.preventDefault(),m(me=>!me);break;case "f":ce.preventDefault(),de();break;case "t":ce.preventDefault(),Q();break;case "ArrowLeft":ce.preventDefault(),W.current&&(W.current.currentTime=Math.max(0,d-5));break;case "ArrowRight":ce.preventDefault(),W.current&&(W.current.currentTime=Math.min(h,d+5));break;case "ArrowUp":ce.preventDefault(),x(me=>Math.min(1,me+.05));break;case "ArrowDown":ce.preventDefault(),x(me=>Math.max(0,me-.05));break;case "Escape":E&&Q();break;case "n":ce.preventDefault(),te();break;case "p":ce.preventDefault(),ve();break;case "l":ce.preventDefault(),ie();break}};return window.addEventListener("keydown",K),()=>window.removeEventListener("keydown",K)},[de,Q,ie,te,ve,d,h,E]);let Oe=h>0?d/h*100:0,Xe=h>0?y/h*100:0,se="text-(--accent)",Re=jsxRuntime.jsxs("div",{ref:G,className:f("group flex overflow-hidden",H?"h-full w-full":"aspect-video w-full",!H&&"rounded-xl",!H&&p&&"shadow-2xl",!H&&!p&&"animate-[cp-glow-pulse_4s_ease-in-out_infinite] will-change-[box-shadow]",l),style:{"--accent":s,background:"var(--cp-bg)"},tabIndex:0,children:[jsxRuntime.jsxs("div",{className:f("relative flex-1 min-w-0 h-full overflow-hidden",be&&"animate-[cp-track-transition_0.6s_ease-out]"),onMouseMove:Z,onMouseLeave:()=>{p&&oe(false);},children:[jsxRuntime.jsx("video",{ref:W,className:"h-full w-full object-contain",poster:B.poster,playsInline:true,preload:"metadata",onClick:()=>m(K=>!K)}),!p&&!be&&jsxRuntime.jsx("div",{className:"absolute inset-0 flex cursor-pointer items-center justify-center",style:{background:"var(--cp-overlay)"},onClick:()=>m(true),children:jsxRuntime.jsx("div",{className:"flex h-20 w-20 items-center justify-center rounded-full backdrop-blur-md transition-transform hover:scale-110 active:scale-95",style:{background:"var(--cp-surface-hover)"},children:jsxRuntime.jsx(lucideReact.Play,{className:"h-10 w-10 translate-x-0.5",fill:"currentColor",style:{color:"var(--cp-text-strong)"}})})}),be&&!V&&jsxRuntime.jsx("div",{className:"absolute left-6 top-6 z-20 animate-[fade-in_0.4s_ease-out]",children:jsxRuntime.jsxs("div",{className:"rounded-lg px-4 py-2 backdrop-blur-md",style:{background:"var(--cp-panel-bg)"},children:[jsxRuntime.jsx("div",{className:"text-sm font-semibold",style:{color:"var(--cp-text-strong)"},children:B.title}),B.subtitle&&jsxRuntime.jsx("div",{className:"text-xs",style:{color:"var(--cp-text-muted)"},children:B.subtitle})]})}),jsxRuntime.jsx("div",{className:f("absolute inset-x-0 top-0 z-10 bg-linear-to-b from-black/70 to-transparent px-5 pb-8 pt-4 transition-opacity duration-500",V?"opacity-100":"pointer-events-none opacity-0"),children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold drop-shadow-md",style:{color:"var(--cp-text-strong)"},children:B.title}),B.subtitle&&jsxRuntime.jsx("p",{className:"text-xs",style:{color:"var(--cp-text-muted)"},children:B.subtitle})]}),B.type&&jsxRuntime.jsx("span",{className:"rounded-full bg-(--accent)/70 px-2.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider backdrop-blur-sm",style:{color:"var(--cp-text-strong)"},children:B.type})]})}),jsxRuntime.jsxs("div",{className:f("absolute inset-x-0 bottom-0 z-10 bg-linear-to-t from-black/80 via-black/40 to-transparent px-4 pb-3 pt-10 transition-all duration-500",V?"translate-y-0 opacity-100":"pointer-events-none translate-y-2 opacity-0"),children:[jsxRuntime.jsxs("div",{className:"group/seek relative mb-3 h-1 cursor-pointer rounded-full transition-[height] duration-200 hover:h-1.5",style:{background:"var(--cp-seek-track)"},onClick:Ne,onMouseMove:X,onMouseLeave:()=>re(null),children:[jsxRuntime.jsx("div",{className:"absolute inset-y-0 left-0 rounded-full",style:{width:`${Xe}%`,background:"var(--cp-seek-buffer)"}}),jsxRuntime.jsx("div",{className:"absolute inset-y-0 left-0 rounded-full bg-(--accent) transition-[width] duration-100",style:{width:`${Oe}%`}}),F!==null&&jsxRuntime.jsx("div",{className:"absolute -top-8 -translate-x-1/2 rounded px-2 py-0.5 text-[10px] font-mono",style:{left:`${F/h*100}%`,background:"var(--cp-panel-bg)",color:"var(--cp-text-strong)"},children:za(F)}),jsxRuntime.jsx("div",{className:"absolute top-1/2 h-3.5 w-3.5 -translate-y-1/2 rounded-full border-2 border-(--accent) bg-white opacity-0 shadow-lg transition-opacity group-hover/seek:opacity-100",style:{left:`calc(${Oe}% - 7px)`}})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{className:"cp-btn",onClick:()=>m(K=>!K),title:p?"Pause (k)":"Play (k)",children:p?jsxRuntime.jsx(lucideReact.Pause,{className:"h-5 w-5",fill:"currentColor"}):jsxRuntime.jsx(lucideReact.Play,{className:"h-5 w-5 translate-x-px",fill:"currentColor"})}),jsxRuntime.jsx("button",{className:"cp-btn",onClick:ve,title:"Previous (p)",children:jsxRuntime.jsx(lucideReact.SkipBack,{className:"h-4 w-4",fill:"currentColor"})}),jsxRuntime.jsx("button",{className:"cp-btn",onClick:te,title:"Next (n)",children:jsxRuntime.jsx(lucideReact.SkipForward,{className:"h-4 w-4",fill:"currentColor"})}),jsxRuntime.jsxs("div",{className:"group/vol ml-1 flex items-center",children:[jsxRuntime.jsx("button",{className:"cp-btn",onClick:()=>L(K=>!K),title:w?"Unmute":"Mute",children:w||N===0?jsxRuntime.jsx(lucideReact.VolumeX,{className:"h-4 w-4"}):jsxRuntime.jsx(lucideReact.Volume2,{className:"h-4 w-4"})}),jsxRuntime.jsx("div",{className:"flex w-0 items-center overflow-hidden transition-all duration-300 group-hover/vol:w-20",children:jsxRuntime.jsx("input",{type:"range",min:0,max:1,step:.01,value:w?0:N,onChange:K=>{x(Number(K.target.value)),w&&L(false);},className:"h-1 w-full cursor-pointer appearance-none rounded-full accent-(--accent)",style:{background:"var(--cp-seek-track)"}})})]}),jsxRuntime.jsxs("span",{className:"ml-2 min-w-0 shrink-0 font-mono text-xs",style:{color:"var(--cp-text-muted)"},children:[za(d)," / ",za(h)]}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{className:f("cp-btn",P&&se),onClick:()=>A(K=>!K),title:"Shuffle",children:jsxRuntime.jsx(lucideReact.Shuffle,{className:"h-4 w-4"})}),jsxRuntime.jsx("button",{className:f("cp-btn",D&&se),onClick:()=>S(K=>!K),title:"Loop",children:jsxRuntime.jsx(lucideReact.Repeat1,{className:"h-4 w-4"})}),jsxRuntime.jsx("button",{className:f("cp-btn",C&&se),onClick:ie,title:"Playlist",children:jsxRuntime.jsx(lucideReact.ListVideo,{className:"h-4 w-4"})}),jsxRuntime.jsx("button",{className:f("cp-btn",E&&se),onClick:Q,title:"Cinema mode (t)",children:jsxRuntime.jsx(lucideReact.Theater,{className:"h-4 w-4"})}),jsxRuntime.jsx("button",{className:"cp-btn",onClick:de,title:"Fullscreen (f)",children:H?jsxRuntime.jsx(lucideReact.Minimize,{className:"h-4 w-4"}):jsxRuntime.jsx(lucideReact.Maximize,{className:"h-4 w-4"})})]})]})]}),jsxRuntime.jsx("div",{className:f("h-full shrink-0 overflow-hidden transition-[width] duration-300 ease-out",C?"w-72":"w-0"),children:jsxRuntime.jsxs("div",{className:"flex h-full w-72 flex-col backdrop-blur-xl",style:{borderLeft:"1px solid var(--cp-border)",background:"var(--cp-panel-bg)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{borderBottom:"1px solid var(--cp-border)"},children:[jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--cp-text)"},children:"Playlist"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("button",{className:"flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium transition-colors",style:{color:"var(--cp-text-muted)"},onClick:Pe,title:`Sort: ${k} ${R?"\u2191":"\u2193"}`,children:[jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"h-3 w-3"}),k,R?" \u2191":" \u2193"]}),jsxRuntime.jsx("button",{className:"cp-btn p-1!",onClick:ie,title:"Close",children:jsxRuntime.jsx(lucideReact.X,{className:"h-3.5 w-3.5"})})]})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto",children:q.map(({media:K,originalIndex:ce})=>{let me=ce===c;return jsxRuntime.jsxs("button",{className:f("flex w-full items-center gap-3 px-4 py-2.5 text-left transition-all duration-200",me?"bg-(--accent)/20 text-(--accent)":"hover:text-(--cp-text-strong)"),style:me?void 0:{color:"var(--cp-text)"},onClick:()=>{ue(ce);},children:[jsxRuntime.jsxs("div",{className:"relative h-10 w-16 shrink-0 overflow-hidden rounded",style:{background:"var(--cp-surface)"},children:[K.poster?jsxRuntime.jsx("img",{src:K.poster,alt:"",className:"h-full w-full object-cover",draggable:false}):jsxRuntime.jsx("div",{className:"flex h-full w-full items-center justify-center",children:jsxRuntime.jsx(lucideReact.Play,{className:"h-4 w-4",style:{color:"var(--cp-seek-track)"}})}),me&&p&&jsxRuntime.jsx("div",{className:"absolute inset-0 flex items-center justify-center",style:{background:"var(--cp-overlay)"},children:jsxRuntime.jsx("div",{className:"flex items-end gap-px",children:[1,2,3,4].map(J=>jsxRuntime.jsx("div",{className:"w-0.5 rounded-full bg-(--accent)",style:{height:`${6+J*3}px`,animation:`mp-eq-bar ${.3+J*.12}s ease-in-out infinite alternate`}},J))})})]}),jsxRuntime.jsxs("div",{className:"min-w-0 flex-1",children:[jsxRuntime.jsx("div",{className:"truncate text-xs font-medium",children:K.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[K.type&&jsxRuntime.jsx("span",{className:"text-[10px] uppercase tracking-wide opacity-50",children:K.type}),K.duration!=null&&jsxRuntime.jsx("span",{className:"font-mono text-[10px] opacity-40",children:za(K.duration)})]})]}),me&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"h-3.5 w-3.5 shrink-0 text-(--accent)"})]},ce)})})]})}),jsxRuntime.jsx("style",{children:`
8
8
  .cp-btn {
9
9
  display: flex;
10
10
  align-items: center;
@@ -20,7 +20,7 @@
20
20
  0%, 100% { box-shadow: 0 0 20px color-mix(in srgb, var(--accent) 25%, transparent), 0 25px 50px -12px rgba(0,0,0,0.25); }
21
21
  50% { box-shadow: 0 0 40px color-mix(in srgb, var(--accent) 55%, transparent), 0 25px 50px -12px rgba(0,0,0,0.25); }
22
22
  }
23
- `})]});return jsxRuntime.jsx("div",{className:s($&&"fixed inset-0 z-100 flex items-center justify-center p-8",$&&(J?"animate-[cp-cinema-out_0.5s_ease-in_both]":"animate-[cp-cinema-in_0.5s_ease-out_both]")),onClick:$?A=>{A.target===A.currentTarget&&Y();}:void 0,children:jsxRuntime.jsx("div",{className:s($&&"w-full",$&&!re&&"max-w-5xl"),children:Ne})})}function Ma(e){let t=e.lastIndexOf(".");return t>0?e.slice(t).toLowerCase():""}function Dl(e){return e==null?"\u2014":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(2)} GB`}function Di(e){return e?(typeof e=="string"?new Date(e):e).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"\u2014"}var Ff={".png":lucideReact.Image,".jpg":lucideReact.Image,".jpeg":lucideReact.Image,".gif":lucideReact.Image,".svg":lucideReact.Image,".webp":lucideReact.Image,".ico":lucideReact.Image,".bmp":lucideReact.Image,".mp3":lucideReact.Music,".wav":lucideReact.Music,".flac":lucideReact.Music,".ogg":lucideReact.Music,".aac":lucideReact.Music,".m4a":lucideReact.Music,".mp4":lucideReact.Video,".mkv":lucideReact.Video,".avi":lucideReact.Video,".mov":lucideReact.Video,".wmv":lucideReact.Video,".webm":lucideReact.Video,".ts":lucideReact.FileCode,".tsx":lucideReact.FileCode,".js":lucideReact.FileCode,".jsx":lucideReact.FileCode,".json":lucideReact.FileCode,".html":lucideReact.FileCode,".css":lucideReact.FileCode,".scss":lucideReact.FileCode,".py":lucideReact.FileCode,".rs":lucideReact.FileCode,".go":lucideReact.FileCode,".java":lucideReact.FileCode,".c":lucideReact.FileCode,".cpp":lucideReact.FileCode,".h":lucideReact.FileCode,".sh":lucideReact.Terminal,".bat":lucideReact.Terminal,".ps1":lucideReact.Terminal,".md":lucideReact.FileText,".txt":lucideReact.FileText,".pdf":lucideReact.FileText,".doc":lucideReact.FileText,".docx":lucideReact.FileText,".rtf":lucideReact.FileText,".csv":lucideReact.FileSpreadsheet,".xls":lucideReact.FileSpreadsheet,".xlsx":lucideReact.FileSpreadsheet,".db":lucideReact.Database,".sqlite":lucideReact.Database,".sql":lucideReact.Database,".zip":lucideReact.FileArchive,".tar":lucideReact.FileArchive,".gz":lucideReact.FileArchive,".rar":lucideReact.FileArchive,".7z":lucideReact.FileArchive};function Li(e){if(e.type==="directory")return lucideReact.Folder;let t=e.extension||Ma(e.name);return Ff[t]||lucideReact.File}function Vr(e,t,r){return Math.max(t,Math.min(r,e))}function Ll(e){return e<480?"xs":e<640?"sm":e<1024?"md":"lg"}function El(e,t){if(e<480)return {size:{width:e-16,height:t-48},pos:{x:8,y:24}};if(e<640){let a=e-24,i=Math.min(t-64,540);return {size:{width:a,height:i},pos:{x:12,y:32}}}if(e<1024){let a=Math.min(640,e-32),i=Math.min(480,t-64);return {size:{width:a,height:i},pos:{x:Math.max(0,Math.round((e-a)/2)),y:Math.max(0,Math.round((t-i)/2))}}}let r=720,n=520;return {size:{width:r,height:n},pos:{x:Math.max(0,Math.round((e-r)/2)),y:Math.max(0,Math.round((t-n)/2))}}}function Ei({files:e,title:t="File Explorer",accent:r="#8b5cf6",defaultView:n="list",initialPosition:a,initialSize:i,dockable:o=false,dockSide:l="right",visible:c=true,onFileOpen:m,onSelectionChange:d,onNavigate:f,onDelete:p,onClose:u,onMinimize:h,onPathSubmit:g,defaultInputMode:b="search",actions:N,resizable:x=true,minSize:T={width:400,height:300},className:w}){let[C,S]=qr.useState(n),[R,V]=qr.useState(new Set),[I,E]=qr.useState(null),[v,U]=qr.useState(false),[k,q]=qr.useState(false),[M,W]=qr.useState(""),[$,ue]=qr.useState(b),[J,de]=qr.useState(c),[re,B]=qr.useState(false),[j,pe]=qr.useState({w:window.innerWidth,h:window.innerHeight}),ye=El(window.innerWidth,window.innerHeight),[y,L]=qr.useState(a??ye.pos),[G,O]=qr.useState(i??ye.size),[_,ee]=qr.useState(null),xe=qr.useRef(false),P=qr.useRef({x:0,y:0}),F=qr.useRef(null),K=qr.useRef(false),oe=qr.useRef({x:0,y:0,w:0,h:0,px:0,py:0}),X=qr.useRef(false),fe=qr.useRef(v);qr.useEffect(()=>{fe.current=v;},[v]);let we=c!==void 0?c:J,H=qr.useMemo(()=>{let D=e.filter(Me=>Me.type==="directory"),ce=e.filter(Me=>Me.type==="file");return D.sort((Me,Re)=>Me.name.localeCompare(Re.name)),ce.sort((Me,Re)=>Me.name.localeCompare(Re.name)),[...D,...ce]},[e]),ne=qr.useMemo(()=>{if($!=="search"||!M.trim())return H;let D=M.toLowerCase();return H.filter(ce=>ce.name.toLowerCase().includes(D))},[H,M,$]),Y=I!=null?ne[I]:null;qr.useEffect(()=>{let D=Ll(window.innerWidth),ce=()=>{let Me=window.innerWidth,Re=window.innerHeight;if(pe({w:Me,h:Re}),fe.current)return;let Ee=Ll(Me);if(Ee!==D&&!X.current&&!i){let at=El(Me,Re);O(at.size),L(at.pos);}D=Ee;};return window.addEventListener("resize",ce),()=>window.removeEventListener("resize",ce)},[i]);let Q=qr.useCallback((D,ce)=>{V(Me=>{let Re=new Set(Me);return ce.ctrlKey||ce.metaKey?Re.has(D)?Re.delete(D):Re.add(D):(Re.clear(),Re.add(D)),Re}),E(D);},[]);qr.useEffect(()=>{if(!d)return;let D=Array.from(R).map(ce=>ne[ce]).filter(Boolean);d(D);},[R]);let ke=qr.useCallback(D=>{let ce=ne[D];ce&&(ce.type==="directory"?f?.(ce.path):m?.(ce));},[ne,m,f]),He=qr.useCallback(D=>{v||D.target.closest("button")||(X.current=true,xe.current=true,P.current={x:D.clientX-y.x,y:D.clientY-y.y},D.preventDefault());},[y,v]),Fe=qr.useCallback(D=>{if(v||D.target.closest("button"))return;X.current=true;let ce=D.touches[0];xe.current=true,P.current={x:ce.clientX-y.x,y:ce.clientY-y.y};},[y,v]);qr.useEffect(()=>{let D=Re=>{if(!xe.current)return;let Ee=window.innerWidth-100,at=window.innerHeight-40;L({x:Vr(Re.clientX-P.current.x,0,Ee),y:Vr(Re.clientY-P.current.y,0,at)});},ce=Re=>{if(!xe.current)return;Re.preventDefault();let Ee=Re.touches[0],at=window.innerWidth-100,Ut=window.innerHeight-40;L({x:Vr(Ee.clientX-P.current.x,0,at),y:Vr(Ee.clientY-P.current.y,0,Ut)});},Me=()=>{xe.current=false,K.current=false,document.body.style.cursor="",document.body.style.userSelect="";};return window.addEventListener("mousemove",D),window.addEventListener("mouseup",Me),window.addEventListener("touchmove",ce,{passive:false}),window.addEventListener("touchend",Me),()=>{window.removeEventListener("mousemove",D),window.removeEventListener("mouseup",Me),window.removeEventListener("touchmove",ce),window.removeEventListener("touchend",Me);}},[]);let Z=qr.useCallback((D,ce)=>{v||(ce.preventDefault(),ce.stopPropagation(),X.current=true,K.current=D,oe.current={x:ce.clientX,y:ce.clientY,w:G.width,h:G.height,px:y.x,py:y.y},document.body.style.cursor=D==="e"||D==="w"?"ew-resize":D==="n"||D==="s"?"ns-resize":D==="nw"||D==="se"?"nwse-resize":"nesw-resize",document.body.style.userSelect="none");},[v,G,y]),Ne=qr.useCallback((D,ce)=>{if(v)return;ce.preventDefault(),ce.stopPropagation(),X.current=true;let Me=ce.touches[0];K.current=D,oe.current={x:Me.clientX,y:Me.clientY,w:G.width,h:G.height,px:y.x,py:y.y},document.body.style.userSelect="none";},[v,G,y]);qr.useEffect(()=>{let D=(Ee,at)=>{let Ut=K.current;if(!Ut)return;let ds=Ee-oe.current.x,ms=at-oe.current.y,{w:mr,h:pr,px:Wa,py:ja}=oe.current;if(Ut.includes("e")&&(mr=Math.max(T.width,mr+ds)),Ut.includes("w")){let zr=Math.max(T.width,mr-ds);Wa=Wa+(mr-zr),mr=zr;}if(Ut.includes("s")&&(pr=Math.max(T.height,pr+ms)),Ut.includes("n")){let zr=Math.max(T.height,pr-ms);ja=ja+(pr-zr),pr=zr;}O({width:mr,height:pr}),L({x:Wa,y:ja});},ce=Ee=>{K.current&&D(Ee.clientX,Ee.clientY);},Me=Ee=>{K.current&&(Ee.preventDefault(),D(Ee.touches[0].clientX,Ee.touches[0].clientY));},Re=()=>{K.current=false,document.body.style.cursor="",document.body.style.userSelect="";};return window.addEventListener("mousemove",ce),window.addEventListener("mouseup",Re),window.addEventListener("touchmove",Me,{passive:false}),window.addEventListener("touchend",Re),()=>{window.removeEventListener("mousemove",ce),window.removeEventListener("mouseup",Re),window.removeEventListener("touchmove",Me),window.removeEventListener("touchend",Re);}},[T]);let A=qr.useCallback(()=>{v?(_&&(L(_.pos),O(_.size)),U(false)):(ee({pos:y,size:G}),U(true));},[v,y,G,_]),ae=qr.useCallback(()=>{k?q(false):(v&&(U(false),_&&(L(_.pos),O(_.size))),q(true),h?.());},[k,v,_,h]);qr.useEffect(()=>{if(!we||k)return;let D=ce=>{if(!(!F.current?.contains(document.activeElement)&&document.activeElement!==F.current)){if(ce.key==="Escape"&&(E(null),V(new Set)),ce.ctrlKey&&ce.key==="a"){ce.preventDefault();let Me=new Set(ne.map((Re,Ee)=>Ee));V(Me);}ce.key==="Delete"&&R.size>0&&p&&(ce.preventDefault(),B(true));}};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[we,k,ne,R,p]);let se={"--fe-accent":r};if(k)return jsxRuntime.jsx("div",{className:s("fixed z-100 cursor-pointer transition-all duration-300",l==="right"?"right-0 top-1/2 -translate-y-1/2":"left-0 top-1/2 -translate-y-1/2"),style:se,onClick:()=>q(false),title:`Restore ${t}`,children:jsxRuntime.jsxs("div",{className:"fe-dock flex items-center gap-1.5 rounded-l-lg px-2 py-3 backdrop-blur-md",style:{writingMode:"vertical-rl",textOrientation:"mixed"},children:[jsxRuntime.jsx(lucideReact.HardDrive,{className:"h-3.5 w-3.5 text-(--fe-accent)"}),jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-widest text-(--fe-text)",children:t})]})});if(!we)return null;let z=v?j.w:Math.min(G.width,j.w-8),ve=v?j.h:Math.min(G.height,j.h-8),_e=v?0:Vr(y.x,0,Math.max(0,j.w-z)),mt=v?0:Vr(y.y,0,Math.max(0,j.h-40)),Xa=z<500;return jsxRuntime.jsxs("div",{ref:F,className:s("fe-window fixed z-100 flex flex-col overflow-hidden","rounded-xl border border-(--fe-border)","animate-[fe-window-in_0.35s_cubic-bezier(0.16,1,0.3,1)_both]",v&&"rounded-none",w),style:{...se,left:_e,top:mt,width:z,height:ve,transition:v?"left 0.3s, top 0.3s, width 0.3s, height 0.3s":void 0},tabIndex:0,children:[jsxRuntime.jsxs("div",{className:"fe-titlebar group/titlebar flex h-10 shrink-0 cursor-grab items-center justify-between px-3 select-none active:cursor-grabbing",onMouseDown:He,onTouchStart:Fe,onDoubleClick:A,children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"flex h-5 w-5 items-center justify-center rounded",style:{background:"color-mix(in srgb, var(--fe-accent) 25%, transparent)"},children:jsxRuntime.jsx(lucideReact.HardDrive,{className:"h-3 w-3 text-(--fe-accent)"})}),jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-widest text-(--fe-text)",children:t}),jsxRuntime.jsx("div",{className:"ml-2 hidden h-px w-20 md:block",style:{background:"linear-gradient(90deg, var(--fe-accent), transparent)",opacity:.3}})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{className:"fe-btn mr-1",onClick:()=>S(D=>D==="list"?"grid":"list"),title:C==="list"?"Grid view":"List view",children:C==="list"?jsxRuntime.jsx(lucideReact.LayoutGrid,{className:"h-3.5 w-3.5"}):jsxRuntime.jsx(lucideReact.LayoutList,{className:"h-3.5 w-3.5"})}),o&&jsxRuntime.jsx("button",{className:"fe-btn",onClick:ae,title:"Dock to edge",children:jsxRuntime.jsx(lucideReact.Minus,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("button",{className:"fe-btn",onClick:A,title:v?"Restore":"Maximize",children:v?jsxRuntime.jsx(lucideReact.Minimize2,{className:"h-3.5 w-3.5"}):jsxRuntime.jsx(lucideReact.Maximize2,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("button",{className:"fe-btn hover:bg-red-500/40! hover:text-red-300!",onClick:()=>{u?.(),de(false);},title:"Close",children:jsxRuntime.jsx(lucideReact.X,{className:"h-3.5 w-3.5"})})]})]}),jsxRuntime.jsxs("div",{className:"fe-toolbar flex h-9 shrink-0 items-center gap-2 px-3",children:[jsxRuntime.jsx("button",{className:"fe-btn p-1",onClick:()=>f?.(".."),title:"Go up",children:jsxRuntime.jsx(lucideReact.FolderUp,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("button",{className:"fe-btn shrink-0 px-1.5 py-0.5 text-[9px] font-bold uppercase tracking-wider",style:$==="navigate"?{color:"var(--fe-accent)",background:"color-mix(in srgb, var(--fe-accent) 15%, transparent)"}:void 0,onClick:()=>ue(D=>D==="search"?"navigate":"search"),title:$==="search"?"Switch to path navigation":"Switch to file search",children:$==="search"?jsxRuntime.jsx(lucideReact.Search,{className:"h-3 w-3"}):jsxRuntime.jsx(lucideReact.CornerRightDown,{className:"h-3 w-3"})}),jsxRuntime.jsx("div",{className:"relative flex-1",children:jsxRuntime.jsx("input",{type:"text",value:M,onChange:D=>W(D.target.value),onKeyDown:D=>{D.key==="Enter"&&M.trim()&&$==="navigate"&&(g?g(M.trim()):f?.(M.trim()));},placeholder:$==="search"?"Search files\u2026":"Enter path and press Enter\u2026",className:"h-6 w-full rounded border border-(--fe-input-border) bg-(--fe-input-bg) px-2 text-[11px] text-(--fe-text-strong) placeholder:text-(--fe-text-muted) outline-none transition-colors focus:border-(--fe-accent)/40 focus:bg-(--fe-input-bg)"})}),jsxRuntime.jsxs("span",{className:"shrink-0 font-mono text-[10px] text-(--fe-text-muted)",children:[ne.length," item",ne.length!==1?"s":"",R.size>0&&` \xB7 ${R.size} selected`]})]}),jsxRuntime.jsxs("div",{className:"relative flex flex-1 min-h-0",children:[jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden p-1.5",onClick:D=>{D.target===D.currentTarget&&(V(new Set),E(null));},children:ne.length===0?jsxRuntime.jsxs("div",{className:"flex h-full flex-col items-center justify-center text-(--fe-text-muted)",children:[jsxRuntime.jsx(lucideReact.Folder,{className:"mb-2 h-10 w-10"}),jsxRuntime.jsx("span",{className:"text-xs",children:"No files found"})]}):C==="list"?jsxRuntime.jsx("div",{className:"space-y-px",children:ne.map((D,ce)=>{let Me=Li(D),Re=R.has(ce),Ee=D.extension||Ma(D.name);return jsxRuntime.jsxs("div",{className:s("fe-item group/item flex items-center gap-2.5 rounded-lg px-2.5 py-1.5 text-(--fe-text) transition-all duration-150 cursor-pointer",Re?"bg-(--fe-accent)/15 text-(--fe-text-strong)":"hover:bg-(--fe-surface-hover) hover:text-(--fe-text-strong)"),style:Re?{boxShadow:"inset 2px 0 0 var(--fe-accent)"}:void 0,onClick:at=>Q(ce,at),onDoubleClick:()=>ke(ce),children:[jsxRuntime.jsx(Me,{className:s("h-4 w-4 shrink-0",D.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsxRuntime.jsx("span",{className:"flex-1 truncate text-xs font-medium",children:D.name}),Ee&&D.type==="file"&&jsxRuntime.jsx("span",{className:"shrink-0 rounded bg-(--fe-badge-bg) px-1.5 py-0.5 font-mono text-[9px] uppercase text-(--fe-text-muted)",children:Ee}),D.size!=null&&jsxRuntime.jsx("span",{className:"shrink-0 font-mono text-[10px] text-(--fe-text-muted)",children:Dl(D.size)}),D.modifiedAt&&jsxRuntime.jsx("span",{className:"hidden shrink-0 font-mono text-[10px] text-(--fe-text-muted) lg:inline",children:Di(D.modifiedAt)})]},D.path+ce)})}):jsxRuntime.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(90px,1fr))] gap-1.5 p-1",children:ne.map((D,ce)=>{let Me=Li(D),Re=R.has(ce),Ee=D.extension||Ma(D.name);return jsxRuntime.jsxs("div",{className:s("fe-item group/item flex cursor-pointer flex-col items-center gap-1 rounded-lg px-2 py-2.5 text-center transition-all duration-150",Re?"bg-(--fe-accent)/15 text-(--fe-text-strong) ring-1 ring-(--fe-accent)/30":"text-(--fe-text) hover:bg-(--fe-surface-hover) hover:text-(--fe-text-strong)"),onClick:at=>Q(ce,at),onDoubleClick:()=>ke(ce),children:[jsxRuntime.jsx(Me,{className:s("h-7 w-7",D.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsxRuntime.jsx("span",{className:"w-full truncate text-[10px] font-medium leading-tight",children:D.name}),Ee&&D.type==="file"&&jsxRuntime.jsx("span",{className:"font-mono text-[8px] uppercase text-(--fe-text-muted)",children:Ee})]},D.path+ce)})})}),jsxRuntime.jsx("div",{className:s("overflow-hidden transition-[width,opacity] duration-300 ease-out",Xa?s("absolute right-0 top-0 bottom-0 z-10",Y?"w-44 opacity-100":"w-0 opacity-0 pointer-events-none"):s("shrink-0",Y?"w-56":"w-0")),children:Y&&jsxRuntime.jsxs("div",{className:s("flex h-full flex-col p-4",Xa?"fe-panel-narrow w-44":"fe-panel w-56 border-l border-(--fe-border)"),children:[Xa&&jsxRuntime.jsx("button",{className:"fe-btn mb-2 self-end",onClick:()=>{E(null),V(new Set);},title:"Close panel",children:jsxRuntime.jsx(lucideReact.X,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsxs("div",{className:"mb-3 flex flex-col items-center",children:[qr__default.default.createElement(Li(Y),{className:s("h-10 w-10 mb-2",Y.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsxRuntime.jsx("span",{className:"w-full text-center text-xs font-semibold text-(--fe-text-strong) break-all leading-tight",children:Y.name})]}),jsxRuntime.jsxs("div",{className:"space-y-2.5 text-[10px]",children:[jsxRuntime.jsx(Ir,{label:"Type",value:Y.type==="directory"?"Directory":Y.mimeType||Y.extension||Ma(Y.name)||"File"}),Y.size!=null&&jsxRuntime.jsx(Ir,{label:"Size",value:Dl(Y.size)}),jsxRuntime.jsx(Ir,{label:"Path",value:Y.path,mono:true}),Y.extension&&jsxRuntime.jsx(Ir,{label:"Extension",value:Y.extension}),Y.modifiedAt&&jsxRuntime.jsx(Ir,{label:"Modified",value:Di(Y.modifiedAt)}),Y.createdAt&&jsxRuntime.jsx(Ir,{label:"Created",value:Di(Y.createdAt)})]}),jsxRuntime.jsxs("div",{className:"mt-auto flex flex-col gap-1.5",children:[Y.type==="file"&&m&&jsxRuntime.jsxs("button",{className:"flex items-center justify-center gap-1.5 rounded-lg py-1.5 text-[10px] font-semibold uppercase tracking-wider text-(--fe-text-strong) transition-colors",style:{background:"color-mix(in srgb, var(--fe-accent) 20%, transparent)",border:"1px solid color-mix(in srgb, var(--fe-accent) 30%, transparent)"},onClick:()=>m(Y),children:[jsxRuntime.jsx(lucideReact.ArrowUp,{className:"h-3 w-3 rotate-45"}),"Open"]}),N?.map(D=>jsxRuntime.jsxs("button",{className:"fe-action flex items-center justify-center gap-1.5 rounded-lg py-1.5 text-[10px] font-semibold uppercase tracking-wider text-(--fe-text) transition-colors hover:text-(--fe-text-strong)",onClick:()=>D.onClick(Y),children:[D.icon&&qr__default.default.createElement(D.icon,{className:"h-3 w-3"}),D.label]},D.key))]})]})})]}),jsxRuntime.jsxs("div",{className:"fe-statusbar flex h-6 shrink-0 items-center justify-between px-3 text-[9px] font-mono text-(--fe-text-muted)",children:[jsxRuntime.jsxs("span",{children:[ne.length," items"]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[R.size>0&&jsxRuntime.jsxs("span",{className:"text-(--fe-accent)/70",children:[R.size," selected"]}),jsxRuntime.jsx("span",{className:"opacity-50",children:"Ctrl+Click multi-select \xB7 Esc clear"})]})]}),x&&!v&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"absolute top-0 left-4 right-4 h-3 cursor-ns-resize",onMouseDown:D=>Z("n",D),onTouchStart:D=>Ne("n",D)}),jsxRuntime.jsx("div",{className:"absolute bottom-0 left-4 right-4 h-3 cursor-ns-resize",onMouseDown:D=>Z("s",D),onTouchStart:D=>Ne("s",D)}),jsxRuntime.jsx("div",{className:"absolute top-4 left-0 bottom-4 w-3 cursor-ew-resize",onMouseDown:D=>Z("w",D),onTouchStart:D=>Ne("w",D)}),jsxRuntime.jsx("div",{className:"absolute top-4 right-0 bottom-4 w-3 cursor-ew-resize",onMouseDown:D=>Z("e",D),onTouchStart:D=>Ne("e",D)}),jsxRuntime.jsx("div",{className:"absolute top-0 left-0 h-6 w-6 cursor-nwse-resize",onMouseDown:D=>Z("nw",D),onTouchStart:D=>Ne("nw",D)}),jsxRuntime.jsx("div",{className:"absolute top-0 right-0 h-6 w-6 cursor-nesw-resize",onMouseDown:D=>Z("ne",D),onTouchStart:D=>Ne("ne",D)}),jsxRuntime.jsx("div",{className:"absolute bottom-0 left-0 h-6 w-6 cursor-nesw-resize",onMouseDown:D=>Z("sw",D),onTouchStart:D=>Ne("sw",D)}),jsxRuntime.jsx("div",{className:"absolute bottom-0 right-0 h-6 w-6 cursor-nwse-resize",onMouseDown:D=>Z("se",D),onTouchStart:D=>Ne("se",D)})]}),jsxRuntime.jsx("style",{children:`
23
+ `})]});return jsxRuntime.jsx("div",{className:f(E&&"fixed inset-0 z-100 flex items-center justify-center p-8",E&&(U?"animate-[cp-cinema-out_0.5s_ease-in_both]":"animate-[cp-cinema-in_0.5s_ease-out_both]")),onClick:E?K=>{K.target===K.currentTarget&&Q();}:void 0,children:jsxRuntime.jsx("div",{className:f(E&&"w-full",E&&!H&&"max-w-5xl"),children:Re})})}function Va(e){let t=e.lastIndexOf(".");return t>0?e.slice(t).toLowerCase():""}function Bd(e){return e==null?"\u2014":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(2)} GB`}function Js(e){return e?(typeof e=="string"?new Date(e):e).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"\u2014"}var iy={".png":lucideReact.Image,".jpg":lucideReact.Image,".jpeg":lucideReact.Image,".gif":lucideReact.Image,".svg":lucideReact.Image,".webp":lucideReact.Image,".ico":lucideReact.Image,".bmp":lucideReact.Image,".mp3":lucideReact.Music,".wav":lucideReact.Music,".flac":lucideReact.Music,".ogg":lucideReact.Music,".aac":lucideReact.Music,".m4a":lucideReact.Music,".mp4":lucideReact.Video,".mkv":lucideReact.Video,".avi":lucideReact.Video,".mov":lucideReact.Video,".wmv":lucideReact.Video,".webm":lucideReact.Video,".ts":lucideReact.FileCode,".tsx":lucideReact.FileCode,".js":lucideReact.FileCode,".jsx":lucideReact.FileCode,".json":lucideReact.FileCode,".html":lucideReact.FileCode,".css":lucideReact.FileCode,".scss":lucideReact.FileCode,".py":lucideReact.FileCode,".rs":lucideReact.FileCode,".go":lucideReact.FileCode,".java":lucideReact.FileCode,".c":lucideReact.FileCode,".cpp":lucideReact.FileCode,".h":lucideReact.FileCode,".sh":lucideReact.Terminal,".bat":lucideReact.Terminal,".ps1":lucideReact.Terminal,".md":lucideReact.FileText,".txt":lucideReact.FileText,".pdf":lucideReact.FileText,".doc":lucideReact.FileText,".docx":lucideReact.FileText,".rtf":lucideReact.FileText,".csv":lucideReact.FileSpreadsheet,".xls":lucideReact.FileSpreadsheet,".xlsx":lucideReact.FileSpreadsheet,".db":lucideReact.Database,".sqlite":lucideReact.Database,".sql":lucideReact.Database,".zip":lucideReact.FileArchive,".tar":lucideReact.FileArchive,".gz":lucideReact.FileArchive,".rar":lucideReact.FileArchive,".7z":lucideReact.FileArchive};function Qs(e){if(e.type==="directory")return lucideReact.Folder;let t=e.extension||Va(e.name);return iy[t]||lucideReact.File}function bn(e,t,r){return Math.max(t,Math.min(r,e))}function Od(e){return e<480?"xs":e<640?"sm":e<1024?"md":"lg"}function $d(e,t){if(e<480)return {size:{width:e-16,height:t-48},pos:{x:8,y:24}};if(e<640){let o=e-24,a=Math.min(t-64,540);return {size:{width:o,height:a},pos:{x:12,y:32}}}if(e<1024){let o=Math.min(640,e-32),a=Math.min(480,t-64);return {size:{width:o,height:a},pos:{x:Math.max(0,Math.round((e-o)/2)),y:Math.max(0,Math.round((t-a)/2))}}}let r=720,n=520;return {size:{width:r,height:n},pos:{x:Math.max(0,Math.round((e-r)/2)),y:Math.max(0,Math.round((t-n)/2))}}}function Zs({files:e,title:t="File Explorer",accent:r="#8b5cf6",defaultView:n="list",initialPosition:o,initialSize:a,dockable:i=false,dockSide:s="right",visible:l=true,onFileOpen:c,onSelectionChange:u,onNavigate:p,onDelete:m,onClose:d,onMinimize:g,onPathSubmit:h,defaultInputMode:b="search",actions:y,resizable:v=true,minSize:N={width:400,height:300},className:x}){let[w,L]=On.useState(n),[P,A]=On.useState(new Set),[D,S]=On.useState(null),[C,I]=On.useState(false),[k,T]=On.useState(false),[R,O]=On.useState(""),[E,ne]=On.useState(b),[U,z]=On.useState(l),[H,_]=On.useState(false),[V,oe]=On.useState({w:window.innerWidth,h:window.innerHeight}),be=$d(window.innerWidth,window.innerHeight),[M,F]=On.useState(o??be.pos),[re,W]=On.useState(a??be.size),[G,le]=On.useState(null),ke=On.useRef(false),B=On.useRef({x:0,y:0}),q=On.useRef(null),Z=On.useRef(false),ue=On.useRef({x:0,y:0,w:0,h:0,px:0,py:0}),te=On.useRef(false),ve=On.useRef(C);On.useEffect(()=>{ve.current=C;},[C]);let Ne=l!==void 0?l:U,X=On.useMemo(()=>{let $=e.filter(Le=>Le.type==="directory"),ge=e.filter(Le=>Le.type==="file");return $.sort((Le,De)=>Le.name.localeCompare(De.name)),ge.sort((Le,De)=>Le.name.localeCompare(De.name)),[...$,...ge]},[e]),de=On.useMemo(()=>{if(E!=="search"||!R.trim())return X;let $=R.toLowerCase();return X.filter(ge=>ge.name.toLowerCase().includes($))},[X,R,E]),Q=D!=null?de[D]:null;On.useEffect(()=>{let $=Od(window.innerWidth),ge=()=>{let Le=window.innerWidth,De=window.innerHeight;if(oe({w:Le,h:De}),ve.current)return;let He=Od(Le);if(He!==$&&!te.current&&!a){let dt=$d(Le,De);W(dt.size),F(dt.pos);}$=He;};return window.addEventListener("resize",ge),()=>window.removeEventListener("resize",ge)},[a]);let ie=On.useCallback(($,ge)=>{A(Le=>{let De=new Set(Le);return ge.ctrlKey||ge.metaKey?De.has($)?De.delete($):De.add($):(De.clear(),De.add($)),De}),S($);},[]);On.useEffect(()=>{if(!u)return;let $=Array.from(P).map(ge=>de[ge]).filter(Boolean);u($);},[P]);let Pe=On.useCallback($=>{let ge=de[$];ge&&(ge.type==="directory"?p?.(ge.path):c?.(ge));},[de,c,p]),Oe=On.useCallback($=>{C||$.target.closest("button")||(te.current=true,ke.current=true,B.current={x:$.clientX-M.x,y:$.clientY-M.y},$.preventDefault());},[M,C]),Xe=On.useCallback($=>{if(C||$.target.closest("button"))return;te.current=true;let ge=$.touches[0];ke.current=true,B.current={x:ge.clientX-M.x,y:ge.clientY-M.y};},[M,C]);On.useEffect(()=>{let $=De=>{if(!ke.current)return;let He=window.innerWidth-100,dt=window.innerHeight-40;F({x:bn(De.clientX-B.current.x,0,He),y:bn(De.clientY-B.current.y,0,dt)});},ge=De=>{if(!ke.current)return;De.preventDefault();let He=De.touches[0],dt=window.innerWidth-100,Gt=window.innerHeight-40;F({x:bn(He.clientX-B.current.x,0,dt),y:bn(He.clientY-B.current.y,0,Gt)});},Le=()=>{ke.current=false,Z.current=false,document.body.style.cursor="",document.body.style.userSelect="";};return window.addEventListener("mousemove",$),window.addEventListener("mouseup",Le),window.addEventListener("touchmove",ge,{passive:false}),window.addEventListener("touchend",Le),()=>{window.removeEventListener("mousemove",$),window.removeEventListener("mouseup",Le),window.removeEventListener("touchmove",ge),window.removeEventListener("touchend",Le);}},[]);let se=On.useCallback(($,ge)=>{C||(ge.preventDefault(),ge.stopPropagation(),te.current=true,Z.current=$,ue.current={x:ge.clientX,y:ge.clientY,w:re.width,h:re.height,px:M.x,py:M.y},document.body.style.cursor=$==="e"||$==="w"?"ew-resize":$==="n"||$==="s"?"ns-resize":$==="nw"||$==="se"?"nwse-resize":"nesw-resize",document.body.style.userSelect="none");},[C,re,M]),Re=On.useCallback(($,ge)=>{if(C)return;ge.preventDefault(),ge.stopPropagation(),te.current=true;let Le=ge.touches[0];Z.current=$,ue.current={x:Le.clientX,y:Le.clientY,w:re.width,h:re.height,px:M.x,py:M.y},document.body.style.userSelect="none";},[C,re,M]);On.useEffect(()=>{let $=(He,dt)=>{let Gt=Z.current;if(!Gt)return;let Mo=He-ue.current.x,j=dt-ue.current.y,{w:qt,h:ir,px:Sn,py:Yr}=ue.current;if(Gt.includes("e")&&(qt=Math.max(N.width,qt+Mo)),Gt.includes("w")){let Tr=Math.max(N.width,qt-Mo);Sn=Sn+(qt-Tr),qt=Tr;}if(Gt.includes("s")&&(ir=Math.max(N.height,ir+j)),Gt.includes("n")){let Tr=Math.max(N.height,ir-j);Yr=Yr+(ir-Tr),ir=Tr;}W({width:qt,height:ir}),F({x:Sn,y:Yr});},ge=He=>{Z.current&&$(He.clientX,He.clientY);},Le=He=>{Z.current&&(He.preventDefault(),$(He.touches[0].clientX,He.touches[0].clientY));},De=()=>{Z.current=false,document.body.style.cursor="",document.body.style.userSelect="";};return window.addEventListener("mousemove",ge),window.addEventListener("mouseup",De),window.addEventListener("touchmove",Le,{passive:false}),window.addEventListener("touchend",De),()=>{window.removeEventListener("mousemove",ge),window.removeEventListener("mouseup",De),window.removeEventListener("touchmove",Le),window.removeEventListener("touchend",De);}},[N]);let K=On.useCallback(()=>{C?(G&&(F(G.pos),W(G.size)),I(false)):(le({pos:M,size:re}),I(true));},[C,M,re,G]),ce=On.useCallback(()=>{k?T(false):(C&&(I(false),G&&(F(G.pos),W(G.size))),T(true),g?.());},[k,C,G,g]);On.useEffect(()=>{if(!Ne||k)return;let $=ge=>{if(!(!q.current?.contains(document.activeElement)&&document.activeElement!==q.current)){if(ge.key==="Escape"&&(S(null),A(new Set)),ge.ctrlKey&&ge.key==="a"){ge.preventDefault();let Le=new Set(de.map((De,He)=>He));A(Le);}ge.key==="Delete"&&P.size>0&&m&&(ge.preventDefault(),_(true));}};return window.addEventListener("keydown",$),()=>window.removeEventListener("keydown",$)},[Ne,k,de,P,m]);let me={"--fe-accent":r};if(k)return jsxRuntime.jsx("div",{className:f("fixed z-100 cursor-pointer transition-all duration-300",s==="right"?"right-0 top-1/2 -translate-y-1/2":"left-0 top-1/2 -translate-y-1/2"),style:me,onClick:()=>T(false),title:`Restore ${t}`,children:jsxRuntime.jsxs("div",{className:"fe-dock flex items-center gap-1.5 rounded-l-lg px-2 py-3 backdrop-blur-md",style:{writingMode:"vertical-rl",textOrientation:"mixed"},children:[jsxRuntime.jsx(lucideReact.HardDrive,{className:"h-3.5 w-3.5 text-(--fe-accent)"}),jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-widest text-(--fe-text)",children:t})]})});if(!Ne)return null;let J=C?V.w:Math.min(re.width,V.w-8),Ce=C?V.h:Math.min(re.height,V.h-8),Ye=C?0:bn(M.x,0,Math.max(0,V.w-J)),vt=C?0:bn(M.y,0,Math.max(0,V.h-40)),Wr=J<500;return jsxRuntime.jsxs("div",{ref:q,className:f("fe-window fixed z-100 flex flex-col overflow-hidden","rounded-xl border border-(--fe-border)","animate-[fe-window-in_0.35s_cubic-bezier(0.16,1,0.3,1)_both]",C&&"rounded-none",x),style:{...me,left:Ye,top:vt,width:J,height:Ce,transition:C?"left 0.3s, top 0.3s, width 0.3s, height 0.3s":void 0},tabIndex:0,children:[jsxRuntime.jsxs("div",{className:"fe-titlebar group/titlebar flex h-10 shrink-0 cursor-grab items-center justify-between px-3 select-none active:cursor-grabbing",onMouseDown:Oe,onTouchStart:Xe,onDoubleClick:K,children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"flex h-5 w-5 items-center justify-center rounded",style:{background:"color-mix(in srgb, var(--fe-accent) 25%, transparent)"},children:jsxRuntime.jsx(lucideReact.HardDrive,{className:"h-3 w-3 text-(--fe-accent)"})}),jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-widest text-(--fe-text)",children:t}),jsxRuntime.jsx("div",{className:"ml-2 hidden h-px w-20 md:block",style:{background:"linear-gradient(90deg, var(--fe-accent), transparent)",opacity:.3}})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{className:"fe-btn mr-1",onClick:()=>L($=>$==="list"?"grid":"list"),title:w==="list"?"Grid view":"List view",children:w==="list"?jsxRuntime.jsx(lucideReact.LayoutGrid,{className:"h-3.5 w-3.5"}):jsxRuntime.jsx(lucideReact.LayoutList,{className:"h-3.5 w-3.5"})}),i&&jsxRuntime.jsx("button",{className:"fe-btn",onClick:ce,title:"Dock to edge",children:jsxRuntime.jsx(lucideReact.Minus,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("button",{className:"fe-btn",onClick:K,title:C?"Restore":"Maximize",children:C?jsxRuntime.jsx(lucideReact.Minimize2,{className:"h-3.5 w-3.5"}):jsxRuntime.jsx(lucideReact.Maximize2,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("button",{className:"fe-btn hover:bg-red-500/40! hover:text-red-300!",onClick:()=>{d?.(),z(false);},title:"Close",children:jsxRuntime.jsx(lucideReact.X,{className:"h-3.5 w-3.5"})})]})]}),jsxRuntime.jsxs("div",{className:"fe-toolbar flex h-9 shrink-0 items-center gap-2 px-3",children:[jsxRuntime.jsx("button",{className:"fe-btn p-1",onClick:()=>p?.(".."),title:"Go up",children:jsxRuntime.jsx(lucideReact.FolderUp,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("button",{className:"fe-btn shrink-0 px-1.5 py-0.5 text-[9px] font-bold uppercase tracking-wider",style:E==="navigate"?{color:"var(--fe-accent)",background:"color-mix(in srgb, var(--fe-accent) 15%, transparent)"}:void 0,onClick:()=>ne($=>$==="search"?"navigate":"search"),title:E==="search"?"Switch to path navigation":"Switch to file search",children:E==="search"?jsxRuntime.jsx(lucideReact.Search,{className:"h-3 w-3"}):jsxRuntime.jsx(lucideReact.CornerRightDown,{className:"h-3 w-3"})}),jsxRuntime.jsx("div",{className:"relative flex-1",children:jsxRuntime.jsx("input",{type:"text",value:R,onChange:$=>O($.target.value),onKeyDown:$=>{$.key==="Enter"&&R.trim()&&E==="navigate"&&(h?h(R.trim()):p?.(R.trim()));},placeholder:E==="search"?"Search files\u2026":"Enter path and press Enter\u2026",className:"h-6 w-full rounded border border-(--fe-input-border) bg-(--fe-input-bg) px-2 text-[11px] text-(--fe-text-strong) placeholder:text-(--fe-text-muted) outline-none transition-colors focus:border-(--fe-accent)/40 focus:bg-(--fe-input-bg)"})}),jsxRuntime.jsxs("span",{className:"shrink-0 font-mono text-[10px] text-(--fe-text-muted)",children:[de.length," item",de.length!==1?"s":"",P.size>0&&` \xB7 ${P.size} selected`]})]}),jsxRuntime.jsxs("div",{className:"relative flex flex-1 min-h-0",children:[jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden p-1.5",onClick:$=>{$.target===$.currentTarget&&(A(new Set),S(null));},children:de.length===0?jsxRuntime.jsxs("div",{className:"flex h-full flex-col items-center justify-center text-(--fe-text-muted)",children:[jsxRuntime.jsx(lucideReact.Folder,{className:"mb-2 h-10 w-10"}),jsxRuntime.jsx("span",{className:"text-xs",children:"No files found"})]}):w==="list"?jsxRuntime.jsx("div",{className:"space-y-px",children:de.map(($,ge)=>{let Le=Qs($),De=P.has(ge),He=$.extension||Va($.name);return jsxRuntime.jsxs("div",{className:f("fe-item group/item flex items-center gap-2.5 rounded-lg px-2.5 py-1.5 text-(--fe-text) transition-all duration-150 cursor-pointer",De?"bg-(--fe-accent)/15 text-(--fe-text-strong)":"hover:bg-(--fe-surface-hover) hover:text-(--fe-text-strong)"),style:De?{boxShadow:"inset 2px 0 0 var(--fe-accent)"}:void 0,onClick:dt=>ie(ge,dt),onDoubleClick:()=>Pe(ge),children:[jsxRuntime.jsx(Le,{className:f("h-4 w-4 shrink-0",$.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsxRuntime.jsx("span",{className:"flex-1 truncate text-xs font-medium",children:$.name}),He&&$.type==="file"&&jsxRuntime.jsx("span",{className:"shrink-0 rounded bg-(--fe-badge-bg) px-1.5 py-0.5 font-mono text-[9px] uppercase text-(--fe-text-muted)",children:He}),$.size!=null&&jsxRuntime.jsx("span",{className:"shrink-0 font-mono text-[10px] text-(--fe-text-muted)",children:Bd($.size)}),$.modifiedAt&&jsxRuntime.jsx("span",{className:"hidden shrink-0 font-mono text-[10px] text-(--fe-text-muted) lg:inline",children:Js($.modifiedAt)})]},$.path+ge)})}):jsxRuntime.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(90px,1fr))] gap-1.5 p-1",children:de.map(($,ge)=>{let Le=Qs($),De=P.has(ge),He=$.extension||Va($.name);return jsxRuntime.jsxs("div",{className:f("fe-item group/item flex cursor-pointer flex-col items-center gap-1 rounded-lg px-2 py-2.5 text-center transition-all duration-150",De?"bg-(--fe-accent)/15 text-(--fe-text-strong) ring-1 ring-(--fe-accent)/30":"text-(--fe-text) hover:bg-(--fe-surface-hover) hover:text-(--fe-text-strong)"),onClick:dt=>ie(ge,dt),onDoubleClick:()=>Pe(ge),children:[jsxRuntime.jsx(Le,{className:f("h-7 w-7",$.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsxRuntime.jsx("span",{className:"w-full truncate text-[10px] font-medium leading-tight",children:$.name}),He&&$.type==="file"&&jsxRuntime.jsx("span",{className:"font-mono text-[8px] uppercase text-(--fe-text-muted)",children:He})]},$.path+ge)})})}),jsxRuntime.jsx("div",{className:f("overflow-hidden transition-[width,opacity] duration-300 ease-out",Wr?f("absolute right-0 top-0 bottom-0 z-10",Q?"w-44 opacity-100":"w-0 opacity-0 pointer-events-none"):f("shrink-0",Q?"w-56":"w-0")),children:Q&&jsxRuntime.jsxs("div",{className:f("flex h-full flex-col p-4",Wr?"fe-panel-narrow w-44":"fe-panel w-56 border-l border-(--fe-border)"),children:[Wr&&jsxRuntime.jsx("button",{className:"fe-btn mb-2 self-end",onClick:()=>{S(null),A(new Set);},title:"Close panel",children:jsxRuntime.jsx(lucideReact.X,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsxs("div",{className:"mb-3 flex flex-col items-center",children:[On__default.default.createElement(Qs(Q),{className:f("h-10 w-10 mb-2",Q.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsxRuntime.jsx("span",{className:"w-full text-center text-xs font-semibold text-(--fe-text-strong) break-all leading-tight",children:Q.name})]}),jsxRuntime.jsxs("div",{className:"space-y-2.5 text-[10px]",children:[jsxRuntime.jsx(yn,{label:"Type",value:Q.type==="directory"?"Directory":Q.mimeType||Q.extension||Va(Q.name)||"File"}),Q.size!=null&&jsxRuntime.jsx(yn,{label:"Size",value:Bd(Q.size)}),jsxRuntime.jsx(yn,{label:"Path",value:Q.path,mono:true}),Q.extension&&jsxRuntime.jsx(yn,{label:"Extension",value:Q.extension}),Q.modifiedAt&&jsxRuntime.jsx(yn,{label:"Modified",value:Js(Q.modifiedAt)}),Q.createdAt&&jsxRuntime.jsx(yn,{label:"Created",value:Js(Q.createdAt)})]}),jsxRuntime.jsxs("div",{className:"mt-auto flex flex-col gap-1.5",children:[Q.type==="file"&&c&&jsxRuntime.jsxs("button",{className:"flex items-center justify-center gap-1.5 rounded-lg py-1.5 text-[10px] font-semibold uppercase tracking-wider text-(--fe-text-strong) transition-colors",style:{background:"color-mix(in srgb, var(--fe-accent) 20%, transparent)",border:"1px solid color-mix(in srgb, var(--fe-accent) 30%, transparent)"},onClick:()=>c(Q),children:[jsxRuntime.jsx(lucideReact.ArrowUp,{className:"h-3 w-3 rotate-45"}),"Open"]}),y?.map($=>jsxRuntime.jsxs("button",{className:"fe-action flex items-center justify-center gap-1.5 rounded-lg py-1.5 text-[10px] font-semibold uppercase tracking-wider text-(--fe-text) transition-colors hover:text-(--fe-text-strong)",onClick:()=>$.onClick(Q),children:[$.icon&&On__default.default.createElement($.icon,{className:"h-3 w-3"}),$.label]},$.key))]})]})})]}),jsxRuntime.jsxs("div",{className:"fe-statusbar flex h-6 shrink-0 items-center justify-between px-3 text-[9px] font-mono text-(--fe-text-muted)",children:[jsxRuntime.jsxs("span",{children:[de.length," items"]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[P.size>0&&jsxRuntime.jsxs("span",{className:"text-(--fe-accent)/70",children:[P.size," selected"]}),jsxRuntime.jsx("span",{className:"opacity-50",children:"Ctrl+Click multi-select \xB7 Esc clear"})]})]}),v&&!C&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"absolute top-0 left-4 right-4 h-3 cursor-ns-resize",onMouseDown:$=>se("n",$),onTouchStart:$=>Re("n",$)}),jsxRuntime.jsx("div",{className:"absolute bottom-0 left-4 right-4 h-3 cursor-ns-resize",onMouseDown:$=>se("s",$),onTouchStart:$=>Re("s",$)}),jsxRuntime.jsx("div",{className:"absolute top-4 left-0 bottom-4 w-3 cursor-ew-resize",onMouseDown:$=>se("w",$),onTouchStart:$=>Re("w",$)}),jsxRuntime.jsx("div",{className:"absolute top-4 right-0 bottom-4 w-3 cursor-ew-resize",onMouseDown:$=>se("e",$),onTouchStart:$=>Re("e",$)}),jsxRuntime.jsx("div",{className:"absolute top-0 left-0 h-6 w-6 cursor-nwse-resize",onMouseDown:$=>se("nw",$),onTouchStart:$=>Re("nw",$)}),jsxRuntime.jsx("div",{className:"absolute top-0 right-0 h-6 w-6 cursor-nesw-resize",onMouseDown:$=>se("ne",$),onTouchStart:$=>Re("ne",$)}),jsxRuntime.jsx("div",{className:"absolute bottom-0 left-0 h-6 w-6 cursor-nesw-resize",onMouseDown:$=>se("sw",$),onTouchStart:$=>Re("sw",$)}),jsxRuntime.jsx("div",{className:"absolute bottom-0 right-0 h-6 w-6 cursor-nwse-resize",onMouseDown:$=>se("se",$),onTouchStart:$=>Re("se",$)})]}),jsxRuntime.jsx("style",{children:`
24
24
  .fe-window {
25
25
  background: var(--fe-bg);
26
26
  box-shadow: var(--fe-shadow);
@@ -81,4 +81,48 @@
81
81
  from { opacity: 0; transform: translateX(-4px); }
82
82
  to { opacity: 1; transform: translateX(0); }
83
83
  }
84
- `}),jsxRuntime.jsx(ln,{open:re,onOpenChange:B,children:jsxRuntime.jsxs(Zo,{size:"sm",children:[jsxRuntime.jsxs(Jo,{children:[jsxRuntime.jsxs(ei,{children:[jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"text-danger-500"}),"Confirm Deletion"]}),jsxRuntime.jsxs(ti,{children:[R.size===1?`Are you sure you want to delete "${ne[Array.from(R)[0]]?.name}"?`:`Are you sure you want to delete ${R.size} selected items?`," ","This action cannot be undone."]})]}),jsxRuntime.jsxs(ri,{children:[jsxRuntime.jsx(gr,{intent:"ghost",onClick:()=>B(false),children:"Cancel"}),jsxRuntime.jsxs(gr,{intent:"danger",onClick:()=>{let D=Array.from(R).map(ce=>ne[ce]).filter(Boolean);p?.(D),V(new Set),E(null),B(false);},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"h-4 w-4"}),"Delete"]})]})]})})]})}function Ir({label:e,value:t,mono:r}){return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"mb-0.5 font-semibold uppercase tracking-wider text-(--fe-text-muted)",children:e}),jsxRuntime.jsx("div",{className:s("text-(--fe-text) break-all leading-snug",r&&"font-mono text-[9px]"),children:t})]})}function Bf(e,t){let r=t.getBoundingClientRect(),n=Math.max(r.width,r.height)*1.2,a=e.clientX-r.left,i=e.clientY-r.top,o=document.createElement("span");o.className="masonry-ripple",o.style.width=`${n}px`,o.style.height=`${n}px`,o.style.left=`${a}px`,o.style.top=`${i}px`,t.appendChild(o),o.addEventListener("animationend",()=>o.remove());}function Hi({columns:e,columnWidth:t=240,gap:r=16,items:n,onItemClick:a,className:i,style:o,children:l,...c}){let m=qr.useRef(null),d=qr.useRef([]),[f,p]=qr.useState(()=>e??1),[u,h]=qr.useState([]),[g,b]=qr.useState(0),N=n?n.map((R,V)=>({key:R.key??V,node:R.content})):qr__default.default.Children.toArray(l).map((R,V)=>({key:R.key??V,node:R})),x=N.length,T=qr.useCallback(R=>e??Math.max(1,Math.floor((R+r)/(t+r))),[e,t,r]),w=qr.useCallback(()=>{let R=m.current;if(!R)return;let V=R.clientWidth,I=T(V);p(I);let E=(V-(I-1)*r)/I,v=new Array(I).fill(0),U=[];for(let q=0;q<x;q++){let M=d.current[q],W=M?M.offsetHeight:0,$=0;for(let ue=1;ue<I;ue++)v[ue]<v[$]&&($=ue);U.push({top:v[$],left:$*(E+r),width:E}),v[$]+=W+r;}let k=Math.max(0,...v)-(x?r:0);h(U),b(k);},[x,T,r]);qr.useEffect(()=>{let R=m.current;if(!R)return;let V=new ResizeObserver(()=>w());return V.observe(R),()=>V.disconnect()},[w]),qr.useEffect(()=>{let R=requestAnimationFrame(w);return ()=>cancelAnimationFrame(R)},[w]),qr.useEffect(()=>{let R=new ResizeObserver(()=>w());return d.current.forEach(V=>{V&&R.observe(V);}),()=>R.disconnect()},[x,f,w]);let C=qr.useCallback((R,V)=>{let I=R.currentTarget;Bf(R,I),a?.(n?.[V],V);},[a,n]),S=R=>{if(!n)return false;let V=n[R];return !!(V.title||V.description||V.actions)};return jsxRuntime.jsx("div",{ref:m,className:s("relative",i),style:{...o,height:g},...c,children:N.map((R,V)=>jsxRuntime.jsxs("div",{ref:I=>{d.current[V]=I;},className:"masonry-item",role:"button",tabIndex:0,onClick:I=>C(I,V),onKeyDown:I=>{(I.key==="Enter"||I.key===" ")&&(I.preventDefault(),a?.(n?.[V],V));},style:{position:"absolute",top:u[V]?.top??0,left:u[V]?.left??0,width:u[V]?.width??"100%"},children:[R.node,S(V)&&jsxRuntime.jsxs("div",{className:"masonry-item-overlay",children:[n[V].title&&jsxRuntime.jsx("p",{className:"masonry-item-overlay-title",children:n[V].title}),n[V].description&&jsxRuntime.jsx("p",{className:"masonry-item-overlay-desc",children:n[V].description}),n[V].actions&&jsxRuntime.jsx("div",{className:"masonry-item-overlay-actions",children:n[V].actions})]})]},R.key))})}function La({text:e="",mode:t="typewriter",speed:r=40,cursor:n=true,cursorChar:a="\u258B",thinking:i=false,streaming:o=false,delay:l=0,onComplete:c,as:m="span",className:d}){let[f,p]=qr.useState(t==="instant"?e:""),[u,h]=qr.useState(false),[g,b]=qr.useState(t==="instant"),[N,x]=qr.useState(false),T=qr.useRef(0),w=qr.useRef(c);w.current=c;let C=qr.useRef(e);C.current=e,qr.useEffect(()=>{if(t!=="typewriter")return;if(p(""),b(false),x(false),h(false),!e){b(true);return}let E=Math.max(10,1e3/r),v=0,U,k=()=>{h(true),U=setInterval(()=>{let M=C.current;v++,p(M.slice(0,v)),v>=M.length&&(clearInterval(U),h(false),b(true),w.current?.());},E);},q;return l>0?q=setTimeout(k,l):k(),()=>{clearTimeout(q),clearInterval(U);}},[e,t]),qr.useEffect(()=>{if(t!=="stream")return;if(e.length===0){T.current=0,p(""),h(false),b(false),x(false);return}if(e.length<=T.current)return;let E=Math.max(10,1e3/r),v=T.current;h(true),b(false),x(false);let U=setInterval(()=>{v++,T.current=v,p(C.current.slice(0,v)),v>=C.current.length&&(clearInterval(U),h(false),w.current?.());},E);return ()=>clearInterval(U)},[e,t]),qr.useEffect(()=>{t==="instant"&&(p(e),h(false),b(true));},[e,t]);let S=qr.useRef(o);qr.useEffect(()=>{let E=S.current;if(S.current=o,E&&!o&&!u&&t==="stream"){x(true);let v=setTimeout(()=>{x(false),b(true);},650);return ()=>clearTimeout(v)}},[o,u,t]);let R=n&&(i||u||N||t==="stream"&&o&&!g||t==="typewriter"&&!g),V=i?"tw-cursor--blink":u?"tw-cursor--solid":N?"tw-cursor--out":"tw-cursor--blink";return jsxRuntime.jsxs(m,{className:s(d),children:[i&&!f&&jsxRuntime.jsx("span",{"aria-hidden":"true",children:"\u200B"}),f,R&&jsxRuntime.jsx("span",{className:s("tw-cursor",V),"aria-hidden":"true",children:a})]})}function Ea(e){return e.toLowerCase().replace(/\s+/g," ").trim()}function $f(e,t){if(!t)return true;let r=Ea(t);return Ea(e.label).includes(r)||(e.description?Ea(e.description).includes(r):false)||(e.keywords?e.keywords.some(n=>Ea(n).includes(r)):false)}function Yf(e){let t=new Map;for(let r of e){let n=r.group??"";t.has(n)||t.set(n,[]),t.get(n).push(r);}return Array.from(t.entries()).map(([r,n])=>({label:r,items:n}))}function Bl(e,t,r,n){let[a,i]=qr.useState(""),[o,l]=qr.useState(0);qr.useEffect(()=>{t&&(i(""),l(0));},[t]);let c=qr.useMemo(()=>e.filter(p=>!p.disabled&&$f(p,a)),[e,a]),m=qr.useMemo(()=>Yf(c),[c]);qr.useEffect(()=>{l(p=>Math.min(p,Math.max(0,c.length-1)));},[c.length]);let d=qr.useCallback(()=>{let p=c[o];p&&(p.onSelect(),r(false));},[c,o,r]),f=qr.useCallback(p=>{switch(p.key){case "ArrowDown":p.preventDefault(),l(u=>(u+1)%Math.max(1,c.length));break;case "ArrowUp":p.preventDefault(),l(u=>(u-1+Math.max(1,c.length))%Math.max(1,c.length));break;case "Enter":p.preventDefault(),d();break;case "Escape":p.preventDefault(),r(false);break}},[c.length,d,r]);return qr.useEffect(()=>{if(!n)return;function p(u){(u.metaKey||u.ctrlKey)&&u.key==="k"&&(u.preventDefault(),r(!t));}return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[n,t,r]),{query:a,setQuery:i,groups:m,filtered:c,activeIndex:o,setActiveIndex:l,handleKeyDown:f}}function Va({open:e,onOpenChange:t,commands:r,placeholder:n="Type a command or search\u2026",hotkey:a=true,maxItems:i=8,className:o}){let l=qr.useRef(null),c=qr.useRef(null),{query:m,setQuery:d,groups:f,filtered:p,activeIndex:u,setActiveIndex:h,handleKeyDown:g}=Bl(r,e,t,a);if(qr.useEffect(()=>{if(e){let N=setTimeout(()=>l.current?.focus(),40);return ()=>clearTimeout(N)}},[e]),qr.useEffect(()=>{c.current?.querySelector("[data-active='true']")?.scrollIntoView({block:"nearest"});},[u]),!e)return null;let b=0;return reactDom.createPortal(jsxRuntime.jsx("div",{className:"cmd-backdrop fixed inset-0 z-50 flex items-start justify-center pt-[15vh]",onClick:()=>t(false),role:"presentation",children:jsxRuntime.jsxs("div",{className:s("cmd-panel relative flex w-full max-w-lg flex-col overflow-hidden rounded-xl","border border-primary-200 bg-white shadow-2xl","dark:border-primary-700 dark:bg-primary-900",o),onClick:N=>N.stopPropagation(),onKeyDown:g,role:"dialog","aria-label":"Command palette","aria-modal":"true",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 border-b border-primary-100 px-4 dark:border-primary-700",children:[jsxRuntime.jsx(lucideReact.Search,{className:"h-4 w-4 shrink-0 text-secondary-400","aria-hidden":"true"}),jsxRuntime.jsx("input",{ref:l,value:m,onChange:N=>d(N.target.value),placeholder:n,className:"flex-1 bg-transparent py-3.5 text-sm text-primary-900 outline-none placeholder:text-secondary-400 dark:text-primary-50","aria-label":"Search commands","aria-controls":"cmd-results","aria-autocomplete":"list","aria-activedescendant":p[u]?`cmd-item-${p[u].id}`:void 0,spellCheck:false,autoComplete:"off"}),jsxRuntime.jsx("kbd",{className:"hidden shrink-0 rounded border border-primary-200 px-1.5 py-0.5 text-xs text-secondary-400 dark:border-primary-600 sm:block",children:"esc"})]}),jsxRuntime.jsx("div",{id:"cmd-results",ref:c,className:"overflow-y-auto py-2",style:{maxHeight:`${i*2.75}rem`},role:"listbox","aria-label":"Commands",children:p.length===0?jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-2 py-8 text-sm text-secondary-400",children:[jsxRuntime.jsx(lucideReact.Command,{className:"h-8 w-8 opacity-30"}),jsxRuntime.jsx("span",{children:"No commands found"})]}):f.map(N=>jsxRuntime.jsxs("div",{className:"mb-1 last:mb-0",children:[N.label&&jsxRuntime.jsx("p",{className:"px-4 pb-1 pt-2 text-xs font-semibold uppercase tracking-wide text-secondary-400 dark:text-secondary-500",children:N.label}),N.items.map(x=>{let T=b++,w=T===u;return jsxRuntime.jsxs("button",{id:`cmd-item-${x.id}`,"data-active":w,role:"option","aria-selected":w,className:s("cmd-item group flex w-full items-center gap-3 px-4 py-2.5 text-left text-sm",w?"bg-primary-100 text-primary-900 dark:bg-primary-800 dark:text-primary-50":"text-primary-700 hover:bg-primary-50 dark:text-primary-300 dark:hover:bg-primary-800/50"),onMouseEnter:()=>h(T),onClick:()=>{x.onSelect(),t(false);},children:[x.icon&&jsxRuntime.jsx("span",{className:s("flex h-7 w-7 shrink-0 items-center justify-center rounded-md border text-xs",w?"border-primary-300 bg-white text-primary-700 dark:border-primary-600 dark:bg-primary-700 dark:text-primary-200":"border-primary-200 bg-primary-50 text-primary-500 dark:border-primary-700 dark:bg-primary-800 dark:text-primary-400"),children:x.icon}),jsxRuntime.jsxs("span",{className:"min-w-0 flex-1",children:[jsxRuntime.jsx("span",{className:"block truncate font-medium",children:x.label}),x.description&&jsxRuntime.jsx("span",{className:"block truncate text-xs text-secondary-400 dark:text-secondary-500",children:x.description})]}),x.shortcut&&jsxRuntime.jsx("span",{className:"flex shrink-0 items-center gap-0.5",children:x.shortcut.map((C,S)=>jsxRuntime.jsx("kbd",{className:"rounded border border-primary-200 px-1.5 py-0.5 text-xs text-secondary-500 dark:border-primary-700 dark:text-secondary-400",children:C},S))})]},x.id)})]},N.label||"_default"))}),p.length>0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between border-t border-primary-100 px-4 py-2 dark:border-primary-700",children:[jsxRuntime.jsxs("span",{className:"text-xs text-secondary-400",children:[p.length," result",p.length!==1?"s":""]}),jsxRuntime.jsxs("span",{className:"flex items-center gap-3 text-xs text-secondary-400",children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("kbd",{className:"rounded border border-primary-200 px-1 dark:border-primary-700",children:"\u2191"}),jsxRuntime.jsx("kbd",{className:"rounded border border-primary-200 px-1 dark:border-primary-700",children:"\u2193"}),"Navigate"]}),jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("kbd",{className:"rounded border border-primary-200 px-1 dark:border-primary-700",children:"\u21B5"}),"Select"]})]})]})]})}),document.body)}var Xl={complete:"bg-success-500 border-success-500 text-white dark:bg-success-600 dark:border-success-600",active:"bg-primary-500 border-primary-500 text-white dark:bg-primary-400 dark:border-primary-400",error:"bg-danger-500 border-danger-500 text-white dark:bg-danger-600 dark:border-danger-600",pending:"bg-white border-primary-300 text-secondary-400 dark:bg-primary-800 dark:border-primary-600"},Wl={complete:"shadow-[0_0_0_4px_theme(colors.success.100)] dark:shadow-[0_0_0_4px_theme(colors.success.900/30)]",active:"shadow-[0_0_0_4px_theme(colors.primary.100)] dark:shadow-[0_0_0_4px_theme(colors.primary.800/50)] animate-pulse",error:"shadow-[0_0_0_4px_theme(colors.danger.100)] dark:shadow-[0_0_0_4px_theme(colors.danger.900/30)]",pending:""};function jl({status:e,icon:t}){return t?jsxRuntime.jsx(jsxRuntime.Fragment,{children:t}):e==="complete"?jsxRuntime.jsx(lucideReact.Check,{className:"h-3 w-3"}):e==="error"?jsxRuntime.jsx(lucideReact.AlertCircle,{className:"h-3 w-3"}):e==="active"?jsxRuntime.jsx(lucideReact.Dot,{className:"h-4 w-4"}):jsxRuntime.jsx(lucideReact.Clock,{className:"h-3 w-3"})}function Gl({images:e,title:t}){let r=e.slice(0,4),n=e.length>4?e.length-4:0,a=(i,o,l)=>jsxRuntime.jsxs("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:s("relative block overflow-hidden",l),onClick:c=>c.stopPropagation(),children:[jsxRuntime.jsx("img",{src:i,alt:`${t} ${o+1}`,className:"h-full w-full object-cover transition-transform duration-300 hover:scale-105"}),o===r.length-1&&n>0&&jsxRuntime.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/60",children:jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-white",children:["+",n]})})]},o);return r.length===0?null:r.length===1?jsxRuntime.jsx("div",{className:"mt-2.5 h-36 overflow-hidden rounded-xl",children:a(r[0],0,"h-full")}):r.length===2?jsxRuntime.jsx("div",{className:"mt-2.5 grid h-28 grid-cols-2 gap-0.5 overflow-hidden rounded-xl",children:r.map((i,o)=>a(i,o))}):r.length===3?jsxRuntime.jsxs("div",{className:"mt-2.5 grid h-36 grid-cols-2 grid-rows-2 gap-0.5 overflow-hidden rounded-xl",children:[a(r[0],0,"row-span-2"),a(r[1],1),a(r[2],2)]}):jsxRuntime.jsx("div",{className:"mt-2.5 grid h-44 grid-cols-2 grid-rows-2 gap-0.5 overflow-hidden rounded-xl",children:r.map((i,o)=>a(i,o))})}function Ul({actions:e}){let t=e.filter(o=>o.variant!=="primary"),r=e.filter(o=>o.variant==="primary"),n="inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1 text-xs font-medium text-secondary-500 transition-colors hover:bg-secondary-100/80 hover:text-secondary-700 dark:text-secondary-400 dark:hover:bg-primary-800/60 dark:hover:text-secondary-200",a="inline-flex items-center gap-1.5 rounded-lg border border-primary-200/70 bg-primary-50/80 px-3 py-1 text-xs font-semibold text-primary-700 transition-colors hover:bg-primary-100 dark:border-primary-600/60 dark:bg-primary-800/60 dark:text-primary-300 dark:hover:bg-primary-700/60",i=(o,l,c)=>o.href?jsxRuntime.jsxs("a",{href:o.href,target:"_blank",rel:"noopener noreferrer",className:c,onClick:m=>m.stopPropagation(),children:[o.icon,o.label]},l):jsxRuntime.jsxs("button",{type:"button",onClick:o.onClick,className:c,children:[o.icon,o.label]},l);return jsxRuntime.jsxs("div",{className:"mt-3 flex items-center gap-1 border-t border-primary-100/50 pt-2.5 dark:border-primary-700/40",children:[t.map((o,l)=>i(o,l,n)),r.length>0&&jsxRuntime.jsx("span",{className:"flex-1"}),r.map((o,l)=>i(o,l,a))]})}function ql({item:e,isActive:t,animated:r,visible:n,orientation:a}){let i=e.status??"pending",o={complete:"bg-gradient-to-br from-white to-success-50/40 dark:from-primary-900 dark:to-success-900/10",active:"bg-gradient-to-br from-white to-primary-50/60 dark:from-primary-900 dark:to-primary-800/40",error:"bg-gradient-to-br from-white to-danger-50/40 dark:from-primary-900 dark:to-danger-900/10",pending:"bg-white dark:bg-primary-900"}[i],l={complete:"border-success-200/70 dark:border-success-800/50",active:"border-primary-300/80 dark:border-primary-600/70",error:"border-danger-200/70 dark:border-danger-800/50",pending:"border-primary-200/60 dark:border-primary-700/50"}[i],c=t?"shadow-lg shadow-primary-300/30 dark:shadow-primary-500/20":i==="complete"?"shadow-md shadow-success-300/20 dark:shadow-success-400/10":i==="error"?"shadow-md shadow-danger-300/20 dark:shadow-danger-400/10":"shadow-sm shadow-primary-100/50 dark:shadow-black/20",m=i==="complete"?"conic-gradient(from 30deg, transparent 0%, var(--tl-glow-complete-1) 18%, var(--tl-glow-complete-2) 30%, var(--tl-holo-cyan) 44%, transparent 60%)":i==="error"?"conic-gradient(from 150deg, transparent 0%, var(--tl-glow-error-1) 18%, var(--tl-glow-error-2) 32%, var(--tl-glow-error-3) 44%, transparent 58%)":null,d={complete:"bg-success-100 text-success-700 dark:bg-success-900/40 dark:text-success-300",active:"bg-primary-100 text-primary-700 dark:bg-primary-800/60 dark:text-primary-300",error:"bg-danger-100 text-danger-700 dark:bg-danger-900/40 dark:text-danger-300",pending:"bg-secondary-100 text-secondary-600 dark:bg-primary-800/50 dark:text-secondary-400"}[i];return jsxRuntime.jsxs("div",{className:s("relative isolate",r&&"transition-all duration-700",r?n?"opacity-100 translate-y-0":a==="vertical"?"opacity-0 translate-y-6":"opacity-0 translate-x-6":"",a==="horizontal"?"w-56 shrink-0":"flex-1",e.className),children:[!t&&m&&jsxRuntime.jsx("div",{className:"pointer-events-none absolute animate-[tl-glow-pulse_5s_ease-in-out_infinite]",style:{inset:"-6px",borderRadius:"1.5rem",zIndex:-1,background:m,filter:"blur(14px)",opacity:.22},"aria-hidden":true}),t&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"pointer-events-none absolute",style:{inset:"-7px",borderRadius:"1.5rem",zIndex:-1,background:"conic-gradient(from var(--tl-angle, 0deg) at 50% 50%, var(--tl-holo-base) 0%, var(--tl-holo-indigo) 18%, var(--tl-holo-violet) 30%, var(--tl-holo-cyan) 45%, var(--tl-holo-mid) 62%, var(--tl-holo-base) 100%)",filter:"blur(10px)",animation:"tl-breathe 2.8s ease-in-out infinite, tl-holo-spin 9s linear infinite"},"aria-hidden":true}),jsxRuntime.jsx("div",{className:"pointer-events-none absolute",style:{inset:"-1.5px",borderRadius:"1.0625rem",zIndex:-1,padding:"1.5px",background:"conic-gradient(from var(--tl-angle, 0deg) at 50% 50%, transparent 0deg, var(--tl-holo-indigo) 55deg, var(--tl-holo-violet) 85deg, var(--tl-holo-cyan) 115deg, transparent 175deg, transparent 360deg)",WebkitMask:"linear-gradient(white 0 0) content-box, linear-gradient(white 0 0)",WebkitMaskComposite:"xor",maskComposite:"exclude",animation:"tl-holo-spin 5s linear infinite"},"aria-hidden":true})]}),jsxRuntime.jsx("div",{className:s("relative overflow-hidden rounded-2xl border backdrop-blur-[2px]",t?"border-transparent":s("border",l),o,c),children:e.imagePosition==="left"&&e.image?jsxRuntime.jsxs("div",{className:"flex min-h-[8rem]",children:[jsxRuntime.jsx("a",{href:e.image,target:"_blank",rel:"noopener noreferrer",className:"w-28 shrink-0 overflow-hidden",onClick:p=>p.stopPropagation(),"aria-label":e.title,children:jsxRuntime.jsx("img",{src:e.image,alt:e.title,className:"h-full w-full object-cover transition-transform duration-500 hover:scale-105"})}),jsxRuntime.jsxs("div",{className:"flex flex-1 flex-col p-4",children:[e.date&&jsxRuntime.jsx("span",{className:s("mb-2 inline-flex items-center gap-1 rounded-md px-2 py-0.5 text-[0.65rem] font-semibold tracking-wide",d),children:e.date}),jsxRuntime.jsx("h3",{className:s("text-sm font-semibold leading-snug",t?"text-primary-900 dark:text-white":"text-primary-800 dark:text-primary-100"),children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"mt-1 text-xs leading-relaxed text-secondary-500 dark:text-secondary-400",children:e.description}),e.images&&e.images.length>0&&jsxRuntime.jsx(Gl,{images:e.images,title:e.title}),e.actions&&e.actions.length>0&&jsxRuntime.jsx(Ul,{actions:e.actions})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[e.image&&jsxRuntime.jsx("div",{className:"overflow-hidden",children:jsxRuntime.jsx("img",{src:e.image,alt:e.title,className:"h-32 w-full object-cover transition-transform duration-500 hover:scale-105"})}),e.svg&&!e.image&&jsxRuntime.jsx("div",{className:"flex items-center justify-center bg-primary-50/60 p-4 dark:bg-primary-800/40",children:e.svg}),jsxRuntime.jsxs("div",{className:s("p-4",(e.image||e.svg)&&"pt-3"),children:[e.date&&jsxRuntime.jsx("span",{className:s("mb-2.5 inline-flex items-center gap-1 rounded-md px-2 py-0.5 text-[0.65rem] font-semibold tracking-wide",d),children:e.date}),jsxRuntime.jsx("h3",{className:s("text-sm font-semibold leading-snug",t?"text-primary-900 dark:text-white":"text-primary-800 dark:text-primary-100"),children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"mt-1 text-xs leading-relaxed text-secondary-500 dark:text-secondary-400",children:e.description}),e.images&&e.images.length>0&&jsxRuntime.jsx(Gl,{images:e.images,title:e.title}),e.actions&&e.actions.length>0&&jsxRuntime.jsx(Ul,{actions:e.actions})]})]})})]})}function zi({items:e,orientation:t="vertical",activeIndex:r,animated:n=true,lineStyle:a="solid",className:i}){let o=qr.useRef(null),l=qr.useRef([]),[c,m]=qr.useState(new Set);qr.useEffect(()=>{if(!n){m(new Set(e.map((p,u)=>u)));return}let f=new IntersectionObserver(p=>{m(u=>{let h=new Set(u);return p.forEach(g=>{let b=Number(g.target.dataset.idx);g.isIntersecting&&h.add(b);}),h});},{threshold:.15});return l.current.forEach(p=>p&&f.observe(p)),()=>f.disconnect()},[e,n]),qr.useEffect(()=>{if(r==null)return;let f=l.current[r];f&&f.scrollIntoView({behavior:"smooth",block:"center",inline:"center"});},[r]);let d=a==="dashed"?"border-dashed":"";return t==="vertical"?jsxRuntime.jsxs("div",{ref:o,className:s("relative",i),children:[jsxRuntime.jsx("div",{className:"absolute left-5 top-0 h-full w-px bg-primary-200 dark:bg-primary-700"}),jsxRuntime.jsx("div",{className:"space-y-6",children:e.map((f,p)=>{let u=f.status??"pending",h=p===r;return jsxRuntime.jsxs("div",{ref:g=>{l.current[p]=g;},"data-idx":p,className:"relative flex gap-4",children:[jsxRuntime.jsx("div",{className:"relative z-10 flex shrink-0 flex-col items-center",children:jsxRuntime.jsx("div",{className:s("flex h-10 w-10 items-center justify-center rounded-full border-2 transition-all duration-300 [&_svg]:shrink-0",Xl[u],h&&Wl[u]),children:jsxRuntime.jsx(jl,{status:u,icon:f.icon})})}),jsxRuntime.jsx(ql,{item:f,isActive:h,animated:n,visible:c.has(p),orientation:"vertical"})]},f.id??p)})})]}):jsxRuntime.jsx("div",{ref:o,className:s("relative overflow-x-auto pb-4",i),children:jsxRuntime.jsx("div",{className:"flex min-w-max gap-6 px-4",children:e.map((f,p)=>{let u=f.status??"pending",h=p===r,g=p===e.length-1;return jsxRuntime.jsxs("div",{ref:b=>{l.current[p]=b;},"data-idx":p,className:"relative flex flex-col items-center gap-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("div",{className:s("flex h-10 w-10 items-center justify-center rounded-full border-2 transition-all duration-300 z-10 [&_svg]:shrink-0",Xl[u],h&&Wl[u]),children:jsxRuntime.jsx(jl,{status:u,icon:f.icon})}),!g&&jsxRuntime.jsx("div",{className:s("h-px w-28 border-t-2",d,u==="complete"?"border-success-400":"border-primary-200 dark:border-primary-700")})]}),jsxRuntime.jsx(ql,{item:f,isActive:h,animated:n,visible:c.has(p),orientation:"horizontal"})]},f.id??p)})})})}function xn(e="en-US",t="long"){return Array.from({length:12},(r,n)=>new Intl.DateTimeFormat(e,{month:t}).format(new Date(2e3,n,1)))}function Ql(e="en-US",t="narrow"){let r=new Date(2e3,0,2);return Array.from({length:7},(n,a)=>{let i=new Date(r);return i.setDate(r.getDate()+a),new Intl.DateTimeFormat(e,{weekday:t}).format(i)})}function Zl(e,t=true,r=true){return e==="date"?"YYYY-MM-DD":e==="time"?t?r?"HH:mm:ss":"HH:mm":r?"hh:mm:ss A":"hh:mm A":t?r?"YYYY-MM-DD HH:mm:ss":"YYYY-MM-DD HH:mm":r?"YYYY-MM-DD hh:mm:ss A":"YYYY-MM-DD hh:mm A"}function Zf(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Jl(e,t,r="en-US"){let n=e.getHours(),a=xn(r,"long"),i=xn(r,"short"),o={YYYY:String(e.getFullYear()),YY:String(e.getFullYear()).slice(-2),MMMM:a[e.getMonth()],MMM:i[e.getMonth()],MM:String(e.getMonth()+1).padStart(2,"0"),M:String(e.getMonth()+1),DD:String(e.getDate()).padStart(2,"0"),D:String(e.getDate()),HH:String(n).padStart(2,"0"),H:String(n),hh:String(n%12||12).padStart(2,"0"),h:String(n%12||12),mm:String(e.getMinutes()).padStart(2,"0"),ss:String(e.getSeconds()).padStart(2,"0"),A:n<12?"AM":"PM",a:n<12?"am":"pm"},l=Object.keys(o).sort((m,d)=>d.length-m.length),c=new RegExp(l.map(Zf).join("|"),"g");return t.replace(c,m=>o[m]??m)}function Ar(e,t){return new Date(e,t+1,0).getDate()}function ec(e,t){let r=new Date(e,t,1).getDay(),n=Ar(e,t),a=Ar(e,t-1),i=[];for(let l=r-1;l>=0;l--)i.push({date:new Date(e,t-1,a-l),thisMonth:false});for(let l=1;l<=n;l++)i.push({date:new Date(e,t,l),thisMonth:true});let o=42-i.length;for(let l=1;l<=o;l++)i.push({date:new Date(e,t+1,l),thisMonth:false});return i}function Hr(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())}function Bi(e,t){return Hr(e).getTime()===Hr(t).getTime()}function tc(e,t){return Hr(e)<Hr(t)}function rc(e,t){return Hr(e)>Hr(t)}function Ia(e,t,r){return t&&e<t?new Date(t):r&&e>r?new Date(r):e}function nc(e,t,r,n){let a=new Date(e),o=t*(n==="future"?1:-1);switch(r){case "day":a.setDate(a.getDate()+o);break;case "week":a.setDate(a.getDate()+o*7);break;case "month":a.setMonth(a.getMonth()+o);break;case "year":a.setFullYear(a.getFullYear()+o);break}return a}function ac(e,t=200){let r=e-Math.floor(t/2);return Array.from({length:t},(n,a)=>r+a)}function oc(e){let{value:t,defaultValue:r,onChange:n,mode:a="datetime",minDate:i,maxDate:o,use24Hour:l=true,showSeconds:c=true,locale:m="en-US",format:d,onOpen:f,onClose:p}=e,u=t!==void 0,[h,g]=qr.useState(r??null),b=u?t??null:h,[N,x]=qr.useState(false),[T,w]=qr.useState(()=>b??new Date),[C,S]=qr.useState("drum"),[R,V]=qr.useState(()=>(b??new Date).getFullYear()),[I,E]=qr.useState(()=>(b??new Date).getMonth()),[v,U]=qr.useState(1),[k,q]=qr.useState("day"),[M,W]=qr.useState("future"),$=d??Zl(a,l,c),ue=b?Jl(b,$,m):"",J=qr.useCallback(()=>{let y=b??new Date;w(new Date(y)),V(y.getFullYear()),E(y.getMonth()),S("drum"),x(true),f?.();},[b,f]),de=qr.useCallback(()=>{x(false),p?.();},[p]),re=qr.useCallback(()=>{let y=Ia(T,i,o);u||g(y),n?.(y),de();},[T,i,o,u,n,de]),B=qr.useCallback(()=>{u||g(null),n?.(null),de();},[u,n,de]),j=qr.useCallback((y,L)=>{w(G=>{let O=new Date(G);switch(y){case "year":O.setFullYear(L);break;case "month":{O.setMonth(L);let _=Ar(O.getFullYear(),L);O.getDate()>_&&O.setDate(_);break}case "day":O.setDate(L);break;case "hour":O.setHours(L);break;case "minute":O.setMinutes(L);break;case "second":O.setSeconds(L);break}return Ia(O,i,o)});},[i,o]),pe=qr.useCallback(()=>{let y=Ia(nc(new Date,v,k,M),i,o);w(y),V(y.getFullYear()),E(y.getMonth());},[v,k,M,i,o]),ye=qr.useCallback(y=>{let L=I+y,G=R;L<0&&(L=11,G--),L>11&&(L=0,G++),E(L),V(G);},[I,R]);return {isOpen:N,displayValue:ue,workingDate:T,view:C,calYear:R,calMonth:I,offsetAmount:v,offsetUnit:k,offsetDirection:M,mode:a,use24Hour:l,showSeconds:c,locale:m,minDate:i,maxDate:o,openPicker:J,closePicker:de,confirm:re,clear:B,updateField:j,setView:S,setCalYear:V,setCalMonth:E,setOffsetAmount:U,setOffsetUnit:q,setOffsetDirection:W,applyQuickOffset:pe,navigateCalendar:ye}}var wn=40;function lc(e,t,r=true){let n=qr.useRef(t);n.current=t,qr.useEffect(()=>{if(!r)return;function a(i){let o=i.target;e.some(c=>c.current?.contains(o))||n.current();}return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[e,r]);}function cc(e,t,r){let n=qr.useRef(false),a=qr.useRef(void 0),i=qr.useRef(r);i.current=r;let o=qr.useRef(t);o.current=t;let l=qr.useCallback((m,d="smooth")=>{let f=e.current;if(!f)return;let p=m*wn;Math.abs(f.scrollTop-p)<2&&d!=="instant"||(d==="instant"?f.scrollTop=p:f.scrollTo({top:p,behavior:d}));},[e]),c=qr.useCallback(()=>{e.current&&(n.current=true,clearTimeout(a.current),a.current=setTimeout(()=>{n.current=false;let d=e.current;if(!d)return;let f=Math.round(d.scrollTop/wn),p=Math.max(0,Math.min(o.current-1,f)),u=p*wn;Math.abs(d.scrollTop-u)>1&&d.scrollTo({top:u,behavior:"smooth"}),i.current(p);},120));},[e]);return {scrollToIndex:l,handleScroll:c,isScrollingRef:n}}function dc(e,t,r){qr.useEffect(()=>{if(!r)return;function n(){let i=e.current,o=t.current;if(!i||!o)return;if(window.innerWidth<=640){o.style.top="",o.style.left="";return}let l=i.getBoundingClientRect(),c=window.innerHeight,m=window.innerWidth,d=o.offsetHeight||460,f=o.offsetWidth||340,p=l.bottom+8,u=l.left;p+d>c-16&&(p=Math.max(16,l.top-d-8)),u+f>m-16&&(u=Math.max(16,m-f-16)),u<16&&(u=16),o.style.top=`${Math.round(p)}px`,o.style.left=`${Math.round(u)}px`;}let a=setTimeout(n,0);return window.addEventListener("resize",n),window.addEventListener("scroll",n,true),()=>{clearTimeout(a),window.removeEventListener("resize",n),window.removeEventListener("scroll",n,true);}},[r,e,t]);}function Yt({items:e,selectedValue:t,onSelect:r,label:n}){let a=qr.useRef(null),i=qr.useRef(t),o=qr.useRef(false),{scrollToIndex:l,handleScroll:c}=cc(a,e.length,m=>{let d=e[m];d&&(o.current=true,r(d.value),setTimeout(()=>{o.current=false;},200));});return qr.useEffect(()=>{let m=a.current;if(!m)return;let d=e.findIndex(f=>f.value===t);d>=0&&(m.scrollTop=d*wn);},[]),qr.useEffect(()=>{if(i.current!==t&&(i.current=t,!o.current)){let m=e.findIndex(d=>d.value===t);m>=0&&l(m,"smooth");}},[t,e,l]),jsxRuntime.jsxs("div",{className:"dtp-column",role:"group","aria-label":n,children:[jsxRuntime.jsx("div",{className:"dtp-column-highlight","aria-hidden":"true"}),jsxRuntime.jsx("div",{ref:a,className:"dtp-column-list",onScroll:c,role:"listbox","aria-label":n,children:e.map(m=>jsxRuntime.jsx("div",{className:s("dtp-item",m.value===t&&"dtp-item--selected"),onClick:()=>{let d=e.findIndex(f=>f.value===m.value);d>=0&&l(d,"smooth"),r(m.value);},role:"option","aria-selected":m.value===t,children:m.label},m.value))}),jsxRuntime.jsx("div",{className:"dtp-fade-top","aria-hidden":"true"}),jsxRuntime.jsx("div",{className:"dtp-fade-bottom","aria-hidden":"true"})]})}function ag({year:e,month:t,selectedDate:r,today:n,minDate:a,maxDate:i,locale:o,onSelectDay:l,onPrev:c,onNext:m}){let d=Ql(o,"narrow"),f=xn(o,"long"),p=ec(e,t);return jsxRuntime.jsxs("div",{className:"dtp-calendar",children:[jsxRuntime.jsxs("div",{className:"dtp-cal-nav",children:[jsxRuntime.jsx("button",{type:"button",className:"dtp-cal-nav-btn",onClick:c,"aria-label":"Previous month",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"h-4 w-4"})}),jsxRuntime.jsxs("span",{className:"dtp-cal-title",children:[f[t]," ",e]}),jsxRuntime.jsx("button",{type:"button",className:"dtp-cal-nav-btn",onClick:m,"aria-label":"Next month",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"h-4 w-4"})})]}),jsxRuntime.jsx("div",{className:"dtp-cal-weekdays",role:"row",children:d.map((u,h)=>jsxRuntime.jsx("div",{className:"dtp-cal-weekday",role:"columnheader","aria-label":u,children:u},h))}),jsxRuntime.jsx("div",{className:"dtp-cal-days",role:"grid",children:p.map(({date:u,thisMonth:h},g)=>{let b=Bi(u,r),N=Bi(u,n),x=a!=null&&tc(u,a)||i!=null&&rc(u,i);return jsxRuntime.jsx("button",{type:"button",role:"gridcell",className:s("dtp-cal-day",!h&&"dtp-cal-day--other",b&&"dtp-cal-day--selected",N&&!b&&"dtp-cal-day--today",x&&"dtp-cal-day--disabled"),onClick:()=>!x&&l(u),disabled:x,"aria-current":N?"date":void 0,"aria-selected":b,"aria-disabled":x,children:u.getDate()},g)})})]})}function og({amount:e,unit:t,direction:r,onAmountChange:n,onUnitChange:a,onDirectionChange:i,onApply:o,locale:l}){let c=l.startsWith("zh"),m=[{value:"day",label:c?"\u5929":"Day"},{value:"week",label:c?"\u5468":"Week"},{value:"month",label:c?"\u6708":"Month"},{value:"year",label:c?"\u5E74":"Year"}],d=[{value:"future",label:c?"\u4EE5\u540E":"from now"},{value:"past",label:c?"\u4EE5\u524D":"before now"}];return jsxRuntime.jsxs("div",{className:"dtp-quick-offset","aria-label":c?"\u5FEB\u901F\u504F\u79FB":"Quick offset",children:[jsxRuntime.jsx("input",{type:"number",className:"dtp-offset-input",value:e,min:1,max:9999,"aria-label":c?"\u504F\u79FB\u6570\u91CF":"Offset amount",onChange:f=>{let p=parseInt(f.target.value,10);!isNaN(p)&&p>=1&&n(p);}}),jsxRuntime.jsx("select",{className:"dtp-offset-select",value:t,"aria-label":c?"\u504F\u79FB\u5355\u4F4D":"Offset unit",onChange:f=>a(f.target.value),children:m.map(f=>jsxRuntime.jsx("option",{value:f.value,children:f.label},f.value))}),jsxRuntime.jsx("select",{className:"dtp-offset-select",value:r,"aria-label":c?"\u504F\u79FB\u65B9\u5411":"Offset direction",onChange:f=>i(f.target.value),children:d.map(f=>jsxRuntime.jsx("option",{value:f.value,children:f.label},f.value))}),jsxRuntime.jsx("button",{type:"button",className:"dtp-offset-apply",onClick:o,children:c?"\u5E94\u7528":"Apply"})]})}function Aa({className:e,popupClassName:t,triggerClassName:r,disabled:n=false,placeholder:a,...i}){let{isOpen:o,displayValue:l,workingDate:c,view:m,calYear:d,calMonth:f,offsetAmount:p,offsetUnit:u,offsetDirection:h,mode:g,use24Hour:b,showSeconds:N,locale:x,minDate:T,maxDate:w,openPicker:C,closePicker:S,confirm:R,clear:V,updateField:I,setView:E,setCalYear:v,setCalMonth:U,setOffsetAmount:k,setOffsetUnit:q,setOffsetDirection:M,applyQuickOffset:W,navigateCalendar:$}=oc({...i}),ue=qr.useRef(null),J=qr.useRef(null),de=new Date;lc([ue,J],S,o),dc(ue,J,o);let re=x.startsWith("zh"),B={cancel:re?"\u53D6\u6D88":"Cancel",confirm:re?"\u786E\u5B9A":"Confirm",calendarView:re?"\u65E5\u5386":"Calendar",scrollView:re?"\u6EDA\u8F6E":"Scroll",placeholder:a??(re?"\u9009\u62E9\u65E5\u671F\u65F6\u95F4":"Select date / time")},j=g==="date"||g==="datetime",pe=g==="time"||g==="datetime",ye=ac(c.getFullYear(),200).map(X=>({label:String(X),value:X})),y=xn(x,"short").map((X,fe)=>({label:X,value:fe})),L=Ar(c.getFullYear(),c.getMonth()),G=Array.from({length:L},(X,fe)=>({label:String(fe+1).padStart(2,"0"),value:fe+1})),O=Array.from({length:24},(X,fe)=>({label:String(fe).padStart(2,"0"),value:fe})),_=Array.from({length:12},(X,fe)=>({label:String(fe===0?12:fe).padStart(2,"0"),value:fe})),ee=[{label:"AM",value:0},{label:"PM",value:1}],xe=Array.from({length:60},(X,fe)=>({label:String(fe).padStart(2,"0"),value:fe})),P=c.getHours(),F=P%12,K=P<12?0:1,oe=pe&&!j?lucideReact.Clock:lucideReact.Calendar;return jsxRuntime.jsxs("div",{className:s("dtp-root",e),children:[jsxRuntime.jsxs("div",{className:"dtp-trigger-wrap",children:[jsxRuntime.jsxs("button",{ref:ue,type:"button",className:s("dtp-trigger",l&&"dtp-trigger--has-clear",n&&"dtp-trigger--disabled",r),onClick:()=>!n&&(o?S():C()),disabled:n,"aria-haspopup":"dialog","aria-expanded":o,children:[jsxRuntime.jsx(oe,{className:"dtp-trigger-icon","aria-hidden":"true"}),jsxRuntime.jsx("span",{className:s("dtp-trigger-text",!l&&"dtp-trigger-placeholder"),children:l||B.placeholder})]}),l&&jsxRuntime.jsx("button",{type:"button",className:"dtp-trigger-clear","aria-label":re?"\u6E05\u9664":"Clear value",onClick:()=>!n&&V(),children:jsxRuntime.jsx(lucideReact.X,{className:"h-3.5 w-3.5"})})]}),o&&reactDom.createPortal(jsxRuntime.jsxs("div",{ref:J,className:s("dtp-panel",t),role:"dialog","aria-modal":"true","aria-label":re?"\u65E5\u671F\u65F6\u95F4\u9009\u62E9\u5668":"Date time picker",children:[jsxRuntime.jsxs("div",{className:"dtp-panel-header",children:[jsxRuntime.jsx("span",{className:"dtp-panel-preview",children:l||B.placeholder}),jsxRuntime.jsx("div",{className:"dtp-panel-actions",children:j&&jsxRuntime.jsx("button",{type:"button",className:s("dtp-view-btn",m==="calendar"&&"dtp-view-btn--active"),"aria-pressed":m==="calendar",title:m==="calendar"?B.scrollView:B.calendarView,onClick:()=>{m!=="calendar"&&(v(c.getFullYear()),U(c.getMonth())),E(m==="calendar"?"drum":"calendar");},children:jsxRuntime.jsx(lucideReact.Calendar,{className:"h-4 w-4"})})})]}),jsxRuntime.jsx("div",{className:"dtp-panel-body",children:m==="drum"?jsxRuntime.jsxs("div",{className:"dtp-drum",children:[j&&jsxRuntime.jsxs("div",{className:"dtp-drum-date",children:[jsxRuntime.jsx(Yt,{label:re?"\u5E74":"Year",items:ye,selectedValue:c.getFullYear(),onSelect:X=>I("year",X)}),jsxRuntime.jsx(Yt,{label:re?"\u6708":"Month",items:y,selectedValue:c.getMonth(),onSelect:X=>I("month",X)}),jsxRuntime.jsx(Yt,{label:re?"\u65E5":"Day",items:G,selectedValue:c.getDate(),onSelect:X=>I("day",X)})]}),j&&pe&&jsxRuntime.jsx("div",{className:"dtp-drum-sep","aria-hidden":"true"}),pe&&jsxRuntime.jsxs("div",{className:"dtp-drum-time",children:[b?jsxRuntime.jsx(Yt,{label:re?"\u65F6":"Hour",items:O,selectedValue:P,onSelect:X=>I("hour",X)}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Yt,{label:re?"\u65F6":"Hour",items:_,selectedValue:F,onSelect:X=>{I("hour",K===1?X+12:X);}}),jsxRuntime.jsx(Yt,{label:"AM/PM",items:ee,selectedValue:K,onSelect:X=>{I("hour",F+(X===1?12:0));}})]}),jsxRuntime.jsx(Yt,{label:re?"\u5206":"Min",items:xe,selectedValue:c.getMinutes(),onSelect:X=>I("minute",X)}),N&&jsxRuntime.jsx(Yt,{label:re?"\u79D2":"Sec",items:xe,selectedValue:c.getSeconds(),onSelect:X=>I("second",X)})]})]}):jsxRuntime.jsx(ag,{year:d,month:f,selectedDate:c,today:de,minDate:T,maxDate:w,locale:x,onSelectDay:X=>{I("year",X.getFullYear()),I("month",X.getMonth()),I("day",X.getDate()),E("drum");},onPrev:()=>$(-1),onNext:()=>$(1)})}),j&&jsxRuntime.jsx("div",{className:"dtp-panel-offset",children:jsxRuntime.jsx(og,{amount:p,unit:u,direction:h,onAmountChange:k,onUnitChange:q,onDirectionChange:M,onApply:W,locale:x})}),jsxRuntime.jsxs("div",{className:"dtp-panel-footer",children:[jsxRuntime.jsx("button",{type:"button",className:"dtp-btn-cancel",onClick:S,children:B.cancel}),jsxRuntime.jsx("button",{type:"button",className:"dtp-btn-confirm",onClick:R,children:B.confirm})]})]}),document.body)]})}var sg={FilmReel:ki,MiniPlayer:Ci,CinePlayer:Mi,FileExplorer:Ei,Masonry:Hi,TypewriterText:La,CommandPalette:Va,Timeline:zi,DateTimePicker:Aa},Oi=sg;var uc=classVarianceAuthority.cva("w-full",{variants:{intent:{default:"",card:"rounded-(--form-radius) border border-primary-200 bg-white p-6 shadow-sm dark:border-primary-700 dark:bg-primary-900",inset:"rounded-(--form-radius) bg-primary-50 p-6 dark:bg-primary-800/50"},size:{sm:"",md:"",lg:""}},defaultVariants:{intent:"default",size:"md"}});classVarianceAuthority.cva("flex w-full",{variants:{layout:{stacked:"flex-col gap-1.5",inline:"flex-row items-start gap-(--form-item-gap-md)"},size:{sm:"",md:"",lg:""}},defaultVariants:{layout:"stacked",size:"md"}});var fc=classVarianceAuthority.cva("mt-1 flex items-center gap-1 text-xs [&_svg]:h-3.5 [&_svg]:w-3.5 [&_svg]:shrink-0",{variants:{status:{error:"text-danger-600 dark:text-danger-400",warning:"text-warning-600 dark:text-warning-400",success:"text-success-600 dark:text-success-400",hint:"text-primary-400 dark:text-primary-500"}},defaultVariants:{status:"hint"}});var Ki=qr.createContext({layout:"stacked",size:"md",labelWidth:"var(--form-label-w-md, 7rem)",bulkErrors:{}}),fg={sm:"var(--form-label-w-sm, 5rem)",md:"var(--form-label-w-md, 7rem)",lg:"var(--form-label-w-lg, 9rem)"},yc={sm:"gap-(--form-row-gap-sm)",md:"gap-(--form-row-gap-md)",lg:"gap-(--form-row-gap-lg)"};function Xi({children:e,className:t,intent:r,size:n="md",layout:a="stacked",title:i,description:o,footer:l,onValues:c,onSubmit:m,...d}){let f=fg[n??"md"],[p,u]=qr.useState({}),h=qr.useCallback(g=>{if(g.preventDefault(),m?.(g),c){let b=Object.fromEntries(new FormData(g.currentTarget).entries()),N=c(b,g),x=T=>{if(!T)return;let w={};for(let[C,{result:S,reason:R}]of Object.entries(T))R&&(w[C]={status:S?"success":"error",message:R});u(w);};N instanceof Promise?N.then(x).catch(()=>{}):x(N);}},[m,c]);return jsxRuntime.jsx(Ki.Provider,{value:{layout:a??"stacked",size:n??"md",labelWidth:f,bulkErrors:p},children:jsxRuntime.jsxs("form",{className:s(uc({intent:r,size:n}),"flex flex-col",t),onSubmit:h,...d,children:[(i||o)&&jsxRuntime.jsxs("div",{className:"mb-(--form-header-mb)",children:[i&&jsxRuntime.jsx("h2",{className:"text-base font-semibold text-primary-900 dark:text-primary-100",children:i}),o&&jsxRuntime.jsx("p",{className:"mt-1 text-xs text-primary-500 dark:text-primary-400",children:o})]}),jsxRuntime.jsx("div",{className:s("flex flex-col",yc[n??"md"]),children:e}),l&&jsxRuntime.jsx("div",{className:"mt-(--form-footer-pt) flex flex-wrap items-center justify-end gap-(--form-footer-gap) border-t border-primary-200 pt-(--form-footer-pt) dark:border-primary-700",children:l})]})})}var gg={error:jsxRuntime.jsx(lucideReact.AlertCircle,{}),warning:jsxRuntime.jsx(lucideReact.AlertTriangle,{}),success:jsxRuntime.jsx(lucideReact.CheckCircle,{}),hint:jsxRuntime.jsx(lucideReact.Info,{})};function bg({label:e,layout:t,required:r,hint:n,validation:a,name:i,onValidate:o,className:l,children:c}){let m=qr.useContext(Ki),d=qr.useId(),[f,p]=qr.useState(void 0),u=i?m.bulkErrors[i]:void 0,h=a??f??u,b=(t??m.layout)==="inline",N=qr.useCallback(S=>{let R=S!=null&&typeof S=="object"&&"target"in S?S.target.value:S;if(i&&m.bulkErrors[i]&&(m.bulkErrors[i]=void 0),!o){p(void 0);return}let{result:V,reason:I}=o(R);p(I?{status:V?"success":"error",message:I}:void 0);},[o,i,m.bulkErrors]),x=h?`${d}-validation`:n?`${d}-hint`:void 0,T=qr__default.default.Children.map(c,(S,R)=>{if(R!==0||!qr__default.default.isValidElement(S))return S;let V=S,I={};if(V.props.id||(I.id=d),x&&!V.props["aria-describedby"]&&(I["aria-describedby"]=x),h?.status==="error"&&!V.props["aria-invalid"]&&(I["aria-invalid"]=true),i&&!V.props.name&&(I.name=i),o){let E=V.props.onChange;I.onChange=v=>{E?.(v),N(v);};}return Object.keys(I).length?qr__default.default.cloneElement(V,I):S}),w=e!=null&&jsxRuntime.jsx("label",{htmlFor:d,className:s("shrink-0 text-sm font-medium","text-primary-700 dark:text-primary-300",r&&"after:ml-0.5 after:text-danger-500 after:content-['*']",b&&"pt-1.75"),style:b?{width:m.labelWidth,minWidth:m.labelWidth}:void 0,children:e}),C=a?`${d}-validation`:n?`${d}-hint`:void 0;return jsxRuntime.jsxs("div",{className:s("flex w-full flex-col gap-1.5",b&&"md:flex-row md:items-start md:gap-(--form-item-gap-md)",l),children:[w,jsxRuntime.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[T,h&&jsxRuntime.jsxs("p",{id:`${d}-validation`,className:s(fc({status:h.status})),role:h.status==="error"?"alert":void 0,children:[gg[h.status],jsxRuntime.jsx("span",{children:h.message})]}),n&&jsxRuntime.jsx("p",{id:C===`${d}-hint`?C:void 0,className:"mt-1 text-xs text-primary-400 dark:text-primary-500",children:n})]})]})}function hg({title:e,description:t,className:r,children:n}){let{size:a}=qr.useContext(Ki);return jsxRuntime.jsxs("fieldset",{className:s("flex flex-col rounded-(--form-radius) border border-primary-200 p-4 dark:border-primary-700",yc[a],r),children:[(e||t)&&jsxRuntime.jsxs("legend",{className:"px-1.5 pb-1",children:[e&&jsxRuntime.jsx("span",{className:"text-sm font-semibold text-primary-700 dark:text-primary-300",children:e}),t&&jsxRuntime.jsx("span",{className:"ml-2 text-xs text-primary-400 dark:text-primary-500",children:t})]}),n]})}var yg={Form:Xi},Wi=yg;var Nt=classVarianceAuthority.cva("relative w-full font-sans select-none",{variants:{size:{sm:"text-xs",md:"text-sm",lg:"text-base"}},defaultVariants:{size:"md"}}),Ct=classVarianceAuthority.cva("flex flex-wrap gap-3 items-center justify-center",{variants:{position:{top:"mb-3",bottom:"mt-3",left:"flex-col mr-4",right:"flex-col ml-4"}},defaultVariants:{position:"bottom"}}),Tt=classVarianceAuthority.cva("absolute z-50 pointer-events-none px-3 py-2 rounded-lg text-xs shadow-lg border transition-opacity duration-150 bg-primary-900 text-primary-50 border-primary-700 dark:bg-primary-950 dark:border-primary-800");function Kt(e){let[t,r]=qr.useState(()=>new Set(e)),n=qr.useCallback(o=>{r(l=>{let c=new Set(l);return c.has(o)?c.delete(o):c.add(o),c});},[]),a=qr.useCallback(o=>t.has(o),[t]),i=qr.useCallback(()=>{r(new Set(e));},[e]);return {visible:t,toggle:n,isVisible:a,showAll:i}}function Xt(e){let t=["var(--color-chart-1)","var(--color-chart-2)","var(--color-chart-3)","var(--color-chart-4)","var(--color-chart-5)","var(--color-chart-6)","var(--color-chart-7)","var(--color-chart-8)"];return Array.from({length:e},(r,n)=>t[n%t.length])}function Wt(e,t,r=.1){if(e===t)return [e-1,t+1];let a=(t-e)*r;return [Math.floor(e-a),Math.ceil(t+a)]}function Fr(e,t,r){if(r<=1)return [e];let n=(t-e)/(r-1);return Array.from({length:r},(a,i)=>+(e+i*n).toFixed(10))}function Ie(e,t){return t?t(e):typeof e=="number"?Math.abs(e)>=1e6?`${(e/1e6).toFixed(1)}M`:Math.abs(e)>=1e3?`${(e/1e3).toFixed(1)}K`:Number.isInteger(e)?e.toString():e.toFixed(2):String(e)}function ct(e,t,r,n){let a=(n-90)*Math.PI/180;return {x:e+r*Math.cos(a),y:t+r*Math.sin(a)}}function jt(e,t,r){return {top:20,right:r?65:20,bottom:e?52:36,left:t?65:52}}function Gt(e,t,r){let n=Math.max(e,120);return {width:n,height:t,margins:r,plotLeft:r.left,plotTop:r.top,plotRight:n-r.right,plotBottom:t-r.bottom,plotWidth:Math.max(n-r.left-r.right,10),plotHeight:Math.max(t-r.top-r.bottom,10)}}function xc(e,t){let r=new Set,n=[];for(let a of e)if(t.has(a.id))for(let i of a.data){let o=String(i.x);r.has(o)||(r.add(o),n.push(o));}return n}function Ui(e,t,r){let n=1/0,a=-1/0;for(let l of e)if(t.has(l.id))for(let c of l.data)c.y<n&&(n=c.y),c.y>a&&(a=c.y);if(!isFinite(n))return [0,1];let[i,o]=Wt(n,a);return [r?.min??i,r?.max??o]}function Ha(e,t){let[r,n]=e,[a,i]=t;return n===r?()=>(a+i)/2:o=>a+(o-r)/(n-r)*(i-a)}function Fa(e,t){let r=e.length;if(r===0)return ()=>(t[0]+t[1])/2;let n=(t[1]-t[0])/r;return a=>{let i=e.indexOf(a);return i<0?(t[0]+t[1])/2:t[0]+i*n+n/2}}function vc(e,t,r){return e.map(n=>`${t(n.x).toFixed(2)},${r(n.y).toFixed(2)}`).join(" ")}function qi(e,t,r){if(e.length===0)return "";let n=e.map(o=>({x:t(o.x),y:r(o.y)}));if(n.length===1)return `M ${n[0].x.toFixed(2)} ${n[0].y.toFixed(2)}`;let a=.5,i=`M ${n[0].x.toFixed(2)} ${n[0].y.toFixed(2)}`;for(let o=0;o<n.length-1;o++){let l=o===0?{x:2*n[0].x-n[1].x,y:2*n[0].y-n[1].y}:n[o-1],c=n[o],m=n[o+1],d=o+2<n.length?n[o+2]:{x:2*n[n.length-1].x-n[n.length-2].x,y:2*n[n.length-1].y-n[n.length-2].y},f=c.x+(m.x-l.x)*a/3,p=c.y+(m.y-l.y)*a/3,u=m.x-(d.x-c.x)*a/3,h=m.y-(d.y-c.y)*a/3;i+=` C ${f.toFixed(2)} ${p.toFixed(2)}, ${u.toFixed(2)} ${h.toFixed(2)}, ${m.x.toFixed(2)} ${m.y.toFixed(2)}`;}return i}function wc(e,t,r,n,a){if(e.length===0)return "";let i=n?qi(e,t,r):`M ${e.map(c=>`${t(c.x).toFixed(2)},${r(c.y).toFixed(2)}`).join(" L ")}`,o=t(e[e.length-1].x).toFixed(2),l=t(e[0].x).toFixed(2);return `${i} L ${o},${a.toFixed(2)} L ${l},${a.toFixed(2)} Z`}function _a(e,t=5){return Fr(e[0],e[1],t)}function Qi(e,t,r){if(t.length===0)return -1;let n=1/0,a=0;for(let i=0;i<t.length;i++){let o=Math.abs(r(t[i])-e);o<n&&(n=o,a=i);}return a}function Zi(e,t){return e.data.find(r=>String(r.x)===t)?.y}function kc(e){for(let t of e)for(let r of t.data)if(typeof r.x=="string")return true;return false}function za({items:e,position:t,onToggle:r}){return jsxRuntime.jsx("div",{className:Ct({position:t}),children:e.map(n=>jsxRuntime.jsxs("button",{onClick:()=>r(n.id),className:s("flex items-center gap-1.5 cursor-pointer rounded px-1.5 py-1 text-xs text-primary-700 transition-opacity hover:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-800",!n.visible&&"opacity-40"),"aria-pressed":n.visible,children:[jsxRuntime.jsx("span",{className:"h-2.5 w-5 rounded-sm shrink-0",style:{background:n.color}}),n.label]},n.id))})}function ts({series:e,xAxis:t,yAxis:r,y2Axis:n,y2Series:a=[],smooth:i=false,showDots:o=true,area:l=false,strokeWidth:c=2,title:m,height:d=300,className:f,legend:p=true,legendPosition:u="bottom",animateOnMount:h=true,emptyText:g="No data to display"}){let b=qr.useRef(null),N=qr.useRef(null),[x,T]=qr.useState(600),[w,C]=qr.useState(null),[S,R]=qr.useState(null);qr.useEffect(()=>{let P=N.current;if(!P)return;let F=P.getBoundingClientRect().width;F>0&&T(F);let K=new ResizeObserver(oe=>{let X=oe[0]?.contentRect.width;X&&X>0&&T(X);});return K.observe(P),()=>K.disconnect()},[]);let V=qr.useMemo(()=>e.map(P=>P.id),[e]),{visible:I,toggle:E,isVisible:v}=Kt(V),U=qr.useMemo(()=>Xt(e.length),[e.length]),k=qr.useMemo(()=>new Map(e.map((P,F)=>[P.id,P.color??U[F]])),[e,U]),q=qr.useMemo(()=>jt(!!t?.label,!!r?.label,!!n),[t?.label,r?.label,n]),M=qr.useMemo(()=>Gt(x,d,q),[x,d,q]),W=qr.useMemo(()=>kc(e),[e]),$=qr.useMemo(()=>W?xc(e,I):[],[e,I,W]),ue=qr.useMemo(()=>{if(W){let X=Fa($,[M.plotLeft,M.plotRight]);return fe=>X(fe)}let P=e.flatMap(X=>X.data.map(fe=>fe.x));if(P.length===0)return ()=>M.plotLeft;let F=Math.min(...P),K=Math.max(...P),oe=Ha([F,K],[M.plotLeft,M.plotRight]);return X=>oe(X)},[e,W,$,M]),J=qr.useMemo(()=>Ui(e,I,r),[e,I,r]),de=qr.useMemo(()=>Ha(J,[M.plotBottom,M.plotTop]),[J,M]),re=qr.useMemo(()=>_a(J,r?.tickCount??5),[J,r?.tickCount]),B=qr.useMemo(()=>{if(!n)return null;let P=e.filter(F=>a.includes(F.id));return Ui(P,I,n)},[n,e,a,I]),j=qr.useMemo(()=>B?Ha(B,[M.plotBottom,M.plotTop]):null,[B,M]),pe=qr.useMemo(()=>B?_a(B,n?.tickCount??5):[],[B,n?.tickCount]),ye=qr.useMemo(()=>{if(W)return $;let P=e.flatMap(oe=>oe.data.map(X=>Number(X.x)));if(P.length===0)return [];let F=Math.min(...P),K=Math.max(...P);return _a([F,K],t?.tickCount??6)},[W,$,e,t?.tickCount]),y=qr.useCallback(P=>{let F=P.currentTarget.closest("svg");if(!F)return;let K=F.getBoundingClientRect(),oe=P.clientX-K.left,X=b.current?.getBoundingClientRect();if(!X)return;let fe="",we=oe;if(W&&$.length>0){let Q=Fa($,[M.plotLeft,M.plotRight]),ke=Qi(oe,$,Q);fe=$[ke]??"",we=Q(fe);}else if(!W){let Q=ye;fe=Ie((oe-M.plotLeft)/M.plotWidth*(Q[Q.length-1]-Q[0])+Q[0],t?.format),we=oe;}let H=e.filter(Q=>v(Q.id)).map(Q=>{a.includes(Q.id)&&j!=null?j:de;let Fe;if(W)Fe=Zi(Q,fe);else {let Z=oe,Ne=1/0,A;for(let ae of Q.data){let se=ue(ae.x),z=Math.abs(se-Z);z<Ne&&(Ne=z,A=ae.y);}Fe=A;}return {name:Q.name,value:Fe!==void 0?Ie(Fe,r?.format):"\u2014",color:k.get(Q.id)??"var(--color-chart-1)"}});we>=M.plotLeft&&we<=M.plotRight&&R(we);let ne=P.clientX-X.left+12,Y=P.clientY-X.top-10;C({x:ne,y:Y,label:fe,items:H});},[W,$,M,e,v,a,j,de,ue,ye,t?.format,r?.format,k]),L=qr.useCallback(()=>{C(null),R(null);},[]),G=qr.useCallback(P=>{P.preventDefault();let F=P.touches[0];if(!F)return;let K=P.currentTarget.closest("svg");if(!K)return;let oe=K.getBoundingClientRect(),X=b.current?.getBoundingClientRect();if(!X)return;let fe=F.clientX-oe.left,we=fe,H="";if(W&&$.length>0){let Y=Fa($,[M.plotLeft,M.plotRight]),Q=Qi(fe,$,Y);H=$[Q]??"",we=Y(H);}we>=M.plotLeft&&we<=M.plotRight&&R(we);let ne=e.filter(Y=>v(Y.id)).map(Y=>({name:Y.name,value:W&&H?Ie(Zi(Y,H)??0,r?.format):"\u2014",color:k.get(Y.id)??"var(--color-chart-1)"}));C({x:F.clientX-X.left+12,y:F.clientY-X.top-10,label:H,items:ne});},[W,$,M,e,v,r?.format,k]),O=qr.useMemo(()=>e.map((P,F)=>({id:P.id,label:P.name,color:P.color??U[F],visible:v(P.id)})),[e,U,v]),_=e.some(P=>P.data.length>0),ee=jsxRuntime.jsxs("svg",{role:"img","aria-label":m??"Line chart",width:M.width,height:M.height,viewBox:`0 0 ${M.width} ${M.height}`,shapeRendering:"geometricPrecision",children:[r?.gridLines!==false&&re.map(P=>{let F=de(P);return jsxRuntime.jsx("line",{x1:M.plotLeft,x2:M.plotRight,y1:F,y2:F,stroke:"currentColor",strokeWidth:.5,strokeDasharray:"4 4",className:"text-secondary-200 dark:text-secondary-700"},P)}),l&&e.map(P=>{if(!v(P.id)||P.data.length===0)return null;let K=a.includes(P.id)&&j!=null?j:de,oe=k.get(P.id)??"var(--color-chart-1)",X=wc(P.data,ue,K,i,M.plotBottom);return jsxRuntime.jsx("path",{d:X,fill:oe,fillOpacity:.15,stroke:"none",className:h?"chart-area-animate":""},`area-${P.id}`)}),e.map(P=>{if(!v(P.id)||P.data.length===0)return null;let K=a.includes(P.id)&&j!=null?j:de,oe=k.get(P.id)??"var(--color-chart-1)";return i?jsxRuntime.jsx("path",{d:qi(P.data,ue,K),fill:"none",stroke:oe,strokeWidth:c,strokeLinecap:"round",strokeLinejoin:"round",className:h?"chart-line-animate":""},P.id):jsxRuntime.jsx("polyline",{points:vc(P.data,ue,K),fill:"none",stroke:oe,strokeWidth:c,strokeLinecap:"round",strokeLinejoin:"round",className:h?"chart-line-animate":""},P.id)}),o&&e.map(P=>{if(!v(P.id))return null;let K=a.includes(P.id)&&j!=null?j:de,oe=k.get(P.id)??"var(--color-chart-1)";return P.data.map((X,fe)=>jsxRuntime.jsx("circle",{cx:ue(X.x),cy:K(X.y),r:3,fill:oe,stroke:"white",strokeWidth:1.5,className:s("chart-dot",h?"chart-dot-animate":"")},`${P.id}-${fe}`))}),S!=null&&jsxRuntime.jsx("line",{className:"chart-crosshair",x1:S,x2:S,y1:M.plotTop,y2:M.plotBottom,stroke:"currentColor",strokeWidth:1,strokeDasharray:"4 4",opacity:.5,style:{color:"var(--color-secondary-400)"}}),jsxRuntime.jsx("line",{x1:M.plotLeft,x2:M.plotLeft,y1:M.plotTop,y2:M.plotBottom,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),re.map(P=>{let F=de(P);return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("line",{x1:M.plotLeft-4,x2:M.plotLeft,y1:F,y2:F,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsxRuntime.jsx("text",{x:M.plotLeft-6,y:F,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:Ie(P,r?.format)})]},P)}),r?.label&&jsxRuntime.jsx("text",{x:-(M.plotTop+M.plotHeight/2),y:14,textAnchor:"middle",fontSize:11,fill:"currentColor",className:"text-secondary-600 dark:text-secondary-400",transform:"rotate(-90)",children:r.label}),n&&j&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:M.plotRight,x2:M.plotRight,y1:M.plotTop,y2:M.plotBottom,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),pe.map(P=>{let F=j(P);return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("line",{x1:M.plotRight,x2:M.plotRight+4,y1:F,y2:F,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsxRuntime.jsx("text",{x:M.plotRight+6,y:F,textAnchor:"start",dominantBaseline:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:Ie(P,n?.format)})]},P)}),n?.label&&jsxRuntime.jsx("text",{x:M.plotTop+M.plotHeight/2,y:-(M.width-14),textAnchor:"middle",fontSize:11,fill:"currentColor",className:"text-secondary-600 dark:text-secondary-400",transform:"rotate(90)",children:n.label})]}),jsxRuntime.jsx("line",{x1:M.plotLeft,x2:M.plotRight,y1:M.plotBottom,y2:M.plotBottom,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),(W?$:ye).map((P,F)=>{let K=ue(P);return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("line",{x1:K,x2:K,y1:M.plotBottom,y2:M.plotBottom+4,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsxRuntime.jsx("text",{x:K,y:M.plotBottom+14,textAnchor:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:Ie(P,t?.format)})]},F)}),t?.label&&jsxRuntime.jsx("text",{x:M.plotLeft+M.plotWidth/2,y:M.height-4,textAnchor:"middle",fontSize:11,fill:"currentColor",className:"text-secondary-600 dark:text-secondary-400",children:t.label}),jsxRuntime.jsx("rect",{x:M.plotLeft,y:M.plotTop,width:M.plotWidth,height:M.plotHeight,fill:"transparent",onMouseMove:y,onMouseLeave:L,onTouchStart:G,onTouchMove:G,onTouchEnd:L,style:{cursor:"crosshair"}})]}),xe=u==="left"||u==="right";return jsxRuntime.jsxs("div",{ref:b,className:s(Nt(),f),children:[m&&jsxRuntime.jsx("h3",{className:"mb-2 text-sm font-semibold text-primary-700 dark:text-primary-200",children:m}),p&&u==="top"&&jsxRuntime.jsx(za,{items:O,position:"top",onToggle:E}),jsxRuntime.jsxs("div",{className:s("flex items-start",xe&&"gap-0"),children:[p&&u==="left"&&jsxRuntime.jsx(za,{items:O,position:"left",onToggle:E}),jsxRuntime.jsx("div",{ref:N,className:"flex-1 min-w-0 overflow-hidden",children:_?ee:jsxRuntime.jsx("div",{className:"flex items-center justify-center text-secondary-400 dark:text-secondary-500",style:{height:d},children:g})}),p&&u==="right"&&jsxRuntime.jsx(za,{items:O,position:"right",onToggle:E})]}),p&&u==="bottom"&&jsxRuntime.jsx(za,{items:O,position:"bottom",onToggle:E}),w&&jsxRuntime.jsxs("div",{className:Tt(),style:{left:w.x,top:w.y},role:"tooltip",children:[w.label&&jsxRuntime.jsx("div",{className:"mb-1 font-medium text-primary-200",children:w.label}),w.items.map((P,F)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{background:P.color}}),jsxRuntime.jsxs("span",{className:"text-primary-300",children:[P.name,":"]}),jsxRuntime.jsx("span",{className:"font-medium",children:P.value})]},F))]})]})}function Cc(e,t){let r=new Set,n=[];for(let a of e)if(t.has(a.id))for(let i of a.data){let o=String(i.x);r.has(o)||(r.add(o),n.push(o));}return n}function Tc(e,t,r,n){if(r){let a=0;for(let o of e)if(t.has(o.id))for(let l of o.data)l.y>a&&(a=l.y);a===0&&(a=1);let[,i]=Wt(0,a,.05);return [n?.min??0,n?.max??i]}else {let a=new Map;for(let l of e)if(t.has(l.id))for(let c of l.data){let m=String(c.x);a.set(m,(a.get(m)??0)+c.y);}let i=Math.max(0,...a.values()),[,o]=Wt(0,i===0?1:i,.05);return [n?.min??0,n?.max??o]}}function Mc(e,t){let[r,n]=e,[a,i]=t;return n===r?()=>(a+i)/2:o=>a+(o-r)/(n-r)*(i-a)}function Rc(e,t=5){return Fr(e[0],e[1],t)}function Sc(e,t,r,n,a,i,o,l,c,m,d){let f=e.filter(x=>t.has(x.id)),p=r.length,u=f.length;if(p===0||u===0)return [];let h=i/p,g=h*(1-m),b=u>0?g*(1-d)/u:0,N=[];for(let x=0;x<r.length;x++){let T=r[x],w=a+x*h+(h-g)/2;for(let C=0;C<f.length;C++){let S=f[C],R=S.data.find(E=>String(E.x)===T);if(!R)continue;let V=w+C*(b+g*d/u),I=c(R.y);N.push({seriesId:S.id,category:T,x:V,y:I,width:Math.max(b,1),height:Math.max(o-I,0),stackBase:o,value:R.y,color:n.get(S.id)??"var(--color-chart-1)"});}}return N}function Pc(e,t,r,n,a,i,o,l,c,m){let d=e.filter(N=>t.has(N.id)),f=r.length,p=d.length;if(f===0||p===0)return [];let u=o/f,h=u*(1-c),g=p>0?h*(1-m)/p:0,b=[];for(let N=0;N<r.length;N++){let x=r[N],T=i+N*u+(u-h)/2;for(let w=0;w<d.length;w++){let C=d[w],S=C.data.find(I=>String(I.x)===x);if(!S)continue;let R=T+w*(g+h*m/Math.max(p,1)),V=l(S.y);b.push({seriesId:C.id,category:x,x:a,y:R,width:Math.max(V-a,0),height:Math.max(g,1),stackBase:a,value:S.y,color:n.get(C.id)??"var(--color-chart-1)"});}}return b}function Dc(e,t,r,n,a,i,o,l,c){let m=e.filter(h=>t.has(h.id)),d=r.length;if(d===0)return [];let f=o/d*(1-c),p=[],u=new Map;r.forEach(h=>u.set(h,a));for(let h of m)for(let g of r){let b=h.data.find(C=>String(C.x)===g);if(!b)continue;let N=u.get(g)??a,x=Math.max(l(b.y)-a,0),T=r.indexOf(g),w=i+(T+.5)*(o/d);p.push({seriesId:h.id,category:g,x:N,y:w-f/2,width:x,height:Math.max(f,1),stackBase:N,value:b.y,color:n.get(h.id)??"var(--color-chart-1)"}),u.set(g,N+x);}return p}function Lc(e,t,r,n,a,i,o,l,c){let m=e.filter(h=>t.has(h.id)),d=r.length;if(d===0)return [];let f=i/d*(1-c),p=[],u=new Map;r.forEach(h=>u.set(h,o));for(let h of m)for(let g of r){let b=h.data.find(S=>String(S.x)===g);if(!b)continue;let N=u.get(g)??o,x=Math.max(o-l(b.y),0),T=N-x,w=r.indexOf(g),C=a+(w+.5)*(i/d);p.push({seriesId:h.id,category:g,x:C-f/2,y:T,width:Math.max(f,1),height:x,stackBase:N,value:b.y,color:n.get(h.id)??"var(--color-chart-1)"}),u.set(g,T);}return p}function Ba({items:e,position:t,onToggle:r}){return jsxRuntime.jsx("div",{className:Ct({position:t}),children:e.map(n=>jsxRuntime.jsxs("button",{onClick:()=>r(n.id),className:s("flex items-center gap-1.5 cursor-pointer rounded px-1.5 py-1 text-xs text-primary-700 transition-opacity hover:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-800",!n.visible&&"opacity-40"),"aria-pressed":n.visible,children:[jsxRuntime.jsx("span",{className:"h-2.5 w-5 rounded-sm shrink-0",style:{background:n.color}}),n.label]},n.id))})}function rs({series:e,xAxis:t,yAxis:r,orientation:n="vertical",grouped:a=true,barRadius:i=4,barPadding:o=.2,groupPadding:l=.3,title:c,height:m=300,className:d,legend:f=true,legendPosition:p="bottom",animateOnMount:u=true,emptyText:h="No data to display"}){let g=qr.useRef(null),b=qr.useRef(null),[N,x]=qr.useState(600),[T,w]=qr.useState(null);qr.useEffect(()=>{let y=b.current;if(!y)return;let L=y.getBoundingClientRect().width;L>0&&x(L);let G=new ResizeObserver(O=>{let _=O[0]?.contentRect.width;_&&_>0&&x(_);});return G.observe(y),()=>G.disconnect()},[]);let C=qr.useMemo(()=>e.map(y=>y.id),[e]),{visible:S,toggle:R,isVisible:V}=Kt(C),I=qr.useMemo(()=>Xt(e.length),[e.length]),E=qr.useMemo(()=>new Map(e.map((y,L)=>[y.id,y.color??I[L]])),[e,I]),v=n==="horizontal",U=qr.useMemo(()=>jt(!!t?.label,!!r?.label,false),[t?.label,r?.label]),k=qr.useMemo(()=>Gt(N,m,U),[N,m,U]),q=qr.useMemo(()=>Cc(e,S),[e,S]),M=qr.useMemo(()=>Tc(e,S,a,v?t:r),[e,S,a,v,t,r]),W=qr.useMemo(()=>Mc(M,v?[k.plotLeft,k.plotRight]:[k.plotBottom,k.plotTop]),[M,k,v]),$=qr.useMemo(()=>Rc(M,(v?t:r)?.tickCount??5),[M,v,t,r]),ue=qr.useMemo(()=>v?a?Pc(e,S,q,E,k.plotLeft,k.plotTop,k.plotHeight,W,l,o):Dc(e,S,q,E,k.plotLeft,k.plotTop,k.plotHeight,W,l):a?Sc(e,S,q,E,k.plotLeft,k.plotWidth,k.plotBottom,k.plotTop,W,l,o):Lc(e,S,q,E,k.plotLeft,k.plotWidth,k.plotBottom,W,l),[e,S,q,E,k,W,a,v,l,o]),J=q.length>0?k.plotWidth/q.length:1,de=q.length>0?k.plotHeight/q.length:1,re=qr.useCallback((y,L)=>{let G=g.current?.getBoundingClientRect();if(!G)return;let O=e.filter(_=>V(_.id)).map(_=>{let ee=_.data.find(xe=>String(xe.x)===L);return {name:_.name,value:ee?Ie(ee.y,r?.format):"\u2014",color:E.get(_.id)??"var(--color-chart-1)"}});w({x:y.clientX-G.left+12,y:y.clientY-G.top-10,category:L,items:O});},[e,V,E,r?.format]),B=qr.useMemo(()=>e.map((y,L)=>({id:y.id,label:y.name,color:y.color??I[L],visible:V(y.id)})),[e,I,V]),j=e.some(y=>y.data.length>0),pe=p==="left"||p==="right",ye=jsxRuntime.jsxs("svg",{role:"img","aria-label":c??"Bar chart",width:k.width,height:k.height,viewBox:`0 0 ${k.width} ${k.height}`,shapeRendering:"geometricPrecision",children:[$.map(y=>{let L=W(y);return v?jsxRuntime.jsx("line",{x1:L,x2:L,y1:k.plotTop,y2:k.plotBottom,stroke:"currentColor",strokeWidth:.5,strokeDasharray:"4 4",className:"text-secondary-200 dark:text-secondary-700"},y):jsxRuntime.jsx("line",{x1:k.plotLeft,x2:k.plotRight,y1:L,y2:L,stroke:"currentColor",strokeWidth:.5,strokeDasharray:"4 4",className:"text-secondary-200 dark:text-secondary-700"},y)}),ue.map(y=>{let L=Math.min(i,y.width/2,y.height/2),G=`${y.seriesId}-${y.category}`;return v?jsxRuntime.jsx("rect",{x:y.x,y:y.y,width:y.width,height:y.height,rx:L,fill:y.color,className:s("chart-bar-h",u&&"chart-bar-animate"),onMouseMove:O=>re(O,y.category),onMouseLeave:()=>w(null)},G):jsxRuntime.jsx("rect",{x:y.x,y:y.y,width:y.width,height:y.height,rx:L,fill:y.color,className:s("chart-bar-v",u&&"chart-bar-animate"),onMouseMove:O=>re(O,y.category),onMouseLeave:()=>w(null)},G)}),jsxRuntime.jsx("line",{x1:k.plotLeft,x2:k.plotLeft,y1:k.plotTop,y2:k.plotBottom,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsxRuntime.jsx("line",{x1:k.plotLeft,x2:k.plotRight,y1:k.plotBottom,y2:k.plotBottom,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),!v&&$.map(y=>{let L=W(y);return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("line",{x1:k.plotLeft-4,x2:k.plotLeft,y1:L,y2:L,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsxRuntime.jsx("text",{x:k.plotLeft-6,y:L,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:Ie(y,r?.format)})]},y)}),v&&$.map(y=>{let L=W(y);return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("line",{x1:L,x2:L,y1:k.plotBottom,y2:k.plotBottom+4,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsxRuntime.jsx("text",{x:L,y:k.plotBottom+14,textAnchor:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:Ie(y,t?.format)})]},y)}),q.map((y,L)=>{if(v){let O=k.plotTop+(L+.5)*de;return jsxRuntime.jsx("text",{x:k.plotLeft-6,y:O,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:y},y)}let G=k.plotLeft+(L+.5)*J;return jsxRuntime.jsx("text",{x:G,y:k.plotBottom+14,textAnchor:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:y},y)}),r?.label&&!v&&jsxRuntime.jsx("text",{x:-(k.plotTop+k.plotHeight/2),y:14,textAnchor:"middle",fontSize:11,fill:"currentColor",className:"text-secondary-600 dark:text-secondary-400",transform:"rotate(-90)",children:r.label}),t?.label&&jsxRuntime.jsx("text",{x:k.plotLeft+k.plotWidth/2,y:k.height-4,textAnchor:"middle",fontSize:11,fill:"currentColor",className:"text-secondary-600 dark:text-secondary-400",children:t.label})]});return jsxRuntime.jsxs("div",{ref:g,className:s(Nt(),d),children:[c&&jsxRuntime.jsx("h3",{className:"mb-2 text-sm font-semibold text-primary-700 dark:text-primary-200",children:c}),f&&p==="top"&&jsxRuntime.jsx(Ba,{items:B,position:"top",onToggle:R}),jsxRuntime.jsxs("div",{className:s("flex items-start",pe&&"gap-0"),children:[f&&p==="left"&&jsxRuntime.jsx(Ba,{items:B,position:"left",onToggle:R}),jsxRuntime.jsx("div",{ref:b,className:"flex-1 min-w-0 overflow-hidden",children:j?ye:jsxRuntime.jsx("div",{className:"flex items-center justify-center text-secondary-400 dark:text-secondary-500",style:{height:m},children:h})}),f&&p==="right"&&jsxRuntime.jsx(Ba,{items:B,position:"right",onToggle:R})]}),f&&p==="bottom"&&jsxRuntime.jsx(Ba,{items:B,position:"bottom",onToggle:R}),T&&jsxRuntime.jsxs("div",{className:Tt(),style:{left:T.x,top:T.y},role:"tooltip",children:[jsxRuntime.jsx("div",{className:"mb-1 font-medium text-primary-200",children:T.category}),T.items.map((y,L)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{background:y.color}}),jsxRuntime.jsxs("span",{className:"text-primary-300",children:[y.name,":"]}),jsxRuntime.jsx("span",{className:"font-medium",children:y.value})]},L))]})]})}function Ic(e,t,r,n,a,i,o,l,c){let m=e.filter(h=>t.has(h.id)),d=m.reduce((h,g)=>h+g.value,0);if(d===0)return [];let f=new Map(e.map((h,g)=>[h.id,h.color??r[g%r.length]])),p=[],u=l;for(let h of m){let g=h.value/d*360,b=c/2,N=u+b,x=u+g-b,T=(N+x)/2,w;if(Math.abs(x-N)>=359.9){let C=ct(i,o,n,N),S=ct(i,o,n,N+180);w=`M ${C.x.toFixed(3)} ${C.y.toFixed(3)} A ${n} ${n} 0 1 1 ${S.x.toFixed(3)} ${S.y.toFixed(3)} A ${n} ${n} 0 1 1 ${C.x.toFixed(3)} ${C.y.toFixed(3)} Z`;}else if(a>0){let C=ct(i,o,n,N),S=ct(i,o,n,x),R=ct(i,o,a,x),V=ct(i,o,a,N),I=x-N>180?1:0;w=`M ${C.x.toFixed(3)} ${C.y.toFixed(3)} A ${n} ${n} 0 ${I} 1 ${S.x.toFixed(3)} ${S.y.toFixed(3)} L ${R.x.toFixed(3)} ${R.y.toFixed(3)} A ${a} ${a} 0 ${I} 0 ${V.x.toFixed(3)} ${V.y.toFixed(3)} Z`;}else {let C=ct(i,o,n,N),S=ct(i,o,n,x),R=x-N>180?1:0;w=`M ${i.toFixed(3)} ${o.toFixed(3)} L ${C.x.toFixed(3)} ${C.y.toFixed(3)} A ${n} ${n} 0 ${R} 1 ${S.x.toFixed(3)} ${S.y.toFixed(3)} Z`;}p.push({id:h.id,label:h.label,value:h.value,percent:Math.round(h.value/d*1e3)/10,color:f.get(h.id)??"var(--color-chart-1)",startAngle:N,endAngle:x,midAngle:T,path:w,outerR:n,innerR:a,cx:i,cy:o}),u+=g;}return p}function Ac(e,t){let r=(e-90)*Math.PI/180;return {dx:Math.cos(r)*t,dy:Math.sin(r)*t}}function Ya({items:e,position:t,onToggle:r}){return jsxRuntime.jsx("div",{className:Ct({position:t}),children:e.map(n=>jsxRuntime.jsxs("button",{onClick:()=>r(n.id),className:s("flex items-center gap-1.5 cursor-pointer rounded px-1.5 py-1 text-xs text-primary-700 transition-opacity hover:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-800",!n.visible&&"opacity-40"),"aria-pressed":n.visible,children:[jsxRuntime.jsx("span",{className:"h-2.5 w-2.5 rounded-full shrink-0",style:{background:n.color}}),jsxRuntime.jsx("span",{children:n.label}),jsxRuntime.jsxs("span",{className:"text-secondary-400",children:["(",n.percent,"%)"]})]},n.id))})}function os({data:e,donut:t=false,donutThickness:r=.5,startAngle:n=-90,padAngle:a=0,labelType:i="percent",centerLabel:o,centerSubLabel:l,explodeOnHover:c=true,explodeOffset:m=8,title:d,height:f=300,className:p,legend:u=true,legendPosition:h="bottom",animateOnMount:g=true,emptyText:b="No data to display"}){let N=qr.useRef(null),x=qr.useRef(null),[T,w]=qr.useState(400),[C,S]=qr.useState(null),[R,V]=qr.useState(null),[I,E]=qr.useState({}),v=qr.useRef(null);qr.useEffect(()=>{let H=x.current;if(!H)return;let ne=H.getBoundingClientRect().width;ne>0&&w(ne);let Y=new ResizeObserver(Q=>{let ke=Q[0]?.contentRect.width;ke&&ke>0&&w(ke);});return Y.observe(H),()=>Y.disconnect()},[]),qr.useEffect(()=>{function H(Y){let Q=v.current;if(!Q)return;"touches"in Y&&Y.cancelable&&Y.preventDefault();let ke="touches"in Y?Y.touches[0]?.clientX??Q.startX:Y.clientX,He="touches"in Y?Y.touches[0]?.clientY??Q.startY:Y.clientY;E(Fe=>({...Fe,[Q.id]:{dx:Q.origDx+ke-Q.startX,dy:Q.origDy+He-Q.startY}}));}function ne(){v.current=null;}return window.addEventListener("mousemove",H),window.addEventListener("mouseup",ne),window.addEventListener("touchmove",H,{passive:false}),window.addEventListener("touchend",ne),()=>{window.removeEventListener("mousemove",H),window.removeEventListener("mouseup",ne),window.removeEventListener("touchmove",H),window.removeEventListener("touchend",ne);}},[]);let U=qr.useMemo(()=>e.map(H=>H.id),[e]),{visible:k,toggle:q,isVisible:M}=Kt(U),W=qr.useMemo(()=>Xt(e.length),[e.length]),$=10,ue=6.4,J=18,de=14,re=6,B=T,j=f,pe=B/2,ye=j/2,y=i!=="none"?J+re+4:re+4,L=Math.max(Math.min(pe,ye)-y,20),G=t?L*r:0,O=qr.useMemo(()=>Ic(e,k,W,L,G,pe,ye,n,a),[e,k,W,L,G,pe,ye,n,a]),_=qr.useMemo(()=>O.map(H=>H.id).join(","),[O]);qr.useEffect(()=>{E({});},[_]);let ee=qr.useCallback((H,ne)=>{if(v.current)return;let Y=N.current?.getBoundingClientRect();if(!Y)return;S(ne);let Q=O.find(ke=>ke.id===ne);Q&&V({x:H.clientX-Y.left+12,y:H.clientY-Y.top-10,items:[{label:Q.label,value:Ie(Q.value),percent:`${Q.percent}%`,color:Q.color}]});},[O]),xe=qr.useCallback(()=>{S(null),V(null);},[]),P=qr.useCallback((H,ne,Y)=>{let Q=I[H]??{dx:0,dy:0};v.current={id:H,startX:ne,startY:Y,origDx:Q.dx,origDy:Q.dy};},[I]),F=qr.useCallback((H,ne)=>{H.preventDefault(),S(ne);let Y=N.current?.getBoundingClientRect();if(!Y)return;let Q=H.touches[0];if(!Q)return;let ke=O.find(He=>He.id===ne);ke&&V({x:Q.clientX-Y.left+12,y:Q.clientY-Y.top-10,items:[{label:ke.label,value:Ie(ke.value),percent:`${ke.percent}%`,color:ke.color}]});},[O]),K=qr.useMemo(()=>{let H=e.reduce((ne,Y)=>ne+Y.value,0);return e.map((ne,Y)=>({id:ne.id,label:ne.label,color:ne.color??W[Y],visible:M(ne.id),percent:H>0?Math.round(ne.value/H*1e3)/10:0}))},[e,W,M]),oe=e.length>0&&e.some(H=>H.value>0),X=h==="left"||h==="right",fe=qr.useMemo(()=>{if(i==="none")return [];let H=$+3,ne=re+$*.5,Y=j-re-$*.5,Q=O.filter(Z=>Z.percent>=3).map(Z=>{let Ne="";switch(i){case "percent":Ne=`${Z.percent}%`;break;case "value":Ne=Ie(Z.value);break;case "label":Ne=Z.label;break;case "label+percent":Ne=`${Z.label} ${Z.percent}%`;break}let A=ct(Z.cx,Z.cy,Z.outerR+2,Z.midAngle),ae=ct(Z.cx,Z.cy,Z.outerR+J,Z.midAngle),se=(Z.midAngle-90)*Math.PI/180,z=Math.cos(se)>=0,ve=Math.ceil(Ne.length*ue);return {id:Z.id,color:Z.color,text:Ne,textW:ve,p1:A,elbowX:ae.x,y:ae.y,isRight:z}}),ke=Q.filter(Z=>Z.isRight).sort((Z,Ne)=>Z.y-Ne.y),He=Q.filter(Z=>!Z.isRight).sort((Z,Ne)=>Z.y-Ne.y);function Fe(Z){if(Z.length!==0)for(let Ne=0;Ne<20;Ne++){let A=false;for(let se=1;se<Z.length;se++){let z=Z[se].y-Z[se-1].y;if(z<H){let ve=(H-z)/2;Z[se-1].y-=ve,Z[se].y+=ve,A=true;}}Z[0].y<ne&&(Z[0].y=ne);for(let se=1;se<Z.length;se++)Z[se].y<Z[se-1].y+H&&(Z[se].y=Z[se-1].y+H);let ae=Z.length-1;Z[ae].y>Y&&(Z[ae].y=Y);for(let se=ae-1;se>=0;se--)Z[se].y>Z[se+1].y-H&&(Z[se].y=Z[se+1].y-H);for(let se of Z)se.y=Math.max(ne,Math.min(Y,se.y));if(!A)break}}return Fe(ke),Fe(He),[...He,...ke]},[O,i,j]),we=jsxRuntime.jsxs("svg",{role:"img","aria-label":d??"Pie chart",width:B,height:j,viewBox:`0 0 ${B} ${j}`,shapeRendering:"geometricPrecision",children:[jsxRuntime.jsxs("g",{className:g?"chart-pie-animate":"",children:[O.map((H,ne)=>{let Y=C===H.id,Q=c&&Y,ke=Ac(H.midAngle,Q?m:0);return jsxRuntime.jsx("path",{d:H.path,fill:H.color,transform:Q?`translate(${ke.dx}, ${ke.dy})`:void 0,className:s("chart-slice",g&&`chart-slice-animate-${Math.min(ne,7)}`,Y&&"chart-slice--exploded"),stroke:H.color,strokeWidth:.6,onMouseMove:He=>ee(He,H.id),onMouseLeave:xe,onTouchStart:He=>F(He,H.id),onTouchEnd:xe,"aria-label":`${H.label}: ${H.percent}%`},H.id)}),fe.map(H=>{let ne=I[H.id]??{dx:0,dy:0},Y=H.elbowX+ne.dx,Q=H.y+ne.dy,ke=Y+(H.isRight?de:-de),He=H.isRight?ke+3:ke-3,Fe=de+3+H.textW+6,Z=H.isRight?Y:Y-Fe,Ne=Q-$-2,A=$*2+4;return jsxRuntime.jsxs("g",{style:{userSelect:"none"},children:[jsxRuntime.jsx("polyline",{points:[`${H.p1.x.toFixed(2)},${H.p1.y.toFixed(2)}`,`${Y.toFixed(2)},${Q.toFixed(2)}`,`${ke.toFixed(2)},${Q.toFixed(2)}`].join(" "),fill:"none",stroke:H.color,strokeWidth:1.2,opacity:.85,strokeLinejoin:"round",strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("text",{x:He.toFixed(2),y:Q.toFixed(2),textAnchor:H.isRight?"start":"end",dominantBaseline:"middle",fontSize:$,fill:"currentColor",className:"text-primary-700 dark:text-primary-300",style:{pointerEvents:"none"},children:H.text}),jsxRuntime.jsx("rect",{x:Z,y:Ne,width:Fe,height:A,fill:"transparent",style:{cursor:"grab",touchAction:"none"},onMouseDown:ae=>{ae.stopPropagation(),P(H.id,ae.clientX,ae.clientY);},onTouchStart:ae=>{ae.stopPropagation();let se=ae.touches[0];se&&P(H.id,se.clientX,se.clientY);}})]},`label-${H.id}`)})]}),t&&jsxRuntime.jsx("g",{style:{pointerEvents:"none"},children:C&&O.find(H=>H.id===C)?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("text",{x:pe,y:ye-8,textAnchor:"middle",dominantBaseline:"middle",fontSize:18,fontWeight:600,fill:"currentColor",className:"text-primary-800 dark:text-primary-100",children:[O.find(H=>H.id===C)?.percent,"%"]}),jsxRuntime.jsx("text",{x:pe,y:ye+12,textAnchor:"middle",dominantBaseline:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:O.find(H=>H.id===C)?.label})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[o&&jsxRuntime.jsx("text",{x:pe,y:ye-(l?8:0),textAnchor:"middle",dominantBaseline:"middle",fontSize:16,fontWeight:600,fill:"currentColor",className:"text-primary-800 dark:text-primary-100",children:o}),l&&jsxRuntime.jsx("text",{x:pe,y:ye+14,textAnchor:"middle",dominantBaseline:"middle",fontSize:11,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:l})]})})]});return jsxRuntime.jsxs("div",{ref:N,className:s(Nt(),p),children:[d&&jsxRuntime.jsx("h3",{className:"mb-2 text-sm font-semibold text-primary-700 dark:text-primary-200",children:d}),u&&h==="top"&&jsxRuntime.jsx(Ya,{items:K,position:"top",onToggle:q}),jsxRuntime.jsxs("div",{className:s("flex items-start justify-center",X&&"gap-0"),children:[u&&h==="left"&&jsxRuntime.jsx(Ya,{items:K,position:"left",onToggle:q}),jsxRuntime.jsx("div",{ref:x,className:"flex-1 min-w-0 overflow-hidden",children:oe?we:jsxRuntime.jsx("div",{className:"flex items-center justify-center text-secondary-400 dark:text-secondary-500",style:{height:f},children:b})}),u&&h==="right"&&jsxRuntime.jsx(Ya,{items:K,position:"right",onToggle:q})]}),u&&h==="bottom"&&jsxRuntime.jsx(Ya,{items:K,position:"bottom",onToggle:q}),R&&jsxRuntime.jsx("div",{className:Tt(),style:{left:R.x,top:R.y},role:"tooltip",children:R.items.map((H,ne)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"h-2.5 w-2.5 rounded-full shrink-0",style:{background:H.color}}),jsxRuntime.jsxs("span",{className:"font-medium",children:[H.label,":"]}),jsxRuntime.jsx("span",{children:H.value}),jsxRuntime.jsxs("span",{className:"text-primary-300",children:["(",H.percent,")"]})]},ne))})]})}function Fc(e,t,r){let n=1/0,a=-1/0;for(let l of e)if(t.has(l.id))for(let c of l.data){let m=Number(c.x);m<n&&(n=m),m>a&&(a=m);}if(!isFinite(n))return [0,1];let[i,o]=Wt(n,a);return [r?.min??i,r?.max??o]}function _c(e,t,r){let n=1/0,a=-1/0;for(let l of e)if(t.has(l.id))for(let c of l.data)c.y<n&&(n=c.y),c.y>a&&(a=c.y);if(!isFinite(n))return [0,1];let[i,o]=Wt(n,a);return [r?.min??i,r?.max??o]}function is(e,t){let[r,n]=e,[a,i]=t;return n===r?()=>(a+i)/2:o=>a+(o-r)/(n-r)*(i-a)}function ss(e,t=5){return Fr(e[0],e[1],t)}function zc(e,t,r){let n=1.618033988749895,a=e*137+t,i=a*n%1*2-1,o=a*n*n%1*2-1;return [i*r,o*r]}function Bc(e,t,r=12){if(e.length<2)return null;let n=Math.min(...e),a=Math.max(...e),i=Math.min(...t),o=Math.max(...t);return {cx:(n+a)/2,cy:(i+o)/2,rx:(a-n)/2+r,ry:(o-i)/2+r}}function Ka({items:e,position:t,onToggle:r}){return jsxRuntime.jsx("div",{className:Ct({position:t}),children:e.map(n=>jsxRuntime.jsxs("button",{onClick:()=>r(n.id),className:s("flex items-center gap-1.5 cursor-pointer rounded px-1.5 py-1 text-xs text-primary-700 transition-opacity hover:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-800",!n.visible&&"opacity-40"),"aria-pressed":n.visible,children:[jsxRuntime.jsx("span",{className:"h-2.5 w-2.5 rounded-full shrink-0",style:{background:n.color}}),n.label]},n.id))})}function ls({series:e,xAxis:t,yAxis:r,dotRadius:n=5,dotOpacity:a=.75,clusters:i=false,jitter:o=false,jitterAmount:l=12,linkedLines:c=false,title:m,height:d=300,className:f,legend:p=true,legendPosition:u="bottom",animateOnMount:h=true,emptyText:g="No data to display"}){let b=qr.useRef(null),N=qr.useRef(null),[x,T]=qr.useState(600),[w,C]=qr.useState(null);qr.useEffect(()=>{let y=N.current;if(!y)return;let L=y.getBoundingClientRect().width;L>0&&T(L);let G=new ResizeObserver(O=>{let _=O[0]?.contentRect.width;_&&_>0&&T(_);});return G.observe(y),()=>G.disconnect()},[]);let S=qr.useMemo(()=>e.map(y=>y.id),[e]),{visible:R,toggle:V,isVisible:I}=Kt(S),E=qr.useMemo(()=>Xt(e.length),[e.length]),v=qr.useMemo(()=>new Map(e.map((y,L)=>[y.id,y.color??E[L]])),[e,E]),U=qr.useMemo(()=>jt(!!t?.label,!!r?.label,false),[t?.label,r?.label]),k=qr.useMemo(()=>Gt(x,d,U),[x,d,U]),q=qr.useMemo(()=>Fc(e,R,t),[e,R,t]),M=qr.useMemo(()=>_c(e,R,r),[e,R,r]),W=qr.useMemo(()=>is(q,[k.plotLeft,k.plotRight]),[q,k]),$=qr.useMemo(()=>is(M,[k.plotBottom,k.plotTop]),[M,k]),ue=qr.useMemo(()=>ss(q,t?.tickCount??6),[q,t?.tickCount]),J=qr.useMemo(()=>ss(M,r?.tickCount??5),[M,r?.tickCount]),de=qr.useCallback((y,L,G,O,_)=>{let ee=b.current?.getBoundingClientRect();ee&&C({x:y.clientX-ee.left+12,y:y.clientY-ee.top-10,seriesName:L,xVal:Ie(G,t?.format),yVal:Ie(O,r?.format),color:_});},[t?.format,r?.format]),re=qr.useCallback((y,L,G,O,_)=>{y.preventDefault();let ee=b.current?.getBoundingClientRect();if(!ee)return;let xe=y.touches[0];xe&&C({x:xe.clientX-ee.left+12,y:xe.clientY-ee.top-10,seriesName:L,xVal:Ie(G,t?.format),yVal:Ie(O,r?.format),color:_});},[t?.format,r?.format]),B=qr.useMemo(()=>e.map((y,L)=>({id:y.id,label:y.name,color:y.color??E[L],visible:I(y.id)})),[e,E,I]),j=e.some(y=>y.data.length>0),pe=u==="left"||u==="right",ye=jsxRuntime.jsxs("svg",{role:"img","aria-label":m??"Scatter chart",width:k.width,height:k.height,viewBox:`0 0 ${k.width} ${k.height}`,shapeRendering:"geometricPrecision",children:[J.map(y=>jsxRuntime.jsx("line",{x1:k.plotLeft,x2:k.plotRight,y1:$(y),y2:$(y),stroke:"currentColor",strokeWidth:.5,strokeDasharray:"4 4",className:"text-secondary-200 dark:text-secondary-700"},y)),i&&e.map((y,L)=>{if(!I(y.id)||y.data.length<2)return null;let G=v.get(y.id)??"var(--color-chart-1)",O=y.data.map(xe=>W(Number(xe.x))),_=y.data.map(xe=>$(xe.y)),ee=Bc(O,_,16);return ee?jsxRuntime.jsx("ellipse",{cx:ee.cx,cy:ee.cy,rx:ee.rx,ry:ee.ry,fill:G,fillOpacity:.06,stroke:G,strokeOpacity:.3,strokeWidth:1.5,strokeDasharray:"5 3",className:h?"chart-cluster-ellipse":"",style:{animationDelay:`${L*.1}s`}},`cluster-${y.id}`):null}),c&&e.map(y=>{if(!I(y.id)||y.data.length<2)return null;let L=v.get(y.id)??"var(--color-chart-1)",O=[...y.data].sort((_,ee)=>Number(_.x)-Number(ee.x)).map(_=>`${W(Number(_.x)).toFixed(2)},${$(_.y).toFixed(2)}`).join(" ");return jsxRuntime.jsx("polyline",{points:O,fill:"none",stroke:L,strokeWidth:1.5,className:"chart-scatter-link"},`link-${y.id}`)}),e.map((y,L)=>{if(!I(y.id))return null;let G=v.get(y.id)??"var(--color-chart-1)";return jsxRuntime.jsx("g",{className:"chart-scatter-group",children:y.data.map((O,_)=>{let[ee,xe]=o?zc(L,_,l):[0,0],P=W(Number(O.x))+ee,F=$(O.y)+xe;return jsxRuntime.jsx("circle",{cx:P,cy:F,r:n,fill:G,fillOpacity:a,stroke:G,strokeWidth:1,strokeOpacity:.5,className:s("chart-scatter-dot",h&&"chart-scatter-dot--animate"),style:{color:G},onMouseMove:K=>de(K,y.name,O.x,O.y,G),onMouseLeave:()=>C(null),onTouchStart:K=>re(K,y.name,O.x,O.y,G),onTouchEnd:()=>C(null)},_)})},y.id)}),jsxRuntime.jsx("line",{x1:k.plotLeft,x2:k.plotLeft,y1:k.plotTop,y2:k.plotBottom,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsxRuntime.jsx("line",{x1:k.plotLeft,x2:k.plotRight,y1:k.plotBottom,y2:k.plotBottom,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),J.map(y=>{let L=$(y);return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("line",{x1:k.plotLeft-4,x2:k.plotLeft,y1:L,y2:L,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsxRuntime.jsx("text",{x:k.plotLeft-6,y:L,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:Ie(y,r?.format)})]},y)}),ue.map(y=>{let L=W(y);return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("line",{x1:L,x2:L,y1:k.plotBottom,y2:k.plotBottom+4,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsxRuntime.jsx("text",{x:L,y:k.plotBottom+14,textAnchor:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:Ie(y,t?.format)})]},y)}),r?.label&&jsxRuntime.jsx("text",{x:-(k.plotTop+k.plotHeight/2),y:14,textAnchor:"middle",fontSize:11,fill:"currentColor",className:"text-secondary-600 dark:text-secondary-400",transform:"rotate(-90)",children:r.label}),t?.label&&jsxRuntime.jsx("text",{x:k.plotLeft+k.plotWidth/2,y:k.height-4,textAnchor:"middle",fontSize:11,fill:"currentColor",className:"text-secondary-600 dark:text-secondary-400",children:t.label})]});return jsxRuntime.jsxs("div",{ref:b,className:s(Nt(),f),children:[m&&jsxRuntime.jsx("h3",{className:"mb-2 text-sm font-semibold text-primary-700 dark:text-primary-200",children:m}),p&&u==="top"&&jsxRuntime.jsx(Ka,{items:B,position:"top",onToggle:V}),jsxRuntime.jsxs("div",{className:s("flex items-start",pe&&"gap-0"),children:[p&&u==="left"&&jsxRuntime.jsx(Ka,{items:B,position:"left",onToggle:V}),jsxRuntime.jsx("div",{ref:N,className:"flex-1 min-w-0 overflow-hidden",children:j?ye:jsxRuntime.jsx("div",{className:"flex items-center justify-center text-secondary-400 dark:text-secondary-500",style:{height:d},children:g})}),p&&u==="right"&&jsxRuntime.jsx(Ka,{items:B,position:"right",onToggle:V})]}),p&&u==="bottom"&&jsxRuntime.jsx(Ka,{items:B,position:"bottom",onToggle:V}),w&&jsxRuntime.jsxs("div",{className:Tt(),style:{left:w.x,top:w.y},role:"tooltip",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[jsxRuntime.jsx("span",{className:"h-2 w-2 rounded-full",style:{background:w.color}}),jsxRuntime.jsx("span",{className:"font-medium",children:w.seriesName})]}),jsxRuntime.jsxs("div",{className:"text-primary-300",children:["X: ",jsxRuntime.jsx("span",{className:"font-medium text-primary-50",children:w.xVal})," ","Y: ",jsxRuntime.jsx("span",{className:"font-medium text-primary-50",children:w.yVal})]})]})]})}var Tg={LineChart:ts,BarChart:rs,PieChart:os,ScatterChart:ls},cs=Tg;var Mg={Primitives:bo,Layout:wo,DataDisplay:Ho,Navigation:Ko,Disclosure:Go,Overlay:si,Feedback:xi,Extras:Oi,Forms:Wi,Chart:cs},cC=Mg;exports.Accordion=Wo;exports.AccordionContent=Fp;exports.AccordionItem=Ap;exports.AccordionTrigger=Hp;exports.Alert=mi;exports.AlertContent=Mu;exports.AlertDescription=Ru;exports.AlertIcon=Tu;exports.AlertTitle=Cu;exports.Avatar=Fn;exports.AvatarGroup=_n;exports.Badge=ao;exports.BarChart=rs;exports.Breadcrumb=ta;exports.Button=gr;exports.Card=ho;exports.CardContent=Gd;exports.CardDescription=jd;exports.CardFooter=Ud;exports.CardHeader=Xd;exports.CardTitle=Wd;exports.Chart=cs;exports.Chat=Po;exports.Checkbox=po;exports.CinePlayer=Mi;exports.CodeBlock=Vo;exports.CommandPalette=Va;exports.ContextMenu=ii;exports.DataDisplay=Ho;exports.DataTable=ym;exports.DateTimePicker=Aa;exports.Dialog=ln;exports.DialogClose=eu;exports.DialogContent=Zo;exports.DialogDescription=ti;exports.DialogFooter=ri;exports.DialogHeader=Jo;exports.DialogTitle=ei;exports.Disclosure=Go;exports.Drawer=pa;exports.DrawerBody=nl;exports.DrawerClose=ol;exports.DrawerFooter=al;exports.DrawerHeader=rl;exports.Dropdown=Za;exports.DropdownButton=hr;exports.Extras=Oi;exports.Feedback=xi;exports.FileExplorer=Ei;exports.FilmReel=ki;exports.Form=Xi;exports.FormItem=bg;exports.FormSection=hg;exports.Forms=Wi;exports.Header=Bo;exports.HorizontalCard=qd;exports.ImageCard=yo;exports.ImageCardActions=tm;exports.ImageCardBody=Zd;exports.ImageCardDescription=em;exports.ImageCardTitle=Jd;exports.Indicator=io;exports.Input=lo;exports.Label=so;exports.Layout=wo;exports.LineChart=ts;exports.List=Mo;exports.ListItem=wm;exports.Masonry=Hi;exports.MetricCard=Ao;exports.MiniPlayer=Ci;exports.NavLink=Oo;exports.Navigation=Ko;exports.Overlay=si;exports.Pagination=na;exports.Panel=xo;exports.PanelContent=nm;exports.PanelHeader=rm;exports.PieChart=os;exports.Primitives=bo;exports.ProgressBar=fi;exports.Radio=fo;exports.RadioGroup=uo;exports.RibbonBar=Yo;exports.ScatterChart=ls;exports.SideNav=zo;exports.Skeleton=xa;exports.Slider=Bn;exports.SliderRange=On;exports.SortableTable=bm;exports.Spin=bi;exports.Stat=Io;exports.Switch=mo;exports.TabContent=Kp;exports.TabList=Op;exports.TabPanels=Yp;exports.TabTrigger=$p;exports.Table=Ur;exports.TableBody=Co;exports.TableCell=nr;exports.TableEmpty=To;exports.TableHead=rr;exports.TableHeader=No;exports.TableRow=Gr;exports.Tabs=jo;exports.Tag=oo;exports.TextBox=co;exports.Timeline=zi;exports.ToastContext=hn;exports.ToastProvider=va;exports.Tooltip=ni;exports.Tree=Ro;exports.TreeItem=Sm;exports.TypewriterText=La;exports.accordionContentVariants=oa;exports.accordionTriggerVariants=aa;exports.accordionVariants=ia;exports.alertVariants=pn;exports.avatarVariants=Br;exports.badgeVariants=Nn;exports.buttonVariants=ur;exports.cardVariants=Xr;exports.chartContainerVariants=Nt;exports.chartLegendVariants=Ct;exports.chartTooltipVariants=Tt;exports.checkboxVariants=Mn;exports.cn=s;exports.codeBlockVariants=Wr;exports.configureAlertTopOffset=Lu;exports.default=cC;exports.dialogContentVariants=sn;exports.indicatorVariants=Cn;exports.inputVariants=fr;exports.labelVariants=Tn;exports.listItemVariants=Xn;exports.listVariants=Kn;exports.metricCardVariants=Gn;exports.navLinkVariants=Zn;exports.panelVariants=$n;exports.progressBarVariants=fa;exports.radioVariants=Rn;exports.skeletonVariants=un;exports.sliderVariants=Or;exports.spinVariants=Tr;exports.statVariants=jn;exports.switchTrackVariants=Sn;exports.tabListVariants=sa;exports.tabTriggerVariants=la;exports.tableVariants=Yn;exports.tagVariants=Pn;exports.toastVariants=ga;exports.tooltipVariants=ma;exports.treeItemVariants=Wn;exports.useAlert=zu;exports.useSpin=Zu;exports.useToast=wa;
84
+ `}),jsxRuntime.jsx(Zn,{open:H,onOpenChange:_,children:jsxRuntime.jsxs(vs,{size:"sm",children:[jsxRuntime.jsxs(xs,{children:[jsxRuntime.jsxs(ws,{children:[jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"text-danger-500"}),"Confirm Deletion"]}),jsxRuntime.jsxs(ks,{children:[P.size===1?`Are you sure you want to delete "${de[Array.from(P)[0]]?.name}"?`:`Are you sure you want to delete ${P.size} selected items?`," ","This action cannot be undone."]})]}),jsxRuntime.jsxs(Ns,{children:[jsxRuntime.jsx(Vt,{intent:"ghost",onClick:()=>_(false),children:"Cancel"}),jsxRuntime.jsxs(Vt,{intent:"danger",onClick:()=>{let $=Array.from(P).map(ge=>de[ge]).filter(Boolean);m?.($),A(new Set),S(null),_(false);},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"h-4 w-4"}),"Delete"]})]})]})})]})}function yn({label:e,value:t,mono:r}){return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"mb-0.5 font-semibold uppercase tracking-wider text-(--fe-text-muted)",children:e}),jsxRuntime.jsx("div",{className:f("text-(--fe-text) break-all leading-snug",r&&"font-mono text-[9px]"),children:t})]})}function cy(e,t){let r=t.getBoundingClientRect(),n=Math.max(r.width,r.height)*1.2,o=e.clientX-r.left,a=e.clientY-r.top,i=document.createElement("span");i.className="masonry-ripple",i.style.width=`${n}px`,i.style.height=`${n}px`,i.style.left=`${o}px`,i.style.top=`${a}px`,t.appendChild(i),i.addEventListener("animationend",()=>i.remove());}function nl({columns:e,columnWidth:t=240,gap:r=16,items:n,onItemClick:o,className:a,style:i,children:s,...l}){let c=On.useRef(null),u=On.useRef([]),[p,m]=On.useState(()=>e??1),[d,g]=On.useState([]),[h,b]=On.useState(0),y=n?n.map((P,A)=>({key:P.key??A,node:P.content})):On__default.default.Children.toArray(s).map((P,A)=>({key:P.key??A,node:P})),v=y.length,N=On.useCallback(P=>e??Math.max(1,Math.floor((P+r)/(t+r))),[e,t,r]),x=On.useCallback(()=>{let P=c.current;if(!P)return;let A=P.clientWidth,D=N(A);m(D);let S=(A-(D-1)*r)/D,C=new Array(D).fill(0),I=[];for(let T=0;T<v;T++){let R=u.current[T],O=R?R.offsetHeight:0,E=0;for(let ne=1;ne<D;ne++)C[ne]<C[E]&&(E=ne);I.push({top:C[E],left:E*(S+r),width:S}),C[E]+=O+r;}let k=Math.max(0,...C)-(v?r:0);g(I),b(k);},[v,N,r]);On.useEffect(()=>{let P=c.current;if(!P)return;let A=new ResizeObserver(()=>x());return A.observe(P),()=>A.disconnect()},[x]),On.useEffect(()=>{let P=requestAnimationFrame(x);return ()=>cancelAnimationFrame(P)},[x]),On.useEffect(()=>{let P=new ResizeObserver(()=>x());return u.current.forEach(A=>{A&&P.observe(A);}),()=>P.disconnect()},[v,p,x]);let w=On.useCallback((P,A)=>{let D=P.currentTarget;cy(P,D),o?.(n?.[A],A);},[o,n]),L=P=>{if(!n)return false;let A=n[P];return !!(A.title||A.description||A.actions)};return jsxRuntime.jsx("div",{ref:c,className:f("relative",a),style:{...i,height:h},...l,children:y.map((P,A)=>jsxRuntime.jsxs("div",{ref:D=>{u.current[A]=D;},className:"masonry-item",role:"button",tabIndex:0,onClick:D=>w(D,A),onKeyDown:D=>{(D.key==="Enter"||D.key===" ")&&(D.preventDefault(),o?.(n?.[A],A));},style:{position:"absolute",top:d[A]?.top??0,left:d[A]?.left??0,width:d[A]?.width??"100%"},children:[P.node,L(A)&&jsxRuntime.jsxs("div",{className:"masonry-item-overlay",children:[n[A].title&&jsxRuntime.jsx("p",{className:"masonry-item-overlay-title",children:n[A].title}),n[A].description&&jsxRuntime.jsx("p",{className:"masonry-item-overlay-desc",children:n[A].description}),n[A].actions&&jsxRuntime.jsx("div",{className:"masonry-item-overlay-actions",children:n[A].actions})]})]},P.key))})}var uy='<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="2" y1="2" x2="22" y2="22"/><path d="M10.41 10.41a2 2 0 1 1-2.83-2.83"/><line x1="13.5" y1="6" x2="18" y2="6"/><line x1="6" y1="2" x2="14" y2="10"/><path d="M4 6h1.5"/><path d="M2 18.5C2 19.9 3.1 21 4.5 21H16"/><rect x="2" y="2" width="20" height="20" rx="5" ry="5"/></svg>';function _a(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function py(e){return e.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"").replace(/<style\b[^<]*(?:(?!<\/style>)<[^<]*)*<\/style>/gi,"").replace(/\s+on[a-z][a-z0-9]*\s*=\s*(?:"[^"]*"|'[^']*'|[^\s/>]*)/gi,"").replace(/\b(href|src|action)\s*=\s*["']\s*(?:javascript|vbscript)\s*:[^"'>]*/gi,'$1="#"').replace(/\bhref\s*=\s*["']\s*data\s*:[^"'>]*/gi,'href="#"')}var Yd=new marked.Marked;Yd.use({renderer:{image({href:e,title:t,text:r}){let n=/^https?:\/\//i.test(e??"")?e:"",o=r?` alt="${_a(r)}"`:' alt=""',a=t?` title="${_a(t)}"`:"",i=_a(r||"Image failed to load");return `<figure class="tw-rich-img-wrap"><img class="tw-rich-img" src="${_a(n)}" loading="lazy"${o}${a} /><div class="tw-rich-img-error">`+uy+`<span>${i}</span></div></figure>`}}});function Ud(e){let t=Yd.parse(e,{async:false});return py(t)}function Oa({text:e="",mode:t="typewriter",speed:r=40,cursor:n=true,cursorChar:o="\u258B",thinking:a=false,streaming:i=false,delay:s=0,onComplete:l,as:c="span",className:u,rich:p=false}){let[m,d]=On.useState(t==="instant"?e:""),[g,h]=On.useState(false),[b,y]=On.useState(t==="instant"),[v,N]=On.useState(false),x=On.useRef(null),w=On.useRef(0),L=On.useRef(l);L.current=l;let P=On.useRef(e);P.current=e,On.useEffect(()=>{if(t!=="typewriter")return;if(d(""),y(false),N(false),h(false),!e){y(true);return}let I=Math.max(10,1e3/r),k=0,T,R=()=>{h(true),T=setInterval(()=>{let E=P.current;k++,d(E.slice(0,k)),k>=E.length&&(clearInterval(T),h(false),y(true),L.current?.());},I);},O;return s>0?O=setTimeout(R,s):R(),()=>{clearTimeout(O),clearInterval(T);}},[e,t]),On.useEffect(()=>{if(t!=="stream")return;if(e.length===0){w.current=0,d(""),h(false),y(false),N(false);return}if(e.length<=w.current)return;let I=Math.max(10,1e3/r),k=w.current;h(true),y(false),N(false);let T=setInterval(()=>{k++,w.current=k,d(P.current.slice(0,k)),k>=P.current.length&&(clearInterval(T),h(false),L.current?.());},I);return ()=>clearInterval(T)},[e,t]),On.useEffect(()=>{t==="instant"&&(d(e),h(false),y(true));},[e,t]);let A=On.useRef(i);On.useEffect(()=>{let I=A.current;if(A.current=i,I&&!i&&!g&&t==="stream"){N(true);let k=setTimeout(()=>{N(false),y(true);},650);return ()=>clearTimeout(k)}},[i,g,t]),On.useEffect(()=>{if(!p||!x.current)return;let k=Array.from(x.current.querySelectorAll(".tw-rich-img")).map(T=>{let R=()=>{let O=T.closest(".tw-rich-img-wrap");O&&O.classList.add("tw-rich-img-wrap--error");};return T.addEventListener("error",R,{once:true}),{img:T,onError:R}});return ()=>{k.forEach(({img:T,onError:R})=>T.removeEventListener("error",R));}},[m,p]);let D=n&&(a||g||v||t==="stream"&&i&&!b||t==="typewriter"&&!b),S=a?"tw-cursor--blink":g?"tw-cursor--solid":v?"tw-cursor--out":"tw-cursor--blink",C=c;return p?jsxRuntime.jsxs("div",{role:"region",className:f(u),children:[jsxRuntime.jsx("div",{ref:x,className:"tw-rich-prose",dangerouslySetInnerHTML:{__html:Ud(m)}}),D&&jsxRuntime.jsx("span",{className:f("tw-cursor",S),"aria-hidden":"true",children:o})]}):jsxRuntime.jsxs(C,{className:f(u),children:[a&&!m&&jsxRuntime.jsx("span",{"aria-hidden":"true",children:"\u200B"}),m,D&&jsxRuntime.jsx("span",{className:f("tw-cursor",S),"aria-hidden":"true",children:o})]})}function $a(e){return e.toLowerCase().replace(/\s+/g," ").trim()}function my(e,t){if(!t)return true;let r=$a(t);return $a(e.label).includes(r)||(e.description?$a(e.description).includes(r):false)||(e.keywords?e.keywords.some(n=>$a(n).includes(r)):false)}function fy(e){let t=new Map;for(let r of e){let n=r.group??"";t.has(n)||t.set(n,[]),t.get(n).push(r);}return Array.from(t.entries()).map(([r,n])=>({label:r,items:n}))}function Qd(e,t,r,n){let[o,a]=On.useState(""),[i,s]=On.useState(0);On.useEffect(()=>{t&&(a(""),s(0));},[t]);let l=On.useMemo(()=>e.filter(m=>!m.disabled&&my(m,o)),[e,o]),c=On.useMemo(()=>fy(l),[l]);On.useEffect(()=>{s(m=>Math.min(m,Math.max(0,l.length-1)));},[l.length]);let u=On.useCallback(()=>{let m=l[i];m&&(m.onSelect(),r(false));},[l,i,r]),p=On.useCallback(m=>{switch(m.key){case "ArrowDown":m.preventDefault(),s(d=>(d+1)%Math.max(1,l.length));break;case "ArrowUp":m.preventDefault(),s(d=>(d-1+Math.max(1,l.length))%Math.max(1,l.length));break;case "Enter":m.preventDefault(),u();break;case "Escape":m.preventDefault(),r(false);break}},[l.length,u,r]);return On.useEffect(()=>{if(!n)return;function m(d){(d.metaKey||d.ctrlKey)&&d.key==="k"&&(d.preventDefault(),r(!t));}return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[n,t,r]),{query:o,setQuery:a,groups:c,filtered:l,activeIndex:i,setActiveIndex:s,handleKeyDown:p}}function Ka({open:e,onOpenChange:t,commands:r,placeholder:n="Type a command or search\u2026",hotkey:o=true,maxItems:a=8,className:i}){let s=On.useRef(null),l=On.useRef(null),{query:c,setQuery:u,groups:p,filtered:m,activeIndex:d,setActiveIndex:g,handleKeyDown:h}=Qd(r,e,t,o);if(On.useEffect(()=>{if(e){let y=setTimeout(()=>s.current?.focus(),40);return ()=>clearTimeout(y)}},[e]),On.useEffect(()=>{l.current?.querySelector("[data-active='true']")?.scrollIntoView({block:"nearest"});},[d]),!e)return null;let b=0;return reactDom.createPortal(jsxRuntime.jsx("div",{className:"cmd-backdrop fixed inset-0 z-50 flex items-start justify-center pt-[15vh]",onClick:()=>t(false),role:"presentation",children:jsxRuntime.jsxs("div",{className:f("cmd-panel relative flex w-full max-w-lg flex-col overflow-hidden rounded-xl","border border-primary-200 bg-white shadow-2xl","dark:border-primary-700 dark:bg-primary-900",i),onClick:y=>y.stopPropagation(),onKeyDown:h,role:"dialog","aria-label":"Command palette","aria-modal":"true",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 border-b border-primary-100 px-4 dark:border-primary-700",children:[jsxRuntime.jsx(lucideReact.Search,{className:"h-4 w-4 shrink-0 text-secondary-400","aria-hidden":"true"}),jsxRuntime.jsx("input",{ref:s,value:c,onChange:y=>u(y.target.value),placeholder:n,className:"flex-1 bg-transparent py-3.5 text-sm text-primary-900 outline-none placeholder:text-secondary-400 dark:text-primary-50","aria-label":"Search commands","aria-controls":"cmd-results","aria-autocomplete":"list","aria-activedescendant":m[d]?`cmd-item-${m[d].id}`:void 0,spellCheck:false,autoComplete:"off"}),jsxRuntime.jsx("kbd",{className:"hidden shrink-0 rounded border border-primary-200 px-1.5 py-0.5 text-xs text-secondary-400 dark:border-primary-600 sm:block",children:"esc"})]}),jsxRuntime.jsx("div",{id:"cmd-results",ref:l,className:"overflow-y-auto py-2",style:{maxHeight:`${a*2.75}rem`},role:"listbox","aria-label":"Commands",children:m.length===0?jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-2 py-8 text-sm text-secondary-400",children:[jsxRuntime.jsx(lucideReact.Command,{className:"h-8 w-8 opacity-30"}),jsxRuntime.jsx("span",{children:"No commands found"})]}):p.map(y=>jsxRuntime.jsxs("div",{className:"mb-1 last:mb-0",children:[y.label&&jsxRuntime.jsx("p",{className:"px-4 pb-1 pt-2 text-xs font-semibold uppercase tracking-wide text-secondary-400 dark:text-secondary-500",children:y.label}),y.items.map(v=>{let N=b++,x=N===d;return jsxRuntime.jsxs("button",{id:`cmd-item-${v.id}`,"data-active":x,role:"option","aria-selected":x,className:f("cmd-item group flex w-full items-center gap-3 px-4 py-2.5 text-left text-sm",x?"bg-primary-100 text-primary-900 dark:bg-primary-800 dark:text-primary-50":"text-primary-700 hover:bg-primary-50 dark:text-primary-300 dark:hover:bg-primary-800/50"),onMouseEnter:()=>g(N),onClick:()=>{v.onSelect(),t(false);},children:[v.icon&&jsxRuntime.jsx("span",{className:f("flex h-7 w-7 shrink-0 items-center justify-center rounded-md border text-xs",x?"border-primary-300 bg-white text-primary-700 dark:border-primary-600 dark:bg-primary-700 dark:text-primary-200":"border-primary-200 bg-primary-50 text-primary-500 dark:border-primary-700 dark:bg-primary-800 dark:text-primary-400"),children:v.icon}),jsxRuntime.jsxs("span",{className:"min-w-0 flex-1",children:[jsxRuntime.jsx("span",{className:"block truncate font-medium",children:v.label}),v.description&&jsxRuntime.jsx("span",{className:"block truncate text-xs text-secondary-400 dark:text-secondary-500",children:v.description})]}),v.shortcut&&jsxRuntime.jsx("span",{className:"flex shrink-0 items-center gap-0.5",children:v.shortcut.map((w,L)=>jsxRuntime.jsx("kbd",{className:"rounded border border-primary-200 px-1.5 py-0.5 text-xs text-secondary-500 dark:border-primary-700 dark:text-secondary-400",children:w},L))})]},v.id)})]},y.label||"_default"))}),m.length>0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between border-t border-primary-100 px-4 py-2 dark:border-primary-700",children:[jsxRuntime.jsxs("span",{className:"text-xs text-secondary-400",children:[m.length," result",m.length!==1?"s":""]}),jsxRuntime.jsxs("span",{className:"flex items-center gap-3 text-xs text-secondary-400",children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("kbd",{className:"rounded border border-primary-200 px-1 dark:border-primary-700",children:"\u2191"}),jsxRuntime.jsx("kbd",{className:"rounded border border-primary-200 px-1 dark:border-primary-700",children:"\u2193"}),"Navigate"]}),jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("kbd",{className:"rounded border border-primary-200 px-1 dark:border-primary-700",children:"\u21B5"}),"Select"]})]})]})]})}),document.body)}var nu={complete:"bg-success-500 border-success-500 text-white dark:bg-success-600 dark:border-success-600",active:"bg-primary-500 border-primary-500 text-white dark:bg-primary-400 dark:border-primary-400",error:"bg-danger-500 border-danger-500 text-white dark:bg-danger-600 dark:border-danger-600",pending:"bg-white border-primary-300 text-secondary-400 dark:bg-primary-800 dark:border-primary-600"},ou={complete:"shadow-[0_0_0_4px_theme(colors.success.100)] dark:shadow-[0_0_0_4px_theme(colors.success.900/30)]",active:"shadow-[0_0_0_4px_theme(colors.primary.100)] dark:shadow-[0_0_0_4px_theme(colors.primary.800/50)] animate-pulse",error:"shadow-[0_0_0_4px_theme(colors.danger.100)] dark:shadow-[0_0_0_4px_theme(colors.danger.900/30)]",pending:""};function au({status:e,icon:t}){return t?jsxRuntime.jsx(jsxRuntime.Fragment,{children:t}):e==="complete"?jsxRuntime.jsx(lucideReact.Check,{className:"h-3 w-3"}):e==="error"?jsxRuntime.jsx(lucideReact.AlertCircle,{className:"h-3 w-3"}):e==="active"?jsxRuntime.jsx(lucideReact.Dot,{className:"h-4 w-4"}):jsxRuntime.jsx(lucideReact.Clock,{className:"h-3 w-3"})}function iu({images:e,title:t}){let r=e.slice(0,4),n=e.length>4?e.length-4:0,o=(a,i,s)=>jsxRuntime.jsxs("a",{href:a,target:"_blank",rel:"noopener noreferrer",className:f("relative block overflow-hidden",s),onClick:l=>l.stopPropagation(),children:[jsxRuntime.jsx("img",{src:a,alt:`${t} ${i+1}`,className:"h-full w-full object-cover transition-transform duration-300 hover:scale-105"}),i===r.length-1&&n>0&&jsxRuntime.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/60",children:jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-white",children:["+",n]})})]},i);return r.length===0?null:r.length===1?jsxRuntime.jsx("div",{className:"mt-2.5 h-36 overflow-hidden rounded-xl",children:o(r[0],0,"h-full")}):r.length===2?jsxRuntime.jsx("div",{className:"mt-2.5 grid h-28 grid-cols-2 gap-0.5 overflow-hidden rounded-xl",children:r.map((a,i)=>o(a,i))}):r.length===3?jsxRuntime.jsxs("div",{className:"mt-2.5 grid h-36 grid-cols-2 grid-rows-2 gap-0.5 overflow-hidden rounded-xl",children:[o(r[0],0,"row-span-2"),o(r[1],1),o(r[2],2)]}):jsxRuntime.jsx("div",{className:"mt-2.5 grid h-44 grid-cols-2 grid-rows-2 gap-0.5 overflow-hidden rounded-xl",children:r.map((a,i)=>o(a,i))})}function su({actions:e}){let t=e.filter(i=>i.variant!=="primary"),r=e.filter(i=>i.variant==="primary"),n="inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1 text-xs font-medium text-secondary-500 transition-colors hover:bg-secondary-100/80 hover:text-secondary-700 dark:text-secondary-400 dark:hover:bg-primary-800/60 dark:hover:text-secondary-200",o="inline-flex items-center gap-1.5 rounded-lg border border-primary-200/70 bg-primary-50/80 px-3 py-1 text-xs font-semibold text-primary-700 transition-colors hover:bg-primary-100 dark:border-primary-600/60 dark:bg-primary-800/60 dark:text-primary-300 dark:hover:bg-primary-700/60",a=(i,s,l)=>i.href?jsxRuntime.jsxs("a",{href:i.href,target:"_blank",rel:"noopener noreferrer",className:l,onClick:c=>c.stopPropagation(),children:[i.icon,i.label]},s):jsxRuntime.jsxs("button",{type:"button",onClick:i.onClick,className:l,children:[i.icon,i.label]},s);return jsxRuntime.jsxs("div",{className:"mt-3 flex items-center gap-1 border-t border-primary-100/50 pt-2.5 dark:border-primary-700/40",children:[t.map((i,s)=>a(i,s,n)),r.length>0&&jsxRuntime.jsx("span",{className:"flex-1"}),r.map((i,s)=>a(i,s,o))]})}function lu({item:e,isActive:t,animated:r,visible:n,orientation:o}){let a=e.status??"pending",i={complete:"bg-gradient-to-br from-white to-success-50/40 dark:from-primary-900 dark:to-success-900/10",active:"bg-gradient-to-br from-white to-primary-50/60 dark:from-primary-900 dark:to-primary-800/40",error:"bg-gradient-to-br from-white to-danger-50/40 dark:from-primary-900 dark:to-danger-900/10",pending:"bg-white dark:bg-primary-900"}[a],s={complete:"border-success-200/70 dark:border-success-800/50",active:"border-primary-300/80 dark:border-primary-600/70",error:"border-danger-200/70 dark:border-danger-800/50",pending:"border-primary-200/60 dark:border-primary-700/50"}[a],l=t?"shadow-lg shadow-primary-300/30 dark:shadow-primary-500/20":a==="complete"?"shadow-md shadow-success-300/20 dark:shadow-success-400/10":a==="error"?"shadow-md shadow-danger-300/20 dark:shadow-danger-400/10":"shadow-sm shadow-primary-100/50 dark:shadow-black/20",c=a==="complete"?"conic-gradient(from 30deg, transparent 0%, var(--tl-glow-complete-1) 18%, var(--tl-glow-complete-2) 30%, var(--tl-holo-cyan) 44%, transparent 60%)":a==="error"?"conic-gradient(from 150deg, transparent 0%, var(--tl-glow-error-1) 18%, var(--tl-glow-error-2) 32%, var(--tl-glow-error-3) 44%, transparent 58%)":null,u={complete:"bg-success-100 text-success-700 dark:bg-success-900/40 dark:text-success-300",active:"bg-primary-100 text-primary-700 dark:bg-primary-800/60 dark:text-primary-300",error:"bg-danger-100 text-danger-700 dark:bg-danger-900/40 dark:text-danger-300",pending:"bg-secondary-100 text-secondary-600 dark:bg-primary-800/50 dark:text-secondary-400"}[a];return jsxRuntime.jsxs("div",{className:f("relative isolate",r&&"transition-all duration-700",r?n?"opacity-100 translate-y-0":o==="vertical"?"opacity-0 translate-y-6":"opacity-0 translate-x-6":"",o==="horizontal"?"w-56 shrink-0":"flex-1",e.className),children:[!t&&c&&jsxRuntime.jsx("div",{className:"pointer-events-none absolute animate-[tl-glow-pulse_5s_ease-in-out_infinite]",style:{inset:"-6px",borderRadius:"1.5rem",zIndex:-1,background:c,filter:"blur(14px)",opacity:.22},"aria-hidden":true}),t&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"pointer-events-none absolute",style:{inset:"-7px",borderRadius:"1.5rem",zIndex:-1,background:"conic-gradient(from var(--tl-angle, 0deg) at 50% 50%, var(--tl-holo-base) 0%, var(--tl-holo-indigo) 18%, var(--tl-holo-violet) 30%, var(--tl-holo-cyan) 45%, var(--tl-holo-mid) 62%, var(--tl-holo-base) 100%)",filter:"blur(10px)",animation:"tl-breathe 2.8s ease-in-out infinite, tl-holo-spin 9s linear infinite"},"aria-hidden":true}),jsxRuntime.jsx("div",{className:"pointer-events-none absolute",style:{inset:"-1.5px",borderRadius:"1.0625rem",zIndex:-1,padding:"1.5px",background:"conic-gradient(from var(--tl-angle, 0deg) at 50% 50%, transparent 0deg, var(--tl-holo-indigo) 55deg, var(--tl-holo-violet) 85deg, var(--tl-holo-cyan) 115deg, transparent 175deg, transparent 360deg)",WebkitMask:"linear-gradient(white 0 0) content-box, linear-gradient(white 0 0)",WebkitMaskComposite:"xor",maskComposite:"exclude",animation:"tl-holo-spin 5s linear infinite"},"aria-hidden":true})]}),jsxRuntime.jsx("div",{className:f("relative overflow-hidden rounded-2xl border backdrop-blur-[2px]",t?"border-transparent":f("border",s),i,l),children:e.imagePosition==="left"&&e.image?jsxRuntime.jsxs("div",{className:"flex min-h-[8rem]",children:[jsxRuntime.jsx("a",{href:e.image,target:"_blank",rel:"noopener noreferrer",className:"w-28 shrink-0 overflow-hidden",onClick:m=>m.stopPropagation(),"aria-label":e.title,children:jsxRuntime.jsx("img",{src:e.image,alt:e.title,className:"h-full w-full object-cover transition-transform duration-500 hover:scale-105"})}),jsxRuntime.jsxs("div",{className:"flex flex-1 flex-col p-4",children:[e.date&&jsxRuntime.jsx("span",{className:f("mb-2 inline-flex items-center gap-1 rounded-md px-2 py-0.5 text-[0.65rem] font-semibold tracking-wide",u),children:e.date}),jsxRuntime.jsx("h3",{className:f("text-sm font-semibold leading-snug",t?"text-primary-900 dark:text-white":"text-primary-800 dark:text-primary-100"),children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"mt-1 text-xs leading-relaxed text-secondary-500 dark:text-secondary-400",children:e.description}),e.images&&e.images.length>0&&jsxRuntime.jsx(iu,{images:e.images,title:e.title}),e.actions&&e.actions.length>0&&jsxRuntime.jsx(su,{actions:e.actions})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[e.image&&jsxRuntime.jsx("div",{className:"overflow-hidden",children:jsxRuntime.jsx("img",{src:e.image,alt:e.title,className:"h-32 w-full object-cover transition-transform duration-500 hover:scale-105"})}),e.svg&&!e.image&&jsxRuntime.jsx("div",{className:"flex items-center justify-center bg-primary-50/60 p-4 dark:bg-primary-800/40",children:e.svg}),jsxRuntime.jsxs("div",{className:f("p-4",(e.image||e.svg)&&"pt-3"),children:[e.date&&jsxRuntime.jsx("span",{className:f("mb-2.5 inline-flex items-center gap-1 rounded-md px-2 py-0.5 text-[0.65rem] font-semibold tracking-wide",u),children:e.date}),jsxRuntime.jsx("h3",{className:f("text-sm font-semibold leading-snug",t?"text-primary-900 dark:text-white":"text-primary-800 dark:text-primary-100"),children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"mt-1 text-xs leading-relaxed text-secondary-500 dark:text-secondary-400",children:e.description}),e.images&&e.images.length>0&&jsxRuntime.jsx(iu,{images:e.images,title:e.title}),e.actions&&e.actions.length>0&&jsxRuntime.jsx(su,{actions:e.actions})]})]})})]})}function il({items:e,orientation:t="vertical",activeIndex:r,animated:n=true,lineStyle:o="solid",className:a}){let i=On.useRef(null),s=On.useRef([]),[l,c]=On.useState(new Set);On.useEffect(()=>{if(!n){c(new Set(e.map((m,d)=>d)));return}let p=new IntersectionObserver(m=>{c(d=>{let g=new Set(d);return m.forEach(h=>{let b=Number(h.target.dataset.idx);h.isIntersecting&&g.add(b);}),g});},{threshold:.15});return s.current.forEach(m=>m&&p.observe(m)),()=>p.disconnect()},[e,n]),On.useEffect(()=>{if(r==null)return;let p=s.current[r];p&&p.scrollIntoView({behavior:"smooth",block:"center",inline:"center"});},[r]);let u=o==="dashed"?"border-dashed":"";return t==="vertical"?jsxRuntime.jsxs("div",{ref:i,className:f("relative",a),children:[jsxRuntime.jsx("div",{className:"absolute left-5 top-0 h-full w-px bg-primary-200 dark:bg-primary-700"}),jsxRuntime.jsx("div",{className:"space-y-6",children:e.map((p,m)=>{let d=p.status??"pending",g=m===r;return jsxRuntime.jsxs("div",{ref:h=>{s.current[m]=h;},"data-idx":m,className:"relative flex gap-4",children:[jsxRuntime.jsx("div",{className:"relative z-10 flex shrink-0 flex-col items-center",children:jsxRuntime.jsx("div",{className:f("flex h-10 w-10 items-center justify-center rounded-full border-2 transition-all duration-300 [&_svg]:shrink-0",nu[d],g&&ou[d]),children:jsxRuntime.jsx(au,{status:d,icon:p.icon})})}),jsxRuntime.jsx(lu,{item:p,isActive:g,animated:n,visible:l.has(m),orientation:"vertical"})]},p.id??m)})})]}):jsxRuntime.jsx("div",{ref:i,className:f("relative overflow-x-auto pb-4",a),children:jsxRuntime.jsx("div",{className:"flex min-w-max gap-6 px-4",children:e.map((p,m)=>{let d=p.status??"pending",g=m===r,h=m===e.length-1;return jsxRuntime.jsxs("div",{ref:b=>{s.current[m]=b;},"data-idx":m,className:"relative flex flex-col items-center gap-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("div",{className:f("flex h-10 w-10 items-center justify-center rounded-full border-2 transition-all duration-300 z-10 [&_svg]:shrink-0",nu[d],g&&ou[d]),children:jsxRuntime.jsx(au,{status:d,icon:p.icon})}),!h&&jsxRuntime.jsx("div",{className:f("h-px w-28 border-t-2",u,d==="complete"?"border-success-400":"border-primary-200 dark:border-primary-700")})]}),jsxRuntime.jsx(lu,{item:p,isActive:g,animated:n,visible:l.has(m),orientation:"horizontal"})]},p.id??m)})})})}function mo(e="en-US",t="long"){return Array.from({length:12},(r,n)=>new Intl.DateTimeFormat(e,{month:t}).format(new Date(2e3,n,1)))}function cu(e="en-US",t="narrow"){let r=new Date(2e3,0,2);return Array.from({length:7},(n,o)=>{let a=new Date(r);return a.setDate(r.getDate()+o),new Intl.DateTimeFormat(e,{weekday:t}).format(a)})}function du(e,t=true,r=true){return e==="date"?"YYYY-MM-DD":e==="time"?t?r?"HH:mm:ss":"HH:mm":r?"hh:mm:ss A":"hh:mm A":t?r?"YYYY-MM-DD HH:mm:ss":"YYYY-MM-DD HH:mm":r?"YYYY-MM-DD hh:mm:ss A":"YYYY-MM-DD hh:mm A"}function Ny(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function uu(e,t,r="en-US"){let n=e.getHours(),o=mo(r,"long"),a=mo(r,"short"),i={YYYY:String(e.getFullYear()),YY:String(e.getFullYear()).slice(-2),MMMM:o[e.getMonth()],MMM:a[e.getMonth()],MM:String(e.getMonth()+1).padStart(2,"0"),M:String(e.getMonth()+1),DD:String(e.getDate()).padStart(2,"0"),D:String(e.getDate()),HH:String(n).padStart(2,"0"),H:String(n),hh:String(n%12||12).padStart(2,"0"),h:String(n%12||12),mm:String(e.getMinutes()).padStart(2,"0"),ss:String(e.getSeconds()).padStart(2,"0"),A:n<12?"AM":"PM",a:n<12?"am":"pm"},s=Object.keys(i).sort((c,u)=>u.length-c.length),l=new RegExp(s.map(Ny).join("|"),"g");return t.replace(l,c=>i[c]??c)}function vn(e,t){return new Date(e,t+1,0).getDate()}function pu(e,t){let r=new Date(e,t,1).getDay(),n=vn(e,t),o=vn(e,t-1),a=[];for(let s=r-1;s>=0;s--)a.push({date:new Date(e,t-1,o-s),thisMonth:false});for(let s=1;s<=n;s++)a.push({date:new Date(e,t,s),thisMonth:true});let i=42-a.length;for(let s=1;s<=i;s++)a.push({date:new Date(e,t+1,s),thisMonth:false});return a}function xn(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())}function sl(e,t){return xn(e).getTime()===xn(t).getTime()}function mu(e,t){return xn(e)<xn(t)}function fu(e,t){return xn(e)>xn(t)}function ja(e,t,r){return t&&e<t?new Date(t):r&&e>r?new Date(r):e}function hu(e,t,r,n){let o=new Date(e),i=t*(n==="future"?1:-1);switch(r){case "day":o.setDate(o.getDate()+i);break;case "week":o.setDate(o.getDate()+i*7);break;case "month":o.setMonth(o.getMonth()+i);break;case "year":o.setFullYear(o.getFullYear()+i);break}return o}function gu(e,t=200){let r=e-Math.floor(t/2);return Array.from({length:t},(n,o)=>r+o)}function bu(e){let{value:t,defaultValue:r,onChange:n,mode:o="datetime",minDate:a,maxDate:i,use24Hour:s=true,showSeconds:l=true,locale:c="en-US",format:u,onOpen:p,onClose:m}=e,d=t!==void 0,[g,h]=On.useState(r??null),b=d?t??null:g,[y,v]=On.useState(false),[N,x]=On.useState(()=>b??new Date),[w,L]=On.useState("drum"),[P,A]=On.useState(()=>(b??new Date).getFullYear()),[D,S]=On.useState(()=>(b??new Date).getMonth()),[C,I]=On.useState(1),[k,T]=On.useState("day"),[R,O]=On.useState("future"),E=u??du(o,s,l),ne=b?uu(b,E,c):"",U=On.useCallback(()=>{let M=b??new Date;x(new Date(M)),A(M.getFullYear()),S(M.getMonth()),L("drum"),v(true),p?.();},[b,p]),z=On.useCallback(()=>{v(false),m?.();},[m]),H=On.useCallback(()=>{let M=ja(N,a,i);d||h(M),n?.(M),z();},[N,a,i,d,n,z]),_=On.useCallback(()=>{d||h(null),n?.(null),z();},[d,n,z]),V=On.useCallback((M,F)=>{x(re=>{let W=new Date(re);switch(M){case "year":W.setFullYear(F);break;case "month":{W.setMonth(F);let G=vn(W.getFullYear(),F);W.getDate()>G&&W.setDate(G);break}case "day":W.setDate(F);break;case "hour":W.setHours(F);break;case "minute":W.setMinutes(F);break;case "second":W.setSeconds(F);break}return ja(W,a,i)});},[a,i]),oe=On.useCallback(()=>{let M=ja(hu(new Date,C,k,R),a,i);x(M),A(M.getFullYear()),S(M.getMonth());},[C,k,R,a,i]),be=On.useCallback(M=>{let F=D+M,re=P;F<0&&(F=11,re--),F>11&&(F=0,re++),S(F),A(re);},[D,P]);return {isOpen:y,displayValue:ne,workingDate:N,view:w,calYear:P,calMonth:D,offsetAmount:C,offsetUnit:k,offsetDirection:R,mode:o,use24Hour:s,showSeconds:l,locale:c,minDate:a,maxDate:i,openPicker:U,closePicker:z,confirm:H,clear:_,updateField:V,setView:L,setCalYear:A,setCalMonth:S,setOffsetAmount:I,setOffsetUnit:T,setOffsetDirection:O,applyQuickOffset:oe,navigateCalendar:be}}var ho=40;function xu(e,t,r=true){let n=On.useRef(t);n.current=t,On.useEffect(()=>{if(!r)return;function o(a){let i=a.target;e.some(l=>l.current?.contains(i))||n.current();}return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[e,r]);}function wu(e,t,r){let n=On.useRef(false),o=On.useRef(void 0),a=On.useRef(r);a.current=r;let i=On.useRef(t);i.current=t;let s=On.useCallback((c,u="smooth")=>{let p=e.current;if(!p)return;let m=c*ho;Math.abs(p.scrollTop-m)<2&&u!=="instant"||(u==="instant"?p.scrollTop=m:p.scrollTo({top:m,behavior:u}));},[e]),l=On.useCallback(()=>{e.current&&(n.current=true,clearTimeout(o.current),o.current=setTimeout(()=>{n.current=false;let u=e.current;if(!u)return;let p=Math.round(u.scrollTop/ho),m=Math.max(0,Math.min(i.current-1,p)),d=m*ho;Math.abs(u.scrollTop-d)>1&&u.scrollTo({top:d,behavior:"smooth"}),a.current(m);},120));},[e]);return {scrollToIndex:s,handleScroll:l,isScrollingRef:n}}function ku(e,t,r){On.useEffect(()=>{if(!r)return;function n(){let a=e.current,i=t.current;if(!a||!i)return;if(window.innerWidth<=640){i.style.top="",i.style.left="";return}let s=a.getBoundingClientRect(),l=window.innerHeight,c=window.innerWidth,u=i.offsetHeight||460,p=i.offsetWidth||340,m=s.bottom+8,d=s.left;m+u>l-16&&(m=Math.max(16,s.top-u-8)),d+p>c-16&&(d=Math.max(16,c-p-16)),d<16&&(d=16),i.style.top=`${Math.round(m)}px`,i.style.left=`${Math.round(d)}px`;}let o=setTimeout(n,0);return window.addEventListener("resize",n),window.addEventListener("scroll",n,true),()=>{clearTimeout(o),window.removeEventListener("resize",n),window.removeEventListener("scroll",n,true);}},[r,e,t]);}function yr({items:e,selectedValue:t,onSelect:r,label:n}){let o=On.useRef(null),a=On.useRef(t),i=On.useRef(false),{scrollToIndex:s,handleScroll:l}=wu(o,e.length,c=>{let u=e[c];u&&(i.current=true,r(u.value),setTimeout(()=>{i.current=false;},200));});return On.useEffect(()=>{let c=o.current;if(!c)return;let u=e.findIndex(p=>p.value===t);u>=0&&(c.scrollTop=u*ho);},[]),On.useEffect(()=>{if(a.current!==t&&(a.current=t,!i.current)){let c=e.findIndex(u=>u.value===t);c>=0&&s(c,"smooth");}},[t,e,s]),jsxRuntime.jsxs("div",{className:"dtp-column",role:"group","aria-label":n,children:[jsxRuntime.jsx("div",{className:"dtp-column-highlight","aria-hidden":"true"}),jsxRuntime.jsx("div",{ref:o,className:"dtp-column-list",onScroll:l,role:"listbox","aria-label":n,children:e.map(c=>jsxRuntime.jsx("div",{className:f("dtp-item",c.value===t&&"dtp-item--selected"),onClick:()=>{let u=e.findIndex(p=>p.value===c.value);u>=0&&s(u,"smooth"),r(c.value);},role:"option","aria-selected":c.value===t,children:c.label},c.value))}),jsxRuntime.jsx("div",{className:"dtp-fade-top","aria-hidden":"true"}),jsxRuntime.jsx("div",{className:"dtp-fade-bottom","aria-hidden":"true"})]})}function Ry({year:e,month:t,selectedDate:r,today:n,minDate:o,maxDate:a,locale:i,onSelectDay:s,onPrev:l,onNext:c}){let u=cu(i,"narrow"),p=mo(i,"long"),m=pu(e,t);return jsxRuntime.jsxs("div",{className:"dtp-calendar",children:[jsxRuntime.jsxs("div",{className:"dtp-cal-nav",children:[jsxRuntime.jsx("button",{type:"button",className:"dtp-cal-nav-btn",onClick:l,"aria-label":"Previous month",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"h-4 w-4"})}),jsxRuntime.jsxs("span",{className:"dtp-cal-title",children:[p[t]," ",e]}),jsxRuntime.jsx("button",{type:"button",className:"dtp-cal-nav-btn",onClick:c,"aria-label":"Next month",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"h-4 w-4"})})]}),jsxRuntime.jsx("div",{className:"dtp-cal-weekdays",role:"row",children:u.map((d,g)=>jsxRuntime.jsx("div",{className:"dtp-cal-weekday",role:"columnheader","aria-label":d,children:d},g))}),jsxRuntime.jsx("div",{className:"dtp-cal-days",role:"grid",children:m.map(({date:d,thisMonth:g},h)=>{let b=sl(d,r),y=sl(d,n),v=o!=null&&mu(d,o)||a!=null&&fu(d,a);return jsxRuntime.jsx("button",{type:"button",role:"gridcell",className:f("dtp-cal-day",!g&&"dtp-cal-day--other",b&&"dtp-cal-day--selected",y&&!b&&"dtp-cal-day--today",v&&"dtp-cal-day--disabled"),onClick:()=>!v&&s(d),disabled:v,"aria-current":y?"date":void 0,"aria-selected":b,"aria-disabled":v,children:d.getDate()},h)})})]})}function Ey({amount:e,unit:t,direction:r,onAmountChange:n,onUnitChange:o,onDirectionChange:a,onApply:i,locale:s}){let l=s.startsWith("zh"),c=[{value:"day",label:l?"\u5929":"Day"},{value:"week",label:l?"\u5468":"Week"},{value:"month",label:l?"\u6708":"Month"},{value:"year",label:l?"\u5E74":"Year"}],u=[{value:"future",label:l?"\u4EE5\u540E":"from now"},{value:"past",label:l?"\u4EE5\u524D":"before now"}];return jsxRuntime.jsxs("div",{className:"dtp-quick-offset","aria-label":l?"\u5FEB\u901F\u504F\u79FB":"Quick offset",children:[jsxRuntime.jsx("input",{type:"number",className:"dtp-offset-input",value:e,min:1,max:9999,"aria-label":l?"\u504F\u79FB\u6570\u91CF":"Offset amount",onChange:p=>{let m=parseInt(p.target.value,10);!isNaN(m)&&m>=1&&n(m);}}),jsxRuntime.jsx("select",{className:"dtp-offset-select",value:t,"aria-label":l?"\u504F\u79FB\u5355\u4F4D":"Offset unit",onChange:p=>o(p.target.value),children:c.map(p=>jsxRuntime.jsx("option",{value:p.value,children:p.label},p.value))}),jsxRuntime.jsx("select",{className:"dtp-offset-select",value:r,"aria-label":l?"\u504F\u79FB\u65B9\u5411":"Offset direction",onChange:p=>a(p.target.value),children:u.map(p=>jsxRuntime.jsx("option",{value:p.value,children:p.label},p.value))}),jsxRuntime.jsx("button",{type:"button",className:"dtp-offset-apply",onClick:i,children:l?"\u5E94\u7528":"Apply"})]})}function Wa({className:e,popupClassName:t,triggerClassName:r,disabled:n=false,placeholder:o,...a}){let{isOpen:i,displayValue:s,workingDate:l,view:c,calYear:u,calMonth:p,offsetAmount:m,offsetUnit:d,offsetDirection:g,mode:h,use24Hour:b,showSeconds:y,locale:v,minDate:N,maxDate:x,openPicker:w,closePicker:L,confirm:P,clear:A,updateField:D,setView:S,setCalYear:C,setCalMonth:I,setOffsetAmount:k,setOffsetUnit:T,setOffsetDirection:R,applyQuickOffset:O,navigateCalendar:E}=bu({...a}),ne=On.useRef(null),U=On.useRef(null),z=new Date;xu([ne,U],L,i),ku(ne,U,i);let H=v.startsWith("zh"),_={cancel:H?"\u53D6\u6D88":"Cancel",confirm:H?"\u786E\u5B9A":"Confirm",calendarView:H?"\u65E5\u5386":"Calendar",scrollView:H?"\u6EDA\u8F6E":"Scroll",placeholder:o??(H?"\u9009\u62E9\u65E5\u671F\u65F6\u95F4":"Select date / time")},V=h==="date"||h==="datetime",oe=h==="time"||h==="datetime",be=gu(l.getFullYear(),200).map(te=>({label:String(te),value:te})),M=mo(v,"short").map((te,ve)=>({label:te,value:ve})),F=vn(l.getFullYear(),l.getMonth()),re=Array.from({length:F},(te,ve)=>({label:String(ve+1).padStart(2,"0"),value:ve+1})),W=Array.from({length:24},(te,ve)=>({label:String(ve).padStart(2,"0"),value:ve})),G=Array.from({length:12},(te,ve)=>({label:String(ve===0?12:ve).padStart(2,"0"),value:ve})),le=[{label:"AM",value:0},{label:"PM",value:1}],ke=Array.from({length:60},(te,ve)=>({label:String(ve).padStart(2,"0"),value:ve})),B=l.getHours(),q=B%12,Z=B<12?0:1,ue=oe&&!V?lucideReact.Clock:lucideReact.Calendar;return jsxRuntime.jsxs("div",{className:f("dtp-root",e),children:[jsxRuntime.jsxs("div",{className:"dtp-trigger-wrap",children:[jsxRuntime.jsxs("button",{ref:ne,type:"button",className:f("dtp-trigger",s&&"dtp-trigger--has-clear",n&&"dtp-trigger--disabled",r),onClick:()=>!n&&(i?L():w()),disabled:n,"aria-haspopup":"dialog","aria-expanded":i,children:[jsxRuntime.jsx(ue,{className:"dtp-trigger-icon","aria-hidden":"true"}),jsxRuntime.jsx("span",{className:f("dtp-trigger-text",!s&&"dtp-trigger-placeholder"),children:s||_.placeholder})]}),s&&jsxRuntime.jsx("button",{type:"button",className:"dtp-trigger-clear","aria-label":H?"\u6E05\u9664":"Clear value",onClick:()=>!n&&A(),children:jsxRuntime.jsx(lucideReact.X,{className:"h-3.5 w-3.5"})})]}),i&&reactDom.createPortal(jsxRuntime.jsxs("div",{ref:U,className:f("dtp-panel",t),role:"dialog","aria-modal":"true","aria-label":H?"\u65E5\u671F\u65F6\u95F4\u9009\u62E9\u5668":"Date time picker",children:[jsxRuntime.jsxs("div",{className:"dtp-panel-header",children:[jsxRuntime.jsx("span",{className:"dtp-panel-preview",children:s||_.placeholder}),jsxRuntime.jsx("div",{className:"dtp-panel-actions",children:V&&jsxRuntime.jsx("button",{type:"button",className:f("dtp-view-btn",c==="calendar"&&"dtp-view-btn--active"),"aria-pressed":c==="calendar",title:c==="calendar"?_.scrollView:_.calendarView,onClick:()=>{c!=="calendar"&&(C(l.getFullYear()),I(l.getMonth())),S(c==="calendar"?"drum":"calendar");},children:jsxRuntime.jsx(lucideReact.Calendar,{className:"h-4 w-4"})})})]}),jsxRuntime.jsx("div",{className:"dtp-panel-body",children:c==="drum"?jsxRuntime.jsxs("div",{className:"dtp-drum",children:[V&&jsxRuntime.jsxs("div",{className:"dtp-drum-date",children:[jsxRuntime.jsx(yr,{label:H?"\u5E74":"Year",items:be,selectedValue:l.getFullYear(),onSelect:te=>D("year",te)}),jsxRuntime.jsx(yr,{label:H?"\u6708":"Month",items:M,selectedValue:l.getMonth(),onSelect:te=>D("month",te)}),jsxRuntime.jsx(yr,{label:H?"\u65E5":"Day",items:re,selectedValue:l.getDate(),onSelect:te=>D("day",te)})]}),V&&oe&&jsxRuntime.jsx("div",{className:"dtp-drum-sep","aria-hidden":"true"}),oe&&jsxRuntime.jsxs("div",{className:"dtp-drum-time",children:[b?jsxRuntime.jsx(yr,{label:H?"\u65F6":"Hour",items:W,selectedValue:B,onSelect:te=>D("hour",te)}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(yr,{label:H?"\u65F6":"Hour",items:G,selectedValue:q,onSelect:te=>{D("hour",Z===1?te+12:te);}}),jsxRuntime.jsx(yr,{label:"AM/PM",items:le,selectedValue:Z,onSelect:te=>{D("hour",q+(te===1?12:0));}})]}),jsxRuntime.jsx(yr,{label:H?"\u5206":"Min",items:ke,selectedValue:l.getMinutes(),onSelect:te=>D("minute",te)}),y&&jsxRuntime.jsx(yr,{label:H?"\u79D2":"Sec",items:ke,selectedValue:l.getSeconds(),onSelect:te=>D("second",te)})]})]}):jsxRuntime.jsx(Ry,{year:u,month:p,selectedDate:l,today:z,minDate:N,maxDate:x,locale:v,onSelectDay:te=>{D("year",te.getFullYear()),D("month",te.getMonth()),D("day",te.getDate()),S("drum");},onPrev:()=>E(-1),onNext:()=>E(1)})}),V&&jsxRuntime.jsx("div",{className:"dtp-panel-offset",children:jsxRuntime.jsx(Ey,{amount:m,unit:d,direction:g,onAmountChange:k,onUnitChange:T,onDirectionChange:R,onApply:O,locale:v})}),jsxRuntime.jsxs("div",{className:"dtp-panel-footer",children:[jsxRuntime.jsx("button",{type:"button",className:"dtp-btn-cancel",onClick:L,children:_.cancel}),jsxRuntime.jsx("button",{type:"button",className:"dtp-btn-confirm",onClick:P,children:_.confirm})]})]}),document.body)]})}var Ua=classVarianceAuthority.cva("w-full rounded-md font-mono text-center transition-all focus:outline-none focus:ring-2 disabled:pointer-events-none disabled:opacity-50",{variants:{size:{sm:"h-9 w-9 text-sm",md:"h-12 w-12 text-base",lg:"h-14 w-14 text-lg"},variant:{outline:"border border-secondary-300 bg-transparent focus:border-primary-500 focus:ring-primary-500/20 dark:border-secondary-600 dark:bg-transparent dark:focus:border-primary-400",filled:"border border-transparent bg-secondary-100 focus:border-primary-500 focus:ring-primary-500/20 dark:bg-secondary-800 dark:focus:border-primary-400",underline:"rounded-none border-0 border-b-2 border-secondary-300 bg-transparent px-0 focus:border-primary-500 focus:ring-0 dark:border-secondary-600 dark:focus:border-primary-400"},invalid:{true:"border-danger-400 focus:border-danger-500 focus:ring-danger-500/20",false:""}},defaultVariants:{size:"md",variant:"outline",invalid:false}}),ll=classVarianceAuthority.cva("w-full",{variants:{intent:{default:"",card:"rounded-(--form-radius) border border-primary-200 bg-white p-6 shadow-sm dark:border-primary-700 dark:bg-primary-900",inset:"rounded-(--form-radius) bg-primary-50 p-6 dark:bg-primary-800/50"},size:{sm:"",md:"",lg:""}},defaultVariants:{intent:"default",size:"md"}});classVarianceAuthority.cva("flex w-full",{variants:{layout:{stacked:"flex-col gap-1.5",inline:"flex-row items-start gap-(--form-item-gap-md)"},size:{sm:"",md:"",lg:""}},defaultVariants:{layout:"stacked",size:"md"}});var cl=classVarianceAuthority.cva("mt-1 flex items-center gap-1 text-xs [&_svg]:h-3.5 [&_svg]:w-3.5 [&_svg]:shrink-0",{variants:{status:{error:"text-danger-600 dark:text-danger-400",warning:"text-warning-600 dark:text-warning-400",success:"text-success-600 dark:text-success-400",hint:"text-primary-400 dark:text-primary-500"}},defaultVariants:{status:"hint"}});function wn({length:e=6,value:t,defaultValue:r="",onChange:n,onComplete:o,size:a="md",variant:i="outline",disabled:s=false,readOnly:l=false,autoFocus:c=false,alphanumeric:u=false,mask:p=false,invalid:m=false,className:d}){let g=t!==void 0,[h,b]=On.useState(()=>{let S=(r??"").slice(0,e);return Array.from({length:e},(C,I)=>S[I]??"")}),y=g?Array.from({length:e},(S,C)=>(t??"")[C]??""):h,v=On.useRef([]),N=On.useRef([]);On.useEffect(()=>{c&&v.current[0]&&v.current[0].focus();},[c]);let x=On.useCallback(S=>{g||b(S);let C=S.join("");n?.(C),S.every(I=>I!=="")&&S.length===e&&o?.(C);},[g,n,o,e]),w=S=>{let C=v.current[S];C&&(C.classList.remove("otp-pop"),clearTimeout(N.current[S]),C.offsetWidth,C.classList.add("otp-pop"),N.current[S]=window.setTimeout(()=>C.classList.remove("otp-pop"),200));},L=On.useCallback((S,C)=>{let I=u?/[a-zA-Z0-9]/g:/[0-9]/g,k=C.match(I)??[];if(k.length===0)return;let T=k[k.length-1],R=[...y];R[S]=T,x(R),w(S),S<e-1&&v.current[S+1]?.focus();},[y,e,u,x]),P=On.useCallback((S,C)=>{if(C.key==="Backspace"){if(C.preventDefault(),y[S]){let I=[...y];I[S]="",x(I);}else if(S>0){v.current[S-1]?.focus();let I=[...y];I[S-1]="",x(I);}}else if(C.key==="ArrowLeft")C.preventDefault(),S>0&&v.current[S-1]?.focus();else if(C.key==="ArrowRight")C.preventDefault(),S<e-1&&v.current[S+1]?.focus();else if(C.key==="Delete"){C.preventDefault();let I=[...y];I[S]="",x(I);}},[y,e,x]),A=On.useCallback((S,C)=>{C.preventDefault();let I=C.clipboardData.getData("text"),k=u?/[a-zA-Z0-9]/g:/[0-9]/g,T=I.match(k)??[],R=[...y],O=S;for(let U=0;U<T.length&&S+U<e;U++)R[S+U]=T[U],O=S+U;x(R);let E=R.findIndex((U,z)=>z>O&&U===""),ne=E!==-1?E:Math.min(O+1,e-1);v.current[ne]?.focus();},[y,e,u,x]),D=On.useCallback(S=>{S.target.select();},[]);return jsxRuntime.jsx("div",{role:"group","aria-label":"OTP Input",className:f("inline-flex gap-2",d),children:Array.from({length:e},(S,C)=>jsxRuntime.jsx("input",{ref:I=>{v.current[C]=I;},type:p?"password":"text",inputMode:u?"text":"numeric",pattern:u?"[a-zA-Z0-9]":"[0-9]",maxLength:2,value:y[C],disabled:s,readOnly:l,autoComplete:"one-time-code","aria-label":`Digit ${C+1} of ${e}`,className:f(Ua({size:a,variant:i,invalid:m||void 0}),"text-secondary-900 dark:text-secondary-100"),onChange:I=>L(C,I.target.value),onKeyDown:I=>P(C,I),onPaste:I=>A(C,I),onFocus:D},C))})}var zy={login:"Welcome back",register:"Create account",otp:"Verify your identity",forgot:"Reset password"},Vy={login:"Sign in to your account to continue",register:"Fill in the details to get started",otp:"Enter the 6-digit code sent to your email",forgot:"We'll send a reset link to your email"};function Ga({mode:e,onModeChange:t,onLogin:r,onRegister:n,onOTPComplete:o,onForgotPassword:a,logo:i,title:s,subtitle:l,socialLogins:c,showRememberMe:u=true,isLoading:p=false,error:m,className:d,style:g}){let[h,b]=On.useState("login"),y=e!==void 0,v=y?e:h,N=On.useCallback(V=>{y||b(V),t?.(V);},[y,t]),[x,w]=On.useState(""),[L,P]=On.useState(""),[A,D]=On.useState(false),[S,C]=On.useState(""),[I,k]=On.useState(""),[T,R]=On.useState(""),[O,E]=On.useState(""),ne=On.useCallback(async V=>{V.preventDefault(),await r?.(x,L,A);},[x,L,A,r]),U=On.useCallback(async V=>{V.preventDefault(),await n?.(S,I,T);},[S,I,T,n]),z=On.useCallback(async V=>{V.preventDefault(),await a?.(O);},[O,a]),H=s??zy[v],_=l??Vy[v];return jsxRuntime.jsxs("div",{className:f("w-full max-w-sm rounded-2xl border border-primary-200 bg-white/90 p-8 shadow-xl backdrop-blur-md","dark:border-primary-700 dark:bg-primary-900/90",d),style:g,children:[i&&jsxRuntime.jsx("div",{className:"mb-6 flex justify-center",children:i}),jsxRuntime.jsxs("div",{className:"mb-6 text-center",children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-primary-900 dark:text-primary-50",children:H}),jsxRuntime.jsx("p",{className:"mt-1 text-sm text-secondary-500 dark:text-secondary-400",children:_})]}),c&&c.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"mb-4 flex flex-col gap-2",children:c.map((V,oe)=>jsxRuntime.jsxs("button",{type:"button",onClick:V.onClick,disabled:p,className:f("flex w-full items-center justify-center gap-2 rounded-lg border border-secondary-300 px-4 py-2 text-sm font-medium","text-secondary-700 transition-colors hover:bg-secondary-50","dark:border-secondary-600 dark:text-secondary-300 dark:hover:bg-secondary-800","disabled:opacity-50 disabled:cursor-not-allowed","[&_svg]:h-4 [&_svg]:w-4"),children:[V.icon,V.label]},oe))}),jsxRuntime.jsxs("div",{className:"relative mb-4 flex items-center",children:[jsxRuntime.jsx("div",{className:"flex-1 border-t border-secondary-200 dark:border-secondary-700"}),jsxRuntime.jsx("span",{className:"mx-3 text-xs text-secondary-400 dark:text-secondary-500",children:"or continue with"}),jsxRuntime.jsx("div",{className:"flex-1 border-t border-secondary-200 dark:border-secondary-700"})]})]}),jsxRuntime.jsxs("div",{className:"login-panel-slide-enter",children:[v==="login"&&jsxRuntime.jsxs("form",{onSubmit:ne,className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"space-y-1.5",children:[jsxRuntime.jsx(_t,{htmlFor:"lp-email",children:"Email"}),jsxRuntime.jsx(Ft,{id:"lp-email",type:"email",placeholder:"you@example.com",value:x,onChange:V=>w(V.target.value),disabled:p,required:true})]}),jsxRuntime.jsxs("div",{className:"space-y-1.5",children:[jsxRuntime.jsx(_t,{htmlFor:"lp-password",children:"Password"}),jsxRuntime.jsx(Ft,{id:"lp-password",type:"password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",value:L,onChange:V=>P(V.target.value),disabled:p,required:true})]}),u&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(An,{checked:A,onCheckedChange:V=>D(!!V),label:"Remember me",disabled:p}),jsxRuntime.jsx("button",{type:"button",className:"text-xs text-primary-500 hover:underline dark:text-primary-400",onClick:()=>N("forgot"),children:"Forgot password?"})]}),m&&jsxRuntime.jsx("p",{className:"rounded-md bg-danger-50 p-2.5 text-sm text-danger-600 dark:bg-danger-900/30 dark:text-danger-400",children:m}),jsxRuntime.jsx(Vt,{type:"submit",className:"w-full",disabled:p,children:p?jsxRuntime.jsx("span",{className:"inline-block h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Sign in"," ",jsxRuntime.jsx(en,{className:"ml-1 opacity-60",children:jsxRuntime.jsx(Zr,{size:"xs",children:"\u23CE"})})]})}),jsxRuntime.jsxs("p",{className:"text-center text-sm text-secondary-500 dark:text-secondary-400",children:["Don't have an account?"," ",jsxRuntime.jsx("button",{type:"button",className:"font-medium text-primary-500 hover:underline dark:text-primary-400",onClick:()=>N("register"),children:"Register"})]})]}),v==="register"&&jsxRuntime.jsxs("form",{onSubmit:U,className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"space-y-1.5",children:[jsxRuntime.jsx(_t,{htmlFor:"lp-name",children:"Full name"}),jsxRuntime.jsx(Ft,{id:"lp-name",type:"text",placeholder:"Jane Doe",value:S,onChange:V=>C(V.target.value),disabled:p,required:true})]}),jsxRuntime.jsxs("div",{className:"space-y-1.5",children:[jsxRuntime.jsx(_t,{htmlFor:"lp-reg-email",children:"Email"}),jsxRuntime.jsx(Ft,{id:"lp-reg-email",type:"email",placeholder:"you@example.com",value:I,onChange:V=>k(V.target.value),disabled:p,required:true})]}),jsxRuntime.jsxs("div",{className:"space-y-1.5",children:[jsxRuntime.jsx(_t,{htmlFor:"lp-reg-password",children:"Password"}),jsxRuntime.jsx(Ft,{id:"lp-reg-password",type:"password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",value:T,onChange:V=>R(V.target.value),disabled:p,required:true})]}),m&&jsxRuntime.jsx("p",{className:"rounded-md bg-danger-50 p-2.5 text-sm text-danger-600 dark:bg-danger-900/30 dark:text-danger-400",children:m}),jsxRuntime.jsx(Vt,{type:"submit",className:"w-full",disabled:p,children:p?jsxRuntime.jsx("span",{className:"inline-block h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}):"Create account"}),jsxRuntime.jsxs("p",{className:"text-center text-sm text-secondary-500 dark:text-secondary-400",children:["Already have an account?"," ",jsxRuntime.jsx("button",{type:"button",className:"font-medium text-primary-500 hover:underline dark:text-primary-400",onClick:()=>N("login"),children:"Sign in"})]})]}),v==="otp"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsx("div",{className:"flex justify-center",children:jsxRuntime.jsx(wn,{length:6,size:"md",onComplete:async V=>{await o?.(V);},autoFocus:true})}),m&&jsxRuntime.jsx("p",{className:"rounded-md bg-danger-50 p-2.5 text-center text-sm text-danger-600 dark:bg-danger-900/30 dark:text-danger-400",children:m}),jsxRuntime.jsx("p",{className:"text-center text-sm text-secondary-500 dark:text-secondary-400",children:jsxRuntime.jsx("button",{type:"button",className:"font-medium text-primary-500 hover:underline dark:text-primary-400",onClick:()=>N("login"),children:"\u2190 Back to login"})})]}),v==="forgot"&&jsxRuntime.jsxs("form",{onSubmit:z,className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"space-y-1.5",children:[jsxRuntime.jsx(_t,{htmlFor:"lp-forgot-email",children:"Email address"}),jsxRuntime.jsx(Ft,{id:"lp-forgot-email",type:"email",placeholder:"you@example.com",value:O,onChange:V=>E(V.target.value),disabled:p,required:true})]}),m&&jsxRuntime.jsx("p",{className:"rounded-md bg-danger-50 p-2.5 text-sm text-danger-600 dark:bg-danger-900/30 dark:text-danger-400",children:m}),jsxRuntime.jsx(Vt,{type:"submit",className:"w-full",disabled:p,children:p?jsxRuntime.jsx("span",{className:"inline-block h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}):"Send reset link"}),jsxRuntime.jsx("p",{className:"text-center text-sm text-secondary-500 dark:text-secondary-400",children:jsxRuntime.jsx("button",{type:"button",className:"font-medium text-primary-500 hover:underline dark:text-primary-400",onClick:()=>N("login"),children:"\u2190 Back to login"})})]})]},v)]})}var Hy=Object.defineProperty,bl=(e,t)=>{for(var r in t)Hy(e,r,{get:t[r],enumerable:true});};function oi(e){let{state:t,transaction:r}=e,{selection:n}=r,{doc:o}=r,{storedMarks:a}=r;return {...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return a},get selection(){return n},get doc(){return o},get tr(){return n=r.selection,o=r.doc,a=r.storedMarks,r}}}var yl=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state;}get hasCustomState(){return !!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:e,editor:t,state:r}=this,{view:n}=t,{tr:o}=r,a=this.buildProps(o);return Object.fromEntries(Object.entries(e).map(([i,s])=>[i,(...c)=>{let u=s(...c)(a);return !o.getMeta("preventDispatch")&&!this.hasCustomState&&n.dispatch(o),u}]))}get chain(){return ()=>this.createChain()}get can(){return ()=>this.createCan()}createChain(e,t=true){let{rawCommands:r,editor:n,state:o}=this,{view:a}=n,i=[],s=!!e,l=e||o.tr,c=()=>(!s&&t&&!l.getMeta("preventDispatch")&&!this.hasCustomState&&a.dispatch(l),i.every(p=>p===true)),u={...Object.fromEntries(Object.entries(r).map(([p,m])=>[p,(...g)=>{let h=this.buildProps(l,t),b=m(...g)(h);return i.push(b),u}])),run:c};return u}createCan(e){let{rawCommands:t,state:r}=this,n=false,o=e||r.tr,a=this.buildProps(o,n);return {...Object.fromEntries(Object.entries(t).map(([s,l])=>[s,(...c)=>l(...c)({...a,dispatch:void 0})])),chain:()=>this.createChain(o,n)}}buildProps(e,t=true){let{rawCommands:r,editor:n,state:o}=this,{view:a}=n,i={tr:e,editor:n,view:a,state:oi({state:o,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([s,l])=>[s,(...c)=>l(...c)(i)]))}};return i}},$u={};bl($u,{blur:()=>_y,clearContent:()=>Fy,clearNodes:()=>Oy,command:()=>$y,createParagraphNear:()=>jy,cut:()=>Yy,deleteCurrentNode:()=>Uy,deleteNode:()=>Xy,deleteRange:()=>Gy,deleteSelection:()=>Jy,enter:()=>Qy,exitCode:()=>ev,extendMarkRange:()=>rv,first:()=>nv,focus:()=>sv,forEach:()=>lv,insertContent:()=>cv,insertContentAt:()=>yv,joinBackward:()=>Mv,joinDown:()=>Cv,joinForward:()=>Tv,joinItemBackward:()=>Pv,joinItemForward:()=>Ev,joinTextblockBackward:()=>Dv,joinTextblockForward:()=>Iv,joinUp:()=>Nv,keyboardShortcut:()=>Vv,lift:()=>_v,liftEmptyBlock:()=>Bv,liftListItem:()=>$v,newlineInCode:()=>jv,resetAttributes:()=>Wv,scrollIntoView:()=>Yv,selectAll:()=>Xv,selectNodeBackward:()=>qv,selectNodeForward:()=>Qv,selectParentNode:()=>ex,selectTextblockEnd:()=>rx,selectTextblockStart:()=>ox,setContent:()=>ix,setMark:()=>Px,setMeta:()=>Rx,setNode:()=>Ex,setNodeSelection:()=>Dx,setTextDirection:()=>Ax,setTextSelection:()=>Ix,sinkListItem:()=>Vx,splitBlock:()=>Fx,splitListItem:()=>Kx,toggleList:()=>jx,toggleMark:()=>Wx,toggleNode:()=>Yx,toggleWrap:()=>Ux,undoInputRule:()=>Xx,unsetAllMarks:()=>Gx,unsetMark:()=>qx,unsetTextDirection:()=>Jx,updateAttributes:()=>Qx,wrapIn:()=>ew,wrapInList:()=>rw});var _y=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var r;e.isDestroyed||(t.dom.blur(),(r=window?.getSelection())==null||r.removeAllRanges());}),true),Fy=(e=true)=>({commands:t})=>t.setContent("",{emitUpdate:e}),Oy=()=>({state:e,tr:t,dispatch:r})=>{let{selection:n}=t,{ranges:o}=n;return r&&o.forEach(({$from:a,$to:i})=>{e.doc.nodesBetween(a.pos,i.pos,(s,l)=>{if(s.type.isText)return;let{doc:c,mapping:u}=t,p=c.resolve(u.map(l)),m=c.resolve(u.map(l+s.nodeSize)),d=p.blockRange(m);if(!d)return;let g=transform.liftTarget(d);if(s.type.isTextblock){let{defaultType:h}=p.parent.contentMatchAt(p.index());t.setNodeMarkup(d.start,h);}(g||g===0)&&t.lift(d,g);});}),true},$y=e=>t=>e(t),jy=()=>({state:e,dispatch:t})=>commands.createParagraphNear(e,t),Yy=(e,t)=>({editor:r,tr:n})=>{let{state:o}=r,a=o.doc.slice(e.from,e.to);n.deleteRange(e.from,e.to);let i=n.mapping.map(t);return n.insert(i,a.content),n.setSelection(new state.TextSelection(n.doc.resolve(Math.max(i-1,0)))),true},Uy=()=>({tr:e,dispatch:t})=>{let{selection:r}=e,n=r.$anchor.node();if(n.content.size>0)return false;let o=e.selection.$anchor;for(let a=o.depth;a>0;a-=1)if(o.node(a).type===n.type){if(t){let s=o.before(a),l=o.after(a);e.delete(s,l).scrollIntoView();}return true}return false};function nt(e,t){if(typeof e=="string"){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}var Xy=e=>({tr:t,state:r,dispatch:n})=>{let o=nt(e,r.schema),a=t.selection.$anchor;for(let i=a.depth;i>0;i-=1)if(a.node(i).type===o){if(n){let l=a.before(i),c=a.after(i);t.delete(l,c).scrollIntoView();}return true}return false},Gy=e=>({tr:t,dispatch:r})=>{let{from:n,to:o}=e;return r&&t.delete(n,o),true},Jy=()=>({state:e,dispatch:t})=>commands.deleteSelection(e,t),Qy=()=>({commands:e})=>e.keyboardShortcut("Enter"),ev=()=>({state:e,dispatch:t})=>commands.exitCode(e,t);function vl(e){return Object.prototype.toString.call(e)==="[object RegExp]"}function ti(e,t,r={strict:true}){let n=Object.keys(t);return n.length?n.every(o=>r.strict?t[o]===e[o]:vl(t[o])?t[o].test(e[o]):t[o]===e[o]):true}function Ku(e,t,r={}){return e.find(n=>n.type===t&&ti(Object.fromEntries(Object.keys(r).map(o=>[o,n.attrs[o]])),r))}function Pu(e,t,r={}){return !!Ku(e,t,r)}function ju(e,t,r){var n;if(!e||!t)return;let o=e.parent.childAfter(e.parentOffset);if((!o.node||!o.node.marks.some(u=>u.type===t))&&(o=e.parent.childBefore(e.parentOffset)),!o.node||!o.node.marks.some(u=>u.type===t)||(r=r||((n=o.node.marks[0])==null?void 0:n.attrs),!Ku([...o.node.marks],t,r)))return;let i=o.index,s=e.start()+o.offset,l=i+1,c=s+o.node.nodeSize;for(;i>0&&Pu([...e.parent.child(i-1).marks],t,r);)i-=1,s-=e.parent.child(i).nodeSize;for(;l<e.parent.childCount&&Pu([...e.parent.child(l).marks],t,r);)c+=e.parent.child(l).nodeSize,l+=1;return {from:s,to:c}}function rr(e,t){if(typeof e=="string"){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}var rv=(e,t={})=>({tr:r,state:n,dispatch:o})=>{let a=rr(e,n.schema),{doc:i,selection:s}=r,{$from:l,from:c,to:u}=s;if(o){let p=ju(l,a,t);if(p&&p.from<=c&&p.to>=u){let m=state.TextSelection.create(i,p.from,p.to);r.setSelection(m);}}return true},nv=e=>t=>{let r=typeof e=="function"?e(t):e;for(let n=0;n<r.length;n+=1)if(r[n](t))return true;return false};function Wu(e){return e instanceof state.TextSelection}function Kr(e=0,t=0,r=0){return Math.min(Math.max(e,t),r)}function av(e,t=null){if(!t)return null;let r=state.Selection.atStart(e),n=state.Selection.atEnd(e);if(t==="start"||t===true)return r;if(t==="end")return n;let o=r.from,a=n.to;return t==="all"?state.TextSelection.create(e,Kr(0,o,a),Kr(e.content.size,o,a)):state.TextSelection.create(e,Kr(t,o,a),Kr(t,o,a))}function Lu(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function ri(){return ["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function iv(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):false}var sv=(e=null,t={})=>({editor:r,view:n,tr:o,dispatch:a})=>{t={scrollIntoView:true,...t};let i=()=>{(ri()||Lu())&&n.dom.focus(),iv()&&!ri()&&!Lu()&&n.dom.focus({preventScroll:true}),requestAnimationFrame(()=>{r.isDestroyed||(n.focus(),t?.scrollIntoView&&r.commands.scrollIntoView());});};try{if(n.hasFocus()&&e===null||e===!1)return !0}catch{return false}if(a&&e===null&&!Wu(r.state.selection))return i(),true;let s=av(o.doc,e)||r.state.selection,l=r.state.selection.eq(s);return a&&(l||o.setSelection(s),l&&o.storedMarks&&o.setStoredMarks(o.storedMarks),i()),true},lv=(e,t)=>r=>e.every((n,o)=>t(n,{...r,index:o})),cv=(e,t)=>({tr:r,commands:n})=>n.insertContentAt({from:r.selection.from,to:r.selection.to},e,t),Yu=e=>{let t=e.childNodes;for(let r=t.length-1;r>=0;r-=1){let n=t[r];n.nodeType===3&&n.nodeValue&&/^(\n\s\s|\n)$/.test(n.nodeValue)?e.removeChild(n):n.nodeType===1&&Yu(n);}return e};function qa(e){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");let t=`<body>${e}</body>`,r=new window.DOMParser().parseFromString(t,"text/html").body;return Yu(r)}function xo(e,t,r){if(e instanceof model.Node||e instanceof model.Fragment)return e;r={slice:true,parseOptions:{},...r};let n=typeof e=="object"&&e!==null,o=typeof e=="string";if(n)try{if(Array.isArray(e)&&e.length>0)return model.Fragment.fromArray(e.map(s=>t.nodeFromJSON(s)));let i=t.nodeFromJSON(e);return r.errorOnInvalidContent&&i.check(),i}catch(a){if(r.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:a});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",a),xo("",t,r)}if(o){if(r.errorOnInvalidContent){let i=false,s="",l=new model.Schema({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(i=true,s=typeof c=="string"?c:c.outerHTML,null)}]}})});if(r.slice?model.DOMParser.fromSchema(l).parseSlice(qa(e),r.parseOptions):model.DOMParser.fromSchema(l).parse(qa(e),r.parseOptions),r.errorOnInvalidContent&&i)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${s}`)})}let a=model.DOMParser.fromSchema(t);return r.slice?a.parseSlice(qa(e),r.parseOptions).content:a.parse(qa(e),r.parseOptions)}return xo("",t,r)}function gv(e,t,r){let n=e.steps.length-1;if(n<t)return;let o=e.steps[n];if(!(o instanceof transform.ReplaceStep||o instanceof transform.ReplaceAroundStep))return;let a=e.mapping.maps[n],i=0;a.forEach((s,l,c,u)=>{i===0&&(i=u);}),e.setSelection(state.Selection.near(e.doc.resolve(i),r));}var bv=e=>!("type"in e),yv=(e,t,r)=>({tr:n,dispatch:o,editor:a})=>{var i;if(o){r={parseOptions:a.options.parseOptions,updateSelection:true,applyInputRules:false,applyPasteRules:false,...r};let s,l=b=>{a.emit("contentError",{editor:a,error:b,disableCollaboration:()=>{"collaboration"in a.storage&&typeof a.storage.collaboration=="object"&&a.storage.collaboration&&(a.storage.collaboration.isDisabled=true);}});},c={preserveWhitespace:"full",...r.parseOptions};if(!r.errorOnInvalidContent&&!a.options.enableContentCheck&&a.options.emitContentError)try{xo(t,a.schema,{parseOptions:c,errorOnInvalidContent:!0});}catch(b){l(b);}try{s=xo(t,a.schema,{parseOptions:c,errorOnInvalidContent:(i=r.errorOnInvalidContent)!=null?i:a.options.enableContentCheck});}catch(b){return l(b),false}let{from:u,to:p}=typeof e=="number"?{from:e,to:e}:{from:e.from,to:e.to},m=true,d=true;if((bv(s)?s:[s]).forEach(b=>{b.check(),m=m?b.isText&&b.marks.length===0:false,d=d?b.isBlock:false;}),u===p&&d){let{parent:b}=n.doc.resolve(u);b.isTextblock&&!b.type.spec.code&&!b.childCount&&(u-=1,p+=1);}let h;if(m){if(Array.isArray(t))h=t.map(b=>b.text||"").join("");else if(t instanceof model.Fragment){let b="";t.forEach(y=>{y.text&&(b+=y.text);}),h=b;}else typeof t=="object"&&t&&t.text?h=t.text:h=t;n.insertText(h,u,p);}else {h=s;let b=n.doc.resolve(u),y=b.node(),v=b.parentOffset===0,N=y.isText||y.isTextblock,x=y.content.size>0;v&&N&&x&&(u=Math.max(0,u-1)),n.replaceWith(u,p,h);}r.updateSelection&&gv(n,n.steps.length-1,-1),r.applyInputRules&&n.setMeta("applyInputRules",{from:u,text:h}),r.applyPasteRules&&n.setMeta("applyPasteRules",{from:u,text:h});}return true},Nv=()=>({state:e,dispatch:t})=>commands.joinUp(e,t),Cv=()=>({state:e,dispatch:t})=>commands.joinDown(e,t),Mv=()=>({state:e,dispatch:t})=>commands.joinBackward(e,t),Tv=()=>({state:e,dispatch:t})=>commands.joinForward(e,t),Pv=()=>({state:e,dispatch:t,tr:r})=>{try{let n=transform.joinPoint(e.doc,e.selection.$from.pos,-1);return n==null?!1:(r.join(n,2),t&&t(r),!0)}catch{return false}},Ev=()=>({state:e,dispatch:t,tr:r})=>{try{let n=transform.joinPoint(e.doc,e.selection.$from.pos,1);return n==null?!1:(r.join(n,2),t&&t(r),!0)}catch{return false}},Dv=()=>({state:e,dispatch:t})=>commands.joinTextblockBackward(e,t),Iv=()=>({state:e,dispatch:t})=>commands.joinTextblockForward(e,t);function Uu(){return typeof navigator<"u"?/Mac/.test(navigator.platform):false}function zv(e){let t=e.split(/-(?!$)/),r=t[t.length-1];r==="Space"&&(r=" ");let n,o,a,i;for(let s=0;s<t.length-1;s+=1){let l=t[s];if(/^(cmd|meta|m)$/i.test(l))i=true;else if(/^a(lt)?$/i.test(l))n=true;else if(/^(c|ctrl|control)$/i.test(l))o=true;else if(/^s(hift)?$/i.test(l))a=true;else if(/^mod$/i.test(l))ri()||Uu()?i=true:o=true;else throw new Error(`Unrecognized modifier name: ${l}`)}return n&&(r=`Alt-${r}`),o&&(r=`Ctrl-${r}`),i&&(r=`Meta-${r}`),a&&(r=`Shift-${r}`),r}var Vv=e=>({editor:t,view:r,tr:n,dispatch:o})=>{let a=zv(e).split(/-(?!$)/),i=a.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),s=new KeyboardEvent("keydown",{key:i==="Space"?" ":i,altKey:a.includes("Alt"),ctrlKey:a.includes("Ctrl"),metaKey:a.includes("Meta"),shiftKey:a.includes("Shift"),bubbles:true,cancelable:true}),l=t.captureTransaction(()=>{r.someProp("handleKeyDown",c=>c(r,s));});return l?.steps.forEach(c=>{let u=c.map(n.mapping);u&&o&&n.maybeStep(u);}),true};function xl(e,t,r={}){let{from:n,to:o,empty:a}=e.selection,i=t?nt(t,e.schema):null,s=[];e.doc.nodesBetween(n,o,(p,m)=>{if(p.isText)return;let d=Math.max(n,m),g=Math.min(o,m+p.nodeSize);s.push({node:p,from:d,to:g});});let l=o-n,c=s.filter(p=>i?i.name===p.node.type.name:true).filter(p=>ti(p.node.attrs,r,{strict:false}));return a?!!c.length:c.reduce((p,m)=>p+m.to-m.from,0)>=l}var _v=(e,t={})=>({state:r,dispatch:n})=>{let o=nt(e,r.schema);return xl(r,o,t)?commands.lift(r,n):false},Bv=()=>({state:e,dispatch:t})=>commands.liftEmptyBlock(e,t),$v=e=>({state:t,dispatch:r})=>{let n=nt(e,t.schema);return schemaList.liftListItem(n)(t,r)},jv=()=>({state:e,dispatch:t})=>commands.newlineInCode(e,t);function Xu(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function Au(e,t){let r=typeof t=="string"?[t]:t;return Object.keys(e).reduce((n,o)=>(r.includes(o)||(n[o]=e[o]),n),{})}var Wv=(e,t)=>({tr:r,state:n,dispatch:o})=>{let a=null,i=null,s=Xu(typeof e=="string"?e:e.name,n.schema);if(!s)return false;s==="node"&&(a=nt(e,n.schema)),s==="mark"&&(i=rr(e,n.schema));let l=false;return r.selection.ranges.forEach(c=>{n.doc.nodesBetween(c.$from.pos,c.$to.pos,(u,p)=>{a&&a===u.type&&(l=true,o&&r.setNodeMarkup(p,void 0,Au(u.attrs,t))),i&&u.marks.length&&u.marks.forEach(m=>{i===m.type&&(l=true,o&&r.addMark(p,p+u.nodeSize,i.create(Au(m.attrs,t))));});});}),l},Yv=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),true),Xv=()=>({tr:e,dispatch:t})=>{if(t){let r=new state.AllSelection(e.doc);e.setSelection(r);}return true},qv=()=>({state:e,dispatch:t})=>commands.selectNodeBackward(e,t),Qv=()=>({state:e,dispatch:t})=>commands.selectNodeForward(e,t),ex=()=>({state:e,dispatch:t})=>commands.selectParentNode(e,t),rx=()=>({state:e,dispatch:t})=>commands.selectTextblockEnd(e,t),ox=()=>({state:e,dispatch:t})=>commands.selectTextblockStart(e,t);function ax(e,t,r={},n={}){return xo(e,t,{slice:false,parseOptions:r,errorOnInvalidContent:n.errorOnInvalidContent})}var ix=(e,{errorOnInvalidContent:t,emitUpdate:r=true,parseOptions:n={}}={})=>({editor:o,tr:a,dispatch:i,commands:s})=>{let{doc:l}=a;if(n.preserveWhitespace!=="full"){let c=ax(e,o.schema,n,{errorOnInvalidContent:t??o.options.enableContentCheck});return i&&a.replaceWith(0,l.content.size,c).setMeta("preventUpdate",!r),true}return i&&a.setMeta("preventUpdate",!r),s.insertContentAt({from:0,to:l.content.size},e,{parseOptions:n,errorOnInvalidContent:t??o.options.enableContentCheck})};function sx(e,t){let r=rr(t,e.schema),{from:n,to:o,empty:a}=e.selection,i=[];a?(e.storedMarks&&i.push(...e.storedMarks),i.push(...e.selection.$head.marks())):e.doc.nodesBetween(n,o,l=>{i.push(...l.marks);});let s=i.find(l=>l.type.name===r.name);return s?{...s.attrs}:{}}function cx(e,t){let r=new transform.Transform(e);return t.forEach(n=>{n.steps.forEach(o=>{r.step(o);});}),r}function dx(e){for(let t=0;t<e.edgeCount;t+=1){let{type:r}=e.edge(t);if(r.isTextblock&&!r.hasRequiredAttrs())return r}return null}function ux(e,t){for(let r=e.depth;r>0;r-=1){let n=e.node(r);if(t(n))return {pos:r>0?e.before(r):0,start:e.start(r),depth:r,node:n}}}function wl(e){return t=>ux(t.$from,e)}function ye(e,t,r){return e.config[t]===void 0&&e.parent?ye(e.parent,t,r):typeof e.config[t]=="function"?e.config[t].bind({...r,parent:e.parent?ye(e.parent,t,r):null}):e.config[t]}function fx(e){return typeof e=="function"}function je(e,t=void 0,...r){return fx(e)?t?e.bind(t)(...r):e(...r):e}function kn(e){let t=e.filter(o=>o.type==="extension"),r=e.filter(o=>o.type==="node"),n=e.filter(o=>o.type==="mark");return {baseExtensions:t,nodeExtensions:r,markExtensions:n}}function gx(e){let t=[],r="",n=false,o=false,a=0,i=e.length;for(let s=0;s<i;s+=1){let l=e[s];if(l==="'"&&!o){n=!n,r+=l;continue}if(l==='"'&&!n){o=!o,r+=l;continue}if(!n&&!o){if(l==="("){a+=1,r+=l;continue}if(l===")"&&a>0){a-=1,r+=l;continue}if(l===";"&&a===0){t.push(r),r="";continue}}r+=l;}return r&&t.push(r),t}function Iu(e){let t=[],r=gx(e||""),n=r.length;for(let o=0;o<n;o+=1){let a=r[o],i=a.indexOf(":");if(i===-1)continue;let s=a.slice(0,i).trim(),l=a.slice(i+1).trim();s&&l&&t.push([s,l]);}return t}function Nn(...e){return e.filter(t=>!!t).reduce((t,r)=>{let n={...t};return Object.entries(r).forEach(([o,a])=>{if(!n[o]){n[o]=a;return}if(o==="class"){let s=a?String(a).split(" "):[],l=n[o]?n[o].split(" "):[],c=s.filter(u=>!l.includes(u));n[o]=[...l,...c].join(" ");}else if(o==="style"){let s=new Map([...Iu(n[o]),...Iu(a)]);n[o]=Array.from(s.entries()).map(([l,c])=>`${l}: ${c}`).join("; ");}else n[o]=a;}),n},{})}function xx(e,t,r){let{from:n,to:o}=t,{blockSeparator:a=`
85
+
86
+ `,textSerializers:i={}}=r||{},s="";return e.nodesBetween(n,o,(l,c,u,p)=>{var m;l.isBlock&&c>n&&(s+=a);let d=i?.[l.type.name];if(d)return u&&(s+=d({node:l,pos:c,parent:u,index:p,range:t})),false;l.isText&&(s+=(m=l?.text)==null?void 0:m.slice(Math.max(n,c)-c,o-c));}),s}function wx(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,t])=>t.spec.toText).map(([t,r])=>[t,r.spec.toText]))}function kx(e,t=JSON.stringify){let r={};return e.filter(n=>{let o=t(n);return Object.prototype.hasOwnProperty.call(r,o)?false:r[o]=true})}function Nx(e){let t=kx(e);return t.length===1?t:t.filter((r,n)=>!t.filter((a,i)=>i!==n).some(a=>r.oldRange.from>=a.oldRange.from&&r.oldRange.to<=a.oldRange.to&&r.newRange.from>=a.newRange.from&&r.newRange.to<=a.newRange.to))}function Cx(e){let{mapping:t,steps:r}=e,n=[];return t.maps.forEach((o,a)=>{let i=[];if(o.ranges.length)o.forEach((s,l)=>{i.push({from:s,to:l});});else {let{from:s,to:l}=r[a];if(s===void 0||l===void 0)return;i.push({from:s,to:l});}i.forEach(({from:s,to:l})=>{let c=t.slice(a).map(s,-1),u=t.slice(a).map(l),p=t.invert().map(c,-1),m=t.invert().map(u);n.push({oldRange:{from:p,to:m},newRange:{from:c,to:u}});});}),Nx(n)}function ei(e,t,r){return Object.fromEntries(Object.entries(r).filter(([n])=>{let o=e.find(a=>a.type===t&&a.name===n);return o?o.attribute.keepOnSplit:false}))}function Tx(e,t,r={}){let{empty:n,ranges:o}=e.selection,a=t?rr(t,e.schema):null;if(n)return !!(e.storedMarks||e.selection.$from.marks()).filter(p=>a?a.name===p.type.name:true).find(p=>ti(p.attrs,r,{strict:false}));let i=0,s=[];if(o.forEach(({$from:p,$to:m})=>{let d=p.pos,g=m.pos;e.doc.nodesBetween(d,g,(h,b)=>{if(a&&h.inlineContent&&!h.type.allowsMarkType(a))return false;if(!h.isText&&!h.marks.length)return;let y=Math.max(d,b),v=Math.min(g,b+h.nodeSize),N=v-y;i+=N,s.push(...h.marks.map(x=>({mark:x,from:y,to:v})));});}),i===0)return false;let l=s.filter(p=>a?a.name===p.mark.type.name:true).filter(p=>ti(p.mark.attrs,r,{strict:false})).reduce((p,m)=>p+m.to-m.from,0),c=s.filter(p=>a?p.mark.type!==a&&p.mark.type.excludes(a):true).reduce((p,m)=>p+m.to-m.from,0);return (l>0?l+c:l)>=i}function Fu(e,t){let{nodeExtensions:r}=kn(t),n=r.find(i=>i.name===e);if(!n)return false;let o={name:n.name,options:n.options,storage:n.storage},a=je(ye(n,"group",o));return typeof a!="string"?false:a.split(" ").includes("list")}function Qu(e,{checkChildren:t=true,ignoreWhitespace:r=false}={}){var n;if(r){if(e.type.name==="hardBreak")return true;if(e.isText)return !/\S/.test((n=e.text)!=null?n:"")}if(e.isText)return !e.text;if(e.isAtom||e.isLeaf)return false;if(e.content.childCount===0)return true;if(t){let o=true;return e.content.forEach(a=>{o!==false&&(Qu(a,{ignoreWhitespace:r,checkChildren:t})||(o=false));}),o}return false}function Sx(e,t,r){var n;let{selection:o}=t,a=null;if(Wu(o)&&(a=o.$cursor),a){let s=(n=e.storedMarks)!=null?n:a.marks();return a.parent.type.allowsMarkType(r)&&(!!r.isInSet(s)||!s.some(c=>c.type.excludes(r)))}let{ranges:i}=o;return i.some(({$from:s,$to:l})=>{let c=s.depth===0?e.doc.inlineContent&&e.doc.type.allowsMarkType(r):false;return e.doc.nodesBetween(s.pos,l.pos,(u,p,m)=>{if(c)return false;if(u.isInline){let d=!m||m.type.allowsMarkType(r),g=!!r.isInSet(u.marks)||!u.marks.some(h=>h.type.excludes(r));c=d&&g;}return !c}),c})}var Px=(e,t={})=>({tr:r,state:n,dispatch:o})=>{let{selection:a}=r,{empty:i,ranges:s}=a,l=rr(e,n.schema);if(o)if(i){let c=sx(n,l);r.addStoredMark(l.create({...c,...t}));}else s.forEach(c=>{let u=c.$from.pos,p=c.$to.pos;n.doc.nodesBetween(u,p,(m,d)=>{let g=Math.max(d,u),h=Math.min(d+m.nodeSize,p);m.marks.find(y=>y.type===l)?m.marks.forEach(y=>{l===y.type&&r.addMark(g,h,l.create({...y.attrs,...t}));}):r.addMark(g,h,l.create(t));});});return Sx(n,r,l)},Rx=(e,t)=>({tr:r})=>(r.setMeta(e,t),true),Ex=(e,t={})=>({state:r,dispatch:n,chain:o})=>{let a=nt(e,r.schema),i;return r.selection.$anchor.sameParent(r.selection.$head)&&(i=r.selection.$anchor.parent.attrs),a.isTextblock?o().command(({commands:s})=>commands.setBlockType(a,{...i,...t})(r)?true:s.clearNodes()).command(({state:s})=>commands.setBlockType(a,{...i,...t})(s,n)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),false)},Dx=e=>({tr:t,dispatch:r})=>{if(r){let{doc:n}=t,o=Kr(e,0,n.content.size),a=state.NodeSelection.create(n,o);t.setSelection(a);}return true},Ax=(e,t)=>({tr:r,state:n,dispatch:o})=>{let{selection:a}=n,i,s;return typeof t=="number"?(i=t,s=t):t&&"from"in t&&"to"in t?(i=t.from,s=t.to):(i=a.from,s=a.to),o&&r.doc.nodesBetween(i,s,(l,c)=>{l.isText||r.setNodeMarkup(c,void 0,{...l.attrs,dir:e});}),true},Ix=e=>({tr:t,dispatch:r})=>{if(r){let{doc:n}=t,{from:o,to:a}=typeof e=="number"?{from:e,to:e}:e,i=state.TextSelection.atStart(n).from,s=state.TextSelection.atEnd(n).to,l=Kr(o,i,s),c=Kr(a,i,s),u=state.TextSelection.create(n,l,c);t.setSelection(u);}return true},Vx=e=>({state:t,dispatch:r})=>{let n=nt(e,t.schema);return schemaList.sinkListItem(n)(t,r)};function Ou(e,t){let r=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(r){let n=r.filter(o=>t?.includes(o.type.name));e.tr.ensureMarks(n);}}var Fx=({keepMarks:e=true}={})=>({tr:t,state:r,dispatch:n,editor:o})=>{let{selection:a,doc:i}=t,{$from:s,$to:l}=a,c=o.extensionManager.attributes,u=ei(c,s.node().type.name,s.node().attrs);if(a instanceof state.NodeSelection&&a.node.isBlock)return !s.parentOffset||!transform.canSplit(i,s.pos)?false:(n&&(e&&Ou(r,o.extensionManager.splittableMarks),t.split(s.pos).scrollIntoView()),true);if(!s.parent.isBlock)return false;let p=l.parentOffset===l.parent.content.size,m=s.depth===0?void 0:dx(s.node(-1).contentMatchAt(s.indexAfter(-1))),d=p&&m?[{type:m,attrs:u}]:void 0,g=transform.canSplit(t.doc,t.mapping.map(s.pos),1,d);if(!d&&!g&&transform.canSplit(t.doc,t.mapping.map(s.pos),1,m?[{type:m}]:void 0)&&(g=true,d=m?[{type:m,attrs:u}]:void 0),n){if(g&&(a instanceof state.TextSelection&&t.deleteSelection(),t.split(t.mapping.map(s.pos),1,d),m&&!p&&!s.parentOffset&&s.parent.type!==m)){let h=t.mapping.map(s.before()),b=t.doc.resolve(h);s.node(-1).canReplaceWith(b.index(),b.index()+1,m)&&t.setNodeMarkup(t.mapping.map(s.before()),m);}e&&Ou(r,o.extensionManager.splittableMarks),t.scrollIntoView();}return g},Kx=(e,t={})=>({tr:r,state:n,dispatch:o,editor:a})=>{var i;let s=nt(e,n.schema),{$from:l,$to:c}=n.selection,u=n.selection.node;if(u&&u.isBlock||l.depth<2||!l.sameParent(c))return false;let p=l.node(-1);if(p.type!==s)return false;let m=a.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==s||l.index(-2)!==l.node(-2).childCount-1)return false;if(o){let y=model.Fragment.empty,v=l.index(-1)?1:l.index(-2)?2:3;for(let A=l.depth-v;A>=l.depth-3;A-=1)y=model.Fragment.from(l.node(A).copy(y));let N=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,x={...ei(m,l.node().type.name,l.node().attrs),...t},w=((i=s.contentMatch.defaultType)==null?void 0:i.createAndFill(x))||void 0;y=y.append(model.Fragment.from(s.createAndFill(null,w)||void 0));let L=l.before(l.depth-(v-1));r.replace(L,l.after(-N),new model.Slice(y,4-v,0));let P=-1;r.doc.nodesBetween(L,r.doc.content.size,(A,D)=>{if(P>-1)return false;A.isTextblock&&A.content.size===0&&(P=D+1);}),P>-1&&r.setSelection(state.TextSelection.near(r.doc.resolve(P))),r.scrollIntoView();}return true}let d=c.pos===l.end()?p.contentMatchAt(0).defaultType:null,g={...ei(m,p.type.name,p.attrs),...t},h={...ei(m,l.node().type.name,l.node().attrs),...t};r.delete(l.pos,c.pos);let b=d?[{type:s,attrs:g},{type:d,attrs:h}]:[{type:s,attrs:g}];if(!transform.canSplit(r.doc,l.pos,2))return false;if(o){let{selection:y,storedMarks:v}=n,{splittableMarks:N}=a.extensionManager,x=v||y.$to.parentOffset&&y.$from.marks();if(r.split(l.pos,2,b).scrollIntoView(),!x||!o)return true;let w=x.filter(L=>N.includes(L.type.name));r.ensureMarks(w);}return true},fl=(e,t)=>{let r=wl(i=>i.type===t)(e.selection);if(!r)return true;let n=e.doc.resolve(Math.max(0,r.pos-1)).before(r.depth);if(n===void 0)return true;let o=e.doc.nodeAt(n);return r.node.type===o?.type&&transform.canJoin(e.doc,r.pos)&&e.join(r.pos),true},hl=(e,t)=>{let r=wl(i=>i.type===t)(e.selection);if(!r)return true;let n=e.doc.resolve(r.start).after(r.depth);if(n===void 0)return true;let o=e.doc.nodeAt(n);return r.node.type===o?.type&&transform.canJoin(e.doc,n)&&e.join(n),true},jx=(e,t,r,n={})=>({editor:o,tr:a,state:i,dispatch:s,chain:l,commands:c,can:u})=>{let{extensions:p,splittableMarks:m}=o.extensionManager,d=nt(e,i.schema),g=nt(t,i.schema),{selection:h,storedMarks:b}=i,{$from:y,$to:v}=h,N=y.blockRange(v),x=b||h.$to.parentOffset&&h.$from.marks();if(!N)return false;let w=wl(L=>Fu(L.type.name,p))(h);if(N.depth>=1&&w&&N.depth-w.depth<=1){if(w.node.type===d)return c.liftListItem(g);if(Fu(w.node.type.name,p)&&d.validContent(w.node.content)&&s)return l().command(()=>(a.setNodeMarkup(w.pos,d),true)).command(()=>fl(a,d)).command(()=>hl(a,d)).run()}return !r||!x||!s?l().command(()=>u().wrapInList(d,n)?true:c.clearNodes()).wrapInList(d,n).command(()=>fl(a,d)).command(()=>hl(a,d)).run():l().command(()=>{let L=u().wrapInList(d,n),P=x.filter(A=>m.includes(A.type.name));return a.ensureMarks(P),L?true:c.clearNodes()}).wrapInList(d,n).command(()=>fl(a,d)).command(()=>hl(a,d)).run()},Wx=(e,t={},r={})=>({state:n,commands:o})=>{let{extendEmptyMarkRange:a=false}=r,i=rr(e,n.schema);return Tx(n,i,t)?o.unsetMark(i,{extendEmptyMarkRange:a}):o.setMark(i,t)},Yx=(e,t,r={})=>({state:n,commands:o})=>{let a=nt(e,n.schema),i=nt(t,n.schema),s=xl(n,a,r),l;return n.selection.$anchor.sameParent(n.selection.$head)&&(l=n.selection.$anchor.parent.attrs),s?o.setNode(i,l):o.setNode(a,{...l,...r})},Ux=(e,t={})=>({state:r,commands:n})=>{let o=nt(e,r.schema);return xl(r,o,t)?n.lift(o):n.wrapIn(o,t)},Xx=()=>({state:e,dispatch:t})=>{let r=e.plugins;for(let n=0;n<r.length;n+=1){let o=r[n],a;if(o.spec.isInputRules&&(a=o.getState(e))){if(t){let i=e.tr,s=a.transform;for(let l=s.steps.length-1;l>=0;l-=1)i.step(s.steps[l].invert(s.docs[l]));if(a.text){let l=i.doc.resolve(a.from).marks();i.replaceWith(a.from,a.to,e.schema.text(a.text,l));}else i.delete(a.from,a.to);}return true}}return false},Gx=()=>({tr:e,dispatch:t})=>{let{selection:r}=e,{empty:n,ranges:o}=r;return n||t&&o.forEach(a=>{e.removeMark(a.$from.pos,a.$to.pos);}),true},qx=(e,t={})=>({tr:r,state:n,dispatch:o})=>{var a;let{extendEmptyMarkRange:i=false}=t,{selection:s}=r,l=rr(e,n.schema),{$from:c,empty:u,ranges:p}=s;if(!o)return true;if(u&&i){let{from:m,to:d}=s,g=(a=c.marks().find(b=>b.type===l))==null?void 0:a.attrs,h=ju(c,l,g);h&&(m=h.from,d=h.to),r.removeMark(m,d,l);}else p.forEach(m=>{r.removeMark(m.$from.pos,m.$to.pos,l);});return r.removeStoredMark(l),true},Jx=e=>({tr:t,state:r,dispatch:n})=>{let{selection:o}=r,a,i;return typeof e=="number"?(a=e,i=e):e&&"from"in e&&"to"in e?(a=e.from,i=e.to):(a=o.from,i=o.to),n&&t.doc.nodesBetween(a,i,(s,l)=>{if(s.isText)return;let c={...s.attrs};delete c.dir,t.setNodeMarkup(l,void 0,c);}),true},Qx=(e,t={})=>({tr:r,state:n,dispatch:o})=>{let a=null,i=null,s=Xu(typeof e=="string"?e:e.name,n.schema);if(!s)return false;s==="node"&&(a=nt(e,n.schema)),s==="mark"&&(i=rr(e,n.schema));let l=false;return r.selection.ranges.forEach(c=>{let u=c.$from.pos,p=c.$to.pos,m,d,g,h;r.selection.empty?n.doc.nodesBetween(u,p,(b,y)=>{a&&a===b.type&&(l=true,g=Math.max(y,u),h=Math.min(y+b.nodeSize,p),m=y,d=b);}):n.doc.nodesBetween(u,p,(b,y)=>{y<u&&a&&a===b.type&&(l=true,g=Math.max(y,u),h=Math.min(y+b.nodeSize,p),m=y,d=b),y>=u&&y<=p&&(a&&a===b.type&&(l=true,o&&r.setNodeMarkup(y,void 0,{...b.attrs,...t})),i&&b.marks.length&&b.marks.forEach(v=>{if(i===v.type&&(l=true,o)){let N=Math.max(y,u),x=Math.min(y+b.nodeSize,p);r.addMark(N,x,i.create({...v.attrs,...t}));}}));}),d&&(m!==void 0&&o&&r.setNodeMarkup(m,void 0,{...d.attrs,...t}),i&&d.marks.length&&d.marks.forEach(b=>{i===b.type&&o&&r.addMark(g,h,i.create({...b.attrs,...t}));}));}),l},ew=(e,t={})=>({state:r,dispatch:n})=>{let o=nt(e,r.schema);return commands.wrapIn(o,t)(r,n)},rw=(e,t={})=>({state:r,dispatch:n})=>{let o=nt(e,r.schema);return schemaList.wrapInList(o,t)(r,n)};function lw(e){return Object.prototype.toString.call(e).slice(8,-1)}function Qa(e){return lw(e)!=="Object"?false:e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function ep(e,t){let r={...e};return Qa(e)&&Qa(t)&&Object.keys(t).forEach(n=>{Qa(t[n])&&Qa(e[n])?r[n]=ep(e[n],t[n]):r[n]=t[n];}),r}var Nl=class{constructor(e={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name;}get options(){return {...je(ye(this,"addOptions",{name:this.name}))||{}}}get storage(){return {...je(ye(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(e={}){let t=this.extend({...this.config,addOptions:()=>ep(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){let t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name="name"in e?e.name:t.parent.name,t}},Cl=class tp extends Nl{constructor(){super(...arguments),this.type="mark";}static create(t={}){let r=typeof t=="function"?t():t;return new tp(r)}static handleExit({editor:t,mark:r}){let{tr:n}=t.state,o=t.state.selection.$from;if(o.pos===o.end()){let i=o.marks();if(!!!i.find(c=>c?.type.name===r.name))return false;let l=i.find(c=>c?.type.name===r.name);return l&&n.removeStoredMark(l),n.insertText(" ",o.pos),t.view.dispatch(n),true}return false}configure(t){return super.configure(t)}extend(t){let r=typeof t=="function"?t():t;return super.extend(r)}};var gw={};bl(gw,{ClipboardTextSerializer:()=>vw,Commands:()=>xw,Delete:()=>kw,Drop:()=>Mw,Editable:()=>Pw,FocusEvents:()=>Lw,Keymap:()=>Iw,Paste:()=>Hw,Tabindex:()=>Bw,TextDirection:()=>Kw,focusEventsPluginKey:()=>np});var Ke=class rp extends Nl{constructor(){super(...arguments),this.type="extension";}static create(t={}){let r=typeof t=="function"?t():t;return new rp(r)}configure(t){return super.configure(t)}extend(t){let r=typeof t=="function"?t():t;return super.extend(r)}},vw=Ke.create({name:"clipboardTextSerializer",addOptions(){return {blockSeparator:void 0}},addProseMirrorPlugins(){return [new state.Plugin({key:new state.PluginKey("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{let{editor:e}=this,{state:t,schema:r}=e,{doc:n,selection:o}=t,{ranges:a}=o,i=Math.min(...a.map(u=>u.$from.pos)),s=Math.max(...a.map(u=>u.$to.pos)),l=wx(r);return xx(n,{from:i,to:s},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),xw=Ke.create({name:"commands",addCommands(){return {...$u}}}),kw=Ke.create({name:"delete",onUpdate({transaction:e,appendedTransactions:t}){var r,n,o;let a=()=>{var i,s,l,c;if((c=(l=(s=(i=this.editor.options.coreExtensionOptions)==null?void 0:i.delete)==null?void 0:s.filterTransaction)==null?void 0:l.call(s,e))!=null?c:e.getMeta("y-sync$"))return;let u=cx(e.before,[e,...t]);Cx(u).forEach(d=>{u.mapping.mapResult(d.oldRange.from).deletedAfter&&u.mapping.mapResult(d.oldRange.to).deletedBefore&&u.before.nodesBetween(d.oldRange.from,d.oldRange.to,(g,h)=>{let b=h+g.nodeSize-2,y=d.oldRange.from<=h&&b<=d.oldRange.to;this.editor.emit("delete",{type:"node",node:g,from:h,to:b,newFrom:u.mapping.map(h),newTo:u.mapping.map(b),deletedRange:d.oldRange,newRange:d.newRange,partial:!y,editor:this.editor,transaction:e,combinedTransform:u});});});let m=u.mapping;u.steps.forEach((d,g)=>{var h,b;if(d instanceof transform.RemoveMarkStep){let y=m.slice(g).map(d.from,-1),v=m.slice(g).map(d.to),N=m.invert().map(y,-1),x=m.invert().map(v),w=(h=u.doc.nodeAt(y-1))==null?void 0:h.marks.some(P=>P.eq(d.mark)),L=(b=u.doc.nodeAt(v))==null?void 0:b.marks.some(P=>P.eq(d.mark));this.editor.emit("delete",{type:"mark",mark:d.mark,from:d.from,to:d.to,deletedRange:{from:N,to:x},newRange:{from:y,to:v},partial:!!(L||w),editor:this.editor,transaction:e,combinedTransform:u});}});};(o=(n=(r=this.editor.options.coreExtensionOptions)==null?void 0:r.delete)==null?void 0:n.async)==null||o?setTimeout(a,0):a();}}),Mw=Ke.create({name:"drop",addProseMirrorPlugins(){return [new state.Plugin({key:new state.PluginKey("tiptapDrop"),props:{handleDrop:(e,t,r,n)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:r,moved:n});}}})]}}),Pw=Ke.create({name:"editable",addProseMirrorPlugins(){return [new state.Plugin({key:new state.PluginKey("editable"),props:{editable:()=>this.editor.options.editable}})]}}),np=new state.PluginKey("focusEvents"),Lw=Ke.create({name:"focusEvents",addProseMirrorPlugins(){let{editor:e}=this;return [new state.Plugin({key:np,props:{handleDOMEvents:{focus:(t,r)=>{e.isFocused=true;let n=e.state.tr.setMeta("focus",{event:r}).setMeta("addToHistory",false);return t.dispatch(n),false},blur:(t,r)=>{e.isFocused=false;let n=e.state.tr.setMeta("blur",{event:r}).setMeta("addToHistory",false);return t.dispatch(n),false}}}})]}}),Iw=Ke.create({name:"keymap",addKeyboardShortcuts(){let e=()=>this.editor.commands.first(({commands:i})=>[()=>i.undoInputRule(),()=>i.command(({tr:s})=>{let{selection:l,doc:c}=s,{empty:u,$anchor:p}=l,{pos:m,parent:d}=p,g=p.parent.isTextblock&&m>0?s.doc.resolve(m-1):p,h=g.parent.type.spec.isolating,b=p.pos-p.parentOffset,y=h&&g.parent.childCount===1?b===p.pos:state.Selection.atStart(c).from===m;return !u||!d.type.isTextblock||d.textContent.length||!y||y&&p.parent.type.name==="paragraph"?false:i.clearNodes()}),()=>i.deleteSelection(),()=>i.joinBackward(),()=>i.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:i})=>[()=>i.deleteSelection(),()=>i.deleteCurrentNode(),()=>i.joinForward(),()=>i.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:i})=>[()=>i.newlineInCode(),()=>i.createParagraphNear(),()=>i.liftEmptyBlock(),()=>i.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},o={...n},a={...n,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return ri()||Uu()?a:o},addProseMirrorPlugins(){return [new state.Plugin({key:new state.PluginKey("clearDocument"),appendTransaction:(e,t,r)=>{if(e.some(h=>h.getMeta("composition")))return;let n=e.some(h=>h.docChanged)&&!t.doc.eq(r.doc),o=e.some(h=>h.getMeta("preventClearDocument"));if(!n||o)return;let{empty:a,from:i,to:s}=t.selection,l=state.Selection.atStart(t.doc).from,c=state.Selection.atEnd(t.doc).to;if(a||!(i===l&&s===c)||!Qu(r.doc))return;let m=r.tr,d=oi({state:r,transaction:m}),{commands:g}=new yl({editor:this.editor,state:d});if(g.clearNodes(),!!m.steps.length)return m}})]}}),Hw=Ke.create({name:"paste",addProseMirrorPlugins(){return [new state.Plugin({key:new state.PluginKey("tiptapPaste"),props:{handlePaste:(e,t,r)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:r});}}})]}}),Bw=Ke.create({name:"tabindex",addProseMirrorPlugins(){return [new state.Plugin({key:new state.PluginKey("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),Kw=Ke.create({name:"textDirection",addOptions(){return {direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return [];let{nodeExtensions:e}=kn(this.extensions);return [{types:e.filter(t=>t.name!=="text").map(t=>t.name),attributes:{dir:{default:this.options.direction,parseHTML:t=>{let r=t.getAttribute("dir");return r&&(r==="ltr"||r==="rtl"||r==="auto")?r:this.options.direction},renderHTML:t=>t.dir?{dir:t.dir}:{}}}}]},addProseMirrorPlugins(){return [new state.Plugin({key:new state.PluginKey("textDirection"),props:{attributes:()=>{let e=this.options.direction;return e?{dir:e}:{}}}})]}});var jw={};bl(jw,{createAtomBlockMarkdownSpec:()=>Ww,createBlockMarkdownSpec:()=>Yw,createInlineMarkdownSpec:()=>Gw,parseAttributes:()=>Tl,parseIndentedBlocks:()=>qw,renderNestedMarkdownContent:()=>Jw,serializeAttributes:()=>Sl});function Tl(e){if(!e?.trim())return {};let t={},r=[],n=e.replace(/["']([^"']*)["']/g,c=>(r.push(c),`__QUOTED_${r.length-1}__`)),o=n.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(o){let c=o.map(u=>u.trim().slice(1));t.class=c.join(" ");}let a=n.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);a&&(t.id=a[1]);let i=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(n.matchAll(i)).forEach(([,c,u])=>{var p;let m=parseInt(((p=u.match(/__QUOTED_(\d+)__/))==null?void 0:p[1])||"0",10),d=r[m];d&&(t[c]=d.slice(1,-1));});let l=n.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return l&&l.split(/\s+/).filter(Boolean).forEach(u=>{u.match(/^[a-zA-Z][\w-]*$/)&&(t[u]=true);}),t}function Sl(e){if(!e||Object.keys(e).length===0)return "";let t=[];return e.class&&String(e.class).split(/\s+/).filter(Boolean).forEach(n=>t.push(`.${n}`)),e.id&&t.push(`#${e.id}`),Object.entries(e).forEach(([r,n])=>{r==="class"||r==="id"||(n===true?t.push(r):n!==false&&n!=null&&t.push(`${r}="${String(n)}"`));}),t.join(" ")}function Ww(e){let{nodeName:t,name:r,parseAttributes:n=Tl,serializeAttributes:o=Sl,defaultAttributes:a={},requiredAttributes:i=[],allowedAttributes:s}=e,l=r||t,c=u=>{if(!s)return u;let p={};return s.forEach(m=>{m in u&&(p[m]=u[m]);}),p};return {parseMarkdown:(u,p)=>{let m={...a,...u.attributes};return p.createNode(t,m,[])},markdownTokenizer:{name:t,level:"block",start(u){var p;let m=new RegExp(`^:::${l}(?:\\s|$)`,"m"),d=(p=u.match(m))==null?void 0:p.index;return d!==void 0?d:-1},tokenize(u,p,m){let d=new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),g=u.match(d);if(!g)return;let h=g[1]||"",b=n(h);if(!i.find(v=>!(v in b)))return {type:t,raw:g[0],attributes:b}}},renderMarkdown:u=>{let p=c(u.attrs||{}),m=o(p),d=m?` {${m}}`:"";return `:::${l}${d} :::`}}}function Yw(e){let{nodeName:t,name:r,getContent:n,parseAttributes:o=Tl,serializeAttributes:a=Sl,defaultAttributes:i={},content:s="block",allowedAttributes:l}=e,c=r||t,u=p=>{if(!l)return p;let m={};return l.forEach(d=>{d in p&&(m[d]=p[d]);}),m};return {parseMarkdown:(p,m)=>{let d;if(n){let h=n(p);d=typeof h=="string"?[{type:"text",text:h}]:h;}else s==="block"?d=m.parseChildren(p.tokens||[]):d=m.parseInline(p.tokens||[]);let g={...i,...p.attributes};return m.createNode(t,g,d)},markdownTokenizer:{name:t,level:"block",start(p){var m;let d=new RegExp(`^:::${c}`,"m"),g=(m=p.match(d))==null?void 0:m.index;return g!==void 0?g:-1},tokenize(p,m,d){var g;let h=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),b=p.match(h);if(!b)return;let[y,v=""]=b,N=o(v),x=1,w=y.length,L="",P=/^:::([\w-]*)(\s.*)?/gm,A=p.slice(w);for(P.lastIndex=0;;){let D=P.exec(A);if(D===null)break;let S=D.index,C=D[1];if(!((g=D[2])!=null&&g.endsWith(":::"))){if(C)x+=1;else if(x-=1,x===0){let I=A.slice(0,S);L=I.trim();let k=p.slice(0,w+S+D[0].length),T=[];if(L)if(s==="block")for(T=d.blockTokens(I),T.forEach(R=>{R.text&&(!R.tokens||R.tokens.length===0)&&(R.tokens=d.inlineTokens(R.text));});T.length>0;){let R=T[T.length-1];if(R.type==="paragraph"&&(!R.text||R.text.trim()===""))T.pop();else break}else T=d.inlineTokens(L);return {type:t,raw:k,attributes:N,content:L,tokens:T}}}}}},renderMarkdown:(p,m)=>{let d=u(p.attrs||{}),g=a(d),h=g?` {${g}}`:"",b=m.renderChildren(p.content||[],`
87
+
88
+ `);return `:::${c}${h}
89
+
90
+ ${b}
91
+
92
+ :::`}}}function Uw(e){if(!e.trim())return {};let t={},r=/(\w+)=(?:"([^"]*)"|'([^']*)')/g,n=r.exec(e);for(;n!==null;){let[,o,a,i]=n;t[o]=a||i,n=r.exec(e);}return t}function Xw(e){return Object.entries(e).filter(([,t])=>t!=null).map(([t,r])=>`${t}="${r}"`).join(" ")}function Gw(e){let{nodeName:t,name:r,getContent:n,parseAttributes:o=Uw,serializeAttributes:a=Xw,defaultAttributes:i={},selfClosing:s=false,allowedAttributes:l}=e,c=r||t,u=m=>{if(!l)return m;let d={};return l.forEach(g=>{let h=typeof g=="string"?g:g.name,b=typeof g=="string"?void 0:g.skipIfDefault;if(h in m){let y=m[h];if(b!==void 0&&y===b)return;d[h]=y;}}),d},p=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return {parseMarkdown:(m,d)=>{let g={...i,...m.attributes};if(s)return d.createNode(t,g);let h=n?n(m):m.content||"";return h?d.createNode(t,g,[d.createTextNode(h)]):d.createNode(t,g,[])},markdownTokenizer:{name:t,level:"inline",start(m){let d=s?new RegExp(`\\[${p}\\s*[^\\]]*\\]`):new RegExp(`\\[${p}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${p}\\]`),g=m.match(d),h=g?.index;return h!==void 0?h:-1},tokenize(m,d,g){let h=s?new RegExp(`^\\[${p}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${p}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${p}\\]`),b=m.match(h);if(!b)return;let y="",v="";if(s){let[,x]=b;v=x;}else {let[,x,w]=b;v=x,y=w||"";}let N=o(v.trim());return {type:t,raw:b[0],content:y.trim(),attributes:N}}},renderMarkdown:m=>{let d="";n?d=n(m):m.content&&m.content.length>0&&(d=m.content.filter(y=>y.type==="text").map(y=>y.text).join(""));let g=u(m.attrs||{}),h=a(g),b=h?` ${h}`:"";return s?`[${c}${b}]`:`[${c}${b}]${d}[/${c}]`}}}function qw(e,t,r){var n,o,a,i;let s=e.split(`
93
+ `),l=[],c="",u=0,p=t.baseIndentSize||2;for(;u<s.length;){let m=s[u],d=m.match(t.itemPattern);if(!d){if(l.length>0)break;if(m.trim()===""){u+=1,c=`${c}${m}
94
+ `;continue}else return}let g=t.extractItemData(d),{indentLevel:h,mainContent:b}=g;c=`${c}${m}
95
+ `;let y=[b];for(u+=1;u<s.length;){let w=s[u];if(w.trim()===""){let P=s.slice(u+1).findIndex(S=>S.trim()!=="");if(P===-1)break;if((((o=(n=s[u+1+P].match(/^(\s*)/))==null?void 0:n[1])==null?void 0:o.length)||0)>h){y.push(w),c=`${c}${w}
96
+ `,u+=1;continue}else break}if((((i=(a=w.match(/^(\s*)/))==null?void 0:a[1])==null?void 0:i.length)||0)>h)y.push(w),c=`${c}${w}
97
+ `,u+=1;else break}let v,N=y.slice(1);if(N.length>0){let w=N.map(L=>L.slice(h+p)).join(`
98
+ `);w.trim()&&(t.customNestedParser?v=t.customNestedParser(w):v=r.blockTokens(w));}let x=t.createToken(g,v);l.push(x);}if(l.length!==0)return {items:l,raw:c}}function Jw(e,t,r,n){if(!e||!Array.isArray(e.content))return "";let o=typeof r=="function"?r(n):r,[a,...i]=e.content,s=t.renderChildren([a]),l=`${o}${s}`;return i&&i.length>0&&i.forEach((c,u)=>{var p,m;let d=(m=(p=t.renderChild)==null?void 0:p.call(t,c,u+1))!=null?m:t.renderChildren([c]);if(d!=null){let g=d.split(`
99
+ `).map(h=>h?t.indent(h):t.indent("")).join(`
100
+ `);l+=c.type==="paragraph"?`
101
+
102
+ ${g}`:`
103
+ ${g}`;}}),l}var Pl=class op extends Nl{constructor(){super(...arguments),this.type="node";}static create(t={}){let r=typeof t=="function"?t():t;return new op(r)}configure(t){return super.configure(t)}extend(t){let r=typeof t=="function"?t():t;return super.extend(r)}};var Zw=20,ap=(e,t=0)=>{let r=[];return !e.children.length||t>Zw||Array.from(e.children).forEach(n=>{n.tagName==="SPAN"?r.push(n):n.children.length&&r.push(...ap(n,t+1));}),r},ek=e=>{if(!e.children.length)return;let t=ap(e);t&&t.forEach(r=>{var n,o;let a=r.getAttribute("style"),i=(o=(n=r.parentElement)==null?void 0:n.closest("span"))==null?void 0:o.getAttribute("style");r.setAttribute("style",`${i};${a}`);});},Rl=Cl.create({name:"textStyle",priority:101,addOptions(){return {HTMLAttributes:{},mergeNestedSpanStyles:true}},parseHTML(){return [{tag:"span",consuming:false,getAttrs:e=>e.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&ek(e),{}):false}]},renderHTML({HTMLAttributes:e}){return ["span",Nn(this.options.HTMLAttributes,e),0]},addCommands(){return {toggleTextStyle:e=>({commands:t})=>t.toggleMark(this.name,e),removeEmptyTextStyle:()=>({tr:e})=>{let{selection:t}=e;return e.doc.nodesBetween(t.from,t.to,(r,n)=>{if(r.isTextblock)return true;r.marks.filter(o=>o.type===this.type).some(o=>Object.values(o.attrs).some(a=>!!a))||e.removeMark(n,n+r.nodeSize,this.type);}),true}}}}),tk=Ke.create({name:"backgroundColor",addOptions(){return {types:["textStyle"]}},addGlobalAttributes(){return [{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:e=>{var t;let r=e.getAttribute("style");if(r){let n=r.split(";").map(o=>o.trim()).filter(Boolean);for(let o=n.length-1;o>=0;o-=1){let a=n[o].split(":");if(a.length>=2){let i=a[0].trim().toLowerCase(),s=a.slice(1).join(":").trim();if(i==="background-color")return s.replace(/['"]+/g,"")}}}return (t=e.style.backgroundColor)==null?void 0:t.replace(/['"]+/g,"")},renderHTML:e=>e.backgroundColor?{style:`background-color: ${e.backgroundColor}`}:{}}}}]},addCommands(){return {setBackgroundColor:e=>({chain:t})=>t().setMark("textStyle",{backgroundColor:e}).run(),unsetBackgroundColor:()=>({chain:e})=>e().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),rk=Ke.create({name:"color",addOptions(){return {types:["textStyle"]}},addGlobalAttributes(){return [{types:this.options.types,attributes:{color:{default:null,parseHTML:e=>{var t;let r=e.getAttribute("style");if(r){let n=r.split(";").map(o=>o.trim()).filter(Boolean);for(let o=n.length-1;o>=0;o-=1){let a=n[o].split(":");if(a.length>=2){let i=a[0].trim().toLowerCase(),s=a.slice(1).join(":").trim();if(i==="color")return s.replace(/['"]+/g,"")}}}return (t=e.style.color)==null?void 0:t.replace(/['"]+/g,"")},renderHTML:e=>e.color?{style:`color: ${e.color}`}:{}}}}]},addCommands(){return {setColor:e=>({chain:t})=>t().setMark("textStyle",{color:e}).run(),unsetColor:()=>({chain:e})=>e().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),nk=Ke.create({name:"fontFamily",addOptions(){return {types:["textStyle"]}},addGlobalAttributes(){return [{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:e=>e.style.fontFamily,renderHTML:e=>e.fontFamily?{style:`font-family: ${e.fontFamily}`}:{}}}}]},addCommands(){return {setFontFamily:e=>({chain:t})=>t().setMark("textStyle",{fontFamily:e}).run(),unsetFontFamily:()=>({chain:e})=>e().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),ok=Ke.create({name:"fontSize",addOptions(){return {types:["textStyle"]}},addGlobalAttributes(){return [{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:e=>e.style.fontSize,renderHTML:e=>e.fontSize?{style:`font-size: ${e.fontSize}`}:{}}}}]},addCommands(){return {setFontSize:e=>({chain:t})=>t().setMark("textStyle",{fontSize:e}).run(),unsetFontSize:()=>({chain:e})=>e().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),ak=Ke.create({name:"lineHeight",addOptions(){return {types:["textStyle"]}},addGlobalAttributes(){return [{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:e=>e.style.lineHeight,renderHTML:e=>e.lineHeight?{style:`line-height: ${e.lineHeight}`}:{}}}}]},addCommands(){return {setLineHeight:e=>({chain:t})=>t().setMark("textStyle",{lineHeight:e}).run(),unsetLineHeight:()=>({chain:e})=>e().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}});Ke.create({name:"textStyleKit",addExtensions(){let e=[];return this.options.backgroundColor!==false&&e.push(tk.configure(this.options.backgroundColor)),this.options.color!==false&&e.push(rk.configure(this.options.color)),this.options.fontFamily!==false&&e.push(nk.configure(this.options.fontFamily)),this.options.fontSize!==false&&e.push(ok.configure(this.options.fontSize)),this.options.lineHeight!==false&&e.push(ak.configure(this.options.lineHeight)),this.options.textStyle!==false&&e.push(Rl.configure(this.options.textStyle)),e}});function sk({node:e,updateAttributes:t,selected:r}){let n=On.useRef(null),[o,a]=On.useState(false),i=On.useRef({x:0,width:0}),{src:s,alt:l,title:c}=e.attrs,u=e.attrs.width;function p(m){m.preventDefault(),m.stopPropagation();let d=n.current?.offsetWidth??(typeof u=="number"?u:200);i.current={x:m.clientX,width:d},a(true);}return On.useEffect(()=>{if(!o)return;function m(g){let h=g.clientX-i.current.x,b=Math.max(60,Math.round(i.current.width+h));t({width:b,height:null});}function d(){a(false);}return document.addEventListener("mousemove",m),document.addEventListener("mouseup",d),()=>{document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",d);}},[o,t]),jsxRuntime.jsxs(react.NodeViewWrapper,{as:"span",className:`rte-image-wrapper${r?" rte-image-wrapper--selected":""}`,children:[jsxRuntime.jsx("img",{ref:n,src:s,alt:l??"",title:c??"",draggable:false,style:{display:"block",maxWidth:"100%",width:u?`${u}px`:void 0,cursor:o?"ew-resize":"default"}}),r&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"rte-rh rte-rh--nw"}),jsxRuntime.jsx("span",{className:"rte-rh rte-rh--ne"}),jsxRuntime.jsx("span",{className:"rte-rh rte-rh--sw"}),jsxRuntime.jsx("span",{className:"rte-rh rte-rh--se",onMouseDown:p,title:"Drag to resize",role:"separator","aria-label":"Resize image"}),jsxRuntime.jsx("span",{className:"rte-rh rte-rh--e",onMouseDown:p,title:"Drag to resize",role:"separator","aria-label":"Resize image"}),u&&jsxRuntime.jsxs("span",{className:"rte-image-size-label","aria-live":"polite",children:[u,"px"]})]})]})}var ip=ik__default.default.extend({name:"image",addAttributes(){return {...this.parent?.(),width:{default:null,parseHTML:e=>{let t=e.getAttribute("width");return t?parseInt(t,10):null},renderHTML:e=>e.width?{width:e.width,style:`width:${e.width}px;`}:{}},height:{default:null,parseHTML:e=>{let t=e.getAttribute("height");return t?parseInt(t,10):null},renderHTML:e=>e.height?{height:e.height}:{}}}},addNodeView(){return react.ReactNodeViewRenderer(sk)}}).configure({inline:true,allowBase64:true});function lk({node:e,updateAttributes:t,selected:r}){let n=On.useRef(null),[o,a]=On.useState(false),i=On.useRef({x:0,width:0}),{src:s}=e.attrs,l=e.attrs.width;function c(u){u.preventDefault(),u.stopPropagation();let p=n.current?.offsetWidth??(typeof l=="number"?l:320);i.current={x:u.clientX,width:p},a(true);}return On.useEffect(()=>{if(!o)return;function u(m){let d=m.clientX-i.current.x,g=Math.max(120,Math.round(i.current.width+d));t({width:g});}function p(){a(false);}return document.addEventListener("mousemove",u),document.addEventListener("mouseup",p),()=>{document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",p);}},[o,t]),jsxRuntime.jsx(react.NodeViewWrapper,{as:"div",className:`rte-video-wrapper${r?" rte-video-wrapper--selected":""}`,children:jsxRuntime.jsxs("div",{ref:n,style:{display:"inline-block",maxWidth:"100%",width:l?`${l}px`:"100%",position:"relative"},children:[jsxRuntime.jsx("video",{src:s,controls:true,style:{display:"block",width:"100%",maxWidth:"100%"}}),r&&jsxRuntime.jsx("span",{className:"rte-rh rte-rh--e",onMouseDown:c,title:"Drag to resize",role:"separator","aria-label":"Resize video"})]})})}var sp=Pl.create({name:"resizableVideo",group:"block",atom:true,draggable:true,addAttributes(){return {src:{default:null},width:{default:null,parseHTML:e=>{let t=e.getAttribute("data-width");return t?parseInt(t,10):null},renderHTML:e=>e.width?{"data-width":e.width}:{}}}},parseHTML(){return [{tag:"div[data-type=resizable-video]"}]},renderHTML({HTMLAttributes:e}){return ["div",Nn({"data-type":"resizable-video"},e)]},addNodeView(){return react.ReactNodeViewRenderer(lk)}});function ck({node:e,updateAttributes:t,selected:r}){let n=On.useRef(null),[o,a]=On.useState(false),i=On.useRef({x:0,width:0}),{src:s}=e.attrs,l=e.attrs.width??480,c=e.attrs.height??Math.round(l*9/16);function u(p){p.preventDefault(),p.stopPropagation();let m=n.current?.offsetWidth??l;i.current={x:p.clientX,width:m},a(true);}return On.useEffect(()=>{if(!o)return;function p(d){let g=d.clientX-i.current.x,h=Math.max(160,Math.round(i.current.width+g));t({width:h,height:Math.round(h*9/16)});}function m(){a(false);}return document.addEventListener("mousemove",p),document.addEventListener("mouseup",m),()=>{document.removeEventListener("mousemove",p),document.removeEventListener("mouseup",m);}},[o,t]),jsxRuntime.jsx(react.NodeViewWrapper,{as:"div",className:`rte-embed-wrapper${r?" rte-embed-wrapper--selected":""}`,children:jsxRuntime.jsxs("div",{ref:n,style:{display:"inline-block",position:"relative",width:`${l}px`,maxWidth:"100%"},children:[jsxRuntime.jsx("iframe",{src:s,width:l,height:c,allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; fullscreen",sandbox:"allow-scripts allow-same-origin allow-popups allow-presentation",title:"Embedded video",style:{display:"block",border:"none",maxWidth:"100%"}}),r&&jsxRuntime.jsx("span",{className:"rte-rh rte-rh--e",onMouseDown:u,title:"Drag to resize",role:"separator","aria-label":"Resize embed"})]})})}var lp=Pl.create({name:"embedFrame",group:"block",atom:true,draggable:true,addAttributes(){return {src:{default:null},width:{default:480},height:{default:270}}},parseHTML(){return [{tag:"div[data-type=embed-frame]"}]},renderHTML({HTMLAttributes:e}){return ["div",Nn({"data-type":"embed-frame"},e)]},addNodeView(){return react.ReactNodeViewRenderer(ck)}});function ko(e){return marked.marked.parse(e,{async:false})}function ai(e){return e.replace(/<h1[^>]*>([\s\S]*?)<\/h1>/gi,`# $1
104
+
105
+ `).replace(/<h2[^>]*>([\s\S]*?)<\/h2>/gi,`## $1
106
+
107
+ `).replace(/<h3[^>]*>([\s\S]*?)<\/h3>/gi,`### $1
108
+
109
+ `).replace(/<h4[^>]*>([\s\S]*?)<\/h4>/gi,`#### $1
110
+
111
+ `).replace(/<h5[^>]*>([\s\S]*?)<\/h5>/gi,`##### $1
112
+
113
+ `).replace(/<h6[^>]*>([\s\S]*?)<\/h6>/gi,`###### $1
114
+
115
+ `).replace(/<blockquote[^>]*>([\s\S]*?)<\/blockquote>/gi,(t,r)=>r.trim().replace(/^/gm,"> ")+`
116
+
117
+ `).replace(/<pre[^>]*><code[^>]*>([\s\S]*?)<\/code><\/pre>/gi,"```\n$1\n```\n\n").replace(/<hr\s*\/?>/gi,`
118
+ ---
119
+
120
+ `).replace(/<li[^>]*>([\s\S]*?)<\/li>/gi,`- $1
121
+ `).replace(/<\/?(ul|ol)[^>]*>/gi,`
122
+ `).replace(/<strong[^>]*>([\s\S]*?)<\/strong>/gi,"**$1**").replace(/<b[^>]*>([\s\S]*?)<\/b>/gi,"**$1**").replace(/<em[^>]*>([\s\S]*?)<\/em>/gi,"_$1_").replace(/<i[^>]*>([\s\S]*?)<\/i>/gi,"_$1_").replace(/<s[^>]*>([\s\S]*?)<\/s>/gi,"~~$1~~").replace(/<del[^>]*>([\s\S]*?)<\/del>/gi,"~~$1~~").replace(/<code[^>]*>([\s\S]*?)<\/code>/gi,"`$1`").replace(/<a[^>]*href="([^"]*)"[^>]*>([\s\S]*?)<\/a>/gi,"[$2]($1)").replace(/<img[^>]*src="([^"]*)"[^>]*alt="([^"]*)"[^>]*\/?>/gi,"![$2]($1)").replace(/<img[^>]*src="([^"]*)"[^>]*\/?>/gi,"![]($1)").replace(/<br\s*\/?>/gi,`
123
+ `).replace(/<p[^>]*>([\s\S]*?)<\/p>/gi,`$1
124
+
125
+ `).replace(/<[^>]+>/g,"").replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/&nbsp;/g," ").replace(/\n{3,}/g,`
126
+
127
+ `).trim()}function Il(e){return e.trim()?e.trim().split(/\s+/).length:0}function zl(e,t,r=false){if(!t)return [];let n=[],o=r?"g":"gi",a=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=new RegExp(a,o);return e.descendants((s,l)=>{if(!s.isText||!s.text)return;let c;for(i.lastIndex=0;(c=i.exec(s.text))!==null;)n.push({from:l+c.index,to:l+c.index+c[0].length});}),n}function ii(e,t,r=false){if(!t)return [];let n=r?"g":"gi",o=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(o,n),i=[],s;for(;(s=a.exec(e))!==null;)i.push([s.index,s.index+s[0].length]);return i}var Pt=new state.PluginKey("rteSearch"),Dk=Ke.create({name:"rteSearch",addProseMirrorPlugins(){return [new state.Plugin({key:Pt,state:{init(){return {query:"",caseSensitive:false,currentIndex:0,matches:[]}},apply(e,t){let r=e.getMeta(Pt);if(r){let n={...t,...r};return n.matches=zl(e.doc,n.query,n.caseSensitive),n.currentIndex>=n.matches.length&&(n.currentIndex=0),n}if(e.docChanged&&t.query){let n=zl(e.doc,t.query,t.caseSensitive),o=Math.min(t.currentIndex,Math.max(0,n.length-1));return {...t,matches:n,currentIndex:o}}return t}},props:{decorations(e){let t=Pt.getState(e);if(!t?.query||!t.matches.length)return view.DecorationSet.empty;let r=t.matches.map((n,o)=>view.Decoration.inline(n.from,n.to,{class:o===t.currentIndex?"rte-search-current":"rte-search-match"}));return view.DecorationSet.create(e.doc,r)}}})]}});function dp(e){return react.useEditor({extensions:[gk__default.default,bk__default.default,yk__default.default.configure({types:["heading","paragraph"]}),Rl,extensionColor.Color,xk__default.default.configure({multicolor:true}),ip,sp,lp,wk__default.default.configure({openOnClick:false}),kk__default.default.configure({width:480,height:320}),Nk__default.default.configure({placeholder:e.placeholder??"Start typing\u2026"}),Ck__default.default,Mk__default.default,Tk__default.default,Sk__default.default,extensionTable.Table.configure({resizable:true}),Rk__default.default,Ek__default.default,Lk__default.default,Dk],content:e.defaultValue??"",editable:!e.readOnly,autofocus:e.autoFocus,onUpdate:({editor:r})=>{e.onChange?.({html:r.getHTML(),markdown:"",json:r.getJSON(),text:r.getText()});}})}var M1={tab_home:"Home",tab_insert:"Insert",tab_format:"Format",group_clipboard:"Clipboard",undo:"Undo",redo:"Redo",save:"Save",group_text:"Text",bold:"Bold",italic:"Italic",underline:"Underline",strikethrough:"Strikethrough",group_headings:"Headings",h1:"H1",h2:"H2",h3:"H3",paragraph:"Normal",group_alignment:"Alignment",alignLeft:"Left",alignCenter:"Center",alignRight:"Right",alignJustify:"Justify",group_lists:"Lists",bulletList:"Bullet",orderedList:"Ordered",group_media:"Media",image:"Image",video:"Video",youtube:"Video",group_content:"Content",link:"Link",table:"Table",codeBlock:"Code Block",blockquote:"Quote",divider:"Divider",group_style:"Style",color:"Color",highlight:"Highlight",subscript:"Sub",superscript:"Sup",group_reset:"Reset",clear:"Clear",group_table_rows:"Rows",addRowBefore:"Add Above",addRowAfter:"Add Below",deleteRow:"Del Row",group_table_cols:"Columns",addColBefore:"Add Left",addColAfter:"Add Right",deleteColumn:"Del Col",group_table_cells:"Cells",mergeCells:"Merge",splitCell:"Split",deleteTable:"Del Table"};function nr({icon:e,label:t,onClick:r,disabled:n=false,title:o}){return jsxRuntime.jsxs("button",{type:"button",className:f("rte-tbar-btn",n&&"rte-tbar-btn--disabled"),onClick:r,disabled:n,title:o??t,children:[e,jsxRuntime.jsx("span",{className:"rte-tbar-label",children:t})]})}function T1({editor:e,L:t,readOnly:r}){let[,n]=On.useState(0),[o,a]=On.useState(null),i=On.useRef(null);if(On.useEffect(()=>{if(!e)return;let u=()=>n(p=>p+1);return e.on("selectionUpdate",u),e.on("transaction",u),()=>{e.off("selectionUpdate",u),e.off("transaction",u);}},[e]),On.useEffect(()=>{if(!o)return;function u(p){i.current&&!i.current.contains(p.target)&&a(null);}return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[o]),!e||r||!e.isActive("table"))return null;let s=e.can().mergeCells(),l=e.can().splitCell();function c(){l?e.chain().focus().splitCell().run():a(u=>u?null:"col");}return jsxRuntime.jsxs("div",{className:"rte-tablebar",role:"toolbar","aria-label":"Table editing",children:[jsxRuntime.jsx("span",{className:"rte-tbar-group-label",children:t.group_table_rows}),jsxRuntime.jsx(nr,{icon:jsxRuntime.jsx(lucideReact.BetweenHorizontalStart,{size:13}),label:t.addRowBefore,onClick:()=>e.chain().focus().addRowBefore().run()}),jsxRuntime.jsx(nr,{icon:jsxRuntime.jsx(lucideReact.BetweenHorizontalEnd,{size:13}),label:t.addRowAfter,onClick:()=>e.chain().focus().addRowAfter().run()}),jsxRuntime.jsx(nr,{icon:jsxRuntime.jsx(lucideReact.Trash2,{size:13}),label:t.deleteRow,onClick:()=>e.chain().focus().deleteRow().run()}),jsxRuntime.jsx("div",{className:"rte-tbar-sep"}),jsxRuntime.jsx("span",{className:"rte-tbar-group-label",children:t.group_table_cols}),jsxRuntime.jsx(nr,{icon:jsxRuntime.jsx(lucideReact.BetweenVerticalStart,{size:13}),label:t.addColBefore,onClick:()=>e.chain().focus().addColumnBefore().run()}),jsxRuntime.jsx(nr,{icon:jsxRuntime.jsx(lucideReact.BetweenVerticalEnd,{size:13}),label:t.addColAfter,onClick:()=>e.chain().focus().addColumnAfter().run()}),jsxRuntime.jsx(nr,{icon:jsxRuntime.jsx(lucideReact.Trash2,{size:13}),label:t.deleteColumn,onClick:()=>e.chain().focus().deleteColumn().run()}),jsxRuntime.jsx("div",{className:"rte-tbar-sep"}),jsxRuntime.jsx("span",{className:"rte-tbar-group-label",children:t.group_table_cells}),jsxRuntime.jsx(nr,{icon:jsxRuntime.jsx(lucideReact.TableCellsMerge,{size:13}),label:t.mergeCells,onClick:()=>e.chain().focus().mergeCells().run(),disabled:!s,title:s?t.mergeCells:`${t.mergeCells} (Shift+click to select cells)`}),jsxRuntime.jsxs("div",{className:"rte-tbar-split-wrap",ref:i,children:[jsxRuntime.jsx(nr,{icon:jsxRuntime.jsx(lucideReact.TableCellsSplit,{size:13}),label:l?t.splitCell:`${t.splitCell}\u2026`,onClick:c,title:l?t.splitCell:"Split by adding a column or row"}),o&&!l&&jsxRuntime.jsxs("div",{className:"rte-tbar-split-picker",children:[jsxRuntime.jsxs("button",{className:"rte-tbar-split-pick-btn",onClick:()=>{e.chain().focus().addColumnAfter().run(),a(null);},children:[jsxRuntime.jsx(lucideReact.BetweenVerticalEnd,{size:13}),"Split column"]}),jsxRuntime.jsxs("button",{className:"rte-tbar-split-pick-btn",onClick:()=>{e.chain().focus().addRowAfter().run(),a(null);},children:[jsxRuntime.jsx(lucideReact.BetweenHorizontalEnd,{size:13}),"Split row"]})]})]}),jsxRuntime.jsx("div",{className:"rte-tbar-sep"}),jsxRuntime.jsx(nr,{icon:jsxRuntime.jsx(lucideReact.Trash2,{size:13}),label:t.deleteTable,onClick:()=>e.chain().focus().deleteTable().run()})]})}function Hl({open:e,onClose:t,children:r}){let n=On.useRef(null);return On.useEffect(()=>{if(!e)return;function o(a){n.current&&!n.current.contains(a.target)&&t();}return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[e,t]),e?jsxRuntime.jsx("div",{ref:n,className:"rte-inline-dialog",children:r}):null}function S1({mode:e,onClose:t,onFind:r,onPrev:n,onNext:o,onReplace:a,onReplaceAll:i,matchCount:s,currentIndex:l}){let[c,u]=On__default.default.useState(""),[p,m]=On__default.default.useState(""),[d,g]=On__default.default.useState(false),h=On__default.default.useRef(null);On.useEffect(()=>{h.current?.focus();},[]);function b(w){let L=w.target.value;u(L),r(L,d);}function y(){let w=!d;g(w),r(c,w);}function v(w){if(w.key==="Escape"){t();return}w.key==="Enter"&&(w.shiftKey?n():o());}let N=s>0,x=c?N?`${l+1} / ${s}`:"No results":"";return jsxRuntime.jsxs("div",{className:"rte-findbar",role:"search","aria-label":"Find and replace",children:[jsxRuntime.jsxs("div",{className:"rte-findbar-row",children:[jsxRuntime.jsx(lucideReact.Search,{size:14,className:"rte-findbar-icon"}),jsxRuntime.jsx("input",{ref:h,className:"rte-findbar-input",value:c,onChange:b,onKeyDown:v,placeholder:"Find\u2026","aria-label":"Find",spellCheck:false}),jsxRuntime.jsx("button",{className:f("rte-findbar-btn",d&&"rte-findbar-btn--active"),onClick:y,title:"Match case","aria-pressed":d,children:"Aa"}),jsxRuntime.jsx("span",{className:"rte-findbar-count",children:x}),jsxRuntime.jsx("button",{className:"rte-findbar-btn",onClick:n,disabled:!N,title:"Previous match (Shift+Enter)","aria-label":"Previous match",children:jsxRuntime.jsx(lucideReact.ChevronUp,{size:14})}),jsxRuntime.jsx("button",{className:"rte-findbar-btn",onClick:o,disabled:!N,title:"Next match (Enter)","aria-label":"Next match",children:jsxRuntime.jsx(lucideReact.ChevronDown,{size:14})}),jsxRuntime.jsx("button",{className:"rte-findbar-btn rte-findbar-btn--close",onClick:t,title:"Close (Esc)","aria-label":"Close find bar",children:jsxRuntime.jsx(lucideReact.X,{size:14})})]}),e==="replace"&&jsxRuntime.jsxs("div",{className:"rte-findbar-row",children:[jsxRuntime.jsx(lucideReact.Replace,{size:14,className:"rte-findbar-icon"}),jsxRuntime.jsx("input",{className:"rte-findbar-input",value:p,onChange:w=>m(w.target.value),onKeyDown:w=>w.key==="Escape"&&t(),placeholder:"Replace with\u2026","aria-label":"Replace with",spellCheck:false}),jsxRuntime.jsx("button",{className:"rte-findbar-btn rte-findbar-btn--action",onClick:()=>a(p),disabled:!N,title:"Replace current",children:"Replace"}),jsxRuntime.jsx("button",{className:"rte-findbar-btn rte-findbar-btn--action",onClick:()=>i(p),disabled:!N,title:"Replace all",children:"All"})]})]})}var Co=On.forwardRef(function(t,r){let{mode:n,defaultMode:o="richtext",onModeChange:a,showPreview:i,defaultShowPreview:s=false,onPreviewChange:l,defaultValue:c="",value:u,onChange:p,placeholder:m="Start typing\u2026",readOnly:d=false,height:g=400,minHeight:h,maxHeight:b,showWordCount:y=true,showCharCount:v=true,onImageUpload:N,allowedImageTypes:x,maxImageSize:w,autoFocus:L=false,spellCheck:P=true,className:A,style:D,labels:S,extraRibbonGroups:C,extraRibbonTabs:I,onSave:k}=t,T={...M1,...S},[R,O]=On.useState(o),E=n??R;function ne(ee){if(ee!==E){if(ee==="markdown"){let ae=j?.getHTML()??re;F(ai(ae));}else {let ae=ko(M);W(ae),j?.commands.setContent(ae);}n===void 0&&O(ee),a?.(ee);}}let[U,z]=On.useState(()=>typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)").matches:false);function H(ee){z(ee),ee?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark");}On.useEffect(()=>{H(U);let ee=window.matchMedia("(prefers-color-scheme: dark)");function ae(Ie){z(Ie.matches),H(Ie.matches);}return ee.addEventListener("change",ae),()=>ee.removeEventListener("change",ae)},[]);let[_,V]=On.useState(s),oe=i??_;function be(ee){let ae=ee??!oe;i===void 0&&V(ae),l?.(ae);}let[M,F]=On.useState(E==="markdown"?u??c:""),[re,W]=On.useState(E==="richtext"?u??c??"":""),[G,le]=On.useState(false),[ke,B]=On.useState(""),[q,Z]=On.useState(false),[ue,te]=On.useState(""),[ve,Ne]=On.useState(false),[X,de]=On.useState(""),[Q,ie]=On.useState(null),[Pe,Oe]=On.useState(null),[Xe,se]=On.useState(0),[Re,K]=On.useState(0),[ce,me]=On.useState(""),J=On.useRef(null),Ce=On.useRef(null),Ye=On.useRef(null);On.useEffect(()=>{function ee(ae){!(ae.metaKey||ae.ctrlKey)||ae.key.toLowerCase()!=="f"||Ce.current?.contains(ae.target)&&(ae.preventDefault(),ae.shiftKey?Oe(ze=>ze==="replace"?null:"replace"):Oe(ze=>ze!==null?null:"find"));}return document.addEventListener("keydown",ee,true),()=>document.removeEventListener("keydown",ee,true)},[]);function vt(ee){let ae=ee.trim();if(/\.(mp4|webm|ogg|ogv|mov|m4v|flv|mkv)(\?[^#]*)?$/i.test(ae))return {kind:"video"};if(/(?:youtube\.com|youtu\.be|youtube-nocookie\.com)/.test(ae))return {kind:"youtube"};let Ie=ae.match(/vimeo\.com\/(?:video\/)?(\d+)/);if(Ie)return {kind:"iframe",embedUrl:`https://player.vimeo.com/video/${Ie[1]}`};let ze=ae.match(/bilibili\.com\/video\/(BV[\w]+|av\d+)/i);if(ze)return {kind:"iframe",embedUrl:`https://player.bilibili.com/player.html?bvid=${ze[1]}&high_quality=1&danmaku=0`};let Je=ae.match(/dailymotion\.com\/(?:video\/|embed\/video\/)([a-z0-9]+)/i);if(Je)return {kind:"iframe",embedUrl:`https://www.dailymotion.com/embed/video/${Je[1]}`};let tt=ae.match(/twitch\.tv\/\w+\/clip\/([\w-]+)/);if(tt){let ft=typeof window<"u"?window.location.hostname:"localhost";return {kind:"iframe",embedUrl:`https://clips.twitch.tv/embed?clip=${tt[1]}&parent=${ft}`}}return null}function Wr(){let ee=X.trim();if(!ee)return;let ae=vt(ee);if(!ae){ie("Unsupported URL. Paste a YouTube, Vimeo, Bilibili, Dailymotion, or direct .mp4/.webm link.");return}ae.kind==="youtube"?j?.chain().focus().setYoutubeVideo({src:ee}).run():ae.kind==="iframe"?j?.chain().focus().insertContent({type:"embedFrame",attrs:{src:ae.embedUrl}}).run():j?.chain().focus().insertContent({type:"resizableVideo",attrs:{src:ee}}).run(),de(""),ie(null),Ne(false);}function $(ee,ae){j&&j.view.dispatch(j.view.state.tr.setMeta(Pt,{query:ee,caseSensitive:ae,currentIndex:0}));}function ge(ee){if(!j)return;let ae=Pt.getState(j.view.state);if(!ae||!ae.matches.length)return;let Ie=ae.matches.length,ze=((ae.currentIndex+ee)%Ie+Ie)%Ie;j.view.dispatch(j.view.state.tr.setMeta(Pt,{currentIndex:ze}));let Je=ae.matches[ze];Je&&(j.commands.setTextSelection({from:Je.from,to:Je.to}),j.commands.scrollIntoView());}function Le(ee){if(!j)return;let ae=Pt.getState(j.view.state);if(!ae||!ae.matches.length)return;let Ie=ae.matches[ae.currentIndex];Ie&&(j.chain().setTextSelection({from:Ie.from,to:Ie.to}).insertContent(ee).run(),$(ae.query,ae.caseSensitive));}function De(ee){if(!j)return;let ae=Pt.getState(j.view.state);if(!ae||!ae.matches.length)return;let Ie=j.chain();[...ae.matches].reverse().forEach(ze=>{Ie.setTextSelection({from:ze.from,to:ze.to}).insertContent(ee);}),Ie.run(),$(ae.query,ae.caseSensitive);}function He(ee,ae){me(ee);let Ie=ii(M,ee,ae);se(Ie.length),K(0);}function dt(ee,ae,Ie){let ze=ii(M,ae,Ie);if(!ze.length)return;let Je=ze.length,tt=((Re+ee)%Je+Je)%Je;K(tt);let ft=Ye.current;ft&&(ft.focus(),ft.setSelectionRange(ze[tt][0],ze[tt][1]));}function Gt(ee,ae,Ie){let ze=ii(M,ee,Ie);if(!ze.length)return;let[Je,tt]=ze[Re]??ze[0],ft=M.slice(0,Je)+ae+M.slice(tt);F(ft);}function Mo(ee,ae,Ie){let ze=ee.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Je=new RegExp(ze,"gi");F(tt=>tt.replace(Je,ae)),se(0),K(0);}let j=dp({defaultValue:E==="richtext"?u??c:"",placeholder:m,readOnly:d,autoFocus:E==="richtext"&&L,onChange:ee=>{W(ee.html),p?.({...ee,markdown:ai(ee.html)});}});On.useEffect(()=>{u!==void 0&&j&&E==="richtext"&&j.getHTML()!==u&&(j.commands.setContent(u),W(u));},[u,j,E]);let qt=j?Pt.getState(j.view.state):null,ir=E==="richtext"?qt?.matches.length??0:Xe,Sn=E==="richtext"?qt?.currentIndex??0:Re;function Yr(){if(!k)return;let ee=E==="markdown"?M:j?.getHTML()??"";k(ee,E);}On.useEffect(()=>{if(!k)return;function ee(ae){!(ae.metaKey||ae.ctrlKey)||ae.key.toLowerCase()!=="s"||Ce.current?.contains(ae.target)&&(ae.preventDefault(),Yr());}return document.addEventListener("keydown",ee,true),()=>document.removeEventListener("keydown",ee,true)},[k,E,M,j]);function Tr(ee){let ae=ee.target.value;F(ae),p?.({html:ko(ae),markdown:ae,json:{},text:ae});}let Kp=On.useCallback(async ee=>{let Ie=Array.from(ee.clipboardData?.items??[]).find(tt=>tt.type.startsWith("image/"));if(!Ie)return;ee.preventDefault();let ze=Ie.getAsFile();if(!ze||x&&!x.includes(ze.type)||w&&ze.size>w)return;let Je;if(N?Je=await N(ze):Je=await new Promise(tt=>{let ft=new FileReader;ft.onload=()=>tt(ft.result),ft.readAsDataURL(ze);}),E==="richtext"&&j)j.chain().focus().setImage({src:Je}).run();else {let tt=ee.currentTarget.querySelector(".rte-markdown-source");if(tt){let ft=tt.selectionStart,Xp=`![pasted image](${Je})`,Gp=M.slice(0,ft),qp=M.slice(ft);F(Gp+Xp+qp);}}},[E,j,M,N,x,w]);On.useImperativeHandle(r,()=>({getContent:()=>E==="markdown"?M:j?.getHTML()??"",getMode:()=>E,getHTML:()=>j?.getHTML()??"",getMarkdown:()=>E==="markdown"?M:ai(j?.getHTML()??""),getJSON:()=>j?.getJSON()??{},getText:()=>j?.getText()??"",setHTML:ee=>j?.commands.setContent(ee),setMarkdown:ee=>{F(ee),j?.commands.setContent(ko(ee));},setJSON:ee=>j?.commands.setContent(ee),clear:()=>{j?.commands.clearContent(),F("");},focus:()=>j?.commands.focus(),blur:()=>(j?.view.dom).blur()}));let jp=j?.storage?.characterCount?.characters?.()??M.length,Wp=E==="richtext"?Il(j?.getText()??""):Il(M),Yp=[...[{key:"home",label:T.tab_home,groups:[{key:"clipboard",label:T.group_clipboard,items:[{key:"undo",label:T.undo,icon:jsxRuntime.jsx(lucideReact.Undo2,{}),disabled:d||!j?.can().undo()||E==="markdown",onClick:()=>j?.chain().focus().undo().run()},{key:"redo",label:T.redo,icon:jsxRuntime.jsx(lucideReact.Redo2,{}),disabled:d||!j?.can().redo()||E==="markdown",onClick:()=>j?.chain().focus().redo().run()},{key:"save",label:T.save,icon:jsxRuntime.jsx(lucideReact.Save,{}),disabled:d||!k,onClick:Yr}]},{key:"text",label:T.group_text,items:[{key:"bold",label:T.bold,icon:jsxRuntime.jsx(lucideReact.Bold,{}),active:j?.isActive("bold"),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().toggleBold().run()},{key:"italic",label:T.italic,icon:jsxRuntime.jsx(lucideReact.Italic,{}),active:j?.isActive("italic"),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().toggleItalic().run()},{key:"underline",label:T.underline,icon:jsxRuntime.jsx(lucideReact.Underline,{}),active:j?.isActive("underline"),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().toggleUnderline().run()},{key:"strike",label:T.strikethrough,icon:jsxRuntime.jsx(lucideReact.Strikethrough,{}),active:j?.isActive("strike"),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().toggleStrike().run()}]},{key:"headings",label:T.group_headings,items:[{key:"h1",label:T.h1,icon:jsxRuntime.jsx(lucideReact.Heading1,{}),active:j?.isActive("heading",{level:1}),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().toggleHeading({level:1}).run()},{key:"h2",label:T.h2,icon:jsxRuntime.jsx(lucideReact.Heading2,{}),active:j?.isActive("heading",{level:2}),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().toggleHeading({level:2}).run()},{key:"h3",label:T.h3,icon:jsxRuntime.jsx(lucideReact.Heading3,{}),active:j?.isActive("heading",{level:3}),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().toggleHeading({level:3}).run()},{key:"paragraph",label:T.paragraph,icon:jsxRuntime.jsx(lucideReact.Type,{}),active:j?.isActive("paragraph"),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().setParagraph().run()}]},{key:"alignment",label:T.group_alignment,items:[{key:"align-left",label:T.alignLeft,icon:jsxRuntime.jsx(lucideReact.AlignLeft,{}),active:j?.isActive({textAlign:"left"}),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().setTextAlign("left").run()},{key:"align-center",label:T.alignCenter,icon:jsxRuntime.jsx(lucideReact.AlignCenter,{}),active:j?.isActive({textAlign:"center"}),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().setTextAlign("center").run()},{key:"align-right",label:T.alignRight,icon:jsxRuntime.jsx(lucideReact.AlignRight,{}),active:j?.isActive({textAlign:"right"}),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().setTextAlign("right").run()},{key:"align-justify",label:T.alignJustify,icon:jsxRuntime.jsx(lucideReact.AlignJustify,{}),active:j?.isActive({textAlign:"justify"}),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().setTextAlign("justify").run()}]},{key:"lists",label:T.group_lists,items:[{key:"bullet-list",label:T.bulletList,icon:jsxRuntime.jsx(lucideReact.List,{}),active:j?.isActive("bulletList"),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().toggleBulletList().run()},{key:"ordered-list",label:T.orderedList,icon:jsxRuntime.jsx(lucideReact.ListOrdered,{}),active:j?.isActive("orderedList"),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().toggleOrderedList().run()}]},...C?.home??[]]},{key:"insert",label:T.tab_insert,groups:[{key:"media",label:T.group_media,items:[{key:"image",label:T.image,icon:jsxRuntime.jsx(lucideReact.Image,{}),disabled:d||E==="markdown",onClick:()=>le(true)},{key:"video",label:T.video??T.youtube,icon:jsxRuntime.jsx(lucideReact.Video,{}),disabled:d||E==="markdown",onClick:()=>{de(""),ie(null),Ne(true);}}]},{key:"content",label:T.group_content,items:[{key:"link",label:T.link,icon:jsxRuntime.jsx(lucideReact.Link,{}),active:j?.isActive("link"),disabled:d||E==="markdown",onClick:()=>{let ee=j?.getAttributes("link").href??"";te(ee),Z(true);}},{key:"table",label:T.table,icon:jsxRuntime.jsx(lucideReact.Table,{}),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:true}).run()},{key:"code-block",label:T.codeBlock,icon:jsxRuntime.jsx(lucideReact.Code,{}),active:j?.isActive("codeBlock"),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().toggleCodeBlock().run()},{key:"blockquote",label:T.blockquote,icon:jsxRuntime.jsx(lucideReact.Quote,{}),active:j?.isActive("blockquote"),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().toggleBlockquote().run()},{key:"hr",label:T.divider,icon:jsxRuntime.jsx(lucideReact.Minus,{}),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().setHorizontalRule().run()}]},...C?.insert??[]]},{key:"format",label:T.tab_format,groups:[{key:"style",label:T.group_style,items:[{key:"color",label:T.color,icon:jsxRuntime.jsx(lucideReact.Palette,{}),disabled:d||E==="markdown",onClick:()=>{document.getElementById("rte-color-input")?.click();}},{key:"highlight",label:T.highlight,icon:jsxRuntime.jsx(lucideReact.Highlighter,{}),active:j?.isActive("highlight"),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().toggleHighlight().run()},{key:"subscript",label:T.subscript,icon:jsxRuntime.jsx(lucideReact.Subscript,{}),active:j?.isActive("subscript"),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().toggleSubscript().run()},{key:"superscript",label:T.superscript,icon:jsxRuntime.jsx(lucideReact.Superscript,{}),active:j?.isActive("superscript"),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().toggleSuperscript().run()}]},{key:"reset",label:T.group_reset,items:[{key:"clear",label:T.clear,icon:jsxRuntime.jsx(lucideReact.Eraser,{}),disabled:d||E==="markdown",onClick:()=>j?.chain().focus().unsetAllMarks().clearNodes().run()}]},...C?.format??[]]}],...I??[]],To={};g&&(To.height=typeof g=="number"?`${g}px`:g),h&&(To.minHeight=typeof h=="number"?`${h}px`:h),b&&(To.maxHeight=typeof b=="number"?`${b}px`:b);let Up=E==="richtext"?re:ko(M);return jsxRuntime.jsxs("div",{ref:Ce,className:f("rte-root",A),style:{...To,...D},"data-testid":"rte-root",onPaste:Kp,children:[jsxRuntime.jsx("input",{id:"rte-color-input",type:"color",className:"sr-only","aria-hidden":true,onChange:ee=>{j?.chain().focus().setColor(ee.target.value).run();}}),jsxRuntime.jsxs("div",{ref:J,className:"rte-ribbon relative",children:[jsxRuntime.jsx(Un,{tabs:Yp}),jsxRuntime.jsxs(Hl,{open:G,onClose:()=>le(false),children:[jsxRuntime.jsx("input",{type:"url",placeholder:"Image URL\u2026",value:ke,onChange:ee=>B(ee.target.value),onKeyDown:ee=>{ee.key==="Enter"&&(ke&&j?.chain().focus().setImage({src:ke}).run(),B(""),le(false));},autoFocus:true}),jsxRuntime.jsx("button",{onClick:()=>{ke&&j?.chain().focus().setImage({src:ke}).run(),B(""),le(false);},children:"Insert"}),jsxRuntime.jsx("button",{className:"rte-cancel-btn",onClick:()=>le(false),children:"Cancel"})]}),jsxRuntime.jsxs(Hl,{open:q,onClose:()=>Z(false),children:[jsxRuntime.jsx("input",{type:"url",placeholder:"https://\u2026",value:ue,onChange:ee=>te(ee.target.value),onKeyDown:ee=>{ee.key==="Enter"&&(j?.chain().focus().setLink({href:ue}).run(),te(""),Z(false));},autoFocus:true}),jsxRuntime.jsx("button",{onClick:()=>{j?.chain().focus().setLink({href:ue}).run(),te(""),Z(false);},children:"Apply"}),jsxRuntime.jsx("button",{className:"rte-cancel-btn",onClick:()=>Z(false),children:"Cancel"})]}),jsxRuntime.jsxs(Hl,{open:ve,onClose:()=>Ne(false),children:[jsxRuntime.jsx("input",{type:"url",placeholder:"YouTube, Vimeo, Bilibili, or .mp4 URL\u2026",value:X,onChange:ee=>{de(ee.target.value),ie(null);},onKeyDown:ee=>{ee.key==="Enter"&&Wr();},autoFocus:true,style:{minWidth:280}}),Q&&jsxRuntime.jsx("span",{style:{fontSize:"0.72rem",color:"var(--color-danger-500)",flex:"0 0 100%"},children:Q}),jsxRuntime.jsx("button",{onClick:Wr,children:"Embed"}),jsxRuntime.jsx("button",{className:"rte-cancel-btn",onClick:()=>Ne(false),children:"Cancel"})]})]}),E==="richtext"&&jsxRuntime.jsx(T1,{editor:j,L:T,readOnly:d??false}),Pe!==null&&jsxRuntime.jsx(S1,{mode:Pe,onClose:()=>{Oe(null),j&&j.view.dispatch(j.view.state.tr.setMeta(Pt,{query:"",currentIndex:0,matches:[]})),se(0),K(0),me("");},onFind:(ee,ae)=>{E==="richtext"?$(ee,ae):He(ee,ae);},onPrev:()=>{E==="richtext"?ge(-1):dt(-1,ce,false);},onNext:()=>{E==="richtext"?ge(1):dt(1,ce,false);},onReplace:ee=>{if(E==="richtext"){let ae=j?Pt.getState(j.view.state):null;Le(ee),ae&&He(ae.query,ae.caseSensitive);}else Gt(ce,ee,false);},onReplaceAll:ee=>{E==="richtext"?De(ee):Mo(ce,ee);},matchCount:ir,currentIndex:Sn}),jsxRuntime.jsxs("div",{className:"rte-body",children:[jsxRuntime.jsx("div",{className:"rte-editor-pane",children:E==="richtext"?jsxRuntime.jsx(react.EditorContent,{editor:j,spellCheck:P,readOnly:d}):jsxRuntime.jsx("textarea",{ref:Ye,className:"rte-markdown-source",value:M,onChange:Tr,placeholder:m,readOnly:d,spellCheck:P,"data-testid":"rte-markdown-source"})}),oe&&jsxRuntime.jsx("div",{className:"rte-preview-pane","data-testid":"rte-preview-pane",children:jsxRuntime.jsx("div",{className:"prose",dangerouslySetInnerHTML:{__html:Up}})})]}),jsxRuntime.jsxs("div",{className:"rte-statusbar",children:[jsxRuntime.jsxs("div",{className:"rte-statusbar-left",children:[jsxRuntime.jsx(Rr,{size:"sm",checked:U,onCheckedChange:H,checkedContent:jsxRuntime.jsx(lucideReact.Moon,{size:10}),uncheckedContent:jsxRuntime.jsx(lucideReact.Sun,{size:10}),"aria-label":"Toggle dark mode",title:U?"Switch to light mode":"Switch to dark mode"}),jsxRuntime.jsx("span",{className:"rte-statusbar-divider"}),jsxRuntime.jsx(Rr,{size:"sm",checked:E==="markdown",onCheckedChange:ee=>ne(ee?"markdown":"richtext"),disabled:n!==void 0,checkedContent:jsxRuntime.jsx(lucideReact.Code,{size:10}),uncheckedContent:jsxRuntime.jsx(lucideReact.FileText,{size:10}),"aria-label":"Toggle editor mode",title:n!==void 0?`Mode locked: ${E}`:E==="markdown"?"Markdown mode (click for Rich Text)":"Rich Text mode (click for Markdown)"}),jsxRuntime.jsx("span",{className:"rte-statusbar-label",children:E==="markdown"?"Markdown":"Rich Text"})]}),jsxRuntime.jsxs("div",{className:"rte-statusbar-right",children:[jsxRuntime.jsx(Rr,{size:"sm",checked:oe,onCheckedChange:be,checkedContent:jsxRuntime.jsx(lucideReact.Eye,{size:10}),uncheckedContent:jsxRuntime.jsx(lucideReact.EyeOff,{size:10}),"aria-label":"Toggle live preview",title:oe?"Hide preview":"Show live preview"}),jsxRuntime.jsx("span",{className:"rte-statusbar-label",children:"Preview"}),(y||v)&&jsxRuntime.jsx("span",{className:"rte-statusbar-divider"}),y&&jsxRuntime.jsxs("span",{children:[Wp," words"]}),v&&jsxRuntime.jsxs("span",{children:[jp," chars"]})]})]})]})});Co.displayName="RichTextEditor";var P1={FilmReel:Ks,MiniPlayer:Ws,CinePlayer:Us,FileExplorer:Zs,Masonry:nl,TypewriterText:Oa,CommandPalette:Ka,Timeline:il,DateTimePicker:Wa,LoginPanel:Ga,RichTextEditor:Co},_l=P1;var Bl=On.createContext({layout:"stacked",size:"md",labelWidth:"var(--form-label-w-md, 7rem)",bulkErrors:{}}),z1={sm:"var(--form-label-w-sm, 5rem)",md:"var(--form-label-w-md, 7rem)",lg:"var(--form-label-w-lg, 9rem)"},bp={sm:"gap-(--form-row-gap-sm)",md:"gap-(--form-row-gap-md)",lg:"gap-(--form-row-gap-lg)"};function Ol({children:e,className:t,intent:r,size:n="md",layout:o="stacked",title:a,description:i,footer:s,onValues:l,onSubmit:c,...u}){let p=z1[n??"md"],[m,d]=On.useState({}),g=On.useCallback(h=>{if(h.preventDefault(),c?.(h),l){let b=Object.fromEntries(new FormData(h.currentTarget).entries()),y=l(b,h),v=N=>{if(!N)return;let x={};for(let[w,{result:L,reason:P}]of Object.entries(N))P&&(x[w]={status:L?"success":"error",message:P});d(x);};y instanceof Promise?y.then(v).catch(()=>{}):v(y);}},[c,l]);return jsxRuntime.jsx(Bl.Provider,{value:{layout:o??"stacked",size:n??"md",labelWidth:p,bulkErrors:m},children:jsxRuntime.jsxs("form",{className:f(ll({intent:r,size:n}),"flex flex-col",t),onSubmit:g,...u,children:[(a||i)&&jsxRuntime.jsxs("div",{className:"mb-(--form-header-mb)",children:[a&&jsxRuntime.jsx("h2",{className:"text-base font-semibold text-primary-900 dark:text-primary-100",children:a}),i&&jsxRuntime.jsx("p",{className:"mt-1 text-xs text-primary-500 dark:text-primary-400",children:i})]}),jsxRuntime.jsx("div",{className:f("flex flex-col",bp[n??"md"]),children:e}),s&&jsxRuntime.jsx("div",{className:"mt-(--form-footer-pt) flex flex-wrap items-center justify-end gap-(--form-footer-gap) border-t border-primary-200 pt-(--form-footer-pt) dark:border-primary-700",children:s})]})})}var V1={error:jsxRuntime.jsx(lucideReact.AlertCircle,{}),warning:jsxRuntime.jsx(lucideReact.AlertTriangle,{}),success:jsxRuntime.jsx(lucideReact.CheckCircle,{}),hint:jsxRuntime.jsx(lucideReact.Info,{})};function H1({label:e,layout:t,required:r,hint:n,validation:o,name:a,onValidate:i,className:s,children:l}){let c=On.useContext(Bl),u=On.useId(),[p,m]=On.useState(void 0),d=a?c.bulkErrors[a]:void 0,g=o??p??d,b=(t??c.layout)==="inline",y=On.useCallback(L=>{let P=L!=null&&typeof L=="object"&&"target"in L?L.target.value:L;if(a&&c.bulkErrors[a]&&(c.bulkErrors[a]=void 0),!i){m(void 0);return}let{result:A,reason:D}=i(P);m(D?{status:A?"success":"error",message:D}:void 0);},[i,a,c.bulkErrors]),v=g?`${u}-validation`:n?`${u}-hint`:void 0,N=On__default.default.Children.map(l,(L,P)=>{if(P!==0||!On__default.default.isValidElement(L))return L;let A=L,D={};if(A.props.id||(D.id=u),v&&!A.props["aria-describedby"]&&(D["aria-describedby"]=v),g?.status==="error"&&!A.props["aria-invalid"]&&(D["aria-invalid"]=true),a&&!A.props.name&&(D.name=a),i){let S=A.props.onChange;D.onChange=C=>{S?.(C),y(C);};}return Object.keys(D).length?On__default.default.cloneElement(A,D):L}),x=e!=null&&jsxRuntime.jsx("label",{htmlFor:u,className:f("shrink-0 text-sm font-medium","text-primary-700 dark:text-primary-300",r&&"after:ml-0.5 after:text-danger-500 after:content-['*']",b&&"pt-1.75"),style:b?{width:c.labelWidth,minWidth:c.labelWidth}:void 0,children:e}),w=o?`${u}-validation`:n?`${u}-hint`:void 0;return jsxRuntime.jsxs("div",{className:f("flex w-full flex-col gap-1.5",b&&"md:flex-row md:items-start md:gap-(--form-item-gap-md)",s),children:[x,jsxRuntime.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[N,g&&jsxRuntime.jsxs("p",{id:`${u}-validation`,className:f(cl({status:g.status})),role:g.status==="error"?"alert":void 0,children:[V1[g.status],jsxRuntime.jsx("span",{children:g.message})]}),n&&jsxRuntime.jsx("p",{id:w===`${u}-hint`?w:void 0,className:"mt-1 text-xs text-primary-400 dark:text-primary-500",children:n})]})]})}function _1({title:e,description:t,className:r,children:n}){let{size:o}=On.useContext(Bl);return jsxRuntime.jsxs("fieldset",{className:f("flex flex-col rounded-(--form-radius) border border-primary-200 p-4 dark:border-primary-700",bp[o],r),children:[(e||t)&&jsxRuntime.jsxs("legend",{className:"px-1.5 pb-1",children:[e&&jsxRuntime.jsx("span",{className:"text-sm font-semibold text-primary-700 dark:text-primary-300",children:e}),t&&jsxRuntime.jsx("span",{className:"ml-2 text-xs text-primary-400 dark:text-primary-500",children:t})]}),n]})}var F1={Form:Ol,OTPInput:wn},$l=F1;var Yt=classVarianceAuthority.cva("relative w-full font-sans select-none",{variants:{size:{sm:"text-xs",md:"text-sm",lg:"text-base"}},defaultVariants:{size:"md"}}),Ut=classVarianceAuthority.cva("flex flex-wrap gap-3 items-center justify-center",{variants:{position:{top:"mb-3",bottom:"mt-3",left:"flex-col mr-4",right:"flex-col ml-4"}},defaultVariants:{position:"bottom"}}),Xt=classVarianceAuthority.cva("absolute z-50 pointer-events-none px-3 py-2 rounded-lg text-xs shadow-lg border transition-opacity duration-150 bg-primary-900 text-primary-50 border-primary-700 dark:bg-primary-950 dark:border-primary-800");function wr(e){let[t,r]=On.useState(()=>new Set(e)),n=On.useCallback(i=>{r(s=>{let l=new Set(s);return l.has(i)?l.delete(i):l.add(i),l});},[]),o=On.useCallback(i=>t.has(i),[t]),a=On.useCallback(()=>{r(new Set(e));},[e]);return {visible:t,toggle:n,isVisible:o,showAll:a}}function kr(e){let t=["var(--color-chart-1)","var(--color-chart-2)","var(--color-chart-3)","var(--color-chart-4)","var(--color-chart-5)","var(--color-chart-6)","var(--color-chart-7)","var(--color-chart-8)"];return Array.from({length:e},(r,n)=>t[n%t.length])}function Nr(e,t,r=.1){if(e===t)return [e-1,t+1];let o=(t-e)*r;return [Math.floor(e-o),Math.ceil(t+o)]}function Mn(e,t,r){if(r<=1)return [e];let n=(t-e)/(r-1);return Array.from({length:r},(o,a)=>+(e+a*n).toFixed(10))}function We(e,t){return t?t(e):typeof e=="number"?Math.abs(e)>=1e6?`${(e/1e6).toFixed(1)}M`:Math.abs(e)>=1e3?`${(e/1e3).toFixed(1)}K`:Number.isInteger(e)?e.toString():e.toFixed(2):String(e)}function Rt(e,t,r,n){let o=(n-90)*Math.PI/180;return {x:e+r*Math.cos(o),y:t+r*Math.sin(o)}}function Cr(e,t,r){return {top:20,right:r?65:20,bottom:e?52:36,left:t?65:52}}function Mr(e,t,r){let n=Math.max(e,120);return {width:n,height:t,margins:r,plotLeft:r.left,plotTop:r.top,plotRight:n-r.right,plotBottom:t-r.bottom,plotWidth:Math.max(n-r.left-r.right,10),plotHeight:Math.max(t-r.top-r.bottom,10)}}function yp(e,t){let r=new Set,n=[];for(let o of e)if(t.has(o.id))for(let a of o.data){let i=String(a.x);r.has(i)||(r.add(i),n.push(i));}return n}function Wl(e,t,r){let n=1/0,o=-1/0;for(let s of e)if(t.has(s.id))for(let l of s.data)l.y<n&&(n=l.y),l.y>o&&(o=l.y);if(!isFinite(n))return [0,1];let[a,i]=Nr(n,o);return [r?.min??a,r?.max??i]}function li(e,t){let[r,n]=e,[o,a]=t;return n===r?()=>(o+a)/2:i=>o+(i-r)/(n-r)*(a-o)}function ci(e,t){let r=e.length;if(r===0)return ()=>(t[0]+t[1])/2;let n=(t[1]-t[0])/r;return o=>{let a=e.indexOf(o);return a<0?(t[0]+t[1])/2:t[0]+a*n+n/2}}function vp(e,t,r){return e.map(n=>`${t(n.x).toFixed(2)},${r(n.y).toFixed(2)}`).join(" ")}function Yl(e,t,r){if(e.length===0)return "";let n=e.map(i=>({x:t(i.x),y:r(i.y)}));if(n.length===1)return `M ${n[0].x.toFixed(2)} ${n[0].y.toFixed(2)}`;let o=.5,a=`M ${n[0].x.toFixed(2)} ${n[0].y.toFixed(2)}`;for(let i=0;i<n.length-1;i++){let s=i===0?{x:2*n[0].x-n[1].x,y:2*n[0].y-n[1].y}:n[i-1],l=n[i],c=n[i+1],u=i+2<n.length?n[i+2]:{x:2*n[n.length-1].x-n[n.length-2].x,y:2*n[n.length-1].y-n[n.length-2].y},p=l.x+(c.x-s.x)*o/3,m=l.y+(c.y-s.y)*o/3,d=c.x-(u.x-l.x)*o/3,g=c.y-(u.y-l.y)*o/3;a+=` C ${p.toFixed(2)} ${m.toFixed(2)}, ${d.toFixed(2)} ${g.toFixed(2)}, ${c.x.toFixed(2)} ${c.y.toFixed(2)}`;}return a}function xp(e,t,r,n,o){if(e.length===0)return "";let a=n?Yl(e,t,r):`M ${e.map(l=>`${t(l.x).toFixed(2)},${r(l.y).toFixed(2)}`).join(" L ")}`,i=t(e[e.length-1].x).toFixed(2),s=t(e[0].x).toFixed(2);return `${a} L ${i},${o.toFixed(2)} L ${s},${o.toFixed(2)} Z`}function di(e,t=5){return Mn(e[0],e[1],t)}function Ul(e,t,r){if(t.length===0)return -1;let n=1/0,o=0;for(let a=0;a<t.length;a++){let i=Math.abs(r(t[a])-e);i<n&&(n=i,o=a);}return o}function Xl(e,t){return e.data.find(r=>String(r.x)===t)?.y}function wp(e){for(let t of e)for(let r of t.data)if(typeof r.x=="string")return true;return false}function ui({items:e,position:t,onToggle:r}){return jsxRuntime.jsx("div",{className:Ut({position:t}),children:e.map(n=>jsxRuntime.jsxs("button",{onClick:()=>r(n.id),className:f("flex items-center gap-1.5 cursor-pointer rounded px-1.5 py-1 text-xs text-primary-700 transition-opacity hover:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-800",!n.visible&&"opacity-40"),"aria-pressed":n.visible,children:[jsxRuntime.jsx("span",{className:"h-2.5 w-5 rounded-sm shrink-0",style:{background:n.color}}),n.label]},n.id))})}function Jl({series:e,xAxis:t,yAxis:r,y2Axis:n,y2Series:o=[],smooth:a=false,showDots:i=true,area:s=false,strokeWidth:l=2,title:c,height:u=300,className:p,legend:m=true,legendPosition:d="bottom",animateOnMount:g=true,emptyText:h="No data to display"}){let b=On.useRef(null),y=On.useRef(null),[v,N]=On.useState(600),[x,w]=On.useState(null),[L,P]=On.useState(null);On.useEffect(()=>{let B=y.current;if(!B)return;let q=B.getBoundingClientRect().width;q>0&&N(q);let Z=new ResizeObserver(ue=>{let te=ue[0]?.contentRect.width;te&&te>0&&N(te);});return Z.observe(B),()=>Z.disconnect()},[]);let A=On.useMemo(()=>e.map(B=>B.id),[e]),{visible:D,toggle:S,isVisible:C}=wr(A),I=On.useMemo(()=>kr(e.length),[e.length]),k=On.useMemo(()=>new Map(e.map((B,q)=>[B.id,B.color??I[q]])),[e,I]),T=On.useMemo(()=>Cr(!!t?.label,!!r?.label,!!n),[t?.label,r?.label,n]),R=On.useMemo(()=>Mr(v,u,T),[v,u,T]),O=On.useMemo(()=>wp(e),[e]),E=On.useMemo(()=>O?yp(e,D):[],[e,D,O]),ne=On.useMemo(()=>{if(O){let te=ci(E,[R.plotLeft,R.plotRight]);return ve=>te(ve)}let B=e.flatMap(te=>te.data.map(ve=>ve.x));if(B.length===0)return ()=>R.plotLeft;let q=Math.min(...B),Z=Math.max(...B),ue=li([q,Z],[R.plotLeft,R.plotRight]);return te=>ue(te)},[e,O,E,R]),U=On.useMemo(()=>Wl(e,D,r),[e,D,r]),z=On.useMemo(()=>li(U,[R.plotBottom,R.plotTop]),[U,R]),H=On.useMemo(()=>di(U,r?.tickCount??5),[U,r?.tickCount]),_=On.useMemo(()=>{if(!n)return null;let B=e.filter(q=>o.includes(q.id));return Wl(B,D,n)},[n,e,o,D]),V=On.useMemo(()=>_?li(_,[R.plotBottom,R.plotTop]):null,[_,R]),oe=On.useMemo(()=>_?di(_,n?.tickCount??5):[],[_,n?.tickCount]),be=On.useMemo(()=>{if(O)return E;let B=e.flatMap(ue=>ue.data.map(te=>Number(te.x)));if(B.length===0)return [];let q=Math.min(...B),Z=Math.max(...B);return di([q,Z],t?.tickCount??6)},[O,E,e,t?.tickCount]),M=On.useCallback(B=>{let q=B.currentTarget.closest("svg");if(!q)return;let Z=q.getBoundingClientRect(),ue=B.clientX-Z.left,te=b.current?.getBoundingClientRect();if(!te)return;let ve="",Ne=ue;if(O&&E.length>0){let ie=ci(E,[R.plotLeft,R.plotRight]),Pe=Ul(ue,E,ie);ve=E[Pe]??"",Ne=ie(ve);}else if(!O){let ie=be;ve=We((ue-R.plotLeft)/R.plotWidth*(ie[ie.length-1]-ie[0])+ie[0],t?.format),Ne=ue;}let X=e.filter(ie=>C(ie.id)).map(ie=>{o.includes(ie.id)&&V!=null?V:z;let Xe;if(O)Xe=Xl(ie,ve);else {let se=ue,Re=1/0,K;for(let ce of ie.data){let me=ne(ce.x),J=Math.abs(me-se);J<Re&&(Re=J,K=ce.y);}Xe=K;}return {name:ie.name,value:Xe!==void 0?We(Xe,r?.format):"\u2014",color:k.get(ie.id)??"var(--color-chart-1)"}});Ne>=R.plotLeft&&Ne<=R.plotRight&&P(Ne);let de=B.clientX-te.left+12,Q=B.clientY-te.top-10;w({x:de,y:Q,label:ve,items:X});},[O,E,R,e,C,o,V,z,ne,be,t?.format,r?.format,k]),F=On.useCallback(()=>{w(null),P(null);},[]),re=On.useCallback(B=>{B.preventDefault();let q=B.touches[0];if(!q)return;let Z=B.currentTarget.closest("svg");if(!Z)return;let ue=Z.getBoundingClientRect(),te=b.current?.getBoundingClientRect();if(!te)return;let ve=q.clientX-ue.left,Ne=ve,X="";if(O&&E.length>0){let Q=ci(E,[R.plotLeft,R.plotRight]),ie=Ul(ve,E,Q);X=E[ie]??"",Ne=Q(X);}Ne>=R.plotLeft&&Ne<=R.plotRight&&P(Ne);let de=e.filter(Q=>C(Q.id)).map(Q=>({name:Q.name,value:O&&X?We(Xl(Q,X)??0,r?.format):"\u2014",color:k.get(Q.id)??"var(--color-chart-1)"}));w({x:q.clientX-te.left+12,y:q.clientY-te.top-10,label:X,items:de});},[O,E,R,e,C,r?.format,k]),W=On.useMemo(()=>e.map((B,q)=>({id:B.id,label:B.name,color:B.color??I[q],visible:C(B.id)})),[e,I,C]),G=e.some(B=>B.data.length>0),le=jsxRuntime.jsxs("svg",{role:"img","aria-label":c??"Line chart",width:R.width,height:R.height,viewBox:`0 0 ${R.width} ${R.height}`,shapeRendering:"geometricPrecision",children:[r?.gridLines!==false&&H.map(B=>{let q=z(B);return jsxRuntime.jsx("line",{x1:R.plotLeft,x2:R.plotRight,y1:q,y2:q,stroke:"currentColor",strokeWidth:.5,strokeDasharray:"4 4",className:"text-secondary-200 dark:text-secondary-700"},B)}),s&&e.map(B=>{if(!C(B.id)||B.data.length===0)return null;let Z=o.includes(B.id)&&V!=null?V:z,ue=k.get(B.id)??"var(--color-chart-1)",te=xp(B.data,ne,Z,a,R.plotBottom);return jsxRuntime.jsx("path",{d:te,fill:ue,fillOpacity:.15,stroke:"none",className:g?"chart-area-animate":""},`area-${B.id}`)}),e.map(B=>{if(!C(B.id)||B.data.length===0)return null;let Z=o.includes(B.id)&&V!=null?V:z,ue=k.get(B.id)??"var(--color-chart-1)";return a?jsxRuntime.jsx("path",{d:Yl(B.data,ne,Z),fill:"none",stroke:ue,strokeWidth:l,strokeLinecap:"round",strokeLinejoin:"round",className:g?"chart-line-animate":""},B.id):jsxRuntime.jsx("polyline",{points:vp(B.data,ne,Z),fill:"none",stroke:ue,strokeWidth:l,strokeLinecap:"round",strokeLinejoin:"round",className:g?"chart-line-animate":""},B.id)}),i&&e.map(B=>{if(!C(B.id))return null;let Z=o.includes(B.id)&&V!=null?V:z,ue=k.get(B.id)??"var(--color-chart-1)";return B.data.map((te,ve)=>jsxRuntime.jsx("circle",{cx:ne(te.x),cy:Z(te.y),r:3,fill:ue,stroke:"white",strokeWidth:1.5,className:f("chart-dot",g?"chart-dot-animate":"")},`${B.id}-${ve}`))}),L!=null&&jsxRuntime.jsx("line",{className:"chart-crosshair",x1:L,x2:L,y1:R.plotTop,y2:R.plotBottom,stroke:"currentColor",strokeWidth:1,strokeDasharray:"4 4",opacity:.5,style:{color:"var(--color-secondary-400)"}}),jsxRuntime.jsx("line",{x1:R.plotLeft,x2:R.plotLeft,y1:R.plotTop,y2:R.plotBottom,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),H.map(B=>{let q=z(B);return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("line",{x1:R.plotLeft-4,x2:R.plotLeft,y1:q,y2:q,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsxRuntime.jsx("text",{x:R.plotLeft-6,y:q,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:We(B,r?.format)})]},B)}),r?.label&&jsxRuntime.jsx("text",{x:-(R.plotTop+R.plotHeight/2),y:14,textAnchor:"middle",fontSize:11,fill:"currentColor",className:"text-secondary-600 dark:text-secondary-400",transform:"rotate(-90)",children:r.label}),n&&V&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:R.plotRight,x2:R.plotRight,y1:R.plotTop,y2:R.plotBottom,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),oe.map(B=>{let q=V(B);return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("line",{x1:R.plotRight,x2:R.plotRight+4,y1:q,y2:q,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsxRuntime.jsx("text",{x:R.plotRight+6,y:q,textAnchor:"start",dominantBaseline:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:We(B,n?.format)})]},B)}),n?.label&&jsxRuntime.jsx("text",{x:R.plotTop+R.plotHeight/2,y:-(R.width-14),textAnchor:"middle",fontSize:11,fill:"currentColor",className:"text-secondary-600 dark:text-secondary-400",transform:"rotate(90)",children:n.label})]}),jsxRuntime.jsx("line",{x1:R.plotLeft,x2:R.plotRight,y1:R.plotBottom,y2:R.plotBottom,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),(O?E:be).map((B,q)=>{let Z=ne(B);return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("line",{x1:Z,x2:Z,y1:R.plotBottom,y2:R.plotBottom+4,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsxRuntime.jsx("text",{x:Z,y:R.plotBottom+14,textAnchor:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:We(B,t?.format)})]},q)}),t?.label&&jsxRuntime.jsx("text",{x:R.plotLeft+R.plotWidth/2,y:R.height-4,textAnchor:"middle",fontSize:11,fill:"currentColor",className:"text-secondary-600 dark:text-secondary-400",children:t.label}),jsxRuntime.jsx("rect",{x:R.plotLeft,y:R.plotTop,width:R.plotWidth,height:R.plotHeight,fill:"transparent",onMouseMove:M,onMouseLeave:F,onTouchStart:re,onTouchMove:re,onTouchEnd:F,style:{cursor:"crosshair"}})]}),ke=d==="left"||d==="right";return jsxRuntime.jsxs("div",{ref:b,className:f(Yt(),p),children:[c&&jsxRuntime.jsx("h3",{className:"mb-2 text-sm font-semibold text-primary-700 dark:text-primary-200",children:c}),m&&d==="top"&&jsxRuntime.jsx(ui,{items:W,position:"top",onToggle:S}),jsxRuntime.jsxs("div",{className:f("flex items-start",ke&&"gap-0"),children:[m&&d==="left"&&jsxRuntime.jsx(ui,{items:W,position:"left",onToggle:S}),jsxRuntime.jsx("div",{ref:y,className:"flex-1 min-w-0 overflow-hidden",children:G?le:jsxRuntime.jsx("div",{className:"flex items-center justify-center text-secondary-400 dark:text-secondary-500",style:{height:u},children:h})}),m&&d==="right"&&jsxRuntime.jsx(ui,{items:W,position:"right",onToggle:S})]}),m&&d==="bottom"&&jsxRuntime.jsx(ui,{items:W,position:"bottom",onToggle:S}),x&&jsxRuntime.jsxs("div",{className:Xt(),style:{left:x.x,top:x.y},role:"tooltip",children:[x.label&&jsxRuntime.jsx("div",{className:"mb-1 font-medium text-primary-200",children:x.label}),x.items.map((B,q)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{background:B.color}}),jsxRuntime.jsxs("span",{className:"text-primary-300",children:[B.name,":"]}),jsxRuntime.jsx("span",{className:"font-medium",children:B.value})]},q))]})]})}function Np(e,t){let r=new Set,n=[];for(let o of e)if(t.has(o.id))for(let a of o.data){let i=String(a.x);r.has(i)||(r.add(i),n.push(i));}return n}function Cp(e,t,r,n){if(r){let o=0;for(let i of e)if(t.has(i.id))for(let s of i.data)s.y>o&&(o=s.y);o===0&&(o=1);let[,a]=Nr(0,o,.05);return [n?.min??0,n?.max??a]}else {let o=new Map;for(let s of e)if(t.has(s.id))for(let l of s.data){let c=String(l.x);o.set(c,(o.get(c)??0)+l.y);}let a=Math.max(0,...o.values()),[,i]=Nr(0,a===0?1:a,.05);return [n?.min??0,n?.max??i]}}function Mp(e,t){let[r,n]=e,[o,a]=t;return n===r?()=>(o+a)/2:i=>o+(i-r)/(n-r)*(a-o)}function Tp(e,t=5){return Mn(e[0],e[1],t)}function Sp(e,t,r,n,o,a,i,s,l,c,u){let p=e.filter(v=>t.has(v.id)),m=r.length,d=p.length;if(m===0||d===0)return [];let g=a/m,h=g*(1-c),b=d>0?h*(1-u)/d:0,y=[];for(let v=0;v<r.length;v++){let N=r[v],x=o+v*g+(g-h)/2;for(let w=0;w<p.length;w++){let L=p[w],P=L.data.find(S=>String(S.x)===N);if(!P)continue;let A=x+w*(b+h*u/d),D=l(P.y);y.push({seriesId:L.id,category:N,x:A,y:D,width:Math.max(b,1),height:Math.max(i-D,0),stackBase:i,value:P.y,color:n.get(L.id)??"var(--color-chart-1)"});}}return y}function Pp(e,t,r,n,o,a,i,s,l,c){let u=e.filter(y=>t.has(y.id)),p=r.length,m=u.length;if(p===0||m===0)return [];let d=i/p,g=d*(1-l),h=m>0?g*(1-c)/m:0,b=[];for(let y=0;y<r.length;y++){let v=r[y],N=a+y*d+(d-g)/2;for(let x=0;x<u.length;x++){let w=u[x],L=w.data.find(D=>String(D.x)===v);if(!L)continue;let P=N+x*(h+g*c/Math.max(m,1)),A=s(L.y);b.push({seriesId:w.id,category:v,x:o,y:P,width:Math.max(A-o,0),height:Math.max(h,1),stackBase:o,value:L.y,color:n.get(w.id)??"var(--color-chart-1)"});}}return b}function Rp(e,t,r,n,o,a,i,s,l){let c=e.filter(g=>t.has(g.id)),u=r.length;if(u===0)return [];let p=i/u*(1-l),m=[],d=new Map;r.forEach(g=>d.set(g,o));for(let g of c)for(let h of r){let b=g.data.find(w=>String(w.x)===h);if(!b)continue;let y=d.get(h)??o,v=Math.max(s(b.y)-o,0),N=r.indexOf(h),x=a+(N+.5)*(i/u);m.push({seriesId:g.id,category:h,x:y,y:x-p/2,width:v,height:Math.max(p,1),stackBase:y,value:b.y,color:n.get(g.id)??"var(--color-chart-1)"}),d.set(h,y+v);}return m}function Ep(e,t,r,n,o,a,i,s,l){let c=e.filter(g=>t.has(g.id)),u=r.length;if(u===0)return [];let p=a/u*(1-l),m=[],d=new Map;r.forEach(g=>d.set(g,i));for(let g of c)for(let h of r){let b=g.data.find(L=>String(L.x)===h);if(!b)continue;let y=d.get(h)??i,v=Math.max(i-s(b.y),0),N=y-v,x=r.indexOf(h),w=o+(x+.5)*(a/u);m.push({seriesId:g.id,category:h,x:w-p/2,y:N,width:Math.max(p,1),height:v,stackBase:y,value:b.y,color:n.get(g.id)??"var(--color-chart-1)"}),d.set(h,N);}return m}function pi({items:e,position:t,onToggle:r}){return jsxRuntime.jsx("div",{className:Ut({position:t}),children:e.map(n=>jsxRuntime.jsxs("button",{onClick:()=>r(n.id),className:f("flex items-center gap-1.5 cursor-pointer rounded px-1.5 py-1 text-xs text-primary-700 transition-opacity hover:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-800",!n.visible&&"opacity-40"),"aria-pressed":n.visible,children:[jsxRuntime.jsx("span",{className:"h-2.5 w-5 rounded-sm shrink-0",style:{background:n.color}}),n.label]},n.id))})}function Ql({series:e,xAxis:t,yAxis:r,orientation:n="vertical",grouped:o=true,barRadius:a=4,barPadding:i=.2,groupPadding:s=.3,title:l,height:c=300,className:u,legend:p=true,legendPosition:m="bottom",animateOnMount:d=true,emptyText:g="No data to display"}){let h=On.useRef(null),b=On.useRef(null),[y,v]=On.useState(600),[N,x]=On.useState(null);On.useEffect(()=>{let M=b.current;if(!M)return;let F=M.getBoundingClientRect().width;F>0&&v(F);let re=new ResizeObserver(W=>{let G=W[0]?.contentRect.width;G&&G>0&&v(G);});return re.observe(M),()=>re.disconnect()},[]);let w=On.useMemo(()=>e.map(M=>M.id),[e]),{visible:L,toggle:P,isVisible:A}=wr(w),D=On.useMemo(()=>kr(e.length),[e.length]),S=On.useMemo(()=>new Map(e.map((M,F)=>[M.id,M.color??D[F]])),[e,D]),C=n==="horizontal",I=On.useMemo(()=>Cr(!!t?.label,!!r?.label,false),[t?.label,r?.label]),k=On.useMemo(()=>Mr(y,c,I),[y,c,I]),T=On.useMemo(()=>Np(e,L),[e,L]),R=On.useMemo(()=>Cp(e,L,o,C?t:r),[e,L,o,C,t,r]),O=On.useMemo(()=>Mp(R,C?[k.plotLeft,k.plotRight]:[k.plotBottom,k.plotTop]),[R,k,C]),E=On.useMemo(()=>Tp(R,(C?t:r)?.tickCount??5),[R,C,t,r]),ne=On.useMemo(()=>C?o?Pp(e,L,T,S,k.plotLeft,k.plotTop,k.plotHeight,O,s,i):Rp(e,L,T,S,k.plotLeft,k.plotTop,k.plotHeight,O,s):o?Sp(e,L,T,S,k.plotLeft,k.plotWidth,k.plotBottom,k.plotTop,O,s,i):Ep(e,L,T,S,k.plotLeft,k.plotWidth,k.plotBottom,O,s),[e,L,T,S,k,O,o,C,s,i]),U=T.length>0?k.plotWidth/T.length:1,z=T.length>0?k.plotHeight/T.length:1,H=On.useCallback((M,F)=>{let re=h.current?.getBoundingClientRect();if(!re)return;let W=e.filter(G=>A(G.id)).map(G=>{let le=G.data.find(ke=>String(ke.x)===F);return {name:G.name,value:le?We(le.y,r?.format):"\u2014",color:S.get(G.id)??"var(--color-chart-1)"}});x({x:M.clientX-re.left+12,y:M.clientY-re.top-10,category:F,items:W});},[e,A,S,r?.format]),_=On.useMemo(()=>e.map((M,F)=>({id:M.id,label:M.name,color:M.color??D[F],visible:A(M.id)})),[e,D,A]),V=e.some(M=>M.data.length>0),oe=m==="left"||m==="right",be=jsxRuntime.jsxs("svg",{role:"img","aria-label":l??"Bar chart",width:k.width,height:k.height,viewBox:`0 0 ${k.width} ${k.height}`,shapeRendering:"geometricPrecision",children:[E.map(M=>{let F=O(M);return C?jsxRuntime.jsx("line",{x1:F,x2:F,y1:k.plotTop,y2:k.plotBottom,stroke:"currentColor",strokeWidth:.5,strokeDasharray:"4 4",className:"text-secondary-200 dark:text-secondary-700"},M):jsxRuntime.jsx("line",{x1:k.plotLeft,x2:k.plotRight,y1:F,y2:F,stroke:"currentColor",strokeWidth:.5,strokeDasharray:"4 4",className:"text-secondary-200 dark:text-secondary-700"},M)}),ne.map(M=>{let F=Math.min(a,M.width/2,M.height/2),re=`${M.seriesId}-${M.category}`;return C?jsxRuntime.jsx("rect",{x:M.x,y:M.y,width:M.width,height:M.height,rx:F,fill:M.color,className:f("chart-bar-h",d&&"chart-bar-animate"),onMouseMove:W=>H(W,M.category),onMouseLeave:()=>x(null)},re):jsxRuntime.jsx("rect",{x:M.x,y:M.y,width:M.width,height:M.height,rx:F,fill:M.color,className:f("chart-bar-v",d&&"chart-bar-animate"),onMouseMove:W=>H(W,M.category),onMouseLeave:()=>x(null)},re)}),jsxRuntime.jsx("line",{x1:k.plotLeft,x2:k.plotLeft,y1:k.plotTop,y2:k.plotBottom,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsxRuntime.jsx("line",{x1:k.plotLeft,x2:k.plotRight,y1:k.plotBottom,y2:k.plotBottom,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),!C&&E.map(M=>{let F=O(M);return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("line",{x1:k.plotLeft-4,x2:k.plotLeft,y1:F,y2:F,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsxRuntime.jsx("text",{x:k.plotLeft-6,y:F,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:We(M,r?.format)})]},M)}),C&&E.map(M=>{let F=O(M);return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("line",{x1:F,x2:F,y1:k.plotBottom,y2:k.plotBottom+4,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsxRuntime.jsx("text",{x:F,y:k.plotBottom+14,textAnchor:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:We(M,t?.format)})]},M)}),T.map((M,F)=>{if(C){let W=k.plotTop+(F+.5)*z;return jsxRuntime.jsx("text",{x:k.plotLeft-6,y:W,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:M},M)}let re=k.plotLeft+(F+.5)*U;return jsxRuntime.jsx("text",{x:re,y:k.plotBottom+14,textAnchor:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:M},M)}),r?.label&&!C&&jsxRuntime.jsx("text",{x:-(k.plotTop+k.plotHeight/2),y:14,textAnchor:"middle",fontSize:11,fill:"currentColor",className:"text-secondary-600 dark:text-secondary-400",transform:"rotate(-90)",children:r.label}),t?.label&&jsxRuntime.jsx("text",{x:k.plotLeft+k.plotWidth/2,y:k.height-4,textAnchor:"middle",fontSize:11,fill:"currentColor",className:"text-secondary-600 dark:text-secondary-400",children:t.label})]});return jsxRuntime.jsxs("div",{ref:h,className:f(Yt(),u),children:[l&&jsxRuntime.jsx("h3",{className:"mb-2 text-sm font-semibold text-primary-700 dark:text-primary-200",children:l}),p&&m==="top"&&jsxRuntime.jsx(pi,{items:_,position:"top",onToggle:P}),jsxRuntime.jsxs("div",{className:f("flex items-start",oe&&"gap-0"),children:[p&&m==="left"&&jsxRuntime.jsx(pi,{items:_,position:"left",onToggle:P}),jsxRuntime.jsx("div",{ref:b,className:"flex-1 min-w-0 overflow-hidden",children:V?be:jsxRuntime.jsx("div",{className:"flex items-center justify-center text-secondary-400 dark:text-secondary-500",style:{height:c},children:g})}),p&&m==="right"&&jsxRuntime.jsx(pi,{items:_,position:"right",onToggle:P})]}),p&&m==="bottom"&&jsxRuntime.jsx(pi,{items:_,position:"bottom",onToggle:P}),N&&jsxRuntime.jsxs("div",{className:Xt(),style:{left:N.x,top:N.y},role:"tooltip",children:[jsxRuntime.jsx("div",{className:"mb-1 font-medium text-primary-200",children:N.category}),N.items.map((M,F)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{background:M.color}}),jsxRuntime.jsxs("span",{className:"text-primary-300",children:[M.name,":"]}),jsxRuntime.jsx("span",{className:"font-medium",children:M.value})]},F))]})]})}function Ap(e,t,r,n,o,a,i,s,l){let c=e.filter(g=>t.has(g.id)),u=c.reduce((g,h)=>g+h.value,0);if(u===0)return [];let p=new Map(e.map((g,h)=>[g.id,g.color??r[h%r.length]])),m=[],d=s;for(let g of c){let h=g.value/u*360,b=l/2,y=d+b,v=d+h-b,N=(y+v)/2,x;if(Math.abs(v-y)>=359.9){let w=Rt(a,i,n,y),L=Rt(a,i,n,y+180);x=`M ${w.x.toFixed(3)} ${w.y.toFixed(3)} A ${n} ${n} 0 1 1 ${L.x.toFixed(3)} ${L.y.toFixed(3)} A ${n} ${n} 0 1 1 ${w.x.toFixed(3)} ${w.y.toFixed(3)} Z`;}else if(o>0){let w=Rt(a,i,n,y),L=Rt(a,i,n,v),P=Rt(a,i,o,v),A=Rt(a,i,o,y),D=v-y>180?1:0;x=`M ${w.x.toFixed(3)} ${w.y.toFixed(3)} A ${n} ${n} 0 ${D} 1 ${L.x.toFixed(3)} ${L.y.toFixed(3)} L ${P.x.toFixed(3)} ${P.y.toFixed(3)} A ${o} ${o} 0 ${D} 0 ${A.x.toFixed(3)} ${A.y.toFixed(3)} Z`;}else {let w=Rt(a,i,n,y),L=Rt(a,i,n,v),P=v-y>180?1:0;x=`M ${a.toFixed(3)} ${i.toFixed(3)} L ${w.x.toFixed(3)} ${w.y.toFixed(3)} A ${n} ${n} 0 ${P} 1 ${L.x.toFixed(3)} ${L.y.toFixed(3)} Z`;}m.push({id:g.id,label:g.label,value:g.value,percent:Math.round(g.value/u*1e3)/10,color:p.get(g.id)??"var(--color-chart-1)",startAngle:y,endAngle:v,midAngle:N,path:x,outerR:n,innerR:o,cx:a,cy:i}),d+=h;}return m}function Ip(e,t){let r=(e-90)*Math.PI/180;return {dx:Math.cos(r)*t,dy:Math.sin(r)*t}}function hi({items:e,position:t,onToggle:r}){return jsxRuntime.jsx("div",{className:Ut({position:t}),children:e.map(n=>jsxRuntime.jsxs("button",{onClick:()=>r(n.id),className:f("flex items-center gap-1.5 cursor-pointer rounded px-1.5 py-1 text-xs text-primary-700 transition-opacity hover:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-800",!n.visible&&"opacity-40"),"aria-pressed":n.visible,children:[jsxRuntime.jsx("span",{className:"h-2.5 w-2.5 rounded-full shrink-0",style:{background:n.color}}),jsxRuntime.jsx("span",{children:n.label}),jsxRuntime.jsxs("span",{className:"text-secondary-400",children:["(",n.percent,"%)"]})]},n.id))})}function tc({data:e,donut:t=false,donutThickness:r=.5,startAngle:n=-90,padAngle:o=0,labelType:a="percent",centerLabel:i,centerSubLabel:s,explodeOnHover:l=true,explodeOffset:c=8,title:u,height:p=300,className:m,legend:d=true,legendPosition:g="bottom",animateOnMount:h=true,emptyText:b="No data to display"}){let y=On.useRef(null),v=On.useRef(null),[N,x]=On.useState(400),[w,L]=On.useState(null),[P,A]=On.useState(null),[D,S]=On.useState({}),C=On.useRef(null);On.useEffect(()=>{let X=v.current;if(!X)return;let de=X.getBoundingClientRect().width;de>0&&x(de);let Q=new ResizeObserver(ie=>{let Pe=ie[0]?.contentRect.width;Pe&&Pe>0&&x(Pe);});return Q.observe(X),()=>Q.disconnect()},[]),On.useEffect(()=>{function X(Q){let ie=C.current;if(!ie)return;"touches"in Q&&Q.cancelable&&Q.preventDefault();let Pe="touches"in Q?Q.touches[0]?.clientX??ie.startX:Q.clientX,Oe="touches"in Q?Q.touches[0]?.clientY??ie.startY:Q.clientY;S(Xe=>({...Xe,[ie.id]:{dx:ie.origDx+Pe-ie.startX,dy:ie.origDy+Oe-ie.startY}}));}function de(){C.current=null;}return window.addEventListener("mousemove",X),window.addEventListener("mouseup",de),window.addEventListener("touchmove",X,{passive:false}),window.addEventListener("touchend",de),()=>{window.removeEventListener("mousemove",X),window.removeEventListener("mouseup",de),window.removeEventListener("touchmove",X),window.removeEventListener("touchend",de);}},[]);let I=On.useMemo(()=>e.map(X=>X.id),[e]),{visible:k,toggle:T,isVisible:R}=wr(I),O=On.useMemo(()=>kr(e.length),[e.length]),E=10,ne=6.4,U=18,z=14,H=6,_=N,V=p,oe=_/2,be=V/2,M=a!=="none"?U+H+4:H+4,F=Math.max(Math.min(oe,be)-M,20),re=t?F*r:0,W=On.useMemo(()=>Ap(e,k,O,F,re,oe,be,n,o),[e,k,O,F,re,oe,be,n,o]),G=On.useMemo(()=>W.map(X=>X.id).join(","),[W]);On.useEffect(()=>{S({});},[G]);let le=On.useCallback((X,de)=>{if(C.current)return;let Q=y.current?.getBoundingClientRect();if(!Q)return;L(de);let ie=W.find(Pe=>Pe.id===de);ie&&A({x:X.clientX-Q.left+12,y:X.clientY-Q.top-10,items:[{label:ie.label,value:We(ie.value),percent:`${ie.percent}%`,color:ie.color}]});},[W]),ke=On.useCallback(()=>{L(null),A(null);},[]),B=On.useCallback((X,de,Q)=>{let ie=D[X]??{dx:0,dy:0};C.current={id:X,startX:de,startY:Q,origDx:ie.dx,origDy:ie.dy};},[D]),q=On.useCallback((X,de)=>{X.preventDefault(),L(de);let Q=y.current?.getBoundingClientRect();if(!Q)return;let ie=X.touches[0];if(!ie)return;let Pe=W.find(Oe=>Oe.id===de);Pe&&A({x:ie.clientX-Q.left+12,y:ie.clientY-Q.top-10,items:[{label:Pe.label,value:We(Pe.value),percent:`${Pe.percent}%`,color:Pe.color}]});},[W]),Z=On.useMemo(()=>{let X=e.reduce((de,Q)=>de+Q.value,0);return e.map((de,Q)=>({id:de.id,label:de.label,color:de.color??O[Q],visible:R(de.id),percent:X>0?Math.round(de.value/X*1e3)/10:0}))},[e,O,R]),ue=e.length>0&&e.some(X=>X.value>0),te=g==="left"||g==="right",ve=On.useMemo(()=>{if(a==="none")return [];let X=E+3,de=H+E*.5,Q=V-H-E*.5,ie=W.filter(se=>se.percent>=3).map(se=>{let Re="";switch(a){case "percent":Re=`${se.percent}%`;break;case "value":Re=We(se.value);break;case "label":Re=se.label;break;case "label+percent":Re=`${se.label} ${se.percent}%`;break}let K=Rt(se.cx,se.cy,se.outerR+2,se.midAngle),ce=Rt(se.cx,se.cy,se.outerR+U,se.midAngle),me=(se.midAngle-90)*Math.PI/180,J=Math.cos(me)>=0,Ce=Math.ceil(Re.length*ne);return {id:se.id,color:se.color,text:Re,textW:Ce,p1:K,elbowX:ce.x,y:ce.y,isRight:J}}),Pe=ie.filter(se=>se.isRight).sort((se,Re)=>se.y-Re.y),Oe=ie.filter(se=>!se.isRight).sort((se,Re)=>se.y-Re.y);function Xe(se){if(se.length!==0)for(let Re=0;Re<20;Re++){let K=false;for(let me=1;me<se.length;me++){let J=se[me].y-se[me-1].y;if(J<X){let Ce=(X-J)/2;se[me-1].y-=Ce,se[me].y+=Ce,K=true;}}se[0].y<de&&(se[0].y=de);for(let me=1;me<se.length;me++)se[me].y<se[me-1].y+X&&(se[me].y=se[me-1].y+X);let ce=se.length-1;se[ce].y>Q&&(se[ce].y=Q);for(let me=ce-1;me>=0;me--)se[me].y>se[me+1].y-X&&(se[me].y=se[me+1].y-X);for(let me of se)me.y=Math.max(de,Math.min(Q,me.y));if(!K)break}}return Xe(Pe),Xe(Oe),[...Oe,...Pe]},[W,a,V]),Ne=jsxRuntime.jsxs("svg",{role:"img","aria-label":u??"Pie chart",width:_,height:V,viewBox:`0 0 ${_} ${V}`,shapeRendering:"geometricPrecision",children:[jsxRuntime.jsxs("g",{className:h?"chart-pie-animate":"",children:[W.map((X,de)=>{let Q=w===X.id,ie=l&&Q,Pe=Ip(X.midAngle,ie?c:0);return jsxRuntime.jsx("path",{d:X.path,fill:X.color,transform:ie?`translate(${Pe.dx}, ${Pe.dy})`:void 0,className:f("chart-slice",h&&`chart-slice-animate-${Math.min(de,7)}`,Q&&"chart-slice--exploded"),stroke:X.color,strokeWidth:.6,onMouseMove:Oe=>le(Oe,X.id),onMouseLeave:ke,onTouchStart:Oe=>q(Oe,X.id),onTouchEnd:ke,"aria-label":`${X.label}: ${X.percent}%`},X.id)}),ve.map(X=>{let de=D[X.id]??{dx:0,dy:0},Q=X.elbowX+de.dx,ie=X.y+de.dy,Pe=Q+(X.isRight?z:-z),Oe=X.isRight?Pe+3:Pe-3,Xe=z+3+X.textW+6,se=X.isRight?Q:Q-Xe,Re=ie-E-2,K=E*2+4;return jsxRuntime.jsxs("g",{style:{userSelect:"none"},children:[jsxRuntime.jsx("polyline",{points:[`${X.p1.x.toFixed(2)},${X.p1.y.toFixed(2)}`,`${Q.toFixed(2)},${ie.toFixed(2)}`,`${Pe.toFixed(2)},${ie.toFixed(2)}`].join(" "),fill:"none",stroke:X.color,strokeWidth:1.2,opacity:.85,strokeLinejoin:"round",strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("text",{x:Oe.toFixed(2),y:ie.toFixed(2),textAnchor:X.isRight?"start":"end",dominantBaseline:"middle",fontSize:E,fill:"currentColor",className:"text-primary-700 dark:text-primary-300",style:{pointerEvents:"none"},children:X.text}),jsxRuntime.jsx("rect",{x:se,y:Re,width:Xe,height:K,fill:"transparent",style:{cursor:"grab",touchAction:"none"},onMouseDown:ce=>{ce.stopPropagation(),B(X.id,ce.clientX,ce.clientY);},onTouchStart:ce=>{ce.stopPropagation();let me=ce.touches[0];me&&B(X.id,me.clientX,me.clientY);}})]},`label-${X.id}`)})]}),t&&jsxRuntime.jsx("g",{style:{pointerEvents:"none"},children:w&&W.find(X=>X.id===w)?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("text",{x:oe,y:be-8,textAnchor:"middle",dominantBaseline:"middle",fontSize:18,fontWeight:600,fill:"currentColor",className:"text-primary-800 dark:text-primary-100",children:[W.find(X=>X.id===w)?.percent,"%"]}),jsxRuntime.jsx("text",{x:oe,y:be+12,textAnchor:"middle",dominantBaseline:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:W.find(X=>X.id===w)?.label})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[i&&jsxRuntime.jsx("text",{x:oe,y:be-(s?8:0),textAnchor:"middle",dominantBaseline:"middle",fontSize:16,fontWeight:600,fill:"currentColor",className:"text-primary-800 dark:text-primary-100",children:i}),s&&jsxRuntime.jsx("text",{x:oe,y:be+14,textAnchor:"middle",dominantBaseline:"middle",fontSize:11,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:s})]})})]});return jsxRuntime.jsxs("div",{ref:y,className:f(Yt(),m),children:[u&&jsxRuntime.jsx("h3",{className:"mb-2 text-sm font-semibold text-primary-700 dark:text-primary-200",children:u}),d&&g==="top"&&jsxRuntime.jsx(hi,{items:Z,position:"top",onToggle:T}),jsxRuntime.jsxs("div",{className:f("flex items-start justify-center",te&&"gap-0"),children:[d&&g==="left"&&jsxRuntime.jsx(hi,{items:Z,position:"left",onToggle:T}),jsxRuntime.jsx("div",{ref:v,className:"flex-1 min-w-0 overflow-hidden",children:ue?Ne:jsxRuntime.jsx("div",{className:"flex items-center justify-center text-secondary-400 dark:text-secondary-500",style:{height:p},children:b})}),d&&g==="right"&&jsxRuntime.jsx(hi,{items:Z,position:"right",onToggle:T})]}),d&&g==="bottom"&&jsxRuntime.jsx(hi,{items:Z,position:"bottom",onToggle:T}),P&&jsxRuntime.jsx("div",{className:Xt(),style:{left:P.x,top:P.y},role:"tooltip",children:P.items.map((X,de)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"h-2.5 w-2.5 rounded-full shrink-0",style:{background:X.color}}),jsxRuntime.jsxs("span",{className:"font-medium",children:[X.label,":"]}),jsxRuntime.jsx("span",{children:X.value}),jsxRuntime.jsxs("span",{className:"text-primary-300",children:["(",X.percent,")"]})]},de))})]})}function Vp(e,t,r){let n=1/0,o=-1/0;for(let s of e)if(t.has(s.id))for(let l of s.data){let c=Number(l.x);c<n&&(n=c),c>o&&(o=c);}if(!isFinite(n))return [0,1];let[a,i]=Nr(n,o);return [r?.min??a,r?.max??i]}function Hp(e,t,r){let n=1/0,o=-1/0;for(let s of e)if(t.has(s.id))for(let l of s.data)l.y<n&&(n=l.y),l.y>o&&(o=l.y);if(!isFinite(n))return [0,1];let[a,i]=Nr(n,o);return [r?.min??a,r?.max??i]}function rc(e,t){let[r,n]=e,[o,a]=t;return n===r?()=>(o+a)/2:i=>o+(i-r)/(n-r)*(a-o)}function nc(e,t=5){return Mn(e[0],e[1],t)}function _p(e,t,r){let n=1.618033988749895,o=e*137+t,a=o*n%1*2-1,i=o*n*n%1*2-1;return [a*r,i*r]}function Fp(e,t,r=12){if(e.length<2)return null;let n=Math.min(...e),o=Math.max(...e),a=Math.min(...t),i=Math.max(...t);return {cx:(n+o)/2,cy:(a+i)/2,rx:(o-n)/2+r,ry:(i-a)/2+r}}function gi({items:e,position:t,onToggle:r}){return jsxRuntime.jsx("div",{className:Ut({position:t}),children:e.map(n=>jsxRuntime.jsxs("button",{onClick:()=>r(n.id),className:f("flex items-center gap-1.5 cursor-pointer rounded px-1.5 py-1 text-xs text-primary-700 transition-opacity hover:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-800",!n.visible&&"opacity-40"),"aria-pressed":n.visible,children:[jsxRuntime.jsx("span",{className:"h-2.5 w-2.5 rounded-full shrink-0",style:{background:n.color}}),n.label]},n.id))})}function oc({series:e,xAxis:t,yAxis:r,dotRadius:n=5,dotOpacity:o=.75,clusters:a=false,jitter:i=false,jitterAmount:s=12,linkedLines:l=false,title:c,height:u=300,className:p,legend:m=true,legendPosition:d="bottom",animateOnMount:g=true,emptyText:h="No data to display"}){let b=On.useRef(null),y=On.useRef(null),[v,N]=On.useState(600),[x,w]=On.useState(null);On.useEffect(()=>{let M=y.current;if(!M)return;let F=M.getBoundingClientRect().width;F>0&&N(F);let re=new ResizeObserver(W=>{let G=W[0]?.contentRect.width;G&&G>0&&N(G);});return re.observe(M),()=>re.disconnect()},[]);let L=On.useMemo(()=>e.map(M=>M.id),[e]),{visible:P,toggle:A,isVisible:D}=wr(L),S=On.useMemo(()=>kr(e.length),[e.length]),C=On.useMemo(()=>new Map(e.map((M,F)=>[M.id,M.color??S[F]])),[e,S]),I=On.useMemo(()=>Cr(!!t?.label,!!r?.label,false),[t?.label,r?.label]),k=On.useMemo(()=>Mr(v,u,I),[v,u,I]),T=On.useMemo(()=>Vp(e,P,t),[e,P,t]),R=On.useMemo(()=>Hp(e,P,r),[e,P,r]),O=On.useMemo(()=>rc(T,[k.plotLeft,k.plotRight]),[T,k]),E=On.useMemo(()=>rc(R,[k.plotBottom,k.plotTop]),[R,k]),ne=On.useMemo(()=>nc(T,t?.tickCount??6),[T,t?.tickCount]),U=On.useMemo(()=>nc(R,r?.tickCount??5),[R,r?.tickCount]),z=On.useCallback((M,F,re,W,G)=>{let le=b.current?.getBoundingClientRect();le&&w({x:M.clientX-le.left+12,y:M.clientY-le.top-10,seriesName:F,xVal:We(re,t?.format),yVal:We(W,r?.format),color:G});},[t?.format,r?.format]),H=On.useCallback((M,F,re,W,G)=>{M.preventDefault();let le=b.current?.getBoundingClientRect();if(!le)return;let ke=M.touches[0];ke&&w({x:ke.clientX-le.left+12,y:ke.clientY-le.top-10,seriesName:F,xVal:We(re,t?.format),yVal:We(W,r?.format),color:G});},[t?.format,r?.format]),_=On.useMemo(()=>e.map((M,F)=>({id:M.id,label:M.name,color:M.color??S[F],visible:D(M.id)})),[e,S,D]),V=e.some(M=>M.data.length>0),oe=d==="left"||d==="right",be=jsxRuntime.jsxs("svg",{role:"img","aria-label":c??"Scatter chart",width:k.width,height:k.height,viewBox:`0 0 ${k.width} ${k.height}`,shapeRendering:"geometricPrecision",children:[U.map(M=>jsxRuntime.jsx("line",{x1:k.plotLeft,x2:k.plotRight,y1:E(M),y2:E(M),stroke:"currentColor",strokeWidth:.5,strokeDasharray:"4 4",className:"text-secondary-200 dark:text-secondary-700"},M)),a&&e.map((M,F)=>{if(!D(M.id)||M.data.length<2)return null;let re=C.get(M.id)??"var(--color-chart-1)",W=M.data.map(ke=>O(Number(ke.x))),G=M.data.map(ke=>E(ke.y)),le=Fp(W,G,16);return le?jsxRuntime.jsx("ellipse",{cx:le.cx,cy:le.cy,rx:le.rx,ry:le.ry,fill:re,fillOpacity:.06,stroke:re,strokeOpacity:.3,strokeWidth:1.5,strokeDasharray:"5 3",className:g?"chart-cluster-ellipse":"",style:{animationDelay:`${F*.1}s`}},`cluster-${M.id}`):null}),l&&e.map(M=>{if(!D(M.id)||M.data.length<2)return null;let F=C.get(M.id)??"var(--color-chart-1)",W=[...M.data].sort((G,le)=>Number(G.x)-Number(le.x)).map(G=>`${O(Number(G.x)).toFixed(2)},${E(G.y).toFixed(2)}`).join(" ");return jsxRuntime.jsx("polyline",{points:W,fill:"none",stroke:F,strokeWidth:1.5,className:"chart-scatter-link"},`link-${M.id}`)}),e.map((M,F)=>{if(!D(M.id))return null;let re=C.get(M.id)??"var(--color-chart-1)";return jsxRuntime.jsx("g",{className:"chart-scatter-group",children:M.data.map((W,G)=>{let[le,ke]=i?_p(F,G,s):[0,0],B=O(Number(W.x))+le,q=E(W.y)+ke;return jsxRuntime.jsx("circle",{cx:B,cy:q,r:n,fill:re,fillOpacity:o,stroke:re,strokeWidth:1,strokeOpacity:.5,className:f("chart-scatter-dot",g&&"chart-scatter-dot--animate"),style:{color:re},onMouseMove:Z=>z(Z,M.name,W.x,W.y,re),onMouseLeave:()=>w(null),onTouchStart:Z=>H(Z,M.name,W.x,W.y,re),onTouchEnd:()=>w(null)},G)})},M.id)}),jsxRuntime.jsx("line",{x1:k.plotLeft,x2:k.plotLeft,y1:k.plotTop,y2:k.plotBottom,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsxRuntime.jsx("line",{x1:k.plotLeft,x2:k.plotRight,y1:k.plotBottom,y2:k.plotBottom,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),U.map(M=>{let F=E(M);return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("line",{x1:k.plotLeft-4,x2:k.plotLeft,y1:F,y2:F,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsxRuntime.jsx("text",{x:k.plotLeft-6,y:F,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:We(M,r?.format)})]},M)}),ne.map(M=>{let F=O(M);return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("line",{x1:F,x2:F,y1:k.plotBottom,y2:k.plotBottom+4,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsxRuntime.jsx("text",{x:F,y:k.plotBottom+14,textAnchor:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:We(M,t?.format)})]},M)}),r?.label&&jsxRuntime.jsx("text",{x:-(k.plotTop+k.plotHeight/2),y:14,textAnchor:"middle",fontSize:11,fill:"currentColor",className:"text-secondary-600 dark:text-secondary-400",transform:"rotate(-90)",children:r.label}),t?.label&&jsxRuntime.jsx("text",{x:k.plotLeft+k.plotWidth/2,y:k.height-4,textAnchor:"middle",fontSize:11,fill:"currentColor",className:"text-secondary-600 dark:text-secondary-400",children:t.label})]});return jsxRuntime.jsxs("div",{ref:b,className:f(Yt(),p),children:[c&&jsxRuntime.jsx("h3",{className:"mb-2 text-sm font-semibold text-primary-700 dark:text-primary-200",children:c}),m&&d==="top"&&jsxRuntime.jsx(gi,{items:_,position:"top",onToggle:A}),jsxRuntime.jsxs("div",{className:f("flex items-start",oe&&"gap-0"),children:[m&&d==="left"&&jsxRuntime.jsx(gi,{items:_,position:"left",onToggle:A}),jsxRuntime.jsx("div",{ref:y,className:"flex-1 min-w-0 overflow-hidden",children:V?be:jsxRuntime.jsx("div",{className:"flex items-center justify-center text-secondary-400 dark:text-secondary-500",style:{height:u},children:h})}),m&&d==="right"&&jsxRuntime.jsx(gi,{items:_,position:"right",onToggle:A})]}),m&&d==="bottom"&&jsxRuntime.jsx(gi,{items:_,position:"bottom",onToggle:A}),x&&jsxRuntime.jsxs("div",{className:Xt(),style:{left:x.x,top:x.y},role:"tooltip",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[jsxRuntime.jsx("span",{className:"h-2 w-2 rounded-full",style:{background:x.color}}),jsxRuntime.jsx("span",{className:"font-medium",children:x.seriesName})]}),jsxRuntime.jsxs("div",{className:"text-primary-300",children:["X: ",jsxRuntime.jsx("span",{className:"font-medium text-primary-50",children:x.xVal})," ","Y: ",jsxRuntime.jsx("span",{className:"font-medium text-primary-50",children:x.yVal})]})]})]})}var Y1={LineChart:Jl,BarChart:Ql,PieChart:tc,ScatterChart:oc},ac=Y1;var U1={Primitives:Vi,Layout:Oi,DataDisplay:os,Navigation:us,Disclosure:hs,Overlay:Ps,Feedback:Bs,Extras:_l,Forms:$l,Chart:ac},DA=U1;
128
+ exports.Accordion=ms;exports.AccordionContent=sh;exports.AccordionItem=ah;exports.AccordionTrigger=ih;exports.Alert=Ds;exports.AlertContent=qh;exports.AlertDescription=Jh;exports.AlertIcon=Gh;exports.AlertTitle=Xh;exports.Avatar=Ko;exports.AvatarGroup=jo;exports.Badge=Si;exports.BarChart=Ql;exports.Breadcrumb=ua;exports.Button=Vt;exports.Card=Hi;exports.CardContent=af;exports.CardDescription=of;exports.CardFooter=sf;exports.CardHeader=rf;exports.CardTitle=nf;exports.Chart=ac;exports.Chat=Gi;exports.Checkbox=An;exports.CinePlayer=Us;exports.CodeBlock=Zi;exports.CommandPalette=Ka;exports.ContextMenu=Ss;exports.DataDisplay=os;exports.DataTable=Vf;exports.DateTimePicker=Wa;exports.Dialog=Zn;exports.DialogClose=Ch;exports.DialogContent=vs;exports.DialogDescription=ks;exports.DialogFooter=Ns;exports.DialogHeader=xs;exports.DialogTitle=ws;exports.Disclosure=hs;exports.Drawer=ka;exports.DrawerBody=md;exports.DrawerClose=hd;exports.DrawerFooter=fd;exports.DrawerHeader=pd;exports.Dropdown=wi;exports.DropdownButton=qr;exports.Extras=_l;exports.Feedback=Bs;exports.FileExplorer=Zs;exports.FilmReel=Ks;exports.Form=Ol;exports.FormItem=H1;exports.FormSection=_1;exports.Forms=$l;exports.Header=ls;exports.HorizontalCard=lf;exports.ImageCard=_i;exports.ImageCardActions=mf;exports.ImageCardBody=df;exports.ImageCardDescription=pf;exports.ImageCardTitle=uf;exports.Indicator=Ri;exports.Input=Ft;exports.Kbd=Zr;exports.KbdGroup=en;exports.Label=_t;exports.Layout=Oi;exports.LineChart=Jl;exports.List=Yi;exports.ListItem=Ff;exports.LoginPanel=Ga;exports.Masonry=nl;exports.MetricCard=ts;exports.MiniPlayer=Ws;exports.NavLink=cs;exports.Navigation=us;exports.OTPInput=wn;exports.Overlay=Ps;exports.Pagination=ma;exports.Panel=Fi;exports.PanelContent=hf;exports.PanelHeader=ff;exports.PieChart=tc;exports.Primitives=Vi;exports.ProgressBar=zs;exports.Radio=Di;exports.RadioGroup=Li;exports.Rating=Xo;exports.RibbonBar=Un;exports.RichTextEditor=Co;exports.ScatterChart=oc;exports.SideNav=ss;exports.Skeleton=Ra;exports.Slider=Yo;exports.SliderRange=Uo;exports.SortableTable=If;exports.Spin=Hs;exports.SplitPanel=qo;exports.Stat=es;exports.Switch=Rr;exports.TabContent=fh;exports.TabList=uh;exports.TabPanels=mh;exports.TabTrigger=ph;exports.Table=Bn;exports.TableBody=ji;exports.TableCell=Vr;exports.TableEmpty=Wi;exports.TableHead=zr;exports.TableHeader=Ki;exports.TableRow=Fn;exports.Tabs=fs;exports.Tag=Pi;exports.TextBox=Ei;exports.Timeline=il;exports.ToastContext=lo;exports.ToastProvider=Ea;exports.Tooltip=Cs;exports.Tree=Ui;exports.TreeItem=Yf;exports.TypewriterText=Oa;exports.VirtualList=aa;exports.accordionContentVariants=ha;exports.accordionTriggerVariants=fa;exports.accordionVariants=ga;exports.alertVariants=no;exports.avatarVariants=Pn;exports.badgeVariants=So;exports.buttonVariants=Ur;exports.cardVariants=In;exports.chartContainerVariants=Yt;exports.chartLegendVariants=Ut;exports.chartTooltipVariants=Xt;exports.checkboxVariants=Eo;exports.cn=f;exports.codeBlockVariants=Hn;exports.configureAlertTopOffset=tg;exports.default=DA;exports.dialogContentVariants=Qn;exports.indicatorVariants=Po;exports.inputVariants=Xr;exports.kbdVariants=Io;exports.labelVariants=Ro;exports.listItemVariants=Zo;exports.listVariants=Qo;exports.metricCardVariants=ra;exports.navLinkVariants=la;exports.otpInputVariants=Ua;exports.panelVariants=Go;exports.progressBarVariants=Ca;exports.radioVariants=Lo;exports.ratingVariants=Ao;exports.skeletonVariants=oo;exports.sliderVariants=Rn;exports.spinVariants=cn;exports.statVariants=ta;exports.switchTrackVariants=Do;exports.tabListVariants=ba;exports.tabTriggerVariants=ya;exports.tableVariants=Jo;exports.tagVariants=zo;exports.toastVariants=Ma;exports.tooltipVariants=wa;exports.treeItemVariants=ea;exports.useAlert=cg;exports.useSpin=kg;exports.useToast=La;