@epam/ai-dial-ui-kit 0.15.0-dev.9 → 0.15.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 (250) hide show
  1. package/README.md +55 -2
  2. package/dist/CHANGELOG.md +84 -0
  3. package/dist/DateCellRenderer-BdUMSg-E.cjs +1 -0
  4. package/dist/{DateCellRenderer-Bu40QyHE.cjs → DateCellRenderer-CZNa4jVJ.cjs} +30 -30
  5. package/dist/IconButton-DHOFapLo.cjs +1 -0
  6. package/dist/{JsonEditor-qv1Z0dLX.cjs → JsonEditor-Bxui5wJH.cjs} +1 -1
  7. package/dist/{MarkdownEditor-DHn2pYOJ.cjs → MarkdownEditor-BKtFs714.cjs} +1 -1
  8. package/dist/MarkdownEditor-Bapd1ycU.cjs +1 -0
  9. package/dist/MarkdownEditorContainer-B5aHwoYF.cjs +1 -0
  10. package/dist/{Switch-CUKClcEz.cjs → Switch-DE6MrcqJ.cjs} +1 -1
  11. package/dist/components/Button/constants.js +9 -8
  12. package/dist/components/Dropdown/Dropdown.js +2 -2
  13. package/dist/components/Dropdown/DropdownSubMenuItem.js +1 -1
  14. package/dist/components/Dropdown/constants.js +7 -7
  15. package/dist/components/DropdownIcon/DropdownIcon.js +4 -4
  16. package/dist/components/FileManager/FileManager.js +373 -372
  17. package/dist/components/FileManager/FileManagerProvider.js +266 -264
  18. package/dist/components/FileManager/hooks/use-grid-context-menu.js +59 -59
  19. package/dist/components/MarkdownEditor/MarkdownEditor.js +23 -21
  20. package/dist/components/MarkdownEditor/MarkdownEditorContainer.js +27 -25
  21. package/dist/components/New/Accordion/Accordion.js +86 -72
  22. package/dist/components/New/AutocompleteTagInput/AutocompleteTagInput.js +214 -0
  23. package/dist/components/New/AutocompleteTagInput/utils.js +11 -0
  24. package/dist/components/New/Avatar/Avatar.js +70 -0
  25. package/dist/components/New/Badge/Badge.js +45 -0
  26. package/dist/components/New/BottomSheet/BottomSheet.js +128 -0
  27. package/dist/components/New/Breadcrumbs/Breadcrumbs.js +159 -0
  28. package/dist/components/New/Breadcrumbs/constants.js +41 -0
  29. package/dist/components/New/Button/Button.js +32 -32
  30. package/dist/components/New/Button/ButtonWrappers.js +103 -37
  31. package/dist/components/New/Button/constants.js +3 -0
  32. package/dist/components/New/Button/utils.js +18 -8
  33. package/dist/components/New/ButtonDropdown/ButtonDropdown.js +27 -18
  34. package/dist/components/New/Calendar/Calendar.js +6 -6
  35. package/dist/components/New/Calendar/constants.js +5 -5
  36. package/dist/components/New/CaptionText/CaptionText.js +3 -3
  37. package/dist/components/New/CardShell/CardShell.js +2 -2
  38. package/dist/components/New/Checkbox/Checkbox.js +2 -2
  39. package/dist/components/New/Checkbox/CheckboxBox.js +2 -2
  40. package/dist/components/New/CloseButton/CloseButton.js +1 -1
  41. package/dist/components/New/CollapsibleSidebar/CollapsibleSidebar.js +2 -2
  42. package/dist/components/New/ConfirmationPopup/ConfirmationPopup.js +21 -25
  43. package/dist/components/New/ConfirmationPopup/constants.js +8 -11
  44. package/dist/components/New/Dropdown/Dropdown.js +99 -98
  45. package/dist/components/New/Dropdown/DropdownSubMenuItem.js +17 -17
  46. package/dist/components/New/Dropdown/constants.js +22 -17
  47. package/dist/components/New/EllipsisTooltip/EllipsisTooltip.js +2 -2
  48. package/dist/components/New/EntityIdentity/EntityIdentity.js +135 -0
  49. package/dist/components/New/FileDropzone/FileDropzone.js +2 -2
  50. package/dist/components/New/FileIcon/FileIcon.js +55 -0
  51. package/dist/components/New/FileIcon/constants.js +134 -0
  52. package/dist/components/New/FileIcon/icons/FileGlyph.js +150 -0
  53. package/dist/components/New/FileIcon/icons/FolderGlyph.js +50 -0
  54. package/dist/components/New/FileName/FileName.js +78 -0
  55. package/dist/components/New/FilterChips/FilterChips.js +2 -2
  56. package/dist/components/New/FolderName/FolderName.js +16 -0
  57. package/dist/components/New/FolderPath/FolderPath.js +1 -1
  58. package/dist/components/New/Grid/constants.js +14 -5
  59. package/dist/components/New/Highlight/Highlight.js +2 -2
  60. package/dist/components/New/IconButton/IconButton.js +30 -28
  61. package/dist/components/New/InfoButton/InfoButton.js +2 -2
  62. package/dist/components/New/InlineSelect/InlineSelect.js +75 -59
  63. package/dist/components/New/InteractiveTooltip/InteractiveTooltip.js +70 -66
  64. package/dist/components/New/InteractiveTooltip/constants.js +2 -2
  65. package/dist/components/New/Label/Label.js +2 -2
  66. package/dist/components/New/MarkdownEditor/MarkdownEditor.js +29 -27
  67. package/dist/components/New/MenuItem/MenuItem.js +2 -2
  68. package/dist/components/New/MenuItem/constants.js +1 -1
  69. package/dist/components/New/NoDataContent/NoDataContent.js +2 -2
  70. package/dist/components/New/Notification/Notification.js +37 -35
  71. package/dist/components/New/NumberInput/NumberInput.js +2 -2
  72. package/dist/components/New/PasswordInput/PasswordInput.js +2 -2
  73. package/dist/components/New/Popup/Popup.js +59 -57
  74. package/dist/components/New/Popup/constants.js +3 -3
  75. package/dist/components/New/Radio/Radio.js +2 -2
  76. package/dist/components/New/RadioGroup/RadioGroup.js +2 -2
  77. package/dist/components/New/RadioGroupPopupField/RadioGroupPopupField.js +2 -2
  78. package/dist/components/New/ResizableContainer/ResizableContainer.js +2 -2
  79. package/dist/components/New/SchemaRenderer/SchemaRenderer.js +164 -0
  80. package/dist/components/New/SchemaRenderer/components/SchemaAnyOfEditor.js +65 -0
  81. package/dist/components/New/SchemaRenderer/components/SchemaArrayEditor.js +109 -0
  82. package/dist/components/New/SchemaRenderer/components/SchemaField.js +83 -0
  83. package/dist/components/New/SchemaRenderer/components/SchemaFieldContent.js +72 -0
  84. package/dist/components/New/SchemaRenderer/components/SchemaJsonEditor.js +41 -0
  85. package/dist/components/New/SchemaRenderer/components/SchemaKeyValueEditor.js +250 -0
  86. package/dist/components/New/SchemaRenderer/components/SchemaObjectEditor.js +36 -0
  87. package/dist/components/New/SchemaRenderer/components/SchemaOneOfEditor.js +163 -0
  88. package/dist/components/New/SchemaRenderer/components/SchemaPrimitiveField.js +150 -0
  89. package/dist/components/New/SchemaRenderer/components/SchemaSection.js +135 -0
  90. package/dist/components/New/SchemaRenderer/context.js +17 -0
  91. package/dist/components/New/Search/Search.js +2 -2
  92. package/dist/components/New/SegmentedControl/SegmentedControl.js +4 -4
  93. package/dist/components/New/Select/CollapsedSelectTags.js +127 -0
  94. package/dist/components/New/Select/MultiSelectTags.js +18 -15
  95. package/dist/components/New/Select/Select.js +184 -173
  96. package/dist/components/New/Select/constants.js +23 -20
  97. package/dist/components/New/SharedEntityIndicator/SharedEntityIndicator.js +34 -0
  98. package/dist/components/New/SideDrawer/SideDrawer.js +148 -0
  99. package/dist/components/New/Slider/Slider.js +184 -91
  100. package/dist/components/New/Slider/utils.js +20 -0
  101. package/dist/components/New/Switch/Switch.js +2 -2
  102. package/dist/components/New/Tabs/Tabs.js +124 -66
  103. package/dist/components/New/Tag/Tag.js +2 -2
  104. package/dist/components/New/TagInput/TagInput.js +5 -3
  105. package/dist/components/New/Textarea/Textarea.js +21 -20
  106. package/dist/components/New/ToggleIconButton/ToggleIconButton.js +2 -2
  107. package/dist/components/New/Tooltip/TooltipContent.js +2 -2
  108. package/dist/components/New/Tooltip/constants.js +1 -1
  109. package/dist/components/New/TransferQueue/TransferQueue.js +124 -0
  110. package/dist/components/New/TransferQueue/TransferQueueHeader.js +71 -0
  111. package/dist/components/New/TransferQueue/TransferQueueRow.js +119 -0
  112. package/dist/components/New/TransferQueue/constants.js +24 -0
  113. package/dist/components/New/constants/overlay.js +17 -9
  114. package/dist/components/Popup/constants.js +8 -8
  115. package/dist/components/ProgressBar/ProgressBar.js +6 -6
  116. package/dist/components/SchemaRenderer/SchemaRenderer.js +16 -15
  117. package/dist/components/SchemaRenderer/components/SchemaAnyOfEditor.js +2 -2
  118. package/dist/components/SchemaRenderer/components/SchemaArrayEditor.js +1 -1
  119. package/dist/components/SchemaRenderer/components/SchemaField.js +23 -23
  120. package/dist/components/SchemaRenderer/components/SchemaFieldContent.js +19 -19
  121. package/dist/components/SchemaRenderer/components/SchemaKeyValueEditor.js +2 -2
  122. package/dist/components/SchemaRenderer/components/SchemaObjectEditor.js +1 -1
  123. package/dist/components/SchemaRenderer/components/SchemaOneOfEditor.js +13 -13
  124. package/dist/components/SchemaRenderer/components/SchemaPrimitiveField.js +5 -5
  125. package/dist/components/Skeleton/Skeleton.js +2 -2
  126. package/dist/components/Spinner/Spinner.js +2 -2
  127. package/dist/components/Tooltip/TooltipContent.js +11 -11
  128. package/dist/components-manifest.json +1826 -109
  129. package/dist/constants/public-class-names.js +64 -3
  130. package/dist/{components/SchemaRenderer/types.js → constants/schema-renderer.js} +2 -7
  131. package/dist/dial-ui-kit.cjs +2 -2
  132. package/dist/dial-ui-kit.js +357 -311
  133. package/dist/editors.cjs +1 -1
  134. package/dist/file-manager.cjs +1 -1
  135. package/dist/grid.cjs +1 -1
  136. package/dist/index.css +2 -2
  137. package/dist/lazy-_W6FYhKg.cjs +1 -0
  138. package/dist/merge-classes-BEJXjzkx.cjs +1 -0
  139. package/dist/migration-guides/0.15.0/legacy-theme-variable-fallbacks-removal.md +69 -0
  140. package/dist/migration-guides/0.15.0/slider-redesign.md +110 -0
  141. package/dist/migration-guides/README.md +2 -0
  142. package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +419 -399
  143. package/dist/src/components/FileManager/FileManager.d.ts +2 -0
  144. package/dist/src/components/FileManager/FileManagerContext.d.ts +1 -0
  145. package/dist/src/components/FileManager/hooks/use-grid-context-menu.d.ts +2 -1
  146. package/dist/src/components/MarkdownEditor/MarkdownEditor.d.ts +2 -0
  147. package/dist/src/components/MarkdownEditor/MarkdownEditorContainer.d.ts +2 -0
  148. package/dist/src/components/New/Accordion/Accordion.d.ts +6 -1
  149. package/dist/src/components/New/AutocompleteTagInput/AutocompleteTagInput.d.ts +108 -0
  150. package/dist/src/components/New/AutocompleteTagInput/utils.d.ts +17 -0
  151. package/dist/src/components/New/AutocompleteTagInput/utils.spec.d.ts +1 -0
  152. package/dist/src/components/New/Avatar/Avatar.d.ts +55 -0
  153. package/dist/src/components/New/Badge/Badge.d.ts +47 -0
  154. package/dist/src/components/New/BottomSheet/BottomSheet.d.ts +84 -0
  155. package/dist/src/components/New/Breadcrumbs/Breadcrumbs.d.ts +94 -0
  156. package/dist/src/components/New/Breadcrumbs/constants.d.ts +60 -0
  157. package/dist/src/components/New/Button/Button.d.ts +4 -1
  158. package/dist/src/components/New/Button/ButtonWrappers.d.ts +21 -0
  159. package/dist/src/components/New/Button/utils.d.ts +15 -0
  160. package/dist/src/components/New/ButtonDropdown/ButtonDropdown.d.ts +4 -0
  161. package/dist/src/components/New/Calendar/constants.d.ts +1 -1
  162. package/dist/src/components/New/ConfirmationPopup/constants.d.ts +0 -1
  163. package/dist/src/components/New/Dropdown/Dropdown.d.ts +9 -1
  164. package/dist/src/components/New/Dropdown/constants.d.ts +3 -0
  165. package/dist/src/components/New/EntityIdentity/EntityIdentity.d.ts +85 -0
  166. package/dist/src/components/New/FileIcon/FileIcon.d.ts +61 -0
  167. package/dist/src/components/New/FileIcon/constants.d.ts +16 -0
  168. package/dist/src/components/New/FileIcon/icons/FileGlyph.d.ts +18 -0
  169. package/dist/src/components/New/FileIcon/icons/FolderGlyph.d.ts +17 -0
  170. package/dist/src/components/New/FileName/FileName.d.ts +79 -0
  171. package/dist/src/components/New/FolderName/FolderName.d.ts +37 -0
  172. package/dist/src/components/New/Grid/constants.d.ts +6 -4
  173. package/dist/src/components/New/InlineSelect/InlineSelect.d.ts +16 -1
  174. package/dist/src/components/New/InteractiveTooltip/InteractiveTooltip.d.ts +13 -2
  175. package/dist/src/components/New/InteractiveTooltip/constants.d.ts +5 -4
  176. package/dist/src/components/New/MarkdownEditor/MarkdownEditor.d.ts +3 -0
  177. package/dist/src/components/New/Notification/Notification.d.ts +18 -0
  178. package/dist/src/components/New/Popup/Popup.d.ts +8 -1
  179. package/dist/src/components/New/Popup/constants.d.ts +1 -1
  180. package/dist/src/components/New/SchemaRenderer/SchemaRenderer.d.ts +38 -0
  181. package/dist/src/components/New/SchemaRenderer/components/SchemaAnyOfEditor.d.ts +37 -0
  182. package/dist/src/components/New/SchemaRenderer/components/SchemaArrayEditor.d.ts +35 -0
  183. package/dist/src/components/New/SchemaRenderer/components/SchemaField.d.ts +33 -0
  184. package/dist/src/components/New/SchemaRenderer/components/SchemaFieldContent.d.ts +30 -0
  185. package/dist/src/components/New/SchemaRenderer/components/SchemaJsonEditor.d.ts +29 -0
  186. package/dist/src/components/New/SchemaRenderer/components/SchemaKeyValueEditor.d.ts +37 -0
  187. package/dist/src/components/New/SchemaRenderer/components/SchemaObjectEditor.d.ts +32 -0
  188. package/dist/src/components/New/SchemaRenderer/components/SchemaOneOfEditor.d.ts +39 -0
  189. package/dist/src/components/New/SchemaRenderer/components/SchemaPrimitiveField.d.ts +38 -0
  190. package/dist/src/components/New/SchemaRenderer/components/SchemaSection.d.ts +39 -0
  191. package/dist/src/components/New/SchemaRenderer/context.d.ts +8 -0
  192. package/dist/src/components/New/SchemaRenderer/types.d.ts +76 -0
  193. package/dist/src/components/New/Select/CollapsedSelectTags.d.ts +22 -0
  194. package/dist/src/components/New/Select/MultiSelectTags.d.ts +5 -0
  195. package/dist/src/components/New/Select/Select.d.ts +9 -0
  196. package/dist/src/components/New/Select/constants.d.ts +3 -2
  197. package/dist/src/components/New/SharedEntityIndicator/SharedEntityIndicator.d.ts +35 -0
  198. package/dist/src/components/New/SideDrawer/SideDrawer.d.ts +100 -0
  199. package/dist/src/components/New/Slider/Slider.d.ts +29 -1
  200. package/dist/src/components/New/Slider/utils.d.ts +14 -0
  201. package/dist/src/components/New/Slider/utils.spec.d.ts +1 -0
  202. package/dist/src/components/New/Tabs/Tabs.d.ts +54 -6
  203. package/dist/src/components/New/Tooltip/constants.d.ts +5 -3
  204. package/dist/src/components/New/TransferQueue/TransferQueue.d.ts +139 -0
  205. package/dist/src/components/New/TransferQueue/TransferQueueHeader.d.ts +16 -0
  206. package/dist/src/components/New/TransferQueue/TransferQueueRow.d.ts +10 -0
  207. package/dist/src/components/New/TransferQueue/constants.d.ts +6 -0
  208. package/dist/src/components/New/constants/overlay.d.ts +13 -0
  209. package/dist/src/components/Popup/constants.d.ts +1 -1
  210. package/dist/src/components/SchemaRenderer/types.d.ts +5 -93
  211. package/dist/src/components/SchemaRenderer/utils.d.ts +1 -17
  212. package/dist/src/constants/public-class-names.d.ts +64 -3
  213. package/dist/src/constants/schema-renderer.d.ts +2 -0
  214. package/dist/src/index.d.ts +37 -3
  215. package/dist/src/models/json-schema.d.ts +71 -0
  216. package/dist/src/types/accordion.d.ts +7 -0
  217. package/dist/src/types/avatar.d.ts +7 -0
  218. package/dist/src/types/badge.d.ts +16 -0
  219. package/dist/src/types/breadcrumbs.d.ts +9 -0
  220. package/dist/src/types/button.d.ts +1 -0
  221. package/dist/src/types/entity-type.d.ts +9 -0
  222. package/dist/src/types/json-schema.d.ts +22 -0
  223. package/dist/src/types/tooltip.d.ts +4 -0
  224. package/dist/src/types/transfer-queue.d.ts +10 -0
  225. package/dist/src/utils/__tests__/avatar.spec.d.ts +1 -0
  226. package/dist/src/utils/avatar.d.ts +12 -0
  227. package/dist/src/utils/json-schema.d.ts +23 -0
  228. package/dist/src/utils/sub-menu-floating.d.ts +7 -4
  229. package/dist/types/accordion.js +4 -0
  230. package/dist/types/avatar.js +4 -0
  231. package/dist/types/badge.js +5 -0
  232. package/dist/types/breadcrumbs.js +4 -0
  233. package/dist/types/button.js +3 -3
  234. package/dist/types/entity-type.js +4 -0
  235. package/dist/types/json-schema.js +7 -0
  236. package/dist/types/tooltip.js +3 -2
  237. package/dist/types/transfer-queue.js +4 -0
  238. package/dist/use-file-manager-tabs-Bzzwwcgk.cjs +3 -0
  239. package/dist/utils/avatar.js +22 -0
  240. package/dist/{components/SchemaRenderer/utils.js → utils/json-schema.js} +22 -20
  241. package/dist/utils/merge-classes.js +12 -5
  242. package/dist/utils/sub-menu-floating.js +99 -54
  243. package/package.json +4 -9
  244. package/dist/DateCellRenderer-C3e61i75.cjs +0 -1
  245. package/dist/IconButton-DWqoaBWf.cjs +0 -1
  246. package/dist/MarkdownEditor-jQ8nDJfx.cjs +0 -1
  247. package/dist/MarkdownEditorContainer-Bzcnoemw.cjs +0 -1
  248. package/dist/lazy-tfN4sKhq.cjs +0 -1
  249. package/dist/merge-classes-Dipy1Ih1.cjs +0 -1
  250. package/dist/use-file-manager-tabs-9DWkp9IJ.cjs +0 -3
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("./use-file-manager-tabs-9DWkp9IJ.cjs"),_e=require("./Switch-CUKClcEz.cjs"),n=require("react/jsx-runtime"),h=require("react"),H=require("@tabler/icons-react"),ie=require("classnames"),w=require("./DateCellRenderer-Bu40QyHE.cjs"),K=require("./icon-CrGVkVpG.cjs"),I=require("./merge-classes-Dipy1Ih1.cjs"),P=require("./DateCellRenderer-C3e61i75.cjs"),T=require("./IconButton-DWqoaBWf.cjs"),Wn=require("react-dom"),ot=require("./lazy-tfN4sKhq.cjs"),de=require("@floating-ui/react"),oe=require("./icon-DhjrDQ8I.cjs");function qn(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const hr=qn(h),He=({label:e,className:t,icon:r,selected:s,closable:a,onClick:i,onRemove:o})=>{const l=I.mergeClasses("flex items-center gap-1 cursor-pointer dial-tiny-text px-2 h-[24px] border text-primary rounded-[8px]",s?"hover:bg-controls-accent-primary-alpha-active bg-accent-primary-alpha border-accent-primary":"bg-neutral border-primary",t);return n.jsxs("div",{className:l,onClick:i,children:[n.jsx(w.DialIcon,{icon:r}),n.jsx(w.DialEllipsisTooltip,{text:e}),a&&o&&n.jsx(b.DialButton,{className:"p-0",iconAfter:n.jsx(H.IconX,{size:K.DIAL_ICON_SIZE.SM}),onClick:c=>o(c)})]},e)},Qt=({label:e="Error",className:t})=>n.jsx(He,{label:e,className:I.mergeClasses("dial-tiny-semi-text cursor-default rounded-[120px] border-transparent bg-error text-error",t)});var st=(e=>(e.Default="default",e.Compact="compact",e))(st||{});const Zn={[st.Default]:{container:"bg-layer-3",title:"dial-small-text text-secondary",value:"dial-display2-text text-primary",showDescription:!0},[st.Compact]:{container:"bg-layer-2",title:"dial-tiny-text text-secondary",value:"dial-body-semi-text text-primary",showDescription:!1}},Yn=({title:e,value:t,description:r,variant:s=st.Default,error:a,isLoading:i,className:o,delta:l,deltaPositive:c,deltaUnit:u,compareValues:d})=>{const p=Zn[s],g=c!==void 0?c:(l??0)>=0,f=l===void 0?null:`${l>=0?`+${l}`:String(l)}${u??""}`;return n.jsxs("div",{className:I.mergeClasses("flex flex-col rounded-lg border border-secondary p-4",a||i?"gap-2":"gap-1",p.container,o),children:[l!==void 0?n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:p.title,children:e}),n.jsx("span",{className:I.mergeClasses("dial-tiny-semi-text rounded-[120px] border border-transparent px-2",g?"bg-success text-success":"bg-error text-error"),children:f})]}):n.jsx("span",{className:p.title,children:e}),a?n.jsx(Qt,{className:"self-start"}):i?n.jsx(b.DialLoader,{fullWidth:!1,className:"self-start"}):d?n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[n.jsx(w.DialEllipsisTooltip,{text:d[0].title,className:"dial-tiny-text text-secondary"}),n.jsx("span",{className:p.value,children:d[0].value})]}),n.jsx("div",{className:"h-4 w-px flex-shrink-0 bg-controls-disable-accent"}),n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[n.jsx(w.DialEllipsisTooltip,{text:d[1].title,className:"dial-tiny-text text-secondary"}),n.jsx("span",{className:p.value,children:d[1].value})]})]}):n.jsx("span",{className:p.value,children:t}),!a&&!i&&p.showDescription&&r!=null&&r!==!1&&n.jsx("span",{className:"dial-tiny-text text-secondary",children:r})]})},er=[{from:0,to:.1,color:"#F26B5B"},{from:.1,to:.2,color:"#E5764A"},{from:.2,to:.3,color:"#E08C3F"},{from:.3,to:.4,color:"#D9A638"},{from:.4,to:.5,color:"#D4BE3A"},{from:.5,to:.6,color:"#B8C94A"},{from:.6,to:.7,color:"#7EC96B"},{from:.7,to:.8,color:"#4ECBA8"},{from:.8,to:.9,color:"#4EC5C5"},{from:.9,to:1,color:"#4DC87A"},{from:1,to:1,color:"#30E070"}],Xn=(e,t)=>t<=0?0:Math.min(Math.max(e/t,0),1),Jn=(e,t)=>{if(e<=0)return;let r;for(const s of t)(s.from===s.to?e>=s.from:e>s.from&&e<=s.to)&&(r=s.color);return r},ut=({value:e,maxValue:t=1,error:r,isLoading:s,title:a,valueLabel:i,colorMap:o=er,className:l,titleClassName:c,valueClassName:u,inline:d,ariaLabel:p})=>{const g=e==null,f=!!(r||s||!g),m=Xn(g?0:e,t),y=Jn(m,o),x=i??(g?"—":e),v=p??(typeof a=="string"?a:void 0),C=r||s,S=r?n.jsx(Qt,{}):s?n.jsx(b.DialLoader,{fullWidth:!1}):n.jsx("span",{className:I.mergeClasses("shrink-0 tabular-nums text-end",d?"dial-small-text min-w-[5ch] text-primary":"dial-small-semi-text text-primary",u),children:x}),E=f?n.jsx("div",{role:"progressbar","aria-valuenow":r||s||typeof e!="number"?void 0:e,"aria-valuemin":0,"aria-valuemax":t,"aria-label":v,className:I.mergeClasses("w-full overflow-hidden rounded-sm",d?"h-1":"h-2",r?"bg-error":"bg-layer-1"),children:!C&&n.jsx("div",{className:"h-full rounded-sm transition-[width] duration-300",style:{width:`${m*100}%`,backgroundColor:y}})}):null,D=n.jsx("span",{className:I.mergeClasses("dial-small-text text-primary",c),children:a});return d?n.jsxs("div",{className:I.mergeClasses("flex flex-row items-center gap-2",l),children:[n.jsx("div",{className:"w-1/2 min-w-0",children:D}),n.jsxs("div",{className:"flex w-1/2 flex-row items-center gap-2",children:[n.jsx("div",{className:"min-w-0 flex-1",children:E}),S]})]}):n.jsxs("div",{className:I.mergeClasses("flex flex-col gap-1",l),children:[n.jsxs("div",{className:"flex flex-row items-center justify-between gap-2",children:[D,S]}),E]})},Ur=({title:e,description:t,children:r,expanded:s,defaultExpanded:a=!1,disabled:i,nonCollapsible:o,onToggle:l,className:c,headerClassName:u,contentClassName:d})=>{const p=s!==void 0,[g,f]=h.useState(a),m=o?!0:p?s:g,y=h.useId(),x=()=>{if(i)return;const v=!m;p||f(v),l?.(v)};return n.jsxs("div",{className:I.mergeClasses("rounded border border-secondary",c),children:[n.jsxs("button",{type:"button","aria-expanded":m,"aria-controls":y,disabled:i||o,onClick:x,className:I.mergeClasses("flex w-full items-center gap-2 p-4 text-left",i?"cursor-not-allowed":"cursor-pointer",o&&"cursor-default",u),children:[!o&&n.jsx(w.DialIcon,{className:ie("text-secondary transition-transform",m&&"rotate-90"),icon:n.jsx(H.IconChevronRight,{size:K.DIAL_ICON_SIZE.SM})}),n.jsx("span",{className:"dial-body-text text-primary",children:e}),t!=null&&t!==!1&&n.jsx("span",{className:"dial-tiny-text text-secondary",children:t})]}),m&&n.jsx("div",{id:y,role:"region",className:I.mergeClasses("px-4 pb-4",d),children:r})]})},Qn=({title:e,titleTooltip:t,description:r,data:s,compareData:a,compareLabels:i,maxValue:o,colorMap:l,defaultExpanded:c=!0,nonCollapsible:u,isLoading:d,onBarClick:p,inline:g,barTitleClassName:f,barValueClassName:m,barClassName:y,barDescriptions:x,className:v})=>{const C=Object.entries(s),S=g?I.mergeClasses("text-secondary",f):f,E=i?"dial-tiny-text text-secondary":void 0,D=t?n.jsx(T.DialTooltip,{tooltip:t,children:e}):e,j=a?[...new Set([...Object.keys(s),...Object.keys(a)])]:[],L="cursor-pointer rounded-sm text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-primary",O="group flex flex-col gap-1.5",_=I.mergeClasses("flex flex-col gap-1.5 pl-2",p&&"group-hover:bg-accent-primary-alpha group-focus-visible:bg-accent-primary-alpha",y);return n.jsx(Ur,{title:D,description:r,defaultExpanded:c,nonCollapsible:u,className:v,children:n.jsx("div",{className:I.mergeClasses("flex flex-col",a?"gap-4":g?"gap-2":"gap-3"),children:d?n.jsx(b.DialLoader,{fullWidth:!1,className:"self-center"}):a?j.map(R=>{const N=R in s?s[R]:null,k=R in a?a[R]:null,U=typeof N=="number"&&typeof k=="number"?parseFloat((k-N).toFixed(3)):null,Q=U!=null&&U!==0,V=Q&&U>0,F=Q?V?`+${U}`:String(U):null,z=x?.[R],Z=n.jsx("span",{className:"dial-small-text text-secondary",children:R}),G=n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-2",children:[z?n.jsx(T.DialTooltip,{tooltip:z,children:Z}):Z,F!=null&&n.jsx("span",{className:I.mergeClasses("dial-tiny-semi-text rounded-[120px] border border-transparent px-2",V?"bg-success text-success":"bg-error text-error"),children:F})]}),n.jsxs("div",{className:_,children:[n.jsx(ut,{title:i?.[0],value:N,maxValue:o,colorMap:l,inline:g,titleClassName:E,ariaLabel:R}),n.jsx(ut,{title:i?.[1],value:k,maxValue:o,colorMap:l,inline:g,titleClassName:E,ariaLabel:`${R} compare`})]})]});return p?n.jsx("button",{type:"button",onClick:()=>p(R,N),className:I.mergeClasses(O,L),children:G},R):n.jsx("div",{className:O,children:G},R)}):C.map(([R,N])=>{const k=n.jsx(ut,{title:R,value:N,maxValue:o,colorMap:l,inline:g,titleClassName:S,valueClassName:m,className:y}),B=p?n.jsx("button",{type:"button",onClick:()=>p(R,N),className:L,children:k}):k,U=x?.[R];return U?n.jsx(T.DialTooltip,{tooltip:U,triggerClassName:"flex flex-col",children:B},R):n.jsx(h.Fragment,{children:B},R)})})})},es="#FF4E50",ts=(e,t)=>{let r=-1;return t.forEach((s,a)=>{(s.from===s.to?e>=s.from:e>s.from&&e<=s.to)&&(r=a)}),r},mr=(e,t)=>{const r=t.map(()=>0);let s=0;e.forEach(c=>{if(c<=0){s+=1;return}const u=ts(c,t);u>=0&&(r[u]+=1)});const a=Math.max(0,s,...r),i=c=>a>0?c/a:0,o={from:0,to:0,color:es,count:s,ratio:i(s),isZeroBucket:!0},l=t.map((c,u)=>({from:c.from,to:c.to,color:c.color,count:r[u],ratio:i(r[u]),isZeroBucket:!1}));return[o,...l]},Wr=e=>e<=0?2:e%2===0?e:e+1,rs=e=>{const t=Wr(e);return[t,t/2,0]},Ot=e=>`${Math.round(e*100)/100}`,qr=(e,t)=>e===t?Ot(e):`${Ot(e)}-${Ot(t)}`,At=128,ns=(e,t)=>{const r=qr(e,t);return e===t?`scored ${r}`:`scored between ${r}`},xr=(e,t,r,s,a)=>n.jsxs("div",{className:"flex flex-col gap-0.5",children:[e&&n.jsx("strong",{children:e}),n.jsxs("span",{children:[t," out of ",r," ",s]}),n.jsx("span",{children:ns(a.from,a.to)})]}),ss=({title:e,values:t,colorMap:r=er,valueTitle:s="values",showCount:a,isLoading:i,className:o,compareValues:l,valueSetLabel:c,compareValueSetLabel:u})=>{const d=mr(t,r),p=l?mr(l,r):void 0,g=t.length,f=l?.length??0,m=Math.max(g,f),y=Wr(m),x=rs(m),v=D=>D.map(j=>({...j,ratio:y>0?j.count/y:0})),C=v(d),S=p?v(p):void 0,E=(D,j,L,O)=>{if(D.count===0)return n.jsx("div",{className:"flex h-full flex-1 items-end","aria-hidden":"true",children:n.jsx("div",{className:"min-h-2 w-full rounded-sm",style:{height:`${D.ratio*100}%`}})});const _=O?{backgroundImage:`repeating-linear-gradient(135deg, ${D.color} 0px, ${D.color} 1px, transparent 1px, transparent 4px)`,borderColor:D.color}:{backgroundColor:D.color};return n.jsx(T.DialTooltip,{placement:"bottom",tooltip:j,triggerClassName:"flex h-full flex-1 items-end",children:n.jsx("div",{role:"img","aria-label":L,className:"flex min-h-2 w-full items-center justify-center rounded-sm border border-transparent",style:{height:`${D.ratio*100}%`,..._},children:a&&n.jsx("span",{className:"dial-tiny-semi-text text-primary",children:D.count})})})};return n.jsxs("div",{className:I.mergeClasses("flex flex-col gap-2",o),children:[n.jsx("span",{className:"dial-small-text text-primary",children:e}),i?n.jsx("div",{className:"flex items-center justify-center",style:{height:At},children:n.jsx(b.DialLoader,{fullWidth:!1})}):n.jsxs("div",{className:"grid grid-cols-[auto_minmax(0,1fr)] gap-x-2 gap-y-1",children:[n.jsx("div",{"data-histogram-y-axis":!0,"aria-hidden":"true",className:"relative",style:{height:At},children:x.map((D,j)=>n.jsx("span",{className:"dial-tiny-text absolute right-0 whitespace-nowrap text-secondary",style:{top:`${j/(x.length-1)*100}%`,transform:"translateY(-50%)"},children:D},D))}),n.jsxs("div",{className:"relative min-w-0",children:[x.map((D,j)=>n.jsx("div",{"data-histogram-grid":!0,className:"pointer-events-none absolute inset-x-0 border-t border-primary",style:{top:`${j/(x.length-1)*100}%`}},D)),n.jsx("div",{className:"relative flex items-end gap-1",style:{height:At},children:S?C.map((D,j)=>{const L=S[j],O=`${D.count} out of ${g} ${s}`,_=`${L.count} out of ${f} ${s}`;return n.jsxs("div",{className:"flex h-full flex-1 items-end",children:[E(D,xr(c,D.count,g,s,D),O,!0),E(L,xr(u,L.count,f,s,L),_,!1)]},j)}):C.map((D,j)=>{const L=`${D.count} out of ${g} ${s}`;return D.count===0?n.jsx("div",{className:"flex h-full flex-1 items-end","aria-hidden":"true",children:n.jsx("div",{className:"min-h-2 w-full rounded-sm",style:{height:`${D.ratio*100}%`}})},j):n.jsx(T.DialTooltip,{placement:"bottom",tooltip:L,triggerClassName:"flex h-full flex-1 items-end",children:n.jsx("div",{role:"img","aria-label":L,className:I.mergeClasses("flex min-h-2 w-full items-center justify-center rounded-sm border","border-transparent"),style:{height:`${D.ratio*100}%`,backgroundColor:D.color},children:a&&D.count>0&&n.jsx("span",{className:"dial-tiny-semi-text text-primary",children:D.count})})},j)})})]}),n.jsx("div",{}),n.jsx("div",{"data-histogram-x-axis":!0,className:"flex gap-1",children:C.map((D,j)=>n.jsx("span",{className:"dial-caption-text flex-1 text-center text-secondary",children:qr(D.from,D.to)},j))})]})]})},as=({value:e,max:t=100,size:r=T.ElementSize.Standard,labelProps:s,valueLabel:a,id:i,className:o,"aria-label":l,...c})=>{const u=h.useId(),d=i??u,p=!!s?.label,g=p?s?.id??`${d}-label`:void 0,f=t>0?t:0,m=Number.isFinite(e)?e:0,y=Math.min(Math.max(m,0),f),x=f>0?y/f*100:0,v=n.jsx("div",{...c,id:d,role:"progressbar","aria-valuenow":y,"aria-valuemin":0,"aria-valuemax":f,"aria-labelledby":g,"aria-label":T.resolveAccessibleName(l,p?void 0:"Progress"),className:I.mergeClasses(!p&&!a&&w.DIAL_KIT_CLASS.progressBar,"w-full overflow-hidden rounded-full bg-control-disable-primary",r===T.ElementSize.Small?"h-1":"h-2",o),children:n.jsx("div",{style:{width:`${x}%`},className:"h-full rounded-full bg-control-accent transition-[width] duration-300 motion-reduce:transition-none"})});return!p&&!a?v:n.jsxs("div",{className:I.mergeClasses(w.DIAL_KIT_CLASS.progressBar,"flex w-full flex-col gap-1"),children:[n.jsxs("div",{className:"flex items-baseline gap-2",children:[s&&n.jsx(P.Label,{...s,id:g}),a&&n.jsx("span",{className:"dial-tiny-text text-secondary ml-auto shrink-0",children:a})]}),v]})},is=7,os=2,ls=e=>e<=0?[]:Array.from({length:e},(t,r)=>r+1);var ft=(e=>(e.Active="active",e.Adjacent="adjacent",e.Far="far",e))(ft||{});const cs=(e,t,r)=>e===t?"active":r<is||Math.abs(e-t)<=os?"adjacent":"far",ds=({page:e,totalPages:t,onPageChange:r,className:s})=>{const a=ls(t);return n.jsxs("nav",{"aria-label":"Pagination",className:I.mergeClasses("flex items-center gap-2",s),children:[n.jsx(T.DialIconButton,{icon:n.jsx(H.IconCaretLeftFilled,{size:K.DIAL_ICON_SIZE.SM,className:"text-secondary"}),size:T.ElementSize.Small,className:"!p-0 items-center flex justify-center",disabled:e<=1,onClick:()=>r(e-1),"aria-label":"Previous page"}),n.jsx("div",{className:"flex flex-row items-center gap-2",children:a.map(i=>{const o=cs(i,e,t);return n.jsx("button",{type:"button",onClick:()=>r(i),"aria-label":`Page ${i}`,"aria-current":i===e?"page":void 0,className:I.mergeClasses("dial-pagination-dot rounded-full focus-visible:outline outline-offset-0 transition-all duration-300 ease-in-out",o===ft.Active&&"h-[8px] w-[32px]",o===ft.Adjacent&&"size-[8px]",o===ft.Far&&"size-[4px]")},i)})}),n.jsx(T.DialIconButton,{icon:n.jsx(H.IconCaretRightFilled,{size:K.DIAL_ICON_SIZE.SM,className:"text-secondary"}),size:T.ElementSize.Small,className:"!p-0 items-center flex justify-center",disabled:e>=t,onClick:()=>r(e+1),"aria-label":"Next page"})]})},Gt=({label:e,id:t,checked:r,indeterminate:s,disabled:a,ariaLabel:i,onChange:o,className:l,...c})=>{const u=h.useCallback(f=>{o?.(f.target.checked,t)},[o,t]),d=ie("flex flex-row items-center cursor-pointer text-accent-primary small-medium min-w-0",`${r||s?"":'before:content-[""] before:inline-block before:w-[18px] before:h-[18px] before:border before:border-hover before:rounded'}`,a?"pointer-events-none text-secondary before:border-icon-secondary before:bg-layer-4":"",l),p=ie("border rounded",a?"bg-layer-4 border-icon-secondary":""),g=()=>s?n.jsx(H.IconMinus,{className:p,...K.BASE_ICON_PROPS}):r?n.jsx(H.IconCheck,{className:p,...K.BASE_ICON_PROPS}):null;return n.jsxs("label",{...c,className:d,htmlFor:t,"aria-description":c["aria-description"]||w.ariaDescription,children:[g(),e&&(typeof e=="string"?n.jsx(w.DialEllipsisTooltip,{text:e,className:"ml-2 text-primary"}):e),n.jsx("input",{type:"checkbox",role:"checkbox",name:t,onChange:u,id:t,checked:r,"aria-checked":s?"mixed":r,"aria-disabled":a||void 0,"aria-label":e?void 0:i,className:"invisible size-0"})]})};var ye=(e=>(e.VALID="valid",e.ERROR="error",e))(ye||{});const us=(e,t)=>{if(t===e.id)switch(e.status){case ye.VALID:return"border-accent-secondary text-primary";case ye.ERROR:return"border-red-900 text-primary";default:return"border-accent-primary text-primary"}switch(e.status){case ye.VALID:return"border-primary text-primary";case ye.ERROR:return"border-red-900 text-error";default:return"border-primary text-secondary"}},fs=(e,t)=>{if(t===e.id)switch(e.status){case ye.VALID:return"bg-accent-secondary";case ye.ERROR:return"bg-red-400";default:return"bg-accent-primary"}switch(e.status){case ye.VALID:return"bg-accent-secondary";case ye.ERROR:return"bg-red-400";default:return"bg-layer-4"}},ps=({step:e,index:t,currentStep:r,onChangeStep:s})=>{const a="h-[32px] flex flex-1 min-w-[180px] items-center dial-tiny-text cursor-pointer dial-step",i="w-[22px] h-[22px] flex justify-center items-center mr-2 rounded-full text-white",o=()=>r===e.id&&e.status===ye.ERROR?n.jsx(H.IconExclamationCircle,{stroke:2,size:K.DIAL_ICON_SIZE.SM}):r!==e.id&&e.status===ye.VALID?n.jsx(H.IconCheck,{stroke:2,size:K.DIAL_ICON_SIZE.SM}):t+1;return n.jsxs("button",{className:ie(a,us(e,r)),onClick:()=>s(e.id),children:[n.jsx("span",{className:ie(i,fs(e,r)),children:o()}),n.jsx("span",{children:e.name})]})},gs=({steps:e,currentStep:t,onChangeStep:r})=>{const s=a=>{const i=e.findIndex(c=>c.id===t),o=e.findIndex(c=>c.id===a);if(a===t)return;(e.slice(0,o).every(c=>c.status===ye.VALID)||o<i)&&r(a)};return n.jsx("div",{id:"steps",className:"flex gap-x-3",children:e.map((a,i)=>n.jsx(ps,{currentStep:t,onChangeStep:s,step:a,index:i},a.id))})},_t=e=>(e.toString().split(".")[1]??"").length,hs=({value:e,min:t=0,max:r=1,step:s=.1,disabled:a=!1,labelProps:i,labels:o,formatValue:l,onChange:c,className:u,trackClassName:d,fillClassName:p,thumbClassName:g,labelsClassName:f,"aria-label":m,"aria-labelledby":y,...x})=>{const v=h.useRef(null),C=Math.max(0,Math.min(100,(e-t)/(r-t)*100)),S=_t(s),E=l?l(e):e.toFixed(S),D=h.useCallback(_=>{const R=v.current;if(!R)return e;const N=R.getBoundingClientRect(),k=(_-N.left)/N.width,B=t+k*(r-t),U=_t(s),Q=parseFloat((Math.round((B-t)/s)*s+t).toFixed(U));return Math.min(r,Math.max(t,Q))},[t,r,s,e]),j=h.useCallback(_=>{a||(_.currentTarget.setPointerCapture(_.pointerId),c?.(D(_.clientX)))},[a,D,c]),L=h.useCallback(_=>{a||_.buttons===0||c?.(D(_.clientX))},[a,D,c]),O=h.useCallback(_=>{if(a)return;const R=_t(s),N=U=>parseFloat((Math.round((U-t)/s)*s+t).toFixed(R)),k=U=>Math.min(r,Math.max(t,U));let B=e;switch(_.key){case"ArrowRight":case"ArrowUp":B=k(N(e+s));break;case"ArrowLeft":case"ArrowDown":B=k(N(e-s));break;case"Home":B=t;break;case"End":B=r;break;default:return}_.preventDefault(),B!==e&&c?.(B)},[a,e,s,t,r,c]);return n.jsxs("div",{className:I.mergeClasses("flex flex-col",a&&"pointer-events-none opacity-50",u),...x,children:[i&&n.jsx(_e.DialLabel,{...i,htmlFor:x.id}),n.jsxs("div",{ref:v,className:"relative flex h-[38px] cursor-pointer items-center",onPointerDown:j,onPointerMove:L,children:[n.jsx("div",{className:I.mergeClasses("pointer-events-none absolute inset-x-0 h-3 rounded-[10px] bg-layer-1",d)}),n.jsx("div",{className:I.mergeClasses("pointer-events-none absolute left-0 h-3 rounded-[10px] bg-controls-accent-primary",p),style:{width:`${C}%`}}),n.jsx("div",{role:"slider",tabIndex:a?-1:0,"aria-valuenow":e,"aria-valuemin":t,"aria-valuemax":r,"aria-disabled":a||void 0,"aria-label":m,"aria-labelledby":y,className:I.mergeClasses("dial-small-text absolute -translate-x-1/2 flex size-[38px] cursor-grab select-none items-center justify-center rounded-full bg-layer-3 text-primary shadow focus:outline-none focus-visible:ring-2 focus-visible:ring-focus",g),style:{left:`${C}%`},onKeyDown:O,children:E})]}),o&&n.jsx("div",{className:I.mergeClasses("dial-tiny-text flex text-secondary",f),children:o.length===3?n.jsxs(n.Fragment,{children:[n.jsx("span",{children:o[0]}),n.jsx("span",{className:"flex-1 text-center",children:o[1]}),n.jsx("span",{children:o[2]})]}):n.jsxs(n.Fragment,{children:[n.jsx("span",{children:o[0]}),n.jsx("span",{className:"ml-auto",children:o[1]})]})})]})},ms=({label:e,text:t,tooltip:r,children:s,postfix:a,className:i})=>n.jsxs("div",{className:I.mergeClasses("flex flex-col",s?"":"max-w-[200px]",i),children:[e&&n.jsx("label",{className:"dial-tiny-text mb-2 text-secondary",children:e}),s||n.jsxs("div",{className:"flex flex-row items-center gap-x-2",children:[n.jsx(T.DialTooltip,{triggerClassName:"text-primary flex-1 min-w-0",tooltip:r||t,children:t}),a||null]})]}),Zr=h.createContext({dragDropManager:void 0});function De(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var br=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})(),yr=function(){return Math.random().toString(36).substring(7).split("").join(".")},vr={INIT:"@@redux/INIT"+yr(),REPLACE:"@@redux/REPLACE"+yr()};function xs(e){if(typeof e!="object"||e===null)return!1;for(var t=e;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function bs(e){if(e===void 0)return"undefined";if(e===null)return"null";var t=typeof e;switch(t){case"boolean":case"string":case"number":case"symbol":case"function":return t}if(Array.isArray(e))return"array";if(Ds(e))return"date";if(vs(e))return"error";var r=ys(e);switch(r){case"Symbol":case"Promise":case"WeakMap":case"WeakSet":case"Map":case"Set":return r}return t.slice(8,-1).toLowerCase().replace(/\s/g,"")}function ys(e){return typeof e.constructor=="function"?e.constructor.name:null}function vs(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function Ds(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function qe(e){var t=typeof e;return process.env.NODE_ENV!=="production"&&(t=bs(e)),t}function Yr(e,t,r){var s;if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(process.env.NODE_ENV==="production"?De(0):"It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.");if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(process.env.NODE_ENV==="production"?De(1):"Expected the enhancer to be a function. Instead, received: '"+qe(r)+"'");return r(Yr)(e,t)}if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?De(2):"Expected the root reducer to be a function. Instead, received: '"+qe(e)+"'");var a=e,i=t,o=[],l=o,c=!1;function u(){l===o&&(l=o.slice())}function d(){if(c)throw new Error(process.env.NODE_ENV==="production"?De(3):"You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return i}function p(y){if(typeof y!="function")throw new Error(process.env.NODE_ENV==="production"?De(4):"Expected the listener to be a function. Instead, received: '"+qe(y)+"'");if(c)throw new Error(process.env.NODE_ENV==="production"?De(5):"You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details.");var x=!0;return u(),l.push(y),function(){if(x){if(c)throw new Error(process.env.NODE_ENV==="production"?De(6):"You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.");x=!1,u();var C=l.indexOf(y);l.splice(C,1),o=null}}}function g(y){if(!xs(y))throw new Error(process.env.NODE_ENV==="production"?De(7):"Actions must be plain objects. Instead, the actual type was: '"+qe(y)+"'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.");if(typeof y.type>"u")throw new Error(process.env.NODE_ENV==="production"?De(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if(c)throw new Error(process.env.NODE_ENV==="production"?De(9):"Reducers may not dispatch actions.");try{c=!0,i=a(i,y)}finally{c=!1}for(var x=o=l,v=0;v<x.length;v++){var C=x[v];C()}return y}function f(y){if(typeof y!="function")throw new Error(process.env.NODE_ENV==="production"?De(10):"Expected the nextReducer to be a function. Instead, received: '"+qe(y));a=y,g({type:vr.REPLACE})}function m(){var y,x=p;return y={subscribe:function(C){if(typeof C!="object"||C===null)throw new Error(process.env.NODE_ENV==="production"?De(11):"Expected the observer to be an object. Instead, received: '"+qe(C)+"'");function S(){C.next&&C.next(d())}S();var E=x(S);return{unsubscribe:E}}},y[br]=function(){return this},y}return g({type:vr.INIT}),s={dispatch:g,subscribe:p,getState:d,replaceReducer:f},s[br]=m,s}function Y(e,t,...r){if(Cs()&&t===void 0)throw new Error("invariant requires an error message argument");if(!e){let s;if(t===void 0)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{let a=0;s=new Error(t.replace(/%s/g,function(){return r[a++]})),s.name="Invariant Violation"}throw s.framesToPop=1,s}}function Cs(){return typeof process<"u"&&process.env.NODE_ENV==="production"}function Is(e,t,r){return t.split(".").reduce((s,a)=>s&&s[a]?s[a]:r||null,e)}function Ss(e,t){return e.filter(r=>r!==t)}function Xr(e){return typeof e=="object"}function Ns(e,t){const r=new Map,s=i=>{r.set(i,r.has(i)?r.get(i)+1:1)};e.forEach(s),t.forEach(s);const a=[];return r.forEach((i,o)=>{i===1&&a.push(o)}),a}function js(e,t){return e.filter(r=>t.indexOf(r)>-1)}const tr="dnd-core/INIT_COORDS",yt="dnd-core/BEGIN_DRAG",rr="dnd-core/PUBLISH_DRAG_SOURCE",vt="dnd-core/HOVER",Dt="dnd-core/DROP",Ct="dnd-core/END_DRAG";function Dr(e,t){return{type:tr,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}const Ts={type:tr,payload:{clientOffset:null,sourceClientOffset:null}};function ws(e){return function(r=[],s={publishSource:!0}){const{publishSource:a=!0,clientOffset:i,getSourceClientOffset:o}=s,l=e.getMonitor(),c=e.getRegistry();e.dispatch(Dr(i)),Es(r,l,c);const u=_s(r,l);if(u==null){e.dispatch(Ts);return}let d=null;if(i){if(!o)throw new Error("getSourceClientOffset must be defined");Os(o),d=o(u)}e.dispatch(Dr(i,d));const g=c.getSource(u).beginDrag(l,u);if(g==null)return;As(g),c.pinSource(u);const f=c.getSourceType(u);return{type:yt,payload:{itemType:f,item:g,sourceId:u,clientOffset:i||null,sourceClientOffset:d||null,isSourcePublic:!!a}}}}function Es(e,t,r){Y(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach(function(s){Y(r.getSource(s),"Expected sourceIds to be registered.")})}function Os(e){Y(typeof e=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function As(e){Y(Xr(e),"Item must be an object.")}function _s(e,t){let r=null;for(let s=e.length-1;s>=0;s--)if(t.canDragSource(e[s])){r=e[s];break}return r}function Ls(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Rs(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{},s=Object.keys(r);typeof Object.getOwnPropertySymbols=="function"&&(s=s.concat(Object.getOwnPropertySymbols(r).filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable}))),s.forEach(function(a){Ls(e,a,r[a])})}return e}function ks(e){return function(r={}){const s=e.getMonitor(),a=e.getRegistry();Ps(s),Bs(s).forEach((o,l)=>{const c=Ms(o,l,a,s),u={type:Dt,payload:{dropResult:Rs({},r,c)}};e.dispatch(u)})}}function Ps(e){Y(e.isDragging(),"Cannot call drop while not dragging."),Y(!e.didDrop(),"Cannot call drop twice during one drag operation.")}function Ms(e,t,r,s){const a=r.getTarget(e);let i=a?a.drop(s,e):void 0;return Fs(i),typeof i>"u"&&(i=t===0?{}:s.getDropResult()),i}function Fs(e){Y(typeof e>"u"||Xr(e),"Drop result must either be an object or undefined.")}function Bs(e){const t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function zs(e){return function(){const r=e.getMonitor(),s=e.getRegistry();$s(r);const a=r.getSourceId();return a!=null&&(s.getSource(a,!0).endDrag(r,a),s.unpinSource()),{type:Ct}}}function $s(e){Y(e.isDragging(),"Cannot call endDrag while not dragging.")}function Vt(e,t){return t===null?e===null:Array.isArray(e)?e.some(r=>r===t):e===t}function Hs(e){return function(r,{clientOffset:s}={}){Ks(r);const a=r.slice(0),i=e.getMonitor(),o=e.getRegistry(),l=i.getItemType();return Vs(a,o,l),Gs(a,i,o),Us(a,i,o),{type:vt,payload:{targetIds:a,clientOffset:s||null}}}}function Ks(e){Y(Array.isArray(e),"Expected targetIds to be an array.")}function Gs(e,t,r){Y(t.isDragging(),"Cannot call hover while not dragging."),Y(!t.didDrop(),"Cannot call hover after drop.");for(let s=0;s<e.length;s++){const a=e[s];Y(e.lastIndexOf(a)===s,"Expected targetIds to be unique in the passed array.");const i=r.getTarget(a);Y(i,"Expected targetIds to be registered.")}}function Vs(e,t,r){for(let s=e.length-1;s>=0;s--){const a=e[s],i=t.getTargetType(a);Vt(i,r)||e.splice(s,1)}}function Us(e,t,r){e.forEach(function(s){r.getTarget(s).hover(t,s)})}function Ws(e){return function(){if(e.getMonitor().isDragging())return{type:rr}}}function qs(e){return{beginDrag:ws(e),publishDragSource:Ws(e),hover:Hs(e),drop:ks(e),endDrag:zs(e)}}class Zs{receiveBackend(t){this.backend=t}getMonitor(){return this.monitor}getBackend(){return this.backend}getRegistry(){return this.monitor.registry}getActions(){const t=this,{dispatch:r}=this.store;function s(i){return(...o)=>{const l=i.apply(t,o);typeof l<"u"&&r(l)}}const a=qs(this);return Object.keys(a).reduce((i,o)=>{const l=a[o];return i[o]=s(l),i},{})}dispatch(t){this.store.dispatch(t)}constructor(t,r){this.isSetUp=!1,this.handleRefCountChange=()=>{const s=this.store.getState().refCount>0;this.backend&&(s&&!this.isSetUp?(this.backend.setup(),this.isSetUp=!0):!s&&this.isSetUp&&(this.backend.teardown(),this.isSetUp=!1))},this.store=t,this.monitor=r,t.subscribe(this.handleRefCountChange)}}function Ys(e,t){return{x:e.x+t.x,y:e.y+t.y}}function Jr(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Xs(e){const{clientOffset:t,initialClientOffset:r,initialSourceClientOffset:s}=e;return!t||!r||!s?null:Jr(Ys(t,s),r)}function Js(e){const{clientOffset:t,initialClientOffset:r}=e;return!t||!r?null:Jr(t,r)}const rt=[],nr=[];rt.__IS_NONE__=!0;nr.__IS_ALL__=!0;function Qs(e,t){return e===rt?!1:e===nr||typeof t>"u"?!0:js(t,e).length>0}class ea{subscribeToStateChange(t,r={}){const{handlerIds:s}=r;Y(typeof t=="function","listener must be a function."),Y(typeof s>"u"||Array.isArray(s),"handlerIds, when specified, must be an array of strings.");let a=this.store.getState().stateId;const i=()=>{const o=this.store.getState(),l=o.stateId;try{l===a||l===a+1&&!Qs(o.dirtyHandlerIds,s)||t()}finally{a=l}};return this.store.subscribe(i)}subscribeToOffsetChange(t){Y(typeof t=="function","listener must be a function.");let r=this.store.getState().dragOffset;const s=()=>{const a=this.store.getState().dragOffset;a!==r&&(r=a,t())};return this.store.subscribe(s)}canDragSource(t){if(!t)return!1;const r=this.registry.getSource(t);return Y(r,`Expected to find a valid source. sourceId=${t}`),this.isDragging()?!1:r.canDrag(this,t)}canDropOnTarget(t){if(!t)return!1;const r=this.registry.getTarget(t);if(Y(r,`Expected to find a valid target. targetId=${t}`),!this.isDragging()||this.didDrop())return!1;const s=this.registry.getTargetType(t),a=this.getItemType();return Vt(s,a)&&r.canDrop(this,t)}isDragging(){return!!this.getItemType()}isDraggingSource(t){if(!t)return!1;const r=this.registry.getSource(t,!0);if(Y(r,`Expected to find a valid source. sourceId=${t}`),!this.isDragging()||!this.isSourcePublic())return!1;const s=this.registry.getSourceType(t),a=this.getItemType();return s!==a?!1:r.isDragging(this,t)}isOverTarget(t,r={shallow:!1}){if(!t)return!1;const{shallow:s}=r;if(!this.isDragging())return!1;const a=this.registry.getTargetType(t),i=this.getItemType();if(i&&!Vt(a,i))return!1;const o=this.getTargetIds();if(!o.length)return!1;const l=o.indexOf(t);return s?l===o.length-1:l>-1}getItemType(){return this.store.getState().dragOperation.itemType}getItem(){return this.store.getState().dragOperation.item}getSourceId(){return this.store.getState().dragOperation.sourceId}getTargetIds(){return this.store.getState().dragOperation.targetIds}getDropResult(){return this.store.getState().dragOperation.dropResult}didDrop(){return this.store.getState().dragOperation.didDrop}isSourcePublic(){return!!this.store.getState().dragOperation.isSourcePublic}getInitialClientOffset(){return this.store.getState().dragOffset.initialClientOffset}getInitialSourceClientOffset(){return this.store.getState().dragOffset.initialSourceClientOffset}getClientOffset(){return this.store.getState().dragOffset.clientOffset}getSourceClientOffset(){return Xs(this.store.getState().dragOffset)}getDifferenceFromInitialOffset(){return Js(this.store.getState().dragOffset)}constructor(t,r){this.store=t,this.registry=r}}const Cr=typeof global<"u"?global:self,Qr=Cr.MutationObserver||Cr.WebKitMutationObserver;function en(e){return function(){const r=setTimeout(a,0),s=setInterval(a,50);function a(){clearTimeout(r),clearInterval(s),e()}}}function ta(e){let t=1;const r=new Qr(e),s=document.createTextNode("");return r.observe(s,{characterData:!0}),function(){t=-t,s.data=t}}const ra=typeof Qr=="function"?ta:en;class na{enqueueTask(t){const{queue:r,requestFlush:s}=this;r.length||(s(),this.flushing=!0),r[r.length]=t}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{const{queue:t}=this;for(;this.index<t.length;){const r=this.index;if(this.index++,t[r].call(),this.index>this.capacity){for(let s=0,a=t.length-this.index;s<a;s++)t[s]=t[s+this.index];t.length-=this.index,this.index=0}}t.length=0,this.index=0,this.flushing=!1},this.registerPendingError=t=>{this.pendingErrors.push(t),this.requestErrorThrow()},this.requestFlush=ra(this.flush),this.requestErrorThrow=en(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}}class sa{call(){try{this.task&&this.task()}catch(t){this.onError(t)}finally{this.task=null,this.release(this)}}constructor(t,r){this.onError=t,this.release=r,this.task=null}}class aa{create(t){const r=this.freeTasks,s=r.length?r.pop():new sa(this.onError,a=>r[r.length]=a);return s.task=t,s}constructor(t){this.onError=t,this.freeTasks=[]}}const tn=new na,ia=new aa(tn.registerPendingError);function oa(e){tn.enqueueTask(ia.create(e))}const sr="dnd-core/ADD_SOURCE",ar="dnd-core/ADD_TARGET",ir="dnd-core/REMOVE_SOURCE",It="dnd-core/REMOVE_TARGET";function la(e){return{type:sr,payload:{sourceId:e}}}function ca(e){return{type:ar,payload:{targetId:e}}}function da(e){return{type:ir,payload:{sourceId:e}}}function ua(e){return{type:It,payload:{targetId:e}}}function fa(e){Y(typeof e.canDrag=="function","Expected canDrag to be a function."),Y(typeof e.beginDrag=="function","Expected beginDrag to be a function."),Y(typeof e.endDrag=="function","Expected endDrag to be a function.")}function pa(e){Y(typeof e.canDrop=="function","Expected canDrop to be a function."),Y(typeof e.hover=="function","Expected hover to be a function."),Y(typeof e.drop=="function","Expected beginDrag to be a function.")}function Ut(e,t){if(t&&Array.isArray(e)){e.forEach(r=>Ut(r,!1));return}Y(typeof e=="string"||typeof e=="symbol",t?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}var Ce;(function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"})(Ce||(Ce={}));let ga=0;function ha(){return ga++}function ma(e){const t=ha().toString();switch(e){case Ce.SOURCE:return`S${t}`;case Ce.TARGET:return`T${t}`;default:throw new Error(`Unknown Handler Role: ${e}`)}}function Ir(e){switch(e[0]){case"S":return Ce.SOURCE;case"T":return Ce.TARGET;default:throw new Error(`Cannot parse handler ID: ${e}`)}}function Sr(e,t){const r=e.entries();let s=!1;do{const{done:a,value:[,i]}=r.next();if(i===t)return!0;s=!!a}while(!s);return!1}class xa{addSource(t,r){Ut(t),fa(r);const s=this.addHandler(Ce.SOURCE,t,r);return this.store.dispatch(la(s)),s}addTarget(t,r){Ut(t,!0),pa(r);const s=this.addHandler(Ce.TARGET,t,r);return this.store.dispatch(ca(s)),s}containsHandler(t){return Sr(this.dragSources,t)||Sr(this.dropTargets,t)}getSource(t,r=!1){return Y(this.isSourceId(t),"Expected a valid source ID."),r&&t===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(t)}getTarget(t){return Y(this.isTargetId(t),"Expected a valid target ID."),this.dropTargets.get(t)}getSourceType(t){return Y(this.isSourceId(t),"Expected a valid source ID."),this.types.get(t)}getTargetType(t){return Y(this.isTargetId(t),"Expected a valid target ID."),this.types.get(t)}isSourceId(t){return Ir(t)===Ce.SOURCE}isTargetId(t){return Ir(t)===Ce.TARGET}removeSource(t){Y(this.getSource(t),"Expected an existing source."),this.store.dispatch(da(t)),oa(()=>{this.dragSources.delete(t),this.types.delete(t)})}removeTarget(t){Y(this.getTarget(t),"Expected an existing target."),this.store.dispatch(ua(t)),this.dropTargets.delete(t),this.types.delete(t)}pinSource(t){const r=this.getSource(t);Y(r,"Expected an existing source."),this.pinnedSourceId=t,this.pinnedSource=r}unpinSource(){Y(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}addHandler(t,r,s){const a=ma(t);return this.types.set(a,r),t===Ce.SOURCE?this.dragSources.set(a,s):t===Ce.TARGET&&this.dropTargets.set(a,s),a}constructor(t){this.types=new Map,this.dragSources=new Map,this.dropTargets=new Map,this.pinnedSourceId=null,this.pinnedSource=null,this.store=t}}const ba=(e,t)=>e===t;function ya(e,t){return!e&&!t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function va(e,t,r=ba){if(e.length!==t.length)return!1;for(let s=0;s<e.length;++s)if(!r(e[s],t[s]))return!1;return!0}function Da(e=rt,t){switch(t.type){case vt:break;case sr:case ar:case It:case ir:return rt;case yt:case rr:case Ct:case Dt:default:return nr}const{targetIds:r=[],prevTargetIds:s=[]}=t.payload,a=Ns(r,s);if(!(a.length>0||!va(r,s)))return rt;const o=s[s.length-1],l=r[r.length-1];return o!==l&&(o&&a.push(o),l&&a.push(l)),a}function Ca(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ia(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{},s=Object.keys(r);typeof Object.getOwnPropertySymbols=="function"&&(s=s.concat(Object.getOwnPropertySymbols(r).filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable}))),s.forEach(function(a){Ca(e,a,r[a])})}return e}const Nr={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function Sa(e=Nr,t){const{payload:r}=t;switch(t.type){case tr:case yt:return{initialSourceClientOffset:r.sourceClientOffset,initialClientOffset:r.clientOffset,clientOffset:r.clientOffset};case vt:return ya(e.clientOffset,r.clientOffset)?e:Ia({},e,{clientOffset:r.clientOffset});case Ct:case Dt:return Nr;default:return e}}function Na(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ze(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{},s=Object.keys(r);typeof Object.getOwnPropertySymbols=="function"&&(s=s.concat(Object.getOwnPropertySymbols(r).filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable}))),s.forEach(function(a){Na(e,a,r[a])})}return e}const ja={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function Ta(e=ja,t){const{payload:r}=t;switch(t.type){case yt:return Ze({},e,{itemType:r.itemType,item:r.item,sourceId:r.sourceId,isSourcePublic:r.isSourcePublic,dropResult:null,didDrop:!1});case rr:return Ze({},e,{isSourcePublic:!0});case vt:return Ze({},e,{targetIds:r.targetIds});case It:return e.targetIds.indexOf(r.targetId)===-1?e:Ze({},e,{targetIds:Ss(e.targetIds,r.targetId)});case Dt:return Ze({},e,{dropResult:r.dropResult,didDrop:!0,targetIds:[]});case Ct:return Ze({},e,{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}}function wa(e=0,t){switch(t.type){case sr:case ar:return e+1;case ir:case It:return e-1;default:return e}}function Ea(e=0){return e+1}function Oa(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Aa(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{},s=Object.keys(r);typeof Object.getOwnPropertySymbols=="function"&&(s=s.concat(Object.getOwnPropertySymbols(r).filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable}))),s.forEach(function(a){Oa(e,a,r[a])})}return e}function _a(e={},t){return{dirtyHandlerIds:Da(e.dirtyHandlerIds,{type:t.type,payload:Aa({},t.payload,{prevTargetIds:Is(e,"dragOperation.targetIds",[])})}),dragOffset:Sa(e.dragOffset,t),refCount:wa(e.refCount,t),dragOperation:Ta(e.dragOperation,t),stateId:Ea(e.stateId)}}function La(e,t=void 0,r={},s=!1){const a=Ra(s),i=new ea(a,new xa(a)),o=new Zs(a,i),l=e(o,t,r);return o.receiveBackend(l),o}function Ra(e){const t=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__;return Yr(_a,e&&t&&t({name:"dnd-core",instanceId:"dnd-core"}))}function ka(e,t){if(e==null)return{};var r=Pa(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(r[s]=e[s])}return r}function Pa(e,t){if(e==null)return{};var r={},s=Object.keys(e),a,i;for(i=0;i<s.length;i++)a=s[i],!(t.indexOf(a)>=0)&&(r[a]=e[a]);return r}let jr=0;const pt=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__");var Ma=h.memo(function(t){var{children:r}=t,s=ka(t,["children"]);const[a,i]=Fa(s);return h.useEffect(()=>{if(i){const o=rn();return++jr,()=>{--jr===0&&(o[pt]=null)}}},[]),n.jsx(Zr.Provider,{value:a,children:r})});function Fa(e){if("manager"in e)return[{dragDropManager:e.manager},!1];const t=Ba(e.backend,e.context,e.options,e.debugMode),r=!e.context;return[t,r]}function Ba(e,t=rn(),r,s){const a=t;return a[pt]||(a[pt]={dragDropManager:La(e,t,r,s)}),a[pt]}function rn(){return typeof global<"u"?global:window}var Lt,Tr;function za(){return Tr||(Tr=1,Lt=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var s,a,i;if(Array.isArray(t)){if(s=t.length,s!=r.length)return!1;for(a=s;a--!==0;)if(!e(t[a],r[a]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(i=Object.keys(t),s=i.length,s!==Object.keys(r).length)return!1;for(a=s;a--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[a]))return!1;for(a=s;a--!==0;){var o=i[a];if(!e(t[o],r[o]))return!1}return!0}return t!==t&&r!==r}),Lt}var $a=za();const Ha=b.getDefaultExportFromCjs($a),Ge=typeof window<"u"?h.useLayoutEffect:h.useEffect;function Ka(e,t,r){const[s,a]=h.useState(()=>t(e)),i=h.useCallback(()=>{const o=t(e);Ha(s,o)||(a(o),r&&r())},[s,e,r]);return Ge(i),[s,i]}function Ga(e,t,r){const[s,a]=Ka(e,t,r);return Ge(function(){const o=e.getHandlerId();if(o!=null)return e.subscribeToStateChange(a,{handlerIds:[o]})},[e,a]),s}function nn(e,t,r){return Ga(t,e||(()=>({})),()=>r.reconnect())}function sn(e,t){const r=[...t||[]];return t==null&&typeof e!="function"&&r.push(e),h.useMemo(()=>typeof e=="function"?e():e,r)}function Va(e){return h.useMemo(()=>e.hooks.dragSource(),[e])}function Ua(e){return h.useMemo(()=>e.hooks.dragPreview(),[e])}let Rt=!1,kt=!1;class Wa{receiveHandlerId(t){this.sourceId=t}getHandlerId(){return this.sourceId}canDrag(){Y(!Rt,"You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return Rt=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{Rt=!1}}isDragging(){if(!this.sourceId)return!1;Y(!kt,"You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return kt=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{kt=!1}}subscribeToStateChange(t,r){return this.internalMonitor.subscribeToStateChange(t,r)}isDraggingSource(t){return this.internalMonitor.isDraggingSource(t)}isOverTarget(t,r){return this.internalMonitor.isOverTarget(t,r)}getTargetIds(){return this.internalMonitor.getTargetIds()}isSourcePublic(){return this.internalMonitor.isSourcePublic()}getSourceId(){return this.internalMonitor.getSourceId()}subscribeToOffsetChange(t){return this.internalMonitor.subscribeToOffsetChange(t)}canDragSource(t){return this.internalMonitor.canDragSource(t)}canDropOnTarget(t){return this.internalMonitor.canDropOnTarget(t)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(t){this.sourceId=null,this.internalMonitor=t.getMonitor()}}let Pt=!1;class qa{receiveHandlerId(t){this.targetId=t}getHandlerId(){return this.targetId}subscribeToStateChange(t,r){return this.internalMonitor.subscribeToStateChange(t,r)}canDrop(){if(!this.targetId)return!1;Y(!Pt,"You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor");try{return Pt=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{Pt=!1}}isOver(t){return this.targetId?this.internalMonitor.isOverTarget(this.targetId,t):!1}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(t){this.targetId=null,this.internalMonitor=t.getMonitor()}}function Za(e,t,r){const s=r.getRegistry(),a=s.addTarget(e,t);return[a,()=>s.removeTarget(a)]}function Ya(e,t,r){const s=r.getRegistry(),a=s.addSource(e,t);return[a,()=>s.removeSource(a)]}function Wt(e,t,r,s){let a;if(a!==void 0)return!!a;if(e===t)return!0;if(typeof e!="object"||!e||typeof t!="object"||!t)return!1;const i=Object.keys(e),o=Object.keys(t);if(i.length!==o.length)return!1;const l=Object.prototype.hasOwnProperty.bind(t);for(let c=0;c<i.length;c++){const u=i[c];if(!l(u))return!1;const d=e[u],p=t[u];if(a=void 0,a===!1||a===void 0&&d!==p)return!1}return!0}function qt(e){return e!==null&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function Xa(e){if(typeof e.type=="string")return;const t=e.type.displayName||e.type.name||"the component";throw new Error(`Only native element nodes can now be passed to React DnD connectors.You can either wrap ${t} into a <div>, or turn it into a drag source or a drop target itself.`)}function Ja(e){return(t=null,r=null)=>{if(!h.isValidElement(t)){const i=t;return e(i,r),i}const s=t;return Xa(s),Qa(s,r?i=>e(i,r):e)}}function an(e){const t={};return Object.keys(e).forEach(r=>{const s=e[r];if(r.endsWith("Ref"))t[r]=e[r];else{const a=Ja(s);t[r]=()=>a}}),t}function wr(e,t){typeof e=="function"?e(t):e.current=t}function Qa(e,t){const r=e.ref;return Y(typeof r!="string","Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),r?h.cloneElement(e,{ref:s=>{wr(r,s),wr(t,s)}}):h.cloneElement(e,{ref:t})}class ei{receiveHandlerId(t){this.handlerId!==t&&(this.handlerId=t,this.reconnect())}get connectTarget(){return this.dragSource}get dragSourceOptions(){return this.dragSourceOptionsInternal}set dragSourceOptions(t){this.dragSourceOptionsInternal=t}get dragPreviewOptions(){return this.dragPreviewOptionsInternal}set dragPreviewOptions(t){this.dragPreviewOptionsInternal=t}reconnect(){const t=this.reconnectDragSource();this.reconnectDragPreview(t)}reconnectDragSource(){const t=this.dragSource,r=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();return r&&this.disconnectDragSource(),this.handlerId?t?(r&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=t,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,t,this.dragSourceOptions)),r):(this.lastConnectedDragSource=t,r):r}reconnectDragPreview(t=!1){const r=this.dragPreview,s=t||this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();if(s&&this.disconnectDragPreview(),!!this.handlerId){if(!r){this.lastConnectedDragPreview=r;return}s&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=r,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,r,this.dragPreviewOptions))}}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didConnectedDragSourceChange(){return this.lastConnectedDragSource!==this.dragSource}didConnectedDragPreviewChange(){return this.lastConnectedDragPreview!==this.dragPreview}didDragSourceOptionsChange(){return!Wt(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}didDragPreviewOptionsChange(){return!Wt(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}disconnectDragSource(){this.dragSourceUnsubscribe&&(this.dragSourceUnsubscribe(),this.dragSourceUnsubscribe=void 0)}disconnectDragPreview(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}get dragSource(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}get dragPreview(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}clearDragSource(){this.dragSourceNode=null,this.dragSourceRef=null}clearDragPreview(){this.dragPreviewNode=null,this.dragPreviewRef=null}constructor(t){this.hooks=an({dragSource:(r,s)=>{this.clearDragSource(),this.dragSourceOptions=s||null,qt(r)?this.dragSourceRef=r:this.dragSourceNode=r,this.reconnectDragSource()},dragPreview:(r,s)=>{this.clearDragPreview(),this.dragPreviewOptions=s||null,qt(r)?this.dragPreviewRef=r:this.dragPreviewNode=r,this.reconnectDragPreview()}}),this.handlerId=null,this.dragSourceRef=null,this.dragSourceOptionsInternal=null,this.dragPreviewRef=null,this.dragPreviewOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDragSource=null,this.lastConnectedDragSourceOptions=null,this.lastConnectedDragPreview=null,this.lastConnectedDragPreviewOptions=null,this.backend=t}}class ti{get connectTarget(){return this.dropTarget}reconnect(){const t=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();t&&this.disconnectDropTarget();const r=this.dropTarget;if(this.handlerId){if(!r){this.lastConnectedDropTarget=r;return}t&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=r,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,r,this.dropTargetOptions))}}receiveHandlerId(t){t!==this.handlerId&&(this.handlerId=t,this.reconnect())}get dropTargetOptions(){return this.dropTargetOptionsInternal}set dropTargetOptions(t){this.dropTargetOptionsInternal=t}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didDropTargetChange(){return this.lastConnectedDropTarget!==this.dropTarget}didOptionsChange(){return!Wt(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}disconnectDropTarget(){this.unsubscribeDropTarget&&(this.unsubscribeDropTarget(),this.unsubscribeDropTarget=void 0)}get dropTarget(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}clearDropTarget(){this.dropTargetRef=null,this.dropTargetNode=null}constructor(t){this.hooks=an({dropTarget:(r,s)=>{this.clearDropTarget(),this.dropTargetOptions=s,qt(r)?this.dropTargetRef=r:this.dropTargetNode=r,this.reconnect()}}),this.handlerId=null,this.dropTargetRef=null,this.dropTargetOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDropTarget=null,this.lastConnectedDropTargetOptions=null,this.backend=t}}function Xe(){const{dragDropManager:e}=h.useContext(Zr);return Y(e!=null,"Expected drag drop context"),e}function ri(e,t){const r=Xe(),s=h.useMemo(()=>new ei(r.getBackend()),[r]);return Ge(()=>(s.dragSourceOptions=e||null,s.reconnect(),()=>s.disconnectDragSource()),[s,e]),Ge(()=>(s.dragPreviewOptions=t||null,s.reconnect(),()=>s.disconnectDragPreview()),[s,t]),s}function ni(){const e=Xe();return h.useMemo(()=>new Wa(e),[e])}class si{beginDrag(){const t=this.spec,r=this.monitor;let s=null;return typeof t.item=="object"?s=t.item:typeof t.item=="function"?s=t.item(r):s={},s??null}canDrag(){const t=this.spec,r=this.monitor;return typeof t.canDrag=="boolean"?t.canDrag:typeof t.canDrag=="function"?t.canDrag(r):!0}isDragging(t,r){const s=this.spec,a=this.monitor,{isDragging:i}=s;return i?i(a):r===t.getSourceId()}endDrag(){const t=this.spec,r=this.monitor,s=this.connector,{end:a}=t;a&&a(r.getItem(),r),s.reconnect()}constructor(t,r,s){this.spec=t,this.monitor=r,this.connector=s}}function ai(e,t,r){const s=h.useMemo(()=>new si(e,t,r),[t,r]);return h.useEffect(()=>{s.spec=e},[e]),s}function ii(e){return h.useMemo(()=>{const t=e.type;return Y(t!=null,"spec.type must be defined"),t},[e])}function oi(e,t,r){const s=Xe(),a=ai(e,t,r),i=ii(e);Ge(function(){if(i!=null){const[l,c]=Ya(i,a,s);return t.receiveHandlerId(l),r.receiveHandlerId(l),c}},[s,t,r,a,i])}function li(e,t){const r=sn(e,t);Y(!r.begin,"useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)");const s=ni(),a=ri(r.options,r.previewOptions);return oi(r,s,a),[nn(r.collect,s,a),Va(a),Ua(a)]}function ci(e){return h.useMemo(()=>e.hooks.dropTarget(),[e])}function di(e){const t=Xe(),r=h.useMemo(()=>new ti(t.getBackend()),[t]);return Ge(()=>(r.dropTargetOptions=e||null,r.reconnect(),()=>r.disconnectDropTarget()),[e]),r}function ui(){const e=Xe();return h.useMemo(()=>new qa(e),[e])}function fi(e){const{accept:t}=e;return h.useMemo(()=>(Y(e.accept!=null,"accept must be defined"),Array.isArray(t)?t:[t]),[t])}class pi{canDrop(){const t=this.spec,r=this.monitor;return t.canDrop?t.canDrop(r.getItem(),r):!0}hover(){const t=this.spec,r=this.monitor;t.hover&&t.hover(r.getItem(),r)}drop(){const t=this.spec,r=this.monitor;if(t.drop)return t.drop(r.getItem(),r)}constructor(t,r){this.spec=t,this.monitor=r}}function gi(e,t){const r=h.useMemo(()=>new pi(e,t),[t]);return h.useEffect(()=>{r.spec=e},[e]),r}function hi(e,t,r){const s=Xe(),a=gi(e,t),i=fi(e);Ge(function(){const[l,c]=Za(i,a,s);return t.receiveHandlerId(l),r.receiveHandlerId(l),c},[s,t,a,r,i.map(o=>o.toString()).join("|")])}function or(e,t){const r=sn(e,t),s=ui(),a=di(r.options);return hi(r,s,a),[nn(r.collect,s,a),ci(a)]}const Er="column",mi="flex items-center",xi="mr-3 cursor-move text-secondary",bi=({id:e,children:t,className:r,onFind:s,onMove:a,ariaLabel:i="Drag item"})=>{const o=h.useRef(null),l=h.useRef(null),c=typeof s=="function"?s(e):-1,[{isDragging:u},d,p]=li(()=>({type:Er,item:{id:e,originalIndex:c},collect:f=>{const m=f.getItem();return{isDragging:f.isDragging()&&m?.id===e}},end:(f,m)=>{if(!f)return;!m.didDrop()&&typeof a=="function"&&f.originalIndex>-1&&a(f.id,f.originalIndex)}}),[e,c,a]),[,g]=or(()=>({accept:Er,hover:f=>{if(!(!f||f.id===e)&&typeof s=="function"&&typeof a=="function"){const m=s(e);a(f.id,m)}}}),[s,a,e]);return p(g(l)),d(o),n.jsxs("div",{ref:l,className:I.mergeClasses(mi,r),style:{opacity:u?0:1},"aria-roledescription":"Draggable item",children:[n.jsx("div",{ref:o,className:xi,"aria-label":i,children:n.jsx(H.IconGripVertical,{...K.BASE_ICON_PROPS})}),t]})},St=({iconClassName:e,label:t,...r})=>t?n.jsx(b.DialDangerButton,{...r,label:t,appearance:T.ButtonAppearance.Ghost,iconBefore:n.jsx(H.IconTrashX,{...K.BASE_ICON_PROPS,className:e||""})}):n.jsx(w.DialDangerIconButton,{...r,appearance:T.ButtonAppearance.Ghost,icon:n.jsx(H.IconTrashX,{...K.BASE_ICON_PROPS,className:e||""})}),yi=({className:e="",value:t,onChange:r,error:s,containerClassName:a,resize:i=!1,labelProps:o,caption:l,id:c,...u})=>{const d=I.mergeClasses("dial-textarea dial-input px-3 py-2",u.invalid&&"dial-input-error",u.disabled&&"dial-input-disable",i?"resize":"resize-none",e);return n.jsxs("div",{className:I.mergeClasses("flex flex-col gap-y-1",a),children:[o&&n.jsx(_e.DialLabel,{...o,htmlFor:c}),n.jsx("textarea",{id:c,value:t||"",className:d,onChange:p=>r?.(p.currentTarget.value),...u}),n.jsx(b.DialErrorText,{text:s}),!s&&n.jsx(b.DialCaptionText,{text:l})]})},vi="inline-flex items-center rounded bg-layer-3",Di="flex flex-1 items-center justify-center gap-2 h-7 px-3 py-1 border border-primary dial-small-text whitespace-nowrap focus-visible:outline outline-offset-0 focus-visible:relative focus-visible:z-10",Ci="relative z-10 bg-controls-accent-primary-alpha-active text-primary",Ii="text-secondary hover:text-primary",Si="text-controls-disable-accent cursor-not-allowed hover:text-controls-disable-accent",Ni=({options:e,value:t,onChange:r,disabled:s,className:a,ariaLabel:i})=>{const o=h.useCallback(l=>{if(s)return;const c=e.filter(g=>!g.disabled);if(c.length===0)return;const u=c.findIndex(g=>g.value===t);let d=null;switch(l.key){case"ArrowRight":case"ArrowDown":d=(u+1)%c.length;break;case"ArrowLeft":case"ArrowUp":d=(u-1+c.length)%c.length;break;case"Home":d=0;break;case"End":d=c.length-1;break;default:return}l.preventDefault();const p=c[d];p&&p.value!==t&&r(p.value)},[s,e,t,r]);return n.jsx("div",{role:"tablist","aria-label":i,className:I.mergeClasses(vi,a),children:e.map((l,c)=>{const u=l.value===t,d=c===0,p=c===e.length-1,g=s||l.disabled;return n.jsxs("button",{type:"button",role:"tab","aria-selected":u,tabIndex:u?0:-1,disabled:g,onClick:()=>r(l.value),onKeyDown:o,className:I.mergeClasses(Di,!p&&"-mr-px",d&&"rounded-l",p&&"rounded-r",u?Ci:Ii,g&&Si),children:[l.icon,l.label]},l.value)})})},Mt=8,ji=24,on=({initialTags:e=[],label:t,required:r,elementId:s,placeholder:a,captionDescription:i,errorText:o,invalid:l,disabled:c,collapseTagOverflow:u=!1,readOnly:d=!1,containerClassName:p,tagClassName:g,onChange:f})=>{const m=h.useRef(null),y=h.useRef([]),x=h.useRef(null),[v,C]=h.useState(e),[S,E]=h.useState(""),[D,j]=h.useState(!1),[L,O]=h.useState(e.length),_=h.useCallback(F=>z=>{y.current[F]=z},[]),R=h.useCallback(()=>{if(!u)return;const F=m.current;if(!F)return;const z=F.offsetWidth;if(z===0)return;const Z=x.current?.offsetWidth??0,ne=z-(d?0:ji)-Mt;let X=0,W=0;for(let se=0;se<v.length;se++){const te=y.current[se];if(!te)continue;const le=te.offsetWidth+Mt;if(X+le>ne)break;X+=le,W++}if(W<v.length&&W>0)for(;X+Z>ne&&W>0;){W--;const se=y.current[W]?.offsetWidth??0;X-=se+Mt}O(W)},[u,d,v.length]),N=F=>{const z=F.trim().replace(/,$/,"");if(z&&!v.includes(z)){const Z=[z,...v];C(Z),f?.(Z)}},k=F=>{(F.key===","||F.key==="Enter")&&(F.preventDefault(),N(S),E(""))},B=()=>{S.trim()&&(N(S),E(""))},U=F=>{const z=v.filter((Z,G)=>G!==F);C(z),f?.(z)},Q=()=>o?n.jsx(b.DialErrorText,{text:o}):i?n.jsx(b.DialCaptionText,{text:i}):null;h.useEffect(()=>{if(u)return;const F=new ResizeObserver(()=>{if(m.current){const z=m.current.scrollHeight>m.current.clientHeight+10;j(z)}});return m.current&&F.observe(m.current),()=>F.disconnect()},[v,u]),h.useEffect(()=>{if(!u){O(v.length);return}O(v.length);const F=new ResizeObserver(()=>{R()}),z=m.current;return z&&F.observe(z),R(),()=>F.disconnect()},[u,R,v]),h.useEffect(()=>{C(e)},[JSON.stringify(e)]);const V=n.jsxs("div",{ref:m,className:ie("flex gap-2 items-center relative",u?"flex-nowrap overflow-hidden w-full min-w-0":ie("flex-wrap",D?"flex-col-reverse":"flex-row"),p),children:[(u?v.slice(0,L):v).map((F,z)=>n.jsx(He,{label:F,className:g,closable:!c&&!d,onRemove:!c&&!d?()=>U(z):void 0},F+z)),u&&L<v.length&&n.jsx(T.DialTooltip,{tooltip:v.slice(L).join(", "),triggerClassName:"inline-flex shrink-0 cursor-pointer",children:n.jsx(He,{label:`+${v.length-L}`})}),!d&&n.jsx("input",{id:s,type:"text",value:S,onChange:F=>E(F.target.value),onKeyDown:k,onBlur:B,className:ie("dial-input outline-none !border-none w-full flex-1 !p-1 !h-auto",u?"min-w-0":"min-w-[100px]"),placeholder:a??"",disabled:c}),u&&n.jsxs("div",{className:"absolute left-0 top-0 invisible pointer-events-none h-0 overflow-hidden whitespace-nowrap","aria-hidden":!0,children:[v.map((F,z)=>n.jsx("div",{ref:_(z),className:"inline-flex shrink-0",children:n.jsx(He,{label:F,className:g,closable:!c&&!d,onRemove:!c&&!d?()=>U(z):void 0})},`measure-${F}-${z}`)),n.jsx("div",{ref:x,className:"inline-flex shrink-0",children:n.jsx(He,{label:`+${v.length}`})})]})]});return d?V:n.jsxs("div",{className:"flex flex-col gap-2 w-full",children:[n.jsx(_e.DialLabel,{label:t,required:r,htmlFor:s}),n.jsx("div",{className:ie("dial-input min-h-[38px] p-[6px]",l&&"dial-input-error",c&&"dial-input-disable"),children:V}),Q()]})},ln=({selectedItems:e,placeholder:t,collapseTagOverflow:r=!1,listClassName:s,listElementClassName:a})=>e?.length?n.jsx(on,{readOnly:!0,initialTags:e,collapseTagOverflow:r,containerClassName:s,tagClassName:a}):t?n.jsx("span",{className:"text-secondary",children:t}):null,Ft=e=>hr.createElement("svg",{width:18,height:18,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},hr.createElement("path",{d:"M2.25 13.5V12C2.25 11.5858 2.58579 11.25 3 11.25C3.41421 11.25 3.75 11.5858 3.75 12V13.5C3.75 13.6989 3.82907 13.8896 3.96973 14.0303C4.11038 14.1709 4.30109 14.25 4.5 14.25H6C6.41421 14.25 6.75 14.5858 6.75 15C6.75 15.4142 6.41421 15.75 6 15.75H4.5C3.90326 15.75 3.33114 15.5128 2.90918 15.0908C2.48722 14.6689 2.25 14.0967 2.25 13.5ZM14.25 6V4.5C14.25 4.30109 14.1709 4.11038 14.0303 3.96973C13.8896 3.82907 13.6989 3.75 13.5 3.75H12C11.5858 3.75 11.25 3.41421 11.25 3C11.25 2.58579 11.5858 2.25 12 2.25H13.5C14.0967 2.25 14.6689 2.48722 15.0908 2.90918C15.5128 3.33114 15.75 3.90326 15.75 4.5V6C15.75 6.41421 15.4142 6.75 15 6.75C14.5858 6.75 14.25 6.41421 14.25 6Z",fill:"currentColor"})),cn=({children:e,open:t,disabled:r=!1,selectedValue:s,valueClassName:a,inputClassName:i,onOpen:o,elementId:l,errorText:c,invalid:u,emptyValueText:d,placeholder:p,editable:g=!1,onValueChange:f,collapseTagOverflow:m=!1,iconBefore:y})=>{const x=Array.isArray(s)&&s.length>0,v=typeof s=="string"&&!!s.trim(),C=x||v?s:p?void 0:d,S=r?void 0:o,E=h.useCallback(O=>{f?.(O.target.value)},[f]),D=()=>n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:ie("dial-input px-3 py-2 dial-input-field flex flex-row items-center gap-x-2 w-full justify-between",i,r&&"dial-input-disable",(c||u)&&"dial-input-error"),children:[n.jsxs("div",{className:"flex flex-row items-center gap-x-2 flex-1 min-w-0",children:[y&&n.jsx(w.DialIcon,{icon:y}),n.jsx("input",{type:"text",className:ie("flex-1 min-w-0 bg-transparent outline-none border-none p-0 dial-small-text text-primary placeholder:text-secondary",a),value:typeof s=="string"?s:"",placeholder:p||d,onChange:E,disabled:r,id:l,"aria-label":"input-popup-field"})]}),!r&&n.jsx("button",{type:"button",className:"shrink-0 cursor-pointer bg-transparent border-none p-0 ml-1",onClick:o,"aria-label":"open-popup",children:n.jsx(w.DialIcon,{icon:n.jsx(Ft,{role:"img",width:K.BASE_ICON_SIZE,height:K.BASE_ICON_SIZE})})})]}),n.jsx(b.DialErrorText,{text:c})]}),j=()=>n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",className:"w-full",onClick:S,"aria-label":"open-popup",id:l,children:n.jsxs("div",{className:ie("dial-input px-3 py-2 dial-input-field flex flex-row items-center gap-x-2 w-full justify-between cursor-pointer",i,r&&"dial-input-disable",(c||u)&&"dial-input-error"),children:[n.jsxs("div",{className:"flex flex-row items-center gap-x-2 flex-1 min-w-0",children:[y&&n.jsx(w.DialIcon,{icon:y}),n.jsx(T.DialTooltip,{tooltip:C==null?void 0:String(C),children:C||!p?n.jsx("span",{className:a,children:C}):n.jsx("span",{className:"text-secondary",children:p})})]}),!r&&n.jsx("div",{className:"shrink-0",children:n.jsx(w.DialIcon,{icon:n.jsx(Ft,{role:"img",width:K.BASE_ICON_SIZE,height:K.BASE_ICON_SIZE})})})]})}),n.jsx(b.DialErrorText,{text:c})]}),L=()=>n.jsx("div",{className:"w-full",onClick:S,children:n.jsxs("div",{className:ie("dial-input px-3 py-2 flex flex-row items-center gap-x-2 w-full justify-between cursor-pointer",r&&"dial-input-disable"),children:[n.jsxs("div",{className:"flex flex-row items-center gap-x-2 flex-1 min-w-0",children:[y&&n.jsx(w.DialIcon,{icon:y}),n.jsx(ln,{placeholder:p,selectedItems:C,collapseTagOverflow:m})]}),!r&&n.jsx("div",{className:"ml-1",children:n.jsx(w.DialIcon,{icon:n.jsx(Ft,{role:"img",width:K.BASE_ICON_SIZE,height:K.BASE_ICON_SIZE})})})]})});return n.jsxs(n.Fragment,{children:[x?L():g?D():j(),t&&Wn.createPortal(e,document.body)]})},Ti=({label:e,htmlFor:t,disabled:r,selectedValue:s,radioButtons:a,customInputValue:i,valueClassName:o,inputClassName:l,emptyValueText:c,placeholder:u,onClose:d,header:p,portalId:g,onApply:f,onCancel:m,cancelButtonTitle:y="Cancel",applyButtonTitle:x="Apply",isValid:v,selectedRadioValue:C,onChangeRadioField:S,id:E,size:D=b.PopupSize.Md})=>{const[j,L]=h.useState(!1),O=h.useCallback(()=>{r||L(!0)},[r]),_=h.useCallback(()=>{L(!1),d?.()},[d]),R=h.useCallback(()=>{m?.(),_()},[m,_]),N=h.useCallback(()=>{f(),_()},[f,_]);return n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsx(_e.DialLabel,{label:e,htmlFor:t}),n.jsx(cn,{disabled:r,open:j,selectedValue:i??a.find(k=>k.id===s)?.name,valueClassName:o,inputClassName:ie(l,"py-2","px-3"),emptyValueText:c,placeholder:u,onOpen:O,children:n.jsx(b.DialPopup,{open:j,onClose:R,header:p,portalId:g,size:D,footer:n.jsxs("div",{className:"flex flex-row items-center justify-end gap-2 px-6 py-4",children:[n.jsx(b.DialNeutralButton,{label:y,onClick:R}),n.jsx(b.DialPrimaryButton,{label:x,onClick:N,disabled:!v})]}),children:n.jsx("div",{className:"px-6 py-4",children:n.jsx(b.DialRadioGroup,{radioButtons:a,labelClassName:"dial-small-text",activeRadioButton:C,onChange:S,elementId:E,orientation:b.RadioGroupOrientation.Column})})})})]})},wi="Create",Ei="Cancel",Oi="flex items-center justify-end gap-2 px-6 py-3",Ai=({header:e,open:t=!1,submitLabel:r=wi,cancelLabel:s=Ei,isLoading:a=!1,disableSubmitButton:i=!1,className:o,submitClassName:l,onClose:c,onSubmit:u,onCancel:d,children:p,dividers:g=!0,size:f=b.PopupSize.Md,footer:m})=>{const y=a?null:n.jsxs("div",{className:Oi,children:[n.jsx(b.DialNeutralButton,{label:s,onClick:()=>d?d():c?.()}),n.jsx(b.DialPrimaryButton,{className:l,label:r,disabled:i,onClick:()=>u()})]}),x=h.useCallback(()=>a?n.jsx("div",{className:"px-6 py-4 h-[120px]",children:n.jsx(b.DialLoader,{size:50})}):p??null,[p,a]);return n.jsx(b.DialPopup,{open:t,header:e,className:o,dividers:g,onClose:()=>c?.(),footer:m??y,size:f,children:x()})},_i=/^0+\.(\d+)?$/,Li=/^0+/,Zt=({integer:e,onChange:t,min:r,max:s,onKeyDown:a,onPaste:i,...o})=>{const l=d=>!d||d==="-"?d:String(d)?.match(_i)?String(d)?.replace(Li,"0"):Number(d),c=d=>{if([".","-","+","e","E"].includes(d.key)){d.preventDefault();return}b.handleKeyDown(d,"number",r,s)},u=d=>{const p=d.clipboardData.getData("text"),g=p.replace(/\D/g,"");if(g!==p&&(d.preventDefault(),g)){const f=d.currentTarget,m=f.selectionStart??0,y=f.selectionEnd??0,x=f.value.slice(0,m)+g+f.value.slice(y);t?.(l(x))}};return n.jsx(b.DialInput,{type:"number",min:r,max:s,onChange:d=>t?.(l(d)),onKeyDown:e?c:a,onPaste:e?u:i,...o})},Ri=({onClick:e})=>n.jsx(H.IconEyeOff,{...K.BASE_ICON_PROPS,className:"text-primary",onClick:e,role:"button","aria-label":"hide"}),ki=({onClick:e})=>n.jsx(H.IconEye,{...K.BASE_ICON_PROPS,className:"text-primary",onClick:e,role:"button","aria-label":"show"}),dn=({...e})=>{const[t,r]=h.useState(!1),s=h.useCallback(a=>{r(a)},[]);return n.jsx(b.DialInput,{type:t?"text":"password",...e,iconAfter:e.disabled?null:t?n.jsx(Ri,{onClick:()=>s(!1)}):n.jsx(ki,{onClick:()=>s(!0)})})},un=({options:e,selectedValues:t,handleRemoveTag:r})=>n.jsx("div",{className:"flex flex-wrap w-full items-center gap-1",children:t.map(s=>{const a=e.find(o=>o.value===s)?.label??s,i=e.find(o=>o.value===s)?.icon;return n.jsx(He,{label:a,onRemove:o=>r?.(o,s),icon:i?n.jsx(w.DialIcon,{icon:i}):null,className:"max-w-full"},s)})});var ht=(e=>(e.Sm="sm",e.Md="md",e))(ht||{}),mt=(e=>(e.Primary="Primary",e.Secondary="Secondary",e))(mt||{});const Pi="dial-input flex w-full items-center justify-between gap-2 dial-small-text cursor-pointer",Mi="w-full rounded flex flex-col",nt="flex w-full items-center justify-between gap-2 px-3 h-[34px] dial-small-text text-primary truncate hover:bg-accent-primary-alpha focus:bg-accent-primary-alpha focus:outline-none",Fi="bg-accent-primary-alpha",Yt="bg-accent-primary-alpha border-l border-accent-primary border-1",xt="opacity-75",Bi=352,zi=4,$i=n.jsx(H.IconChevronDown,{size:K.DIAL_ICON_SIZE.SM}),Hi=({opt:e,selectedValues:t,onSelect:r})=>{const{isOpen:s,refs:a,floatingStyles:i,context:o,getReferenceProps:l,getFloatingProps:c}=w.useSubMenuFloating(zi,"listbox",!!e.disabled),u=e.children?.some(d=>t.includes(d.value));return n.jsxs(n.Fragment,{children:[n.jsxs("button",{ref:a.setReference,type:"button",role:"option","aria-haspopup":"listbox","aria-expanded":s,"aria-selected":!!u,"aria-disabled":!!e.disabled,disabled:e.disabled,className:ie(nt,u&&Yt,e.disabled&&xt),...l(),children:[n.jsxs("div",{className:"flex items-center gap-2 w-full min-w-0",children:[e.icon&&n.jsx(w.DialIcon,{icon:e.icon}),n.jsx(w.DialEllipsisTooltip,{text:e.labelNode??e.label})]}),n.jsx(H.IconChevronRight,{size:14,className:"shrink-0"})]}),s&&n.jsx(w.SubMenuPanel,{refs:a,floatingStyles:i,context:o,getFloatingProps:c,role:"listbox",className:"w-max py-1",children:e.children.map(d=>{const p=t.includes(d.value);return n.jsx("button",{type:"button",role:"option","aria-selected":p,"aria-disabled":!!d.disabled,disabled:d.disabled,className:ie(nt,p&&Yt,d.disabled&&xt),onClick:()=>!d.disabled&&r(d.value),children:n.jsxs("div",{className:"flex items-center gap-2 w-full",children:[d.icon&&n.jsx(w.DialIcon,{icon:d.icon}),n.jsx(w.DialEllipsisTooltip,{text:d.labelNode??d.label})]})},d.value)})})]})},Ne=({options:e,multiple:t=!1,elementId:r,value:s,defaultValue:a,variant:i=mt.Primary,size:o=ht.Md,prefix:l,customSelectedValue:c,placeholder:u="Select...",searchable:d=!1,searchSize:p=T.ElementSize.Standard,searchPlaceholder:g,selectAll:f=!1,invalid:m,selectAllLabel:y="Select all",emptyStateTitle:x="No options available",emptyStateDescription:v,emptyStateIcon:C,disabled:S=!1,className:E,listClassName:D,closable:j=!1,header:L,footer:O,onClose:_,onChange:R,inlineSearch:N=!1,dismissRef:k,onFooterClick:B,open:U,onOpenChange:Q,onInlineQueryChange:V,customMultiSelectTagsRenderer:F})=>{const z=h.useId(),[Z,G]=h.useState(!1),ne=U!==void 0,X=ne?!!U:Z,W=h.useCallback(A=>{ne||G(A),Q?.(A)},[ne,Q]),[se,te]=h.useState(N&&c||""),le=h.useRef(null),ue=h.useCallback(A=>{A!==se&&(te(A||""),V?.(A||""))},[V,se]),pe=s!==void 0,[ge,fe]=h.useState(a),q=pe?s:ge,ee=h.useMemo(()=>t?Array.isArray(q)?q:[]:typeof q=="string"?[q]:[],[q,t]),Ie=h.useMemo(()=>{const A=se.trim().toLowerCase();return A?e.filter(re=>re.label.toLowerCase().includes(A)):e},[e,se]);h.useEffect(()=>{!X&&!N&&ue("")},[N,X,ue]);const Me=h.useRef(c);h.useEffect(()=>{N&&c!==Me.current&&(X||(Me.current=c,ue(c||"")))},[c,N,X,ue]);const he=h.useCallback(A=>{pe||fe(A),R?.(A)},[pe,R]),Fe=h.useCallback(A=>{if(t){const re=new Set(ee);re.has(A)?re.delete(A):re.add(A),he(Array.from(re));return}if(he(A),N){const re=e.find(xe=>xe.value===A)??e.flatMap(xe=>xe.children??[]).find(xe=>xe.value===A);re&&ue(re.label)}W(!1)},[t,he,N,W,ee,e,ue]),Te=h.useCallback((A,re)=>{if(A.stopPropagation(),!t){he("");return}const xe=ee.filter(Et=>Et!==re);he(xe)},[t,ee,he]),ae=h.useMemo(()=>Ie.filter(A=>!A.disabled),[Ie]),Le=h.useMemo(()=>ae.filter(A=>ee.includes(A.value)).length,[ae,ee]),Se=h.useCallback(A=>{N&&!t&&!A&&Fe(se),W(A)},[Fe,N,t,se,W]),{allSelectedInFiltered:Be,someSelectedInFiltered:tt}=h.useMemo(()=>{const A=ae.length>0&&Le===ae.length;return{allSelectedInFiltered:A,someSelectedInFiltered:Le>0&&!A}},[ae,Le]),ve=h.useCallback(()=>{if(!(!t||ae.length===0))if(Be){const A=new Set(ae.map(re=>re.value));he(ee.filter(re=>!A.has(re)))}else{const A=new Set(ee);ae.forEach(re=>A.add(re.value)),he(Array.from(A))}},[Be,t,ae,ee,he]),ze=ee.length>0;h.useEffect(()=>{X&&N&&!t&&!S&&requestAnimationFrame(()=>{const A=le.current;if(!A)return;A.focus();const re=A.value?.length??0;A.setSelectionRange?.(re,re)})},[X,N,t,S]);const Re=!t&&ze?ee[0]:void 0,me=h.useMemo(()=>Re?e.find(A=>A.value===Re)??e.flatMap(A=>A.children??[]).find(A=>A.value===Re):void 0,[e,Re]),wt=h.useCallback(()=>t?ze?F?.(e,ee,Te)||n.jsx(un,{options:e,selectedValues:ee,handleRemoveTag:Te}):n.jsx("span",{className:"text-secondary truncate",children:u}):me?n.jsxs(n.Fragment,{children:[me.icon&&n.jsx(w.DialIcon,{icon:me.icon}),n.jsx(w.DialEllipsisTooltip,{text:me.labelNode??(l?`${l} ${me.label}`:me.label)}),me?.description&&n.jsx("div",{className:"text-secondary dial-small-text",children:me.description})]}):c&&s?c:n.jsx("span",{className:"text-secondary truncate",children:u}),[ze,t,c,l,s,u,me,e,ee,Te,F]);h.useImperativeHandle(k,()=>({dismiss:()=>{W(!1)}}));const we=h.useCallback(()=>{ue(ee.length===1?me?.label??se:"")},[se,ee.length,ue,me?.label]),$e=h.useCallback(()=>{S||(W(!X),N&&!t&&(we(),le.current?.focus()))},[S,N,X,t,we,W]);return n.jsx(w.DialDropdown,{open:X,onOpenChange:Se,disabled:S,closable:j,onClose:_,placement:"bottom-start",allowedPlacements:["bottom-start","top-start"],maxDropdownHeight:d?null:Bi,listClassName:D,renderOverlay:()=>n.jsxs("div",{id:`list-${r||z}`,role:"listbox","aria-multiselectable":t||void 0,className:Mi,children:[L&&n.jsx(n.Fragment,{children:typeof L=="function"?L():L}),(d||j)&&e.length>8&&n.jsxs("div",{className:"flex items-center gap-2 px-2 pt-2",children:[d&&n.jsx(b.DialSearch,{size:p,placeholder:g,onChange:ue,value:se,id:`search-${r||z}`,containerClassName:I.mergeClasses(b.SIZE_CONFIG[p].containerClassName,"w-full")}),j&&n.jsx(b.DialButton,{"aria-label":"Close select",className:"shrink-0",iconBefore:n.jsx(H.IconX,{size:K.DIAL_ICON_SIZE.SM}),onClick:A=>{_?.(A),W(!1)}})]}),t&&f&&ae.length>0&&n.jsx("div",{className:ie(nt,"mt-2"),children:n.jsx(Gt,{id:`${r||z}-selectAll`,label:y,checked:Be,indeterminate:tt,onChange:ve,ariaLabel:y})}),n.jsx("div",{className:ie("overflow-y-auto max-h-[352px]",N&&Ie.length===0?"":"py-1"),children:Ie.length===0?!N&&n.jsx("div",{className:"px-2 py-3",children:n.jsx(w.DialNoDataContent,{icon:C??n.jsx(H.IconClipboardX,{size:K.DIAL_ICON_SIZE.LG,stroke:.5}),title:x,description:v})}):Ie.map(A=>{const re=ee.includes(A.value);return t?n.jsxs("div",{role:"option","aria-selected":re,"aria-disabled":!!A.disabled,className:ie(nt,re&&Fi,A.disabled&&xt,"w-full"),children:[n.jsx(Gt,{id:`${r||z}-${A.value}`,label:n.jsxs("span",{className:"flex w-full flex-1 pl-2 min-w-0 items-center gap-2 text-primary",children:[A.icon&&n.jsx(w.DialIcon,{icon:A.icon}),n.jsx("span",{className:"truncate",children:A.labelNode??A.label})]}),checked:re,disabled:A.disabled,onChange:()=>!A.disabled&&Fe(A.value),ariaLabel:A.label}),A.description&&n.jsx("div",{className:"text-secondary dial-small-text",children:A.description})]},A.value):A.children?.length?n.jsx(Hi,{opt:A,selectedValues:ee,onSelect:Fe},A.value):n.jsx("button",{role:"option",type:"button","aria-selected":re,"aria-disabled":!!A.disabled,disabled:A.disabled,className:ie(nt,re&&Yt,A.disabled&&xt),onClick:()=>!A.disabled&&Fe(A.value),children:n.jsxs("div",{className:"flex items-center gap-2 w-full",children:[A.icon&&n.jsx(w.DialIcon,{icon:A.icon}),n.jsx(w.DialEllipsisTooltip,{text:A.labelNode??A.label}),A.description&&n.jsx("div",{className:"text-secondary dial-small-text",children:A.description})]})},A.value)})}),O&&n.jsx("div",{onClick:A=>{B?.(A),B&&W(!1)},children:typeof O=="function"?O():O})]}),children:n.jsxs("div",{role:"button",tabIndex:0,"aria-roledescription":"button to open select list","aria-haspopup":"listbox","aria-expanded":X,"aria-controls":`list-${r||z}`,className:I.mergeClasses(Pi,S&&"opacity-75 !cursor-not-allowed !border-primary",o===ht.Sm?"min-h-[25px] px-1.5 py-1":"min-h-[38px] px-3 py-2",m&&"dial-input-error",i===mt.Secondary?"!bg-layer-4 !h-auto":"",E),onMouseDown:A=>{S||N&&!t&&(we(),A.preventDefault())},onClick:()=>{$e()},onKeyDown:A=>{(A.key===" "||A.code==="Space")&&(A.preventDefault(),$e())},children:[N&&!t?n.jsx("div",{className:"flex min-w-0 items-center gap-2 text-primary flex-1",children:n.jsx("input",{id:`inline-${r||z}`,type:"text",placeholder:g??u,value:se||"",onChange:A=>ue(A.currentTarget.value.trimStart()),onFocus:()=>!S&&W(!0),onMouseDown:A=>{we(),A.stopPropagation()},onClick:A=>{A.stopPropagation()},onKeyDown:A=>{A.stopPropagation()},className:"bg-transparent outline-none w-full dial-small-text",ref:le,disabled:S,"aria-disabled":S,autoComplete:"off"})}):n.jsx("div",{className:"flex w-full min-w-0 items-center gap-2 text-primary",children:wt()}),!N&&n.jsx(w.DialIcon,{icon:$i,className:ie("text-primary",X&&"rotate-180")})]})})},Ki=({label:e,required:t,captionDescription:r,containerClassName:s,selectClassName:a,error:i,id:o,caption:l,readonly:c,value:u,defaultEmptyText:d,...p})=>{const g=h.useCallback(()=>{if(!u||Array.isArray(u)&&u.length===0)return d??"None";if(Array.isArray(u))return n.jsx(un,{options:p.options,selectedValues:u});{const f=p.options?.find(m=>m.value===u);return n.jsx("span",{"aria-readonly":!0,className:"text-primary",children:f?.label||u})}},[u,p.options,d]);return n.jsx(b.DialFormItem,{id:o,label:e,required:t,description:l,error:i,captionDescription:r,className:s,readonly:c,value:g(),defaultEmptyText:d,children:n.jsx(Ne,{className:a,value:u,elementId:o,invalid:!!i,...p})})};function fn(e){let t=null;return()=>(t==null&&(t=e()),t)}function Gi(e,t){return e.filter(r=>r!==t)}function Vi(e,t){const r=new Set,s=i=>r.add(i);e.forEach(s),t.forEach(s);const a=[];return r.forEach(i=>a.push(i)),a}class Ui{enter(t){const r=this.entered.length,s=a=>this.isNodeInDocument(a)&&(!a.contains||a.contains(t));return this.entered=Vi(this.entered.filter(s),[t]),r===0&&this.entered.length>0}leave(t){const r=this.entered.length;return this.entered=Gi(this.entered.filter(this.isNodeInDocument),t),r>0&&this.entered.length===0}reset(){this.entered=[]}constructor(t){this.entered=[],this.isNodeInDocument=t}}class Wi{initializeExposedProperties(){Object.keys(this.config.exposeProperties).forEach(t=>{Object.defineProperty(this.item,t,{configurable:!0,enumerable:!0,get(){return console.warn(`Browser doesn't allow reading "${t}" until the drop event.`),null}})})}loadDataTransfer(t){if(t){const r={};Object.keys(this.config.exposeProperties).forEach(s=>{const a=this.config.exposeProperties[s];a!=null&&(r[s]={value:a(t,this.config.matchesTypes),configurable:!0,enumerable:!0})}),Object.defineProperties(this.item,r)}}canDrag(){return!0}beginDrag(){return this.item}isDragging(t,r){return r===t.getSourceId()}endDrag(){}constructor(t){this.config=t,this.item={},this.initializeExposedProperties()}}const Nt="__NATIVE_FILE__",pn="__NATIVE_URL__",gn="__NATIVE_TEXT__",hn="__NATIVE_HTML__",Or=Object.freeze(Object.defineProperty({__proto__:null,FILE:Nt,HTML:hn,TEXT:gn,URL:pn},Symbol.toStringTag,{value:"Module"}));function Bt(e,t,r){const s=t.reduce((a,i)=>a||e.getData(i),"");return s??r}const Xt={[Nt]:{exposeProperties:{files:e=>Array.prototype.slice.call(e.files),items:e=>e.items,dataTransfer:e=>e},matchesTypes:["Files"]},[hn]:{exposeProperties:{html:(e,t)=>Bt(e,t,""),dataTransfer:e=>e},matchesTypes:["Html","text/html"]},[pn]:{exposeProperties:{urls:(e,t)=>Bt(e,t,"").split(`
2
- `),dataTransfer:e=>e},matchesTypes:["Url","text/uri-list"]},[gn]:{exposeProperties:{text:(e,t)=>Bt(e,t,""),dataTransfer:e=>e},matchesTypes:["Text","text/plain"]}};function qi(e,t){const r=Xt[e];if(!r)throw new Error(`native type ${e} has no configuration`);const s=new Wi(r);return s.loadDataTransfer(t),s}function zt(e){if(!e)return null;const t=Array.prototype.slice.call(e.types||[]);return Object.keys(Xt).filter(r=>{const s=Xt[r];return s?.matchesTypes?s.matchesTypes.some(a=>t.indexOf(a)>-1):!1})[0]||null}const Zi=fn(()=>/firefox/i.test(navigator.userAgent)),mn=fn(()=>!!window.safari);class Ar{interpolate(t){const{xs:r,ys:s,c1s:a,c2s:i,c3s:o}=this;let l=r.length-1;if(t===r[l])return s[l];let c=0,u=o.length-1,d;for(;c<=u;){d=Math.floor(.5*(c+u));const f=r[d];if(f<t)c=d+1;else if(f>t)u=d-1;else return s[d]}l=Math.max(0,u);const p=t-r[l],g=p*p;return s[l]+a[l]*p+i[l]*g+o[l]*p*g}constructor(t,r){const{length:s}=t,a=[];for(let f=0;f<s;f++)a.push(f);a.sort((f,m)=>t[f]<t[m]?-1:1);const i=[],o=[];let l,c;for(let f=0;f<s-1;f++)l=t[f+1]-t[f],c=r[f+1]-r[f],i.push(l),o.push(c/l);const u=[o[0]];for(let f=0;f<i.length-1;f++){const m=o[f],y=o[f+1];if(m*y<=0)u.push(0);else{l=i[f];const x=i[f+1],v=l+x;u.push(3*v/((v+x)/m+(v+l)/y))}}u.push(o[o.length-1]);const d=[],p=[];let g;for(let f=0;f<u.length-1;f++){g=o[f];const m=u[f],y=1/i[f],x=m+u[f+1]-g-g;d.push((g-m-x)*y),p.push(x*y*y)}this.xs=t,this.ys=r,this.c1s=u,this.c2s=d,this.c3s=p}}const Yi=1;function xn(e){const t=e.nodeType===Yi?e:e.parentElement;if(!t)return null;const{top:r,left:s}=t.getBoundingClientRect();return{x:s,y:r}}function ct(e){return{x:e.clientX,y:e.clientY}}function Xi(e){var t;return e.nodeName==="IMG"&&(Zi()||!(!((t=document.documentElement)===null||t===void 0)&&t.contains(e)))}function Ji(e,t,r,s){let a=e?t.width:r,i=e?t.height:s;return mn()&&e&&(i/=window.devicePixelRatio,a/=window.devicePixelRatio),{dragPreviewWidth:a,dragPreviewHeight:i}}function Qi(e,t,r,s,a){const i=Xi(t),l=xn(i?e:t),c={x:r.x-l.x,y:r.y-l.y},{offsetWidth:u,offsetHeight:d}=e,{anchorX:p,anchorY:g}=s,{dragPreviewWidth:f,dragPreviewHeight:m}=Ji(i,t,u,d),y=()=>{let j=new Ar([0,.5,1],[c.y,c.y/d*m,c.y+m-d]).interpolate(g);return mn()&&i&&(j+=(window.devicePixelRatio-1)*m),j},x=()=>new Ar([0,.5,1],[c.x,c.x/u*f,c.x+f-u]).interpolate(p),{offsetX:v,offsetY:C}=a,S=v===0||v,E=C===0||C;return{x:S?v:x(),y:E?C:y()}}class eo{get window(){if(this.globalContext)return this.globalContext;if(typeof window<"u")return window}get document(){var t;return!((t=this.globalContext)===null||t===void 0)&&t.document?this.globalContext.document:this.window?this.window.document:void 0}get rootElement(){var t;return((t=this.optionsArgs)===null||t===void 0?void 0:t.rootElement)||this.window}constructor(t,r){this.ownerDocument=null,this.globalContext=t,this.optionsArgs=r}}function to(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _r(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{},s=Object.keys(r);typeof Object.getOwnPropertySymbols=="function"&&(s=s.concat(Object.getOwnPropertySymbols(r).filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable}))),s.forEach(function(a){to(e,a,r[a])})}return e}class ro{profile(){var t,r;return{sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,sourceNodeOptions:this.sourceNodeOptions.size,sourceNodes:this.sourceNodes.size,dragStartSourceIds:((t=this.dragStartSourceIds)===null||t===void 0?void 0:t.length)||0,dropTargetIds:this.dropTargetIds.length,dragEnterTargetIds:this.dragEnterTargetIds.length,dragOverTargetIds:((r=this.dragOverTargetIds)===null||r===void 0?void 0:r.length)||0}}get window(){return this.options.window}get document(){return this.options.document}get rootElement(){return this.options.rootElement}setup(){const t=this.rootElement;if(t!==void 0){if(t.__isReactDndBackendSetUp)throw new Error("Cannot have two HTML5 backends at the same time.");t.__isReactDndBackendSetUp=!0,this.addEventListeners(t)}}teardown(){const t=this.rootElement;if(t!==void 0&&(t.__isReactDndBackendSetUp=!1,this.removeEventListeners(this.rootElement),this.clearCurrentDragSourceNode(),this.asyncEndDragFrameId)){var r;(r=this.window)===null||r===void 0||r.cancelAnimationFrame(this.asyncEndDragFrameId)}}connectDragPreview(t,r,s){return this.sourcePreviewNodeOptions.set(t,s),this.sourcePreviewNodes.set(t,r),()=>{this.sourcePreviewNodes.delete(t),this.sourcePreviewNodeOptions.delete(t)}}connectDragSource(t,r,s){this.sourceNodes.set(t,r),this.sourceNodeOptions.set(t,s);const a=o=>this.handleDragStart(o,t),i=o=>this.handleSelectStart(o);return r.setAttribute("draggable","true"),r.addEventListener("dragstart",a),r.addEventListener("selectstart",i),()=>{this.sourceNodes.delete(t),this.sourceNodeOptions.delete(t),r.removeEventListener("dragstart",a),r.removeEventListener("selectstart",i),r.setAttribute("draggable","false")}}connectDropTarget(t,r){const s=o=>this.handleDragEnter(o,t),a=o=>this.handleDragOver(o,t),i=o=>this.handleDrop(o,t);return r.addEventListener("dragenter",s),r.addEventListener("dragover",a),r.addEventListener("drop",i),()=>{r.removeEventListener("dragenter",s),r.removeEventListener("dragover",a),r.removeEventListener("drop",i)}}addEventListeners(t){t.addEventListener&&(t.addEventListener("dragstart",this.handleTopDragStart),t.addEventListener("dragstart",this.handleTopDragStartCapture,!0),t.addEventListener("dragend",this.handleTopDragEndCapture,!0),t.addEventListener("dragenter",this.handleTopDragEnter),t.addEventListener("dragenter",this.handleTopDragEnterCapture,!0),t.addEventListener("dragleave",this.handleTopDragLeaveCapture,!0),t.addEventListener("dragover",this.handleTopDragOver),t.addEventListener("dragover",this.handleTopDragOverCapture,!0),t.addEventListener("drop",this.handleTopDrop),t.addEventListener("drop",this.handleTopDropCapture,!0))}removeEventListeners(t){t.removeEventListener&&(t.removeEventListener("dragstart",this.handleTopDragStart),t.removeEventListener("dragstart",this.handleTopDragStartCapture,!0),t.removeEventListener("dragend",this.handleTopDragEndCapture,!0),t.removeEventListener("dragenter",this.handleTopDragEnter),t.removeEventListener("dragenter",this.handleTopDragEnterCapture,!0),t.removeEventListener("dragleave",this.handleTopDragLeaveCapture,!0),t.removeEventListener("dragover",this.handleTopDragOver),t.removeEventListener("dragover",this.handleTopDragOverCapture,!0),t.removeEventListener("drop",this.handleTopDrop),t.removeEventListener("drop",this.handleTopDropCapture,!0))}getCurrentSourceNodeOptions(){const t=this.monitor.getSourceId(),r=this.sourceNodeOptions.get(t);return _r({dropEffect:this.altKeyPressed?"copy":"move"},r||{})}getCurrentDropEffect(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}getCurrentSourcePreviewNodeOptions(){const t=this.monitor.getSourceId(),r=this.sourcePreviewNodeOptions.get(t);return _r({anchorX:.5,anchorY:.5,captureDraggingState:!1},r||{})}isDraggingNativeItem(){const t=this.monitor.getItemType();return Object.keys(Or).some(r=>Or[r]===t)}beginDragNativeItem(t,r){this.clearCurrentDragSourceNode(),this.currentNativeSource=qi(t,r),this.currentNativeHandle=this.registry.addSource(t,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}setCurrentDragSourceNode(t){this.clearCurrentDragSourceNode(),this.currentDragSourceNode=t;const r=1e3;this.mouseMoveTimeoutTimer=setTimeout(()=>{var s;return(s=this.rootElement)===null||s===void 0?void 0:s.addEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)},r)}clearCurrentDragSourceNode(){if(this.currentDragSourceNode){if(this.currentDragSourceNode=null,this.rootElement){var t;(t=this.window)===null||t===void 0||t.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)}return this.mouseMoveTimeoutTimer=null,!0}return!1}handleDragStart(t,r){t.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(r))}handleDragEnter(t,r){this.dragEnterTargetIds.unshift(r)}handleDragOver(t,r){this.dragOverTargetIds===null&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(r)}handleDrop(t,r){this.dropTargetIds.unshift(r)}constructor(t,r,s){this.sourcePreviewNodes=new Map,this.sourcePreviewNodeOptions=new Map,this.sourceNodes=new Map,this.sourceNodeOptions=new Map,this.dragStartSourceIds=null,this.dropTargetIds=[],this.dragEnterTargetIds=[],this.currentNativeSource=null,this.currentNativeHandle=null,this.currentDragSourceNode=null,this.altKeyPressed=!1,this.mouseMoveTimeoutTimer=null,this.asyncEndDragFrameId=null,this.dragOverTargetIds=null,this.lastClientOffset=null,this.hoverRafId=null,this.getSourceClientOffset=a=>{const i=this.sourceNodes.get(a);return i&&xn(i)||null},this.endDragNativeItem=()=>{this.isDraggingNativeItem()&&(this.actions.endDrag(),this.currentNativeHandle&&this.registry.removeSource(this.currentNativeHandle),this.currentNativeHandle=null,this.currentNativeSource=null)},this.isNodeInDocument=a=>!!(a&&this.document&&this.document.body&&this.document.body.contains(a)),this.endDragIfSourceWasRemovedFromDOM=()=>{const a=this.currentDragSourceNode;a==null||this.isNodeInDocument(a)||(this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover())},this.scheduleHover=a=>{this.hoverRafId===null&&typeof requestAnimationFrame<"u"&&(this.hoverRafId=requestAnimationFrame(()=>{this.monitor.isDragging()&&this.actions.hover(a||[],{clientOffset:this.lastClientOffset}),this.hoverRafId=null}))},this.cancelHover=()=>{this.hoverRafId!==null&&typeof cancelAnimationFrame<"u"&&(cancelAnimationFrame(this.hoverRafId),this.hoverRafId=null)},this.handleTopDragStartCapture=()=>{this.clearCurrentDragSourceNode(),this.dragStartSourceIds=[]},this.handleTopDragStart=a=>{if(a.defaultPrevented)return;const{dragStartSourceIds:i}=this;this.dragStartSourceIds=null;const o=ct(a);this.monitor.isDragging()&&(this.actions.endDrag(),this.cancelHover()),this.actions.beginDrag(i||[],{publishSource:!1,getSourceClientOffset:this.getSourceClientOffset,clientOffset:o});const{dataTransfer:l}=a,c=zt(l);if(this.monitor.isDragging()){if(l&&typeof l.setDragImage=="function"){const d=this.monitor.getSourceId(),p=this.sourceNodes.get(d),g=this.sourcePreviewNodes.get(d)||p;if(g){const{anchorX:f,anchorY:m,offsetX:y,offsetY:x}=this.getCurrentSourcePreviewNodeOptions(),S=Qi(p,g,o,{anchorX:f,anchorY:m},{offsetX:y,offsetY:x});l.setDragImage(g,S.x,S.y)}}try{l?.setData("application/json",{})}catch{}this.setCurrentDragSourceNode(a.target);const{captureDraggingState:u}=this.getCurrentSourcePreviewNodeOptions();u?this.actions.publishDragSource():setTimeout(()=>this.actions.publishDragSource(),0)}else if(c)this.beginDragNativeItem(c);else{if(l&&!l.types&&(a.target&&!a.target.hasAttribute||!a.target.hasAttribute("draggable")))return;a.preventDefault()}},this.handleTopDragEndCapture=()=>{this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleTopDragEnterCapture=a=>{if(this.dragEnterTargetIds=[],this.isDraggingNativeItem()){var i;(i=this.currentNativeSource)===null||i===void 0||i.loadDataTransfer(a.dataTransfer)}if(!this.enterLeaveCounter.enter(a.target)||this.monitor.isDragging())return;const{dataTransfer:l}=a,c=zt(l);c&&this.beginDragNativeItem(c,l)},this.handleTopDragEnter=a=>{const{dragEnterTargetIds:i}=this;if(this.dragEnterTargetIds=[],!this.monitor.isDragging())return;this.altKeyPressed=a.altKey,i.length>0&&this.actions.hover(i,{clientOffset:ct(a)}),i.some(l=>this.monitor.canDropOnTarget(l))&&(a.preventDefault(),a.dataTransfer&&(a.dataTransfer.dropEffect=this.getCurrentDropEffect()))},this.handleTopDragOverCapture=a=>{if(this.dragOverTargetIds=[],this.isDraggingNativeItem()){var i;(i=this.currentNativeSource)===null||i===void 0||i.loadDataTransfer(a.dataTransfer)}},this.handleTopDragOver=a=>{const{dragOverTargetIds:i}=this;if(this.dragOverTargetIds=[],!this.monitor.isDragging()){a.preventDefault(),a.dataTransfer&&(a.dataTransfer.dropEffect="none");return}this.altKeyPressed=a.altKey,this.lastClientOffset=ct(a),this.scheduleHover(i),(i||[]).some(l=>this.monitor.canDropOnTarget(l))?(a.preventDefault(),a.dataTransfer&&(a.dataTransfer.dropEffect=this.getCurrentDropEffect())):this.isDraggingNativeItem()?a.preventDefault():(a.preventDefault(),a.dataTransfer&&(a.dataTransfer.dropEffect="none"))},this.handleTopDragLeaveCapture=a=>{this.isDraggingNativeItem()&&a.preventDefault(),this.enterLeaveCounter.leave(a.target)&&(this.isDraggingNativeItem()&&setTimeout(()=>this.endDragNativeItem(),0),this.cancelHover())},this.handleTopDropCapture=a=>{if(this.dropTargetIds=[],this.isDraggingNativeItem()){var i;a.preventDefault(),(i=this.currentNativeSource)===null||i===void 0||i.loadDataTransfer(a.dataTransfer)}else zt(a.dataTransfer)&&a.preventDefault();this.enterLeaveCounter.reset()},this.handleTopDrop=a=>{const{dropTargetIds:i}=this;this.dropTargetIds=[],this.actions.hover(i,{clientOffset:ct(a)}),this.actions.drop({dropEffect:this.getCurrentDropEffect()}),this.isDraggingNativeItem()?this.endDragNativeItem():this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleSelectStart=a=>{const i=a.target;typeof i.dragDrop=="function"&&(i.tagName==="INPUT"||i.tagName==="SELECT"||i.tagName==="TEXTAREA"||i.isContentEditable||(a.preventDefault(),i.dragDrop()))},this.options=new eo(r,s),this.actions=t.getActions(),this.monitor=t.getMonitor(),this.registry=t.getRegistry(),this.enterLeaveCounter=new Ui(this.isNodeInDocument)}}const no=function(t,r,s){return new ro(t,r,s)},so=({onChange:e,emptyTextFirstLine:t,emptyTextSecondLine:r,emptyButtonLabel:s,acceptTypes:a,maxFilesCount:i,multiple:o,fileFormatError:l,fileCountError:c,fileSizeError:u,getIsFileFormatError:d,getIsFileSizeError:p})=>{const g=h.useRef(null),f=h.useRef(null),[m,y]=h.useState([]),[x,v]=h.useState(!1),[C,S]=h.useState(!1),E=h.useCallback(V=>{const F=V.target.files;if(F&&F.length>0){const z=Array.from(F),Z=d?.(z),G=p?.(z);Z?v(!0):G?S(!0):e(z)}},[d,p,e]),D=h.useCallback(V=>i&&V?.length>i,[i]),j=h.useMemo(()=>x||C||D(m),[x,C,D,m]),L=()=>{y([]),v(!1),S(!1)},O=h.useMemo(()=>x?n.jsx(b.DialErrorText,{text:l}):C?n.jsx(b.DialErrorText,{text:u}):D(m)?n.jsx(b.DialErrorText,{text:c}):null,[c,l,u,m,D,x,C]);h.useEffect(()=>{L()},[a]);const[{isOver:_,canDrop:R},N]=or(()=>({accept:[Nt],drop(V){const F=V.files,z=d?.(F)??!1,Z=p?.(F)??!1,G=D?.(F)??!1;if(v(z),S(Z),z||Z||G){y(F);return}e(F),L()},collect:V=>({isOver:V.isOver(),canDrop:V.canDrop()})}),[e,d,p,D]),k=V=>{(V.key==="Enter"||V.key==="Space")&&(V.preventDefault(),f.current?.click())},B=V=>{V?.preventDefault();const F=Array.from(V.dataTransfer?.items??[]);v(!!d?.(F)),S(!!p?.(F)),y(F)},U=V=>{V.target===V.currentTarget&&L()},Q=ie("border border-dashed rounded w-full cursor-pointer relative h-full hover:border-hover",!R&&!j&&"border-primary",R&&(_?"border-accent-primary":"border-hover"),j&&"border-error");return N(g),n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:Q,ref:g,onDragOver:B,onDragLeave:U,children:[n.jsxs("label",{htmlFor:"file",tabIndex:0,onKeyDown:k,className:"flex flex-col items-center cursor-pointer size-full text-secondary dial-tiny-text justify-center",children:[t&&n.jsx("p",{className:"mb-1",children:t}),r&&n.jsx("p",{className:"mb-0.5",children:r}),s&&n.jsx(b.DialPrimaryButton,{appearance:T.ButtonAppearance.Ghost,label:s,onClick:()=>f.current?.click()})]}),n.jsx("input",{multiple:o,id:"file",type:"file",ref:f,hidden:!0,accept:a,onChange:E})]}),n.jsx(n.Fragment,{children:O})]})},ao=({iconBefore:e,className:t,...r})=>{const s=r.invalid,a=()=>n.jsx("div",{className:"mr-2",children:s?n.jsx(H.IconExclamationCircle,{...K.BASE_ICON_PROPS,className:"text-error"}):e});return n.jsx(b.DialInput,{...r,iconBefore:a(),containerClassName:ie("h-[40px] p-0",s&&"h-[60px]"),className:ie("rounded-r-none border-r-0",s&&"text-error",t)})},io=({children:e,existingFiles:t,onDrop:r,getIsFileFormatError:s,getIsFileSizeError:a,maxFilesCount:i,fileFormatError:o,fileSizeError:l,fileCountError:c})=>{const u=h.useRef(null),[d,p]=h.useState(!1),[g,f]=h.useState(!1),[m,y]=h.useState(0),x=h.useCallback(()=>{p(!1),f(!1),y(0)},[]),v=h.useCallback(_=>!!(i&&t.length+_.length>i),[i,t.length]),C=d||g,[{isOver:S,canDrop:E},D]=or(()=>({accept:[Nt],drop(_){const R=_.files,N=[...t,...R],k=s?.(R)??!1,B=a?.(R)??!1,U=v?.(R)??!1;if(p(k),f(B),k||B||U){y(R.length);return}r(N),x()},collect:_=>({isOver:_.isOver(),canDrop:_.canDrop()})}),[t,r,s,a,v,x]),j=_=>{_.preventDefault();const R=Array.from(_.dataTransfer?.items??[]);p(!!s?.(R)),f(!1),y(R.length)},L=_=>{_.target===_.currentTarget&&x()};D(u);const O=v(Array.from({length:m}));return n.jsxs("div",{className:"h-full flex flex-col",children:[n.jsx("div",{ref:u,onDragOver:j,onDragLeave:L,className:ie("flex-1 min-h-0 border border-solid rounded p-2 overflow-y-auto",!C&&!O&&(E&&S?"border-accent-primary":"border-primary"),(C||O)&&"border-error"),children:e}),d&&n.jsx(b.DialErrorText,{text:o}),g&&n.jsx(b.DialErrorText,{text:l}),!d&&!g&&O&&n.jsx(b.DialErrorText,{text:c})]})},bn=e=>{const{files:t,iconBeforeInput:r,dynamicIcon:s,onChange:a,isInvalid:i,errorText:o,removeButtonAriaLabel:l,getIsMultiFilesSizeError:c,multiFilesSizeError:u,getIsFileFormatError:d,getIsFileSizeError:p,maxFilesCount:g}=e,f=h.useCallback((x,v)=>{x.stopPropagation(),a(t?.filter(C=>C.name!==v)||[])},[a,t]),m=h.useCallback(x=>n.jsx(St,{"aria-label":l,onClick:v=>f(v,x)}),[l,f]),y=h.useMemo(()=>n.jsx("div",{className:"flex flex-col gap-y-1",children:t?.map((x,v)=>n.jsx(ao,{id:x.name,value:x.name,iconAfter:m(x.name),iconBefore:r||s?.(x.name),invalid:i?.(x),error:i?.(x)?o:""},x.name+v))}),[t,r,s,i,o,m]);return n.jsx(Ma,{backend:no,children:!t||t.length===0?n.jsx(so,{...e,onChange:a}):n.jsxs(n.Fragment,{children:[n.jsx(io,{existingFiles:t,onDrop:a,getIsFileFormatError:d,getIsFileSizeError:p,maxFilesCount:g,fileFormatError:e.fileFormatError,fileSizeError:e.fileSizeError,fileCountError:e.fileCountError,children:y}),c?.(t)&&n.jsx(b.DialErrorText,{text:u})]})})},oo=({onChange:e,fieldTitle:t,elementId:r,files:s,maxFilesCount:a,maxFileSize:i,maxMultiFilesSize:o,fileFormatError:l,fileCountError:c,fileSizeError:u,multiFilesSizeError:d,multiple:p=!0,acceptTypes:g,deleteAllButtonLabel:f,addButtonLabel:m,additionalActionButtons:y,...x})=>{const v=h.useRef(null),C=()=>v.current?.click(),S=()=>{e([])},E=h.useCallback(O=>O?.some(_=>!(g==="/"||g?.toLowerCase()?.includes(_?.type?.toLowerCase()))),[g]),D=h.useCallback(O=>{if(!i)return!1;const _=i*(1024*1024);return O?.some(R=>{const N=R.size;return!!N&&N>_})},[i]),j=h.useCallback(O=>{if(!o||!p)return!1;const _=o*1024*1024;return O.reduce((N,k)=>N+k.size,0)>_},[o,p]),L=h.useCallback(O=>{const _=O.target.files;if(_&&_.length>0){const R=Array.from(_),N=E(R),k=D(R);!N&&!k&&e([...s||[],...R])}},[E,D,e,s]);return n.jsxs("div",{className:"h-full flex flex-col",children:[n.jsxs("div",{className:"flex justify-between items-center pb-1 min-h-[42px]",children:[n.jsx(_e.DialLabel,{label:`${t}: ${p?s?.length||0:""}`,htmlFor:r}),p&&!!s?.length&&n.jsxs("div",{className:"flex flex-row items-center gap-x-2",children:[n.jsx(b.DialNeutralButton,{label:f,iconBefore:n.jsx(H.IconTrashX,{...K.BASE_ICON_PROPS}),onClick:S}),(a?a>s?.length:!0)&&n.jsx(b.DialPrimaryButton,{appearance:T.ButtonAppearance.Ghost,iconBefore:n.jsx(H.IconPlus,{...K.BASE_ICON_PROPS}),label:m,onClick:C}),y]})]}),s&&s.length>0&&n.jsx("input",{id:"file",type:"file",multiple:p,ref:v,hidden:!0,accept:g,onChange:L}),n.jsx(bn,{files:s,onChange:e,acceptTypes:g,maxFilesCount:a,multiple:p,fileFormatError:l,fileCountError:c,fileSizeError:u,multiFilesSizeError:d,getIsFileFormatError:E,getIsFileSizeError:D,getIsMultiFilesSizeError:j,...x})]})},lo=({icon:e,ariaLabel:t,size:r=T.ElementSize.Standard,disabled:s=!1,className:a,buttonClassName:i,iconClassName:o,caretIcon:l=n.jsx(H.IconChevronDown,{size:K.DIAL_ICON_SIZE.SM}),showCaret:c=!0,placement:u="bottom-start",matchReferenceWidth:d=!1,open:p,onOpenChange:g,defaultOpen:f=!1,...m})=>{const y=r===T.ElementSize.Small,[x,v]=h.useState(f),C=p??x,S=y?"w-8 px-0":"w-10 px-0",E={[T.ElementSize.Small]:"size-5",[T.ElementSize.Standard]:"size-6",[T.ElementSize.Large]:"size-7"},D=j=>{v(j),g?.(j)};return n.jsx(w.DialDropdown,{...m,disabled:s,placement:u,matchReferenceWidth:d,className:a,open:C,onOpenChange:D,defaultOpen:f,children:n.jsxs("button",{type:"button","aria-label":t,disabled:s,className:I.mergeClasses("group flex items-center justify-center rounded border border-transparent bg-layer-4 text-primary","enabled:hover:bg-accent-primary-alpha enabled:active:bg-controls-accent-primary-alpha-active","focus-visible:border-focus focus-visible:outline-none disabled:cursor-not-allowed disabled:text-controls-secondary-disable disabled:opacity-75",y?"h-8 px-2":"h-10 px-2",c?void 0:S,i),children:[n.jsx(w.DialIcon,{icon:e,className:I.mergeClasses(w.DIAL_KIT_CLASS.dropdownIcon,"flex items-center justify-center text-inherit",E[r],c&&"-mr-2",o)}),c&&n.jsxs("div",{className:I.mergeClasses(w.DIAL_KIT_CLASS.dropdownIconCaret,"relative z-10 inline-grid size-5 shrink-0 place-items-center"),children:[n.jsx("div",{className:"absolute inset-0 rounded-full bg-layer-2"}),n.jsx(w.DialIcon,{icon:l,className:I.mergeClasses("relative flex items-center justify-center text-secondary transition-transform group-hover:text-primary group-disabled:text-controls-secondary-disable",C&&"rotate-180")})]})]})})},co="application/octet-stream";function uo(e,t){if(!e||e.length===0)return[];const r=e.find(c=>c.parentPath===""&&c.nodeType==="FOLDER");if(!r)return[];const s=r.path||r.url||"",a=$t(s,!0),i=e.filter(c=>c!==r).map(c=>{const u=c.path||c.url||"",d=fo(c.nodeType),p=d===b.DialFileNodeType.FOLDER,g=$t(u,p);let f;return c.parentPath===null||c.parentPath===void 0?f=a:c.parentPath===""?f="":f=$t(c.parentPath,!0),{...c,originalPath:u,path:g,parentPath:f,nodeType:d}}),o=new Map;i.forEach(c=>{const u={...c,id:c.originalPath,name:c.name,path:c.path,parentPath:c.parentPath,nodeType:c.nodeType,resourceType:po(c.resourceType),folderId:t,updatedAt:c.updatedAt?new Date(c.updatedAt).toISOString():new Date().toISOString(),items:c.nodeType===b.DialFileNodeType.FOLDER?[]:void 0};c.nodeType===b.DialFileNodeType.ITEM&&(u.extension=go(c.name),u.contentType=c.contentType||co,u.contentLength=c.contentLength||0),o.set(c.path,u)});const l=[];return o.forEach(c=>{if(c.parentPath===a)l.push(c);else{const u=c.path.lastIndexOf(c.name||""),d=c.path.slice(0,u),p=o.get(d);p&&p.nodeType===b.DialFileNodeType.FOLDER?(p.items=p.items||[],p.items.push(c)):l.push(c)}}),l}function $t(e,t){try{let r=decodeURIComponent(e);return t?r.endsWith("/")||(r+="/"):r.endsWith("/")&&(r=r.slice(0,-1)),r}catch{return t&&!e.endsWith("/")?e+"/":!t&&e.endsWith("/")?e.slice(0,-1):e}}function fo(e){return e.toUpperCase()==="FOLDER"?b.DialFileNodeType.FOLDER:b.DialFileNodeType.ITEM}function po(e){if(!e)return;const t=e.toUpperCase();return Object.values(b.DialFileResourceType).find(s=>s.toUpperCase()===t)}function go(e){const t=e.split(".");return t.length>1?t[t.length-1]:""}function ho(e,t="Prompts",r="prompts/public/",s="root"){const a=uo(e,s);return[{id:s,name:t,path:r,parentPath:"",nodeType:b.DialFileNodeType.FOLDER,folderId:s,items:a}]}const yn=({locale:e,timeZone:t,date:r=new Date}={})=>{const s=t??Intl.DateTimeFormat().resolvedOptions().timeZone;try{const a=new Intl.DateTimeFormat(e,{timeZone:s,timeZoneName:"longOffset"}).formatToParts(r).find(i=>i.type==="timeZoneName")?.value;return a?`(${a}) ${s}`:s}catch{return s}};var Ye=(e=>(e.Sections="sections",e.Flat="flat",e.FlatSections="flat-sections",e))(Ye||{}),at=(e=>(e.Select="select",e.Radio="radio",e))(at||{}),jt=(e=>(e.Row="row",e.Column="column",e))(jt||{}),$=(e=>(e.String="string",e.Number="number",e.Integer="integer",e.Boolean="boolean",e.Object="object",e.Array="array",e.Null="null",e))($||{});const mo={noItemSchema:"No item schema defined.",noItemsYet:"No items yet. Add one below.",addItem:"Add Item",selectTypeToAdd:"Select type to add…",noConfigurableProperties:"No configurable properties.",noFieldsYet:"No fields yet. Add one below.",keyColumnHeader:"Key",valueColumnHeader:"Value",addField:"Add Field",keyInputPlaceholder:"Enter key",stringInputPlaceholder:"Enter a value",integerInputPlaceholder:"Enter a whole number",numberInputPlaceholder:"Enter a number",enumSelectPlaceholder:"Select an option",selectTypePlaceholder:"Select type",removeItemAriaLabel:"Remove item",removeFieldAriaLabel:"Remove field",typeColumnHeader:"Type",entryTypeString:"String",entryTypeNumber:"Number",entryTypeBoolean:"Boolean",entryTypeNull:"Null",entryTypeObject:"Object",entryTypeArray:"Array",entryTypeChangeWarning:"Changing type will reset the current value.",booleanTrueOption:"True",booleanFalseOption:"False",invalidJsonError:"Invalid JSON"},vn=h.createContext(null);function je(){const e=h.useContext(vn);if(!e)throw new Error("useSchemaContext must be used inside DialSchemaRenderer");return e}function Lr(e,t){const r={...e,...t};return(e.properties||t.properties)&&(r.properties={...e.properties,...t.properties}),(e.required||t.required)&&(r.required=Array.from(new Set([...e.required??[],...t.required??[]]))),r}function J(e,t,r=0){if(r>10)return e;let s=e;if(s.$ref){const a=s.$ref.replace(/^#\//,"").split("/");let i=t;for(const d of a)i=i?.[d];if(!i||typeof i!="object")return e;const{$ref:o,...l}=s,c=i;s={...c.$ref?J(c,t,r+1):c,...l}}if(s.allOf&&s.allOf.length>0){const{allOf:a,...i}=s;let o={};for(const l of a)o=Lr(o,J(l,t,r+1));s=Lr(o,i)}return s}function Dn(e){return e.map((t,r)=>({entry:t,index:r})).sort((t,r)=>{const s=t.entry[1]["dial:meta"]?.["dial:propertyOrder"]??1/0,a=r.entry[1]["dial:meta"]?.["dial:propertyOrder"]??1/0;return s!==a?s-a:t.index-r.index}).map(({entry:t})=>t)}function Tt(e){return e==null||e===""}function We(e){return e.type===$.Object||e.properties!=null&&e.oneOf==null&&e.anyOf==null&&e.type==null}function bt(e){return e.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/\b\w/g,t=>t.toUpperCase())}function Cn(e,t){return e.type===$.Null?"null":e.$ref?J(e,t).title??e.$ref.split("/").pop()??"Option":e.title?e.title:e.type?Array.isArray(e.type)?e.type.join(" | "):e.type:e.discriminator?Object.keys(e.discriminator.mapping).join(" | "):e.const!=null?String(e.const):e.oneOf?"One of options":"Option"}function Oe(e,t,r=0){if(r>15)return;const s=J(e,t);if("default"in s)return s.default;if(s.discriminator&&s.oneOf){const a=Object.keys(s.discriminator.mapping)[0];if(a){const i=J({$ref:s.discriminator.mapping[a]},t);return{...Oe(i,t,r+1)??{},[s.discriminator.propertyName]:a}}}if(We(s)){if(s.properties){const a={};let i=!1;for(const[o,l]of Object.entries(s.properties)){const c=Oe(l,t,r+1);c!==void 0&&(a[o]=c,i=!0)}return i?a:void 0}if(s.additionalProperties!=null&&s.additionalProperties!==!1)return{}}}function Ee(e,t,r,s="",a=0){if(a>15)return[];const i=[],o=J(t,r);if(o.anyOf){const u=o.anyOf.filter(d=>d.type!==$.Null);return e!=null&&u.length===1?Ee(e,u[0],r,s,a+1):i}if(o.oneOf&&o.discriminator){const u=o.discriminator.propertyName,d=e?.[u];if(d&&o.discriminator.mapping[d]){const p={$ref:o.discriminator.mapping[d]},g=J(p,r);return Ee(e,g,r,s,a+1)}return i}if(o.type===$.Array||!o.type&&Array.isArray(e)){if(Array.isArray(e)&&o.items)for(let u=0;u<e.length;u++){const d=Ee(e[u],o.items,r,`${s}[${u}]`,a+1);i.push(...d)}return i}if(!We(o))return i;const l=o.required??[],c=e;for(const u of l){const d=o.properties?.[u];if(d&&J(d,r).isHidden)continue;const p=s?`${s}.${u}`:u,g=c?.[u];if(Tt(g)){const f=d?.title??bt(u);i.push({path:p,message:`${f} is required`})}}if(c&&o.properties)for(const[u,d]of Object.entries(o.properties)){if(J(d,r).isHidden)continue;const p=s?`${s}.${u}`:u,g=c[u];if(g!=null){const f=Ee(g,d,r,p,a+1);i.push(...f)}}if(c&&o.additionalProperties!=null&&o.additionalProperties!==!1&&typeof o.additionalProperties=="object"){const u=o.additionalProperties;for(const[d,p]of Object.entries(c)){const g=s?`${s}.${d}`:d,f=Ee(p,u,r,g,a+1);i.push(...f)}}return i}function lr(e,t,r){const s=J(t,r);if(Array.isArray(e))return`${e.length} item${e.length!==1?"s":""}`;if(We(s)&&s.properties){const a=Object.entries(s.properties).filter(([,c])=>!J(c,r).isHidden),i=a.length,o=e;return`${a.filter(([c])=>{const u=o?.[c];return u!=null&&u!==""}).length}/${i} fields`}return""}function xo(e,t,r){if(e==null){const s=t.findIndex(a=>a.type===$.Null);return s>=0?s:0}if(Array.isArray(e)){const s=t.findIndex(a=>J(a,r).type===$.Array);return s>=0?s:0}if(typeof e=="boolean"){const s=t.findIndex(a=>J(a,r).type===$.Boolean);return s>=0?s:0}if(typeof e=="number"){const s=t.findIndex(a=>{const i=J(a,r);return i.type===$.Number||i.type===$.Integer});return s>=0?s:0}if(typeof e=="string"){const s=t.findIndex(a=>J(a,r).type===$.String);return s>=0?s:0}if(typeof e=="object"){const s=e;for(let a=0;a<t.length;a++){const i=J(t[a],r);if(i.discriminator&&i.discriminator.propertyName in s)return a}for(let a=0;a<t.length;a++){const i=J(t[a],r);if(We(i)||i.oneOf)return a}return 0}return 0}function bo(e,t,r){if(t&&typeof e=="object"&&e!==null){const s=e[t];if(s)return`Item ${r+1}: ${s}`}if(typeof e=="object"&&e!==null){const s=e,a=s.name??s.title??s.id;if(a)return`Item ${r+1}: ${a}`}return`Item ${r+1}`}function In(e){switch(Array.isArray(e.type)?e.type[0]:e.type){case $.String:return"";case $.Boolean:return!1;case $.Array:return[];case $.Integer:case $.Number:return;default:return{}}}const yo=[$.String,$.Number,$.Boolean,$.Null,$.Object,$.Array];function vo(e){return Array.isArray(e)?$.Array:typeof e=="object"&&e!==null?$.Object:typeof e=="boolean"?$.Boolean:typeof e=="number"?$.Number:e===null?$.Null:$.String}const Do={[$.String]:"",[$.Number]:0,[$.Boolean]:!1,[$.Null]:null,[$.Object]:{},[$.Array]:[]};function Co(e){return Do[e]}const it=({title:e,description:t,summary:r,errorCount:s=0,level:a=0,children:i,onRemove:o,defaultExpanded:l=!0,removeItemAriaLabel:c="Remove item"})=>{const[u,d]=h.useState(l),p=a===0,g="rounded border border-secondary",f=I.mergeClasses("flex items-center gap-2 cursor-pointer select-none transition-colors",p?"px-4 py-3 bg-layer-3 hover:bg-layer-4":"px-3 py-2 bg-layer-4 hover:bg-layer-3",u?"rounded-t":"rounded"),m=I.mergeClasses("border-t border-secondary",p?"p-4":"p-3");return n.jsxs("div",{className:g,children:[n.jsxs("div",{className:f,onClick:()=>d(y=>!y),role:"button","aria-expanded":u,children:[n.jsx("span",{className:"shrink-0 text-secondary",children:u?n.jsx(H.IconChevronDown,{size:16,stroke:2}):n.jsx(H.IconChevronRight,{size:16,stroke:2})}),n.jsx("span",{className:I.mergeClasses("flex-1 truncate",p?"dial-small-semi-text text-primary":"dial-small-text text-primary"),children:e}),t&&n.jsx(_e.DialInfoButton,{caption:t}),r&&n.jsx("span",{className:"dial-tiny-text text-secondary whitespace-nowrap ml-2",children:r}),s>0?n.jsxs("span",{className:"flex items-center gap-1 dial-tiny-text text-error whitespace-nowrap",children:[n.jsx(w.DialIcon,{icon:n.jsx(H.IconAlertTriangle,{size:13,stroke:2})}),s," error",s>1?"s":""]}):n.jsx(w.DialIcon,{icon:n.jsx(H.IconCheck,{size:13,stroke:2}),className:"text-success shrink-0"}),o&&n.jsx(St,{size:T.ElementSize.Small,onClick:y=>{y.stopPropagation(),o()},"aria-label":c,className:"ml-1 shrink-0 p-0.5"})]}),u&&n.jsx("div",{className:m,children:i})]})},Sn=({schema:e,value:t,onChange:r,path:s,level:a=0,required:i,label:o})=>{const{rootSchema:l,defaultExpanded:c=!0,touchedPaths:u=new Set,skipUntouched:d=!1}=je(),p=J(e,l),g=We(p),f=p.type===$.Array;if(g||f){const x=lr(t,p,l),v=Ee(t,p,l,s.join(".")),C=s.join("."),S=C+".",E=!d||u.has(C)||[...u].some(D=>D.startsWith(S));return n.jsx(it,{title:o??p.title??s[s.length-1]??"Section",description:p.description,level:a,summary:x,errorCount:E?v.length:0,defaultExpanded:c,children:n.jsx(Ae,{schema:p,value:t,onChange:r,path:s,level:a+1,required:i})})}const y=(!d||u.has(s.join(".")))&&i&&Tt(t)?`${o??"Field"} is required`:void 0;return n.jsx(b.DialFormItem,{label:o,required:i,description:p.description,error:y,children:n.jsx(Ae,{schema:p,value:t,onChange:r,path:s,level:a,required:i,suppressInlineError:!0})})},gt=({schema:e,value:t,onChange:r,path:s,level:a})=>{const{rootSchema:i,texts:o}=je(),l=J(e,i),c=Dn(Object.entries(l.properties??{}).filter(([,p])=>!J(p,i).isHidden)),u=l.required??[],d=t??{};return c.length===0?n.jsx("p",{className:"dial-tiny-text text-secondary italic",children:o.noConfigurableProperties}):n.jsx("div",{className:"flex flex-col gap-4",children:c.map(([p,g])=>{const m=J(g,i).title??g.title??bt(p),y=u.includes(p);return n.jsx(Sn,{schema:g,value:d[p],onChange:x=>r({...d,[p]:x}),path:[...s,p],level:a,required:y,label:m},p)})})},Io=({schema:e,value:t,onChange:r,path:s,level:a})=>{const{rootSchema:i,texts:o,readonly:l=!1,defaultExpanded:c=!0}=je(),u=Array.isArray(t)?t:[],d=e.items,[p,g]=h.useState(void 0);if(!d)return n.jsx("p",{className:"dial-tiny-text text-secondary italic",children:o.noItemSchema});const f=h.useMemo(()=>J(d,i),[d,i]),m=h.useMemo(()=>f.discriminator,[f]),y=h.useMemo(()=>m?.propertyName,[m]),x=h.useMemo(()=>m?Object.keys(m.mapping).map(E=>({value:E,label:E})):[],[m]),v=()=>{const E=p??x[0]?.value;let D;if(m&&E){const j=J({$ref:m.mapping[E]},i);D={...Oe(j,i)??{},[m.propertyName]:E}}else D=Oe(f,i)??In(f);r([...u,D])},C=E=>{r(u.filter((D,j)=>j!==E))},S=(E,D)=>{r(u.map((j,L)=>L===E?D:j))};return n.jsxs("div",{className:"flex flex-col gap-3",children:[u.length===0&&n.jsx("p",{className:"dial-tiny-text text-secondary italic",children:o.noItemsYet}),u.map((E,D)=>{const j=bo(E,y,D),L=lr(E,f,i),O=Ee(E,f,i,`${s.join(".")}[${D}]`);return n.jsx(it,{title:j,level:a,summary:L,errorCount:O.length,onRemove:l?void 0:()=>C(D),defaultExpanded:c,removeItemAriaLabel:o.removeItemAriaLabel,children:n.jsx(Ae,{schema:d,value:E,onChange:_=>S(D,_),path:[...s,String(D)],level:a+1})},D)}),!l&&n.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[x.length>0&&n.jsx("div",{className:"flex-1 max-w-[280px]",children:n.jsx(Ne,{options:x,value:p??x[0]?.value,placeholder:o.selectTypeToAdd,onChange:E=>{const D=typeof E=="string"?E:E[0];g(D)}})}),n.jsx(b.DialGhostButton,{label:o.addItem,iconBefore:n.jsx(H.IconPlus,{size:16,stroke:2}),onClick:v})]})]})},So=({schema:e,value:t,onChange:r,path:s,level:a})=>{const{rootSchema:i,texts:o,readonly:l=!1}=je(),c=h.useId(),u=e.discriminator;if(u){const x=u.propertyName,v=u.mapping,C=Object.keys(v).map(j=>({value:j,label:j})),S=typeof t=="object"&&t!==null?t[x]:void 0,E=S?J({$ref:v[S]},i):void 0,D=j=>{const L=J({$ref:v[j]},i),O=Oe(L,i)??{};r({...O,[x]:j})};if(e.discriminatorDisplay===at.Radio){const j=e.discriminatorOrientation===jt.Row,L=S?(()=>{const O=J({$ref:v[S]},i),{[x]:_,...R}=O.properties??{};return{...O,properties:R}})():void 0;return j?n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx("div",{role:"radiogroup",className:"flex flex-row flex-wrap gap-4",children:Object.keys(v).map(O=>{const _=J({$ref:v[O]},i);return n.jsx(w.DialRadioButton,{name:c,value:O,inputId:`${c}-${O}`,label:_.title??O,checked:S===O,disabled:l,onChange:()=>D(O)},O)})}),L&&n.jsx(gt,{schema:L,value:t,onChange:r,path:s,level:a})]}):n.jsx("div",{role:"radiogroup",className:"flex flex-col gap-2",children:Object.keys(v).map(O=>{const _=J({$ref:v[O]},i),R=S===O,{[x]:N,...k}=_.properties??{},B={..._,properties:k};return n.jsxs("div",{className:"flex flex-col",children:[n.jsx(w.DialRadioButton,{name:c,value:O,inputId:`${c}-${O}`,label:_.title??O,checked:R,disabled:l,onChange:()=>D(O)}),R&&n.jsx("div",{className:"ml-6 mt-2",children:n.jsx(gt,{schema:B,value:t,onChange:r,path:s,level:a})})]},O)})})}return n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx("div",{className:"flex-1 max-w-[280px]",children:n.jsx(Ne,{options:C,value:S,placeholder:o.selectTypePlaceholder,disabled:l,onChange:j=>{const L=typeof j=="string"?j:j[0];L&&D(L)}})}),E&&n.jsx("div",{className:"pl-3",children:n.jsx(gt,{schema:E,value:t,onChange:r,path:s,level:a})})]})}const d=e.oneOf??[],g=(()=>{if(t==null)return 0;if(typeof t=="object"&&!Array.isArray(t)){for(let x=0;x<d.length;x++)if(J(d[x],i).required?.every(C=>C in t))return x}return 0})(),f=x=>{const v=J(d[x],i),C=Oe(v,i);r(C??null)},m=d[g];if(e.discriminatorDisplay===at.Radio)return n.jsx("div",{role:"radiogroup",className:"flex flex-col gap-2",children:d.map((x,v)=>{const C=J(x,i),S=Cn(x,i)??`Option ${v+1}`,E=g===v;return n.jsxs("div",{className:"flex flex-col",children:[n.jsx(w.DialRadioButton,{name:c,value:String(v),inputId:`${c}-${v}`,label:S,checked:E,disabled:l,onChange:()=>f(v)}),E&&C&&n.jsx("div",{className:"ml-6 mt-2",children:n.jsx(Ae,{schema:C,value:t,onChange:r,path:s,level:a})})]},v)})});const y=d.map((x,v)=>{const C=J(x,i);return{value:String(v),label:C.title??`Option ${v+1}`}});return n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx("div",{className:"flex-1 max-w-[280px]",children:n.jsx(Ne,{options:y,value:String(g),disabled:l,onChange:x=>{const v=typeof x=="string"?x:x[0];f(Number(v))}})}),m&&n.jsx("div",{className:"pl-3 border-l-2 border-secondary",children:n.jsx(Ae,{schema:m,value:t,onChange:r,path:s,level:a})})]})},No=({schema:e,value:t,onChange:r,path:s,level:a})=>{const{rootSchema:i,readonly:o=!1}=je(),l=e.anyOf??[],c=l.map((m,y)=>({value:String(y),label:Cn(m,i)})),u=xo(t,l,i),d=l[u],g=J(d,i).type===$.Null,f=m=>{const y=J(l[m],i);if(y.type===$.Null){r(null);return}const x=Oe(y,i);if(x!==void 0){r(x);return}switch(y.type){case $.Array:r([]);break;case $.String:r("");break;case $.Boolean:r(!1);break;case $.Integer:case $.Number:r(0);break;default:r({});break}};return n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx("div",{className:"flex-1 max-w-[280px]",children:n.jsx(Ne,{options:c,value:String(u),disabled:o,onChange:m=>{const y=typeof m=="string"?m:m[0];f(Number(y))}})}),!g&&d&&n.jsx("div",{className:"pl-3 border-l-2 border-secondary",children:n.jsx(Ae,{schema:d,value:t,onChange:r,path:s,level:a})})]})},Nn=({schema:e,value:t,onChange:r,invalid:s})=>{const a=h.useId(),{texts:i,readonly:o=!1,inputClassName:l,acceptableResourceTypes:c}=je(),u=e.const!==void 0,d=Array.isArray(e.enum)&&e.enum.length>0;if(e["dial:resource"]===!0&&Array.isArray(e.acceptableResourceTypes)&&e.acceptableResourceTypes.length>0&&(e.type===$.String||e.type===void 0)){const g=(e.acceptableResourceTypes??[]).flatMap(f=>{const m=c?.[f];return Array.isArray(m)?m.map(y=>{const x=String(y);return{value:x,label:x}}):[]});return n.jsx(Ne,{options:g,value:t!=null?String(t):void 0,invalid:s,disabled:o,onChange:f=>r(typeof f=="string"?f:f[0]),placeholder:i.enumSelectPlaceholder,className:l})}if(u)return n.jsx(b.DialInput,{value:String(e.const??""),disabled:!0,onChange:void 0,className:"opacity-60"});if(d&&e.enumDisplay===at.Radio){const g=e.enumOrientation===jt.Row;return n.jsx("div",{role:"radiogroup",className:g?"flex flex-row flex-wrap gap-x-4 gap-y-2":"flex flex-col gap-2",children:e.enum.map(f=>{const m=String(f);return n.jsx(w.DialRadioButton,{name:a,value:m,inputId:`${a}-${m}`,label:m,checked:t!=null?String(t)===m:!1,disabled:o,onChange:y=>r(y)},m)})})}if(d){const g=e.enum.map(f=>({value:String(f),label:String(f)}));return n.jsx(Ne,{options:g,value:t!=null?String(t):void 0,invalid:s,disabled:o,onChange:f=>r(typeof f=="string"?f:f[0]),placeholder:i.enumSelectPlaceholder})}switch(e.type){case $.Boolean:return n.jsx(_e.DialSwitch,{switchId:a,isOn:!!t,disabled:o,onChange:g=>r(g)});case $.Integer:return n.jsx(Zt,{integer:!0,value:t!=null?String(t):"",invalid:s,disabled:o,onChange:g=>r(g!==void 0?Number(g):void 0),placeholder:i.integerInputPlaceholder,containerClassName:l});case $.Number:return n.jsx(Zt,{value:t!=null?String(t):"",invalid:s,disabled:o,onChange:g=>r(g!==void 0?Number(g):void 0),placeholder:i.numberInputPlaceholder,containerClassName:l});default:return e.isProtected?n.jsx(dn,{value:t!=null?String(t):"",invalid:s,disabled:o,onChange:g=>r(g??void 0),placeholder:i.stringInputPlaceholder,containerClassName:l}):n.jsx(b.DialInput,{value:t!=null?String(t):"",invalid:s,disabled:o,onChange:g=>r(g??void 0),placeholder:i.stringInputPlaceholder,containerClassName:l})}},cr=({value:e,onChange:t,theme:r=ot.EditorThemes.dark,height:s=240})=>{const{readonly:a,texts:i}=je(),[o,l]=h.useState(null),[c,u]=h.useState(()=>JSON.stringify(e,null,2));h.useEffect(()=>{typeof window<"u"&&Promise.resolve().then(()=>require("./JsonEditor-qv1Z0dLX.cjs")).then(g=>{l(()=>g.DialJsonEditor)})},[]);let d=!1;try{JSON.parse(c)}catch{d=!0}const p=g=>{const f=g??"";u(f);try{t(JSON.parse(f))}catch{}};return n.jsxs("div",{children:[n.jsx("div",{className:"border border-primary rounded",style:{height:`${s}px`},children:o&&n.jsx(o,{value:c,currentTheme:r,onChange:p,options:{readOnly:a}})}),n.jsx(b.DialErrorText,{text:d?i.invalidJsonError:void 0})]})},Rr=(e,t)=>({id:Math.random().toString(36).slice(2),key:e,value:t}),jn=e=>!!(e.oneOf||e.anyOf||e.type===$.Array||We(e)),jo={[$.String]:"entryTypeString",[$.Number]:"entryTypeNumber",[$.Boolean]:"entryTypeBoolean",[$.Null]:"entryTypeNull",[$.Object]:"entryTypeObject",[$.Array]:"entryTypeArray"},To=({pairId:e,pairKey:t,pairValue:r,valueSchema:s,isUnschematizedValue:a,jsonEditorTheme:i,onKeyChange:o,onValueChange:l,onRemove:c,keyInputPlaceholder:u,removeFieldAriaLabel:d,path:p,level:g,readonly:f=!1,inputClassName:m})=>{const{rootSchema:y,texts:x,defaultExpanded:v=!0,touchedPaths:C=new Set,markTouched:S=()=>{},skipUntouched:E=!1}=je(),[D,j]=h.useState(t),L=jn(s),[O,_]=h.useState(()=>vo(r)),R=a&&(O===$.Object||O===$.Array),N=a&&O===$.Null,k=L||R,B=[...p,e,"key"].join("."),Q=(!E||C.has(B))&&t==="",V=h.useCallback(te=>{l(Co(te)),_(te)},[l]),F=h.useMemo(()=>yo.map(te=>({value:te,label:x[jo[te]]})),[x]),z=h.useMemo(()=>[{value:"true",label:x.booleanTrueOption},{value:"false",label:x.booleanFalseOption}],[x]),Z=`${e}-key-error`,G=a&&O===$.Boolean,ne=n.jsxs("div",{className:"flex gap-2 items-start",children:[n.jsxs("div",{className:k?"flex-1 min-w-0":"w-2/5 min-w-0",children:[n.jsx(b.DialInput,{value:D,disabled:f,invalid:Q,"aria-describedby":Q?Z:void 0,onChange:te=>j(te??""),onBlur:()=>{S(B),D!==t&&o(D)},placeholder:u,containerClassName:m}),n.jsx(b.DialErrorText,{id:Z,text:Q?`${x.keyColumnHeader} is required`:void 0})]}),!L&&!R&&n.jsx("div",{className:"flex-1 min-w-0",children:N?n.jsx(b.DialInput,{value:"null",disabled:!0,onChange:void 0,className:"opacity-60"}):G?n.jsx(Ne,{options:z,value:r?"true":"false",disabled:f,onChange:te=>{const le=typeof te=="string"?te:te[0];le&&l(le==="true")}}):n.jsx(Nn,{schema:a?{type:O}:s,value:r,onChange:l})}),a&&n.jsx("div",{className:"w-28 shrink-0",children:n.jsx(T.DialTooltip,{tooltip:x.entryTypeChangeWarning,triggerClassName:"block",children:n.jsx(Ne,{options:F,value:O,disabled:f,onChange:te=>{const le=typeof te=="string"?te:te[0];le&&V(le)}})})}),!f&&n.jsx(St,{size:T.ElementSize.Small,onClick:c,"aria-label":d,className:"shrink-0 p-1"})]});if(!k)return ne;if(R)return n.jsxs("div",{className:"flex flex-col gap-2",children:[ne,n.jsx(cr,{value:r,onChange:l,theme:i},O)]});const X=[...p,t],W=lr(r,s,y),se=Ee(r,s,y,X.join("."));return n.jsxs("div",{className:"flex flex-col gap-2",children:[ne,n.jsx(it,{title:t,level:g,summary:W,errorCount:se.length+(Q?1:0),defaultExpanded:v,children:n.jsx(Ae,{schema:s,value:r,onChange:l,path:X,level:g+1})})]})},wo=({schema:e,value:t,onChange:r,path:s,level:a})=>{const{rootSchema:i,texts:o,readonly:l=!1,inputClassName:c,jsonEditorTheme:u}=je(),d=e.additionalProperties===!0||e.additionalProperties==null,p=d?{type:"string"}:typeof e.additionalProperties=="object"?J(e.additionalProperties,i):{type:"string"},g=jn(p),[f,m]=h.useState(()=>Object.entries(t??{}).map(([D,j])=>Rr(D,j))),y=D=>Object.fromEntries(D.filter(j=>j.key!=="").map(j=>[j.key,j.value])),x=(D,j)=>{const L=f.map((O,_)=>_===D?{...O,key:j}:O);m(L),r(y(L))},v=(D,j)=>{const L=f.map((O,_)=>_===D?{...O,value:j}:O);m(L),r(y(L))},C=()=>g?Oe(p,i)??In(p):"",S=()=>{m(D=>[...D,Rr("",C())])},E=D=>{const j=f.filter((L,O)=>O!==D);m(j),r(y(j))};return n.jsxs("div",{className:"flex flex-col gap-2",children:[f.length===0&&n.jsx("p",{className:"dial-tiny-text text-secondary italic",children:o.noFieldsYet}),f.length>0&&!g&&n.jsxs("div",{className:"flex gap-2 mb-1 pr-7",children:[n.jsx("span",{className:"w-2/5 dial-tiny-text text-secondary font-medium",children:o.keyColumnHeader}),n.jsx("span",{className:"flex-1 dial-tiny-text text-secondary font-medium",children:o.valueColumnHeader}),d&&n.jsx("span",{className:"w-28 shrink-0 dial-tiny-text text-secondary font-medium",children:o.typeColumnHeader})]}),f.map((D,j)=>n.jsx(To,{pairId:D.id,pairKey:D.key,pairValue:D.value,valueSchema:p,isUnschematizedValue:d,jsonEditorTheme:u,onKeyChange:L=>x(j,L),onValueChange:L=>v(j,L),onRemove:()=>E(j),keyInputPlaceholder:o.keyInputPlaceholder,removeFieldAriaLabel:o.removeFieldAriaLabel,path:s,level:a,readonly:l,inputClassName:c},D.id)),!l&&n.jsx("div",{className:"pt-1",children:n.jsx(b.DialGhostButton,{label:o.addField,iconBefore:n.jsx(H.IconPlus,{size:16,stroke:2}),onClick:S})})]})},Ae=({schema:e,value:t,onChange:r,path:s,level:a,required:i,suppressInlineError:o=!1})=>{const{rootSchema:l,renderField:c,markTouched:u=()=>{},touchedPaths:d=new Set,skipUntouched:p=!1,jsonEditorTheme:g}=je(),f=J(e,l),m=v=>{u(s.join(".")),r(v)},y=!p||d.has(s.join("."));let x;if(f.oneOf)x=n.jsx(So,{schema:f,value:t,onChange:m,path:s,level:a});else if(f.anyOf&&f.type!==$.Object)x=n.jsx(No,{schema:f,value:t,onChange:m,path:s,level:a});else if(We(f)){const v=f.additionalProperties!=null&&f.additionalProperties!==!1,C=!f.properties||Object.keys(f.properties).length===0;v&&C?x=n.jsx(wo,{schema:f,value:t,onChange:m,path:s,level:a}):C&&f.additionalProperties!==!1?x=n.jsx(cr,{value:t,onChange:m,theme:g}):x=n.jsx(gt,{schema:f,value:t,onChange:m,path:s,level:a})}else if(f.type===$.Array)x=n.jsx(Io,{schema:f,value:t,onChange:m,path:s,level:a});else{const v=y&&i&&Tt(t),C=!o&&v?`${f.title??"Field"} is required`:void 0;x=n.jsxs(n.Fragment,{children:[n.jsx(Nn,{schema:f,value:t,onChange:m,invalid:v}),n.jsx(b.DialErrorText,{text:C})]})}return c?c(s,f,x):x},Eo=({schema:e,defaultValue:t,texts:r,className:s,readonly:a=!1,defaultExpanded:i=!0,inputClassName:o,variant:l=Ye.Sections,onChange:c,onPropertyChange:u,onDefaultValues:d,renderField:p,skipUntouched:g=!1,jsonEditorTheme:f,acceptableResourceTypes:m})=>{const y=h.useMemo(()=>({...mo,...r}),[r]),x=h.useMemo(()=>t||(Oe(e,e)??{}),[]),[v,C]=h.useState(x),[S,E]=h.useState(new Set),D=h.useCallback(N=>{E(k=>k.has(N)?k:new Set([...k,N]))},[]);h.useEffect(()=>{d?.(x)},[]);const j=(N,k)=>{const B={...v,[N]:k};C(B),c?.(B),u?.(N,k)},L=new Set(Object.keys(e.properties??{})),O=Object.keys(v).filter(N=>!L.has(N)),_=Dn(Object.entries(e.properties??{}).filter(([,N])=>!J(N,e).isHidden)),R=e.required??[];return n.jsx(vn.Provider,{value:{rootSchema:e,texts:y,readonly:a,defaultExpanded:i,inputClassName:o,jsonEditorTheme:f,acceptableResourceTypes:m,renderField:p,touchedPaths:S,markTouched:D,skipUntouched:g},children:n.jsxs("div",{className:I.mergeClasses("flex flex-col gap-4",s),children:[_.map(([N,k])=>{const B=J(k,e),U=B.title??k.title??bt(N),Q=R.includes(N),V=v[N];if(l===Ye.Flat)return n.jsx(Sn,{schema:k,value:V,onChange:G=>j(N,G),path:[N],level:0,required:Q,label:U},N);if(l===Ye.FlatSections)return n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx("h2",{className:"dial-small-semi-text text-primary",children:U}),n.jsx(Ae,{schema:k,value:V,onChange:G=>j(N,G),path:[N],level:0,required:Q})]},N);const F=Ee(V,B,e,N),z=N+".",Z=!g||S.has(N)||[...S].some(G=>G.startsWith(z));return n.jsx(it,{title:U,description:B.description,level:0,defaultExpanded:i,errorCount:Z?Q&&Tt(V)?Math.max(F.length,1):F.length:0,children:n.jsx(Ae,{schema:k,value:V,onChange:G=>j(N,G),path:[N],level:1,required:Q})},N)}),O.map(N=>{const k=bt(N),B=n.jsx(cr,{value:v[N],onChange:U=>j(N,U),theme:f});return l===Ye.Sections?n.jsx(it,{title:k,level:0,defaultExpanded:i,children:B},N):n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx("h2",{className:"dial-small-semi-text text-primary",children:k}),B]},N)})]})})},Oo=e=>({info:n.jsx(H.IconInfoCircleFilled,{size:e.size}),error:n.jsx(H.IconAlertCircleFilled,{size:e.size}),warning:n.jsx(H.IconAlertTriangleFilled,{size:e.size}),success:n.jsx(H.IconCircleCheckFilled,{size:e.size}),loading:n.jsx(b.Spinner,{size:e.size}),general:n.jsx(H.IconCheck,{size:e.size,stroke:e.stroke})}),Ao={[b.NotificationVariant.Info]:"bg-info text-info",[b.NotificationVariant.Success]:"bg-success text-success",[b.NotificationVariant.Warning]:"bg-warning text-warning",[b.NotificationVariant.Error]:"bg-error text-error",[b.NotificationVariant.Loading]:"bg-layer-raised text-info",[b.NotificationVariant.General]:"bg-layer-sunken text-primary"},_o={[b.NotificationVariant.Info]:"status",[b.NotificationVariant.Success]:"status",[b.NotificationVariant.Warning]:"alert",[b.NotificationVariant.Error]:"alert",[b.NotificationVariant.Loading]:"status",[b.NotificationVariant.General]:"status"},Lo="items-center justify-between rounded-xl relative gap-3 p-3 border flex border-transparent",dr=({variant:e=b.NotificationVariant.Info,type:t=b.NotificationType.Toast,title:r,message:s,className:a,iconSize:i=24,iconStroke:o=2,closable:l=!1,onClose:c,children:u,textClassName:d,...p})=>{const g=h.useMemo(()=>Oo({size:i,stroke:o})[e],[e,i,o]),f=d??(t===b.NotificationType.SectionMessage?"flex-row flex-wrap items-baseline gap-x-1":"flex-col");return n.jsxs("div",{role:_o[e],...p,className:I.mergeClasses(w.DIAL_KIT_CLASS.notification,Lo,Ao[e],t===b.NotificationType.Toast&&"min-w-[200px] max-w-[600px] shadow-lg",t===b.NotificationType.SectionMessage&&e===b.NotificationVariant.Loading&&"border-secondary",a),children:[n.jsxs("div",{className:"flex items-start gap-3 flex-1 min-w-0",children:[n.jsx("span",{"aria-hidden":"true",className:"flex shrink-0",children:n.jsx(w.DialIcon,{icon:g})}),r?n.jsxs("div",{className:I.mergeClasses("flex min-w-0 text-primary break-words",f),children:[n.jsx("div",{className:"dial-small-paragraph-semi-text min-w-0 break-words",children:r}),n.jsx("div",{className:"dial-small-paragraph-text min-w-0 break-words",children:s})]}):n.jsx("div",{className:"dial-small-paragraph-text min-w-0 text-primary break-words",children:s})]}),u,l&&n.jsx(P.CloseButton,{className:"shrink-0 self-start",ariaLabel:"Close notification",onClose:m=>c?.(m)})]})},kr={2:"line-clamp-2",3:"line-clamp-3",4:"line-clamp-4",5:"line-clamp-5",6:"line-clamp-6"},Ro=e=>e===1?"!truncate !whitespace-nowrap":`${kr[e]??kr[2]} !whitespace-normal`,ko=({text:e,query:t,markClassName:r,className:s,maxLines:a=2})=>{const i=I.mergeClasses(w.DIAL_KIT_CLASS.highlight,Ro(a),s);if(!t.trim())return n.jsx(P.EllipsisTooltip,{className:i,text:e});const o=e.toLowerCase().indexOf(t.toLowerCase()),l=o===-1?e:n.jsxs(n.Fragment,{children:[e.slice(0,o),n.jsx("mark",{className:I.mergeClasses("text-accent bg-control-accent-alpha-hover",r),children:e.slice(o,o+t.length)}),e.slice(o+t.length)]});return n.jsx(P.EllipsisTooltip,{className:i,text:l})},Po=({className:e,children:t,...r})=>n.jsx("article",{...r,className:I.mergeClasses(w.DIAL_KIT_CLASS.cardShell,"relative flex flex-col gap-3 rounded-[20px] border-2 border-transparent p-5","bg-layer-raised shadow-md transition-[transform,box-shadow] duration-200 ease-out hover:-translate-y-[3px] hover:shadow-lg motion-reduce:transition-none motion-reduce:hover:translate-y-0",e),children:t}),Je=(e,t)=>({type:s,...a})=>n.jsx(dr,{...a,variant:e,type:s||t}),Qe=(e,t)=>({variant:s,...a})=>n.jsx(dr,{...a,variant:s||t,type:e}),Mo=Je(b.NotificationVariant.Error,b.NotificationType.Toast),Fo=Je(b.NotificationVariant.Info,b.NotificationType.Toast),Bo=Je(b.NotificationVariant.Success,b.NotificationType.Toast),zo=Je(b.NotificationVariant.Warning,b.NotificationType.Toast),$o=Je(b.NotificationVariant.Loading,b.NotificationType.Toast),Ho=Je(b.NotificationVariant.General,b.NotificationType.Toast),Ko=Qe(b.NotificationType.SectionMessage,b.NotificationVariant.Error),Go=Qe(b.NotificationType.SectionMessage,b.NotificationVariant.Info),Vo=Qe(b.NotificationType.SectionMessage,b.NotificationVariant.Success),Uo=Qe(b.NotificationType.SectionMessage,b.NotificationVariant.Warning),Wo=Qe(b.NotificationType.SectionMessage,b.NotificationVariant.Loading),qo=Qe(b.NotificationType.SectionMessage,b.NotificationVariant.General);var be=(e=>(e.Date="date",e.DateTime="datetime",e.Time="time",e.Weekday="weekday",e))(be||{});const Zo="en-GB",Yo={[be.Date]:"Select date",[be.DateTime]:"Select date and time",[be.Time]:"--:--",[be.Weekday]:"Select day"},Tn="flex w-full items-center justify-between gap-2 rounded-xl border border-secondary bg-layer-raised px-4 py-3 dial-small-text text-primary outline-none transition-colors hover:border-accent-alpha focus-within:border-accent-focus",wn="!cursor-not-allowed !border-transparent bg-layer-sunken text-control-disable-primary hover:!border-transparent",En="!border-error",Xo="z-[53] flex w-[248px] flex-col gap-4 rounded-lg bg-layer-raised px-2 py-4 shadow-md",Jo="flex size-10 items-center justify-center rounded-full dial-small-text text-primary hover:bg-control-accent-alpha-hover hover:text-primary focus:outline-none focus-visible:outline focus-visible:outline-focus",Qo="bg-control-accent text-control-permanent",el="text-accent dial-small-semi-text",tl="text-control-disable-primary",On="text-secondary",rl=n.jsx(H.IconCalendar,{size:K.DIAL_ICON_SIZE.MD,stroke:oe.DIAL_KIT_ICON_STROKE,"aria-hidden":"true",className:On}),Pr={prev:n.jsx(H.IconChevronLeft,{size:K.DIAL_ICON_SIZE.SM,stroke:oe.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}),next:n.jsx(H.IconChevronRight,{size:K.DIAL_ICON_SIZE.SM,stroke:oe.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"})},nl=(e,t)=>{const s=(new Date(e,t,1).getDay()+6)%7,a=new Date(e,t,1-s);return Array.from({length:42},(i,o)=>{const l=new Date(a);return l.setDate(a.getDate()+o),l})},Mr=(e,t)=>!!e&&!!t&&e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),Fr=(e,t,r)=>{const s=new Date(e.getFullYear(),e.getMonth(),e.getDate());if(t){const a=new Date(t.getFullYear(),t.getMonth(),t.getDate());if(s<a)return!0}if(r){const a=new Date(r.getFullYear(),r.getMonth(),r.getDate());if(s>a)return!0}return!1},sl=(e,t)=>e.toLocaleDateString(t,{month:"long",year:"numeric"}),Br=(e,t)=>e.toLocaleDateString(t,{day:"numeric",month:"short",year:"numeric"}),al=(e,t)=>e.toLocaleDateString(t,{weekday:"long",day:"numeric",month:"long",year:"numeric"}),dt=e=>`${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}`,zr=(e,t)=>{const[r,s]=t.split(":").map(Number),a=new Date(e);return a.setHours(r||0,s||0,0,0),a},il=e=>/^([01]\d|2[0-3]):[0-5]\d$/.test(e),ol=e=>{const t=e.replace(/\D/g,"").slice(0,4);let r=t.slice(0,2);const s=t.slice(2,4);if(r.length===2&&(r=String(Math.min(Number(r),23)).padStart(2,"0")),s.length===0)return r;const a=String(Math.min(Number(s),59)).padStart(s.length,"0");return`${r}:${a}`},An=5,_n=e=>e.charAt(0).toUpperCase()+e.slice(1),ll=e=>Array.from({length:7},(t,r)=>{const s=new Date(Date.UTC(1970,0,An+r));return _n(s.toLocaleDateString(e,{weekday:"short",timeZone:"UTC"}))}),cl=e=>Array.from({length:7},(t,r)=>{const s=new Date(Date.UTC(1970,0,An+r));return{value:String(r+1),label:_n(s.toLocaleDateString(e,{weekday:"long",timeZone:"UTC"}))}}),$r=({id:e,disabled:t,invalid:r,trigger:s,panelClassName:a,fieldClassName:i,panel:o,labelledBy:l,panelLabel:c})=>{const u=w.useThemeScope(),[d,p]=h.useState(!1),{refs:g,floatingStyles:f,context:m}=de.useFloating({open:d,onOpenChange:E=>p(t?!1:E),placement:"bottom-start",whileElementsMounted:de.autoUpdate,middleware:[de.offset(8),de.flip({padding:8}),de.shift({padding:8})]}),y=de.useClick(m,{enabled:!t}),x=de.useDismiss(m),v=de.useRole(m,{role:"dialog"}),{getReferenceProps:C,getFloatingProps:S}=de.useInteractions([y,x,v]);return n.jsxs(n.Fragment,{children:[n.jsx("div",{id:e,ref:g.setReference,role:"button","aria-haspopup":"dialog","aria-expanded":d,"aria-disabled":t,"aria-labelledby":l,tabIndex:t?-1:0,className:I.mergeClasses(Tn,"focus-visible:outline focus-visible:outline-focus",r&&En,t&&wn,i),...C(),children:s}),d&&n.jsx(de.FloatingPortal,{children:n.jsx(de.FloatingFocusManager,{context:m,modal:!1,initialFocus:-1,returnFocus:!0,children:n.jsx("div",{ref:g.setFloating,style:f,"aria-label":c,className:I.mergeClasses(Xo,u,a),...S(),children:o(()=>p(!1))})})})]})},Hr=({id:e,value:t,onChange:r,onBlur:s,disabled:a,invalid:i,className:o,ariaLabel:l,placeholder:c="--:--",timezoneLabel:u})=>{const[d,p]=h.useState(t);h.useEffect(()=>{p(t)},[t]);const g=n.jsx("input",{id:e,type:"text",inputMode:"numeric",autoComplete:"off","aria-label":l,placeholder:c,disabled:a,value:d,onChange:f=>{const m=ol(f.target.value);p(m),il(m)&&r(m)},onBlur:s,className:I.mergeClasses(Tn,i&&En,a&&wn,o)});return u?n.jsxs("div",{className:"relative w-full",children:[g,n.jsx("span",{className:"dial-small-paragraph-text pointer-events-none absolute end-4 top-1/2 -translate-y-1/2 truncate text-secondary",children:u})]}):g},dl=({mode:e=be.Date,value:t,onChange:r,onBlur:s,labelProps:a,placeholder:i,disabled:o=!1,invalid:l=!1,id:c,className:u,minDate:d,maxDate:p,locale:g=Zo,fieldClassName:f,showTimezone:m=!1})=>{const y=i??Yo[e],x=t instanceof Date?t:null,v=h.useId(),C=c??v,S=a?.id??`${C}-label`,E=!!a?.label,D=typeof a?.label=="string"?a.label:void 0,j=E?`${S} ${C}`:void 0,L=a?n.jsx(P.Label,{...a,id:S,htmlFor:C}):null,[O,_]=h.useState(()=>x??new Date),R=h.useMemo(()=>new Date,[]),N=h.useMemo(()=>m?yn({locale:g}):null,[m,g]),k=h.useMemo(()=>ll(g),[g]),B=h.useMemo(()=>cl(g),[g]),U=h.useMemo(()=>nl(O.getFullYear(),O.getMonth()),[O]),Q=Z=>{_(G=>new Date(G.getFullYear(),G.getMonth()+Z,1))},V=(Z,G)=>{if(Fr(Z,d,p))return;const ne=e===be.DateTime&&x?zr(Z,dt(x)):Z;r?.(ne),e===be.Date&&G()},F=Z=>{r?.(zr(x??new Date,Z))},z=()=>x?e===be.DateTime?`${Br(x,g)}, ${dt(x)}`:Br(x,g):y;if(e===be.Time){const Z=typeof t=="string"?t:x?dt(x):"";return n.jsxs("div",{className:I.mergeClasses(w.DIAL_KIT_CLASS.calendar,"flex flex-col gap-y-3",u),children:[L,n.jsx(Hr,{id:C,value:Z,onChange:G=>r?.(G),onBlur:s,disabled:o,invalid:l,placeholder:y,className:f,timezoneLabel:N})]})}if(e===be.Weekday){const Z=typeof t=="string"?t:void 0,G=B.find(ne=>ne.value===Z);return n.jsxs("div",{className:I.mergeClasses(w.DIAL_KIT_CLASS.calendar,"flex flex-col gap-y-3",u),children:[L,n.jsx($r,{id:C,disabled:o,invalid:l,labelledBy:j,panelLabel:D??y,fieldClassName:f,trigger:n.jsxs(n.Fragment,{children:[n.jsx("span",{className:I.mergeClasses("truncate",!G&&"text-secondary"),children:G?.label??y}),n.jsx(H.IconChevronDown,{size:K.DIAL_ICON_SIZE.MD,stroke:oe.DIAL_KIT_ICON_STROKE,"aria-hidden":"true",className:On})]}),panel:ne=>n.jsx("div",{role:"listbox","aria-label":D??y,className:"flex flex-col gap-0.5",children:B.map(X=>n.jsx("button",{type:"button",role:"option","aria-selected":X.value===Z,className:I.mergeClasses("flex w-full items-center rounded-lg px-3 py-2 text-left dial-small-text text-primary hover:bg-control-accent-alpha-hover","focus-visible:outline focus-visible:outline-focus",X.value===Z&&"bg-control-accent-alpha-hover"),onClick:()=>{r?.(X.value),ne()},children:X.label},X.value))})})]})}return n.jsxs("div",{className:I.mergeClasses(w.DIAL_KIT_CLASS.calendar,"flex flex-col gap-y-3",u),children:[L,n.jsx($r,{id:C,disabled:o,invalid:l,labelledBy:j,panelLabel:D??y,fieldClassName:f,trigger:n.jsxs(n.Fragment,{children:[n.jsx("span",{className:I.mergeClasses("truncate",!x&&"text-secondary"),children:z()}),rl]}),panel:Z=>n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx(P.StaticIconButton,{"aria-label":"Previous month",icon:Pr.prev,size:T.ElementSize.Small,onClick:()=>Q(-1)}),n.jsx("div",{className:"dial-small-semi-text text-primary","aria-live":"polite",children:sl(O,g)}),n.jsx(P.StaticIconButton,{"aria-label":"Next month",icon:Pr.next,size:T.ElementSize.Small,onClick:()=>Q(1)})]}),n.jsxs("div",{className:"grid grid-cols-7 gap-y-1 text-center",children:[k.map(G=>n.jsx("div",{"aria-hidden":"true",className:"dial-tiny-text py-1 text-secondary",children:G},G)),U.map(G=>{const ne=G.getMonth()!==O.getMonth(),X=Mr(G,x),W=Mr(G,R),se=Fr(G,d,p);return n.jsx("button",{type:"button",disabled:se,"aria-label":al(G,g),"aria-pressed":X,"aria-current":W?"date":void 0,className:I.mergeClasses(Jo,ne&&tl,W&&!X&&el,X&&Qo,se&&"cursor-not-allowed opacity-40 hover:bg-transparent"),onClick:()=>V(G,Z),children:G.getDate()},G.toISOString())})]}),e===be.DateTime&&n.jsxs("div",{className:"flex items-center justify-between gap-3 border-t border-secondary pt-3",children:[n.jsx("span",{className:"dial-small-text text-primary",children:"Time"}),n.jsx(Hr,{ariaLabel:"Time",value:x?dt(x):"",onChange:F,onBlur:s,className:"w-[120px] px-3 py-1.5"})]})]})})]})},ul=({segments:e,labelClassName:t="dial-small-text",leafClassName:r="dial-small-semi-text",className:s,ariaLabel:a="Folder path"})=>{const i=n.jsx(w.DialIcon,{icon:n.jsx(H.IconFolder,{size:K.DIAL_ICON_SIZE.SM,stroke:oe.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}),className:"text-secondary"}),o=e.map((l,c)=>({label:c===e.length-1?n.jsx("span",{className:r,children:l}):l,disabled:!0,...c===0?{iconBefore:i}:{}}));return n.jsx(b.DialBreadcrumb,{className:I.mergeClasses(w.DIAL_KIT_CLASS.folderPath,s),ariaLabel:a,separator:n.jsx(w.DialIcon,{icon:n.jsx(H.IconChevronRight,{size:14,stroke:oe.DIAL_KIT_ICON_STROKE,"aria-hidden":"true",className:"rtl:scale-x-[-1]"}),className:"text-secondary"}),pathItems:o,labelClassName:I.mergeClasses(t,"text-secondary","!cursor-default")})},et=({label:e,variant:t,appearance:r=T.ButtonAppearance.Solid,size:s=T.ElementSize.Standard,className:a,textClassName:i,iconAfter:o,iconBefore:l,type:c="button",tooltipProps:u,href:d,target:p,rel:g,disabled:f,...m})=>{const y=I.mergeClasses("dial-kit-base-button",t&&P.getButtonClassNames(t,r),s===T.ElementSize.Small?"dial-tiny-semi-text":"dial-small-paragraph-semi-text",s===T.ElementSize.Small?"h-[24px] gap-1":"h-[40px] gap-2",s===T.ElementSize.Small&&"dial-kit-base-button-small",r!==T.ButtonAppearance.Link&&(s===T.ElementSize.Small?"px-2":"px-4"),s!==T.ElementSize.Small&&r!==T.ButtonAppearance.Link&&"dial-kit-enhanced-target",a),x=e?void 0:u?.tooltip,v=T.resolveAccessibleName(typeof e=="string"?e:void 0,m["aria-label"],x),C=n.jsxs(n.Fragment,{children:[n.jsx(w.DialIcon,{icon:l}),e&&n.jsx("span",{className:i,children:e}),n.jsx(w.DialIcon,{icon:o})]}),S=m,E=d!==void 0?n.jsx("a",{...S,href:f?void 0:d,target:p,rel:g??(p==="_blank"?"noopener noreferrer":void 0),"aria-disabled":f||void 0,tabIndex:f?-1:S.tabIndex,onClick:f?void 0:S.onClick,className:y,"aria-label":v,children:C}):n.jsx("button",{...m,type:c,disabled:f,className:y,"aria-label":v,children:C});return u?n.jsx(P.Tooltip,{asChild:!0,...u,children:E}):E},ur=(e,t)=>({appearance:s,...a})=>n.jsx(et,{...a,variant:e,appearance:s||t}),fr=(e,t)=>({variant:s,...a})=>n.jsx(et,{...a,variant:s||t,appearance:e}),Ln=ur(T.ButtonVariant.Primary,T.ButtonAppearance.Solid),pr=ur(T.ButtonVariant.Neutral,T.ButtonAppearance.Solid),fl=ur(T.ButtonVariant.Danger,T.ButtonAppearance.Solid),pl=fr(T.ButtonAppearance.Link,T.ButtonVariant.Primary),gl=fr(T.ButtonAppearance.Ghost,T.ButtonVariant.Primary),hl=fr(T.ButtonAppearance.Outlined,T.ButtonVariant.Neutral),ml=({className:e,icon:t,tooltipProps:r,type:s="button",...a})=>{const i=I.mergeClasses("flex items-center justify-center rounded-full size-[40px]","dial-kit-enhanced-target","dial-kit-fab-button disabled:cursor-not-allowed focus-visible:outline focus-visible:outline-focus outline-offset-0",e),o=n.jsx("button",{...a,type:s,className:i,"aria-label":T.resolveAccessibleName(a["aria-label"],r?.tooltip),children:t||n.jsx(H.IconArrowNarrowDown,{size:24,stroke:1.5,"aria-hidden":"true"})});return r?n.jsx(T.DialTooltip,{...r,children:o}):o},xl=e=>n.jsx(H.IconChevronDown,{size:K.DIAL_ICON_SIZE.SM,stroke:oe.DIAL_KIT_ICON_STROKE,"aria-hidden":!0,className:I.mergeClasses("transition-transform",e&&"rotate-180")}),bl=({variant:e,appearance:t,items:r,...s})=>{const[a,i]=h.useState(!1),o=h.useMemo(()=>xl(a),[a]);return n.jsx("div",{className:w.DIAL_KIT_CLASS.buttonDropdown,children:n.jsx(P.Dropdown,{items:r,onOpenChange:l=>i(l),children:n.jsx(et,{...s,iconAfter:o,variant:e||T.ButtonVariant.Primary,appearance:t||T.ButtonAppearance.Solid,"aria-haspopup":"menu","aria-expanded":a})})})},Rn=({label:e,size:t,isOpen:r=!1,"aria-label":s,...a})=>{const i=t===T.ElementSize.Small?"h-[32px]":"h-[40px] dial-kit-enhanced-target";return n.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":r,"aria-label":s?`${s} ${e}`:void 0,className:I.mergeClasses(w.DIAL_KIT_CLASS.inlineSelect,"dial-small-paragraph-text px-3 focus-visible:outline focus-visible:outline-focus","flex items-center gap-1 rounded-full text-primary disabled:text-control-disable-primary","hover:bg-control-accent-alpha-hover focus-visible:outline-offset-2 active:bg-control-accent-alpha-active",i,a.className),...a,children:[e,n.jsx(H.IconChevronDown,{size:K.DIAL_ICON_SIZE.MD,stroke:oe.DIAL_KIT_ICON_STROKE,"aria-hidden":!0,className:I.mergeClasses("transition-transform",r&&"rotate-180")})]})},yl=({items:e,selectedKey:t,defaultSelectedKey:r,onSelect:s,size:a,disabled:i,placement:o="bottom-end",matchReferenceWidth:l=!1,listClassName:c,ariaLabel:u})=>{const[d,p]=h.useState(!1),[g,f]=h.useState(r??e[0]?.key),m=t!==void 0,y=m?t:g,x=h.useMemo(()=>{const C=e.find(S=>S.key===y);return C?.label?String(C.label):""},[e,y]),v=h.useCallback(({key:C})=>{const S=e.find(E=>E.key===C);S&&(m||f(C),s?.(S))},[e,m,s]);return n.jsx(P.Dropdown,{items:e,placement:o,matchReferenceWidth:l,listClassName:c,disabled:i,onOpenChange:p,onItemClick:v,children:n.jsx(Rn,{label:x,size:a,isOpen:d,disabled:i,"aria-label":u})})},ke=({text:e,className:t,variant:r=b.CaptionType.Description,...s})=>e?n.jsx("span",{...s,role:"alert",className:I.mergeClasses(w.DIAL_KIT_CLASS.captionText,r===b.CaptionType.Error&&w.DIAL_KIT_CLASS.errorText,"dial-tiny-text",r===b.CaptionType.Error?"text-error":"text-secondary",t),children:e}):null,Pe=({...e})=>n.jsx(ke,{...e,variant:b.CaptionType.Error}),vl="bg-control-neutral-active flex items-center justify-center enabled:text-secondary enabled:hover:text-control-accent-hover enabled:active:bg-control-accent-alpha-active enabled:hover:bg-control-accent-alpha-hover enabled:active:text-control-accent-active",Dl={[T.ElementSize.Small]:"size-[24px]",[T.ElementSize.Standard]:"size-[40px]",[T.ElementSize.Large]:"size-[48px]"},Cl=({icon:e,onClick:t,disabled:r,size:s=T.ElementSize.Standard,className:a})=>n.jsx("div",{className:I.mergeClasses("border-l border-tertiary",Dl[s]),children:n.jsx(P.IconButton,{className:I.mergeClasses(vl,s===T.ElementSize.Small&&"p-1",a),icon:e,onClick:t,disabled:r,size:s})}),Il=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Backspace","Delete","Tab","Enter","Escape","Home","End","Insert"],kn=(e,t,r,s)=>{if((t==="number"||r!==void 0||s!==void 0)&&!Il.includes(e.key)&&!(e.ctrlKey||e.metaKey)&&!(e.key==="-"&&(e.currentTarget.selectionStart??0)===0&&!e.currentTarget.value.includes("-"))&&!(e.key==="."&&t==="number"&&!e.currentTarget.value.includes("."))){if(!/^[0-9]$/.test(e.key)){e.preventDefault();return}if((r!==void 0||s!==void 0)&&e.currentTarget.selectionStart!==null){const i=e.currentTarget.value,o=e.currentTarget.selectionStart,l=e.currentTarget.selectionEnd??o,c=i.slice(0,o)+e.key+i.slice(l),u=parseFloat(c);if(!isNaN(u)){if(r!==void 0&&u<+r){e.preventDefault();return}if(s!==void 0&&u>+s){e.preventDefault();return}}}}},Pn={[T.ElementSize.Small]:{field:"dial-kit-input-small gap-x-1",paddingStart:"pl-2",paddingEnd:"pr-2",stackGap:"gap-1",postfixText:"dial-tiny-text"},[T.ElementSize.Standard]:{field:"gap-x-2 py-2",paddingStart:"pl-3",paddingEnd:"pr-3",stackGap:"gap-2",postfixText:"dial-small-text"},[T.ElementSize.Large]:{field:"gap-x-2 py-3",paddingStart:"pl-4",paddingEnd:"pr-4",stackGap:"gap-2",postfixText:"dial-body-text"}},Ve=({labelProps:e,error:t,caption:r,id:s,containerClassName:a,size:i=T.ElementSize.Standard,...o})=>n.jsxs("div",{className:I.mergeClasses("flex flex-col",Pn[i].stackGap,a),children:[e&&n.jsx(P.Label,{...e,htmlFor:s}),n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsx(Mn,{id:s,size:i,...o}),n.jsx(Pe,{text:t}),!t&&n.jsx(ke,{text:r})]})]}),Mn=({invalid:e,disabled:t,prefix:r,className:s,postfix:a,children:i,iconBefore:o,iconAfter:l,wrapperClassName:c,type:u,inputRef:d,value:p,tooltipText:g,min:f,onChange:m,max:y,inputButtonProps:x,wrapperRef:v,size:C=T.ElementSize.Standard,...S})=>{const E=Pn[C],D=h.useRef(null),j=de.useMergeRefs([d,D]),L=u==="number"||f!==void 0||y!==void 0;h.useEffect(()=>{const N=D.current;if(!N||!L||t)return;const k=B=>{B.preventDefault()};return N.addEventListener("wheel",k,{passive:!1}),()=>{N.removeEventListener("wheel",k)}},[t,L,u]);const O=N=>{kn(N,u,f,y)},_=N=>{const k=N.currentTarget.value;if(L&&k!==""){const B=parseFloat(k);if(isNaN(B)&&k!=="-"&&k!=="."||!isNaN(B)&&(f!==void 0&&B<+f||y!==void 0&&B>+y))return}m?.(k||void 0)},R=()=>n.jsxs("div",{ref:v,className:I.mergeClasses("dial-kit-input flex flex-row items-center justify-between",E.field,e&&"dial-kit-input-error",t&&"dial-kit-input-disable",!r&&E.paddingStart,!x&&E.paddingEnd,c),"aria-label":"input-container",children:[r&&n.jsx("div",{className:"border-r border-secondary",children:n.jsx(Mn,{wrapperClassName:"!rounded-r-none",className:"truncate",value:r,disabled:!0,size:C,id:`${r}_textBefore`})}),n.jsx(w.DialIcon,{icon:o}),i,n.jsx("input",{ref:j,type:u,autoComplete:u==="password"?"new-password":"off",value:p??"",className:I.mergeClasses("border-0 bg-transparent w-full truncate",t&&"cursor-not-allowed",s),onChange:_,onKeyDown:O,min:f,disabled:t,max:y,...S}),a&&n.jsxs("p",{className:I.mergeClasses("text-secondary",E.postfixText),children:[" ",a]}),n.jsx(w.DialIcon,{icon:l}),x&&n.jsx(Cl,{size:C,...x,disabled:t})]});return t&&u!=="password"?n.jsx(P.Tooltip,{tooltip:g||p,children:R()}):R()};var Ue=(e=>(e.Outlined="outlined",e.Selectable="selectable",e))(Ue||{});const Sl="inline-flex h-[32px] max-w-full items-center gap-1 rounded-full px-3",Nl={[Ue.Outlined]:{default:"bg-layer-raised text-primary",selected:"bg-control-accent-alpha text-primary"},[Ue.Selectable]:{default:"text-secondary",selected:"bg-control-accent-alpha text-primary"}},jl="cursor-pointer outline-offset-0 focus-visible:outline focus-visible:outline-focus",Tl="hover:bg-control-accent-alpha-hover active:bg-control-accent-alpha-active",Ke=({label:e,icon:t,appearance:r=Ue.Outlined,selected:s=!1,disabled:a=!1,closable:i=!1,removeLabel:o,className:l,title:c,onClick:u,onRemove:d,onKeyDown:p,...g})=>{const f=r===Ue.Selectable,m=!!u&&!a,y=i&&!!d&&!a,x=f&&s,v=C=>{p?.(C),!(!m||C.defaultPrevented)&&(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),C.currentTarget.click())};return n.jsxs("span",{...g,role:m?"button":g.role,tabIndex:m?0:g.tabIndex,"aria-disabled":a||void 0,"aria-pressed":f&&m?s:void 0,onClick:a?void 0:u,onKeyDown:v,className:I.mergeClasses(w.DIAL_KIT_CLASS.tag,Sl,x?"dial-tiny-semi-text":"dial-tiny-text",Nl[r][s?"selected":"default"],a&&"cursor-not-allowed",m&&[jl,Tl],l),children:[t&&n.jsx("span",{className:"flex shrink-0 items-center","aria-hidden":"true",children:t}),n.jsx("span",{className:"truncate",title:c??e,children:e}),y&&n.jsx(P.GhostIconButton,{className:"size-[16px] shrink-0 dial-kit-minimum-target",size:T.ElementSize.Small,"aria-label":o??`Remove ${e}`,icon:n.jsx(H.IconX,{size:K.DIAL_ICON_SIZE.SM,stroke:oe.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}),onClick:C=>{C.stopPropagation(),d?.(C)}})]})},Fn=({options:e,selectedValues:t,handleRemoveTag:r})=>n.jsx(n.Fragment,{children:t.map(s=>{const a=e.find(i=>i.value===s);return n.jsx(Ke,{label:a?.label??s,closable:!!r,onRemove:i=>r?.(i,s),icon:a?.icon,className:"max-w-full border border-tertiary"},s)})}),wl=I.mergeClasses("w-full flex flex-col"),El=P.overlayItemClassName,Ol="!max-w-[var(--reference-width)]",Al="max-h-[344px] overflow-y-auto",_l=P.overlayGap,Ll=P.overlaySubMenuClassName,Rl=n.jsx(H.IconChevronRight,{size:K.DIAL_ICON_SIZE.SM,stroke:oe.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}),kl="text-secondary transition-transform",Pl=8,Ml=n.jsx(H.IconSearch,{size:K.DIAL_ICON_SIZE.MD,stroke:oe.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}),Fl=n.jsx(H.IconX,{size:K.DIAL_ICON_SIZE.SM,stroke:oe.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}),Bl=n.jsx(P.SvgNoData,{width:K.DIAL_ICON_SIZE.LG,height:K.DIAL_ICON_SIZE.LG,"aria-hidden":"true"}),zl=({opt:e,selectedValues:t,mark:r=P.MenuItemMark.Tint,onSelect:s})=>{const{isOpen:a,nodeId:i,refs:o,floatingStyles:l,context:c,getReferenceProps:u,getFloatingProps:d}=w.useSubMenuFloating(_l,"listbox",!!e.disabled),p=e.children?.some(f=>t.includes(f.value)),g=n.jsx(P.MenuItem,{ref:o.setReference,role:"option","aria-haspopup":"listbox","aria-expanded":a,"aria-selected":!!p,"aria-disabled":!!e.disabled,disabled:e.disabled,ellipsisLabel:!0,icon:e.icon,label:e.labelNode??e.label,trailing:Rl,...u()});return n.jsxs(de.FloatingNode,{id:i,children:[e.interactiveTooltip?n.jsx(P.InteractiveTooltip,{asChild:!0,placement:e.interactiveTooltip.placement,content:e.interactiveTooltip.content,contentClassName:e.interactiveTooltip.contentClassName,children:g}):g,a&&n.jsx(w.SubMenuPanel,{refs:o,floatingStyles:l,context:c,getFloatingProps:d,role:"listbox",surfaceClassName:Ll,children:e.children.map(f=>{const m=n.jsx(P.MenuItem,{role:"option","aria-selected":t.includes(f.value),"aria-disabled":!!f.disabled,disabled:f.disabled,mark:r,selected:t.includes(f.value),ellipsisLabel:!0,icon:f.icon,label:f.labelNode??f.label,rightControl:f.rightControl,onClick:()=>!f.disabled&&s(f.value)});return n.jsx(h.Fragment,{children:f.interactiveTooltip?n.jsx(P.InteractiveTooltip,{asChild:!0,placement:f.interactiveTooltip.placement,content:f.interactiveTooltip.content,contentClassName:f.interactiveTooltip.contentClassName,children:m}):m},f.value)})})]})},$l=({options:e,multiple:t=!1,id:r,value:s,defaultValue:a,size:i=T.ElementSize.Standard,prefix:o,customSelectedValue:l,placeholder:c="Select...",labelProps:u,error:d,caption:p,ariaLabel:g,searchable:f=!1,searchSize:m=T.ElementSize.Standard,searchPlaceholder:y,selectAll:x=!1,invalid:v,selectAllLabel:C="Select all",selectedOptionMark:S=P.MenuItemMark.Tint,emptyStateTitle:E="No options available",emptyStateDescription:D,emptyStateIcon:j,disabled:L=!1,className:O,fieldClassName:_,listClassName:R,closable:N=!1,header:k,footer:B,onClose:U,onChange:Q,dismissRef:V,onFooterClick:F,open:z,onOpenChange:Z,onSearchQueryChange:G,customMultiSelectTagsRenderer:ne})=>{const X=h.useId(),W=r||X,se=`list-${W}`,te=i===T.ElementSize.Small,[le,ue]=h.useState(!1),pe=z!==void 0,ge=pe?!!z:le,fe=h.useCallback(M=>{pe||ue(M),Z?.(M)},[pe,Z]),[q,ee]=h.useState(""),Ie=h.useCallback(M=>{M!==q&&(ee(M||""),G?.(M||""))},[G,q]),Me=s!==void 0,[he,Fe]=h.useState(a),Te=Me?s:he,ae=h.useMemo(()=>t?Array.isArray(Te)?Te:[]:typeof Te=="string"?[Te]:[],[Te,t]),Le=h.useMemo(()=>{const M=q.trim().toLowerCase();return M?e.filter(ce=>ce.label.toLowerCase().includes(M)):e},[e,q]);h.useEffect(()=>{ge||Ie("")},[ge,Ie]);const Se=h.useCallback(M=>{Me||Fe(M),Q?.(M)},[Me,Q]),Be=h.useCallback(M=>{if(t){const ce=new Set(ae);ce.has(M)?ce.delete(M):ce.add(M),Se(Array.from(ce));return}Se(M),fe(!1)},[t,Se,fe,ae]),tt=h.useCallback((M,ce)=>{if(M.stopPropagation(),!t){Se("");return}const lt=ae.filter(Un=>Un!==ce);Se(lt)},[t,ae,Se]),ve=h.useMemo(()=>Le.filter(M=>!M.disabled),[Le]),ze=h.useMemo(()=>ve.filter(M=>ae.includes(M.value)).length,[ve,ae]),{allSelectedInFiltered:Re,someSelectedInFiltered:me}=h.useMemo(()=>{const M=ve.length>0&&ze===ve.length;return{allSelectedInFiltered:M,someSelectedInFiltered:ze>0&&!M}},[ve,ze]),wt=h.useCallback(()=>{if(!(!t||ve.length===0))if(Re){const M=new Set(ve.map(ce=>ce.value));Se(ae.filter(ce=>!M.has(ce)))}else{const M=new Set(ae);ve.forEach(ce=>M.add(ce.value)),Se(Array.from(M))}},[Re,t,ve,ae,Se]),we=ae.length>0,$e=!t&&we?ae[0]:void 0,A=h.useMemo(()=>$e?e.find(M=>M.value===$e)??e.flatMap(M=>M.children??[]).find(M=>M.value===$e):void 0,[e,$e]),re=A?o?`${o} ${A.label}`:A.label:void 0,xe=h.useMemo(()=>t?we?n.jsx("span",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-1",children:ne?.(e,ae,tt)??n.jsx(Fn,{options:e,selectedValues:ae,handleRemoveTag:tt})}):null:!A||!A.labelNode&&!A.description?null:n.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-2",children:[n.jsx(P.EllipsisTooltip,{text:A.labelNode??re}),A.description&&n.jsx("span",{className:"truncate text-secondary dial-tiny-text",children:A.description})]}),[ne,tt,we,t,e,re,ae,A]),Et=t||xe?"":re||(l&&s?l:""),Hn=typeof u?.label=="string"?u.label:void 0,Kn=xe?[T.resolveAccessibleName(g,Hn),t?ae.map(M=>e.find(ce=>ce.value===M)?.label??M).join(", "):re].filter(Boolean).join(", ")||void 0:T.resolveAccessibleName(g);h.useImperativeHandle(V,()=>({dismiss:()=>{fe(!1)}}));const Gn=h.useCallback(M=>{L||(M.key==="ArrowDown"||M.key==="ArrowUp")&&(M.preventDefault(),ge||fe(!0))},[L,ge,fe]),Vn=()=>n.jsxs("div",{id:se,role:"listbox","aria-multiselectable":t||void 0,className:wl,children:[k&&n.jsx(n.Fragment,{children:typeof k=="function"?k():k}),(f||N)&&(e.length>Pl||!!q)&&n.jsxs("div",{className:"flex items-center gap-2 px-2 pt-2",children:[f&&n.jsx(Ve,{id:`search-${W}`,size:m,placeholder:y,"aria-label":y||"Search options",onChange:M=>Ie(M),value:q,iconBefore:Ml,containerClassName:"w-full"}),N&&n.jsx(P.GhostIconButton,{"aria-label":"Close select",className:"shrink-0",size:T.ElementSize.Small,icon:Fl,onClick:M=>{U?.(M),fe(!1)}})]}),t&&x&&ve.length>0&&n.jsx("div",{className:I.mergeClasses(El,"mt-2"),children:n.jsx(P.Checkbox,{id:`${W}-selectAll`,labelProps:{label:C},isSelected:Re,isIndeterminate:me,onChange:wt})}),n.jsx("div",{role:"none",className:Al,children:Le.length===0?n.jsx("div",{className:"px-2 py-3",children:n.jsx(w.DialNoDataContent,{icon:j??Bl,title:E,description:D})}):Le.map(M=>{const ce=ae.includes(M.value);if(M.children?.length)return n.jsx(zl,{opt:M,selectedValues:ae,mark:t?P.MenuItemMark.Checkbox:S,onSelect:Be},M.value);const lt=t?n.jsx(P.MenuItem,{id:`${W}-${M.value}`,role:"option","aria-selected":ce,"aria-disabled":!!M.disabled,disabled:M.disabled,mark:P.MenuItemMark.Checkbox,selected:ce,icon:M.icon,label:M.labelNode??M.label,description:M.description,rightControl:M.rightControl,onClick:()=>Be(M.value)}):n.jsx(P.MenuItem,{role:"option","aria-selected":ce,"aria-disabled":!!M.disabled,disabled:M.disabled,mark:S,selected:ce,ellipsisLabel:!0,icon:M.icon,label:M.labelNode??M.label,description:M.description,rightControl:M.rightControl,onClick:()=>!M.disabled&&Be(M.value)});return n.jsx(h.Fragment,{children:M.interactiveTooltip?n.jsx(P.InteractiveTooltip,{asChild:!0,placement:M.interactiveTooltip.placement,content:M.interactiveTooltip.content,contentClassName:M.interactiveTooltip.contentClassName,children:lt}):lt},M.value)})}),B&&n.jsx("div",{onClick:M=>{F?.(M),F&&fe(!1)},children:typeof B=="function"?B():B})]});return n.jsxs("div",{className:I.mergeClasses(w.DIAL_KIT_CLASS.select,"flex w-full flex-col gap-2",O),children:[u&&n.jsx(P.Label,{...u,htmlFor:W}),n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsx(P.Dropdown,{open:ge,onOpenChange:fe,disabled:L,closable:N,onClose:U,placement:"bottom-start",allowedPlacements:["bottom-start","top-start"],listClassName:I.mergeClasses(Ol,R),className:"w-full",renderOverlay:Vn,children:n.jsx(Ve,{id:W,size:i,disabled:L,invalid:v,value:Et,placeholder:xe?void 0:c,readOnly:!0,iconBefore:t?void 0:A?.icon,iconAfter:n.jsx(H.IconChevronDown,{size:te?K.DIAL_ICON_SIZE.SM:K.DIAL_ICON_SIZE.MD,stroke:oe.DIAL_KIT_ICON_STROKE,"aria-hidden":"true",className:I.mergeClasses(kl,ge&&"rotate-180")}),role:"combobox","aria-haspopup":"listbox","aria-expanded":ge,"aria-controls":se,"aria-autocomplete":"none","aria-label":Kn,containerClassName:"w-full",wrapperClassName:I.mergeClasses(!L&&"cursor-pointer",t&&we&&["!h-auto flex-wrap py-1.5",te?"min-h-[24px]":"min-h-[40px]"],_),className:I.mergeClasses("cursor-pointer",xe&&"w-0 min-w-0 flex-none p-0"),onKeyDown:Gn,children:xe})}),n.jsx(Pe,{text:d}),!d&&n.jsx(ke,{text:p})]})]})};var Bn=(e=>(e.None="none",e.Both="both",e.Horizontal="horizontal",e.Vertical="vertical",e))(Bn||{});const Kr={none:"resize-none",both:"resize",horizontal:"resize-x",vertical:"resize-y"},Hl=e=>typeof e=="boolean"?Kr[e?"both":"none"]:Kr[e],Kl=({className:e="",value:t,onChange:r,error:s,containerClassName:a,resize:i=!1,labelProps:o,caption:l,id:c,...u})=>{const d=I.mergeClasses("dial-kit-textarea dial-kit-input px-3 py-2",u.invalid&&"dial-kit-input-error",u.disabled&&"dial-kit-input-disable",Hl(i),e);return n.jsxs("div",{className:I.mergeClasses("flex flex-col gap-2",a),children:[o&&n.jsx(P.Label,{...o,htmlFor:c}),n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsx("textarea",{id:c,value:t||"",className:d,onChange:p=>r?.(p.currentTarget.value),...u}),n.jsx(Pe,{text:s}),!s&&n.jsx(ke,{text:l})]})]})},Gl=({showPasswordLabel:e="Show password",hidePasswordLabel:t="Hide password",disabled:r,size:s=T.ElementSize.Standard,...a})=>{const[i,o]=h.useState(!1),l=i&&!r;return h.useEffect(()=>{r&&o(!1)},[r]),n.jsx(Ve,{...a,wrapperClassName:I.mergeClasses(w.DIAL_KIT_CLASS.passwordInput,a.wrapperClassName),size:s,disabled:r,type:l?"text":"password",iconAfter:r?void 0:n.jsx(P.GhostIconButton,{size:T.ElementSize.Small,"aria-label":l?t:e,"aria-pressed":l,icon:l?n.jsx(H.IconEyeOff,{size:K.DIAL_ICON_SIZE.SM,stroke:oe.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}):n.jsx(H.IconEye,{size:K.DIAL_ICON_SIZE.SM,stroke:oe.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}),onClick:()=>o(c=>!c)})})},Vl=/^0+\.(\d+)?$/,Ul=/^0+/,Wl=[".","-","+","e","E"],Gr=e=>!e||e==="-"?e:String(e).match(Vl)?String(e).replace(Ul,"0"):Number(e),ql=({integer:e,onChange:t,min:r,max:s,onKeyDown:a,onPaste:i,...o})=>{const l=u=>{if(e&&Wl.includes(u.key)){u.preventDefault();return}kn(u,"number",r,s),a?.(u)},c=u=>{if(e){const d=u.clipboardData.getData("text"),p=d.replace(/\D/g,"");if(p!==d&&(u.preventDefault(),p)){const g=u.currentTarget,f=g.selectionStart??0,m=g.selectionEnd??0,y=g.value.slice(0,f)+p+g.value.slice(m);t?.(Gr(y))}}i?.(u)};return n.jsx(Ve,{...o,wrapperClassName:I.mergeClasses(w.DIAL_KIT_CLASS.numberInput,o.wrapperClassName),type:"number",min:r,max:s,onChange:u=>t?.(Gr(u)),onKeyDown:l,onPaste:c})},Zl="z-[52] flex items-center justify-center bg-backdrop md:p-4 gap-5 p-6",Yl="relative flex w-full max-h-full flex-col rounded-xl bg-layer-raised md:h-auto",Xl="flex flex-row items-center justify-between px-6 py-4",Jl="flex-1 min-w-0 mr-3 truncate dial-h1-text text-primary",Ql="border-b border-tertiary",ec="flex flex-row items-center gap-2 px-6 py-4",tc="border-t border-tertiary",Ht="flex shrink-0 flex-row items-center gap-2",rc={[b.PopupSize.Sm]:"max-w-full md:max-w-[400px]",[b.PopupSize.Md]:"max-w-full md:max-w-[800px]",[b.PopupSize.Lg]:"max-w-full md:max-w-[1200px]"},gr=({open:e=!1,header:t,ariaLabel:r,portalId:s,className:a,overlayClassName:i,titleClassName:o,headerClassName:l,bodyClassName:c,children:u,footer:d,footerClassName:p,onClose:g,onBack:f,backAriaLabel:m="Back",headerActions:y,headerDivider:x=!1,mainButtons:v,additionalButtons:C,additionalButtonsOnLeft:S=!1,footerDivider:E=!1,size:D=b.PopupSize.Md,hideClose:j=!1,closeAriaLabel:L="Close dialog",closeOnOutsideClick:O=!0,preventKeyboardOnOpen:_=!1})=>{const R=w.useThemeScope(),N=h.useRef(null),k=h.useId(),{refs:B,context:U}=de.useFloating({open:e,onOpenChange:W=>{W||g?.(null)}}),Q=de.useRole(U,{role:"dialog"}),V=de.useDismiss(U,{outsidePress:O}),{getFloatingProps:F}=de.useInteractions([Q,V]);if(!e)return null;const z=typeof t=="string"?`popup-heading-${k}`:void 0,Z=W=>W?typeof W=="string"?n.jsx("h2",{id:z,className:I.mergeClasses(Jl,o),children:n.jsx(P.Tooltip,{tooltip:W,triggerClassName:"truncate",children:W})}):W:n.jsx("span",{}),G=j?null:n.jsx(P.CloseButton,{ariaLabel:L,onClose:W=>g?.(W)}),ne=(W,se=[])=>se.map(({variant:te=T.ButtonVariant.Neutral,...le},ue)=>n.jsx(et,{variant:te,...le},`${W}-${ue}`)),X=()=>{if(d!==void 0)return d;if(!v?.length&&!C?.length)return null;const W=ne("additional",C);return n.jsxs("div",{className:I.mergeClasses(ec,E&&tc,p),children:[S&&W.length>0&&n.jsx("div",{className:Ht,children:W}),n.jsxs("div",{className:I.mergeClasses(Ht,"ml-auto"),children:[!S&&W,ne("main",v)]})]})};return n.jsx(de.FloatingPortal,{id:s,children:n.jsx(de.FloatingOverlay,{className:I.mergeClasses(Zl,R,i),children:n.jsx(de.FloatingFocusManager,{context:U,initialFocus:_?N:B.floating,children:n.jsxs("div",{ref:B.setFloating,...F(),role:"dialog","aria-modal":"true","aria-labelledby":z,"aria-label":z?void 0:r,className:I.mergeClasses(w.DIAL_KIT_CLASS.popup,Yl,rc[D],a),children:[_&&n.jsx("div",{ref:N,tabIndex:-1,"aria-hidden":!0,className:"absolute size-px -m-px overflow-hidden opacity-0 pointer-events-none"}),n.jsxs("div",{className:I.mergeClasses(Xl,x&&Ql,l),children:[f&&n.jsx(P.GhostIconButton,{"aria-label":m,size:T.ElementSize.Small,className:"mr-2",onClick:f,icon:n.jsx(H.IconChevronLeft,{size:K.DIAL_ICON_SIZE.SM,stroke:oe.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"})}),Z(t),y?n.jsxs("div",{className:Ht,children:[y,G]}):G]}),n.jsx("div",{className:I.mergeClasses("grow overflow-auto",c),children:u}),X()]})})})})},nc="flex justify-end gap-2 px-6 py-4 border-t border-tertiary",sc="text-secondary dial-small-paragraph-text px-6 pb-4",ac="px-6 py-4 h-[120px]",ic="Cancel",oc="Ok",Kt={[b.ConfirmationPopupVariant.Info]:{confirm:{variant:T.ButtonVariant.Primary,appearance:T.ButtonAppearance.Solid}},[b.ConfirmationPopupVariant.Danger]:{container:"border-t-4 border-error",confirm:{variant:T.ButtonVariant.Danger,appearance:T.ButtonAppearance.Solid}}},lc=({header:e,description:t,descriptionClassName:r,open:s=!1,confirmLabel:a=oc,cancelLabel:i=ic,isLoading:o=!1,disableConfirmButton:l=!1,className:c,confirmClassName:u,onClose:d,onConfirm:p,onCancel:g,children:f,variant:m=b.ConfirmationPopupVariant.Info,size:y=b.PopupSize.Sm,footer:x,hideClose:v,...C})=>{const S=o?null:n.jsxs("div",{className:nc,children:[n.jsx(pr,{label:i,onClick:()=>g?g():d?.()}),n.jsx(et,{variant:Kt[m].confirm.variant,appearance:Kt[m].confirm.appearance,className:u,label:a,disabled:l,onClick:p})]}),E=h.useCallback(()=>o?n.jsx("div",{className:ac,children:n.jsx(b.Spinner,{size:40})}):f??(t?n.jsx("div",{className:I.mergeClasses(sc,r),children:t}):null),[f,t,o,r]);return n.jsx(gr,{...C,open:s,header:e,className:I.mergeClasses(w.DIAL_KIT_CLASS.confirmationPopup,Kt[m].container,c),onClose:()=>d?.(),footer:x??S,size:y,hideClose:v??(!o&&x===void 0),children:E()})},cc=({title:e,description:t,children:r,expanded:s,defaultExpanded:a=!1,disabled:i,nonCollapsible:o,ariaLabel:l,onToggle:c,className:u,headerClassName:d,contentClassName:p})=>{const g=s!==void 0,[f,m]=h.useState(a),y=o?!0:g?s:f,x=h.useId(),v=`accordion-header-${x}`,C=`accordion-content-${x}`,S=()=>{if(i)return;const D=!y;g||m(D),c?.(D)},E=n.jsxs(n.Fragment,{children:[n.jsxs("span",{className:"flex min-w-0 flex-col",children:[n.jsx("span",{className:"truncate dial-body-text text-primary",children:e}),t?n.jsx("span",{className:"truncate dial-tiny-text text-secondary",children:t}):null]}),!o&&n.jsx(H.IconChevronRight,{size:K.DIAL_ICON_SIZE.SM,stroke:oe.DIAL_KIT_ICON_STROKE,"aria-hidden":"true",className:I.mergeClasses("shrink-0 text-secondary transition-transform motion-reduce:transition-none",y&&"rotate-90")})]});return n.jsxs("div",{className:I.mergeClasses(w.DIAL_KIT_CLASS.accordion,"flex flex-col gap-3 py-3 overflow-hidden bg-transparent ",u),children:[o?n.jsx("div",{id:v,className:I.mergeClasses("flex w-full px-4 rounded-xl items-center justify-between dial-tiny-text",d),children:E}):n.jsx("button",{id:v,type:"button","aria-expanded":y,"aria-controls":y?C:void 0,"aria-label":T.resolveAccessibleName(l),disabled:i,onClick:S,className:I.mergeClasses("flex w-full px-4 rounded-xl items-center justify-between dial-tiny-text",i?"cursor-not-allowed opacity-75":"cursor-pointer hover:bg-control-accent-alpha-hover focus-visible:outline focus-visible:outline-focus",d),children:E}),y&&n.jsx("div",{id:C,role:"region","aria-labelledby":v,className:I.mergeClasses("px-4 dial-small-text text-primary",p),children:r})]})},dc=({id:e,labelProps:t,isOn:r=!1,disabled:s,onChange:a,caption:i,className:o,...l})=>{const c=h.useId(),u=e??c,d=i?`${u}-caption`:void 0,p=h.useCallback(g=>{a?.(g.target.checked)},[a]);return n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsxs("div",{className:I.mergeClasses(w.DIAL_KIT_CLASS.switch,"flex items-center gap-2",o),children:[n.jsx("input",{...l,type:"checkbox",role:"switch",id:u,checked:r,"aria-checked":r,disabled:s,onChange:p,"aria-label":T.resolveAccessibleName(typeof t?.label!="string"?l["aria-label"]:void 0),"aria-describedby":d,className:"peer sr-only"}),n.jsx("label",{htmlFor:u,className:I.mergeClasses("flex h-[18px] w-[36px] shrink-0 items-center rounded-full p-0.5 transition-colors duration-200","peer-focus-visible:outline peer-focus-visible:outline-offset-2 peer-focus-visible:outline-focus",r?"justify-end":"justify-start",s?"cursor-not-allowed bg-control-disable-primary":I.mergeClasses("cursor-pointer",r?"bg-control-accent hover:bg-control-accent-hover":"bg-control-neutral-default hover:bg-control-neutral-hover-strong")),children:n.jsx("span",{className:I.mergeClasses("size-3.5 shrink-0 rounded-full",s?"bg-control-disable-secondary":"bg-control-neutral")})}),t&&n.jsx(P.Label,{size:T.ElementSize.Standard,...t,htmlFor:u,className:I.mergeClasses("py-[1px]",s?"cursor-not-allowed text-control-disable-primary":"cursor-pointer text-primary",t.className)})]}),i&&n.jsx("span",{id:d,className:"dial-tiny-text text-secondary ml-[44px]",children:i})]})},uc="flex flex-col gap-2",fc="flex",pc="mt-2 ml-[26px]",gc={[b.RadioGroupOrientation.Column]:"flex-col gap-y-3",[b.RadioGroupOrientation.Row]:"flex-row flex-wrap gap-x-4 gap-y-3"},zn=({items:e,value:t,onChange:r,name:s,id:a,orientation:i=b.RadioGroupOrientation.Column,labelProps:o,disabled:l,error:c,caption:u,ariaLabel:d,className:p,optionsClassName:g,radioClassName:f,contentClassName:m})=>{const y=h.useId(),x=a??y,v=`${x}-label`,C=c?`${x}-error`:void 0,S=!c&&u?`${x}-caption`:void 0,E=T.resolveAccessibleName(o?.label);return n.jsxs("div",{className:I.mergeClasses(w.DIAL_KIT_CLASS.radioGroup,uc,p),children:[o&&n.jsx(P.Label,{...o,id:v}),n.jsx("div",{role:"radiogroup","aria-labelledby":E?v:void 0,"aria-label":E?void 0:T.resolveAccessibleName(d),"aria-describedby":[C,S].filter(Boolean).join(" ")||void 0,"aria-disabled":l||void 0,className:I.mergeClasses(fc,gc[i],g),children:e.map(D=>{const j=D.value===t;return n.jsxs("div",{className:"flex min-w-0 flex-col",children:[n.jsx(P.Radio,{id:`${x}-${D.value}`,name:s??x,value:D.value,labelProps:D.label==null?void 0:{label:D.label},"aria-label":D["aria-label"],caption:D.caption,isSelected:j,disabled:l||D.disabled,onChange:r,className:f}),j&&D.content?n.jsx("div",{className:I.mergeClasses(pc,m),children:D.content}):null]},D.value)})}),n.jsx(Pe,{id:C,text:c}),!c&&n.jsx(ke,{id:S,text:u})]})},hc="dial-kit-input flex flex-row items-center justify-between gap-x-2 px-3 text-left",mc="min-w-0 flex-1 truncate text-primary",xc="min-w-0 flex-1 truncate text-secondary",bc="shrink-0 text-secondary",yc="px-6 pb-4",vc="flex justify-end gap-2 px-6 py-4 border-t border-tertiary",Dc="Cancel",Cc="Apply",Ic=({items:e,value:t,customValue:r,header:s,onApply:a,id:i,labelProps:o,placeholder:l,selectedValue:c,onSelectionChange:u,onCancel:d,onClose:p,isValid:g=!0,applyButtonLabel:f=Cc,cancelButtonLabel:m=Dc,size:y=b.PopupSize.Md,portalId:x,disabled:v,invalid:C,error:S,caption:E,ariaLabel:D,className:j,fieldClassName:L})=>{const O=h.useId(),_=i??O,R=`${_}-label`,N=`${_}-value`,k=S?`${_}-error`:void 0,B=!S&&E?`${_}-caption`:void 0,[U,Q]=h.useState(!1),V=c!==void 0,[F,z]=h.useState(t),Z=V?c:F,G=h.useCallback(()=>{v||(V||z(t),Q(!0))},[v,V,t]),ne=h.useCallback(()=>{Q(!1),p?.()},[p]),X=h.useCallback(()=>{d?.(),ne()},[d,ne]),W=h.useCallback(()=>{a(Z),ne()},[a,Z,ne]),se=h.useCallback(q=>{V||z(q),u?.(q)},[V,u]),te=T.resolveAccessibleName(o?.label),le=te?void 0:T.resolveAccessibleName(D),ue=te?R:le&&`${_}-name`,pe=T.resolveAccessibleName(s),ge=e.find(q=>q.value===t)?.label,fe=r??ge;return n.jsxs("div",{className:I.mergeClasses(w.DIAL_KIT_CLASS.radioGroupPopupField,"flex w-full flex-col gap-2",j),children:[o&&n.jsx(P.Label,{...o,id:R,htmlFor:_}),n.jsxs("div",{className:"flex flex-col gap-1",children:[le&&n.jsx("span",{id:ue,className:"sr-only",children:le}),n.jsxs("button",{type:"button",id:_,disabled:v,"aria-haspopup":"dialog","aria-expanded":U,"aria-labelledby":ue?`${ue} ${N}`:void 0,"aria-describedby":[k,B].filter(Boolean).join(" ")||void 0,onClick:G,className:I.mergeClasses(hc,C&&"dial-kit-input-error",v&&"dial-kit-input-disable",L),children:[n.jsx("span",{id:N,className:fe==null?xc:mc,children:fe??l}),n.jsx(H.IconMaximize,{size:K.DIAL_ICON_SIZE.MD,stroke:oe.DIAL_KIT_ICON_STROKE,"aria-hidden":"true",className:bc})]}),n.jsx(Pe,{id:k,text:S}),!S&&n.jsx(ke,{id:B,text:E})]}),n.jsx(gr,{open:U,header:s,ariaLabel:pe?void 0:te,portalId:x,size:y,onClose:X,footer:n.jsxs("div",{className:vc,children:[n.jsx(pr,{label:m,onClick:X}),n.jsx(Ln,{label:f,disabled:!g,onClick:W})]}),children:n.jsx("div",{className:yc,children:n.jsx(zn,{id:`${_}-options`,items:e,value:Z,onChange:se,orientation:b.RadioGroupOrientation.Column,ariaLabel:te??pe})})})]})},Sc=({icon:e,selectedIcon:t,isSelected:r=!1,onToggle:s,onClick:a,tooltipProps:i,size:o=T.ElementSize.Small,className:l,...c})=>{const u=h.useCallback(p=>{a?.(p),s?.(!r)},[a,s,r]),d=n.jsx(P.IconButton,{...c,size:o,variant:T.ButtonVariant.Primary,appearance:T.ButtonAppearance.Ghost,icon:r?t??e:e,"aria-pressed":r,"aria-label":T.resolveAccessibleName(c["aria-label"],i?.tooltip),onClick:u,className:I.mergeClasses(w.DIAL_KIT_CLASS.toggleIconButton,"!rounded","[&_svg]:size-4",r&&"!text-accent",l)});return i?n.jsx(P.Tooltip,{asChild:!0,...i,children:d}):d},Nc=["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End"],jc="inline-flex w-fit items-center gap-1 rounded-full border border-tertiary bg-layer-sunken p-[3px]",Tc="flex h-8 min-w-8 grow shrink-0 basis-auto items-center justify-center gap-2 whitespace-nowrap rounded-full px-4 dial-small-text transition-colors duration-200 outline-offset-0 focus-visible:outline focus-visible:outline-focus",wc="bg-layer-raised text-accent shadow-xs",Ec="bg-transparent text-secondary",Oc="cursor-pointer hover:bg-control-accent-alpha-hover active:bg-control-accent-alpha-active",Ac="cursor-pointer hover:bg-control-accent-alpha-hover hover:text-accent active:bg-control-accent-alpha-active",_c="cursor-not-allowed bg-control-disable-primary text-control-disable-primary shadow-none",Lc="cursor-not-allowed bg-transparent text-control-disable-primary",Rc=({items:e,value:t,onChange:r,disabled:s,className:a,segmentClassName:i,"aria-label":o})=>{const l=h.useRef({}),c=e.find(p=>p.value===t),u=c&&!c.disabled?c.value:e.find(p=>!p.disabled)?.value,d=h.useCallback(p=>{if(s||!Nc.includes(p.key))return;const g=e.filter(v=>!v.disabled);if(g.length===0)return;const f=Math.max(g.findIndex(v=>v.value===t),0),m=g.length-1;let y=f;switch(p.key){case"ArrowRight":case"ArrowDown":y=f===m?0:f+1;break;case"ArrowLeft":case"ArrowUp":y=f===0?m:f-1;break;case"Home":y=0;break;case"End":y=m;break}p.preventDefault();const x=g[y];l.current[x.value]?.focus(),x.value!==t&&r(x.value)},[s,e,t,r]);return n.jsx("div",{role:"radiogroup","aria-label":o,"aria-disabled":s||void 0,onKeyDown:d,className:I.mergeClasses(w.DIAL_KIT_CLASS.segmentedControl,jc,a),children:e.map(p=>{const g=p.value===t,f=s||p.disabled;return n.jsxs("button",{ref:m=>{l.current[p.value]=m},type:"button",role:"radio","aria-checked":g,"aria-label":T.resolveAccessibleName(p["aria-label"],typeof p.label=="string"?p.label:void 0),tabIndex:p.value===u?0:-1,disabled:f,onClick:()=>r(p.value),className:I.mergeClasses(w.DIAL_KIT_CLASS.segmentedControlItem,Tc,g?wc:Ec,f?g?_c:Lc:g?Oc:Ac,i),children:[p.icon,p.label]},p.value)})})},kc=["ArrowRight","ArrowLeft","Home","End"],Pc=({tabs:e,activeTabId:t,onTabChange:r,ariaLabel:s,className:a,tabClassName:i})=>{const o=h.useRef({}),l=e.find(d=>d.id===t),c=l&&!l.disabled?l.id:e.find(d=>!d.disabled)?.id,u=h.useCallback(d=>{if(!kc.includes(d.key)||e.length===0)return;const p=e.filter(x=>!x.disabled);if(p.length===0)return;const g=Math.max(p.findIndex(x=>x.id===t),0),f=p.length-1;let m=g;switch(d.key){case"ArrowRight":m=g===f?0:g+1;break;case"ArrowLeft":m=g===0?f:g-1;break;case"Home":m=0;break;case"End":m=f;break}d.preventDefault();const y=p[m];o.current[y.id]?.focus(),y.id!==t&&r(y.id)},[e,t,r]);return n.jsx("div",{role:"tablist","aria-label":s,onKeyDown:u,className:I.mergeClasses(w.DIAL_KIT_CLASS.tabs,"flex justify-start gap-1",a),children:e.map(d=>{const p=t===d.id,g=!!d.disabled;return n.jsxs("button",{ref:f=>{o.current[d.id]=f},type:"button",role:"tab","aria-selected":p,disabled:g,tabIndex:d.id===c?0:-1,onClick:()=>r(d.id),className:I.mergeClasses(w.DIAL_KIT_CLASS.tab,"dial-small-paragraph-semi-text dial-kit-enhanced-target","border-b-2 border-transparent flex items-center gap-2 px-3 py-2 text-start","transition-colors motion-reduce:transition-none","focus-visible:outline focus-visible:outline-offset-2 focus-visible:outline-focus",g&&"cursor-not-allowed border-control-disable-primary text-control-disable-primary",!g&&(p?"dial-kit-tab-selected-underline text-primary":"border-transparent text-secondary"),i),children:[n.jsx("span",{children:d.label}),d.count!=null&&n.jsx("span",{className:I.mergeClasses("dial-tiny-semi-text rounded-full px-1.5 py-0.5",g&&"bg-layer-sunken text-control-disable-primary",!g&&(p?"bg-control-accent-alpha text-accent":"bg-layer-sunken text-secondary")),children:d.count})]},d.id)})})},Mc="flex flex-nowrap items-center gap-1",Fc="min-w-max flex-1 justify-center",Bc=({items:e,value:t,onChange:r,stretch:s=!1,className:a,chipClassName:i,"aria-label":o,"aria-labelledby":l})=>n.jsx("div",{role:"group","aria-label":o,"aria-labelledby":l,className:I.mergeClasses(w.DIAL_KIT_CLASS.filterChips,Mc,a),children:e.map(c=>n.jsx(Ke,{label:c.label,icon:c.icon,appearance:Ue.Selectable,selected:c.value===t,onClick:()=>r(c.value),className:I.mergeClasses(s&&Fc,i)},c.value))}),Jt=(e,t)=>{const r=(t??"").split(",").map(i=>i.trim().toLowerCase()).filter(Boolean);if(r.length===0)return!0;const s=e.name.toLowerCase(),a=e.type.toLowerCase();return r.some(i=>{if(i.startsWith("."))return s.endsWith(i);if(i.endsWith("/*")){const o=i.slice(0,-1);return a.length>o.length&&a.startsWith(o)}return a===i})},zc=({labelProps:e,label:t,description:r,onChange:s,onReject:a,accept:i,multiple:o=!1,disabled:l=!1,errorText:c,icon:u,id:d,ariaLabel:p,className:g})=>{const f=h.useId(),m=d??`file-dropzone-${f}`,y=c?`${m}-error`:void 0,[x,v]=h.useState(!1),C=h.useRef(0),S=h.useCallback(R=>{if(R.length===0)return;const N=o?R:R.slice(0,1),k=N.filter(U=>Jt(U,i)),B=N.filter(U=>!Jt(U,i));B.length>0&&a?.(B),k.length>0&&s(k)},[i,o,s,a]),E=h.useCallback(R=>{S(Array.from(R.target.files??[])),R.target.value=""},[S]),D=h.useCallback(()=>{C.current=0,v(!1)},[]),j=h.useCallback(R=>{l||(R.preventDefault(),C.current+=1,v(!0))},[l]),L=h.useCallback(R=>{l||(R.preventDefault(),R.dataTransfer.dropEffect="copy")},[l]),O=h.useCallback(()=>{l||(C.current-=1,C.current<=0&&D())},[l,D]),_=h.useCallback(R=>{R.preventDefault(),!l&&(D(),S(Array.from(R.dataTransfer?.files??[])))},[l,D,S]);return n.jsxs("div",{className:"flex flex-col gap-1",children:[e&&n.jsx(P.Label,{...e,htmlFor:m}),n.jsx("input",{id:m,type:"file",accept:i,multiple:o,disabled:l,onChange:E,"aria-label":T.resolveAccessibleName(typeof t!="string"?p:void 0),"aria-describedby":y,"aria-invalid":c?!0:void 0,className:"peer sr-only"}),n.jsxs("label",{htmlFor:m,onDragEnter:j,onDragOver:L,onDragLeave:O,onDrop:_,className:I.mergeClasses(w.DIAL_KIT_CLASS.fileDropzone,"flex flex-col items-center justify-center gap-3 rounded-xl border border-dashed px-6 py-10 text-center","transition-colors motion-reduce:transition-none","peer-focus-visible:outline peer-focus-visible:outline-offset-2 peer-focus-visible:outline-focus",l?"cursor-not-allowed border-secondary bg-layer-sunken":"cursor-pointer bg-layer-base",!l&&x&&"border-accent bg-control-accent-alpha",!l&&!x&&"border-secondary hover:border-accent",c&&!x&&"border-error hover:border-error",g),children:[u??n.jsx(H.IconUpload,{size:K.DIAL_ICON_SIZE.LG,stroke:oe.DIAL_KIT_ICON_STROKE,"aria-hidden":"true",className:l?"text-control-disable-primary":"text-secondary"}),n.jsxs("span",{className:"flex flex-col gap-1",children:[n.jsx("span",{className:I.mergeClasses("dial-small-text",l?"text-control-disable-primary":"text-primary"),children:t}),r&&n.jsx("span",{className:I.mergeClasses("dial-tiny-text",l?"text-control-disable-primary":"text-secondary"),children:r})]})]}),n.jsx(Pe,{id:y,text:c})]})},$c=({availableWidth:e,tagWidths:t,overflowChipWidth:r,gap:s})=>{if(e<=0)return t.length;let a=0,i=0;for(const o of t){const l=o+s;if(a+l>e)break;a+=l,i++}if(i===t.length)return i;for(;i>0&&a+r>e;)i--,a-=t[i]+s;return i},Hc=4,Kc=24,Vr=e=>parseFloat(e)||0,Gc=e=>{let t=e.length;for(;t>0&&e[t-1]===",";)t--;return e.slice(0,t)},Vc=()=>{},Uc=({id:e,value:t,defaultValue:r,size:s=T.ElementSize.Standard,labelProps:a,placeholder:i,caption:o,error:l,invalid:c,disabled:u=!1,readOnly:d=!1,collapseTagOverflow:p=!1,ariaLabel:g,tagListLabel:f="Tags",className:m,fieldClassName:y,tagClassName:x,onChange:v})=>{const C=h.useId(),S=e||C,E=s===T.ElementSize.Small,D=h.useRef(null),j=h.useRef([]),L=h.useRef(null),O=t!==void 0,[_,R]=h.useState(r??[]),N=O?t:_,k=N.length,[B,U]=h.useState(""),[Q,V]=h.useState(k),F=!d&&!u,z=h.useCallback(q=>{O||R(q),v?.(q)},[O,v]),Z=h.useCallback(q=>ee=>{j.current[q]=ee},[]),G=h.useCallback(()=>{const q=D.current;if(!q||q.clientWidth===0){V(N.length);return}const{paddingLeft:ee,paddingRight:Ie}=getComputedStyle(q);V($c({availableWidth:q.clientWidth-Vr(ee)-Vr(Ie)-(d?0:Kc),tagWidths:N.map((Me,he)=>j.current[he]?.offsetWidth??0),overflowChipWidth:L.current?.offsetWidth??0,gap:Hc}))},[d,N]);h.useEffect(()=>{if(!p){V(k);return}const q=D.current;if(!q)return;const ee=new ResizeObserver(()=>G());return ee.observe(q),G(),()=>ee.disconnect()},[p,G,k]);const ne=I.mergeClasses(p?"shrink-0":"min-w-0",x),X=q=>{const ee=Gc(q.trim()).trim();!ee||N.includes(ee)||z([...N,ee])},W=q=>{z(N.filter(ee=>ee!==q))},se=()=>{X(B),U("")},te=q=>{if(F){if(q.key==="Enter"||q.key===","){q.preventDefault(),se();return}q.key==="Backspace"&&!B&&k>0&&(q.preventDefault(),z(N.slice(0,-1)))}},le=()=>{F&&B.trim()&&se()},ue=p?N.slice(0,Q):N,pe=p?N.slice(Q):[],ge=pe.join(", "),fe=k>0&&n.jsxs("span",{role:"list","aria-label":f,className:I.mergeClasses("relative flex min-w-0 items-center gap-1",p?"flex-nowrap":"flex-wrap"),children:[ue.map(q=>n.jsx(Ke,{role:"listitem",label:q,className:ne,disabled:u,closable:F,onRemove:F?()=>W(q):void 0},q)),pe.length>0&&n.jsx(Ke,{role:"listitem",label:`+${pe.length}`,"aria-label":ge,title:ge,className:I.mergeClasses("shrink-0",x),disabled:u}),p&&n.jsxs("span",{"aria-hidden":"true",className:"pointer-events-none invisible absolute left-0 top-0 h-0 overflow-hidden whitespace-nowrap",children:[N.map((q,ee)=>n.jsx("span",{ref:Z(ee),className:"inline-flex",children:n.jsx(Ke,{label:q,className:x,disabled:u,closable:F,onRemove:F?Vc:void 0})},q)),n.jsx("span",{ref:L,className:"inline-flex",children:n.jsx(Ke,{label:`+${k}`,className:x})})]})]});return n.jsx(Ve,{id:S,size:s,labelProps:a,caption:o,error:l,invalid:c,disabled:u,readOnly:d,value:B,placeholder:k>0?void 0:i,"aria-label":g,wrapperRef:D,onChange:q=>U(q??""),onKeyDown:te,onBlur:le,containerClassName:I.mergeClasses("w-full",m),wrapperClassName:I.mergeClasses(w.DIAL_KIT_CLASS.tagInput,k>0&&["!h-auto",E?"min-h-[24px] py-0.5":"min-h-[40px] py-1.5",p?"flex-nowrap overflow-hidden":"flex-wrap"],y),className:I.mergeClasses("w-auto flex-1",p?"min-w-[24px]":"min-w-[100px]",d&&"cursor-default"),children:fe})},Wc={[T.ElementSize.Small]:K.DIAL_ICON_SIZE.SM,[T.ElementSize.Standard]:K.DIAL_ICON_SIZE.MD,[T.ElementSize.Large]:K.DIAL_ICON_SIZE.MD},qc=({size:e=T.ElementSize.Standard,placeholder:t="Search...",withoutBorder:r=!1,clearLabel:s="Clear search",disabled:a,value:i,onChange:o,wrapperClassName:l,inputRef:c,...u})=>{const d=h.useRef(null),p=de.useMergeRefs([c,d]),g=!!i&&!a,f=h.useCallback(()=>{o?.(void 0),d.current?.focus()},[o]);return n.jsx(Ve,{...u,size:e,value:i,disabled:a,onChange:o,placeholder:t,inputRef:p,wrapperClassName:I.mergeClasses(w.DIAL_KIT_CLASS.search,r&&"dial-kit-input-borderless",l),iconBefore:n.jsx(H.IconSearch,{size:Wc[e],stroke:oe.DIAL_KIT_ICON_STROKE,className:"text-secondary","aria-hidden":"true"}),iconAfter:g?n.jsx(P.GhostIconButton,{size:T.ElementSize.Small,"aria-label":s,icon:n.jsx(H.IconX,{size:K.DIAL_ICON_SIZE.SM,stroke:oe.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}),onClick:f}):void 0})},Zc=16,Yc=e=>(e.toString().split(".")[1]??"").length,Xc=({id:e,value:t,min:r=0,max:s=1,step:a=.1,disabled:i,labelProps:o,labels:l,formatValue:c,showValue:u=!1,caption:d,error:p,onChange:g,containerClassName:f,trackClassName:m,fillClassName:y,className:x,...v})=>{const C=h.useId(),S=e??C,E=d&&!p?`${S}-caption`:void 0,D=p?`${S}-error`:void 0,j=s-r,L=j>0?Math.min(100,Math.max(0,(t-r)/j*100)):0,O=`calc(${L}% + ${(.5-L/100)*Zc}px)`,_=c?c(t):t.toFixed(Yc(a)),R=h.useCallback(N=>{g?.(Number(N.target.value))},[g]);return n.jsxs("div",{className:I.mergeClasses("flex flex-col gap-2",f),children:[(o||u)&&n.jsxs("div",{className:"flex items-center gap-2",children:[o&&n.jsx(P.Label,{...o,htmlFor:S}),u&&n.jsx("span",{"aria-hidden":"true",className:I.mergeClasses("dial-small-text ml-auto",i?"text-control-disable-primary":"text-primary"),children:_})]}),n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsxs("div",{className:"relative flex h-6 items-center",children:[n.jsx("div",{className:I.mergeClasses("pointer-events-none absolute inset-x-0 h-1 rounded-full",i?"bg-control-disable-primary":"bg-control-neutral-active",m)}),n.jsx("div",{className:I.mergeClasses("pointer-events-none absolute left-0 h-1 rounded-full",i?"bg-control-disable-secondary":"bg-control-accent",y),style:{width:O}}),n.jsx("input",{...v,type:"range",id:S,value:t,min:r,max:s,step:a,disabled:i,onChange:R,"aria-label":T.resolveAccessibleName(typeof o?.label!="string"?v["aria-label"]:void 0),"aria-valuetext":c?_:void 0,"aria-describedby":D??E,className:I.mergeClasses("dial-kit-slider absolute inset-0 h-full w-full",x)})]}),l&&n.jsx("div",{className:"dial-tiny-text flex text-secondary",children:l.length===3?n.jsxs(n.Fragment,{children:[n.jsx("span",{children:l[0]}),n.jsx("span",{className:"flex-1 text-center",children:l[1]}),n.jsx("span",{children:l[2]})]}):n.jsxs(n.Fragment,{children:[n.jsx("span",{children:l[0]}),n.jsx("span",{className:"ml-auto",children:l[1]})]})}),n.jsx(Pe,{id:D,text:p}),!p&&n.jsx(ke,{id:E,text:d})]})]})},Jc=48,Qc=({children:e,title:t,width:r=280,collapsedWidth:s=Jc,isOpened:a,defaultOpened:i=!0,onToggle:o,additionalButtons:l,ariaLabel:c="Sidebar",collapseLabel:u="Collapse sidebar",expandLabel:d="Expand sidebar",className:p,titleClassName:g,contentClassName:f,footerClassName:m})=>{const y=a!==void 0,[x,v]=h.useState(i),C=y?a:x,S=`collapsible-sidebar-content-${h.useId()}`,E=C?u:d,D=j=>{const L=!C;y||v(L),o?.(L,j)};return n.jsxs("aside",{"aria-label":c,style:{width:`${C?r:s}px`},className:I.mergeClasses(w.DIAL_KIT_CLASS.collapsibleSidebar,"flex flex-col justify-between",p),children:[n.jsx("div",{id:S,hidden:!C,className:I.mergeClasses("min-h-0 flex-1 overflow-auto p-4",f),children:e}),n.jsx("div",{hidden:C,className:I.mergeClasses("rotate-180 px-3 py-4 [writing-mode:tb-rl] dial-small-text text-primary",g),children:t}),n.jsxs("div",{className:I.mergeClasses("flex h-12 shrink-0 flex-row items-center gap-2 border-t border-tertiary py-1",C?"justify-end px-2":"justify-center",m),children:[C&&l,n.jsx(P.IconButton,{variant:T.ButtonVariant.Primary,appearance:T.ButtonAppearance.Ghost,size:T.ElementSize.Standard,onClick:D,"aria-label":E,"aria-expanded":C,"aria-controls":S,tooltipProps:{tooltip:E},icon:C?n.jsx(H.IconChevronsLeft,{size:K.DIAL_ICON_SIZE.MD,stroke:oe.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}):n.jsx(H.IconChevronsRight,{size:K.DIAL_ICON_SIZE.MD,stroke:oe.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"})})]})]})},ed=({side:e,isResizing:t,width:r,minWidth:s,maxWidth:a,step:i,ariaLabel:o,onWidthChange:l,customHandler:c,handlerClassName:u})=>{const d=e===b.ResizableContainerSide.Left,p=d?H.IconChevronLeft:H.IconChevronRight,g=f=>{let m;switch(f.key){case"ArrowLeft":m=r+(d?i:-i);break;case"ArrowRight":m=r+(d?-i:i);break;case"Home":m=s;break;case"End":m=a;break;default:return}f.preventDefault(),l(m)};return n.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":o,"aria-valuenow":r,"aria-valuemin":s,"aria-valuemax":a,tabIndex:0,onKeyDown:g,className:I.mergeClasses("relative h-full w-0.5 cursor-col-resize bg-control-accent text-accent","opacity-0 transition-opacity motion-reduce:transition-none","group-hover:opacity-100 focus-visible:opacity-100","focus-visible:outline focus-visible:outline-offset-2 focus-visible:outline-focus",t&&"opacity-100",u),children:c??n.jsx(p,{size:K.DIAL_ICON_SIZE.MD,stroke:oe.DIAL_KIT_ICON_STROKE,"aria-hidden":"true",className:I.mergeClasses("pointer-events-none absolute top-1/2 -translate-y-1/2",d?"right-full":"left-full")})})},td=16,$n=({children:e,minWidth:t,maxWidth:r,width:s,defaultWidth:a,onResizeStop:i,onResize:o,side:l=b.ResizableContainerSide.Right,keyboardStep:c=td,ariaLabel:u="Resize panel",className:d,resizeHandlerClassName:p,resizeHandler:g})=>{const[f,m]=h.useState(!1),[y,x]=h.useState(a??t),v=s!==void 0,C=v?s:y,S=h.useRef(null),E=h.useCallback(()=>{m(!0)},[]),D=h.useCallback(()=>{m(!1);const O=S.current?.resizable?.getBoundingClientRect(),_=O?Math.round(O.width):t;v||x(_),i?.(_)},[i,v,t]),j=h.useCallback(O=>{const _=Math.min(r,Math.max(t,O));_!==C&&(v||(x(_),S.current?.updateSize({width:_,height:"100%"})),o?.(_),i?.(_))},[r,t,C,v,o,i]),L=h.useMemo(()=>{const O=l===b.ResizableContainerSide.Left,_=n.jsx(ed,{side:l,isResizing:f,width:C,minWidth:t,maxWidth:r,step:c,ariaLabel:u,onWidthChange:j,customHandler:g,handlerClassName:p});return{size:v?{width:C,height:"100%"}:void 0,defaultSize:v?void 0:{width:C,height:"100%"},minWidth:t,maxWidth:r,enable:{left:O,right:!O},handleClasses:{right:"group",left:"group"},handleStyles:{right:{right:"-8px",zIndex:10},left:{left:0,zIndex:10}},handleComponent:{left:O?_:void 0,right:O?void 0:_},onResizeStart:E,onResize:(R,N,k)=>{o?.(Math.round(k.offsetWidth))},onResizeStop:D}},[l,v,C,t,r,c,u,j,g,p,f,E,D,o]);return n.jsx(b.Resizable,{ref:S,...L,children:n.jsx("div",{className:I.mergeClasses(w.DIAL_KIT_CLASS.resizableContainer,"group flex size-full flex-col bg-layer-raised transition-all motion-reduce:transition-none",d),children:e})})},rd=({enabled:e=!0,children:t,...r})=>e?n.jsx($n,{...r,children:t}):t;exports.ConfirmationPopupVariant=b.ConfirmationPopupVariant;exports.DialBreadcrumb=b.DialBreadcrumb;exports.DialBreadcrumbItem=b.DialBreadcrumbItem;exports.DialButton=b.DialButton;exports.DialButtonDropdown=b.DialButtonDropdown;exports.DialCaptionText=b.DialCaptionText;exports.DialCollapsibleSidebar=b.DialCollapsibleSidebar;exports.DialConditionalResizableContainer=b.DialConditionalResizableContainer;exports.DialConfirmationPopup=b.DialConfirmationPopup;exports.DialDangerButton=b.DialDangerButton;exports.DialDestinationFolderPopup=b.DialDestinationFolderPopup;exports.DialErrorText=b.DialErrorText;exports.DialFileIcon=b.DialFileIcon;exports.DialFileManager=b.DialFileManager;exports.DialFileManagerActions=b.DialFileManagerActions;exports.DialFileManagerTabs=b.DialFileManagerTabs;exports.DialFileName=b.DialFileName;exports.DialFileNodeType=b.DialFileNodeType;exports.DialFilePermission=b.DialFilePermission;exports.DialFileResourceType=b.DialFileResourceType;exports.DialFolderName=b.DialFolderName;exports.DialFoldersTree=b.DialFoldersTree;exports.DialFormItem=b.DialFormItem;exports.DialGhostButton=b.DialGhostButton;exports.DialInput=b.DialInput;exports.DialItemType=b.DialItemType;exports.DialLinkButton=b.DialLinkButton;exports.DialLoader=b.DialLoader;exports.DialNeutralButton=b.DialNeutralButton;exports.DialNotification=b.DialNotification;exports.DialPopup=b.DialPopup;exports.DialPrimaryButton=b.DialPrimaryButton;exports.DialRadioGroup=b.DialRadioGroup;exports.DialResizableContainer=b.DialResizableContainer;exports.DialSearch=b.DialSearch;exports.DialSharedEntityIndicator=b.DialSharedEntityIndicator;exports.DialTabs=b.DialTabs;exports.EDITABLE_CONTAINER_ATTRIBUTE=b.EDITABLE_CONTAINER_ATTRIBUTE;exports.FileManagerColumnKey=b.FileManagerColumnKey;exports.FileManagerProvider=b.FileManagerProvider;exports.FlexibleActionsDirection=b.FlexibleActionsDirection;exports.FormItemOrientation=b.FormItemOrientation;exports.NAME_COLUMN=b.NAME_COLUMN;exports.NOT_ALLOWED_SPACES=b.NOT_ALLOWED_SPACES;exports.NOT_ALLOWED_SPACES_REGEXP=b.NOT_ALLOWED_SPACES_REGEXP;exports.NOT_ALLOWED_SYMBOLS=b.NOT_ALLOWED_SYMBOLS;exports.NOT_ALLOWED_SYMBOLS_REGEXP=b.NOT_ALLOWED_SYMBOLS_REGEXP;exports.NotificationType=b.NotificationType;exports.NotificationVariant=b.NotificationVariant;exports.PopupSize=b.PopupSize;exports.RadioGroupOrientation=b.RadioGroupOrientation;exports.ResizableContainerSide=b.ResizableContainerSide;exports.SIZE_COLUMN=b.SIZE_COLUMN;exports.ScreenResolution=b.ScreenResolution;exports.Skeleton=b.Skeleton;exports.SkeletonAvatarShape=b.SkeletonAvatarShape;exports.SkeletonAvatarSize=b.SkeletonAvatarSize;exports.SkeletonVariant=b.SkeletonVariant;exports.Spinner=b.Spinner;exports.TabOrientation=b.TabOrientation;exports.TabView=b.TabView;exports.UPDATED_AT_COLUMN=b.UPDATED_AT_COLUMN;exports.editableContainerProps=b.editableContainerProps;exports.useDialFileManagerTabs=b.useDialFileManagerTabs;exports.useEditableItem=b.useEditableItem;exports.useFileManagerContext=b.useFileManagerContext;exports.DialLabel=_e.DialLabel;exports.DialSwitch=_e.DialSwitch;exports.DEFAULT_GRID_DATE_FORMAT_OPTIONS=w.DEFAULT_DATE_FORMAT_OPTIONS;exports.DEFAULT_GRID_DATE_LOCALE=w.DEFAULT_LOCALE;exports.DIAL_KIT_CLASS=w.DIAL_KIT_CLASS;exports.DialCloseButton=w.DialCloseButton;exports.DialDangerIconButton=w.DialDangerIconButton;exports.DialDateCellRenderer=w.DialDateCellRenderer;exports.DialDropdown=w.DialDropdown;exports.DialEllipsisTooltip=w.DialEllipsisTooltip;exports.DialGhostIconButton=w.DialGhostIconButton;exports.DialGrid=w.DialGrid;exports.DialIcon=w.DialIcon;exports.DialNeutralIconButton=w.DialNeutralIconButton;exports.DialNoDataContent=w.DialNoDataContent;exports.DialPrimaryIconButton=w.DialPrimaryIconButton;exports.DialRadioButton=w.DialRadioButton;exports.DialSecondaryIconButton=w.DialSecondaryIconButton;exports.DialSuccessIconButton=w.DialSuccessIconButton;exports.DialTertiaryIconButton=w.DialTertiaryIconButton;exports.DropdownItemType=w.DropdownItemType;exports.DropdownTrigger=w.DropdownTrigger;exports.DropdownType=w.DropdownType;exports.GridSelectionMode=w.GridSelectionMode;exports.ThemeScope=w.ThemeScope;exports.baseColumnComparator=w.baseColumnComparator;exports.checkColDefsChanges=w.checkColDefsChanges;exports.convertGridDateToDate=w.convertToDate;exports.convertToDate=w.convertToDate;exports.useThemeScope=w.useThemeScope;exports.BASE_ICON_PROPS=K.BASE_ICON_PROPS;exports.BASE_ICON_SIZE=K.BASE_ICON_SIZE;exports.DIAL_ICON_SIZE=K.DIAL_ICON_SIZE;exports.mergeClasses=I.mergeClasses;exports.Checkbox=P.Checkbox;exports.CheckboxBox=P.CheckboxBox;exports.CloseButton=P.CloseButton;exports.DEFAULT_DATE_FORMAT_OPTIONS=P.DEFAULT_DATE_FORMAT_OPTIONS;exports.DEFAULT_DATE_LOCALE=P.DEFAULT_LOCALE;exports.DangerIconButton=P.DangerIconButton;exports.DateCellRenderer=P.DateCellRenderer;exports.Dropdown=P.Dropdown;exports.EllipsisTooltip=P.EllipsisTooltip;exports.GRID_ALIGN_RIGHT_CLASS=P.GRID_ALIGN_RIGHT_CLASS;exports.GRID_ROOT_CLASS=P.GRID_ROOT_CLASS;exports.GRID_ROW_HEIGHT=P.ROW_HEIGHT;exports.GRID_SELECTION_COLUMN_ID=P.GRID_SELECTION_COLUMN_ID;exports.GRID_THEME_PARAMS=P.GRID_THEME_PARAMS;exports.GhostIconButton=P.GhostIconButton;exports.Grid=P.Grid;exports.IconButton=P.IconButton;exports.InfoButton=P.InfoButton;exports.InteractiveTooltip=P.InteractiveTooltip;exports.Label=P.Label;exports.MenuItem=P.MenuItem;exports.MenuItemMark=P.MenuItemMark;exports.NeutralIconButton=P.NeutralIconButton;exports.NoDataContent=P.NoDataContent;exports.PrimaryIconButton=P.PrimaryIconButton;exports.Radio=P.Radio;exports.StaticIconButton=P.StaticIconButton;exports.Tooltip=P.Tooltip;exports.TooltipContainer=P.TooltipContainer;exports.TooltipContent=P.TooltipContent;exports.TooltipPlacement=P.TooltipPlacement;exports.TooltipTrigger=P.TooltipTrigger;exports.ButtonAppearance=T.ButtonAppearance;exports.ButtonVariant=T.ButtonVariant;exports.DialIconButton=T.DialIconButton;exports.DialTooltip=T.DialTooltip;exports.DialTooltipContainer=T.DialTooltipContainer;exports.DialTooltipContent=T.DialTooltipContent;exports.DialTooltipTrigger=T.DialTooltipTrigger;exports.ElementSize=T.ElementSize;exports.EditorThemes=ot.EditorThemes;exports.LazyDialJsonEditor=ot.LazyDialJsonEditor;exports.LazyDialMarkdownEditor=ot.LazyDialMarkdownEditor;exports.LazyMarkdownEditor=ot.LazyMarkdownEditor;exports.DIAL_KIT_ICON_STROKE=oe.DIAL_KIT_ICON_STROKE;exports.Accordion=cc;exports.AnalyticsCardVariant=st;exports.Button=et;exports.ButtonDropdown=bl;exports.Calendar=dl;exports.CalendarMode=be;exports.CaptionText=ke;exports.CardShell=Po;exports.CollapsibleSidebar=Qc;exports.ConditionalResizableContainer=rd;exports.ConfirmationPopup=lc;exports.DEFAULT_ANALYTICS_BAR_COLOR_MAP=er;exports.DangerButton=fl;exports.DialAccordion=Ur;exports.DialAnalyticsBar=ut;exports.DialAnalyticsBarGroup=Qn;exports.DialAnalyticsCard=Yn;exports.DialAnalyticsErrorTag=Qt;exports.DialAnalyticsHistogram=ss;exports.DialAutocompleteInputValue=ln;exports.DialCheckbox=Gt;exports.DialDraggableItem=bi;exports.DialDropdownIcon=lo;exports.DialFormPopup=Ai;exports.DialInputPopup=cn;exports.DialLabelledText=ms;exports.DialLoadFileArea=bn;exports.DialLoadFileAreaField=oo;exports.DialNumberInput=Zt;exports.DialPagination=ds;exports.DialPasswordInput=dn;exports.DialRadioGroupPopupField=Ti;exports.DialRemoveButton=St;exports.DialSchemaRenderer=Eo;exports.DialSegmentedControl=Ni;exports.DialSelect=Ne;exports.DialSelectField=Ki;exports.DialSlider=hs;exports.DialSteps=gs;exports.DialTag=He;exports.DialTagInput=on;exports.DialTextarea=yi;exports.ErrorMessageNotification=Ko;exports.ErrorText=Pe;exports.ErrorToastNotification=Mo;exports.FabButton=ml;exports.FileDropzone=zc;exports.FilterChips=Bc;exports.FolderPath=ul;exports.GeneralMessageNotification=qo;exports.GeneralToastNotification=Ho;exports.GhostButton=gl;exports.Highlight=ko;exports.InfoMessageNotification=Go;exports.InfoToastNotification=Fo;exports.InlineSelect=yl;exports.InlineSelectTrigger=Rn;exports.Input=Ve;exports.JsonSchemaType=$;exports.LinkButton=pl;exports.LoadingMessageNotification=Wo;exports.LoadingToastNotification=$o;exports.MultiSelectTags=Fn;exports.NeutralButton=pr;exports.Notification=dr;exports.NumberInput=ql;exports.OutlinedButton=hl;exports.PasswordInput=Gl;exports.Popup=gr;exports.PrimaryButton=Ln;exports.ProgressBar=as;exports.RadioGroup=zn;exports.RadioGroupPopupField=Ic;exports.ResizableContainer=$n;exports.SchemaDisplayMode=at;exports.SchemaOrientation=jt;exports.SchemaRendererVariant=Ye;exports.Search=qc;exports.SegmentedControl=Rc;exports.Select=$l;exports.SelectSize=ht;exports.SelectVariant=mt;exports.Slider=Xc;exports.StepStatus=ye;exports.SuccessMessageNotification=Vo;exports.SuccessToastNotification=Bo;exports.Switch=dc;exports.Tabs=Pc;exports.Tag=Ke;exports.TagAppearance=Ue;exports.TagInput=Uc;exports.Textarea=Kl;exports.TextareaResize=Bn;exports.ToggleIconButton=Sc;exports.WarningMessageNotification=Uo;exports.WarningToastNotification=zo;exports.getTimezoneLabel=yn;exports.matchesAccept=Jt;exports.wrapInRootFolder=ho;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("./use-file-manager-tabs-Bzzwwcgk.cjs"),Ue=require("./Switch-DE6MrcqJ.cjs"),r=require("react/jsx-runtime"),g=require("react"),$=require("@tabler/icons-react"),de=require("classnames"),O=require("./DateCellRenderer-CZNa4jVJ.cjs"),H=require("./icon-CrGVkVpG.cjs"),S=require("./merge-classes-BEJXjzkx.cjs"),k=require("./DateCellRenderer-BdUMSg-E.cjs"),_=require("./IconButton-DHOFapLo.cjs"),oa=require("react-dom"),wt=require("./lazy-_W6FYhKg.cjs"),se=require("@floating-ui/react"),ne=require("./icon-DhjrDQ8I.cjs");function ia(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,s.get?s:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const Ur=ia(g),Je=({label:e,className:t,icon:n,selected:s,closable:a,onClick:o,onRemove:i})=>{const l=S.mergeClasses("flex items-center gap-1 cursor-pointer dial-tiny-text px-2 h-[24px] border text-primary rounded-[8px]",s?"hover:bg-controls-accent-primary-alpha-active bg-accent-primary-alpha border-accent-primary":"bg-neutral border-primary",t);return r.jsxs("div",{className:l,onClick:o,children:[r.jsx(O.DialIcon,{icon:n}),r.jsx(O.DialEllipsisTooltip,{text:e}),a&&i&&r.jsx(v.DialButton,{className:"p-0",iconAfter:r.jsx($.IconX,{size:H.DIAL_ICON_SIZE.SM}),onClick:c=>i(c)})]},e)},jr=({label:e="Error",className:t})=>r.jsx(Je,{label:e,className:S.mergeClasses("dial-tiny-semi-text cursor-default rounded-[120px] border-transparent bg-error text-error",t)});var St=(e=>(e.Default="default",e.Compact="compact",e))(St||{});const la={[St.Default]:{container:"bg-layer-3",title:"dial-small-text text-secondary",value:"dial-display2-text text-primary",showDescription:!0},[St.Compact]:{container:"bg-layer-2",title:"dial-tiny-text text-secondary",value:"dial-body-semi-text text-primary",showDescription:!1}},ca=({title:e,value:t,description:n,variant:s=St.Default,error:a,isLoading:o,className:i,delta:l,deltaPositive:c,deltaUnit:d,compareValues:f})=>{const p=la[s],h=c!==void 0?c:(l??0)>=0,u=l===void 0?null:`${l>=0?`+${l}`:String(l)}${d??""}`;return r.jsxs("div",{className:S.mergeClasses("flex flex-col rounded-lg border border-secondary p-4",a||o?"gap-2":"gap-1",p.container,i),children:[l!==void 0?r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:p.title,children:e}),r.jsx("span",{className:S.mergeClasses("dial-tiny-semi-text rounded-[120px] border border-transparent px-2",h?"bg-success text-success":"bg-error text-error"),children:u})]}):r.jsx("span",{className:p.title,children:e}),a?r.jsx(jr,{className:"self-start"}):o?r.jsx(v.DialLoader,{fullWidth:!1,className:"self-start"}):f?r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[r.jsx(O.DialEllipsisTooltip,{text:f[0].title,className:"dial-tiny-text text-secondary"}),r.jsx("span",{className:p.value,children:f[0].value})]}),r.jsx("div",{className:"h-4 w-px flex-shrink-0 bg-controls-disable-accent"}),r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[r.jsx(O.DialEllipsisTooltip,{text:f[1].title,className:"dial-tiny-text text-secondary"}),r.jsx("span",{className:p.value,children:f[1].value})]})]}):r.jsx("span",{className:p.value,children:t}),!a&&!o&&p.showDescription&&n!=null&&n!==!1&&r.jsx("span",{className:"dial-tiny-text text-secondary",children:n})]})},Tr=[{from:0,to:.1,color:"#F26B5B"},{from:.1,to:.2,color:"#E5764A"},{from:.2,to:.3,color:"#E08C3F"},{from:.3,to:.4,color:"#D9A638"},{from:.4,to:.5,color:"#D4BE3A"},{from:.5,to:.6,color:"#B8C94A"},{from:.6,to:.7,color:"#7EC96B"},{from:.7,to:.8,color:"#4ECBA8"},{from:.8,to:.9,color:"#4EC5C5"},{from:.9,to:1,color:"#4DC87A"},{from:1,to:1,color:"#30E070"}],da=(e,t)=>t<=0?0:Math.min(Math.max(e/t,0),1),ua=(e,t)=>{if(e<=0)return;let n;for(const s of t)(s.from===s.to?e>=s.from:e>s.from&&e<=s.to)&&(n=s.color);return n},kt=({value:e,maxValue:t=1,error:n,isLoading:s,title:a,valueLabel:o,colorMap:i=Tr,className:l,titleClassName:c,valueClassName:d,inline:f,ariaLabel:p})=>{const h=e==null,u=!!(n||s||!h),m=da(h?0:e,t),C=ua(m,i),x=o??(h?"—":e),b=p??(typeof a=="string"?a:void 0),y=n||s,N=n?r.jsx(jr,{}):s?r.jsx(v.DialLoader,{fullWidth:!1}):r.jsx("span",{className:S.mergeClasses("shrink-0 tabular-nums text-end",f?"dial-small-text min-w-[5ch] text-primary":"dial-small-semi-text text-primary",d),children:x}),D=u?r.jsx("div",{role:"progressbar","aria-valuenow":n||s||typeof e!="number"?void 0:e,"aria-valuemin":0,"aria-valuemax":t,"aria-label":b,className:S.mergeClasses("w-full overflow-hidden rounded-sm",f?"h-1":"h-2",n?"bg-error":"bg-layer-1"),children:!y&&r.jsx("div",{className:"h-full rounded-sm transition-[width] duration-300",style:{width:`${m*100}%`,backgroundColor:C}})}):null,I=r.jsx("span",{className:S.mergeClasses("dial-small-text text-primary",c),children:a});return f?r.jsxs("div",{className:S.mergeClasses("flex flex-row items-center gap-2",l),children:[r.jsx("div",{className:"w-1/2 min-w-0",children:I}),r.jsxs("div",{className:"flex w-1/2 flex-row items-center gap-2",children:[r.jsx("div",{className:"min-w-0 flex-1",children:D}),N]})]}):r.jsxs("div",{className:S.mergeClasses("flex flex-col gap-1",l),children:[r.jsxs("div",{className:"flex flex-row items-center justify-between gap-2",children:[I,N]}),D]})},$n=({title:e,description:t,children:n,expanded:s,defaultExpanded:a=!1,disabled:o,nonCollapsible:i,onToggle:l,className:c,headerClassName:d,contentClassName:f})=>{const p=s!==void 0,[h,u]=g.useState(a),m=i?!0:p?s:h,C=g.useId(),x=()=>{if(o)return;const b=!m;p||u(b),l?.(b)};return r.jsxs("div",{className:S.mergeClasses("rounded border border-secondary",c),children:[r.jsxs("button",{type:"button","aria-expanded":m,"aria-controls":C,disabled:o||i,onClick:x,className:S.mergeClasses("flex w-full items-center gap-2 p-4 text-left",o?"cursor-not-allowed":"cursor-pointer",i&&"cursor-default",d),children:[!i&&r.jsx(O.DialIcon,{className:de("text-secondary transition-transform",m&&"rotate-90"),icon:r.jsx($.IconChevronRight,{size:H.DIAL_ICON_SIZE.SM})}),r.jsx("span",{className:"dial-body-text text-primary",children:e}),t!=null&&t!==!1&&r.jsx("span",{className:"dial-tiny-text text-secondary",children:t})]}),m&&r.jsx("div",{id:C,role:"region",className:S.mergeClasses("px-4 pb-4",f),children:n})]})},fa=({title:e,titleTooltip:t,description:n,data:s,compareData:a,compareLabels:o,maxValue:i,colorMap:l,defaultExpanded:c=!0,nonCollapsible:d,isLoading:f,onBarClick:p,inline:h,barTitleClassName:u,barValueClassName:m,barClassName:C,barDescriptions:x,className:b})=>{const y=Object.entries(s),N=h?S.mergeClasses("text-secondary",u):u,D=o?"dial-tiny-text text-secondary":void 0,I=t?r.jsx(_.DialTooltip,{tooltip:t,children:e}):e,j=a?[...new Set([...Object.keys(s),...Object.keys(a)])]:[],L="cursor-pointer rounded-sm text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-primary",w="group flex flex-col gap-1.5",A=S.mergeClasses("flex flex-col gap-1.5 pl-2",p&&"group-hover:bg-accent-primary-alpha group-focus-visible:bg-accent-primary-alpha",C);return r.jsx($n,{title:I,description:n,defaultExpanded:c,nonCollapsible:d,className:b,children:r.jsx("div",{className:S.mergeClasses("flex flex-col",a?"gap-4":h?"gap-2":"gap-3"),children:f?r.jsx(v.DialLoader,{fullWidth:!1,className:"self-center"}):a?j.map(E=>{const T=E in s?s[E]:null,R=E in a?a[E]:null,K=typeof T=="number"&&typeof R=="number"?parseFloat((R-T).toFixed(3)):null,Q=K!=null&&K!==0,V=Q&&K>0,F=Q?V?`+${K}`:String(K):null,G=x?.[E],U=r.jsx("span",{className:"dial-small-text text-secondary",children:E}),Z=r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-center gap-2",children:[G?r.jsx(_.DialTooltip,{tooltip:G,children:U}):U,F!=null&&r.jsx("span",{className:S.mergeClasses("dial-tiny-semi-text rounded-[120px] border border-transparent px-2",V?"bg-success text-success":"bg-error text-error"),children:F})]}),r.jsxs("div",{className:A,children:[r.jsx(kt,{title:o?.[0],value:T,maxValue:i,colorMap:l,inline:h,titleClassName:D,ariaLabel:E}),r.jsx(kt,{title:o?.[1],value:R,maxValue:i,colorMap:l,inline:h,titleClassName:D,ariaLabel:`${E} compare`})]})]});return p?r.jsx("button",{type:"button",onClick:()=>p(E,T),className:S.mergeClasses(w,L),children:Z},E):r.jsx("div",{className:w,children:Z},E)}):y.map(([E,T])=>{const R=r.jsx(kt,{title:E,value:T,maxValue:i,colorMap:l,inline:h,titleClassName:N,valueClassName:m,className:C}),B=p?r.jsx("button",{type:"button",onClick:()=>p(E,T),className:L,children:R}):R,K=x?.[E];return K?r.jsx(_.DialTooltip,{tooltip:K,triggerClassName:"flex flex-col",children:B},E):r.jsx(g.Fragment,{children:B},E)})})})},pa="#FF4E50",ha=(e,t)=>{let n=-1;return t.forEach((s,a)=>{(s.from===s.to?e>=s.from:e>s.from&&e<=s.to)&&(n=a)}),n},Zr=(e,t)=>{const n=t.map(()=>0);let s=0;e.forEach(c=>{if(c<=0){s+=1;return}const d=ha(c,t);d>=0&&(n[d]+=1)});const a=Math.max(0,s,...n),o=c=>a>0?c/a:0,i={from:0,to:0,color:pa,count:s,ratio:o(s),isZeroBucket:!0},l=t.map((c,d)=>({from:c.from,to:c.to,color:c.color,count:n[d],ratio:o(n[d]),isZeroBucket:!1}));return[i,...l]},Hn=e=>e<=0?2:e%2===0?e:e+1,ma=e=>{const t=Hn(e);return[t,t/2,0]},rr=e=>`${Math.round(e*100)/100}`,Kn=(e,t)=>e===t?rr(e):`${rr(e)}-${rr(t)}`,nr=128,ga=(e,t)=>{const n=Kn(e,t);return e===t?`scored ${n}`:`scored between ${n}`},Wr=(e,t,n,s,a)=>r.jsxs("div",{className:"flex flex-col gap-0.5",children:[e&&r.jsx("strong",{children:e}),r.jsxs("span",{children:[t," out of ",n," ",s]}),r.jsx("span",{children:ga(a.from,a.to)})]}),xa=({title:e,values:t,colorMap:n=Tr,valueTitle:s="values",showCount:a,isLoading:o,className:i,compareValues:l,valueSetLabel:c,compareValueSetLabel:d})=>{const f=Zr(t,n),p=l?Zr(l,n):void 0,h=t.length,u=l?.length??0,m=Math.max(h,u),C=Hn(m),x=ma(m),b=I=>I.map(j=>({...j,ratio:C>0?j.count/C:0})),y=b(f),N=p?b(p):void 0,D=(I,j,L,w)=>{if(I.count===0)return r.jsx("div",{className:"flex h-full flex-1 items-end","aria-hidden":"true",children:r.jsx("div",{className:"min-h-2 w-full rounded-sm",style:{height:`${I.ratio*100}%`}})});const A=w?{backgroundImage:`repeating-linear-gradient(135deg, ${I.color} 0px, ${I.color} 1px, transparent 1px, transparent 4px)`,borderColor:I.color}:{backgroundColor:I.color};return r.jsx(_.DialTooltip,{placement:"bottom",tooltip:j,triggerClassName:"flex h-full flex-1 items-end",children:r.jsx("div",{role:"img","aria-label":L,className:"flex min-h-2 w-full items-center justify-center rounded-sm border border-transparent",style:{height:`${I.ratio*100}%`,...A},children:a&&r.jsx("span",{className:"dial-tiny-semi-text text-primary",children:I.count})})})};return r.jsxs("div",{className:S.mergeClasses("flex flex-col gap-2",i),children:[r.jsx("span",{className:"dial-small-text text-primary",children:e}),o?r.jsx("div",{className:"flex items-center justify-center",style:{height:nr},children:r.jsx(v.DialLoader,{fullWidth:!1})}):r.jsxs("div",{className:"grid grid-cols-[auto_minmax(0,1fr)] gap-x-2 gap-y-1",children:[r.jsx("div",{"data-histogram-y-axis":!0,"aria-hidden":"true",className:"relative",style:{height:nr},children:x.map((I,j)=>r.jsx("span",{className:"dial-tiny-text absolute right-0 whitespace-nowrap text-secondary",style:{top:`${j/(x.length-1)*100}%`,transform:"translateY(-50%)"},children:I},I))}),r.jsxs("div",{className:"relative min-w-0",children:[x.map((I,j)=>r.jsx("div",{"data-histogram-grid":!0,className:"pointer-events-none absolute inset-x-0 border-t border-primary",style:{top:`${j/(x.length-1)*100}%`}},I)),r.jsx("div",{className:"relative flex items-end gap-1",style:{height:nr},children:N?y.map((I,j)=>{const L=N[j],w=`${I.count} out of ${h} ${s}`,A=`${L.count} out of ${u} ${s}`;return r.jsxs("div",{className:"flex h-full flex-1 items-end",children:[D(I,Wr(c,I.count,h,s,I),w,!0),D(L,Wr(d,L.count,u,s,L),A,!1)]},j)}):y.map((I,j)=>{const L=`${I.count} out of ${h} ${s}`;return I.count===0?r.jsx("div",{className:"flex h-full flex-1 items-end","aria-hidden":"true",children:r.jsx("div",{className:"min-h-2 w-full rounded-sm",style:{height:`${I.ratio*100}%`}})},j):r.jsx(_.DialTooltip,{placement:"bottom",tooltip:L,triggerClassName:"flex h-full flex-1 items-end",children:r.jsx("div",{role:"img","aria-label":L,className:S.mergeClasses("flex min-h-2 w-full items-center justify-center rounded-sm border","border-transparent"),style:{height:`${I.ratio*100}%`,backgroundColor:I.color},children:a&&I.count>0&&r.jsx("span",{className:"dial-tiny-semi-text text-primary",children:I.count})})},j)})})]}),r.jsx("div",{}),r.jsx("div",{"data-histogram-x-axis":!0,className:"flex gap-1",children:y.map((I,j)=>r.jsx("span",{className:"dial-caption-text flex-1 text-center text-secondary",children:Kn(I.from,I.to)},j))})]})]})},Vn=({value:e,max:t=100,size:n=_.ElementSize.Standard,labelProps:s,valueLabel:a,id:o,className:i,"aria-label":l,...c})=>{const d=g.useId(),f=o??d,p=!!s?.label,h=p?s?.id??`${f}-label`:void 0,u=t>0?t:0,m=Number.isFinite(e)?e:0,C=Math.min(Math.max(m,0),u),x=u>0?C/u*100:0,b=r.jsx("div",{...c,id:f,role:"progressbar","aria-valuenow":C,"aria-valuemin":0,"aria-valuemax":u,"aria-labelledby":h,"aria-label":_.resolveAccessibleName(l,p?void 0:"Progress"),className:S.mergeClasses("w-full overflow-hidden rounded-full bg-control-disable-primary",n===_.ElementSize.Small?"h-1":"h-2",i,!p&&!a&&O.DIAL_KIT_CLASS.progressBar),children:r.jsx("div",{style:{width:`${x}%`},className:"h-full rounded-full bg-control-accent transition-[width] duration-300 motion-reduce:transition-none"})});return!p&&!a?b:r.jsxs("div",{className:S.mergeClasses("flex w-full flex-col gap-1",O.DIAL_KIT_CLASS.progressBar),children:[r.jsxs("div",{className:"flex items-baseline gap-2",children:[s&&r.jsx(k.Label,{...s,id:h}),a&&r.jsx("span",{className:"dial-tiny-text text-secondary ml-auto shrink-0",children:a})]}),b]})},ba=7,Ca=2,ya=e=>e<=0?[]:Array.from({length:e},(t,n)=>n+1);var Rt=(e=>(e.Active="active",e.Adjacent="adjacent",e.Far="far",e))(Rt||{});const va=(e,t,n)=>e===t?"active":n<ba||Math.abs(e-t)<=Ca?"adjacent":"far",Sa=({page:e,totalPages:t,onPageChange:n,className:s})=>{const a=ya(t);return r.jsxs("nav",{"aria-label":"Pagination",className:S.mergeClasses("flex items-center gap-2",s),children:[r.jsx(_.DialIconButton,{icon:r.jsx($.IconCaretLeftFilled,{size:H.DIAL_ICON_SIZE.SM,className:"text-secondary"}),size:_.ElementSize.Small,className:"!p-0 items-center flex justify-center",disabled:e<=1,onClick:()=>n(e-1),"aria-label":"Previous page"}),r.jsx("div",{className:"flex flex-row items-center gap-2",children:a.map(o=>{const i=va(o,e,t);return r.jsx("button",{type:"button",onClick:()=>n(o),"aria-label":`Page ${o}`,"aria-current":o===e?"page":void 0,className:S.mergeClasses("dial-pagination-dot rounded-full focus-visible:outline outline-offset-0 transition-all duration-300 ease-in-out",i===Rt.Active&&"h-[8px] w-[32px]",i===Rt.Adjacent&&"size-[8px]",i===Rt.Far&&"size-[4px]")},o)})}),r.jsx(_.DialIconButton,{icon:r.jsx($.IconCaretRightFilled,{size:H.DIAL_ICON_SIZE.SM,className:"text-secondary"}),size:_.ElementSize.Small,className:"!p-0 items-center flex justify-center",disabled:e>=t,onClick:()=>n(e+1),"aria-label":"Next page"})]})},gr=({label:e,id:t,checked:n,indeterminate:s,disabled:a,ariaLabel:o,onChange:i,className:l,...c})=>{const d=g.useCallback(u=>{i?.(u.target.checked,t)},[i,t]),f=de("flex flex-row items-center cursor-pointer text-accent-primary small-medium min-w-0",`${n||s?"":'before:content-[""] before:inline-block before:w-[18px] before:h-[18px] before:border before:border-hover before:rounded'}`,a?"pointer-events-none text-secondary before:border-icon-secondary before:bg-layer-4":"",l),p=de("border rounded",a?"bg-layer-4 border-icon-secondary":""),h=()=>s?r.jsx($.IconMinus,{className:p,...H.BASE_ICON_PROPS}):n?r.jsx($.IconCheck,{className:p,...H.BASE_ICON_PROPS}):null;return r.jsxs("label",{...c,className:f,htmlFor:t,"aria-description":c["aria-description"]||O.ariaDescription,children:[h(),e&&(typeof e=="string"?r.jsx(O.DialEllipsisTooltip,{text:e,className:"ml-2 text-primary"}):e),r.jsx("input",{type:"checkbox",role:"checkbox",name:t,onChange:d,id:t,checked:n,"aria-checked":s?"mixed":n,"aria-disabled":a||void 0,"aria-label":e?void 0:o,className:"invisible size-0"})]})};var je=(e=>(e.VALID="valid",e.ERROR="error",e))(je||{});const Ia=(e,t)=>{if(t===e.id)switch(e.status){case je.VALID:return"border-accent-secondary text-primary";case je.ERROR:return"border-red-900 text-primary";default:return"border-accent-primary text-primary"}switch(e.status){case je.VALID:return"border-primary text-primary";case je.ERROR:return"border-red-900 text-error";default:return"border-primary text-secondary"}},Na=(e,t)=>{if(t===e.id)switch(e.status){case je.VALID:return"bg-accent-secondary";case je.ERROR:return"bg-red-400";default:return"bg-accent-primary"}switch(e.status){case je.VALID:return"bg-accent-secondary";case je.ERROR:return"bg-red-400";default:return"bg-layer-4"}},Da=({step:e,index:t,currentStep:n,onChangeStep:s})=>{const a="h-[32px] flex flex-1 min-w-[180px] items-center dial-tiny-text cursor-pointer dial-step",o="w-[22px] h-[22px] flex justify-center items-center mr-2 rounded-full text-white",i=()=>n===e.id&&e.status===je.ERROR?r.jsx($.IconExclamationCircle,{stroke:2,size:H.DIAL_ICON_SIZE.SM}):n!==e.id&&e.status===je.VALID?r.jsx($.IconCheck,{stroke:2,size:H.DIAL_ICON_SIZE.SM}):t+1;return r.jsxs("button",{className:de(a,Ia(e,n)),onClick:()=>s(e.id),children:[r.jsx("span",{className:de(o,Na(e,n)),children:i()}),r.jsx("span",{children:e.name})]})},ja=({steps:e,currentStep:t,onChangeStep:n})=>{const s=a=>{const o=e.findIndex(c=>c.id===t),i=e.findIndex(c=>c.id===a);if(a===t)return;(e.slice(0,i).every(c=>c.status===je.VALID)||i<o)&&n(a)};return r.jsx("div",{id:"steps",className:"flex gap-x-3",children:e.map((a,o)=>r.jsx(Da,{currentStep:t,onChangeStep:s,step:a,index:o},a.id))})},sr=e=>(e.toString().split(".")[1]??"").length,Ta=({value:e,min:t=0,max:n=1,step:s=.1,disabled:a=!1,labelProps:o,labels:i,formatValue:l,onChange:c,className:d,trackClassName:f,fillClassName:p,thumbClassName:h,labelsClassName:u,"aria-label":m,"aria-labelledby":C,...x})=>{const b=g.useRef(null),y=Math.max(0,Math.min(100,(e-t)/(n-t)*100)),N=sr(s),D=l?l(e):e.toFixed(N),I=g.useCallback(A=>{const E=b.current;if(!E)return e;const T=E.getBoundingClientRect(),R=(A-T.left)/T.width,B=t+R*(n-t),K=sr(s),Q=parseFloat((Math.round((B-t)/s)*s+t).toFixed(K));return Math.min(n,Math.max(t,Q))},[t,n,s,e]),j=g.useCallback(A=>{a||(A.currentTarget.setPointerCapture(A.pointerId),c?.(I(A.clientX)))},[a,I,c]),L=g.useCallback(A=>{a||A.buttons===0||c?.(I(A.clientX))},[a,I,c]),w=g.useCallback(A=>{if(a)return;const E=sr(s),T=K=>parseFloat((Math.round((K-t)/s)*s+t).toFixed(E)),R=K=>Math.min(n,Math.max(t,K));let B=e;switch(A.key){case"ArrowRight":case"ArrowUp":B=R(T(e+s));break;case"ArrowLeft":case"ArrowDown":B=R(T(e-s));break;case"Home":B=t;break;case"End":B=n;break;default:return}A.preventDefault(),B!==e&&c?.(B)},[a,e,s,t,n,c]);return r.jsxs("div",{className:S.mergeClasses("flex flex-col",a&&"pointer-events-none opacity-50",d),...x,children:[o&&r.jsx(Ue.DialLabel,{...o,htmlFor:x.id}),r.jsxs("div",{ref:b,className:"relative flex h-[38px] cursor-pointer items-center",onPointerDown:j,onPointerMove:L,children:[r.jsx("div",{className:S.mergeClasses("pointer-events-none absolute inset-x-0 h-3 rounded-[10px] bg-layer-1",f)}),r.jsx("div",{className:S.mergeClasses("pointer-events-none absolute left-0 h-3 rounded-[10px] bg-controls-accent-primary",p),style:{width:`${y}%`}}),r.jsx("div",{role:"slider",tabIndex:a?-1:0,"aria-valuenow":e,"aria-valuemin":t,"aria-valuemax":n,"aria-disabled":a||void 0,"aria-label":m,"aria-labelledby":C,className:S.mergeClasses("dial-small-text absolute -translate-x-1/2 flex size-[38px] cursor-grab select-none items-center justify-center rounded-full bg-layer-3 text-primary shadow focus:outline-none focus-visible:ring-2 focus-visible:ring-focus",h),style:{left:`${y}%`},onKeyDown:w,children:D})]}),i&&r.jsx("div",{className:S.mergeClasses("dial-tiny-text flex text-secondary",u),children:i.length===3?r.jsxs(r.Fragment,{children:[r.jsx("span",{children:i[0]}),r.jsx("span",{className:"flex-1 text-center",children:i[1]}),r.jsx("span",{children:i[2]})]}):r.jsxs(r.Fragment,{children:[r.jsx("span",{children:i[0]}),r.jsx("span",{className:"ml-auto",children:i[1]})]})})]})},wa=({label:e,text:t,tooltip:n,children:s,postfix:a,className:o})=>r.jsxs("div",{className:S.mergeClasses("flex flex-col",s?"":"max-w-[200px]",o),children:[e&&r.jsx("label",{className:"dial-tiny-text mb-2 text-secondary",children:e}),s||r.jsxs("div",{className:"flex flex-row items-center gap-x-2",children:[r.jsx(_.DialTooltip,{triggerClassName:"text-primary flex-1 min-w-0",tooltip:n||t,children:t}),a||null]})]}),Gn=g.createContext({dragDropManager:void 0});function we(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var qr=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})(),Yr=function(){return Math.random().toString(36).substring(7).split("").join(".")},Xr={INIT:"@@redux/INIT"+Yr(),REPLACE:"@@redux/REPLACE"+Yr()};function Ea(e){if(typeof e!="object"||e===null)return!1;for(var t=e;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function Oa(e){if(e===void 0)return"undefined";if(e===null)return"null";var t=typeof e;switch(t){case"boolean":case"string":case"number":case"symbol":case"function":return t}if(Array.isArray(e))return"array";if(La(e))return"date";if(_a(e))return"error";var n=Aa(e);switch(n){case"Symbol":case"Promise":case"WeakMap":case"WeakSet":case"Map":case"Set":return n}return t.slice(8,-1).toLowerCase().replace(/\s/g,"")}function Aa(e){return typeof e.constructor=="function"?e.constructor.name:null}function _a(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function La(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function lt(e){var t=typeof e;return process.env.NODE_ENV!=="production"&&(t=Oa(e)),t}function Un(e,t,n){var s;if(typeof t=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(process.env.NODE_ENV==="production"?we(0):"It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.");if(typeof t=="function"&&typeof n>"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(process.env.NODE_ENV==="production"?we(1):"Expected the enhancer to be a function. Instead, received: '"+lt(n)+"'");return n(Un)(e,t)}if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?we(2):"Expected the root reducer to be a function. Instead, received: '"+lt(e)+"'");var a=e,o=t,i=[],l=i,c=!1;function d(){l===i&&(l=i.slice())}function f(){if(c)throw new Error(process.env.NODE_ENV==="production"?we(3):"You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return o}function p(C){if(typeof C!="function")throw new Error(process.env.NODE_ENV==="production"?we(4):"Expected the listener to be a function. Instead, received: '"+lt(C)+"'");if(c)throw new Error(process.env.NODE_ENV==="production"?we(5):"You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details.");var x=!0;return d(),l.push(C),function(){if(x){if(c)throw new Error(process.env.NODE_ENV==="production"?we(6):"You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.");x=!1,d();var y=l.indexOf(C);l.splice(y,1),i=null}}}function h(C){if(!Ea(C))throw new Error(process.env.NODE_ENV==="production"?we(7):"Actions must be plain objects. Instead, the actual type was: '"+lt(C)+"'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.");if(typeof C.type>"u")throw new Error(process.env.NODE_ENV==="production"?we(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if(c)throw new Error(process.env.NODE_ENV==="production"?we(9):"Reducers may not dispatch actions.");try{c=!0,o=a(o,C)}finally{c=!1}for(var x=i=l,b=0;b<x.length;b++){var y=x[b];y()}return C}function u(C){if(typeof C!="function")throw new Error(process.env.NODE_ENV==="production"?we(10):"Expected the nextReducer to be a function. Instead, received: '"+lt(C));a=C,h({type:Xr.REPLACE})}function m(){var C,x=p;return C={subscribe:function(y){if(typeof y!="object"||y===null)throw new Error(process.env.NODE_ENV==="production"?we(11):"Expected the observer to be an object. Instead, received: '"+lt(y)+"'");function N(){y.next&&y.next(f())}N();var D=x(N);return{unsubscribe:D}}},C[qr]=function(){return this},C}return h({type:Xr.INIT}),s={dispatch:h,subscribe:p,getState:f,replaceReducer:u},s[qr]=m,s}function re(e,t,...n){if(ka()&&t===void 0)throw new Error("invariant requires an error message argument");if(!e){let s;if(t===void 0)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{let a=0;s=new Error(t.replace(/%s/g,function(){return n[a++]})),s.name="Invariant Violation"}throw s.framesToPop=1,s}}function ka(){return typeof process<"u"&&process.env.NODE_ENV==="production"}function Ra(e,t,n){return t.split(".").reduce((s,a)=>s&&s[a]?s[a]:n||null,e)}function Ma(e,t){return e.filter(n=>n!==t)}function Zn(e){return typeof e=="object"}function Pa(e,t){const n=new Map,s=o=>{n.set(o,n.has(o)?n.get(o)+1:1)};e.forEach(s),t.forEach(s);const a=[];return n.forEach((o,i)=>{o===1&&a.push(i)}),a}function Fa(e,t){return e.filter(n=>t.indexOf(n)>-1)}const wr="dnd-core/INIT_COORDS",Kt="dnd-core/BEGIN_DRAG",Er="dnd-core/PUBLISH_DRAG_SOURCE",Vt="dnd-core/HOVER",Gt="dnd-core/DROP",Ut="dnd-core/END_DRAG";function Jr(e,t){return{type:wr,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}const Ba={type:wr,payload:{clientOffset:null,sourceClientOffset:null}};function za(e){return function(n=[],s={publishSource:!0}){const{publishSource:a=!0,clientOffset:o,getSourceClientOffset:i}=s,l=e.getMonitor(),c=e.getRegistry();e.dispatch(Jr(o)),$a(n,l,c);const d=Va(n,l);if(d==null){e.dispatch(Ba);return}let f=null;if(o){if(!i)throw new Error("getSourceClientOffset must be defined");Ha(i),f=i(d)}e.dispatch(Jr(o,f));const h=c.getSource(d).beginDrag(l,d);if(h==null)return;Ka(h),c.pinSource(d);const u=c.getSourceType(d);return{type:Kt,payload:{itemType:u,item:h,sourceId:d,clientOffset:o||null,sourceClientOffset:f||null,isSourcePublic:!!a}}}}function $a(e,t,n){re(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach(function(s){re(n.getSource(s),"Expected sourceIds to be registered.")})}function Ha(e){re(typeof e=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function Ka(e){re(Zn(e),"Item must be an object.")}function Va(e,t){let n=null;for(let s=e.length-1;s>=0;s--)if(t.canDragSource(e[s])){n=e[s];break}return n}function Ga(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ua(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{},s=Object.keys(n);typeof Object.getOwnPropertySymbols=="function"&&(s=s.concat(Object.getOwnPropertySymbols(n).filter(function(a){return Object.getOwnPropertyDescriptor(n,a).enumerable}))),s.forEach(function(a){Ga(e,a,n[a])})}return e}function Za(e){return function(n={}){const s=e.getMonitor(),a=e.getRegistry();Wa(s),Xa(s).forEach((i,l)=>{const c=qa(i,l,a,s),d={type:Gt,payload:{dropResult:Ua({},n,c)}};e.dispatch(d)})}}function Wa(e){re(e.isDragging(),"Cannot call drop while not dragging."),re(!e.didDrop(),"Cannot call drop twice during one drag operation.")}function qa(e,t,n,s){const a=n.getTarget(e);let o=a?a.drop(s,e):void 0;return Ya(o),typeof o>"u"&&(o=t===0?{}:s.getDropResult()),o}function Ya(e){re(typeof e>"u"||Zn(e),"Drop result must either be an object or undefined.")}function Xa(e){const t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function Ja(e){return function(){const n=e.getMonitor(),s=e.getRegistry();Qa(n);const a=n.getSourceId();return a!=null&&(s.getSource(a,!0).endDrag(n,a),s.unpinSource()),{type:Ut}}}function Qa(e){re(e.isDragging(),"Cannot call endDrag while not dragging.")}function xr(e,t){return t===null?e===null:Array.isArray(e)?e.some(n=>n===t):e===t}function eo(e){return function(n,{clientOffset:s}={}){to(n);const a=n.slice(0),o=e.getMonitor(),i=e.getRegistry(),l=o.getItemType();return no(a,i,l),ro(a,o,i),so(a,o,i),{type:Vt,payload:{targetIds:a,clientOffset:s||null}}}}function to(e){re(Array.isArray(e),"Expected targetIds to be an array.")}function ro(e,t,n){re(t.isDragging(),"Cannot call hover while not dragging."),re(!t.didDrop(),"Cannot call hover after drop.");for(let s=0;s<e.length;s++){const a=e[s];re(e.lastIndexOf(a)===s,"Expected targetIds to be unique in the passed array.");const o=n.getTarget(a);re(o,"Expected targetIds to be registered.")}}function no(e,t,n){for(let s=e.length-1;s>=0;s--){const a=e[s],o=t.getTargetType(a);xr(o,n)||e.splice(s,1)}}function so(e,t,n){e.forEach(function(s){n.getTarget(s).hover(t,s)})}function ao(e){return function(){if(e.getMonitor().isDragging())return{type:Er}}}function oo(e){return{beginDrag:za(e),publishDragSource:ao(e),hover:eo(e),drop:Za(e),endDrag:Ja(e)}}class io{receiveBackend(t){this.backend=t}getMonitor(){return this.monitor}getBackend(){return this.backend}getRegistry(){return this.monitor.registry}getActions(){const t=this,{dispatch:n}=this.store;function s(o){return(...i)=>{const l=o.apply(t,i);typeof l<"u"&&n(l)}}const a=oo(this);return Object.keys(a).reduce((o,i)=>{const l=a[i];return o[i]=s(l),o},{})}dispatch(t){this.store.dispatch(t)}constructor(t,n){this.isSetUp=!1,this.handleRefCountChange=()=>{const s=this.store.getState().refCount>0;this.backend&&(s&&!this.isSetUp?(this.backend.setup(),this.isSetUp=!0):!s&&this.isSetUp&&(this.backend.teardown(),this.isSetUp=!1))},this.store=t,this.monitor=n,t.subscribe(this.handleRefCountChange)}}function lo(e,t){return{x:e.x+t.x,y:e.y+t.y}}function Wn(e,t){return{x:e.x-t.x,y:e.y-t.y}}function co(e){const{clientOffset:t,initialClientOffset:n,initialSourceClientOffset:s}=e;return!t||!n||!s?null:Wn(lo(t,s),n)}function uo(e){const{clientOffset:t,initialClientOffset:n}=e;return!t||!n?null:Wn(t,n)}const Ct=[],Or=[];Ct.__IS_NONE__=!0;Or.__IS_ALL__=!0;function fo(e,t){return e===Ct?!1:e===Or||typeof t>"u"?!0:Fa(t,e).length>0}class po{subscribeToStateChange(t,n={}){const{handlerIds:s}=n;re(typeof t=="function","listener must be a function."),re(typeof s>"u"||Array.isArray(s),"handlerIds, when specified, must be an array of strings.");let a=this.store.getState().stateId;const o=()=>{const i=this.store.getState(),l=i.stateId;try{l===a||l===a+1&&!fo(i.dirtyHandlerIds,s)||t()}finally{a=l}};return this.store.subscribe(o)}subscribeToOffsetChange(t){re(typeof t=="function","listener must be a function.");let n=this.store.getState().dragOffset;const s=()=>{const a=this.store.getState().dragOffset;a!==n&&(n=a,t())};return this.store.subscribe(s)}canDragSource(t){if(!t)return!1;const n=this.registry.getSource(t);return re(n,`Expected to find a valid source. sourceId=${t}`),this.isDragging()?!1:n.canDrag(this,t)}canDropOnTarget(t){if(!t)return!1;const n=this.registry.getTarget(t);if(re(n,`Expected to find a valid target. targetId=${t}`),!this.isDragging()||this.didDrop())return!1;const s=this.registry.getTargetType(t),a=this.getItemType();return xr(s,a)&&n.canDrop(this,t)}isDragging(){return!!this.getItemType()}isDraggingSource(t){if(!t)return!1;const n=this.registry.getSource(t,!0);if(re(n,`Expected to find a valid source. sourceId=${t}`),!this.isDragging()||!this.isSourcePublic())return!1;const s=this.registry.getSourceType(t),a=this.getItemType();return s!==a?!1:n.isDragging(this,t)}isOverTarget(t,n={shallow:!1}){if(!t)return!1;const{shallow:s}=n;if(!this.isDragging())return!1;const a=this.registry.getTargetType(t),o=this.getItemType();if(o&&!xr(a,o))return!1;const i=this.getTargetIds();if(!i.length)return!1;const l=i.indexOf(t);return s?l===i.length-1:l>-1}getItemType(){return this.store.getState().dragOperation.itemType}getItem(){return this.store.getState().dragOperation.item}getSourceId(){return this.store.getState().dragOperation.sourceId}getTargetIds(){return this.store.getState().dragOperation.targetIds}getDropResult(){return this.store.getState().dragOperation.dropResult}didDrop(){return this.store.getState().dragOperation.didDrop}isSourcePublic(){return!!this.store.getState().dragOperation.isSourcePublic}getInitialClientOffset(){return this.store.getState().dragOffset.initialClientOffset}getInitialSourceClientOffset(){return this.store.getState().dragOffset.initialSourceClientOffset}getClientOffset(){return this.store.getState().dragOffset.clientOffset}getSourceClientOffset(){return co(this.store.getState().dragOffset)}getDifferenceFromInitialOffset(){return uo(this.store.getState().dragOffset)}constructor(t,n){this.store=t,this.registry=n}}const Qr=typeof global<"u"?global:self,qn=Qr.MutationObserver||Qr.WebKitMutationObserver;function Yn(e){return function(){const n=setTimeout(a,0),s=setInterval(a,50);function a(){clearTimeout(n),clearInterval(s),e()}}}function ho(e){let t=1;const n=new qn(e),s=document.createTextNode("");return n.observe(s,{characterData:!0}),function(){t=-t,s.data=t}}const mo=typeof qn=="function"?ho:Yn;class go{enqueueTask(t){const{queue:n,requestFlush:s}=this;n.length||(s(),this.flushing=!0),n[n.length]=t}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{const{queue:t}=this;for(;this.index<t.length;){const n=this.index;if(this.index++,t[n].call(),this.index>this.capacity){for(let s=0,a=t.length-this.index;s<a;s++)t[s]=t[s+this.index];t.length-=this.index,this.index=0}}t.length=0,this.index=0,this.flushing=!1},this.registerPendingError=t=>{this.pendingErrors.push(t),this.requestErrorThrow()},this.requestFlush=mo(this.flush),this.requestErrorThrow=Yn(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}}class xo{call(){try{this.task&&this.task()}catch(t){this.onError(t)}finally{this.task=null,this.release(this)}}constructor(t,n){this.onError=t,this.release=n,this.task=null}}class bo{create(t){const n=this.freeTasks,s=n.length?n.pop():new xo(this.onError,a=>n[n.length]=a);return s.task=t,s}constructor(t){this.onError=t,this.freeTasks=[]}}const Xn=new go,Co=new bo(Xn.registerPendingError);function yo(e){Xn.enqueueTask(Co.create(e))}const Ar="dnd-core/ADD_SOURCE",_r="dnd-core/ADD_TARGET",Lr="dnd-core/REMOVE_SOURCE",Zt="dnd-core/REMOVE_TARGET";function vo(e){return{type:Ar,payload:{sourceId:e}}}function So(e){return{type:_r,payload:{targetId:e}}}function Io(e){return{type:Lr,payload:{sourceId:e}}}function No(e){return{type:Zt,payload:{targetId:e}}}function Do(e){re(typeof e.canDrag=="function","Expected canDrag to be a function."),re(typeof e.beginDrag=="function","Expected beginDrag to be a function."),re(typeof e.endDrag=="function","Expected endDrag to be a function.")}function jo(e){re(typeof e.canDrop=="function","Expected canDrop to be a function."),re(typeof e.hover=="function","Expected hover to be a function."),re(typeof e.drop=="function","Expected beginDrag to be a function.")}function br(e,t){if(t&&Array.isArray(e)){e.forEach(n=>br(n,!1));return}re(typeof e=="string"||typeof e=="symbol",t?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}var Oe;(function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"})(Oe||(Oe={}));let To=0;function wo(){return To++}function Eo(e){const t=wo().toString();switch(e){case Oe.SOURCE:return`S${t}`;case Oe.TARGET:return`T${t}`;default:throw new Error(`Unknown Handler Role: ${e}`)}}function en(e){switch(e[0]){case"S":return Oe.SOURCE;case"T":return Oe.TARGET;default:throw new Error(`Cannot parse handler ID: ${e}`)}}function tn(e,t){const n=e.entries();let s=!1;do{const{done:a,value:[,o]}=n.next();if(o===t)return!0;s=!!a}while(!s);return!1}class Oo{addSource(t,n){br(t),Do(n);const s=this.addHandler(Oe.SOURCE,t,n);return this.store.dispatch(vo(s)),s}addTarget(t,n){br(t,!0),jo(n);const s=this.addHandler(Oe.TARGET,t,n);return this.store.dispatch(So(s)),s}containsHandler(t){return tn(this.dragSources,t)||tn(this.dropTargets,t)}getSource(t,n=!1){return re(this.isSourceId(t),"Expected a valid source ID."),n&&t===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(t)}getTarget(t){return re(this.isTargetId(t),"Expected a valid target ID."),this.dropTargets.get(t)}getSourceType(t){return re(this.isSourceId(t),"Expected a valid source ID."),this.types.get(t)}getTargetType(t){return re(this.isTargetId(t),"Expected a valid target ID."),this.types.get(t)}isSourceId(t){return en(t)===Oe.SOURCE}isTargetId(t){return en(t)===Oe.TARGET}removeSource(t){re(this.getSource(t),"Expected an existing source."),this.store.dispatch(Io(t)),yo(()=>{this.dragSources.delete(t),this.types.delete(t)})}removeTarget(t){re(this.getTarget(t),"Expected an existing target."),this.store.dispatch(No(t)),this.dropTargets.delete(t),this.types.delete(t)}pinSource(t){const n=this.getSource(t);re(n,"Expected an existing source."),this.pinnedSourceId=t,this.pinnedSource=n}unpinSource(){re(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}addHandler(t,n,s){const a=Eo(t);return this.types.set(a,n),t===Oe.SOURCE?this.dragSources.set(a,s):t===Oe.TARGET&&this.dropTargets.set(a,s),a}constructor(t){this.types=new Map,this.dragSources=new Map,this.dropTargets=new Map,this.pinnedSourceId=null,this.pinnedSource=null,this.store=t}}const Ao=(e,t)=>e===t;function _o(e,t){return!e&&!t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function Lo(e,t,n=Ao){if(e.length!==t.length)return!1;for(let s=0;s<e.length;++s)if(!n(e[s],t[s]))return!1;return!0}function ko(e=Ct,t){switch(t.type){case Vt:break;case Ar:case _r:case Zt:case Lr:return Ct;case Kt:case Er:case Ut:case Gt:default:return Or}const{targetIds:n=[],prevTargetIds:s=[]}=t.payload,a=Pa(n,s);if(!(a.length>0||!Lo(n,s)))return Ct;const i=s[s.length-1],l=n[n.length-1];return i!==l&&(i&&a.push(i),l&&a.push(l)),a}function Ro(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Mo(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{},s=Object.keys(n);typeof Object.getOwnPropertySymbols=="function"&&(s=s.concat(Object.getOwnPropertySymbols(n).filter(function(a){return Object.getOwnPropertyDescriptor(n,a).enumerable}))),s.forEach(function(a){Ro(e,a,n[a])})}return e}const rn={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function Po(e=rn,t){const{payload:n}=t;switch(t.type){case wr:case Kt:return{initialSourceClientOffset:n.sourceClientOffset,initialClientOffset:n.clientOffset,clientOffset:n.clientOffset};case Vt:return _o(e.clientOffset,n.clientOffset)?e:Mo({},e,{clientOffset:n.clientOffset});case Ut:case Gt:return rn;default:return e}}function Fo(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ct(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{},s=Object.keys(n);typeof Object.getOwnPropertySymbols=="function"&&(s=s.concat(Object.getOwnPropertySymbols(n).filter(function(a){return Object.getOwnPropertyDescriptor(n,a).enumerable}))),s.forEach(function(a){Fo(e,a,n[a])})}return e}const Bo={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function zo(e=Bo,t){const{payload:n}=t;switch(t.type){case Kt:return ct({},e,{itemType:n.itemType,item:n.item,sourceId:n.sourceId,isSourcePublic:n.isSourcePublic,dropResult:null,didDrop:!1});case Er:return ct({},e,{isSourcePublic:!0});case Vt:return ct({},e,{targetIds:n.targetIds});case Zt:return e.targetIds.indexOf(n.targetId)===-1?e:ct({},e,{targetIds:Ma(e.targetIds,n.targetId)});case Gt:return ct({},e,{dropResult:n.dropResult,didDrop:!0,targetIds:[]});case Ut:return ct({},e,{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}}function $o(e=0,t){switch(t.type){case Ar:case _r:return e+1;case Lr:case Zt:return e-1;default:return e}}function Ho(e=0){return e+1}function Ko(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Vo(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{},s=Object.keys(n);typeof Object.getOwnPropertySymbols=="function"&&(s=s.concat(Object.getOwnPropertySymbols(n).filter(function(a){return Object.getOwnPropertyDescriptor(n,a).enumerable}))),s.forEach(function(a){Ko(e,a,n[a])})}return e}function Go(e={},t){return{dirtyHandlerIds:ko(e.dirtyHandlerIds,{type:t.type,payload:Vo({},t.payload,{prevTargetIds:Ra(e,"dragOperation.targetIds",[])})}),dragOffset:Po(e.dragOffset,t),refCount:$o(e.refCount,t),dragOperation:zo(e.dragOperation,t),stateId:Ho(e.stateId)}}function Uo(e,t=void 0,n={},s=!1){const a=Zo(s),o=new po(a,new Oo(a)),i=new io(a,o),l=e(i,t,n);return i.receiveBackend(l),i}function Zo(e){const t=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__;return Un(Go,e&&t&&t({name:"dnd-core",instanceId:"dnd-core"}))}function Wo(e,t){if(e==null)return{};var n=qo(e,t),s,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)s=o[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function qo(e,t){if(e==null)return{};var n={},s=Object.keys(e),a,o;for(o=0;o<s.length;o++)a=s[o],!(t.indexOf(a)>=0)&&(n[a]=e[a]);return n}let nn=0;const Mt=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__");var Yo=g.memo(function(t){var{children:n}=t,s=Wo(t,["children"]);const[a,o]=Xo(s);return g.useEffect(()=>{if(o){const i=Jn();return++nn,()=>{--nn===0&&(i[Mt]=null)}}},[]),r.jsx(Gn.Provider,{value:a,children:n})});function Xo(e){if("manager"in e)return[{dragDropManager:e.manager},!1];const t=Jo(e.backend,e.context,e.options,e.debugMode),n=!e.context;return[t,n]}function Jo(e,t=Jn(),n,s){const a=t;return a[Mt]||(a[Mt]={dragDropManager:Uo(e,t,n,s)}),a[Mt]}function Jn(){return typeof global<"u"?global:window}var ar,sn;function Qo(){return sn||(sn=1,ar=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var s,a,o;if(Array.isArray(t)){if(s=t.length,s!=n.length)return!1;for(a=s;a--!==0;)if(!e(t[a],n[a]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(o=Object.keys(t),s=o.length,s!==Object.keys(n).length)return!1;for(a=s;a--!==0;)if(!Object.prototype.hasOwnProperty.call(n,o[a]))return!1;for(a=s;a--!==0;){var i=o[a];if(!e(t[i],n[i]))return!1}return!0}return t!==t&&n!==n}),ar}var ei=Qo();const ti=v.getDefaultExportFromCjs(ei),Qe=typeof window<"u"?g.useLayoutEffect:g.useEffect;function ri(e,t,n){const[s,a]=g.useState(()=>t(e)),o=g.useCallback(()=>{const i=t(e);ti(s,i)||(a(i),n&&n())},[s,e,n]);return Qe(o),[s,o]}function ni(e,t,n){const[s,a]=ri(e,t,n);return Qe(function(){const i=e.getHandlerId();if(i!=null)return e.subscribeToStateChange(a,{handlerIds:[i]})},[e,a]),s}function Qn(e,t,n){return ni(t,e||(()=>({})),()=>n.reconnect())}function es(e,t){const n=[...t||[]];return t==null&&typeof e!="function"&&n.push(e),g.useMemo(()=>typeof e=="function"?e():e,n)}function si(e){return g.useMemo(()=>e.hooks.dragSource(),[e])}function ai(e){return g.useMemo(()=>e.hooks.dragPreview(),[e])}let or=!1,ir=!1;class oi{receiveHandlerId(t){this.sourceId=t}getHandlerId(){return this.sourceId}canDrag(){re(!or,"You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return or=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{or=!1}}isDragging(){if(!this.sourceId)return!1;re(!ir,"You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return ir=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{ir=!1}}subscribeToStateChange(t,n){return this.internalMonitor.subscribeToStateChange(t,n)}isDraggingSource(t){return this.internalMonitor.isDraggingSource(t)}isOverTarget(t,n){return this.internalMonitor.isOverTarget(t,n)}getTargetIds(){return this.internalMonitor.getTargetIds()}isSourcePublic(){return this.internalMonitor.isSourcePublic()}getSourceId(){return this.internalMonitor.getSourceId()}subscribeToOffsetChange(t){return this.internalMonitor.subscribeToOffsetChange(t)}canDragSource(t){return this.internalMonitor.canDragSource(t)}canDropOnTarget(t){return this.internalMonitor.canDropOnTarget(t)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(t){this.sourceId=null,this.internalMonitor=t.getMonitor()}}let lr=!1;class ii{receiveHandlerId(t){this.targetId=t}getHandlerId(){return this.targetId}subscribeToStateChange(t,n){return this.internalMonitor.subscribeToStateChange(t,n)}canDrop(){if(!this.targetId)return!1;re(!lr,"You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor");try{return lr=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{lr=!1}}isOver(t){return this.targetId?this.internalMonitor.isOverTarget(this.targetId,t):!1}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(t){this.targetId=null,this.internalMonitor=t.getMonitor()}}function li(e,t,n){const s=n.getRegistry(),a=s.addTarget(e,t);return[a,()=>s.removeTarget(a)]}function ci(e,t,n){const s=n.getRegistry(),a=s.addSource(e,t);return[a,()=>s.removeSource(a)]}function Cr(e,t,n,s){let a;if(a!==void 0)return!!a;if(e===t)return!0;if(typeof e!="object"||!e||typeof t!="object"||!t)return!1;const o=Object.keys(e),i=Object.keys(t);if(o.length!==i.length)return!1;const l=Object.prototype.hasOwnProperty.bind(t);for(let c=0;c<o.length;c++){const d=o[c];if(!l(d))return!1;const f=e[d],p=t[d];if(a=void 0,a===!1||a===void 0&&f!==p)return!1}return!0}function yr(e){return e!==null&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function di(e){if(typeof e.type=="string")return;const t=e.type.displayName||e.type.name||"the component";throw new Error(`Only native element nodes can now be passed to React DnD connectors.You can either wrap ${t} into a <div>, or turn it into a drag source or a drop target itself.`)}function ui(e){return(t=null,n=null)=>{if(!g.isValidElement(t)){const o=t;return e(o,n),o}const s=t;return di(s),fi(s,n?o=>e(o,n):e)}}function ts(e){const t={};return Object.keys(e).forEach(n=>{const s=e[n];if(n.endsWith("Ref"))t[n]=e[n];else{const a=ui(s);t[n]=()=>a}}),t}function an(e,t){typeof e=="function"?e(t):e.current=t}function fi(e,t){const n=e.ref;return re(typeof n!="string","Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),n?g.cloneElement(e,{ref:s=>{an(n,s),an(t,s)}}):g.cloneElement(e,{ref:t})}class pi{receiveHandlerId(t){this.handlerId!==t&&(this.handlerId=t,this.reconnect())}get connectTarget(){return this.dragSource}get dragSourceOptions(){return this.dragSourceOptionsInternal}set dragSourceOptions(t){this.dragSourceOptionsInternal=t}get dragPreviewOptions(){return this.dragPreviewOptionsInternal}set dragPreviewOptions(t){this.dragPreviewOptionsInternal=t}reconnect(){const t=this.reconnectDragSource();this.reconnectDragPreview(t)}reconnectDragSource(){const t=this.dragSource,n=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();return n&&this.disconnectDragSource(),this.handlerId?t?(n&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=t,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,t,this.dragSourceOptions)),n):(this.lastConnectedDragSource=t,n):n}reconnectDragPreview(t=!1){const n=this.dragPreview,s=t||this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();if(s&&this.disconnectDragPreview(),!!this.handlerId){if(!n){this.lastConnectedDragPreview=n;return}s&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=n,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,n,this.dragPreviewOptions))}}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didConnectedDragSourceChange(){return this.lastConnectedDragSource!==this.dragSource}didConnectedDragPreviewChange(){return this.lastConnectedDragPreview!==this.dragPreview}didDragSourceOptionsChange(){return!Cr(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}didDragPreviewOptionsChange(){return!Cr(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}disconnectDragSource(){this.dragSourceUnsubscribe&&(this.dragSourceUnsubscribe(),this.dragSourceUnsubscribe=void 0)}disconnectDragPreview(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}get dragSource(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}get dragPreview(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}clearDragSource(){this.dragSourceNode=null,this.dragSourceRef=null}clearDragPreview(){this.dragPreviewNode=null,this.dragPreviewRef=null}constructor(t){this.hooks=ts({dragSource:(n,s)=>{this.clearDragSource(),this.dragSourceOptions=s||null,yr(n)?this.dragSourceRef=n:this.dragSourceNode=n,this.reconnectDragSource()},dragPreview:(n,s)=>{this.clearDragPreview(),this.dragPreviewOptions=s||null,yr(n)?this.dragPreviewRef=n:this.dragPreviewNode=n,this.reconnectDragPreview()}}),this.handlerId=null,this.dragSourceRef=null,this.dragSourceOptionsInternal=null,this.dragPreviewRef=null,this.dragPreviewOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDragSource=null,this.lastConnectedDragSourceOptions=null,this.lastConnectedDragPreview=null,this.lastConnectedDragPreviewOptions=null,this.backend=t}}class hi{get connectTarget(){return this.dropTarget}reconnect(){const t=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();t&&this.disconnectDropTarget();const n=this.dropTarget;if(this.handlerId){if(!n){this.lastConnectedDropTarget=n;return}t&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=n,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,n,this.dropTargetOptions))}}receiveHandlerId(t){t!==this.handlerId&&(this.handlerId=t,this.reconnect())}get dropTargetOptions(){return this.dropTargetOptionsInternal}set dropTargetOptions(t){this.dropTargetOptionsInternal=t}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didDropTargetChange(){return this.lastConnectedDropTarget!==this.dropTarget}didOptionsChange(){return!Cr(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}disconnectDropTarget(){this.unsubscribeDropTarget&&(this.unsubscribeDropTarget(),this.unsubscribeDropTarget=void 0)}get dropTarget(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}clearDropTarget(){this.dropTargetRef=null,this.dropTargetNode=null}constructor(t){this.hooks=ts({dropTarget:(n,s)=>{this.clearDropTarget(),this.dropTargetOptions=s,yr(n)?this.dropTargetRef=n:this.dropTargetNode=n,this.reconnect()}}),this.handlerId=null,this.dropTargetRef=null,this.dropTargetOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDropTarget=null,this.lastConnectedDropTargetOptions=null,this.backend=t}}function ft(){const{dragDropManager:e}=g.useContext(Gn);return re(e!=null,"Expected drag drop context"),e}function mi(e,t){const n=ft(),s=g.useMemo(()=>new pi(n.getBackend()),[n]);return Qe(()=>(s.dragSourceOptions=e||null,s.reconnect(),()=>s.disconnectDragSource()),[s,e]),Qe(()=>(s.dragPreviewOptions=t||null,s.reconnect(),()=>s.disconnectDragPreview()),[s,t]),s}function gi(){const e=ft();return g.useMemo(()=>new oi(e),[e])}class xi{beginDrag(){const t=this.spec,n=this.monitor;let s=null;return typeof t.item=="object"?s=t.item:typeof t.item=="function"?s=t.item(n):s={},s??null}canDrag(){const t=this.spec,n=this.monitor;return typeof t.canDrag=="boolean"?t.canDrag:typeof t.canDrag=="function"?t.canDrag(n):!0}isDragging(t,n){const s=this.spec,a=this.monitor,{isDragging:o}=s;return o?o(a):n===t.getSourceId()}endDrag(){const t=this.spec,n=this.monitor,s=this.connector,{end:a}=t;a&&a(n.getItem(),n),s.reconnect()}constructor(t,n,s){this.spec=t,this.monitor=n,this.connector=s}}function bi(e,t,n){const s=g.useMemo(()=>new xi(e,t,n),[t,n]);return g.useEffect(()=>{s.spec=e},[e]),s}function Ci(e){return g.useMemo(()=>{const t=e.type;return re(t!=null,"spec.type must be defined"),t},[e])}function yi(e,t,n){const s=ft(),a=bi(e,t,n),o=Ci(e);Qe(function(){if(o!=null){const[l,c]=ci(o,a,s);return t.receiveHandlerId(l),n.receiveHandlerId(l),c}},[s,t,n,a,o])}function vi(e,t){const n=es(e,t);re(!n.begin,"useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)");const s=gi(),a=mi(n.options,n.previewOptions);return yi(n,s,a),[Qn(n.collect,s,a),si(a),ai(a)]}function Si(e){return g.useMemo(()=>e.hooks.dropTarget(),[e])}function Ii(e){const t=ft(),n=g.useMemo(()=>new hi(t.getBackend()),[t]);return Qe(()=>(n.dropTargetOptions=e||null,n.reconnect(),()=>n.disconnectDropTarget()),[e]),n}function Ni(){const e=ft();return g.useMemo(()=>new ii(e),[e])}function Di(e){const{accept:t}=e;return g.useMemo(()=>(re(e.accept!=null,"accept must be defined"),Array.isArray(t)?t:[t]),[t])}class ji{canDrop(){const t=this.spec,n=this.monitor;return t.canDrop?t.canDrop(n.getItem(),n):!0}hover(){const t=this.spec,n=this.monitor;t.hover&&t.hover(n.getItem(),n)}drop(){const t=this.spec,n=this.monitor;if(t.drop)return t.drop(n.getItem(),n)}constructor(t,n){this.spec=t,this.monitor=n}}function Ti(e,t){const n=g.useMemo(()=>new ji(e,t),[t]);return g.useEffect(()=>{n.spec=e},[e]),n}function wi(e,t,n){const s=ft(),a=Ti(e,t),o=Di(e);Qe(function(){const[l,c]=li(o,a,s);return t.receiveHandlerId(l),n.receiveHandlerId(l),c},[s,t,a,n,o.map(i=>i.toString()).join("|")])}function kr(e,t){const n=es(e,t),s=Ni(),a=Ii(n.options);return wi(n,s,a),[Qn(n.collect,s,a),Si(a)]}const on="column",Ei="flex items-center",Oi="mr-3 cursor-move text-secondary",Ai=({id:e,children:t,className:n,onFind:s,onMove:a,ariaLabel:o="Drag item"})=>{const i=g.useRef(null),l=g.useRef(null),c=typeof s=="function"?s(e):-1,[{isDragging:d},f,p]=vi(()=>({type:on,item:{id:e,originalIndex:c},collect:u=>{const m=u.getItem();return{isDragging:u.isDragging()&&m?.id===e}},end:(u,m)=>{if(!u)return;!m.didDrop()&&typeof a=="function"&&u.originalIndex>-1&&a(u.id,u.originalIndex)}}),[e,c,a]),[,h]=kr(()=>({accept:on,hover:u=>{if(!(!u||u.id===e)&&typeof s=="function"&&typeof a=="function"){const m=s(e);a(u.id,m)}}}),[s,a,e]);return p(h(l)),f(i),r.jsxs("div",{ref:l,className:S.mergeClasses(Ei,n),style:{opacity:d?0:1},"aria-roledescription":"Draggable item",children:[r.jsx("div",{ref:i,className:Oi,"aria-label":o,children:r.jsx($.IconGripVertical,{...H.BASE_ICON_PROPS})}),t]})},Wt=({iconClassName:e,label:t,...n})=>t?r.jsx(v.DialDangerButton,{...n,label:t,appearance:_.ButtonAppearance.Ghost,iconBefore:r.jsx($.IconTrashX,{...H.BASE_ICON_PROPS,className:e||""})}):r.jsx(O.DialDangerIconButton,{...n,appearance:_.ButtonAppearance.Ghost,icon:r.jsx($.IconTrashX,{...H.BASE_ICON_PROPS,className:e||""})}),_i=({className:e="",value:t,onChange:n,error:s,containerClassName:a,resize:o=!1,labelProps:i,caption:l,id:c,...d})=>{const f=S.mergeClasses("dial-textarea dial-input px-3 py-2",d.invalid&&"dial-input-error",d.disabled&&"dial-input-disable",o?"resize":"resize-none",e);return r.jsxs("div",{className:S.mergeClasses("flex flex-col gap-y-1",a),children:[i&&r.jsx(Ue.DialLabel,{...i,htmlFor:c}),r.jsx("textarea",{id:c,value:t||"",className:f,onChange:p=>n?.(p.currentTarget.value),...d}),r.jsx(v.DialErrorText,{text:s}),!s&&r.jsx(v.DialCaptionText,{text:l})]})},Li="inline-flex items-center rounded bg-layer-3",ki="flex flex-1 items-center justify-center gap-2 h-7 px-3 py-1 border border-primary dial-small-text whitespace-nowrap focus-visible:outline outline-offset-0 focus-visible:relative focus-visible:z-10",Ri="relative z-10 bg-controls-accent-primary-alpha-active text-primary",Mi="text-secondary hover:text-primary",Pi="text-controls-disable-accent cursor-not-allowed hover:text-controls-disable-accent",Fi=({options:e,value:t,onChange:n,disabled:s,className:a,ariaLabel:o})=>{const i=g.useCallback(l=>{if(s)return;const c=e.filter(h=>!h.disabled);if(c.length===0)return;const d=c.findIndex(h=>h.value===t);let f=null;switch(l.key){case"ArrowRight":case"ArrowDown":f=(d+1)%c.length;break;case"ArrowLeft":case"ArrowUp":f=(d-1+c.length)%c.length;break;case"Home":f=0;break;case"End":f=c.length-1;break;default:return}l.preventDefault();const p=c[f];p&&p.value!==t&&n(p.value)},[s,e,t,n]);return r.jsx("div",{role:"tablist","aria-label":o,className:S.mergeClasses(Li,a),children:e.map((l,c)=>{const d=l.value===t,f=c===0,p=c===e.length-1,h=s||l.disabled;return r.jsxs("button",{type:"button",role:"tab","aria-selected":d,tabIndex:d?0:-1,disabled:h,onClick:()=>n(l.value),onKeyDown:i,className:S.mergeClasses(ki,!p&&"-mr-px",f&&"rounded-l",p&&"rounded-r",d?Ri:Mi,h&&Pi),children:[l.icon,l.label]},l.value)})})},cr=8,Bi=24,rs=({initialTags:e=[],label:t,required:n,elementId:s,placeholder:a,captionDescription:o,errorText:i,invalid:l,disabled:c,collapseTagOverflow:d=!1,readOnly:f=!1,containerClassName:p,tagClassName:h,onChange:u})=>{const m=g.useRef(null),C=g.useRef([]),x=g.useRef(null),[b,y]=g.useState(e),[N,D]=g.useState(""),[I,j]=g.useState(!1),[L,w]=g.useState(e.length),A=g.useCallback(F=>G=>{C.current[F]=G},[]),E=g.useCallback(()=>{if(!d)return;const F=m.current;if(!F)return;const G=F.offsetWidth;if(G===0)return;const U=x.current?.offsetWidth??0,le=G-(f?0:Bi)-cr;let J=0,ie=0;for(let W=0;W<b.length;W++){const te=C.current[W];if(!te)continue;const ae=te.offsetWidth+cr;if(J+ae>le)break;J+=ae,ie++}if(ie<b.length&&ie>0)for(;J+U>le&&ie>0;){ie--;const W=C.current[ie]?.offsetWidth??0;J-=W+cr}w(ie)},[d,f,b.length]),T=F=>{const G=F.trim().replace(/,$/,"");if(G&&!b.includes(G)){const U=[G,...b];y(U),u?.(U)}},R=F=>{(F.key===","||F.key==="Enter")&&(F.preventDefault(),T(N),D(""))},B=()=>{N.trim()&&(T(N),D(""))},K=F=>{const G=b.filter((U,Z)=>Z!==F);y(G),u?.(G)},Q=()=>i?r.jsx(v.DialErrorText,{text:i}):o?r.jsx(v.DialCaptionText,{text:o}):null;g.useEffect(()=>{if(d)return;const F=new ResizeObserver(()=>{if(m.current){const G=m.current.scrollHeight>m.current.clientHeight+10;j(G)}});return m.current&&F.observe(m.current),()=>F.disconnect()},[b,d]),g.useEffect(()=>{if(!d){w(b.length);return}w(b.length);const F=new ResizeObserver(()=>{E()}),G=m.current;return G&&F.observe(G),E(),()=>F.disconnect()},[d,E,b]),g.useEffect(()=>{y(e)},[JSON.stringify(e)]);const V=r.jsxs("div",{ref:m,className:de("flex gap-2 items-center relative",d?"flex-nowrap overflow-hidden w-full min-w-0":de("flex-wrap",I?"flex-col-reverse":"flex-row"),p),children:[(d?b.slice(0,L):b).map((F,G)=>r.jsx(Je,{label:F,className:h,closable:!c&&!f,onRemove:!c&&!f?()=>K(G):void 0},F+G)),d&&L<b.length&&r.jsx(_.DialTooltip,{tooltip:b.slice(L).join(", "),triggerClassName:"inline-flex shrink-0 cursor-pointer",children:r.jsx(Je,{label:`+${b.length-L}`})}),!f&&r.jsx("input",{id:s,type:"text",value:N,onChange:F=>D(F.target.value),onKeyDown:R,onBlur:B,className:de("dial-input outline-none !border-none w-full flex-1 !p-1 !h-auto",d?"min-w-0":"min-w-[100px]"),placeholder:a??"",disabled:c}),d&&r.jsxs("div",{className:"absolute left-0 top-0 invisible pointer-events-none h-0 overflow-hidden whitespace-nowrap","aria-hidden":!0,children:[b.map((F,G)=>r.jsx("div",{ref:A(G),className:"inline-flex shrink-0",children:r.jsx(Je,{label:F,className:h,closable:!c&&!f,onRemove:!c&&!f?()=>K(G):void 0})},`measure-${F}-${G}`)),r.jsx("div",{ref:x,className:"inline-flex shrink-0",children:r.jsx(Je,{label:`+${b.length}`})})]})]});return f?V:r.jsxs("div",{className:"flex flex-col gap-2 w-full",children:[r.jsx(Ue.DialLabel,{label:t,required:n,htmlFor:s}),r.jsx("div",{className:de("dial-input min-h-[38px] p-[6px]",l&&"dial-input-error",c&&"dial-input-disable"),children:V}),Q()]})},ns=({selectedItems:e,placeholder:t,collapseTagOverflow:n=!1,listClassName:s,listElementClassName:a})=>e?.length?r.jsx(rs,{readOnly:!0,initialTags:e,collapseTagOverflow:n,containerClassName:s,tagClassName:a}):t?r.jsx("span",{className:"text-secondary",children:t}):null,dr=e=>Ur.createElement("svg",{width:18,height:18,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},Ur.createElement("path",{d:"M2.25 13.5V12C2.25 11.5858 2.58579 11.25 3 11.25C3.41421 11.25 3.75 11.5858 3.75 12V13.5C3.75 13.6989 3.82907 13.8896 3.96973 14.0303C4.11038 14.1709 4.30109 14.25 4.5 14.25H6C6.41421 14.25 6.75 14.5858 6.75 15C6.75 15.4142 6.41421 15.75 6 15.75H4.5C3.90326 15.75 3.33114 15.5128 2.90918 15.0908C2.48722 14.6689 2.25 14.0967 2.25 13.5ZM14.25 6V4.5C14.25 4.30109 14.1709 4.11038 14.0303 3.96973C13.8896 3.82907 13.6989 3.75 13.5 3.75H12C11.5858 3.75 11.25 3.41421 11.25 3C11.25 2.58579 11.5858 2.25 12 2.25H13.5C14.0967 2.25 14.6689 2.48722 15.0908 2.90918C15.5128 3.33114 15.75 3.90326 15.75 4.5V6C15.75 6.41421 15.4142 6.75 15 6.75C14.5858 6.75 14.25 6.41421 14.25 6Z",fill:"currentColor"})),ss=({children:e,open:t,disabled:n=!1,selectedValue:s,valueClassName:a,inputClassName:o,onOpen:i,elementId:l,errorText:c,invalid:d,emptyValueText:f,placeholder:p,editable:h=!1,onValueChange:u,collapseTagOverflow:m=!1,iconBefore:C})=>{const x=Array.isArray(s)&&s.length>0,b=typeof s=="string"&&!!s.trim(),y=x||b?s:p?void 0:f,N=n?void 0:i,D=g.useCallback(w=>{u?.(w.target.value)},[u]),I=()=>r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:de("dial-input px-3 py-2 dial-input-field flex flex-row items-center gap-x-2 w-full justify-between",o,n&&"dial-input-disable",(c||d)&&"dial-input-error"),children:[r.jsxs("div",{className:"flex flex-row items-center gap-x-2 flex-1 min-w-0",children:[C&&r.jsx(O.DialIcon,{icon:C}),r.jsx("input",{type:"text",className:de("flex-1 min-w-0 bg-transparent outline-none border-none p-0 dial-small-text text-primary placeholder:text-secondary",a),value:typeof s=="string"?s:"",placeholder:p||f,onChange:D,disabled:n,id:l,"aria-label":"input-popup-field"})]}),!n&&r.jsx("button",{type:"button",className:"shrink-0 cursor-pointer bg-transparent border-none p-0 ml-1",onClick:i,"aria-label":"open-popup",children:r.jsx(O.DialIcon,{icon:r.jsx(dr,{role:"img",width:H.BASE_ICON_SIZE,height:H.BASE_ICON_SIZE})})})]}),r.jsx(v.DialErrorText,{text:c})]}),j=()=>r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button",className:"w-full",onClick:N,"aria-label":"open-popup",id:l,children:r.jsxs("div",{className:de("dial-input px-3 py-2 dial-input-field flex flex-row items-center gap-x-2 w-full justify-between cursor-pointer",o,n&&"dial-input-disable",(c||d)&&"dial-input-error"),children:[r.jsxs("div",{className:"flex flex-row items-center gap-x-2 flex-1 min-w-0",children:[C&&r.jsx(O.DialIcon,{icon:C}),r.jsx(_.DialTooltip,{tooltip:y==null?void 0:String(y),children:y||!p?r.jsx("span",{className:a,children:y}):r.jsx("span",{className:"text-secondary",children:p})})]}),!n&&r.jsx("div",{className:"shrink-0",children:r.jsx(O.DialIcon,{icon:r.jsx(dr,{role:"img",width:H.BASE_ICON_SIZE,height:H.BASE_ICON_SIZE})})})]})}),r.jsx(v.DialErrorText,{text:c})]}),L=()=>r.jsx("div",{className:"w-full",onClick:N,children:r.jsxs("div",{className:de("dial-input px-3 py-2 flex flex-row items-center gap-x-2 w-full justify-between cursor-pointer",n&&"dial-input-disable"),children:[r.jsxs("div",{className:"flex flex-row items-center gap-x-2 flex-1 min-w-0",children:[C&&r.jsx(O.DialIcon,{icon:C}),r.jsx(ns,{placeholder:p,selectedItems:y,collapseTagOverflow:m})]}),!n&&r.jsx("div",{className:"ml-1",children:r.jsx(O.DialIcon,{icon:r.jsx(dr,{role:"img",width:H.BASE_ICON_SIZE,height:H.BASE_ICON_SIZE})})})]})});return r.jsxs(r.Fragment,{children:[x?L():h?I():j(),t&&oa.createPortal(e,document.body)]})},zi=({label:e,htmlFor:t,disabled:n,selectedValue:s,radioButtons:a,customInputValue:o,valueClassName:i,inputClassName:l,emptyValueText:c,placeholder:d,onClose:f,header:p,portalId:h,onApply:u,onCancel:m,cancelButtonTitle:C="Cancel",applyButtonTitle:x="Apply",isValid:b,selectedRadioValue:y,onChangeRadioField:N,id:D,size:I=v.PopupSize.Md})=>{const[j,L]=g.useState(!1),w=g.useCallback(()=>{n||L(!0)},[n]),A=g.useCallback(()=>{L(!1),f?.()},[f]),E=g.useCallback(()=>{m?.(),A()},[m,A]),T=g.useCallback(()=>{u(),A()},[u,A]);return r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx(Ue.DialLabel,{label:e,htmlFor:t}),r.jsx(ss,{disabled:n,open:j,selectedValue:o??a.find(R=>R.id===s)?.name,valueClassName:i,inputClassName:de(l,"py-2","px-3"),emptyValueText:c,placeholder:d,onOpen:w,children:r.jsx(v.DialPopup,{open:j,onClose:E,header:p,portalId:h,size:I,footer:r.jsxs("div",{className:"flex flex-row items-center justify-end gap-2 px-6 py-4",children:[r.jsx(v.DialNeutralButton,{label:C,onClick:E}),r.jsx(v.DialPrimaryButton,{label:x,onClick:T,disabled:!b})]}),children:r.jsx("div",{className:"px-6 py-4",children:r.jsx(v.DialRadioGroup,{radioButtons:a,labelClassName:"dial-small-text",activeRadioButton:y,onChange:N,elementId:D,orientation:v.RadioGroupOrientation.Column})})})})]})},$i="Create",Hi="Cancel",Ki="flex items-center justify-end gap-2 px-6 py-3",Vi=({header:e,open:t=!1,submitLabel:n=$i,cancelLabel:s=Hi,isLoading:a=!1,disableSubmitButton:o=!1,className:i,submitClassName:l,onClose:c,onSubmit:d,onCancel:f,children:p,dividers:h=!0,size:u=v.PopupSize.Md,footer:m})=>{const C=a?null:r.jsxs("div",{className:Ki,children:[r.jsx(v.DialNeutralButton,{label:s,onClick:()=>f?f():c?.()}),r.jsx(v.DialPrimaryButton,{className:l,label:n,disabled:o,onClick:()=>d()})]}),x=g.useCallback(()=>a?r.jsx("div",{className:"px-6 py-4 h-[120px]",children:r.jsx(v.DialLoader,{size:50})}):p??null,[p,a]);return r.jsx(v.DialPopup,{open:t,header:e,className:i,dividers:h,onClose:()=>c?.(),footer:m??C,size:u,children:x()})},Gi=/^0+\.(\d+)?$/,Ui=/^0+/,vr=({integer:e,onChange:t,min:n,max:s,onKeyDown:a,onPaste:o,...i})=>{const l=f=>!f||f==="-"?f:String(f)?.match(Gi)?String(f)?.replace(Ui,"0"):Number(f),c=f=>{if([".","-","+","e","E"].includes(f.key)){f.preventDefault();return}v.handleKeyDown(f,"number",n,s)},d=f=>{const p=f.clipboardData.getData("text"),h=p.replace(/\D/g,"");if(h!==p&&(f.preventDefault(),h)){const u=f.currentTarget,m=u.selectionStart??0,C=u.selectionEnd??0,x=u.value.slice(0,m)+h+u.value.slice(C);t?.(l(x))}};return r.jsx(v.DialInput,{type:"number",min:n,max:s,onChange:f=>t?.(l(f)),onKeyDown:e?c:a,onPaste:e?d:o,...i})},Zi=({onClick:e})=>r.jsx($.IconEyeOff,{...H.BASE_ICON_PROPS,className:"text-primary",onClick:e,role:"button","aria-label":"hide"}),Wi=({onClick:e})=>r.jsx($.IconEye,{...H.BASE_ICON_PROPS,className:"text-primary",onClick:e,role:"button","aria-label":"show"}),as=({...e})=>{const[t,n]=g.useState(!1),s=g.useCallback(a=>{n(a)},[]);return r.jsx(v.DialInput,{type:t?"text":"password",...e,iconAfter:e.disabled?null:t?r.jsx(Zi,{onClick:()=>s(!1)}):r.jsx(Wi,{onClick:()=>s(!0)})})},os=({options:e,selectedValues:t,handleRemoveTag:n})=>r.jsx("div",{className:"flex flex-wrap w-full items-center gap-1",children:t.map(s=>{const a=e.find(i=>i.value===s)?.label??s,o=e.find(i=>i.value===s)?.icon;return r.jsx(Je,{label:a,onRemove:i=>n?.(i,s),icon:o?r.jsx(O.DialIcon,{icon:o}):null,className:"max-w-full"},s)})});var Ft=(e=>(e.Sm="sm",e.Md="md",e))(Ft||{}),Bt=(e=>(e.Primary="Primary",e.Secondary="Secondary",e))(Bt||{});const qi="dial-input flex w-full items-center justify-between gap-2 dial-small-text cursor-pointer",Yi="w-full rounded flex flex-col",yt="flex w-full items-center justify-between gap-2 px-3 h-[34px] dial-small-text text-primary truncate hover:bg-accent-primary-alpha focus:bg-accent-primary-alpha focus:outline-none",Xi="bg-accent-primary-alpha",Sr="bg-accent-primary-alpha border-l border-accent-primary border-1",zt="opacity-75",Ji=352,Qi=4,el=r.jsx($.IconChevronDown,{size:H.DIAL_ICON_SIZE.SM}),tl=({opt:e,selectedValues:t,onSelect:n})=>{const{isOpen:s,refs:a,floatingStyles:o,context:i,getReferenceProps:l,getFloatingProps:c}=O.useSubMenuFloating(Qi,"listbox",!!e.disabled),d=e.children?.some(f=>t.includes(f.value));return r.jsxs(r.Fragment,{children:[r.jsxs("button",{ref:a.setReference,type:"button",role:"option","aria-haspopup":"listbox","aria-expanded":s,"aria-selected":!!d,"aria-disabled":!!e.disabled,disabled:e.disabled,className:de(yt,d&&Sr,e.disabled&&zt),...l(),children:[r.jsxs("div",{className:"flex items-center gap-2 w-full min-w-0",children:[e.icon&&r.jsx(O.DialIcon,{icon:e.icon}),r.jsx(O.DialEllipsisTooltip,{text:e.labelNode??e.label})]}),r.jsx($.IconChevronRight,{size:14,className:"shrink-0"})]}),s&&r.jsx(O.SubMenuPanel,{refs:a,floatingStyles:o,context:i,getFloatingProps:c,role:"listbox",className:"w-max py-1",children:e.children.map(f=>{const p=t.includes(f.value);return r.jsx("button",{type:"button",role:"option","aria-selected":p,"aria-disabled":!!f.disabled,disabled:f.disabled,className:de(yt,p&&Sr,f.disabled&&zt),onClick:()=>!f.disabled&&n(f.value),children:r.jsxs("div",{className:"flex items-center gap-2 w-full",children:[f.icon&&r.jsx(O.DialIcon,{icon:f.icon}),r.jsx(O.DialEllipsisTooltip,{text:f.labelNode??f.label})]})},f.value)})})]})},Me=({options:e,multiple:t=!1,elementId:n,value:s,defaultValue:a,variant:o=Bt.Primary,size:i=Ft.Md,prefix:l,customSelectedValue:c,placeholder:d="Select...",searchable:f=!1,searchSize:p=_.ElementSize.Standard,searchPlaceholder:h,selectAll:u=!1,invalid:m,selectAllLabel:C="Select all",emptyStateTitle:x="No options available",emptyStateDescription:b,emptyStateIcon:y,disabled:N=!1,className:D,listClassName:I,closable:j=!1,header:L,footer:w,onClose:A,onChange:E,inlineSearch:T=!1,dismissRef:R,onFooterClick:B,open:K,onOpenChange:Q,onInlineQueryChange:V,customMultiSelectTagsRenderer:F})=>{const G=g.useId(),[U,Z]=g.useState(!1),le=K!==void 0,J=le?!!K:U,ie=g.useCallback(M=>{le||Z(M),Q?.(M)},[le,Q]),[W,te]=g.useState(T&&c||""),ae=g.useRef(null),ce=g.useCallback(M=>{M!==W&&(te(M||""),V?.(M||""))},[V,W]),he=s!==void 0,[Se,be]=g.useState(a),q=he?s:Se,ee=g.useMemo(()=>t?Array.isArray(q)?q:[]:typeof q=="string"?[q]:[],[q,t]),Te=g.useMemo(()=>{const M=W.trim().toLowerCase();return M?e.filter(oe=>oe.label.toLowerCase().includes(M)):e},[e,W]);g.useEffect(()=>{!J&&!T&&ce("")},[T,J,ce]);const Le=g.useRef(c);g.useEffect(()=>{T&&c!==Le.current&&(J||(Le.current=c,ce(c||"")))},[c,T,J,ce]);const ge=g.useCallback(M=>{he||be(M),E?.(M)},[he,E]),$e=g.useCallback(M=>{if(t){const oe=new Set(ee);oe.has(M)?oe.delete(M):oe.add(M),ge(Array.from(oe));return}if(ge(M),T){const oe=e.find(Ie=>Ie.value===M)??e.flatMap(Ie=>Ie.children??[]).find(Ie=>Ie.value===M);oe&&ce(oe.label)}ie(!1)},[t,ge,T,ie,ee,e,ce]),Ye=g.useCallback((M,oe)=>{if(M.stopPropagation(),!t){ge("");return}const Ie=ee.filter(er=>er!==oe);ge(Ie)},[t,ee,ge]),me=g.useMemo(()=>Te.filter(M=>!M.disabled),[Te]),X=g.useMemo(()=>me.filter(M=>ee.includes(M.value)).length,[me,ee]),ue=g.useCallback(M=>{T&&!t&&!M&&$e(W),ie(M)},[$e,T,t,W,ie]),{allSelectedInFiltered:fe,someSelectedInFiltered:xt}=g.useMemo(()=>{const M=me.length>0&&X===me.length;return{allSelectedInFiltered:M,someSelectedInFiltered:X>0&&!M}},[me,X]),ot=g.useCallback(()=>{if(!(!t||me.length===0))if(fe){const M=new Set(me.map(oe=>oe.value));ge(ee.filter(oe=>!M.has(oe)))}else{const M=new Set(ee);me.forEach(oe=>M.add(oe.value)),ge(Array.from(M))}},[fe,t,me,ee,ge]),ve=ee.length>0;g.useEffect(()=>{J&&T&&!t&&!N&&requestAnimationFrame(()=>{const M=ae.current;if(!M)return;M.focus();const oe=M.value?.length??0;M.setSelectionRange?.(oe,oe)})},[J,T,t,N]);const Ze=!t&&ve?ee[0]:void 0,ye=g.useMemo(()=>Ze?e.find(M=>M.value===Ze)??e.flatMap(M=>M.children??[]).find(M=>M.value===Ze):void 0,[e,Ze]),Qt=g.useCallback(()=>t?ve?F?.(e,ee,Ye)||r.jsx(os,{options:e,selectedValues:ee,handleRemoveTag:Ye}):r.jsx("span",{className:"text-secondary truncate",children:d}):ye?r.jsxs(r.Fragment,{children:[ye.icon&&r.jsx(O.DialIcon,{icon:ye.icon}),r.jsx(O.DialEllipsisTooltip,{text:ye.labelNode??(l?`${l} ${ye.label}`:ye.label)}),ye?.description&&r.jsx("div",{className:"text-secondary dial-small-text",children:ye.description})]}):c&&s?c:r.jsx("span",{className:"text-secondary truncate",children:d}),[ve,t,c,l,s,d,ye,e,ee,Ye,F]);g.useImperativeHandle(R,()=>({dismiss:()=>{ie(!1)}}));const it=g.useCallback(()=>{ce(ee.length===1?ye?.label??W:"")},[W,ee.length,ce,ye?.label]),Xe=g.useCallback(()=>{N||(ie(!J),T&&!t&&(it(),ae.current?.focus()))},[N,T,J,t,it,ie]);return r.jsx(O.DialDropdown,{open:J,onOpenChange:ue,disabled:N,closable:j,onClose:A,placement:"bottom-start",allowedPlacements:["bottom-start","top-start"],maxDropdownHeight:f?null:Ji,listClassName:I,renderOverlay:()=>r.jsxs("div",{id:`list-${n||G}`,role:"listbox","aria-multiselectable":t||void 0,className:Yi,children:[L&&r.jsx(r.Fragment,{children:typeof L=="function"?L():L}),(f||j)&&e.length>8&&r.jsxs("div",{className:"flex items-center gap-2 px-2 pt-2",children:[f&&r.jsx(v.DialSearch,{size:p,placeholder:h,onChange:ce,value:W,id:`search-${n||G}`,containerClassName:S.mergeClasses(v.SIZE_CONFIG[p].containerClassName,"w-full")}),j&&r.jsx(v.DialButton,{"aria-label":"Close select",className:"shrink-0",iconBefore:r.jsx($.IconX,{size:H.DIAL_ICON_SIZE.SM}),onClick:M=>{A?.(M),ie(!1)}})]}),t&&u&&me.length>0&&r.jsx("div",{className:de(yt,"mt-2"),children:r.jsx(gr,{id:`${n||G}-selectAll`,label:C,checked:fe,indeterminate:xt,onChange:ot,ariaLabel:C})}),r.jsx("div",{className:de("overflow-y-auto max-h-[352px]",T&&Te.length===0?"":"py-1"),children:Te.length===0?!T&&r.jsx("div",{className:"px-2 py-3",children:r.jsx(O.DialNoDataContent,{icon:y??r.jsx($.IconClipboardX,{size:H.DIAL_ICON_SIZE.LG,stroke:.5}),title:x,description:b})}):Te.map(M=>{const oe=ee.includes(M.value);return t?r.jsxs("div",{role:"option","aria-selected":oe,"aria-disabled":!!M.disabled,className:de(yt,oe&&Xi,M.disabled&&zt,"w-full"),children:[r.jsx(gr,{id:`${n||G}-${M.value}`,label:r.jsxs("span",{className:"flex w-full flex-1 pl-2 min-w-0 items-center gap-2 text-primary",children:[M.icon&&r.jsx(O.DialIcon,{icon:M.icon}),r.jsx("span",{className:"truncate",children:M.labelNode??M.label})]}),checked:oe,disabled:M.disabled,onChange:()=>!M.disabled&&$e(M.value),ariaLabel:M.label}),M.description&&r.jsx("div",{className:"text-secondary dial-small-text",children:M.description})]},M.value):M.children?.length?r.jsx(tl,{opt:M,selectedValues:ee,onSelect:$e},M.value):r.jsx("button",{role:"option",type:"button","aria-selected":oe,"aria-disabled":!!M.disabled,disabled:M.disabled,className:de(yt,oe&&Sr,M.disabled&&zt),onClick:()=>!M.disabled&&$e(M.value),children:r.jsxs("div",{className:"flex items-center gap-2 w-full",children:[M.icon&&r.jsx(O.DialIcon,{icon:M.icon}),r.jsx(O.DialEllipsisTooltip,{text:M.labelNode??M.label}),M.description&&r.jsx("div",{className:"text-secondary dial-small-text",children:M.description})]})},M.value)})}),w&&r.jsx("div",{onClick:M=>{B?.(M),B&&ie(!1)},children:typeof w=="function"?w():w})]}),children:r.jsxs("div",{role:"button",tabIndex:0,"aria-roledescription":"button to open select list","aria-haspopup":"listbox","aria-expanded":J,"aria-controls":`list-${n||G}`,className:S.mergeClasses(qi,N&&"opacity-75 !cursor-not-allowed !border-primary",i===Ft.Sm?"min-h-[25px] px-1.5 py-1":"min-h-[38px] px-3 py-2",m&&"dial-input-error",o===Bt.Secondary?"!bg-layer-4 !h-auto":"",D),onMouseDown:M=>{N||T&&!t&&(it(),M.preventDefault())},onClick:()=>{Xe()},onKeyDown:M=>{(M.key===" "||M.code==="Space")&&(M.preventDefault(),Xe())},children:[T&&!t?r.jsx("div",{className:"flex min-w-0 items-center gap-2 text-primary flex-1",children:r.jsx("input",{id:`inline-${n||G}`,type:"text",placeholder:h??d,value:W||"",onChange:M=>ce(M.currentTarget.value.trimStart()),onFocus:()=>!N&&ie(!0),onMouseDown:M=>{it(),M.stopPropagation()},onClick:M=>{M.stopPropagation()},onKeyDown:M=>{M.stopPropagation()},className:"bg-transparent outline-none w-full dial-small-text",ref:ae,disabled:N,"aria-disabled":N,autoComplete:"off"})}):r.jsx("div",{className:"flex w-full min-w-0 items-center gap-2 text-primary",children:Qt()}),!T&&r.jsx(O.DialIcon,{icon:el,className:de("text-primary",J&&"rotate-180")})]})})},rl=({label:e,required:t,captionDescription:n,containerClassName:s,selectClassName:a,error:o,id:i,caption:l,readonly:c,value:d,defaultEmptyText:f,...p})=>{const h=g.useCallback(()=>{if(!d||Array.isArray(d)&&d.length===0)return f??"None";if(Array.isArray(d))return r.jsx(os,{options:p.options,selectedValues:d});{const u=p.options?.find(m=>m.value===d);return r.jsx("span",{"aria-readonly":!0,className:"text-primary",children:u?.label||d})}},[d,p.options,f]);return r.jsx(v.DialFormItem,{id:i,label:e,required:t,description:l,error:o,captionDescription:n,className:s,readonly:c,value:h(),defaultEmptyText:f,children:r.jsx(Me,{className:a,value:d,elementId:i,invalid:!!o,...p})})};function is(e){let t=null;return()=>(t==null&&(t=e()),t)}function nl(e,t){return e.filter(n=>n!==t)}function sl(e,t){const n=new Set,s=o=>n.add(o);e.forEach(s),t.forEach(s);const a=[];return n.forEach(o=>a.push(o)),a}class al{enter(t){const n=this.entered.length,s=a=>this.isNodeInDocument(a)&&(!a.contains||a.contains(t));return this.entered=sl(this.entered.filter(s),[t]),n===0&&this.entered.length>0}leave(t){const n=this.entered.length;return this.entered=nl(this.entered.filter(this.isNodeInDocument),t),n>0&&this.entered.length===0}reset(){this.entered=[]}constructor(t){this.entered=[],this.isNodeInDocument=t}}class ol{initializeExposedProperties(){Object.keys(this.config.exposeProperties).forEach(t=>{Object.defineProperty(this.item,t,{configurable:!0,enumerable:!0,get(){return console.warn(`Browser doesn't allow reading "${t}" until the drop event.`),null}})})}loadDataTransfer(t){if(t){const n={};Object.keys(this.config.exposeProperties).forEach(s=>{const a=this.config.exposeProperties[s];a!=null&&(n[s]={value:a(t,this.config.matchesTypes),configurable:!0,enumerable:!0})}),Object.defineProperties(this.item,n)}}canDrag(){return!0}beginDrag(){return this.item}isDragging(t,n){return n===t.getSourceId()}endDrag(){}constructor(t){this.config=t,this.item={},this.initializeExposedProperties()}}const qt="__NATIVE_FILE__",ls="__NATIVE_URL__",cs="__NATIVE_TEXT__",ds="__NATIVE_HTML__",ln=Object.freeze(Object.defineProperty({__proto__:null,FILE:qt,HTML:ds,TEXT:cs,URL:ls},Symbol.toStringTag,{value:"Module"}));function ur(e,t,n){const s=t.reduce((a,o)=>a||e.getData(o),"");return s??n}const Ir={[qt]:{exposeProperties:{files:e=>Array.prototype.slice.call(e.files),items:e=>e.items,dataTransfer:e=>e},matchesTypes:["Files"]},[ds]:{exposeProperties:{html:(e,t)=>ur(e,t,""),dataTransfer:e=>e},matchesTypes:["Html","text/html"]},[ls]:{exposeProperties:{urls:(e,t)=>ur(e,t,"").split(`
2
+ `),dataTransfer:e=>e},matchesTypes:["Url","text/uri-list"]},[cs]:{exposeProperties:{text:(e,t)=>ur(e,t,""),dataTransfer:e=>e},matchesTypes:["Text","text/plain"]}};function il(e,t){const n=Ir[e];if(!n)throw new Error(`native type ${e} has no configuration`);const s=new ol(n);return s.loadDataTransfer(t),s}function fr(e){if(!e)return null;const t=Array.prototype.slice.call(e.types||[]);return Object.keys(Ir).filter(n=>{const s=Ir[n];return s?.matchesTypes?s.matchesTypes.some(a=>t.indexOf(a)>-1):!1})[0]||null}const ll=is(()=>/firefox/i.test(navigator.userAgent)),us=is(()=>!!window.safari);class cn{interpolate(t){const{xs:n,ys:s,c1s:a,c2s:o,c3s:i}=this;let l=n.length-1;if(t===n[l])return s[l];let c=0,d=i.length-1,f;for(;c<=d;){f=Math.floor(.5*(c+d));const u=n[f];if(u<t)c=f+1;else if(u>t)d=f-1;else return s[f]}l=Math.max(0,d);const p=t-n[l],h=p*p;return s[l]+a[l]*p+o[l]*h+i[l]*p*h}constructor(t,n){const{length:s}=t,a=[];for(let u=0;u<s;u++)a.push(u);a.sort((u,m)=>t[u]<t[m]?-1:1);const o=[],i=[];let l,c;for(let u=0;u<s-1;u++)l=t[u+1]-t[u],c=n[u+1]-n[u],o.push(l),i.push(c/l);const d=[i[0]];for(let u=0;u<o.length-1;u++){const m=i[u],C=i[u+1];if(m*C<=0)d.push(0);else{l=o[u];const x=o[u+1],b=l+x;d.push(3*b/((b+x)/m+(b+l)/C))}}d.push(i[i.length-1]);const f=[],p=[];let h;for(let u=0;u<d.length-1;u++){h=i[u];const m=d[u],C=1/o[u],x=m+d[u+1]-h-h;f.push((h-m-x)*C),p.push(x*C*C)}this.xs=t,this.ys=n,this.c1s=d,this.c2s=f,this.c3s=p}}const cl=1;function fs(e){const t=e.nodeType===cl?e:e.parentElement;if(!t)return null;const{top:n,left:s}=t.getBoundingClientRect();return{x:s,y:n}}function At(e){return{x:e.clientX,y:e.clientY}}function dl(e){var t;return e.nodeName==="IMG"&&(ll()||!(!((t=document.documentElement)===null||t===void 0)&&t.contains(e)))}function ul(e,t,n,s){let a=e?t.width:n,o=e?t.height:s;return us()&&e&&(o/=window.devicePixelRatio,a/=window.devicePixelRatio),{dragPreviewWidth:a,dragPreviewHeight:o}}function fl(e,t,n,s,a){const o=dl(t),l=fs(o?e:t),c={x:n.x-l.x,y:n.y-l.y},{offsetWidth:d,offsetHeight:f}=e,{anchorX:p,anchorY:h}=s,{dragPreviewWidth:u,dragPreviewHeight:m}=ul(o,t,d,f),C=()=>{let j=new cn([0,.5,1],[c.y,c.y/f*m,c.y+m-f]).interpolate(h);return us()&&o&&(j+=(window.devicePixelRatio-1)*m),j},x=()=>new cn([0,.5,1],[c.x,c.x/d*u,c.x+u-d]).interpolate(p),{offsetX:b,offsetY:y}=a,N=b===0||b,D=y===0||y;return{x:N?b:x(),y:D?y:C()}}class pl{get window(){if(this.globalContext)return this.globalContext;if(typeof window<"u")return window}get document(){var t;return!((t=this.globalContext)===null||t===void 0)&&t.document?this.globalContext.document:this.window?this.window.document:void 0}get rootElement(){var t;return((t=this.optionsArgs)===null||t===void 0?void 0:t.rootElement)||this.window}constructor(t,n){this.ownerDocument=null,this.globalContext=t,this.optionsArgs=n}}function hl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function dn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{},s=Object.keys(n);typeof Object.getOwnPropertySymbols=="function"&&(s=s.concat(Object.getOwnPropertySymbols(n).filter(function(a){return Object.getOwnPropertyDescriptor(n,a).enumerable}))),s.forEach(function(a){hl(e,a,n[a])})}return e}class ml{profile(){var t,n;return{sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,sourceNodeOptions:this.sourceNodeOptions.size,sourceNodes:this.sourceNodes.size,dragStartSourceIds:((t=this.dragStartSourceIds)===null||t===void 0?void 0:t.length)||0,dropTargetIds:this.dropTargetIds.length,dragEnterTargetIds:this.dragEnterTargetIds.length,dragOverTargetIds:((n=this.dragOverTargetIds)===null||n===void 0?void 0:n.length)||0}}get window(){return this.options.window}get document(){return this.options.document}get rootElement(){return this.options.rootElement}setup(){const t=this.rootElement;if(t!==void 0){if(t.__isReactDndBackendSetUp)throw new Error("Cannot have two HTML5 backends at the same time.");t.__isReactDndBackendSetUp=!0,this.addEventListeners(t)}}teardown(){const t=this.rootElement;if(t!==void 0&&(t.__isReactDndBackendSetUp=!1,this.removeEventListeners(this.rootElement),this.clearCurrentDragSourceNode(),this.asyncEndDragFrameId)){var n;(n=this.window)===null||n===void 0||n.cancelAnimationFrame(this.asyncEndDragFrameId)}}connectDragPreview(t,n,s){return this.sourcePreviewNodeOptions.set(t,s),this.sourcePreviewNodes.set(t,n),()=>{this.sourcePreviewNodes.delete(t),this.sourcePreviewNodeOptions.delete(t)}}connectDragSource(t,n,s){this.sourceNodes.set(t,n),this.sourceNodeOptions.set(t,s);const a=i=>this.handleDragStart(i,t),o=i=>this.handleSelectStart(i);return n.setAttribute("draggable","true"),n.addEventListener("dragstart",a),n.addEventListener("selectstart",o),()=>{this.sourceNodes.delete(t),this.sourceNodeOptions.delete(t),n.removeEventListener("dragstart",a),n.removeEventListener("selectstart",o),n.setAttribute("draggable","false")}}connectDropTarget(t,n){const s=i=>this.handleDragEnter(i,t),a=i=>this.handleDragOver(i,t),o=i=>this.handleDrop(i,t);return n.addEventListener("dragenter",s),n.addEventListener("dragover",a),n.addEventListener("drop",o),()=>{n.removeEventListener("dragenter",s),n.removeEventListener("dragover",a),n.removeEventListener("drop",o)}}addEventListeners(t){t.addEventListener&&(t.addEventListener("dragstart",this.handleTopDragStart),t.addEventListener("dragstart",this.handleTopDragStartCapture,!0),t.addEventListener("dragend",this.handleTopDragEndCapture,!0),t.addEventListener("dragenter",this.handleTopDragEnter),t.addEventListener("dragenter",this.handleTopDragEnterCapture,!0),t.addEventListener("dragleave",this.handleTopDragLeaveCapture,!0),t.addEventListener("dragover",this.handleTopDragOver),t.addEventListener("dragover",this.handleTopDragOverCapture,!0),t.addEventListener("drop",this.handleTopDrop),t.addEventListener("drop",this.handleTopDropCapture,!0))}removeEventListeners(t){t.removeEventListener&&(t.removeEventListener("dragstart",this.handleTopDragStart),t.removeEventListener("dragstart",this.handleTopDragStartCapture,!0),t.removeEventListener("dragend",this.handleTopDragEndCapture,!0),t.removeEventListener("dragenter",this.handleTopDragEnter),t.removeEventListener("dragenter",this.handleTopDragEnterCapture,!0),t.removeEventListener("dragleave",this.handleTopDragLeaveCapture,!0),t.removeEventListener("dragover",this.handleTopDragOver),t.removeEventListener("dragover",this.handleTopDragOverCapture,!0),t.removeEventListener("drop",this.handleTopDrop),t.removeEventListener("drop",this.handleTopDropCapture,!0))}getCurrentSourceNodeOptions(){const t=this.monitor.getSourceId(),n=this.sourceNodeOptions.get(t);return dn({dropEffect:this.altKeyPressed?"copy":"move"},n||{})}getCurrentDropEffect(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}getCurrentSourcePreviewNodeOptions(){const t=this.monitor.getSourceId(),n=this.sourcePreviewNodeOptions.get(t);return dn({anchorX:.5,anchorY:.5,captureDraggingState:!1},n||{})}isDraggingNativeItem(){const t=this.monitor.getItemType();return Object.keys(ln).some(n=>ln[n]===t)}beginDragNativeItem(t,n){this.clearCurrentDragSourceNode(),this.currentNativeSource=il(t,n),this.currentNativeHandle=this.registry.addSource(t,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}setCurrentDragSourceNode(t){this.clearCurrentDragSourceNode(),this.currentDragSourceNode=t;const n=1e3;this.mouseMoveTimeoutTimer=setTimeout(()=>{var s;return(s=this.rootElement)===null||s===void 0?void 0:s.addEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)},n)}clearCurrentDragSourceNode(){if(this.currentDragSourceNode){if(this.currentDragSourceNode=null,this.rootElement){var t;(t=this.window)===null||t===void 0||t.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)}return this.mouseMoveTimeoutTimer=null,!0}return!1}handleDragStart(t,n){t.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(n))}handleDragEnter(t,n){this.dragEnterTargetIds.unshift(n)}handleDragOver(t,n){this.dragOverTargetIds===null&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(n)}handleDrop(t,n){this.dropTargetIds.unshift(n)}constructor(t,n,s){this.sourcePreviewNodes=new Map,this.sourcePreviewNodeOptions=new Map,this.sourceNodes=new Map,this.sourceNodeOptions=new Map,this.dragStartSourceIds=null,this.dropTargetIds=[],this.dragEnterTargetIds=[],this.currentNativeSource=null,this.currentNativeHandle=null,this.currentDragSourceNode=null,this.altKeyPressed=!1,this.mouseMoveTimeoutTimer=null,this.asyncEndDragFrameId=null,this.dragOverTargetIds=null,this.lastClientOffset=null,this.hoverRafId=null,this.getSourceClientOffset=a=>{const o=this.sourceNodes.get(a);return o&&fs(o)||null},this.endDragNativeItem=()=>{this.isDraggingNativeItem()&&(this.actions.endDrag(),this.currentNativeHandle&&this.registry.removeSource(this.currentNativeHandle),this.currentNativeHandle=null,this.currentNativeSource=null)},this.isNodeInDocument=a=>!!(a&&this.document&&this.document.body&&this.document.body.contains(a)),this.endDragIfSourceWasRemovedFromDOM=()=>{const a=this.currentDragSourceNode;a==null||this.isNodeInDocument(a)||(this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover())},this.scheduleHover=a=>{this.hoverRafId===null&&typeof requestAnimationFrame<"u"&&(this.hoverRafId=requestAnimationFrame(()=>{this.monitor.isDragging()&&this.actions.hover(a||[],{clientOffset:this.lastClientOffset}),this.hoverRafId=null}))},this.cancelHover=()=>{this.hoverRafId!==null&&typeof cancelAnimationFrame<"u"&&(cancelAnimationFrame(this.hoverRafId),this.hoverRafId=null)},this.handleTopDragStartCapture=()=>{this.clearCurrentDragSourceNode(),this.dragStartSourceIds=[]},this.handleTopDragStart=a=>{if(a.defaultPrevented)return;const{dragStartSourceIds:o}=this;this.dragStartSourceIds=null;const i=At(a);this.monitor.isDragging()&&(this.actions.endDrag(),this.cancelHover()),this.actions.beginDrag(o||[],{publishSource:!1,getSourceClientOffset:this.getSourceClientOffset,clientOffset:i});const{dataTransfer:l}=a,c=fr(l);if(this.monitor.isDragging()){if(l&&typeof l.setDragImage=="function"){const f=this.monitor.getSourceId(),p=this.sourceNodes.get(f),h=this.sourcePreviewNodes.get(f)||p;if(h){const{anchorX:u,anchorY:m,offsetX:C,offsetY:x}=this.getCurrentSourcePreviewNodeOptions(),N=fl(p,h,i,{anchorX:u,anchorY:m},{offsetX:C,offsetY:x});l.setDragImage(h,N.x,N.y)}}try{l?.setData("application/json",{})}catch{}this.setCurrentDragSourceNode(a.target);const{captureDraggingState:d}=this.getCurrentSourcePreviewNodeOptions();d?this.actions.publishDragSource():setTimeout(()=>this.actions.publishDragSource(),0)}else if(c)this.beginDragNativeItem(c);else{if(l&&!l.types&&(a.target&&!a.target.hasAttribute||!a.target.hasAttribute("draggable")))return;a.preventDefault()}},this.handleTopDragEndCapture=()=>{this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleTopDragEnterCapture=a=>{if(this.dragEnterTargetIds=[],this.isDraggingNativeItem()){var o;(o=this.currentNativeSource)===null||o===void 0||o.loadDataTransfer(a.dataTransfer)}if(!this.enterLeaveCounter.enter(a.target)||this.monitor.isDragging())return;const{dataTransfer:l}=a,c=fr(l);c&&this.beginDragNativeItem(c,l)},this.handleTopDragEnter=a=>{const{dragEnterTargetIds:o}=this;if(this.dragEnterTargetIds=[],!this.monitor.isDragging())return;this.altKeyPressed=a.altKey,o.length>0&&this.actions.hover(o,{clientOffset:At(a)}),o.some(l=>this.monitor.canDropOnTarget(l))&&(a.preventDefault(),a.dataTransfer&&(a.dataTransfer.dropEffect=this.getCurrentDropEffect()))},this.handleTopDragOverCapture=a=>{if(this.dragOverTargetIds=[],this.isDraggingNativeItem()){var o;(o=this.currentNativeSource)===null||o===void 0||o.loadDataTransfer(a.dataTransfer)}},this.handleTopDragOver=a=>{const{dragOverTargetIds:o}=this;if(this.dragOverTargetIds=[],!this.monitor.isDragging()){a.preventDefault(),a.dataTransfer&&(a.dataTransfer.dropEffect="none");return}this.altKeyPressed=a.altKey,this.lastClientOffset=At(a),this.scheduleHover(o),(o||[]).some(l=>this.monitor.canDropOnTarget(l))?(a.preventDefault(),a.dataTransfer&&(a.dataTransfer.dropEffect=this.getCurrentDropEffect())):this.isDraggingNativeItem()?a.preventDefault():(a.preventDefault(),a.dataTransfer&&(a.dataTransfer.dropEffect="none"))},this.handleTopDragLeaveCapture=a=>{this.isDraggingNativeItem()&&a.preventDefault(),this.enterLeaveCounter.leave(a.target)&&(this.isDraggingNativeItem()&&setTimeout(()=>this.endDragNativeItem(),0),this.cancelHover())},this.handleTopDropCapture=a=>{if(this.dropTargetIds=[],this.isDraggingNativeItem()){var o;a.preventDefault(),(o=this.currentNativeSource)===null||o===void 0||o.loadDataTransfer(a.dataTransfer)}else fr(a.dataTransfer)&&a.preventDefault();this.enterLeaveCounter.reset()},this.handleTopDrop=a=>{const{dropTargetIds:o}=this;this.dropTargetIds=[],this.actions.hover(o,{clientOffset:At(a)}),this.actions.drop({dropEffect:this.getCurrentDropEffect()}),this.isDraggingNativeItem()?this.endDragNativeItem():this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleSelectStart=a=>{const o=a.target;typeof o.dragDrop=="function"&&(o.tagName==="INPUT"||o.tagName==="SELECT"||o.tagName==="TEXTAREA"||o.isContentEditable||(a.preventDefault(),o.dragDrop()))},this.options=new pl(n,s),this.actions=t.getActions(),this.monitor=t.getMonitor(),this.registry=t.getRegistry(),this.enterLeaveCounter=new al(this.isNodeInDocument)}}const gl=function(t,n,s){return new ml(t,n,s)},xl=({onChange:e,emptyTextFirstLine:t,emptyTextSecondLine:n,emptyButtonLabel:s,acceptTypes:a,maxFilesCount:o,multiple:i,fileFormatError:l,fileCountError:c,fileSizeError:d,getIsFileFormatError:f,getIsFileSizeError:p})=>{const h=g.useRef(null),u=g.useRef(null),[m,C]=g.useState([]),[x,b]=g.useState(!1),[y,N]=g.useState(!1),D=g.useCallback(V=>{const F=V.target.files;if(F&&F.length>0){const G=Array.from(F),U=f?.(G),Z=p?.(G);U?b(!0):Z?N(!0):e(G)}},[f,p,e]),I=g.useCallback(V=>o&&V?.length>o,[o]),j=g.useMemo(()=>x||y||I(m),[x,y,I,m]),L=()=>{C([]),b(!1),N(!1)},w=g.useMemo(()=>x?r.jsx(v.DialErrorText,{text:l}):y?r.jsx(v.DialErrorText,{text:d}):I(m)?r.jsx(v.DialErrorText,{text:c}):null,[c,l,d,m,I,x,y]);g.useEffect(()=>{L()},[a]);const[{isOver:A,canDrop:E},T]=kr(()=>({accept:[qt],drop(V){const F=V.files,G=f?.(F)??!1,U=p?.(F)??!1,Z=I?.(F)??!1;if(b(G),N(U),G||U||Z){C(F);return}e(F),L()},collect:V=>({isOver:V.isOver(),canDrop:V.canDrop()})}),[e,f,p,I]),R=V=>{(V.key==="Enter"||V.key==="Space")&&(V.preventDefault(),u.current?.click())},B=V=>{V?.preventDefault();const F=Array.from(V.dataTransfer?.items??[]);b(!!f?.(F)),N(!!p?.(F)),C(F)},K=V=>{V.target===V.currentTarget&&L()},Q=de("border border-dashed rounded w-full cursor-pointer relative h-full hover:border-hover",!E&&!j&&"border-primary",E&&(A?"border-accent-primary":"border-hover"),j&&"border-error");return T(h),r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:Q,ref:h,onDragOver:B,onDragLeave:K,children:[r.jsxs("label",{htmlFor:"file",tabIndex:0,onKeyDown:R,className:"flex flex-col items-center cursor-pointer size-full text-secondary dial-tiny-text justify-center",children:[t&&r.jsx("p",{className:"mb-1",children:t}),n&&r.jsx("p",{className:"mb-0.5",children:n}),s&&r.jsx(v.DialPrimaryButton,{appearance:_.ButtonAppearance.Ghost,label:s,onClick:()=>u.current?.click()})]}),r.jsx("input",{multiple:i,id:"file",type:"file",ref:u,hidden:!0,accept:a,onChange:D})]}),r.jsx(r.Fragment,{children:w})]})},bl=({iconBefore:e,className:t,...n})=>{const s=n.invalid,a=()=>r.jsx("div",{className:"mr-2",children:s?r.jsx($.IconExclamationCircle,{...H.BASE_ICON_PROPS,className:"text-error"}):e});return r.jsx(v.DialInput,{...n,iconBefore:a(),containerClassName:de("h-[40px] p-0",s&&"h-[60px]"),className:de("rounded-r-none border-r-0",s&&"text-error",t)})},Cl=({children:e,existingFiles:t,onDrop:n,getIsFileFormatError:s,getIsFileSizeError:a,maxFilesCount:o,fileFormatError:i,fileSizeError:l,fileCountError:c})=>{const d=g.useRef(null),[f,p]=g.useState(!1),[h,u]=g.useState(!1),[m,C]=g.useState(0),x=g.useCallback(()=>{p(!1),u(!1),C(0)},[]),b=g.useCallback(A=>!!(o&&t.length+A.length>o),[o,t.length]),y=f||h,[{isOver:N,canDrop:D},I]=kr(()=>({accept:[qt],drop(A){const E=A.files,T=[...t,...E],R=s?.(E)??!1,B=a?.(E)??!1,K=b?.(E)??!1;if(p(R),u(B),R||B||K){C(E.length);return}n(T),x()},collect:A=>({isOver:A.isOver(),canDrop:A.canDrop()})}),[t,n,s,a,b,x]),j=A=>{A.preventDefault();const E=Array.from(A.dataTransfer?.items??[]);p(!!s?.(E)),u(!1),C(E.length)},L=A=>{A.target===A.currentTarget&&x()};I(d);const w=b(Array.from({length:m}));return r.jsxs("div",{className:"h-full flex flex-col",children:[r.jsx("div",{ref:d,onDragOver:j,onDragLeave:L,className:de("flex-1 min-h-0 border border-solid rounded p-2 overflow-y-auto",!y&&!w&&(D&&N?"border-accent-primary":"border-primary"),(y||w)&&"border-error"),children:e}),f&&r.jsx(v.DialErrorText,{text:i}),h&&r.jsx(v.DialErrorText,{text:l}),!f&&!h&&w&&r.jsx(v.DialErrorText,{text:c})]})},ps=e=>{const{files:t,iconBeforeInput:n,dynamicIcon:s,onChange:a,isInvalid:o,errorText:i,removeButtonAriaLabel:l,getIsMultiFilesSizeError:c,multiFilesSizeError:d,getIsFileFormatError:f,getIsFileSizeError:p,maxFilesCount:h}=e,u=g.useCallback((x,b)=>{x.stopPropagation(),a(t?.filter(y=>y.name!==b)||[])},[a,t]),m=g.useCallback(x=>r.jsx(Wt,{"aria-label":l,onClick:b=>u(b,x)}),[l,u]),C=g.useMemo(()=>r.jsx("div",{className:"flex flex-col gap-y-1",children:t?.map((x,b)=>r.jsx(bl,{id:x.name,value:x.name,iconAfter:m(x.name),iconBefore:n||s?.(x.name),invalid:o?.(x),error:o?.(x)?i:""},x.name+b))}),[t,n,s,o,i,m]);return r.jsx(Yo,{backend:gl,children:!t||t.length===0?r.jsx(xl,{...e,onChange:a}):r.jsxs(r.Fragment,{children:[r.jsx(Cl,{existingFiles:t,onDrop:a,getIsFileFormatError:f,getIsFileSizeError:p,maxFilesCount:h,fileFormatError:e.fileFormatError,fileSizeError:e.fileSizeError,fileCountError:e.fileCountError,children:C}),c?.(t)&&r.jsx(v.DialErrorText,{text:d})]})})},yl=({onChange:e,fieldTitle:t,elementId:n,files:s,maxFilesCount:a,maxFileSize:o,maxMultiFilesSize:i,fileFormatError:l,fileCountError:c,fileSizeError:d,multiFilesSizeError:f,multiple:p=!0,acceptTypes:h,deleteAllButtonLabel:u,addButtonLabel:m,additionalActionButtons:C,...x})=>{const b=g.useRef(null),y=()=>b.current?.click(),N=()=>{e([])},D=g.useCallback(w=>w?.some(A=>!(h==="/"||h?.toLowerCase()?.includes(A?.type?.toLowerCase()))),[h]),I=g.useCallback(w=>{if(!o)return!1;const A=o*(1024*1024);return w?.some(E=>{const T=E.size;return!!T&&T>A})},[o]),j=g.useCallback(w=>{if(!i||!p)return!1;const A=i*1024*1024;return w.reduce((T,R)=>T+R.size,0)>A},[i,p]),L=g.useCallback(w=>{const A=w.target.files;if(A&&A.length>0){const E=Array.from(A),T=D(E),R=I(E);!T&&!R&&e([...s||[],...E])}},[D,I,e,s]);return r.jsxs("div",{className:"h-full flex flex-col",children:[r.jsxs("div",{className:"flex justify-between items-center pb-1 min-h-[42px]",children:[r.jsx(Ue.DialLabel,{label:`${t}: ${p?s?.length||0:""}`,htmlFor:n}),p&&!!s?.length&&r.jsxs("div",{className:"flex flex-row items-center gap-x-2",children:[r.jsx(v.DialNeutralButton,{label:u,iconBefore:r.jsx($.IconTrashX,{...H.BASE_ICON_PROPS}),onClick:N}),(a?a>s?.length:!0)&&r.jsx(v.DialPrimaryButton,{appearance:_.ButtonAppearance.Ghost,iconBefore:r.jsx($.IconPlus,{...H.BASE_ICON_PROPS}),label:m,onClick:y}),C]})]}),s&&s.length>0&&r.jsx("input",{id:"file",type:"file",multiple:p,ref:b,hidden:!0,accept:h,onChange:L}),r.jsx(ps,{files:s,onChange:e,acceptTypes:h,maxFilesCount:a,multiple:p,fileFormatError:l,fileCountError:c,fileSizeError:d,multiFilesSizeError:f,getIsFileFormatError:D,getIsFileSizeError:I,getIsMultiFilesSizeError:j,...x})]})},vl=({icon:e,ariaLabel:t,size:n=_.ElementSize.Standard,disabled:s=!1,className:a,buttonClassName:o,iconClassName:i,caretIcon:l=r.jsx($.IconChevronDown,{size:H.DIAL_ICON_SIZE.SM}),showCaret:c=!0,placement:d="bottom-start",matchReferenceWidth:f=!1,open:p,onOpenChange:h,defaultOpen:u=!1,...m})=>{const C=n===_.ElementSize.Small,[x,b]=g.useState(u),y=p??x,N=C?"w-8 px-0":"w-10 px-0",D={[_.ElementSize.Small]:"size-5",[_.ElementSize.Standard]:"size-6",[_.ElementSize.Large]:"size-7"},I=j=>{b(j),h?.(j)};return r.jsx(O.DialDropdown,{...m,disabled:s,placement:d,matchReferenceWidth:f,className:a,open:y,onOpenChange:I,defaultOpen:u,children:r.jsxs("button",{type:"button","aria-label":t,disabled:s,className:S.mergeClasses("group flex items-center justify-center rounded border border-transparent bg-layer-4 text-primary","enabled:hover:bg-accent-primary-alpha enabled:active:bg-controls-accent-primary-alpha-active","focus-visible:border-focus focus-visible:outline-none disabled:cursor-not-allowed disabled:text-controls-secondary-disable disabled:opacity-75",C?"h-8 px-2":"h-10 px-2",c?void 0:N,o),children:[r.jsx(O.DialIcon,{icon:e,className:S.mergeClasses("flex items-center justify-center text-inherit",D[n],c&&"-mr-2",i,O.DIAL_KIT_CLASS.dropdownIcon)}),c&&r.jsxs("div",{className:S.mergeClasses("relative z-10 inline-grid size-5 shrink-0 place-items-center",O.DIAL_KIT_CLASS.dropdownIconCaret),children:[r.jsx("div",{className:"absolute inset-0 rounded-full bg-layer-2"}),r.jsx(O.DialIcon,{icon:l,className:S.mergeClasses("relative flex items-center justify-center text-secondary transition-transform group-hover:text-primary group-disabled:text-controls-secondary-disable",y&&"rotate-180")})]})]})})},Sl="application/octet-stream";function Il(e,t){if(!e||e.length===0)return[];const n=e.find(c=>c.parentPath===""&&c.nodeType==="FOLDER");if(!n)return[];const s=n.path||n.url||"",a=pr(s,!0),o=e.filter(c=>c!==n).map(c=>{const d=c.path||c.url||"",f=Nl(c.nodeType),p=f===v.DialFileNodeType.FOLDER,h=pr(d,p);let u;return c.parentPath===null||c.parentPath===void 0?u=a:c.parentPath===""?u="":u=pr(c.parentPath,!0),{...c,originalPath:d,path:h,parentPath:u,nodeType:f}}),i=new Map;o.forEach(c=>{const d={...c,id:c.originalPath,name:c.name,path:c.path,parentPath:c.parentPath,nodeType:c.nodeType,resourceType:Dl(c.resourceType),folderId:t,updatedAt:c.updatedAt?new Date(c.updatedAt).toISOString():new Date().toISOString(),items:c.nodeType===v.DialFileNodeType.FOLDER?[]:void 0};c.nodeType===v.DialFileNodeType.ITEM&&(d.extension=jl(c.name),d.contentType=c.contentType||Sl,d.contentLength=c.contentLength||0),i.set(c.path,d)});const l=[];return i.forEach(c=>{if(c.parentPath===a)l.push(c);else{const d=c.path.lastIndexOf(c.name||""),f=c.path.slice(0,d),p=i.get(f);p&&p.nodeType===v.DialFileNodeType.FOLDER?(p.items=p.items||[],p.items.push(c)):l.push(c)}}),l}function pr(e,t){try{let n=decodeURIComponent(e);return t?n.endsWith("/")||(n+="/"):n.endsWith("/")&&(n=n.slice(0,-1)),n}catch{return t&&!e.endsWith("/")?e+"/":!t&&e.endsWith("/")?e.slice(0,-1):e}}function Nl(e){return e.toUpperCase()==="FOLDER"?v.DialFileNodeType.FOLDER:v.DialFileNodeType.ITEM}function Dl(e){if(!e)return;const t=e.toUpperCase();return Object.values(v.DialFileResourceType).find(s=>s.toUpperCase()===t)}function jl(e){const t=e.split(".");return t.length>1?t[t.length-1]:""}function Tl(e,t="Prompts",n="prompts/public/",s="root"){const a=Il(e,s);return[{id:s,name:t,path:n,parentPath:"",nodeType:v.DialFileNodeType.FOLDER,folderId:s,items:a}]}const hs=({locale:e,timeZone:t,date:n=new Date}={})=>{const s=t??Intl.DateTimeFormat().resolvedOptions().timeZone;try{const a=new Intl.DateTimeFormat(e,{timeZone:s,timeZoneName:"longOffset"}).formatToParts(n).find(o=>o.type==="timeZoneName")?.value;return a?`(${a}) ${s}`:s}catch{return s}};var ke=(e=>(e.Sections="sections",e.Flat="flat",e.FlatSections="flat-sections",e))(ke||{}),et=(e=>(e.Select="select",e.Radio="radio",e))(et||{}),pt=(e=>(e.Row="row",e.Column="column",e))(pt||{}),P=(e=>(e.String="string",e.Number="number",e.Integer="integer",e.Boolean="boolean",e.Object="object",e.Array="array",e.Null="null",e))(P||{});const ms={noItemSchema:"No item schema defined.",noItemsYet:"No items yet. Add one below.",addItem:"Add Item",selectTypeToAdd:"Select type to add…",noConfigurableProperties:"No configurable properties.",noFieldsYet:"No fields yet. Add one below.",keyColumnHeader:"Key",valueColumnHeader:"Value",addField:"Add Field",keyInputPlaceholder:"Enter key",stringInputPlaceholder:"Enter a value",integerInputPlaceholder:"Enter a whole number",numberInputPlaceholder:"Enter a number",enumSelectPlaceholder:"Select an option",selectTypePlaceholder:"Select type",removeItemAriaLabel:"Remove item",removeFieldAriaLabel:"Remove field",typeColumnHeader:"Type",entryTypeString:"String",entryTypeNumber:"Number",entryTypeBoolean:"Boolean",entryTypeNull:"Null",entryTypeObject:"Object",entryTypeArray:"Array",entryTypeChangeWarning:"Changing type will reset the current value.",booleanTrueOption:"True",booleanFalseOption:"False",invalidJsonError:"Invalid JSON"},gs=g.createContext(null);function Pe(){const e=g.useContext(gs);if(!e)throw new Error("useSchemaContext must be used inside DialSchemaRenderer");return e}function un(e,t){const n={...e,...t};return(e.properties||t.properties)&&(n.properties={...e.properties,...t.properties}),(e.required||t.required)&&(n.required=Array.from(new Set([...e.required??[],...t.required??[]]))),n}function Y(e,t,n=0){if(n>10)return e;let s=e;if(s.$ref){const a=s.$ref.replace(/^#\//,"").split("/");let o=t;for(const f of a)o=o?.[f];if(!o||typeof o!="object")return e;const{$ref:i,...l}=s,c=o;s={...c.$ref?Y(c,t,n+1):c,...l}}if(s.allOf&&s.allOf.length>0){const{allOf:a,...o}=s;let i={};for(const l of a)i=un(i,Y(l,t,n+1));s=un(i,o)}return s}function Yt(e){return e.map((t,n)=>({entry:t,index:n})).sort((t,n)=>{const s=t.entry[1]["dial:meta"]?.["dial:propertyOrder"]??1/0,a=n.entry[1]["dial:meta"]?.["dial:propertyOrder"]??1/0;return s!==a?s-a:t.index-n.index}).map(({entry:t})=>t)}function st(e){return e==null||e===""}function Fe(e){return e.type===P.Object||e.properties!=null&&e.oneOf==null&&e.anyOf==null&&e.type==null}function tt(e){return e.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/\b\w/g,t=>t.toUpperCase())}const Et=e=>`"${e}" is required`;function Xt(e,t){return e.type===P.Null?"null":e.$ref?Y(e,t).title??e.$ref.split("/").pop()??"Option":e.title?e.title:e.type?Array.isArray(e.type)?e.type.join(" | "):e.type:e.discriminator?Object.keys(e.discriminator.mapping).join(" | "):e.const!=null?String(e.const):e.oneOf?"One of options":"Option"}function Ce(e,t,n=0){if(n>15)return;const s=Y(e,t);if("default"in s)return s.default;if(s.discriminator&&s.oneOf){const a=Object.keys(s.discriminator.mapping)[0];if(a){const o=Y({$ref:s.discriminator.mapping[a]},t);return{...Ce(o,t,n+1)??{},[s.discriminator.propertyName]:a}}}if(Fe(s)){if(s.properties){const a={};let o=!1;for(const[i,l]of Object.entries(s.properties)){const c=Ce(l,t,n+1);c!==void 0&&(a[i]=c,o=!0)}return o?a:void 0}if(s.additionalProperties!=null&&s.additionalProperties!==!1)return{}}}function De(e,t,n,s="",a=0){if(a>15)return[];const o=[],i=Y(t,n);if(i.anyOf){const d=i.anyOf.filter(f=>f.type!==P.Null);return e!=null&&d.length===1?De(e,d[0],n,s,a+1):o}if(i.oneOf&&i.discriminator){const d=i.discriminator.propertyName,f=e?.[d];if(f&&i.discriminator.mapping[f]){const p={$ref:i.discriminator.mapping[f]},h=Y(p,n);return De(e,h,n,s,a+1)}return o}if(i.type===P.Array||!i.type&&Array.isArray(e)){if(Array.isArray(e)&&i.items)for(let d=0;d<e.length;d++){const f=De(e[d],i.items,n,`${s}[${d}]`,a+1);o.push(...f)}return o}if(!Fe(i))return o;const l=i.required??[],c=e;for(const d of l){const f=i.properties?.[d];if(f&&Y(f,n).isHidden)continue;const p=s?`${s}.${d}`:d,h=c?.[d];if(st(h)){const u=f?.title??tt(d);o.push({path:p,message:Et(u)})}}if(c&&i.properties)for(const[d,f]of Object.entries(i.properties)){if(Y(f,n).isHidden)continue;const p=s?`${s}.${d}`:d,h=c[d];if(h!=null){const u=De(h,f,n,p,a+1);o.push(...u)}}if(c&&i.additionalProperties!=null&&i.additionalProperties!==!1&&typeof i.additionalProperties=="object"){const d=i.additionalProperties;for(const[f,p]of Object.entries(c)){const h=s?`${s}.${f}`:f,u=De(p,d,n,h,a+1);o.push(...u)}}return o}function ht(e,t,n){const s=Y(t,n);if(Array.isArray(e))return`${e.length} item${e.length!==1?"s":""}`;if(Fe(s)&&s.properties){const a=Object.entries(s.properties).filter(([,c])=>!Y(c,n).isHidden),o=a.length,i=e;return`${a.filter(([c])=>{const d=i?.[c];return d!=null&&d!==""}).length}/${o} fields`}return""}function xs(e,t,n){if(e==null){const s=t.findIndex(a=>a.type===P.Null);return s>=0?s:0}if(Array.isArray(e)){const s=t.findIndex(a=>Y(a,n).type===P.Array);return s>=0?s:0}if(typeof e=="boolean"){const s=t.findIndex(a=>Y(a,n).type===P.Boolean);return s>=0?s:0}if(typeof e=="number"){const s=t.findIndex(a=>{const o=Y(a,n);return o.type===P.Number||o.type===P.Integer});return s>=0?s:0}if(typeof e=="string"){const s=t.findIndex(a=>Y(a,n).type===P.String);return s>=0?s:0}if(typeof e=="object"){const s=e;for(let a=0;a<t.length;a++){const o=Y(t[a],n);if(o.discriminator&&o.discriminator.propertyName in s)return a}for(let a=0;a<t.length;a++){const o=Y(t[a],n);if(Fe(o)||o.oneOf)return a}return 0}return 0}function bs(e,t,n){if(t&&typeof e=="object"&&e!==null){const s=e[t];if(s)return`Item ${n+1}: ${s}`}if(typeof e=="object"&&e!==null){const s=e,a=s.name??s.title??s.id;if(a)return`Item ${n+1}: ${a}`}return`Item ${n+1}`}function Jt(e){switch(Array.isArray(e.type)?e.type[0]:e.type){case P.String:return"";case P.Boolean:return!1;case P.Array:return[];case P.Integer:case P.Number:return;default:return{}}}const Cs=[P.String,P.Number,P.Boolean,P.Null,P.Object,P.Array];function ys(e){return Array.isArray(e)?P.Array:typeof e=="object"&&e!==null?P.Object:typeof e=="boolean"?P.Boolean:typeof e=="number"?P.Number:e===null?P.Null:P.String}const wl={[P.String]:"",[P.Number]:0,[P.Boolean]:!1,[P.Null]:null,[P.Object]:{},[P.Array]:[]};function vs(e){return wl[e]}const It=({title:e,description:t,summary:n,errorCount:s=0,level:a=0,children:o,onRemove:i,defaultExpanded:l=!0,removeItemAriaLabel:c="Remove item"})=>{const[d,f]=g.useState(l),p=a===0,h="rounded border border-secondary",u=S.mergeClasses("flex items-center gap-2 cursor-pointer select-none transition-colors",p?"px-4 py-3 bg-layer-3 hover:bg-layer-4":"px-3 py-2 bg-layer-4 hover:bg-layer-3",d?"rounded-t":"rounded"),m=S.mergeClasses("border-t border-secondary",p?"p-4":"p-3");return r.jsxs("div",{className:h,children:[r.jsxs("div",{className:u,onClick:()=>f(C=>!C),role:"button","aria-expanded":d,children:[r.jsx("span",{className:"shrink-0 text-secondary",children:d?r.jsx($.IconChevronDown,{size:16,stroke:2}):r.jsx($.IconChevronRight,{size:16,stroke:2})}),r.jsx("span",{className:S.mergeClasses("flex-1 truncate",p?"dial-small-semi-text text-primary":"dial-small-text text-primary"),children:e}),t&&r.jsx(Ue.DialInfoButton,{caption:t}),n&&r.jsx("span",{className:"dial-tiny-text text-secondary whitespace-nowrap ml-2",children:n}),s>0?r.jsxs("span",{className:"flex items-center gap-1 dial-tiny-text text-error whitespace-nowrap",children:[r.jsx(O.DialIcon,{icon:r.jsx($.IconAlertTriangle,{size:13,stroke:2})}),s," error",s>1?"s":""]}):r.jsx(O.DialIcon,{icon:r.jsx($.IconCheck,{size:13,stroke:2}),className:"text-success shrink-0"}),i&&r.jsx(Wt,{size:_.ElementSize.Small,onClick:C=>{C.stopPropagation(),i()},"aria-label":c,className:"ml-1 shrink-0 p-0.5"})]}),d&&r.jsx("div",{className:m,children:o})]})},Ss=({schema:e,value:t,onChange:n,path:s,level:a=0,required:o,label:i})=>{const{rootSchema:l,defaultExpanded:c=!0,touchedPaths:d=new Set,skipUntouched:f=!1}=Pe(),p=Y(e,l),h=Fe(p),u=p.type===P.Array;if(h||u){const x=ht(t,p,l),b=De(t,p,l,s.join(".")),y=s.join("."),N=y+".",D=!f||d.has(y)||[...d].some(I=>I.startsWith(N));return r.jsx(It,{title:i??p.title??s[s.length-1]??"Section",description:p.description,level:a,summary:x,errorCount:D?b.length:0,defaultExpanded:c,children:r.jsx(Ke,{schema:p,value:t,onChange:n,path:s,level:a+1,required:o})})}const C=(!f||d.has(s.join(".")))&&o&&st(t)?Et(i??"Field"):void 0;return r.jsx(v.DialFormItem,{label:i,required:o,description:p.description,error:C,children:r.jsx(Ke,{schema:p,value:t,onChange:n,path:s,level:a,required:o,suppressInlineError:!0})})},Pt=({schema:e,value:t,onChange:n,path:s,level:a})=>{const{rootSchema:o,texts:i}=Pe(),l=Y(e,o),c=Yt(Object.entries(l.properties??{}).filter(([,p])=>!Y(p,o).isHidden)),d=l.required??[],f=t??{};return c.length===0?r.jsx("p",{className:"dial-tiny-text text-secondary italic",children:i.noConfigurableProperties}):r.jsx("div",{className:"flex flex-col gap-4",children:c.map(([p,h])=>{const m=Y(h,o).title??h.title??tt(p),C=d.includes(p);return r.jsx(Ss,{schema:h,value:f[p],onChange:x=>n({...f,[p]:x}),path:[...s,p],level:a,required:C,label:m},p)})})},El=({schema:e,value:t,onChange:n,path:s,level:a})=>{const{rootSchema:o,texts:i,readonly:l=!1,defaultExpanded:c=!0}=Pe(),d=Array.isArray(t)?t:[],f=e.items,[p,h]=g.useState(void 0);if(!f)return r.jsx("p",{className:"dial-tiny-text text-secondary italic",children:i.noItemSchema});const u=g.useMemo(()=>Y(f,o),[f,o]),m=g.useMemo(()=>u.discriminator,[u]),C=g.useMemo(()=>m?.propertyName,[m]),x=g.useMemo(()=>m?Object.keys(m.mapping).map(D=>({value:D,label:D})):[],[m]),b=()=>{const D=p??x[0]?.value;let I;if(m&&D){const j=Y({$ref:m.mapping[D]},o);I={...Ce(j,o)??{},[m.propertyName]:D}}else I=Ce(u,o)??Jt(u);n([...d,I])},y=D=>{n(d.filter((I,j)=>j!==D))},N=(D,I)=>{n(d.map((j,L)=>L===D?I:j))};return r.jsxs("div",{className:"flex flex-col gap-3",children:[d.length===0&&r.jsx("p",{className:"dial-tiny-text text-secondary italic",children:i.noItemsYet}),d.map((D,I)=>{const j=bs(D,C,I),L=ht(D,u,o),w=De(D,u,o,`${s.join(".")}[${I}]`);return r.jsx(It,{title:j,level:a,summary:L,errorCount:w.length,onRemove:l?void 0:()=>y(I),defaultExpanded:c,removeItemAriaLabel:i.removeItemAriaLabel,children:r.jsx(Ke,{schema:f,value:D,onChange:A=>N(I,A),path:[...s,String(I)],level:a+1})},I)}),!l&&r.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[x.length>0&&r.jsx("div",{className:"flex-1 max-w-[280px]",children:r.jsx(Me,{options:x,value:p??x[0]?.value,placeholder:i.selectTypeToAdd,onChange:D=>{const I=typeof D=="string"?D:D[0];h(I)}})}),r.jsx(v.DialGhostButton,{label:i.addItem,iconBefore:r.jsx($.IconPlus,{size:16,stroke:2}),onClick:b})]})]})},Ol=({schema:e,value:t,onChange:n,path:s,level:a})=>{const{rootSchema:o,texts:i,readonly:l=!1}=Pe(),c=g.useId(),d=e.discriminator;if(d){const x=d.propertyName,b=d.mapping,y=Object.keys(b).map(j=>({value:j,label:j})),N=typeof t=="object"&&t!==null?t[x]:void 0,D=N?Y({$ref:b[N]},o):void 0,I=j=>{const L=Y({$ref:b[j]},o),w=Ce(L,o)??{};n({...w,[x]:j})};if(e.discriminatorDisplay===et.Radio){const j=e.discriminatorOrientation===pt.Row,L=N?(()=>{const w=Y({$ref:b[N]},o),{[x]:A,...E}=w.properties??{};return{...w,properties:E}})():void 0;return j?r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx("div",{role:"radiogroup",className:"flex flex-row flex-wrap gap-4",children:Object.keys(b).map(w=>{const A=Y({$ref:b[w]},o);return r.jsx(O.DialRadioButton,{name:c,value:w,inputId:`${c}-${w}`,label:A.title??w,checked:N===w,disabled:l,onChange:()=>I(w)},w)})}),L&&r.jsx(Pt,{schema:L,value:t,onChange:n,path:s,level:a})]}):r.jsx("div",{role:"radiogroup",className:"flex flex-col gap-2",children:Object.keys(b).map(w=>{const A=Y({$ref:b[w]},o),E=N===w,{[x]:T,...R}=A.properties??{},B={...A,properties:R};return r.jsxs("div",{className:"flex flex-col",children:[r.jsx(O.DialRadioButton,{name:c,value:w,inputId:`${c}-${w}`,label:A.title??w,checked:E,disabled:l,onChange:()=>I(w)}),E&&r.jsx("div",{className:"ml-6 mt-2",children:r.jsx(Pt,{schema:B,value:t,onChange:n,path:s,level:a})})]},w)})})}return r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx("div",{className:"flex-1 max-w-[280px]",children:r.jsx(Me,{options:y,value:N,placeholder:i.selectTypePlaceholder,disabled:l,onChange:j=>{const L=typeof j=="string"?j:j[0];L&&I(L)}})}),D&&r.jsx("div",{className:"pl-3",children:r.jsx(Pt,{schema:D,value:t,onChange:n,path:s,level:a})})]})}const f=e.oneOf??[],h=(()=>{if(t==null)return 0;if(typeof t=="object"&&!Array.isArray(t)){for(let x=0;x<f.length;x++)if(Y(f[x],o).required?.every(y=>y in t))return x}return 0})(),u=x=>{const b=Y(f[x],o),y=Ce(b,o);n(y??null)},m=f[h];if(e.discriminatorDisplay===et.Radio)return r.jsx("div",{role:"radiogroup",className:"flex flex-col gap-2",children:f.map((x,b)=>{const y=Y(x,o),N=Xt(x,o)??`Option ${b+1}`,D=h===b;return r.jsxs("div",{className:"flex flex-col",children:[r.jsx(O.DialRadioButton,{name:c,value:String(b),inputId:`${c}-${b}`,label:N,checked:D,disabled:l,onChange:()=>u(b)}),D&&y&&r.jsx("div",{className:"ml-6 mt-2",children:r.jsx(Ke,{schema:y,value:t,onChange:n,path:s,level:a})})]},b)})});const C=f.map((x,b)=>{const y=Y(x,o);return{value:String(b),label:y.title??`Option ${b+1}`}});return r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx("div",{className:"flex-1 max-w-[280px]",children:r.jsx(Me,{options:C,value:String(h),disabled:l,onChange:x=>{const b=typeof x=="string"?x:x[0];u(Number(b))}})}),m&&r.jsx("div",{className:"pl-3 border-l-2 border-secondary",children:r.jsx(Ke,{schema:m,value:t,onChange:n,path:s,level:a})})]})},Al=({schema:e,value:t,onChange:n,path:s,level:a})=>{const{rootSchema:o,readonly:i=!1}=Pe(),l=e.anyOf??[],c=l.map((m,C)=>({value:String(C),label:Xt(m,o)})),d=xs(t,l,o),f=l[d],h=Y(f,o).type===P.Null,u=m=>{const C=Y(l[m],o);if(C.type===P.Null){n(null);return}const x=Ce(C,o);if(x!==void 0){n(x);return}switch(C.type){case P.Array:n([]);break;case P.String:n("");break;case P.Boolean:n(!1);break;case P.Integer:case P.Number:n(0);break;default:n({});break}};return r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx("div",{className:"flex-1 max-w-[280px]",children:r.jsx(Me,{options:c,value:String(d),disabled:i,onChange:m=>{const C=typeof m=="string"?m:m[0];u(Number(C))}})}),!h&&f&&r.jsx("div",{className:"pl-3 border-l-2 border-secondary",children:r.jsx(Ke,{schema:f,value:t,onChange:n,path:s,level:a})})]})},Is=({schema:e,value:t,onChange:n,invalid:s})=>{const a=g.useId(),{texts:o,readonly:i=!1,inputClassName:l,acceptableResourceTypes:c}=Pe(),d=e.const!==void 0,f=Array.isArray(e.enum)&&e.enum.length>0;if(e["dial:resource"]===!0&&Array.isArray(e.acceptableResourceTypes)&&e.acceptableResourceTypes.length>0&&(e.type===P.String||e.type===void 0)){const h=(e.acceptableResourceTypes??[]).flatMap(u=>{const m=c?.[u];return Array.isArray(m)?m.map(C=>{const x=String(C);return{value:x,label:x}}):[]});return r.jsx(Me,{options:h,value:t!=null?String(t):void 0,invalid:s,disabled:i,onChange:u=>n(typeof u=="string"?u:u[0]),placeholder:o.enumSelectPlaceholder,className:l})}if(d)return r.jsx(v.DialInput,{value:String(e.const??""),disabled:!0,onChange:void 0,className:"opacity-60"});if(f&&e.enumDisplay===et.Radio){const h=e.enumOrientation===pt.Row;return r.jsx("div",{role:"radiogroup",className:h?"flex flex-row flex-wrap gap-x-4 gap-y-2":"flex flex-col gap-2",children:e.enum.map(u=>{const m=String(u);return r.jsx(O.DialRadioButton,{name:a,value:m,inputId:`${a}-${m}`,label:m,checked:t!=null?String(t)===m:!1,disabled:i,onChange:C=>n(C)},m)})})}if(f){const h=e.enum.map(u=>({value:String(u),label:String(u)}));return r.jsx(Me,{options:h,value:t!=null?String(t):void 0,invalid:s,disabled:i,onChange:u=>n(typeof u=="string"?u:u[0]),placeholder:o.enumSelectPlaceholder})}switch(e.type){case P.Boolean:return r.jsx(Ue.DialSwitch,{switchId:a,isOn:!!t,disabled:i,onChange:h=>n(h)});case P.Integer:return r.jsx(vr,{integer:!0,value:t!=null?String(t):"",invalid:s,disabled:i,onChange:h=>n(h!==void 0?Number(h):void 0),placeholder:o.integerInputPlaceholder,containerClassName:l});case P.Number:return r.jsx(vr,{value:t!=null?String(t):"",invalid:s,disabled:i,onChange:h=>n(h!==void 0?Number(h):void 0),placeholder:o.numberInputPlaceholder,containerClassName:l});default:return e.isProtected?r.jsx(as,{value:t!=null?String(t):"",invalid:s,disabled:i,onChange:h=>n(h??void 0),placeholder:o.stringInputPlaceholder,containerClassName:l}):r.jsx(v.DialInput,{value:t!=null?String(t):"",invalid:s,disabled:i,onChange:h=>n(h??void 0),placeholder:o.stringInputPlaceholder,containerClassName:l})}},Rr=({value:e,onChange:t,theme:n=wt.EditorThemes.dark,height:s=240})=>{const{readonly:a,texts:o}=Pe(),[i,l]=g.useState(null),[c,d]=g.useState(()=>JSON.stringify(e,null,2));g.useEffect(()=>{typeof window<"u"&&Promise.resolve().then(()=>require("./JsonEditor-Bxui5wJH.cjs")).then(h=>{l(()=>h.DialJsonEditor)})},[]);let f=!1;try{JSON.parse(c)}catch{f=!0}const p=h=>{const u=h??"";d(u);try{t(JSON.parse(u))}catch{}};return r.jsxs("div",{children:[r.jsx("div",{className:"border border-primary rounded",style:{height:`${s}px`},children:i&&r.jsx(i,{value:c,currentTheme:n,onChange:p,options:{readOnly:a}})}),r.jsx(v.DialErrorText,{text:f?o.invalidJsonError:void 0})]})},fn=(e,t)=>({id:Math.random().toString(36).slice(2),key:e,value:t}),Ns=e=>!!(e.oneOf||e.anyOf||e.type===P.Array||Fe(e)),_l={[P.String]:"entryTypeString",[P.Number]:"entryTypeNumber",[P.Boolean]:"entryTypeBoolean",[P.Null]:"entryTypeNull",[P.Object]:"entryTypeObject",[P.Array]:"entryTypeArray"},Ll=({pairId:e,pairKey:t,pairValue:n,valueSchema:s,isUnschematizedValue:a,jsonEditorTheme:o,onKeyChange:i,onValueChange:l,onRemove:c,keyInputPlaceholder:d,removeFieldAriaLabel:f,path:p,level:h,readonly:u=!1,inputClassName:m})=>{const{rootSchema:C,texts:x,defaultExpanded:b=!0,touchedPaths:y=new Set,markTouched:N=()=>{},skipUntouched:D=!1}=Pe(),[I,j]=g.useState(t),L=Ns(s),[w,A]=g.useState(()=>ys(n)),E=a&&(w===P.Object||w===P.Array),T=a&&w===P.Null,R=L||E,B=[...p,e,"key"].join("."),Q=(!D||y.has(B))&&t==="",V=g.useCallback(te=>{l(vs(te)),A(te)},[l]),F=g.useMemo(()=>Cs.map(te=>({value:te,label:x[_l[te]]})),[x]),G=g.useMemo(()=>[{value:"true",label:x.booleanTrueOption},{value:"false",label:x.booleanFalseOption}],[x]),U=`${e}-key-error`,Z=a&&w===P.Boolean,le=r.jsxs("div",{className:"flex gap-2 items-start",children:[r.jsxs("div",{className:R?"flex-1 min-w-0":"w-2/5 min-w-0",children:[r.jsx(v.DialInput,{value:I,disabled:u,invalid:Q,"aria-describedby":Q?U:void 0,onChange:te=>j(te??""),onBlur:()=>{N(B),I!==t&&i(I)},placeholder:d,containerClassName:m}),r.jsx(v.DialErrorText,{id:U,text:Q?`${x.keyColumnHeader} is required`:void 0})]}),!L&&!E&&r.jsx("div",{className:"flex-1 min-w-0",children:T?r.jsx(v.DialInput,{value:"null",disabled:!0,onChange:void 0,className:"opacity-60"}):Z?r.jsx(Me,{options:G,value:n?"true":"false",disabled:u,onChange:te=>{const ae=typeof te=="string"?te:te[0];ae&&l(ae==="true")}}):r.jsx(Is,{schema:a?{type:w}:s,value:n,onChange:l})}),a&&r.jsx("div",{className:"w-28 shrink-0",children:r.jsx(_.DialTooltip,{tooltip:x.entryTypeChangeWarning,triggerClassName:"block",children:r.jsx(Me,{options:F,value:w,disabled:u,onChange:te=>{const ae=typeof te=="string"?te:te[0];ae&&V(ae)}})})}),!u&&r.jsx(Wt,{size:_.ElementSize.Small,onClick:c,"aria-label":f,className:"shrink-0 p-1"})]});if(!R)return le;if(E)return r.jsxs("div",{className:"flex flex-col gap-2",children:[le,r.jsx(Rr,{value:n,onChange:l,theme:o},w)]});const J=[...p,t],ie=ht(n,s,C),W=De(n,s,C,J.join("."));return r.jsxs("div",{className:"flex flex-col gap-2",children:[le,r.jsx(It,{title:t,level:h,summary:ie,errorCount:W.length+(Q?1:0),defaultExpanded:b,children:r.jsx(Ke,{schema:s,value:n,onChange:l,path:J,level:h+1})})]})},kl=({schema:e,value:t,onChange:n,path:s,level:a})=>{const{rootSchema:o,texts:i,readonly:l=!1,inputClassName:c,jsonEditorTheme:d}=Pe(),f=e.additionalProperties===!0||e.additionalProperties==null,p=f?{type:"string"}:typeof e.additionalProperties=="object"?Y(e.additionalProperties,o):{type:"string"},h=Ns(p),[u,m]=g.useState(()=>Object.entries(t??{}).map(([I,j])=>fn(I,j))),C=I=>Object.fromEntries(I.filter(j=>j.key!=="").map(j=>[j.key,j.value])),x=(I,j)=>{const L=u.map((w,A)=>A===I?{...w,key:j}:w);m(L),n(C(L))},b=(I,j)=>{const L=u.map((w,A)=>A===I?{...w,value:j}:w);m(L),n(C(L))},y=()=>h?Ce(p,o)??Jt(p):"",N=()=>{m(I=>[...I,fn("",y())])},D=I=>{const j=u.filter((L,w)=>w!==I);m(j),n(C(j))};return r.jsxs("div",{className:"flex flex-col gap-2",children:[u.length===0&&r.jsx("p",{className:"dial-tiny-text text-secondary italic",children:i.noFieldsYet}),u.length>0&&!h&&r.jsxs("div",{className:"flex gap-2 mb-1 pr-7",children:[r.jsx("span",{className:"w-2/5 dial-tiny-text text-secondary font-medium",children:i.keyColumnHeader}),r.jsx("span",{className:"flex-1 dial-tiny-text text-secondary font-medium",children:i.valueColumnHeader}),f&&r.jsx("span",{className:"w-28 shrink-0 dial-tiny-text text-secondary font-medium",children:i.typeColumnHeader})]}),u.map((I,j)=>r.jsx(Ll,{pairId:I.id,pairKey:I.key,pairValue:I.value,valueSchema:p,isUnschematizedValue:f,jsonEditorTheme:d,onKeyChange:L=>x(j,L),onValueChange:L=>b(j,L),onRemove:()=>D(j),keyInputPlaceholder:i.keyInputPlaceholder,removeFieldAriaLabel:i.removeFieldAriaLabel,path:s,level:a,readonly:l,inputClassName:c},I.id)),!l&&r.jsx("div",{className:"pt-1",children:r.jsx(v.DialGhostButton,{label:i.addField,iconBefore:r.jsx($.IconPlus,{size:16,stroke:2}),onClick:N})})]})},Ke=({schema:e,value:t,onChange:n,path:s,level:a,required:o,suppressInlineError:i=!1})=>{const{rootSchema:l,renderField:c,markTouched:d=()=>{},touchedPaths:f=new Set,skipUntouched:p=!1,jsonEditorTheme:h}=Pe(),u=Y(e,l),m=b=>{d(s.join(".")),n(b)},C=!p||f.has(s.join("."));let x;if(u.oneOf)x=r.jsx(Ol,{schema:u,value:t,onChange:m,path:s,level:a});else if(u.anyOf&&u.type!==P.Object)x=r.jsx(Al,{schema:u,value:t,onChange:m,path:s,level:a});else if(Fe(u)){const b=u.additionalProperties!=null&&u.additionalProperties!==!1,y=!u.properties||Object.keys(u.properties).length===0;b&&y?x=r.jsx(kl,{schema:u,value:t,onChange:m,path:s,level:a}):y&&u.additionalProperties!==!1?x=r.jsx(Rr,{value:t,onChange:m,theme:h}):x=r.jsx(Pt,{schema:u,value:t,onChange:m,path:s,level:a})}else if(u.type===P.Array)x=r.jsx(El,{schema:u,value:t,onChange:m,path:s,level:a});else{const b=C&&o&&st(t),y=!i&&b?Et(u.title??"Field"):void 0;x=r.jsxs(r.Fragment,{children:[r.jsx(Is,{schema:u,value:t,onChange:m,invalid:b}),r.jsx(v.DialErrorText,{text:y})]})}return c?c(s,u,x):x},Rl=({schema:e,defaultValue:t,texts:n,className:s,readonly:a=!1,defaultExpanded:o=!0,inputClassName:i,variant:l=ke.Sections,onChange:c,onPropertyChange:d,onDefaultValues:f,renderField:p,skipUntouched:h=!1,jsonEditorTheme:u,acceptableResourceTypes:m})=>{const C=g.useMemo(()=>({...ms,...n}),[n]),x=g.useMemo(()=>t||(Ce(e,e)??{}),[]),[b,y]=g.useState(x),[N,D]=g.useState(new Set),I=g.useCallback(T=>{D(R=>R.has(T)?R:new Set([...R,T]))},[]);g.useEffect(()=>{f?.(x)},[]);const j=(T,R)=>{const B={...b,[T]:R};y(B),c?.(B),d?.(T,R)},L=new Set(Object.keys(e.properties??{})),w=Object.keys(b).filter(T=>!L.has(T)),A=Yt(Object.entries(e.properties??{}).filter(([,T])=>!Y(T,e).isHidden)),E=e.required??[];return r.jsx(gs.Provider,{value:{rootSchema:e,texts:C,readonly:a,defaultExpanded:o,inputClassName:i,jsonEditorTheme:u,acceptableResourceTypes:m,renderField:p,touchedPaths:N,markTouched:I,skipUntouched:h},children:r.jsxs("div",{className:S.mergeClasses("flex flex-col gap-4",s),children:[A.map(([T,R])=>{const B=Y(R,e),K=B.title??R.title??tt(T),Q=E.includes(T),V=b[T];if(l===ke.Flat)return r.jsx(Ss,{schema:R,value:V,onChange:Z=>j(T,Z),path:[T],level:0,required:Q,label:K},T);if(l===ke.FlatSections)return r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx("h2",{className:"dial-small-semi-text text-primary",children:K}),r.jsx(Ke,{schema:R,value:V,onChange:Z=>j(T,Z),path:[T],level:0,required:Q})]},T);const F=De(V,B,e,T),G=T+".",U=!h||N.has(T)||[...N].some(Z=>Z.startsWith(G));return r.jsx(It,{title:K,description:B.description,level:0,defaultExpanded:o,errorCount:U?Q&&st(V)?Math.max(F.length,1):F.length:0,children:r.jsx(Ke,{schema:R,value:V,onChange:Z=>j(T,Z),path:[T],level:1,required:Q})},T)}),w.map(T=>{const R=tt(T),B=r.jsx(Rr,{value:b[T],onChange:K=>j(T,K),theme:u});return l===ke.Sections?r.jsx(It,{title:R,level:0,defaultExpanded:o,children:B},T):r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx("h2",{className:"dial-small-semi-text text-primary",children:R}),B]},T)})]})})},qe=({text:e,className:t,variant:n=v.CaptionType.Description,...s})=>e?r.jsx("span",{...s,role:"alert",className:S.mergeClasses("dial-tiny-text",n===v.CaptionType.Error?"text-error":"text-secondary",t,O.DIAL_KIT_CLASS.captionText,n===v.CaptionType.Error&&O.DIAL_KIT_CLASS.errorText),children:e}):null,Be=({...e})=>r.jsx(qe,{...e,variant:v.CaptionType.Error}),Ds=g.createContext(null),ze=()=>{const e=g.useContext(Ds);if(!e)throw new Error("useSchemaContext must be used inside SchemaRenderer");return e},Nt=(e,t=new Set,n=!1,s=!1)=>{if(!n||t.has(e))return!0;if(!s)return!1;const a=e+".";return[...t].some(o=>o.startsWith(a))},Ml="bg-control-neutral-active flex items-center justify-center enabled:text-secondary enabled:hover:text-control-accent-hover enabled:active:bg-control-accent-alpha-active enabled:hover:bg-control-accent-alpha-hover enabled:active:text-control-accent-active",Pl={[_.ElementSize.Small]:"size-[24px]",[_.ElementSize.Standard]:"size-[40px]",[_.ElementSize.Large]:"size-[48px]"},Fl=({icon:e,onClick:t,disabled:n,size:s=_.ElementSize.Standard,className:a})=>r.jsx("div",{className:S.mergeClasses("border-l border-tertiary",Pl[s]),children:r.jsx(k.IconButton,{className:S.mergeClasses(Ml,s===_.ElementSize.Small&&"p-1",a),icon:e,onClick:t,disabled:n,size:s})}),Bl=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Backspace","Delete","Tab","Enter","Escape","Home","End","Insert"],js=(e,t,n,s)=>{if((t==="number"||n!==void 0||s!==void 0)&&!Bl.includes(e.key)&&!(e.ctrlKey||e.metaKey)&&!(e.key==="-"&&(e.currentTarget.selectionStart??0)===0&&!e.currentTarget.value.includes("-"))&&!(e.key==="."&&t==="number"&&!e.currentTarget.value.includes("."))){if(!/^[0-9]$/.test(e.key)){e.preventDefault();return}if((n!==void 0||s!==void 0)&&e.currentTarget.selectionStart!==null){const o=e.currentTarget.value,i=e.currentTarget.selectionStart,l=e.currentTarget.selectionEnd??i,c=o.slice(0,i)+e.key+o.slice(l),d=parseFloat(c);if(!isNaN(d)){if(n!==void 0&&d<+n){e.preventDefault();return}if(s!==void 0&&d>+s){e.preventDefault();return}}}}},Ts={[_.ElementSize.Small]:{field:"dial-kit-input-small gap-x-1",paddingStart:"pl-2",paddingEnd:"pr-2",stackGap:"gap-1",postfixText:"dial-tiny-text"},[_.ElementSize.Standard]:{field:"gap-x-2 py-2",paddingStart:"pl-3",paddingEnd:"pr-3",stackGap:"gap-2",postfixText:"dial-small-text"},[_.ElementSize.Large]:{field:"gap-x-2 py-3",paddingStart:"pl-4",paddingEnd:"pr-4",stackGap:"gap-2",postfixText:"dial-body-text"}},Ae=({labelProps:e,error:t,caption:n,id:s,containerClassName:a,size:o=_.ElementSize.Standard,...i})=>r.jsxs("div",{className:S.mergeClasses("flex flex-col",Ts[o].stackGap,a),children:[e&&r.jsx(k.Label,{...e,htmlFor:s}),r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx(ws,{id:s,size:o,...i}),r.jsx(Be,{text:t}),!t&&r.jsx(qe,{text:n})]})]}),ws=({invalid:e,disabled:t,prefix:n,className:s,postfix:a,children:o,iconBefore:i,iconAfter:l,wrapperClassName:c,type:d,inputRef:f,value:p,tooltipText:h,min:u,onChange:m,max:C,inputButtonProps:x,wrapperRef:b,size:y=_.ElementSize.Standard,...N})=>{const D=Ts[y],I=g.useRef(null),j=se.useMergeRefs([f,I]),L=d==="number"||u!==void 0||C!==void 0;g.useEffect(()=>{const T=I.current;if(!T||!L||t)return;const R=B=>{B.preventDefault()};return T.addEventListener("wheel",R,{passive:!1}),()=>{T.removeEventListener("wheel",R)}},[t,L,d]);const w=T=>{js(T,d,u,C)},A=T=>{const R=T.currentTarget.value;if(L&&R!==""){const B=parseFloat(R);if(isNaN(B)&&R!=="-"&&R!=="."||!isNaN(B)&&(u!==void 0&&B<+u||C!==void 0&&B>+C))return}m?.(R||void 0)},E=()=>r.jsxs("div",{ref:b,className:S.mergeClasses("dial-kit-input flex flex-row items-center justify-between",D.field,e&&"dial-kit-input-error",t&&"dial-kit-input-disable",!n&&D.paddingStart,!x&&D.paddingEnd,c),"aria-label":"input-container",children:[n&&r.jsx("div",{className:"border-r border-secondary",children:r.jsx(ws,{wrapperClassName:"!rounded-r-none",className:"truncate",value:n,disabled:!0,size:y,id:`${n}_textBefore`})}),r.jsx(O.DialIcon,{icon:i}),o,r.jsx("input",{ref:j,type:d,autoComplete:d==="password"?"new-password":"off",value:p??"",className:S.mergeClasses("border-0 bg-transparent w-full truncate",t&&"cursor-not-allowed",s),onChange:A,onKeyDown:w,min:u,disabled:t,max:C,...N}),a&&r.jsxs("p",{className:S.mergeClasses("text-secondary",D.postfixText),children:[" ",a]}),r.jsx(O.DialIcon,{icon:l}),x&&r.jsx(Fl,{size:y,...x,disabled:t})]});return t&&d!=="password"?r.jsx(k.Tooltip,{tooltip:h||p,children:E()}):E()},Es=({availableWidth:e,tagWidths:t,overflowChipWidth:n,gap:s})=>{if(e<=0)return t.length;let a=0,o=0;for(const i of t){const l=i+s;if(a+l>e)break;a+=l,o++}if(o===t.length)return o;for(;o>0&&a+n>e;)o--,a-=t[o]+s;return o};var rt=(e=>(e.Outlined="outlined",e.Selectable="selectable",e))(rt||{});const zl="inline-flex h-[32px] max-w-full items-center gap-1 rounded-full px-3",$l={[rt.Outlined]:{default:"bg-layer-raised text-primary",selected:"bg-control-accent-alpha text-primary"},[rt.Selectable]:{default:"text-secondary",selected:"bg-control-accent-alpha text-primary"}},Hl="cursor-pointer outline-offset-0 focus-visible:outline focus-visible:outline-focus",Kl="hover:bg-control-accent-alpha-hover active:bg-control-accent-alpha-active",Re=({label:e,icon:t,appearance:n=rt.Outlined,selected:s=!1,disabled:a=!1,closable:o=!1,removeLabel:i,className:l,title:c,onClick:d,onRemove:f,onKeyDown:p,...h})=>{const u=n===rt.Selectable,m=!!d&&!a,C=o&&!!f&&!a,x=u&&s,b=y=>{p?.(y),!(!m||y.defaultPrevented)&&(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),y.currentTarget.click())};return r.jsxs("span",{...h,role:m?"button":h.role,tabIndex:m?0:h.tabIndex,"aria-disabled":a||void 0,"aria-pressed":u&&m?s:void 0,onClick:a?void 0:d,onKeyDown:b,className:S.mergeClasses(zl,x?"dial-tiny-semi-text":"dial-tiny-text",$l[n][s?"selected":"default"],a&&"cursor-not-allowed",m&&[Hl,Kl],l,O.DIAL_KIT_CLASS.tag),children:[t&&r.jsx("span",{className:"flex shrink-0 items-center","aria-hidden":"true",children:t}),r.jsx("span",{className:"truncate",title:c??e,children:e}),C&&r.jsx(k.GhostIconButton,{className:"size-[16px] shrink-0 dial-kit-minimum-target",size:_.ElementSize.Small,"aria-label":i??`Remove ${e}`,icon:r.jsx($.IconX,{size:H.DIAL_ICON_SIZE.SM,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}),onClick:y=>{y.stopPropagation(),f?.(y)}})]})},$t="h-[24px] max-w-full rounded-md border border-secondary bg-layer-sunken px-2",vt=({options:e,selectedValues:t,handleRemoveTag:n,tagClassName:s})=>r.jsx(r.Fragment,{children:t.map(a=>{const o=e.find(i=>i.value===a);return r.jsx(Re,{label:o?.label??a,closable:!!n,onRemove:i=>n?.(i,a),icon:o?.icon,className:S.mergeClasses($t,s)},a)})}),Vl=8,Gl=e=>e.stopPropagation(),Ul=e=>{e.key!=="Escape"&&e.stopPropagation()},Zl=({options:e,selectedValues:t,handleRemoveTag:n})=>{const s=g.useRef(null),a=g.useRef(null),[o,i]=g.useState(null),l=g.useCallback(()=>{const p=s.current,h=a.current;if(!p||!h)return;const u=Array.from(h.children,C=>C.offsetWidth),m=u.pop()??0;i(Es({tagWidths:u,overflowChipWidth:m,availableWidth:p.clientWidth,gap:Vl}))},[]);g.useLayoutEffect(()=>{l()},[l,e,t]),g.useLayoutEffect(()=>{const p=s.current;return p?O.observeElementSize(p,l):void 0},[l]);const c=o??t.length,d=t.slice(0,c),f=t.slice(c);return r.jsxs("div",{ref:s,className:"relative flex min-w-0 flex-1 items-center gap-2 overflow-hidden",children:[r.jsx(vt,{options:e,selectedValues:d,handleRemoveTag:n,tagClassName:"min-w-0"}),f.length>0&&r.jsx(k.InteractiveTooltip,{asChild:!0,placement:k.TooltipPlacement.Bottom,content:r.jsx("div",{className:"flex flex-wrap gap-2",onClick:Gl,onKeyDown:Ul,children:r.jsx(vt,{options:e,selectedValues:f,handleRemoveTag:n})}),children:r.jsx(Re,{label:`+${f.length}`,role:"button",tabIndex:0,"aria-haspopup":"true","aria-label":`${f.length} more selected: ${f.map(p=>e.find(h=>h.value===p)?.label??p).join(", ")}`,title:"",className:S.mergeClasses($t,"shrink-0")})}),r.jsxs("div",{ref:a,"aria-hidden":"true",inert:!0,className:"pointer-events-none invisible absolute left-0 top-0 flex h-0 w-max gap-2 overflow-hidden",children:[r.jsx(vt,{options:e,selectedValues:t,handleRemoveTag:n,tagClassName:"shrink-0"}),r.jsx(Re,{label:`+${t.length}`,className:S.mergeClasses($t,"shrink-0")})]})]})},Wl=S.mergeClasses("w-full flex flex-col"),ql=k.overlayItemClassName,Yl="!max-w-[var(--reference-width)]",Xl=S.mergeClasses("max-h-[344px] overflow-y-auto py-1",k.overlayListClassName),Jl=k.overlayGap,Ql=k.overlaySubMenuListClassName,ec=r.jsx($.IconChevronRight,{size:H.DIAL_ICON_SIZE.SM,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}),tc="text-secondary transition-transform",rc=8,nc=r.jsx($.IconSearch,{size:H.DIAL_ICON_SIZE.MD,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}),sc=r.jsx($.IconX,{size:H.DIAL_ICON_SIZE.SM,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}),ac=r.jsx(k.SvgNoData,{width:H.DIAL_ICON_SIZE.LG,height:H.DIAL_ICON_SIZE.LG,"aria-hidden":"true"}),oc=({opt:e,selectedValues:t,mark:n=k.MenuItemMark.Tint,onSelect:s})=>{const{isOpen:a,nodeId:o,refs:i,floatingStyles:l,context:c,getReferenceProps:d,getFloatingProps:f}=O.useSubMenuFloating(Jl,"listbox",!!e.disabled),p=e.children?.some(u=>t.includes(u.value)),h=r.jsx(k.MenuItem,{ref:i.setReference,role:"option","aria-haspopup":"listbox","aria-expanded":a,"aria-selected":!!p,"aria-disabled":!!e.disabled,disabled:e.disabled,ellipsisLabel:!0,icon:e.icon,label:e.labelNode??e.label,trailing:ec,...d()});return r.jsxs(se.FloatingNode,{id:o,children:[e.interactiveTooltip?r.jsx(k.InteractiveTooltip,{asChild:!0,placement:e.interactiveTooltip.placement,content:e.interactiveTooltip.content,contentClassName:e.interactiveTooltip.contentClassName,children:h}):h,a&&r.jsx(O.SubMenuPanel,{refs:i,floatingStyles:l,context:c,getFloatingProps:f,role:"listbox",surfaceClassName:Ql,children:e.children.map(u=>{const m=r.jsx(k.MenuItem,{role:"option","aria-selected":t.includes(u.value),"aria-disabled":!!u.disabled,disabled:u.disabled,mark:n,selected:t.includes(u.value),ellipsisLabel:!0,icon:u.icon,label:u.labelNode??u.label,rightControl:u.rightControl,onClick:()=>!u.disabled&&s(u.value)});return r.jsx(g.Fragment,{children:u.interactiveTooltip?r.jsx(k.InteractiveTooltip,{asChild:!0,placement:u.interactiveTooltip.placement,content:u.interactiveTooltip.content,contentClassName:u.interactiveTooltip.contentClassName,children:m}):m},u.value)})})]})},Ve=({options:e,multiple:t=!1,id:n,value:s,defaultValue:a,size:o=_.ElementSize.Standard,prefix:i,customSelectedValue:l,placeholder:c="Select...",labelProps:d,error:f,caption:p,ariaLabel:h,searchable:u=!1,searchSize:m=_.ElementSize.Standard,searchPlaceholder:C,selectAll:x=!1,invalid:b,selectAllLabel:y="Select all",collapseTagOverflow:N=!1,selectedOptionMark:D=k.MenuItemMark.Tint,emptyStateTitle:I="No options available",emptyStateDescription:j,emptyStateIcon:L,disabled:w=!1,className:A,fieldClassName:E,listClassName:T,closable:R=!1,header:B,footer:K,onClose:Q,onChange:V,dismissRef:F,onFooterClick:G,open:U,onOpenChange:Z,onSearchQueryChange:le,customMultiSelectTagsRenderer:J})=>{const ie=g.useId(),W=n||ie,te=`list-${W}`,ae=o===_.ElementSize.Small,[ce,he]=g.useState(!1),Se=U!==void 0,be=Se?!!U:ce,q=g.useCallback(z=>{Se||he(z),Z?.(z)},[Se,Z]),[ee,Te]=g.useState(""),Le=g.useCallback(z=>{z!==ee&&(Te(z||""),le?.(z||""))},[le,ee]),ge=s!==void 0,[$e,Ye]=g.useState(a),me=ge?s:$e,X=g.useMemo(()=>t?Array.isArray(me)?me:[]:typeof me=="string"?[me]:[],[me,t]),ue=g.useMemo(()=>{const z=ee.trim().toLowerCase();return z?e.filter(pe=>pe.label.toLowerCase().includes(z)):e},[e,ee]);g.useEffect(()=>{be||Le("")},[be,Le]);const fe=g.useCallback(z=>{ge||Ye(z),V?.(z)},[ge,V]),xt=g.useCallback(z=>{if(t){const pe=new Set(X);pe.has(z)?pe.delete(z):pe.add(z),fe(Array.from(pe));return}fe(z),q(!1)},[t,fe,q,X]),ot=g.useCallback((z,pe)=>{if(z.stopPropagation(),!t){fe("");return}const Ot=X.filter(aa=>aa!==pe);fe(Ot)},[t,X,fe]),ve=g.useMemo(()=>ue.filter(z=>!z.disabled),[ue]),Ze=g.useMemo(()=>ve.filter(z=>X.includes(z.value)).length,[ve,X]),{allSelectedInFiltered:ye,someSelectedInFiltered:Qt}=g.useMemo(()=>{const z=ve.length>0&&Ze===ve.length;return{allSelectedInFiltered:z,someSelectedInFiltered:Ze>0&&!z}},[ve,Ze]),it=g.useCallback(()=>{if(!(!t||ve.length===0))if(ye){const z=new Set(ve.map(pe=>pe.value));fe(X.filter(pe=>!z.has(pe)))}else{const z=new Set(X);ve.forEach(pe=>z.add(pe.value)),fe(Array.from(z))}},[ye,t,ve,X,fe]),Xe=X.length>0,M=!t&&Xe?X[0]:void 0,oe=g.useMemo(()=>M?e.find(z=>z.value===M)??e.flatMap(z=>z.children??[]).find(z=>z.value===M):void 0,[e,M]),Ie=oe?i?`${i} ${oe.label}`:oe.label:void 0,er=O.useIsMobileScreen(),tr=t&&N&&!J&&!er,bt=g.useMemo(()=>t?Xe?tr?r.jsx(Zl,{options:e,selectedValues:X,handleRemoveTag:ot}):r.jsx("span",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-2",children:J?.(e,X,ot)??r.jsx(vt,{options:e,selectedValues:X,handleRemoveTag:ot})}):null:!oe||!oe.labelNode&&!oe.description?null:r.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-2",children:[r.jsx(k.EllipsisTooltip,{text:oe.labelNode??Ie}),oe.description&&r.jsx("span",{className:"truncate text-secondary dial-tiny-text",children:oe.description})]}),[tr,J,ot,Xe,t,e,Ie,X,oe]),ea=t||bt?"":Ie||(l&&s?l:""),ta=typeof d?.label=="string"?d.label:void 0,ra=bt?[_.resolveAccessibleName(h,ta),t?X.map(z=>e.find(pe=>pe.value===z)?.label??z).join(", "):Ie].filter(Boolean).join(", ")||void 0:_.resolveAccessibleName(h);g.useImperativeHandle(F,()=>({dismiss:()=>{q(!1)}}));const na=g.useCallback(z=>{w||(z.key==="ArrowDown"||z.key==="ArrowUp")&&(z.preventDefault(),be||q(!0))},[w,be,q]),sa=()=>r.jsxs("div",{id:te,role:"listbox","aria-multiselectable":t||void 0,className:Wl,children:[B&&r.jsx(r.Fragment,{children:typeof B=="function"?B():B}),(u||R)&&(e.length>rc||!!ee)&&r.jsxs("div",{className:"flex items-center gap-2 px-2 pt-2",children:[u&&r.jsx(Ae,{id:`search-${W}`,size:m,placeholder:C,"aria-label":C||"Search options",onChange:z=>Le(z),value:ee,iconBefore:nc,containerClassName:"w-full"}),R&&r.jsx(k.GhostIconButton,{"aria-label":"Close select",className:"shrink-0",size:_.ElementSize.Small,icon:sc,onClick:z=>{Q?.(z),q(!1)}})]}),t&&x&&ve.length>0&&r.jsx("div",{className:S.mergeClasses(ql,"mt-2"),children:r.jsx(k.Checkbox,{id:`${W}-selectAll`,labelProps:{label:y},isSelected:ye,isIndeterminate:Qt,onChange:it})}),r.jsx("div",{role:"none",className:Xl,children:ue.length===0?r.jsx("div",{className:"px-2 py-3",children:r.jsx(O.DialNoDataContent,{icon:L??ac,title:I,description:j})}):ue.map(z=>{const pe=X.includes(z.value);if(z.children?.length)return r.jsx(oc,{opt:z,selectedValues:X,mark:t?k.MenuItemMark.Checkbox:D,onSelect:xt},z.value);const Ot=t?r.jsx(k.MenuItem,{id:`${W}-${z.value}`,role:"option","aria-selected":pe,"aria-disabled":!!z.disabled,disabled:z.disabled,mark:k.MenuItemMark.Checkbox,selected:pe,icon:z.icon,label:z.labelNode??z.label,description:z.description,rightControl:z.rightControl,onClick:()=>xt(z.value)}):r.jsx(k.MenuItem,{role:"option","aria-selected":pe,"aria-disabled":!!z.disabled,disabled:z.disabled,mark:D,selected:pe,ellipsisLabel:!0,icon:z.icon,label:z.labelNode??z.label,description:z.description,rightControl:z.rightControl,onClick:()=>!z.disabled&&xt(z.value)});return r.jsx(g.Fragment,{children:z.interactiveTooltip?r.jsx(k.InteractiveTooltip,{asChild:!0,placement:z.interactiveTooltip.placement,content:z.interactiveTooltip.content,contentClassName:z.interactiveTooltip.contentClassName,children:Ot}):Ot},z.value)})}),K&&r.jsx("div",{onClick:z=>{G?.(z),G&&q(!1)},children:typeof K=="function"?K():K})]});return r.jsxs("div",{className:S.mergeClasses("flex w-full flex-col gap-2",A,O.DIAL_KIT_CLASS.select),children:[d&&r.jsx(k.Label,{...d,htmlFor:W}),r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx(k.Dropdown,{open:be,onOpenChange:q,disabled:w,closable:R,onClose:Q,placement:"bottom-start",allowedPlacements:["bottom-start","top-start"],listClassName:S.mergeClasses(Yl,T),className:"w-full",renderOverlay:sa,children:r.jsx(Ae,{id:W,size:o,disabled:w,invalid:b,value:ea,placeholder:bt?void 0:c,readOnly:!0,iconBefore:t?void 0:oe?.icon,iconAfter:r.jsx($.IconChevronDown,{size:ae?H.DIAL_ICON_SIZE.SM:H.DIAL_ICON_SIZE.MD,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true",className:S.mergeClasses(tc,be&&"rotate-180")}),role:"combobox","aria-haspopup":"listbox","aria-expanded":be,"aria-controls":te,"aria-autocomplete":"none","aria-label":ra,containerClassName:"w-full",wrapperClassName:S.mergeClasses(!w&&"cursor-pointer",t&&Xe&&!tr&&["!h-auto flex-wrap py-2",ae?"min-h-[24px]":"min-h-[40px]"],E),className:S.mergeClasses("cursor-pointer",bt&&"w-0 min-w-0 flex-none p-0"),onKeyDown:na,children:bt})}),r.jsx(Be,{text:f}),!f&&r.jsx(qe,{text:p})]})]})},pn={[P.Array]:[],[P.String]:"",[P.Boolean]:!1,[P.Integer]:0,[P.Number]:0},ic=({schema:e,value:t,onChange:n,path:s,level:a,ariaLabel:o})=>{const{rootSchema:i,texts:l,readonly:c=!1}=ze(),d=e.anyOf??[],f=xs(t,d,i),p=d[f],h=!p||Y(p,i).type===P.Null,u=m=>{const C=Y(d[m],i);if(C.type===P.Null){n(null);return}const x=Ce(C,i);if(x!==void 0){n(x);return}const b=typeof C.type=="string"?C.type:"";n(b in pn?pn[b]:{})};return r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(Ve,{ariaLabel:o??l.selectTypePlaceholder,options:d.map((m,C)=>({value:String(C),label:Xt(m,i)})),value:String(f),disabled:c,onChange:m=>u(Number(typeof m=="string"?m:m[0])),className:"max-w-[280px]"}),!h&&r.jsx("div",{className:"border-l-2 border-tertiary pl-3",children:r.jsx(Ge,{schema:p,value:t,onChange:n,path:s,level:a,ariaLabel:o})})]})},at=({label:e,variant:t,appearance:n=_.ButtonAppearance.Solid,size:s=_.ElementSize.Standard,className:a,textClassName:o,iconAfter:i,iconBefore:l,type:c="button",tooltipProps:d,href:f,target:p,rel:h,disabled:u,...m})=>{const C=S.mergeClasses("dial-kit-base-button",t&&k.getButtonClassNames(t,n),s===_.ElementSize.Small?"dial-tiny-semi-text":"dial-small-paragraph-semi-text",s===_.ElementSize.Small?"h-[24px] gap-1":"h-[40px] gap-2",s===_.ElementSize.Small&&"dial-kit-base-button-small",n!==_.ButtonAppearance.Link&&(s===_.ElementSize.Small?"px-2":"px-4"),s!==_.ElementSize.Small&&n!==_.ButtonAppearance.Link&&"dial-kit-enhanced-target",a),x=e?void 0:d?.tooltip,b=_.resolveAccessibleName(typeof e=="string"?e:void 0,m["aria-label"],x),y=r.jsxs(r.Fragment,{children:[r.jsx(O.DialIcon,{icon:l}),e&&r.jsx("span",{className:o,children:e}),r.jsx(O.DialIcon,{icon:i})]}),N=m,D=f!==void 0?r.jsx("a",{...N,href:u?void 0:f,target:p,rel:h??(p==="_blank"?"noopener noreferrer":void 0),"aria-disabled":u||void 0,tabIndex:u?-1:N.tabIndex,onClick:u?void 0:N.onClick,className:C,"aria-label":b,children:y}):r.jsx("button",{...m,...k.getDisabledButtonProps(u,d,m.onClick),type:c,className:C,"aria-label":b,children:y});return d?r.jsx(k.Tooltip,{asChild:!0,...d,children:D}):D},Mr=(e,t)=>({appearance:s,...a})=>r.jsx(at,{...a,variant:e,appearance:s||t}),Pr=(e,t)=>({variant:s,...a})=>r.jsx(at,{...a,variant:s||t,appearance:e}),Os=Mr(_.ButtonVariant.Primary,_.ButtonAppearance.Solid),Fr=Mr(_.ButtonVariant.Neutral,_.ButtonAppearance.Solid),lc=Mr(_.ButtonVariant.Danger,_.ButtonAppearance.Solid),dt={x1:"-5.06",y1:"2.26",x2:"30.62",y2:"22.63",from:"var(--stroke-gradient-1, #5976E9)",to:"var(--stroke-gradient-2, #885DF2)"},cc=r.jsx($.IconSparkles,{size:H.DIAL_ICON_SIZE.MD,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":!0}),dc=({appearance:e=_.ButtonAppearance.Outlined,iconBefore:t=cc,iconAfter:n,style:s,...a})=>{const o=`dial-kit-starter-gradient-${g.useId().replace(/[^\w-]/g,"")}`,i=r.jsx("svg",{className:"pointer-events-none absolute size-0 overflow-hidden","aria-hidden":"true",focusable:"false",children:r.jsx("defs",{children:r.jsxs("linearGradient",{id:o,x1:dt.x1,y1:dt.y1,x2:dt.x2,y2:dt.y2,gradientUnits:"userSpaceOnUse",children:[r.jsx("stop",{stopColor:dt.from}),r.jsx("stop",{offset:"1",stopColor:dt.to})]})})}),l=c=>r.jsxs(r.Fragment,{children:[i,c]});return r.jsx(at,{...a,variant:_.ButtonVariant.Starter,appearance:e,iconBefore:t?l(t):void 0,iconAfter:n&&!t?l(n):n,style:{"--dial-kit-starter-icon-stroke":`url(#${o})`,...s}})},uc=Pr(_.ButtonAppearance.Link,_.ButtonVariant.Primary),Br=Pr(_.ButtonAppearance.Ghost,_.ButtonVariant.Primary),fc=Pr(_.ButtonAppearance.Outlined,_.ButtonVariant.Neutral),Dt=({title:e,description:t,summary:n,errorCount:s=0,level:a=0,children:o,onRemove:i,defaultExpanded:l=!0,removeItemAriaLabel:c="Remove item"})=>{const[d,f]=g.useState(l),p=g.useId(),h=a===0;return r.jsxs("div",{className:S.mergeClasses("flex flex-col border border-tertiary",h?"rounded-xl bg-layer-raised":"rounded-lg",O.DIAL_KIT_CLASS.schemaRendererSection),children:[r.jsxs("div",{className:S.mergeClasses("flex items-center gap-2",h?"px-4 py-3":"px-3 py-2"),children:[r.jsxs("button",{type:"button","aria-expanded":d,"aria-controls":d?p:void 0,onClick:()=>f(u=>!u),className:"flex min-w-0 flex-1 items-center gap-2 rounded text-left text-primary focus-visible:outline focus-visible:outline-focus",children:[r.jsx($.IconChevronDown,{size:H.DIAL_ICON_SIZE.SM,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true",className:S.mergeClasses("shrink-0 text-secondary transition-transform",!d&&"-rotate-90")}),r.jsx("span",{className:S.mergeClasses("truncate",h?"dial-small-semi-text":"dial-small-text"),children:e})]}),r.jsx(k.InfoButton,{caption:t}),n&&r.jsx("span",{className:"dial-tiny-text whitespace-nowrap text-secondary",children:n}),s>0?r.jsxs("span",{className:"flex items-center gap-1 whitespace-nowrap dial-tiny-text text-error",children:[r.jsx($.IconAlertTriangle,{size:H.DIAL_ICON_SIZE.SM,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true",className:"shrink-0"}),s," error",s>1?"s":""]}):r.jsx($.IconCheck,{size:H.DIAL_ICON_SIZE.SM,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true",className:"shrink-0 text-success"}),i&&r.jsx(k.DangerIconButton,{size:_.ElementSize.Small,icon:r.jsx($.IconTrash,{size:H.DIAL_ICON_SIZE.SM,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}),"aria-label":c,onClick:i,className:"shrink-0"})]}),d&&r.jsx("div",{id:p,className:S.mergeClasses("border-t border-tertiary",h?"p-4":"p-3"),children:o})]})},pc=({schema:e,value:t,onChange:n,path:s,level:a})=>{const{rootSchema:o,texts:i,readonly:l=!1,defaultExpanded:c=!0}=ze(),[d,f]=g.useState(),p=Array.isArray(t)?t:[],h=e.items;if(!h)return r.jsx("p",{className:"dial-small-text text-secondary",children:i.noItemSchema});const u=Y(h,o),m=u.discriminator,C=m?Object.keys(m.mapping).map(D=>({value:D,label:D})):[],x=d??C[0]?.value,b=()=>{let D;if(m&&x){const I=Y({$ref:m.mapping[x]},o);D={...Ce(I,o)??{},[m.propertyName]:x}}else D=Ce(u,o)??Jt(u);n([...p,D])},y=D=>{n(p.filter((I,j)=>j!==D))},N=(D,I)=>{n(p.map((j,L)=>L===D?I:j))};return r.jsxs("div",{className:"flex flex-col gap-3",children:[p.length===0&&r.jsx("p",{className:"dial-small-text text-secondary",children:i.noItemsYet}),p.map((D,I)=>{const j=bs(D,m?.propertyName,I),L=De(D,u,o,`${s.join(".")}[${I}]`);return r.jsx(Dt,{title:j,level:a,summary:ht(D,u,o),errorCount:L.length,onRemove:l?void 0:()=>y(I),defaultExpanded:c,removeItemAriaLabel:`${i.removeItemAriaLabel}: ${j}`,children:r.jsx(Ge,{schema:h,value:D,onChange:w=>N(I,w),path:[...s,String(I)],level:a+1,ariaLabel:j})},I)}),!l&&r.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[C.length>0&&r.jsx(Ve,{ariaLabel:i.selectTypeToAdd,options:C,value:x,placeholder:i.selectTypeToAdd,onChange:D=>f(typeof D=="string"?D:D[0]),className:"max-w-[280px] flex-1"}),r.jsx(Br,{label:i.addItem,iconBefore:r.jsx($.IconPlus,{size:H.DIAL_ICON_SIZE.SM,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}),onClick:b})]})]})};var zr=(e=>(e.None="none",e.Both="both",e.Horizontal="horizontal",e.Vertical="vertical",e))(zr||{});const hn={none:"resize-none",both:"resize",horizontal:"resize-x",vertical:"resize-y"},hc=e=>typeof e=="boolean"?hn[e?"both":"none"]:hn[e],As=({className:e="",value:t,onChange:n,error:s,containerClassName:a,resize:o=!1,labelProps:i,caption:l,id:c,invalid:d,...f})=>{const p=S.mergeClasses("dial-kit-textarea dial-kit-input px-3 py-2",d&&"dial-kit-input-error",f.disabled&&"dial-kit-input-disable",hc(o),e);return r.jsxs("div",{className:S.mergeClasses("flex flex-col gap-2",a),children:[i&&r.jsx(k.Label,{...i,htmlFor:c}),r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx("textarea",{id:c,value:t||"",className:p,onChange:h=>n?.(h.currentTarget.value),...f}),r.jsx(Be,{text:s}),!s&&r.jsx(qe,{text:l})]})]})},mn=e=>{try{return JSON.parse(e),!0}catch{return!1}},$r=({value:e,onChange:t,id:n,ariaLabel:s})=>{const{readonly:a,texts:o}=ze(),[i,l]=g.useState(()=>JSON.stringify(e,null,2)??""),c=!mn(i),d=f=>{l(f),mn(f)&&t(JSON.parse(f))};return r.jsx(As,{id:n,"aria-label":s,value:i,onChange:d,readOnly:a,invalid:c,error:c?o.invalidJsonError:void 0,spellCheck:!1,rows:10,resize:zr.Vertical,className:"font-mono !whitespace-pre"})},mc=/^0+\.(\d+)?$/,gc=/^0+/,xc=[".","-","+","e","E"],gn=e=>!e||e==="-"?e:String(e).match(mc)?String(e).replace(gc,"0"):Number(e),Hr=({integer:e,onChange:t,min:n,max:s,onKeyDown:a,onPaste:o,...i})=>{const l=d=>{if(e&&xc.includes(d.key)){d.preventDefault();return}js(d,"number",n,s),a?.(d)},c=d=>{if(e){const f=d.clipboardData.getData("text"),p=f.replace(/\D/g,"");if(p!==f&&(d.preventDefault(),p)){const h=d.currentTarget,u=h.selectionStart??0,m=h.selectionEnd??0,C=h.value.slice(0,u)+p+h.value.slice(m);t?.(gn(C))}}o?.(d)};return r.jsx(Ae,{...i,wrapperClassName:S.mergeClasses(i.wrapperClassName,O.DIAL_KIT_CLASS.numberInput),type:"number",min:n,max:s,onChange:d=>t?.(gn(d)),onKeyDown:l,onPaste:c})},_s=({showPasswordLabel:e="Show password",hidePasswordLabel:t="Hide password",disabled:n,size:s=_.ElementSize.Standard,...a})=>{const[o,i]=g.useState(!1),l=o&&!n;return g.useEffect(()=>{n&&i(!1)},[n]),r.jsx(Ae,{...a,wrapperClassName:S.mergeClasses(a.wrapperClassName,O.DIAL_KIT_CLASS.passwordInput),size:s,disabled:n,type:l?"text":"password",iconAfter:n?void 0:r.jsx(k.GhostIconButton,{size:_.ElementSize.Small,"aria-label":l?t:e,"aria-pressed":l,icon:l?r.jsx($.IconEyeOff,{size:H.DIAL_ICON_SIZE.SM,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}):r.jsx($.IconEye,{size:H.DIAL_ICON_SIZE.SM,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}),onClick:()=>i(c=>!c)})})},bc="flex flex-col gap-2",Cc="flex",yc="mt-2 ml-[26px]",vc={[v.RadioGroupOrientation.Column]:"flex-col gap-y-3",[v.RadioGroupOrientation.Row]:"flex-row flex-wrap gap-x-4 gap-y-3"},jt=({items:e,value:t,onChange:n,name:s,id:a,orientation:o=v.RadioGroupOrientation.Column,labelProps:i,disabled:l,error:c,caption:d,ariaLabel:f,className:p,optionsClassName:h,radioClassName:u,contentClassName:m})=>{const C=g.useId(),x=a??C,b=`${x}-label`,y=c?`${x}-error`:void 0,N=!c&&d?`${x}-caption`:void 0,D=_.resolveAccessibleName(i?.label);return r.jsxs("div",{className:S.mergeClasses(bc,p,O.DIAL_KIT_CLASS.radioGroup),children:[i&&r.jsx(k.Label,{...i,id:b}),r.jsx("div",{role:"radiogroup","aria-labelledby":D?b:void 0,"aria-label":D?void 0:_.resolveAccessibleName(f),"aria-describedby":[y,N].filter(Boolean).join(" ")||void 0,"aria-disabled":l||void 0,className:S.mergeClasses(Cc,vc[o],h),children:e.map(I=>{const j=I.value===t;return r.jsxs("div",{className:"flex min-w-0 flex-col",children:[r.jsx(k.Radio,{id:`${x}-${I.value}`,name:s??x,value:I.value,labelProps:I.label==null?void 0:{label:I.label},"aria-label":I["aria-label"],caption:I.caption,isSelected:j,disabled:l||I.disabled,onChange:n,className:u}),j&&I.content?r.jsx("div",{className:S.mergeClasses(yc,m),children:I.content}):null]},I.value)})}),r.jsx(Be,{id:y,text:c}),!c&&r.jsx(qe,{id:N,text:d})]})},Ls=({id:e,labelProps:t,isOn:n=!1,disabled:s,onChange:a,caption:o,className:i,...l})=>{const c=g.useId(),d=e??c,f=o?`${d}-caption`:void 0,p=g.useCallback(h=>{a?.(h.target.checked)},[a]);return r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsxs("div",{className:S.mergeClasses("flex items-center gap-2",i,O.DIAL_KIT_CLASS.switch),children:[r.jsx("input",{...l,type:"checkbox",role:"switch",id:d,checked:n,"aria-checked":n,disabled:s,onChange:p,"aria-label":_.resolveAccessibleName(typeof t?.label!="string"?l["aria-label"]:void 0),"aria-describedby":f,className:"peer sr-only"}),r.jsx("label",{htmlFor:d,className:S.mergeClasses("flex h-[18px] w-[36px] shrink-0 items-center rounded-full p-0.5 transition-colors duration-200","peer-focus-visible:outline peer-focus-visible:outline-offset-2 peer-focus-visible:outline-focus",n?"justify-end":"justify-start",s?"cursor-not-allowed bg-control-disable-primary":S.mergeClasses("cursor-pointer",n?"bg-control-accent hover:bg-control-accent-hover":"bg-control-neutral-default hover:bg-control-neutral-hover-strong")),children:r.jsx("span",{className:S.mergeClasses("size-3.5 shrink-0 rounded-full",s?"bg-control-disable-secondary":"bg-control-neutral")})}),t&&r.jsx(k.Label,{size:_.ElementSize.Standard,...t,htmlFor:d,className:S.mergeClasses("py-[1px]",s?"cursor-not-allowed text-control-disable-primary":"cursor-pointer text-primary",t.className)})]}),o&&r.jsx("span",{id:f,className:"dial-tiny-text text-secondary ml-[44px]",children:o})]})},xn=e=>typeof e=="string"?e:e[0],hr=e=>e!=null?String(e):"",Sc=e=>e!==void 0?Number(e):void 0,ks=({schema:e,value:t,onChange:n,invalid:s,id:a,ariaLabel:o})=>{const{texts:i,readonly:l=!1,inputClassName:c,acceptableResourceTypes:d}=ze(),f=e.const!==void 0,p=Array.isArray(e.enum)?e.enum:[],h=p.length>0;if(e["dial:resource"]===!0&&Array.isArray(e.acceptableResourceTypes)&&e.acceptableResourceTypes.length>0&&(e.type===P.String||e.type===void 0)){const m=(e.acceptableResourceTypes??[]).flatMap(C=>{const x=d?.[C];return Array.isArray(x)?x.map(b=>{const y=String(b);return{value:y,label:y}}):[]});return r.jsx(Ve,{id:a,ariaLabel:o,options:m,value:t!=null?String(t):void 0,invalid:s,disabled:l,onChange:C=>n(xn(C)),placeholder:i.enumSelectPlaceholder,className:c})}if(f)return r.jsx(Ae,{id:a,"aria-label":o,value:String(e.const??""),disabled:!0,containerClassName:c});if(h&&e.enumDisplay===et.Radio)return r.jsx(jt,{id:a,ariaLabel:o,items:p.map(m=>({value:String(m),label:String(m)})),value:t!=null?String(t):void 0,orientation:e.enumOrientation===pt.Row?v.RadioGroupOrientation.Row:v.RadioGroupOrientation.Column,disabled:l,onChange:m=>n(m)});if(h)return r.jsx(Ve,{id:a,ariaLabel:o,options:p.map(m=>({value:String(m),label:String(m)})),value:t!=null?String(t):void 0,invalid:s,disabled:l,onChange:m=>n(xn(m)),placeholder:i.enumSelectPlaceholder,className:c});switch(e.type){case P.Boolean:return r.jsx(Ls,{id:a,"aria-label":o,isOn:!!t,disabled:l,onChange:m=>n(m)});case P.Integer:case P.Number:return r.jsx(Hr,{id:a,"aria-label":o,integer:e.type===P.Integer,value:hr(t),invalid:s,disabled:l,onChange:m=>n(Sc(m)),placeholder:e.type===P.Integer?i.integerInputPlaceholder:i.numberInputPlaceholder,containerClassName:c});default:return e.isProtected?r.jsx(_s,{id:a,"aria-label":o,value:hr(t),invalid:s,disabled:l,onChange:m=>n(m??void 0),placeholder:i.stringInputPlaceholder,containerClassName:c}):r.jsx(Ae,{id:a,"aria-label":o,value:hr(t),invalid:s,disabled:l,onChange:m=>n(m??void 0),placeholder:i.stringInputPlaceholder,containerClassName:c})}},bn=(e,t)=>({id:Math.random().toString(36).slice(2),key:e,value:t}),Rs=e=>!!(e.oneOf||e.anyOf||e.type===P.Array||Fe(e)),Ic={[P.String]:"entryTypeString",[P.Number]:"entryTypeNumber",[P.Boolean]:"entryTypeBoolean",[P.Null]:"entryTypeNull",[P.Object]:"entryTypeObject",[P.Array]:"entryTypeArray"},Cn=e=>typeof e=="string"?e:e[0],Nc=({pair:e,valueSchema:t,isUnschematizedValue:n,onKeyChange:s,onValueChange:a,onRemove:o,path:i,level:l})=>{const{rootSchema:c,texts:d,readonly:f=!1,inputClassName:p,defaultExpanded:h=!0,touchedPaths:u,markTouched:m,skipUntouched:C}=ze(),[x,b]=g.useState(e.key),[y,N]=g.useState(()=>ys(e.value)),D=Rs(t),I=n&&(y===P.Object||y===P.Array),j=n&&y===P.Null,L=n&&y===P.Boolean,w=D||I,A=[...i,e.id,"key"].join("."),E=Nt(A,u,C)&&e.key==="",T=e.key||d.valueColumnHeader,R=U=>{a(vs(U)),N(U)},B=g.useMemo(()=>Cs.map(U=>({value:U,label:d[Ic[U]]})),[d]),K=g.useMemo(()=>[{value:"true",label:d.booleanTrueOption},{value:"false",label:d.booleanFalseOption}],[d]),Q=()=>j?r.jsx(Ae,{"aria-label":T,value:"null",disabled:!0}):L?r.jsx(Ve,{ariaLabel:T,options:K,value:e.value?"true":"false",disabled:f,onChange:U=>{const Z=Cn(U);Z&&a(Z==="true")}}):r.jsx(ks,{schema:n?{type:y}:t,value:e.value,onChange:a,ariaLabel:T}),V=r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx("div",{className:w?"min-w-0 flex-1":"w-2/5 min-w-0",children:r.jsx(Ae,{"aria-label":d.keyColumnHeader,value:x,disabled:f,invalid:E,error:E?`${d.keyColumnHeader} is required`:void 0,onChange:U=>b(U??""),onBlur:()=>{m?.(A),x!==e.key&&s(x)},placeholder:d.keyInputPlaceholder,containerClassName:p})}),!w&&r.jsx("div",{className:"min-w-0 flex-1",children:Q()}),n&&r.jsx("div",{className:"w-28 shrink-0",children:r.jsx(k.Tooltip,{tooltip:d.entryTypeChangeWarning,triggerClassName:"block",children:r.jsx(Ve,{ariaLabel:d.typeColumnHeader,options:B,value:y,disabled:f,onChange:U=>{const Z=Cn(U);Z&&R(Z)}})})}),!f&&r.jsx(k.DangerIconButton,{size:_.ElementSize.Small,icon:r.jsx($.IconTrash,{size:H.DIAL_ICON_SIZE.SM,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}),"aria-label":e.key?`${d.removeFieldAriaLabel}: ${e.key}`:d.removeFieldAriaLabel,onClick:o,className:"mt-2 shrink-0"})]});if(!w)return V;if(I)return r.jsxs("div",{className:"flex flex-col gap-2",children:[V,r.jsx($r,{value:e.value,onChange:a,ariaLabel:T},y)]});const F=[...i,e.key],G=De(e.value,t,c,F.join("."));return r.jsxs("div",{className:"flex flex-col gap-2",children:[V,r.jsx(Dt,{title:e.key,level:l,summary:ht(e.value,t,c),errorCount:G.length+(E?1:0),defaultExpanded:h,children:r.jsx(Ge,{schema:t,value:e.value,onChange:a,path:F,level:l+1,ariaLabel:T})})]})},Dc=({schema:e,value:t,onChange:n,path:s,level:a})=>{const{rootSchema:o,texts:i,readonly:l=!1}=ze(),c=e.additionalProperties===!0||e.additionalProperties==null,d=!c&&typeof e.additionalProperties=="object"?Y(e.additionalProperties,o):{type:P.String},f=Rs(d),[p,h]=g.useState(()=>Object.entries(t??{}).map(([x,b])=>bn(x,b))),u=x=>{h(x),n(Object.fromEntries(x.filter(b=>b.key!=="").map(b=>[b.key,b.value])))},m=(x,b)=>u(p.map((y,N)=>N===x?{...y,...b}:y)),C=()=>{const x=f?Ce(d,o)??Jt(d):"";h(b=>[...b,bn("",x)])};return r.jsxs("div",{className:"flex flex-col gap-2",children:[p.length===0&&r.jsx("p",{className:"dial-small-text text-secondary",children:i.noFieldsYet}),p.length>0&&!f&&r.jsxs("div",{"aria-hidden":"true",className:"flex gap-2 pr-8",children:[r.jsx("span",{className:"w-2/5 dial-tiny-semi-text text-secondary",children:i.keyColumnHeader}),r.jsx("span",{className:"flex-1 dial-tiny-semi-text text-secondary",children:i.valueColumnHeader}),c&&r.jsx("span",{className:"w-28 shrink-0 dial-tiny-semi-text text-secondary",children:i.typeColumnHeader})]}),p.map((x,b)=>r.jsx(Nc,{pair:x,valueSchema:d,isUnschematizedValue:c,onKeyChange:y=>m(b,{key:y}),onValueChange:y=>m(b,{value:y}),onRemove:()=>u(p.filter((y,N)=>N!==b)),path:s,level:a},x.id)),!l&&r.jsx("div",{className:"pt-1",children:r.jsx(Br,{label:i.addField,iconBefore:r.jsx($.IconPlus,{size:H.DIAL_ICON_SIZE.SM,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}),onClick:C})})]})},Nr=({schema:e,value:t,onChange:n,path:s,level:a})=>{const{rootSchema:o,texts:i}=ze(),l=Y(e,o),c=Yt(Object.entries(l.properties??{}).filter(([,p])=>!Y(p,o).isHidden)),d=l.required??[],f=t??{};return c.length===0?r.jsx("p",{className:"dial-small-text text-secondary",children:i.noConfigurableProperties}):r.jsx("div",{className:"flex flex-col gap-4",children:c.map(([p,h])=>{const u=Y(h,o);return r.jsx(Ms,{schema:h,value:f[p],onChange:m=>n({...f,[p]:m}),path:[...s,p],level:a,required:d.includes(p),label:u.title??h.title??tt(p)},p)})})},yn=e=>typeof e=="string"?e:e[0],jc=(e,t)=>{const{[t]:n,...s}=e.properties??{};return{...e,properties:s}},Tc=({schema:e,value:t,onChange:n,path:s,level:a,ariaLabel:o})=>{const{rootSchema:i,texts:l,readonly:c=!1}=ze(),d=g.useId(),f=o??l.selectTypePlaceholder,p=e.discriminatorDisplay===et.Radio,h=e.discriminator;if(h){const y=h.propertyName,N=h.mapping,D=w=>Y({$ref:N[w]},i),I=typeof t=="object"&&t!==null?t[y]:void 0,j=I?D(I):void 0,L=w=>{const A=Ce(D(w),i)??{};n({...A,[y]:w})};if(p){const w=e.discriminatorOrientation===pt.Row,A=T=>r.jsx(Nr,{schema:jc(T,y),value:t,onChange:n,path:s,level:a}),E=r.jsx(jt,{id:d,ariaLabel:f,value:I,onChange:L,disabled:c,orientation:w?v.RadioGroupOrientation.Row:v.RadioGroupOrientation.Column,items:Object.keys(N).map(T=>{const R=D(T);return{value:T,label:R.title??T,content:w?void 0:A(R)}})});return w?r.jsxs("div",{className:"flex flex-col gap-3",children:[E,j&&A(j)]}):E}return r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(Ve,{ariaLabel:f,options:Object.keys(N).map(w=>({value:w,label:w})),value:I,placeholder:l.selectTypePlaceholder,disabled:c,onChange:w=>{const A=yn(w);A&&L(A)},className:"max-w-[280px]"}),j&&r.jsx("div",{className:"pl-3",children:r.jsx(Nr,{schema:j,value:t,onChange:n,path:s,level:a})})]})}const u=e.oneOf??[],C=(()=>{if(typeof t!="object"||t===null||Array.isArray(t))return 0;const y=u.findIndex(N=>Y(N,i).required?.every(D=>D in t));return y>=0?y:0})(),x=u[C],b=y=>{const N=Ce(Y(u[y],i),i);n(N??null)};return p?r.jsx(jt,{id:d,ariaLabel:f,value:String(C),onChange:y=>b(Number(y)),disabled:c,items:u.map((y,N)=>({value:String(N),label:Xt(y,i)??`Option ${N+1}`,content:r.jsx(Ge,{schema:Y(y,i),value:t,onChange:n,path:s,level:a,ariaLabel:o})}))}):r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(Ve,{ariaLabel:f,options:u.map((y,N)=>({value:String(N),label:Y(y,i).title??`Option ${N+1}`})),value:String(C),disabled:c,onChange:y=>b(Number(yn(y))),className:"max-w-[280px]"}),x&&r.jsx("div",{className:"border-l-2 border-tertiary pl-3",children:r.jsx(Ge,{schema:x,value:t,onChange:n,path:s,level:a,ariaLabel:o})})]})},Ge=({schema:e,value:t,onChange:n,path:s,level:a,required:o,suppressInlineError:i=!1,fieldId:l,ariaLabel:c})=>{const{rootSchema:d,renderField:f,markTouched:p,touchedPaths:h,skipUntouched:u}=ze(),m=Y(e,d),C=s.join("."),x=N=>{p?.(C),n(N)},b={schema:m,value:t,onChange:x,path:s,level:a};let y;if(m.oneOf)y=r.jsx(Tc,{...b,ariaLabel:c});else if(m.anyOf&&m.type!==P.Object)y=r.jsx(ic,{...b,ariaLabel:c});else if(Fe(m)){const N=m.additionalProperties!=null&&m.additionalProperties!==!1,D=!m.properties||Object.keys(m.properties).length===0;N&&D?y=r.jsx(Dc,{...b}):D&&m.additionalProperties!==!1?y=r.jsx($r,{value:t,onChange:x,id:l,ariaLabel:c}):y=r.jsx(Nr,{...b})}else if(m.type===P.Array)y=r.jsx(pc,{...b});else{const N=Nt(C,h,u)&&!!o&&st(t),D=!i&&N?Et(m.title??c??"Field"):void 0;y=r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx(ks,{schema:m,value:t,onChange:x,invalid:N,id:l,ariaLabel:c}),r.jsx(Be,{text:D})]})}return f?f(s,m,y):y},Ms=({schema:e,value:t,onChange:n,path:s,level:a=0,required:o,label:i})=>{const l=g.useId(),{rootSchema:c,defaultExpanded:d=!0,touchedPaths:f,skipUntouched:p}=ze(),h=Y(e,c),u=s.join(".");if(Fe(h)||h.type===P.Array){const C=De(t,h,c,u),x=i??h.title??s[s.length-1]??"Section";return r.jsx(Dt,{title:x,description:h.description,level:a,summary:ht(t,h,c),errorCount:Nt(u,f,p,!0)?C.length:0,defaultExpanded:d,children:r.jsx(Ge,{schema:h,value:t,onChange:n,path:s,level:a+1,required:o,ariaLabel:x})})}const m=Nt(u,f,p)&&o&&st(t)?Et(i??"Field"):void 0;return r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsx(k.Label,{htmlFor:l,label:i,required:o,caption:h.description}),r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx(Ge,{schema:h,value:t,onChange:n,path:s,level:a,required:o,suppressInlineError:!0,fieldId:l,ariaLabel:i}),r.jsx(Be,{text:m})]})]})},vn="dial-small-semi-text text-primary",wc=({schema:e,defaultValue:t,texts:n,className:s,readonly:a=!1,defaultExpanded:o=!0,inputClassName:i,variant:l=ke.Sections,onChange:c,onPropertyChange:d,onDefaultValues:f,renderField:p,skipUntouched:h=!1,acceptableResourceTypes:u})=>{const m=g.useMemo(()=>({...ms,...n}),[n]),C=g.useMemo(()=>t||(Ce(e,e)??{}),[]),[x,b]=g.useState(C),[y,N]=g.useState(()=>new Set),D=g.useCallback(E=>{N(T=>T.has(E)?T:new Set([...T,E]))},[]);g.useEffect(()=>{f?.(C)},[]);const I=(E,T)=>{const R={...x,[E]:T};b(R),c?.(R),d?.(E,T)},j=new Set(Object.keys(e.properties??{})),L=Object.keys(x).filter(E=>!j.has(E)),w=Yt(Object.entries(e.properties??{}).filter(([,E])=>!Y(E,e).isHidden)),A=e.required??[];return r.jsx(Ds.Provider,{value:{rootSchema:e,texts:m,readonly:a,defaultExpanded:o,inputClassName:i,acceptableResourceTypes:u,renderField:p,touchedPaths:y,markTouched:D,skipUntouched:h},children:r.jsxs("div",{className:S.mergeClasses("flex flex-col gap-4",s,O.DIAL_KIT_CLASS.schemaRenderer),children:[w.map(([E,T])=>{const R=Y(T,e),B=R.title??T.title??tt(E),K=A.includes(E),Q=x[E],V=U=>I(E,U);if(l===ke.Flat)return r.jsx(Ms,{schema:T,value:Q,onChange:V,path:[E],level:0,required:K,label:B},E);if(l===ke.FlatSections)return r.jsxs("section",{className:"flex flex-col gap-3",children:[r.jsx("h2",{className:vn,children:B}),r.jsx(Ge,{schema:T,value:Q,onChange:V,path:[E],level:0,required:K,ariaLabel:B})]},E);const F=De(Q,R,e,E),G=K&&st(Q)?Math.max(F.length,1):F.length;return r.jsx(Dt,{title:B,description:R.description,level:0,defaultExpanded:o,errorCount:Nt(E,y,h,!0)?G:0,children:r.jsx(Ge,{schema:T,value:Q,onChange:V,path:[E],level:1,required:K,ariaLabel:B})},E)}),L.map(E=>{const T=tt(E),R=r.jsx($r,{value:x[E],onChange:B=>I(E,B),ariaLabel:T});return l===ke.Sections?r.jsx(Dt,{title:T,level:0,defaultExpanded:o,children:R},E):r.jsxs("section",{className:"flex flex-col gap-3",children:[r.jsx("h2",{className:vn,children:T}),R]},E)})]})})},Ec=e=>({info:r.jsx($.IconInfoCircleFilled,{size:e.size}),error:r.jsx($.IconAlertCircleFilled,{size:e.size}),warning:r.jsx($.IconAlertTriangleFilled,{size:e.size}),success:r.jsx($.IconCircleCheckFilled,{size:e.size}),loading:r.jsx(v.Spinner,{size:e.size}),general:r.jsx($.IconCheck,{size:e.size,stroke:e.stroke})}),Oc={[v.NotificationVariant.Info]:"bg-info text-info",[v.NotificationVariant.Success]:"bg-success text-success",[v.NotificationVariant.Warning]:"bg-warning text-warning",[v.NotificationVariant.Error]:"bg-error text-error",[v.NotificationVariant.Loading]:"bg-layer-raised text-info",[v.NotificationVariant.General]:"bg-layer-sunken text-primary"},Ac={[v.NotificationVariant.Info]:"status",[v.NotificationVariant.Success]:"status",[v.NotificationVariant.Warning]:"alert",[v.NotificationVariant.Error]:"alert",[v.NotificationVariant.Loading]:"status",[v.NotificationVariant.General]:"status"},_c="items-center justify-between rounded-xl relative gap-3 p-3 border flex border-transparent",Kr=({variant:e=v.NotificationVariant.Info,type:t=v.NotificationType.Toast,title:n,message:s,action:a,className:o,iconSize:i=24,iconStroke:l=2,closable:c=!1,onClose:d,children:f,textClassName:p,...h})=>{const u=g.useMemo(()=>Ec({size:i,stroke:l})[e],[e,i,l]),m=p??(t===v.NotificationType.SectionMessage?"flex-row flex-wrap items-baseline gap-x-1":"flex-col");return r.jsxs("div",{role:Ac[e],...h,className:S.mergeClasses(_c,Oc[e],t===v.NotificationType.Toast&&"min-w-[200px] max-w-[600px] shadow-lg",t===v.NotificationType.SectionMessage&&e===v.NotificationVariant.Loading&&"border-secondary",o,O.DIAL_KIT_CLASS.notification),children:[r.jsxs("div",{className:"flex items-start gap-3 flex-1 min-w-0",children:[r.jsx("span",{"aria-hidden":"true",className:"flex shrink-0",children:r.jsx(O.DialIcon,{icon:u})}),n?r.jsxs("div",{className:S.mergeClasses("flex min-w-0 text-primary break-words",m),children:[r.jsx("div",{className:"dial-small-paragraph-semi-text min-w-0 break-words",children:n}),r.jsx("div",{className:"dial-small-paragraph-text min-w-0 break-words",children:s})]}):r.jsx("div",{className:"dial-small-paragraph-text min-w-0 text-primary break-words",children:s})]}),a!=null&&r.jsx("div",{className:"flex shrink-0 items-center",children:a}),f,c&&r.jsx(k.CloseButton,{className:"shrink-0 self-start",ariaLabel:"Close notification",onClose:C=>d?.(C)})]})},Sn={2:"line-clamp-2",3:"line-clamp-3",4:"line-clamp-4",5:"line-clamp-5",6:"line-clamp-6"},Lc=e=>e===1?"!truncate !whitespace-nowrap":`${Sn[e]??Sn[2]} !whitespace-normal`,Ps=({text:e,query:t,markClassName:n,className:s,maxLines:a=2})=>{const o=S.mergeClasses(Lc(a),s,O.DIAL_KIT_CLASS.highlight);if(!t.trim())return r.jsx(k.EllipsisTooltip,{className:o,text:e});const i=e.toLowerCase().indexOf(t.toLowerCase()),l=i===-1?e:r.jsxs(r.Fragment,{children:[e.slice(0,i),r.jsx("mark",{className:S.mergeClasses("text-accent bg-control-accent-alpha-hover",n),children:e.slice(i,i+t.length)}),e.slice(i+t.length)]});return r.jsx(k.EllipsisTooltip,{className:o,text:l})},kc=({className:e,children:t,...n})=>r.jsx("article",{...n,className:S.mergeClasses("relative flex flex-col gap-3 rounded-[20px] border-2 border-transparent p-5","bg-layer-raised shadow-md transition-[transform,box-shadow] duration-200 ease-out hover:-translate-y-[3px] hover:shadow-lg motion-reduce:transition-none motion-reduce:hover:translate-y-0",e,O.DIAL_KIT_CLASS.cardShell),children:t}),mt=(e,t)=>({type:s,...a})=>r.jsx(Kr,{...a,variant:e,type:s||t}),gt=(e,t)=>({variant:s,...a})=>r.jsx(Kr,{...a,variant:s||t,type:e}),Rc=mt(v.NotificationVariant.Error,v.NotificationType.Toast),Mc=mt(v.NotificationVariant.Info,v.NotificationType.Toast),Pc=mt(v.NotificationVariant.Success,v.NotificationType.Toast),Fc=mt(v.NotificationVariant.Warning,v.NotificationType.Toast),Bc=mt(v.NotificationVariant.Loading,v.NotificationType.Toast),zc=mt(v.NotificationVariant.General,v.NotificationType.Toast),$c=gt(v.NotificationType.SectionMessage,v.NotificationVariant.Error),Hc=gt(v.NotificationType.SectionMessage,v.NotificationVariant.Info),Kc=gt(v.NotificationType.SectionMessage,v.NotificationVariant.Success),Vc=gt(v.NotificationType.SectionMessage,v.NotificationVariant.Warning),Gc=gt(v.NotificationType.SectionMessage,v.NotificationVariant.Loading),Uc=gt(v.NotificationType.SectionMessage,v.NotificationVariant.General);var Ne=(e=>(e.Date="date",e.DateTime="datetime",e.Time="time",e.Weekday="weekday",e))(Ne||{});const Zc="en-GB",Wc={[Ne.Date]:"Select date",[Ne.DateTime]:"Select date and time",[Ne.Time]:"--:--",[Ne.Weekday]:"Select day"},Fs="flex w-full items-center justify-between gap-2 rounded-xl border border-secondary bg-layer-raised px-4 py-3 dial-small-text text-primary outline-none transition-colors hover:border-accent-alpha focus-within:border-accent-focus",Bs="!cursor-not-allowed !border-transparent bg-layer-sunken text-control-disable-primary hover:!border-transparent",zs="!border-error",qc="z-floating flex w-[248px] flex-col gap-4 rounded-lg bg-layer-raised px-2 py-4 shadow-md",Yc="flex size-10 items-center justify-center rounded-full dial-small-text text-primary hover:bg-control-accent-alpha-hover hover:text-primary focus:outline-none focus-visible:outline focus-visible:outline-focus",Xc="bg-control-accent text-control-permanent",Jc="text-accent dial-small-semi-text",Qc="text-control-disable-primary",$s="text-secondary",ed=r.jsx($.IconCalendar,{size:H.DIAL_ICON_SIZE.MD,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true",className:$s}),In={prev:r.jsx($.IconChevronLeft,{size:H.DIAL_ICON_SIZE.SM,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}),next:r.jsx($.IconChevronRight,{size:H.DIAL_ICON_SIZE.SM,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"})},td=(e,t)=>{const s=(new Date(e,t,1).getDay()+6)%7,a=new Date(e,t,1-s);return Array.from({length:42},(o,i)=>{const l=new Date(a);return l.setDate(a.getDate()+i),l})},Nn=(e,t)=>!!e&&!!t&&e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),Dn=(e,t,n)=>{const s=new Date(e.getFullYear(),e.getMonth(),e.getDate());if(t){const a=new Date(t.getFullYear(),t.getMonth(),t.getDate());if(s<a)return!0}if(n){const a=new Date(n.getFullYear(),n.getMonth(),n.getDate());if(s>a)return!0}return!1},rd=(e,t)=>e.toLocaleDateString(t,{month:"long",year:"numeric"}),jn=(e,t)=>e.toLocaleDateString(t,{day:"numeric",month:"short",year:"numeric"}),nd=(e,t)=>e.toLocaleDateString(t,{weekday:"long",day:"numeric",month:"long",year:"numeric"}),_t=e=>`${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}`,Tn=(e,t)=>{const[n,s]=t.split(":").map(Number),a=new Date(e);return a.setHours(n||0,s||0,0,0),a},sd=e=>/^([01]\d|2[0-3]):[0-5]\d$/.test(e),ad=e=>{const t=e.replace(/\D/g,"").slice(0,4);let n=t.slice(0,2);const s=t.slice(2,4);if(n.length===2&&(n=String(Math.min(Number(n),23)).padStart(2,"0")),s.length===0)return n;const a=String(Math.min(Number(s),59)).padStart(s.length,"0");return`${n}:${a}`},Hs=5,Ks=e=>e.charAt(0).toUpperCase()+e.slice(1),od=e=>Array.from({length:7},(t,n)=>{const s=new Date(Date.UTC(1970,0,Hs+n));return Ks(s.toLocaleDateString(e,{weekday:"short",timeZone:"UTC"}))}),id=e=>Array.from({length:7},(t,n)=>{const s=new Date(Date.UTC(1970,0,Hs+n));return{value:String(n+1),label:Ks(s.toLocaleDateString(e,{weekday:"long",timeZone:"UTC"}))}}),wn=({id:e,disabled:t,invalid:n,trigger:s,panelClassName:a,fieldClassName:o,panel:i,labelledBy:l,panelLabel:c})=>{const d=O.useThemeScope(),[f,p]=g.useState(!1),{refs:h,floatingStyles:u,context:m}=se.useFloating({open:f,onOpenChange:D=>p(t?!1:D),placement:"bottom-start",whileElementsMounted:se.autoUpdate,middleware:[se.offset(8),se.flip({padding:8}),se.shift({padding:8})]}),C=se.useClick(m,{enabled:!t}),x=se.useDismiss(m),b=se.useRole(m,{role:"dialog"}),{getReferenceProps:y,getFloatingProps:N}=se.useInteractions([C,x,b]);return r.jsxs(r.Fragment,{children:[r.jsx("div",{id:e,ref:h.setReference,role:"button","aria-haspopup":"dialog","aria-expanded":f,"aria-disabled":t,"aria-labelledby":l,tabIndex:t?-1:0,className:S.mergeClasses(Fs,"focus-visible:outline focus-visible:outline-focus",n&&zs,t&&Bs,o),...y(),children:s}),f&&r.jsx(se.FloatingPortal,{children:r.jsx(se.FloatingFocusManager,{context:m,modal:!1,initialFocus:-1,returnFocus:!0,children:r.jsx("div",{ref:h.setFloating,style:u,"aria-label":c,className:S.mergeClasses(qc,d,a),...N(),children:i(()=>p(!1))})})})]})},En=({id:e,value:t,onChange:n,onBlur:s,disabled:a,invalid:o,className:i,ariaLabel:l,placeholder:c="--:--",timezoneLabel:d})=>{const[f,p]=g.useState(t);g.useEffect(()=>{p(t)},[t]);const h=r.jsx("input",{id:e,type:"text",inputMode:"numeric",autoComplete:"off","aria-label":l,placeholder:c,disabled:a,value:f,onChange:u=>{const m=ad(u.target.value);p(m),sd(m)&&n(m)},onBlur:s,className:S.mergeClasses(Fs,o&&zs,a&&Bs,i)});return d?r.jsxs("div",{className:"relative w-full",children:[h,r.jsx("span",{className:"dial-small-paragraph-text pointer-events-none absolute end-4 top-1/2 -translate-y-1/2 truncate text-secondary",children:d})]}):h},ld=({mode:e=Ne.Date,value:t,onChange:n,onBlur:s,labelProps:a,placeholder:o,disabled:i=!1,invalid:l=!1,id:c,className:d,minDate:f,maxDate:p,locale:h=Zc,fieldClassName:u,showTimezone:m=!1})=>{const C=o??Wc[e],x=t instanceof Date?t:null,b=g.useId(),y=c??b,N=a?.id??`${y}-label`,D=!!a?.label,I=typeof a?.label=="string"?a.label:void 0,j=D?`${N} ${y}`:void 0,L=a?r.jsx(k.Label,{...a,id:N,htmlFor:y}):null,[w,A]=g.useState(()=>x??new Date),E=g.useMemo(()=>new Date,[]),T=g.useMemo(()=>m?hs({locale:h}):null,[m,h]),R=g.useMemo(()=>od(h),[h]),B=g.useMemo(()=>id(h),[h]),K=g.useMemo(()=>td(w.getFullYear(),w.getMonth()),[w]),Q=U=>{A(Z=>new Date(Z.getFullYear(),Z.getMonth()+U,1))},V=(U,Z)=>{if(Dn(U,f,p))return;const le=e===Ne.DateTime&&x?Tn(U,_t(x)):U;n?.(le),e===Ne.Date&&Z()},F=U=>{n?.(Tn(x??new Date,U))},G=()=>x?e===Ne.DateTime?`${jn(x,h)}, ${_t(x)}`:jn(x,h):C;if(e===Ne.Time){const U=typeof t=="string"?t:x?_t(x):"";return r.jsxs("div",{className:S.mergeClasses("flex flex-col gap-y-3",d,O.DIAL_KIT_CLASS.calendar),children:[L,r.jsx(En,{id:y,value:U,onChange:Z=>n?.(Z),onBlur:s,disabled:i,invalid:l,placeholder:C,className:u,timezoneLabel:T})]})}if(e===Ne.Weekday){const U=typeof t=="string"?t:void 0,Z=B.find(le=>le.value===U);return r.jsxs("div",{className:S.mergeClasses("flex flex-col gap-y-3",d,O.DIAL_KIT_CLASS.calendar),children:[L,r.jsx(wn,{id:y,disabled:i,invalid:l,labelledBy:j,panelLabel:I??C,fieldClassName:u,trigger:r.jsxs(r.Fragment,{children:[r.jsx("span",{className:S.mergeClasses("truncate",!Z&&"text-secondary"),children:Z?.label??C}),r.jsx($.IconChevronDown,{size:H.DIAL_ICON_SIZE.MD,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true",className:$s})]}),panel:le=>r.jsx("div",{role:"listbox","aria-label":I??C,className:"flex flex-col gap-0.5",children:B.map(J=>r.jsx("button",{type:"button",role:"option","aria-selected":J.value===U,className:S.mergeClasses("flex w-full items-center rounded-lg px-3 py-2 text-left dial-small-text text-primary hover:bg-control-accent-alpha-hover","focus-visible:outline focus-visible:outline-focus",J.value===U&&"bg-control-accent-alpha-hover"),onClick:()=>{n?.(J.value),le()},children:J.label},J.value))})})]})}return r.jsxs("div",{className:S.mergeClasses("flex flex-col gap-y-3",d,O.DIAL_KIT_CLASS.calendar),children:[L,r.jsx(wn,{id:y,disabled:i,invalid:l,labelledBy:j,panelLabel:I??C,fieldClassName:u,trigger:r.jsxs(r.Fragment,{children:[r.jsx("span",{className:S.mergeClasses("truncate",!x&&"text-secondary"),children:G()}),ed]}),panel:U=>r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(k.StaticIconButton,{"aria-label":"Previous month",icon:In.prev,size:_.ElementSize.Small,onClick:()=>Q(-1)}),r.jsx("div",{className:"dial-small-semi-text text-primary","aria-live":"polite",children:rd(w,h)}),r.jsx(k.StaticIconButton,{"aria-label":"Next month",icon:In.next,size:_.ElementSize.Small,onClick:()=>Q(1)})]}),r.jsxs("div",{className:"grid grid-cols-7 gap-y-1 text-center",children:[R.map(Z=>r.jsx("div",{"aria-hidden":"true",className:"dial-tiny-text py-1 text-secondary",children:Z},Z)),K.map(Z=>{const le=Z.getMonth()!==w.getMonth(),J=Nn(Z,x),ie=Nn(Z,E),W=Dn(Z,f,p);return r.jsx("button",{type:"button",disabled:W,"aria-label":nd(Z,h),"aria-pressed":J,"aria-current":ie?"date":void 0,className:S.mergeClasses(Yc,le&&Qc,ie&&!J&&Jc,J&&Xc,W&&"cursor-not-allowed opacity-40 hover:bg-transparent"),onClick:()=>V(Z,U),children:Z.getDate()},Z.toISOString())})]}),e===Ne.DateTime&&r.jsxs("div",{className:"flex items-center justify-between gap-3 border-t border-secondary pt-3",children:[r.jsx("span",{className:"dial-small-text text-primary",children:"Time"}),r.jsx(En,{ariaLabel:"Time",value:x?_t(x):"",onChange:F,onBlur:s,className:"w-[120px] px-3 py-1.5"})]})]})})]})},cd=({segments:e,labelClassName:t="dial-small-text",leafClassName:n="dial-small-semi-text",className:s,ariaLabel:a="Folder path"})=>{const o=r.jsx(O.DialIcon,{icon:r.jsx($.IconFolder,{size:H.DIAL_ICON_SIZE.SM,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}),className:"text-secondary"}),i=e.map((l,c)=>({label:c===e.length-1?r.jsx("span",{className:n,children:l}):l,disabled:!0,...c===0?{iconBefore:o}:{}}));return r.jsx(v.DialBreadcrumb,{className:S.mergeClasses(s,O.DIAL_KIT_CLASS.folderPath),ariaLabel:a,separator:r.jsx(O.DialIcon,{icon:r.jsx($.IconChevronRight,{size:14,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true",className:"rtl:scale-x-[-1]"}),className:"text-secondary"}),pathItems:i,labelClassName:S.mergeClasses(t,"text-secondary","!cursor-default")})};var nt=(e=>(e.Small="small",e.Heading="heading",e))(nt||{});const dd="w-full overflow-hidden",ud="flex min-w-0 flex-nowrap items-center gap-2 whitespace-nowrap",On="flex min-w-0 items-center gap-2",An={[nt.Small]:"dial-small-text",[nt.Heading]:"dial-h2-text"},fd={[nt.Small]:"dial-small-semi-text",[nt.Heading]:"dial-h2-text"},pd={first:"shrink-0",middle:"min-w-0 max-w-[30%] shrink",last:"min-w-0 max-w-[51%] shrink"},hd="flex min-w-0 flex-1 items-center gap-1 rounded-sm transition-colors",md="text-secondary hover:text-accent focus-visible:outline focus-visible:outline-offset-2 focus-visible:outline-focus",gd="cursor-default text-primary",xd="cursor-default text-secondary",_n="inline-flex flex-none items-center leading-none text-secondary",bd="dial-kit-minimum-target flex shrink-0 items-center rounded-sm text-secondary transition-colors hover:text-accent focus-visible:outline focus-visible:outline-offset-2 focus-visible:outline-focus",Cd=3,yd=4,vd=r.jsx($.IconChevronRight,{size:H.DIAL_ICON_SIZE.SM,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true",className:"rtl:scale-x-[-1]"}),Sd=({items:e,maxVisibleItems:t=yd,size:n=nt.Small,separator:s=vd,ariaLabel:a="Breadcrumb",overflowAriaLabel:o="Show hidden path segments",className:i,itemClassName:l})=>{const c=Math.max(t,Cd),d=g.useMemo(()=>e.length>c?e.slice(1,-(c-2)):[],[e,c]),f=g.useMemo(()=>d.map((m,C)=>({key:String(C),label:m.label,icon:m.icon})),[d]),p=g.useCallback(({key:m,domEvent:C})=>{const x=d[Number(m)];x&&(x.onClick?.(C),!x.onClick&&x.href&&!C.defaultPrevented&&(window.location.href=x.href))},[d]);if(e.length===0)return null;const h=e.slice(d.length+1),u=(m,{index:C,isFirst:x,isCurrent:b})=>{const y=!b&&(!!m.href||!!m.onClick),N=S.mergeClasses(hd,y?md:b?S.mergeClasses(gd,fd[n]):xd,l,O.DIAL_KIT_CLASS.breadcrumbsItem),D=r.jsxs(r.Fragment,{children:[m.icon,r.jsx(k.EllipsisTooltip,{text:m.label})]});return r.jsxs("li",{className:S.mergeClasses(On,An[n],pd[b?"last":x?"first":"middle"]),children:[y?m.href?r.jsx("a",{href:m.href,onClick:m.onClick,className:N,children:D}):r.jsx("button",{type:"button",onClick:m.onClick,className:N,children:D}):r.jsx("span",{className:N,"aria-current":b?"page":void 0,children:D}),!b&&r.jsx("span",{className:_n,"aria-hidden":"true",children:s})]},`segment-${C}`)};return r.jsx("nav",{"aria-label":a,className:S.mergeClasses(dd,i,O.DIAL_KIT_CLASS.breadcrumbs),children:r.jsxs("ol",{className:ud,children:[u(e[0],{index:0,isFirst:!0,isCurrent:e.length===1}),d.length>0&&r.jsxs("li",{className:S.mergeClasses(On,An[n],"shrink-0"),children:[r.jsx(k.Dropdown,{items:f,onItemClick:p,placement:"bottom-start",matchReferenceWidth:!1,children:r.jsx("button",{type:"button","aria-label":o,className:bd,children:r.jsx($.IconDots,{size:H.DIAL_ICON_SIZE.SM,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"})})}),r.jsx("span",{className:_n,"aria-hidden":"true",children:s})]}),h.map((m,C)=>u(m,{index:e.length-h.length+C,isFirst:!1,isCurrent:C===h.length-1}))]})})},Id=({className:e,icon:t,tooltipProps:n,type:s="button",...a})=>{const o=S.mergeClasses("flex items-center justify-center rounded-full size-[40px]","dial-kit-enhanced-target","dial-kit-fab-button disabled:cursor-not-allowed focus-visible:outline focus-visible:outline-focus outline-offset-0",e),i=r.jsx("button",{...a,type:s,className:o,"aria-label":_.resolveAccessibleName(a["aria-label"],n?.tooltip),children:t||r.jsx($.IconArrowNarrowDown,{size:24,stroke:1.5,"aria-hidden":"true"})});return n?r.jsx(_.DialTooltip,{...n,children:i}):i},Nd=e=>r.jsx($.IconChevronDown,{size:H.DIAL_ICON_SIZE.SM,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":!0,className:S.mergeClasses("transition-transform",e&&"rotate-180")}),Dd=({variant:e,appearance:t,items:n,dropdownProps:s,...a})=>{const[o,i]=g.useState(!1),l=g.useMemo(()=>Nd(o),[o]);return r.jsx("div",{className:O.DIAL_KIT_CLASS.buttonDropdown,children:r.jsx(k.Dropdown,{...s,items:n,onOpenChange:c=>i(c),children:r.jsx(at,{...a,iconAfter:l,variant:e||_.ButtonVariant.Primary,appearance:t||_.ButtonAppearance.Solid,"aria-haspopup":"menu","aria-expanded":o})})})},Vs=({label:e,size:t,isOpen:n=!1,labelClassName:s,className:a,"aria-label":o,...i})=>{const l=t===_.ElementSize.Small?"h-[32px]":"h-[40px] dial-kit-enhanced-target";return r.jsxs("button",{type:"button",...i,"aria-haspopup":"menu","aria-expanded":n,"aria-label":o?`${o} ${e}`:void 0,className:S.mergeClasses("dial-small-paragraph-text px-3 focus-visible:outline focus-visible:outline-focus","flex items-center gap-1 rounded-full text-primary disabled:text-control-disable-primary","hover:bg-control-accent-alpha-hover focus-visible:outline-offset-2 active:bg-control-accent-alpha-active",l,a,O.DIAL_KIT_CLASS.inlineSelect),children:[r.jsx("span",{className:s,children:e}),r.jsx($.IconChevronDown,{size:H.DIAL_ICON_SIZE.MD,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":!0,className:S.mergeClasses("transition-transform",n&&"rotate-180")})]})},jd=({items:e,selectedKey:t,defaultSelectedKey:n,onSelect:s,size:a,disabled:o,placement:i="bottom-end",matchReferenceWidth:l=!1,listClassName:c,listStyle:d,ariaLabel:f,triggerClassName:p,triggerLabelClassName:h,open:u,onOpenChange:m})=>{const[C,x]=g.useState(!1),b=u!==void 0,y=b?u:C,N=g.useCallback(E=>{b||x(E),m?.(E)},[b,m]),[D,I]=g.useState(n??e[0]?.key),j=t!==void 0,L=j?t:D,w=g.useMemo(()=>{const E=e.find(T=>T.key===L);return E?.label?String(E.label):""},[e,L]),A=g.useCallback(({key:E})=>{const T=e.find(R=>R.key===E);T&&(j||I(E),s?.(T))},[e,j,s]);return r.jsx(k.Dropdown,{items:e,placement:i,matchReferenceWidth:l,listClassName:c,listStyle:d,disabled:o,open:b?u:void 0,onOpenChange:N,onItemClick:A,children:r.jsx(Vs,{label:w,size:a,isOpen:y,disabled:o,"aria-label":f,className:p,labelClassName:h})})},Td="z-popup flex items-center justify-center bg-backdrop md:p-4 gap-5 p-6",wd="relative flex w-full max-h-full flex-col rounded-xl bg-layer-raised md:h-auto",Ed="flex flex-row items-center justify-between px-6 py-4",Od="flex-1 min-w-0 mr-3 truncate dial-h1-text text-primary",Ad="border-b border-tertiary",_d="flex flex-row items-center gap-2 px-6 py-4",Ld="border-t border-tertiary",mr="flex shrink-0 flex-row items-center gap-2",kd={[v.PopupSize.Sm]:"max-w-full md:max-w-[400px]",[v.PopupSize.Md]:"max-w-full md:max-w-[800px]",[v.PopupSize.Lg]:"max-w-full md:max-w-[1200px]"},Vr=({open:e=!1,header:t,ariaLabel:n,portalId:s,className:a,overlayClassName:o,overlayStyle:i,titleClassName:l,headerClassName:c,bodyClassName:d,children:f,footer:p,footerClassName:h,onClose:u,onBack:m,backAriaLabel:C="Back",headerActions:x,headerDivider:b=!1,mainButtons:y,additionalButtons:N,additionalButtonsOnLeft:D=!1,footerDivider:I=!1,size:j=v.PopupSize.Md,hideClose:L=!1,closeAriaLabel:w="Close dialog",closeOnOutsideClick:A=!0,preventKeyboardOnOpen:E=!1})=>{const T=O.useThemeScope(),R=g.useRef(null),B=g.useId(),{refs:K,context:Q}=se.useFloating({open:e,onOpenChange:W=>{W||u?.(null)}}),V=se.useRole(Q,{role:"dialog"}),F=se.useDismiss(Q,{outsidePress:A}),{getFloatingProps:G}=se.useInteractions([V,F]);if(!e)return null;const U=typeof t=="string"?`popup-heading-${B}`:void 0,Z=W=>W?typeof W=="string"?r.jsx("h2",{id:U,className:S.mergeClasses(Od,l),children:r.jsx(k.Tooltip,{tooltip:W,triggerClassName:"truncate",children:W})}):W:r.jsx("span",{}),le=L?null:r.jsx(k.CloseButton,{ariaLabel:w,onClose:W=>u?.(W)}),J=(W,te=[])=>te.map(({variant:ae=_.ButtonVariant.Neutral,...ce},he)=>r.jsx(at,{variant:ae,...ce},`${W}-${he}`)),ie=()=>{if(p!==void 0)return p;if(!y?.length&&!N?.length)return null;const W=J("additional",N);return r.jsxs("div",{className:S.mergeClasses(_d,I&&Ld,h),children:[D&&W.length>0&&r.jsx("div",{className:mr,children:W}),r.jsxs("div",{className:S.mergeClasses(mr,"ml-auto"),children:[!D&&W,J("main",y)]})]})};return r.jsx(se.FloatingPortal,{id:s,children:r.jsx(se.FloatingOverlay,{style:i,className:S.mergeClasses(Td,T,o),children:r.jsx(se.FloatingFocusManager,{context:Q,initialFocus:E?R:K.floating,children:r.jsxs("div",{ref:K.setFloating,...G(),role:"dialog","aria-modal":"true","aria-labelledby":U,"aria-label":U?void 0:n,className:S.mergeClasses(wd,kd[j],a,O.DIAL_KIT_CLASS.popup),children:[E&&r.jsx("div",{ref:R,tabIndex:-1,"aria-hidden":!0,className:"absolute size-px -m-px overflow-hidden opacity-0 pointer-events-none"}),r.jsxs("div",{className:S.mergeClasses(Ed,b&&Ad,c),children:[m&&r.jsx(k.GhostIconButton,{"aria-label":C,size:_.ElementSize.Small,className:"mr-2",onClick:m,icon:r.jsx($.IconChevronLeft,{size:H.DIAL_ICON_SIZE.SM,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"})}),Z(t),x?r.jsxs("div",{className:mr,children:[x,le]}):le]}),r.jsx("div",{className:S.mergeClasses("grow overflow-auto",d),children:f}),ie()]})})})})},Rd="flex justify-end gap-2 px-6 py-4 border-t border-tertiary",Md="text-secondary dial-small-paragraph-text px-6 pb-4",Pd="px-6 py-4 h-[120px]",Fd="Cancel",Bd="Ok",Ln={[v.ConfirmationPopupVariant.Info]:{confirm:{variant:_.ButtonVariant.Primary,appearance:_.ButtonAppearance.Solid}},[v.ConfirmationPopupVariant.Danger]:{confirm:{variant:_.ButtonVariant.Danger,appearance:_.ButtonAppearance.Solid}}},Gs=({header:e,description:t,descriptionClassName:n,open:s=!1,confirmLabel:a=Bd,cancelLabel:o=Fd,isLoading:i=!1,disableConfirmButton:l=!1,className:c,confirmClassName:d,onClose:f,onConfirm:p,onCancel:h,children:u,variant:m=v.ConfirmationPopupVariant.Info,size:C=v.PopupSize.Sm,footer:x,hideClose:b,...y})=>{const N=i?null:r.jsxs("div",{className:Rd,children:[r.jsx(Fr,{label:o,onClick:()=>h?h():f?.()}),r.jsx(at,{variant:Ln[m].confirm.variant,appearance:Ln[m].confirm.appearance,className:d,label:a,disabled:l,onClick:p})]}),D=g.useCallback(()=>i?r.jsx("div",{className:Pd,children:r.jsx(v.Spinner,{size:40})}):u??(t?r.jsx("div",{className:S.mergeClasses(Md,n),children:t}):null),[u,t,i,n]);return r.jsx(Vr,{...y,open:s,header:e,className:S.mergeClasses(c,O.DIAL_KIT_CLASS.confirmationPopup),onClose:()=>f?.(),footer:x??N,size:C,hideClose:b??(!i&&x===void 0),children:D()})};var Ht=(e=>(e.Start="start",e.End="end",e))(Ht||{});const zd=({title:e,description:t,children:n,expanded:s,defaultExpanded:a=!1,disabled:o,nonCollapsible:i,ariaLabel:l,onToggle:c,caretPosition:d=Ht.End,className:f,headerClassName:p,contentClassName:h})=>{const u=s!==void 0,[m,C]=g.useState(a),x=i?!0:u?s:m,b=g.useId(),y=`accordion-header-${b}`,N=`accordion-content-${b}`,D=()=>{if(o)return;const A=!x;u||C(A),c?.(A)},I=d===Ht.Start,j=i?null:r.jsx($.IconChevronRight,{size:H.DIAL_ICON_SIZE.SM,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true",className:S.mergeClasses("shrink-0 text-secondary transition-transform motion-reduce:transition-none",x?"rotate-90":"rtl:rotate-180")}),L=r.jsxs(r.Fragment,{children:[I&&j,r.jsxs("span",{className:"flex min-w-0 flex-col",children:[r.jsx("span",{className:"truncate dial-body-text text-primary",children:e}),t?r.jsx("span",{className:"truncate dial-tiny-text text-secondary",children:t}):null]}),!I&&j]}),w=I?"justify-start gap-2":"justify-between";return r.jsxs("div",{className:S.mergeClasses("flex flex-col py-3 overflow-hidden bg-transparent",f,O.DIAL_KIT_CLASS.accordion),children:[i?r.jsx("div",{id:y,className:S.mergeClasses("flex w-full px-4 rounded-xl items-center dial-tiny-text",w,p),children:L}):r.jsx("button",{id:y,type:"button","aria-expanded":x,"aria-controls":N,"aria-label":_.resolveAccessibleName(l),disabled:o,onClick:D,className:S.mergeClasses("flex w-full px-4 rounded-xl items-center dial-tiny-text",w,o?"cursor-not-allowed opacity-75":"cursor-pointer hover:bg-control-accent-alpha-hover focus-visible:outline focus-visible:outline-focus",p),children:L}),r.jsx("div",{inert:!x,className:S.mergeClasses("grid transition-[grid-template-rows] duration-200 ease-out motion-reduce:transition-none",x?"grid-rows-[1fr]":"grid-rows-[0fr]"),children:r.jsx("div",{className:"min-h-0 overflow-hidden",children:r.jsx("div",{className:"pt-3",children:r.jsx("div",{id:N,role:"region","aria-labelledby":y,className:S.mergeClasses("px-4 dial-small-text text-primary",h),children:n})})})})]})},$d="dial-kit-input flex flex-row items-center justify-between gap-x-2 px-3 text-left",Hd="min-w-0 flex-1 truncate text-primary",Kd="min-w-0 flex-1 truncate text-secondary",Vd="shrink-0 text-secondary",Gd="px-6 pb-4",Ud="flex justify-end gap-2 px-6 py-4 border-t border-tertiary",Zd="Cancel",Wd="Apply",qd=({items:e,value:t,customValue:n,header:s,onApply:a,id:o,labelProps:i,placeholder:l,selectedValue:c,onSelectionChange:d,onCancel:f,onClose:p,isValid:h=!0,applyButtonLabel:u=Wd,cancelButtonLabel:m=Zd,size:C=v.PopupSize.Md,portalId:x,disabled:b,invalid:y,error:N,caption:D,ariaLabel:I,className:j,fieldClassName:L})=>{const w=g.useId(),A=o??w,E=`${A}-label`,T=`${A}-value`,R=N?`${A}-error`:void 0,B=!N&&D?`${A}-caption`:void 0,[K,Q]=g.useState(!1),V=c!==void 0,[F,G]=g.useState(t),U=V?c:F,Z=g.useCallback(()=>{b||(V||G(t),Q(!0))},[b,V,t]),le=g.useCallback(()=>{Q(!1),p?.()},[p]),J=g.useCallback(()=>{f?.(),le()},[f,le]),ie=g.useCallback(()=>{a(U),le()},[a,U,le]),W=g.useCallback(q=>{V||G(q),d?.(q)},[V,d]),te=_.resolveAccessibleName(i?.label),ae=te?void 0:_.resolveAccessibleName(I),ce=te?E:ae&&`${A}-name`,he=_.resolveAccessibleName(s),Se=e.find(q=>q.value===t)?.label,be=n??Se;return r.jsxs("div",{className:S.mergeClasses("flex w-full flex-col gap-2",j,O.DIAL_KIT_CLASS.radioGroupPopupField),children:[i&&r.jsx(k.Label,{...i,id:E,htmlFor:A}),r.jsxs("div",{className:"flex flex-col gap-1",children:[ae&&r.jsx("span",{id:ce,className:"sr-only",children:ae}),r.jsxs("button",{type:"button",id:A,disabled:b,"aria-haspopup":"dialog","aria-expanded":K,"aria-labelledby":ce?`${ce} ${T}`:void 0,"aria-describedby":[R,B].filter(Boolean).join(" ")||void 0,onClick:Z,className:S.mergeClasses($d,y&&"dial-kit-input-error",b&&"dial-kit-input-disable",L),children:[r.jsx("span",{id:T,className:be==null?Kd:Hd,children:be??l}),r.jsx($.IconMaximize,{size:H.DIAL_ICON_SIZE.MD,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true",className:Vd})]}),r.jsx(Be,{id:R,text:N}),!N&&r.jsx(qe,{id:B,text:D})]}),r.jsx(Vr,{open:K,header:s,ariaLabel:he?void 0:te,portalId:x,size:C,onClose:J,footer:r.jsxs("div",{className:Ud,children:[r.jsx(Fr,{label:m,onClick:J}),r.jsx(Os,{label:u,disabled:!h,onClick:ie})]}),children:r.jsx("div",{className:Gd,children:r.jsx(jt,{id:`${A}-options`,items:e,value:U,onChange:W,orientation:v.RadioGroupOrientation.Column,ariaLabel:te??he})})})]})},Yd=({icon:e,selectedIcon:t,isSelected:n=!1,onToggle:s,onClick:a,tooltipProps:o,size:i=_.ElementSize.Small,className:l,...c})=>{const d=g.useCallback(p=>{a?.(p),s?.(!n)},[a,s,n]),f=r.jsx(k.IconButton,{...c,size:i,variant:_.ButtonVariant.Primary,appearance:_.ButtonAppearance.Ghost,icon:n?t??e:e,"aria-pressed":n,"aria-label":_.resolveAccessibleName(c["aria-label"],o?.tooltip),onClick:d,className:S.mergeClasses("!rounded","[&_svg]:size-4",n&&"!text-accent",l,O.DIAL_KIT_CLASS.toggleIconButton)});return o?r.jsx(k.Tooltip,{asChild:!0,...o,children:f}):f},Xd=["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End"],Jd="inline-flex w-fit items-center gap-1 rounded-full border border-tertiary bg-layer-sunken p-[3px]",Qd="flex h-8 min-w-8 grow shrink-0 basis-auto items-center justify-center gap-2 whitespace-nowrap rounded-full px-4 dial-small-text transition-colors duration-200 outline-offset-0 focus-visible:outline focus-visible:outline-focus",eu="bg-layer-raised text-accent shadow-xs",tu="bg-transparent text-secondary",ru="cursor-pointer hover:bg-control-accent-alpha-hover active:bg-control-accent-alpha-active",nu="cursor-pointer hover:bg-control-accent-alpha-hover hover:text-accent active:bg-control-accent-alpha-active",su="cursor-not-allowed bg-control-disable-primary text-control-disable-primary shadow-none",au="cursor-not-allowed bg-transparent text-control-disable-primary",ou=({items:e,value:t,onChange:n,disabled:s,className:a,segmentClassName:o,"aria-label":i})=>{const l=g.useRef({}),c=e.find(p=>p.value===t),d=c&&!c.disabled?c.value:e.find(p=>!p.disabled)?.value,f=g.useCallback(p=>{if(s||!Xd.includes(p.key))return;const h=e.filter(b=>!b.disabled);if(h.length===0)return;const u=Math.max(h.findIndex(b=>b.value===t),0),m=h.length-1;let C=u;switch(p.key){case"ArrowRight":case"ArrowDown":C=u===m?0:u+1;break;case"ArrowLeft":case"ArrowUp":C=u===0?m:u-1;break;case"Home":C=0;break;case"End":C=m;break}p.preventDefault();const x=h[C];l.current[x.value]?.focus(),x.value!==t&&n(x.value)},[s,e,t,n]);return r.jsx("div",{role:"radiogroup","aria-label":i,"aria-disabled":s||void 0,onKeyDown:f,className:S.mergeClasses(Jd,a,O.DIAL_KIT_CLASS.segmentedControl),children:e.map(p=>{const h=p.value===t,u=s||p.disabled;return r.jsxs("button",{ref:m=>{l.current[p.value]=m},type:"button",role:"radio","aria-checked":h,"aria-label":_.resolveAccessibleName(p["aria-label"],typeof p.label=="string"?p.label:void 0),tabIndex:p.value===d?0:-1,disabled:u,onClick:()=>n(p.value),className:S.mergeClasses(Qd,h?eu:tu,u?h?su:au:h?ru:nu,o,O.DIAL_KIT_CLASS.segmentedControlItem),children:[p.icon,p.label]},p.value)})})},iu={[v.TabOrientation.Horizontal]:{next:"ArrowRight",previous:"ArrowLeft"},[v.TabOrientation.Vertical]:{next:"ArrowDown",previous:"ArrowUp"}},lu=({tabs:e,activeTabId:t,onTabChange:n,orientation:s=v.TabOrientation.Horizontal,sectionLabel:a,ariaLabel:o,className:i,tabListClassName:l,tabClassName:c,sectionLabelClassName:d})=>{const f=g.useRef({}),p=g.useId(),h=s===v.TabOrientation.Vertical,u=e.find(b=>b.id===t),m=u&&!u.disabled?u.id:e.find(b=>!b.disabled)?.id,C=g.useCallback(b=>{const{next:y,previous:N}=iu[s];if(![y,N,"Home","End"].includes(b.key)||e.length===0)return;const D=e.filter(A=>!A.disabled);if(D.length===0)return;const I=Math.max(D.findIndex(A=>A.id===t),0),j=D.length-1;let L=I;b.key===y?L=I===j?0:I+1:b.key===N?L=I===0?j:I-1:b.key==="Home"?L=0:L=j,b.preventDefault();const w=D[L];f.current[w.id]?.focus(),w.id!==t&&n(w.id)},[e,t,n,s]),x=r.jsx("div",{role:"tablist","aria-orientation":h?"vertical":void 0,"aria-label":o,"aria-labelledby":!o&&a?p:void 0,onKeyDown:C,className:S.mergeClasses(h?"flex flex-col gap-1 px-2":"flex justify-start gap-1",!a&&i,l,O.DIAL_KIT_CLASS.tabList,!a&&O.DIAL_KIT_CLASS.tabs),children:e.map(b=>{const y=t===b.id,N=!!b.disabled;return r.jsxs("button",{ref:D=>{f.current[b.id]=D},type:"button",role:"tab","aria-selected":y,disabled:N,tabIndex:b.id===m?0:-1,onClick:()=>n(b.id),className:S.mergeClasses("dial-kit-enhanced-target flex items-center gap-2 text-start","transition-colors motion-reduce:transition-none","focus-visible:outline focus-visible:outline-focus",h?["h-11 w-full rounded-lg px-3 desktop:h-10","focus-visible:-outline-offset-1",y?"dial-small-semi-text":"dial-small-text text-secondary"]:["dial-small-paragraph-semi-text border-b-2 border-transparent px-3 py-2","focus-visible:outline-offset-2"],N&&(h?"cursor-not-allowed text-control-disable-primary":"cursor-not-allowed border-control-disable-primary text-control-disable-primary"),!N&&(h?y?"bg-control-accent-alpha text-accent hover:bg-control-accent-alpha-hover":"hover:bg-control-accent-alpha-hover":y?"dial-kit-tab-selected-underline text-primary":"border-transparent text-secondary"),c,O.DIAL_KIT_CLASS.tab,y&&O.DIAL_KIT_CLASS.tabSelected),children:[b.icon&&r.jsx("span",{"aria-hidden":"true",className:"flex shrink-0",children:b.icon}),r.jsx("span",{className:S.mergeClasses(h&&!y&&!N&&"text-primary"),children:b.label}),b.count!=null&&r.jsx("span",{className:S.mergeClasses("dial-tiny-semi-text rounded-full px-1.5 py-0.5",h&&"ms-auto",N&&"bg-layer-sunken text-control-disable-primary",!N&&(y?"bg-control-accent-alpha text-accent":"bg-layer-sunken text-secondary")),children:b.count})]},b.id)})});return a?r.jsxs("div",{className:S.mergeClasses("flex flex-col gap-3",i,O.DIAL_KIT_CLASS.tabs),children:[r.jsx("div",{className:S.mergeClasses("flex h-16 shrink-0 items-center",h?"px-4":"px-3"),children:r.jsx("span",{id:p,className:S.mergeClasses("dial-h1-text text-primary",d,O.DIAL_KIT_CLASS.tabsSectionLabel),children:a})}),x]}):x},cu="flex flex-nowrap items-center gap-1",du="min-w-max flex-1 justify-center",uu=({items:e,value:t,onChange:n,stretch:s=!1,className:a,chipClassName:o,"aria-label":i,"aria-labelledby":l})=>r.jsx("div",{role:"group","aria-label":i,"aria-labelledby":l,className:S.mergeClasses(cu,a,O.DIAL_KIT_CLASS.filterChips),children:e.map(c=>r.jsx(Re,{label:c.label,icon:c.icon,appearance:rt.Selectable,selected:c.value===t,onClick:()=>n(c.value),className:S.mergeClasses(s&&du,o)},c.value))}),Dr=(e,t)=>{const n=(t??"").split(",").map(o=>o.trim().toLowerCase()).filter(Boolean);if(n.length===0)return!0;const s=e.name.toLowerCase(),a=e.type.toLowerCase();return n.some(o=>{if(o.startsWith("."))return s.endsWith(o);if(o.endsWith("/*")){const i=o.slice(0,-1);return a.length>i.length&&a.startsWith(i)}return a===o})},fu=({labelProps:e,label:t,description:n,onChange:s,onReject:a,accept:o,multiple:i=!1,disabled:l=!1,errorText:c,icon:d,id:f,ariaLabel:p,className:h})=>{const u=g.useId(),m=f??`file-dropzone-${u}`,C=c?`${m}-error`:void 0,[x,b]=g.useState(!1),y=g.useRef(0),N=g.useCallback(E=>{if(E.length===0)return;const T=i?E:E.slice(0,1),R=T.filter(K=>Dr(K,o)),B=T.filter(K=>!Dr(K,o));B.length>0&&a?.(B),R.length>0&&s(R)},[o,i,s,a]),D=g.useCallback(E=>{N(Array.from(E.target.files??[])),E.target.value=""},[N]),I=g.useCallback(()=>{y.current=0,b(!1)},[]),j=g.useCallback(E=>{l||(E.preventDefault(),y.current+=1,b(!0))},[l]),L=g.useCallback(E=>{l||(E.preventDefault(),E.dataTransfer.dropEffect="copy")},[l]),w=g.useCallback(()=>{l||(y.current-=1,y.current<=0&&I())},[l,I]),A=g.useCallback(E=>{E.preventDefault(),!l&&(I(),N(Array.from(E.dataTransfer?.files??[])))},[l,I,N]);return r.jsxs("div",{className:"flex flex-col gap-1",children:[e&&r.jsx(k.Label,{...e,htmlFor:m}),r.jsx("input",{id:m,type:"file",accept:o,multiple:i,disabled:l,onChange:D,"aria-label":_.resolveAccessibleName(typeof t!="string"?p:void 0),"aria-describedby":C,"aria-invalid":c?!0:void 0,className:"peer sr-only"}),r.jsxs("label",{htmlFor:m,onDragEnter:j,onDragOver:L,onDragLeave:w,onDrop:A,className:S.mergeClasses("flex flex-col items-center justify-center gap-3 rounded-xl border border-dashed px-6 py-10 text-center","transition-colors motion-reduce:transition-none","peer-focus-visible:outline peer-focus-visible:outline-offset-2 peer-focus-visible:outline-focus",l?"cursor-not-allowed border-secondary bg-layer-sunken":"cursor-pointer bg-layer-base",!l&&x&&"border-accent bg-control-accent-alpha",!l&&!x&&"border-secondary hover:border-accent",c&&!x&&"border-error hover:border-error",h,O.DIAL_KIT_CLASS.fileDropzone),children:[d??r.jsx($.IconUpload,{size:H.DIAL_ICON_SIZE.LG,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true",className:l?"text-control-disable-primary":"text-secondary"}),r.jsxs("span",{className:"flex flex-col gap-1",children:[r.jsx("span",{className:S.mergeClasses("dial-small-text",l?"text-control-disable-primary":"text-primary"),children:t}),n&&r.jsx("span",{className:S.mergeClasses("dial-tiny-text",l?"text-control-disable-primary":"text-secondary"),children:n})]})]}),r.jsx(Be,{id:C,text:c})]})},Us=({label:e="Shared",tooltip:t,size:n=12,className:s})=>r.jsx(k.Tooltip,{tooltip:t||"Shared",asChild:!0,children:r.jsx("span",{role:"img","aria-label":e,className:S.mergeClasses("flex shrink-0 rounded-sm bg-layer-raised text-accent",s,O.DIAL_KIT_CLASS.sharedEntityIndicator),children:r.jsx($.IconArrowUpRight,{size:n,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"})})});var Ee=(e=>(e.Images="images",e.Video="video",e.Audio="audio",e.Code="code",e.Text="text",e.Pdf="pdf",e.Spreadsheet="spreadsheet",e.Presentation="presentation",e.Archive="archive",e.Dial="dial",e.Other="other",e))(Ee||{});const pu={images:["apng","avif","bmp","gif","heic","heif","ico","jpeg","jpg","png","svg","tif","tiff","webp"],video:["avi","flv","m4v","mkv","mov","mp4","mpeg","mpg","ogv","webm","wmv"],audio:["aac","aiff","flac","m4a","mid","midi","mp3","oga","ogg","opus","wav","wma"],code:["bash","c","cjs","cpp","cs","css","go","h","hpp","htm","html","ini","ipynb","java","js","json","jsx","kt","less","lua","mjs","php","ps1","py","r","rb","rs","sass","scala","scss","sh","sql","svelte","swift","toml","ts","tsx","vue","xml","yaml","yml","zsh"],text:["doc","docx","log","markdown","md","odt","rtf","text","txt"],pdf:["pdf"],spreadsheet:["csv","numbers","ods","tsv","xls","xlsm","xlsx"],presentation:["key","odp","pps","ppsx","ppt","pptx"],archive:["7z","bz2","gz","rar","tar","tgz","xz","zip"],dial:["dial"]},hu=new Map(Object.entries(pu).flatMap(([e,t])=>t.map(n=>[n,e]))),mu=e=>hu.get(e)??"other",kn="var(--text-control-permanent, #FCFCFC)",Lt={x1:"20.4167",y1:"-3.33333",x2:"2.5",y2:"20",from:"var(--bg-visual-blue, #D6EDF9)",to:"var(--stroke-gradient-1, #5976E9)"},gu="#1B212D",xu={[Ee.Images]:{path:"M11.0002 8.66667H11.0036M7.00024 11.3333L8.66691 9.66667C8.97624 9.369 9.35758 9.369 9.66691 9.66667L11.3336 11.3333M10.6669 10.6667L11.0002 10.3333C11.3096 10.0357 11.6909 10.0357 12.0002 10.3333L13.0002 11.3333M7.00024 8C7.00024 7.73478 7.1056 7.48043 7.29314 7.29289C7.48067 7.10536 7.73503 7 8.00024 7H12.0002C12.2655 7 12.5198 7.10536 12.7074 7.29289C12.8949 7.48043 13.0002 7.73478 13.0002 8V12C13.0002 12.2652 12.8949 12.5196 12.7074 12.7071C12.5198 12.8946 12.2655 13 12.0002 13H8.00024C7.73503 13 7.48067 12.8946 7.29314 12.7071C7.1056 12.5196 7.00024 12.2652 7.00024 12V8Z",sheet:Lt},[Ee.Code]:{path:"M8.33358 8.66665L7.00024 9.99998L8.33358 11.3333M11.6669 8.66665L13.0002 9.99998L11.6669 11.3333M10.6669 7.33331L9.33358 12.6666",sheet:{x1:"16.6667",y1:"0",x2:"2.08333",y2:"20.4167",from:"var(--bg-control-inverted, #57647A)",to:gu}},[Ee.Text]:{path:"M7.3335 8H12.6668M7.3335 10H12.6668M7.3335 12H11.3335",sheet:{x1:"25.8333",y1:"-11.6667",x2:"2.5",y2:"20",from:"var(--bg-visual-violet-1, #DDE3F9)",to:"var(--bg-gradient-1, #1D4ED8)"}},[Ee.Spreadsheet]:{path:"M7.33325 10.1667H12.6666M9.99992 7.5V12.8333M7.33325 8.16667C7.33325 7.98986 7.40349 7.82029 7.52851 7.69526C7.65354 7.57024 7.82311 7.5 7.99992 7.5H11.9999C12.1767 7.5 12.3463 7.57024 12.4713 7.69526C12.5963 7.82029 12.6666 7.98986 12.6666 8.16667V12.1667C12.6666 12.3435 12.5963 12.513 12.4713 12.6381C12.3463 12.7631 12.1767 12.8333 11.9999 12.8333H7.99992C7.82311 12.8333 7.65354 12.7631 7.52851 12.6381C7.40349 12.513 7.33325 12.3435 7.33325 12.1667V8.16667Z",sheet:{x1:"20.4167",y1:"-3.75",x2:"2.91667",y2:"20.4167",from:"var(--bg-visual-green-1, #CDE8E5)",to:"var(--text-visual-green-1, #059669)"}},[Ee.Pdf]:{fillPath:"M12.5373 10.3151C12.0382 10.3151 11.4137 10.4021 11.2094 10.4328C10.3637 9.54967 10.1231 9.04771 10.069 8.91388C10.1423 8.72544 10.3975 8.0096 10.4338 7.09022C10.4517 6.62991 10.3544 6.28596 10.1447 6.06792C9.93533 5.85024 9.68191 5.83331 9.60924 5.83331C9.35443 5.83331 8.92697 5.96216 8.92697 6.82503C8.92697 7.5737 9.27603 8.36813 9.37252 8.57339C8.86416 10.0536 8.31837 11.0669 8.20248 11.2753C6.15974 12.0444 6 12.788 6 12.9988C6 13.3775 6.26973 13.6036 6.72152 13.6036C7.8192 13.6036 8.8209 11.7607 8.98653 11.4407C9.76614 11.1301 10.8096 10.9377 11.0749 10.8918C11.8357 11.6166 12.7157 11.81 13.0811 11.81C13.3561 11.81 14 11.81 14 11.148C14 10.5332 13.2121 10.3151 12.5373 10.3151ZM12.4844 10.7497C13.0773 10.7497 13.234 10.9458 13.234 11.0494C13.234 11.1145 13.2093 11.3268 12.8915 11.3268C12.6065 11.3268 12.1145 11.1621 11.6303 10.8047C11.8322 10.7782 12.131 10.7497 12.4844 10.7497ZM9.57812 6.25458C9.63218 6.25458 9.66777 6.27195 9.69711 6.31264C9.86764 6.54926 9.73014 7.32242 9.56279 7.92745C9.40124 7.40867 9.28 6.61264 9.45058 6.33259C9.48392 6.27793 9.52204 6.25458 9.57812 6.25458ZM9.29017 10.8856C9.50483 10.452 9.74542 9.81997 9.87646 9.46253C10.1387 9.90147 10.4914 10.309 10.6954 10.53C10.0603 10.6639 9.57969 10.7976 9.29017 10.8856ZM6.4264 13.0566C6.41226 13.0399 6.41017 13.0045 6.42083 12.9621C6.44317 12.8731 6.61396 12.4322 7.84924 11.8796C7.67236 12.1582 7.39585 12.5563 7.09208 12.8537C6.87825 13.0538 6.71174 13.1553 6.59719 13.1553C6.55621 13.1553 6.49974 13.1442 6.4264 13.0566Z",sheet:{x1:"26.25",y1:"-11.6667",x2:"2.5",y2:"20",from:"var(--bg-visual-red, #FCE7F3)",to:"var(--bg-control-error-active, #CC4545)"}},[Ee.Audio]:{path:"M9 11.5C9 11.7652 8.89464 12.0195 8.70711 12.2071C8.51957 12.3946 8.26522 12.5 8 12.5C7.73478 12.5 7.48043 12.3946 7.29289 12.2071C7.10536 12.0195 7 11.7652 7 11.5C7 11.2347 7.10536 10.9804 7.29289 10.7929C7.48043 10.6053 7.73478 10.5 8 10.5C8.26522 10.5 8.51957 10.6053 8.70711 10.7929C8.89464 10.9804 9 11.2347 9 11.5ZM9 11.5V7.16663H12.3333V11.5M12.3333 11.5C12.3333 11.7652 12.228 12.0195 12.0404 12.2071C11.8529 12.3946 11.5985 12.5 11.3333 12.5C11.0681 12.5 10.8138 12.3946 10.6262 12.2071C10.4387 12.0195 10.3333 11.7652 10.3333 11.5C10.3333 11.2347 10.4387 10.9804 10.6262 10.7929C10.8138 10.6053 11.0681 10.5 11.3333 10.5C11.5985 10.5 11.8529 10.6053 12.0404 10.7929C12.228 10.9804 12.3333 11.2347 12.3333 11.5ZM9 8.49996H12.3333",sheet:Lt},[Ee.Video]:{path:"M9.99996 13.1667C11.8409 13.1667 13.3333 11.6743 13.3333 9.83333C13.3333 7.99238 11.8409 6.5 9.99996 6.5C8.15901 6.5 6.66663 7.99238 6.66663 9.83333C6.66663 11.6743 8.15901 13.1667 9.99996 13.1667ZM9.33337 8.5L11.3334 9.83333L9.33337 11.1667V8.5Z",sheet:Lt},[Ee.Presentation]:{path:"M7 7.33331H13M7.33333 7.33331V10.6666C7.33333 10.8435 7.40357 11.013 7.5286 11.1381C7.65362 11.2631 7.82319 11.3333 8 11.3333H12C12.1768 11.3333 12.3464 11.2631 12.4714 11.1381C12.5964 11.013 12.6667 10.8435 12.6667 10.6666V7.33331M10 11.3333V12.6666M9 12.6666H11M8.66667 9.99998L9.66667 8.99998L10.3333 9.66665L11.3333 8.66665",sheet:{x1:"24.5",y1:"-9.5",x2:"2.5",y2:"20",from:"var(--bg-visual-brown, #FDE8D8)",to:"var(--text-visual-brown-2, #B45309)"}},[Ee.Archive]:{path:"M10.0001 6.66669H9.58341M10.8334 7.451H10.4167M10.0001 8.23531H9.58341M10.8334 9.01963H10.4167M10.0001 9.80394H9.58341M10.8334 10.5883H10.4167M10.0001 11.3726C10.2211 11.3726 10.4331 11.4552 10.5893 11.6023C10.7456 11.7494 10.8334 11.9489 10.8334 12.1569V12.9412C10.8334 13.0452 10.7895 13.1449 10.7114 13.2185C10.6332 13.292 10.5273 13.3334 10.4167 13.3334H9.58341C9.47291 13.3334 9.36693 13.292 9.28879 13.2185C9.21065 13.1449 9.16675 13.0452 9.16675 12.9412V12.1569C9.16675 11.9489 9.25455 11.7494 9.41083 11.6023C9.56711 11.4552 9.77907 11.3726 10.0001 11.3726Z",sheet:{x1:"24.5",y1:"-9.5",x2:"2.5",y2:"20",from:"var(--bg-visual-green-1, #CDE8E5)",to:"var(--text-visual-green-3, #065F46)"}},[Ee.Dial]:{path:"M8.26392 7.44049C8.80816 7.44049 9.28449 7.50578 9.69653 7.63092L9.69849 7.6319C10.1079 7.75343 10.4556 7.938 10.7463 8.1817L10.7483 8.18365C11.0312 8.41601 11.2537 8.72491 11.4104 9.12115V9.12213C11.5666 9.51456 11.6496 9.98403 11.6497 10.5381C11.6497 11.5957 11.3539 12.3492 10.8108 12.8565C10.2602 13.3708 9.47204 13.6504 8.39868 13.6505H6.71313V7.44049H8.26392Z",fillPath:"M12.7167 12.1008L12.9558 12.3564L12.9558 12.3564L12.7167 12.1008ZM11.4504 6.20825L11.3486 6.54311L11.3507 6.54375L11.4504 6.20825ZM12.637 6.833L12.4119 7.10109L12.4147 7.10334L12.637 6.833ZM13.4108 7.9263L13.0853 8.05488L13.0856 8.05566L13.4108 7.9263ZM11.1666 12.8853L11.0909 12.5436V12.5436L11.1666 12.8853ZM10.4391 12.6553C10.2487 12.689 10.1217 12.8706 10.1553 13.0609C10.189 13.2513 10.3706 13.3783 10.5609 13.3447L10.5 13L10.4391 12.6553ZM13.6781 9.49291H13.3281C13.3281 10.5655 13.0283 11.33 12.4776 11.8451L12.7167 12.1008L12.9558 12.3564C13.687 11.6724 14.0281 10.6984 14.0281 9.49291H13.6781ZM7.9751 6.12805H8.3251C8.3251 6.24476 8.23053 6.35 8.1009 6.35V6V5.65C7.83231 5.65 7.6251 5.86989 7.6251 6.12805H7.9751ZM8.1009 6V6.35H9.89799V6V5.65H8.1009V6ZM9.89799 6V6.35C10.449 6.35 10.9312 6.41618 11.3486 6.54311L11.4504 6.20825L11.5522 5.87339C11.0566 5.72265 10.5039 5.65 9.89799 5.65V6ZM11.4504 6.20825L11.3507 6.54375C11.7654 6.66701 12.1173 6.85376 12.4119 7.10107L12.637 6.833L12.862 6.56492C12.4875 6.2506 12.0484 6.02084 11.5501 5.87275L11.4504 6.20825ZM12.637 6.833L12.4147 7.10334C12.7016 7.33926 12.9264 7.65273 13.0853 8.05488L13.4108 7.9263L13.7363 7.79772C13.5387 7.29746 13.2477 6.88206 12.8593 6.56265L12.637 6.833ZM13.4108 7.9263L13.0856 8.05566C13.2441 8.45409 13.3281 8.93071 13.3281 9.49291H13.6781H14.0281C14.0281 8.86239 13.934 8.29465 13.736 7.79694L13.4108 7.9263ZM7.9751 7.21882H8.3251V6.12805H7.9751H7.6251V7.21882H7.9751ZM12.7167 12.1008L12.4776 11.8451C12.117 12.1824 11.6591 12.4177 11.0909 12.5436L11.1666 12.8853L11.2423 13.227C11.9168 13.0776 12.4923 12.7898 12.9558 12.3564L12.7167 12.1008ZM11.1666 12.8853L11.0909 12.5436C11.091 12.5435 11.0826 12.5452 11.0606 12.5493C11.041 12.5528 11.0155 12.5573 10.9857 12.5625C10.926 12.5729 10.8511 12.5857 10.7756 12.5984C10.6269 12.6236 10.472 12.6495 10.4391 12.6553L10.5 13L10.5609 13.3447C10.6064 13.3366 11.1725 13.2425 11.2423 13.227L11.1666 12.8853Z",sheet:"var(--bg-gradient-2, #885DF2)"},[Ee.Other]:{path:"M6.80005 8H13.2M6.80005 10.2222H13.2M6.80005 12.4444H13.2",sheet:Lt}},bu=({size:e,kind:t})=>{const n=`dial-kit-file-gradient-${g.useId().replace(/[^\w-]/g,"")}`,{path:s,fillPath:a,sheet:o}=xu[t],i=typeof o=="string";return r.jsxs("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[r.jsx("path",{d:"M17.4999 3.97859V16C17.4999 18.2091 15.709 20 13.4999 20H6.5C4.29086 20 2.5 18.2091 2.5 16V4C2.5 1.79086 4.29086 0 6.5 0H13.1683H13.5213C15.7186 0 17.4999 1.78128 17.4999 3.97859Z",fill:i?o:`url(#${n})`}),s&&r.jsx("path",{d:s,stroke:kn,strokeWidth:"0.7",strokeLinecap:"round",strokeLinejoin:"round"}),a&&r.jsx("path",{d:a,fill:kn}),!i&&r.jsx("defs",{children:r.jsxs("linearGradient",{id:n,x1:o.x1,y1:o.y1,x2:o.x2,y2:o.y2,gradientUnits:"userSpaceOnUse",children:[r.jsx("stop",{stopColor:o.from}),r.jsx("stop",{offset:"1",stopColor:o.to})]})})]})},Cu=({size:e})=>{const t=`dial-kit-folder-gradient-${g.useId().replace(/[^\w-]/g,"")}`;return r.jsxs("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[r.jsx("path",{d:"M6.38992 3.75H4.66663C3.00977 3.75 1.66663 5.09315 1.66663 6.75V7.91667H7.16339L10.8333 5.79247L7.85075 4.1297C7.40412 3.8807 6.90127 3.75 6.38992 3.75Z",fill:"var(--stroke-gradient-1, #5976E9)"}),r.jsx("path",{d:"M14.3333 5.41669C16.5424 5.41669 18.3333 7.20755 18.3333 9.41669V12.25C18.3333 14.4592 16.5424 16.25 14.3333 16.25H5.66663C3.45749 16.25 1.66663 14.4592 1.66663 12.25V7.6708C1.66663 7.11851 2.11434 6.6708 2.66663 6.6708H6.89447C7.43998 6.6708 7.97973 6.55922 8.48053 6.34291L9.86582 5.74458C10.3666 5.52827 10.9064 5.41669 11.4519 5.41669H14.3333Z",fill:`url(#${t})`}),r.jsx("defs",{children:r.jsxs("linearGradient",{id:t,x1:"17.0833",y1:"5.83335",x2:"9.38489",y2:"19.6653",gradientUnits:"userSpaceOnUse",children:[r.jsx("stop",{stopColor:"var(--stroke-secondary, #D1DBEA)"}),r.jsx("stop",{offset:"0.91",stopColor:"var(--stroke-gradient-1, #5976E9)"})]})})]})},yu=(e,t)=>(t??(e.includes(".")?e.split(".").pop():"")??"").trim().replace(/^\./,"").toLowerCase(),vu=(e,t)=>e===v.DialItemType.Folder?"Folder":t?`${t.toUpperCase()} file`:"File",Su=(e,t,n)=>e===v.DialItemType.Folder?r.jsx(Cu,{size:n}):r.jsx(bu,{size:n,kind:mu(t)}),Gr=({type:e,name:t,fileExtension:n,shared:s=!1,loading:a=!1,size:o=H.DIAL_ICON_SIZE.MD,className:i,decorative:l=!1,label:c,loadingLabel:d="Loading",sharedIndicatorClassName:f,sharedIndicatorTooltip:p})=>{if(e!==v.DialItemType.File&&e!==v.DialItemType.Folder)return null;const h=e===v.DialItemType.File?yu(t,n):"",u=vu(e,h),m=c??(s?`${u}, shared`:u),C=l?{"aria-hidden":!0}:a?{}:{role:"img","aria-label":m};return r.jsxs("span",{className:S.mergeClasses("relative inline-flex shrink-0 items-center justify-center text-secondary",i,O.DIAL_KIT_CLASS.fileIcon),...C,children:[a?r.jsx(v.Spinner,{size:o,ariaLabel:d}):Su(e,h,o),s&&r.jsx(Us,{tooltip:p,className:S.mergeClasses("absolute -bottom-0.5 -left-0.5",f)})]})},Zs=({name:e,type:t=v.DialItemType.File,fileExtension:n,shared:s=!1,loading:a=!1,loadingLabel:o,iconSize:i,details:l,isInvalidName:c=!1,className:d,nameClassName:f,sharedIndicatorClassName:p,sharedIndicatorTooltip:h,sharedLabel:u="Shared",hideTooltip:m=!1,tooltipContent:C})=>r.jsxs("div",{className:S.mergeClasses("flex w-full min-w-0 items-center gap-2",d,O.DIAL_KIT_CLASS.fileName),children:[r.jsx(Gr,{name:e,type:t,fileExtension:n,shared:s,loading:a,loadingLabel:o,size:i,sharedIndicatorClassName:p,sharedIndicatorTooltip:h,decorative:!a}),r.jsxs("div",{className:S.mergeClasses("flex min-w-0 flex-1",{"flex-col gap-1":!!l}),children:[r.jsx(k.EllipsisTooltip,{className:S.mergeClasses("dial-small-paragraph-text",c?"text-secondary":"text-primary",f),text:e,hideTooltip:m,customTooltipContent:C}),s&&r.jsx("span",{className:"sr-only",children:u}),l]})]}),Iu=({className:e,...t})=>r.jsx(Zs,{...t,type:v.DialItemType.Folder,className:S.mergeClasses(e,O.DIAL_KIT_CLASS.folderName)}),Nu=({open:e,onClose:t,title:n,ariaLabel:s,onBack:a,backAriaLabel:o="Back",closeAriaLabel:i="Close",closeOnOutsideClick:l=!0,children:c,className:d,overlayClassName:f,headerClassName:p,style:h,overlayStyle:u,bodyClassName:m,titleClassName:C,portalId:x})=>{const b=O.useThemeScope(),y=`bottom-sheet-title-${g.useId()}`,{refs:N,context:D}=se.useFloating({open:e,onOpenChange:w=>{w||t()}}),I=se.useRole(D,{role:"dialog"}),j=se.useDismiss(D,{outsidePress:l}),{getFloatingProps:L}=se.useInteractions([I,j]);return e?r.jsx(se.FloatingPortal,{id:x,children:r.jsx(se.FloatingOverlay,{lockScroll:!0,style:u,className:S.mergeClasses("z-popup flex items-end bg-backdrop",b,f),children:r.jsx(se.FloatingFocusManager,{context:D,initialFocus:N.floating,children:r.jsxs("div",{ref:N.setFloating,...L(),role:"dialog","aria-modal":"true","aria-labelledby":n?y:void 0,"aria-label":n?void 0:s,style:h,className:S.mergeClasses("flex max-h-[85dvh] w-full flex-col rounded-t-lg bg-layer-raised outline-none","animate-slideUp motion-reduce:animate-none",d,O.DIAL_KIT_CLASS.bottomSheet),children:[n&&r.jsxs("div",{className:S.mergeClasses("relative flex h-[60px] shrink-0 items-center justify-center border-b border-tertiary px-14",p),children:[a&&r.jsx(k.GhostIconButton,{"aria-label":o,className:"absolute start-4",onClick:a,icon:r.jsx($.IconArrowLeft,{size:H.DIAL_ICON_SIZE.LG,stroke:ne.DIAL_KIT_ICON_STROKE,className:"rtl:-scale-x-100","aria-hidden":"true"})}),r.jsx("h2",{id:y,className:S.mergeClasses("min-w-0 truncate text-primary",C??"dial-body-semi-text"),children:n}),r.jsx(k.CloseButton,{ariaLabel:i,onClose:t,size:_.ElementSize.Standard,className:"absolute end-4"})]}),r.jsx("div",{className:S.mergeClasses("min-h-0 overflow-y-auto",m),children:c})]})})})}):null};var We=(e=>(e.Outlined="outlined",e.Filled="filled",e))(We||{}),He=(e=>(e.Blue="blue",e.Green="green",e.Violet="violet",e.Indigo="indigo",e.Brown="brown",e.Red="red",e))(He||{});const Du={[He.Blue]:"bg-blue text-blue",[He.Green]:"bg-green-2 text-green-1",[He.Violet]:"bg-violet-2 text-violet-1",[He.Indigo]:"bg-violet-1 text-violet-2",[He.Brown]:"bg-brown text-brown-2",[He.Red]:"bg-red text-red"},ju={[We.Outlined]:"rounded-md border border-tertiary bg-layer-sunken text-secondary",[We.Filled]:"rounded-full"},Tu={[We.Outlined]:"dial-tiny-text",[We.Filled]:"dial-caption-lead-semi-text"},wu=({label:e,variant:t=We.Outlined,color:n=He.Blue,icon:s,textClassName:a,className:o,...i})=>r.jsxs("span",{...i,className:S.mergeClasses("inline-flex h-6 w-fit shrink-0 items-center gap-1 whitespace-nowrap px-2",ju[t],t===We.Filled&&Du[n],o,O.DIAL_KIT_CLASS.badge),children:[s&&r.jsx("span",{className:"flex shrink-0 items-center","aria-hidden":"true",children:s}),r.jsx("span",{className:a??Tu[t],children:e})]});var ut=(e=>(e.Circle="circle",e.Square="square",e))(ut||{});const Rn=[{background:"bg-green-1",foreground:"text-green-2"},{background:"bg-violet-2",foreground:"text-violet-1"},{background:"bg-brown",foreground:"text-brown-2"},{background:"bg-red",foreground:"text-red"},{background:"bg-green-2",foreground:"text-green-3"},{background:"bg-blue",foreground:"text-accent"},{background:"bg-violet-1",foreground:"text-violet-2"}],Eu=e=>{let t=0;for(let n=0;n<e.length;n++)t+=e.charCodeAt(n);return Rn[t%Rn.length]},Mn=e=>e.match(new RegExp("\\p{L}","u"))?.[0]??"",Ws=e=>{const t=e.trim().split(/\s+/).filter(Boolean);return t.length===0?"?":t.length>=2?(Mn(t[0])+Mn(t[1])).toUpperCase()||"?":t[0].replace(/[^\p{L}]/gu,"").slice(0,2).toUpperCase()||"?"},Ou={[ut.Circle]:"rounded-full",[ut.Square]:"rounded-md"},qs=({name:e,initials:t,src:n,alt:s="",size:a=32,shape:o=ut.Circle,className:i,textClassName:l,onImageError:c})=>{const[d,f]=g.useState(),p=!!n&&d!==n,h=s!=="",u=x=>S.mergeClasses("inline-flex shrink-0 select-none items-center justify-center overflow-hidden",Ou[o],x,i,O.DIAL_KIT_CLASS.avatar);if(p)return r.jsx("img",{src:n,alt:s,width:a,height:a,className:S.mergeClasses(u(),"object-cover"),onError:x=>{f(n),c?.(x)}});const{background:m,foreground:C}=Eu(e);return r.jsx("span",{role:h?"img":void 0,"aria-label":h?s:void 0,"aria-hidden":h?void 0:!0,className:u(S.mergeClasses(m,C)),style:{width:a,height:a,fontSize:l?void 0:Math.round(a*.4)},children:r.jsx("span",{className:S.mergeClasses("leading-none",l??"font-semibold"),children:t??Ws(e)})})};var xe=(e=>(e.Model="model",e.Agent="agent",e.Toolset="toolset",e.Skill="skill",e.Prompt="prompt",e))(xe||{});const Au={[xe.Model]:"Model",[xe.Agent]:"Agent",[xe.Toolset]:"Toolset",[xe.Skill]:"Skill",[xe.Prompt]:"Prompt"},Pn={[xe.Model]:"text-blue",[xe.Agent]:"text-green-1",[xe.Toolset]:"text-brown-2",[xe.Skill]:"text-violet-1",[xe.Prompt]:"text-violet-2"},_u={[xe.Model]:"bg-blue",[xe.Agent]:"bg-green-2",[xe.Toolset]:"bg-brown",[xe.Skill]:"bg-violet-2",[xe.Prompt]:"bg-violet-1"},Lu=["h1","h2","h3","h4","h5","h6"],ku=e=>Lu[Math.min(6,Math.max(1,Math.round(e)))-1],Ru=({item:e,labels:t,showVersion:n=!0,hasFeaturedTag:s=!0,iconSize:a=48,headingLevel:o=3,query:i,footer:l,statusBadge:c,className:d,nameClassName:f="dial-h3-text",typeClassName:p="dial-caption-lead-semi-text",versionClassName:h="dial-tiny-text",iconClassName:u,featuredChipClassName:m})=>{const C=ku(o),x=s&&!!e.isFeatured,b=c!=null||x,y=n?e.version:void 0;return r.jsxs("div",{className:S.mergeClasses("flex items-start gap-2",d,O.DIAL_KIT_CLASS.entityIdentity),children:[r.jsx(qs,{name:e.name,src:e.iconUrl,size:a,shape:ut.Square,className:S.mergeClasses("rounded-[14px]",u)}),r.jsxs("div",{className:S.mergeClasses("flex min-w-0 flex-1 flex-col gap-1",l!=null&&"self-stretch"),children:[r.jsxs("div",{className:"relative flex items-center justify-between",children:[r.jsx("span",{className:S.mergeClasses("uppercase",p,Pn[e.type]),children:t?.type??Au[e.type]}),b&&r.jsxs("div",{className:"absolute end-0 top-[-6px] flex items-center gap-2",children:[c,x&&r.jsx("span",{className:S.mergeClasses("flex h-6 items-center justify-center rounded-2xl px-2","dial-caption-lead-semi-text",_u[e.type],Pn[e.type],m),children:t?.featured??"Featured"})]})]}),r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.jsx(C,{className:S.mergeClasses("min-w-0 shrink text-primary",f),children:i?r.jsx(Ps,{text:e.name,query:i,maxLines:1}):r.jsx(k.EllipsisTooltip,{text:e.name})}),y!=null&&r.jsx(k.EllipsisTooltip,{className:S.mergeClasses("max-w-[30%] shrink-0 text-secondary",h),text:y})]}),l!=null&&r.jsx("div",{className:"mt-auto pt-1",children:l})]})]})},Mu=({open:e,onClose:t,header:n,ariaLabel:s,headerActions:a,onBack:o,backAriaLabel:i="Back",backDisabled:l=!1,closeAriaLabel:c="Close",closeDisabled:d=!1,hideClose:f=!1,closeOnOutsideClick:p=!0,children:h,className:u,overlayClassName:m,headerClassName:C,style:x,overlayStyle:b,bodyClassName:y,titleClassName:N,portalId:D})=>{const I=O.useThemeScope(),j=`side-drawer-title-${g.useId()}`,L=typeof n=="string",{refs:w,context:A}=se.useFloating({open:e,onOpenChange:K=>{K||t()}}),E=se.useRole(A,{role:"dialog"}),T=se.useDismiss(A,{outsidePress:p}),{getFloatingProps:R}=se.useInteractions([E,T]),B=n!=null||o!=null||!f;return r.jsx(se.FloatingPortal,{id:D,children:r.jsx(se.FloatingOverlay,{lockScroll:e,style:b,className:S.mergeClasses("z-popup bg-backdrop transition-opacity duration-300 motion-reduce:transition-none",e?"opacity-100":"pointer-events-none opacity-0",I,m),children:r.jsx(se.FloatingFocusManager,{context:A,disabled:!e,initialFocus:w.floating,children:r.jsxs("div",{ref:w.setFloating,...R(),role:"dialog","aria-modal":"true","aria-labelledby":L?j:void 0,"aria-label":L?void 0:s,inert:!e,style:x,className:S.mergeClasses("fixed inset-y-0 end-0 flex w-full flex-col overflow-hidden bg-layer-raised outline-none","desktop:w-[540px] desktop:rounded-s-xl desktop:border-s desktop:border-secondary","transition-transform duration-300 motion-reduce:transition-none",e?"translate-x-0":"translate-x-full rtl:-translate-x-full",u,O.DIAL_KIT_CLASS.sideDrawer),children:[B&&r.jsxs("div",{className:S.mergeClasses("flex shrink-0 items-center gap-2 border-b border-tertiary px-6 py-3",C),children:[o&&r.jsx(k.GhostIconButton,{"aria-label":i,disabled:l,onClick:o,icon:r.jsx($.IconChevronLeft,{size:H.DIAL_ICON_SIZE.MD,stroke:ne.DIAL_KIT_ICON_STROKE,className:"rtl:-scale-x-100","aria-hidden":"true"})}),L?r.jsx("h2",{id:j,className:S.mergeClasses("min-w-0 flex-1 truncate text-primary",N??"dial-h2-text"),children:n}):r.jsx("div",{className:"min-w-0 flex-1",children:n}),a,!f&&r.jsx(k.CloseButton,{ariaLabel:c,onClose:t,disabled:d,size:_.ElementSize.Standard})]}),r.jsx("div",{className:S.mergeClasses("min-h-0 flex-1 overflow-y-auto",y),children:h})]})})})})},Pu=4,Fu=24,Fn=e=>parseFloat(e)||0,Bu=e=>{let t=e.length;for(;t>0&&e[t-1]===",";)t--;return e.slice(0,t)},zu=()=>{},$u=({id:e,value:t,defaultValue:n,size:s=_.ElementSize.Standard,labelProps:a,placeholder:o,caption:i,error:l,invalid:c,disabled:d=!1,readOnly:f=!1,collapseTagOverflow:p=!1,ariaLabel:h,tagListLabel:u="Tags",className:m,fieldClassName:C,tagClassName:x,onChange:b})=>{const y=g.useId(),N=e||y,D=s===_.ElementSize.Small,I=g.useRef(null),j=g.useRef([]),L=g.useRef(null),w=t!==void 0,[A,E]=g.useState(n??[]),T=w?t:A,R=T.length,[B,K]=g.useState(""),[Q,V]=g.useState(R),F=!f&&!d,G=g.useCallback(q=>{w||E(q),b?.(q)},[w,b]),U=g.useCallback(q=>ee=>{j.current[q]=ee},[]),Z=g.useCallback(()=>{const q=I.current;if(!q||q.clientWidth===0){V(T.length);return}const{paddingLeft:ee,paddingRight:Te}=getComputedStyle(q);V(Es({availableWidth:q.clientWidth-Fn(ee)-Fn(Te)-(f?0:Fu),tagWidths:T.map((Le,ge)=>j.current[ge]?.offsetWidth??0),overflowChipWidth:L.current?.offsetWidth??0,gap:Pu}))},[f,T]);g.useEffect(()=>{if(!p){V(R);return}const q=I.current;if(!q)return;const ee=new ResizeObserver(()=>Z());return ee.observe(q),Z(),()=>ee.disconnect()},[p,Z,R]);const le=S.mergeClasses(p?"shrink-0":"min-w-0",x),J=q=>{const ee=Bu(q.trim()).trim();!ee||T.includes(ee)||G([...T,ee])},ie=q=>{G(T.filter(ee=>ee!==q))},W=()=>{J(B),K("")},te=q=>{if(F){if(q.key==="Enter"||q.key===","){q.preventDefault(),W();return}q.key==="Backspace"&&!B&&R>0&&(q.preventDefault(),G(T.slice(0,-1)))}},ae=()=>{F&&B.trim()&&W()},ce=p?T.slice(0,Q):T,he=p?T.slice(Q):[],Se=he.join(", "),be=R>0&&r.jsxs("span",{role:"list","aria-label":u,className:S.mergeClasses("relative flex min-w-0 items-center gap-1",p?"flex-nowrap":"flex-wrap"),children:[ce.map(q=>r.jsx(Re,{role:"listitem",label:q,className:le,disabled:d,closable:F,onRemove:F?()=>ie(q):void 0},q)),he.length>0&&r.jsx(Re,{role:"listitem",label:`+${he.length}`,"aria-label":Se,title:Se,className:S.mergeClasses("shrink-0",x),disabled:d}),p&&r.jsxs("span",{"aria-hidden":"true",className:"pointer-events-none invisible absolute left-0 top-0 h-0 overflow-hidden whitespace-nowrap",children:[T.map((q,ee)=>r.jsx("span",{ref:U(ee),className:"inline-flex",children:r.jsx(Re,{label:q,className:x,disabled:d,closable:F,onRemove:F?zu:void 0})},q)),r.jsx("span",{ref:L,className:"inline-flex",children:r.jsx(Re,{label:`+${R}`,className:x})})]})]});return r.jsx(Ae,{id:N,size:s,labelProps:a,caption:i,error:l,invalid:c,disabled:d,readOnly:f,value:B,placeholder:R>0?void 0:o,"aria-label":h,wrapperRef:I,onChange:q=>K(q??""),onKeyDown:te,onBlur:ae,containerClassName:S.mergeClasses("w-full",m),wrapperClassName:S.mergeClasses(R>0&&["!h-auto",D?"min-h-[24px] py-0.5":"min-h-[40px] py-[3px]",p?"flex-nowrap overflow-hidden":"flex-wrap"],C,O.DIAL_KIT_CLASS.tagInput),className:S.mergeClasses("w-auto flex-1",p?"min-w-[24px]":"min-w-[100px]",f&&"cursor-default"),children:be})},Hu=(e,t,n,s)=>{const a=t.trim().toLowerCase(),o=new Set(n);return e.filter(({value:i,label:l,description:c})=>!o.has(i)&&[l,i,c].some(d=>d?.toLowerCase().includes(a))).slice(0,Math.max(s,0))},Ku=5,Vu=({id:e,value:t,defaultValue:n,suggestions:s,maxSuggestions:a=Ku,openOnFocus:o=!1,size:i=_.ElementSize.Standard,labelProps:l,placeholder:c,caption:d,error:f,invalid:p=!1,disabled:h=!1,readOnly:u=!1,ariaLabel:m,tagListLabel:C="Tags",getRemoveTagLabel:x,className:b,fieldClassName:y,tagClassName:N,listClassName:D,onChange:I})=>{const j=g.useId(),L=e||j,w=`${L}-listbox`,A=O.useThemeScope(),E=i===_.ElementSize.Small,T=t!==void 0,[R,B]=g.useState(n??[]),K=T?t:R,Q=K.length>0,V=!u&&!h,[F,G]=g.useState(""),[U,Z]=g.useState(!1),[le,J]=g.useState(0),ie=!F.trim(),W=g.useMemo(()=>Hu(s,F,K,o&&ie?s.length:a),[F,ie,a,o,s,K]),te=U&&V&&W.length>0,ae=Math.min(le,W.length-1),ce=te&&ae>=0,he=X=>`${w}-option-${X}`,{refs:Se,floatingStyles:be}=se.useFloating({open:te,placement:"bottom-start",whileElementsMounted:se.autoUpdate,middleware:[se.offset(k.overlayGap),se.flip({padding:k.overlayGap}),se.size({padding:k.overlayGap,apply({rects:X,availableHeight:ue,elements:fe}){fe.floating.style.width=`${Math.round(X.reference.width)}px`,fe.floating.style.maxHeight=`${Math.floor(ue)}px`}})]}),q=g.useCallback(X=>{T||B(X),I?.(X)},[T,I]),ee=()=>{Z(!1),J(0)},Te=()=>{!o||!V||(Z(!0),J(ie?-1:0))},Le=X=>{const ue=X.trim();ue&&!K.includes(ue)&&q([...K,ue]),G(""),o?J(-1):ee()},ge=X=>q(K.filter(ue=>ue!==X)),$e=X=>{const ue=X??"",fe=!!ue.trim();G(ue),Z(fe||o),J(fe?0:-1)},Ye=X=>{if(V)switch(X.key){case"ArrowDown":case"ArrowUp":{if(X.preventDefault(),!te){Z(!0),J(0);return}const ue=X.key==="ArrowDown"?1:-1,fe=ae<0?Math.min(-ue,0):ae;J((fe+ue+W.length)%W.length);return}case"Enter":case",":X.preventDefault(),Le(ce?W[ae].value:F);return;case"Escape":te&&X.preventDefault(),ee();return;case"Backspace":!F&&Q&&(X.preventDefault(),q(K.slice(0,-1)));return}},me=X=>X.preventDefault();return r.jsxs(r.Fragment,{children:[r.jsx(Ae,{id:L,role:"combobox","aria-autocomplete":"list","aria-expanded":te,"aria-controls":w,"aria-activedescendant":ce?he(ae):void 0,"aria-invalid":p||void 0,"aria-label":m,size:i,labelProps:l,caption:d,error:f,invalid:p,disabled:h,readOnly:u,value:F,placeholder:Q?void 0:c,wrapperRef:Se.setReference,onChange:$e,onKeyDown:Ye,onFocus:Te,onClick:Te,onBlur:ee,containerClassName:S.mergeClasses("w-full",b),wrapperClassName:S.mergeClasses(Q&&["!h-auto flex-wrap gap-1 py-2",E?"min-h-[24px]":"min-h-[40px]"],y,O.DIAL_KIT_CLASS.autocompleteTagInput),className:S.mergeClasses("w-auto min-w-[100px] flex-1",u&&"cursor-default"),children:Q&&r.jsx("span",{role:"list","aria-label":C,className:"flex min-w-0 flex-wrap items-center gap-1",children:K.map(X=>r.jsx(Re,{role:"listitem",label:X,className:S.mergeClasses($t,"min-w-0",N),disabled:h,closable:V,removeLabel:x?.(X),onRemove:V?()=>ge(X):void 0},X))})}),r.jsx(se.FloatingPortal,{children:r.jsx("div",{ref:Se.setFloating,id:w,role:"listbox","aria-label":C,hidden:!te,style:be,className:S.mergeClasses("z-floating overflow-y-auto",k.overlaySurfaceClassName,k.overlayListClassName,!te&&"hidden",A,D),children:te&&W.map((X,ue)=>{const fe=ue===ae;return r.jsx(k.MenuItem,{id:he(ue),role:"option","aria-selected":fe,tabIndex:-1,label:X.label,description:X.description,mark:k.MenuItemMark.Tint,selected:fe,onMouseDown:me,onMouseEnter:()=>J(ue),onClick:()=>Le(X.value)},X.value)})})})]})},Gu={[_.ElementSize.Small]:H.DIAL_ICON_SIZE.SM,[_.ElementSize.Standard]:H.DIAL_ICON_SIZE.MD,[_.ElementSize.Large]:H.DIAL_ICON_SIZE.MD},Uu=({size:e=_.ElementSize.Standard,placeholder:t="Search...",withoutBorder:n=!1,clearLabel:s="Clear search",disabled:a,value:o,onChange:i,wrapperClassName:l,inputRef:c,...d})=>{const f=g.useRef(null),p=se.useMergeRefs([c,f]),h=!!o&&!a,u=g.useCallback(()=>{i?.(void 0),f.current?.focus()},[i]);return r.jsx(Ae,{...d,size:e,value:o,disabled:a,onChange:i,placeholder:t,inputRef:p,wrapperClassName:S.mergeClasses(n&&"dial-kit-input-borderless",l,O.DIAL_KIT_CLASS.search),iconBefore:r.jsx($.IconSearch,{size:Gu[e],stroke:ne.DIAL_KIT_ICON_STROKE,className:"text-secondary","aria-hidden":"true"}),iconAfter:h?r.jsx(k.GhostIconButton,{size:_.ElementSize.Small,"aria-label":s,icon:r.jsx($.IconX,{size:H.DIAL_ICON_SIZE.SM,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}),onClick:u}):void 0})},Zu=(e,t)=>{if(e<=0||t<=0)return[];const n=Math.floor(e/t+1e-9);return Array.from({length:n},(s,a)=>(a+1)*t/e*100)},Ys=e=>(e.toString().split(".")[1]??"").length,Wu=(e,t,n,s)=>{const a=Math.min(n,Math.max(t,e));if(s<=0)return a;const o=Math.round(Number(((a-t)/s).toFixed(9))),i=t+o*s;return Number(Math.min(n,i).toFixed(Ys(s)))},qu=12,Bn=e=>`calc(${e}% + ${(.5-e/100)*qu}px)`,Yu=(e,t)=>e&&t?"grid-cols-[auto_minmax(0,1fr)_auto]":e?"grid-cols-[auto_minmax(0,1fr)]":t?"grid-cols-[minmax(0,1fr)_auto]":"grid-cols-[minmax(0,1fr)]",Xu=({id:e,value:t,min:n=0,max:s=1,step:a=.1,disabled:o,labelProps:i,labels:l,formatValue:c,showValue:d=!1,showTooltip:f=!1,showTicks:p=!1,leftContent:h,rightContent:u,showValueInput:m=!1,valueInputAriaLabel:C,caption:x,error:b,onChange:y,containerClassName:N,trackClassName:D,fillClassName:I,className:j,...L})=>{const w=g.useId(),A=e??w,E=x&&!b?`${A}-caption`:void 0,T=b?`${A}-error`:void 0,R=s-n,B=R>0?Math.min(100,Math.max(0,(t-n)/R*100)):0,K=Bn(B),Q=p&&!o?Zu(R,a):[],V=f&&!o,F=h!=null,G=m||u!=null,U=Ys(a),[Z,le]=g.useState(null),J=c?c(t):t.toFixed(U),ie=g.useCallback(ae=>{y?.(Number(ae.target.value))},[y]),W=g.useCallback(ae=>{const ce=ae==null?"":String(ae);le(ce);const he=Number(ce);ce!==""&&Number.isFinite(he)&&y?.(Wu(he,n,s,a))},[s,n,y,a]),te=g.useCallback(()=>le(null),[]);return r.jsxs("div",{className:S.mergeClasses("flex flex-col gap-2",N),children:[(i||d)&&r.jsxs("div",{className:"flex items-center gap-2",children:[i&&r.jsx(k.Label,{...i,htmlFor:A}),d&&r.jsx("span",{"aria-hidden":"true",className:S.mergeClasses("dial-small-text ml-auto",o?"text-control-disable-primary":"text-primary"),children:J})]}),r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsxs("div",{className:S.mergeClasses("grid items-center gap-y-1",m?"gap-x-2":"gap-x-3",Yu(F,G),V&&"mt-2"),children:[F&&r.jsx("div",{className:"flex items-center",children:h}),r.jsxs("div",{className:"relative flex h-6 items-center",children:[r.jsx("div",{className:S.mergeClasses("pointer-events-none absolute inset-x-0 h-1 rounded-full",o?"bg-control-disable-primary":"bg-control-accent-muted",D)}),Q.map(ae=>r.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute size-0.5 -translate-x-1/2 rounded-full border border-accent-focus",style:{left:Bn(ae)}},ae)),r.jsx("div",{className:S.mergeClasses("pointer-events-none absolute left-0 h-1 rounded-full",o?"bg-control-disable-secondary":"bg-control-accent",I),style:{width:K}}),V&&r.jsxs("span",{"aria-hidden":"true",className:"pointer-events-none absolute bottom-full mb-0.5 flex -translate-x-1/2 flex-col items-center",style:{left:K},children:[r.jsx("span",{className:"whitespace-nowrap rounded-md bg-control-inverted px-2 py-0.5 dial-small-text text-control-inverted shadow-xs",children:J}),r.jsx("svg",{width:"8",height:"4",viewBox:"0 0 8 4",className:"fill-control-inverted",children:r.jsx("path",{d:"M0 0h8L4 4z"})})]}),r.jsx("input",{...L,type:"range",id:A,value:t,min:n,max:s,step:a,disabled:o,onChange:ie,"aria-label":_.resolveAccessibleName(typeof i?.label!="string"?L["aria-label"]:void 0),"aria-valuetext":c?J:void 0,"aria-describedby":T??E,className:S.mergeClasses("dial-kit-slider absolute inset-0 h-full w-full",j)})]}),G&&r.jsx("div",{className:"flex items-center",children:m?r.jsx(Hr,{"aria-label":_.resolveAccessibleName(C??(typeof i?.label=="string"?i.label:void 0)),value:Z??t.toFixed(U),min:n,max:s,step:a,disabled:o,size:_.ElementSize.Small,containerClassName:"w-12",className:"text-center",onChange:W,onBlur:te}):u}),l&&r.jsx("div",{className:S.mergeClasses("dial-tiny-text flex text-secondary",F&&"col-start-2"),children:l.length===3?r.jsxs(r.Fragment,{children:[r.jsx("span",{children:l[0]}),r.jsx("span",{className:"flex-1 text-center",children:l[1]}),r.jsx("span",{children:l[2]})]}):r.jsxs(r.Fragment,{children:[r.jsx("span",{children:l[0]}),r.jsx("span",{className:"ml-auto",children:l[1]})]})})]}),r.jsx(Be,{id:T,text:b}),!b&&r.jsx(qe,{id:E,text:x})]})]})},Ju=48,Qu=({children:e,title:t,width:n=280,collapsedWidth:s=Ju,isOpened:a,defaultOpened:o=!0,onToggle:i,additionalButtons:l,ariaLabel:c="Sidebar",collapseLabel:d="Collapse sidebar",expandLabel:f="Expand sidebar",className:p,titleClassName:h,contentClassName:u,footerClassName:m})=>{const C=a!==void 0,[x,b]=g.useState(o),y=C?a:x,N=`collapsible-sidebar-content-${g.useId()}`,D=y?d:f,I=j=>{const L=!y;C||b(L),i?.(L,j)};return r.jsxs("aside",{"aria-label":c,style:{width:`${y?n:s}px`},className:S.mergeClasses("flex flex-col justify-between",p,O.DIAL_KIT_CLASS.collapsibleSidebar),children:[r.jsx("div",{id:N,hidden:!y,className:S.mergeClasses("min-h-0 flex-1 overflow-auto p-4",u),children:e}),r.jsx("div",{hidden:y,className:S.mergeClasses("rotate-180 px-3 py-4 [writing-mode:tb-rl] dial-small-text text-primary",h),children:t}),r.jsxs("div",{className:S.mergeClasses("flex h-12 shrink-0 flex-row items-center gap-2 border-t border-tertiary py-1",y?"justify-end px-2":"justify-center",m),children:[y&&l,r.jsx(k.IconButton,{variant:_.ButtonVariant.Primary,appearance:_.ButtonAppearance.Ghost,size:_.ElementSize.Standard,onClick:I,"aria-label":D,"aria-expanded":y,"aria-controls":N,tooltipProps:{tooltip:D},icon:y?r.jsx($.IconChevronsLeft,{size:H.DIAL_ICON_SIZE.MD,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}):r.jsx($.IconChevronsRight,{size:H.DIAL_ICON_SIZE.MD,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"})})]})]})},ef=({side:e,isResizing:t,width:n,minWidth:s,maxWidth:a,step:o,ariaLabel:i,onWidthChange:l,customHandler:c,handlerClassName:d})=>{const f=e===v.ResizableContainerSide.Left,p=f?$.IconChevronLeft:$.IconChevronRight,h=u=>{let m;switch(u.key){case"ArrowLeft":m=n+(f?o:-o);break;case"ArrowRight":m=n+(f?-o:o);break;case"Home":m=s;break;case"End":m=a;break;default:return}u.preventDefault(),l(m)};return r.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":i,"aria-valuenow":n,"aria-valuemin":s,"aria-valuemax":a,tabIndex:0,onKeyDown:h,className:S.mergeClasses("relative h-full w-0.5 cursor-col-resize bg-control-accent text-accent","opacity-0 transition-opacity motion-reduce:transition-none","group-hover:opacity-100 focus-visible:opacity-100","focus-visible:outline focus-visible:outline-offset-2 focus-visible:outline-focus",t&&"opacity-100",d),children:c??r.jsx(p,{size:H.DIAL_ICON_SIZE.MD,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true",className:S.mergeClasses("pointer-events-none absolute top-1/2 -translate-y-1/2",f?"right-full":"left-full")})})},tf=16,Xs=({children:e,minWidth:t,maxWidth:n,width:s,defaultWidth:a,onResizeStop:o,onResize:i,side:l=v.ResizableContainerSide.Right,keyboardStep:c=tf,ariaLabel:d="Resize panel",className:f,resizeHandlerClassName:p,resizeHandler:h})=>{const[u,m]=g.useState(!1),[C,x]=g.useState(a??t),b=s!==void 0,y=b?s:C,N=g.useRef(null),D=g.useCallback(()=>{m(!0)},[]),I=g.useCallback(()=>{m(!1);const w=N.current?.resizable?.getBoundingClientRect(),A=w?Math.round(w.width):t;b||x(A),o?.(A)},[o,b,t]),j=g.useCallback(w=>{const A=Math.min(n,Math.max(t,w));A!==y&&(b||(x(A),N.current?.updateSize({width:A,height:"100%"})),i?.(A),o?.(A))},[n,t,y,b,i,o]),L=g.useMemo(()=>{const w=l===v.ResizableContainerSide.Left,A=r.jsx(ef,{side:l,isResizing:u,width:y,minWidth:t,maxWidth:n,step:c,ariaLabel:d,onWidthChange:j,customHandler:h,handlerClassName:p});return{size:b?{width:y,height:"100%"}:void 0,defaultSize:b?void 0:{width:y,height:"100%"},minWidth:t,maxWidth:n,enable:{left:w,right:!w},handleClasses:{right:"group",left:"group"},handleStyles:{right:{right:"-8px",zIndex:10},left:{left:0,zIndex:10}},handleComponent:{left:w?A:void 0,right:w?void 0:A},onResizeStart:D,onResize:(E,T,R)=>{i?.(Math.round(R.offsetWidth))},onResizeStop:I}},[l,b,y,t,n,c,d,j,h,p,u,D,I,i]);return r.jsx(v.Resizable,{ref:N,...L,children:r.jsx("div",{className:S.mergeClasses("group flex size-full flex-col bg-layer-raised transition-all motion-reduce:transition-none",f,O.DIAL_KIT_CLASS.resizableContainer),children:e})})},rf=({enabled:e=!0,children:t,...n})=>e?r.jsx(Xs,{...n,children:t}):t;var _e=(e=>(e.InProgress="inProgress",e.Success="success",e.Warning="warning",e.Failed="failed",e.Canceled="canceled",e))(_e||{});const Js=8e3,Tt="flex size-7 shrink-0 items-center justify-center",Qs={cancelItemAriaLabel:e=>`Cancel "${e}"`,itemProgressAriaLabel:e=>`"${e}" in progress`,successLabel:"Completed",canceledLabel:"Canceled",failedMessage:"Failed",warningMessage:"Completed with warnings",queueProgressAriaLabel:"Progress",queueProgressValueText:(e,t)=>`${e} of ${t}`,collapseAriaLabel:"Collapse",expandAriaLabel:"Expand",closeAriaLabel:"Close",closeConfirmHeader:"Close?",closeConfirmDescriptionInProgress:"Some items are still in progress.",closeConfirmDescriptionFailed:"Some items have failed.",closeConfirmDescriptionMixed:"Some items are still in progress, and some have failed.",closeConfirmLabel:"Close",closeCancelLabel:"Cancel"},nf=({title:e,failedCount:t,isCollapsed:n,itemsId:s,labels:a,onToggleCollapse:o,onClose:i})=>{const l=n?$.IconChevronUp:$.IconChevronDown;return r.jsxs("div",{className:"mx-4 flex items-center justify-between border-b border-tertiary py-3",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.jsx("span",{className:"dial-small-paragraph-semi-text truncate text-primary",children:e}),t>0&&r.jsx("span",{className:"dial-small-paragraph-semi-text inline-flex h-4 min-w-4 shrink-0 items-center justify-center rounded-full bg-control-error px-1 text-control-permanent",children:t})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[r.jsx(k.GhostIconButton,{"aria-label":n?a.expandAriaLabel:a.collapseAriaLabel,"aria-expanded":!n,"aria-controls":s,size:_.ElementSize.Small,icon:r.jsx(l,{size:H.DIAL_ICON_SIZE.SM,stroke:ne.DIAL_KIT_ICON_STROKE,className:"text-secondary","aria-hidden":!0}),onClick:o,className:Tt}),r.jsx(k.GhostIconButton,{"aria-label":a.closeAriaLabel,size:_.ElementSize.Small,icon:r.jsx($.IconX,{size:H.DIAL_ICON_SIZE.SM,stroke:ne.DIAL_KIT_ICON_STROKE,className:"text-secondary","aria-hidden":!0}),onClick:i,className:Tt})]})]})},zn=({message:e,isError:t})=>{const n=t?$.IconAlertCircleFilled:$.IconAlertTriangleFilled;return r.jsx(k.Tooltip,{tooltip:e,asChild:!0,children:r.jsx("span",{className:Tt,role:"img","aria-label":e,tabIndex:0,children:r.jsx(n,{size:H.DIAL_ICON_SIZE.SM,className:t?"text-error":"text-warning-icon","aria-hidden":!0})})})},sf=({item:e,labels:t,onCancel:n})=>{const s=e.status===_e.Canceled;return r.jsxs("div",{className:"group flex items-center gap-2 px-4 py-2",children:[r.jsx(Gr,{type:v.DialItemType.File,name:e.name,size:H.DIAL_ICON_SIZE.MD,className:S.mergeClasses(s&&"opacity-50"),decorative:!0}),r.jsx(k.EllipsisTooltip,{text:e.name,className:S.mergeClasses("dial-small-text",s?"text-secondary":"text-primary")}),e.status===_e.InProgress&&r.jsxs("div",{className:S.mergeClasses(Tt,"grid"),children:[r.jsx(v.Spinner,{size:H.DIAL_ICON_SIZE.SM,ariaLabel:t.itemProgressAriaLabel(e.name),className:S.mergeClasses("pointer-events-none col-start-1 row-start-1 transition-opacity",n&&"group-focus-within:opacity-0 group-hover:opacity-0")}),n&&r.jsx(k.GhostIconButton,{"aria-label":t.cancelItemAriaLabel(e.name),size:_.ElementSize.Small,icon:r.jsx($.IconX,{size:H.DIAL_ICON_SIZE.SM,stroke:ne.DIAL_KIT_ICON_STROKE,className:"text-secondary","aria-hidden":!0}),onClick:()=>n(e.id),className:"col-start-1 row-start-1 opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100"})]}),e.status===_e.Success&&r.jsx("span",{className:Tt,role:"img","aria-label":t.successLabel,children:r.jsx($.IconCheck,{size:H.DIAL_ICON_SIZE.SM,stroke:ne.DIAL_KIT_ICON_STROKE,className:"text-accent","aria-hidden":!0})}),e.status===_e.Warning&&r.jsx(zn,{message:e.message||t.warningMessage,isError:!1}),e.status===_e.Failed&&r.jsx(zn,{message:e.message||t.failedMessage,isError:!0}),s&&r.jsx("span",{className:"dial-small-text shrink-0 text-secondary",children:t.canceledLabel})]})},af=e=>Math.round(e.reduce((t,n)=>t+(n.percent??(n.status===_e.InProgress?0:100)),0)/e.length),of=(e,t,n)=>e&&t?n.closeConfirmDescriptionMixed:t?n.closeConfirmDescriptionFailed:n.closeConfirmDescriptionInProgress,lf=({title:e,items:t,onClose:n,onCancelItem:s,labels:a,autoCloseDelay:o=Js,className:i,bodyClassName:l})=>{const[c,d]=g.useState(!1),[f,p]=g.useState(!1),h=g.useId(),u={...Qs,...a},m=t.filter(j=>j.status===_e.InProgress).length,C=m>0,x=t.filter(j=>j.status===_e.Failed).length,b=x>0,y=t.length>0&&t.every(j=>j.status===_e.Success),N=g.useCallback(()=>{C||b?p(!0):n()},[C,b,n]),D=g.useCallback(()=>{p(!1),n()},[n]),I=g.useCallback(()=>{d(j=>!j)},[]);return g.useEffect(()=>{if(!y||o<=0)return;const j=setTimeout(n,o);return()=>clearTimeout(j)},[y,o,n]),t.length===0?null:r.jsxs("div",{role:"status","aria-live":"polite",className:S.mergeClasses("w-[370px] max-w-[calc(100vw-2rem)] rounded-xl bg-layer-raised shadow-md",i,O.DIAL_KIT_CLASS.transferQueue),children:[r.jsx(nf,{title:e,failedCount:x,isCollapsed:c,itemsId:h,labels:u,onToggleCollapse:I,onClose:N}),c&&C&&r.jsx(Vn,{value:af(t),size:_.ElementSize.Small,"aria-label":u.queueProgressAriaLabel,"aria-valuetext":u.queueProgressValueText(t.length-m,t.length)}),!c&&r.jsx("div",{id:h,className:S.mergeClasses("flex max-h-[40vh] flex-col overflow-y-auto py-1",l),children:t.map(j=>r.jsx(sf,{item:j,labels:u,onCancel:s},j.id))}),r.jsx(Gs,{open:f,header:u.closeConfirmHeader,description:of(C,b,u),confirmLabel:u.closeConfirmLabel,cancelLabel:u.closeCancelLabel,variant:v.ConfirmationPopupVariant.Danger,onConfirm:D,onClose:()=>p(!1)})]})};exports.ConfirmationPopupVariant=v.ConfirmationPopupVariant;exports.DialBreadcrumb=v.DialBreadcrumb;exports.DialBreadcrumbItem=v.DialBreadcrumbItem;exports.DialButton=v.DialButton;exports.DialButtonDropdown=v.DialButtonDropdown;exports.DialCaptionText=v.DialCaptionText;exports.DialCollapsibleSidebar=v.DialCollapsibleSidebar;exports.DialConditionalResizableContainer=v.DialConditionalResizableContainer;exports.DialConfirmationPopup=v.DialConfirmationPopup;exports.DialDangerButton=v.DialDangerButton;exports.DialDestinationFolderPopup=v.DialDestinationFolderPopup;exports.DialErrorText=v.DialErrorText;exports.DialFileIcon=v.DialFileIcon;exports.DialFileManager=v.DialFileManager;exports.DialFileManagerActions=v.DialFileManagerActions;exports.DialFileManagerTabs=v.DialFileManagerTabs;exports.DialFileName=v.DialFileName;exports.DialFileNodeType=v.DialFileNodeType;exports.DialFilePermission=v.DialFilePermission;exports.DialFileResourceType=v.DialFileResourceType;exports.DialFolderName=v.DialFolderName;exports.DialFoldersTree=v.DialFoldersTree;exports.DialFormItem=v.DialFormItem;exports.DialGhostButton=v.DialGhostButton;exports.DialInput=v.DialInput;exports.DialItemType=v.DialItemType;exports.DialLinkButton=v.DialLinkButton;exports.DialLoader=v.DialLoader;exports.DialNeutralButton=v.DialNeutralButton;exports.DialNotification=v.DialNotification;exports.DialPopup=v.DialPopup;exports.DialPrimaryButton=v.DialPrimaryButton;exports.DialRadioGroup=v.DialRadioGroup;exports.DialResizableContainer=v.DialResizableContainer;exports.DialSearch=v.DialSearch;exports.DialSharedEntityIndicator=v.DialSharedEntityIndicator;exports.DialTabs=v.DialTabs;exports.EDITABLE_CONTAINER_ATTRIBUTE=v.EDITABLE_CONTAINER_ATTRIBUTE;exports.FileManagerColumnKey=v.FileManagerColumnKey;exports.FileManagerProvider=v.FileManagerProvider;exports.FlexibleActionsDirection=v.FlexibleActionsDirection;exports.FormItemOrientation=v.FormItemOrientation;exports.NAME_COLUMN=v.NAME_COLUMN;exports.NOT_ALLOWED_SPACES=v.NOT_ALLOWED_SPACES;exports.NOT_ALLOWED_SPACES_REGEXP=v.NOT_ALLOWED_SPACES_REGEXP;exports.NOT_ALLOWED_SYMBOLS=v.NOT_ALLOWED_SYMBOLS;exports.NOT_ALLOWED_SYMBOLS_REGEXP=v.NOT_ALLOWED_SYMBOLS_REGEXP;exports.NotificationType=v.NotificationType;exports.NotificationVariant=v.NotificationVariant;exports.PopupSize=v.PopupSize;exports.RadioGroupOrientation=v.RadioGroupOrientation;exports.ResizableContainerSide=v.ResizableContainerSide;exports.SIZE_COLUMN=v.SIZE_COLUMN;exports.ScreenResolution=v.ScreenResolution;exports.Skeleton=v.Skeleton;exports.SkeletonAvatarShape=v.SkeletonAvatarShape;exports.SkeletonAvatarSize=v.SkeletonAvatarSize;exports.SkeletonVariant=v.SkeletonVariant;exports.Spinner=v.Spinner;exports.TabOrientation=v.TabOrientation;exports.TabView=v.TabView;exports.UPDATED_AT_COLUMN=v.UPDATED_AT_COLUMN;exports.editableContainerProps=v.editableContainerProps;exports.useDialFileManagerTabs=v.useDialFileManagerTabs;exports.useEditableItem=v.useEditableItem;exports.useFileManagerContext=v.useFileManagerContext;exports.DialLabel=Ue.DialLabel;exports.DialSwitch=Ue.DialSwitch;exports.DEFAULT_GRID_DATE_FORMAT_OPTIONS=O.DEFAULT_DATE_FORMAT_OPTIONS;exports.DEFAULT_GRID_DATE_LOCALE=O.DEFAULT_LOCALE;exports.DIAL_KIT_CLASS=O.DIAL_KIT_CLASS;exports.DialCloseButton=O.DialCloseButton;exports.DialDangerIconButton=O.DialDangerIconButton;exports.DialDateCellRenderer=O.DialDateCellRenderer;exports.DialDropdown=O.DialDropdown;exports.DialEllipsisTooltip=O.DialEllipsisTooltip;exports.DialGhostIconButton=O.DialGhostIconButton;exports.DialGrid=O.DialGrid;exports.DialIcon=O.DialIcon;exports.DialNeutralIconButton=O.DialNeutralIconButton;exports.DialNoDataContent=O.DialNoDataContent;exports.DialPrimaryIconButton=O.DialPrimaryIconButton;exports.DialRadioButton=O.DialRadioButton;exports.DialSecondaryIconButton=O.DialSecondaryIconButton;exports.DialSuccessIconButton=O.DialSuccessIconButton;exports.DialTertiaryIconButton=O.DialTertiaryIconButton;exports.DropdownItemType=O.DropdownItemType;exports.DropdownTrigger=O.DropdownTrigger;exports.DropdownType=O.DropdownType;exports.GridSelectionMode=O.GridSelectionMode;exports.ThemeScope=O.ThemeScope;exports.baseColumnComparator=O.baseColumnComparator;exports.checkColDefsChanges=O.checkColDefsChanges;exports.convertGridDateToDate=O.convertToDate;exports.convertToDate=O.convertToDate;exports.useThemeScope=O.useThemeScope;exports.BASE_ICON_PROPS=H.BASE_ICON_PROPS;exports.BASE_ICON_SIZE=H.BASE_ICON_SIZE;exports.DIAL_ICON_SIZE=H.DIAL_ICON_SIZE;exports.mergeClasses=S.mergeClasses;exports.Checkbox=k.Checkbox;exports.CheckboxBox=k.CheckboxBox;exports.CloseButton=k.CloseButton;exports.DEFAULT_DATE_FORMAT_OPTIONS=k.DEFAULT_DATE_FORMAT_OPTIONS;exports.DEFAULT_DATE_LOCALE=k.DEFAULT_LOCALE;exports.DangerIconButton=k.DangerIconButton;exports.DateCellRenderer=k.DateCellRenderer;exports.Dropdown=k.Dropdown;exports.EllipsisTooltip=k.EllipsisTooltip;exports.GRID_ALIGN_RIGHT_CLASS=k.GRID_ALIGN_RIGHT_CLASS;exports.GRID_ROOT_CLASS=k.GRID_ROOT_CLASS;exports.GRID_ROW_HEIGHT=k.ROW_HEIGHT;exports.GRID_SELECTION_COLUMN_ID=k.GRID_SELECTION_COLUMN_ID;exports.GRID_THEME_PARAMS=k.GRID_THEME_PARAMS;exports.GhostIconButton=k.GhostIconButton;exports.Grid=k.Grid;exports.IconButton=k.IconButton;exports.InfoButton=k.InfoButton;exports.InteractiveTooltip=k.InteractiveTooltip;exports.InteractiveTooltipTrigger=k.InteractiveTooltipTrigger;exports.Label=k.Label;exports.MenuItem=k.MenuItem;exports.MenuItemMark=k.MenuItemMark;exports.NeutralIconButton=k.NeutralIconButton;exports.NoDataContent=k.NoDataContent;exports.PrimaryIconButton=k.PrimaryIconButton;exports.Radio=k.Radio;exports.StaticIconButton=k.StaticIconButton;exports.Tooltip=k.Tooltip;exports.TooltipContainer=k.TooltipContainer;exports.TooltipContent=k.TooltipContent;exports.TooltipPlacement=k.TooltipPlacement;exports.TooltipTrigger=k.TooltipTrigger;exports.ButtonAppearance=_.ButtonAppearance;exports.ButtonVariant=_.ButtonVariant;exports.DialIconButton=_.DialIconButton;exports.DialTooltip=_.DialTooltip;exports.DialTooltipContainer=_.DialTooltipContainer;exports.DialTooltipContent=_.DialTooltipContent;exports.DialTooltipTrigger=_.DialTooltipTrigger;exports.ElementSize=_.ElementSize;exports.EditorThemes=wt.EditorThemes;exports.LazyDialJsonEditor=wt.LazyDialJsonEditor;exports.LazyDialMarkdownEditor=wt.LazyDialMarkdownEditor;exports.LazyMarkdownEditor=wt.LazyMarkdownEditor;exports.DIAL_KIT_ICON_STROKE=ne.DIAL_KIT_ICON_STROKE;exports.Accordion=zd;exports.AccordionCaretPosition=Ht;exports.AnalyticsCardVariant=St;exports.AutocompleteTagInput=Vu;exports.Avatar=qs;exports.AvatarShape=ut;exports.Badge=wu;exports.BadgeColor=He;exports.BadgeVariant=We;exports.BottomSheet=Nu;exports.Breadcrumbs=Sd;exports.BreadcrumbsSize=nt;exports.Button=at;exports.ButtonDropdown=Dd;exports.Calendar=ld;exports.CalendarMode=Ne;exports.CaptionText=qe;exports.CardShell=kc;exports.CollapsibleSidebar=Qu;exports.ConditionalResizableContainer=rf;exports.ConfirmationPopup=Gs;exports.DEFAULT_ANALYTICS_BAR_COLOR_MAP=Tr;exports.DEFAULT_TRANSFER_QUEUE_LABELS=Qs;exports.DangerButton=lc;exports.DialAccordion=$n;exports.DialAnalyticsBar=kt;exports.DialAnalyticsBarGroup=fa;exports.DialAnalyticsCard=ca;exports.DialAnalyticsErrorTag=jr;exports.DialAnalyticsHistogram=xa;exports.DialAutocompleteInputValue=ns;exports.DialCheckbox=gr;exports.DialDraggableItem=Ai;exports.DialDropdownIcon=vl;exports.DialFormPopup=Vi;exports.DialInputPopup=ss;exports.DialLabelledText=wa;exports.DialLoadFileArea=ps;exports.DialLoadFileAreaField=yl;exports.DialNumberInput=vr;exports.DialPagination=Sa;exports.DialPasswordInput=as;exports.DialRadioGroupPopupField=zi;exports.DialRemoveButton=Wt;exports.DialSchemaRenderer=Rl;exports.DialSegmentedControl=Fi;exports.DialSelect=Me;exports.DialSelectField=rl;exports.DialSlider=Ta;exports.DialSteps=ja;exports.DialTag=Je;exports.DialTagInput=rs;exports.DialTextarea=_i;exports.EntityIdentity=Ru;exports.EntityType=xe;exports.ErrorMessageNotification=$c;exports.ErrorText=Be;exports.ErrorToastNotification=Rc;exports.FabButton=Id;exports.FileDropzone=fu;exports.FileIcon=Gr;exports.FileName=Zs;exports.FilterChips=uu;exports.FolderName=Iu;exports.FolderPath=cd;exports.GeneralMessageNotification=Uc;exports.GeneralToastNotification=zc;exports.GhostButton=Br;exports.Highlight=Ps;exports.InfoMessageNotification=Hc;exports.InfoToastNotification=Mc;exports.InlineSelect=jd;exports.InlineSelectTrigger=Vs;exports.Input=Ae;exports.JsonSchemaType=P;exports.LinkButton=uc;exports.LoadingMessageNotification=Gc;exports.LoadingToastNotification=Bc;exports.MultiSelectTags=vt;exports.NeutralButton=Fr;exports.Notification=Kr;exports.NumberInput=Hr;exports.OutlinedButton=fc;exports.PasswordInput=_s;exports.Popup=Vr;exports.PrimaryButton=Os;exports.ProgressBar=Vn;exports.RadioGroup=jt;exports.RadioGroupPopupField=qd;exports.ResizableContainer=Xs;exports.SchemaDisplayMode=et;exports.SchemaOrientation=pt;exports.SchemaRenderer=wc;exports.SchemaRendererVariant=ke;exports.Search=Uu;exports.SegmentedControl=ou;exports.Select=Ve;exports.SelectSize=Ft;exports.SelectVariant=Bt;exports.SharedEntityIndicator=Us;exports.SideDrawer=Mu;exports.Slider=Xu;exports.StarterButton=dc;exports.StepStatus=je;exports.SuccessMessageNotification=Kc;exports.SuccessToastNotification=Pc;exports.Switch=Ls;exports.TRANSFER_QUEUE_AUTO_CLOSE_DELAY_MS=Js;exports.Tabs=lu;exports.Tag=Re;exports.TagAppearance=rt;exports.TagInput=$u;exports.Textarea=As;exports.TextareaResize=zr;exports.ToggleIconButton=Yd;exports.TransferQueue=lf;exports.TransferQueueItemStatus=_e;exports.WarningMessageNotification=Vc;exports.WarningToastNotification=Fc;exports.extractInitials=Ws;exports.getTimezoneLabel=hs;exports.matchesAccept=Dr;exports.wrapInRootFolder=Tl;