react-reason-editor 1.0.24

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 (871) hide show
  1. package/README.md +225 -0
  2. package/dist/ActionMenuButton-BGj7ODjl.cjs +1 -0
  3. package/dist/ActionMenuButton-DHYJFTev.js +2 -0
  4. package/dist/Attachment-DGzsbPZZ.js +4 -0
  5. package/dist/Attachment.cjs +1 -0
  6. package/dist/Attachment.js +1 -0
  7. package/dist/Blockquote-CQ6HlDnL.js +2 -0
  8. package/dist/Blockquote.cjs +1 -0
  9. package/dist/Blockquote.js +1 -0
  10. package/dist/Bold-Ciuvp1pM.js +2 -0
  11. package/dist/Bold-M6IKTPME.cjs +1 -0
  12. package/dist/Bold.cjs +1 -0
  13. package/dist/Bold.js +1 -0
  14. package/dist/BulletList.cjs +1 -0
  15. package/dist/BulletList.js +1 -0
  16. package/dist/Callout-DOHjjQtT.cjs +1 -0
  17. package/dist/Callout-heY7R-Zu.js +11 -0
  18. package/dist/Callout.cjs +1 -0
  19. package/dist/Callout.js +1 -0
  20. package/dist/Clear.cjs +1 -0
  21. package/dist/Clear.js +1 -0
  22. package/dist/Code-B17BQJf-.js +1 -0
  23. package/dist/Code-BsD1D1sK.cjs +1 -0
  24. package/dist/Code.cjs +1 -0
  25. package/dist/Code.js +1 -0
  26. package/dist/CodeBlock-B7Wklup8.js +1 -0
  27. package/dist/CodeBlock-D2OKvGCF.cjs +1 -0
  28. package/dist/CodeBlock.cjs +1 -0
  29. package/dist/CodeBlock.js +1 -0
  30. package/dist/CodeView.cjs +1 -0
  31. package/dist/CodeView.js +1 -0
  32. package/dist/Color-BxzxtvJH.cjs +1 -0
  33. package/dist/Color-VWGwmpsG.js +5 -0
  34. package/dist/Color.cjs +1 -0
  35. package/dist/Color.js +1 -0
  36. package/dist/Column-D4FgAp5K.js +1 -0
  37. package/dist/Column-I4gS_xKw.cjs +1 -0
  38. package/dist/Column.cjs +1 -0
  39. package/dist/Column.js +1 -0
  40. package/dist/Comment-DEtjWTFF.js +14 -0
  41. package/dist/Comment-DaHgAu2h.cjs +1 -0
  42. package/dist/Comment.cjs +1 -0
  43. package/dist/Comment.js +1 -0
  44. package/dist/Drawer-Dunw22Q1.js +63 -0
  45. package/dist/Drawer-DxCO6TBr.cjs +1 -0
  46. package/dist/Drawer.cjs +1 -0
  47. package/dist/Drawer.js +1 -0
  48. package/dist/Drawio-Bx8zt_CW.cjs +1 -0
  49. package/dist/Drawio-eqEGDkwW.js +6 -0
  50. package/dist/Drawio.cjs +1 -0
  51. package/dist/Drawio.js +1 -0
  52. package/dist/Emoji-BU-itkPp.js +12 -0
  53. package/dist/Emoji.cjs +1 -0
  54. package/dist/Emoji.js +1 -0
  55. package/dist/ExportPdf-DPeFg2GG.js +1 -0
  56. package/dist/ExportPdf.cjs +1 -0
  57. package/dist/ExportPdf.js +1 -0
  58. package/dist/ExportWord-TFEb3HXz.js +1 -0
  59. package/dist/ExportWord.cjs +1 -0
  60. package/dist/ExportWord.js +1 -0
  61. package/dist/FontFamily.cjs +1 -0
  62. package/dist/FontFamily.js +2 -0
  63. package/dist/FontSize.cjs +1 -0
  64. package/dist/FontSize.js +8 -0
  65. package/dist/Harper-1cMMY1sx.cjs +1 -0
  66. package/dist/Harper-BMTF3gpj.js +1 -0
  67. package/dist/Harper.cjs +1 -0
  68. package/dist/Harper.js +1 -0
  69. package/dist/Heading-YSJHyWCU.js +2 -0
  70. package/dist/Heading.cjs +1 -0
  71. package/dist/Heading.js +1 -0
  72. package/dist/Highlight-BeqLxfbY.cjs +1 -0
  73. package/dist/Highlight-OkaWwhRk.js +5 -0
  74. package/dist/Highlight.cjs +1 -0
  75. package/dist/Highlight.js +1 -0
  76. package/dist/History-C6yBYB2w.js +1 -0
  77. package/dist/History.cjs +1 -0
  78. package/dist/History.js +1 -0
  79. package/dist/HorizontalRule-kAw8TV0V.js +1 -0
  80. package/dist/HorizontalRule.cjs +1 -0
  81. package/dist/HorizontalRule.js +1 -0
  82. package/dist/Icon-CJJ9AQtR.js +1 -0
  83. package/dist/Icon-DQdA22_-.cjs +1 -0
  84. package/dist/Iframe-B-0W9YYq.js +2 -0
  85. package/dist/Iframe-DS5N9EFx.cjs +1 -0
  86. package/dist/Iframe.cjs +1 -0
  87. package/dist/Iframe.js +1 -0
  88. package/dist/Image.cjs +1 -0
  89. package/dist/Image.js +1 -0
  90. package/dist/ImageCropper-BAWOk69J.cjs +1 -0
  91. package/dist/ImageCropper-Dlz4nJQu.js +11 -0
  92. package/dist/ImageGif-CWfgVc6e.cjs +1 -0
  93. package/dist/ImageGif-D5Qw_Xf-.js +3 -0
  94. package/dist/ImageGif.cjs +1 -0
  95. package/dist/ImageGif.js +1 -0
  96. package/dist/ImportWord-BCcs3dYp.js +1 -0
  97. package/dist/ImportWord.cjs +1 -0
  98. package/dist/ImportWord.js +1 -0
  99. package/dist/Indent-6tc8tB62.cjs +1 -0
  100. package/dist/Indent-DpTPoZMk.js +1 -0
  101. package/dist/Indent.cjs +1 -0
  102. package/dist/Indent.js +1 -0
  103. package/dist/Italic-Brjxxqsi.cjs +1 -0
  104. package/dist/Italic-CZkbT3Dd.js +1 -0
  105. package/dist/Italic.cjs +1 -0
  106. package/dist/Italic.js +1 -0
  107. package/dist/Katex-Bo_vfXrd.js +10 -0
  108. package/dist/Katex-D_vF5gsD.cjs +1 -0
  109. package/dist/Katex.cjs +1 -0
  110. package/dist/Katex.js +1 -0
  111. package/dist/LineHeight.cjs +1 -0
  112. package/dist/LineHeight.js +1 -0
  113. package/dist/Link-C0cNnjXo.js +6 -0
  114. package/dist/Link.cjs +1 -0
  115. package/dist/Link.js +1 -0
  116. package/dist/LinkEditBlock-Or1HIYih.cjs +1 -0
  117. package/dist/MarkdownPaste-C5jQ33SR.js +1 -0
  118. package/dist/MarkdownPaste.cjs +1 -0
  119. package/dist/MarkdownPaste.js +1 -0
  120. package/dist/Mention-DEkbeL04.js +1 -0
  121. package/dist/Mention.cjs +1 -0
  122. package/dist/Mention.js +1 -0
  123. package/dist/Mermaid-BB15qd24.cjs +1 -0
  124. package/dist/Mermaid-DxpFRVu0.js +5 -0
  125. package/dist/Mermaid.cjs +1 -0
  126. package/dist/Mermaid.js +1 -0
  127. package/dist/MoreMark-CXudh2cm.js +3 -0
  128. package/dist/MoreMark.cjs +1 -0
  129. package/dist/MoreMark.js +1 -0
  130. package/dist/OfficePaste-BmPshTAb.js +1 -0
  131. package/dist/OfficePaste-Day0T6Ox.cjs +1 -0
  132. package/dist/OfficePaste.cjs +1 -0
  133. package/dist/OfficePaste.js +1 -0
  134. package/dist/OrderedList.cjs +1 -0
  135. package/dist/OrderedList.js +1 -0
  136. package/dist/Pagination-B8rfYYi_.js +1 -0
  137. package/dist/Pagination-yjRu_qJK.cjs +1 -0
  138. package/dist/Pagination.cjs +1 -0
  139. package/dist/Pagination.js +1 -0
  140. package/dist/SearchAndReplace.cjs +1 -0
  141. package/dist/SearchAndReplace.js +11 -0
  142. package/dist/SlashCommand-8LkH8bHy.js +1 -0
  143. package/dist/SlashCommand.cjs +1 -0
  144. package/dist/SlashCommand.js +1 -0
  145. package/dist/Strike-BsMuOhxs.js +1 -0
  146. package/dist/Strike.cjs +1 -0
  147. package/dist/Strike.js +1 -0
  148. package/dist/Table-B4KNW7Yq.cjs +1 -0
  149. package/dist/Table-C9t-k9Qu.js +3 -0
  150. package/dist/Table.cjs +1 -0
  151. package/dist/Table.js +1 -0
  152. package/dist/TableOfContents.cjs +1 -0
  153. package/dist/TableOfContents.js +1 -0
  154. package/dist/TaskList.cjs +1 -0
  155. package/dist/TaskList.js +1 -0
  156. package/dist/TextAlign-6ElUYI4_.cjs +1 -0
  157. package/dist/TextAlign-C75gn_OM.js +1 -0
  158. package/dist/TextAlign.cjs +1 -0
  159. package/dist/TextAlign.js +1 -0
  160. package/dist/TextDirection.cjs +1 -0
  161. package/dist/TextDirection.js +1 -0
  162. package/dist/TextUnderline-BaV7bhwo.js +1 -0
  163. package/dist/TextUnderline-ofstnQx_.cjs +1 -0
  164. package/dist/TextUnderline.cjs +1 -0
  165. package/dist/TextUnderline.js +1 -0
  166. package/dist/Twitter-D5UNfT-K.js +5 -0
  167. package/dist/Twitter-DyrQT0n4.cjs +1 -0
  168. package/dist/Twitter.cjs +1 -0
  169. package/dist/Twitter.js +1 -0
  170. package/dist/Video-BSH5k6Jd.cjs +1 -0
  171. package/dist/Video-_YlAC2R_.js +5 -0
  172. package/dist/Video.cjs +1 -0
  173. package/dist/Video.js +1 -0
  174. package/dist/WordCount.cjs +1 -0
  175. package/dist/WordCount.js +2 -0
  176. package/dist/app-hooks/use-mobile.d.ts +5 -0
  177. package/dist/app-hooks/useDocumentSync.d.ts +27 -0
  178. package/dist/app-hooks/useLocalStorage.d.ts +11 -0
  179. package/dist/app-theme/theme-dropdown.d.ts +1 -0
  180. package/dist/app-types/document.d.ts +81 -0
  181. package/dist/app-types/fileSource.d.ts +124 -0
  182. package/dist/app-types/team.d.ts +52 -0
  183. package/dist/app-types/toc.d.ts +2 -0
  184. package/dist/app-ui/FileTypeIcon.d.ts +11 -0
  185. package/dist/app-ui/alert-dialog.d.ts +14 -0
  186. package/dist/app-ui/avatar.d.ts +6 -0
  187. package/dist/app-ui/badge.d.ts +13 -0
  188. package/dist/app-ui/breadcrumb.d.ts +15 -0
  189. package/dist/app-ui/button.d.ts +15 -0
  190. package/dist/app-ui/context-menu.d.ts +28 -0
  191. package/dist/app-ui/dialog.d.ts +15 -0
  192. package/dist/app-ui/dropdown-menu.d.ts +25 -0
  193. package/dist/app-ui/input.d.ts +7 -0
  194. package/dist/app-ui/label.d.ts +4 -0
  195. package/dist/app-ui/radio-group.d.ts +5 -0
  196. package/dist/app-ui/scroll-area.d.ts +5 -0
  197. package/dist/app-ui/select.d.ts +13 -0
  198. package/dist/app-ui/separator.d.ts +4 -0
  199. package/dist/app-ui/sheet.d.ts +13 -0
  200. package/dist/app-ui/sidebar.d.ts +70 -0
  201. package/dist/app-ui/skeleton.d.ts +3 -0
  202. package/dist/app-ui/switch.d.ts +4 -0
  203. package/dist/app-ui/tabs.d.ts +7 -0
  204. package/dist/app-ui/textarea.d.ts +7 -0
  205. package/dist/app-ui/tooltip.d.ts +7 -0
  206. package/dist/app-ui/tree.d.ts +19 -0
  207. package/dist/app-ui/visually-hidden.d.ts +6 -0
  208. package/dist/app-utils/file-sources/sources.d.ts +37 -0
  209. package/dist/app-utils/utils.d.ts +1 -0
  210. package/dist/bubble---c27x7L.js +80 -0
  211. package/dist/bubble.cjs +1 -0
  212. package/dist/bubble.d.ts +4 -0
  213. package/dist/bubble.js +1 -0
  214. package/dist/button-CXcuJkiM.js +1 -0
  215. package/dist/button-CYMsgP3Y.cjs +1 -0
  216. package/dist/cdn-loader-D76eUWN7.cjs +1 -0
  217. package/dist/cdn-loader-w67sLKk9.js +1 -0
  218. package/dist/checkbox-BtMvSk4V.cjs +1 -0
  219. package/dist/checkbox-zfuPZBhD.js +1 -0
  220. package/dist/comments/CommentsSidebar.d.ts +14 -0
  221. package/dist/comments/commentMarks.d.ts +40 -0
  222. package/dist/comments/useCommentThreads.d.ts +29 -0
  223. package/dist/components/ActionButton.d.ts +23 -0
  224. package/dist/components/ActionMenuButton.d.ts +28 -0
  225. package/dist/components/Bubble/RichTextBubbleCallout.d.ts +4 -0
  226. package/dist/components/Bubble/RichTextBubbleCodeBlock.d.ts +4 -0
  227. package/dist/components/Bubble/RichTextBubbleColumns.d.ts +4 -0
  228. package/dist/components/Bubble/RichTextBubbleDrawer.d.ts +4 -0
  229. package/dist/components/Bubble/RichTextBubbleDrawio.d.ts +4 -0
  230. package/dist/components/Bubble/RichTextBubbleIframe.d.ts +4 -0
  231. package/dist/components/Bubble/RichTextBubbleKatex.d.ts +2 -0
  232. package/dist/components/Bubble/RichTextBubbleLink.d.ts +6 -0
  233. package/dist/components/Bubble/RichTextBubbleMedia.d.ts +7 -0
  234. package/dist/components/Bubble/RichTextBubbleMenuDragHandle.d.ts +2 -0
  235. package/dist/components/Bubble/RichTextBubbleMermaid.d.ts +4 -0
  236. package/dist/components/Bubble/RichTextBubbleTable.d.ts +8 -0
  237. package/dist/components/Bubble/RichTextBubbleText.d.ts +8 -0
  238. package/dist/components/Bubble/RichTextBubbleTwitter.d.ts +4 -0
  239. package/dist/components/Bubble/formatBubble.d.ts +55 -0
  240. package/dist/components/Bubble/index.d.ts +17 -0
  241. package/dist/components/ColorPicker.d.ts +11 -0
  242. package/dist/components/ReactBus.d.ts +11 -0
  243. package/dist/components/RichTextProvider.d.ts +8 -0
  244. package/dist/components/SizeSetter/SizeSetter.d.ts +16 -0
  245. package/dist/components/SlashDialogTrigger/RenderDialogUploadImage.d.ts +4 -0
  246. package/dist/components/SlashDialogTrigger/RenderDialogUploadVideo.d.ts +4 -0
  247. package/dist/components/SlashDialogTrigger/SlashDialogTrigger.d.ts +6 -0
  248. package/dist/components/ToolbarMenuItem.d.ts +15 -0
  249. package/dist/components/icons/Activity.d.ts +3 -0
  250. package/dist/components/icons/Animas.d.ts +3 -0
  251. package/dist/components/icons/AspectRatio.d.ts +2 -0
  252. package/dist/components/icons/Blockquote.d.ts +2 -0
  253. package/dist/components/icons/CodeView.d.ts +4 -0
  254. package/dist/components/icons/ColumnAddLeft.d.ts +4 -0
  255. package/dist/components/icons/ColumnAddRight.d.ts +4 -0
  256. package/dist/components/icons/DeleteColumn.d.ts +5 -0
  257. package/dist/components/icons/DeleteRow.d.ts +5 -0
  258. package/dist/components/icons/Direction.d.ts +4 -0
  259. package/dist/components/icons/Drawio.d.ts +4 -0
  260. package/dist/components/icons/ExportPdf.d.ts +4 -0
  261. package/dist/components/icons/ExportWord.d.ts +3 -0
  262. package/dist/components/icons/FileWordOutline.d.ts +2 -0
  263. package/dist/components/icons/Flag.d.ts +3 -0
  264. package/dist/components/icons/Food.d.ts +3 -0
  265. package/dist/components/icons/GIfIcon.d.ts +4 -0
  266. package/dist/components/icons/Html.d.ts +4 -0
  267. package/dist/components/icons/Icon.d.ts +8 -0
  268. package/dist/components/icons/IconColorFill.d.ts +8 -0
  269. package/dist/components/icons/IconHighlightFill.d.ts +6 -0
  270. package/dist/components/icons/ImportWord.d.ts +3 -0
  271. package/dist/components/icons/LeftToRight.d.ts +4 -0
  272. package/dist/components/icons/LineHeight.d.ts +2 -0
  273. package/dist/components/icons/MenuDown.d.ts +2 -0
  274. package/dist/components/icons/Mermaid.d.ts +4 -0
  275. package/dist/components/icons/NoFill.d.ts +4 -0
  276. package/dist/components/icons/Object.d.ts +3 -0
  277. package/dist/components/icons/RightToLeft.d.ts +4 -0
  278. package/dist/components/icons/SizeL.d.ts +2 -0
  279. package/dist/components/icons/SizeM.d.ts +2 -0
  280. package/dist/components/icons/SizeS.d.ts +2 -0
  281. package/dist/components/icons/Symbol.d.ts +3 -0
  282. package/dist/components/icons/Travel.d.ts +3 -0
  283. package/dist/components/icons/Twitter.d.ts +4 -0
  284. package/dist/components/icons/icons.d.ts +4 -0
  285. package/dist/components/icons/index.d.ts +15 -0
  286. package/dist/components/index.d.ts +10 -0
  287. package/dist/components/ui/FileTypeIcon.d.ts +11 -0
  288. package/dist/components/ui/alert-dialog.d.ts +14 -0
  289. package/dist/components/ui/avatar.d.ts +6 -0
  290. package/dist/components/ui/badge.d.ts +13 -0
  291. package/dist/components/ui/breadcrumb.d.ts +15 -0
  292. package/dist/components/ui/button.d.ts +11 -0
  293. package/dist/components/ui/card.d.ts +13 -0
  294. package/dist/components/ui/checkbox.d.ts +7 -0
  295. package/dist/components/ui/context-menu.d.ts +28 -0
  296. package/dist/components/ui/dialog.d.ts +22 -0
  297. package/dist/components/ui/dropdown-menu.d.ts +30 -0
  298. package/dist/components/ui/emoji-picker.d.ts +22 -0
  299. package/dist/components/ui/index.d.ts +33 -0
  300. package/dist/components/ui/input.d.ts +8 -0
  301. package/dist/components/ui/label.d.ts +8 -0
  302. package/dist/components/ui/popover.d.ts +9 -0
  303. package/dist/components/ui/radio-group.d.ts +5 -0
  304. package/dist/components/ui/scroll-area.d.ts +5 -0
  305. package/dist/components/ui/select.d.ts +16 -0
  306. package/dist/components/ui/separator.d.ts +7 -0
  307. package/dist/components/ui/sheet.d.ts +13 -0
  308. package/dist/components/ui/sidebar.d.ts +70 -0
  309. package/dist/components/ui/skeleton.d.ts +3 -0
  310. package/dist/components/ui/switch.d.ts +7 -0
  311. package/dist/components/ui/tabs.d.ts +10 -0
  312. package/dist/components/ui/textarea.d.ts +8 -0
  313. package/dist/components/ui/toast.d.ts +18 -0
  314. package/dist/components/ui/toaster.d.ts +4 -0
  315. package/dist/components/ui/toggle.d.ts +15 -0
  316. package/dist/components/ui/tooltip.d.ts +7 -0
  317. package/dist/components/ui/tree.d.ts +19 -0
  318. package/dist/components/ui/use-toast.d.ts +47 -0
  319. package/dist/components/ui/visually-hidden.d.ts +6 -0
  320. package/dist/constants/index.d.ts +50 -0
  321. package/dist/constants/resetCSS.d.ts +4 -0
  322. package/dist/demo/alternatives.html +23 -0
  323. package/dist/demo/assets/BinaryModule-DTTQwokQ-8eah-8sx.js +4 -0
  324. package/dist/demo/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
  325. package/dist/demo/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
  326. package/dist/demo/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
  327. package/dist/demo/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
  328. package/dist/demo/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
  329. package/dist/demo/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
  330. package/dist/demo/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
  331. package/dist/demo/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
  332. package/dist/demo/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
  333. package/dist/demo/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
  334. package/dist/demo/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
  335. package/dist/demo/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
  336. package/dist/demo/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
  337. package/dist/demo/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
  338. package/dist/demo/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
  339. package/dist/demo/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
  340. package/dist/demo/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
  341. package/dist/demo/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
  342. package/dist/demo/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
  343. package/dist/demo/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
  344. package/dist/demo/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
  345. package/dist/demo/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
  346. package/dist/demo/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
  347. package/dist/demo/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
  348. package/dist/demo/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
  349. package/dist/demo/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
  350. package/dist/demo/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
  351. package/dist/demo/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
  352. package/dist/demo/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
  353. package/dist/demo/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
  354. package/dist/demo/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
  355. package/dist/demo/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
  356. package/dist/demo/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
  357. package/dist/demo/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
  358. package/dist/demo/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
  359. package/dist/demo/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
  360. package/dist/demo/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
  361. package/dist/demo/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
  362. package/dist/demo/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
  363. package/dist/demo/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
  364. package/dist/demo/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
  365. package/dist/demo/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
  366. package/dist/demo/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
  367. package/dist/demo/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
  368. package/dist/demo/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
  369. package/dist/demo/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
  370. package/dist/demo/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
  371. package/dist/demo/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
  372. package/dist/demo/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
  373. package/dist/demo/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
  374. package/dist/demo/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
  375. package/dist/demo/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
  376. package/dist/demo/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
  377. package/dist/demo/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
  378. package/dist/demo/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
  379. package/dist/demo/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
  380. package/dist/demo/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
  381. package/dist/demo/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
  382. package/dist/demo/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
  383. package/dist/demo/assets/abnfDiagram-VRR7QNED-Dfd140vw.js +1 -0
  384. package/dist/demo/assets/alternatives-B9ZaH43Q.js +34 -0
  385. package/dist/demo/assets/arc-DgAnSXoo.js +1 -0
  386. package/dist/demo/assets/architecture-TIHT7OUA-PKWnSAaw.js +1 -0
  387. package/dist/demo/assets/architectureDiagram-ZJ3FMSHR-DKbvCH_5.js +36 -0
  388. package/dist/demo/assets/archiver-web.es-9DdX0ee3.js +1 -0
  389. package/dist/demo/assets/array-BifhSqXX.js +1 -0
  390. package/dist/demo/assets/binary-C5gJtLso.js +1 -0
  391. package/dist/demo/assets/blockDiagram-677ZJIJ3-CG98KmMB.js +132 -0
  392. package/dist/demo/assets/c4Diagram-LMCZKHZV-DMoYN41z.js +10 -0
  393. package/dist/demo/assets/channel-KwEJ8erK.js +1 -0
  394. package/dist/demo/assets/chunk-2Q5K7J3B-C1jixKkw.js +1 -0
  395. package/dist/demo/assets/chunk-32BRIVSS-urznovFN.js +1 -0
  396. package/dist/demo/assets/chunk-52WLFC77-CVCkOQ0G.js +10 -0
  397. package/dist/demo/assets/chunk-5VM5RSS4-ZNzvKenW.js +15 -0
  398. package/dist/demo/assets/chunk-7BUUIJ7U-Bb538aSH.js +1 -0
  399. package/dist/demo/assets/chunk-C7G6YPKG-3KR4wxr6.js +1 -0
  400. package/dist/demo/assets/chunk-EX3LRPZG-7H4O5zer.js +231 -0
  401. package/dist/demo/assets/chunk-FWX5IMBZ-Cr5hG-Ne.js +2 -0
  402. package/dist/demo/assets/chunk-HOUHSVGY-D-1II34k.js +1 -0
  403. package/dist/demo/assets/chunk-ICXQ74PX-6-sSSj2J.js +2 -0
  404. package/dist/demo/assets/chunk-JWPE2WC7-DVXcaiue.js +1 -0
  405. package/dist/demo/assets/chunk-KEIR6QF5-DEvma7oi.js +161 -0
  406. package/dist/demo/assets/chunk-MOJQB5TN-BI6A8dXC.js +88 -0
  407. package/dist/demo/assets/chunk-OGEWGWER-CbUWwSGR.js +1 -0
  408. package/dist/demo/assets/chunk-PUDLZKDR-DZFGcS0W.js +156 -0
  409. package/dist/demo/assets/chunk-Q4XR5HBZ-DZGKW5Hb.js +70 -0
  410. package/dist/demo/assets/chunk-RYQCIY6F-ngGojZR9.js +1 -0
  411. package/dist/demo/assets/chunk-V7JOEXUC-BHAISEav.js +206 -0
  412. package/dist/demo/assets/chunk-VAUOI2AC-DJJNd7f5.js +1 -0
  413. package/dist/demo/assets/chunk-VR4S4FIN-BohNhf6y.js +1 -0
  414. package/dist/demo/assets/chunk-WYO6CB5R-B4Oap74a.js +127 -0
  415. package/dist/demo/assets/chunk-XXDRQBXY-CazVBYiP.js +1 -0
  416. package/dist/demo/assets/chunk-Y2CYZVJY-DsF7k-Jl.js +1 -0
  417. package/dist/demo/assets/chunk-ZGVPDNZ5-BIzSs0a_.js +62 -0
  418. package/dist/demo/assets/chunk-ZIRB5QZD-BpeS1aZ7.js +32 -0
  419. package/dist/demo/assets/classDiagram-OUVF2IWQ-DHWWAQXA.js +1 -0
  420. package/dist/demo/assets/classDiagram-v2-EOCWNBFH-DHWWAQXA.js +1 -0
  421. package/dist/demo/assets/cose-bilkent-JH36ORCC-BX8lNO9u.js +1 -0
  422. package/dist/demo/assets/cynefin-VYW2F7L2-BgajGb2C.js +1 -0
  423. package/dist/demo/assets/cynefinDiagram-TSTJHNR4-DzhUAZoU.js +62 -0
  424. package/dist/demo/assets/cytoscape.esm-C3UvhD5t.js +321 -0
  425. package/dist/demo/assets/dagre-Do4loULv.js +1 -0
  426. package/dist/demo/assets/dagre-VKFMJZFB-BsopUNng.js +4 -0
  427. package/dist/demo/assets/defaultLocale-BFoDCU3G.js +1 -0
  428. package/dist/demo/assets/diagram-FQU43EPY-CnINkZTL.js +3 -0
  429. package/dist/demo/assets/diagram-G47NLZAW-Dz3Rtzen.js +24 -0
  430. package/dist/demo/assets/diagram-NH7WQ7WH-Be_1UuNu.js +24 -0
  431. package/dist/demo/assets/diagram-OA4YK3LP-CoSIFO2U.js +30 -0
  432. package/dist/demo/assets/diagram-WEI45ONY-BSRZnbDT.js +41 -0
  433. package/dist/demo/assets/dist-Cs1z76FA.js +3464 -0
  434. package/dist/demo/assets/dist-Cz2MTljl.js +1 -0
  435. package/dist/demo/assets/dist-D6vyGdj4.js +1 -0
  436. package/dist/demo/assets/ebnfDiagram-CCIWWBDH-CyNs0RvY.js +1 -0
  437. package/dist/demo/assets/editorConfig-DhK0JFvA.js +1355 -0
  438. package/dist/demo/assets/editorConfig-DsFwDEyj.css +2 -0
  439. package/dist/demo/assets/erDiagram-Q63AITRT-Duw2zQw3.js +85 -0
  440. package/dist/demo/assets/eventmodeling-45OFAUF4-BMPwBTgC.js +1 -0
  441. package/dist/demo/assets/flowDiagram-23GEKE2U-vnvQkbfP.js +1 -0
  442. package/dist/demo/assets/ganttDiagram-NO4QXBWP-BUQaZ9pm.js +292 -0
  443. package/dist/demo/assets/gitGraph-TEB2WS4Q-Bqyr024o.js +1 -0
  444. package/dist/demo/assets/gitGraphDiagram-IHSO6WYX-BHYVHdDB.js +106 -0
  445. package/dist/demo/assets/graphlib-0Qhce9xj.js +1 -0
  446. package/dist/demo/assets/harper_wasm_bg-C0DPov_6.wasm +0 -0
  447. package/dist/demo/assets/html-to-docx.esm-C-vYVLZ6.js +75 -0
  448. package/dist/demo/assets/index-CLlAnStL-Ad588yu1.js +18 -0
  449. package/dist/demo/assets/info-DKCQHKI2-CFeY2ca_.js +1 -0
  450. package/dist/demo/assets/infoDiagram-FWYZ7A6U-DL4MXbtI.js +2 -0
  451. package/dist/demo/assets/init-C-OQMol4.js +1 -0
  452. package/dist/demo/assets/isObject-BNleAbAq.js +1 -0
  453. package/dist/demo/assets/ishikawaDiagram-FXEZZL3T-DmCRB68D.js +70 -0
  454. package/dist/demo/assets/journeyDiagram-5HDEW3XC-CweGyybk.js +139 -0
  455. package/dist/demo/assets/kanban-definition-HUTT4EX6-C66P6IsH.js +89 -0
  456. package/dist/demo/assets/katex-DolUETbr.js +257 -0
  457. package/dist/demo/assets/line-BidjcqCQ.js +1 -0
  458. package/dist/demo/assets/linear-CilxpIUn.js +1 -0
  459. package/dist/demo/assets/main-B9AIVkTk.js +10 -0
  460. package/dist/demo/assets/main-BprCJcmy.css +1 -0
  461. package/dist/demo/assets/map-CD2wglgO.js +1 -0
  462. package/dist/demo/assets/mermaid-parser.core-9KJPT0XG.js +7 -0
  463. package/dist/demo/assets/mermaid.core-laQQcj-T.js +11 -0
  464. package/dist/demo/assets/mindmap-definition-LN4V7U3C-BQN-bZLe.js +96 -0
  465. package/dist/demo/assets/ordinal-DtR4qwUh.js +1 -0
  466. package/dist/demo/assets/packet-7NZHBO7P-DxBPLOYy.js +1 -0
  467. package/dist/demo/assets/path-COt_16Va.js +1 -0
  468. package/dist/demo/assets/pegDiagram-2B236MQR-BpHXi9RG.js +1 -0
  469. package/dist/demo/assets/pie-RZYD4A2V-DrQV2Hpi.js +1 -0
  470. package/dist/demo/assets/pieDiagram-ENE6RG2P-CG5jHfId.js +39 -0
  471. package/dist/demo/assets/quadrantDiagram-ABIIQ3AL-Dcu2-MJ0.js +7 -0
  472. package/dist/demo/assets/radar-I7S5WNFK-tVb61Efp.js +1 -0
  473. package/dist/demo/assets/railroad-3IZDKUUU-DkJtB_j_.js +1 -0
  474. package/dist/demo/assets/railroad-abnf-AHOZXSZD-CfCTKFr3.js +1 -0
  475. package/dist/demo/assets/railroad-ebnf-EBAXGLYW-_v-6l-Ly.js +1 -0
  476. package/dist/demo/assets/railroad-peg-LSFZ7HO6-BBeu0SHC.js +1 -0
  477. package/dist/demo/assets/railroadDiagram-RFXS5EU6-Bv3QCzUt.js +1 -0
  478. package/dist/demo/assets/requirementDiagram-TGXJPOKE-DBRcoYhq.js +84 -0
  479. package/dist/demo/assets/rolldown-runtime-C0FnF6B9.js +1 -0
  480. package/dist/demo/assets/rough.esm-By172zw-.js +1 -0
  481. package/dist/demo/assets/sankeyDiagram-HTMAVEWB-BUvv1AGS.js +40 -0
  482. package/dist/demo/assets/sequenceDiagram-DBY2YBRQ-DF4ltyiE.js +162 -0
  483. package/dist/demo/assets/sizeCapture-X5ZJPWSS-B0uUizjq.js +1 -0
  484. package/dist/demo/assets/src-CllyRBe0.js +1 -0
  485. package/dist/demo/assets/stateDiagram-2N3HPSRC-hdEszuU_.js +1 -0
  486. package/dist/demo/assets/stateDiagram-v2-6OUMAXLB-frodkCZE.js +1 -0
  487. package/dist/demo/assets/swimlanes-5IMT3BWC-BXUPe25m.js +2 -0
  488. package/dist/demo/assets/swimlanesDiagram-G3AALYLV-CN1oenl6.js +8 -0
  489. package/dist/demo/assets/timeline-definition-FHXFAJF6-Dphs5ING.js +120 -0
  490. package/dist/demo/assets/treeView-QDETBFTQ-MqbtC4u9.js +1 -0
  491. package/dist/demo/assets/treemap-6X3UGDF4-BExpaQPn.js +1 -0
  492. package/dist/demo/assets/v4-DDdyfk2q.js +1 -0
  493. package/dist/demo/assets/vennDiagram-L72KCM5P-BKVdTvjh.js +34 -0
  494. package/dist/demo/assets/wardley-OPB4EBWU-e6QJ2uBL.js +1 -0
  495. package/dist/demo/assets/wardleyDiagram-EHGQE667-DCxRFNx3.js +78 -0
  496. package/dist/demo/assets/xychartDiagram-FW5EYKEG-OnzZBgPH.js +7 -0
  497. package/dist/demo/index.html +23 -0
  498. package/dist/dialog-CxZ2oxD2.cjs +1 -0
  499. package/dist/dialog-DgdVbRUv.js +3 -0
  500. package/dist/dialogs/FileManagerModal.d.ts +9 -0
  501. package/dist/dialogs/InviteModal.d.ts +13 -0
  502. package/dist/dialogs/filemanager-data.d.ts +12 -0
  503. package/dist/dist-BEFKWXG8.js +1 -0
  504. package/dist/dist-BZqs5TU5.js +1 -0
  505. package/dist/dist-C5TeAoJ9.cjs +1 -0
  506. package/dist/dist-Cn_OUKh6.cjs +1 -0
  507. package/dist/dist-CsCFCV4K.js +29 -0
  508. package/dist/dist-D0RROJPB.cjs +1 -0
  509. package/dist/dist-GxnWmQlw.cjs +1 -0
  510. package/dist/dist-ICzvPVCE.cjs +1 -0
  511. package/dist/dist-fiA_WbbM.js +1 -0
  512. package/dist/documents/DocumentTree.d.ts +59 -0
  513. package/dist/documents/defaultDocuments.d.ts +7 -0
  514. package/dist/dom-dataset-D3Nz0h73.js +1 -0
  515. package/dist/dom-dataset-w2ZYeuXJ.cjs +1 -0
  516. package/dist/dropdown-menu-CVJhYAPA.cjs +1 -0
  517. package/dist/dropdown-menu-CfGzSpIy.js +2 -0
  518. package/dist/editor/EditorArea.d.ts +42 -0
  519. package/dist/editor/ReasonDocs.d.ts +7 -0
  520. package/dist/editor/ReasonDocsDialogs.d.ts +47 -0
  521. package/dist/editor/RightPanel.d.ts +43 -0
  522. package/dist/editor/TiptapEditorWrapper.d.ts +56 -0
  523. package/dist/editor/useReasonDocsState.d.ts +108 -0
  524. package/dist/editor/useSyncStore.d.ts +16 -0
  525. package/dist/events.constant-BkYOoqSk.cjs +1 -0
  526. package/dist/events.constant-DYciHxmk.js +2 -0
  527. package/dist/extensions/Attachment/Attachment.d.ts +15 -0
  528. package/dist/extensions/Attachment/components/NodeViewAttachment/FileIcon.d.ts +4 -0
  529. package/dist/extensions/Attachment/components/NodeViewAttachment/FileIconString.d.ts +4 -0
  530. package/dist/extensions/Attachment/components/NodeViewAttachment/NodeViewAttachment.d.ts +4 -0
  531. package/dist/extensions/Attachment/components/RichTextAttachment.d.ts +4 -0
  532. package/dist/extensions/Attachment/index.d.ts +4 -0
  533. package/dist/extensions/Blockquote/Blockquote.d.ts +6 -0
  534. package/dist/extensions/Blockquote/components/RichTextBlockquote.d.ts +4 -0
  535. package/dist/extensions/Blockquote/index.d.ts +4 -0
  536. package/dist/extensions/Bold/Bold.d.ts +6 -0
  537. package/dist/extensions/Bold/components/RichTextBold.d.ts +4 -0
  538. package/dist/extensions/Bold/index.d.ts +4 -0
  539. package/dist/extensions/BulletList/BulletList.d.ts +6 -0
  540. package/dist/extensions/BulletList/components/RichTextBulletList.d.ts +4 -0
  541. package/dist/extensions/BulletList/index.d.ts +4 -0
  542. package/dist/extensions/Callout/Callout.d.ts +18 -0
  543. package/dist/extensions/Callout/components/NodeViewCallout/NodeViewCallout.d.ts +4 -0
  544. package/dist/extensions/Callout/components/RichTextCallout.d.ts +4 -0
  545. package/dist/extensions/Callout/index.d.ts +4 -0
  546. package/dist/extensions/Clear/Clear.d.ts +6 -0
  547. package/dist/extensions/Clear/components/RichTextClear.d.ts +4 -0
  548. package/dist/extensions/Clear/index.d.ts +4 -0
  549. package/dist/extensions/Code/Code.d.ts +6 -0
  550. package/dist/extensions/Code/components/RichTextCode.d.ts +4 -0
  551. package/dist/extensions/Code/index.d.ts +4 -0
  552. package/dist/extensions/CodeBlock/CodeBlock.d.ts +6 -0
  553. package/dist/extensions/CodeBlock/components/RichTextCodeBlock.d.ts +2 -0
  554. package/dist/extensions/CodeBlock/index.d.ts +4 -0
  555. package/dist/extensions/CodeView/CodeView.d.ts +17 -0
  556. package/dist/extensions/CodeView/components/RichTextCodeView.d.ts +4 -0
  557. package/dist/extensions/CodeView/index.d.ts +4 -0
  558. package/dist/extensions/Color/Color.d.ts +22 -0
  559. package/dist/extensions/Color/components/RichTextColor.d.ts +4 -0
  560. package/dist/extensions/Color/index.d.ts +4 -0
  561. package/dist/extensions/Column/Column.d.ts +25 -0
  562. package/dist/extensions/Column/components/RichTextColumn.d.ts +4 -0
  563. package/dist/extensions/Column/index.d.ts +4 -0
  564. package/dist/extensions/Comment/Comment.d.ts +41 -0
  565. package/dist/extensions/Comment/components/CommentView.d.ts +17 -0
  566. package/dist/extensions/Comment/index.d.ts +5 -0
  567. package/dist/extensions/Drawer/Drawer.d.ts +15 -0
  568. package/dist/extensions/Drawer/components/ControlDrawer/ControlDrawer.d.ts +3 -0
  569. package/dist/extensions/Drawer/components/ControlDrawer/icon.d.ts +28 -0
  570. package/dist/extensions/Drawer/components/EditDrawerBlock.d.ts +4 -0
  571. package/dist/extensions/Drawer/components/NodeViewDrawer/NodeViewDrawer.d.ts +2 -0
  572. package/dist/extensions/Drawer/components/RichTextDrawer.d.ts +4 -0
  573. package/dist/extensions/Drawer/index.d.ts +4 -0
  574. package/dist/extensions/Drawio/Drawio.d.ts +17 -0
  575. package/dist/extensions/Drawio/components/NodeViewDrawio/NodeViewDrawio.d.ts +3 -0
  576. package/dist/extensions/Drawio/components/RichTextDrawio.d.ts +4 -0
  577. package/dist/extensions/Drawio/index.d.ts +4 -0
  578. package/dist/extensions/Emoji/Emoji.d.ts +5 -0
  579. package/dist/extensions/Emoji/components/EmojiList/EmojiNodeView.d.ts +11 -0
  580. package/dist/extensions/Emoji/components/RichTextEmoji.d.ts +2 -0
  581. package/dist/extensions/Emoji/index.d.ts +4 -0
  582. package/dist/extensions/ExportPdf/ExportPdf.d.ts +21 -0
  583. package/dist/extensions/ExportPdf/components/RichTextExportPdf.d.ts +4 -0
  584. package/dist/extensions/ExportPdf/index.d.ts +4 -0
  585. package/dist/extensions/ExportWord/ExportWord.d.ts +13 -0
  586. package/dist/extensions/ExportWord/components/RichTextExportWord.d.ts +4 -0
  587. package/dist/extensions/ExportWord/index.d.ts +4 -0
  588. package/dist/extensions/FontFamily/FontFamily.d.ts +10 -0
  589. package/dist/extensions/FontFamily/components/RichTextFontFamily.d.ts +15 -0
  590. package/dist/extensions/FontFamily/index.d.ts +4 -0
  591. package/dist/extensions/FontSize/FontSize.d.ts +32 -0
  592. package/dist/extensions/FontSize/components/RichTextFontSize.d.ts +12 -0
  593. package/dist/extensions/FontSize/index.d.ts +4 -0
  594. package/dist/extensions/Harper/Harper.d.ts +73 -0
  595. package/dist/extensions/Harper/components/RichTextHarper.d.ts +15 -0
  596. package/dist/extensions/Harper/index.d.ts +9 -0
  597. package/dist/extensions/Harper/lib/createHarperLinter.d.ts +22 -0
  598. package/dist/extensions/Harper/lib/extractTextWithMap.d.ts +33 -0
  599. package/dist/extensions/Heading/Heading.d.ts +6 -0
  600. package/dist/extensions/Heading/components/RichTextHeading.d.ts +17 -0
  601. package/dist/extensions/Heading/index.d.ts +4 -0
  602. package/dist/extensions/Highlight/Highlight.d.ts +18 -0
  603. package/dist/extensions/Highlight/components/RichTextHighlight.d.ts +2 -0
  604. package/dist/extensions/Highlight/index.d.ts +4 -0
  605. package/dist/extensions/History/History.d.ts +6 -0
  606. package/dist/extensions/History/components/RichTextHistory.d.ts +3 -0
  607. package/dist/extensions/History/index.d.ts +4 -0
  608. package/dist/extensions/HorizontalRule/HorizontalRule.d.ts +6 -0
  609. package/dist/extensions/HorizontalRule/components/RichTextHorizontalRule.d.ts +4 -0
  610. package/dist/extensions/HorizontalRule/index.d.ts +4 -0
  611. package/dist/extensions/Iframe/Iframe.d.ts +16 -0
  612. package/dist/extensions/Iframe/components/IframeNodeView.d.ts +5 -0
  613. package/dist/extensions/Iframe/components/RichTextIframe.d.ts +4 -0
  614. package/dist/extensions/Iframe/index.d.ts +4 -0
  615. package/dist/extensions/Iframe/utils.d.ts +9 -0
  616. package/dist/extensions/Image/Image.d.ts +57 -0
  617. package/dist/extensions/Image/components/ImageCropper.d.ts +2 -0
  618. package/dist/extensions/Image/components/ImageView.d.ts +3 -0
  619. package/dist/extensions/Image/components/RichTextImage.d.ts +4 -0
  620. package/dist/extensions/Image/index.d.ts +4 -0
  621. package/dist/extensions/ImageGif/ImageGif.d.ts +39 -0
  622. package/dist/extensions/ImageGif/components/ImageGifView.d.ts +3 -0
  623. package/dist/extensions/ImageGif/components/RichTextImageGif.d.ts +2 -0
  624. package/dist/extensions/ImageGif/components/services.d.ts +461 -0
  625. package/dist/extensions/ImageGif/index.d.ts +4 -0
  626. package/dist/extensions/ImportWord/ImportWord.d.ts +16 -0
  627. package/dist/extensions/ImportWord/components/RichTextImportWord.d.ts +4 -0
  628. package/dist/extensions/ImportWord/docx-to-html.d.ts +24 -0
  629. package/dist/extensions/ImportWord/index.d.ts +4 -0
  630. package/dist/extensions/Indent/Indent.d.ts +23 -0
  631. package/dist/extensions/Indent/components/RichTextIndent.d.ts +4 -0
  632. package/dist/extensions/Indent/index.d.ts +4 -0
  633. package/dist/extensions/Italic/Italic.d.ts +6 -0
  634. package/dist/extensions/Italic/components/RichTextItalic.d.ts +4 -0
  635. package/dist/extensions/Italic/index.d.ts +4 -0
  636. package/dist/extensions/Katex/Katex.d.ts +17 -0
  637. package/dist/extensions/Katex/components/KatexWrapper.d.ts +4 -0
  638. package/dist/extensions/Katex/components/RichTextKatex.d.ts +4 -0
  639. package/dist/extensions/Katex/index.d.ts +4 -0
  640. package/dist/extensions/LineHeight/LineHeight.d.ts +7 -0
  641. package/dist/extensions/LineHeight/components/RichTextLightHeight.d.ts +4 -0
  642. package/dist/extensions/LineHeight/index.d.ts +4 -0
  643. package/dist/extensions/Link/Link.d.ts +6 -0
  644. package/dist/extensions/Link/components/LinkEditBlock.d.ts +12 -0
  645. package/dist/extensions/Link/components/LinkViewBlock.d.ts +9 -0
  646. package/dist/extensions/Link/components/RichTextLink.d.ts +4 -0
  647. package/dist/extensions/Link/index.d.ts +4 -0
  648. package/dist/extensions/MarkdownPaste/MarkdownPaste.d.ts +5 -0
  649. package/dist/extensions/MarkdownPaste/index.d.ts +4 -0
  650. package/dist/extensions/Mention/Mention.d.ts +3 -0
  651. package/dist/extensions/Mention/components/NodeViewMentionList.d.ts +16 -0
  652. package/dist/extensions/Mention/index.d.ts +4 -0
  653. package/dist/extensions/Mermaid/Mermaid.d.ts +15 -0
  654. package/dist/extensions/Mermaid/components/EditMermaidBlock.d.ts +8 -0
  655. package/dist/extensions/Mermaid/components/NodeViewMermaid/NodeViewMermaid.d.ts +2 -0
  656. package/dist/extensions/Mermaid/components/RichTextMermaid.d.ts +4 -0
  657. package/dist/extensions/Mermaid/index.d.ts +4 -0
  658. package/dist/extensions/MoreMark/MoreMark.d.ts +20 -0
  659. package/dist/extensions/MoreMark/components/RichTextMoreMark.d.ts +14 -0
  660. package/dist/extensions/MoreMark/index.d.ts +4 -0
  661. package/dist/extensions/OfficePaste/OfficePaste.d.ts +7 -0
  662. package/dist/extensions/OfficePaste/index.d.ts +4 -0
  663. package/dist/extensions/OrderedList/OrderedList.d.ts +6 -0
  664. package/dist/extensions/OrderedList/components/RichTextOrderedList.d.ts +4 -0
  665. package/dist/extensions/OrderedList/index.d.ts +4 -0
  666. package/dist/extensions/Pagination/Pagination.d.ts +37 -0
  667. package/dist/extensions/Pagination/components/RichTextPagination.d.ts +4 -0
  668. package/dist/extensions/Pagination/index.d.ts +5 -0
  669. package/dist/extensions/SearchAndReplace/SearchAndReplace.d.ts +36 -0
  670. package/dist/extensions/SearchAndReplace/components/RichTextSearchAndReplace.d.ts +4 -0
  671. package/dist/extensions/SearchAndReplace/index.d.ts +4 -0
  672. package/dist/extensions/SlashCommand/SlashCommand.d.ts +4 -0
  673. package/dist/extensions/SlashCommand/components/SlashCommandList.d.ts +6 -0
  674. package/dist/extensions/SlashCommand/components/SlashCommandNodeView.d.ts +3 -0
  675. package/dist/extensions/SlashCommand/index.d.ts +4 -0
  676. package/dist/extensions/SlashCommand/renderCommandListDefault.d.ts +7 -0
  677. package/dist/extensions/SlashCommand/types.d.ts +20 -0
  678. package/dist/extensions/Strike/Strike.d.ts +6 -0
  679. package/dist/extensions/Strike/components/RichTextStrike.d.ts +4 -0
  680. package/dist/extensions/Strike/index.d.ts +4 -0
  681. package/dist/extensions/Subscript/components/RichTextSubscript.d.ts +4 -0
  682. package/dist/extensions/Superscript/components/RichTextSuperscript.d.ts +4 -0
  683. package/dist/extensions/Table/Table.d.ts +21 -0
  684. package/dist/extensions/Table/TableCellBackground.d.ts +14 -0
  685. package/dist/extensions/Table/components/CreateTablePopover.d.ts +8 -0
  686. package/dist/extensions/Table/components/RichTextTable.d.ts +2 -0
  687. package/dist/extensions/Table/index.d.ts +4 -0
  688. package/dist/extensions/TableOfContents/TableOfContents.d.ts +15 -0
  689. package/dist/extensions/TableOfContents/components/RichTextTableOfContents.d.ts +8 -0
  690. package/dist/extensions/TableOfContents/components/RichTextTableOfContentsPanel.d.ts +19 -0
  691. package/dist/extensions/TableOfContents/index.d.ts +6 -0
  692. package/dist/extensions/TaskList/TaskList.d.ts +11 -0
  693. package/dist/extensions/TaskList/components/RichTextTaskList.d.ts +4 -0
  694. package/dist/extensions/TaskList/index.d.ts +4 -0
  695. package/dist/extensions/TextAlign/TextAlign.d.ts +17 -0
  696. package/dist/extensions/TextAlign/components/RichTextAlign.d.ts +14 -0
  697. package/dist/extensions/TextAlign/index.d.ts +4 -0
  698. package/dist/extensions/TextDirection/TextDirection.d.ts +5 -0
  699. package/dist/extensions/TextDirection/components/RichTextTextDirection.d.ts +15 -0
  700. package/dist/extensions/TextDirection/index.d.ts +4 -0
  701. package/dist/extensions/TextUnderline/TextUnderline.d.ts +6 -0
  702. package/dist/extensions/TextUnderline/components/RichTextUnderline.d.ts +4 -0
  703. package/dist/extensions/TextUnderline/index.d.ts +4 -0
  704. package/dist/extensions/Twitter/Twitter.d.ts +46 -0
  705. package/dist/extensions/Twitter/components/FormEditLinkTwitter.d.ts +9 -0
  706. package/dist/extensions/Twitter/components/NodeViewTweet.d.ts +8 -0
  707. package/dist/extensions/Twitter/components/RichTextTwitter.d.ts +4 -0
  708. package/dist/extensions/Twitter/index.d.ts +4 -0
  709. package/dist/extensions/Video/Video.d.ts +66 -0
  710. package/dist/extensions/Video/components/RichTextVideo.d.ts +4 -0
  711. package/dist/extensions/Video/index.d.ts +4 -0
  712. package/dist/extensions/WordCount/WordCount.d.ts +7 -0
  713. package/dist/extensions/WordCount/components/RichTextWordCount.d.ts +4 -0
  714. package/dist/extensions/WordCount/index.d.ts +4 -0
  715. package/dist/extensions/WordCount/utils/wordCount.d.ts +25 -0
  716. package/dist/extensions/Zoom/components/RichTextZoom.d.ts +2 -0
  717. package/dist/features/ai-rewrite/AIRewriteSuggestion.d.ts +27 -0
  718. package/dist/features/ai-rewrite/rewriteModes.d.ts +37 -0
  719. package/dist/features/settings/Settings.d.ts +11 -0
  720. package/dist/features/settings/sections/AIRewriteModesSection.d.ts +6 -0
  721. package/dist/features/settings/sections/AboutSection.d.ts +1 -0
  722. package/dist/features/settings/sections/AppearanceSection.d.ts +6 -0
  723. package/dist/features/settings/sections/FileSourcesSection.d.ts +6 -0
  724. package/dist/features/settings/sections/StorageSection.d.ts +6 -0
  725. package/dist/features/tags/TagManagementDialog.d.ts +18 -0
  726. package/dist/features/team/TeamManagement.d.ts +13 -0
  727. package/dist/file-B1Z0XcVJ.cjs +1 -0
  728. package/dist/file-aBzFF1LO.js +1 -0
  729. package/dist/file-tree/FileTreeContextMenu.d.ts +18 -0
  730. package/dist/file-tree/documentUtils.d.ts +57 -0
  731. package/dist/file-tree/filetree.d.ts +28 -0
  732. package/dist/file-tree/index.d.ts +8 -0
  733. package/dist/file-tree/useFileTreeOperations.d.ts +27 -0
  734. package/dist/floating-ui.dom-D9FglguG.cjs +1 -0
  735. package/dist/floating-ui.dom-DledU50u.js +1 -0
  736. package/dist/hooks/use-mobile.d.ts +5 -0
  737. package/dist/hooks/useActive.d.ts +24 -0
  738. package/dist/hooks/useAttributes.d.ts +2 -0
  739. package/dist/hooks/useButtonProps.d.ts +4 -0
  740. package/dist/hooks/useCopy.d.ts +8 -0
  741. package/dist/hooks/useExtension.d.ts +4 -0
  742. package/dist/hooks/useLocalStorage.d.ts +13 -0
  743. package/dist/html-to-docx.esm-BSqAFns8.cjs +1 -0
  744. package/dist/html-to-docx.esm-DkztZsL5-DQYdhD3B.cjs +1 -0
  745. package/dist/html-to-docx.esm-DkztZsL5.js +1 -0
  746. package/dist/index.cjs +1 -0
  747. package/dist/index.d.ts +10 -0
  748. package/dist/index.js +1 -0
  749. package/dist/input-AvqqajGM.cjs +1 -0
  750. package/dist/input-CMD6LZFr.js +1 -0
  751. package/dist/isNumber-7Fi2iQVS.js +1 -0
  752. package/dist/isNumber-CmHpmrpR.cjs +1 -0
  753. package/dist/jsx-runtime-BLWGWoMZ.cjs +1 -0
  754. package/dist/jsx-runtime-DqgyBF0N.js +1 -0
  755. package/dist/jszip.min-3Yxv_4wz.cjs +1 -0
  756. package/dist/jszip.min-BUJ6OksG.js +1 -0
  757. package/dist/label-DPSH3PiY.cjs +1 -0
  758. package/dist/label-Dx1mMx8l.js +1 -0
  759. package/dist/layout/Sidebar.d.ts +7 -0
  760. package/dist/layout/sidebar/Sidebar.d.ts +2 -0
  761. package/dist/layout/sidebar/SidebarContent.d.ts +76 -0
  762. package/dist/layout/sidebar/SidebarFooter.d.ts +45 -0
  763. package/dist/layout/sidebar/SidebarToolbar.d.ts +85 -0
  764. package/dist/layout/sidebar/SidebarViewMenu.d.ts +24 -0
  765. package/dist/layout/sidebar/fileSourceUtils.d.ts +2 -0
  766. package/dist/layout/sidebar/index.d.ts +12 -0
  767. package/dist/layout/sidebar/panelOptions.d.ts +29 -0
  768. package/dist/layout/sidebar/types.d.ts +68 -0
  769. package/dist/lib/utils.d.ts +2 -0
  770. package/dist/locale-bundle.cjs +1 -0
  771. package/dist/locale-bundle.d.ts +4 -0
  772. package/dist/locale-bundle.js +1 -0
  773. package/dist/locales/ar.d.ts +201 -0
  774. package/dist/locales/de.d.ts +201 -0
  775. package/dist/locales/en.d.ts +201 -0
  776. package/dist/locales/es.d.ts +201 -0
  777. package/dist/locales/fa.d.ts +201 -0
  778. package/dist/locales/fi.d.ts +201 -0
  779. package/dist/locales/fr.d.ts +201 -0
  780. package/dist/locales/he.d.ts +201 -0
  781. package/dist/locales/hi.d.ts +201 -0
  782. package/dist/locales/hu.d.ts +201 -0
  783. package/dist/locales/index.d.ts +3576 -0
  784. package/dist/locales/it.d.ts +201 -0
  785. package/dist/locales/ja.d.ts +201 -0
  786. package/dist/locales/ko.d.ts +201 -0
  787. package/dist/locales/nl.d.ts +201 -0
  788. package/dist/locales/pt-br.d.ts +201 -0
  789. package/dist/locales/ru.d.ts +201 -0
  790. package/dist/locales/tr.d.ts +201 -0
  791. package/dist/locales/uk.d.ts +201 -0
  792. package/dist/locales/vi.d.ts +201 -0
  793. package/dist/locales/zh-cn.d.ts +201 -0
  794. package/dist/locales-DfkG6-1b.js +1 -0
  795. package/dist/locales-Dg9XL0yP.cjs +1 -0
  796. package/dist/plugins/image-upload.d.ts +13 -0
  797. package/dist/popover-DEGqjF2J.cjs +1 -0
  798. package/dist/popover-DGEv-NbL.js +1 -0
  799. package/dist/reason-docs.cjs +1 -0
  800. package/dist/reason-docs.d.ts +1 -0
  801. package/dist/reason-docs.js +1 -0
  802. package/dist/renderCommandListDefault-CJd5Cd3Q.js +1 -0
  803. package/dist/renderCommandListDefault-CykwYpTX.cjs +1 -0
  804. package/dist/renderNodeView-Bis8Vxth.cjs +1 -0
  805. package/dist/renderNodeView-EV3OWici.js +1 -0
  806. package/dist/rolldown-runtime-BeavJI0R.cjs +1 -0
  807. package/dist/rolldown-runtime-Drgf5FY8-7XpCJKyX.cjs +1 -0
  808. package/dist/rolldown-runtime-Drgf5FY8.js +1 -0
  809. package/dist/search/DynamicIslandTOC.d.ts +14 -0
  810. package/dist/search/OutlineView.d.ts +29 -0
  811. package/dist/search/SearchModal.d.ts +26 -0
  812. package/dist/separator-BHN46aj5.cjs +1 -0
  813. package/dist/separator-CTa6o9S_.js +10 -0
  814. package/dist/shortId-B25DIOpW.cjs +1 -0
  815. package/dist/shortId-COE42cHb.js +1 -0
  816. package/dist/src-C7k3RYxJ.js +646 -0
  817. package/dist/src-DYbBlAjR.cjs +1 -0
  818. package/dist/store/EditorEditableReactive.d.ts +4 -0
  819. package/dist/store/ThemeColorReactive.d.ts +4 -0
  820. package/dist/store/commandList.d.ts +2 -0
  821. package/dist/store/editor.d.ts +21 -0
  822. package/dist/store/store.d.ts +6 -0
  823. package/dist/style.css +5 -0
  824. package/dist/tabs-BovAV0Y3.js +1 -0
  825. package/dist/tabs-CoJRfGS8.cjs +1 -0
  826. package/dist/textarea-BFbGcrSO.cjs +1 -0
  827. package/dist/textarea-uEPOPNqf.js +1 -0
  828. package/dist/theme/theme.d.ts +372 -0
  829. package/dist/theme.cjs +1 -0
  830. package/dist/theme.js +1 -0
  831. package/dist/throttle-BpbN7uB1.js +1 -0
  832. package/dist/throttle-COe5rswR.cjs +1 -0
  833. package/dist/toggle-BXl_NYYh.js +2 -0
  834. package/dist/toggle-CRftKzl0.cjs +1 -0
  835. package/dist/tooltip-CzY0Diit.cjs +1 -0
  836. package/dist/tooltip-DC3DBc55.js +5 -0
  837. package/dist/types.d.ts +223 -0
  838. package/dist/updatePosition-CBT0mUIB.js +1 -0
  839. package/dist/updatePosition-DMu5F8JX.cjs +1 -0
  840. package/dist/useButtonProps-D2Hd5DbR.cjs +1 -0
  841. package/dist/useButtonProps-DSIajp_B.js +1 -0
  842. package/dist/utils/base64.d.ts +5 -0
  843. package/dist/utils/cdn-loader.d.ts +10 -0
  844. package/dist/utils/checkIsVideoUrl.d.ts +4 -0
  845. package/dist/utils/color.d.ts +10 -0
  846. package/dist/utils/columns.d.ts +14 -0
  847. package/dist/utils/customEvents/events.constant.d.ts +9 -0
  848. package/dist/utils/delete-node.d.ts +2 -0
  849. package/dist/utils/dom-dataset.d.ts +31 -0
  850. package/dist/utils/download.d.ts +4 -0
  851. package/dist/utils/dynamicCSS.d.ts +28 -0
  852. package/dist/utils/editor-container-size.d.ts +4 -0
  853. package/dist/utils/file.d.ts +30 -0
  854. package/dist/utils/getRenderContainer.d.ts +3 -0
  855. package/dist/utils/indent.d.ts +14 -0
  856. package/dist/utils/is-mobile.d.ts +22 -0
  857. package/dist/utils/json.d.ts +5 -0
  858. package/dist/utils/lru-cache.d.ts +34 -0
  859. package/dist/utils/mitt.d.ts +24 -0
  860. package/dist/utils/node.d.ts +15 -0
  861. package/dist/utils/pdf.d.ts +3 -0
  862. package/dist/utils/plateform.d.ts +14 -0
  863. package/dist/utils/renderNodeView.d.ts +9 -0
  864. package/dist/utils/shortId.d.ts +4 -0
  865. package/dist/utils/storage.d.ts +7 -0
  866. package/dist/utils/updatePosition.d.ts +4 -0
  867. package/dist/utils/utils.d.ts +20 -0
  868. package/dist/utils/validateFile.d.ts +16 -0
  869. package/dist/which-typed-array-Dj_53908.js +1 -0
  870. package/dist/which-typed-array-MFmINaJW.cjs +1 -0
  871. package/package.json +912 -0
@@ -0,0 +1,10 @@
1
+ import{a as e,n as t,o as n,r,t as i}from"./rolldown-runtime-C0FnF6B9.js";import{$n as a,$r as o,$t as s,An as c,Ar as l,Bn as u,Br as d,Bt as f,Cr as p,Dn as m,Dr as h,En as g,Er as _,Fn as v,Fr as y,Ft as b,Gn as x,Gr as S,Hn as C,Hr as w,Ht as T,In as E,Ir as D,It as O,Jn as k,Jr as A,Kn as j,Kr as ee,Ln as M,Lr as N,Mn as te,Mr as P,Nn as F,Nr as I,On as L,Or as ne,Pn as re,Pr as ie,Qn as ae,Qr as oe,Qt as se,Rn as R,Rr as ce,Sr as le,T as ue,Tn as de,Tr as fe,U as pe,Un as me,Ur as he,Ut as ge,Vn as _e,Vr as ve,Vt as ye,Wn as be,Wr as xe,Wt as Se,Xn as Ce,Xr as we,Xt as Te,Yn as Ee,Yr as z,Zn as De,Zr as Oe,Zt as ke,_r as Ae,ai as je,an as Me,ar as Ne,br as Pe,ci as Fe,cn as Ie,cr as Le,di as Re,dn as ze,dr as Be,ei as Ve,en as He,er as Ue,fn as We,fr as Ge,gr as Ke,hr as qe,ii as Je,in as Ye,ir as Xe,jn as Ze,jr as Qe,kn as $e,kr as et,li as tt,ln as nt,lr as rt,mn as it,mr as at,n as ot,ni as st,nn as ct,nr as lt,oi as ut,on as dt,or as ft,pn as pt,pr as mt,qn as ht,qr as gt,ri as _t,rn as vt,rr as yt,si as bt,sn as xt,sr as St,t as Ct,ti as wt,tn as Tt,tr as Et,ui as Dt,un as Ot,ur as kt,vr as At,w as jt,wr as Mt,x as Nt,xr as Pt,yr as Ft,zn as It,zr as Lt}from"./editorConfig-DhK0JFvA.js";var Rt=N(`building-2`,[[`path`,{d:`M10 12h4`,key:`a56b0p`}],[`path`,{d:`M10 8h4`,key:`1sr2af`}],[`path`,{d:`M14 21v-3a2 2 0 0 0-4 0v3`,key:`1rgiei`}],[`path`,{d:`M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2`,key:`secmi2`}],[`path`,{d:`M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16`,key:`16ra0t`}]]),zt=N(`chevrons-down-up`,[[`path`,{d:`m7 20 5-5 5 5`,key:`13a0gw`}],[`path`,{d:`m7 4 5 5 5-5`,key:`1kwcof`}]]),Bt=N(`cloud`,[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]),Vt=N(`command`,[[`path`,{d:`M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3`,key:`11bfej`}]]),Ht=N(`crown`,[[`path`,{d:`M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z`,key:`1vdc57`}],[`path`,{d:`M5 21h14`,key:`11awu3`}]]),Ut=N(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),Wt=N(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),Gt=N(`file-plus`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M9 15h6`,key:`cctwl0`}],[`path`,{d:`M12 18v-6`,key:`17g6i2`}]]),Kt=N(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),qt=N(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),Jt=N(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),Yt=N(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),Xt=N(`folders`,[[`path`,{d:`M20 5a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h2.5a1.5 1.5 0 0 1 1.2.6l.6.8a1.5 1.5 0 0 0 1.2.6z`,key:`a4852j`}],[`path`,{d:`M3 8.268a2 2 0 0 0-1 1.738V19a2 2 0 0 0 2 2h11a2 2 0 0 0 1.732-1`,key:`yxbcw3`}]]),Zt=N(`hard-drive`,[[`path`,{d:`M10 16h.01`,key:`1bzywj`}],[`path`,{d:`M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`18tbho`}],[`path`,{d:`M21.946 12.013H2.054`,key:`zqlbp7`}],[`path`,{d:`M6 16h.01`,key:`1pmjb7`}]]),Qt=N(`hash`,[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]),$t=N(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),en=N(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),tn=N(`log-in`,[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]),nn=N(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),rn=N(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),an=N(`pen`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),on=N(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),sn=N(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),cn=N(`square-split-vertical`,[[`path`,{d:`M5 8V5c0-1 1-2 2-2h10c1 0 2 1 2 2v3`,key:`1pi83i`}],[`path`,{d:`M19 16v3c0 1-1 2-2 2H7c-1 0-2-1-2-2v-3`,key:`ido5k7`}],[`line`,{x1:`4`,x2:`20`,y1:`12`,y2:`12`,key:`1e0a9i`}]]),ln=N(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),un=N(`tag`,[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]),dn=N(`text-align-start`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M17 19H3`,key:`z6ezky`}]]),fn=N(`user-plus`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}],[`line`,{x1:`19`,x2:`19`,y1:`8`,y2:`14`,key:`1bvyxn`}],[`line`,{x1:`22`,x2:`16`,y1:`11`,y2:`11`,key:`1shjgl`}]]),pn=N(`wand-sparkles`,[[`path`,{d:`m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72`,key:`ul74o6`}],[`path`,{d:`m14 7 3 3`,key:`1r5n42`}],[`path`,{d:`M5 6v4`,key:`ilb8ba`}],[`path`,{d:`M19 14v4`,key:`blhpug`}],[`path`,{d:`M10 2v2`,key:`7u0qdc`}],[`path`,{d:`M7 8H3`,key:`zfb6yr`}],[`path`,{d:`M21 16h-4`,key:`1cnmox`}],[`path`,{d:`M11 3H9`,key:`1obp7u`}]]),mn=N(`workflow`,[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]),B=n(Re(),1),hn=tt(),V=Ve();function H(...e){return ft(St(e))}function gn({...e}){return(0,V.jsx)(ce,{"data-slot":`sheet`,...e})}function _n({...e}){return(0,V.jsx)(he,{"data-slot":`sheet-portal`,...e})}function vn({className:e,...t}){return(0,V.jsx)(w,{"data-slot":`sheet-overlay`,className:H(`data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50`,e),...t})}function yn({className:e,children:t,side:n=`right`,...r}){return(0,V.jsxs)(_n,{children:[(0,V.jsx)(vn,{}),(0,V.jsxs)(d,{"data-slot":`sheet-content`,className:H(`bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500`,n===`right`&&`data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm`,n===`left`&&`data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm`,n===`top`&&`data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b`,n===`bottom`&&`data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t`,e),...r,children:[t,(0,V.jsxs)(Lt,{className:`ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none`,children:[(0,V.jsx)(Le,{className:`size-4`}),(0,V.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function bn({className:e,...t}){return(0,V.jsx)(`div`,{"data-slot":`sheet-header`,className:H(`flex flex-col gap-1.5 p-4`,e),...t})}function xn({className:e,...t}){return(0,V.jsx)(xe,{"data-slot":`sheet-title`,className:H(`text-foreground font-semibold`,e),...t})}function Sn({className:e,...t}){return(0,V.jsx)(ve,{"data-slot":`sheet-description`,className:H(`text-muted-foreground text-sm`,e),...t})}var Cn=`REASON-file-sources`,wn=`REASON-active-file-source`,Tn={id:`local-default`,name:`Local Files`,type:`local`,isDefault:!0,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};function En(){try{let e=localStorage.getItem(Cn);if(e){let t=JSON.parse(e);return t.some(e=>e.id===`local-default`)?t:[Tn,...t]}}catch(e){console.error(`Error loading file sources:`,e)}return[Tn]}function Dn(e){try{localStorage.setItem(Cn,JSON.stringify(e))}catch(e){console.error(`Error saving file sources:`,e)}}function On(e){let t={...e,id:`${e.type}-${Date.now()}`,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};return Dn([...En(),t]),t}function kn(e,t){Dn(En().map(n=>n.id===e?{...n,...t,updatedAt:new Date().toISOString()}:n))}function An(e){if(e===`local-default`){console.warn(`Cannot delete default local source`);return}Dn(En().filter(t=>t.id!==e)),jn()===e&&Mn(`local-default`)}function jn(){try{return localStorage.getItem(wn)||`local-default`}catch(e){return console.error(`Error getting active file source:`,e),`local-default`}}function Mn(e){try{localStorage.setItem(wn,e)}catch(e){console.error(`Error setting active file source:`,e)}}function Nn(){let e=En(),t=jn();return e.find(e=>e.id===t)||Tn}new Date().valueOf();function Pn(e){let[t,n]=(0,B.useState)(e),r=(0,B.useRef)(e);return(0,B.useEffect)(()=>{if(r.current!==e){if(Array.isArray(r.current)&&Array.isArray(e)&&r.current.length===0&&e.length===0)return;r.current=e,n(e)}},[e]),[t,n]}function Fn(e,t){return typeof e==`function`?typeof t==`object`?e(t):e():e}function In(e,t=`data-id`){let n=e;for(!n.tagName&&e.target&&(n=e.target);n;){if(n.getAttribute&&n.getAttribute(t))return n;n=n.parentNode}return null}function Ln(e,t=`data-id`){let n=In(e,t);return n?n.getAttribute(t):null}function Rn(e,t=`data-id`){let n=In(e,t);return n?zn(n,t):null}function zn(e,t=`data-id`){let n=e.getAttribute(t);return n?Vn(n):null}function Bn(e){return typeof e==`string`?`:`+e:e}function Vn(e){if(e.startsWith(`:`))return e.substring(1);let t=e*1;return isNaN(t)?e:t}function Hn(){return{detect:()=>!0,addEvent:function(e,t,n){return e.addEventListener(t,n),()=>e.removeEventListener(t,n)},addGlobalEvent:function(e,t){return document.addEventListener(e,t),()=>document.removeEventListener(e,t)},getTopNode:function(){return window.document.body}}}var Un=Hn();function Wn(e){Object.assign(Un,e)}function Gn(e,t,n){function r(e){let r=In(e);if(!r)return;let i=zn(r);if(typeof t==`function`)return t(i,e);let a,o=e.target;for(;o!=r;){if(a=o.dataset?o.dataset.action:null,a&&t[a]){t[a](i,e);return}o=o.parentNode}t[n]&&t[n](i,e)}Un.addEvent(e,n,r)}function Kn(e,t){Gn(e,t,`click`),t.dblclick&&Gn(e,t.dblclick,`dblclick`)}function qn(e,t){for(let n=e.length-1;n>=0;n--)if(e[n]===t){e.splice(n,1);break}}function Jn(e,t,n){for(let r=0;r<Qn.length;r++){if(r===n)continue;let i=Qn[r],a=i.props.parent?.();if(a&&e.contains(a)&&i.node.contains(t))return!0}return!1}var Yn=new Date,Xn=!1,Zn=[],Qn=[],$n=e=>{let t=e.target;if(Xn||!t.isConnected){Xn=!1;return}for(let n=Qn.length-1;n>=0;n--){let{node:r,date:i,props:a}=Qn[n];if(!(i>Yn)&&!r.contains(t)&&r!==t&&(Jn(r,t,n)||(a.callback&&a.callback(e),a.modal||e.defaultPrevented)))break}},er=e=>{Yn=new Date,Xn=!0;for(let t=Qn.length-1;t>=0;t--){let{node:n}=Qn[t];if(!n.contains(e.target)&&n!==e.target){Xn=!1;break}}};function tr(e,t){Zn.length||(Zn=[Un.addGlobalEvent(`click`,$n,e),Un.addGlobalEvent(`contextmenu`,$n,e),Un.addGlobalEvent(`mousedown`,er,e)]),typeof t!=`object`&&(t={callback:t});let n={node:e,date:new Date,props:t};return Qn.push(n),{destroy(){qn(Qn,n),Qn.length||(Zn.forEach(e=>e()),Zn=[])}}}var nr=e=>e.indexOf(`bottom`)!==-1,rr=e=>e.indexOf(`left`)!==-1,ir=e=>e.indexOf(`right`)!==-1,ar=e=>e.indexOf(`top`)!==-1,or=e=>e.indexOf(`fit`)!==-1,sr=e=>e.indexOf(`overlap`)!==-1,cr=e=>e.split(`-`).every(e=>[`center`,`fit`].indexOf(e)>-1),lr=e=>{let t=e.match(/(start|center|end)/);return t?t[0]:null};function ur(e,t){let n=0,r=Un.getTopNode(e);for(;e&&e!==r;){let r=getComputedStyle(e).position;if((r===`absolute`||r===`relative`||r===`fixed`)&&(n=parseInt(getComputedStyle(e).zIndex)||0),e=e.parentNode,e===t)break}return n}var dr,fr,pr,mr;function hr(e,t,n=`bottom`,r=0,i=0){if(!e)return null;dr=r,fr=i,pr=`auto`;let a=0,o=0,s=n,c=gr(e),l=sr(n)?Un.getTopNode(e):c;if(!c)return null;let u=c.getBoundingClientRect(),d=e.getBoundingClientRect(),f=l.getBoundingClientRect(),p=window.getComputedStyle(l),m={left:0,top:0,bottom:0,right:0};for(let e in m){let t=`border-${e}-width`;m[e]=parseFloat(p.getPropertyValue(t))}if(t){let e=ur(t,c);a=Math.max(e+1,20)}if(t){if(mr=t.getBoundingClientRect(),or(n)&&(pr=mr.width+`px`),n!==`point`)if(cr(n))or(n)?dr=0:(dr=f.width/2,o=1),fr=(f.height-d.height)/2;else{let e=+!sr(n);dr=ir(n)?mr.right+e:mr.left-e,fr=nr(n)?mr.bottom+1:mr.top;let t=lr(n);t&&(ir(n)||rr(n)?t===`center`?fr-=(d.height-mr.height)/2:t===`end`&&(fr-=d.height-mr.height):(nr(n)||ar(n))&&(t===`center`?dr-=(d.width-mr.width)/2:t===`end`&&(dr-=d.width-mr.width),sr(n)||(dr+=1)))}}else mr={left:r,right:r,top:i,bottom:i};let h=(rr(n)||ir(n))&&(nr(n)||ar(n));rr(n)&&(o=2);let g=dr-d.width-f.left;t&&rr(n)&&!h&&g<0&&(dr=mr.right,o=0,s=s.replace(`left`,`right`));let _=dr+d.width*(1-o/2)-f.right;if(_>0)if(!ir(n))dr=f.right-m.right-d.width;else{let e=mr.left-f.x-d.width;t&&!h&&e>=0?(dr=mr.left-d.width,s=s.replace(`right`,`left`)):dr-=_+m.right}o&&(dr=Math.round(dr-d.width*o/2));let v=g<0||_>0||!h;ar(n)&&(fr=mr.top-d.height,t&&fr<f.y&&v&&(fr=mr.bottom,s=s.replace(`top`,`bottom`)));let y=fr+d.height-f.bottom;return y>0&&(t&&nr(n)&&v?(fr-=d.height+mr.height+1,s=s.replace(`bottom`,`top`)):fr-=y+m.bottom),dr-=u.left+m.left,fr-=u.top+m.top,dr=(sr(n)?dr:Math.max(dr,0))+l.scrollLeft,fr=(sr(n)?fr:Math.max(fr,0))+l.scrollTop,pr||=`auto`,{at:s,x:dr,y:fr,z:a,width:pr}}function gr(e){let t=Un.getTopNode(e);for(e&&=e.parentElement;e;){let n=getComputedStyle(e).position;if(e===t||n===`relative`||n===`absolute`||n===`fixed`)return e;e=e.parentNode}return null}function _r(e){let t=[],n=e,r=Un.getTopNode(e);for(;n&&n!==r&&!n.getAttribute(`data-wx-portal-root`);)getComputedStyle(n).position===`absolute`&&t.push(n),n=n.parentNode;return t}var vr=new Date().valueOf();function yr(){return vr+=1,vr}function br(e){return e<10?`0`+e:e.toString()}function xr(e){let t=br(e);return t.length==2?`0`+t:t}function Sr(e){let t=Math.floor(e/11)*11;return{start:t,end:t+11}}function Cr(e){let t=(e.getDay()+6)%7,n=new Date(e.valueOf());n.setDate(e.getDate()+(3-t)),n.setHours(0,0,0,0);let r=new Date(n.getFullYear(),0,1),i=Math.round((n.getTime()-r.getTime())/864e5);return 1+Math.floor(i/7)}var wr=[``,``];function Tr(e,t,n){switch(e){case`%d`:return br(t.getDate());case`%m`:return br(t.getMonth()+1);case`%j`:return t.getDate();case`%n`:return t.getMonth()+1;case`%y`:return br(t.getFullYear()%100);case`%Y`:return t.getFullYear();case`%D`:return n.dayShort[t.getDay()];case`%l`:return n.dayFull[t.getDay()];case`%M`:return n.monthShort[t.getMonth()];case`%F`:return n.monthFull[t.getMonth()];case`%h`:return br((t.getHours()+11)%12+1);case`%g`:return(t.getHours()+11)%12+1;case`%G`:return t.getHours();case`%H`:return br(t.getHours());case`%i`:return br(t.getMinutes());case`%a`:return((t.getHours()>11?n.pm:n.am)||wr)[0];case`%A`:return((t.getHours()>11?n.pm:n.am)||wr)[1];case`%s`:return br(t.getSeconds());case`%S`:return xr(t.getMilliseconds());case`%W`:return br(Cr(t));case`%w`:{let e=n.weekStart??1;if(e===1)return br(Cr(t));let r=(t.getDay()-e+7)%7,i=(1-e+7)%7,a=new Date(t.valueOf());return a.setDate(t.getDate()+(i-r)),br(Cr(a))}case`%c`:{let e=t.getFullYear()+``;return e+=`-`+br(t.getMonth()+1),e+=`-`+br(t.getDate()),e+=`T`,e+=br(t.getHours()),e+=`:`+br(t.getMinutes()),e+=`:`+br(t.getSeconds()),e}case`%Q`:return Math.floor(t.getMonth()/3)+1;default:return e}}var Er=/%[a-zA-Z]/g;function Dr(e,t){return typeof e==`function`?e:function(n){return n?(n.getMonth||(n=new Date(n)),e.replace(Er,e=>Tr(e,n,t))):``}}function Or(e){return e&&typeof e==`object`&&!Array.isArray(e)}function kr(e,t){for(let n in t){let r=t[n];e[n]=Or(e[n])&&Or(r)?kr({...e[n]},t[n]):t[n]}return e}function Ar(e){return{getGroup(t){let n=e[t];return e=>n&&n[e]||e},getRaw(){return e},extend(t,n){if(!t)return this;let r;return r=n?kr({...t},e):kr({...e},t),Ar(r)}}}var jr={core:{ok:`OK`,cancel:`Cancel`,select:`Select`,"No data":`No data`,"Rows per page":`Rows per page`,"Total pages":`Total pages`},calendar:{monthFull:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],monthShort:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],dayFull:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],dayShort:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],hours:`Hours`,minutes:`Minutes`,done:`Done`,clear:`Clear`,today:`Today`,am:[`am`,`AM`],pm:[`pm`,`PM`],weekStart:0,clockFormat:24},formats:{timeFormat:`%H:%i`,dateFormat:`%m/%d/%Y`,monthYearFormat:`%F %Y`,yearFormat:`%Y`},lang:`en-US`},Mr=n(Dt(),1),Nr=(0,B.createContext)(``),Pr=(0,B.createContext)({}),Fr=(0,B.createContext)(null),Ir=(0,B.createContext)(null),Lr=Object.freeze(Object.defineProperty({__proto__:null,fieldId:Ir,helpers:Pr,i18n:Fr,theme:Nr},Symbol.toStringTag,{value:`Module`}));function Rr(e){let t=(0,B.useContext)(Ir),[n]=(0,B.useState)(()=>e||t||yr());return n}function zr({type:e=``,css:t=``,icon:n=``,disabled:r=!1,title:i=``,tooltip:a,text:o=``,children:s,onClick:c}){let l=(0,B.useMemo)(()=>{let n=e?e.split(` `).filter(e=>e!==``).map(e=>`wx-`+e).join(` `):``;return t+(t?` `:``)+n},[e,t]);return(0,V.jsxs)(`button`,{title:i,className:`wx-2ZWgb4 wx-button ${l} ${n&&!s?`wx-icon`:``}`,disabled:r,onClick:e=>{c&&c(e)},"data-tooltip-text":a,children:[n&&(0,V.jsx)(`i`,{className:`wx-2ZWgb4 `+n}),s||o||` `]})}function Br({id:e,label:t=``,inputValue:n=``,value:r=!1,onChange:i,disabled:a=!1,css:o=``}){let s=Rr(e),[c,l]=Pn(r);return(0,V.jsxs)(`div`,{className:`wx-2IvefP wx-checkbox ${o}`,children:[(0,V.jsx)(`input`,{type:`checkbox`,id:s,disabled:a,className:`wx-2IvefP wx-check`,checked:c,value:n,onChange:({target:e})=>{let t=e.checked;l(t),i&&i({value:t,inputValue:n})}}),(0,V.jsxs)(`label`,{htmlFor:s,className:`wx-2IvefP wx-label`,children:[(0,V.jsx)(`span`,{className:`wx-2IvefP wx-before`}),t&&(0,V.jsx)(`span`,{className:`wx-2IvefP wx-after`,children:t})]})]})}function Vr({theme:e=``,target:t,children:n}){let r=(0,B.useRef)(null),i=(0,B.useRef)(null),[a,o]=(0,B.useState)(null);r.current||=document.createElement(`div`);let s=(0,B.useContext)(Nr);return(0,B.useEffect)(()=>{o(t||Hr(i.current)||Un.getTopNode(i.current))},[i.current]),(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{ref:i,style:{display:`none`}}),i.current&&a?(0,Mr.createPortal)((0,V.jsx)(`div`,{className:`wx-3ZWsT0 wx-${e||s}-theme`,children:n}),a):null]})}function Hr(e){let t=Un.getTopNode(e);for(;e&&e!==t&&!e.getAttribute(`data-wx-portal-root`);)e=e.parentNode;return e}function Ur({left:e=0,top:t=0,at:n=`bottom`,parent:r=null,width:i=`auto`,css:a=``,onCancel:o,children:s,trackScroll:c=!1}){let[l,u]=(0,B.useState)(0),[d,f]=(0,B.useState)(0),[p,m]=(0,B.useState)(`auto`),[h,g]=(0,B.useState)(!1),_=(0,B.useRef)(null),v=(0,B.useRef)(null),y=(0,B.useRef)(o);(0,B.useEffect)(()=>{y.current=o},[o]);function b(e){return r&&(i+``).indexOf(`%`)>-1?i.replace(/(\d+)%/,(e,t)=>(t=t*r.offsetWidth/100+`px`,i.replace(e,t))):i&&i!==`auto`?i:e}let x=(0,B.useCallback)(()=>{if(!_.current)return;let i=hr(_.current,r,n,e,t);i&&(u(i.x),f(i.y),m(b(i.width)))},[_,r,n,e,t,i]);return(0,B.useLayoutEffect)(()=>{let e=e=>{y.current&&e.target!==v.current&&_.current&&!_.current.contains(e.target)&&y.current(e)},t;return requestAnimationFrame(()=>{x(),g(!0),c&&_.current&&(v.current=gr(_.current),v.current&&v.current.addEventListener(`scroll`,e,!0)),r&&(t=new ResizeObserver(x),t.observe(r))}),()=>{c&&v.current&&v.current.removeEventListener(`scroll`,e,!0),t?.disconnect()}},[]),(0,B.useLayoutEffect)(()=>{x()},[r,n,e,t]),(0,B.useEffect)(()=>{let e=e=>{y.current&&y.current(e)};if(_.current)return tr(_.current,{callback:e,parent:()=>r}).destroy},[r]),(0,V.jsx)(`div`,{ref:_,className:[`wx-37M6Fj`,`wx-popup`,a].filter(Boolean).join(` `),style:{position:`absolute`,visibility:h?`visible`:`hidden`,top:d+`px`,left:l+`px`,width:p},children:s})}function Wr({position:e=`bottom`,align:t=`start`,autoFit:n=!0,onCancel:r=null,width:i=`100%`,css:a=``,children:o}){let s=(0,B.useRef)(null),[c,l]=(0,B.useState)(e),[u,d]=(0,B.useState)(t),f=(0,B.useRef)(r);return(0,B.useEffect)(()=>{f.current=r},[r]),(0,B.useEffect)(()=>{if(n){let e=s.current;if(e){let t=e.getBoundingClientRect(),n=document.body.getBoundingClientRect();t.right>=n.right&&d(`end`),t.bottom>=n.bottom&&l(`top`)}}},[]),(0,B.useEffect)(()=>{if(s.current)return tr(s.current,e=>{f.current&&f.current(e)}).destroy},[]),(0,V.jsx)(`div`,{ref:s,className:[`wx-dropdown`,`wx-${c}-${u}`,a||``,`wx-aaaVytZW`].filter(Boolean).join(` `),style:{width:i},children:o})}function Gr({position:e=`bottom`,align:t=`start`,autoFit:n=!0,inline:r=!1,onCancel:i,width:a=`100%`,children:o,...s}){let[c,l]=(0,B.useState)(void 0),u=(0,B.useRef)(null),d=(0,B.useMemo)(()=>`${e}-${t}`,[e,t]);return(0,B.useLayoutEffect)(()=>{u.current&&l(u.current.parentNode)},[]),(0,V.jsxs)(V.Fragment,{children:[c&&(r?(0,V.jsx)(Wr,{onCancel:i,position:e,align:t,autoFit:n,width:a,...s,children:o}):(0,V.jsx)(Vr,{children:(0,V.jsx)(Ur,{parent:c,at:d,onCancel:i,width:a,...s,children:o})})),(0,V.jsx)(`span`,{ref:u,className:`wx-portal-node wx-32GZ52`})]})}function Kr(){return Ar(jr)}function qr(){let e=null,t=!1,n=!1,r,i,a,o,s=(e,t,s,c,l)=>{r=e,i=t,a=s,o=c,n=l},c=n=>{e=n,t=e!==null,a(e)},l=(e,t)=>{if(!n&&e!==null&&r){let n=r.querySelectorAll(`.wx-list > .wx-item`)[e];n&&(n.scrollIntoView({block:`nearest`}),t&&t.preventDefault())}},u=(t,n)=>{let a=t===null?null:Math.max(0,Math.min(e+t,i.length-1));a!==e&&(c(a),r?l(a,n):requestAnimationFrame(()=>l(a,n)))};return{move:t=>{let n=Rn(t),r=i.findIndex(e=>e.id===n);r!==e&&c(r)},keydown:(n,r)=>{switch(n.code){case`Enter`:t?o():c(0);break;case`Space`:t||c(0);break;case`Escape`:a(e=null);break;case`Tab`:a(e=null);break;case`ArrowDown`:u(t?1:r||0,n);break;case`ArrowUp`:u(t?-1:r||0,n)}},init:s,navigate:u}}var Jr=10,Yr=(0,B.memo)(function({data:e,checkboxes:t,itemTemplate:n,value:r}){return(0,V.jsxs)(V.Fragment,{children:[t&&(0,V.jsx)(Br,{id:e.id,css:`wx-list-checkbox`,value:r&&r.includes(e.id)}),n?Fn(n,{option:e}):e.label]})});function Xr({visibleItems:e,visibleRange:t,navIndex:n,checkboxes:r,itemTemplate:i,value:a,measureRefCallback:o}){return e.map((e,s)=>{let c=t.start+s;return(0,V.jsx)(`div`,{ref:s===0?o:void 0,className:`wx-233fr7 wx-item ${c===n?`wx-focus`:``}`,"data-id":e.id,children:(0,V.jsx)(Yr,{data:e,checkboxes:r,itemTemplate:i,value:a})},e.id)})}function Zr({items:e=[],children:t,onSelect:n,onReady:r,virtualized:i=!1,checkboxes:a,multiselect:o,value:s,...c}){let l=(0,B.useRef)(),u=(0,B.useRef)(!1),d=(0,B.useRef)(qr()),[f,p]=(0,B.useState)(null),m=(0,B.useRef)(f),[h,g]=(0,B.useState)(0),[_,v]=(0,B.useState)(24),y=(0,B.useRef)(!1),b=((0,B.useContext)(Fr)||Kr()).getGroup(`core`),x=(0,B.useRef)(e);(0,B.useEffect)(()=>{x.current=e},[e]);let S=(0,B.useRef)(s);(0,B.useEffect)(()=>{S.current=s},[s]);let C=(0,B.useRef)(0);(0,B.useEffect)(()=>{C.current=_},[_]);let w=(0,B.useCallback)(e=>{e&&e.stopPropagation();let t=x.current,r=S.current,i=m.current,a,s=t[i]?.id;a=o?r&&r.includes(s)?r.filter(e=>e!==s):[...r||[],s]:s,n&&n({id:a})},[o,n]),T=(0,B.useRef)(w);(0,B.useEffect)(()=>{T.current=w},[w]);let E=(0,B.useCallback)(e=>{if(l.current){let t=e*C.current-l.current.clientHeight+C.current;g(t),l.current.scrollTop=t}},[C.current]),D=(0,B.useCallback)(e=>{l.current=e,i&&(e&&!u.current&&m.current!==null&&requestAnimationFrame(()=>{l.current&&(E(m.current),u.current=!0)}),e||(u.current=!1))},[E]),O=(0,B.useCallback)(e=>{if(!e||y.current)return;let t=e.getBoundingClientRect().height;t&&(v(t),C.current=t,y.current=!0)},[]);(0,B.useEffect)(()=>{d.current.init(l.current,e,e=>{p(e),m.current=e},e=>T.current(e),i)},[e,l.current,i]),(0,B.useEffect)(()=>{r&&r({navigate:i?(e,t)=>{d.current.navigate(e,t),E(m.current)}:d.current.navigate,keydown:i?(e,t)=>{let n=m.current,r=x.current;if(n!==0&&n!==r.length-1&&(e.key===`ArrowDown`||e.key===`ArrowUp`)&&e.preventDefault(),d.current.keydown(e,t),l.current){let e=l.current.scrollTop<=m.current*C.current,t=l.current.scrollTop+l.current.clientHeight>=m.current*C.current+C.current;e?t||E(m.current):(l.current.scrollTop=m.current*C.current,g(l.current.scrollTop))}}:d.current.keydown,move:d.current.move})},[]);let k=(0,B.useRef)(0),A=(0,B.useRef)(e);A.current!==e&&(A.current=e,k.current+=1);let j=(0,B.useCallback)(()=>{d.current.navigate(null)},[d]),ee=(0,B.useCallback)(e=>{i&&g(e.target.scrollTop)},[i]),M=(0,B.useMemo)(()=>Math.ceil((l.current?.clientHeight||0)/_),[_,h]),N=(0,B.useMemo)(()=>{if(!i)return{start:0,end:e.length};if(!e.length)return{start:0,end:0};let t=Math.floor(h/_),n=t+M;return{start:Math.max(0,t-Jr),end:Math.min(e.length,n+Jr)}},[i,e,h,_,M]),te=(0,B.useMemo)(()=>{if(!i)return e;let{start:t,end:n}=N;return e.slice(t,n).map(e=>({...e}))},[i,e,N]),P=N.start*_,F=e.length*_;return(0,B.useEffect)(()=>{i&&g(0)},[e,i]),(0,B.useEffect)(()=>{f===null&&(u.current=!1)},[f]),f===null?null:(0,V.jsx)(Gr,{onCancel:j,...c,children:(0,V.jsx)(`div`,{className:`wx-233fr7 wx-list`,ref:D,onClick:w,onMouseMove:d.current.move,onScroll:ee,children:e.length?i?(0,V.jsx)(`div`,{className:`wx-233fr7 wx-list-wrapper`,style:{height:`${F}px`},children:(0,V.jsx)(`div`,{className:`wx-233fr7 wx-list-content`,style:{transform:`translateY(${P}px)`},children:(0,V.jsx)(Xr,{visibleRange:N,visibleItems:te,navIndex:f,measureRefCallback:O,checkboxes:a,itemTemplate:t,value:s})})}):(0,V.jsx)(Xr,{visibleRange:N,visibleItems:te,navIndex:f,measureRefCallback:O,checkboxes:a,itemTemplate:t,value:s}):(0,V.jsx)(`div`,{className:`wx-233fr7 wx-no-data`,children:b(`No data`)})})},k.current)}function Qr({value:e=``,id:t,readonly:n=!1,focus:r=!1,select:i=!1,type:a=`text`,placeholder:o=``,disabled:s=!1,error:c=!1,title:l=``,tooltip:u,css:d=``,icon:f=``,clear:p=!1,onChange:m}){let h=Rr(t),[g,_]=Pn(e),v=(0,B.useRef)(null),y=(0,B.useMemo)(()=>f&&d.indexOf(`wx-icon-left`)===-1?`wx-icon-right `+d:d,[f,d]),b=(0,B.useMemo)(()=>f&&d.indexOf(`wx-icon-left`)!==-1,[f,d]);(0,B.useEffect)(()=>{let e=setTimeout(()=>{r&&v.current&&v.current.focus(),i&&v.current&&v.current.select()},1);return()=>clearTimeout(e)},[r,i]);let x=(0,B.useCallback)(e=>{let t=e.target.value;_(t),m&&m({value:t,input:!0})},[m]),S=(0,B.useCallback)(e=>m&&m({value:e.target.value}),[m]);function C(e){e.stopPropagation(),_(``),m&&m({value:``})}let w=a;return a!==`password`&&a!==`number`&&(w=`text`),(0,B.useEffect)(()=>{let e=S,t=v.current;return t.addEventListener(`change`,e),()=>{t&&t.removeEventListener(`change`,e)}},[S]),(0,V.jsxs)(`div`,{className:`wx-hQ64J4 wx-text ${y} ${c?`wx-error`:``} ${s?`wx-disabled`:``} ${p?`wx-clear`:``}`,"data-tooltip-text":u,children:[(0,V.jsx)(`input`,{className:`wx-hQ64J4 wx-input`,ref:v,id:h,readOnly:n,disabled:s,placeholder:o,type:w,title:l,value:g,onInput:x}),p&&!s&&g?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`i`,{className:`wx-hQ64J4 wx-icon wxi-close`,onClick:C}),b&&(0,V.jsx)(`i`,{className:`wx-hQ64J4 wx-icon ${f}`})]}):f?(0,V.jsx)(`i`,{className:`wx-hQ64J4 wx-icon ${f}`}):null]})}function $r({date:e,type:t,part:n,onShift:r}){let{calendar:i,formats:a}=(0,B.useContext)(Fr).getRaw(),o=e.getFullYear(),s=(0,B.useMemo)(()=>{switch(t){case`month`:return Dr(a.monthYearFormat,i)(e);case`year`:return Dr(a.yearFormat,i)(e);case`duodecade`:{let{start:e,end:t}=Sr(o),n=Dr(a.yearFormat,i);return`${n(new Date(e,0,1))} - ${n(new Date(t,11,31))}`}default:return``}},[e,t,o,i,a]);function c(){r&&r({diff:0,type:t})}return(0,V.jsxs)(`div`,{className:`wx-8HQVQV wx-header`,children:[n===`right`?(0,V.jsx)(`span`,{className:`wx-8HQVQV wx-spacer`}):(0,V.jsx)(`i`,{className:`wx-8HQVQV wx-pager wxi-angle-left`,onClick:()=>r&&r({diff:-1,type:t})}),(0,V.jsx)(`span`,{className:`wx-8HQVQV wx-label`,onClick:c,children:s}),n===`left`?(0,V.jsx)(`span`,{className:`wx-8HQVQV wx-spacer`}):(0,V.jsx)(`i`,{className:`wx-8HQVQV wx-pager wxi-angle-right`,onClick:()=>r&&r({diff:1,type:t})})]})}function ei({onClick:e,children:t}){return(0,V.jsx)(`button`,{className:`wx-3s8W4d wx-button`,onClick:e,children:t})}function ti({value:e,current:t,part:n=``,markers:r=null,css:i=``,onCancel:a,onChange:o}){let s=((0,B.useContext)(Fr)||Kr()).getRaw().calendar,c=(s.weekStart||7)%7,l=s.dayShort.slice(c).concat(s.dayShort.slice(0,c)),u=(e,t,n)=>new Date(e.getFullYear(),e.getMonth()+(t||0),e.getDate()+(n||0)),d=n!==`normal`;function f(e){let t=e.getDay();return t===0||t===6}function p(){let e=u(t,0,1-t.getDate());return e.setDate(e.getDate()-(e.getDay()-(c-7))%7),e}function m(){let e=u(t,1,-t.getDate());return e.setDate(e.getDate()+(6-e.getDay()+c)%7),e}let h=(0,B.useRef)(0);function g(e,t){t.timeStamp!==h.current&&(h.current=t.timeStamp,t.stopPropagation(),o&&o(new Date(e)),a&&a())}let _=(0,B.useMemo)(()=>n==`normal`?[e?u(e).valueOf():0]:e?[e.start?u(e.start).valueOf():0,e.end?u(e.end).valueOf():0]:[0,0],[n,e]),v=(0,B.useMemo)(()=>{let e=p(),n=m(),i=t.getMonth(),a=[];for(let t=e;t<=n;t.setDate(t.getDate()+1)){let e={day:t.getDate(),in:t.getMonth()===i,date:t.valueOf()},n=``;if(n+=e.in?``:` wx-inactive`,n+=_.indexOf(e.date)>-1?` wx-selected`:``,d){let t=e.date==_[0],r=e.date==_[1];t&&!r?n+=` wx-left`:r&&!t&&(n+=` wx-right`),e.date>_[0]&&e.date<_[1]&&(n+=` wx-inrange`)}if(n+=f(t)?` wx-weekend`:``,r){let e=r(t);e&&(n+=` `+e)}a.push({...e,css:n})}return a},[t,_,d,r]),y=(0,B.useRef)(null),b=(0,B.useRef)({});return b.current.click=g,(0,B.useEffect)(()=>{Kn(y.current,b.current)},[]),(0,V.jsxs)(`div`,{className:`wx-398RBS wx-month ${i}`,children:[(0,V.jsx)(`div`,{className:`wx-398RBS wx-weekdays`,children:l.map(e=>(0,V.jsx)(`div`,{className:`wx-398RBS wx-weekday`,children:e},e))}),(0,V.jsx)(`div`,{className:`wx-398RBS wx-days`,ref:y,children:v.map(e=>(0,V.jsx)(`div`,{className:`wx-398RBS wx-day ${e.css} ${e.in?``:`wx-out`}`,"data-id":e.date,children:e.day},e.date))})]})}function ni({value:e,current:t,part:n,onCancel:r,onChange:i,onShift:a}){let o=(0,B.useRef)(new Date),[s,c]=Pn(e||o.current),[l,u]=Pn(t||o.current),d=(0,B.useContext)(Fr).getRaw().calendar,f=d.monthShort||[],p=(0,B.useMemo)(()=>l.getMonth(),[l]),m=(0,B.useCallback)((e,t)=>{if(e!=null){t.stopPropagation();let n=new Date(l);n.setMonth(e),u(n),a&&a({current:n})}n===`normal`&&c(new Date(l)),r&&r()},[l,n,a,r]),h=(0,B.useCallback)(()=>{let e=new Date(ui(s,n)||l);e.setMonth(l.getMonth()),e.setFullYear(l.getFullYear()),i&&i(e)},[s,l,n,i]),g=(0,B.useCallback)(e=>{let t=e.target.closest(`[data-id]`);if(t){let n=parseInt(t.getAttribute(`data-id`),10);m(n,e)}},[m]);return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`wx-34U8T8 wx-months`,onClick:g,children:f.map((e,t)=>(0,V.jsx)(`div`,{className:`wx-34U8T8 wx-month`+(p===t?` wx-current`:``),"data-id":t,children:e},t))}),(0,V.jsx)(`div`,{className:`wx-34U8T8 wx-buttons`,children:(0,V.jsx)(ei,{onClick:h,children:d.done})})]})}var ri={month:{component:ti,next:ai,prev:ii},year:{component:ni,next:si,prev:oi},duodecade:{component:({value:e,current:t,onCancel:n,onChange:r,onShift:i,part:a})=>{let o=(0,B.useContext)(Fr).getRaw().calendar,[s,c]=Pn(t),[l,u]=Pn(e),d=(0,B.useMemo)(()=>s.getFullYear(),[s]),f=(0,B.useMemo)(()=>{let{start:e,end:t}=Sr(d),n=[];for(let r=e;r<=t;++r)n.push(r);return n},[d]),p={click:m};function m(e,t){if(e){t.stopPropagation();let n=new Date(s);n.setFullYear(e),c(n),i&&i({current:n})}a===`normal`&&u(new Date(s)),n&&n()}function h(){let e=new Date(ui(l,a)||s);e.setFullYear(s.getFullYear()),r&&r(e)}let g=(0,B.useRef)(null);return(0,B.useEffect)(()=>{g.current&&Kn(g.current,p)},[]),(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`wx-1XEF33 wx-years`,ref:g,children:f.map((e,t)=>(0,V.jsx)(`div`,{className:`wx-1XEF33 wx-year ${d==e?`wx-current`:``} ${t===0?`wx-prev-decade`:``} ${t===11?`wx-next-decade`:``}`,"data-id":e,children:e},t))}),(0,V.jsx)(`div`,{className:`wx-1XEF33 wx-buttons`,children:(0,V.jsx)(ei,{onClick:h,children:o.done})})]})},next:li,prev:ci}};function ii(e){return e=new Date(e),e.setMonth(e.getMonth()-1),e}function ai(e){return e=new Date(e),e.setMonth(e.getMonth()+1),e}function oi(e){return e=new Date(e),e.setFullYear(e.getFullYear()-1),e}function si(e){return e=new Date(e),e.setFullYear(e.getFullYear()+1),e}function ci(e){return e=new Date(e),e.setFullYear(e.getFullYear()-10),e}function li(e){return e=new Date(e),e.setFullYear(e.getFullYear()+10),e}function ui(e,t){let n;if(t===`normal`)n=e;else{let{start:r,end:i}=e;n=t===`left`?r:(t==`right`||r)&&i}return n}var di=[`clear`,`today`];function fi(e){if(e===`done`)return-1;if(e===`clear`)return null;if(e===`today`)return new Date}function pi({value:e,current:t,onCurrentChange:n,part:r=`normal`,markers:i=null,buttons:a,css:o=``,onShift:s,onChange:c}){let l=(0,B.useContext)(Fr).getGroup(`calendar`),[u,d]=(0,B.useState)(`month`),f=Array.isArray(a)?a:a?di:[],p=(e,t)=>{e.preventDefault(),c&&c({value:t})},m=()=>{u===`duodecade`?d(`year`):u===`year`&&d(`month`)},h=e=>{let{diff:r,current:i}=e;if(r===0){u===`month`?d(`year`):u===`year`&&d(`duodecade`);return}if(r){let e=ri[u];n(r>0?e.next(t):e.prev(t))}else i&&n(i);s&&s()},g=e=>{d(`month`),c&&c({select:!0,value:e})},_=(0,B.useMemo)(()=>ri[u].component,[u]);return(0,V.jsx)(`div`,{className:`wx-2Gr4AS wx-calendar ${r!==`normal`&&r!==`both`?`wx-part`:``} ${o}`,children:(0,V.jsxs)(`div`,{className:`wx-2Gr4AS wx-wrap`,children:[(0,V.jsx)($r,{date:t,part:r,type:u,onShift:h}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(_,{value:e,current:t,onCurrentChange:n,part:r,markers:i,onCancel:m,onChange:g,onShift:h}),u===`month`&&f.length>0&&(0,V.jsx)(`div`,{className:`wx-2Gr4AS wx-buttons`,children:f.map(e=>(0,V.jsx)(`div`,{className:`wx-2Gr4AS wx-button-item`,children:(0,V.jsx)(ei,{onClick:t=>p(t,fi(e)),children:l(e)})},e))})]})]})})}function mi(e){let{words:t=null,optional:n=!1,children:r}=e,i=(0,B.useContext)(Fr),a=(0,B.useMemo)(()=>{let e=i;return(!e||!e.extend)&&(e=Ar(jr)),t!==null&&(e=e.extend(t,n)),e},[t,n,i]);return(0,V.jsx)(Fr.Provider,{value:a,children:r})}function hi(e,t,n,r){if(!e||r){let e=t?new Date(t):new Date;e.setDate(1),n(e)}else if(e.getDate()!==1){let t=new Date(e);t.setDate(1),n(t)}}var gi=[`clear`,`today`];function _i({value:e,current:t,markers:n=null,buttons:r=gi,css:i=``,onChange:a}){let[o,s]=Pn(e),[c,l]=Pn(t);(0,B.useEffect)(()=>{hi(c,o,l,!1)},[o,c]);let u=(0,B.useCallback)(e=>{let t=e.value;t?(s(new Date(t)),hi(c,new Date(t),l,!0)):s(null),a&&a({value:t?new Date(t):null})},[a,c]),d=(0,B.useCallback)(e=>{l(e)},[l]);return c?(0,V.jsx)(mi,{children:(0,V.jsx)(pi,{value:o,current:c,markers:n,buttons:r,css:i,onChange:u,onCurrentChange:d})}):null}function vi(e){return e||={},e.width||(e.width=`unset`),e}var yi=[`clear`,`today`];function bi({value:e,id:t,disabled:n=!1,error:r=!1,placeholder:i=``,format:a=``,buttons:o=yi,css:s=``,title:c=``,tooltip:l,editable:u=!1,clear:d=!1,onChange:f,dropdown:p={}}){let{calendar:m,formats:h}=((0,B.useContext)(Fr)||Kr()).getRaw(),g=a||h?.dateFormat,_=typeof g==`function`?g:Dr(g,m),[v,y]=(0,B.useState)(e),[b,x]=(0,B.useState)(!1);(0,B.useEffect)(()=>{y(e)},[e]);function S(){x(!1)}function C(e){let t=e===v||e&&v&&e.valueOf()===v.valueOf()||!e&&!v;y(e),t||f&&f({value:e}),setTimeout(S,1)}let w=(0,B.useMemo)(()=>v?_(v):``,[v,_]);function T({value:e,input:t}){if(!u&&!d||t)return;let n=typeof u==`function`?u(e):e?new Date(e):null;n=isNaN(n)?v||null:n||null,C(n)}return(0,B.useEffect)(()=>{let e=S;return window.addEventListener(`scroll`,e),()=>window.removeEventListener(`scroll`,e)},[]),(0,V.jsxs)(`div`,{className:`wx-1lKOFG wx-datepicker`,onClick:()=>x(!0),children:[(0,V.jsx)(Qr,{css:`wx-date-input ${s}`,title:c,tooltip:l,value:w,id:t,readonly:!u,disabled:n,error:r,placeholder:i,onInput:S,onChange:T,icon:`wxi-calendar`,clear:d}),b&&!n&&(0,V.jsx)(Gr,{onCancel:S,...vi(p),children:(0,V.jsx)(_i,{buttons:o,value:v,onChange:e=>C(e.value)})})]})}function xi({value:e=``,options:t=[],textOptions:n=null,placeholder:r=``,disabled:i=!1,error:a=!1,title:o=``,tooltip:s,textField:c=`label`,clear:l=!1,css:u=``,children:d,onChange:f,dropdown:p={}}){let m=(0,B.useRef)(null),h=(0,B.useRef)(null),[g,_]=Pn(e);function v(e){m.current=e.navigate,h.current=e.keydown}let y=(0,B.useMemo)(()=>g||g===0?(n||t).find(e=>e.id===g):null,[g,n,t]),b=(0,B.useCallback)(({id:e})=>{(e||e===0)&&(_(e),m.current(null),f&&f({value:e}))},[_,f]),x=(0,B.useCallback)(e=>{e.stopPropagation(),_(``),f&&f({value:``})},[_,f]),S=(0,B.useCallback)(()=>t.findIndex(e=>e.id===g),[t,g]);return(0,V.jsxs)(`div`,{className:`wx-2YgblL wx-richselect ${u} ${a?`wx-2YgblL wx-error`:``} ${i?`wx-2YgblL wx-disabled`:``} ${d?``:`wx-2YgblL wx-nowrap`}`,title:o,onClick:()=>m.current(S()),onKeyDown:e=>h.current(e,S()),tabIndex:0,"data-tooltip-text":s,children:[(0,V.jsx)(`div`,{className:`wx-2YgblL wx-label`,children:y?d?d(y):y[c]:r?(0,V.jsx)(`span`,{className:`wx-2YgblL wx-placeholder`,children:r}):`\xA0`}),l&&!i&&g?(0,V.jsx)(`i`,{className:`wx-2YgblL wx-icon wxi-close`,onClick:x}):(0,V.jsx)(`i`,{className:`wx-2YgblL wx-icon wxi-angle-down`}),!i&&(0,V.jsx)(Zr,{items:t,onReady:v,onSelect:b,...p,children:({option:e})=>d?d(e):e[c]})]})}var Si=({options:e=[],value:t=``,css:n=``,children:r,onChange:i})=>{let[a,o]=(0,B.useState)(t),s=e=>{o(e),i&&i({value:e})};return(0,B.useEffect)(()=>{o(t)},[t]),(0,V.jsx)(`div`,{className:`wx-0hMO7P wx-segmented ${n}`,children:e.map(e=>(0,V.jsx)(`button`,{className:`wx-0hMO7P wx-segment ${e.css} ${e.id===a?`wx-selected`:``}`,title:e.title,onClick:()=>s(e.id),"data-tooltip-text":e.tooltip,children:r?Fn(r,{option:e}):(0,V.jsxs)(V.Fragment,{children:[e.icon&&(0,V.jsx)(`i`,{className:`wx-0hMO7P wx-icon ${e.icon} ${e.label?``:`wx-only`}`}),e.label&&(0,V.jsx)(`span`,{className:`wx-0hMO7P wx-label`,children:e.label})]})},e.id))})};function Ci({notice:e={}}){function t(){e.remove&&e.remove()}return(0,V.jsxs)(`div`,{className:`wx-11sNg5 wx-notice wx-${e.type?e.type:``}`,role:`status`,"aria-live":`polite`,children:[(0,V.jsx)(`div`,{className:`wx-11sNg5 wx-text`,children:e.text}),(0,V.jsx)(`div`,{className:`wx-11sNg5 wx-button`,children:(0,V.jsx)(`i`,{className:`wx-11sNg5 wxi-close`,onClick:t})})]})}function wi({data:e=[]}){return(0,V.jsx)(`div`,{className:`wx-3nwoO9 wx-notices`,children:e.map(e=>(0,V.jsx)(Ci,{notice:e},e.id))})}function Ti({title:e=``,buttons:t=[`cancel`,`ok`],header:n,children:r,footer:i,css:a=``,onConfirm:o,onCancel:s}){let c=((0,B.useContext)(Fr)||Kr()).getGroup(`core`),l=(0,B.useRef)(null);(0,B.useEffect)(()=>{l.current?.focus()},[]);function u(e){switch(e.code){case`Enter`:{let t=e.target.tagName;if(t===`TEXTAREA`||t===`BUTTON`)return;o&&o({event:e});break}case`Escape`:s&&s({event:e})}}function d(e,t){let n={event:e,button:t};t===`cancel`?s&&s(n):o&&o(n)}return(0,V.jsx)(`div`,{className:`wx-1FxkZa wx-modal ${a}`,ref:l,tabIndex:0,onKeyDown:u,children:(0,V.jsxs)(`div`,{className:`wx-1FxkZa wx-window`,children:[n||(e?(0,V.jsx)(`div`,{className:`wx-1FxkZa wx-header`,children:e}):null),(0,V.jsx)(`div`,{children:r}),i||t&&(0,V.jsx)(`div`,{className:`wx-1FxkZa wx-buttons`,children:t.map(e=>(0,V.jsx)(`div`,{className:`wx-1FxkZa wx-button`,children:(0,V.jsx)(zr,{type:`block ${e===`ok`?`primary`:`secondary`}`,onClick:t=>d(t,e),children:c(e)})},e))})]})})}function Ei({children:e},t){let[n,r]=(0,B.useState)(null),[i,a]=(0,B.useState)([]);return(0,B.useImperativeHandle)(t,()=>({showModal:e=>{let t={...e};return r(t),new Promise((e,n)=>{t.resolve=t=>{r(null),e(t)},t.reject=e=>{r(null),n(e)}})},showNotice:e=>{e={...e},e.id=e.id||yr(),e.remove=()=>a(t=>t.filter(t=>t.id!==e.id)),e.expire!=-1&&setTimeout(e.remove,e.expire||5100),a(t=>[...t,e])}}),[]),(0,V.jsxs)(V.Fragment,{children:[e,n&&(0,V.jsx)(Ti,{title:n.title,buttons:n.buttons,onConfirm:n.resolve,onCancel:n.reject,children:n.message}),(0,V.jsx)(wi,{data:i})]})}var Di=(0,B.forwardRef)(Ei);function Oi(e){let{children:t}=e,n=(0,B.useRef)(),r=(0,B.useMemo)(()=>({showNotice:e=>n.current.showNotice(e),showModal:e=>n.current.showModal(e)}),[]);return(0,V.jsx)(Pr.Provider,{value:r,children:(0,V.jsx)(Di,{ref:n,children:t})})}var ki=({value:e=!1,type:t=``,icon:n=``,disabled:r=!1,iconActive:i=``,onClick:a,title:o=``,tooltip:s,css:c=``,text:l=``,textActive:u=``,children:d,active:f,onChange:p})=>{let[m,h]=Pn(e),g=(0,B.useMemo)(()=>(m?`pressed`:``)+(t?` `+t:``),[m,t]),_=(0,B.useCallback)(e=>{let t=!m;a&&a(e),e.defaultPrevented||(h(t),p&&p({value:t}))},[m,a,p]);return m&&f?(0,V.jsx)(zr,{title:o,tooltip:s,text:m&&u||l,css:c,type:g,icon:m&&i||n,onClick:_,disabled:r,children:Fn(f,{value:m})}):d?(0,V.jsx)(zr,{title:o,tooltip:s,text:m&&u||l,css:c,type:g,icon:m&&i||n,onClick:_,disabled:r,children:d}):(0,V.jsx)(zr,{title:o,tooltip:s,text:m&&u||l,css:c,type:g,icon:m&&i||n,onClick:_,disabled:r})};function Ai(){return(0,V.jsx)(V.Fragment,{})}function ji(e){let{fonts:t=!0,children:n}=e;return(0,V.jsx)(Nr.Provider,{value:`willow`,children:(0,V.jsxs)(V.Fragment,{children:[n&&n&&(0,V.jsx)(`div`,{className:`wx-theme wx-willow-theme`,children:n}),t&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`link`,{rel:`preconnect`,href:`https://cdn.svar.dev`,crossOrigin:`true`}),(0,V.jsx)(Ai,{}),(0,V.jsx)(`link`,{rel:`stylesheet`,href:`https://cdn.svar.dev/fonts/wxi/wx-icons.css`})]})]})})}Wn(Un);var Mi={grid:{"Add before":`Add before`,"Add after":`Add after`,Copy:`Copy`,Cut:`Cut`,Paste:`Paste`,Delete:`Delete`,"New row":`New row`,"Move up":`Move up`,"Move down":`Move down`,Undo:`Undo`,Redo:`Redo`,selected:`selected`}};new Date().valueOf();var Ni=class{constructor(e){this._nextHandler=null,this._dispatch=e,this.exec=this.exec.bind(this)}async exec(e,t){return this._dispatch(e,t),this._nextHandler&&await this._nextHandler.exec(e,t),t}setNext(e){return this._nextHandler=e}};new Date().valueOf();var Pi=class{constructor(e){let t={id:0,$level:0,data:[],parent:null},n=new Map;n.set(0,t),this._pool=n,e&&e.length&&this.parse(e,0)}parse(e,t){let n=this._pool;for(let r=0;r<e.length;r++){let i=e[r];i.parent=i.parent||t,i.data=null,n.set(i.id,i)}for(let t=0;t<e.length;t++){let r=e[t],i=n.get(r.parent);i&&(i.data||=[],i.data.push(r))}let r=n.get(t);this.setLevel(r,r.$level+1,!1)}add(e,t){let n=this._pool.get(e.parent||0);e.$level=n.$level+1,this._pool.set(e.id,e),n.data?t===-1?n.data=[...n.data,e]:Li(n,t,e):n.data=[e]}addAfter(e,t){if(!t)return this.add(e,-1);let n=this.byId(t),r=this.byId(n.parent),i=Ri(r,n.id)+1;e.parent=r.id,e.$level=r.$level+1,this.add(e,i)}remove(e){let t=this._pool.get(e);this._remove(t);let n=this._pool.get(t.parent);n.data=n.data.filter(t=>t.id!=e),this._clearBranch(n)}_remove(e){e.data&&e.data.forEach(e=>this._remove(e)),this._pool.delete(e.id)}update(e,t){let n=this._pool.get(e),r=this._pool.get(n.parent),i=Ri(r,n.id);n={...n,...t},r&&i>=0&&(r.data[i]=n,r.data=[...r.data]),this._pool.set(n.id,n)}move(e,t,n){let r=this._pool.get(e),i=t===`child`,a=this._pool.get(n),o=a.$level+ +!!i;if(!r||!a)return;let s=this._pool.get(r.parent),c=i?a:this._pool.get(a.parent);c.data||=[];let l=Ri(s,r.id);Ii(s,l);let u=i?c.data.length:Ri(c,a.id)+ +(t===`after`);if(Li(c,u,r),s.id===c.id&&l===u)return null;r.parent=c.id,r.$level!==o&&(r.$level=o,this.setLevel(r,o+1,!0)),this.update(r.id,r),this._clearBranch(s)}_clearBranch(e){e.data&&!e.data.length&&(e.open&&delete e.open,this.update(e.id,{data:null}))}toArray(){let e=[],t=this._pool.get(0).data;return t&&Fi(t,e),e}byId(e){return this._pool.get(e)}getBranch(e){return this._pool.get(e).data}forEach(e){this._pool.forEach((t,n)=>{n!==0&&e(t)})}eachChild(e,t){let n=this.byId(t);!n||!n.data||n.data.forEach((t,n)=>{e(this.byId(t.id),n),this.eachChild(e,t.id)})}setLevel(e,t,n){e.data&&=e.data.map(e=>(n&&(e={...e},this._pool.set(e.id,e)),e.$level=t,e.data&&this.setLevel(e,t+1,n),e))}};function Fi(e,t){e.forEach(e=>{t.push(e),e.open===!0&&Fi(e.data,t)})}function Ii(e,t){let n=[...e.data];n.splice(t,1),e.data=n}function Li(e,t,n){let r=[...e.data];r.splice(t,0,n),e.data=r}function Ri(e,t){return e?.data.findIndex(e=>e.id===t)}var zi=2,Bi=class{constructor(e){e&&(this._writable=e.writable,this._async=e.async),this._values={},this._state={}}setState(e,t=0){let n={};return this._wrapProperties(e,this._state,this._values,``,n,t),n}getState(){return this._values}getReactive(){return this._state}_wrapProperties(e,t,n,r,i,a){for(let o in e){let s=t[o],c=n[o],l=e[o];if(s&&(c===l&&typeof l!=`object`||l instanceof Date&&c instanceof Date&&c.getTime()===l.getTime()))continue;let u=r+(r?`.`:``)+o;s?(s.__parse(l,u,i,a)&&(n[o]=l),a&zi?i[u]=s.__trigger:s.__trigger()):(t[o]=l&&l.__reactive?this._wrapNested(l,l,u,i):this._wrapWritable(l),n[o]=l),i[u]=i[u]||null}}_wrapNested(e,t,n,r){let i=this._wrapWritable(e);return this._wrapProperties(e,i,t,n,r,0),i.__parse=(e,n,r,a)=>(this._wrapProperties(e,i,t,n,r,a),!1),i}_wrapWritable(e){let t=[],n=function(){for(let n=0;n<t.length;n++)t[n](e)};return{subscribe:n=>(t.push(n),this._async?setTimeout(n,1,e):n(e),()=>{let e=t.indexOf(n);e>=0&&t.splice(e,1)}),__trigger:()=>{t.length&&(this._async?setTimeout(n,1):n())},__parse:function(t){return e=t,!0}}}};function Vi(e,t){return Object.defineProperty(e,"__reactive",{value:!0,enumerable:!1,writable:!1}),e}var Hi=class{constructor(e,t,n,r){this._setter=typeof e==`function`?e:e.setState.bind(e),this._routes=t,this._parsers=n,this._prev={},this._triggers=new Map,this._sources=new Map,this._routes.forEach(e=>{e.in.forEach(t=>{let n=this._triggers.get(t)||[];n.push(e),this._triggers.set(t,n)}),e.out.forEach(t=>{let n=this._sources.get(t)||{};e.in.forEach(e=>n[e]=!0),this._sources.set(t,n)})}),this._routes.forEach(e=>{e.length=Math.max(...e.in.map(e=>Ui(e,this._sources,1)))}),this._bus=r}init(e){let t={};for(let n in e)if(this._prev[n]!==e[n]){let r=this._parsers[n];t[n]=r?r(e[n]):e[n]}this._prev=this._prev?{...this._prev,...e}:{...e},this.setState(t),this._bus&&this._bus.exec(`init-state`,t)}setStateAsync(e){let t=this._setter(e,zi);return this._async?Object.assign(this._async.signals,t):this._async={signals:t,timer:setTimeout(this._applyState.bind(this),1)},t}_applyState(){let e=this._async;if(e){this._async=null,this._triggerUpdates(e.signals,[]);for(let t in e.signals){let n=e.signals[t];n&&n()}}}setState(e,t=[]){let n=this._setter(e);return this._triggerUpdates(n,t),n}_triggerUpdates(e,t){let n=Object.keys(e),r=!t.length;t||=[];for(let e=0;e<n.length;e++){let r=n[e],i=this._triggers.get(r);i&&i.forEach(e=>{t.indexOf(e)==-1&&t.push(e)})}r&&this._execNext(t)}_execNext(e){for(;e.length;){e.sort((e,t)=>e.length<t.length?1:-1);let t=e[e.length-1];e.splice(e.length-1),t.exec(e)}}};function Ui(e,t,n){let r=t.get(e);if(!r)return n;let i=Object.keys(r).map(e=>Ui(e,t,n+1));return Math.max(...i)}var Wi=class{constructor(){this._nextHandler=null,this._handlers={},this._tag=new WeakMap,this.exec=this.exec.bind(this)}on(e,t,n){let r=this._handlers[e];r?n&&n.intercept?r.unshift(t):r.push(t):r=this._handlers[e]=[t],n&&n.tag&&this._tag.set(t,n.tag)}intercept(e,t,n){this.on(e,t,{...n,intercept:!0})}detach(e){for(let t in this._handlers){let n=this._handlers[t];for(let t=n.length-1;t>=0;t--)this._tag.get(n[t])===e&&n.splice(t,1)}}async exec(e,t){let n=this._handlers[e];if(n)for(let e=0;e<n.length;e++){let r=n[e](t);if(r===!1||r&&r.then&&await r===!1)return}return this._nextHandler&&await this._nextHandler.exec(e,t),t}setNext(e){return this._nextHandler=e}},Gi=1024;function Ki(e){return e<Gi?`${e} B`:e<Gi**2?`${(e/Gi).toFixed(1)} KB`:e<Gi**3?`${(e/Gi**2).toFixed(1)} MB`:`${(e/Gi**3).toFixed(1)} GB`}function qi(e,t){t||={key:`name`,order:`asc`};let n=e.filter(e=>e.type===`folder`),r=e.filter(e=>e.type!==`folder`),i=n.sort(Xi(t)),a=r.sort(Xi(t));return[...i,...a]}function Ji(e,t){return typeof e==`string`?e.localeCompare(t,void 0,{numeric:!0}):typeof e==`object`?e.getTime()-t.getTime():(e??0)-(t??0)}function Yi(e,t){return typeof e==`string`?-e.localeCompare(t,void 0,{numeric:!0}):typeof t==`object`?t.getTime()-e.getTime():(t??0)-(e??0)}function Xi({key:e,order:t}){let n=t===`asc`?Ji:Yi;return(t,r)=>n(t[e],r[e])}function Zi(e,t){let n=e===`/`?1:e.split(`/`).length;return n>=t.length?null:t[n].id}function Qi(e){return e.length>1?e[e.length-2].id:null}var $i=class extends Pi{constructor(e){super([{id:`/`,name:`My files`,open:!0,$level:1,parent:0,ext:``,type:`folder`}]),this.parse(e,`/`)}parse(e,t,n){!e||!e.length||(e.forEach(e=>this.parseId(e,n?t:void 0)),super.parse(e,t))}parseId(e,t){if(e.parent===0)return;let n=e.id,r=n.lastIndexOf(`/`);if(e.parent=t??(r===0?`/`:n.slice(0,r)),e.name=n.slice(r+1),e.type=e.type||`file`,e.type!==`folder`){let t=e.name.lastIndexOf(`.`),n=t===-1?``:e.name.slice(t+1);e.ext=n===`new`?``:n?.toLocaleLowerCase()}}getParents(e){let t=[],n=this.byId(e);if(!n)return t;for(;n.id!==0;)t.push(n),n=this.byId(n.parent);return t.reverse()}findFiles(e,t=`/`){let n=[],r=e.toLocaleLowerCase();return this.eachChild(e=>{e.name.toLowerCase().indexOf(r)!==-1&&n.push(e)},t),n}add(e,t){let n=this.byId(e.parent||`/`),r=e.data?[...e.data]:null;e.data=null,super.add(e,t??n.data?n.data.length:0),r&&r.forEach(e=>this.add(e))}renameFiles(e,t,n){let r=this.byId(e),i=this.normalizeFile(r,t),a=[];return i.data?.forEach(e=>a.push(this.renameFiles(e.id,i.id,n))),a.length&&(i.data=a),n[e]=i.id,i}copyFiles(e,t,n){let r={};return e.forEach(e=>{let i=this.renameFiles(e,t,r);this.add(i),n&&this.remove(e),r[e]=i.id}),r}moveFiles(e,t){if(this.byId(e[0]).parent!==t)return this.copyFiles(e,t,!0)}serialize(e=`/`){let t=[],n=this.byId(e);return n?(n.data?.forEach(e=>{let{id:n,date:r,type:i,size:a,lazy:o}=e,s={id:n,date:r,type:i??`file`};o&&(s.lazy=o),a&&(s.size=a),t.push(s);let c=this.serialize(n);c.length&&t.push(...c)}),t):null}normalizeFile(e,t){let n=e.name,r=n.lastIndexOf(`.`),i=r===-1?``:n.slice(r+1),a=i?`.${i}`:``,o=r===-1?n:n.slice(0,r),s=t+(t===`/`?``:`/`)+o;for(;this.byId(s+a);){let e=`.new`;s+=e,o+=e}return{...e,id:s+a,name:o+a,parent:t,ext:i.toLocaleLowerCase()}}},ea=class extends Bi{in;_router;constructor(e){super({writable:e,async:!1});let t=[];for(let e=0;e<2;e++)t.push({in:[`data`,`panels.${e}.path`],out:[`panels.${e}._crumbs`],exec:t=>{let{data:n,panels:r}=this.getState(),i=[];i[e]={_crumbs:n.getParents(r[e].path)},this.setState({panels:i},t)}}),t.push({in:[`data`,`panels.${e}.path`,`panels.${e}._sorts`,`search`],out:[`panels.${e}._files`],exec:t=>{let{data:n,panels:r,search:i}=this.getState(),a;a=i?n.findFiles(i,r[e].path):n.byId(r[e].path)?.data||[];let{path:o,_sorts:s}=r[e];a=qi(a,s[o]);let c=[];c[e]={_files:a},this.setState({panels:c},t)}}),t.push({in:[`data`,`panels.${e}.selected`,`panels.${e}._sorts`],out:[`panels.${e}._selected`],exec:t=>{let{data:n,panels:r}=this.getState(),i=[];r[e].selected.forEach(e=>{let t=n.byId(e);t&&i.push(t)});let{path:a,_sorts:o}=r[e],s=qi(i,o[a]),c=[];c[e]={_selected:s},this.setState({panels:c},t)}});this._router=new Hi(super.setState.bind(this),t,{data:e=>new $i(e)});let n=this.in=new Wi;n.on(`select-file`,({id:e,toggle:t,range:n,panel:r,type:i})=>{let{panels:a,activePanel:o}=this.getState();typeof r>`u`&&(r=o),e||(t=n=!1);let s=[...a[r].selected];if(t){let t=s.indexOf(e);t===-1?s.push(e):s.splice(t,1)}else if(n&&a[r]._lastSelected){let t=a[r]._files,n=t.findIndex(e=>e.id==a[r]._lastSelected),i=t.findIndex(t=>t.id==e);i<n&&([n,i]=[i,n]);let o=t.slice(n,i+1).map(e=>e.id);s=[...new Set([...s,...o])]}else s=e?[e]:[];let c=[];c[r]={selected:s,_lastSelected:e,_selectNavigation:i===`navigation`},this.setState({panels:c})}),n.on(`set-path`,({id:e,panel:t,selected:r})=>{let{data:i,activePanel:a}=this.getState(),o=i.byId(e);if(o){let i=[];typeof t>`u`&&(t=a),i[t]={path:e},this.setState({panels:i}),n.exec(`select-file`,{panel:t}),r&&r.forEach(e=>n.exec(`select-file`,{id:e,panel:t,toggle:!0})),o.lazy&&n.exec(`request-data`,{id:e})}}),n.on(`provide-data`,({id:e,data:t})=>{let{mode:n,data:r}=this.getState(),i=r.byId(e);i&&(i.lazy||(i.data=[]),i.lazy=!1,r.parse(t,e,n===`search`),this.setState({data:r}))}),n.on(`open-tree-folder`,({id:e,mode:t})=>{let{data:n}=this.getState();n.update(e,{open:t}),this.setState({data:n})}),n.on(`show-preview`,({mode:e})=>{this.setState({preview:e})}),n.on(`rename-file`,e=>{let{id:t,name:n}=e,{data:r,panels:i}=this.getState(),a=r.byId(t);if(a.name!==n){a.name=n;let o=r.normalizeFile(a,a.parent);e.newId=o.id,o.data=null,r.add(o);let s={[t]:o.id};a.data?.forEach(e=>s={...r.moveFiles([e.id],o.id),...s});let c=i.map(e=>({selected:e.selected,_crumbs:e._crumbs,_lastSelected:e._lastSelected,_sorts:e._sorts}));r.remove(t),this._updatePanels(c,s),this.setState({data:r,panels:c})}}),n.on(`create-file`,e=>{let{file:t,parent:r}=e,{data:i}=this.getState(),a=i.normalizeFile(t,r);a.type=t.type||`file`,e.newId=a.id,i.add(a),this.setState({data:i}),n.exec(`select-file`,{id:a.id})}),n.on(`delete-files`,({ids:e})=>{let{data:t,panels:n}=this.getState(),r=n.map(e=>({selected:e.selected,_crumbs:e._crumbs,_lastSelected:e._lastSelected,_sorts:e._sorts}));e.forEach(e=>t.remove(e)),this._updatePanels(r,{}),this.setState({data:t,panels:r})}),n.on(`copy-files`,e=>{let{ids:t,target:r}=e;if(this._isPlacedIntoSelf(t,r)){console.error(`You cannot copy a folder into itself`),e.skipProvider=!0;return}let{data:i,panels:a,activePanel:o}=this.getState(),s=i.copyFiles(t,r);e.newIds=t.map(e=>s[e]),this.setState({data:i}),a[o].path==r&&(n.exec(`select-file`,{}),t.forEach(e=>{n.exec(`select-file`,{id:s[e],toggle:!0})}))}),n.on(`move-files`,e=>{let{ids:t,target:r}=e;if(this._isPlacedIntoSelf(t,r)){console.error(`You cannot move a folder into itself`),e.skipProvider=!0;return}let{data:i,panels:a,activePanel:o}=this.getState(),s=i.moveFiles(t,r);if(s){e.newIds=t.map(e=>s[e]);let c=a.map(e=>({selected:e.selected,_crumbs:e._crumbs,_lastSelected:e._lastSelected,_sorts:e._sorts}));this._updatePanels(c,s,!0),this.setState({data:i,panels:c}),a[o].path==r&&(n.exec(`select-file`,{}),t.forEach(e=>{n.exec(`select-file`,{id:s[e],toggle:!0})}))}});let r=null;n.on(`filter-files`,({text:e})=>{if(!e){r&&this.setState({...r});return}n.exec(`select-file`,{});let{panels:t,mode:i}=this.getState();r||={panels:t,mode:i,search:``},this.setState({mode:`search`,search:e})}),n.on(`set-mode`,({mode:e})=>{let{activePanel:t}=this.getState(),n=[];n[t]={_selectNavigation:!1};let i={mode:e,search:``,panels:n};r=null,this.setState(i)}),n.on(`set-active-panel`,({panel:e})=>{this.setState({activePanel:e})}),n.on(`sort-files`,({key:e,order:t,panel:n,path:r})=>{let{activePanel:i,panels:a}=this.getState();n??=i,r??=a[n].path;let o=[];o[n]={_sorts:{...a[n]._sorts,[r]:{key:e,order:t}}},this.setState({panels:o})}),this.initOnce()}initOnce(){let e=[];for(let t=0;t<2;t++)e[t]=Vi({_crumbs:[],_files:[],_selected:[],_sorts:{},path:`/`,selected:[],...e[t]});let t={panels:Vi(e),data:[],search:``};this._router.init(t)}init(e){let t={...e};this._router.init(t)}setState(e,t){return this._router.setState(e,t)}getFile(e){let{data:t}=this.getState();return t.byId(e)||null}serialize(e){let{data:t}=this.getState();return t.serialize(e)}_updatePanels(e,t,n){let{data:r}=this.getState();e.forEach(e=>{let i=[];e.selected.forEach(e=>{r.byId(e)?i.push(e):!n&&t[e]&&i.push(t[e])}),e.selected=i,r.byId(e._lastSelected)||(e._lastSelected=n?null:t[e._lastSelected]||null);let a={};Object.keys(e._sorts).forEach(i=>{r.byId(i)?a[i]=e._sorts[i]:t[i]&&!n&&(a[t[i]]=e._sorts[i])}),e._sorts=a;let o=e._crumbs[e._crumbs.length-1];o?.id!==`/`&&(t[o.id]?e.path=t[o.id]:r.byId(o.id)||(e.path=`/`))})}_isPlacedIntoSelf(e,t){return e.some(e=>e===t||this.getState().data.getParents(t).some(t=>t.id===e))}};function ta(e){switch(e){case`body`:return[{icon:`wxi-content-paste`,text:`Paste`,hotkey:`Ctrl+V`,id:`paste`}];case`add`:return[{icon:`mdi mdi-folder-plus-outline`,text:`Add new file`,id:`add-file`},{icon:`mdi mdi-file-plus-outline`,text:`Add new folder`,id:`add-folder`},{icon:`mdi mdi-file-upload-outline`,text:`Upload file`,id:`upload`,comp:`upload`}];case`multiselect`:return[{icon:`wxi-content-copy`,text:`Copy`,hotkey:`Ctrl+C`,id:`copy`},{icon:`wxi-content-cut`,text:`Cut`,hotkey:`Ctrl+X`,id:`move`},{comp:`separator`},{icon:`wxi-close`,text:`Delete`,hotkey:`Delete`,id:`delete`}];default:return[e===`folder`?null:{icon:`wxi-download`,text:`Download`,hotkey:`Ctrl+D`,id:`download`},{icon:`wxi-content-copy`,text:`Copy`,hotkey:`Ctrl+C`,id:`copy`},{icon:`wxi-content-cut`,text:`Cut`,hotkey:`Ctrl+X`,id:`move`},{icon:`wxi-content-paste`,text:`Paste`,hotkey:`Ctrl+V`,id:`paste`},{comp:`separator`},{icon:`wxi-edit`,text:`Rename`,hotkey:`Ctrl+R`,id:`rename`},{icon:`wxi-close`,text:`Delete`,hotkey:`Delete`,id:`delete`}].filter(e=>e!==null)}}function na(e,t=`data-id`){let n=e;for(!n.tagName&&e.target&&(n=e.target);n;){if(n.getAttribute&&n.getAttribute(t))return n;n=n.parentNode}return null}function ra(e,t=`data-id`){let n=na(e,t);return n?n.getAttribute(t):null}new Date().valueOf();function ia(e,t){let{api:n}=t;function r(e,r){let i=t.getPanel(),a=i.selected,o=r.ctrlKey||r.metaKey,s=r.shiftKey,c,l=a?.[0]?n.getFile(a[0]):null;c=a?.length?a.length>1?t.menuOptions(`multiselect`):t.menuOptions(l.type,l):t.menuOptions(`body`);let u=`${o?`ctrl+`:``}${s?`shift+`:``}${e}`,d=c?c.find(e=>e.hotkey?.toLowerCase()===u):!1,f=t.performAction;if(d)switch(u){case`ctrl+c`:f(`copy`);break;case`ctrl+x`:f(`move`);break;case`ctrl+v`:f(`paste`,l);break;case`delete`:f(`delete`);break;case`ctrl+r`:r.preventDefault(),f(`rename`,l);break;case`ctrl+d`:r.preventDefault(),f(`download`,l);break;default:d.handler?.({context:l})}switch(e){case`enter`:{if(o||s)break;let{_crumbs:e,_selectNavigation:t}=i;if(t){let t=Qi(e);if(t){let r=Zi(t,e);n.exec(`set-path`,{id:t,selected:[r]})}}else if(a.length===1){let e=n.getFile(a[0]);e&&n.exec(e.type===`folder`?`set-path`:`open-file`,{id:e.id})}break}case`arrowup`:case`arrowleft`:{let{_files:e,_selected:t,path:r,_selectNavigation:a}=i,c;if(t.length){let i=t.at(0).id,a=e.findIndex(e=>e.id===i);if(a!==-1){let t=a-1;e[t]?c=e[t].id:r!==`/`&&!(o||s)&&n.exec(`select-file`,{type:`navigation`})}}else{if(a)break;if(r!==`/`){n.exec(`select-file`,{type:`navigation`});break}c=e.at(0)?.id}c&&n.exec(`select-file`,{id:c,toggle:o,range:s});break}case`arrowdown`:case`arrowright`:{let{_files:e,_selected:t,path:r,_selectNavigation:a}=i,c;if(t.length){let n=t.at(-1).id,r=e.findIndex(e=>e.id===n);if(r!==-1){let t=r+1;e[t]&&(c=e[t].id)}}else{if(r!==`/`&&!a){n.exec(`select-file`,{type:`navigation`});break}c=e.at(0)?.id}c&&n.exec(`select-file`,{id:c,toggle:o,range:s});break}}}function i(e){let t=e.code.replace(`Key`,``).toLowerCase();r(t,e),t==`tab`&&setTimeout(()=>{let e=document.activeElement;e.className.indexOf(`table`)!=-1&&n.exec(`set-active-panel`,{panel:+ra(e,`data-panel`)})})}return e.addEventListener(`keydown`,i),{destroy:()=>{e.removeEventListener(`keydown`,i)}}}function aa(e,t=`data-id`){let n=e;for(!n.tagName&&e.target&&(n=e.target);n;){if(n.getAttribute&&n.getAttribute(t))return n;n=n.parentNode}return null}function oa(e,t=`data-id`){let n=e.getAttribute(t);return n?sa(n):null}function sa(e){if(e.startsWith(`:`))return e.substring(1);let t=e*1;return isNaN(t)?e:t}function ca(){return{detect:()=>!0,addEvent:function(e,t,n){return e.addEventListener(t,n),()=>e.removeEventListener(t,n)},addGlobalEvent:function(e,t){return document.addEventListener(e,t),()=>document.removeEventListener(e,t)},getTopNode:function(){return window.document.body}}}var la=ca();new Date().valueOf();function ua(e){let[t,n]=(0,B.useState)(e),r=(0,B.useRef)(e);return(0,B.useEffect)(()=>{if(r.current!==e){if(Array.isArray(r.current)&&Array.isArray(e)&&r.current.length===0&&e.length===0)return;r.current=e,n(e)}},[e]),[t,n]}function da(e,t,n){let[r,i]=(0,B.useState)(()=>t);return e||console.warn(`Writable ${n} is not defined`),(0,B.useEffect)(()=>{if(e)return e.subscribe(e=>{i(()=>e)})},[e]),r}function U(e,t){let n=e.getState();return da(e.getReactiveState()[t],n[t],t)}function fa(e,t){let n=(0,B.useRef)(t);n.current=t;let[r,i]=(0,B.useState)(1);return(0,B.useEffect)(()=>e.subscribe(e=>{n.current=e,i(e=>e+1)}),[e]),[n.current,r]}function pa(e,t){let n=e.getState();return fa(e.getReactiveState()[t],n[t])}function ma(e){let t={};return e.split(`;`).forEach(e=>{let[n,r]=e.split(`:`);if(r){let e=n.trim();e.indexOf(`-`)&&(e=e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())),t[e]=r.trim()}}),t}function ha(e){let t=e,n=[];return{subscribe:e=>{n.push(e),e(t)},unsubscribe:e=>{n=n.filter(t=>t!==e)},set:e=>{t=e,n.forEach(e=>e(t))},update:e=>{t=e(t),n.forEach(e=>e(t))}}}function ga(e,t,n){function r(e){let r=aa(e);if(!r)return;let i=oa(r);if(typeof t==`function`)return t(i,e);let a,o=e.target;for(;o!=r;){if(a=o.dataset?o.dataset.action:null,a&&t[a]){t[a](i,e);return}o=o.parentNode}t[n]&&t[n](i,e)}return la.addEvent(e,n,r)}function _a(e,t){let n=[ga(e,t,`click`)];return t.dblclick&&n.push(ga(e,t.dblclick,`dblclick`)),()=>{n.forEach(e=>e())}}function va(e,t){return e.map((e,n)=>{let r=t(e,n);return e.data&&e.data.length&&(r.data=va(e.data,t)),r}).filter(Boolean)}function ya(e,t){let n=[];return e.forEach(e=>{if(e.data){let r=ya(e.data,t);r.length&&n.push({...e,data:r})}else t(e)&&n.push(e)}),n}function ba(e){return va(e,(t,n)=>{let r={...t,id:t.id||yr()};return r.type&&(r.comp=r.type),r.comp===`separator`&&e[n-1]?.comp===`separator`?null:r})}var xa={};function Sa(e){return xa[e]||e}function Ca(e,t){xa[e]=t}function wa({onClick:e,onShow:t,option:n}){let r=(0,B.useRef)(null),i=(0,B.useCallback)(()=>{t(n.data?n.id:!1,r.current)},[t,n]),a=(0,B.useCallback)(i=>{if(n.data){i.stopPropagation(),t(n.id,r.current);return}e(i)},[e,t,n]),o=(0,B.useMemo)(()=>n&&n.comp?Sa(n.comp):null,[n]);return(0,V.jsxs)(`div`,{ref:r,className:`wx-cDCz9rZQ wx-option ${n.css||``} ${n.disabled?`wx-disabled`:``}`,"data-id":Bn(n.id),onMouseEnter:i,onClick:a,children:[n.icon?(0,V.jsx)(`i`,{className:`wx-cDCz9rZQ wx-icon ${n.icon}`}):null,n.comp?o?(0,V.jsx)(o,{item:n,option:n}):null:(0,V.jsxs)(`span`,{className:`wx-cDCz9rZQ wx-value`,children:[` `,n.text,` `]}),n.subtext?(0,V.jsx)(`span`,{className:`wx-cDCz9rZQ wx-subtext`,children:n.subtext}):null,n.data?(0,V.jsx)(`i`,{className:`wx-cDCz9rZQ wx-sub-icon wxi-angle-right`}):null]})}function Ta({options:e,left:t=0,top:n=0,at:r=`bottom`,parent:i=null,mount:a=null,context:o=null,css:s=``,onClick:c,onCancel:l}){let[u,d]=(0,B.useState)(-1e4),[f,p]=(0,B.useState)(-1e4),[m,h]=(0,B.useState)(20),[g,_]=(0,B.useState)(),v=(0,B.useRef)(null),[y,b]=(0,B.useState)(!1),[x,S]=(0,B.useState)(null),C=(0,B.useCallback)(()=>{let e=hr(v.current,i,r,t,n);e&&(d(e.x),p(e.y),_(e.width));let a=e?.z??20,o=i?_r(i):[],s=0;for(let e of o){let t=parseInt(getComputedStyle(e).zIndex,10);t>s&&(s=t)}s>=a&&(a=s+1),h(a)},[i,r,t,n]);(0,B.useEffect)(()=>{a&&a(C)},[]);let w=(0,B.useCallback)(()=>{b(!1)},[]),T=(0,B.useCallback)((e,t)=>{b(e),S(t)},[]),E=(0,B.useMemo)(()=>ba(e),[e]);(0,B.useEffect)(()=>{C()},[i,C]);let D=(0,B.useRef)(c),O=(0,B.useRef)(l),k=(0,B.useRef)(i);return(0,B.useEffect)(()=>void(D.current=c),[c]),(0,B.useEffect)(()=>void(O.current=l),[l]),(0,B.useEffect)(()=>void(k.current=i),[i]),(0,B.useEffect)(()=>{if(!v.current)return;function e(e){O.current?O.current(e):D.current&&D.current({action:null,option:null})}return tr(v.current,{callback:e,modal:!0,parent:()=>k.current}).destroy},[]),(0,V.jsx)(`div`,{ref:v,"data-wx-menu":`true`,className:`wx-XMmAGqVx wx-menu ${s}`,style:{position:`absolute`,top:f+`px`,left:u+`px`,width:g,zIndex:m},onMouseLeave:w,children:E.map(e=>(0,V.jsxs)(B.Fragment,{children:[e.comp===`separator`?(0,V.jsx)(`div`,{className:`wx-XMmAGqVx wx-separator`}):(0,V.jsx)(wa,{option:e,onShow:T,onClick:t=>{if(!e.data&&!t.defaultPrevented){let n={context:o,action:e,option:e,event:t};e.handler&&e.handler(n),c&&c(n),t.stopPropagation()}}}),e.data&&y===e.id?(0,V.jsx)(Ta,{css:s,options:e.data,at:`right-overlap`,parent:x,context:o,onClick:c,onCancel:l}):null]},e.id))})}var Ea=(0,B.forwardRef)(function(e,t){let{options:n,at:r=`bottom`,resolver:i=null,dataKey:a=`contextId`,filter:o=null,css:s=``,children:c,onClick:l}=e,[u,d]=(0,B.useState)(null),[f,p]=(0,B.useState)(null),[m,h]=(0,B.useState)(0),[g,_]=(0,B.useState)(0),v=(0,B.useRef)(null),y=(0,B.useMemo)(()=>`data-${a.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase()}`,[a]),b=(0,B.useMemo)(()=>u!==null&&o?ya(n,e=>o(e,u)):n,[u,o,n]);function x(e){p(null),l&&l(e)}function S(e){if(v.current===e){v.current=null;return}p(null),l&&l({action:null,option:null})}let C=(0,B.useCallback)((e,t)=>{if(!e){p(null);return}if(e.defaultPrevented)return;let n=e.target;if(n&&n.dataset&&n.dataset.menuIgnore)return;if(f&&f===n){p(null),e.preventDefault();return}h(e.clientX+1),_(e.clientY+1);let r=typeof t<`u`?t:Rn(n,y);i&&(r=i(r,e),!r)||(d(r),p(n),v.current=e.nativeEvent||e,e.preventDefault())},[f,y,i]);return(0,B.useImperativeHandle)(t,()=>({show:C}),[C]),(0,V.jsxs)(V.Fragment,{children:[c?(0,V.jsx)(`span`,{onClick:C,"data-menu-ignore":`true`,children:typeof c==`function`?c():c}):null,f?(0,V.jsx)(Vr,{children:(0,V.jsx)(Ta,{css:s,at:r,top:g,left:m,parent:f,context:u,onClick:x,onCancel:S,options:b},f)}):null]})}),Da=(0,B.forwardRef)(function(e,t){let{options:n,at:r=`bottom`,css:i=``,children:a,onClick:o}=e,[s,c]=(0,B.useState)(null),l=(0,B.useRef)(null);function u(e){c(null),o&&o(e)}function d(e){if(l.current===e){l.current=null;return}c(null),o&&o({action:null,option:null})}let f=(0,B.useCallback)(e=>{c(e.target),l.current=e.nativeEvent||e,e.preventDefault()},[]);(0,B.useImperativeHandle)(t,()=>({show:f}),[f]);function p(e){let t=e.target;for(;!t.dataset.menuIgnore;)c(t),t=t.parentNode}return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{onClick:p,"data-menu-ignore":`true`,children:a}),s?(0,V.jsx)(Vr,{children:(0,V.jsx)(Ta,{css:i,at:r,parent:s,options:n,onClick:u,onCancel:d})}):null]})}),Oa=(0,B.forwardRef)(function(e,t){let{options:n,at:r=`bottom`,resolver:i=null,dataKey:a=`contextId`,filter:o=null,css:s=``,children:c,onClick:l}=e,u=(0,B.useRef)(null),d=(0,B.useCallback)((e,t)=>{u.current.show(e,t)},[]);return(0,B.useImperativeHandle)(t,()=>({show:d}),[d]),(0,V.jsxs)(V.Fragment,{children:[c?(0,V.jsx)(`span`,{onContextMenu:d,"data-menu-ignore":`true`,children:c}):null,(0,V.jsx)(Ea,{css:s,at:r,options:n,resolver:i,dataKey:a,filter:o,ref:u,onClick:l})]})}),ka={uploader:{B:`B`,KB:`KB`,MB:`MB`,GB:`GB`,TB:`TB`,PB:`PB`,EB:`EB`,"Drop files here or":`Drop files here or`,"select files":`select files`}},Aa=class{constructor(e,t,n,r,i){this.setFiles=e,this.setReady=t,this.setSignal=n,this.setDrag=r,i&&i.length&&this.setFiles(i)}open(e){this.setSignal([`click`,e||{}])}getState(){let e=`server`,t=this.files;for(let n=0;n<t.length;n++){if(t[n].status===`client`)return`client`;t[n].status===`error`&&(e=`error`)}return e}droparea(e,t){t||={};let n=()=>{t.dragEnter&&t.dragEnter(),this.setDrag(!0)},r=()=>{t.dragLeave&&t.dragLeave(),this.setDrag(!1)},i=e=>{e.preventDefault()},a=e=>{e.preventDefault(),this.setDrag(!1),this.setSignal([`drop`,t,e]),t.dragLeave&&t.dragLeave(),t.drop&&t.drop()};return e.addEventListener(`dragenter`,n),e.addEventListener(`dragleave`,r),e.addEventListener(`dragover`,i,!0),e.addEventListener(`drop`,a,!0),()=>{e.removeEventListener(`dragenter`,n),e.removeEventListener(`dragleave`,r),e.removeEventListener(`dragover`,i,!0),e.removeEventListener(`drop`,a,!0)}}updateFile(e,t){let n=this.files.findIndex(t=>t.id===e);if(n===-1)return;let r=[...this.files];return r[n]={...r[n],...t},this.files=r,this.setFiles(this.files),this.files[n]}deleteFile(e){this.files=this.files.filter(t=>t.id!==e),this.setFiles(this.files)}addFile(e,t){this.files=t?[...this.files,e]:[e],this.setFiles(this.files)}deleteAll(){this.files=[],this.setFiles(this.files)}};function ja(e){let[t,n]=(0,B.useState)(e||[]),[r,i]=(0,B.useState)(Promise.resolve(null)),[a,o]=(0,B.useState)(null),[s,c]=(0,B.useState)(!1),l=(0,B.useRef)();return l.current||=new Aa(n,i,o,c,e),l.current.files=t,l.current.ready=r,l.current.signal=a,l.current.drag=s,l.current}function Ma(e,t){if(e){let n=e.getGroup(t);if(n)return n}return Ar(ka).getGroup(t)}var Na=()=>Math.random().toString(36).substr(2,9),Pa=({data:e,accept:t=``,multiple:n=!0,folder:r=!1,uploadURL:i=``,apiOnly:a=!1,disabled:o=!1,children:s,onChange:c,onUpload:l})=>{let u=(0,B.useRef)(null),d=(0,B.useRef)(null),[f,p]=(0,B.useState)({}),m=ja(),h=e||m,g=Ma((0,B.useContext)(Lr.i18n),`uploader`);(0,B.useEffect)(()=>{u.current&&r&&(u.current.webkitdirectory=!0)},[r]),(0,B.useEffect)(()=>{if(!a&&d.current&&!o)return h.droparea(d.current)},[a,o,d]);let _=e=>{let t=new FormData;return t.append(`upload`,e.file),fetch(i,{method:`POST`,body:t}).then(e=>e.json()).then(t=>({id:e.id,...t}),()=>({id:e.id,status:`error`})).catch(t=>(console.log(t),{id:e.id,status:`error`}))},v=(e,t)=>{let n=h.updateFile(e,t),r={...n,status:h.getState()};n&&n.uploaded&&n.uploaded(r),l&&l(r),n.temp&&h.deleteFile(n.id)},y=e=>{if(!e)return;let t=typeof i==`function`?i(e):_(e);h.setReady(t.then(t=>{t.status=t.status||`server`,v(e.id,t)}).catch(t=>{v(e.id,{status:`error`,error:t})}))},b=(e,t)=>{let r={...t||f,id:Na(),status:`client`,name:e.name,file:e};r.selected&&r.selected(r),c&&c(r),h.addFile(r,n),y(r),u.current&&(u.current.value=``)},x=(e,t,n)=>{e.isFile?e.file(e=>{b(e,n)}):e.isDirectory&&e.createReader().readEntries(e=>{e.forEach(e=>{x(e,t+e.name+`/`,n)})})},S=e=>{Array.from(e.target.files).forEach(e=>b(e))},C=(e,t)=>{Array.from(e.dataTransfer.items).forEach(e=>{let n=e.webkitGetAsEntry();n&&x(n,``,t)})},w=()=>{u.current&&u.current.click()};return(0,B.useEffect)(()=>{if(h.signal){let[e,t,n]=h.signal;p(t),e===`click`?w():e===`drop`&&C(n,t),h.setSignal(null)}},[h.signal]),a?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`input`,{type:`file`,className:`wx-at1A8tb8 wx-input`,ref:u,onChange:S,accept:t,multiple:n,disabled:o}),s]}):(0,V.jsxs)(`div`,{className:`wx-at1A8tb8 wx-label ${h.drag?`wx-active`:``} ${o?`wx-disabled`:``}`,ref:d,children:[(0,V.jsx)(`input`,{type:`file`,className:`wx-at1A8tb8 wx-input`,ref:u,onChange:S,accept:t,multiple:n,disabled:o}),s||(0,V.jsx)(`div`,{className:`wx-at1A8tb8 wx-dropzone`,children:(0,V.jsxs)(`span`,{children:[g(`Drop files here or`),` `,(0,V.jsx)(`span`,{className:`wx-at1A8tb8 wx-action`,onClick:w,children:g(`select files`)})]})})]})};new Date().valueOf();function Fa(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in t){let r=e[n],i=t[n];if(!Ia(r,i))return!1}return!0}function Ia(e,t){if(typeof e==`number`||typeof e==`string`||typeof e==`boolean`||e===null)return e===t;if(typeof e!=typeof t||(e===null||t===null)&&e!==t||e instanceof Date&&t instanceof Date&&e.getTime()!==t.getTime())return!1;if(typeof e==`object`)if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=e.length-1;n>=0;n--)if(!Ia(e[n],t[n]))return!1;return!0}else return Fa(e,t);return e===t}function La(e){if(typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e);if(e instanceof Array)return e.map(La);let t={};for(let n in e)t[n]=La(e[n]);return t}var Ra=2,za=class{constructor(e){e&&(this._writable=e.writable,this._async=e.async),this._values={},this._state={}}setState(e,t=0){let n={};return this._wrapProperties(e,this._state,this._values,``,n,t),n}getState(){return this._values}getReactive(){return this._state}_wrapProperties(e,t,n,r,i,a){for(let o in e){let s=t[o],c=n[o],l=e[o];if(s&&(c===l&&typeof l!=`object`||l instanceof Date&&c instanceof Date&&c.getTime()===l.getTime()))continue;let u=r+(r?`.`:``)+o;s?(s.__parse(l,u,i,a)&&(n[o]=l),a&Ra?i[u]=s.__trigger:s.__trigger()):(t[o]=l&&l.__reactive?this._wrapNested(l,l,u,i):this._wrapWritable(l),n[o]=l),i[u]=i[u]||null}}_wrapNested(e,t,n,r){let i=this._wrapWritable(e);return this._wrapProperties(e,i,t,n,r,0),i.__parse=(e,n,r,a)=>(this._wrapProperties(e,i,t,n,r,a),!1),i}_wrapWritable(e){let t=[],n=function(){for(let n=0;n<t.length;n++)t[n](e)};return{subscribe:n=>(t.push(n),this._async?setTimeout(n,1,e):n(e),()=>{let e=t.indexOf(n);e>=0&&t.splice(e,1)}),__trigger:()=>{t.length&&(this._async?setTimeout(n,1):n())},__parse:function(t){return e=t,!0}}}},Ba=class{constructor(e,t,n,r){this._setter=typeof e==`function`?e:e.setState.bind(e),this._routes=t,this._parsers=n,this._prev={},this._triggers=new Map,this._sources=new Map,this._routes.forEach(e=>{e.in.forEach(t=>{let n=this._triggers.get(t)||[];n.push(e),this._triggers.set(t,n)}),e.out.forEach(t=>{let n=this._sources.get(t)||{};e.in.forEach(e=>n[e]=!0),this._sources.set(t,n)})}),this._routes.forEach(e=>{e.length=Math.max(...e.in.map(e=>Va(e,this._sources,1)))}),this._bus=r}init(e){let t={};for(let n in e)if(this._prev[n]!==e[n]){let r=this._parsers[n];t[n]=r?r(e[n]):e[n]}this._prev=this._prev?{...this._prev,...e}:{...e},this.setState(t),this._bus&&this._bus.exec(`init-state`,t)}setStateAsync(e){let t=this._setter(e,Ra);return this._async?Object.assign(this._async.signals,t):this._async={signals:t,timer:setTimeout(this._applyState.bind(this),1)},t}_applyState(){let e=this._async;if(e){this._async=null,this._triggerUpdates(e.signals,[]);for(let t in e.signals){let n=e.signals[t];n&&n()}}}setState(e,t=[]){let n=this._setter(e);return this._triggerUpdates(n,t),n}_triggerUpdates(e,t){let n=Object.keys(e),r=!t.length;t||=[];for(let e=0;e<n.length;e++){let r=n[e],i=this._triggers.get(r);i&&i.forEach(e=>{t.indexOf(e)==-1&&t.push(e)})}r&&this._execNext(t)}_execNext(e){for(;e.length;){e.sort((e,t)=>e.length<t.length?1:-1);let t=e[e.length-1];e.splice(e.length-1),t.exec(e)}}};function Va(e,t,n){let r=t.get(e);if(!r)return n;let i=Object.keys(r).map(e=>Va(e,t,n+1));return Math.max(...i)}var Ha=class{constructor(){this._nextHandler=null,this._handlers={},this._tag=new WeakMap,this.exec=this.exec.bind(this)}on(e,t,n){let r=this._handlers[e];r?n&&n.intercept?r.unshift(t):r.push(t):r=this._handlers[e]=[t],n&&n.tag&&this._tag.set(t,n.tag)}intercept(e,t,n){this.on(e,t,{...n,intercept:!0})}detach(e){for(let t in this._handlers){let n=this._handlers[t];for(let t=n.length-1;t>=0;t--)this._tag.get(n[t])===e&&n.splice(t,1)}}async exec(e,t){let n=this._handlers[e];if(n)for(let e=0;e<n.length;e++){let r=n[e](t);if(r===!1||r&&r.then&&await r===!1)return}return this._nextHandler&&await this._nextHandler.exec(e,t),t}setNext(e){return this._nextHandler=e}};function Ua(e){return t=>t[e]}function Wa(e){return(t,n)=>t[e]=n}function Ga(e,t){return(t.getter||Ua(t.id))(e)}function Ka(e,t,n){return(t.setter||Wa(t.id))(e,n)}function qa(e,t){let n=document.createElement(`a`);n.href=URL.createObjectURL(e),n.download=t,document.body.appendChild(n),n.click(),document.body.removeChild(n)}function Ja(e,t){let n=Ga(e,t)??``;return t.template?n=t.template(n,e,t):t.optionsMap&&(n=Array.isArray(n)?n.map(e=>t.optionsMap.get(e)).join(`, `):t.optionsMap.get(n)),typeof n>`u`?``:n+``}function Ya(e,t){let n=/\n|"|;|,/,r=``,i=t.rows||`
2
+ `,a=t.cols||` `,o=e._columns,s=e.flatData;t.header!==!1&&o[0].header&&(r=Xa(`header`,o,r,a,i));for(let e=0;e<s.length;e++){let t=[];for(let r=0;r<o.length;r++){let i=Ja(s[e],o[r]);n.test(i)&&(i=`"`+i.replace(/"/g,`""`)+`"`),t.push(i)}r+=(r?i:``)+t.join(a)}return t.footer!==!1&&o[0].footer&&(r=Xa(`footer`,o,r,a,i)),r}function Xa(e,t,n,r,i){let a=/\n|"|;|,/;for(let o=0;o<t[0][e].length;o++){let s=[];for(let n=0;n<t.length;n++){let r=(t[n][e][o].text||``)+``;a.test(r)&&(r=`"`+r.replace(/"/g,`""`)+`"`),s.push(r)}n+=(n?i:``)+s.join(r)}return n}var Za=`portrait`,Qa=100,$a=`a4`,eo={a3:{width:11.7,height:16.5},a4:{width:8.27,height:11.7},letter:{width:8.5,height:11}};function to(e,t){let n=[],r=[],i=0,a=e.filter(e=>!e.hidden),o=ro(t);return a.forEach((e,t)=>{i+e.width<=o?(i+=e.width,r.push(e)):(r.length&&n.push(r),r=[e],i=e.width),t===a.length-1&&r.length&&n.push(r)}),n}function no(e,t,n){let r=[];return e.forEach((i,a)=>{let o=i[t];for(let i=0;i<n.length;i++){r[i]||(r[i]=[]);let s={...o[i]};if(r[i][a]!==null){if(!a&&!s.rowspan&&!s.colspan){let r=1,o=e[a+r][t][i],c=s.width;for(;!o.rowspan&&!o.colspan;)r++,o=e[a+r][t][i],c+=o.width;s.colspan=r,s.width=c,s.height=n[i]}if(r[i].push(s),!s.collapsed&&s.colspan>1){let t=s.colspan-1;if(s.colspan+a>e.length){let n=s.colspan-(s.colspan+a-e.length);s.colspan=n,s.width=e.slice(a,a+t+1).reduce((e,t)=>e+t.width,0),n>1&&(t=n-1)}for(let e=0;e<t;e++)r[i].push(null)}if(s.rowspan>1){let e=s.rowspan;for(let t=1;t<e;t++)r[i+t]||(r[i+t]=[]),r[i+t].push(null)}}}if(i.collapsed)for(let e=0;e<r.length;e++){let t=r[e],n=t[a];if(n&&n.collapsed){if(t[a]=null,!e)break}else{let e=n||t.findLast(e=>e?.colspan>=1);e&&(--e.colspan,e.width-=i.width)}}}),r.map(e=>e.filter(e=>e&&e.colspan!==0))}function ro(e){let{mode:t,ppi:n,paper:r}=e,{width:i,height:a}=eo[r];return io(t===`portrait`?i:a,n)}function io(e,t){return e*t}function ao(e={}){let{mode:t,ppi:n,paper:r}=e;return{mode:t||Za,ppi:n||Qa,paper:r||$a}}function oo(e,t){return e.flexgrow?`min-width:${t}px;width:auto`:`width:${e.width}px; max-width:${e.width}px; height:${e.height}px`}function so(e,t,n){let r=e[n.id];if(n.filter.type===`richselect`&&r){let e=n.filter.config?.options||t.find(({id:e})=>e==n.id).options;e&&(r=e.find(({id:e})=>e==r).label)}return r??``}var co=[`resize-column`,`hide-column`,`update-cell`],lo=[`delete-row`,`update-row`,`update-cell`],uo=[`move-item`],fo=[`resize-column`,`move-item`],po=class{undo=[];redo=[];progress={};in;getState;setState;_previousValues={};constructor(e,t,n){this.in=e,this.getState=t,this.setState=n,this.setHandlers(),this.resetStateHistory()}getHandlers(){return{"add-row":{handler:e=>({action:`delete-row`,data:{id:e.id},source:{action:`add-row`,data:e}})},"delete-row":{handler:e=>{let{id:t}=e,{data:n}=this.getPrev(),r=n.findIndex(e=>e.id===t);return{action:`add-row`,data:{id:t,row:n[r],before:r<n.length-1?n[r+1].id:void 0},source:{action:`delete-row`,data:e}}}},"update-cell":{handler:e=>{let{id:t,column:n}=e,r=Ga(this.getRow(t),this.getColumn(n));return Ia(r,e.value)?null:{action:`update-cell`,data:{id:t,column:n,value:r},source:{action:`update-cell`,data:e}}}},"update-row":{handler:e=>{let{id:t,row:n}=e,r=this.getRow(t);for(let e in n)Object.keys(r).includes(e)||(r[e]=void 0);return{action:`update-row`,data:{id:t,row:r},source:{action:`update-row`,data:e}}}},"copy-row":{handler:e=>{let{id:t}=e,{data:n}=this.getState(),r=n.findIndex(e=>e.id===t),i=n[r];return{action:`delete-row`,data:{id:t},source:{action:`add-row`,data:{id:t,row:i,before:r<n.length-1?n[r+1].id:void 0}}}}},"resize-column":{handler:e=>{let{id:t,width:n}=e,r=this.getColumn(t),{_sizes:i}=this.getState();return{action:`resize-column`,data:{id:t,width:r.width??i.columnWidth},source:{action:`resize-column`,data:{id:t,width:n}}}}},"hide-column":{handler:e=>{let{id:t}=e;return{action:`hide-column`,data:{id:t,mode:this.getColumn(t).hidden},source:{action:`hide-column`,data:e}}}},"collapse-column":{handler:e=>{let{id:t,row:n,mode:r}=e;return{action:`collapse-column`,data:{id:t,row:n,mode:typeof r==`boolean`?!r:r},source:{action:`collapse-column`,data:e}}}},"move-item":{handler:e=>{let{id:t,target:n,mode:r}=e,{flatData:i}=this.getPrev(),a=i.findIndex(e=>e.id===t);return{action:`move-item`,data:{id:t,target:i[a+(a?-1:1)].id,mode:a?`after`:`before`},source:{action:`move-item`,data:{id:t,target:n,mode:r}}}}},"open-row":{handler:e=>{let{id:t,nested:n}=e;return{action:`close-row`,data:{id:t,nested:n},source:{action:`open-row`,data:e}}}},"close-row":{handler:e=>{let{id:t,nested:n}=e;return{action:`open-row`,data:{id:t,nested:n},source:{action:`close-row`,data:e}}}}}}resetHistory(){this.undo=[],this.redo=[],this.progress={},this.resetStateHistory()}getPrev(){return this._previousValues}setHandlers(){let e=this.getHandlers();for(let t in e)this.in.intercept(t,e=>{if(!(e.eventSource===`undo`||e.eventSource===`redo`||e.skipUndo)){if(fo.includes(t)){(e.inProgress&&!this.progress[t]||typeof e.inProgress!=`boolean`)&&(uo.includes(t)&&this.setPrev(`flatData`),co.includes(t)&&this.setPrev(`columns`)),this.progress[t]=e.inProgress;return}lo.includes(t)&&this.setPrev(`data`),co.includes(t)&&this.setPrev(`columns`)}}),this.in.on(t,n=>{if(n.eventSource===`undo`||n.eventSource===`redo`||n.skipUndo||n.inProgress)return;let r=e[t].handler(n);r&&this.addToHistory(r)})}setPrev(e){this._previousValues[e]=La(this.getState()[e])}addToHistory(e){this.undo.push(e),this.redo=[],this.setStateHistory()}handleUndo(){if(!this.undo.length)return;let e=this.undo.pop();this.redo.push({...e.source,source:e}),this.in.exec(e.action,{...e.data,eventSource:`undo`}),this.setStateHistory()}handleRedo(){if(!this.redo.length)return;let e=this.redo.pop();this.undo.push({...e.source,source:e}),this.in.exec(e.action,{...e.data,eventSource:`redo`}),this.setStateHistory()}resetStateHistory(){this.setState({history:{undo:0,redo:0}})}setStateHistory(){this.setState({history:{undo:this.undo.length,redo:this.redo.length}})}getRow(e){let{data:t}=this.getPrev();return this.getState().tree?this.getTreeRow(t,e):t.find(t=>t.id===e)}getTreeRow(e,t){for(let n=0;n<e.length;n++){if(e[n].id===t)return e[n];if(e[n].data){let r=this.getTreeRow(e[n].data,t);if(r)return r}}return null}getColumn(e){let{columns:t}=this.getPrev();return t.find(t=>t.id===e)}};function mo(){return!0}function ho(e,t){return typeof e>`u`||e===null?-1:typeof t>`u`||t===null?1:e===t?0:e>t?1:-1}function go(e,t){return-ho(e,t)}function _o(e,t){if(typeof t.sort==`function`)return function(n,r){let i=t.sort(n,r);return e===`asc`?i:-i};let n=e===`asc`?ho:go;return function(e,r){return n(Ga(e,t),Ga(r,t))}}function vo(e,t){if(!e||!e.length)return;let n=e.map(e=>{let n=t.find(t=>t.id==e.key);return _o(e.order,n)});return e.length===1?n[0]:function(e,t){for(let r=0;r<n.length;r++){let i=n[r](e,t);if(i!==0)return i}return 0}}var yo=28,bo=20;function xo(){if(typeof document>`u`)return`willow`;let e=document.querySelector(`[class^="wx"][class$="theme"]`);return e?e.className.substring(3,e.className.length-6):`willow`}function So(e,t,n,r,i){let a=document.createElement(`div`),o=document.createElement(`div`),s=document.body;i=i?`${i}px`:`auto`;let c,l;o.className=t,a.classList.add(`wx-${n}-theme`),a.style.cssText=`height:auto;position:absolute;top:0px;left:100px;overflow:hidden;width=${i};white-space:nowrap;`,a.appendChild(o),s.appendChild(a),typeof e!=`object`&&(e=[e]);for(let t=0;t<e.length;t++){o.innerText=e[t]+``;let n=a.getBoundingClientRect(),i=Math.ceil(n.width)+(r&&r.length?r[t]:0),s=Math.ceil(n.height);c=Math.max(c||0,i),l=Math.max(l||0,s)}return a.remove(),{width:c,height:l}}function Co(e,t,n,r,i){let a=[];for(let o=0;o<e.length;o++){let s=e[o][t],c=s.length;for(let e=0;e<c;e++){let{text:o,vertical:c,collapsed:l,rowspan:u,css:d}=s[e];if(!o){a[e]=Math.max(a[e]||0,r);continue}let f=0;if(c&&!l){let c=`wx-measure-cell-${t}`;if(c+=d?` ${d}`:``,f=So(o,c,i).width,(u>1||!s[e+1])&&n>e+1){let t=u||n-e,i=a.slice(e,e+t).reduce((e,t)=>e+t,0);if(i<f){let n=Math.ceil((f-i)/t);for(let i=e;i<e+t;i++)a[i]=(a[i]||r)+n}continue}}a[e]=Math.max(a[e]||r,f)}}return a}function wo(e,t,n){let r=[],i=[],a=`wx-measure-cell-body`;a+=e.css?` ${e.css}`:``;for(let n=0;n<t.length;n++){let a=t[n],o=Ja(a,e);o&&(r.push(o),e.treetoggle?i.push(t[n].$level*yo+(t[n].$count?yo:0)+(e.draggable?yo:0)):e.draggable&&i.push(yo))}return So(r,a,n,i).width}function To(e,t){let n=`wx-measure-cell-header`,r=e.sort?bo:0,i=e.header;if(typeof i==`string`)return So(i,n,t).width+r;let a;Array.isArray(i)||(i=[i]);for(let e=0;e<i.length;e++){let o=i[e],s=So(typeof o==`string`?o:o.text,n+(typeof o==`string`?``:` ${o.css}`),t).width;e===i.length-1&&(s+=r),a=Math.max(a||0,s)}return a}var Eo={text:(e,t)=>e?e.toString().toLowerCase().indexOf(t.toLowerCase())!==-1:!t,richselect:(e,t)=>typeof t!=`number`&&!t||e==t,datepicker:(e,t)=>!t||e&&ko(e,t),multiselect:(e,t)=>!t||t?.length===0?!0:Array.isArray(e)?e?.some(e=>t.includes(e)):e&&t.includes(e)};function Do(e){return Eo[e]}function Oo(e,t){let n=[];for(let r in e){let i=t.find(e=>e.id==r),{config:a,type:o}=i.header.find(e=>e.filter).filter,s=e[r];n.push(e=>{let t=Ga(e,i);return a?.handler?a.handler(t,s):Do(o)(t,s)})}return e=>{for(let t=0;t<n.length;t++)if(!n[t](e))return!1;return!0}}function ko(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}var Ao=class extends za{in;_router;_branches;_xlsxWorker;_historyManager;constructor(e){super({writable:e,async:!1});let t={rowHeight:37,columnWidth:160,headerHeight:36,footerHeight:36};this._router=new Ba(super.setState.bind(this),[{in:[`columns`,`sizes`,`_skin`],out:[`_columns`,`_sizes`],exec:e=>{let{columns:t,sizes:n,_skin:r}=this.getState(),i=this.copyColumns(t),a=i.reduce((e,t)=>Math.max(t.header.length,e),0),o=i.reduce((e,t)=>Math.max(t.footer.length,e),0);i.forEach(this.setCollapsibleColumns);let s=this.normalizeSizes(i,n,a,o,r);for(let e=0;e<i.length;e++)this.normalizeColumns(i,e,`header`,a,s),this.normalizeColumns(i,e,`footer`,o,s);this.setState({_columns:i,_sizes:s},e)}},{in:[`data`,`tree`,`_filterIds`],out:[`flatData`,`_rowHeightFromData`],exec:e=>{let{data:t,tree:n,dynamic:r,_filterIds:i}=this.getState(),a=i&&new Set(i),o=n?this.flattenRows(t,[],i):a?t.filter(e=>a.has(e.id)):t,s=!r&&o.some(e=>e.rowHeight);this.setState({flatData:o,_rowHeightFromData:s},e)}}],{sizes:e=>({...t,...e})});let n=this.in=new Ha;n.on(`close-editor`,({ignore:e})=>{let{editor:t}=this.getState();t&&(e||n.exec(`update-cell`,t),this.setState({editor:null}))}),n.on(`open-editor`,({id:e,column:t})=>{let r=this.getState().editor;r&&n.exec(`close-editor`,{});let i=this.getRow(e),a=t?this.getColumn(t):this.getNextEditor(i);if(a?.editor){let t=a.editor;if(typeof t==`function`&&(t=t(i,a)),!t)return;r={column:a.id,id:e,value:Ga(i,a)??``,renderedValue:Ja(i,a),type:t.type||t},typeof t==`object`&&t.config&&(r.config=t.config,t.config.options&&(r.options=t.config.options)),a.options&&!r.options&&(r.options=a.options),this.setState({editor:r})}}),n.on(`editor`,({value:e})=>{let t=this.getState().editor;if(t){t={...t},t.value=e;let n=this.getColumn(t.column),r={...this.getRow(t.id)};Ka(r,n,e),t.renderedValue=Ja(r,n),this.setState({editor:t})}}),n.on(`add-row`,e=>{let t=this.getState(),{data:r}=t,{select:i,_filterIds:a}=t,{row:o,before:s,after:c,select:l}=e;if(e.id=o.id=e.id||o.id||Mo(),s||c){let t=s||c,n=r.findIndex(e=>e.id===t);r=[...r],r.splice(n+ +!!c,0,e.row)}else r=[...r,e.row];let u={data:r};a&&(u._filterIds=[...a,e.id]),this.setState(u),!(typeof l==`boolean`&&!l)&&(l||i)&&n.exec(`select-row`,{id:o.id,show:!0})}),n.on(`delete-row`,e=>{let{data:t,selectedRows:n,focusCell:r,editor:i}=this.getState(),{id:a}=e,o={data:t.filter(e=>e.id!==a)};this.isSelected(a)&&(o.selectedRows=n.filter(e=>e!==a)),i?.id===a&&(o.editor=null),this.setState(o),r?.row===a&&this.in.exec(`focus-cell`,{eventSource:`delete-row`})}),n.on(`update-cell`,e=>{let t=this.getState(),{data:n}=t;n=[...n];let{tree:r}=t,{id:i,column:a,value:o}=e,s=this.getColumn(a);if(r){let e={...this._branches[i]};Ka(e,s,o);let t=this.updateTreeRow(e);e.$parent===0&&(n=t)}else{let e=n.findIndex(e=>e.id===i),t={...n[e]};Ka(t,s,o),n[e]=t}this.setState({data:n})}),n.on(`update-row`,e=>{let{data:t}=this.getState(),{id:n,row:r}=e,i=t.findIndex(e=>e.id===n);t=[...t],t[i]={...t[i],...r},this.setState({data:t})}),n.on(`select-row`,({id:e,toggle:t,range:n,mode:r,show:i,column:a})=>{let o=this.getState(),{focusCell:s}=o,{selectedRows:c}=o;if(c.length||(n=t=!1),n){let{data:t}=this.getState(),n=t.findIndex(e=>e.id===c[c.length-1]),r=t.findIndex(t=>t.id===e);n>r&&([n,r]=[r,n]),t.slice(n,r+1).forEach(e=>{this.isSelected(e.id)||c.push(e.id)})}else if(t&&this.isSelected(e)){if(r===!0)return;c=c.filter(t=>t!==e)}else if(t){if(r===!1)return;c.push(e)}else c=[e];this.setState({selectedRows:[...c]}),s?.row!==e&&this.in.exec(`focus-cell`,{eventSource:`select-row`}),i&&this.in.exec(`scroll`,{row:e,column:a})}),this.in.on(`focus-cell`,e=>{let{row:t,column:n,eventSource:r}=e,{_columns:i,split:a}=this.getState();t&&n?(this.setState({focusCell:{row:t,column:n}}),r!==`click`&&((!a.left||i.findIndex(t=>t.id===e.column)>=a.left)&&(!a.right||i.findIndex(t=>t.id===e.column)<i.length-a.right)?this.in.exec(`scroll`,{row:t,column:n}):this.in.exec(`scroll`,{row:t}))):this.setState({focusCell:null})}),n.on(`resize-column`,e=>{let{id:t,auto:n,maxRows:r,inProgress:i}=e;if(i===!1)return;let a=e.width||0,o=[...this.getState().columns],s=this.getColumn(t);if(n){if(n===`data`||n===!0){let{flatData:e,_skin:t}=this.getState(),n=e.length;r&&(n=Math.min(r,n)),a=wo(s,e.slice(0,n),t)}if(n===`header`||n===!0){let{_skin:e}=this.getState();a=Math.max(To(s,e),a)}}s.width=Math.max(17,a),delete s.flexgrow,this.setState({columns:o})}),n.on(`hide-column`,e=>{let{id:t,mode:n}=e,r=[...this.getState().columns],i=this.getColumn(t),a=r.reduce((e,t)=>e+ +!t.hidden,0);!n||a>1?(i.hidden=!i.hidden,this.setState({columns:r})):e.skipUndo=!0}),n.on(`sort-rows`,e=>{let{key:t,add:n,sort:r}=e,i=this.getState(),{columns:a,data:o,tree:s}=i;if(r){let e=[...o];e.sort(r),this.setState({data:e});return}let{order:c=`asc`}=e,l=i.sortMarks,u=Object.keys(l),d=u.length;!n||!d||d===1&&l[t]?l={[t]:{order:c}}:(d===1&&(l[u[0]]={...l[u[0]],index:0}),l={...l,[t]:{order:c,index:typeof n==`number`?n:l[t]?.index??d}});let f=Object.keys(l).sort((e,t)=>l[e].index-l[t].index).map(e=>({key:e,order:l[e].order}));this.setState({sortMarks:l});let p=vo(f,a);if(p){let e=[...o];s?this.sortTree(e,p):e.sort(p),this.setState({data:e})}}),n.on(`filter-rows`,e=>{let{value:t,key:n,filter:r}=e;if(!Object.keys(e).length){this.setState({filterValues:{},_filterIds:null});return}let i=this.getState(),{data:a,tree:o,_columns:s}=i,c=i.filterValues,l={};n&&(c={...c,[n]:t},l.filterValues=c);let u=r??Oo(c,s),d=[];o?d=this.filterTree(a,u,d):a.forEach(e=>{u(e)&&d.push(e.id)}),l._filterIds=d,this.setState(l)}),n.on(`collapse-column`,e=>{let{id:t,row:n,mode:r}=e,i=[...this.getState().columns],a=this.getColumn(t).header,o=Array.isArray(a)?a[n]:a;typeof o==`object`&&(o.collapsed=r??!o.collapsed,this.setState({columns:i}))}),n.on(`move-item`,e=>{let{id:t,inProgress:n}=e,{target:r,mode:i=`after`}=e,{data:a,flatData:o,tree:s}=this.getState(),c=o.findIndex(e=>e.id===t),l;if(i===`up`||i===`down`){if(i===`up`){if(c===0)return;l=c-1,i=`before`}else if(i===`down`){if(c===o.length-1)return;l=c+1,i=`after`}r=o[l]&&o[l].id}else l=o.findIndex(e=>e.id===r);if(c===-1||l===-1||n===!1)return;let u;s||(u=this.moveItem(t,r,a,i)),this.setState({data:s?this.normalizeTreeRows(u):u})}),n.on(`copy-row`,e=>{let{id:t,target:n,mode:r=`after`}=e,i=this.getState(),{flatData:a,_filterIds:o}=i,{data:s}=i,c=this.getRow(t);if(!c)return;let l={...c,id:Mo()};e.id=l.id;let u=a.findIndex(e=>e.id===n);if(u===-1)return;s.splice(u+ +(r===`after`),0,l),s=[...s];let d={data:s};o&&(d._filterIds=[...o,l.id]),this.setState(d)}),n.on(`open-row`,e=>{let{id:t,nested:n}=e;this.toggleBranch(t,!0,n)}),n.on(`close-row`,e=>{let{id:t,nested:n}=e;this.toggleBranch(t,!1,n)}),n.on(`export-data`,e=>new Promise((t,n)=>{let r=e.format||`csv`,i=`${e.fileName||`data`}.${r}`;if(r===`csv`){let n=Ya(this.getState(),e.csv||{});e.download===!1?e.result=n:qa(new Blob([``+n],{type:`text/csv`}),i),t(!0)}else n()})),n.on(`hotkey`,({key:e,event:t,isInput:n})=>{switch(e){case`arrowup`:{let{flatData:e,focusCell:r,select:i}=this.getState();if(t.preventDefault(),n)return;let a=r?r.column:this._getFirstVisibleColumn()?.id,o=r?this.getPrevRow(r.row)?.id:e[e.length-1]?.id;a&&o&&(this.in.exec(`focus-cell`,{row:o,column:a,eventSource:`key`}),i&&this.in.exec(`select-row`,{id:o}));break}case`arrowdown`:{let{flatData:e,focusCell:r,select:i}=this.getState();if(t.preventDefault(),n)return;let a=r?r.column:this._getFirstVisibleColumn()?.id,o=r?this.getNextRow(r.row)?.id:e[0]?.id;a&&o&&(this.in.exec(`focus-cell`,{row:o,column:a,eventSource:`key`}),i&&this.in.exec(`select-row`,{id:o}));break}case`arrowright`:{let{focusCell:e}=this.getState();if(n)return;if(t.preventDefault(),e){let t=this.getNextColumn(e.column,!0)?.id;t&&this.in.exec(`focus-cell`,{row:e.row,column:t,eventSource:`key`})}break}case`arrowleft`:{let{focusCell:e}=this.getState();if(n)return;if(t.preventDefault(),e){let t=this.getPrevColumn(e.column,!0)?.id;t&&this.in.exec(`focus-cell`,{row:e.row,column:t,eventSource:`key`})}break}case`tab`:{let{editor:e,focusCell:n,select:r}=this.getState();if(e){t.preventDefault();let n=e.column,i=e.id,a=this.getNextEditor(this.getRow(i),this.getColumn(n));if(!a){let e=this.getNextRow(i);e&&(i=e.id,a=this.getNextEditor(e))}a&&(this.in.exec(`open-editor`,{id:i,column:a.id}),this.in.exec(`focus-cell`,{row:i,column:a.id,eventSource:`key`}),r&&!this.isSelected(i)&&this.in.exec(`select-row`,{id:i}))}else n&&this.in.exec(`focus-cell`,{eventSource:`key`});break}case`shift+tab`:{let{editor:e,focusCell:n,select:r}=this.getState();if(e){t.preventDefault();let n=e.column,i=e.id,a=this.getPrevEditor(this.getRow(i),this.getColumn(n));if(!a){let e=this.getPrevRow(i);e&&(i=e.id,a=this.getPrevEditor(e))}a&&(this.in.exec(`open-editor`,{id:i,column:a.id}),this.in.exec(`focus-cell`,{row:i,column:a.id,eventSource:`key`}),r&&!this.isSelected(i)&&this.in.exec(`select-row`,{id:i}))}else n&&this.in.exec(`focus-cell`,{eventSource:`key`});break}case`escape`:{let{editor:e}=this.getState();e&&(this.in.exec(`close-editor`,{ignore:e.type!=`multiselect`}),this.in.exec(`focus-cell`,{row:e.id,column:e.column,eventSource:`key`}));break}case`f2`:{let{editor:e,focusCell:t}=this.getState();!e&&t&&this.in.exec(`open-editor`,{id:t.row,column:t.column});break}case`enter`:{let{focusCell:e,tree:t}=this.getState();if(!n&&t&&e&&this.getColumn(e.column).treetoggle){let t=this.getRow(e.row);if(!t.data)return;this.in.exec(t.open?`close-row`:`open-row`,{id:e.row,nested:!0})}break}case`home`:{let{editor:e,focusCell:n}=this.getState();if(!e&&n){t.preventDefault();let e=this._getFirstVisibleColumn()?.id;this.in.exec(`focus-cell`,{row:n.row,column:e,eventSource:`key`})}break}case`ctrl+home`:{let{editor:e,focusCell:n,flatData:r,select:i}=this.getState();if(!e&&n){t.preventDefault();let e=r[0]?.id,n=this._getFirstVisibleColumn()?.id;e&&n&&(this.in.exec(`focus-cell`,{row:e,column:n,eventSource:`key`}),i&&!this.isSelected(e)&&this.in.exec(`select-row`,{id:e}))}break}case`end`:{let{editor:e,focusCell:n}=this.getState();if(!e&&n){t.preventDefault();let e=this._getLastVisibleColumn()?.id,r=n.row;this.in.exec(`focus-cell`,{row:r,column:e,eventSource:`key`})}break}case`ctrl+end`:{let{editor:e,focusCell:n,flatData:r,select:i}=this.getState();if(!e&&n){t.preventDefault();let e=r.at(-1).id,n=this._getLastVisibleColumn()?.id;e&&n&&(this.in.exec(`focus-cell`,{row:e,column:n,eventSource:`key`}),i&&!this.isSelected(e)&&this.in.exec(`select-row`,{id:e}))}break}case`ctrl+z`:this.in.exec(`undo`,{});break;case`ctrl+y`:this.in.exec(`redo`,{})}}),n.on(`scroll`,e=>{let{_columns:t,split:n,_sizes:r,flatData:i,dynamic:a,_rowHeightFromData:o}=this.getState(),s=-1,c=-1,l=0,u=0;if(e.column){s=0;let r=t.findIndex(t=>t.id===e.column);l=t[r].width;for(let e=n.left??0;e<r;e++){let n=t[e];n.hidden||(s+=n.width)}}if(e.row&&!a){let t=i.findIndex(t=>t.id===e.row);t>=0&&(o?(c=i.slice(0,t).reduce((e,t)=>e+(t.rowHeight||r.rowHeight),0),u=i[t].rowHeight):c=r.rowHeight*t)}this.setState({scroll:{top:c,left:s,width:l,height:u||r.rowHeight}})}),n.on(`scroll-to`,e=>{let t={};e.top!==void 0&&(t.scrollTop=e.top),e.left!==void 0&&(t.scrollLeft=e.left),Object.keys(t).length&&this.setState(t)}),n.on(`print`,e=>{let t=ao(e);this.setState({_print:t}),this.setStateAsync({_print:null})}),n.on(`undo`,()=>{this._historyManager?.handleUndo()}),n.on(`redo`,()=>{this._historyManager?.handleRedo()}),this.initOnce()}getXlsxWorker(e){if(!this._xlsxWorker){let t=window.URL.createObjectURL(new Blob([`importScripts('${e}');`],{type:`text/javascript`}));this._xlsxWorker=new Promise(e=>{let n=new Worker(t);n.addEventListener(`message`,t=>{t.data.type===`init`&&e(n)})})}return this._xlsxWorker}initOnce(){this._router.init({sortMarks:{},_filterIds:null,data:[],filterValues:{},scroll:null,scrollLeft:0,scrollTop:0,editor:null,focusCell:null,_print:null,history:{undo:0,redo:0},search:null})}init(e){e.hasOwnProperty(`_skin`)&&!e._skin&&(e._skin=xo()),e.columns&&e.columns.forEach(e=>{e.options&&(e.optionsMap=new Map(e.options.map(e=>[e.id,e.label])))}),Ia(this.getState().data,e.data)||(e.data=e.tree?this.normalizeTreeRows(e.data):this.normalizeRows(e.data),this.setState({_filterIds:null,filterValues:{},sortMarks:{},search:null}),this._historyManager&&this._historyManager.resetHistory()),e.tree&&(e.undo=!1,e.reorder=!1),e.split?.right&&(e.split.right=0),e.undo&&!this._historyManager&&(this._historyManager=new po(this.in,this.getState.bind(this),this.setState.bind(this))),this._router.init({...e})}setState(e,t){return this._router.setState(e,t)}setStateAsync(e){this._router.setStateAsync(e)}getRow(e){let{tree:t}=this.getState();return t?this._branches[e]:this.getState().data.find(t=>t.id===e)}getRowIndex(e,t){return t||=this.getState().flatData,t.findIndex(t=>t.id===e)}getNextRow(e){let t=this.getState().flatData;return t[this.getRowIndex(e,t)+1]}getPrevRow(e){let t=this.getState().flatData;return t[this.getRowIndex(e,t)-1]}getColumn(e){return this.getState().columns.find(t=>t.id===e)}getNextColumn(e,t){let n=this.getState()._columns,r=n.findIndex(t=>t.id===e);return t?this._getFirstVisibleColumn(r+1):n[r+1]}getPrevColumn(e,t){let n=this.getState()._columns,r=n.findIndex(t=>t.id===e);return t?this._getLastVisibleColumn(r-1):n[r-1]}_getFirstVisibleColumn(e){let t=this.getState()._columns,n=e??0;for(;n<t.length&&(t[n]?.hidden||t[n]?.collapsed);)n++;return t[n]}_getLastVisibleColumn(e){let t=this.getState()._columns,n=e??t.length-1;for(;n<t.length&&(t[n]?.hidden||t[n]?.collapsed);)n--;return t[n]}isCellEditable(e,t){let{editor:n,hidden:r}=t;return!n||r?!1:typeof n!=`function`||n(e,t)}getNextEditor(e,t){let n=this.getState().columns;if(t){let e=n.findIndex(e=>e.id===t.id);n=n.slice(e+1)}return n.find(t=>this.isCellEditable(e,t))}getPrevEditor(e,t){let n=this.getState().columns;if(t){let e=n.findLastIndex(e=>e.id===t.id);n=n.slice(0,e)}return n.findLast(t=>this.isCellEditable(e,t))}toggleBranch(e,t,n){let r=this._branches[e],{data:i}=this.getState();if(i=[...i],e!==0){r={...r,open:t};let e=this.updateTreeRow(r);r.$parent===0&&(i=e)}n&&r.data?.length&&r.data.forEach(r=>{let a=this.toggleKids(r,t,n);e===0&&(i=a)}),this.setState({data:i})}toggleKids(e,t,n){e={...e,open:t};let r=this.updateTreeRow(e);return n&&e.data?.length&&e.data.forEach(e=>{this.toggleKids(e,t,n)}),r}updateTreeRow(e){let t=e.id;this._branches[t]=e;let n=this._branches[e.$parent],r=n.data.findIndex(e=>e.id===t);return n.data=[...n.data],n.data[r]=e,n.data}isSelected(e){return this.getState().selectedRows.indexOf(e)!==-1}findAndRemove(e,t){for(let n=0;n<e.length;n++){if(e[n].id===t)return e.splice(n,1)[0];if(e[n].data){let r=[...e[n].data],i=this.findAndRemove(r,t);if(i)return e[n]={...e[n],data:r},i}}return null}insertItem(e,t,n,r){for(let i=0;i<e.length;i++){if(e[i].id===t){let t=e[i],a=r===`before`?i:i+1;if(t.data){if(r===`before`){let t=i>0?e[i-1]:null;return t?.data&&t.open?e[i-1]={...t,data:[...t.data,n]}:e.splice(a,0,n),!0}if(t.open)return e[i]={...t,data:[n,...t.data]},!0}return e.splice(a,0,n),!0}if(e[i].data&&(e[i]={...e[i],data:[...e[i].data]},this.insertItem(e[i].data,t,n,r)))return!0}return!1}moveItem(e,t,n,r){let i=[...n],a=this.findAndRemove(i,e);return this.insertItem(i,t,a,r),i}copyColumns(e){let t=[];for(let n=0;n<e.length;n++){let r={...e[n]};this.copyHeaderFooter(r,`header`),this.copyHeaderFooter(r,`footer`),t[n]=r}return t}copyHeaderFooter(e,t){let n=e[t];n=Array.isArray(n)?[...n]:[n],n.forEach((e,t)=>{n[t]=typeof e==`string`?{text:e}:{...e}}),e[t]=n}setCollapsibleColumns(e,t,n){let r=e.header;for(let i=0;i<r.length;i++){let a=r[i];if(a.collapsible&&a.collapsed){if(a.collapsible!==`first`){e.collapsed=!0,e.width=36,a.vertical=!0;let t=r.length-i;r=r.slice(0,i+1),r[i].rowspan=t}let o=a.colspan;if(o){let e=r[i+1],a=1;e&&e.colspan&&!e.collapsed&&(a=e.colspan);for(let e=a;e<o;e++){let r=n[t+e];r&&(r.hidden=!0)}}}}}normalizeColumns(e,t,n,r,i){let a=e[t];a.width||=a.flexgrow?17:i.columnWidth,a._colindex=t+1;let o=a[n],s=i[`${n}RowHeights`];for(let c=0;c<r;c++){let l=o[c];l.id=a.id,c===o.length-1&&(l.rowspan=l.rowspan?Math.min(l.rowspan,r-c):r-c);for(let r=1;r<l.rowspan;r++){o.splice(c+r,0,{_hidden:!0});for(let i=1;i<l.colspan;i++)e[t+i][n].splice(c+r,0,{})}if(l.rowspan&&(l.height=(l.rowspan===r?s:s.slice(c,l.rowspan+c)).reduce((e,t)=>e+t,0),c+l.rowspan!=r&&l.height--),l.colspan){let n=a.width,r=a.flexgrow||0,o=l.colspan;for(let a=1;a<o;a++){let o=e[t+a];o&&(o.hidden?--l.colspan:o.flexgrow?r+=o.flexgrow:n+=o.width||i.columnWidth),r?l.flexgrow=r:l.width=n}}else l.width=a.width,l.flexgrow=a.flexgrow;n===`header`&&l.filter&&typeof l.filter==`string`&&(l.filter={type:l.filter})}o.length>r&&(o.length=r),a[n]=o}normalizeRows(e){for(let t=0;t<e.length;t++)e[t].id||(e[t].id=Mo());return e}normalizeTreeRows(e,t,n){return!t&&!n&&(this._branches={0:{data:e}}),e.forEach(e=>{e.id||=Mo(),e.$level=t||0,e.$parent=n||0,this._branches[e.id]=e,e.data&&(e.data.length?(e.$count=e.data.length,this.normalizeTreeRows(e.data,e.$level+1,e.id)):(delete e.data,delete e.$count,delete e.open))}),e}sortTree(e,t){e.sort(t),e.forEach(e=>{e.data&&this.sortTree(e.data,t)})}filterTree(e,t,n){return e.forEach(e=>{t(e)&&n.push(e.id),e.data&&this.filterTree(e.data,t,n)}),n}flattenRows(e,t,n){let r=t;return e.forEach(e=>{(!n||n.includes(e.id))&&r.push(e),e.data?.length&&e.open!==!1&&this.flattenRows(e.data,r,n)}),r}createFilter(e){let{_columns:t}=this.getState(),n=[];for(let r in e){let i=t.find(e=>e.id==r),{config:a,type:o}=i.header.find(e=>e.filter).filter,s=e[r];n.push(e=>{let t=Ga(e,i);return a?.handler?a.handler(t,s):Do(o)(t,s)})}return e=>{for(let t=0;t<n.length;t++)if(!n[t](e))return!1;return!0}}searchRows(e,t){e=e.trim().toLowerCase();let n={};if(!e)return n;let{flatData:r,columns:i}=this.getState(),a=t?i.filter(e=>t[e.id]):i;return r.forEach(t=>{let r={};a.forEach(n=>{let i=Ja(t,n);String(i).toLowerCase().includes(e)&&(r[n.id]=!0)}),Object.keys(r).length&&(n[t.id]=r)}),n}normalizeSizes(e,t,n,r,i){let a=Co(e,`header`,n,t.headerHeight,i),o=Co(e,`footer`,r,t.footerHeight,i),s=a.reduce((e,t)=>e+t,0),c=o.reduce((e,t)=>e+t,0);return{...t,headerRowHeights:a,footerRowHeights:o,headerHeight:s,footerHeight:c}}},jo=new Date().valueOf();function Mo(){return`temp://`+jo++}function No(e,t=`data-id`){let n=e;for(!n.tagName&&e.target&&(n=e.target);n;){if(n.getAttribute&&n.getAttribute(t))return n;n=n.parentNode}return null}new Date().valueOf();var Po=class{constructor(){this.store=new Map}configure(e,t){this.node=t;for(let t in e)if(e[t]){let n=t.toLowerCase().replace(/[ ]/g,``),r=e[t];this.store.set(n,r)}}},Fo=[],Io={subscribe:e=>{Ro();let t=new Po;return Fo.push(t),e(t),()=>{let e=Fo.findIndex(e=>e===t);e>=0&&Fo.splice(e,1)}}},Lo=!1;function Ro(){Lo||(Lo=!0,document.addEventListener(`keydown`,e=>{if(Fo.length&&(e.ctrlKey||e.altKey||e.metaKey||e.shiftKey||e.key.length>1||e.key===` `)){let t=[];e.ctrlKey&&t.push(`ctrl`),e.altKey&&t.push(`alt`),e.metaKey&&t.push(`meta`),e.shiftKey&&t.push(`shift`);let n=e.code.replace(`Key`,``).toLocaleLowerCase();e.key===` `&&(n=`space`),t.push(n);let r=t.join(`+`);for(let t=Fo.length-1;t>=0;t--){let i=Fo[t],a=i.store.get(r)||i.store.get(n);a&&i.node.contains(e.target)&&a(e,{key:r,evKey:n})}}}))}var zo={tab:!0,"shift+tab":!0,arrowup:!0,arrowdown:!0,arrowright:!0,arrowleft:!0,enter:!0,escape:!0,f2:!0,home:!0,end:!0,"ctrl+home":!0,"ctrl+end":!0,"ctrl+z":!0,"ctrl+y":!0};function Bo(e,{keys:t,exec:n}){if(!t)return;function r(e){let t=e.target;return t.tagName===`INPUT`||t.tagName===`TEXTAREA`||No(t,`data-header-id`)?.classList.contains(`wx-filter`)||!!t.closest(`.wx-cell.wx-editor`)}let i={};for(let e in t){let a=t[e];typeof a<`u`&&(typeof a==`function`?i[e]=a:a&&(i[e]=t=>{let i=r(t);n({key:e,event:t,isInput:i})}))}let a=Io.subscribe(t=>{t.configure(i,e)});return{destroy:()=>{a()}}}function Vo(e,t){let n=null;t.scroll.subscribe(r=>{if(!r||r===n)return;n=r;let{left:i,top:a,height:o,width:s}=r,c=t.getHeight(),l=t.getWidth(),u=t.getScrollMargin();if(a>=0){let t=e.scrollTop;a<t?e.scrollTop=a:a+o>t+c&&(e.scrollTop=a-c+o)}if(i>=0){let t=e.scrollLeft;i<t?e.scrollLeft=i:i+s>t+l-u&&(e.scrollLeft=i-l+s+u)}}),t.scrollLeft?.subscribe?.(t=>{requestAnimationFrame(()=>{Math.abs(e.scrollLeft-t)>1&&(e.scrollLeft=t)})}),t.scrollTop?.subscribe?.(t=>{requestAnimationFrame(()=>{Math.abs(e.scrollTop-t)>1&&(e.scrollTop=t)})})}var Ho=(0,B.createContext)(null);function Uo(e,t){let n=new ResizeObserver(e=>{requestAnimationFrame(()=>t(e[0].contentRect))});return n.observe(e.parentNode),{destroy(){n.disconnect()}}}var Wo=5,Go=700;function Ko(e){let t=e.getBoundingClientRect(),n=document.body,r=t.top+n.scrollTop-n.clientTop||0,i=t.left+n.scrollLeft-n.clientLeft||0;return{y:Math.round(r),x:Math.round(i),width:e.offsetWidth,height:e.offsetHeight}}function qo(e,t){let n=Ko(t);return{x:e.clientX-n.x,y:e.clientY-n.y}}function Jo(e,t){let n=t.current,r=null,i,a,o=!1,s=!1,c=document.createElement(`DIV`);c.className=`wx-drag-zone`,c.setAttribute(`tabindex`,-1);function l(){clearTimeout(i),i=null}function u(t){let n=In(t);n&&(r={container:c,sourceNode:t.target,from:zn(n),pos:qo(t,e)},a=r.pos,d(t))}function d(t){if(!r)return;let i=r.pos=qo(t,e);if(!o){if(!s&&!t?.target?.getAttribute(`draggable-data`)&&Math.abs(a.x-i.x)<Wo&&Math.abs(a.y-i.y)<Wo)return;if(x(t)===!1)return S()}if(s){let e=window.scrollX||document.documentElement.scrollLeft||document.body.scrollLeft,n=window.scrollY||document.documentElement.scrollTop||document.body.scrollTop;r.targetNode=document.elementFromPoint(t.pageX-e,t.pageY-n)}else r.targetNode=t.target;n.move&&n.move(t,r),c.style.left=-(r.offset?r.offset.x:0)+`px`,c.style.top=r.pos.y+(r.offset?r.offset.y:0)+`px`}function f(e){c.parentNode&&c.parentNode.removeChild(c),c.innerHTML=``,o&&n.end&&n.end(e,r),r=a=null,S()}function p(e){n.getReorder&&!n.getReorder()||e.button===0&&(b(e),window.addEventListener(`mousemove`,m),window.addEventListener(`mouseup`,h),u(e))}function m(e){d(e)}function h(e){f(e)}function g(t){if(n.getReorder&&!n.getReorder())return;i=setTimeout(()=>{s=!0,u(t.touches[0])},Go),b(t);function r(){i&&l(),t.target.removeEventListener(`touchmove`,_),t.target.removeEventListener(`touchend`,r),f(t)}t.target.addEventListener(`touchmove`,_),t.target.addEventListener(`touchend`,r),e.addEventListener(`contextmenu`,v)}function _(e){o?(e.preventDefault(),d(e.touches[0])):i&&l()}function v(e){if(o||i)return e.preventDefault(),!1}function y(e){e.preventDefault()}function b(e){if(!n.getDraggableInfo)return;let{hasDraggable:t}=n.getDraggableInfo();(!t||e.target.getAttribute(`draggable-data`))&&(document.body.style.userSelect=`none`,document.body.style.webkitUserSelect=`none`)}function x(t){if(o=!0,n.start){if(n.start(t,r)===!1)return!1;e.appendChild(c),document.body.style.cursor=`move`}}function S(t){o=s=!1,document.body.style.cursor=``,document.body.style.userSelect=``,document.body.style.webkitUserSelect=``,window.removeEventListener(`mousemove`,m),window.removeEventListener(`mouseup`,h),t&&(e.removeEventListener(`mousedown`,p),e.removeEventListener(`touchstart`,g),e.removeEventListener(`dragstart`,y))}return e.addEventListener(`mousedown`,p),e.addEventListener(`touchstart`,g),e.addEventListener(`dragstart`,y),{destroy(){S(!0)}}}var Yo=.004;function Xo(){return{dirX:0,dirY:0,scrollSpeedFactor:1}}function Zo(e,t,n,r){let{node:i,left:a,top:o,bottom:s,sense:c,xScroll:l,yScroll:u}=r,d=qo(e,i);n.scrollState||=Xo();let f=0,p=0;d.x<a+c?f=-1:d.x>t.width-c&&(f=1),d.y<o+Math.round(c/2)?p=-1:d.y>t.height-s-Math.round(c/2)&&(p=1),(n.scrollState.dirX!==f||n.scrollState.dirY!==p)&&($o(n),n.scrollState.dirX=f,n.scrollState.dirY=p),(l&&n.scrollState.dirX!==0||u&&n.scrollState.dirY!==0)&&Qo(n,r,{x:n.scrollState.dirX,y:n.scrollState.dirY})}function Qo(e,t,n){e.autoScrollTimer||=setTimeout(()=>{e.activeAutoScroll=setInterval(es,15,e,t,n)},250)}function $o(e){e.scrollSpeedFactor=1,e.autoScrollTimer&&(e.autoScrollTimer=clearTimeout(e.autoScrollTimer),e.activeAutoScroll=clearInterval(e.activeAutoScroll))}function es(e,t,n){let{x:r,y:i}=n;e.scrollSpeedFactor+=Yo,r!==0&&ns(e,t,r),i!==0&&ts(e,t,i)}function ts(e,t,n){let r=t.node.scrollTop;rs(r+Math.round(t.sense/3)*e.scrollSpeedFactor*n,`scrollTop`,t)}function ns(e,t,n){let r=t.node.scrollLeft;rs(r+Math.round(t.sense/3)*e.scrollSpeedFactor*n,`scrollLeft`,t)}function rs(e,t,n){n.node[t]=e}function is(e,t,n,r,i,a){let o={};return e&&(o.width=`${e}px`,o.minWidth=`${e}px`),t&&(o.flexGrow=t),a&&(o.height=`${a}px`),n&&(o.position=`sticky`,n.left&&(o.left=`${r}px`),n.right&&(o.right=`${i}px`)),o}function as(e,t,n){let r=``;if(e.fixed)for(let n in e.fixed){let i=e.fixed[n]===-1;!i&&e.fixed.leftSize&&t.colspan&&(i=t.colspan+e._colindex-1===e.fixed.leftSize),r+=i?`wx-shadow `:`wx-fixed `}return r+=t.rowspan>1?`wx-rowspan `:``,r+=t.colspan>1?`wx-colspan `:``,r+=t.vertical?`wx-vertical `:``,r+=n?n(e)+` `:``,r}function os(e){let{row:t,column:n,cellStyle:r=null,columnStyle:i=null,children:a,focusable:o}=e,s=(0,B.useContext)(Ho),c=U(s,`focusCell`),l=U(s,`search`),u=U(s,`reorder`),d=(0,B.useMemo)(()=>l?.rows[t.id]&&l.rows[t.id][n.id],[l,t.id,n.id]),f=(0,B.useMemo)(()=>is(n.width,n.flexgrow,n.fixed,n.left,n.right),[n.width,n.flexgrow,n.fixed,n.left,n.right]);function p(e,r){let i=`wx-cell`;return i+=n.fixed?` `+(n.fixed===-1?`wx-shadow`:`wx-fixed`):``,i+=e?` `+e(n):``,i+=r?` `+r(t,n):``,i+=n.treetoggle?` wx-tree-cell`:``,i}let m=(0,B.useMemo)(()=>p(i,r),[i,r,n,t]),h=(0,B.useMemo)(()=>typeof n.draggable==`function`?n.draggable(t,n)!==!1:n.draggable,[n,t]),g=(0,B.useRef)(null);(0,B.useEffect)(()=>{g.current&&o&&c?.row===t.id&&c?.column===n.id&&g.current.focus()},[c,o,t.id,n.id]);let _=(0,B.useCallback)(()=>{o&&!c&&s.exec(`focus-cell`,{row:t.id,column:n.id,eventSource:`focus`})},[s,o,c,t.id,n.id]);function v(e){let t=RegExp(`(${l.value.trim()})`,`gi`);return String(e).split(t).map(e=>({text:e,highlight:t.test(e)}))}let y=(0,B.useMemo)(()=>{let e=n.fixed&&n.fixed.left===-1||n.fixed.right===-1,t=n.fixed&&n.fixed.right;return[m,e?`wx-shadow`:``,t?`wx-fixed-right`:``].filter(Boolean).join(` `)},[m,n]),b=n.cell;return(0,V.jsxs)(`div`,{className:`wx-TSCaXsGV `+y,ref:g,onFocus:_,style:f,"data-row-id":Bn(t.id),"data-col-id":Bn(n.id),tabIndex:o?`0`:`-1`,role:`gridcell`,"aria-colindex":n._colindex,"aria-readonly":!n.editor||void 0,children:[u&&n.draggable?h?(0,V.jsx)(`i`,{"draggable-data":`true`,className:`wx-TSCaXsGV wx-draggable wxi-drag`}):(0,V.jsx)(`i`,{className:`wx-TSCaXsGV wx-draggable-stub`}):null,n.treetoggle?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{style:{marginLeft:`${t.$level*28}px`}}),t.$count?(0,V.jsx)(`i`,{"data-action":`toggle-row`,className:`wx-TSCaXsGV wx-table-tree-toggle wxi-menu-${t.open===!1?`right`:`down`}`}):null]}):null,b?(0,V.jsx)(b,{api:s,row:t,column:n,onAction:({action:e,data:t})=>s.exec(e,t)}):a?a():d?(0,V.jsx)(`span`,{children:v(Ja(t,n)).map(({highlight:e,text:t},n)=>e?(0,V.jsx)(`mark`,{className:`wx-TSCaXsGV wx-search`,children:t},n):(0,V.jsx)(`span`,{children:t},n))}):Ja(t,n)]})}function ss(e,t){let n,r;function i(r){n=r.clientX,e.style.opacity=1,document.body.style.cursor=`ew-resize`,document.body.style.userSelect=`none`,window.addEventListener(`mousemove`,a),window.addEventListener(`mouseup`,o),t&&t.down&&t.down(e)}function a(e){r=e.clientX-n,t&&t.move&&t.move(r)}function o(){e.style.opacity=``,document.body.style.cursor=``,document.body.style.userSelect=``,t&&t.up&&t.up(r),window.removeEventListener(`mousemove`,a),window.removeEventListener(`mouseup`,o)}return e.addEventListener(`mousedown`,i),{destroy(){e.removeEventListener(`mousedown`,i)}}}function cs({filter:e,column:t,action:n,filterValue:r}){function i({value:e}){n({value:e,key:t.id})}return(0,V.jsx)(Qr,{...e.config??{},value:r,onChange:i})}function ls({filter:e,column:t,action:n,filterValue:r}){let i=U((0,B.useContext)(Ho),`flatData`),a=(0,B.useMemo)(()=>e?.config?.options||t?.options||s(),[e,t,i]),o=(0,B.useMemo)(()=>e?.config?.template,[e]);function s(){let e=[];return i.forEach(n=>{let r=Ga(n,t);e.includes(r)||e.push(r)}),e.map(e=>({id:e,label:e}))}function c({value:e}){n({value:e,key:t.id})}function l(e){e.key!==`Tab`&&e.preventDefault()}return(0,V.jsx)(`div`,{style:{width:`100%`},onKeyDown:l,children:(0,V.jsx)(xi,{placeholder:``,clear:!0,...e?.config??{},options:a,value:r,onChange:c,children:e=>o?o(e):e.label})})}function us({filter:e,column:t,action:n,filterValue:r}){function i({value:e}){n({value:e,key:t.id})}return(0,V.jsx)(`div`,{className:`wx-aaaK5VYO`,style:{width:`100%`},children:(0,V.jsx)(bi,{placeholder:``,clear:!0,...e?.config??{},value:r,onChange:i})})}function ds(e){let{value:t,options:n=[],placeholder:r=``,clear:i=!1,text:a=null,template:o=null,cell:s=null,dropdown:c={},autoOpen:l=!1,onChange:u,onAction:d}=e,[f,p]=ua(t||[]),m=(0,B.useMemo)(()=>(f||[]).map(e=>n.find(t=>t.id===e)).filter(Boolean),[f,n]),h=(0,B.useRef)(null),g=(0,B.useRef)(null),[_,v]=(0,B.useState)(null),y=()=>{let e=f||[];if(!e.length)return 0;let t=n.find(t=>e.includes(t.id));return t?n.indexOf(t):0};function b(e){g.current=e.navigate,v(()=>e.keydown),l&&e.navigate(y())}(0,B.useEffect)(()=>{l&&(h.current?.focus(),typeof window<`u`&&window.getSelection&&window.getSelection().removeAllRanges())},[]);function x({id:e}){p(e),u&&u({value:e})}function S(e){e.stopPropagation(),p([]),u&&u({value:[]})}function C(){g.current?.(y())}function w(){g.current?.(null)}function T(e){_?.(e,y())}return(0,V.jsxs)(`div`,{ref:h,className:`wx-multiselect wx-aadNNOwy`,onClick:C,onKeyDown:T,tabIndex:0,children:[(0,V.jsx)(`div`,{className:`wx-label wx-aadNNOwy`,children:o?o(m):s?(0,V.jsx)(s,{data:m,onAction:d}):a?(0,V.jsx)(`span`,{className:`wx-text wx-aadNNOwy`,children:a}):m.length?(0,V.jsx)(`span`,{className:`wx-text wx-aadNNOwy`,children:m.map(e=>e.label).join(`, `)}):r?(0,V.jsx)(`span`,{className:`wx-placeholder wx-aadNNOwy`,children:r}):`\xA0`}),i&&f?.length?(0,V.jsx)(`i`,{className:`wx-icon wxi-close wx-aadNNOwy`,onClick:S}):(0,V.jsx)(`i`,{className:`wx-icon wxi-angle-down wx-aadNNOwy`}),(0,V.jsx)(Zr,{items:n,onReady:b,onSelect:x,multiselect:!0,checkboxes:!0,value:f||[],onCancel:w,...c,children:({option:e})=>(0,V.jsx)(`div`,{className:`wx-option wx-aadNNOwy`,children:o?o(e):s?(0,V.jsx)(s,{data:e,onAction:d}):e.label})})]})}function fs({filter:e,column:t,action:n,filterValue:r}){let i=(0,B.useContext)(Lr.i18n)?.getGroup(`grid`)||Ar(Mi).getGroup(`grid`),a=(0,B.useMemo)(()=>({clear:!0,...e?.config||{}}),[e]),o=(0,B.useMemo)(()=>a.options||t.options,[a,t]),s=(0,B.useMemo)(()=>{let e=r?.length;return e?e<3?r.map(e=>t.optionsMap.get(e)).join(`, `):e+` `+i(`selected`):``},[r,t,i]);function c({value:e}){n({value:e,key:t.id})}function l(e){e.key!==`Tab`&&e.preventDefault()}return(0,V.jsx)(`div`,{style:{width:`100%`},onKeyDown:l,children:(0,V.jsx)(ds,{placeholder:``,...a,options:o,value:r||[],text:s,onChange:c})})}var ps={text:cs,richselect:ls,datepicker:us,multiselect:fs};function ms({filter:e,column:t}){let n=(0,B.useContext)(Ho),r=U(n,`filterValues`);function i(e){n.exec(`filter-rows`,e)}let a=(0,B.useMemo)(()=>ps[e.type],[e.type]);return(0,V.jsx)(a,{filter:e,column:t,action:i,filterValue:r[t.id]})}function hs(e){let{cell:t,column:n,row:r,lastRow:i,sortRow:a,columnStyle:o,bodyHeight:s,hasSplit:c}=e,l=(0,B.useContext)(Ho),u=U(l,`sortMarks`),d=(0,B.useMemo)(()=>u?u[n.id]:void 0,[u,n.id]),f=(0,B.useRef)(),p=(0,B.useCallback)(e=>{f.current=t.flexgrow?e.parentNode.clientWidth:t.width},[t.flexgrow,t.width]),m=(0,B.useCallback)((e,n)=>{l.exec(`resize-column`,{id:t.id,width:Math.max(1,(f.current||0)+e),inProgress:n})},[l,t.id]),h=(0,B.useCallback)(e=>m(e,!0),[m]),g=(0,B.useCallback)(e=>m(e,!1),[m]),_=(0,B.useCallback)(e=>{if(!n.sort||t.filter)return;let r=d?.order;r&&=r===`asc`?`desc`:`asc`,l.exec(`sort-rows`,{key:t.id,add:e.ctrlKey||e.metaKey,order:r})},[l,t.id,t.filter,n.sort,d?.order]),v=(0,B.useCallback)(e=>{e&&e.stopPropagation(),l.exec(`collapse-column`,{id:t.id,row:r})},[l,t.id,r]),y=(0,B.useCallback)(e=>{e.key===`Enter`&&v()},[v]),b=(0,B.useCallback)(e=>{e.key===`Enter`&&!t.filter&&_(e)},[_,t.filter]),x=(0,B.useMemo)(()=>t.collapsed&&n.collapsed,[t.collapsed,n.collapsed]),S=(0,B.useMemo)(()=>x&&!c&&t.collapsible!==`header`,[x,c,t.collapsible]),C=(0,B.useMemo)(()=>S?{top:-s/2,position:`absolute`}:{},[S,s]),w=(0,B.useMemo)(()=>is(t.width,t.flexgrow,n.fixed,n.left,t.right??n.right,t.height+(x&&S?s:0)),[t.width,t.flexgrow,n.fixed,n.left,t.right,n.right,t.height,x,S,s]),T=(0,B.useMemo)(()=>as(n,t,o),[n,t,o]),E=(0,B.useCallback)(()=>Object.fromEntries(Object.entries(t).filter(([e])=>e!==`cell`)),[t]),D=`wx-cell ${T} ${t.css||``} wx-collapsed`,O=[`wx-cell`,T,t.css||``,t.filter?`wx-filter`:``,n.fixed&&n.fixed.right?`wx-fixed-right`:``].filter(Boolean).join(` `),k=(0,B.useRef)(null);return(0,B.useEffect)(()=>{let e=k.current;if(!e)return;let t=ss(e,{down:p,move:h,up:g});return()=>{typeof t==`function`&&t()}},[p,h,g,ss]),x?(0,V.jsx)(`div`,{className:`wx-RsQD74qC `+D,style:w,role:`button`,"aria-label":`Expand column ${t.text||``}`,"aria-expanded":!t.collapsed,tabIndex:0,onKeyDown:y,onClick:v,"data-header-id":Bn(n.id),children:(0,V.jsx)(`div`,{className:`wx-RsQD74qC wx-text`,style:C,children:t.text||``})}):(0,V.jsxs)(`div`,{className:`wx-RsQD74qC `+O,style:w,onClick:_,"data-header-id":Bn(n.id),tabIndex:!t._hidden&&n.sort&&!t.filter?0:void 0,role:`columnheader`,"aria-colindex":n._colindex,"aria-colspan":t.colspan>1?t.colspan:void 0,"aria-rowspan":t.rowspan>1?t.rowspan:void 0,"aria-sort":!d?.order||t.filter?`none`:d?.order===`asc`?`ascending`:`descending`,onKeyDown:b,children:[t.collapsible?(0,V.jsx)(`div`,{className:`wx-RsQD74qC wx-collapse`,role:`button`,"aria-label":t.collapsed?`Expand column`:`Collapse column`,"aria-expanded":!t.collapsed,tabIndex:0,onKeyDown:y,onClick:v,children:(0,V.jsx)(`i`,{className:`wx-RsQD74qC wxi-angle-${t.collapsed?`down`:`right`}`})}):null,t.cell?(()=>{let e=t.cell;return(0,V.jsx)(e,{api:l,cell:E(),column:n,row:r,onAction:({action:e,data:t})=>l.exec(e,t)})})():t.filter?(0,V.jsx)(ms,{filter:t.filter,column:n}):(0,V.jsx)(`div`,{className:`wx-RsQD74qC wx-text`,children:t.text||``}),n.resize&&i&&!t._hidden?(0,V.jsx)(`div`,{className:`wx-RsQD74qC wx-grip`,role:`presentation`,"aria-label":`Resize column`,ref:k,onClick:e=>e.stopPropagation(),children:(0,V.jsx)(`div`,{})}):null,a?(0,V.jsx)(`div`,{className:`wx-RsQD74qC wx-sort`,children:d?(0,V.jsxs)(V.Fragment,{children:[typeof d.index<`u`?(0,V.jsx)(`div`,{className:`wx-RsQD74qC wx-order`,children:d.index+1}):null,(0,V.jsx)(`i`,{className:`wx-RsQD74qC wxi-arrow-${d.order===`asc`?`up`:`down`}`})]}):null}):null]})}function gs({cell:e,column:t,row:n,columnStyle:r}){let i=(0,B.useContext)(Ho),a=(0,B.useMemo)(()=>is(e?.width,e?.flexgrow,t?.fixed,t?.left,e?.right??t?.right,e?.height),[e?.width,e?.flexgrow,t?.fixed,t?.left,e?.right,t?.right,e?.height]),o=(0,B.useMemo)(()=>as(t,e,r),[t,e,r]),s=(0,B.useCallback)(()=>Object.fromEntries(Object.entries(e||{}).filter(([e])=>e!==`cell`)),[e]),c=`wx-6Sdi3Dfd wx-cell ${o||``} ${e?.css||``}`+(t?.fixed&&t?.fixed.right?` wx-fixed-right`:``);return(0,V.jsx)(`div`,{className:c,style:a,children:!t?.collapsed&&!e?.collapsed?e?.cell?B.createElement(e.cell,{api:i,cell:s(),column:t,row:n,onAction:({action:e,data:t})=>i.exec(e,t)}):(0,V.jsx)(`div`,{className:`wx-6Sdi3Dfd wx-text`,children:e?.text||``}):null})}function _s({deltaLeft:e,contentWidth:t,columns:n,type:r=`header`,columnStyle:i,bodyHeight:a}){let o=(0,B.useContext)(Ho),s=U(o,`_sizes`),c=U(o,`split`),l=(0,B.useMemo)(()=>s?.[`${r}RowHeights`],[s,r]),u=(0,B.useMemo)(()=>{let e=[];if(n&&n.length){let t=n[0][r].length;for(let i=0;i<t;i++){let t=0;e.push([]),n.forEach((a,o)=>{let s={...a[r][i]};if(t||e[i].push(s),s.colspan>1){if(t=s.colspan-1,!mo()&&a.right){let e=a.right;for(let t=1;t<s.colspan;t++)e-=n[o+t].width;s.right=e}}else t&&t--})}}return e},[n,r]),d=(0,B.useMemo)(()=>c?.left||c?.right,[c]);function f(e){return n.find(t=>t.id===e)}function p(e,t){let n=t;return e.rowspan&&(n+=e.rowspan-1),n===u.length-1}function m(e,t,n){if(!n.sort)return!1;for(let e=u.length-1;e>=0;e--){let r=n.header[e];if(!r.filter&&!r._hidden)return t===e}return p(e,t)}return(0,V.jsx)(`div`,{className:`wx-sAsPVaUK wx-${r}`,style:{paddingLeft:`${e}px`,width:`${t}px`},role:`rowgroup`,children:u.map((e,t)=>(0,V.jsx)(`div`,{className:r===`header`?`wx-sAsPVaUK wx-h-row`:`wx-sAsPVaUK wx-f-row`,style:{height:`${l?.[t]}px`,display:`flex`},role:`row`,children:e.map(e=>{let n=f(e.id);return r===`header`?(0,V.jsx)(hs,{cell:e,columnStyle:i,column:n,row:t,lastRow:p(e,t),bodyHeight:a,sortRow:m(e,t,n),hasSplit:d},e.id):(0,V.jsx)(gs,{cell:e,columnStyle:i,column:f(e.id),row:t},e.id)})},t))})}function vs({overlay:e}){let t=(0,B.useContext)(Ho);function n(e){return typeof e==`function`}let r=e;return(0,V.jsx)(`div`,{className:`wx-1ty666CQ wx-overlay`,children:n(e)?(0,V.jsx)(r,{onAction:({action:e,data:n})=>t.exec(e,n)}):e})}function ys(e){let{editor:t,onSave:n,onApply:r}=e,[i,a]=(0,B.useState)(t?.value||``),{type:o=`text`}=(0,B.useMemo)(()=>t?.config||{},[t]),s=(0,B.useRef)(null);(0,B.useEffect)(()=>{s.current&&s.current.focus()},[]),(0,B.useEffect)(()=>{if(!s.current)return;let e=tr(s.current,()=>n(!0));return()=>e.destroy()},[n]);function c(){s.current&&(a(s.current.value),r(s.current.value))}function l({key:e}){e===`Enter`&&n()}return(0,V.jsx)(`input`,{className:`wx-e7Ao5ejY wx-text`,onInput:c,onKeyDown:l,ref:s,type:o,value:i})}function bs({editor:e,onAction:t,onSave:n,onApply:r,onCancel:i}){let[a,o]=(0,B.useState)(e?.value),[s,c]=(0,B.useState)(e?.renderedValue),[l,u]=(0,B.useState)(e?.options||[]),d=(0,B.useMemo)(()=>e?.config?.template,[e]),f=(0,B.useMemo)(()=>e?.config?.cell,[e]),p=(0,B.useMemo)(()=>e?.config?.dropdown||{},[e]),m=(0,B.useMemo)(()=>({trackScroll:!0,...p}),[p]),h=(0,B.useMemo)(()=>(l||[]).findIndex(e=>e.id===a),[l,a]),g=(0,B.useRef)(null),_=(0,B.useRef)(null),v=(0,B.useCallback)(e=>{g.current=e.navigate,_.current=e.keydown,g.current(h)},[h,g]),y=(0,B.useCallback)(t=>{let n=t?.target?.value??``;c(n);let r=n?(e?.options||[]).filter(e=>(e.label||``).toLowerCase().includes(n.toLowerCase())):e?.options||[];u(r),r.length?g.current(-1/0):g.current(null)},[e]),b=(0,B.useRef)(null);(0,B.useEffect)(()=>{b.current&&b.current.focus()},[]);let x=(0,B.useRef)(n);(0,B.useEffect)(()=>{x.current=n},[n]),(0,B.useEffect)(()=>{if(!b.current)return;let e=tr(b.current,()=>x.current(!0));return()=>e.destroy()},[]),(0,B.useEffect)(()=>{o(e?.value),c(e?.renderedValue),u(e?.options||[])},[e]);let S=(0,B.useCallback)(({id:e})=>{r(e),n()},[r,n]);return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`input`,{className:`wx-0UYfSd1x wx-input`,ref:b,value:s??``,onChange:y,onKeyDown:e=>_.current?_.current(e,h):void 0}),(0,V.jsx)(Zr,{items:l,onReady:v,onSelect:S,...m,onCancel:i,children:({option:e})=>d?d(e):f?(0,V.jsx)(f,{data:e,onAction:t}):e.label})]})}function xs({editor:e,onAction:t,onSave:n,onApply:r,onCancel:i}){let[a]=(0,B.useState)(()=>e.value||new Date),{template:o,cell:s,dropdown:c={}}=e?.config||{},l=(0,B.useMemo)(()=>({trackScroll:!0,width:`auto`,...c}),[c]);function u({value:e}){r(e),n()}let d=(0,B.useRef)(null),[f,p]=(0,B.useState)(null);return(0,B.useEffect)(()=>{d.current&&d.current.focus(),typeof window<`u`&&window.getSelection&&window.getSelection().removeAllRanges()},[]),(0,B.useEffect)(()=>{if(!f)return;let e=tr(f,()=>n(!0));return()=>e.destroy()},[f,n]),(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`wx-lNWNYUb6 wx-value`,ref:d,tabIndex:0,onClick:i,onKeyDown:e=>e.preventDefault(),children:o?o(a):s?(0,V.jsx)(s,{data:e.value,onAction:t}):(0,V.jsx)(`span`,{className:`wx-lNWNYUb6 wx-text`,children:e.renderedValue})}),(0,V.jsx)(Gr,{...l,onCancel:i,children:(0,V.jsx)(`div`,{ref:p,className:`wx-lNWNYUb6`,children:(0,V.jsx)(_i,{value:a,onChange:u,buttons:e.config?.buttons})})})]})}function Ss(e){let{editor:t}=e,n=e.onAction??e.onaction,r=e.onSave??e.onsave,i=e.onApply??e.onapply,a=e.onCancel??e.oncancel,o=t.config||{},{dropdown:s={}}=o,c=(0,B.useMemo)(()=>({trackScroll:!0,...s}),[s]),[l]=(0,B.useState)(t.options.find(e=>e.id===t.value)),[u]=(0,B.useState)(t.value),[d]=(0,B.useState)(t.options),f=(0,B.useMemo)(()=>d.findIndex(e=>e.id===u),[d,u]);function p({id:e}){i(e),r()}let m,[h,g]=(0,B.useState)();function _(e){m=e.navigate,g(()=>e.keydown),m(f)}let v=(0,B.useRef)(null);return(0,B.useEffect)(()=>{v.current&&v.current.focus(),typeof window<`u`&&window.getSelection&&window.getSelection().removeAllRanges()},[]),(0,B.useEffect)(()=>{if(!v.current)return;let e=tr(v.current,()=>r(!0));return()=>e.destroy()},[r]),(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{ref:v,className:`wx-ywGRk611 wx-value`,tabIndex:0,onClick:a,onKeyDown:e=>{h(e,f),e.preventDefault()},children:o.template?o.template(l):o.cell?(()=>{let e=o.cell;return(0,V.jsx)(e,{data:l,onAction:n})})():(0,V.jsx)(`span`,{className:`wx-ywGRk611 wx-text`,children:t.renderedValue})}),(0,V.jsx)(Zr,{items:d,onReady:_,onSelect:p,...c,onCancel:a,children:({option:e})=>o.template?o.template(e):o.cell?(()=>{let t=o.cell;return(0,V.jsx)(t,{data:e,onAction:n})})():e.label})]})}function Cs(e){let{editor:t,onAction:n,onSave:r,onApply:i}=e,a=t?.config||{},o=t?.options??[],s=t?.value||[],c=t?.renderedValue,l=(0,B.useMemo)(()=>({trackScroll:!0,...a.dropdown||{}}),[a]);function u({value:e}){i(e)}let d=(0,B.useRef)(null);return(0,B.useEffect)(()=>{if(!d.current)return;let e=tr(d.current,()=>r(!0));return()=>e.destroy()},[r]),(0,V.jsx)(`div`,{ref:d,className:`wx-value wx-aacZ4gNU`,onClick:()=>r(!0),children:(0,V.jsx)(ds,{value:s,options:o,text:c,template:a.template,cell:a.cell,clear:a.clear,dropdown:l,autoOpen:!0,onChange:u,onAction:n})})}var ws={text:ys,combo:bs,datepicker:xs,richselect:Ss,multiselect:Cs};function Ts({column:e,row:t}){let n=(0,B.useContext)(Ho),r=U(n,`editor`),i=(0,B.useCallback)((e,t)=>{n.exec(`close-editor`,{ignore:e}),t&&n.exec(`focus-cell`,{...t,eventSource:`click`})},[n]),a=(0,B.useCallback)(e=>{let t=e?null:{row:r?.id,column:r?.column};i(!1,t)},[r,i]),o=(0,B.useCallback)(()=>{i(!0,{row:r?.id,column:r?.column})},[r,i]),s=(0,B.useCallback)(e=>{n.exec(`editor`,{value:e})},[n]),c=(0,B.useCallback)(t=>{t.key===`Enter`&&r&&(e.editor.type===`multiselect`?s(r.value):o())},[r,e.editor,o,s]),l=(0,B.useMemo)(()=>is(e.width,e.flexgrow,e.fixed,e.left,e.right),[e.width,e.flexgrow,e.fixed,e.left,e.right]),u=(0,B.useMemo)(()=>{let n=e.editor;return typeof n==`function`&&(n=n(t,e)),n?ws[typeof n==`string`?n:n.type]:null},[e,t]),d=(0,B.useRef)(null);(0,B.useEffect)(()=>{d.current&&typeof l==`string`&&d.current.setAttribute(`style`,l)},[l]);let f=typeof t.$parent<`u`?`gridcell`:`cell`,p=typeof t.$parent<`u`?!e.editor:void 0;return(0,V.jsx)(`div`,{className:`wx-8l724t2g wx-cell wx-editor`,ref:d,style:typeof l==`object`&&l?l:void 0,role:f,"aria-readonly":p,tabIndex:-1,onClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),onKeyDown:c,children:u?(0,V.jsx)(u,{editor:r,onSave:a,onApply:s,onCancel:o,onAction:({action:e,data:t})=>n.exec(e,t)}):null})}function Es(e){let{columns:t,type:n,columnStyle:r}=e,i=(0,B.useContext)(Ho),{filterValues:a,_columns:o,_sizes:s}=i.getState();function c(e){return r?` `+r(e):``}return(0,V.jsx)(V.Fragment,{children:t.map((e,t)=>(0,V.jsx)(`tr`,{children:e.map(e=>{let r=o.find(t=>t.id===e.id),l=`wx-print-cell-${n}${c(r)}${e.filter?` wx-print-cell-filter`:``}${e.vertical?` wx-vertical`:``}`,u=e.cell;return(0,V.jsx)(`th`,{style:ma(oo(e,s.columnWidth)),className:`wx-Gy81xq2u `+l,rowSpan:e.rowspan,colSpan:e.colspan,children:u?(0,V.jsx)(u,{api:i,cell:Object.fromEntries(Object.entries(e).filter(([e])=>e!==`cell`)),column:r,row:t}):e.filter?(0,V.jsx)(`div`,{className:`wx-Gy81xq2u wx-print-filter`,children:so(a,o,e)}):(0,V.jsx)(`div`,{className:`wx-Gy81xq2u wx-text`,children:e.text??``})},e.id)})},t))})}function Ds(e){let{columns:t,rowStyle:n,columnStyle:r,cellStyle:i,header:a,footer:o,reorder:s}=e,c=(0,B.useContext)(Ho),{flatData:l,_sizes:u}=c.getState(),d=a&&no(t,`header`,u.headerRowHeights),f=o&&no(t,`footer`,u.footerRowHeights);function p(e,t){let n=``;return n+=r?` `+r(t):``,n+=i?` `+i(e,t):``,n}function m(e,t){return typeof t.draggable==`function`?t.draggable(e,t)!==!1:t.draggable}return(0,V.jsxs)(`table`,{className:`wx-8NTMLH0z wx-print-grid ${t.some(e=>e.flexgrow)?`wx-flex-columns`:``}`,children:[a?(0,V.jsx)(`thead`,{children:(0,V.jsx)(Es,{columns:d,type:`header`,columnStyle:r})}):null,(0,V.jsx)(`tbody`,{children:l.map((e,r)=>(0,V.jsx)(`tr`,{className:`wx-8NTMLH0z wx-row`+(n?` `+n(e):``),style:{height:`${e.rowHeight||u.rowHeight}px`},children:t.map(t=>t.collapsed?null:(0,V.jsxs)(`td`,{className:`wx-8NTMLH0z wx-print-cell wx-cell ${p(e,t)}`,style:ma(oo(t,u.columnWidth)),children:[s&&t.draggable?(0,V.jsx)(`span`,{className:`wx-8NTMLH0z wx-print-draggable`,children:m(e,t)?(0,V.jsx)(`i`,{className:`wx-8NTMLH0z wxi-drag`}):null}):null,t.treetoggle?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{style:{marginLeft:e.$level*28+`px`}}),e.$count?(0,V.jsx)(`i`,{className:`wx-8NTMLH0z wx-print-grid-tree-toggle wxi-menu-${e.open===!1?`right`:`down`}`}):null]}):null,t.cell?(()=>{let n=t.cell;return(0,V.jsx)(n,{api:c,row:e,column:t})})():(0,V.jsx)(`span`,{children:Ja(e,t)})]},t.id))},r))}),o?(0,V.jsx)(`tfoot`,{children:(0,V.jsx)(Es,{columns:f,type:`footer`,columnStyle:r})}):null]})}function Os(e){let{config:t,...n}=e,{_skin:r,_columns:i}=(0,B.useContext)(Ho).getState(),a=(0,B.useMemo)(()=>to(i,t),[]),o=(0,B.useRef)(null);return(0,B.useEffect)(()=>{let e=document.body;e.classList.add(`wx-print`);let n=o.current;if(!n)return;let r=n.cloneNode(!0);e.appendChild(r);let i=`@media print { @page { size: ${t.paper} ${t.mode}; }`,a=document.createElement(`style`);a.setAttribute(`type`,`text/css`),a.setAttribute(`media`,`print`),document.getElementsByTagName(`head`)[0].appendChild(a),a.appendChild(document.createTextNode(i)),window.print(),a.remove(),e.classList.remove(`wx-print`),r.remove()},[]),(0,V.jsx)(`div`,{className:`wx-4zwCKA7C wx-${r}-theme wx-print-container`,ref:o,children:a.map((e,t)=>(0,V.jsx)(`div`,{className:`wx-4zwCKA7C wx-print-grid-wrapper`,children:(0,V.jsx)(Ds,{columns:e,...n})},t))})}function ks(e){let{header:t,footer:n,overlay:r,multiselect:i,onreorder:a,rowStyle:o,columnStyle:s,cellStyle:c,autoRowHeight:l,resize:u,clientWidth:d,clientHeight:f,responsiveLevel:p,hotkeys:m}=e,h=(0,B.useContext)(Ho),g=U(h,`dynamic`),_=U(h,`_columns`),v=U(h,`flatData`),y=U(h,`split`),b=U(h,`_sizes`),[x,S]=pa(h,`selectedRows`),C=U(h,`select`),w=U(h,`editor`),T=U(h,`scrollLeft`),E=U(h,`scrollTop`),D=U(h,`tree`),O=U(h,`focusCell`),k=U(h,`_print`),A=U(h,`undo`),j=U(h,`reorder`),ee=U(h,`_rowHeightFromData`),[M,N]=(0,B.useState)(0);(0,B.useEffect)(()=>{N(Ue())},[]);let[te,P]=(0,B.useState)(0),F=(0,B.useMemo)(()=>(_||[]).some(e=>!e.hidden&&e.flexgrow),[_]),I=(0,B.useMemo)(()=>b?.rowHeight||0,[b]),L=(0,B.useRef)(null),[ne,re]=(0,B.useState)(null),[ie,ae]=(0,B.useState)(null),oe=(0,B.useMemo)(()=>{let e=[],t=0;return y&&y.left&&(e=(_||[]).slice(0,y.left).filter(e=>!e.hidden).map(e=>({...e})),e.forEach(e=>{e.fixed={left:1,leftSize:y.left},e.left=t,t+=e.width}),e.length&&(e[e.length-1].fixed.left=-1)),{columns:e,width:t}},[y,_]),se=(0,B.useMemo)(()=>{let e=[],t=0;if(y&&y.right){e=(_||[]).slice(y.right*-1).filter(e=>!e.hidden).map(e=>({...e}));for(let n=e.length-1;n>=0;n--){let r=e[n];r.fixed={right:1},r.right=t,t+=r.width}e.length&&(e[0].fixed={right:-1})}return{columns:e,width:t}},[y,_]),R=(0,B.useMemo)(()=>{let e=(_||[]).slice(y?.left||0,(_||[]).length-(y?.right??0)).filter(e=>!e.hidden);return e.forEach(e=>{e.fixed=0}),e},[_,y]),ce=(0,B.useMemo)(()=>(_||[]).reduce((e,t)=>(t.hidden||(e+=t.width),e),0),[_]);function le(e,t,n){let r=t,i=e;if(R.length){let t=R.length;for(let r=e;r>=0;r--)R[r][n].forEach(n=>{n.colspan>1&&r>e-n.colspan&&r<t&&(t=r)});if(t!==R.length&&t<e){for(let n=t;n<e;n++)r-=R[n].width;i=t}}return{index:i,delta:r}}let ue=(0,B.useMemo)(()=>{let e,t,n,r=T||0,i=(T||0)+(d||0),a=0,o=0,s=0,c=0;R.forEach((e,t)=>{r>s&&(a=t,c=s),s+=e.width,i>s&&(o=t+1)});let l={header:0,footer:0};for(let e=o;e>=a;e--)[`header`,`footer`].forEach(t=>{R[e]&&R[e][t].forEach(n=>{let r=n.colspan;if(r&&r>1){let n=r-(o-e+1);n>0&&(l[t]=Math.max(l[t],n))}})});let u=le(a,c,`header`),f=le(a,c,`footer`),p=u.delta,m=u.index,h=f.delta,g=f.index;return F&&ce>(d||0)?e=t=n=[...oe.columns,...R,...se.columns]:(e=[...oe.columns,...R.slice(a,o+1),...se.columns],t=[...oe.columns,...R.slice(m,o+l.header+1),...se.columns],n=[...oe.columns,...R.slice(g,o+l.footer+1),...se.columns]),{data:e||[],header:t||[],footer:n||[],d:c,df:h,dh:p}},[R,oe,se,T,d,F,ce]),de=(0,B.useMemo)(()=>t&&b?.headerHeight||0,[t,b]),fe=(0,B.useMemo)(()=>n&&b?.footerHeight||0,[n,b]),pe=(0,B.useMemo)(()=>d&&f?ce>=d:!1,[d,f,ce]),[me,he]=(0,B.useState)(!1),ge=(0,B.useMemo)(()=>(f||0)-de-fe-(pe?M:0),[f,de,fe,pe,M]),_e=(0,B.useMemo)(()=>Math.ceil((ge||0)/(I||1))+1,[ge,I]),ve=(0,B.useRef)([]),[ye,be]=(0,B.useState)(0),[xe,Se]=(0,B.useState)(void 0),Ce=(0,B.useMemo)(()=>{let e=0,t=0,n=E||0;if(l){let r=n;for(;r>0;)r-=ve.current[e]||I,e++;t=n-r;for(let n=Math.max(0,e-2-1);n<e;n++)t-=ve.current[e-n]||I;e=Math.max(0,e-2)}else{if(ee){let r=0,i=0;for(let e=0;e<(v||[]).length;e++){let t=v[e].rowHeight||I;if(i+t>n){r=e;break}i+=t}e=Math.max(0,r-2);for(let n=0;n<e;n++)t+=v[n].rowHeight||I;let a=0,o=0;for(let e=r+1;e<(v||[]).length;e++){let t=v[e].rowHeight||I;if(a++,o+t>ge)break;o+=t}let s=Math.min(g?g.rowCount:(v||[]).length,r+a+2);return{d:t,start:e,end:s}}e=Math.floor(n/(I||1)),e=Math.max(0,e-2),t=e*(I||0)}let r=g?g.rowCount:(v||[]).length,i=Math.min(r,e+(_e||0)+2);return{d:t,start:e,end:i}},[l,ee,E,I,g,v,_e,ge]),we=(0,B.useMemo)(()=>{let e=g?g.rowCount:(v||[]).length;if(l)return ye+Ce.d+(e-(xe||0))*(I||0);if(!ee)return e*(I||0);let t=0;for(let n=0;n<e;n++)t+=v[n]?.rowHeight||I;return t},[g,v,I,l,ee,ye,Ce.d,xe]),Te=(0,B.useRef)({});Te.current={clientWidth:d,clientHeight:f,fullHeight:we,headerHeight:de,footerHeight:fe,fullWidth:ce,SCROLLSIZE:M};let Ee=(0,B.useCallback)(()=>{let e=Te.current;he(e.clientWidth&&e.clientHeight?e.fullHeight+e.headerHeight+e.footerHeight>=e.clientHeight-(e.fullWidth>=e.clientWidth?e.SCROLLSIZE:0):!1)},[]);(0,B.useEffect)(()=>{let e=requestAnimationFrame(Ee);return()=>window.cancelAnimationFrame(e)},[te,Ee]),(0,B.useEffect)(()=>{Ee()},[f,Ee]);let z=(0,B.useMemo)(()=>F&&ce<=(d||0)?(d||0)-0-(me?M:0):ce,[F,ce,d,me,M,pe]),De=(0,B.useMemo)(()=>F&&ce<=(d||0)?d||0:z<(d||0)?ce+(me?M:0):-1,[F,ce,d,z,me,M]),Oe=(0,B.useRef)({});(0,B.useEffect)(()=>{if(g&&(Oe.current.start!==Ce.start||Oe.current.end!==Ce.end)){let{start:e,end:t}=Ce;Oe.current={start:e,end:t},h&&h.exec&&h.exec(`request-data`,{row:{start:e,end:t}})}},[g,Ce,h]);let ke=(0,B.useMemo)(()=>g?v||[]:(v||[]).slice(Ce.start,Ce.end),[g,v,Ce]),Ae=(0,B.useMemo)(()=>(x||[]).filter(e=>(ke||[]).some(t=>t.id===e)),[S,ke]),je=(0,B.useMemo)(()=>Ce.start,[Ce.start]),Me=(0,B.useRef)({top:E,left:T});Me.current={top:E,left:T};let Ne=(0,B.useCallback)(e=>{let t=e.target.scrollTop,n=e.target.scrollLeft,r=Me.current;(t!==r.top||n!==r.left)&&h.exec(`scroll-to`,{top:t,left:n})},[h]),Pe=(0,B.useCallback)(e=>{e.shiftKey&&e.preventDefault(),L.current&&L.current.focus&&L.current.focus()},[]),Fe=(0,B.useCallback)(()=>!!(_||[]).find(e=>!!e.draggable),[_]),Ie=(0,B.useRef)(null),Le=(0,B.useRef)(null),Re=(0,B.useRef)({dblclick:(e,t)=>{let n={id:e,column:Rn(t,`data-col-id`)};h.exec(`open-editor`,n)},click:(e,t)=>{if(t.target.closest(`input`)||Ie.current)return;let n=Rn(t,`data-col-id`);if(O?.id!==e&&h.exec(`focus-cell`,{row:e,column:n,eventSource:`click`}),C===!1)return;let r=i&&(t.ctrlKey||t.metaKey),a=i&&t.shiftKey;(r||x.length>1||!x.includes(e))&&h.exec(`select-row`,{id:e,toggle:r,range:a})},"toggle-row":e=>{let t=h.getRow(e);h.exec(t.open===!1?`open-row`:`close-row`,{id:e})},"ignore-click":()=>!1}),ze=(0,B.useMemo)(()=>({top:de,bottom:fe,left:oe.width,xScroll:pe,yScroll:me,sense:l&&ie?ie.offsetHeight:Math.max(b?.rowHeight||0,40),node:L.current&&L.current.firstElementChild}),[de,fe,oe.width,pe,me,l,ie,b]);function Be(e,t){let{container:n,sourceNode:r,from:i}=t;if(Fe()&&!r.getAttribute(`draggable-data`))return!1;re(i),D&&h.getRow(i).open&&h.exec(`close-row`,{id:i,nested:!0});let a=In(r),o=a.cloneNode(!0);o.classList.remove(`wx-selected`),o.querySelectorAll(`[tabindex]`).forEach(e=>e.setAttribute(`tabindex`,`-1`)),n.appendChild(o),ae(o);let s=(T||0)-ue.d,c=me?M:0;n.style.width=Math.min((d||0)-c,F&&ce<=(d||0)?z:z-c)+s+`px`;let l=Ko(a);t.offset={x:s,y:-Math.round(l.height/2)},Le.current||=e.clientY}function Ve(e,t){let{from:n}=t,r=t.pos,i=Ko(L.current);r.x=i.x;let o=ze.top;if(r.y<o)r.y=o;else{let e=i.height-(pe&&M>0?M:Math.round(ze.sense/2))-ze.bottom;r.y>e&&(r.y=e)}if(L.current.contains(t.targetNode)){let i=In(t.targetNode),s=i&&zn(i);if(s&&s!==n){t.to=s;let a=l?ie?.offsetHeight:b?.rowHeight;if(ie&&((E||0)===0||r.y>o+a-1)){let t=i.getBoundingClientRect(),r=Ko(ie).y>t.y?-1:1,a=r===1?`after`:`before`,o=h.getState().flatData,c=Math.abs(o.findIndex(e=>e.id===n)-o.findIndex(e=>e.id===s)),l=c===1?a:a===`before`?`after`:`before`;if(c===1&&(r===-1&&e.clientY>Le.current||r===1&&e.clientY<Le.current))return;Le.current=e.clientY,h.exec(`move-item`,{id:n,target:s,mode:l,inProgress:!0})}}a&&a({event:e,context:t})}Zo(e,i,t,ze)}function He(e,t){let{from:n,to:r}=t;h.exec(`move-item`,{id:n,target:r,inProgress:!1}),Ie.current=setTimeout(()=>{Ie.current=0},1),re(null),ae(null),Le.current=null,$o(t)}function Ue(){let e=document.createElement(`div`);e.style.cssText=`position:absolute;left:-1000px;width:100px;padding:0px;margin:0px;min-height:100px;overflow-y:scroll;`,document.body.appendChild(e);let t=e.offsetWidth-e.clientWidth;return document.body.removeChild(e),t}let We=(0,B.useMemo)(()=>De>0?{width:`${De}px`}:void 0,[De]),Ge=(0,B.useRef)(null);function Ke(){Promise.resolve().then(()=>{let e=0,t=je,n=Ge.current;n&&(Array.from(n.children).forEach((n,r)=>{ve.current[je+r]=n.offsetHeight,e+=n.offsetHeight,t++}),be(e),Se(t))})}(0,B.useEffect)(()=>{ke&&l&&Ke()},[ke,l,je]);let[qe,Je]=(0,B.useState)();(0,B.useEffect)(()=>{if(O&&(!C||!Ae.length||Ae.includes(O.row)))Je({...O});else if(ke.length&&ue.data.length){if(!qe||Ae.length&&!Ae.includes(qe.row)||ke.findIndex(e=>e.id===qe.row)===-1||ue.data.findIndex(e=>e.id===qe.column&&!e.collapsed)===-1){let e=Ae[0]||ke[0].id,t=ue.data.findIndex(e=>!e.collapsed);Je(t===-1?null:{row:e,column:ue.data[t].id})}}else Je(null)},[O]);let Ye=(0,B.useRef)(null);(0,B.useEffect)(()=>{let e=L.current;if(!e)return;let t=Uo(e,u);return()=>{typeof t==`function`&&t()}},[u]);let Xe=(0,B.useRef)({});Object.assign(Xe.current,{start:Be,move:Ve,end:He,getReorder:()=>j,getDraggableInfo:()=>({hasDraggable:Fe()})}),(0,B.useEffect)(()=>{let e=L.current;return e?Jo(e,Xe).destroy:void 0},[j,L.current]),(0,B.useEffect)(()=>{let e=L.current;return e?Bo(e,{keys:m!==!1&&{...zo,"ctrl+z":A,"ctrl+y":A,...m},exec:e=>h.exec(`hotkey`,e)}).destroy:void 0},[h,A,m]);let Ze=(0,B.useRef)({scroll:h.getReactiveState().scroll,scrollLeft:h.getReactiveState().scrollLeft,scrollTop:h.getReactiveState().scrollTop});Ze.current.getWidth=()=>(d||0)-(me?M:0),Ze.current.getHeight=()=>ge,Ze.current.getScrollMargin=()=>oe.width+se.width,(0,B.useEffect)(()=>{Vo(Ye.current,Ze.current)},[]);let Qe=(0,B.useRef)(null);(0,B.useEffect)(()=>{let e=Qe.current;if(!e)return;let t=[];t.push(tr(e,()=>O&&h.exec(`focus-cell`,{eventSource:`click`})).destroy),t.push(_a(e,Re.current)),P(e.clientHeight);let n=new ResizeObserver(()=>{P(e.clientHeight)});return n.observe(e),t.push(()=>n.disconnect()),()=>t.forEach(e=>e())},[]);let $e=`wx-grid ${p?`wx-responsive-${p}`:``}`;return(0,B.useEffect)(()=>{O&&(ke.some(e=>e.id===O.row)&&ue.data.some(e=>e.id===O.column&&!e.collapsed)||h.exec(`focus-cell`,{eventSource:`destroy`}))},[O,ke,ue.data,h]),(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`wx-4VuBwK2D `+$e,style:{"--header-height":`${de}px`,"--footer-height":`${fe}px`,"--split-left-width":`${oe.width}px`,"--split-right-width":`${se.width}px`},children:(0,V.jsx)(`div`,{ref:L,className:`wx-4VuBwK2D wx-table-box`,style:We,role:D?`treegrid`:`grid`,"aria-colcount":ue.data.length,"aria-rowcount":ke.length,"aria-multiselectable":D&&i?!0:void 0,tabIndex:-1,children:(0,V.jsxs)(`div`,{ref:Ye,className:`wx-4VuBwK2D wx-scroll`,style:{overflowX:pe?`scroll`:`hidden`,overflowY:me?`scroll`:`hidden`},onScroll:Ne,children:[t?(0,V.jsx)(`div`,{className:`wx-4VuBwK2D wx-header-wrapper`,children:(0,V.jsx)(_s,{contentWidth:z,deltaLeft:ue.dh,columns:ue.header,columnStyle:s,bodyHeight:ge-+n})}):null,(0,V.jsxs)(`div`,{ref:Qe,className:`wx-4VuBwK2D wx-body`,style:{width:`${z}px`,height:`${we}px`},onMouseDown:e=>Pe(e),children:[r?(0,V.jsx)(vs,{overlay:r}):null,(0,V.jsx)(`div`,{ref:Ge,className:`wx-4VuBwK2D wx-data`,style:{paddingTop:`${Ce.d}px`,paddingLeft:`${ue.d}px`},children:ke.map((e,t)=>{let n=x.indexOf(e.id)!==-1,r=ne===e.id,i=`wx-row`+(l?` wx-autoheight`:``)+(o?` `+o(e):``)+(n?` wx-selected`:``)+(r?` wx-inactive`:``),a=l?{minHeight:`${e.rowHeight||I}px`}:{height:`${e.rowHeight||I}px`};return(0,V.jsx)(`div`,{className:`wx-4VuBwK2D `+i,"data-id":Bn(e.id),"data-context-id":Bn(e.id),style:a,role:`row`,"aria-rowindex":t,"aria-expanded":e.open,"aria-level":D?e.$level+1:void 0,"aria-selected":D?n:void 0,tabIndex:-1,children:ue.data.map(t=>t.collapsed?(0,V.jsx)(`div`,{className:`wx-4VuBwK2D wx-cell wx-collapsed`},t.id):w?.id===e.id&&w.column===t.id?(0,V.jsx)(Ts,{row:e,column:t},t.id):(0,V.jsx)(os,{row:e,column:t,columnStyle:s,cellStyle:c,reorder:j,focusable:qe?.row===e.id&&qe?.column===t.id},t.id))},e.id)})})]}),n&&(v||[]).length?(0,V.jsx)(_s,{type:`footer`,contentWidth:z,deltaLeft:ue.df,columns:ue.footer,columnStyle:s}):null]})})}),k?(0,V.jsx)(Os,{config:k,rowStyle:o,columnStyle:s,cellStyle:c,header:t,footer:n,reorder:j}):null]})}var As=e=>e.split(`-`).map(e=>e?e.charAt(0).toUpperCase()+e.slice(1):``).join(``),js=(0,B.forwardRef)(function({data:e=[],columns:t=[],rowStyle:n=null,columnStyle:r=null,cellStyle:i=null,selectedRows:a,select:o=!0,multiselect:s=!1,header:c=!0,footer:l=!1,dynamic:u=null,overlay:d=null,reorder:f=!1,onReorder:p=null,autoRowHeight:m=!1,sizes:h,split:g,tree:_=!1,autoConfig:v=!1,init:y=null,responsive:b=null,sortMarks:x,undo:S=!1,hotkeys:C=null,filterValues:w,...T},E){let D=(0,B.useRef)();D.current=T;let O=(0,B.useMemo)(()=>new Ao(ha),[]),k=(0,B.useMemo)(()=>O.in,[O]),A=(0,B.useRef)(null);A.current===null&&(A.current=new Ni((e,t)=>{let n=`on`+As(e);D.current&&D.current[n]&&D.current[n](t)}),k.setNext(A.current));let j=(0,B.useMemo)(()=>({getState:O.getState.bind(O),getReactiveState:O.getReactive.bind(O),getStores:()=>({data:O}),exec:k.exec,setNext:e=>(A.current=A.current.setNext(e),A.current),intercept:k.intercept.bind(k),on:k.on.bind(k),detach:k.detach.bind(k),getRow:O.getRow.bind(O),getColumn:O.getColumn.bind(O)}),[O,k]),[ee,M]=(0,B.useState)(0),[N,te]=(0,B.useState)(0),[P,F]=(0,B.useState)(null),[I,L]=(0,B.useState)(null),ne=(0,B.useMemo)(()=>{if(v&&!t.length&&e.length){let t=e[0],n=[];for(let e in t)if(e!==`id`&&e[0]!==`$`){let t={id:e,header:e[0].toUpperCase()+e.slice(1)};typeof v==`object`&&(t={...t,...v}),n.push(t)}return n}return(I&&I.columns)??t},[v,t,e,I]),re=(0,B.useMemo)(()=>(I&&I.sizes)??h,[I,h]),ie=(0,B.useCallback)(e=>{if(M(e.width),te(e.height),b){let t=Object.keys(b).map(Number).sort((e,t)=>e-t).find(t=>e.width<=t)??null;t!==P&&(L(b[t]),F(t))}},[b,P]),ae=(0,B.useContext)(Lr.theme),oe=(0,B.useRef)(0);return(0,B.useEffect)(()=>{if(!oe.current)y&&y(j);else{let t=O.getState();O.init({data:e,columns:ne,split:g||t.split,sizes:re||t.sizes,selectedRows:a||t.selectedRows,dynamic:u,tree:_,sortMarks:x||t.sortMarks,filterValues:w||t.filterValues,undo:S,reorder:f,_skin:ae,_select:o})}oe.current++},[O,e,ne,g,re,a,u,_,x,w,S,f,ae,o,y,j]),oe.current===0&&O.init({data:e,columns:ne,split:g||{left:0},sizes:re||{},selectedRows:a||[],dynamic:u,tree:_,sortMarks:x||{},filterValues:w||{},undo:S,reorder:f,_skin:ae,select:o}),(0,B.useImperativeHandle)(E,()=>({...j}),[j]),(0,V.jsx)(Ho.Provider,{value:j,children:(0,V.jsx)(mi,{words:Mi,optional:!0,children:(0,V.jsx)(ks,{header:c,footer:l,overlay:d,rowStyle:n,columnStyle:r,cellStyle:i,onReorder:p,multiselect:s,autoRowHeight:m,clientWidth:ee,clientHeight:N,responsiveLevel:P,resize:ie,hotkeys:C})})})});Wn(Un);var Ms=(0,B.createContext)(null),Ns=(0,B.createContext)(null),Ps=(0,B.createContext)(null);function Fs({children:e}){let t=(0,B.useContext)(Lr.i18n),n=(0,B.useMemo)(()=>t.getGroup(`filemanager`),[t]),r=(0,B.useContext)(Ms),[i]=pa(r,`panels`),a=i[U(r,`activePanel`)].path,[o,s]=(0,B.useState)(null),[c,l]=(0,B.useState)(null),[u,d]=(0,B.useState)(``),[f,p]=(0,B.useState)(``),[m,h]=(0,B.useState)(!1);function g(){let e=u.trim();if(!e){h(!0);return}o.add?r.exec(`create-file`,{file:{...o.item,name:e},parent:a}):f!==e&&r.exec(`rename-file`,{id:o.item.id,name:e}),_()}function _(){s(null),h(null),p(``),d(``)}function v(){r.exec(`delete-files`,{ids:c.selected}),l(null)}let y=(0,B.useMemo)(()=>({showPrompt(e){let t=e.item.name||(e.item.type===`folder`?n(`New folder`):`${n(`New file`)}.txt`);p(t),d(t),s({...e})},showConfirm(e){l({...e})}}),[n]);return(0,V.jsxs)(Ns.Provider,{value:y,children:[(0,V.jsx)(Oi,{children:e}),o?(0,V.jsx)(Ti,{title:n(`Enter ${o.item.type} name`),onConfirm:g,onCancel:_,children:(0,V.jsx)(Qr,{error:m,select:!0,focus:!0,value:u,onChange:({value:e})=>d(e)})}):null,c?(0,V.jsx)(Ti,{title:n(`Are you sure you want to delete these items:`),onConfirm:v,onCancel:()=>l(null),children:c.selected?(0,V.jsx)(`ul`,{className:`wx-gq7BMzEP wx-list`,children:c.selected.map((e,t)=>(0,V.jsx)(`li`,{children:e},t))}):null}):null]})}var Is={"7z":!0,rar:!0,zip:!0,css:!0,html:!0,js:!0,php:!0,md:!0,xml:!0,sql:!0,aif:!0,mid:!0,mp3:!0,waw:!0,wma:!0,doc:!0,docx:!0,txt:!0,avi:!0,mov:!0,mp4:!0,mpeg:!0,mpg:!0,pdf:!0,xls:!0,xlsx:!0,gif:!0,jpg:!0,jpeg:!0,png:!0,psd:!0,tiff:!0,svg:!0,folder:!0,file:!0,multiple:!0,search:!0,none:!0};function Ls(e){let t=e.lastIndexOf(`.`),n=t>0&&t<e.length-1?Math.min(10,e.length-t):Math.min(5,e.length);return[e.slice(0,-n),e.slice(-n)]}function Rs({item:e}){let t=(0,B.useContext)(Ms),n=(0,B.useContext)(Lr.i18n).getGroup(`filemanager`),r=(0,B.useContext)(Ms).templates,[i]=pa(t,`panels`),a=U(t,`activePanel`),o=U(t,`mode`),s=i[a].selected,c=(0,B.useMemo)(()=>r.preview(e,214,163),[r,e]),l=(0,B.useMemo)(()=>r.icon(e,`big`),[r,e]),[u,d]=(0,B.useMemo)(()=>Ls(e.name),[e.name]);return(0,V.jsx)(V.Fragment,{children:e.id===`/wx-filemanager-parent-link`?o===`search`?null:(0,V.jsx)(`div`,{className:`wx-GAOa4kDV wx-back-item`,children:(0,V.jsxs)(`div`,{className:`wx-GAOa4kDV wx-back ${e.navigation?`wx-selected`:``}`,"data-id":Bn(`/wx-filemanager-parent-link`),children:[(0,V.jsx)(`i`,{className:`wx-GAOa4kDV wxi-arrow-left`}),(0,V.jsx)(`span`,{children:n(`Back to parent folder`)})]})}):(0,V.jsxs)(`div`,{className:`wx-GAOa4kDV wx-item ${s?.length&&s.indexOf(e.id)>=0?`wx-selected`:``}`,"data-id":Bn(e.id),children:[c?(0,V.jsx)(`div`,{className:`wx-GAOa4kDV wx-preview wx-file-preview`,children:(0,V.jsx)(`img`,{className:`wx-GAOa4kDV wx-card-preview`,alt:n(`A miniature file preview`),src:c})}):l?(0,V.jsx)(`div`,{className:`wx-GAOa4kDV wx-preview wx-file-icon`,children:(0,V.jsx)(`img`,{className:`wx-GAOa4kDV wx-card-preview`,alt:``,src:l})}):(0,V.jsx)(`div`,{className:`wx-GAOa4kDV wx-preview`,children:(0,V.jsx)(`i`,{className:`wx-GAOa4kDV wxi-${e.type}`})}),e.type===`folder`?(0,V.jsxs)(`div`,{className:`wx-GAOa4kDV wx-info`,children:[(0,V.jsxs)(`div`,{className:`wx-GAOa4kDV wx-folder-name`,children:[(0,V.jsx)(`span`,{className:`wx-GAOa4kDV wx-type`,children:n(`Folder`)}),(0,V.jsxs)(`span`,{className:`wx-GAOa4kDV wx-name`,children:[(0,V.jsx)(`span`,{children:u}),(0,V.jsx)(`span`,{children:d})]})]}),(0,V.jsx)(`div`,{"data-action-id":Bn(e.id),className:`wx-GAOa4kDV wx-more`,children:(0,V.jsx)(`i`,{className:`wx-GAOa4kDV wxi-dots-v`})})]}):(0,V.jsxs)(`div`,{className:`wx-GAOa4kDV wx-info`,children:[(0,V.jsx)(`div`,{className:`wx-GAOa4kDV wx-file-name`,children:(0,V.jsxs)(`span`,{className:`wx-GAOa4kDV wx-name`,children:[(0,V.jsx)(`span`,{children:u}),(0,V.jsx)(`span`,{children:d})]})}),(0,V.jsx)(`div`,{"data-action-id":Bn(e.id),className:`wx-GAOa4kDV wx-more`,children:(0,V.jsx)(`i`,{className:`wx-GAOa4kDV wxi-dots-v`})})]})]})})}function zs(){let e=(0,B.useContext)(Ms),t=(0,B.useContext)(Lr.i18n),n=(0,B.useMemo)(()=>t.getGroup(`filemanager`),[t]),[r]=pa(e,`panels`),i=U(e,`activePanel`),a=U(e,`mode`),o=r[i]._files,s=r[i].selected,c=r[i].path,l=r[i]._crumbs,u=r[i]._selectNavigation,d=(0,B.useCallback)((t,n)=>{let r=n&&(n.ctrlKey||n.metaKey),a=n&&n.shiftKey;if(t===`/wx-filemanager-parent-link`){if(s.length&&(r||a))return;e.exec(`select-file`,{type:`navigation`});return}let o=t===`body`&&n?null:t,c=n.target.className.indexOf(`wx-more`)!==-1||n.target.className.indexOf(`wxi-dots-v`)!==-1;setTimeout(()=>{e.exec(`select-file`,{id:o,toggle:r&&!c,range:a&&!c,panel:i})},1)},[e,s,i]),f=(0,B.useCallback)(()=>{l.length>1&&e.exec(`set-path`,{id:l[l.length-2].id,panel:i,selected:[l[l.length-1].id]})},[e,l,i]),p=(0,B.useCallback)(t=>{if(t===`/wx-filemanager-parent-link`)return f();a===`search`&&e.exec(`filter-files`,{text:``});let n=o.find(e=>e.id===t);n&&(n.type==`folder`?e.exec(`set-path`,{id:n.id,panel:i}):e.exec(`open-file`,{id:n.id}))},[e,f,a,o,i]),m=(0,B.useCallback)((e,t)=>{(!s?.length||!s.filter(t=>t?.id===e).length>0)&&d(e,t)},[s,d]),h=(0,B.useMemo)(()=>c===`/`?o:[{id:`/wx-filemanager-parent-link`,name:n(`Back to parent folder`),navigation:u},...o],[c,n,u,o]),g=(0,B.useRef)(null),_=(0,B.useRef)();return(0,B.useEffect)(()=>{g.current&&(_.current?(_.current.click=d,_.current._dblclick=p,_.current.context=m):(_.current={click:d,dblclick:e=>_.current._dblclick(e),_dblclick:p,context:m},Kn(g.current,_.current)))},[d,p,m]),a==`search`&&!h.length?(0,V.jsx)(`div`,{className:`wx-iyjASZCY wx-not-found`,children:(0,V.jsx)(`div`,{className:`wx-iyjASZCY wx-not-found-text`,children:n(`Looks like nothing is here`)})}):(0,V.jsx)(`div`,{tabIndex:0,className:`wx-iyjASZCY `+(`wx-cards`+(c!==`/`&&a!==`search`?` wx-has-back-link`:``)),"data-id":Bn(`body`),ref:g,children:h.map(e=>(0,V.jsx)(Rs,{item:e},e.id))})}function Bs({name:e=``,spin:t=!1,onClick:n}){return(0,V.jsx)(`i`,{"data-menu-ignore":`true`,className:`wx-uwcvNSAG wx-icon wxi-${e} ${t?`wx-spin`:``} ${n?`wx-clickable`:``}`,onClick:()=>{n&&n()}})}function Vs(){let e=(0,B.useContext)(Lr.i18n).getGroup(`filemanager`),t=(0,B.useContext)(Ms),n=U(t,`activePanel`),[r]=pa(t,`panels`),i=(0,B.useMemo)(()=>r[n]._crumbs,[r,n]);function a(){t.exec(`filter-files`,{text:``})}return(0,V.jsxs)(`div`,{className:`wx-GDJvtROw wx-search`,children:[(0,V.jsxs)(`div`,{className:`wx-GDJvtROw wx-toolbar`,children:[(0,V.jsx)(`div`,{className:`wx-GDJvtROw wx-back-icon`,children:(0,V.jsx)(Bs,{name:`angle-left`,onClick:a})}),(0,V.jsxs)(`div`,{className:`wx-GDJvtROw wx-text`,children:[e(`Search results in`),` `,Array.isArray(i)&&i.map((t,n)=>(0,V.jsxs)(B.Fragment,{children:[n?`/`:null,t.id==`/`?e(t.name):t.name]},n))]})]}),(0,V.jsx)(zs,{})]})}function Hs({narrowMode:e,extraInfo:t}){let n=(0,B.useContext)(Ms),{preview:r,icon:i}=n.templates,a=(0,B.useContext)(Lr.i18n),o=(0,B.useMemo)(()=>a.getGroup(`filemanager`),[a]),s=(0,B.useMemo)(()=>Dr(`%D, %d %F %Y, %H:%i`,a.getRaw().calendar),[a]),[c,l]=pa(n,`panels`),u=U(n,`activePanel`),d=U(n,`preview`),f=U(n,`search`),p=(0,B.useMemo)(()=>{let e=c&&u!=null&&c[u]?._selected?.length||0;return f&&!e},[f,l,u]),m=(0,B.useMemo)(()=>{let e=c&&u!=null?c[u]:null;return e?p?e._files:e._selected:[]},[p,l,u]),h=(0,B.useCallback)((e,t)=>(e?`${e} ${o(e>1?`folders`:`folder`)} `:``)+(t?`${t} ${o(t>1?`files`:`file`)}`:``),[o]),g=(0,B.useCallback)(()=>{n.exec(`show-preview`,{mode:!d})},[n,d]),_=(0,B.useCallback)(e=>e.type===`folder`?o(`Folder`):e.ext||o(`Unknown file`),[o]),v=(0,B.useMemo)(()=>{let e,t,n,a,s,c,l,u;if(m.length===1&&!p){t=m[0],e=t.name;let o=r(t,400,500);o?(n=o,a=``):(a=i(t,`big`),n=``),s=t.type!==`folder`}else{if(t=s=null,e=``,m.length){let t=0,n=0,r=0,i=[],a;m.forEach(e=>{typeof e.size>`u`&&(a=!0,t=void 0),a||(t+=e.size),i.push(_(e)),e.type===`folder`?n++:r++});let s=new Set(i);c=s.size>1?o(`multiple`):[...s][0],l=h(n,r),u=t,p||(e=o(`Multiple files`))}a=i({type:p?`search`:m.length?`multiple`:`none`},`big`),n=``}return{name:e,item:t,previewSrc:n,iconSrc:a,showDownloadIcon:s,type:c,totalCount:l,totalSize:u}},[m,p,r,i,o,_,h]),y=(0,B.useCallback)(()=>{n.exec(`download-file`,{id:m[0].id})},[n,m]),b=(0,B.useCallback)(async e=>{if(!t||!e)return null;try{return await t(e)}catch(e){return console.log(e),null}},[t]),[x,S]=(0,B.useState)(null);return(0,B.useEffect)(()=>{let e=!1;return S(null),Promise.resolve(b(v.item)).then(t=>{e||S(t)}).catch(()=>{e||S(null)}),()=>{e=!0}},[b,v.item]),(0,V.jsx)(`div`,{className:`wx-O0BTtRrH wx-wrapper`,children:m&&m.length?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`wx-O0BTtRrH wx-preview`,children:[(0,V.jsxs)(`div`,{className:`wx-O0BTtRrH wx-toolbar`,children:[(0,V.jsx)(`div`,{className:`wx-O0BTtRrH wx-name`,children:v.name}),(0,V.jsxs)(`div`,{className:`wx-O0BTtRrH wx-icons`,children:[v.showDownloadIcon?(0,V.jsx)(Bs,{name:`download`,onClick:y}):null,e?(0,V.jsx)(Bs,{name:`close`,onClick:g}):null]})]}),v.previewSrc?(0,V.jsx)(`div`,{className:`wx-O0BTtRrH wx-img-wrapper`,children:(0,V.jsx)(`img`,{src:v.previewSrc,alt:o(`A miniature file preview`)})}):v.iconSrc?(0,V.jsx)(`div`,{className:`wx-O0BTtRrH wx-icon-wrapper`,children:(0,V.jsx)(`img`,{src:v.iconSrc,alt:o(`A miniature file preview`)})}):(0,V.jsx)(`div`,{className:`wx-O0BTtRrH wx-icon-wrapper`,children:v.item?(0,V.jsx)(`i`,{className:`wx-O0BTtRrH wx-icon wxi-${v.item.type}`}):(0,V.jsx)(`i`,{className:`wx-O0BTtRrH wx-icon wxi-${p?`search`:`file-multiple-outline`}`})})]}),(0,V.jsxs)(`div`,{className:`wx-O0BTtRrH wx-info-panel`,children:[(0,V.jsx)(`div`,{className:`wx-O0BTtRrH wx-title`,children:o(p?`Found`:`Information`)}),(0,V.jsxs)(`div`,{className:`wx-O0BTtRrH wx-list`,children:[v.item?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`wx-O0BTtRrH wx-name`,children:o(`Type`)}),(0,V.jsx)(`span`,{className:`wx-O0BTtRrH wx-value`,children:_(v.item)}),typeof v.item.size<`u`?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`wx-O0BTtRrH wx-name`,children:o(`Size`)}),(0,V.jsx)(`span`,{className:`wx-O0BTtRrH wx-value`,children:Ki(v.item.size)})]}):null,(0,V.jsx)(`span`,{className:`wx-O0BTtRrH wx-name`,children:o(`Date`)}),(0,V.jsxs)(`span`,{className:`wx-O0BTtRrH wx-value`,children:[s(v.item.date),` `]})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`wx-O0BTtRrH wx-name`,children:o(`Count`)}),(0,V.jsx)(`span`,{className:`wx-O0BTtRrH wx-value`,children:v.totalCount}),(0,V.jsx)(`span`,{className:`wx-O0BTtRrH wx-name`,children:o(`Type`)}),(0,V.jsx)(`span`,{className:`wx-O0BTtRrH wx-value`,children:v.type}),typeof v.totalSize<`u`?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`wx-O0BTtRrH wx-name`,children:o(`Size`)}),(0,V.jsx)(`span`,{className:`wx-O0BTtRrH wx-value`,children:Ki(v.totalSize)})]}):null]}),x?Object.entries(x).map(([e,t])=>(0,V.jsxs)(B.Fragment,{children:[(0,V.jsx)(`span`,{className:`wx-O0BTtRrH wx-name`,children:e}),(0,V.jsx)(`span`,{className:`wx-O0BTtRrH wx-value`,children:t})]},e)):null]})]})]}):(0,V.jsxs)(`div`,{className:`wx-O0BTtRrH wx-no-info-panel`,children:[(0,V.jsxs)(`div`,{className:`wx-O0BTtRrH wx-toolbar`,children:[(0,V.jsx)(`div`,{className:`wx-O0BTtRrH wx-name`,children:v.name}),(0,V.jsx)(`div`,{className:`wx-O0BTtRrH wx-icons`,children:e?(0,V.jsx)(Bs,{name:`close`,onClick:g}):null})]}),(0,V.jsx)(`div`,{className:`wx-O0BTtRrH wx-no-info-wrapper`,children:(0,V.jsxs)(`div`,{className:`wx-O0BTtRrH wx-no-info`,children:[v.previewSrc?(0,V.jsx)(`div`,{className:`wx-O0BTtRrH wx-img-wrapper`,children:(0,V.jsx)(`img`,{src:v.previewSrc,alt:o(`A miniature file preview`)})}):v.iconSrc?(0,V.jsx)(`div`,{className:`wx-O0BTtRrH wx-icon-wrapper`,children:(0,V.jsx)(`img`,{src:v.iconSrc,alt:o(`A miniature file preview`)})}):(0,V.jsx)(`div`,{className:`wx-O0BTtRrH wx-icon-wrapper`,children:(0,V.jsx)(`i`,{className:`wx-O0BTtRrH wx-icon wxi-${p?`search`:`message-question-outline`}`})}),(0,V.jsx)(`span`,{className:`wx-O0BTtRrH wx-text`,children:p?``:o(`Select file or folder to view details`)})]})})]})})}function Us({panel:e}){let t=(0,B.useContext)(Ms),n=(0,B.useContext)(Lr.i18n),r=(0,B.useMemo)(()=>n.getGroup(`filemanager`),[n]),[i,a]=pa(t,`panels`),o=(0,B.useMemo)(()=>i[e]._files,[a,e]),s=(0,B.useMemo)(()=>i[e]._crumbs||[],[a,e]);function c(n){let r=Zi(n,s);t.exec(`set-path`,{id:n,panel:e,...r&&{selected:[r]}})}let[l,u]=(0,B.useState)(null);(0,B.useEffect)(()=>{o&&u(null)},[o]);function d(){u(!0),t.exec(`request-data`,{id:s[s.length-1].id}),setTimeout(()=>{u(null)},5e3)}let f=(0,B.useRef)(null),p=(0,B.useRef)();return(0,B.useEffect)(()=>{p.current?p.current.click=c:(p.current={click:c},Kn(f.current,p.current))},[c]),(0,V.jsxs)(`div`,{className:`wx-SNY5LTYx wx-breadcrumbs`,"data-menu-ignore":`true`,ref:f,children:[(0,V.jsx)(`div`,{className:`wx-SNY5LTYx wx-refresh-icon`,children:(0,V.jsx)(Bs,{name:`refresh`,spin:!!l,onClick:d})}),s.map((e,t)=>(0,V.jsxs)(B.Fragment,{children:[t?(0,V.jsx)(Bs,{name:`angle-right`}):null,(0,V.jsx)(`div`,{className:`wx-SNY5LTYx wx-item`,"data-id":Bn(e.id),"data-menu-ignore":`true`,children:e.id==`/`?r(e.name):e.name})]},t))]})}function Ws({row:e}){let t=(0,B.useContext)(Lr.i18n),[n]=(0,B.useState)(()=>t.getGroup(`filemanager`)),r=(0,B.useContext)(Ms).templates,[i]=(0,B.useState)(()=>r.icon(e,`small`));return(0,V.jsx)(`div`,{className:`wx-qgAqG6sL wx-name-cell`,children:e.id===`/wx-filemanager-parent-link`?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`i`,{className:`wx-qgAqG6sL wxi-arrow-left`}),(0,V.jsxs)(`span`,{className:`wx-qgAqG6sL wx-name`,children:[` `,n(`Back to parent folder`)]})]}):(0,V.jsxs)(V.Fragment,{children:[i?(0,V.jsx)(`img`,{className:`wx-qgAqG6sL wx-icon`,alt:``,src:i,height:`24px`,width:`24px`}):(0,V.jsx)(`i`,{className:`wx-qgAqG6sL wxi-${e.type}`}),(0,V.jsxs)(`span`,{className:`wx-qgAqG6sL wx-name`,children:[` `,e.name,` `]})]})})}function Gs({children:e}){let t=(0,B.useContext)(Ms),n=U(t,`activePanel`),r=(0,B.useContext)(Ps),i=(0,B.useRef)(null),a=(0,B.useRef)({});return a.current.drop=()=>{let e=i.current,r=Ln(e,`data-panel`);r&&r!=n&&t.exec(`set-active-panel`,{panel:r*1})},a.current.dragEnter=()=>{let e=i.current;e&&e.classList.toggle(`wx-active`)},a.current.dragLeave=()=>{let e=i.current;e&&e.classList.toggle(`wx-active`)},(0,B.useEffect)(()=>{let e=i.current;return r.droparea(e,a.current)},[]),(0,V.jsx)(`div`,{className:`wx-LT9X7tb7 wx-upload-area`,ref:i,children:e})}function Ks({panel:e,active:t=!1,onClick:n,onContextMenu:r}){let i=(0,B.useContext)(Ms),a=(0,B.useContext)(Lr.i18n),o=(0,B.useMemo)(()=>a.getGroup(`filemanager`),[a]),s=(0,B.useMemo)(()=>Dr(`%d %M %Y`,a.getRaw().calendar),[a]),[c]=pa(i,`panels`),l=c[e].selected,u=c[e].path,d=c[e]._crumbs,f=c[e]._sorts,p=c[e]._selectNavigation,m=c[e]._files,h=(0,B.useMemo)(()=>[{id:`name`,header:o(`Name`),flexgrow:3,sort:!0,resize:!0,cell:Ws},{id:`size`,header:o(`Size`),width:100,sort:!0,resize:!0,template:e=>typeof e==`number`?Ki(e):``},{id:`date`,header:o(`Date`),width:120,sort:!0,resize:!0,template:e=>e?s(e):``}],[o,s]),g=(0,B.useRef)(null),_=(0,B.useRef)(null),v=(0,B.useMemo)(()=>p?[`/wx-filemanager-parent-link`]:[...l],[p,l]);function y(t,n){if(n&&n.target&&n.target.className&&n.target.className.indexOf(`wx-grip`)!==-1)return;let r=n&&(n.ctrlKey||n.metaKey),a=n&&n.shiftKey;if(t===`/wx-filemanager-parent-link`){if(l.length&&(r||a))return;i.exec(`select-file`,{type:`navigation`});return}let o=t===`body`&&n?null:t;!g.current&&!_.current?i.exec(`select-file`,{id:o,toggle:r,range:a,panel:e}):(g.current=null,_.current=null)}function b(){d.length>1&&i.exec(`set-path`,{id:d[d.length-2].id,panel:e,selected:[d[d.length-1].id]})}function x(t){if(t===`/wx-filemanager-parent-link`)return b();let n=m.find(e=>e.id===t);n&&(n.type===`folder`?i.exec(`set-path`,{id:n.id,panel:e}):i.exec(`open-file`,{id:n.id}))}function S(t){let n=t.key,r=f[u],a=r?`asc`:`desc`;r&&r.key===n&&(a=r.order===`asc`?`desc`:`asc`),i.exec(`sort-files`,{key:n,order:a,panel:e,path:u})}function C(e){e.intercept(`sort-rows`,e=>(g.current=!0,S(e),!1)),e.intercept(`select-row`,()=>!1),e.on(`resize-column`,()=>_.current=!0),e.intercept(`hotkey`,()=>!1)}let w=(0,B.useMemo)(()=>u===`/`?m:[{id:`/wx-filemanager-parent-link`,name:o(`Back to parent folder`)},...m],[u,m,o]),T=(0,B.useMemo)(()=>{if(w&&f&&f[u]){let{key:e,order:t}=f[u];return{[e]:{order:t}}}},[w,f,u]),E=(0,B.useRef)(null),D=(0,B.useRef)();return(0,B.useEffect)(()=>{D.current?(D.current.click=y,D.current._dblclick=x):(D.current={click:y,dblclick:e=>D.current._dblclick(e),_dblclick:x},Kn(E.current,D.current))},[y,x]),(0,V.jsxs)(`div`,{onClick:n,onContextMenu:r,className:`wx-SSaVhET7 wx-wrapper`,children:[(0,V.jsx)(Us,{panel:e}),(0,V.jsx)(`div`,{"data-id":Bn(`body`),className:`wx-SSaVhET7 wx-list ${t?`wx-active`:``}`,ref:E,children:(0,V.jsx)(Gs,{children:(0,V.jsx)(js,{init:C,data:w,columns:h,selectedRows:v,columnStyle:()=>`wx-SSaVhET7 wx-each-cell`,sizes:{rowHeight:42,headerHeight:42},sortMarks:T})})})]})}function qs(){let e=(0,B.useContext)(Ms),t=U(e,`activePanel`);function n(t){e.exec(`set-active-panel`,{panel:t})}return(0,V.jsxs)(`div`,{className:`wx-L55BfJa2 wx-panels`,"data-id":Bn(`body`),children:[(0,V.jsx)(`div`,{className:`wx-L55BfJa2 wx-item`,"data-panel":0,children:(0,V.jsx)(Ks,{panel:0,active:t==0,onClick:()=>n(0),onContextMenu:()=>n(0)})}),(0,V.jsx)(`div`,{className:`wx-L55BfJa2 wx-item`,"data-panel":1,children:(0,V.jsx)(Ks,{panel:1,active:t==1,onClick:()=>n(1),onContextMenu:()=>n(1)})})]})}function Js({folderIcon:e=!1,folder:t={}}){let n=(0,B.useContext)(Ms),[r,i]=pa(n,`panels`),a=U(n,`activePanel`),o=(0,B.useMemo)(()=>r[a].path,[i,a]),s=(0,B.useContext)(Lr.i18n),c=(0,B.useMemo)(()=>s.getGroup(`filemanager`),[s]),l=(0,B.useMemo)(()=>!!t.data?.find(e=>e.type===`folder`),[t]),u=(0,B.useMemo)(()=>t.id==`/`?c(t.name):t.name,[t,c]),d=(0,B.useMemo)(()=>t.$level>1?(t.$level-1)*20:0,[t]),f=t.open;return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`li`,{"data-id":Bn(t.id),className:`wx-NYfhvGIt wx-folder${o===t.id?` wx-selected`:``}`,style:{paddingLeft:`${d}px`},children:[l?(0,V.jsx)(`i`,{className:`wx-NYfhvGIt wx-toggle wxi-${f?`angle-down`:`angle-right`}`,"data-action":`toggle`}):(0,V.jsx)(`span`,{className:`wx-NYfhvGIt wx-toggle-placeholder`}),(0,V.jsx)(`i`,{className:`wx-NYfhvGIt `+(e||`wxi-folder`)}),(0,V.jsxs)(`span`,{className:`wx-NYfhvGIt wx-name`,children:[` `,u,` `]})]}),f&&t.data&&t.data.length&&l?(0,V.jsx)(V.Fragment,{children:t.data.map(e=>e.type===`folder`?(0,V.jsx)(Js,{folder:e},e.id):null)}):null]})}function Ys(){let e=(0,B.useContext)(Ms),[t,n]=pa(e,`data`),[r,i]=pa(e,`panels`),a=U(e,`activePanel`),o=(0,B.useMemo)(()=>r[a]._crumbs,[i,a]),s=(0,B.useCallback)(n=>{e.exec(`open-tree-folder`,{id:n,mode:!t.byId(n).open})},[e,n]),c=(0,B.useCallback)(t=>{let n=Zi(t,o);e.exec(`set-path`,{id:t,panel:a,...n&&{selected:[n]}})},[e,o,a]),[l,u]=(0,B.useState)([]);(0,B.useEffect)(()=>{u(t.byId(0).data)},[n]);let d=(0,B.useRef)(null),f=(0,B.useRef)();return(0,B.useEffect)(()=>{f.current?(f.current.click=c,f.current.toggle=s):(f.current={click:c,toggle:s},Kn(d.current,f.current))},[c,s]),(0,V.jsx)(`ul`,{ref:d,className:`wx-LyHJ6R6A`,children:l.map(e=>e.type===`folder`?(0,V.jsx)(Js,{folder:e},e.id):null)})}function Xs(){let e=(0,B.useContext)(Ms),t=(0,B.useContext)(Lr.i18n),n=(0,B.useMemo)(()=>t.getGroup(`filemanager`),[t]),r=U(e,`drive`),i=r?r.used:``,a=r?r.total:``;return i&&a?(0,V.jsxs)(`div`,{className:`wx-DetSyKGG wx-drive`,children:[(0,V.jsx)(`progress`,{value:i,max:a,className:`wx-DetSyKGG wx-progress`}),(0,V.jsxs)(`p`,{children:[Ki(i),` `,n(`of`),` `,Ki(a),` `,n(`used`)]})]}):null}function Zs({option:e}){let t=(0,B.useContext)(Lr.i18n).getGroup(`filemanager`),n=(0,B.useContext)(Ps),r=(0,B.useCallback)(()=>{n.open({})},[n]);return(0,V.jsx)(`div`,{className:`wx-9XiKcxq5 wx-upload-button`,onClick:r,children:(0,V.jsx)(`span`,{children:t(e.text)})})}function Qs({readonly:e,menuOptions:t}){let n=(0,B.useContext)(Lr.i18n).getGroup(`filemanager`),{showPrompt:r}=(0,B.useContext)(Ns);(0,B.useEffect)(()=>{Ca(`upload`,Zs)},[]);function i({action:e}){e&&(e.id===`add-file`?r({item:{type:`file`,size:0,date:new Date},add:!0}):e.id===`add-folder`&&r({item:{type:`folder`,date:new Date},add:!0}))}let a=(0,B.useMemo)(()=>t(`add`).map(e=>(e.text=n(e.text),e)),[t,n]);return(0,V.jsxs)(`div`,{className:`wx-FlucfALM wx-wrapper`,children:[!e&&(0,V.jsx)(`div`,{className:`wx-FlucfALM wx-button`,children:(0,V.jsx)(Da,{options:a,at:`bottom-fit`,onClick:i,children:(0,V.jsx)(zr,{type:`primary block`,children:n(`Add New`)})})}),(0,V.jsx)(`div`,{className:`wx-FlucfALM wx-tree`,children:(0,V.jsx)(Ys,{})}),(0,V.jsx)(Xs,{})]})}function $s({value:e=``,onSearch:t}){let[n,r]=ua(e),i=(0,B.useContext)(Lr.i18n).getGroup(`filemanager`),a=(0,B.useRef)(null),o=(0,B.useMemo)(()=>n===``?`wxi-search`:`wxi-close`,[n]);function s(e){let n=e.target.value;r(n),t&&t({value:n})}function c(){r(``),a.current&&a.current.focus(),t&&t({value:``})}return(0,V.jsxs)(`div`,{className:`wx-lUZMtgT1 wx-search-input`,children:[(0,V.jsx)(`i`,{className:`wx-lUZMtgT1 wx-icon ${o}`,onClick:c}),(0,V.jsx)(`input`,{type:`text`,className:`wx-lUZMtgT1 wx-text`,ref:a,value:n,onInput:s,placeholder:i(`Search`)})]})}function ec({narrowMode:e=!1,onShowTree:t}){let n=(0,B.useContext)(Ms),r=(0,B.useContext)(Lr.i18n).getGroup(`filemanager`),i=U(n,`mode`),a=U(n,`preview`),o=U(n,`search`),s=[{icon:`wxi-view-sequential`,id:`table`},{icon:`wxi-view-grid`,id:`cards`},{icon:`wxi-view-column`,id:`panels`}];function c({value:e}){n.exec(`set-mode`,{mode:e})}function l(e){e.preventDefault(),n.exec(`show-preview`,{mode:!a})}function u(e){n.exec(`filter-files`,{text:e.value})}return(0,V.jsxs)(`div`,{className:`wx-5PZQQztG wx-toolbar`,children:[(0,V.jsxs)(`div`,{className:`wx-5PZQQztG wx-left `+(e?`wx-left-narrow`:``),children:[e?i===`panels`||i===`search`?null:(0,V.jsx)(`div`,{className:`wx-5PZQQztG wx-sidebar-icon`,"data-id":Bn(`toggle-tree`),children:(0,V.jsx)(Bs,{onClick:()=>t&&t(),name:`subtask`})}):(0,V.jsx)(`div`,{className:`wx-5PZQQztG wx-name`,children:r(`Files`)}),(0,V.jsx)($s,{onSearch:u,value:o})]}),(0,V.jsxs)(`div`,{className:`wx-5PZQQztG wx-right`,children:[e?null:(0,V.jsx)(`div`,{className:`wx-5PZQQztG wx-preview-icon`,children:(0,V.jsx)(ki,{onClick:l,value:a,children:(0,V.jsx)(`i`,{className:`wx-5PZQQztG wxi-eye`})})}),(0,V.jsx)(`div`,{className:`wx-5PZQQztG wx-modes`,children:(0,V.jsx)(Si,{value:i,options:s,onChange:c})})]})]})}function tc(){let e=U((0,B.useContext)(Ms),`activePanel`);return(0,V.jsxs)(`div`,{className:`wx-NwohNJzN wx-wrapper`,children:[(0,V.jsx)(Us,{panel:e}),(0,V.jsx)(Gs,{children:(0,V.jsx)(zs,{})})]})}function nc({readonly:e=!1,menuOptions:t,extraInfo:n}){let r=(0,B.useRef)(null),i=(0,B.useRef)(null),[a,o]=(0,B.useState)(void 0),[s,c]=(0,B.useState)(void 0),[l,u]=(0,B.useState)(!1),d=ja(),f=(0,B.useContext)(Ms),{showPrompt:p,showConfirm:m}=(0,B.useContext)(Ns),h=(0,B.useContext)(Lr.i18n),g=(0,B.useMemo)(()=>h.getGroup(`filemanager`),[h]),_=U(f,`mode`),v=U(f,`preview`),y=U(f,`activePanel`),[b,x]=pa(f,`panels`),S=(0,B.useMemo)(()=>(b&&y!=null?b[y]:null)?.selected??[],[x,y]),C=(0,B.useMemo)(()=>(b&&y!=null?b[y]:null)?.path,[x,y]),[w,T]=(0,B.useState)([]);(0,B.useEffect)(()=>{let e=r.current;if(!e)return;let t=new ResizeObserver(e=>{let t=e[0]?.borderBoxSize?.[0]?.inlineSize;typeof t==`number`&&c(t<768)});return t.observe(e),()=>{t.disconnect()}},[]);let E=(0,B.useCallback)(()=>{u(e=>!e)},[]),D=(0,B.useCallback)(e=>{s&&Rn(e)!==`toggle-tree`&&u(!1)},[s]);(0,B.useEffect)(()=>{let e=i.current;if(e)return tr(e,D).destroy},[D]),(0,B.useEffect)(()=>{let e=i.current;if(!e)return;let t=new ResizeObserver(()=>{e&&o(e.clientWidth)});return t.observe(e),e&&o(e.clientWidth),()=>{t.disconnect()}},[]);let O=(0,B.useMemo)(()=>({icon:`wxi-eye`,text:`Preview`,id:`preview`}),[]),k=(0,B.useCallback)(e=>{let n=s?[O]:[];return e===`file`&&(n=[...n,...t().filter(e=>e.id===`download`)]),n},[s,O,t]),A=(0,B.useRef)(null),j=(0,B.useCallback)((e,t,n)=>{let r=n?[t.id]:S;switch(e){case`download`:f.exec(`download-file`,{id:t.id});break;case`copy`:case`move`:A.current={action:e,ids:r};break;case`paste`:A.current&&f.exec(A.current.action===`copy`?`copy-files`:`move-files`,{ids:A.current.ids,target:t?.type===`folder`?t.id:C});break;case`rename`:p({item:t});break;case`delete`:m({selected:r});break;case`preview`:f.exec(`show-preview`,{mode:!v})}},[f,S,C,p,m,v]),ee=(0,B.useCallback)(()=>b?.[y],[b,y]);(0,B.useEffect)(()=>{let n=r.current;if(!n)return;let i=ia(n,{api:f,menuOptions:e?k:t,performAction:j,getPanel:ee});return()=>{typeof i==`function`?i():i&&typeof i.destroy==`function`&&i.destroy()}},[f,e,k,t,j,ee]);let M=(0,B.useCallback)((n,r)=>{let i=n?f.getFile(n):null,a=r.target.closest(`.tree-item.folder`),o;if(e)o=k(i?.type);else{switch(n){case`body`:o=t(n);break;default:if(i)if(!a&&S.length>1)o=s?[O,...t(`multiselect`)]:t(`multiselect`);else if(n===`/`)o=t(`folder`,i).filter(e=>e.id===`paste`);else{let e=t(i.type,i);e&&(o=s?[O,...e]:e)}}_===`search`&&(o=o?.filter(e=>e.id!==`paste`))}if(i?.id&&(!S.length||!S.some(e=>e===i.id))&&!a&&f.exec(`select-file`,{id:i.id}),o?.length)return o.forEach(e=>{a&&(e.hotkey=``),e.text&&=g(e.text),e.hotkey&&(e.subtext=e.hotkey)}),T(o),i||{}},[f,e,k,t,S,s,O,_,g]),N=(0,B.useCallback)(e=>{let{action:t,context:n}=e;t&&j(t.id,n,!t.hotkey)},[j]);async function te(e){await Promise.resolve();let{name:t,size:n}=e.file;f.exec(`create-file`,{file:{name:t,size:n,date:new Date,file:e.file},parent:C})}return(0,V.jsx)(`div`,{className:`wx-RJbNonjJ wx-filemanager wx-flex`,ref:r,"data-menu-ignore":`false`,children:s&&v?(0,V.jsx)(`div`,{className:`wx-RJbNonjJ wx-info-narrow`,children:(0,V.jsx)(Hs,{narrowMode:s,extraInfo:n})}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(ec,{narrowMode:s,onShowTree:E}),(0,V.jsx)(Oa,{dataKey:`id`,at:`point`,options:w,resolver:M,onClick:N,children:(0,V.jsxs)(Ea,{dataKey:`actionId`,options:w,resolver:M,onClick:N,children:[(0,V.jsx)(Pa,{data:d,apiOnly:!0,uploadURL:te}),(0,V.jsx)(Ps.Provider,{value:d,children:(0,V.jsx)(`div`,{className:`wx-RJbNonjJ wx-content-wrapper wx-flex`,children:_!==`panels`&&_!==`search`?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`wx-RJbNonjJ `+[`wx-sidebar`,s?`wx-sidebar-narrow`:``,l?`wx-sidebar-visible`:``].filter(Boolean).join(` `),ref:i,children:(0,V.jsx)(Qs,{readonly:e,menuOptions:t})}),(0,V.jsxs)(`div`,{className:`wx-RJbNonjJ wx-content`,style:{width:`calc(100% - ${a||0}px - 10px)`},children:[(0,V.jsx)(`div`,{className:`wx-RJbNonjJ wx-content-item${v?``:`-fit`}`,"data-id":Bn(`body`),children:_===`table`?(0,V.jsx)(Ks,{panel:y}):(0,V.jsx)(tc,{})}),v?(0,V.jsx)(`div`,{className:`wx-RJbNonjJ wx-info`,children:(0,V.jsx)(Hs,{extraInfo:n})}):null]})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`wx-RJbNonjJ wx-content-item${v?``:`-fit`}`,children:_===`panels`?(0,V.jsx)(qs,{}):(0,V.jsx)(Vs,{})}),v?(0,V.jsx)(`div`,{className:`wx-RJbNonjJ wx-info`,children:(0,V.jsx)(Hs,{extraInfo:n})}):null]})})})]})})]})})}var rc=e=>e.split(`-`).map(e=>e?e.charAt(0).toUpperCase()+e.slice(1):``).join(``);function ic(e,t){let{type:n,ext:r}=e;if(n===`folder`)return!1;let i;return i=n&&n!==`file`&&Is[n]?n:r?Is[r]?r:`file`:`unknown`,`https://cdn.svar.dev/icons/filemanager/vivid/${t}/${i}.svg`}var ac=(0,B.forwardRef)(function(e,t){let{data:n=[],mode:r=`cards`,drive:i=null,preview:a=!1,panels:o=null,activePanel:s=0,readonly:c=!1,menuOptions:l=ta,extraInfo:u=null,init:d=null,icons:f=ic,previews:p=null,...m}=e,h=(0,B.useRef)();h.current=m;let g=(0,B.useMemo)(()=>new ea(ha),[]),_=(0,B.useMemo)(()=>g.in,[g]),v=(0,B.useRef)(null);v.current===null&&(v.current=new Ni((e,t)=>{let n=`on`+rc(e);h.current&&h.current[n]&&h.current[n](t)}),_.setNext(v.current));let y=(0,B.useMemo)(()=>({getState:g.getState.bind(g),getReactiveState:g.getReactive.bind(g),getStores:()=>({data:g}),exec:_.exec,setNext:e=>(v.current=v.current.setNext(e),v.current),intercept:_.intercept.bind(_),on:_.on.bind(_),detach:_.detach.bind(_),getFile:g.getFile.bind(g),serialize:g.serialize.bind(g),templates:{preview:p||(()=>null),icon:f===`simple`?(()=>null):f}}),[g,_]),b=(0,B.useRef)(0);return(0,B.useEffect)(()=>{if(!b.current)d&&d(y);else{let e=g.getState();g.init({data:n,mode:r,drive:i,preview:a,panels:o||e.panels||[],activePanel:s})}b.current++},[g,n,r,i,a,o,s,d,y]),b.current===0&&g.init({data:n,mode:r,drive:i,preview:a,panels:o||[],activePanel:s}),(0,B.useImperativeHandle)(t,()=>({...y}),[y]),(0,V.jsx)(Ms.Provider,{value:y,children:(0,V.jsx)(mi,{words:Mi,optional:!0,children:(0,V.jsx)(Fs,{children:(0,V.jsx)(nc,{readonly:c,menuOptions:l,extraInfo:u})})})})});function oc({fonts:e=!0,children:t}){return t?(0,V.jsx)(ji,{fonts:e,children:t}):(0,V.jsx)(ji,{fonts:e})}Wn(Un);function sc({...e}){return(0,V.jsx)(ce,{"data-slot":`dialog`,...e})}function cc({...e}){return(0,V.jsx)(he,{"data-slot":`dialog-portal`,...e})}function lc({className:e,...t}){return(0,V.jsx)(w,{"data-slot":`dialog-overlay`,className:H(`data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50 backdrop-blur-xs`,e),...t})}function uc({className:e,children:t,hideCloseButton:n=!1,...r}){return(0,V.jsxs)(cc,{"data-slot":`dialog-portal`,children:[(0,V.jsx)(lc,{}),(0,V.jsxs)(d,{"data-slot":`dialog-content`,"aria-describedby":r[`aria-describedby`]??void 0,className:H(`z-[9999] bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-2xl border p-6 shadow-lg duration-200`,e),...r,children:[t,!n&&(0,V.jsxs)(Lt,{className:`ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,V.jsx)(Le,{}),(0,V.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function dc({className:e,...t}){return(0,V.jsx)(`div`,{"data-slot":`dialog-header`,className:H(`flex flex-col gap-2 text-center sm:text-left`,e),...t})}function fc({className:e,...t}){return(0,V.jsx)(xe,{"data-slot":`dialog-title`,className:H(`text-lg leading-none font-semibold`,e),...t})}function pc({className:e,...t}){return(0,V.jsx)(ve,{"data-slot":`dialog-description`,className:H(`text-muted-foreground text-sm`,e),...t})}function mc(e){return(e||`Untitled`).trim().replace(/[^a-zA-Z0-9\s-]/g,``).replace(/\s+/g,`-`)}function hc(e){let t=new Map;for(let n of e)t.set(n.id,n);function n(e){let n=[mc(e.title)],r=e;for(;r.parentId;){let e=t.get(r.parentId);if(!e)break;n.unshift(mc(e.title)),r=e}return`/`+n.join(`/`)}function r(e){if(!e.parentId)return`0`;let r=t.get(e.parentId);return r?n(r):`0`}return e.map(e=>({id:n(e),parent:r(e),type:e.isFolder?`folder`:`file`,date:new Date,size:e.isFolder?void 0:e.content?.length||0}))}function gc(e=[]){return hc(e)}function _c(e){let t=new Map;for(let n of e)t.set(n.id,n);function n(e){let n=[mc(e.title)],r=e;for(;r.parentId;){let e=t.get(r.parentId);if(!e)break;n.unshift(mc(e.title)),r=e}return`/`+n.join(`/`)}let r=new Map;for(let t of e)t.isFolder||r.set(n(t),t.id);return r}var vc=[{id:`1`,title:`Welcome to REASON`,content:`<h1>Welcome to REASON</h1><p>A powerful note-taking app with nested documents.</p><h2>Features</h2><ul><li><p><strong>Rich text editing</strong> with WYSIWYG editor</p></li><li><p><strong>Nested documents</strong> for better organization</p></li><li><p><strong>Full-text search</strong> to find notes quickly</p></li><li><p><strong>Drag and drop</strong> to reorganize notes</p></li><li><p><strong>Right-click menus</strong> for quick actions</p></li><li><p><strong>Document outline</strong> view</p></li><li><p><strong>Local storage</strong> - your notes stay private</p></li><li><p><strong>Mobile-friendly</strong> with responsive drawer navigation</p></li></ul><h2>Getting Started</h2><p>On mobile, tap the menu icon to access your notes.</p><p>Click the "New Note" button to create your first note, or select this note to start editing.</p><p>You can also create child notes by right-clicking a note.</p><h3>Drag and Drop</h3><p>Drag notes to reorder them or move them under different parent notes.</p><h3>Outline View</h3><p>Click the outline icon to see all headings in the current document.</p><p>Press the search icon (or Ctrl+K) to quickly find any note.</p>`,parentId:null,children:[],isExpanded:!0,tags:[]},{id:`2`,title:`Projects`,content:``,parentId:null,children:[],isExpanded:!0,isFolder:!0,tags:[]},{id:`3`,title:`Website Redesign`,content:`<h1>Website Redesign</h1><p>Planning for the new website design.</p><h2>Goals</h2><ul><li><p>Modern, clean interface</p></li><li><p>Mobile-first approach</p></li><li><p>Improved accessibility</p></li></ul>`,parentId:`2`,children:[],isExpanded:!1,tags:[`design`,`web`]},{id:`4`,title:`API Integration`,content:`<h1>API Integration</h1><p>Notes on integrating the new REST API.</p><h2>Endpoints</h2><ul><li><p>GET /api/documents</p></li><li><p>POST /api/documents</p></li><li><p>PUT /api/documents/:id</p></li></ul>`,parentId:`2`,children:[],isExpanded:!1,tags:[`development`,`api`]},{id:`5`,title:`Research`,content:``,parentId:null,children:[],isExpanded:!0,isFolder:!0,tags:[]},{id:`6`,title:`Market Analysis`,content:`<h1>Market Analysis</h1><p>Research findings on market trends.</p><h2>Key Insights</h2><ul><li><p>Growing demand for productivity tools</p></li><li><p>Users prefer cloud-based solutions</p></li><li><p>Mobile access is essential</p></li></ul>`,parentId:`5`,children:[],isExpanded:!1,tags:[`research`,`business`]},{id:`7`,title:`Competitor Review`,content:`<h1>Competitor Review</h1><p>Analysis of competitor products.</p><h2>Top Competitors</h2><ul><li><p>Notion - Versatile but complex</p></li><li><p>Obsidian - Great for developers</p></li><li><p>Roam Research - Powerful linking</p></li></ul>`,parentId:`5`,children:[],isExpanded:!1,tags:[`research`,`competition`]},{id:`8`,title:`Meeting Notes`,content:`<h1>Meeting Notes</h1><p>Quick notes from today's team meeting.</p><h2>Action Items</h2><ul><li><p>Review PRs by EOD</p></li><li><p>Update documentation</p></li><li><p>Schedule next sprint planning</p></li></ul>`,parentId:null,children:[],isExpanded:!1,tags:[`meetings`]}];function yc({open:e,onOpenChange:t,documents:n=vc,onSelectDocument:r}){let i=(0,B.useMemo)(()=>gc(n).map(e=>({id:e.id,parent:e.parent,type:e.type,size:e.size??0,date:e.date??new Date})),[n]),a=(0,B.useMemo)(()=>_c(n),[n]),o=(0,B.useRef)(a);o.current=a;let s=(0,B.useRef)(r);s.current=r;let c=(0,B.useRef)(t);c.current=t;let l=(0,B.useCallback)(e=>{e.on(`open-file`,({id:e})=>{let t=o.current.get(e);t&&s.current&&(s.current(t),c.current(!1))})},[]);return(0,V.jsx)(sc,{open:e,onOpenChange:t,children:(0,V.jsx)(uc,{className:`!max-w-[98vw] w-[98vw] h-[95vh] max-h-[95vh] p-0 flex flex-col overflow-hidden sm:!max-w-[98vw] !duration-0 data-[state=open]:!zoom-in-100 data-[state=closed]:!zoom-out-100 data-[state=open]:!animate-none data-[state=closed]:!animate-none`,children:(0,V.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto`,children:(0,V.jsx)(`div`,{className:`h-[92vh] min-h-[300px] rounded-md overflow-hidden`,children:e&&(0,V.jsx)(oc,{children:(0,V.jsx)(ac,{data:i,mode:`table`,init:l})})})})})})}var bc=Ne(`inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-2xl text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/90`,destructive:`bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60`,outline:`border-[1.5px] bg-background hover:bg-accent hover:text-accent-foreground dark:bg-card dark:hover:bg-card/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80`,ghost:`hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-9 px-4 py-2 has-[>svg]:px-3`,sm:`h-8 gap-1.5 px-3 has-[>svg]:px-2.5`,lg:`h-10 px-6 has-[>svg]:px-4`,icon:`size-9`}},defaultVariants:{variant:`default`,size:`default`}});function W({className:e,variant:t,size:n,asChild:r=!1,...i}){return(0,V.jsx)(r?we:`button`,{"data-slot":`button`,className:H(bc({variant:t,size:n,className:e})),...i})}function xc({delayDuration:e=0,...t}){return(0,V.jsx)(Et,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function Sc({...e}){return(0,V.jsx)(xc,{children:(0,V.jsx)(lt,{"data-slot":`tooltip`,...e})})}function Cc({...e}){return(0,V.jsx)(yt,{"data-slot":`tooltip-trigger`,...e})}function wc({className:e,sideOffset:t=0,children:n,...r}){return(0,V.jsx)(Ue,{children:(0,V.jsxs)(a,{"data-slot":`tooltip-content`,sideOffset:t,className:H(`bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-2xl px-3 py-1.5 text-xs text-balance`,e),...r,children:[n,(0,V.jsx)(ae,{className:`bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]`})]})})}function Tc({...e}){return(0,V.jsx)(Ze,{"data-slot":`dropdown-menu`,...e})}function Ec({...e}){return(0,V.jsx)(F,{"data-slot":`dropdown-menu-trigger`,...e})}function Dc({className:e,sideOffset:t=4,...n}){return(0,V.jsx)(c,{children:(0,V.jsx)(g,{"data-slot":`dropdown-menu-content`,sideOffset:t,className:H(`bg-card text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-2xl border p-1 shadow-md`,e),...n})})}function Oc({className:e,inset:t,variant:n=`default`,...r}){return(0,V.jsx)(m,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:H(`focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-2xl px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r})}function kc({className:e,children:t,checked:n,...r}){return(0,V.jsxs)(de,{"data-slot":`dropdown-menu-checkbox-item`,className:H(`focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-2xl py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),checked:n,...r,children:[(0,V.jsx)(`span`,{className:`pointer-events-none absolute left-2 flex size-3.5 items-center justify-center`,children:(0,V.jsx)(L,{children:(0,V.jsx)(D,{className:`size-4`})})}),t]})}function Ac({className:e,inset:t,...n}){return(0,V.jsx)($e,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:H(`px-2 py-1.5 text-sm font-medium data-[inset]:pl-8`,e),...n})}function jc({className:e,...t}){return(0,V.jsx)(te,{"data-slot":`dropdown-menu-separator`,className:H(`bg-border -mx-1 my-1 h-px`,e),...t})}var Mc=e=>{switch(e){case`local`:return(0,V.jsx)(Zt,{className:`h-3.5 w-3.5`});case`ssh`:return(0,V.jsx)(on,{className:`h-3.5 w-3.5`});case`s3`:return(0,V.jsx)(Bt,{className:`h-3.5 w-3.5`});case`r2`:return(0,V.jsx)(Ut,{className:`h-3.5 w-3.5`});case`gdocs`:return(0,V.jsx)(Kt,{className:`h-3.5 w-3.5`});case`turso`:return(0,V.jsx)(mn,{className:`h-3.5 w-3.5`});default:return(0,V.jsx)(Zt,{className:`h-3.5 w-3.5`})}},Nc=e=>{switch(e){case`local`:return`Local`;case`ssh`:return`SSH`;case`s3`:return`S3`;case`r2`:return`R2`;case`gdocs`:return`Google Docs`;case`turso`:return`Turso DB`;default:return e}},Pc=[{type:`ai`,label:`AI`,icon:Be},{type:`files`,label:`Files`,icon:Kt},{type:`outline`,label:`Outline`,icon:dn},{type:`openTabs`,label:`Open Tabs`,icon:$t}];function Fc(e,t,n,r){let i=e.includes(n);if(t){if(i){let t=e.filter(e=>e!==n);return t.length===0&&!r?e:t}return[...e,n]}return i?r?[]:e:[n]}function Ic(e,t){return t||e.length<=1?e:[e[0]]}var Lc=({leftPanels:e,onLeftPanelsChange:t,leftSplit:n,onLeftSplitChange:r,rightPanels:i,onRightPanelsChange:a,rightSplit:o,onRightSplitChange:s,showDynamicIsland:c,onToggleDynamicIsland:l,triggerClassName:u,tooltipSide:d=`bottom`,align:f=`end`})=>{let p=n||o||i.length>0;return(0,V.jsxs)(Tc,{children:[(0,V.jsxs)(Sc,{children:[(0,V.jsx)(Cc,{asChild:!0,children:(0,V.jsx)(Ec,{asChild:!0,children:(0,V.jsx)(W,{variant:`ghost`,size:`sm`,className:H(u,p&&`bg-sidebar-accent text-sidebar-foreground`),children:(0,V.jsx)(ne,{className:`h-4 w-4`})})})}),(0,V.jsx)(wc,{side:d,children:(0,V.jsx)(`p`,{children:`Split View Options`})})]}),(0,V.jsxs)(Dc,{align:f,className:`w-64`,children:[(0,V.jsx)(Ac,{className:`text-xs font-semibold text-muted-foreground`,children:`Left Sidebar`}),(0,V.jsx)(kc,{checked:n,onSelect:e=>e.preventDefault(),onCheckedChange:n=>{r(n),t(Ic(e,n))},children:`Split View`}),Pc.map(({type:r,label:i,icon:a})=>(0,V.jsxs)(kc,{checked:e.includes(r),onSelect:e=>e.preventDefault(),onCheckedChange:()=>t(Fc(e,n,r,!1)),children:[(0,V.jsx)(a,{className:`h-4 w-4`}),(0,V.jsx)(`span`,{children:i})]},`left-${r}`)),(0,V.jsx)(jc,{}),(0,V.jsx)(Ac,{className:`text-xs font-semibold text-muted-foreground`,children:`Right Sidebar`}),(0,V.jsx)(kc,{checked:o,onSelect:e=>e.preventDefault(),onCheckedChange:e=>{s(e),a(Ic(i,e))},children:`Split View`}),Pc.map(({type:e,label:t,icon:n})=>(0,V.jsxs)(kc,{checked:i.includes(e),onSelect:e=>e.preventDefault(),onCheckedChange:()=>a(Fc(i,o,e,!0)),children:[(0,V.jsx)(n,{className:`h-4 w-4`}),(0,V.jsx)(`span`,{children:t})]},`right-${e}`)),l&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(jc,{}),(0,V.jsx)(Ac,{className:`text-xs font-semibold text-muted-foreground`,children:`Display`}),(0,V.jsx)(kc,{checked:!!c,onSelect:e=>e.preventDefault(),onCheckedChange:()=>l(),children:`Reading Progress Island`})]})]})]})},Rc=({leftPanels:e,leftSplit:t,onLeftPanelsChange:n,onLeftSplitChange:r,rightPanels:i,rightSplit:a,onRightPanelsChange:o,onRightSplitChange:s,activeId:c,onAdd:l,onSearchFocus:u,onFileManagerOpen:d,sources:f,activeSource:p,activeFileSourceId:m,onFileSourceChange:h,onSourceSelect:g,allExpanded:_,outlineExpanded:v,onToggleAllExpanded:y,onToggleOutlineExpanded:b,treeRef:x,outlineRef:S,deletedDocs:C=[],onRestore:w,showDynamicIsland:T=!1,onToggleDynamicIsland:E,onSettingsClick:O,isMobile:k,openTabs:A=[],activeTab:j,onTabChange:ee,onTabClose:M,documents:N=[]})=>{let te=e=>N.find(t=>t.id===e)?.title||`Untitled`;return(0,V.jsx)(`div`,{className:`flex flex-wrap items-center gap-0.5 px-2 py-1.5 border-b border-sidebar-border`,children:(0,V.jsxs)(xc,{delayDuration:300,children:[(e.includes(`files`)||e.includes(`openTabs`))&&(0,V.jsxs)(V.Fragment,{children:[h&&(0,V.jsxs)(Tc,{children:[(0,V.jsxs)(Sc,{children:[(0,V.jsx)(Cc,{asChild:!0,children:(0,V.jsx)(Ec,{asChild:!0,children:(0,V.jsx)(W,{variant:`ghost`,size:`sm`,className:`size-8 shrink-0 p-0 text-sidebar-foreground/80 hover:text-sidebar-foreground hover:bg-sidebar-accent`,children:p&&Mc(p.type)})})}),(0,V.jsx)(wc,{side:`bottom`,children:(0,V.jsxs)(`p`,{children:[`Storage Source: `,p?.name||`Select Source`]})})]}),(0,V.jsxs)(Dc,{align:`start`,className:`w-56`,children:[f.map((e,t)=>(0,V.jsxs)(`div`,{children:[t>0&&f[t-1]?.type!==e.type&&(0,V.jsx)(jc,{}),(0,V.jsxs)(Oc,{onClick:()=>g(e.id),className:`flex items-center justify-between cursor-pointer`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:[Mc(e.type),(0,V.jsxs)(`div`,{className:`flex flex-col flex-1 min-w-0`,children:[(0,V.jsx)(`span`,{className:`truncate text-sm`,children:e.name}),(0,V.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Nc(e.type)})]})]}),e.id===m&&(0,V.jsx)(D,{className:`h-4 w-4 ml-2 shrink-0`})]})]},e.id)),f.length===1&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(jc,{}),(0,V.jsx)(Oc,{disabled:!0,className:`text-xs text-center text-muted-foreground`,children:`Add sources in Settings`})]})]})]}),(0,V.jsxs)(Sc,{children:[(0,V.jsx)(Cc,{asChild:!0,children:(0,V.jsx)(W,{variant:`ghost`,size:`sm`,onClick:u,className:`size-8 shrink-0 p-0 text-sidebar-foreground/80 hover:text-sidebar-foreground hover:bg-sidebar-accent`,children:(0,V.jsx)(mt,{className:`h-4 w-4`})})}),(0,V.jsx)(wc,{side:`bottom`,children:(0,V.jsx)(`p`,{children:`Search Notes`})})]}),(0,V.jsxs)(Sc,{children:[(0,V.jsx)(Cc,{asChild:!0,children:(0,V.jsx)(W,{variant:`ghost`,size:`sm`,onClick:d,className:`size-8 shrink-0 p-0 text-sidebar-foreground/80 hover:text-sidebar-foreground hover:bg-sidebar-accent`,children:(0,V.jsx)(Xt,{className:`h-4 w-4`})})}),(0,V.jsx)(wc,{side:`bottom`,children:(0,V.jsx)(`p`,{children:`File Manager`})})]}),(0,V.jsxs)(Sc,{children:[(0,V.jsx)(Cc,{asChild:!0,children:(0,V.jsx)(W,{variant:`ghost`,size:`sm`,onClick:()=>l(c,!1),className:`size-8 shrink-0 p-0 text-sidebar-foreground/80 hover:text-sidebar-foreground hover:bg-sidebar-accent`,children:(0,V.jsx)(Gt,{className:`h-4 w-4`})})}),(0,V.jsx)(wc,{side:`bottom`,children:(0,V.jsx)(`p`,{children:`New File`})})]}),(0,V.jsxs)(Sc,{children:[(0,V.jsx)(Cc,{asChild:!0,children:(0,V.jsx)(W,{variant:`ghost`,size:`sm`,onClick:()=>l(c,!0),className:`size-8 shrink-0 p-0 text-sidebar-foreground/80 hover:text-sidebar-foreground hover:bg-sidebar-accent`,children:(0,V.jsx)(Jt,{className:`h-4 w-4`})})}),(0,V.jsx)(wc,{side:`bottom`,children:(0,V.jsx)(`p`,{children:`New Folder`})})]}),(0,V.jsxs)(Sc,{children:[(0,V.jsx)(Cc,{asChild:!0,children:(0,V.jsx)(W,{variant:`ghost`,size:`sm`,onClick:y,className:`size-8 shrink-0 p-0 text-sidebar-foreground/80 hover:text-sidebar-foreground hover:bg-sidebar-accent`,children:_?(0,V.jsx)(P,{className:`h-4 w-4`}):(0,V.jsx)(zt,{className:`h-4 w-4`})})}),(0,V.jsx)(wc,{side:`bottom`,children:(0,V.jsx)(`p`,{children:_?`Collapse All`:`Expand All`})})]}),(0,V.jsxs)(Tc,{children:[(0,V.jsxs)(Sc,{children:[(0,V.jsx)(Cc,{asChild:!0,children:(0,V.jsx)(Ec,{asChild:!0,children:(0,V.jsx)(W,{variant:`ghost`,size:`sm`,className:`size-8 shrink-0 p-0 text-sidebar-foreground/80 hover:text-sidebar-foreground hover:bg-sidebar-accent`,children:(0,V.jsx)(kt,{className:`h-4 w-4`})})})}),(0,V.jsx)(wc,{side:`bottom`,children:(0,V.jsx)(`p`,{children:`Trash`})})]}),(0,V.jsx)(Dc,{align:`end`,className:`w-56`,children:C.length>0?(0,V.jsxs)(V.Fragment,{children:[C.slice(0,5).map(e=>(0,V.jsxs)(Oc,{className:`flex items-center justify-between`,onClick:()=>w?.(e.id),children:[(0,V.jsx)(`span`,{className:`truncate flex-1`,children:e.title||`Untitled`}),(0,V.jsx)(at,{className:`h-3 w-3 ml-2 opacity-60`})]},e.id)),C.length>5&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(jc,{}),(0,V.jsxs)(Oc,{disabled:!0,className:`text-xs text-center`,children:[C.length-5,` more in trash...`]})]})]}):(0,V.jsx)(Oc,{disabled:!0,className:`text-center text-muted-foreground`,children:`Trash is empty`})})]}),A.length>0&&ee&&(0,V.jsxs)(Tc,{children:[(0,V.jsxs)(Sc,{children:[(0,V.jsx)(Cc,{asChild:!0,children:(0,V.jsx)(Ec,{asChild:!0,children:(0,V.jsx)(W,{variant:`ghost`,size:`sm`,className:`size-8 shrink-0 p-0 text-sidebar-foreground/80 hover:text-sidebar-foreground hover:bg-sidebar-accent`,children:(0,V.jsx)(Wt,{className:`h-4 w-4`})})})}),(0,V.jsx)(wc,{side:`bottom`,children:(0,V.jsx)(`p`,{children:`All Open Tabs`})})]}),(0,V.jsx)(Dc,{align:`end`,className:`w-56 max-h-80 overflow-y-auto`,children:A.map(e=>(0,V.jsxs)(Oc,{className:H(`flex items-center justify-between gap-2 cursor-pointer pr-1`,e===j&&`font-semibold text-blue-600`),onSelect:()=>ee(e),children:[(0,V.jsx)(`span`,{className:`truncate flex-1 text-sm`,children:te(e)}),M&&(0,V.jsx)(`button`,{className:`shrink-0 h-5 w-5 flex items-center justify-center rounded hover:bg-destructive/10 hover:text-destructive`,onClick:t=>{t.stopPropagation(),M(e)},children:(0,V.jsx)(Le,{className:`h-3 w-3`})})]},e))})]})]}),(0,V.jsx)(Lc,{leftPanels:e,onLeftPanelsChange:n,leftSplit:t,onLeftSplitChange:r,rightPanels:i,onRightPanelsChange:o,rightSplit:a,onRightSplitChange:s,showDynamicIsland:T,onToggleDynamicIsland:E,triggerClassName:`size-8 shrink-0 p-0 text-sidebar-foreground/80 hover:text-sidebar-foreground hover:bg-sidebar-accent`,tooltipSide:`bottom`}),e.includes(`outline`)&&(0,V.jsxs)(Sc,{children:[(0,V.jsx)(Cc,{asChild:!0,children:(0,V.jsx)(W,{variant:`ghost`,size:`sm`,onClick:b,className:`size-8 shrink-0 p-0 text-sidebar-foreground/80 hover:text-sidebar-foreground hover:bg-sidebar-accent`,children:v?(0,V.jsx)(P,{className:`h-4 w-4`}):(0,V.jsx)(zt,{className:`h-4 w-4`})})}),(0,V.jsx)(wc,{side:`bottom`,children:(0,V.jsx)(`p`,{children:v?`Collapse All`:`Expand All`})})]})]})})},zc=Object.defineProperty,Bc=Object.defineProperties,Vc=Object.getOwnPropertyDescriptors,Hc=Object.getOwnPropertySymbols,Uc=Object.prototype.hasOwnProperty,Wc=Object.prototype.propertyIsEnumerable,Gc=(e,t,n)=>t in e?zc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,G=(e,t)=>{for(var n in t||={})Uc.call(t,n)&&Gc(e,n,t[n]);if(Hc)for(var n of Hc(t))Wc.call(t,n)&&Gc(e,n,t[n]);return e},Kc=(e,t)=>Bc(e,Vc(t)),qc=(e,t,n)=>new Promise((r,i)=>{var a=e=>{try{s(n.next(e))}catch(e){i(e)}},o=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(a,o);s((n=n.apply(e,t)).next())});function Jc(e,t){return typeof e==`function`?e(t):e}function Yc(e,t){return n=>{t.setState(t=>Kc(G({},t),{[e]:Jc(n,t[e])}))}}var Xc=(e,t=100,n=1e3)=>new Promise(r=>{let i,a=setInterval(()=>{e()&&(r(),clearInterval(a),clearTimeout(i))},t);i=setTimeout(()=>{clearInterval(a),r()},n)}),Zc=`Headless Tree: `,Qc=e=>Error(Zc+e),$c=e=>console.warn(Zc+e),el={key:`tree`,getInitialState:e=>G({expandedItems:[],focusedItem:null},e),getDefaultConfig:(e,t)=>G({setExpandedItems:Yc(`expandedItems`,t),setFocusedItem:Yc(`focusedItem`,t)},e),stateHandlerNames:{expandedItems:`setExpandedItems`,focusedItem:`setFocusedItem`},treeInstance:{getItemsMeta:({tree:e})=>{let{rootItemId:t}=e.getConfig(),{expandedItems:n}=e.getState(),r=[],i=new Set(n),a=(t,n,o,s,c)=>{if(n.includes(t)){$c(`Circular reference for ${n.join(`.`)}`);return}if(r.push({itemId:t,level:o,index:r.length,parentId:n.at(-1),setSize:s,posInSet:c}),i.has(t)){let r=e.retrieveChildrenIds(t)??[],i=0;for(let e of r)a(e,n.concat(t),o+1,r.length,i++)}},o=e.retrieveChildrenIds(t),s=0;for(let e of o)a(e,[t],0,o.length,s++);return r},getFocusedItem:({tree:e})=>{let t=e.getState().focusedItem;return(t===null?null:e.getItemInstance(t))??e.getItems()[0]},getRootItem:({tree:e})=>{let{rootItemId:t}=e.getConfig();return e.getItemInstance(t)},focusNextItem:({tree:e})=>{var t;let n=e.getFocusedItem().getItemMeta();if(!n)return;let r=Math.min(n.index+1,e.getItems().length-1);(t=e.getItems()[r])==null||t.setFocused()},focusPreviousItem:({tree:e})=>{var t;let n=e.getFocusedItem().getItemMeta();if(!n)return;let r=Math.max(n.index-1,0);(t=e.getItems()[r])==null||t.setFocused()},updateDomFocus:({tree:e})=>{setTimeout(()=>qc(null,null,function*(){var t,n,r,i;let a=e.getFocusedItem();(n=(t=e.getConfig()).scrollToItem)==null||n.call(t,a),yield Xc(()=>a.getElement()!==null,20,500);let o=a.getElement();if(!o){(r=e.getItems()[0])==null||r.setFocused(),(i=e.getItems()[0]?.getElement())==null||i.focus();return}o.focus()}))},getContainerProps:({prev:e,tree:t},n)=>Kc(G({},e?.()),{role:`tree`,"aria-label":n??``,ref:t.registerElement}),isSearchOpen:()=>!1},itemInstance:{scrollTo:(e,t)=>qc(null,[e,t],function*({tree:e,item:t},n){var r,i,a;(i=(r=e.getConfig()).scrollToItem)==null||i.call(r,t),yield Xc(()=>t.getElement()!==null,20),(a=t.getElement())==null||a.scrollIntoView(n)}),getId:({itemId:e})=>e,getKey:({itemId:e})=>e,getProps:({item:e,prev:t})=>{let n=e.getItemMeta();return Kc(G({},t?.()),{ref:e.registerElement,role:`treeitem`,"aria-setsize":n.setSize,"aria-posinset":n.posInSet+1,"aria-selected":`false`,"aria-label":e.getItemName(),"aria-level":n.level+1,"aria-expanded":e.isFolder()?e.isExpanded():void 0,tabIndex:e.isFocused()?0:-1,onClick:t=>{e.setFocused(),e.primaryAction(),!(t.ctrlKey||t.shiftKey||t.metaKey)&&e.isFolder()&&(e.isExpanded()?e.collapse():e.expand())}})},expand:({tree:e,item:t,itemId:n})=>{t.isFolder()&&(e.getState().loadingItemChildrens?.includes(n)||(e.applySubStateUpdate(`expandedItems`,e=>[...e,n]),e.rebuildTree()))},collapse:({tree:e,item:t,itemId:n})=>{t.isFolder()&&(e.applySubStateUpdate(`expandedItems`,e=>e.filter(e=>e!==n)),e.rebuildTree())},getItemData:({tree:e,itemId:t})=>e.retrieveItemData(t),equals:({item:e},t)=>e.getId()===t?.getId(),isExpanded:({tree:e,itemId:t})=>e.getState().expandedItems.includes(t),isDescendentOf:({item:e},t)=>{let n=e.getParent();return!!(n?.getId()===t||n?.isDescendentOf(t))},isFocused:({tree:e,item:t,itemId:n})=>e.getState().focusedItem===n||e.getState().focusedItem===null&&t.getItemMeta().index===0,isFolder:({tree:e,item:t,itemId:n})=>n===e.getConfig().rootItemId||e.getConfig().isItemFolder(t),getItemName:({tree:e,item:t})=>e.getConfig().getItemName(t),setFocused:({tree:e,itemId:t})=>{e.applySubStateUpdate(`focusedItem`,t)},primaryAction:({tree:e,item:t})=>{var n;return(n=e.getConfig()).onPrimaryAction?.call(n,t)},getParent:({tree:e,item:t})=>t.getItemMeta().parentId?e.getItemInstance(t.getItemMeta().parentId):void 0,getIndexInParent:({item:e})=>e.getItemMeta().posInSet,getChildren:({tree:e,itemId:t})=>e.retrieveChildrenIds(t).map(t=>e.getItemInstance(t)),getTree:({tree:e})=>e,getItemAbove:({tree:e,item:t})=>e.getItems()[t.getItemMeta().index-1],getItemBelow:({tree:e,item:t})=>e.getItems()[t.getItemMeta().index+1]},hotkeys:{focusNextItem:{hotkey:`ArrowDown`,canRepeat:!0,preventDefault:!0,isEnabled:e=>!(e.isSearchOpen?.call(e)??!1)&&!e.getState().dnd,handler:(e,t)=>{t.focusNextItem(),t.updateDomFocus()}},focusPreviousItem:{hotkey:`ArrowUp`,canRepeat:!0,preventDefault:!0,isEnabled:e=>!(e.isSearchOpen?.call(e)??!1)&&!e.getState().dnd,handler:(e,t)=>{t.focusPreviousItem(),t.updateDomFocus()}},expandOrDown:{hotkey:`ArrowRight`,canRepeat:!0,handler:(e,t)=>{let n=t.getFocusedItem();n.isExpanded()||!n.isFolder()?(t.focusNextItem(),t.updateDomFocus()):n.expand()}},collapseOrUp:{hotkey:`ArrowLeft`,canRepeat:!0,handler:(e,t)=>{var n;let r=t.getFocusedItem();(!r.isExpanded()||!r.isFolder())&&r.getItemMeta().level!==0?((n=r.getParent())==null||n.setFocused(),t.updateDomFocus()):r.collapse()}},focusFirstItem:{hotkey:`Home`,handler:(e,t)=>{var n;(n=t.getItems()[0])==null||n.setFocused(),t.updateDomFocus()}},focusLastItem:{hotkey:`End`,handler:(e,t)=>{var n;(n=t.getItems()[t.getItems().length-1])==null||n.setFocused(),t.updateDomFocus()}}}},tl=(e,t,n)=>{let r={};return[r,()=>{let i=n(r);featureLoop:for(let n=0;n<e.length;n++){let a=e[n][t];if(!a)continue featureLoop;methodLoop:for(let[e,t]of Object.entries(a)){if(!t)continue methodLoop;let n=r[e];r[e]=(...e)=>t(Kc(G({},i),{prev:n}),...e)}}}]},nl=e=>{let t=e?.map(e=>e.key);for(let n of e??[]){let e=n.deps?.find(e=>!t?.includes(e));if(e)throw Qc(`${n.key} needs ${e}`)}},rl=(e,t)=>{let n=e.length;for(let r=0;r<n;r++)for(let i=r+1;i<n;i++)t(e[i],e[r])<0&&([e[r],e[i]]=[e[i],e[r]]);return e},il=e=>(t,n)=>n.key&&t.overwrites?.includes(n.key)?1:t.key&&n.overwrites?.includes(t.key)?-1:e.indexOf(t)-e.indexOf(n),al=(e=[])=>rl(e,il(e)),ol=e=>{let t=e.instanceBuilder??tl,n=[el,...al(e.features)];nl(n);let r=[...n],[i,a]=t(r,`treeInstance`,e=>({tree:e})),o=n.reduce((e,t)=>t.getInitialState?.call(t,e,i)??e,e.initialState??e.state??{}),s=n.reduce((e,t)=>t.getDefaultConfig?.call(t,e,i)??e,e),c=n.reduce((e,t)=>G(G({},e),t.stateHandlerNames),{}),l,u={current:{}},d=!1,f={},p=[],m={},h={},g={},_={},v=()=>{p=[],g={};let[e,n]=t(r,`itemInstance`,e=>({item:e,tree:i,itemId:s.rootItemId}));n(),f[s.rootItemId]=e,g[s.rootItemId]={itemId:s.rootItemId,index:-1,parentId:null,level:-1,posInSet:0,setSize:1};for(let e of i.getItemsMeta())if(g[e.itemId]=e,f[e.itemId])p.push(f[e.itemId]);else{let[n,a]=t(r,`itemInstance`,t=>({item:t,tree:i,itemId:e.itemId}));a(),f[e.itemId]=n,p.push(n)}d=!1},y=e=>{for(let t of n)e(t)};r.unshift({key:`main`,treeInstance:{getState:()=>o,setState:({},e)=>{var t;(t=s.setState)==null||t.call(s,o)},setMounted:({},e)=>{var t;let n=u.current;n.isMounted=e,e&&((t=n.waitingForMount)==null||t.forEach(e=>e()),n.waitingForMount=[])},applySubStateUpdate:({},e,t)=>{let n=()=>{o[e]=typeof t==`function`?t(o[e]):t;let n=s[c[e]];n?.(o[e])},r=u.current;r.isMounted?n():(r.waitingForMount??=[],r.waitingForMount.push(n))},rebuildTree:()=>{var e;let t=u.current;t.isMounted?(v(),(e=s.setState)==null||e.call(s,o)):(t.waitingForMount??=[],t.waitingForMount.push(()=>{var e;v(),(e=s.setState)==null||e.call(s,o)}))},scheduleRebuildTree:()=>{d=!0},getConfig:()=>s,setConfig:(e,t)=>{var n;let r=typeof t==`function`?t(s):t,i=r.state?.expandedItems&&r.state?.expandedItems!==o.expandedItems;s=r,r.state&&(o=G(G({},o),r.state)),i&&(v(),(n=s.setState)==null||n.call(s,o))},getItemInstance:({},e)=>{let n=f[e];if(!n){let[n,a]=t(r,`itemInstance`,t=>({item:t,tree:i,itemId:e}));return a(),n}return n},getItems:()=>(d&&v(),p),registerElement:({},e)=>{l!==e&&(l&&!e?y(e=>e.onTreeUnmount?.call(e,i,l)):!l&&e&&y(t=>t.onTreeMount?.call(t,i,e)),l=e)},getElement:()=>l,getDataRef:()=>u,getHotkeyPresets:()=>_},itemInstance:{registerElement:({itemId:e,item:t},n)=>{if(m[e]===n)return;let r=m[e];r&&!n?y(e=>e.onItemUnmount?.call(e,t,r,i)):!r&&n&&y(e=>e.onItemMount?.call(e,t,n,i)),m[e]=n},getElement:({itemId:e})=>m[e],getDataRef:({itemId:e})=>h[e]??(h[e]={current:{}}),getItemMeta:({itemId:e})=>g[e]??{itemId:e,parentId:null,level:-1,index:-1,posInSet:0,setSize:1}}});for(let e of r)Object.assign(_,e.hotkeys??{});return a(),i},sl=(e=>(e[e.None=0]=`None`,e[e.Started=1]=`Started`,e[e.Dragging=2]=`Dragging`,e[e.Completed=3]=`Completed`,e[e.Aborted=4]=`Aborted`,e))(sl||{}),cl={key:`selection`,getInitialState:e=>G({selectedItems:[]},e),getDefaultConfig:(e,t)=>G({setSelectedItems:Yc(`selectedItems`,t)},e),stateHandlerNames:{selectedItems:`setSelectedItems`},treeInstance:{setSelectedItems:({tree:e},t)=>{e.applySubStateUpdate(`selectedItems`,t)},getSelectedItems:({tree:e})=>e.getState().selectedItems.map(e.getItemInstance)},itemInstance:{select:({tree:e,itemId:t})=>{let{selectedItems:n}=e.getState();e.setSelectedItems(n.includes(t)?n:[...n,t])},deselect:({tree:e,itemId:t})=>{let{selectedItems:n}=e.getState();e.setSelectedItems(n.filter(e=>e!==t))},isSelected:({tree:e,itemId:t})=>{let{selectedItems:n}=e.getState();return n.includes(t)},selectUpTo:({tree:e,item:t,itemId:n},r)=>{let i=t.getItemMeta().index,a=e.getDataRef();if(!a.current.selectUpToAnchorId){a.current.selectUpToAnchorId=n,e.setSelectedItems([n]);return}let o=e.getItemInstance(a.current.selectUpToAnchorId).getItemMeta().index,[s,c]=i<o?[i,o]:[o,i],l=e.getItems().slice(s,c+1).map(e=>e.getItemMeta().itemId);if(!r){e.setSelectedItems(l);return}let{selectedItems:u}=e.getState(),d=[...new Set([...u,...l])];e.setSelectedItems(d)},toggleSelect:({item:e})=>{e.isSelected()?e.deselect():e.select()},getProps:({tree:e,item:t,itemId:n,prev:r})=>Kc(G({},r?.()),{"aria-selected":t.isSelected()?`true`:`false`,onClick:i=>{var a,o;i.shiftKey?t.selectUpTo(i.ctrlKey||i.metaKey):i.ctrlKey||i.metaKey?t.toggleSelect():e.setSelectedItems([n]),i.shiftKey||(e.getDataRef().current.selectUpToAnchorId=n),(o=(a=r?.())?.onClick)==null||o.call(a,i)}})},hotkeys:{toggleSelectedItem:{hotkey:`Control+Space`,preventDefault:!0,handler:(e,t)=>{t.getFocusedItem().toggleSelect()}},selectUpwards:{hotkey:`Shift+ArrowUp`,handler:(e,t)=>{let n=t.getFocusedItem(),r=n.getItemAbove();r&&(n.isSelected()&&r.isSelected()?n.deselect():r.select(),r.setFocused(),t.updateDomFocus())}},selectDownwards:{hotkey:`Shift+ArrowDown`,handler:(e,t)=>{let n=t.getFocusedItem(),r=n.getItemBelow();r&&(n.isSelected()&&r.isSelected()?n.deselect():r.select(),r.setFocused(),t.updateDomFocus())}},selectAll:{hotkey:`Control+KeyA`,preventDefault:!0,handler:(e,t)=>{t.setSelectedItems(t.getItems().map(e=>e.getId()))}}}},ll=e=>e.code!==``&&e.code!==`Unidentified`?e.code:e.key,ul={letter:/^Key[A-Z]$/,letterornumber:/^(Key[A-Z]|Digit[0-9])$/,plus:/^(NumpadAdd|Plus)$/,minus:/^(NumpadSubtract|Minus)$/,control:/^(ControlLeft|ControlRight)$/,shift:/^(ShiftLeft|ShiftRight)$/,metaorcontrol:/^(MetaLeft|MetaRight|ControlLeft|ControlRight)$/,enter:/^(Enter|NumpadEnter)$/},dl=new Set([`MetaLeft`,`MetaRight`,`Meta`,`ControlLeft`,`ControlRight`,`Control`,`AltLeft`,`AltRight`,`Alt`,`ShiftLeft`,`ShiftRight`,`Shift`]),fl=(e,t,n)=>{let r=n.hotkey.toLowerCase().split(`+`),i=r.every(t=>{if(t in ul)return[...e].some(e=>ul[t].test(e));let n=[...e].map(e=>e.toLowerCase());return n.includes(t.toLowerCase())||n.includes(`key${t.toLowerCase()}`)}),a=!n.isEnabled||n.isEnabled(t);return i&&a&&e.size===r.length},pl=(e,t,n,r)=>Object.entries(G(G({},n),r)).find(([,n])=>fl(e,t,n))?.[0],ml={clearPressedKeys:e=>{e.current.pressedKeys=new Set},dispatchKeyDown:(e,t,n,r={})=>{var i,a;let{isInputFocused:o=!1,releaseAfterDispatch:s=!1}=r,{ignoreHotkeysOnInputs:c,onTreeHotkey:l,hotkeys:u}=e.getConfig();if(o&&c)return;let d=ll({code:n.code??``,key:n.key??``});(i=t.current).pressedKeys??(i.pressedKeys=new Set);let f=!t.current.pressedKeys.has(d);d&&t.current.pressedKeys.add(d);let p=pl(t.current.pressedKeys,e,e.getHotkeyPresets(),u);if(s&&d&&t.current.pressedKeys.delete(d),!p)return;let m=G(G({},e.getHotkeyPresets()[p]),u?.[p]);m&&(!m.allowWhenInputFocused&&o||!m.canRepeat&&!f||(m.preventDefault&&((a=n.preventDefault)==null||a.call(n)),m.handler(n,e),l?.(p,n)))},dispatchKeyUp:(e,t)=>{var n;let r=ll({code:t.code??``,key:t.key??``});r&&((n=e.current).pressedKeys??(n.pressedKeys=new Set),dl.has(r)&&(e.current.pressedKeys=new Set([...e.current.pressedKeys].filter(e=>dl.has(e)))),e.current.pressedKeys.delete(r))}},hl={key:`hotkeys-core`,onTreeMount:(e,t)=>{let n=e.getDataRef(),r=t=>{let r=t.target instanceof HTMLInputElement;ml.dispatchKeyDown(e,n,t,{isInputFocused:r,releaseAfterDispatch:r})},i=e=>{ml.dispatchKeyUp(n,e)},a=()=>{ml.clearPressedKeys(n)};t.addEventListener(`keydown`,r),document.addEventListener(`keyup`,i),window.addEventListener(`focus`,a),n.current.keydownHandler=r,n.current.keyupHandler=i,n.current.resetHandler=a},onTreeUnmount:(e,t)=>{let n=e.getDataRef();n.current.keyupHandler&&(document.removeEventListener(`keyup`,n.current.keyupHandler),delete n.current.keyupHandler),n.current.keydownHandler&&(t.removeEventListener(`keydown`,n.current.keydownHandler),delete n.current.keydownHandler),n.current.resetHandler&&(window.removeEventListener(`focus`,n.current.resetHandler),delete n.current.resetHandler)}},gl=`sync dataLoader returned undefined`,_l=`sync dataLoader returned promise`,vl=e=>{if(!e)throw Qc(gl);if(typeof e==`object`&&`then`in e)throw Qc(_l);return e},yl={key:`sync-data-loader`,getInitialState:e=>G({loadingItemData:[],loadingItemChildrens:[]},e),getDefaultConfig:(e,t)=>G({setLoadingItemData:Yc(`loadingItemData`,t),setLoadingItemChildrens:Yc(`loadingItemChildrens`,t)},e),stateHandlerNames:{loadingItemData:`setLoadingItemData`,loadingItemChildrens:`setLoadingItemChildrens`},treeInstance:{waitForItemDataLoaded:()=>qc(null,null,function*(){}),waitForItemChildrenLoaded:()=>qc(null,null,function*(){}),retrieveItemData:({tree:e},t)=>vl(e.getConfig().dataLoader.getItem(t)),retrieveChildrenIds:({tree:e},t)=>{let{dataLoader:n}=e.getConfig();return`getChildren`in n?vl(n.getChildren(t)):vl(n.getChildrenWithData(t)).map(e=>e.data)},loadItemData:({tree:e},t)=>e.retrieveItemData(t),loadChildrenIds:({tree:e},t)=>e.retrieveChildrenIds(t)},itemInstance:{isLoading:()=>!1,hasLoadedData:()=>!0}},bl=e=>`childIndex`in e,xl=(e,t,n)=>{let r=n.getState().dnd?.draggedItems,i=n.getConfig();return!(r&&!(i.canDrop?.call(i,r,t)??!0)||r&&r.some(e=>t.item.getId()===e.getId()||t.item.isDescendentOf(e.getId()))||!r&&e&&i.canDropForeignDragObject&&!i.canDropForeignDragObject(e,t))},Sl=e=>e.isExpanded()?1:e.getParent()&&e.getIndexInParent()===e.getItemMeta().setSize-1?2:0,Cl=(e,t,n)=>t-(e.slice(0,t).reduce((e,t)=>t&&n?.some(e=>e.getId()===t.getId())?++e:e,0)??0),wl=(e,t,n,r)=>{let i=n.getConfig();if(!i.canReorder)return r?{type:2}:{type:1};let a=t.getElement()?.getBoundingClientRect(),o=a?(e.clientY-a.top)/a.height:.5,s=a?e.clientX-a.left:0,c=Sl(t),l=r?i.reorderAreaPercentage??.3:.5,u=i.indent??20,d=r?2:1;if(c===1)return o<l?{type:0}:{type:d};if(c===2&&s<t.getItemMeta().level*u){if(o<.5)return{type:0};let e=t.getItemBelow()?.getItemMeta().level??0;return{type:3,reparentLevel:Math.max(e,Math.floor(s/u))}}return o<l?{type:0}:o>1-l?{type:1}:{type:d}},Tl=(e,t)=>[e.getId(),t.type,t.type===3?t.reparentLevel:0].join(`__`),El=(e,t)=>t===e.getItemMeta().level?e:El(e.getParent(),t),Dl=(e,t,n)=>{let r=e.getItemMeta(),i=El(e,t-1),a=El(e,t).getIndexInParent()+1;return{item:i,childIndex:a,insertionIndex:Cl(i.getChildren(),a,n),dragLineIndex:r.index+1,dragLineLevel:t}},Ol=(e,t,n,r,i=n.getConfig().canReorder)=>{let a=r?e.dataTransfer:null,o=n.getState().dnd?.draggedItems,s=t.getItemMeta(),c=t.getParent(),l={item:t},u=c?{item:c}:null,d=u&&xl(a,u,n),f=wl(e,t,n,xl(a,l,n));if(!i&&c&&d&&f.type!==2)return o?.some(e=>e.isDescendentOf(c.getId()))?l:u;if(f.type===2)return l;if(!i&&c&&!d)return Ol(e,c,n,r,!1);if(!c)return l;if(!d)return Ol(e,c,n,r,!1);if(f.type===3)return Dl(t,f.reparentLevel,o);let p=f.type===0?0:1,m=t.getIndexInParent()+p;return{item:c,dragLineIndex:s.index+p,dragLineLevel:s.level,childIndex:m,insertionIndex:Cl(c.getChildren(),m,o)}},kl=(e,t,n,r)=>{let{openOnDropDelay:i}=t.getConfig(),a=e.current.lastDragCode;!i||!n.isFolder()||n.isExpanded()||r.type!==2||(clearTimeout(e.current.autoExpandTimeout),e.current.autoExpandTimeout=setTimeout(()=>{a!==e.current.lastDragCode||!e.current.lastAllowDrop||n.expand()},i))},Al=()=>!1,jl={key:`drag-and-drop`,getDefaultConfig:(e,t)=>G({canDrop:(e,t)=>t.item.isFolder(),canDropForeignDragObject:Al,canDragForeignDragObjectOver:e.canDropForeignDragObject===Al?()=>!1:e=>e.effectAllowed!==`none`,setDndState:Yc(`dnd`,t),canReorder:!0,openOnDropDelay:800,draggedItemOverwritesSelection:!0},e),stateHandlerNames:{dnd:`setDndState`},onTreeMount:e=>{let t=()=>{e.applySubStateUpdate(`dnd`,null)};e.getDataRef().current.windowDragEndListener=t,window.addEventListener(`dragend`,t)},onTreeUnmount:e=>{let{windowDragEndListener:t}=e.getDataRef().current;t&&window.removeEventListener(`dragend`,t)},treeInstance:{getDragTarget:({tree:e})=>e.getState().dnd?.dragTarget??null,getDragLineData:({tree:e})=>{let t=e.getDragTarget(),n=(t?.item.getItemMeta().level??0)+1,r=e.getElement()?.getBoundingClientRect();if(!t||!r||!bl(t))return null;let i=t.dragLineLevel*(e.getConfig().indent??1),a=e.getItems()[t.dragLineIndex];if(!a){let a=(e.getItems()[t.dragLineIndex-1]?.getElement())?.getBoundingClientRect();if(a)return{indent:n,top:a.bottom-r.top,left:a.left+i-r.left,width:a.width-i}}let o=(a?.getElement())?.getBoundingClientRect();return o?{indent:n,top:o.top-r.top,left:o.left+i-r.left,width:o.width-i}:null},getDragLineStyle:({tree:e},t=-1,n=-8)=>{let r=e.getDragLineData();return r?{position:`absolute`,top:`${r.top+t}px`,left:`${r.left+n}px`,width:`${r.width-n}px`,pointerEvents:`none`}:{display:`none`}},getContainerProps:({prev:e,tree:t},n)=>{let r=e?.(n);return Kc(G({},r),{onDragOver:e=>{e.preventDefault()},onDrop:e=>qc(null,null,function*(){let n=t.getDataRef(),r={item:t.getRootItem()};if(!xl(e.dataTransfer,r,t))return;e.preventDefault();let i=t.getConfig(),a=t.getState().dnd?.draggedItems;n.current.lastDragCode=void 0,a?yield i.onDrop?.call(i,a,r):e.dataTransfer&&(yield i.onDropForeignDragObject?.call(i,e.dataTransfer,r))}),style:Kc(G({},r?.style),{position:`relative`})})}},itemInstance:{getProps:({tree:e,item:t,prev:n})=>Kc(G(G({},n?.()),e.getConfig().seperateDragHandle?{}:t.getDragHandleProps()),{onDragEnter:e=>e.preventDefault(),onDragOver:n=>{var r;n.stopPropagation();let i=e.getDataRef(),a=wl(n,t,e,!0),o=Tl(t,a);if(o===i.current.lastDragCode){i.current.lastAllowDrop&&n.preventDefault();return}i.current.lastDragCode=o,i.current.lastDragEnter=Date.now(),kl(i,e,t,a);let s=Ol(n,t,e,!1);if(!e.getState().dnd?.draggedItems&&(!n.dataTransfer||!(r=e.getConfig()).canDragForeignDragObjectOver?.call(r,n.dataTransfer,s))){i.current.lastAllowDrop=!1;return}if(!xl(null,s,e)){i.current.lastAllowDrop=!1;return}e.applySubStateUpdate(`dnd`,e=>Kc(G({},e),{dragTarget:s,draggingOverItem:t})),i.current.lastAllowDrop=!0,n.preventDefault()},onDragLeave:()=>{setTimeout(()=>{let t=e.getDataRef();(t.current.lastDragEnter??0)+100>=Date.now()||(t.current.lastDragCode=`no-drag`,e.applySubStateUpdate(`dnd`,e=>Kc(G({},e),{draggingOverItem:void 0,dragTarget:void 0})))},100)},onDrop:n=>qc(null,null,function*(){n.stopPropagation();let r=e.getDataRef(),i=Ol(n,t,e,!0),a=e.getState().dnd?.draggedItems,o=xl(n.dataTransfer,i,e);if(e.applySubStateUpdate(`dnd`,{draggedItems:void 0,draggingOverItem:void 0,dragTarget:void 0}),!o)return;n.preventDefault();let s=e.getConfig();r.current.lastDragCode=void 0,a?(yield s.onDrop?.call(s,a,i),a[0].setFocused()):n.dataTransfer&&(yield s.onDropForeignDragObject?.call(s,n.dataTransfer,i)),e.applySubStateUpdate(`dnd`,null),e.updateDomFocus()})}),getDragHandleProps:({tree:e,item:t,prev:n})=>Kc(G({},n?.()),{draggable:!0,onDragStart:n=>{var r,i;let{draggedItemOverwritesSelection:a}=e.getConfig(),o=e.getSelectedItems?e.getSelectedItems():[e.getFocusedItem()],s=!o.includes(t)&&a,c=s?[t]:o,l=e.getConfig();if(s&&((r=e.setSelectedItems)==null||r.call(e,[t.getItemMeta().itemId])),!(l.canDrag?.call(l,c)??!0)){n.preventDefault();return}if(l.setDragImage){let{imgElement:e,xOffset:t,yOffset:r}=l.setDragImage(c);(i=n.dataTransfer)==null||i.setDragImage(e,t??0,r??0)}if(l.createForeignDragObject&&n.dataTransfer){let{format:e,data:t,dropEffect:r,effectAllowed:i}=l.createForeignDragObject(c);n.dataTransfer.setData(e,t),r&&(n.dataTransfer.dropEffect=r),i&&(n.dataTransfer.effectAllowed=i)}e.applySubStateUpdate(`dnd`,{draggedItems:c,draggingOverItem:e.getFocusedItem()})},onDragEnd:n=>{let{onCompleteForeignDrop:r,canDragForeignDragObjectOver:i}=e.getConfig(),a=e.getState().dnd?.draggedItems;if(n.dataTransfer?.dropEffect===`none`||!a)return;let o=Ol(n,t,e,!1);i&&n.dataTransfer&&!i(n.dataTransfer,o)||r?.(a)}}),isDragTarget:({tree:e,item:t})=>{let n=e.getDragTarget();return n?n.item.getId()===t.getId():!1},isUnorderedDragTarget:({tree:e,item:t})=>{let n=e.getDragTarget();return n?!bl(n)&&n.item.getId()===t.getId():!1},isDragTargetAbove:({tree:e,item:t})=>{let n=e.getDragTarget();return!n||!bl(n)||n.item!==t.getParent()?!1:n.childIndex===t.getItemMeta().posInSet},isDragTargetBelow:({tree:e,item:t})=>{let n=e.getDragTarget();return!n||!bl(n)||n.item!==t.getParent()?!1:n.childIndex-1===t.getItemMeta().posInSet},isDraggingOver:({tree:e,item:t})=>(e.getState().dnd?.draggingOverItem)?.getId()===t.getId()}},Ml=(e,t,n)=>{let r=+!t,i=e.getState().dnd?.draggedItems;if(bl(n)){let a=n.item.getParent(),o=e.getItems()[n.dragLineIndex-1],s=o?Sl(o):0,c=o?.getItemMeta().level??0,l=(o?.getItemBelow())?.getItemMeta().level??0;if(s===2){if(t&&n.dragLineLevel<c)return Dl(o,n.dragLineLevel+1,i);if(!t&&n.dragLineLevel>l&&a)return Dl(o,n.dragLineLevel-1,i)}let u=n.dragLineIndex-1+r,d=e.getItems()[u];return d?{item:d}:void 0}if(Sl(n.item)===1&&!t)return{item:n.item,childIndex:0,insertionIndex:Cl(n.item.getChildren(),0,i),dragLineIndex:n.item.getItemMeta().index+r,dragLineLevel:n.item.getItemMeta().level+1};let a=n.item.getIndexInParent()+r;return{item:n.item.getParent(),childIndex:a,insertionIndex:Cl(n.item.getParent().getChildren(),a,i),dragLineIndex:n.item.getItemMeta().index+r,dragLineLevel:n.item.getItemMeta().level}},Nl=(e,t,n=(t=>(t=e.getState().dnd)?.dragTarget)())=>{if(!n)return;let r=Ml(e,t,n),i=e.getDataRef().current.kDndDataTransfer??null;if(r)return xl(i,r,e)?r:Nl(e,t,r)},Pl=e=>{let t=e.getState().dnd;!t?.dragTarget||bl(t.dragTarget)||t.dragTarget.item.scrollTo({block:`nearest`,inline:`nearest`})},Fl=(e,t,n)=>{var r,i;let a=e.getFocusedItem(),{canDrag:o}=e.getConfig();if(t&&o&&!o(t))return;t?(e.applySubStateUpdate(`dnd`,{draggedItems:t}),(i=(r=e.getConfig()).onStartKeyboardDrag)==null||i.call(r,t)):n&&(e.getDataRef().current.kDndDataTransfer=n);let s=Nl(e,!1,{item:a});s&&(e.applySubStateUpdate(`dnd`,{draggedItems:t,dragTarget:s}),e.applySubStateUpdate(`assistiveDndState`,1),Pl(e))},Il=(e,t)=>{let n=Nl(e,t);n&&(e.applySubStateUpdate(`dnd`,{draggedItems:e.getState().dnd?.draggedItems,dragTarget:n}),e.applySubStateUpdate(`assistiveDndState`,2),bl(n)||n.item.setFocused(),Pl(e))},Ll={key:`keyboard-drag-and-drop`,deps:[`drag-and-drop`],getDefaultConfig:(e,t)=>G({setAssistiveDndState:Yc(`assistiveDndState`,t)},e),stateHandlerNames:{assistiveDndState:`setAssistiveDndState`},treeInstance:{startKeyboardDrag:({tree:e},t)=>{Fl(e,t,void 0)},startKeyboardDragOnForeignObject:({tree:e},t)=>{Fl(e,void 0,t)},stopKeyboardDrag:({tree:e})=>{e.getDataRef().current.kDndDataTransfer=void 0,e.applySubStateUpdate(`dnd`,null),e.applySubStateUpdate(`assistiveDndState`,0)}},hotkeys:{startDrag:{hotkey:`Control+Shift+KeyD`,preventDefault:!0,isEnabled:e=>!e.getState().dnd,handler:(e,t)=>{let n=t.getSelectedItems?.call(t)??[t.getFocusedItem()],r=t.getFocusedItem();t.startKeyboardDrag(n.includes(r)?n:n.concat(r))}},dragUp:{hotkey:`ArrowUp`,preventDefault:!0,isEnabled:e=>!!e.getState().dnd,handler:(e,t)=>{Il(t,!0)}},dragDown:{hotkey:`ArrowDown`,preventDefault:!0,isEnabled:e=>!!e.getState().dnd,handler:(e,t)=>{Il(t,!1)}},cancelDrag:{hotkey:`Escape`,isEnabled:e=>!!e.getState().dnd,handler:(e,t)=>{t.stopKeyboardDrag()}},completeDrag:{hotkey:`Enter`,preventDefault:!0,isEnabled:e=>!!e.getState().dnd,handler:(e,t)=>qc(null,null,function*(){e.stopPropagation();let n=t.getDataRef(),r=t.getDragTarget(),i=n.current.kDndDataTransfer??null;if(!r||!xl(i,r,t))return;let a=t.getConfig(),o=t.getState().dnd?.draggedItems;n.current.lastDragCode=void 0,t.applySubStateUpdate(`dnd`,null),o?(yield a.onDrop?.call(a,o,r),t.getItemInstance(o[0].getId()).setFocused()):i&&(yield a.onDropForeignDragObject?.call(a,i,r)),t.updateDomFocus(),t.applySubStateUpdate(`assistiveDndState`,3)})}}},Rl={key:`renaming`,overwrites:[`drag-and-drop`],getDefaultConfig:(e,t)=>G({setRenamingItem:Yc(`renamingItem`,t),setRenamingValue:Yc(`renamingValue`,t),canRename:()=>!0},e),stateHandlerNames:{renamingItem:`setRenamingItem`,renamingValue:`setRenamingValue`},treeInstance:{getRenamingItem:({tree:e})=>{let t=e.getState().renamingItem;return t?e.getItemInstance(t):null},getRenamingValue:({tree:e})=>e.getState().renamingValue||``,abortRenaming:({tree:e})=>{e.applySubStateUpdate(`renamingItem`,null),e.updateDomFocus()},completeRenaming:({tree:e})=>{var t;let n=e.getConfig(),r=e.getRenamingItem();r&&((t=n.onRename)==null||t.call(n,r,e.getState().renamingValue||``)),e.applySubStateUpdate(`renamingItem`,null),e.updateDomFocus()},isRenamingItem:({tree:e})=>!!e.getState().renamingItem},itemInstance:{startRenaming:({tree:e,item:t,itemId:n})=>{t.canRename()&&(e.applySubStateUpdate(`renamingItem`,n),e.applySubStateUpdate(`renamingValue`,t.getItemName()))},getRenameInputProps:({tree:e})=>({ref:e=>e?.focus(),onBlur:()=>e.abortRenaming(),value:e.getRenamingValue(),onChange:t=>{e.applySubStateUpdate(`renamingValue`,t.target?.value)}}),canRename:({tree:e,item:t})=>{var n;return(n=e.getConfig()).canRename?.call(n,t)??!0},isRenaming:({tree:e,item:t})=>t.getId()===e.getState().renamingItem,getProps:({prev:e,item:t})=>{let n=t.isRenaming(),r=e?.()??{};return n?Kc(G({},r),{draggable:!1,onDragStart:()=>{}}):r}},hotkeys:{renameItem:{hotkey:`F2`,handler:(e,t)=>{t.getFocusedItem().startRenaming()}},abortRenaming:{hotkey:`Escape`,allowWhenInputFocused:!0,isEnabled:e=>e.isRenamingItem(),handler:(e,t)=>{t.abortRenaming()}},completeRenaming:{hotkey:`Enter`,allowWhenInputFocused:!0,isEnabled:e=>e.isRenamingItem(),handler:(e,t)=>{t.completeRenaming()}}}},zl=Object.defineProperty,Bl=Object.defineProperties,Vl=Object.getOwnPropertyDescriptors,Hl=Object.getOwnPropertySymbols,Ul=Object.prototype.hasOwnProperty,Wl=Object.prototype.propertyIsEnumerable,Gl=(e,t,n)=>t in e?zl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Kl=(e,t)=>{for(var n in t||={})Ul.call(t,n)&&Gl(e,n,t[n]);if(Hl)for(var n of Hl(t))Wl.call(t,n)&&Gl(e,n,t[n]);return e},ql=(e,t)=>Bl(e,Vl(t)),Jl=(e,t)=>{var n={};for(var r in e)Ul.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Hl)for(var r of Hl(e))t.indexOf(r)<0&&Wl.call(e,r)&&(n[r]=e[r]);return n},Yl={position:`absolute`,margin:`-1px`,width:`1px`,height:`1px`,overflow:`hidden`,clip:`rect(0 0 0 0)`},Xl=(e,t,n)=>{if(!n.startDrag)return``;let r=(e?.draggedItems)?.map(e=>e.getItemName()).join(`, `)??``,i=e?.dragTarget?`childIndex`in e.dragTarget?`${e.dragTarget.childIndex} of ${e.dragTarget.item.getChildren().length} in ${e.dragTarget.item.getItemName()}`:`in ${e.dragTarget.item.getItemName()}`:`None`,a=`Press ${n.dragUp?.hotkey} and ${n.dragDown?.hotkey} to move up or down, ${n.completeDrag?.hotkey} to drop, ${n.cancelDrag?.hotkey} to abort.`;switch(t){case sl.Started:return r?`Dragging ${r}. Current position: ${i}. ${a}`:`Current position: ${i}. ${a}`;case sl.Dragging:return r?`${r}, ${i}`:i;case sl.Completed:return`Drag completed. Press ${n.startDrag?.hotkey} to move selected items`;case sl.Aborted:return`Drag cancelled. Press ${n.startDrag?.hotkey} to move selected items`;case sl.None:default:return`Press ${n.startDrag?.hotkey} to move selected items`}},Zl=e=>{var t=e,{tree:n,getLabel:r=Xl}=t,i=Jl(t,[`tree`,`getLabel`]);let a=n.getState();return B.createElement(`span`,ql(Kl({"aria-live":`assertive`},i),{style:Kl(Kl({},Yl),i.style)}),r(a.dnd,a.assistiveDndState??sl.None,n.getHotkeyPresets()))},Ql=e=>{let[t]=(0,B.useState)(()=>({current:ol(e)})),[n,r]=(0,B.useState)(()=>t.current.getState());return(0,B.useEffect)(()=>(t.current.setMounted(!0),t.current.rebuildTree(),()=>{t.current.setMounted(!1)}),[t]),t.current.setConfig(t=>ql(Kl(Kl({},t),e),{state:Kl(Kl({},n),e.state),setState:t=>{var n;r(t),(n=e.setState)==null||n.call(e,t)}})),t.current},$l=i(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),eu=i(((e,t)=>{var n=$l();function r(){}function i(){}i.resetWarningCache=r,t.exports=function(){function e(e,t,r,i,a,o){if(o!==n){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name=`Invariant Violation`,s}}e.isRequired=e;function t(){return e}var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return a.PropTypes=a,a}})),tu=n(i(((e,t)=>{t.exports=eu()()}))()),nu={grad:.9,turn:360,rad:360/(2*Math.PI)},ru=function(e){return typeof e==`string`?e.length>0:typeof e==`number`},iu=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=10**t),Math.round(n*e)/n+0},au=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e>t?e:t},ou=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},su=function(e){return{r:au(e.r,0,255),g:au(e.g,0,255),b:au(e.b,0,255),a:au(e.a)}},cu=function(e){return{r:iu(e.r),g:iu(e.g),b:iu(e.b),a:iu(e.a,3)}},lu=/^#([0-9a-f]{3,8})$/i,uu=function(e){var t=e.toString(16);return t.length<2?`0`+t:t},du=function(e){var t=e.r,n=e.g,r=e.b,i=e.a,a=Math.max(t,n,r),o=a-Math.min(t,n,r),s=o?a===t?(n-r)/o:a===n?2+(r-t)/o:4+(t-n)/o:0;return{h:60*(s<0?s+6:s),s:a?o/a*100:0,v:a/255*100,a:i}},fu=function(e){var t=e.h,n=e.s,r=e.v,i=e.a;t=t/360*6,n/=100,r/=100;var a=Math.floor(t),o=r*(1-n),s=r*(1-(t-a)*n),c=r*(1-(1-t+a)*n),l=a%6;return{r:255*[r,s,o,o,c,r][l],g:255*[c,r,r,s,o,o][l],b:255*[o,o,c,r,r,s][l],a:i}},pu=function(e){return{h:ou(e.h),s:au(e.s,0,100),l:au(e.l,0,100),a:au(e.a)}},mu=function(e){return{h:iu(e.h),s:iu(e.s),l:iu(e.l),a:iu(e.a,3)}},hu=function(e){return fu((n=(t=e).s,{h:t.h,s:(n*=((r=t.l)<50?r:100-r)/100)>0?2*n/(r+n)*100:0,v:r+n,a:t.a}));var t,n,r},gu=function(e){return{h:(t=du(e)).h,s:(i=(200-(n=t.s))*(r=t.v)/100)>0&&i<200?n*r/100/(i<=100?i:200-i)*100:0,l:i/2,a:t.a};var t,n,r,i},_u=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,vu=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,yu=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,bu=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,xu={string:[[function(e){var t=lu.exec(e);return t?(e=t[1]).length<=4?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:e.length===4?iu(parseInt(e[3]+e[3],16)/255,2):1}:e.length===6||e.length===8?{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:e.length===8?iu(parseInt(e.substr(6,2),16)/255,2):1}:null:null},`hex`],[function(e){var t=yu.exec(e)||bu.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:su({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},`rgb`],[function(e){var t=_u.exec(e)||vu.exec(e);if(!t)return null;var n,r;return hu(pu({h:(n=t[1],r=t[2],r===void 0&&(r=`deg`),Number(n)*(nu[r]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)}))},`hsl`]],object:[[function(e){var t=e.r,n=e.g,r=e.b,i=e.a,a=i===void 0?1:i;return ru(t)&&ru(n)&&ru(r)?su({r:Number(t),g:Number(n),b:Number(r),a:Number(a)}):null},`rgb`],[function(e){var t=e.h,n=e.s,r=e.l,i=e.a,a=i===void 0?1:i;return!ru(t)||!ru(n)||!ru(r)?null:hu(pu({h:Number(t),s:Number(n),l:Number(r),a:Number(a)}))},`hsl`],[function(e){var t=e.h,n=e.s,r=e.v,i=e.a,a=i===void 0?1:i;return!ru(t)||!ru(n)||!ru(r)?null:fu(function(e){return{h:ou(e.h),s:au(e.s,0,100),v:au(e.v,0,100),a:au(e.a)}}({h:Number(t),s:Number(n),v:Number(r),a:Number(a)}))},`hsv`]]},Su=function(e,t){for(var n=0;n<t.length;n++){var r=t[n][0](e);if(r)return[r,t[n][1]]}return[null,void 0]},Cu=function(e){return typeof e==`string`?Su(e.trim(),xu.string):typeof e==`object`&&e?Su(e,xu.object):[null,void 0]},wu=function(e,t){var n=gu(e);return{h:n.h,s:au(n.s+100*t,0,100),l:n.l,a:n.a}},Tu=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},Eu=function(e,t){var n=gu(e);return{h:n.h,s:n.s,l:au(n.l+100*t,0,100),a:n.a}},Du=function(){function e(e){this.parsed=Cu(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return e.prototype.isValid=function(){return this.parsed!==null},e.prototype.brightness=function(){return iu(Tu(this.rgba),2)},e.prototype.isDark=function(){return Tu(this.rgba)<.5},e.prototype.isLight=function(){return Tu(this.rgba)>=.5},e.prototype.toHex=function(){return e=cu(this.rgba),t=e.r,n=e.g,r=e.b,a=(i=e.a)<1?uu(iu(255*i)):``,`#`+uu(t)+uu(n)+uu(r)+a;var e,t,n,r,i,a},e.prototype.toRgb=function(){return cu(this.rgba)},e.prototype.toRgbString=function(){return e=cu(this.rgba),t=e.r,n=e.g,r=e.b,(i=e.a)<1?`rgba(`+t+`, `+n+`, `+r+`, `+i+`)`:`rgb(`+t+`, `+n+`, `+r+`)`;var e,t,n,r,i},e.prototype.toHsl=function(){return mu(gu(this.rgba))},e.prototype.toHslString=function(){return e=mu(gu(this.rgba)),t=e.h,n=e.s,r=e.l,(i=e.a)<1?`hsla(`+t+`, `+n+`%, `+r+`%, `+i+`)`:`hsl(`+t+`, `+n+`%, `+r+`%)`;var e,t,n,r,i},e.prototype.toHsv=function(){return e=du(this.rgba),{h:iu(e.h),s:iu(e.s),v:iu(e.v),a:iu(e.a,3)};var e},e.prototype.invert=function(){return Ou({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},e.prototype.saturate=function(e){return e===void 0&&(e=.1),Ou(wu(this.rgba,e))},e.prototype.desaturate=function(e){return e===void 0&&(e=.1),Ou(wu(this.rgba,-e))},e.prototype.grayscale=function(){return Ou(wu(this.rgba,-1))},e.prototype.lighten=function(e){return e===void 0&&(e=.1),Ou(Eu(this.rgba,e))},e.prototype.darken=function(e){return e===void 0&&(e=.1),Ou(Eu(this.rgba,-e))},e.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},e.prototype.alpha=function(e){return typeof e==`number`?Ou({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):iu(this.rgba.a,3);var t},e.prototype.hue=function(e){var t=gu(this.rgba);return typeof e==`number`?Ou({h:e,s:t.s,l:t.l,a:t.a}):iu(t.h)},e.prototype.isEqual=function(e){return this.toHex()===Ou(e).toHex()},e}(),Ou=function(e){return e instanceof Du?e:new Du(e)},ku=[],Au=function(e){e.forEach(function(e){ku.indexOf(e)<0&&(e(Du,xu),ku.push(e))})};function ju(e,t){var n={white:`#ffffff`,bisque:`#ffe4c4`,blue:`#0000ff`,cadetblue:`#5f9ea0`,chartreuse:`#7fff00`,chocolate:`#d2691e`,coral:`#ff7f50`,antiquewhite:`#faebd7`,aqua:`#00ffff`,azure:`#f0ffff`,whitesmoke:`#f5f5f5`,papayawhip:`#ffefd5`,plum:`#dda0dd`,blanchedalmond:`#ffebcd`,black:`#000000`,gold:`#ffd700`,goldenrod:`#daa520`,gainsboro:`#dcdcdc`,cornsilk:`#fff8dc`,cornflowerblue:`#6495ed`,burlywood:`#deb887`,aquamarine:`#7fffd4`,beige:`#f5f5dc`,crimson:`#dc143c`,cyan:`#00ffff`,darkblue:`#00008b`,darkcyan:`#008b8b`,darkgoldenrod:`#b8860b`,darkkhaki:`#bdb76b`,darkgray:`#a9a9a9`,darkgreen:`#006400`,darkgrey:`#a9a9a9`,peachpuff:`#ffdab9`,darkmagenta:`#8b008b`,darkred:`#8b0000`,darkorchid:`#9932cc`,darkorange:`#ff8c00`,darkslateblue:`#483d8b`,gray:`#808080`,darkslategray:`#2f4f4f`,darkslategrey:`#2f4f4f`,deeppink:`#ff1493`,deepskyblue:`#00bfff`,wheat:`#f5deb3`,firebrick:`#b22222`,floralwhite:`#fffaf0`,ghostwhite:`#f8f8ff`,darkviolet:`#9400d3`,magenta:`#ff00ff`,green:`#008000`,dodgerblue:`#1e90ff`,grey:`#808080`,honeydew:`#f0fff0`,hotpink:`#ff69b4`,blueviolet:`#8a2be2`,forestgreen:`#228b22`,lawngreen:`#7cfc00`,indianred:`#cd5c5c`,indigo:`#4b0082`,fuchsia:`#ff00ff`,brown:`#a52a2a`,maroon:`#800000`,mediumblue:`#0000cd`,lightcoral:`#f08080`,darkturquoise:`#00ced1`,lightcyan:`#e0ffff`,ivory:`#fffff0`,lightyellow:`#ffffe0`,lightsalmon:`#ffa07a`,lightseagreen:`#20b2aa`,linen:`#faf0e6`,mediumaquamarine:`#66cdaa`,lemonchiffon:`#fffacd`,lime:`#00ff00`,khaki:`#f0e68c`,mediumseagreen:`#3cb371`,limegreen:`#32cd32`,mediumspringgreen:`#00fa9a`,lightskyblue:`#87cefa`,lightblue:`#add8e6`,midnightblue:`#191970`,lightpink:`#ffb6c1`,mistyrose:`#ffe4e1`,moccasin:`#ffe4b5`,mintcream:`#f5fffa`,lightslategray:`#778899`,lightslategrey:`#778899`,navajowhite:`#ffdead`,navy:`#000080`,mediumvioletred:`#c71585`,powderblue:`#b0e0e6`,palegoldenrod:`#eee8aa`,oldlace:`#fdf5e6`,paleturquoise:`#afeeee`,mediumturquoise:`#48d1cc`,mediumorchid:`#ba55d3`,rebeccapurple:`#663399`,lightsteelblue:`#b0c4de`,mediumslateblue:`#7b68ee`,thistle:`#d8bfd8`,tan:`#d2b48c`,orchid:`#da70d6`,mediumpurple:`#9370db`,purple:`#800080`,pink:`#ffc0cb`,skyblue:`#87ceeb`,springgreen:`#00ff7f`,palegreen:`#98fb98`,red:`#ff0000`,yellow:`#ffff00`,slateblue:`#6a5acd`,lavenderblush:`#fff0f5`,peru:`#cd853f`,palevioletred:`#db7093`,violet:`#ee82ee`,teal:`#008080`,slategray:`#708090`,slategrey:`#708090`,aliceblue:`#f0f8ff`,darkseagreen:`#8fbc8f`,darkolivegreen:`#556b2f`,greenyellow:`#adff2f`,seagreen:`#2e8b57`,seashell:`#fff5ee`,tomato:`#ff6347`,silver:`#c0c0c0`,sienna:`#a0522d`,lavender:`#e6e6fa`,lightgreen:`#90ee90`,orange:`#ffa500`,orangered:`#ff4500`,steelblue:`#4682b4`,royalblue:`#4169e1`,turquoise:`#40e0d0`,yellowgreen:`#9acd32`,salmon:`#fa8072`,saddlebrown:`#8b4513`,sandybrown:`#f4a460`,rosybrown:`#bc8f8f`,darksalmon:`#e9967a`,lightgoldenrodyellow:`#fafad2`,snow:`#fffafa`,lightgrey:`#d3d3d3`,lightgray:`#d3d3d3`,dimgray:`#696969`,dimgrey:`#696969`,olivedrab:`#6b8e23`,olive:`#808000`},r={};for(var i in n)r[n[i]]=i;var a={};e.prototype.toName=function(t){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return`transparent`;var i,o,s=r[this.toHex()];if(s)return s;if(t?.closest){var c=this.toRgb(),l=1/0,u=`black`;if(!a.length)for(var d in n)a[d]=new e(n[d]).toRgb();for(var f in n){var p=(i=c,o=a[f],(i.r-o.r)**2+(i.g-o.g)**2+(i.b-o.b)**2);p<l&&(l=p,u=f)}return u}},t.string.push([function(t){var r=t.toLowerCase(),i=r===`transparent`?`#0000`:n[r];return i?new e(i).toRgb():null},`name`])}var Mu={"3d":B.createElement(`path`,{d:`M18 14.625V3.375L9 0 0 3.375v11.25L9 18l9-3.375zM9 2.136l5.918 2.22-5.98 2.242-5.919-2.22L9 2.137zM2 13.239V5.065l6.438 2.414v8.174L2 13.24zM9.438 15.7L16 13.239V5.018l-6.563 2.46V15.7z`,transform:`translate(15 10)`,fillRule:`evenodd`}),acrobat:B.createElement(`path`,{d:`M10.15 1.095C9.938.33 9.42-.051 8.984.005c-.528.068-1.09.382-1.314.876-.63 1.416.685 5.582.887 6.279-1.28 3.863-5.66 11.5-7.806 12.017-.045-.505.225-1.965 3.055-3.785.146-.157.315-.348.393-.472-2.392 1.168-5.492 3.044-3.628 4.448.102.079.259.146.439.213 1.426.528 3.425-1.201 5.435-5.121 2.213-.73 3.999-1.28 6.526-1.662 2.762 1.875 4.616 2.257 5.874 1.774.348-.135.898-.573 1.055-1.145-1.022 1.258-3.414.382-5.323-.82 1.763-.191 3.582-.303 4.369-.056 1 .314.965.808.954.876.079-.27.191-.708-.022-1.056-.842-1.37-4.706-.573-6.11-.427-2.212-1.336-3.74-3.717-4.358-5.436.573-2.212 1.19-3.818.742-5.413zm-.954 4.638C8.826 4.42 8.309 1.5 9.14.556c1.628.932.618 3.144.056 5.177zm3.044 6.514c-2.134.393-3.583.944-5.66 1.764.617-1.202 1.785-4.268 2.346-6.29.787 1.573 1.741 3.111 3.314 4.526z`,transform:`translate(14 9)`,fillRule:`evenodd`}),android:B.createElement(`path`,{d:`M17.6,9.48l1.84-3.18c0.16-0.31,0.04-0.69-0.26-0.85c-0.29-0.15-0.65-0.06-0.83,0.22l-1.88,3.24 c-2.86-1.21-6.08-1.21-8.94,0L5.65,5.67c-0.19-0.29-0.58-0.38-0.87-0.2C4.5,5.65,4.41,6.01,4.56,6.3L6.4,9.48 C3.3,11.25,1.28,14.44,1,18h22C22.72,14.44,20.7,11.25,17.6,9.48z M7,15.25c-0.69,0-1.25-0.56-1.25-1.25 c0-0.69,0.56-1.25,1.25-1.25S8.25,13.31,8.25,14C8.25,14.69,7.69,15.25,7,15.25z M17,15.25c-0.69,0-1.25-0.56-1.25-1.25 c0-0.69,0.56-1.25,1.25-1.25s1.25,0.56,1.25,1.25C18.25,14.69,17.69,15.25,17,15.25z`,transform:`translate(12 8)`}),audio:B.createElement(`path`,{d:`M.25 4.75v4.5h3L7 13V1L3.25 4.75h-3zM10.375 7A3.375 3.375 0 0 0 8.5 3.977v6.037A3.355 3.355 0 0 0 10.375 7zM8.5.421v1.545A5.254 5.254 0 0 1 12.25 7a5.254 5.254 0 0 1-3.75 5.032v1.545A6.747 6.747 0 0 0 13.75 7 6.747 6.747 0 0 0 8.5.421z`,transform:`translate(17 12)`,fillRule:`evenodd`}),binary:B.createElement(`path`,{d:`M2.338 6.112c1.192 0 1.928-1.072 1.928-2.68 0-1.56-.576-2.504-1.8-2.504C1.274.928.538 2 .538 3.608c0 1.56.576 2.504 1.8 2.504zM1.61 3.408c0-1.008.24-1.568.776-1.568.376 0 .616.336.728.888l-1.504.776v-.096zM2.418 5.2c-.368 0-.608-.32-.72-.856l1.496-.768v.056c0 1.008-.24 1.568-.776 1.568zm7.03.8l.088-.944H8.36V.896L7.272.984v.592l-1.184.112.024.824h1.16v2.544h-1.32V6zm5.199 0l.088-.944h-1.176V.896L12.47.984v.592l-1.184.112.024.824h1.16v2.544h-1.32V6zM4.25 14l.088-.944H3.162v-4.16l-1.088.088v.592L.89 9.688l.024.824h1.16v2.544H.754V14zm5.198 0l.088-.944H8.36v-4.16l-1.088.088v.592l-1.184.112.024.824h1.16v2.544h-1.32V14zm3.287.112c1.192 0 1.928-1.072 1.928-2.68 0-1.56-.576-2.504-1.8-2.504-1.192 0-1.928 1.072-1.928 2.68 0 1.56.576 2.504 1.8 2.504zm-.728-2.704c0-1.008.24-1.568.776-1.568.376 0 .616.336.728.888l-1.504.776v-.096zm.808 1.792c-.368 0-.608-.32-.72-.856l1.496-.768v.056c0 1.008-.24 1.568-.776 1.568z`,transform:`translate(16 11)`,fillRule:`evenodd`}),code:B.createElement(`path`,{d:`M4.078 13.67c-1.875-.527-2.812-1.738-2.812-3.634V9.49C1.266 8.437.844 7.911 0 7.911V6.138c.844 0 1.266-.529 1.266-1.586v-.64c.015-.938.257-1.696.726-2.274C2.466 1.06 3.162.64 4.078.38l.492 1.375c-.656.25-.997.95-1.023 2.102v.695c0 1.167-.482 1.99-1.445 2.469.963.479 1.445 1.304 1.445 2.476v.688c.026 1.15.367 1.851 1.023 2.101l-.492 1.383zm7.844 0c1.875-.527 2.812-1.738 2.812-3.634V9.49c0-1.052.422-1.578 1.266-1.578V6.138c-.844 0-1.266-.529-1.266-1.586v-.64c-.015-.938-.257-1.696-.726-2.274-.474-.578-1.17-.998-2.086-1.258l-.492 1.375c.656.25.997.95 1.023 2.102v.695c0 1.167.482 1.99 1.445 2.469-.963.479-1.445 1.304-1.445 2.476v.688c-.026 1.15-.367 1.851-1.023 2.101l.492 1.383z`,transform:`translate(16 13)`,fillRule:`evenodd`}),code2:B.createElement(`path`,{d:`M7.4 10.6L2.8 6l4.6-4.6L6 0 0 6l6 6 1.4-1.4zm5.2 0L17.2 6l-4.6-4.6L14 0l6 6-6 6-1.4-1.4z`,transform:`translate(14 14)`,fillRule:`evenodd`}),compressed:B.createElement(`path`,{d:`M.25 0A.25.25 0 0 0 0 .25v1.5c0 .138.112.25.25.25h1.5A.25.25 0 0 0 2 1.75V.25A.25.25 0 0 0 1.75 0H.25zM1 17a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-6a1 1 0 0 0-1-1H1zm0 4v3h2v-3H1zM2 2.25A.25.25 0 0 1 2.25 2h1.5a.25.25 0 0 1 .25.25v1.5a.25.25 0 0 1-.25.25h-1.5A.25.25 0 0 1 2 3.75v-1.5zM.25 4a.25.25 0 0 0-.25.25v1.5c0 .138.112.25.25.25h1.5A.25.25 0 0 0 2 5.75v-1.5A.25.25 0 0 0 1.75 4H.25zM2 6.25A.25.25 0 0 1 2.25 6h1.5a.25.25 0 0 1 .25.25v1.5a.25.25 0 0 1-.25.25h-1.5A.25.25 0 0 1 2 7.75v-1.5zM.25 8a.25.25 0 0 0-.25.25v1.5c0 .138.112.25.25.25h1.5A.25.25 0 0 0 2 9.75v-1.5A.25.25 0 0 0 1.75 8H.25zM2 10.25a.25.25 0 0 1 .25-.25h1.5a.25.25 0 0 1 .25.25v1.5a.25.25 0 0 1-.25.25h-1.5a.25.25 0 0 1-.25-.25v-1.5zM.25 12a.25.25 0 0 0-.25.25v1.5c0 .138.112.25.25.25h1.5a.25.25 0 0 0 .25-.25v-1.5a.25.25 0 0 0-.25-.25H.25zM2 14.25a.25.25 0 0 1 .25-.25h1.5a.25.25 0 0 1 .25.25v1.5a.25.25 0 0 1-.25.25h-1.5a.25.25 0 0 1-.25-.25v-1.5z`,transform:`translate(15 1)`,fillRule:`evenodd`}),document:B.createElement(`path`,{d:`M12 4H0v2h12V4zM0 10h18V8H0v2zM0 0v2h18V0H0z`,transform:`translate(15 15)`,fillRule:`evenodd`}),drive:B.createElement(`path`,{d:`M2.199.289A.5.5 0 0 1 2.652 0h8.696a.5.5 0 0 1 .453.289l1.867 4a.5.5 0 0 1-.453.711H.785a.5.5 0 0 1-.453-.711l1.867-4zM13 6H1a.752.752 0 0 0-.75.75v4.5c0 .412.338.75.75.75h12c.412 0 .75-.338.75-.75v-4.5A.752.752 0 0 0 13 6zm-9.75 4.5c-.825 0-1.5-.675-1.5-1.5s.675-1.5 1.5-1.5 1.5.675 1.5 1.5-.675 1.5-1.5 1.5z`,transform:`translate(17 13)`,fillRule:`evenodd`}),font:B.createElement(`path`,{d:`M3.722 8.702l-.686 1.89c-.053.14-.094.28-.123.421-.03.135-.044.252-.044.352 0 .304.097.527.29.668.2.14.501.21.905.21h.414V13H.083v-.756h.343c.176 0 .325-.018.448-.053a.81.81 0 0 0 .334-.22c.1-.105.193-.249.281-.43.094-.182.197-.416.308-.704L5.787.15h1.406l4.07 11.136c.07.187.14.343.21.466.077.123.165.222.264.298.1.07.214.12.343.15.129.03.281.044.457.044h.237V13H7.826v-.756h.413c.72 0 1.081-.287 1.081-.862 0-.1-.014-.202-.044-.307a3.274 3.274 0 0 0-.105-.36l-.72-2.013H3.72zM7.009 4.65c-.188-.533-.36-1.031-.519-1.494a15.92 15.92 0 0 1-.378-1.354 7.12 7.12 0 0 1-.15.633 16.95 16.95 0 0 1-.395 1.283c-.082.229-.175.484-.28.765L4.063 7.796h4.061L7.009 4.65zm8.411 5.74c0 .562.117.984.351 1.265.24.275.61.413 1.108.413.363 0 .691-.059.984-.176.3-.117.551-.284.756-.5.211-.218.372-.481.483-.792.112-.31.168-.656.168-1.037V8.104l-1.152.053c-.51.023-.937.088-1.283.193-.34.1-.615.243-.826.43a1.546 1.546 0 0 0-.457.678c-.088.27-.132.58-.132.931zm2.18-6.32c-.346 0-.627.05-.844.15a1.182 1.182 0 0 0-.501.404 1.594 1.594 0 0 0-.237.624c-.041.24-.062.5-.062.782-.498 0-.879-.085-1.143-.255-.257-.17-.386-.463-.386-.879 0-.31.085-.574.255-.79.17-.218.401-.393.694-.528.299-.14.644-.243 1.037-.308a7.76 7.76 0 0 1 1.257-.097c.55 0 1.031.056 1.441.167.41.106.753.282 1.029.528.275.246.48.568.615.967.14.392.21.876.21 1.45v4.667c0 .252.021.46.062.624a.928.928 0 0 0 .194.395c.088.1.202.17.343.211.146.041.319.062.518.062h.053V13H19.7l-.281-1.547h-.15c-.187.252-.369.483-.544.694-.176.211-.37.393-.58.545-.211.152-.452.27-.721.352a3.053 3.053 0 0 1-.958.131c-.399 0-.77-.058-1.116-.175a2.369 2.369 0 0 1-.888-.519 2.516 2.516 0 0 1-.58-.896c-.14-.364-.211-.791-.211-1.284 0-.955.34-1.664 1.02-2.127.68-.462 1.707-.714 3.084-.755l1.495-.053V6.285a6.93 6.93 0 0 0-.053-.888 1.778 1.778 0 0 0-.229-.703 1.14 1.14 0 0 0-.51-.457c-.216-.111-.51-.167-.878-.167z`,transform:`translate(13 12)`,fillRule:`evenodd`}),image:B.createElement(`path`,{d:`M13 0L9.25 5l2.85 3.8-1.6 1.2C8.81 7.75 6 4 6 4l-6 8h22L13 0z`,transform:`translate(13 14)`,fillRule:`evenodd`}),presentation:B.createElement(`path`,{d:`M2 4H0v10c0 1.1.9 2 2 2h14v-2H2V4zm16-4H6C4.9 0 4 .9 4 2v8c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V2c0-1.1-.9-2-2-2zm0 10H6V2h12v8z`,transform:`matrix(-1 0 0 1 34 12)`,fillRule:`evenodd`}),settings:B.createElement(`path`,{d:`M13.572 8.735c.03-.24.053-.48.053-.735s-.023-.495-.053-.735l1.583-1.237a.378.378 0 0 0 .09-.48l-1.5-2.595a.377.377 0 0 0-.457-.165l-1.868.75a5.48 5.48 0 0 0-1.268-.735L9.868.815A.366.366 0 0 0 9.5.5h-3a.366.366 0 0 0-.367.315l-.285 1.988a5.762 5.762 0 0 0-1.268.735l-1.868-.75a.366.366 0 0 0-.457.165l-1.5 2.595a.37.37 0 0 0 .09.48l1.583 1.237c-.03.24-.053.488-.053.735 0 .248.022.495.053.735L.845 9.973a.378.378 0 0 0-.09.48l1.5 2.595c.09.165.292.225.458.165l1.867-.75c.39.3.81.547 1.268.735l.285 1.987c.022.18.18.315.367.315h3a.366.366 0 0 0 .367-.315l.285-1.988a5.762 5.762 0 0 0 1.268-.734l1.867.75c.173.067.368 0 .458-.165l1.5-2.595a.378.378 0 0 0-.09-.48l-1.582-1.238zM8 10.625A2.628 2.628 0 0 1 5.375 8 2.628 2.628 0 0 1 8 5.375 2.628 2.628 0 0 1 10.625 8 2.628 2.628 0 0 1 8 10.625z`,transform:`translate(16 11)`,fillRule:`evenodd`}),spreadsheet:B.createElement(`path`,{d:`M0 8h6V5H0v3zm0 5h6v-3H0v3zM0 3h6V0H0v3zm8 5h12V5H8v3zm0 5h12v-3H8v3zM8 0v3h12V0H8z`,transform:`translate(14 14)`,fillRule:`evenodd`}),vector:B.createElement(`path`,{d:`M14.5 2V1a1 1 0 0 0-1-1h-3a1 1 0 0 0-1 1v1H3.937a2 2 0 1 0 0 1h3.936A9 9 0 0 0 3 11v1h2v-1a7.003 7.003 0 0 1 4.594-6.576A1 1 0 0 0 10.5 5h3a1 1 0 0 0 .906-.576A7.003 7.003 0 0 1 19 11v1h2v-1a9 9 0 0 0-4.873-8h3.936a2 2 0 1 0 0-1H14.5zm-1-1h-3v3h3V1zM2 1.5a1 1 0 1 0 0 2 1 1 0 0 0 0-2zm19 1a1 1 0 1 0 2 0 1 1 0 0 0-2 0z`,transform:`translate(12 14)`,fillRule:`evenodd`}),video:B.createElement(`path`,{d:`M10.75 3.875V1.25A.752.752 0 0 0 10 .5H1a.752.752 0 0 0-.75.75v7.5c0 .412.338.75.75.75h9c.412 0 .75-.338.75-.75V6.125l3 3V.875l-3 3z`,transform:`translate(17 14)`})};Au([ju]);var Nu={color:tu.default.string,extension:tu.default.string,fold:tu.default.bool,foldColor:tu.default.string,glyphColor:tu.default.string,gradientColor:tu.default.string,gradientOpacity:tu.default.number,labelColor:tu.default.string,labelTextColor:tu.default.string,labelUppercase:tu.default.bool,radius:tu.default.number,type:tu.default.oneOf([`3d`,`acrobat`,`android`,`audio`,`binary`,`code`,`code2`,`compressed`,`document`,`drive`,`font`,`image`,`presentation`,`settings`,`spreadsheet`,`vector`,`video`])},Pu={WIDTH:40,HEIGHT:48},K={WIDTH:Pu.WIDTH,HEIGHT:Pu.HEIGHT,X_OFFSET:0},Fu={HEIGHT:12},Iu=14,Lu=B.useId||function(){var e=0;return function(){return e++}}(),Ru=function(e){var t=e.color,n=t===void 0?`whitesmoke`:t,r=e.extension,i=e.fold,a=i===void 0||i,o=e.foldColor,s=e.glyphColor,c=e.gradientColor,l=c===void 0?`white`:c,u=e.gradientOpacity,d=u===void 0?.25:u,f=e.labelColor,p=e.labelTextColor,m=p===void 0?`white`:p,h=e.labelUppercase,g=h!==void 0&&h,_=e.radius,v=_===void 0?4:_,y=e.type,b=Lu(),x=typeof jest>`u`?b:``;return B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 `+Pu.WIDTH+` `+Pu.HEIGHT,width:`100%`,style:{maxWidth:`100%`}},B.createElement(`defs`,null,B.createElement(`clipPath`,{id:`pageRadius`+x},B.createElement(`rect`,{x:K.X_OFFSET,y:`0`,rx:v,ry:v,width:K.WIDTH,height:K.HEIGHT})),B.createElement(`clipPath`,{id:`foldCrop`+x},B.createElement(`rect`,{width:K.WIDTH,height:Fu.HEIGHT,transform:`rotate(-45 0 `+Fu.HEIGHT+`)`})),B.createElement(`linearGradient`,{x1:`100%`,y1:`0%`,y2:`100%`,id:`pageGradient`+x},B.createElement(`stop`,{stopColor:l,stopOpacity:d,offset:`0%`}),B.createElement(`stop`,{stopColor:l,stopOpacity:`0`,offset:`66.67%`}))),B.createElement(`g`,{id:`file`,clipPath:`url(#pageRadius`+x+`)`},a?B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M`+K.X_OFFSET+` 0 h `+(K.WIDTH-Fu.HEIGHT)+` L `+(K.WIDTH+K.X_OFFSET)+` `+Fu.HEIGHT+` v `+(K.HEIGHT-Fu.HEIGHT)+` H `+K.X_OFFSET+` Z`,fill:n}),B.createElement(`path`,{d:`M`+K.X_OFFSET+` 0 h `+(K.WIDTH-Fu.HEIGHT)+` L `+(K.WIDTH+K.X_OFFSET)+` `+Fu.HEIGHT+` v `+(K.HEIGHT-Fu.HEIGHT)+` H `+K.X_OFFSET+` Z`,fill:`url(#pageGradient`+x+`)`})):B.createElement(B.Fragment,null,B.createElement(`rect`,{x:K.X_OFFSET,y:`0`,width:K.WIDTH,height:K.HEIGHT,fill:n}),B.createElement(`rect`,{x:K.X_OFFSET,y:`0`,width:K.WIDTH,height:K.HEIGHT,fill:`url(#pageGradient`+x+`)`}))),a&&B.createElement(`g`,{transform:`translate(28 `+Fu.HEIGHT+`) rotate(-90)`},B.createElement(`rect`,{width:K.WIDTH,height:K.HEIGHT,fill:o||Ou(n).darken(.1).toHex(),rx:v,ry:v,clipPath:`url(#foldCrop`+x+`)`})),r&&B.createElement(B.Fragment,null,B.createElement(`g`,{id:`label`+x},B.createElement(`rect`,{fill:f||Ou(n).darken(.3).toHex(),x:K.X_OFFSET,y:K.HEIGHT-Iu,width:K.WIDTH,height:Iu,clipPath:`url(#pageRadius`+x+`)`})),B.createElement(`g`,{id:`labelText`+x,transform:`translate(`+K.X_OFFSET+` 34)`},B.createElement(`text`,{x:K.WIDTH/2,y:`10`,fontFamily:`-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif`,fontSize:`9`,fill:m,textAnchor:`middle`,style:{fontWeight:`bold`,textAlign:`center`,pointerEvents:`none`,textTransform:g?`uppercase`:`none`,userSelect:`none`}},r))),y&&B.createElement(`g`,{transform:`translate(-4 `+(r?0:6)+`)`,fill:s||Ou(n).darken(.15).toHex()},Mu[y]))};Ru.propTypes=Nu;var zu={"3dm":{labelColor:`#8D1A11`,type:`3d`},"3ds":{labelColor:`#5FB9AD`,type:`3d`},"3g2":{type:`video`},"3gp":{type:`video`},"7zip":{type:`compressed`},aab:{type:`android`,labelColor:`#3DDC84`},aac:{type:`audio`},aep:{type:`video`},ai:{color:`#423325`,gradientOpacity:0,labelColor:`#423325`,labelTextColor:`#FF7F18`,labelUppercase:!0,foldColor:`#FF7F18`,radius:2},aif:{type:`audio`},aiff:{type:`audio`},apk:{type:`android`,labelColor:`#3DDC84`},apkm:{type:`android`,labelColor:`#3DDC84`},apks:{type:`android`,labelColor:`#3DDC84`},asf:{type:`video`},asp:{type:`code`},aspx:{type:`code`},avi:{type:`video`},bin:{type:`binary`},bmp:{type:`image`},c:{type:`code`},cpp:{type:`code`},cs:{type:`code`},css:{type:`code`},csv:{type:`spreadsheet`},cue:{type:`document`},dll:{type:`settings`},dmg:{type:`drive`},doc:{color:`#2C5898`,foldColor:`#254A80`,glyphColor:`rgba(255,255,255,0.4)`,labelColor:`#2C5898`,labelUppercase:!0,type:`document`},docx:{color:`#2C5898`,foldColor:`#254A80`,glyphColor:`rgba(255,255,255,0.4)`,labelColor:`#2C5898`,labelUppercase:!0,type:`document`},dwg:{type:`vector`},dxf:{type:`vector`},eot:{type:`font`},eps:{type:`vector`},exe:{type:`settings`},flac:{type:`audio`},flv:{type:`video`},fnt:{type:`font`},fodp:{type:`presentation`},fods:{type:`spreadsheet`},fodt:{type:`document`},fon:{type:`font`},gif:{type:`image`},gz:{type:`compressed`},heic:{type:`image`},htm:{type:`code`},html:{type:`code`},indd:{color:`#4B2B36`,gradientOpacity:0,labelColor:`#4B2B36`,labelTextColor:`#FF408C`,labelUppercase:!0,foldColor:`#FF408C`,radius:2},ini:{type:`settings`},java:{type:`code`},jpeg:{type:`image`},jpg:{type:`image`},js:{labelColor:`#F7DF1E`,type:`code`},json:{type:`code`},jsx:{labelColor:`#00D8FF`,type:`code`},m4a:{type:`audio`},m4v:{type:`video`},max:{labelColor:`#5FB9AD`,type:`3d`},md:{type:`document`},mid:{type:`audio`},mkv:{type:`video`},mov:{type:`video`},mp3:{type:`audio`},mp4:{type:`video`},mpeg:{type:`video`},mpg:{type:`video`},obj:{type:`3d`},odp:{type:`presentation`},ods:{type:`spreadsheet`},odt:{type:`document`},ogg:{type:`audio`},ogv:{type:`video`},otf:{type:`font`},pdf:{labelColor:`#D93831`,type:`acrobat`},php:{labelColor:`#8892BE`,type:`code`},pkg:{type:`3d`},plist:{type:`settings`},png:{type:`image`},ppt:{color:`#D14423`,foldColor:`#AB381D`,glyphColor:`rgba(255,255,255,0.4)`,labelColor:`#D14423`,labelUppercase:!0,type:`presentation`},pptx:{color:`#D14423`,foldColor:`#AB381D`,glyphColor:`rgba(255,255,255,0.4)`,labelColor:`#D14423`,labelUppercase:!0,type:`presentation`},pr:{type:`video`},ps:{type:`vector`},psd:{color:`#34364E`,gradientOpacity:0,labelColor:`#34364E`,labelTextColor:`#31C5F0`,labelUppercase:!0,foldColor:`#31C5F0`,radius:2},py:{labelColor:`#FFDE57`,type:`code`},rar:{type:`compressed`},rb:{labelColor:`#BB271A`,type:`code`},rm:{type:`video`},rtf:{type:`document`},scss:{labelColor:`#C16A98`,type:`code`},sitx:{type:`compressed`},skp:{type:`3d`},svg:{type:`vector`},swf:{type:`video`},sys:{type:`settings`},tar:{type:`compressed`},tex:{type:`document`},tif:{type:`image`},tiff:{type:`image`},ts:{labelColor:`#3478C7`,type:`code`},ttf:{type:`font`},txt:{type:`document`},wav:{type:`audio`},webm:{type:`video`},wmv:{type:`video`},woff:{type:`font`},wpd:{type:`document`},wps:{type:`document`},xapk:{type:`android`,labelColor:`#3DDC84`},xlr:{type:`spreadsheet`},xls:{color:`#1A754C`,foldColor:`#16613F`,glyphColor:`rgba(255,255,255,0.4)`,labelColor:`#1A754C`,labelUppercase:!0,type:`spreadsheet`},xlsx:{color:`#1A754C`,foldColor:`#16613F`,glyphColor:`rgba(255,255,255,0.4)`,labelColor:`#1A754C`,labelUppercase:!0,type:`spreadsheet`},yml:{type:`code`},zip:{type:`compressed`},zipx:{type:`compressed`}},Bu={sm:14,md:18,lg:24};function Vu(e){let t=e.lastIndexOf(`.`);return t===-1?``:e.slice(t+1).toLowerCase()}function Hu({filename:e,size:t=`sm`}){let n=Vu(e),r=typeof t==`number`?t:Bu[t],i=n?zu[n]??{}:{};return(0,V.jsx)(`span`,{className:`shrink-0 inline-flex`,style:{width:r,height:r},"aria-hidden":!0,children:(0,V.jsx)(Ru,{extension:n||void 0,...i})})}var Uu=B.createContext({currentItem:void 0,indent:20,tree:void 0});function Wu(){return B.useContext(Uu)}function Gu({indent:e=20,tree:t,className:n,...r}){let i=t&&typeof t.getContainerProps==`function`?t.getContainerProps():{},{style:a,...o}={...r,...i},s={...a,"--tree-indent":`${e}px`};return(0,V.jsx)(Uu.Provider,{value:{indent:e,tree:t},children:(0,V.jsx)(`div`,{className:H(`flex flex-col`,n),"data-slot":`tree`,style:s,...o})})}function Ku({item:e,className:t,asChild:n,children:r,...i}){let{indent:a}=Wu(),o=typeof e.getProps==`function`?e.getProps():{},{style:s,...c}={...i,...o},l={...s,"--tree-padding":`${e.getItemMeta().level*a}px`},u=n?we:`button`;return(0,V.jsx)(Uu.Provider,{value:{currentItem:e,indent:a},children:(0,V.jsx)(u,{"aria-expanded":e.isExpanded(),className:H(`z-10 select-none ps-(--tree-padding) not-last:pb-0.5 outline-hidden focus:z-20 data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,t),"data-drag-target":typeof e.isDragTarget==`function`?e.isDragTarget()||!1:void 0,"data-focus":typeof e.isFocused==`function`?e.isFocused()||!1:void 0,"data-folder":typeof e.isFolder==`function`?e.isFolder()||!1:void 0,"data-search-match":typeof e.isMatchingSearch==`function`?e.isMatchingSearch()||!1:void 0,"data-selected":typeof e.isSelected==`function`?e.isSelected()||!1:void 0,"data-slot":`tree-item`,style:l,...c,children:r})})}function qu({item:e,children:t,className:n,...r}){let{currentItem:i}=Wu(),a=e||i;return a?(0,V.jsxs)(`span`,{className:H(`flex items-center gap-2 rounded-sm bg-background in-data-[drag-target=true]:bg-accent in-data-[search-match=true]:bg-blue-400/20! in-data-[selected=true]:bg-accent px-2 py-1.5 in-data-[selected=true]:text-accent-foreground text-sm in-focus-visible:ring-[3px] in-focus-visible:ring-ring/50 transition-colors hover:bg-accent [&_svg]:pointer-events-none [&_svg]:shrink-0`,n),"data-slot":`tree-item-label`,...r,children:[a.isFolder()?(0,V.jsx)(y,{className:`in-aria-[expanded=false]:-rotate-90 size-4 shrink-0 text-muted-foreground`}):(0,V.jsx)(`span`,{className:`size-4 shrink-0`,"aria-hidden":!0}),t||(typeof a.getItemName==`function`?a.getItemName():null)]}):(console.warn(`TreeItemLabel: No item provided via props or context`),null)}function Ju({className:e,...t}){let{tree:n}=Wu();if(!n||typeof n.getDragLineStyle!=`function`)return console.warn(`TreeDragLine: No tree provided via context or tree does not have getDragLineStyle method`),null;let r=n.getDragLineStyle();return(0,V.jsx)(`div`,{className:H(`-mt-px before:-top-[3px] absolute z-30 h-0.5 w-[unset] bg-primary before:absolute before:left-0 before:size-2 before:rounded-full before:border-2 before:border-primary before:bg-background`,e),style:r,...t})}var Yu=Object.defineProperty,Xu=(e,t)=>Yu(e,`name`,{value:t,configurable:!0}),[Zu,Qu]=o(`AlertDialog`,[ee]),$u=ee(),ed=Xu(e=>{let{__scopeAlertDialog:t,...n}=e,r=$u(t);return(0,V.jsx)(ce,{...r,...n,modal:!0})},`AlertDialog`);B.forwardRef(Xu(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=$u(n);return(0,V.jsx)(S,{...i,...r,ref:t})},`AlertDialogTrigger`));var td=Xu(e=>{let{__scopeAlertDialog:t,...n}=e,r=$u(t);return(0,V.jsx)(he,{...r,...n})},`AlertDialogPortal`),nd=B.forwardRef(Xu(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=$u(n);return(0,V.jsx)(w,{...i,...r,ref:t})},`AlertDialogOverlay`)),[rd,id]=Zu(`AlertDialogContent`),ad=B.forwardRef(Xu(function(e,t){let{__scopeAlertDialog:n,children:r,...i}=e,a=$u(n),o=B.useRef(null),s=wt(t,o),c=B.useRef(null);return(0,V.jsx)(rd,{scope:n,cancelRef:c,children:(0,V.jsx)(d,{role:`alertdialog`,...a,...i,ref:s,onOpenAutoFocus:st(i.onOpenAutoFocus,e=>{e.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:r})})},`AlertDialogContent`)),od=B.forwardRef(Xu(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=$u(n);return(0,V.jsx)(xe,{...i,...r,ref:t})},`AlertDialogTitle`)),sd=B.forwardRef(Xu(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=$u(n);return(0,V.jsx)(ve,{...i,...r,ref:t})},`AlertDialogDescription`)),cd=B.forwardRef(Xu(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=$u(n);return(0,V.jsx)(Lt,{...i,...r,ref:t})},`AlertDialogAction`)),ld=`AlertDialogCancel`,ud=B.forwardRef(Xu(function(e,t){let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=id(ld,n),a=$u(n),o=wt(t,i);return(0,V.jsx)(Lt,{...a,...r,ref:o})},`AlertDialogCancel`)),dd=ed,fd=td,pd=nd,md=ad,hd=cd,gd=ud,_d=od,vd=sd;function yd({...e}){return(0,V.jsx)(dd,{"data-slot":`alert-dialog`,...e})}function bd({...e}){return(0,V.jsx)(fd,{"data-slot":`alert-dialog-portal`,...e})}function xd({className:e,...t}){return(0,V.jsx)(pd,{"data-slot":`alert-dialog-overlay`,className:H(`data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50 backdrop-blur-xs`,e),...t})}function Sd({className:e,...t}){return(0,V.jsxs)(bd,{children:[(0,V.jsx)(xd,{}),(0,V.jsx)(md,{"data-slot":`alert-dialog-content`,className:H(`bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-2xl border p-6 shadow-lg duration-200 sm:max-w-lg`,e),...t})]})}function Cd({className:e,...t}){return(0,V.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:H(`flex flex-col gap-2 text-center sm:text-left`,e),...t})}function wd({className:e,...t}){return(0,V.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:H(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...t})}function Td({className:e,...t}){return(0,V.jsx)(_d,{"data-slot":`alert-dialog-title`,className:H(`text-lg font-semibold`,e),...t})}function Ed({className:e,...t}){return(0,V.jsx)(vd,{"data-slot":`alert-dialog-description`,className:H(`text-muted-foreground text-sm`,e),...t})}function Dd({className:e,...t}){return(0,V.jsx)(hd,{className:H(bc(),e),...t})}function Od({className:e,...t}){return(0,V.jsx)(gd,{className:H(bc({variant:`outline`}),e),...t})}var kd=Object.defineProperty,Ad=(e,t)=>kd(e,`name`,{value:t,configurable:!0}),jd=`ContextMenu`,[Md,Nd]=o(jd,[ht]),Pd=ht(),[Fd,Id]=Md(jd),Ld=Ad(e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,open:i,dir:a,modal:o=!0}=e,s=B.useRef(!1),[c,l]=Oe({prop:i,defaultProp:!1,onChange:r,caller:jd}),u=Pd(t);return(0,V.jsx)(Fd,{scope:t,open:c,onOpenChange:l,modal:o,hasInteractedRef:s,children:(0,V.jsx)(C,{...u,dir:a,open:c,onOpenChange:l,modal:o,children:n})})},`ContextMenu`),Rd=`ContextMenuTrigger`,zd=B.forwardRef(Ad(function(e,t){let{__scopeContextMenu:n,disabled:r=!1,...i}=e,a=Id(Rd,n),o=Pd(n),[s,c]=B.useState({x:0,y:0}),l=B.useMemo(()=>({current:{getBoundingClientRect:Ad(()=>DOMRect.fromRect({width:0,height:0,...s}),`getBoundingClientRect`)}}),[s]),u=B.useRef(0),d=B.useCallback(()=>window.clearTimeout(u.current),[]),f=Ad(e=>{a.hasInteractedRef.current=!0,c({x:e.clientX,y:e.clientY}),a.onOpenChange(!0)},`handleOpen`);return B.useEffect(()=>d,[d]),B.useEffect(()=>void(r&&d()),[r,d]),(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(re,{...o,virtualRef:l}),(0,V.jsx)(z.span,{"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,...i,ref:t,style:{WebkitTouchCallout:`none`,...e.style},onContextMenu:r?e.onContextMenu:st(e.onContextMenu,e=>{d(),f(e),e.preventDefault()}),onPointerDown:r?e.onPointerDown:st(e.onPointerDown,$d(e=>{d(),a.open&&a.onOpenChange(!1),u.current=window.setTimeout(()=>f(e),700)})),onPointerMove:r?e.onPointerMove:st(e.onPointerMove,$d(d)),onPointerCancel:r?e.onPointerCancel:st(e.onPointerCancel,$d(d)),onPointerUp:r?e.onPointerUp:st(e.onPointerUp,$d(d))})]})},`ContextMenuTrigger`)),Bd=Ad(e=>{let{__scopeContextMenu:t,...n}=e,r=Pd(t);return(0,V.jsx)(u,{...r,...n})},`ContextMenuPortal`),Vd=`ContextMenuContent`,Hd=B.forwardRef(Ad(function(e,t){let{__scopeContextMenu:n,...r}=e,i=Id(Vd,n),a=Pd(n),o=B.useRef(!1);return(0,V.jsx)(E,{...a,...r,ref:t,side:`right`,sideOffset:2,align:`start`,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),!t.defaultPrevented&&o.current&&t.preventDefault(),o.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),!t.defaultPrevented&&!i.modal&&(o.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-context-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-context-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-context-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-context-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`ContextMenuContent`)),Ud=B.forwardRef(Ad(function(e,t){let{__scopeContextMenu:n,...r}=e,i=Pd(n);return(0,V.jsx)(It,{...i,...r,ref:t})},`ContextMenuLabel`)),Wd=B.forwardRef(Ad(function(e,t){let{__scopeContextMenu:n,...r}=e,i=Pd(n);return(0,V.jsx)(M,{...i,...r,ref:t})},`ContextMenuItem`)),Gd=B.forwardRef(Ad(function(e,t){let{__scopeContextMenu:n,...r}=e,i=Pd(n);return(0,V.jsx)(v,{...i,...r,ref:t})},`ContextMenuCheckboxItem`)),Kd=B.forwardRef(Ad(function(e,t){let{__scopeContextMenu:n,...r}=e,i=Pd(n);return(0,V.jsx)(_e,{...i,...r,ref:t})},`ContextMenuRadioItem`)),qd=B.forwardRef(Ad(function(e,t){let{__scopeContextMenu:n,...r}=e,i=Pd(n);return(0,V.jsx)(R,{...i,...r,ref:t})},`ContextMenuItemIndicator`)),Jd=B.forwardRef(Ad(function(e,t){let{__scopeContextMenu:n,...r}=e,i=Pd(n);return(0,V.jsx)(me,{...i,...r,ref:t})},`ContextMenuSeparator`)),Yd=`ContextMenuSub`,Xd=Ad(e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,open:i,defaultOpen:a}=e,o=Pd(t),[s,c]=Oe({prop:i,defaultProp:a??!1,onChange:r,caller:Yd});return(0,V.jsx)(be,{...o,open:s,onOpenChange:c,children:n})},`ContextMenuSub`),Zd=B.forwardRef(Ad(function(e,t){let{__scopeContextMenu:n,...r}=e,i=Pd(n);return(0,V.jsx)(j,{...i,...r,ref:t})},`ContextMenuSubTrigger`)),Qd=B.forwardRef(Ad(function(e,t){let{__scopeContextMenu:n,...r}=e,i=Pd(n);return(0,V.jsx)(x,{...i,...r,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-context-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-context-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-context-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-context-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`ContextMenuSubContent`));function $d(e){return t=>t.pointerType===`mouse`?void 0:e(t)}Ad($d,`whenTouchOrPen`);var ef=Ld,tf=zd,nf=Bd,rf=Hd,af=Ud,of=Wd,sf=Gd,cf=Kd,lf=qd,uf=Jd,df=Xd,ff=Zd,pf=Qd,mf=ef,hf=tf,gf=df,_f=B.forwardRef(({className:e,inset:t,children:n,...r},i)=>(0,V.jsxs)(ff,{ref:i,className:H(`flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[state=open]:bg-accent data-[state=open]:text-accent-foreground focus:bg-accent focus:text-accent-foreground`,t&&`pl-8`,e),...r,children:[n,(0,V.jsx)(ie,{className:`ml-auto h-4 w-4`})]}));_f.displayName=ff.displayName;var vf=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(pf,{ref:n,className:H(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...t}));vf.displayName=pf.displayName;var yf=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(nf,{children:(0,V.jsx)(rf,{ref:n,className:H(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...t})}));yf.displayName=rf.displayName;var bf=B.forwardRef(({className:e,inset:t,...n},r)=>(0,V.jsx)(of,{ref:r,className:H(`relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground`,t&&`pl-8`,e),...n}));bf.displayName=of.displayName;var xf=B.forwardRef(({className:e,children:t,checked:n,...r},i)=>(0,V.jsxs)(sf,{ref:i,className:H(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground`,e),checked:n,...r,children:[(0,V.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,V.jsx)(lf,{children:(0,V.jsx)(D,{className:`h-4 w-4`})})}),t]}));xf.displayName=sf.displayName;var Sf=B.forwardRef(({className:e,children:t,...n},r)=>(0,V.jsxs)(cf,{ref:r,className:H(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground`,e),...n,children:[(0,V.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,V.jsx)(lf,{children:(0,V.jsx)(Qe,{className:`h-2 w-2 fill-current`})})}),t]}));Sf.displayName=cf.displayName;var Cf=B.forwardRef(({className:e,inset:t,...n},r)=>(0,V.jsx)(af,{ref:r,className:H(`px-2 py-1.5 text-sm font-semibold text-foreground`,t&&`pl-8`,e),...n}));Cf.displayName=af.displayName;var wf=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(uf,{ref:n,className:H(`-mx-1 my-1 h-px bg-border`,e),...t}));wf.displayName=uf.displayName;var Tf=({className:e,...t})=>(0,V.jsx)(`span`,{className:H(`ml-auto text-xs tracking-widest text-muted-foreground`,e),...t});Tf.displayName=`ContextMenuShortcut`;var Ef=500,Df=10,Of=({children:e,itemId:t,isFolder:n,hasCopiedItem:r,onAddChild:i,onAddChildFolder:a,onAddSibling:o,onAddSiblingFolder:s,onRename:c,onDuplicate:u,onCopy:d,onPaste:f,onDelete:p,onManageTags:m})=>{let g=(0,B.useRef)(null),_=(0,B.useRef)(null),v=()=>{g.current&&=(clearTimeout(g.current),null)};return(0,V.jsxs)(mf,{children:[(0,V.jsx)(hf,{asChild:!0,children:(0,V.jsx)(`div`,{className:`contents`,onTouchStart:e=>{let t=e.touches[0];_.current={x:t.clientX,y:t.clientY};let n=e.currentTarget,r=t.clientX,i=t.clientY;g.current=setTimeout(()=>{n.dispatchEvent(new MouseEvent(`contextmenu`,{bubbles:!0,cancelable:!0,clientX:r,clientY:i}))},Ef)},onTouchEnd:v,onTouchCancel:v,onTouchMove:e=>{if(!_.current)return;let t=e.touches[0],n=Math.abs(t.clientX-_.current.x),r=Math.abs(t.clientY-_.current.y);(n>Df||r>Df)&&v()},children:e})}),(0,V.jsxs)(yf,{className:`w-56`,onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:[(0,V.jsxs)(bf,{onClick:()=>n?i?.(t):o?.(t),disabled:n?!i:!o,children:[(0,V.jsx)(Kt,{className:`mr-2 h-4 w-4`}),`Add Note`]}),(0,V.jsxs)(bf,{onClick:()=>n?a?.(t):s?.(t),disabled:n?!a:!s,children:[(0,V.jsx)(Yt,{className:`mr-2 h-4 w-4`}),`Add Folder`]}),(0,V.jsxs)(bf,{onClick:()=>c?.(t),disabled:!c,children:[(0,V.jsx)(Ke,{className:`mr-2 h-4 w-4`}),`Rename`,(0,V.jsx)(Tf,{children:`F2`})]}),(0,V.jsxs)(bf,{onClick:()=>u?.(t),disabled:!u,children:[(0,V.jsx)(h,{className:`mr-2 h-4 w-4`}),`Duplicate`,(0,V.jsx)(Tf,{children:`⌘D`})]}),(0,V.jsx)(wf,{}),(0,V.jsxs)(bf,{onClick:()=>d?.(t),disabled:!d,children:[(0,V.jsx)(et,{className:`mr-2 h-4 w-4`}),`Copy`,(0,V.jsx)(Tf,{children:`⌘C`})]}),(0,V.jsxs)(bf,{onClick:()=>{f?.(n?t:null)},disabled:!r||!f,children:[(0,V.jsx)(l,{className:`mr-2 h-4 w-4`}),`Paste`,(0,V.jsx)(Tf,{children:`⌘V`})]}),(0,V.jsxs)(bf,{onClick:()=>m?.(t),disabled:!m,children:[(0,V.jsx)(un,{className:`mr-2 h-4 w-4`}),`Manage Tags`]}),(0,V.jsx)(wf,{}),(0,V.jsxs)(bf,{onClick:()=>p?.(t),disabled:!p,className:`text-destructive focus:text-destructive`,children:[(0,V.jsx)(kt,{className:`mr-2 h-4 w-4`}),`Delete`,(0,V.jsx)(Tf,{children:`Del`})]})]})]})},kf=`__root__`,Af=20;function jf(e){let t={[kf]:{children:[],documentId:kf,isFolder:!0,name:`Root`}};for(let n of e)t[n.id]={children:[],documentId:n.id,isFolder:!!n.isFolder,name:n.title||`Untitled`};for(let n of e){let e=n.parentId&&t[n.parentId]?n.parentId:kf;t[e].children=[...t[e].children??[],n.id]}for(let e of Object.keys(t))e!==kf&&(t[e].children?.length??0)>0&&(t[e].isFolder=!0);return t}var Mf=(0,B.forwardRef)(({activeId:e,documents:t,onMove:n,onRename:r,onSelect:i,onDelete:a,onDuplicate:o,onAddChild:s,onAddChildFolder:c,onAddSibling:l,onAddSiblingFolder:u,onCopy:d,onPaste:f,_onNewFile:p,_onNewFolder:m,onManageTags:h},g)=>{let _=(0,B.useMemo)(()=>jf(t),[t]),v=(0,B.useMemo)(()=>t.filter(e=>e.isFolder&&e.isExpanded).map(e=>e.id),[t]),[y,b]=(0,B.useState)({expandedItems:v,selectedItems:e?[e]:[]}),[x,S]=(0,B.useState)(null),[C,w]=(0,B.useState)(null),T={current:!1},E=Ql({canReorder:!0,dataLoader:{getChildren:e=>{let t=_[e];return t?t.children??[]:[]},getItem:e=>_[e]||{children:[],documentId:e,isFolder:!1,name:`Deleted Item`}},features:[yl,cl,hl,Rl,jl,Ll],getItemName:e=>e.getItemData().name,onRename:(e,t)=>{let n=t.trim()||`Untitled`;r?.(e.getId(),n)},indent:Af,isItemFolder:e=>e.getItemData()?.isFolder??!1,onDrop:(e,t)=>{let r=e.map(e=>e.getId()).filter(e=>e!==kf);if(r.length===0)return;let i=[...r].reverse(),a=e=>{for(let t of i)n(t,e,`child`)};if(`childIndex`in t){let e=t.item.getId()===kf?null:t.item.getId(),o=(_[t.item.getId()]?.children??[]).filter(e=>!r.includes(e)),s=o[t.childIndex];if(s){for(let e of i)n(e,s,`before`);return}let c=o[t.childIndex-1];if(c){for(let e of i)n(e,c,`after`);return}a(e);return}a(t.item.getId()===kf?null:t.item.getId())},rootItemId:kf,setState:b,state:y});(0,B.useEffect)(()=>{b(t=>({...t,expandedItems:v,selectedItems:e&&_[e]?[e]:[]}))},[e,v,_]),(0,B.useImperativeHandle)(g,()=>({collapseAll:()=>{T.current=!0,E.collapseAll()},edit:e=>{r&&E.getItemInstance(e).startRenaming()},expandAll:()=>{T.current=!1,E.expandAll(T)},cancelExpand:()=>{T.current=!0}}));let D=()=>{C&&a&&(a(C),w(null),b(e=>({...e,selectedItems:e.selectedItems?.filter(e=>e!==C)??[]})))},O=C?_[C]?.name:``,k=E.getItems();return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`flex h-full flex-col gap-2 overflow-auto`,children:(0,V.jsxs)(Gu,{indent:Af,tree:E,children:[(0,V.jsx)(Zl,{tree:E}),k.map(t=>{let n=t.getId();return n===kf?null:(0,V.jsx)(Ku,{item:t,children:(0,V.jsx)(Of,{itemId:n,isFolder:t.isFolder(),hasCopiedItem:!!x,onAddChild:s,onAddChildFolder:c,onAddSibling:l,onAddSiblingFolder:u,onRename:r?()=>t.startRenaming():void 0,onDuplicate:o,onCopy:d?e=>{S(e),d(e)}:void 0,onPaste:f?()=>{x&&f(t.isFolder()?n:null)}:void 0,onDelete:a?()=>w(n):void 0,onManageTags:h,children:t.isRenaming()?(0,V.jsx)(qu,{className:`w-full text-left`,onClick:e=>e.stopPropagation(),children:(0,V.jsx)(`input`,{...t.getRenameInputProps(),className:`flex-1 w-full rounded border bg-background px-1 text-sm outline-none focus:ring-2 focus:ring-ring`})}):(0,V.jsx)(qu,{className:H(`w-full text-left`,e===n&&`bg-accent text-accent-foreground`),onClick:()=>i(n),onDoubleClick:()=>r&&t.startRenaming(),children:(0,V.jsxs)(`span`,{className:`flex items-center gap-2 w-full min-w-0`,children:[t.isFolder()?t.isExpanded()?(0,V.jsx)(qt,{className:`pointer-events-none size-4 shrink-0 text-muted-foreground`}):(0,V.jsx)(Yt,{className:`pointer-events-none size-4 shrink-0 text-muted-foreground`}):(0,V.jsx)(Hu,{filename:t.getItemName(),size:16}),(0,V.jsx)(`span`,{className:`flex-1 truncate`,children:t.getItemName()})]})})})},n)}),(0,V.jsx)(Ju,{})]})}),(0,V.jsx)(yd,{open:!!C,onOpenChange:e=>!e&&w(null),children:(0,V.jsxs)(Sd,{children:[(0,V.jsxs)(Cd,{children:[(0,V.jsx)(Td,{children:`Move to Trash?`}),(0,V.jsxs)(Ed,{children:[`Are you sure you want to move "`,O,`" to trash? You can restore it later from the trash.`]})]}),(0,V.jsxs)(wd,{children:[(0,V.jsx)(Od,{children:`Cancel`}),(0,V.jsx)(Dd,{onClick:D,children:`Move to Trash`})]})]})})]})});Mf.displayName=`FileTree`;var Nf=`outline-collapse-preferences`,Pf=(0,B.forwardRef)(({headings:e=[],onNavigate:t,onReorder:n,searchQuery:r=``},i)=>{let[a,o]=(0,B.useState)(new Set),[s,c]=(0,B.useState)(null),l=(0,B.useMemo)(()=>e.map(([e,t,n],r)=>({id:e,level:parseInt(n[1],10),text:t,line:r})),[e]);(0,B.useImperativeHandle)(i,()=>({expandAll:()=>{o(new Set)},collapseAll:()=>{let e=new Set;l.forEach(t=>{t.level===1&&e.add(t.id)}),o(e)}})),(0,B.useEffect)(()=>{try{let e=localStorage.getItem(Nf);if(e){let t=JSON.parse(e);c(t.defaultCollapseLevel||null),t.defaultCollapseLevel&&h(t.defaultCollapseLevel)}}catch(e){console.error(`Failed to load outline preferences:`,e)}},[]);let u=e=>{try{localStorage.setItem(Nf,JSON.stringify({defaultCollapseLevel:e})),c(e)}catch(e){console.error(`Failed to save outline preferences:`,e)}},d=(0,B.useMemo)(()=>{if(!r.trim())return l;let e=r.toLowerCase();return l.filter(t=>t.text.toLowerCase().includes(e))},[l,r]),f=e=>{let t=l.findIndex(t=>t.id===e);if(t===-1)return[];let n=l[t].level,r=[];for(let e=t+1;e<l.length&&!(l[e].level<=n);e++)r.push(l[e].id);return r},p=e=>{o(t=>{let n=new Set(t);return n.has(e)?(n.delete(e),f(e).forEach(e=>n.delete(e))):n.add(e),n})},m=e=>{let t=l[e].level;for(let n=e-1;n>=0;n--)if(l[n].level<t){if(a.has(l[n].id))return!0;if(l[n].level===1)break}return!1},h=e=>{let t=new Set;l.forEach(n=>{n.level===e&&t.add(n.id)}),o(t)};return l.length===0?(0,V.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-center`,children:(0,V.jsxs)(`div`,{children:[(0,V.jsx)(Qt,{className:`mx-auto h-12 w-12 text-muted-foreground opacity-50 mb-3`}),(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No headings found in this document`}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:`Use the heading buttons in the toolbar`})]})}):(0,V.jsx)(`div`,{className:`flex h-full flex-col overflow-auto`,children:d.map((e,n)=>{let r=l[n+1],i=r&&r.level>e.level,c=a.has(e.id);return m(n)?null:(0,V.jsxs)(mf,{children:[(0,V.jsx)(hf,{children:(0,V.jsxs)(`div`,{className:H(`flex items-center gap-1 rounded-md cursor-pointer transition-colors hover:bg-sidebar-accent`,e.level===1&&`py-1.5 mt-0.5`,e.level===2&&`py-1`,e.level>=3&&`py-0.5`),style:{paddingLeft:`${(e.level-1)*12+4}px`,paddingRight:`4px`},onClick:()=>t?.(e.id),children:[(0,V.jsx)(`button`,{className:H(`h-4 w-4 p-0 shrink-0 flex items-center justify-center hover:bg-transparent`,!i&&`invisible`),onClick:t=>{t.stopPropagation(),p(e.id)},children:(0,V.jsx)(ie,{className:H(`h-3 w-3 transition-transform text-muted-foreground`,!c&&`rotate-90`)})}),(0,V.jsx)(Qt,{className:H(`shrink-0`,e.level===1&&`h-3.5 w-3.5 text-blue-500`,e.level===2&&`h-3 w-3 text-indigo-400`,e.level>=3&&`h-2.5 w-2.5 text-muted-foreground`)}),(0,V.jsx)(`span`,{className:H(`flex-1 truncate`,e.level===1&&`text-sm font-semibold text-foreground`,e.level===2&&`text-sm font-medium text-foreground/90`,e.level===3&&`text-xs text-foreground/80`,e.level>=4&&`text-xs text-muted-foreground`),children:e.text})]})}),(0,V.jsxs)(yf,{children:[(0,V.jsxs)(gf,{children:[(0,V.jsx)(_f,{children:`Collapse to...`}),(0,V.jsxs)(vf,{children:[(0,V.jsx)(bf,{onClick:()=>h(1),children:`Heading 1`}),(0,V.jsx)(bf,{onClick:()=>h(2),children:`Heading 2`}),(0,V.jsx)(bf,{onClick:()=>h(3),children:`Heading 3`}),(0,V.jsx)(bf,{onClick:()=>h(4),children:`Heading 4`}),(0,V.jsx)(bf,{onClick:()=>o(new Set),children:`Expand All`})]})]}),(0,V.jsx)(wf,{}),(0,V.jsx)(xf,{checked:s!==null,onCheckedChange:e=>{if(e){let e=l.find(e=>a.has(e.id));e&&u(e.level)}else u(null)},children:`Keep this collapse level as default`})]})]},e.id)})})}),Ff=Ne(`inline-flex items-center justify-center rounded-2xl border px-3 py-1.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden`,{variants:{variant:{default:`border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90`,secondary:`border-transparent bg-gray-100 text-gray-700 [a&]:hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:[a&]:hover:bg-gray-700`,destructive:`border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60`,outline:`text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,new:`text-purple-600 dark:text-purple-300 bg-purple-600/30 dark:bg-purple-600/30`,beta:`text-blue-600 dark:text-blue-300 bg-blue-600/30 dark:bg-blue-600/30`,highlight:`text-green-800 dark:text-green-300 bg-green-600/30 dark:bg-green-600/30`}},defaultVariants:{variant:`default`}});function If({className:e,variant:t,asChild:n=!1,...r}){return(0,V.jsx)(n?we:`span`,{"data-slot":`badge`,className:H(Ff({variant:t}),e),...r})}var Lf=[{id:`clarity`,name:`Clarity`,prompt:`Rewrite this paragraph for maximum clarity and straightforwardness, keeping all original meaning but removing ambiguity and simplifying complex sentences:`,color:`blue`},{id:`concise`,name:`Concise`,prompt:`Rewrite this text to be more concise, removing redundancy and filler while preserving all key points and tone. Aim for about 50% of the original length:`,color:`purple`},{id:`summarize`,name:`Summarize`,prompt:`Summarize the following text into a shorter paragraph, keeping the main ideas and overall tone but removing details and repetition:`,color:`green`},{id:`rephrase`,name:`Rephrase`,prompt:`Rephrase this paragraph with fresh wording and more engaging style, varying sentence structure and word choice while preserving the core message:`,color:`orange`},{id:`expand`,name:`Expand`,prompt:`Keep the original paragraph as-is, then expand it by adding one additional paragraph that elaborates on the main idea, gives an example, or adds helpful context for the reader:`,color:`pink`}],Rf=`REASON-rewrite-modes`,zf=()=>{try{let e=localStorage.getItem(Rf);if(e)return JSON.parse(e)}catch(e){console.error(`Failed to load rewrite modes:`,e)}return Lf},Bf=e=>{try{localStorage.setItem(Rf,JSON.stringify(e))}catch(e){console.error(`Failed to save rewrite modes:`,e)}},Vf=()=>{Bf(Lf)},Hf=({originalText:e,suggestedText:t,onApprove:n,onReject:r,onRegenerate:i,isLoading:a=!1,currentMode:o})=>{let[s,c]=(0,B.useState)([]);if((0,B.useEffect)(()=>{c(zf())},[]),a)return(0,V.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-border bg-popover p-3 shadow-lg`,children:[(0,V.jsx)(p,{className:`h-4 w-4 animate-spin text-muted-foreground`}),(0,V.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Generating AI suggestion...`})]});let l=e=>{let t={blue:`bg-blue-500/10 text-blue-700 dark:text-blue-300 hover:bg-blue-500/20 border-blue-500/20`,purple:`bg-purple-500/10 text-purple-700 dark:text-purple-300 hover:bg-purple-500/20 border-purple-500/20`,green:`bg-green-500/10 text-green-700 dark:text-green-300 hover:bg-green-500/20 border-green-500/20`,orange:`bg-orange-500/10 text-orange-700 dark:text-orange-300 hover:bg-orange-500/20 border-orange-500/20`,pink:`bg-pink-500/10 text-pink-700 dark:text-pink-300 hover:bg-pink-500/20 border-pink-500/20`};return t[e||`blue`]||t.blue};return(0,V.jsxs)(`div`,{className:`h-full flex flex-col`,children:[(0,V.jsxs)(`div`,{className:`p-3 border-b border-sidebar-border`,children:[(0,V.jsx)(`div`,{className:`text-xs font-semibold text-sidebar-foreground mb-3`,children:`AI SUGGESTION`}),i&&s.length>0&&(0,V.jsxs)(`div`,{className:`mb-3`,children:[(0,V.jsx)(`div`,{className:`text-xs text-muted-foreground mb-2`,children:`Rewrite Mode:`}),(0,V.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:s.map(e=>(0,V.jsx)(If,{variant:`outline`,className:H(`cursor-pointer text-xs px-2 py-0.5 transition-colors`,l(e.color),o===e.id&&`ring-2 ring-offset-1`),onClick:()=>i(e),children:e.name},e.id))})]})]}),(0,V.jsxs)(`div`,{className:`flex-1 overflow-auto p-3 space-y-4`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`text-xs font-semibold text-muted-foreground mb-2`,children:`Original:`}),(0,V.jsx)(`div`,{className:`text-sm text-foreground/70 line-through bg-muted/50 p-3 rounded-md`,children:e})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`text-xs font-semibold text-muted-foreground mb-2`,children:`Suggested:`}),(0,V.jsx)(`div`,{className:`text-sm text-foreground font-medium bg-primary/10 p-3 rounded-md border border-primary/20`,children:t})]})]}),(0,V.jsx)(`div`,{className:`border-t border-sidebar-border p-3`,children:(0,V.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,V.jsxs)(W,{variant:`default`,size:`sm`,onClick:n,className:`w-full h-9 bg-green-500 hover:bg-green-600 text-white`,title:`Approve`,children:[(0,V.jsx)(D,{className:`h-4 w-4 mr-1`}),`Approve`]}),(0,V.jsxs)(W,{variant:`outline`,size:`sm`,onClick:r,className:`w-full h-9`,title:`Reject`,children:[(0,V.jsx)(Le,{className:`h-4 w-4 mr-1`}),`Reject`]})]})})]})};function q({className:e,type:t,...n}){return(0,V.jsx)(`input`,{type:t,"data-slot":`input`,className:H(`file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground flex h-11 w-full min-w-0 rounded-2xl border bg-card px-3 py-1 text-sm font-medium transition-[color] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50`,`focus:outline-none focus:ring-2 focus:ring-primary/50`,`aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive`,e),...n})}function Uf(...e){return e.filter(Boolean).join(` `)}var Wf=(0,B.forwardRef)(function(e,t){let{className:n,style:r,children:i,defaultSize:a,size:o,minSize:s,maxSize:c,...l}=e,u={position:`relative`,outline:`none`,overflow:`auto`,flex:`none`,...r},d=Uf(`split-pane-pane`,n);return(0,V.jsx)(`div`,{ref:t,className:d,style:u,"data-pane":`true`,...l,children:i})});function Gf(e,t=`polite`){if(typeof document>`u`)return;let n=document.createElement(`div`);n.setAttribute(`role`,`status`),n.setAttribute(`aria-live`,t),n.setAttribute(`aria-atomic`,`true`),n.style.position=`absolute`,n.style.left=`-10000px`,n.style.width=`1px`,n.style.height=`1px`,n.style.overflow=`hidden`,n.textContent=e,document.body.appendChild(n),setTimeout(()=>{document.body.removeChild(n)},1e3)}function Kf(e){return 1e3>e?Math.round(e)+` pixels`:Math.round(e/10)/100+` thousand pixels`}function qf(e){let{direction:t,index:n,isDragging:r,disabled:i,onPointerDown:a,onKeyDown:o,className:s,style:c,currentSize:l,minSize:u,maxSize:d,children:f}=e,p=t===`horizontal`?`vertical`:`horizontal`,m={flex:`none`,position:`relative`,userSelect:`none`,touchAction:`none`,...t===`horizontal`?{width:`1px`,cursor:i?`default`:`col-resize`}:{height:`1px`,cursor:i?`default`:`row-resize`},...r&&{cursor:t===`horizontal`?`col-resize`:`row-resize`},...c},h=Uf(`split-pane-divider`,t,r&&`dragging`,s),g=function(e,t){return`${t===`horizontal`?`vertical`:`horizontal`} divider ${e+1}`}(n,t);return(0,V.jsx)(`div`,{role:`separator`,"aria-orientation":p,"aria-label":g,"aria-valuenow":l,"aria-valuemin":u,"aria-valuemax":d===void 0||d===1/0?void 0:d,"aria-description":function(e){return`Use ${e===`horizontal`?`left and right arrow keys`:`up and down arrow keys`} to resize. Hold Shift for larger steps. Press Home or End to minimize or maximize.`}(t),tabIndex:i?-1:0,className:h,style:m,onPointerDown:i?void 0:a,onKeyDown:i?void 0:o,"data-divider-index":n,children:f})}function Jf(e,t){if(typeof e==`number`)return e;if(e.endsWith(`%`))return parseFloat(e)/100*t;if(e.endsWith(`px`))return parseFloat(e);let n=parseFloat(e);return isNaN(n)?0:n}function Yf(e,t,n){return Math.min(Math.max(e,t),n)}function Xf(e,t,n,r,i){let a=[...e],o=e[t]??0,s=e[t+1]??0,c=r[t+1]??0,l=i[t+1]??1/0,u=Yf(o+n,r[t]??0,i[t]??1/0),d=Yf(s-n,c,l),f=s-d,p=Math.min(Math.abs(u-o),Math.abs(f));return n>0?(u=o+p,d=s-p):(u=o-p,d=s+p),a[t]=u,a[t+1]=d,a}function Zf(e){let{direction:t,sizes:n,minSizes:r,maxSizes:i,snapPoints:a=[],snapTolerance:o=10,step:s,onResizeStart:c,onResize:l,onResizeEnd:u}=e,[d,f]=(0,B.useState)(!1),[p,m]=(0,B.useState)(n),h=(0,B.useRef)(null),g=(0,B.useRef)(null),_=(0,B.useRef)(!0),v=(0,B.useRef)(null),y=(0,B.useRef)(p);y.current=p;let b=(0,B.useRef)(u);b.current=u;let x=(0,B.useRef)(n);(0,B.useEffect)(()=>{d||JSON.stringify(n)===JSON.stringify(x.current)||(x.current=n,m(n))},[n,d]),(0,B.useEffect)(()=>(_.current=!0,()=>{_.current=!1,g.current&&=(cancelAnimationFrame(g.current),null)}),[]);let S=(0,B.useCallback)((e,n)=>{if(!h.current||!_.current)return;let{dividerIndex:c,startPosition:u,startSizes:d,pointerType:f}=h.current,p=(t===`horizontal`?e:n)-u;s&&(p=function(e,t){return t>0?Math.round(e/t)*t:e}(p,s));let g=Xf(d,c,p,r,i);a.length>0&&(g=g.map(e=>function(e,t,n){for(let r of t)if(n>=Math.abs(e-r))return r;return e}(e,a,o))),m(g),l&&l(g,{sizes:g,source:`pointer`,pointerType:f})},[t,s,r,i,a,o,l]),C=(0,B.useCallback)(e=>{h.current&&e.pointerId===h.current.pointerId&&(e.preventDefault(),v.current={x:e.clientX,y:e.clientY},g.current||=requestAnimationFrame(()=>{g.current=null,_.current&&v.current&&S(v.current.x,v.current.y)}))},[S]),w=(0,B.useCallback)(e=>{if(!h.current||e.pointerId!==h.current.pointerId)return;let{element:t,pointerId:n,pointerType:r}=h.current;t?.hasPointerCapture?.(n)&&t.releasePointerCapture(n),g.current&&=(cancelAnimationFrame(g.current),null),f(!1);let i=y.current,a=b.current;a&&a(i,{sizes:i,source:`pointer`,pointerType:r}),h.current=null},[]),T=(0,B.useCallback)(e=>n=>{n.preventDefault();let r=t===`horizontal`?n.clientX:n.clientY,i=n.currentTarget;i.setPointerCapture(n.pointerId);let a=n.pointerType;h.current={dividerIndex:e,startPosition:r,startSizes:p,pointerId:n.pointerId,pointerType:a,element:i},f(!0),c&&c({sizes:p,source:`pointer`,pointerType:a,originalEvent:n.nativeEvent})},[t,p,c]);return(0,B.useEffect)(()=>{if(d)return document.addEventListener(`pointermove`,C),document.addEventListener(`pointerup`,w),document.addEventListener(`pointercancel`,w),()=>{document.removeEventListener(`pointermove`,C),document.removeEventListener(`pointerup`,w),document.removeEventListener(`pointercancel`,w)}},[d,C,w]),{isDragging:d,currentSizes:p,handlePointerDown:T}}var Qf=10,$f=50;function ep(e){let{direction:t,sizes:n,minSizes:r,maxSizes:i,step:a=Qf,largeStep:o=$f,onResize:s,onResizeEnd:c}=e,l=(0,B.useRef)(null);return{handleKeyDown:(0,B.useCallback)(e=>u=>{if(!(t===`horizontal`?[`ArrowLeft`,`ArrowRight`]:[`ArrowUp`,`ArrowDown`]).includes(u.key)&&u.key!==`Home`&&u.key!==`End`&&u.key!==`Escape`)return;if(u.preventDefault(),u.key===`Escape`){if(l.current){let e=l.current;l.current=null,s&&s(e,{sizes:e,source:`keyboard`,originalEvent:u.nativeEvent}),c&&c(e,{sizes:e,source:`keyboard`,originalEvent:u.nativeEvent}),Gf(`Pane sizes restored`)}return}l.current===null&&(l.current=[...n]);let d=0,f=[...n],p=`arrow`;switch(u.key){case`ArrowLeft`:case`ArrowUp`:d=-(u.shiftKey?o:a);break;case`ArrowRight`:case`ArrowDown`:d=u.shiftKey?o:a;break;case`Home`:{p=`home`;let t=e+1,i=r[e]??0,a=(n[e]??0)+(n[t]??0);f[e]=i,f[t]=a-i;break}case`End`:{p=`end`;let t=e,a=e+1,o=(n[t]??0)+(n[a]??0);f[t]=Math.min(i[t]??1/0,o-(r[a]??0)),f[a]=o-f[t];break}}if(d!==0&&(f=Xf(n,e,d,r,i)),f=f.map((e,t)=>Yf(e,r[t]??0,i[t]??1/0)),s&&s(f,{sizes:f,source:`keyboard`,originalEvent:u.nativeEvent}),c&&c(f,{sizes:f,source:`keyboard`,originalEvent:u.nativeEvent}),p===`home`)Gf(`Pane ${e+1} minimized to ${Kf(f[e]??0)}`);else if(p===`end`)Gf(`Pane ${e+1} maximized to ${Kf(f[e]??0)}`);else{let t=d>0?e:e+1;Gf(`Pane ${t+1} resized to ${Kf(f[t]??0)}`)}},[t,n,r,i,a,o,s,c])}}function tp(e){let{direction:t=`horizontal`,resizable:n=!0,snapPoints:r,snapTolerance:i=10,step:a,onResizeStart:o,onResize:s,onResizeEnd:c,className:l,style:u,divider:d,dividerStyle:f,dividerClassName:p,dividerSize:m=1,children:h}=e,g=(0,B.useRef)(null),[_,v]=(0,B.useState)(0),y=(0,B.useRef)(0),b=(0,B.useMemo)(()=>B.Children.toArray(h).filter(e=>typeof e==`object`&&!!e&&`props`in e).map(e=>({props:e.props,size:e.props.size,defaultSize:e.props.defaultSize,minSize:e.props.minSize??0,maxSize:e.props.maxSize??1/0})),[h]),x=b.length,S=(0,B.useRef)(!1);2>x&&!S.current&&(S.current=!0,console.warn(`SplitPane requires at least 2 Pane children. Received ${x}.`));let{minSizes:C,maxSizes:w}=(0,B.useMemo)(()=>{if(_===0)return{minSizes:Array(x).fill(0),maxSizes:Array(x).fill(1/0)};let e=[],t=[];return b.forEach(n=>{e.push(Jf(n.minSize,_)),t.push(n.maxSize===1/0?1/0:Jf(n.maxSize,_))}),{minSizes:e,maxSizes:t}},[_,x,b]),T=(0,B.useCallback)(e=>{if(e===0)return Array(x).fill(0);let t=e-m*(x-1),n=b.map(e=>{let n=e.size??e.defaultSize;return n===void 0?null:Jf(n,t)}),r=n.reduce((e,t)=>e+(t??0),0),i=n.filter(e=>e===null).length,a=i>0?(t-r)/i:0;return n.map(e=>e===null?a:e)},[x,b,m]),[E,D]=(0,B.useState)(()=>T(_));(0,B.useEffect)(()=>{if(_===0||!b.some(e=>e.size!==void 0))return;let e=T(_);D(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[_,b,T]);let O=(0,B.useCallback)(e=>{let t=y.current;if(y.current=e,e===0)return;let n=b.some(e=>e.size!==void 0),r=e-m*(x-1);D(i=>i.every(e=>e===0)||i.length!==x?T(e):t>0&&t!==e?n?T(e):function(e,t){let n=e.reduce((e,t)=>e+t,0);if(n===0){let n=t/e.length;return e.map(()=>n)}return e.map(e=>e/n*t)}(i,r):t===0?T(e):i)},[x,b,T,m]),k=(0,B.useRef)(0);(0,B.useEffect)(()=>{let e=g.current;if(!e)return;let n=new ResizeObserver(e=>{let n=e[0];n&&(e=>{let n=Math.round(t===`horizontal`?e.width:e.height);n>0&&n!==k.current&&(k.current=n,v(n),O(n))})(n.contentRect)});return n.observe(e),()=>{n.disconnect()}},[t,O]);let A=(0,B.useCallback)((e,t)=>{D(e),s?.(e,t)},[s]),{isDragging:j,currentSizes:ee,handlePointerDown:M}=Zf({direction:t,sizes:E,minSizes:C,maxSizes:w,snapPoints:r,snapTolerance:i,step:a,onResizeStart:o,onResize:A,onResizeEnd:c}),{handleKeyDown:N}=ep({direction:t,sizes:ee,minSizes:C,maxSizes:w,step:a,onResize:A,onResizeEnd:c}),te=(0,B.useCallback)(e=>t=>{let n={...t,pointerId:1,pointerType:`mouse`,nativeEvent:t.nativeEvent};M(e)(n)},[M]),P=(0,B.useCallback)(e=>t=>{let n=t.touches[0];if(!n)return;let r={...t,clientX:n.clientX,clientY:n.clientY,pointerId:n.identifier,pointerType:`touch`,nativeEvent:t.nativeEvent};M(e)(r)},[M]),F=(0,B.useCallback)(()=>{},[]),I={display:`flex`,flexDirection:t===`horizontal`?`row`:`column`,height:`100%`,width:`100%`,overflow:`hidden`,position:`relative`,...u},L=Uf(`split-pane`,t,l);return(0,V.jsx)(`div`,{ref:g,className:L,style:I,children:_>0&&(()=>{if(2>x)return null;let e=[];return b.forEach((r,i)=>{let a=ee[i]??0,o={...t===`horizontal`?{width:a+`px`,height:`100%`}:{height:a+`px`,width:`100%`},...r.props.style};if(e.push((0,V.jsx)(Wf,{...r.props,style:o,children:r.props.children},`pane-`+i)),x-1>i){let r=C[i],o=w[i];e.push((0,V.jsx)(d??qf,{direction:t,index:i,isDragging:j,disabled:!n,onPointerDown:M(i),onMouseDown:te(i),onTouchStart:P(i),onTouchEnd:F,onKeyDown:N(i),className:p,style:f,currentSize:a,minSize:r,maxSize:o===1/0?void 0:o},`divider-`+i))}}),e})()})}function np(e){let{key:t,storage:n=localStorage,debounce:r=300}=e,[i,a]=(0,B.useState)(()=>{try{let e=n.getItem(t);return e?JSON.parse(e):[]}catch{return[]}});return(0,B.useEffect)(()=>{if(i.length===0)return;let e=setTimeout(()=>{try{n.setItem(t,JSON.stringify(i))}catch(e){console.warn(`Failed to persist pane sizes:`,e)}},r);return()=>clearTimeout(e)},[i,t,n,r]),[i,a]}var rp=typeof window>`u`?{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{},key:()=>null,length:0}:window.localStorage,ip=({panels:e,split:t,persistenceKey:n,activeDocuments:r,activeId:i,activeDocument:a,headings:o=[],isMobile:s,onSelect:c,onAdd:l,onDelete:u,onDuplicate:d,onMove:f,onManageTags:m,onRename:h,onOpenChange:g,treeRef:_,outlineRef:v,openTabs:y=[],activeTab:b,onTabChange:x,onTabClose:S,onTabRename:C,onSplitRight:w,onReopenLastClosed:T,canReopenLastClosed:E=!1,onNavigate:D,aiProps:O})=>{let[k,A]=(0,B.useState)(null),[j,ee]=(0,B.useState)(``),M=(0,B.useRef)(null),N=(0,B.useRef)(null),te=_??M,P=v??N,F=e=>{c(e),s&&g&&g(!1)},I=e=>{m?.(e),s&&g&&g(!1)},L=(0,B.useCallback)(e=>{A(e)},[]),ne=(0,B.useCallback)(e=>{k&&d(k)},[k,d]),re=(0,B.useMemo)(()=>{let e=a?.content||``;if(!e)return[];let t=new DOMParser().parseFromString(e,`text/html`),n=[],r=``,i=-1;for(let e of Array.from(t.body.children))/^h[1-6]$/i.test(e.tagName)?(i>=0&&(n[i]=r),i++,r=``):i>=0&&(r+=` `+(e.textContent||``));return i>=0&&(n[i]=r),n},[a?.content]),ie=(0,B.useMemo)(()=>{let e=j.trim().toLowerCase();return e?o.filter(([,t],n)=>t.toLowerCase().includes(e)||(re[n]||``).toLowerCase().includes(e)):o},[j,o,re]),[ae,oe]=np({key:`sidebar-panels-${n}`,storage:rp}),se=()=>(0,V.jsx)(`div`,{className:`h-full overflow-auto`,children:(0,V.jsxs)(`div`,{className:`px-1 py-1`,children:[(0,V.jsx)(`p`,{className:`px-2 py-1 text-xs font-semibold text-muted-foreground uppercase tracking-wide`,children:`Open Files`}),y.length===0?(0,V.jsx)(`div`,{className:`px-2 py-3 text-xs text-muted-foreground`,children:`No open files`}):y.map(e=>{let t=r.find(t=>t.id===e)?.title||`Untitled`;return(0,V.jsxs)(mf,{children:[(0,V.jsx)(hf,{children:(0,V.jsxs)(`div`,{className:H(`group flex items-center gap-2 px-2 py-1.5 rounded-md cursor-pointer transition-colors hover:bg-sidebar-accent`,e===b&&`bg-sidebar-accent text-blue-600 font-medium`),onClick:()=>x?.(e),children:[(0,V.jsx)(Hu,{filename:t,size:16}),(0,V.jsx)(`span`,{className:`flex-1 truncate text-sm`,children:t}),S&&(0,V.jsx)(`button`,{className:`shrink-0 h-4 w-4 flex items-center justify-center rounded opacity-0 group-hover:opacity-100 hover:bg-destructive/10 hover:text-destructive`,onClick:t=>{t.stopPropagation(),S(e)},children:(0,V.jsx)(Le,{className:`h-3 w-3`})})]})}),(0,V.jsxs)(yf,{children:[C&&(0,V.jsxs)(bf,{onClick:()=>{let n=window.prompt(`Rename document`,t);n?.trim()&&C(e,n.trim())},children:[(0,V.jsx)(an,{className:`mr-2 h-4 w-4`}),`Rename`]}),S&&(0,V.jsxs)(bf,{onClick:()=>S(e),className:`text-destructive focus:text-destructive`,children:[(0,V.jsx)(Le,{className:`mr-2 h-4 w-4`}),`Close`]}),(0,V.jsx)(wf,{}),w&&(0,V.jsxs)(bf,{onClick:()=>w(e),children:[(0,V.jsx)(cn,{className:`mr-2 h-4 w-4`}),`Split Right`]}),T&&(0,V.jsxs)(bf,{onClick:T,disabled:!E,children:[(0,V.jsx)(at,{className:`mr-2 h-4 w-4`}),`Reopen Last Closed`]})]})]},e)})]})}),R=()=>(0,V.jsx)(`div`,{className:`h-full overflow-auto`,children:(0,V.jsx)(Mf,{ref:te,documents:r,activeId:i,onSelect:F,onMove:f,onRename:h,onDelete:u,onDuplicate:d,onAddChild:e=>l(e,!1),onAddChildFolder:e=>l(e,!0),onAddSibling:e=>{l(r.find(t=>t.id===e)?.parentId||null,!1)},onAddSiblingFolder:e=>{l(r.find(t=>t.id===e)?.parentId||null,!0)},onCopy:L,onPaste:ne,onManageTags:I})}),ce=()=>(0,V.jsxs)(`div`,{className:`h-full overflow-hidden flex flex-col`,children:[(0,V.jsxs)(`div`,{className:`px-3 py-2 border-b border-sidebar-border shrink-0`,children:[(0,V.jsx)(`p`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2`,children:`Outline`}),(0,V.jsxs)(`div`,{className:`relative`,children:[(0,V.jsx)(mt,{className:`absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground pointer-events-none`}),(0,V.jsx)(q,{value:j,onChange:e=>ee(e.target.value),placeholder:`Filter headings & text…`,className:`h-7 pl-7 pr-7 text-xs`}),j&&(0,V.jsx)(`button`,{onClick:()=>ee(``),className:`absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,children:(0,V.jsx)(Le,{className:`h-3 w-3`})})]})]}),(0,V.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,V.jsx)(Pf,{ref:P,headings:ie,searchQuery:j,onNavigate:D})})]}),le=()=>(0,V.jsxs)(`div`,{className:`h-full overflow-hidden flex flex-col`,children:[(0,V.jsx)(`div`,{className:`px-3 py-2 border-b border-sidebar-border shrink-0`,children:(0,V.jsx)(`p`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wide`,children:`AI Suggestions`})}),(0,V.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:O?.isAiLoading?(0,V.jsx)(`div`,{className:`h-full flex items-center justify-center p-6`,children:(0,V.jsxs)(`div`,{className:`text-center`,children:[(0,V.jsx)(p,{className:`h-8 w-8 animate-spin text-muted-foreground mx-auto mb-3`}),(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Generating AI suggestion...`})]})}):O?.aiSuggestion?(0,V.jsx)(Hf,{originalText:O.aiSuggestion.originalText,suggestedText:O.aiSuggestion.suggestedText,onApprove:()=>O.onAiApprove?.(),onReject:()=>O.onAiReject?.(),onRegenerate:e=>O.onAiRegenerate?.(e),currentMode:O.aiSuggestion.mode,isLoading:!1}):(0,V.jsx)(`div`,{className:`h-full flex items-center justify-center p-6 text-center`,children:(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Select text and click the AI button to get suggestions`})})})]}),ue=e=>{switch(e){case`files`:return R();case`openTabs`:return se();case`outline`:return ce();case`ai`:return le()}};return e.length===0?(0,V.jsx)(`div`,{className:`h-full flex items-center justify-center p-6 text-center`,children:(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No panels enabled`})}):e.length===1||!t?(0,V.jsx)(`div`,{className:`h-full`,children:ue(e[0])}):(0,V.jsx)(`div`,{className:`h-full`,children:(0,V.jsx)(tp,{direction:`vertical`,onResize:oe,children:e.map((t,n)=>(0,V.jsx)(Wf,{size:ae?.[n]||`${Math.round(100/e.length)}%`,minSize:`0px`,children:ue(t)},t))})})},ap=({documents:e,activeId:t,activeDocument:n,onSelect:r,onAdd:i,onDelete:a,onDuplicate:o,onMove:s,onManageTags:c,onRename:l,onSearchFocus:u,isOpen:d,onOpenChange:f,isMobile:p,leftPanels:m,onLeftPanelsChange:h,leftSplit:g,onLeftSplitChange:_,rightPanels:v,onRightPanelsChange:y,rightSplit:b,onRightSplitChange:x,onSettingsClick:S,onRestore:C,newDocumentId:w,showDynamicIsland:T,onToggleDynamicIsland:E,activeFileSourceId:D=`local-default`,onFileSourceChange:O,headings:k=[],onNavigate:A,openTabs:j=[],activeTab:ee,onTabChange:M,onTabClose:N,onTabRename:te,onSplitRight:P,onReopenLastClosed:F,canReopenLastClosed:I=!1,aiProps:L})=>{let ne=e.filter(e=>e.isDeleted),re=e.filter(e=>!e.isDeleted),[ie,ae]=(0,B.useState)(!1),[oe,se]=(0,B.useState)(!0),R=(0,B.useRef)(null),ce=(0,B.useRef)(null),[le]=(0,B.useState)(()=>En()),[ue,de]=(0,B.useState)(()=>{let e=En();return e.find(e=>e.id===D)||e[0]||null}),[fe,pe]=(0,B.useState)(!1);(0,B.useEffect)(()=>{let e=le.find(e=>e.id===D);e&&e.id!==ue?.id&&de(e)},[D,ue?.id,le]);let me=e=>{let t=le.find(t=>t.id===e);t&&(de(t),O?.(e))},he=()=>{let e=!ie;ae(e),R.current&&(e?R.current.expandAll():(R.current.cancelExpand?.(),R.current.collapseAll()))},ge=()=>{let e=!oe;se(e),ce.current&&(e?ce.current.expandAll():ce.current.collapseAll())};(0,B.useEffect)(()=>{if(w&&R.current){let e=setTimeout(()=>{let e=R.current;e&&typeof e.edit==`function`&&e.edit(w)},100);return()=>clearTimeout(e)}},[w]);let _e={leftPanels:m,leftSplit:g,onLeftPanelsChange:h,onLeftSplitChange:_,rightPanels:v,rightSplit:b,onRightPanelsChange:y,onRightSplitChange:x,activeId:t,onAdd:i,onSearchFocus:u,onFileManagerOpen:()=>pe(!0),sources:le,activeSource:ue,activeFileSourceId:D,onFileSourceChange:O,onSourceSelect:me,allExpanded:ie,outlineExpanded:oe,onToggleAllExpanded:he,onToggleOutlineExpanded:ge,treeRef:R,outlineRef:ce,deletedDocs:ne,onRestore:C,onSettingsClick:S,showDynamicIsland:T,onToggleDynamicIsland:E,isMobile:p,openTabs:j,activeTab:ee,onTabChange:M,onTabClose:N,documents:e},ve={panels:m,split:g,persistenceKey:`left`,activeDocuments:re,activeId:t,activeDocument:n,headings:k,isMobile:p,onSelect:r,onAdd:i,onDelete:a,onDuplicate:o,onMove:s,onManageTags:c,onRename:l,onOpenChange:f,treeRef:R,outlineRef:ce,openTabs:j,activeTab:ee,onTabChange:M,onTabClose:N,onTabRename:te,onSplitRight:P,onReopenLastClosed:F,canReopenLastClosed:I,onNavigate:A,aiProps:L};return p?(0,V.jsx)(gn,{open:d,onOpenChange:f,children:(0,V.jsx)(yn,{side:`left`,className:`w-80 p-0`,children:(0,V.jsxs)(`aside`,{className:`h-full flex flex-col bg-sidebar-background`,children:[(0,V.jsx)(Rc,{..._e}),(0,V.jsx)(`div`,{className:`flex-1 min-h-0 overflow-hidden`,children:(0,V.jsx)(ip,{...ve})}),(0,V.jsx)(yc,{open:fe,onOpenChange:pe,documents:re,onSelectDocument:r})]})})}):(0,V.jsxs)(`aside`,{className:`h-screen w-full flex flex-col bg-sidebar-background`,children:[(0,V.jsx)(Rc,{..._e}),(0,V.jsx)(`div`,{className:`flex-1 min-h-0 overflow-hidden`,children:(0,V.jsx)(ip,{...ve})}),(0,V.jsx)(yc,{open:fe,onOpenChange:pe,documents:re,onSelectDocument:r})]})},op=Object.defineProperty,sp=(e,t)=>op(e,`name`,{value:t,configurable:!0}),cp=`Avatar`,[lp,up]=o(cp),dp=[0,()=>void 0],[fp,pp]=lp(cp),mp=B.forwardRef(sp(function(e,t){let{__scopeAvatar:n,...r}=e,[i,a]=B.useState(`idle`),[o,s]=xp();return(0,V.jsx)(fp,{scope:n,imageLoadingStatus:i,setImageLoadingStatus:a,imageCount:o,setImageCount:s,children:(0,V.jsx)(z.span,{...r,ref:t})})},`Avatar`)),hp=`AvatarImage`,gp=B.forwardRef(sp(function(e,t){let{__scopeAvatar:n,src:r,onLoadingStatusChange:i,...a}=e,o=pp(hp,n);o.setImageCount;let s=yp(r,{referrerPolicy:a.referrerPolicy,crossOrigin:a.crossOrigin,loadingStatus:o.imageLoadingStatus,setLoadingStatus:o.setImageLoadingStatus}),c=A(e=>{i?.(e)}),l=B.useRef(s);return oe(()=>{let e=l.current;l.current=s,s!==e&&c(s)},[s,c]),s===`loaded`?(0,V.jsx)(z.img,{...a,ref:t,src:r}):null},`AvatarImage`)),_p=`AvatarFallback`,vp=B.forwardRef(sp(function(e,t){let{__scopeAvatar:n,delayMs:r,...i}=e,a=pp(_p,n),[o,s]=B.useState(r===void 0);return B.useEffect(()=>{if(r!==void 0){let e=window.setTimeout(()=>s(!0),r);return()=>window.clearTimeout(e)}},[r]),o&&a.imageLoadingStatus!==`loaded`?(0,V.jsx)(z.span,{...i,ref:t}):null},`AvatarFallback`));function yp(e,{loadingStatus:t,setLoadingStatus:n,referrerPolicy:r,crossOrigin:i}){return oe(()=>{if(!e){n(`error`);return}let t=new window.Image,a=sp(e=>{let t=e.currentTarget;n(bp(t))},`handleLoad`),o=sp(()=>n(`error`),`handleError`);return t.addEventListener(`load`,a),t.addEventListener(`error`,o),r&&(t.referrerPolicy=r),t.crossOrigin=i??null,t.src=e,n(bp(t)),()=>{t.removeEventListener(`load`,a),t.removeEventListener(`error`,o),n(`idle`)}},[e,i,r,n]),t}sp(yp,`useImageLoadingStatus`);function bp(e){return e.complete?e.naturalWidth>0?`loaded`:`error`:`loading`}sp(bp,`getImageLoadingStatus`);function xp(){return dp}sp(xp,`useImageCount`);function Sp(e){}sp(Sp,`useUpdateImageCount`);var Cp=Object.defineProperty,wp=(e,t)=>Cp(e,`name`,{value:t,configurable:!0}),Tp=`Radio`,[Ep,Dp]=o(Tp),[Op,kp]=Ep(Tp);function Ap(e){let{__scopeRadio:t,checked:n=!1,children:r,disabled:i,form:a,name:o,onCheck:s,required:c,value:l=`on`,internal_do_not_use_render:u}=e,[d,f]=B.useState(null),[p,m]=B.useState(null),h=B.useRef(!1),[g,_]=B.useReducer(e=>e+1,0),v={checked:n,disabled:i,required:c,name:o,form:a,value:l,control:d,setControl:f,hasConsumerStoppedPropagationRef:h,userInteractionCount:g,onUserInteraction:_,isFormControl:!d||!!a||!!d.closest(`form`),bubbleInput:p,setBubbleInput:m,onCheck:wp(()=>s?.(),`onCheck`)};return(0,V.jsx)(Op,{scope:t,...v,children:Lp(u)?u(v):r})}wp(Ap,`RadioProvider`);var jp=`RadioTrigger`,Mp=B.forwardRef(wp(function({__scopeRadio:e,onClick:t,...n},r){let{checked:i,disabled:a,value:o,setControl:s,onCheck:c,hasConsumerStoppedPropagationRef:l,onUserInteraction:u,isFormControl:d,bubbleInput:f}=kp(jp,e),p=wt(r,s);return(0,V.jsx)(z.button,{type:`button`,role:`radio`,"aria-checked":i,"data-state":Rp(i),"data-disabled":a?``:void 0,disabled:a,value:o,...n,ref:p,onClick:st(t,e=>{i||(u(),c()),f&&d&&(l.current=e.isPropagationStopped(),l.current||e.stopPropagation())})})},`RadioTrigger`)),Np=`RadioIndicator`,Pp=B.forwardRef(wp(function(e,t){let{__scopeRadio:n,forceMount:r,...i}=e,a=kp(Np,n);return(0,V.jsx)(gt,{present:r||a.checked,children:(0,V.jsx)(z.span,{"data-state":Rp(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t})})},`RadioIndicator`)),Fp=`RadioBubbleInput`,Ip=B.forwardRef(wp(function({__scopeRadio:e,onClick:t,...n},r){let{control:i,checked:a,required:o,disabled:s,name:c,value:l,form:u,bubbleInput:d,setBubbleInput:f,hasConsumerStoppedPropagationRef:p,userInteractionCount:m}=kp(Fp,e),h=wt(r,f),g=Xe(i),_=B.useRef(!1),v=B.useRef(a),y=B.useRef(m);B.useEffect(()=>{let e=d;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=m!==y.current;y.current=m;let i=v.current!==a;v.current=a;let o=!(r&&p.current);if(i&&n){_.current=!r;let t=new Event(`click`,{bubbles:o});n.call(e,a),e.dispatchEvent(t),_.current=!1}},[d,a,p,m]);let b=B.useRef(a);return(0,V.jsx)(z.input,{type:`radio`,"aria-hidden":!0,defaultChecked:b.current,required:o,disabled:s,name:c,value:l,form:u,...n,tabIndex:-1,ref:h,onClick:st(t,e=>{_.current&&e.stopPropagation()}),style:{...n.style,...g,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`RadioBubbleInput`));function Lp(e){return typeof e==`function`}wp(Lp,`isFunction`);function Rp(e){return e?`checked`:`unchecked`}wp(Rp,`getState`);var zp=[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`],Bp=`RadioGroup`,[Vp,Hp]=o(Bp,[Ce,Dp]),Up=Ce(),Wp=Dp(),[Gp,Kp]=Vp(Bp),qp=B.forwardRef(wp(function(e,t){let{__scopeRadioGroup:n,name:r,form:i,defaultValue:a,value:o,required:s=!1,disabled:c=!1,orientation:l,dir:u,loop:d=!0,onValueChange:f,...p}=e,m=Up(n),h=De(u),[g,_]=Oe({prop:o,defaultProp:a??null,onChange:f,caller:Bp}),[v,y]=B.useState(null),b=wt(t,y),x=B.useRef(g);return B.useEffect(()=>{let e=i?v?.ownerDocument.getElementById(i):v?.closest(`form`);if(e instanceof HTMLFormElement){let t=wp(()=>_(x.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[v,i,_]),(0,V.jsx)(Gp,{scope:n,name:r,form:i,required:s,disabled:c,value:g,onValueChange:_,children:(0,V.jsx)(Ee,{asChild:!0,...m,orientation:l,dir:h,loop:d,children:(0,V.jsx)(z.div,{role:`radiogroup`,"aria-required":s,"aria-orientation":l,"data-disabled":c?``:void 0,dir:h,...p,ref:b})})})},`RadioGroup`)),Jp=`RadioGroupItemProvider`,Yp=`RadioGroupItemTrigger`;function Xp(e){let{__scopeRadioGroup:t,value:n,disabled:r,children:i,internal_do_not_use_render:a}=e,o=Kp(Jp,t),s=Wp(t),c=o.disabled||r;return(0,V.jsx)(Ap,{...s,checked:o.value===n,disabled:c,required:o.required,name:o.name,form:o.form,value:n,onCheck:()=>o.onValueChange(n),internal_do_not_use_render:a,children:i})}wp(Xp,`RadioGroupItemProvider`);var Zp=B.forwardRef(wp(function(e,t){let{__scopeRadioGroup:n,...r}=e,i=Up(n),a=Wp(n),{checked:o,disabled:s}=kp(Yp,a.__scopeRadio),c=B.useRef(null),l=wt(t,c),u=B.useRef(!1);return B.useEffect(()=>{let e=wp(e=>{zp.includes(e.key)&&(u.current=!0)},`handleKeyDown`),t=wp(()=>u.current=!1,`handleKeyUp`);return document.addEventListener(`keydown`,e),document.addEventListener(`keyup`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`keyup`,t)}},[]),(0,V.jsx)(k,{asChild:!0,...i,focusable:!s,active:o,children:(0,V.jsx)(Mp,{...a,...r,ref:l,onKeyDown:st(r.onKeyDown,e=>{e.key===`Enter`&&e.preventDefault()}),onFocus:st(r.onFocus,()=>{u.current&&c.current?.click()})})})},`RadioGroupItemTrigger`)),Qp=B.forwardRef(wp(function(e,t){let{__scopeRadioGroup:n,value:r,disabled:i,...a}=e;return(0,V.jsx)(Xp,{__scopeRadioGroup:n,value:r,disabled:i,internal_do_not_use_render:({isFormControl:e})=>(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Zp,{...a,ref:t,__scopeRadioGroup:n}),e&&(0,V.jsx)($p,{__scopeRadioGroup:n})]})})},`RadioGroupItem`)),$p=B.forwardRef(wp(function(e,t){let{__scopeRadioGroup:n,...r}=e,i=Wp(n);return(0,V.jsx)(Ip,{...i,...r,ref:t})},`RadioGroupItemBubbleInput`)),em=B.forwardRef(wp(function(e,t){let{__scopeRadioGroup:n,...r}=e,i=Wp(n);return(0,V.jsx)(Pp,{...i,...r,ref:t})},`RadioGroupIndicator`)),tm=Object.defineProperty,J=(e,t)=>tm(e,`name`,{value:t,configurable:!0});function nm(e,t){return B.useReducer((e,n)=>t[e][n]??e,e)}J(nm,`useStateMachine`);var rm=`ScrollArea`,[im,am]=o(rm),[om,sm]=im(rm),cm=B.forwardRef(J(function(e,t){let{__scopeScrollArea:n,type:r=`hover`,dir:i,scrollHideDelay:a=600,...o}=e,[s,c]=B.useState(null),[l,u]=B.useState(null),[d,f]=B.useState(null),[p,m]=B.useState(null),[h,g]=B.useState(null),[_,v]=B.useState(0),[y,b]=B.useState(0),[x,S]=B.useState(!1),[C,w]=B.useState(!1),T=wt(t,c),E=De(i);return(0,V.jsx)(om,{scope:n,type:r,dir:E,scrollHideDelay:a,scrollArea:s,viewport:l,onViewportChange:u,content:d,onContentChange:f,scrollbarX:p,onScrollbarXChange:m,scrollbarXEnabled:x,onScrollbarXEnabledChange:S,scrollbarY:h,onScrollbarYChange:g,scrollbarYEnabled:C,onScrollbarYEnabledChange:w,onCornerWidthChange:v,onCornerHeightChange:b,children:(0,V.jsx)(z.div,{dir:E,...o,ref:T,style:{position:`relative`,"--radix-scroll-area-corner-width":_+`px`,"--radix-scroll-area-corner-height":y+`px`,...e.style}})})},`ScrollArea`)),lm=`ScrollAreaViewport`,um=B.forwardRef(J(function(e,t){let{__scopeScrollArea:n,children:r,nonce:i,...a}=e,o=sm(lm,n),s=B.useRef(null),c=wt(t,s,o.onViewportChange);return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(dm,{nonce:i}),(0,V.jsx)(z.div,{"data-radix-scroll-area-viewport":``,...a,ref:c,style:{overflowX:o.scrollbarXEnabled?`scroll`:`hidden`,overflowY:o.scrollbarYEnabled?`scroll`:`hidden`,...e.style},children:(0,V.jsx)(`div`,{ref:o.onContentChange,style:{minWidth:`100%`,display:`table`},children:r})})]})},`ScrollAreaViewport`)),dm=B.memo(J(function({nonce:e}){return(0,V.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}`},nonce:e})},`ScrollAreaViewportStyle`),(e,t)=>e.nonce===t.nonce),fm=`ScrollAreaScrollbar`,pm=B.forwardRef(J(function(e,t){let{forceMount:n,...r}=e,i=sm(fm,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:o}=i,s=e.orientation===`horizontal`;return B.useEffect(()=>(s?a(!0):o(!0),()=>{s?a(!1):o(!1)}),[s,a,o]),i.type===`hover`?(0,V.jsx)(mm,{...r,ref:t,forceMount:n}):i.type===`scroll`?(0,V.jsx)(hm,{...r,ref:t,forceMount:n}):i.type===`auto`?(0,V.jsx)(gm,{...r,ref:t,forceMount:n}):i.type===`always`?(0,V.jsx)(_m,{...r,ref:t,"data-state":`visible`}):null},`ScrollAreaScrollbar`)),mm=B.forwardRef(J(function(e,t){let{forceMount:n,...r}=e,i=sm(fm,e.__scopeScrollArea),[a,o]=B.useState(!1);return B.useEffect(()=>{let e=i.scrollArea,t=0;if(e){let n=J(()=>{window.clearTimeout(t),o(!0)},`handlePointerEnter`),r=J(()=>{t=window.setTimeout(()=>o(!1),i.scrollHideDelay)},`handlePointerLeave`);return e.addEventListener(`pointerenter`,n),e.addEventListener(`pointerleave`,r),()=>{window.clearTimeout(t),e.removeEventListener(`pointerenter`,n),e.removeEventListener(`pointerleave`,r)}}},[i.scrollArea,i.scrollHideDelay]),(0,V.jsx)(gt,{present:n||a,children:(0,V.jsx)(gm,{"data-state":a?`visible`:`hidden`,...r,ref:t})})},`ScrollAreaScrollbarHover`)),hm=B.forwardRef(J(function(e,t){let{forceMount:n,...r}=e,i=sm(fm,e.__scopeScrollArea),a=e.orientation===`horizontal`,o=Lm(()=>c(`SCROLL_END`),100),[s,c]=nm(`hidden`,{hidden:{SCROLL:`scrolling`},scrolling:{SCROLL_END:`idle`,POINTER_ENTER:`interacting`},interacting:{SCROLL:`interacting`,POINTER_LEAVE:`idle`},idle:{HIDE:`hidden`,SCROLL:`scrolling`,POINTER_ENTER:`interacting`}});return B.useEffect(()=>{if(s===`idle`){let e=window.setTimeout(()=>c(`HIDE`),i.scrollHideDelay);return()=>window.clearTimeout(e)}},[s,i.scrollHideDelay,c]),B.useEffect(()=>{let e=i.viewport,t=a?`scrollLeft`:`scrollTop`;if(e){let n=e[t],r=J(()=>{let r=e[t];n!==r&&(c(`SCROLL`),o()),n=r},`handleScroll`);return e.addEventListener(`scroll`,r),()=>e.removeEventListener(`scroll`,r)}},[i.viewport,a,c,o]),(0,V.jsx)(gt,{present:n||s!==`hidden`,children:(0,V.jsx)(_m,{"data-state":s===`hidden`?`hidden`:`visible`,...r,ref:t,onPointerEnter:st(e.onPointerEnter,()=>c(`POINTER_ENTER`)),onPointerLeave:st(e.onPointerLeave,()=>c(`POINTER_LEAVE`))})})},`ScrollAreaScrollbarScroll`)),gm=B.forwardRef(J(function(e,t){let n=sm(fm,e.__scopeScrollArea),{forceMount:r,...i}=e,[a,o]=B.useState(!1),s=e.orientation===`horizontal`,c=Lm(()=>{if(n.viewport){let e=n.viewport.offsetWidth<n.viewport.scrollWidth,t=n.viewport.offsetHeight<n.viewport.scrollHeight;o(s?e:t)}},10);return Rm(n.viewport,c),Rm(n.content,c),(0,V.jsx)(gt,{present:r||a,children:(0,V.jsx)(_m,{"data-state":a?`visible`:`hidden`,...i,ref:t})})},`ScrollAreaScrollbarAuto`)),_m=B.forwardRef(J(function(e,t){let{orientation:n=`vertical`,...r}=e,i=sm(fm,e.__scopeScrollArea),a=B.useRef(null),o=B.useRef(0),[s,c]=B.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),l=Am(s.viewport,s.content),u={...r,sizes:s,onSizesChange:c,hasThumb:l>0&&l<1,onThumbChange:J(e=>a.current=e,`onThumbChange`),onThumbPointerUp:J(()=>o.current=0,`onThumbPointerUp`),onThumbPointerDown:J(e=>o.current=e,`onThumbPointerDown`)};function d(e,t){return Mm(e,o.current,s,t)}return J(d,`getScrollPosition`),n===`horizontal`?(0,V.jsx)(vm,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollLeft,t=Nm(e,s,i.dir);a.current.style.transform=`translate3d(${t}px, 0, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollLeft=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollLeft=d(e,i.dir))}}):n===`vertical`?(0,V.jsx)(ym,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollTop,t=Nm(e,s);a.current.style.transform=`translate3d(0, ${t}px, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollTop=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollTop=d(e))}}):null},`ScrollAreaScrollbarVisible`)),vm=B.forwardRef(J(function(e,t){let{sizes:n,onSizesChange:r,...i}=e,a=sm(fm,e.__scopeScrollArea),[o,s]=B.useState(),c=B.useRef(null),l=wt(t,c,a.onScrollbarXChange);return B.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,V.jsx)(Sm,{"data-orientation":`horizontal`,...i,ref:l,sizes:n,style:{bottom:0,left:a.dir===`rtl`?`var(--radix-scroll-area-corner-width)`:0,right:a.dir===`ltr`?`var(--radix-scroll-area-corner-width)`:0,"--radix-scroll-area-thumb-width":jm(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollLeft+t.deltaX;e.onWheelScroll(r),Fm(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:km(o.paddingLeft),paddingEnd:km(o.paddingRight)}})}})},`ScrollAreaScrollbarX`)),ym=B.forwardRef(J(function(e,t){let{sizes:n,onSizesChange:r,...i}=e,a=sm(fm,e.__scopeScrollArea),[o,s]=B.useState(),c=B.useRef(null),l=wt(t,c,a.onScrollbarYChange);return B.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,V.jsx)(Sm,{"data-orientation":`vertical`,...i,ref:l,sizes:n,style:{top:0,right:a.dir===`ltr`?0:void 0,left:a.dir===`rtl`?0:void 0,bottom:`var(--radix-scroll-area-corner-height)`,"--radix-scroll-area-thumb-height":jm(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollTop+t.deltaY;e.onWheelScroll(r),Fm(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:km(o.paddingTop),paddingEnd:km(o.paddingBottom)}})}})},`ScrollAreaScrollbarY`)),[bm,xm]=im(fm),Sm=B.forwardRef(J(function(e,t){let{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:a,onThumbPointerUp:o,onThumbPointerDown:s,onThumbPositionChange:c,onDragScroll:l,onWheelScroll:u,onResize:d,...f}=e,p=sm(fm,n),[m,h]=B.useState(null),g=wt(t,h),_=B.useRef(null),v=B.useRef(``),y=p.viewport,b=r.content-r.viewport,x=A(u),S=A(c),C=Lm(d,10);function w(e){if(_.current){let t=e.clientX-_.current.left,n=e.clientY-_.current.top;l({x:t,y:n})}}return J(w,`handleDragScroll`),B.useEffect(()=>{let e=J(e=>{let t=e.target;m?.contains(t)&&x(e,b)},`handleWheel`);return document.addEventListener(`wheel`,e,{passive:!1}),()=>document.removeEventListener(`wheel`,e,{passive:!1})},[y,m,b,x]),B.useEffect(S,[r,S]),Rm(m,C),Rm(p.content,C),(0,V.jsx)(bm,{scope:n,scrollbar:m,hasThumb:i,onThumbChange:A(a),onThumbPointerUp:A(o),onThumbPositionChange:S,onThumbPointerDown:A(s),children:(0,V.jsx)(z.div,{...f,ref:g,style:{position:`absolute`,...f.style},onPointerDown:st(e.onPointerDown,e=>{e.button===0&&(e.target.setPointerCapture(e.pointerId),_.current=m.getBoundingClientRect(),v.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect=`none`,p.viewport&&(p.viewport.style.scrollBehavior=`auto`),w(e))}),onPointerMove:st(e.onPointerMove,w),onPointerUp:st(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=v.current,p.viewport&&(p.viewport.style.scrollBehavior=``),_.current=null})})})},`ScrollAreaScrollbarImpl`)),Cm=`ScrollAreaThumb`,wm=B.forwardRef(J(function(e,t){let{forceMount:n,...r}=e,i=xm(Cm,e.__scopeScrollArea);return(0,V.jsx)(gt,{present:n||i.hasThumb,children:(0,V.jsx)(Tm,{ref:t,...r})})},`ScrollAreaThumb`)),Tm=B.forwardRef(J(function(e,t){let{__scopeScrollArea:n,style:r,...i}=e,a=sm(Cm,n),o=xm(Cm,n),{onThumbPositionChange:s}=o,c=wt(t,o.onThumbChange),l=B.useRef(void 0),u=Lm(()=>{l.current&&=(l.current(),void 0)},100);return B.useEffect(()=>{let e=a.viewport;if(e){let t=J(()=>{if(u(),!l.current){let t=Im(e,s);l.current=t,s()}},`handleScroll`);return s(),e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)}},[a.viewport,u,s]),(0,V.jsx)(z.div,{"data-state":o.hasThumb?`visible`:`hidden`,...i,ref:c,style:{width:`var(--radix-scroll-area-thumb-width)`,height:`var(--radix-scroll-area-thumb-height)`,...r},onPointerDownCapture:st(e.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;o.onThumbPointerDown({x:n,y:r})}),onPointerUp:st(e.onPointerUp,o.onThumbPointerUp)})},`ScrollAreaThumbImpl`)),Em=`ScrollAreaCorner`,Dm=B.forwardRef(J(function(e,t){let n=sm(Em,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!==`scroll`&&r?(0,V.jsx)(Om,{...e,ref:t}):null},`ScrollAreaCorner`)),Om=B.forwardRef(J(function(e,t){let{__scopeScrollArea:n,...r}=e,i=sm(Em,n),[a,o]=B.useState(0),[s,c]=B.useState(0),l=!!(a&&s),{onCornerWidthChange:u,onCornerHeightChange:d}=i;return Rm(i.scrollbarX,()=>{let e=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(e),c(e)}),Rm(i.scrollbarY,()=>{let e=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(e),o(e)}),B.useEffect(()=>()=>{u(0),d(0)},[u,d]),l?(0,V.jsx)(z.div,{...r,ref:t,style:{width:a,height:s,position:`absolute`,right:i.dir===`ltr`?0:void 0,left:i.dir===`rtl`?0:void 0,bottom:0,...e.style}}):null},`ScrollAreaCornerImpl`));function km(e){return e?parseInt(e,10):0}J(km,`toInt`);function Am(e,t){let n=e/t;return isNaN(n)?0:n}J(Am,`getThumbRatio`);function jm(e){let t=Am(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}J(jm,`getThumbSize`);function Mm(e,t,n,r=`ltr`){let i=jm(n),a=i/2,o=t||a,s=i-o,c=n.scrollbar.paddingStart+o,l=n.scrollbar.size-n.scrollbar.paddingEnd-s,u=n.content-n.viewport,d=r===`ltr`?[0,u]:[u*-1,0];return Pm([c,l],d)(e)}J(Mm,`getScrollPositionFromPointer`);function Nm(e,t,n=`ltr`){let r=jm(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-i,o=t.content-t.viewport,s=a-r,c=n===`ltr`?[0,o]:[o*-1,0],l=Ot(e,c);return Pm([0,o],[0,s])(l)}J(Nm,`getThumbOffsetFromScroll`);function Pm(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}J(Pm,`linearScale`);function Fm(e,t){return e>0&&e<t}J(Fm,`isScrollingWithinScrollbarBounds`);var Im=J((e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return J((function i(){let a={left:e.scrollLeft,top:e.scrollTop},o=n.left!==a.left,s=n.top!==a.top;(o||s)&&t(),n=a,r=window.requestAnimationFrame(i)}),`loop`)(),()=>window.cancelAnimationFrame(r)},`addUnlinkedScrollListener`);function Lm(e,t){let n=A(e),r=B.useRef(0);return B.useEffect(()=>()=>window.clearTimeout(r.current),[]),B.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}J(Lm,`useDebounceCallback`);function Rm(e,t){let n=A(t);oe(()=>{let t=0;if(e){let r=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(n)});return r.observe(e),()=>{window.cancelAnimationFrame(t),r.unobserve(e)}}},[e,n])}J(Rm,`useResizeObserver`);var zm=cm,Bm=um,Vm=Dm,Hm=Object.defineProperty,Um=(e,t)=>Hm(e,`name`,{value:t,configurable:!0}),Wm=`Switch`,[Gm,Km]=o(Wm),[qm,Jm]=Gm(Wm);function Ym(e){let{__scopeSwitch:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=Oe({prop:n,defaultProp:i??!1,onChange:c,caller:Wm}),[m,h]=B.useState(null),[g,_]=B.useState(null),v=B.useRef(!1),[y,b]=B.useReducer(e=>e+1,0),x={checked:f,setChecked:p,disabled:a,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:v,userInteractionCount:y,onUserInteraction:b,required:l,defaultChecked:i,isFormControl:!m||!!o||!!m.closest(`form`),bubbleInput:g,setBubbleInput:_};return(0,V.jsx)(qm,{scope:t,...x,children:rh(d)?d(x):r})}Um(Ym,`SwitchProvider`);var Xm=`SwitchTrigger`,Zm=B.forwardRef(Um(function({__scopeSwitch:e,onClick:t,...n},r){let{control:i,form:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,onUserInteraction:p,isFormControl:m,bubbleInput:h}=Jm(Xm,e),g=wt(r,u),_=B.useRef(c);return B.useEffect(()=>{let e=a?i?.ownerDocument.getElementById(a):i?.form;if(e instanceof HTMLFormElement){let t=Um(()=>d(_.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[i,a,d]),(0,V.jsx)(z.button,{type:`button`,role:`switch`,"aria-checked":c,"aria-required":l,"data-state":ih(c),"data-disabled":s?``:void 0,disabled:s,value:o,...n,ref:g,onClick:st(t,e=>{p(),d(e=>!e),h&&m&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})},`SwitchTrigger`)),Qm=B.forwardRef(Um(function(e,t){let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,V.jsx)(Ym,{__scopeSwitch:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Zm,{...d,ref:t,__scopeSwitch:n}),e&&(0,V.jsx)(nh,{__scopeSwitch:n})]})})},`Switch`)),$m=`SwitchThumb`,eh=B.forwardRef(Um(function(e,t){let{__scopeSwitch:n,...r}=e,i=Jm($m,n);return(0,V.jsx)(z.span,{"data-state":ih(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})},`SwitchThumb`)),th=`SwitchBubbleInput`,nh=B.forwardRef(Um(function({__scopeSwitch:e,onClick:t,...n},r){let{control:i,hasConsumerStoppedPropagationRef:a,userInteractionCount:o,checked:s,defaultChecked:c,required:l,disabled:u,name:d,value:f,form:p,bubbleInput:m,setBubbleInput:h}=Jm(th,e),g=wt(r,h),_=Xe(i),v=B.useRef(!1),y=B.useRef(s),b=B.useRef(o);B.useEffect(()=>{let e=m;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=o!==b.current;b.current=o;let i=y.current!==s;y.current=s;let c=!(r&&a.current);if(i&&n){v.current=!r;let t=new Event(`click`,{bubbles:c});n.call(e,s),e.dispatchEvent(t),v.current=!1}},[m,s,a,o]);let x=B.useRef(s);return(0,V.jsx)(z.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:c??x.current,required:l,disabled:u,name:d,value:f,form:p,...n,tabIndex:-1,ref:g,onClick:st(t,e=>{v.current&&e.stopPropagation()}),style:{...n.style,..._,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`SwitchBubbleInput`));function rh(e){return typeof e==`function`}Um(rh,`isFunction`);function ih(e){return e?`checked`:`unchecked`}Um(ih,`getState`);var ah=({editor:e,theme:t,setTheme:n})=>{let[r,i]=(0,B.useState)(!1);return Je(),ut(),(0,B.useEffect)(()=>{je.setColor(`default`),i(e?.isEditable??!0)},[]),(0,B.useEffect)(()=>(e&&e.on(`update`,()=>{i(e.isEditable)}),()=>{e&&e.off(`update`,()=>{i(e.isEditable)})}),[e]),null},oh=Ct(ot());function sh({className:e,...t}){return(0,V.jsx)(mp,{"data-slot":`avatar`,className:H(`relative flex size-8 shrink-0 overflow-hidden rounded-full`,e),...t})}function ch({className:e,...t}){return(0,V.jsx)(gp,{"data-slot":`avatar-image`,className:H(`aspect-square size-full`,e),...t})}function lh({className:e,...t}){return(0,V.jsx)(vp,{"data-slot":`avatar-fallback`,className:H(`bg-muted flex size-full items-center justify-center rounded-full`,e),...t})}function uh({className:e,...t}){return(0,V.jsx)(`textarea`,{"data-slot":`textarea`,className:H(`border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-2xl border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm`,e),...t})}function dh(e){return e.split(` `).map(e=>e[0]).filter(Boolean).slice(0,2).join(``).toUpperCase()}function fh(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function ph({thread:e,active:t,onSelect:n,onSubmitBody:r,onReply:i,onResolve:a,onRemove:o}){let[s,c]=(0,B.useState)(``),l=(0,B.useRef)(null),u=!e.text.trim();(0,B.useEffect)(()=>{t&&u&&l.current?.focus()},[t,u]);let d=()=>{let t=s.trim();t&&(u?r(e.id,t):i(e.id,t),c(``))};return(0,V.jsxs)(`div`,{role:`button`,tabIndex:0,onClick:()=>n(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&n(e.id)},className:H(`rounded-lg border bg-card p-3 text-left shadow-sm transition-colors cursor-pointer`,t?`border-primary ring-1 ring-primary/40`:`hover:border-primary/40`,e.resolved&&`opacity-70`),children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(sh,{className:`h-6 w-6`,children:(0,V.jsx)(lh,{className:`text-[10px]`,style:{backgroundColor:e.authorColor,color:`#fff`},children:dh(e.authorName)})}),(0,V.jsx)(`span`,{className:`text-sm font-medium truncate flex-1`,children:e.authorName}),(0,V.jsx)(`span`,{className:`text-[11px] text-muted-foreground shrink-0`,children:fh(e.timestamp)}),e.resolved&&(0,V.jsx)(If,{variant:`secondary`,className:`shrink-0`,children:`Resolved`})]}),!u&&(0,V.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap break-words text-sm`,children:e.text}),e.replies?.length>0&&(0,V.jsx)(`div`,{className:`mt-2 space-y-2 border-l-2 border-border pl-2`,children:e.replies.map(e=>(0,V.jsxs)(`div`,{children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,V.jsx)(`span`,{className:`text-xs font-medium`,children:e.authorName}),(0,V.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:fh(e.timestamp)})]}),(0,V.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-sm`,children:e.text})]},e.id))}),!e.resolved&&(0,V.jsxs)(`div`,{className:`mt-2`,onClick:e=>e.stopPropagation(),children:[(0,V.jsx)(uh,{ref:l,value:s,onChange:e=>c(e.target.value),onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),d())},placeholder:u?`Write a comment…`:`Reply…`,className:`min-h-[56px] text-sm`}),(0,V.jsxs)(`div`,{className:`mt-1.5 flex items-center justify-between`,children:[(0,V.jsxs)(`div`,{className:`flex gap-1`,children:[!u&&(0,V.jsxs)(W,{variant:`ghost`,size:`sm`,className:`h-7 gap-1 px-2 text-xs`,onClick:()=>a(e.id,!0),children:[(0,V.jsx)(D,{className:`h-3.5 w-3.5`}),` Resolve`]}),(0,V.jsxs)(W,{variant:`ghost`,size:`sm`,className:`h-7 gap-1 px-2 text-xs text-destructive hover:text-destructive`,onClick:()=>o(e.id),children:[(0,V.jsx)(kt,{className:`h-3.5 w-3.5`}),` Delete`]})]}),(0,V.jsx)(W,{size:`sm`,className:`h-7 px-3 text-xs`,onClick:d,disabled:!s.trim(),children:u?`Comment`:`Reply`})]})]}),e.resolved&&(0,V.jsxs)(`div`,{className:`mt-2 flex gap-1`,onClick:e=>e.stopPropagation(),children:[(0,V.jsxs)(W,{variant:`ghost`,size:`sm`,className:`h-7 gap-1 px-2 text-xs`,onClick:()=>a(e.id,!1),children:[(0,V.jsx)(at,{className:`h-3.5 w-3.5`}),` Reopen`]}),(0,V.jsxs)(W,{variant:`ghost`,size:`sm`,className:`h-7 gap-1 px-2 text-xs text-destructive hover:text-destructive`,onClick:()=>o(e.id),children:[(0,V.jsx)(kt,{className:`h-3.5 w-3.5`}),` Delete`]})]})]})}function mh({threads:e,activeId:t,onSelect:n,onSubmitBody:r,onReply:i,onResolve:a,onRemove:o,onClose:s}){let c=e.filter(e=>!e.resolved),l=e.filter(e=>e.resolved);return(0,V.jsxs)(`aside`,{className:`flex h-full w-full flex-col border-l border-border bg-background`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border px-3 py-2`,children:[(0,V.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Comments`}),(0,V.jsx)(W,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:s,"aria-label":`Close comments`,children:(0,V.jsx)(Le,{className:`h-4 w-4`})})]}),(0,V.jsx)(`div`,{className:`flex-1 space-y-2 overflow-y-auto p-3`,children:e.length===0?(0,V.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-10 text-center text-muted-foreground`,children:[(0,V.jsx)(Pe,{className:`h-8 w-8 opacity-50`}),(0,V.jsx)(`p`,{className:`text-sm`,children:`No comments yet`}),(0,V.jsx)(`p`,{className:`text-xs`,children:`Select text in the document, then choose “Comment”.`})]}):(0,V.jsxs)(V.Fragment,{children:[c.map(e=>(0,V.jsx)(ph,{thread:e,active:e.id===t,onSelect:n,onSubmitBody:r,onReply:i,onResolve:a,onRemove:o},e.id)),l.length>0&&(0,V.jsxs)(`div`,{className:`pt-2`,children:[(0,V.jsxs)(`p`,{className:`mb-1 px-1 text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:[`Resolved (`,l.length,`)`]}),(0,V.jsx)(`div`,{className:`space-y-2`,children:l.map(e=>(0,V.jsx)(ph,{thread:e,active:e.id===t,onSelect:n,onSubmitBody:r,onReply:i,onResolve:a,onRemove:o},e.id))})]})]})})]})}function hh(){let[e,t]=(0,B.useState)({}),n=(0,B.useRef)(e);n.current=e;let r=(0,B.useCallback)(e=>{t(t=>({...t,[e.id]:e}))},[]),i=(0,B.useCallback)((e,n)=>{t(t=>t[e]?{...t,[e]:{...t[e],text:n}}:t)},[]),a=(0,B.useCallback)((e,n)=>{t(t=>t[e]?{...t,[e]:{...t[e],replies:[...t[e].replies||[],n]}}:t)},[]),o=(0,B.useCallback)((e,n)=>{t(t=>t[e]?{...t,[e]:{...t[e],resolved:n}}:t)},[]),s=(0,B.useCallback)(e=>{t(t=>{if(!t[e])return t;let n={...t};return delete n[e],n})},[]),c=(0,B.useCallback)(e=>{t(t=>{let n={};for(let r of e){let e=t[r.id];n[r.id]=e?{...r,text:e.text||r.text,replies:e.replies}:r}return n})},[]),l=(0,B.useCallback)(e=>!!n.current[e],[]);return{threads:Object.values(e).sort((e,t)=>t.timestamp-e.timestamp),addThread:r,setThreadText:i,addReply:a,setResolved:o,removeThread:s,hydrate:c,has:l}}var gh=`comment`;function _h(e,t){let n=null,r=null;return e.state.doc.descendants((e,i)=>{e.isText&&e.marks.some(e=>e.type.name===gh&&e.attrs.id===t)&&(n===null&&(n=i),r=i+e.nodeSize)}),n===null||r===null?null:{from:n,to:r}}function vh(e,t,n){let r=_h(e,t);if(!r)return!1;let{state:i,view:a}=e,o=i.schema.marks[gh];if(!o)return!1;let s=i.tr;return i.doc.nodesBetween(r.from,r.to,(e,i)=>{if(!e.isText)return;let a=e.marks.find(e=>e.type===o&&e.attrs.id===t);if(!a)return;let c=Math.max(i,r.from),l=Math.min(i+e.nodeSize,r.to);s.removeMark(c,l,o),s.addMark(c,l,o.create({...a.attrs,...n}))}),s.docChanged&&a.dispatch(s),!0}function yh(e,t){let n=_h(e,t);if(!n)return!1;let{state:r,view:i}=e,a=r.schema.marks[gh];if(!a)return!1;let o=r.tr.removeMark(n.from,n.to,a);return o.docChanged&&i.dispatch(o),!0}function bh(e,t){let n=_h(e,t);return n?(e.chain().setTextSelection(n).run(),e.view.dom.querySelector(`[data-comment-id="${t}"]`)?.scrollIntoView({behavior:`smooth`,block:`center`}),!0):!1}function xh(e){let t=new Map;return e.state.doc.descendants(e=>{if(e.isText)for(let n of e.marks){if(n.type.name!==gh)continue;let e=n.attrs;!e.id||t.has(e.id)||t.set(e.id,{id:e.id,authorId:e.authorId??``,authorName:e.authorName??`Anonymous`,authorColor:e.authorColor??`#4F46E5`,text:e.text??``,timestamp:typeof e.timestamp==`number`?e.timestamp:Date.now(),resolved:!!e.resolved,replies:[]})}}),[...t.values()]}function Sh(e){if(!e.isActive(gh))return null;let t=e.getAttributes(gh).id;return typeof t==`string`&&t?t:null}function Ch(){let e=(0,B.useRef)({loadedContentKey:null,shouldSuppressNextLoad:!1});return{shouldLoadContent:(0,B.useCallback)(t=>{let n=e.current;return n.shouldSuppressNextLoad?(console.log(`[SyncStore] ⏭️ Suppressing load (own onChange)`),n.shouldSuppressNextLoad=!1,!1):n.loadedContentKey!==t||(console.log(`[SyncStore] ⏭️ Same contentKey, skipping reload`),!1)},[]),markContentLoaded:(0,B.useCallback)(t=>{console.log(`[SyncStore] ✅ Marking content loaded for key:`,t),e.current.loadedContentKey=t},[]),markContentSaved:(0,B.useCallback)(()=>{console.log(`[SyncStore] 💾 Marking content saved (will suppress next load)`),e.current.shouldSuppressNextLoad=!0},[])}}var wh=2e4,Th=300,Eh={id:`local-user`,name:`You`,color:`#4F46E5`};function Dh(e){if(!e)return[];let t=e.getJSON(),n=[];return(t.content??[]).forEach((e,t)=>{if(e.type===`heading`&&e.attrs?.level){let r=(e.content??[]).map(e=>e.text??``).join(``);n.push([`${e.attrs.level}:${t}:${r}`,r,`h${e.attrs.level}`])}}),n}var Oh=(0,B.forwardRef)(({content:e,contentKey:t,onChange:n,onHeadingsChange:r,readOnly:i},a)=>{let o=Ch(),[s,c]=(0,B.useState)(`light`),l=t??e.slice(0,40),u=hh(),d=(0,B.useRef)(u);d.current=u;let[f,p]=(0,B.useState)(!1),[m,h]=(0,B.useState)(null),[g,_]=(0,B.useState)(!0),v=(0,B.useMemo)(()=>[...oh.filter(e=>e.name!==`comment`),b.configure({authorId:Eh.id,authorName:Eh.name,authorColor:Eh.color,onCommentAdd:e=>d.current.addThread(e),onCommentRemove:e=>d.current.removeThread(e),onCommentResolve:(e,t)=>d.current.setResolved(e,t)})],[]),y=(0,B.useRef)(n),x=(0,B.useRef)(r),S=(0,B.useRef)(!1),C=(0,B.useRef)(null),w=(0,B.useRef)(null),T=(0,B.useRef)(0);(0,B.useEffect)(()=>{y.current=n},[n]),(0,B.useEffect)(()=>{x.current=r},[r]);let E=(0,B.useCallback)(e=>{if(!x.current)return;let t=Dh(e),n=Date.now(),r=n-T.current;r>=Th?(T.current=n,x.current(t)):(w.current&&clearTimeout(w.current),w.current=setTimeout(()=>{T.current=Date.now(),x.current?.(Dh(e))},Th-r))},[]),D=it({extensions:v,content:e,editable:!i,onUpdate:({editor:e})=>{S.current=!0,C.current&&clearTimeout(C.current),C.current=setTimeout(()=>{S.current&&(S.current=!1,o.markContentSaved(),y.current(e.getHTML()))},wh),E(e)},onSelectionUpdate:({editor:e})=>{_(e.state.selection.empty);let t=Sh(e);t&&(h(t),p(!0))}});(0,B.useEffect)(()=>{D&&o.shouldLoadContent(l)&&(D.commands.setContent(e||``),o.markContentLoaded(l),E(D),d.current.hydrate(xh(D)),h(null))},[D,l,o,E]),(0,B.useEffect)(()=>{D&&D.setEditable(!i)},[D,i]),(0,B.useEffect)(()=>{let e=D;return()=>{C.current&&clearTimeout(C.current),w.current&&clearTimeout(w.current),e&&S.current&&(S.current=!1,o.markContentSaved(),y.current(e.getHTML()))}},[D,o]);let k=(0,B.useCallback)(e=>{if(!D)return null;let t=e.indexOf(`:`),n=e.indexOf(`:`,t+1),r=e.slice(0,t),i=e.slice(n+1);for(let e of D.view.dom.querySelectorAll(`h${r}`))if(e.textContent?.trim()===i)return e;return null},[D]);(0,B.useImperativeHandle)(a,()=>({scrollToHeading:e=>k(e)?.scrollIntoView({behavior:`smooth`,block:`start`}),getElementByKey:e=>k(e)}),[k]);let A=(0,B.useCallback)(()=>{if(!D)return;let e=`comment-${Date.now()}`;D.chain().focus().setComment({id:e}).run()&&(h(e),p(!0))},[D]),j=(0,B.useCallback)(e=>{h(e),D&&bh(D,e)},[D]),ee=(0,B.useCallback)((e,t)=>{u.setResolved(e,t),D&&vh(D,e,{resolved:t})},[D,u]),M=(0,B.useCallback)(e=>{u.removeThread(e),D&&yh(D,e),h(t=>t===e?null:t)},[D,u]),N=(0,B.useCallback)((e,t)=>{u.addReply(e,{id:`reply-${Date.now()}`,authorId:Eh.id,authorName:Eh.name,authorColor:Eh.color,text:t,timestamp:Date.now()})},[u]),te=u.threads.filter(e=>!e.resolved).length;return(0,V.jsxs)(`div`,{className:`flex h-full w-full flex-col bg-editor-bg`,children:[(0,V.jsx)(ah,{editor:D,theme:s,setTheme:c}),(0,V.jsx)(O,{editor:D,dark:s===`dark`,children:(0,V.jsxs)(`div`,{className:`flex-1 flex flex-col overflow-hidden`,children:[!i&&(0,V.jsx)(jt,{theme:s,setTheme:c,onAddComment:A,commentDisabled:g,showComments:f,onToggleComments:()=>p(e=>!e),commentCount:te}),(0,V.jsxs)(`div`,{className:`flex flex-1 min-h-0 overflow-hidden`,children:[(0,V.jsx)(`div`,{className:`flex-1 min-h-0 overflow-auto prose dark:prose-invert max-w-none px-4 py-3`,children:(0,V.jsx)(pt,{editor:D})}),!i&&f&&(0,V.jsx)(`div`,{className:`w-80 shrink-0`,children:(0,V.jsx)(mh,{threads:u.threads,activeId:m,onSelect:j,onSubmitBody:u.setThreadText,onReply:N,onResolve:ee,onRemove:M,onClose:()=>p(!1)})})]}),!i&&(0,V.jsx)(Nt,{})]})})]})});Oh.displayName=`TiptapEditorWrapper`;function kh({activeDocument:e,documents:t,splitViewDocId:n,activeDocId:r,isMobile:i,editorRef:a,onUpdateDocument:o,onHeadingsChange:s,onCloseSplitView:c,aiSuggestion:l,isAiLoading:u,onAiRewrite:d,onAiApprove:f,onAiReject:p,onAiRegenerate:m,onInviteClick:h,onShareClick:g}){if(!e)return(0,V.jsx)(`div`,{className:`flex h-full items-center justify-center bg-editor-bg`,children:(0,V.jsxs)(`div`,{className:`text-center`,children:[(0,V.jsx)(Kt,{className:`mx-auto h-16 w-16 text-muted-foreground mb-4`}),(0,V.jsx)(`h2`,{className:`text-2xl font-serif font-semibold text-foreground mb-2`,children:`No Note Selected`}),(0,V.jsx)(`p`,{className:`text-muted-foreground`,children:i?`Tap the menu to select a note`:`Select a note from the sidebar or create a new one`})]})});if(n&&n!==r){let r=t.find(e=>e.id===n);return(0,V.jsx)(`div`,{className:`flex-1 h-full`,children:(0,V.jsxs)(tp,{direction:`horizontal`,children:[(0,V.jsx)(Wf,{minSize:`300px`,children:(0,V.jsx)(`div`,{className:`flex flex-col h-full border-r border-border`,children:(0,V.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,V.jsx)(Oh,{ref:a,contentKey:e.id,content:e.content,onChange:t=>o(e.id,{content:t}),title:e.title,onTitleChange:t=>o(e.id,{title:t}),scrollToHeading:()=>{},onHeadingsChange:s,aiSuggestion:l,isAiLoading:u,onAiRewrite:d,onAiApprove:f,onAiReject:p,onAiRegenerate:m,onInviteClick:h,onShareClick:g,documentId:e.id})})})}),(0,V.jsx)(Wf,{minSize:`300px`,children:(0,V.jsx)(`div`,{className:`flex flex-col h-full`,children:r?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2 border-b border-border bg-muted/30`,children:[(0,V.jsx)(`span`,{className:`text-sm font-medium`,children:r.title}),(0,V.jsx)(W,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0`,onClick:c,title:`Close split view`,children:(0,V.jsx)(Le,{className:`h-3 w-3`})})]}),(0,V.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,V.jsx)(Oh,{content:r.content,onChange:e=>o(r.id,{content:e}),title:r.title,onTitleChange:e=>o(r.id,{title:e}),scrollToHeading:()=>{},onInviteClick:h,onShareClick:g,documentId:r.id})})]}):null})})]})})}return(0,V.jsx)(`div`,{className:`h-full flex flex-col`,children:(0,V.jsx)(Oh,{ref:a,contentKey:e.id,content:e.content,onChange:t=>o(e.id,{content:t}),title:e.title,onTitleChange:t=>o(e.id,{title:t}),scrollToHeading:()=>{},onHeadingsChange:s,aiSuggestion:l,isAiLoading:u,onAiRewrite:d,onAiApprove:f,onAiReject:p,onAiRegenerate:m,onInviteClick:h,onShareClick:g,documentId:e.id})})}var Ah={top:!1,right:!1,bottom:!1,left:!0,topRight:!1,bottomRight:!1,bottomLeft:!1,topLeft:!1},jh=Object.fromEntries(Pc.map(({type:e,label:t})=>[e,t]));function Mh({panels:e,split:t,documents:n,activeId:r,activeDocument:i,onSelect:a,onAdd:o,onDelete:s,onDuplicate:c,onMove:l,onManageTags:u,onRename:d,headings:f,onNavigate:p,openTabs:m,activeTab:h,onTabChange:g,onTabClose:_,onTabRename:v,onSplitRight:y,onReopenLastClosed:b,canReopenLastClosed:x,outlineRef:S,aiProps:C,onClose:w}){let[T,E]=(0,B.useState)(320),D=e.length===1?jh[e[0]]:`Right Panel`;return(0,V.jsx)(ue,{size:{width:T,height:`100%`},onResizeStop:(e,t,n)=>E(n.offsetWidth),minWidth:260,maxWidth:640,enable:Ah,className:`h-full flex flex-col border-l border-sidebar-border/60 bg-sidebar-background shrink-0`,children:(0,V.jsxs)(`div`,{className:`h-full overflow-hidden flex flex-col`,children:[(0,V.jsxs)(`div`,{className:`px-3 py-2 border-b border-sidebar-border/60 flex items-center justify-between select-none shrink-0`,children:[(0,V.jsx)(`h3`,{className:`text-sm font-semibold text-sidebar-foreground`,children:D}),(0,V.jsx)(W,{variant:`ghost`,size:`sm`,className:`h-7 px-2`,onClick:w,children:(0,V.jsx)(Le,{className:`h-4 w-4`})})]}),(0,V.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,V.jsx)(ip,{panels:e,split:t,persistenceKey:`right`,activeDocuments:n,activeId:r,activeDocument:i,headings:f,onSelect:a,onAdd:o,onDelete:s,onDuplicate:c,onMove:l,onManageTags:u,onRename:d,outlineRef:S,openTabs:m,activeTab:h,onTabChange:g,onTabClose:_,onTabRename:v,onSplitRight:y,onReopenLastClosed:b,canReopenLastClosed:x,onNavigate:p,aiProps:C})})]})})}function Nh({className:e,children:t,...n}){return(0,V.jsxs)(zm,{"data-slot":`scroll-area`,className:H(`relative`,e),...n,children:[(0,V.jsx)(Bm,{"data-slot":`scroll-area-viewport`,className:`focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1 [&>div]:!block`,children:t}),(0,V.jsx)(Ph,{}),(0,V.jsx)(Ph,{orientation:`horizontal`}),(0,V.jsx)(Vm,{})]})}function Ph({className:e,orientation:t=`vertical`,...n}){return(0,V.jsx)(pm,{"data-slot":`scroll-area-scrollbar`,orientation:t,className:H(`flex touch-none p-px transition-colors select-none`,t===`vertical`&&`h-full w-2.5 border-l border-l-transparent`,t===`horizontal`&&`h-2.5 flex-col border-t border-t-transparent`,e),...n,children:(0,V.jsx)(wm,{"data-slot":`scroll-area-thumb`,className:`bg-border relative flex-1 rounded-full`})})}var Fh=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`span`,{ref:n,className:H(`absolute w-px h-px p-0 -m-px overflow-hidden whitespace-nowrap border-0`,e),style:{clip:`rect(0, 0, 0, 0)`,clipPath:`inset(50%)`},...t}));Fh.displayName=`VisuallyHidden`;var Ih=({open:e,onOpenChange:t,documents:n,onSelectDocument:r,onOpenSettings:i,onOpenTeams:a,onToggleTheme:o,currentTheme:s=`light`})=>{let[c,l]=(0,B.useState)(``),u=(0,B.useRef)(null),d=(0,B.useMemo)(()=>{let e=[];return i&&e.push({id:`settings`,label:`Open Settings`,icon:(0,V.jsx)(Ge,{className:`h-4 w-4`}),action:()=>{i(),t(!1)},keywords:[`settings`,`preferences`,`config`]}),a&&e.push({id:`teams`,label:`Manage Teams`,icon:(0,V.jsx)(rt,{className:`h-4 w-4`}),action:()=>{a(),t(!1)},keywords:[`teams`,`organization`,`members`,`collaborate`]}),o&&e.push({id:`theme`,label:s===`dark`?`Switch to Light Mode`:`Switch to Dark Mode`,icon:s===`dark`?(0,V.jsx)(ln,{className:`h-4 w-4`}):(0,V.jsx)(rn,{className:`h-4 w-4`}),action:()=>{o()},keywords:[`theme`,`dark`,`light`,`mode`,`appearance`]}),e},[i,a,o,s,t]),f=(0,B.useMemo)(()=>{if(!c.trim())return[];let e=[],t=c.toLowerCase();return n.forEach(n=>{let r=n.title.toLowerCase().includes(t),i=n.content.toLowerCase().includes(t);if(r)e.push({document:n,matchType:`title`});else if(i){let r=n.content.toLowerCase().indexOf(t),i=Math.max(0,r-40),a=Math.min(n.content.length,r+c.length+40),o=n.content.substring(i,a);e.push({document:n,matchType:`content`,preview:(i>0?`...`:``)+o+(a<n.content.length?`...`:``)})}}),e},[c,n]),p=(0,B.useMemo)(()=>{if(!c.trim())return d;let e=c.toLowerCase();return d.filter(t=>{let n=t.label.toLowerCase().includes(e),r=t.keywords?.some(t=>t.toLowerCase().includes(e));return n||r})},[c,d]),m=e=>{r(e),t(!1),l(``)};(0,B.useEffect)(()=>{e?setTimeout(()=>u.current?.focus(),100):l(``)},[e]),(0,B.useEffect)(()=>{let n=n=>{e&&n.key===`Escape`&&t(!1)};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t]);let h=p.length>0,g=f.length>0,_=c.trim()!==``&&!h&&!g;return(0,V.jsx)(sc,{open:e,onOpenChange:t,children:(0,V.jsxs)(uc,{className:`max-w-2xl w-[95vw] sm:w-full p-0 gap-0 max-h-[90vh] sm:max-h-[85vh]`,children:[(0,V.jsx)(Fh,{children:(0,V.jsx)(fc,{children:`Search notes and commands`})}),(0,V.jsx)(dc,{className:`px-4 py-4 border-b border-border`,children:(0,V.jsxs)(`div`,{className:`relative`,children:[(0,V.jsx)(Vt,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground`}),(0,V.jsx)(q,{ref:u,type:`text`,placeholder:`Search notes or type a command...`,value:c,onChange:e=>l(e.target.value),className:`pl-9 pr-9 border-none shadow-none focus-visible:ring-0 text-sm sm:text-base`}),c&&(0,V.jsx)(`button`,{onClick:()=>l(``),className:`absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,children:(0,V.jsx)(Le,{className:`h-4 w-4`})})]})}),(0,V.jsx)(Nh,{className:`max-h-[50vh] sm:max-h-[60vh]`,children:c.trim()===``?(0,V.jsxs)(`div`,{className:`py-2`,children:[d.length>0&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`px-4 py-2`,children:(0,V.jsx)(`h3`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wider`,children:`Quick Actions`})}),d.map(e=>(0,V.jsx)(`button`,{onClick:e.action,className:`w-full px-4 py-3 text-left hover:bg-muted/50 transition-colors border-b border-border last:border-0`,children:(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(`div`,{className:`flex-shrink-0 text-muted-foreground`,children:e.icon}),(0,V.jsx)(`span`,{className:`text-sm font-medium`,children:e.label})]})},e.id))]}),(0,V.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 px-4 text-center`,children:[(0,V.jsx)(mt,{className:`h-12 w-12 text-muted-foreground mb-4 opacity-50`}),(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Type to search across all your notes`})]})]}):_?(0,V.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 px-4 text-center`,children:[(0,V.jsx)(Kt,{className:`h-12 w-12 text-muted-foreground mb-4 opacity-50`}),(0,V.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`No results found for "`,c,`"`]})]}):(0,V.jsxs)(`div`,{className:`py-2`,children:[h&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`px-4 py-2`,children:(0,V.jsx)(`h3`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wider`,children:`Commands`})}),p.map(e=>(0,V.jsx)(`button`,{onClick:e.action,className:`w-full px-4 py-3 text-left hover:bg-muted/50 transition-colors border-b border-border`,children:(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(`div`,{className:`flex-shrink-0 text-muted-foreground`,children:e.icon}),(0,V.jsx)(`span`,{className:`text-sm font-medium`,children:e.label})]})},e.id))]}),g&&(0,V.jsxs)(V.Fragment,{children:[h&&(0,V.jsx)(`div`,{className:`px-4 py-2 mt-2`,children:(0,V.jsx)(`h3`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wider`,children:`Notes`})}),f.map(e=>(0,V.jsx)(`button`,{onClick:()=>m(e.document.id),className:`w-full px-4 py-3 text-left hover:bg-muted/50 transition-colors border-b border-border last:border-0`,children:(0,V.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,V.jsx)(Kt,{className:`h-4 w-4 mt-1 flex-shrink-0 text-muted-foreground`}),(0,V.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,V.jsx)(`h3`,{className:`font-medium text-sm mb-1 truncate`,children:e.document.title||`Untitled`}),e.matchType===`content`&&e.preview&&(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground line-clamp-2`,children:e.preview}),e.matchType===`title`&&e.document.content&&(0,V.jsxs)(`p`,{className:`text-xs text-muted-foreground line-clamp-2`,children:[e.document.content.substring(0,120),e.document.content.length>120?`...`:``]})]})]})},e.document.id))]})]})}),(0,V.jsxs)(`div`,{className:`px-4 py-3 border-t border-border bg-muted/30`,children:[(0,V.jsxs)(`p`,{className:`text-xs text-muted-foreground text-center hidden sm:block`,children:[`Press `,(0,V.jsx)(`kbd`,{className:`px-1.5 py-0.5 rounded bg-background border border-border`,children:`⌘K`}),` or `,(0,V.jsx)(`kbd`,{className:`px-1.5 py-0.5 rounded bg-background border border-border`,children:`Ctrl+K`}),` to open • `,(0,V.jsx)(`kbd`,{className:`px-1.5 py-0.5 rounded bg-background border border-border`,children:`ESC`}),` to close`]}),(0,V.jsxs)(`p`,{className:`text-xs text-muted-foreground text-center sm:hidden`,children:[`Tap `,(0,V.jsx)(`kbd`,{className:`px-1.5 py-0.5 rounded bg-background border border-border`,children:`ESC`}),` to close`]})]})]})})};function Lh({...e}){return(0,V.jsx)(`nav`,{"aria-label":`breadcrumb`,"data-slot":`breadcrumb`,...e})}function Rh({className:e,...t}){return(0,V.jsx)(`ol`,{"data-slot":`breadcrumb-list`,className:H(`text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5`,e),...t})}function zh({className:e,...t}){return(0,V.jsx)(`li`,{"data-slot":`breadcrumb-item`,className:H(`inline-flex items-center gap-1.5`,e),...t})}function Bh({asChild:e,className:t,...n}){return(0,V.jsx)(e?we:`a`,{"data-slot":`breadcrumb-link`,className:H(`hover:text-foreground transition-colors`,t),...n})}function Vh({className:e,...t}){return(0,V.jsx)(`span`,{"data-slot":`breadcrumb-page`,role:`link`,"aria-disabled":`true`,"aria-current":`page`,className:H(`text-foreground font-normal`,e),...t})}function Hh({children:e,className:t,...n}){return(0,V.jsx)(`li`,{"data-slot":`breadcrumb-separator`,role:`presentation`,"aria-hidden":`true`,className:H(`[&>svg]:size-3.5`,t),...n,children:e??(0,V.jsx)(ie,{})})}var Uh=1024;function Wh(){let[e,t]=B.useState(void 0);return B.useEffect(()=>{let e=window.matchMedia(`(max-width: 1023px)`),n=()=>{t(window.innerWidth<Uh)};return e.addEventListener(`change`,n),t(window.innerWidth<Uh),()=>e.removeEventListener(`change`,n)},[]),!!e}function Gh({className:e,orientation:t=`horizontal`,decorative:n=!0,...r}){return(0,V.jsx)(Se,{"data-slot":`separator`,decorative:n,orientation:t,className:H(`bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px`,e),...r})}var Kh=`sidebar_state`,qh=604800,Jh=`420px`,Yh=`16.2rem`,Xh=`5.2875rem`,Zh=`b`,Qh=B.createContext(null);function $h(){let e=B.useContext(Qh);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function eg({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:i,children:a,...o}){let s=Wh(),[c,l]=B.useState(!1),[u,d]=B.useState(e),f=t??u,p=B.useCallback(e=>{let t=typeof e==`function`?e(f):e;n?n(t):d(t),document.cookie=`${Kh}=${t}; path=/; max-age=${qh}`},[n,f]),m=B.useCallback(()=>s?l(e=>!e):p(e=>!e),[s,p,l]);B.useEffect(()=>{let e=e=>{let t=document.activeElement;if(t){let e=t.tagName.toLowerCase();if(e===`input`||e===`textarea`||t.getAttribute(`contenteditable`)===`true`||t.closest(`.cm-editor`)||t.closest(`.ProseMirror`))return}e.key===Zh&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),m())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[m,null]);let h=f?`expanded`:`collapsed`,g=B.useMemo(()=>({state:h,open:f,setOpen:p,isMobile:s,openMobile:c,setOpenMobile:l,toggleSidebar:m}),[h,f,p,s,c,l,m]);return(0,V.jsx)(Qh.Provider,{value:g,children:(0,V.jsx)(xc,{delayDuration:0,children:(0,V.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:{"--sidebar-width":Jh,"--sidebar-width-icon":Xh,...i},className:H(`group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full`,r),...o,children:a})})})}function tg({side:e=`left`,variant:t=`sidebar`,collapsible:n=`offcanvas`,className:r,children:i,...a}){let{isMobile:o,state:s,openMobile:c,setOpenMobile:l}=$h();return n===`none`?(0,V.jsx)(`div`,{"data-slot":`sidebar`,className:H(`bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col`,r),...a,children:i}):o?(0,V.jsx)(gn,{open:c,onOpenChange:l,...a,children:(0,V.jsxs)(yn,{"data-sidebar":`sidebar`,"data-slot":`sidebar`,"data-mobile":`true`,className:`bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden`,style:{"--sidebar-width":Yh},side:e,children:[(0,V.jsxs)(bn,{className:`sr-only`,children:[(0,V.jsx)(xn,{children:`Sidebar`}),(0,V.jsx)(Sn,{children:`Displays the mobile sidebar.`})]}),(0,V.jsx)(`div`,{className:`flex h-full w-full flex-col`,children:i})]})}):(0,V.jsxs)(`div`,{className:`group peer text-sidebar-foreground hidden md:block`,"data-state":s,"data-collapsible":s===`collapsed`?n:``,"data-variant":t,"data-side":e,"data-slot":`sidebar`,children:[(0,V.jsx)(`div`,{"data-slot":`sidebar-gap`,className:H(`relative w-[var(--sidebar-width)] bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,t===`floating`||t===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+var(--spacing-4))]`:`group-data-[collapsible=icon]:w-[var(--sidebar-width-icon)]`)}),(0,V.jsx)(`div`,{"data-slot":`sidebar-container`,className:H(`fixed inset-y-0 z-10 hidden h-svh w-[var(--sidebar-width)] transition-[left,right,width] duration-200 ease-linear md:flex`,e===`left`?`left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]`:`right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]`,t===`floating`||t===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+var(--spacing-4)+2px)]`:`group-data-[collapsible=icon]:w-[var(--sidebar-width-icon)] group-data-[side=left]:border-r group-data-[side=right]:border-l`,r),...a,children:(0,V.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm`,children:i})})]})}function ng({className:e,...t}){return(0,V.jsx)(`div`,{"data-slot":`sidebar-content`,"data-sidebar":`content`,className:H(`flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden`,e),...t})}function rg({className:e,...t}){return(0,V.jsx)(`div`,{"data-slot":`sidebar-group`,"data-sidebar":`group`,className:H(`relative flex w-full min-w-0 flex-col p-2`,e),...t})}function ig({className:e,...t}){return(0,V.jsx)(`div`,{"data-slot":`sidebar-group-content`,"data-sidebar":`group-content`,className:H(`w-full text-sm`,e),...t})}function ag({className:e,...t}){return(0,V.jsx)(`ul`,{"data-slot":`sidebar-menu`,"data-sidebar":`menu`,className:H(`flex w-full min-w-0 flex-col gap-1`,e),...t})}function og({className:e,...t}){return(0,V.jsx)(`li`,{"data-slot":`sidebar-menu-item`,"data-sidebar":`menu-item`,className:H(`group/menu-item relative`,e),...t})}var sg=Ne(`cursor-pointer peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-2xl p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0`,{variants:{variant:{default:`hover:bg-sidebar-accent hover:text-sidebar-accent-foreground`,outline:`bg-background shadow-[0_0_0_1.5px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1.5px_hsl(var(--sidebar-accent))]`},size:{default:`h-8 text-sm`,sm:`h-7 text-xs`,lg:`h-12 text-sm group-data-[collapsible=icon]:p-0!`}},defaultVariants:{variant:`default`,size:`default`}});function cg({asChild:e=!1,isActive:t=!1,variant:n=`default`,size:r=`default`,tooltip:i,className:a,...o}){let s=e?we:`button`,{isMobile:c,state:l}=$h(),u=(0,V.jsx)(s,{"data-slot":`sidebar-menu-button`,"data-sidebar":`menu-button`,"data-size":r,"data-active":t,className:H(sg({variant:n,size:r}),a),...o});return i?(typeof i==`string`&&(i={children:i}),(0,V.jsxs)(Sc,{children:[(0,V.jsx)(Cc,{asChild:!0,children:u}),(0,V.jsx)(wc,{side:`right`,align:`center`,hidden:l!==`collapsed`||c,...i})]})):u}function lg({className:e,...t}){return(0,V.jsx)(ze,{"data-slot":`label`,className:H(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}function ug({className:e,...t}){return(0,V.jsx)(qp,{"data-slot":`radio-group`,className:H(`grid gap-3`,e),...t})}function dg({className:e,...t}){return(0,V.jsx)(Qp,{"data-slot":`radio-group-item`,className:H(`border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50`,e),...t,children:(0,V.jsx)(em,{"data-slot":`radio-group-indicator`,className:`relative flex items-center justify-center`,children:(0,V.jsx)(Qe,{className:`fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2`})})})}var fg=[`modern-minimal`,`elegant-luxury`,`cyberpunk`,`twitter`,`mocha-mousse`,`amethyst-haze`,`notebook`,`doom-64`,`catppuccin`,`graphite`,`perpetuity`,`kodama-grove`,`cosmic-night`,`tangerine`,`nature`,`bold-tech`,`amber-minimal`,`supabase`,`neo-brutalism`,`quantum-rose`,`solar-dusk`,`bubblegum`,`pink-lemonade`,`claymorphism`,`pastel-dreams`],pg={"modern-minimal":{primary:`#3b82f6`,secondary:`#f3f4f6`},"elegant-luxury":{primary:`#9b2c2c`,secondary:`#fdf2d6`},cyberpunk:{primary:`#ff00c8`,secondary:`#f0f0ff`},twitter:{primary:`#1e9df1`,secondary:`#0f1419`},"mocha-mousse":{primary:`#A37764`,secondary:`#BAAB92`},bubblegum:{primary:`#d04f99`,secondary:`#8acfd1`},"amethyst-haze":{primary:`#8a79ab`,secondary:`#dfd9ec`},"pink-lemonade":{primary:`#a84370`,secondary:`#f1c4e6`},notebook:{primary:`#606060`,secondary:`#dedede`},"doom-64":{primary:`#b71c1c`,secondary:`#556b2f`},catppuccin:{primary:`#8839ef`,secondary:`#ccd0da`},graphite:{primary:`#606060`,secondary:`#e0e0e0`},perpetuity:{primary:`#06858e`,secondary:`#d9eaea`},"kodama-grove":{primary:`#8d9d4f`,secondary:`#decea0`},"cosmic-night":{primary:`#6e56cf`,secondary:`#e4dfff`},tangerine:{primary:`#e05d38`,secondary:`#f3f4f6`},"quantum-rose":{primary:`#e6067a`,secondary:`#ffd6ff`},nature:{primary:`#2e7d32`,secondary:`#e8f5e9`},"bold-tech":{primary:`#8b5cf6`,secondary:`#f3f0ff`},"amber-minimal":{primary:`#f59e0b`,secondary:`#f3f4f6`},supabase:{primary:`#72e3ad`,secondary:`#fdfdfd`},"neo-brutalism":{primary:`#ff3333`,secondary:`#ffff00`},"solar-dusk":{primary:`#B45309`,secondary:`#E4C090`},claymorphism:{primary:`#6366f1`,secondary:`#d6d3d1`},"pastel-dreams":{primary:`#a78bfa`,secondary:`#e9d8fd`}};function mg(){let{theme:e,setTheme:t}=Fe(),[n,r]=(0,B.useState)(`modern-minimal`),[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(null);(0,B.useEffect)(()=>{a(!0);let e=localStorage.getItem(`color-theme`);e&&fg.includes(e)&&r(e)},[]);let c=e=>{r(e),localStorage.setItem(`color-theme`,e),document.cookie=`color-theme=${e}; path=/; max-age=31536000`,fg.forEach(e=>document.documentElement.classList.remove(`theme-${e}`)),document.documentElement.classList.add(`theme-${e}`),s(null)},l=e=>{s(e),fg.forEach(e=>document.documentElement.classList.remove(`theme-${e}`)),document.documentElement.classList.add(`theme-${e}`)},u=()=>{o&&(fg.forEach(e=>document.documentElement.classList.remove(`theme-${e}`)),document.documentElement.classList.add(`theme-${n}`),s(null))},d=e=>e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `),f=()=>{t(e===`dark`?`light`:`dark`)};return i?(0,V.jsxs)(Tc,{onOpenChange:e=>!e&&u(),children:[(0,V.jsx)(Ec,{asChild:!0,children:(0,V.jsx)(W,{variant:`ghost`,size:`icon`,className:`relative`,children:(0,V.jsx)(We,{name:`icon-themes`,className:`h-5 w-5`})})}),(0,V.jsxs)(Dc,{align:`end`,className:`w-56 max-h-[400px] overflow-y-auto`,children:[(0,V.jsxs)(Ac,{className:`flex items-center justify-between`,children:[(0,V.jsx)(`span`,{children:`Theme`}),(0,V.jsx)(W,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:e=>{e.stopPropagation(),f()},children:e===`dark`?(0,V.jsx)(rn,{className:`h-4 w-4`}):(0,V.jsx)(ln,{className:`h-4 w-4`})})]}),(0,V.jsx)(jc,{}),fg.map(e=>{let t=pg[e];return(0,V.jsx)(Oc,{onClick:()=>c(e),onMouseEnter:()=>l(e),onMouseLeave:u,className:`cursor-pointer ${n===e?`bg-accent`:``}`,children:(0,V.jsxs)(`div`,{className:`flex items-center justify-between w-full`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t&&(0,V.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,V.jsx)(`div`,{className:`w-3 h-3 rounded-full border border-border`,style:{backgroundColor:t.primary}}),(0,V.jsx)(`div`,{className:`w-3 h-3 rounded-full border border-border`,style:{backgroundColor:t.secondary}})]}),(0,V.jsx)(`span`,{children:d(e)})]}),n===e&&(0,V.jsx)(`span`,{className:`text-xs`,children:`✓`})]})},e)})]})]}):null}var hg=[{value:`light`,label:`Light`,icon:(0,V.jsx)(ln,{className:`h-4 w-4`}),description:`Clean and bright interface`},{value:`dark`,label:`Dark`,icon:(0,V.jsx)(rn,{className:`h-4 w-4`}),description:`Easy on the eyes in low light`},{value:`system`,label:`System`,icon:(0,V.jsx)(nn,{className:`h-4 w-4`}),description:`Sync with your system preferences`}],gg=({defaultSidebarView:e,onDefaultSidebarViewChange:t})=>{let{theme:n,setTheme:r}=Fe();return(0,V.jsxs)(`div`,{className:`space-y-6`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h2`,{className:`text-xl font-semibold mb-2`,children:`Appearance`}),(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Choose how REASON looks to you`})]}),(0,V.jsx)(Gh,{}),(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsx)(lg,{className:`text-base`,children:`Theme`}),(0,V.jsx)(ug,{value:n,onValueChange:r,className:`space-y-3`,children:hg.map(e=>(0,V.jsxs)(`div`,{className:`flex items-start space-x-3`,children:[(0,V.jsx)(dg,{value:e.value,id:e.value,className:`mt-1`}),(0,V.jsxs)(`label`,{htmlFor:e.value,className:`flex-1 cursor-pointer`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,V.jsx)(`div`,{className:`text-muted-foreground`,children:e.icon}),(0,V.jsx)(`span`,{className:`font-medium`,children:e.label})]}),(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.description})]})]},e.value))})]}),(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsx)(lg,{className:`text-base`,children:`Color Theme`}),(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground mb-2`,children:`Choose from various color themes to customize your interface`}),(0,V.jsx)(`div`,{className:`flex items-center`,children:(0,V.jsx)(mg,{})})]}),(0,V.jsx)(Gh,{}),(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsx)(lg,{className:`text-base`,children:`Default Sidebar View`}),(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground mb-2`,children:`Choose the default view when opening the application`}),(0,V.jsx)(ug,{value:e,onValueChange:e=>t?.(e),className:`space-y-3`,children:[{value:`tree`,label:`Documents Tree`,desc:`Show only the document tree`},{value:`outline`,label:`Outline Only`,desc:`Show only the headings outline`},{value:`split`,label:`Split View`,desc:`Show both tree and outline side by side`},{value:`last-used`,label:`Remember Last Used`,desc:`Use the view you had open last time`}].map(e=>(0,V.jsxs)(`div`,{className:`flex items-start space-x-3`,children:[(0,V.jsx)(dg,{value:e.value,id:e.value,className:`mt-1`}),(0,V.jsxs)(`label`,{htmlFor:e.value,className:`flex-1 cursor-pointer`,children:[(0,V.jsx)(`div`,{className:`flex items-center gap-2 mb-1`,children:(0,V.jsx)(`span`,{className:`font-medium`,children:e.label})}),(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.desc})]})]},e.value))})]})]})},_g=({enableDatabaseSync:e=!1,onEnableDatabaseSyncChange:t})=>(0,V.jsxs)(`div`,{className:`space-y-6`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h2`,{className:`text-xl font-semibold mb-2`,children:`Storage`}),(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Manage how your documents are stored`})]}),(0,V.jsx)(Gh,{}),(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,V.jsxs)(`div`,{className:`space-y-1`,children:[(0,V.jsxs)(lg,{className:`text-base flex items-center gap-2`,children:[(0,V.jsx)(Ut,{className:`h-4 w-4`}),`Database Sync`]}),(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Save documents to SQL database for persistent storage`})]}),(0,V.jsx)(`input`,{type:`checkbox`,id:`database-sync`,checked:e,onChange:e=>t?.(e.target.checked),className:`h-4 w-4 rounded border-gray-300`})]}),e?(0,V.jsx)(`div`,{className:`rounded-md bg-muted p-3 space-y-2`,children:(0,V.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,V.jsx)(Mt,{className:`h-4 w-4 text-muted-foreground mt-0.5`}),(0,V.jsxs)(`div`,{className:`space-y-1`,children:[(0,V.jsx)(`p`,{className:`text-sm font-medium`,children:`Database Sync Enabled`}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Your documents will be automatically saved to the database. Changes are synced every 2 seconds after editing.`})]})]})}):(0,V.jsx)(`div`,{className:`rounded-md bg-muted p-3 space-y-2`,children:(0,V.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,V.jsx)(Zt,{className:`h-4 w-4 text-muted-foreground mt-0.5`}),(0,V.jsxs)(`div`,{className:`space-y-1`,children:[(0,V.jsx)(`p`,{className:`text-sm font-medium`,children:`Local Storage Only`}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Your documents are stored in your browser's local storage. They won't be accessible from other devices.`})]})]})})]})]});function vg(e){if(!e||typeof document>`u`)return;let t=document.head||document.getElementsByTagName(`head`)[0],n=document.createElement(`style`);n.type=`text/css`,t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}Array(12).fill(0);var yg=1,bg=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{let{message:t,...n}=e,r=typeof e?.id==`number`||e.id?.length>0?e.id:yg++,i=this.toasts.find(e=>e.id===r),a=e.dismissible===void 0||e.dismissible;return this.dismissedToasts.has(r)&&this.dismissedToasts.delete(r),i?this.toasts=this.toasts.map(n=>n.id===r?(this.publish({...n,...e,id:r,title:t}),{...n,...e,id:r,dismissible:a,title:t}):n):this.addToast({title:t,...n,dismissible:a,id:r}),r},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(t=>t({id:e,dismiss:!0})))):this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:`error`}),this.success=(e,t)=>this.create({...t,type:`success`,message:e}),this.info=(e,t)=>this.create({...t,type:`info`,message:e}),this.warning=(e,t)=>this.create({...t,type:`warning`,message:e}),this.loading=(e,t)=>this.create({...t,type:`loading`,message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:t.loading,description:typeof t.description==`function`?void 0:t.description}));let r=Promise.resolve(e instanceof Function?e():e),i=n!==void 0,a,o=r.then(async e=>{if(a=[`resolve`,e],B.isValidElement(e))i=!1,this.create({id:n,type:`default`,message:e});else if(Sg(e)&&!e.ok){i=!1;let r=typeof t.error==`function`?await t.error(`HTTP error! status: ${e.status}`):t.error,a=typeof t.description==`function`?await t.description(`HTTP error! status: ${e.status}`):t.description,o=typeof r==`object`&&!B.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(e instanceof Error){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!B.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(t.success!==void 0){i=!1;let r=typeof t.success==`function`?await t.success(e):t.success,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!B.isValidElement(r)?r:{message:r};this.create({id:n,type:`success`,description:a,...o})}}).catch(async e=>{if(a=[`reject`,e],t.error!==void 0){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!B.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}}).finally(()=>{i&&(this.dismiss(n),n=void 0),t.finally==null||t.finally.call(t)}),s=()=>new Promise((e,t)=>o.then(()=>a[0]===`reject`?t(a[1]):e(a[1])).catch(t));return typeof n!=`string`&&typeof n!=`number`?{unwrap:s}:Object.assign(n,{unwrap:s})},this.custom=(e,t)=>{let n=t?.id||yg++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},xg=(e,t)=>{let n=t?.id||yg++;return bg.addToast({title:e,...t,id:n}),n},Sg=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,Y=Object.assign(xg,{success:bg.success,info:bg.info,warning:bg.warning,error:bg.error,custom:bg.custom,message:bg.message,promise:bg.promise,dismiss:bg.dismiss,loading:bg.loading},{getHistory:()=>bg.toasts,getToasts:()=>bg.getActiveToasts()});vg(`[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}`);var Cg={name:``,type:`local`,credentials:{}},wg=({open:e})=>{let[t,n]=(0,B.useState)([]),[r,i]=(0,B.useState)(null),[a,o]=(0,B.useState)(Cg);(0,B.useEffect)(()=>{e&&n(En())},[e]);let s=()=>{if(!a.name.trim()){Y.error(`Please enter a source name`);return}r&&r!==`new`?(kn(r,{name:a.name,credentials:a.type===`local`?void 0:a.credentials}),Y.success(`Source updated`)):(On({name:a.name,type:a.type,credentials:a.type===`local`?void 0:a.credentials}),Y.success(`Source added`)),n(En()),i(null),o(Cg)},c=e=>{An(e),n(En()),Y.success(`Source deleted`)},l=e=>{i(e.id),o({name:e.name,type:e.type,credentials:e.credentials||{}})},u=()=>{i(null),o(Cg)},d=e=>a.credentials[e],f=e=>o(t=>({...t,credentials:{...t.credentials,...e}})),p=({type:e})=>e===`local`?(0,V.jsx)(Zt,{className:`h-4 w-4`}):e===`ssh`?(0,V.jsx)(on,{className:`h-4 w-4`}):e===`s3`||e===`b2`?(0,V.jsx)(Bt,{className:`h-4 w-4`}):e===`r2`?(0,V.jsx)(Ut,{className:`h-4 w-4`}):e===`gdocs`?(0,V.jsx)(Kt,{className:`h-4 w-4`}):e===`turso`?(0,V.jsx)(mn,{className:`h-4 w-4`}):null,m=e=>e===`gdocs`?`Google Docs`:e===`turso`?`Turso DB`:e===`b2`?`Backblaze B2`:e.toUpperCase(),h=e=>e===`ssh`?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(X,{label:`Host`,children:(0,V.jsx)(q,{value:d(`host`)||``,onChange:e=>f({host:e.target.value}),placeholder:`example.com`})}),(0,V.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,V.jsx)(X,{label:`Port`,children:(0,V.jsx)(q,{type:`number`,value:d(`port`)||22,onChange:e=>f({port:parseInt(e.target.value)}),placeholder:`22`})}),(0,V.jsx)(X,{label:`Username`,children:(0,V.jsx)(q,{value:d(`username`)||``,onChange:e=>f({username:e.target.value}),placeholder:`user`})})]}),(0,V.jsx)(X,{label:`Password (Optional)`,children:(0,V.jsx)(q,{type:`password`,value:d(`password`)||``,onChange:e=>f({password:e.target.value}),placeholder:`••••••••`})}),(0,V.jsx)(X,{label:`Base Path (Optional)`,children:(0,V.jsx)(q,{value:d(`basePath`)||``,onChange:e=>f({basePath:e.target.value}),placeholder:`/home/user/documents`})})]}):e===`s3`?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(X,{label:`Access Key ID`,children:(0,V.jsx)(q,{value:d(`accessKeyId`)||``,onChange:e=>f({accessKeyId:e.target.value}),placeholder:`AKIAIOSFODNN7EXAMPLE`})}),(0,V.jsx)(X,{label:`Secret Access Key`,children:(0,V.jsx)(q,{type:`password`,value:d(`secretAccessKey`)||``,onChange:e=>f({secretAccessKey:e.target.value}),placeholder:`••••••••`})}),(0,V.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,V.jsx)(X,{label:`Region`,children:(0,V.jsx)(q,{value:d(`region`)||``,onChange:e=>f({region:e.target.value}),placeholder:`us-east-1`})}),(0,V.jsx)(X,{label:`Bucket`,children:(0,V.jsx)(q,{value:d(`bucket`)||``,onChange:e=>f({bucket:e.target.value}),placeholder:`my-bucket`})})]})]}):e===`r2`?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(X,{label:`Account ID`,children:(0,V.jsx)(q,{value:d(`accountId`)||``,onChange:e=>f({accountId:e.target.value}),placeholder:`your-account-id`})}),(0,V.jsx)(X,{label:`Access Key ID`,children:(0,V.jsx)(q,{value:d(`accessKeyId`)||``,onChange:e=>f({accessKeyId:e.target.value}),placeholder:`your-access-key-id`})}),(0,V.jsx)(X,{label:`Secret Access Key`,children:(0,V.jsx)(q,{type:`password`,value:d(`secretAccessKey`)||``,onChange:e=>f({secretAccessKey:e.target.value}),placeholder:`••••••••`})}),(0,V.jsx)(X,{label:`Bucket`,children:(0,V.jsx)(q,{value:d(`bucket`)||``,onChange:e=>f({bucket:e.target.value}),placeholder:`my-bucket`})})]}):e===`b2`?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(X,{label:`Access Key ID`,children:(0,V.jsx)(q,{value:d(`accessKeyId`)||``,onChange:e=>f({accessKeyId:e.target.value}),placeholder:`your-key-id`})}),(0,V.jsx)(X,{label:`Secret Access Key`,children:(0,V.jsx)(q,{type:`password`,value:d(`secretAccessKey`)||``,onChange:e=>f({secretAccessKey:e.target.value}),placeholder:`••••••••`})}),(0,V.jsx)(X,{label:`Bucket`,children:(0,V.jsx)(q,{value:d(`bucket`)||``,onChange:e=>f({bucket:e.target.value}),placeholder:`my-bucket`})}),(0,V.jsx)(X,{label:`Endpoint (Optional)`,children:(0,V.jsx)(q,{value:d(`endpoint`)||``,onChange:e=>f({endpoint:e.target.value}),placeholder:`https://s3.us-west-004.backblazeb2.com`})})]}):e===`gdocs`?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(X,{label:`Email`,children:(0,V.jsx)(q,{value:d(`email`)||``,onChange:e=>f({email:e.target.value}),placeholder:`user@gmail.com`,disabled:!0})}),(0,V.jsxs)(X,{label:`Folder IDs (comma-separated)`,children:[(0,V.jsx)(uh,{value:d(`folderIds`)?.join(`, `)||``,onChange:e=>f({folderIds:e.target.value.split(`,`).map(e=>e.trim()).filter(Boolean)}),placeholder:`folder-id-1, folder-id-2`,rows:3}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Enter Google Drive folder IDs to sync (one per line or comma-separated)`})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2 p-3 bg-muted rounded-md`,children:[(0,V.jsx)(`div`,{className:`flex-1`,children:(0,V.jsx)(`p`,{className:`text-sm font-medium`,children:d(`isAuthenticated`)?`Connected to Google`:`Not authenticated`})}),(0,V.jsxs)(W,{size:`sm`,variant:`outline`,children:[(0,V.jsx)(tn,{className:`h-4 w-4 mr-2`}),d(`isAuthenticated`)?`Reconnect`:`Authenticate`]})]})]}):e===`turso`?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(X,{label:`Database Endpoint`,children:(0,V.jsx)(q,{value:d(`endpoint`)||``,onChange:e=>f({endpoint:e.target.value}),placeholder:`https://your-db.turso.io`})}),(0,V.jsx)(X,{label:`Auth Token (Optional)`,children:(0,V.jsx)(q,{type:`password`,value:d(`authToken`)||``,onChange:e=>f({authToken:e.target.value}),placeholder:`••••••••`})}),(0,V.jsx)(X,{label:`Database Name (Optional)`,children:(0,V.jsx)(q,{value:d(`database`)||``,onChange:e=>f({database:e.target.value}),placeholder:`my-database`})}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`input`,{type:`checkbox`,id:`gdocs-sync`,checked:d(`enableGoogleDocsSync`)||!1,onChange:e=>f({enableGoogleDocsSync:e.target.checked}),className:`h-4 w-4`}),(0,V.jsx)(lg,{htmlFor:`gdocs-sync`,className:`cursor-pointer`,children:`Enable Google Docs Sync`})]}),d(`enableGoogleDocsSync`)&&(0,V.jsxs)(`div`,{className:`flex items-center gap-2 p-3 bg-muted rounded-md`,children:[(0,V.jsx)(`div`,{className:`flex-1`,children:(0,V.jsx)(`p`,{className:`text-sm`,children:`Authenticate with Google to sync documents`})}),(0,V.jsxs)(W,{size:`sm`,variant:`outline`,children:[(0,V.jsx)(tn,{className:`h-4 w-4 mr-2`}),`Login with Google`]})]})]}):null;return(0,V.jsxs)(`div`,{className:`space-y-6`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h2`,{className:`text-xl font-semibold mb-2`,children:`File Sources`}),(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Manage storage sources (SSH, S3, R2, B2, Google Docs, Turso DB)`})]}),(0,V.jsx)(Gh,{}),(0,V.jsxs)(`div`,{className:`space-y-3`,children:[t.map(e=>(0,V.jsx)(`div`,{className:`border rounded-lg p-3 space-y-2`,children:r===e.id?(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsx)(X,{label:`Source Name`,children:(0,V.jsx)(q,{value:a.name,onChange:e=>o(t=>({...t,name:e.target.value})),placeholder:`My Remote Files`})}),h(e.type),(0,V.jsx)(Tg,{onSave:s,onCancel:u,label:`Save`})]}):(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(p,{type:e.type}),(0,V.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,V.jsx)(If,{variant:`outline`,className:`text-xs`,children:m(e.type)})]}),e.id!==`local-default`&&(0,V.jsxs)(`div`,{className:`flex gap-1`,children:[(0,V.jsx)(W,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0`,onClick:()=>l(e),children:(0,V.jsx)(an,{className:`h-3 w-3`})}),(0,V.jsx)(W,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0 text-destructive`,onClick:()=>c(e.id),children:(0,V.jsx)(kt,{className:`h-3 w-3`})})]})]}),(0,V.jsx)(Eg,{source:e})]})},e.id)),r===`new`&&(0,V.jsxs)(`div`,{className:`border rounded-lg p-3 space-y-3`,children:[(0,V.jsx)(X,{label:`Source Name`,children:(0,V.jsx)(q,{value:a.name,onChange:e=>o(t=>({...t,name:e.target.value})),placeholder:`My Remote Files`})}),(0,V.jsx)(X,{label:`Source Type`,children:(0,V.jsxs)(`select`,{value:a.type,onChange:e=>{let t=e.target.value;o({name:a.name,type:t,credentials:t===`gdocs`?{isAuthenticated:!1}:{}})},className:`w-full border rounded-md px-3 py-2 text-sm`,children:[(0,V.jsx)(`option`,{value:`ssh`,children:`SSH`}),(0,V.jsx)(`option`,{value:`s3`,children:`Amazon S3`}),(0,V.jsx)(`option`,{value:`r2`,children:`Cloudflare R2`}),(0,V.jsx)(`option`,{value:`b2`,children:`Backblaze B2`}),(0,V.jsx)(`option`,{value:`gdocs`,children:`Google Docs`}),(0,V.jsx)(`option`,{value:`turso`,children:`Turso DB`})]})}),h(a.type),(0,V.jsx)(Tg,{onSave:s,onCancel:u,label:`Add Source`})]})]}),r!==`new`&&(0,V.jsxs)(W,{variant:`outline`,size:`sm`,onClick:()=>{i(`new`),o({name:``,type:`ssh`,credentials:{port:22}})},className:`w-full gap-2`,children:[(0,V.jsx)(qe,{className:`h-4 w-4`}),`Add New File Source`]})]})},X=({label:e,children:t})=>(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(lg,{children:e}),t]}),Tg=({onSave:e,onCancel:t,label:n})=>(0,V.jsxs)(`div`,{className:`flex gap-2`,children:[(0,V.jsx)(W,{size:`sm`,onClick:e,children:n}),(0,V.jsx)(W,{size:`sm`,variant:`outline`,onClick:t,children:`Cancel`})]}),Eg=({source:e})=>{if(e.type===`ssh`&&e.credentials){let t=e.credentials;return(0,V.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[t.username,`@`,t.host,`:`,t.port||22]})}if(e.type===`s3`&&e.credentials){let t=e.credentials;return(0,V.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[t.bucket,` (`,t.region,`)`]})}if(e.type===`r2`&&e.credentials){let t=e.credentials;return(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.bucket})}if(e.type===`b2`&&e.credentials){let t=e.credentials;return(0,V.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[t.bucket,` (`,t.endpoint||`default endpoint`,`)`]})}if(e.type===`gdocs`&&e.credentials){let t=e.credentials;return(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.isAuthenticated?`${t.email||`Authenticated`} - ${t.folderIds?.length||0} folder(s)`:`Not authenticated`})}if(e.type===`turso`&&e.credentials){let t=e.credentials;return(0,V.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[t.endpoint,t.enableGoogleDocsSync&&` (Google Docs sync enabled)`]})}return null},Dg=[`blue`,`purple`,`green`,`orange`,`pink`],Og=({open:e})=>{let[t,n]=(0,B.useState)([]),[r,i]=(0,B.useState)(null),[a,o]=(0,B.useState)({});(0,B.useEffect)(()=>{e&&n(zf())},[e]);let s=e=>{let r=t.map(t=>t.id===e.id?e:t);n(r),Bf(r),i(null),o({}),Y.success(`Mode updated`)},c=()=>{let e={id:`custom-${Date.now()}`,name:a.name||`New Mode`,prompt:a.prompt||`Rewrite this text:`,color:a.color||`blue`},r=[...t,e];n(r),Bf(r),i(null),o({}),Y.success(`Mode added`)},l=e=>{let r=t.filter(t=>t.id!==e);n(r),Bf(r),Y.success(`Mode deleted`)},u=()=>{Vf(),n(zf()),Y.success(`Modes reset to defaults`)},d=({modeId:e,onSave:t,onCancel:n})=>(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(lg,{htmlFor:`name-${e}`,children:`Mode Name`}),(0,V.jsx)(q,{id:`name-${e}`,value:a.name||``,onChange:e=>o(t=>({...t,name:e.target.value})),placeholder:`Mode name`})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(lg,{htmlFor:`prompt-${e}`,children:`Prompt`}),(0,V.jsx)(uh,{id:`prompt-${e}`,value:a.prompt||``,onChange:e=>o(t=>({...t,prompt:e.target.value})),placeholder:`Rewrite prompt...`,rows:4})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(lg,{htmlFor:`color-${e}`,children:`Color`}),(0,V.jsx)(`select`,{id:`color-${e}`,value:a.color||`blue`,onChange:e=>o(t=>({...t,color:e.target.value})),className:`w-full border rounded-md px-3 py-2 text-sm`,children:Dg.map(e=>(0,V.jsx)(`option`,{value:e,children:e.charAt(0).toUpperCase()+e.slice(1)},e))})]}),(0,V.jsxs)(`div`,{className:`flex gap-2`,children:[(0,V.jsx)(W,{size:`sm`,onClick:t,children:`Save`}),(0,V.jsx)(W,{size:`sm`,variant:`outline`,onClick:n,children:`Cancel`})]})]});return(0,V.jsxs)(`div`,{className:`space-y-6`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h2`,{className:`text-xl font-semibold mb-2`,children:`AI Rewrite Modes`}),(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Customize AI rewrite prompts and add your own modes`})]}),(0,V.jsxs)(W,{variant:`outline`,size:`sm`,onClick:u,className:`gap-2`,children:[(0,V.jsx)(at,{className:`h-4 w-4`}),`Reset`]})]}),(0,V.jsx)(Gh,{}),(0,V.jsxs)(`div`,{className:`space-y-3`,children:[t.map(e=>(0,V.jsx)(`div`,{className:`border rounded-lg p-3 space-y-2`,children:r===e.id?(0,V.jsx)(d,{modeId:e.id,onSave:()=>s(a),onCancel:()=>{i(null),o({})}}):(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsx)(If,{variant:`outline`,className:`text-sm`,children:e.name}),(0,V.jsxs)(`div`,{className:`flex gap-1`,children:[(0,V.jsx)(W,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0`,onClick:()=>{i(e.id),o(e)},children:(0,V.jsx)(an,{className:`h-3 w-3`})}),(0,V.jsx)(W,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0 text-destructive`,onClick:()=>l(e.id),children:(0,V.jsx)(kt,{className:`h-3 w-3`})})]})]}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground line-clamp-2`,children:e.prompt})]})},e.id)),r===`new`&&(0,V.jsx)(`div`,{className:`border rounded-lg p-3`,children:(0,V.jsx)(d,{modeId:`new`,onSave:c,onCancel:()=>{i(null),o({})}})})]}),r!==`new`&&(0,V.jsxs)(W,{variant:`outline`,size:`sm`,onClick:()=>{i(`new`),o({name:``,prompt:``,color:`blue`})},className:`w-full gap-2`,children:[(0,V.jsx)(qe,{className:`h-4 w-4`}),`Add New Mode`]})]})},kg=()=>(0,V.jsxs)(`div`,{className:`space-y-6`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h2`,{className:`text-xl font-semibold mb-2`,children:`About`}),(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Application information`})]}),(0,V.jsx)(Gh,{}),(0,V.jsxs)(`div`,{className:`text-sm space-y-3`,children:[(0,V.jsxs)(`div`,{className:`space-y-1`,children:[(0,V.jsx)(`p`,{className:`font-medium`,children:`REASON`}),(0,V.jsx)(`p`,{className:`text-muted-foreground`,children:`A powerful note-taking application`})]}),(0,V.jsxs)(`div`,{className:`space-y-1`,children:[(0,V.jsx)(`p`,{className:`font-medium`,children:`Version`}),(0,V.jsx)(`p`,{className:`text-muted-foreground`,children:`1.0.0`})]})]})]}),Ag=[{name:`Appearance`,icon:At},{name:`Storage`,icon:Ut},{name:`File Sources`,icon:Zt},{name:`AI Rewrite Modes`,icon:pn},{name:`About`,icon:Mt}],jg=({open:e,onOpenChange:t,initialSection:n,defaultSidebarView:r=`last-used`,onDefaultSidebarViewChange:i,enableDatabaseSync:a=!1,onEnableDatabaseSyncChange:o})=>{let[s,c]=(0,B.useState)(n||`Appearance`);return(0,B.useEffect)(()=>{e&&c(n||`Appearance`)},[e,n]),(0,V.jsx)(sc,{open:e,onOpenChange:t,children:(0,V.jsxs)(uc,{className:`overflow-hidden p-0 md:max-h-[500px] md:max-w-[700px] lg:max-w-[800px]`,children:[(0,V.jsx)(fc,{className:`sr-only`,children:`Settings`}),(0,V.jsx)(pc,{className:`sr-only`,children:`Customize your settings here.`}),(0,V.jsxs)(eg,{className:`items-start`,children:[(0,V.jsx)(tg,{collapsible:`none`,className:`hidden md:flex`,children:(0,V.jsx)(ng,{children:(0,V.jsx)(rg,{children:(0,V.jsx)(ig,{children:(0,V.jsx)(ag,{children:Ag.map(e=>(0,V.jsx)(og,{children:(0,V.jsx)(cg,{asChild:!0,isActive:e.name===s,onClick:()=>c(e.name),children:(0,V.jsxs)(`a`,{href:`#`,children:[(0,V.jsx)(e.icon,{}),(0,V.jsx)(`span`,{children:e.name})]})})},e.name))})})})})}),(0,V.jsxs)(`main`,{className:`flex h-[480px] flex-1 flex-col overflow-hidden`,children:[(0,V.jsx)(`header`,{className:`flex h-16 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-[[data-collapsible=icon]]/sidebar-wrapper:h-12`,children:(0,V.jsx)(`div`,{className:`flex items-center gap-2 px-4`,children:(0,V.jsx)(Lh,{children:(0,V.jsxs)(Rh,{children:[(0,V.jsx)(zh,{className:`hidden md:block`,children:(0,V.jsxs)(Bh,{href:`#`,children:[(0,V.jsx)(Ge,{className:`h-4 w-4 inline mr-1`}),`Settings`]})}),(0,V.jsx)(Hh,{className:`hidden md:block`}),(0,V.jsx)(zh,{children:(0,V.jsx)(Vh,{children:s})})]})})})}),(0,V.jsx)(`div`,{className:`flex flex-1 flex-col gap-4 overflow-y-auto p-4 pt-0`,children:(()=>{switch(s){case`Appearance`:return(0,V.jsx)(gg,{defaultSidebarView:r,onDefaultSidebarViewChange:i});case`Storage`:return(0,V.jsx)(_g,{enableDatabaseSync:a,onEnableDatabaseSyncChange:o});case`File Sources`:return(0,V.jsx)(wg,{open:e});case`AI Rewrite Modes`:return(0,V.jsx)(Og,{open:e});case`About`:return(0,V.jsx)(kg,{});default:return null}})()})]})]})]})})};function Mg({className:e,...t}){return(0,V.jsx)(T,{"data-slot":`tabs`,className:H(`flex flex-col gap-2`,e),...t})}function Ng({className:e,...t}){return(0,V.jsx)(ye,{"data-slot":`tabs-list`,className:H(`bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-2xl p-[3px]`,e),...t})}function Pg({className:e,...t}){return(0,V.jsx)(ge,{"data-slot":`tabs-trigger`,className:H(`cursor-pointer data-[state=active]:bg-background data-[state=active]:text-foreground dark:data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-2xl border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...t})}function Fg({className:e,...t}){return(0,V.jsx)(f,{"data-slot":`tabs-content`,className:H(`flex-1 outline-none`,e),...t})}var Ig=Te,Lg=Ie,Rg=B.forwardRef(({className:e,children:t,...n},r)=>(0,V.jsxs)(xt,{ref:r,className:H(`flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1`,e),...n,children:[t,(0,V.jsx)(se,{asChild:!0,children:(0,V.jsx)(y,{className:`h-4 w-4 opacity-50`})})]}));Rg.displayName=xt.displayName;var zg=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(Me,{ref:n,className:H(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,V.jsx)(I,{className:`h-4 w-4`})}));zg.displayName=Me.displayName;var Bg=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(Ye,{ref:n,className:H(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,V.jsx)(y,{className:`h-4 w-4`})}));Bg.displayName=Ye.displayName;var Vg=B.forwardRef(({className:e,children:t,position:n=`popper`,...r},i)=>(0,V.jsx)(vt,{children:(0,V.jsxs)(ke,{ref:i,className:H(`relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,...r,children:[(0,V.jsx)(zg,{}),(0,V.jsx)(nt,{className:H(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`),children:t}),(0,V.jsx)(Bg,{})]})}));Vg.displayName=ke.displayName;var Hg=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(ct,{ref:n,className:H(`px-2 py-1.5 text-sm font-semibold`,e),...t}));Hg.displayName=ct.displayName;var Ug=B.forwardRef(({className:e,children:t,...n},r)=>(0,V.jsxs)(s,{ref:r,className:H(`relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,V.jsx)(`span`,{className:`absolute right-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,V.jsx)(He,{children:(0,V.jsx)(D,{className:`h-4 w-4`})})}),(0,V.jsx)(Tt,{children:t})]}));Ug.displayName=s.displayName;var Wg=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(dt,{ref:n,className:H(`-mx-1 my-1 h-px bg-muted`,e),...t}));Wg.displayName=dt.displayName;function Gg(e,t){let[n,r]=(0,B.useState)(()=>{try{let n=window.localStorage.getItem(e);if(!n)return t;let r=JSON.parse(n);return Array.isArray(r)&&r.length===0&&Array.isArray(t)&&t.length>0?t:r}catch(e){return console.error(`Error reading from localStorage:`,e),t}});return[n,t=>{try{let i=t instanceof Function?t(n):t;r(i),window.localStorage.setItem(e,JSON.stringify(i))}catch(e){console.error(`Error writing to localStorage:`,e)}}]}var Kg={owner:(0,V.jsx)(Ht,{className:`h-3 w-3`}),admin:(0,V.jsx)(sn,{className:`h-3 w-3`}),member:(0,V.jsx)(rt,{className:`h-3 w-3`}),viewer:(0,V.jsx)(_,{className:`h-3 w-3`})},qg={owner:`bg-yellow-500/10 text-yellow-700 dark:text-yellow-400`,admin:`bg-purple-500/10 text-purple-700 dark:text-purple-400`,member:`bg-blue-500/10 text-blue-700 dark:text-blue-400`,viewer:`bg-gray-500/10 text-gray-700 dark:text-gray-400`},Jg=({open:e,onOpenChange:t})=>{let[n,r]=Gg(`REASON-organizations`,[{id:`1`,name:`My Organization`,slug:`my-org`,description:`Your personal workspace`,teams:[{id:`1`,name:`General`,description:`Default team for collaboration`,members:[{id:`1`,name:`You`,email:`you@example.com`,role:`owner`,joinedAt:new Date}],createdAt:new Date,updatedAt:new Date}],createdAt:new Date,updatedAt:new Date}]),[i,a]=(0,B.useState)(n[0]?.id||null),[o,s]=(0,B.useState)(null),[c,l]=(0,B.useState)(!1),[u,d]=(0,B.useState)(null),[f,p]=(0,B.useState)(``),[m,h]=(0,B.useState)(`member`),g=n.find(e=>e.id===i),_=g?.teams.find(e=>e.id===o),v=()=>{if(!f.trim()||!i||!o)return;let e={id:Date.now().toString(),name:f.split(`@`)[0],email:f,role:m,joinedAt:new Date};r(t=>t.map(t=>t.id===i?{...t,teams:t.teams.map(t=>t.id===o?{...t,members:[...t.members,e],updatedAt:new Date}:t)}:t)),p(``),h(`member`),l(!1),Y.success(`Member invited`)},y=e=>{!i||!o||(r(t=>t.map(t=>t.id===i?{...t,teams:t.teams.map(t=>t.id===o?{...t,members:t.members.filter(t=>t.id!==e),updatedAt:new Date}:t)}:t)),d(null),Y.success(`Member removed`))},b=(e,t)=>{!i||!o||(r(n=>n.map(n=>n.id===i?{...n,teams:n.teams.map(n=>n.id===o?{...n,members:n.members.map(n=>n.id===e?{...n,role:t}:n),updatedAt:new Date}:n)}:n)),Y.success(`Role updated`))};return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(sc,{open:e,onOpenChange:t,children:(0,V.jsxs)(uc,{className:`max-w-4xl max-h-[85vh]`,children:[(0,V.jsxs)(dc,{children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(Rt,{className:`h-5 w-5`}),(0,V.jsx)(fc,{children:`Teams & Organizations`})]}),(0,V.jsx)(pc,{children:`Manage your teams and collaborate with others`})]}),(0,V.jsxs)(Mg,{defaultValue:`teams`,className:`flex-1`,children:[(0,V.jsxs)(Ng,{className:`grid w-full grid-cols-2`,children:[(0,V.jsx)(Pg,{value:`teams`,children:`Teams`}),(0,V.jsx)(Pg,{value:`organizations`,children:`Organizations`})]}),(0,V.jsxs)(Fg,{value:`teams`,className:`space-y-4 mt-4`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsxs)(`div`,{className:`space-y-1`,children:[(0,V.jsx)(`h3`,{className:`font-semibold`,children:`Your Teams`}),(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Collaborate with team members`})]}),(0,V.jsxs)(W,{onClick:()=>{if(!i)return;let e={id:Date.now().toString(),name:`New Team`,members:[],createdAt:new Date,updatedAt:new Date};r(t=>t.map(t=>t.id===i?{...t,teams:[...t.teams,e],updatedAt:new Date}:t)),s(e.id),Y.success(`Team created`)},size:`sm`,children:[(0,V.jsx)(qe,{className:`h-4 w-4 mr-2`}),`New Team`]})]}),(0,V.jsx)(Gh,{}),(0,V.jsx)(Nh,{className:`h-[50vh]`,children:g&&g.teams.length>0?(0,V.jsx)(`div`,{className:`space-y-4`,children:g.teams.map(e=>(0,V.jsxs)(`div`,{className:`border rounded-lg p-4 space-y-4`,children:[(0,V.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,V.jsxs)(`div`,{className:`space-y-1`,children:[(0,V.jsxs)(`h4`,{className:`font-semibold flex items-center gap-2`,children:[(0,V.jsx)(rt,{className:`h-4 w-4`}),e.name]}),e.description&&(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.description}),(0,V.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.members.length,` member`,e.members.length===1?``:`s`]})]}),(0,V.jsxs)(W,{variant:`outline`,size:`sm`,onClick:()=>{s(e.id),l(!0)},children:[(0,V.jsx)(fn,{className:`h-4 w-4 mr-2`}),`Invite`]})]}),(0,V.jsx)(`div`,{className:`space-y-2`,children:e.members.map(e=>(0,V.jsxs)(`div`,{className:`flex items-center justify-between p-2 rounded-lg hover:bg-muted/50`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsxs)(sh,{className:`h-8 w-8`,children:[(0,V.jsx)(ch,{src:e.avatarUrl}),(0,V.jsx)(lh,{children:e.name.substring(0,2).toUpperCase()})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`text-sm font-medium`,children:e.name}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.email})]})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsxs)(If,{variant:`secondary`,className:qg[e.role],children:[(0,V.jsx)(`span`,{className:`mr-1`,children:Kg[e.role]}),e.role]}),e.role!==`owner`&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(Ig,{value:e.role,onValueChange:t=>b(e.id,t),children:[(0,V.jsx)(Rg,{className:`h-8 w-28`,children:(0,V.jsx)(Lg,{})}),(0,V.jsxs)(Vg,{children:[(0,V.jsx)(Ug,{value:`admin`,children:`Admin`}),(0,V.jsx)(Ug,{value:`member`,children:`Member`}),(0,V.jsx)(Ug,{value:`viewer`,children:`Viewer`})]})]}),(0,V.jsx)(W,{variant:`ghost`,size:`sm`,onClick:()=>d(e),children:(0,V.jsx)(kt,{className:`h-4 w-4 text-destructive`})})]})]})]},e.id))})]},e.id))}):(0,V.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 text-center`,children:[(0,V.jsx)(rt,{className:`h-12 w-12 text-muted-foreground mb-4 opacity-50`}),(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No teams yet. Create your first team to get started.`})]})})]}),(0,V.jsxs)(Fg,{value:`organizations`,className:`space-y-4 mt-4`,children:[(0,V.jsxs)(`div`,{className:`space-y-1`,children:[(0,V.jsx)(`h3`,{className:`font-semibold`,children:`Your Organizations`}),(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Manage organization settings and details`})]}),(0,V.jsx)(Gh,{}),(0,V.jsx)(Nh,{className:`h-[50vh]`,children:n.map(e=>(0,V.jsx)(`div`,{className:`border rounded-lg p-4 space-y-4 mb-4`,children:(0,V.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,V.jsxs)(sh,{className:`h-16 w-16`,children:[(0,V.jsx)(ch,{src:e.logoUrl}),(0,V.jsx)(lh,{className:`text-lg`,children:e.name.substring(0,2).toUpperCase()})]}),(0,V.jsxs)(`div`,{className:`flex-1 space-y-1`,children:[(0,V.jsx)(`h4`,{className:`font-semibold text-lg`,children:e.name}),(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.slug}),e.description&&(0,V.jsx)(`p`,{className:`text-sm`,children:e.description}),(0,V.jsxs)(`div`,{className:`flex gap-4 text-xs text-muted-foreground pt-2`,children:[(0,V.jsxs)(`span`,{children:[e.teams.length,` teams`]}),(0,V.jsxs)(`span`,{children:[e.teams.reduce((e,t)=>e+t.members.length,0),` `,`members`]})]})]})]})},e.id))})]})]})]})}),(0,V.jsx)(sc,{open:c,onOpenChange:l,children:(0,V.jsxs)(uc,{children:[(0,V.jsxs)(dc,{children:[(0,V.jsx)(fc,{children:`Invite Team Member`}),(0,V.jsxs)(pc,{children:[`Send an invitation to join `,_?.name]})]}),(0,V.jsxs)(`div`,{className:`space-y-4 py-4`,children:[(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(lg,{htmlFor:`email`,children:`Email Address`}),(0,V.jsxs)(`div`,{className:`relative`,children:[(0,V.jsx)(Pt,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,V.jsx)(q,{id:`email`,type:`email`,placeholder:`colleague@example.com`,value:f,onChange:e=>p(e.target.value),className:`pl-9`})]})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(lg,{htmlFor:`role`,children:`Role`}),(0,V.jsxs)(Ig,{value:m,onValueChange:e=>h(e),children:[(0,V.jsx)(Rg,{children:(0,V.jsx)(Lg,{})}),(0,V.jsxs)(Vg,{children:[(0,V.jsx)(Ug,{value:`admin`,children:`Admin`}),(0,V.jsx)(Ug,{value:`member`,children:`Member`}),(0,V.jsx)(Ug,{value:`viewer`,children:`Viewer`})]})]})]})]}),(0,V.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,V.jsx)(W,{variant:`outline`,onClick:()=>l(!1),children:`Cancel`}),(0,V.jsx)(W,{onClick:v,children:`Send Invitation`})]})]})}),(0,V.jsx)(yd,{open:!!u,onOpenChange:()=>d(null),children:(0,V.jsxs)(Sd,{children:[(0,V.jsxs)(Cd,{children:[(0,V.jsx)(Td,{children:`Remove Team Member`}),(0,V.jsxs)(Ed,{children:[`Are you sure you want to remove `,u?.name,` from the team? They will lose access to all team resources.`]})]}),(0,V.jsxs)(wd,{children:[(0,V.jsx)(Od,{children:`Cancel`}),(0,V.jsx)(Dd,{onClick:()=>u&&y(u.id),className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:`Remove`})]})]})})]})};function Yg({className:e,...t}){return(0,V.jsx)(Qm,{"data-slot":`switch`,className:H(`peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50`,e),...t,children:(0,V.jsx)(eh,{"data-slot":`switch-thumb`,className:H(`bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0`)})})}var Xg=({open:e,onOpenChange:t,documentTitle:n,documentId:r,sharingInfo:i,teams:a=[],onUpdateSharing:o})=>{let[s,c]=(0,B.useState)(``),[l,u]=(0,B.useState)(`editor`),[d,f]=(0,B.useState)(i?.isPublic||!1),[p,m]=(0,B.useState)(i?.sharedWith||[]),[h,g]=(0,B.useState)(i?.shareLink||null),[v,y]=(0,B.useState)(!1),b=()=>{if(!s.trim())return;if(p.find(e=>e.email===s)){Y.error(`Already shared with this user`);return}let e={email:s,role:l,sharedAt:new Date().toISOString()},t=[...p,e];m(t),o&&o({...i,isPublic:d,sharedWith:t}),c(``),Y.success(`Invited ${s}`)},x=e=>{let t=p.filter(t=>t.email!==e);m(t),o&&o({...i,isPublic:d,sharedWith:t}),Y.success(`Access removed`)},S=(e,t)=>{let n=p.map(n=>n.email===e?{...n,role:t}:n);m(n),o&&o({...i,isPublic:d,sharedWith:n}),Y.success(`Role updated`)},C=async e=>{f(e),e&&!h&&await w(),o&&o({...i,isPublic:e,sharedWith:p,shareLink:h}),Y.success(e?`Document is now public`:`Document is now private`)},w=async()=>{if(!v){y(!0);try{let e=await pe(`doc/share`,{method:`POST`,headers:{"Content-Type":`application/json`},body:{documentId:r}});return e.success?(g(e.data.shareUrl),o&&o({...i,isPublic:d,sharedWith:p,shareLink:e.data.shareUrl}),e.data.shareUrl):(Y.error(e.error||`Failed to generate share link`),null)}catch(e){return Y.error(e.message||`Failed to generate share link`),null}finally{y(!1)}}},T=async()=>{let e=h;!e&&(e=await w(),!e)||(navigator.clipboard.writeText(e),Y.success(`Link copied to clipboard`))},E=e=>e.substring(0,2).toUpperCase();return(0,V.jsx)(sc,{open:e,onOpenChange:t,children:(0,V.jsxs)(uc,{className:`max-w-2xl max-h-[85vh]`,children:[(0,V.jsxs)(dc,{children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(fn,{className:`h-5 w-5`}),(0,V.jsxs)(fc,{children:[`Share "`,n,`"`]})]}),(0,V.jsx)(pc,{children:`Invite people or share with teams`})]}),(0,V.jsxs)(`div`,{className:`space-y-6`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between p-4 rounded-lg border bg-muted/30`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[d?(0,V.jsx)(fe,{className:`h-5 w-5 text-primary`}):(0,V.jsx)(le,{className:`h-5 w-5 text-muted-foreground`}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`font-medium text-sm`,children:d?`Public Access`:`Private`}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:d?`Anyone with the link can view`:`Only invited people can access`})]})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[d&&(0,V.jsx)(W,{variant:`ghost`,size:`sm`,onClick:T,className:`h-8`,children:(0,V.jsx)(en,{className:`h-4 w-4`})}),(0,V.jsx)(Yg,{checked:d,onCheckedChange:C})]})]}),(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsx)(lg,{children:`Invite by email`}),(0,V.jsxs)(`div`,{className:`flex gap-2`,children:[(0,V.jsxs)(`div`,{className:`relative flex-1`,children:[(0,V.jsx)(Pt,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,V.jsx)(q,{type:`email`,placeholder:`colleague@example.com`,value:s,onChange:e=>c(e.target.value),onKeyPress:e=>e.key===`Enter`&&b(),className:`pl-9`})]}),(0,V.jsxs)(Ig,{value:l,onValueChange:e=>u(e),children:[(0,V.jsx)(Rg,{className:`w-36`,children:(0,V.jsx)(Lg,{})}),(0,V.jsxs)(Vg,{children:[(0,V.jsx)(Ug,{value:`editor`,children:(0,V.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(Ae,{className:`h-3 w-3`}),`Editor`]})}),(0,V.jsx)(Ug,{value:`commentor`,children:(0,V.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(Ft,{className:`h-3 w-3`}),`Commentor`]})}),(0,V.jsx)(Ug,{value:`viewer`,children:(0,V.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(_,{className:`h-3 w-3`}),`Viewer`]})})]})]}),(0,V.jsx)(W,{onClick:b,children:`Invite`})]})]}),(0,V.jsx)(Gh,{}),a.length>0&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(rt,{className:`h-4 w-4 text-muted-foreground`}),(0,V.jsx)(`h4`,{className:`text-sm font-semibold`,children:`Teams with access`})]}),(0,V.jsx)(`div`,{className:`space-y-2`,children:a.map(e=>(0,V.jsxs)(`div`,{className:`flex items-center justify-between p-3 rounded-lg border bg-card hover:bg-muted/50 transition-colors`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(sh,{className:`h-8 w-8`,children:(0,V.jsx)(lh,{className:`bg-primary/10 text-primary`,children:(0,V.jsx)(rt,{className:`h-4 w-4`})})}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`text-sm font-medium`,children:e.name}),(0,V.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.members.length,` member`,e.members.length===1?``:`s`]})]})]}),(0,V.jsxs)(If,{variant:`secondary`,className:`bg-blue-500/10 text-blue-700 dark:text-blue-400`,children:[(0,V.jsx)(Ae,{className:`h-3 w-3 mr-1`}),`Team`]})]},e.id))})]}),(0,V.jsx)(Gh,{})]}),(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsx)(`h4`,{className:`text-sm font-semibold`,children:`People with access`}),(0,V.jsx)(Nh,{className:`max-h-[300px]`,children:p.length>0?(0,V.jsx)(`div`,{className:`space-y-2 pr-4`,children:p.map(e=>(0,V.jsxs)(`div`,{className:`flex items-center justify-between p-3 rounded-lg border bg-card hover:bg-muted/50 transition-colors`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(sh,{className:`h-8 w-8`,children:(0,V.jsx)(lh,{className:`bg-gradient-to-br from-primary/20 to-primary/10`,children:E(e.email)})}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`text-sm font-medium`,children:e.email}),(0,V.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Added `,new Date(e.sharedAt).toLocaleDateString()]})]})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsxs)(Ig,{value:e.role||`viewer`,onValueChange:t=>S(e.email,t),children:[(0,V.jsx)(Rg,{className:`h-8 w-32`,children:(0,V.jsx)(Lg,{})}),(0,V.jsxs)(Vg,{children:[(0,V.jsx)(Ug,{value:`editor`,children:(0,V.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(Ae,{className:`h-3 w-3`}),`Editor`]})}),(0,V.jsx)(Ug,{value:`commentor`,children:(0,V.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(Ft,{className:`h-3 w-3`}),`Commentor`]})}),(0,V.jsx)(Ug,{value:`viewer`,children:(0,V.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(_,{className:`h-3 w-3`}),`Viewer`]})})]})]}),(0,V.jsx)(W,{variant:`ghost`,size:`sm`,onClick:()=>x(e.email),className:`h-8 w-8 p-0`,children:(0,V.jsx)(Le,{className:`h-4 w-4 text-muted-foreground hover:text-destructive`})})]})]},e.email))}):(0,V.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-8 text-center`,children:[(0,V.jsx)(fn,{className:`h-12 w-12 text-muted-foreground mb-3 opacity-50`}),(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No one else has access yet`}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:`Invite people to collaborate`})]})})]})]})]})})},Zg=({open:e,onOpenChange:t,currentTags:n,onUpdateTags:r})=>{let[i,a]=(0,B.useState)(``),[o,s]=(0,B.useState)(n),c=()=>{if(i.trim()&&!o.includes(i.trim())){let e=[...o,i.trim()];s(e),a(``)}},l=e=>{let t=o.filter(t=>t!==e);s(t)};return(0,V.jsx)(sc,{open:e,onOpenChange:t,children:(0,V.jsxs)(uc,{className:`sm:max-w-md`,children:[(0,V.jsx)(dc,{children:(0,V.jsx)(fc,{children:`Manage Tags`})}),(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsxs)(`div`,{className:`flex gap-2`,children:[(0,V.jsx)(q,{value:i,onChange:e=>a(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),c())},placeholder:`Enter tag name...`,className:`flex-1`}),(0,V.jsxs)(W,{onClick:c,size:`sm`,children:[(0,V.jsx)(qe,{className:`h-4 w-4 mr-1`}),`Add`]})]}),(0,V.jsx)(`div`,{className:`flex flex-wrap gap-2 min-h-[60px] p-3 border border-border rounded-md bg-muted/20`,children:o.length===0?(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No tags added yet`}):o.map(e=>(0,V.jsxs)(If,{variant:`secondary`,className:`gap-1 pl-2 pr-1`,children:[e,(0,V.jsx)(`button`,{onClick:()=>l(e),className:`ml-1 hover:bg-background/80 rounded-sm p-0.5`,children:(0,V.jsx)(Le,{className:`h-3 w-3`})})]},e))}),(0,V.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,V.jsx)(W,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,V.jsx)(W,{onClick:()=>{r(o),t(!1)},children:`Save Tags`})]})]})]})})};function Qg({isSearchModalOpen:e,setIsSearchModalOpen:t,isSettingsOpen:n,setIsSettingsOpen:r,settingsInitialSection:i,isTeamsOpen:a,setIsTeamsOpen:o,isInviteModalOpen:s,setIsInviteModalOpen:c,isTagDialogOpen:l,setIsTagDialogOpen:u,documents:d,activeDocument:f,tagManagementDocId:p,defaultSidebarView:m,setDefaultSidebarView:h,enableDatabaseSync:g,setEnableDatabaseSync:_,setDocuments:v,onSelectDocument:y,onToggleTheme:b,currentTheme:x,onUpdateTags:S}){return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Ih,{open:e,onOpenChange:t,documents:d,onSelectDocument:y,onOpenSettings:()=>r(!0),onOpenTeams:()=>o(!0),onToggleTheme:b,currentTheme:x}),(0,V.jsx)(jg,{open:n,onOpenChange:r,initialSection:i,defaultSidebarView:m,onDefaultSidebarViewChange:h,enableDatabaseSync:g,onEnableDatabaseSyncChange:_}),(0,V.jsx)(Jg,{open:a,onOpenChange:o}),(0,V.jsx)(Xg,{open:s,onOpenChange:c,documentTitle:f?.title||`Untitled`,documentId:f?.id||``,sharingInfo:f?.sharing,onUpdateSharing:e=>{f&&v(t=>t.map(t=>t.id===f.id?{...t,sharing:e}:t))}}),(0,V.jsx)(Zg,{open:l,onOpenChange:u,currentTags:p&&d.find(e=>e.id===p)?.tags||[],onUpdateTags:S})]})}function $g(e,t,n={}){let{enableSync:r=!1,syncInterval:i=5e3}=n,[a,o]=(0,B.useState)(!1),[s,c]=(0,B.useState)(null),l=(0,B.useRef)(new Map),u=(0,B.useRef)(void 0),d=(0,B.useCallback)(async()=>{if(r)try{let e=(await pe(`doc/documents`)).map(e=>({id:e.id.toString(),title:e.title||e.name||`Untitled`,content:e.content||``,parentId:e.parentId?e.parentId.toString():null,children:[],isExpanded:e.isExpanded===1,isFolder:e.isFolder===1,tags:e.metadata&&JSON.parse(e.metadata).tags||[],metadata:e.metadata?JSON.parse(e.metadata):void 0}));return t(e),c(new Date),e}catch(e){return console.error(`Error loading documents from database:`,e),Y.error(`Failed to load documents from database`),null}},[r,t]),f=(0,B.useCallback)(async e=>{if(r)try{let n={name:e.title||`Untitled`,title:e.title||`Untitled`,content:e.content||``,parentId:e.parentId?parseInt(e.parentId):null,isFolder:e.isFolder||!1,metadata:{tags:e.tags||[],isExpanded:e.isExpanded||!1,...e.metadata}};if(isNaN(parseInt(e.id))){let r=await pe(`doc/documents`,{method:`POST`,headers:{"Content-Type":`application/json`},body:n});return t(t=>t.map(t=>t.id===e.id?{...t,id:r.id.toString()}:t)),r}return await pe(`doc/documents/${e.id}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:n})}catch(e){return console.error(`Error saving document:`,e),Y.error(`Failed to save document to database`),null}},[r,t]),p=(0,B.useCallback)(async()=>{if(!(!r||l.current.size===0)){o(!0);try{let e=Array.from(l.current.values());await Promise.all(e.map(e=>f(e))),l.current.clear(),c(new Date)}catch(e){console.error(`Error syncing changes:`,e)}finally{o(!1)}}},[r,f]),m=(0,B.useCallback)(e=>{r&&(l.current.set(e.id,e),u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{p()},2e3))},[r,p]),h=(0,B.useCallback)(async e=>{if(r)try{return await pe(`doc/documents/${e}`,{method:`DELETE`}),!0}catch(e){return console.error(`Error deleting document:`,e),Y.error(`Failed to delete document from database`),!1}},[r]);return(0,B.useEffect)(()=>{if(!r||i<=0)return;let e=setInterval(()=>{l.current.size>0&&p()},i);return()=>clearInterval(e)},[r,i,p]),(0,B.useEffect)(()=>()=>{u.current&&clearTimeout(u.current)},[]),{isSyncing:a,lastSyncTime:s,loadFromDatabase:d,saveDocument:f,deleteDocument:h,queueDocumentForSync:m,syncPendingChanges:p}}function e_(){let e=Wh(),[t,n]=(0,B.useState)(!1),[r,i]=(0,B.useState)(!1),[a,o]=(0,B.useState)(!1),[s,c]=(0,B.useState)(!1),[l,u]=(0,B.useState)(!1),[d,f]=(0,B.useState)(!1),[p,m]=(0,B.useState)(null),[h,g]=Gg(`REASON-default-sidebar-view`,`last-used`),[_,v]=Gg(`REASON-left-panels`,[`files`,`openTabs`]),[y,b]=Gg(`REASON-left-split`,!0),[x,S]=Gg(`REASON-right-panels`,[]),[C,w]=Gg(`REASON-right-split`,!1),[T,E]=Gg(`REASON-show-dynamic-island`,!1),[D,O]=Gg(`REASON-sidebar-width`,25),[k,A]=(0,B.useState)(null),[j,ee]=(0,B.useState)(!1),M=(0,B.useRef)(null),[N,te]=(0,B.useState)([]),[P,F]=Gg(`REASON-documents`,vc),[I,L]=Gg(`REASON-active-doc`,P.length>0?P[0].id:null),[ne,re]=Gg(`REASON-open-tabs`,P.length>0?[P[0].id]:[]),[ie,ae]=(0,B.useState)([]),[oe,se]=(0,B.useState)(null),[R,ce]=(0,B.useState)(``),[le,ue]=(0,B.useState)(null),[de,fe]=(0,B.useState)(jn()),[pe,me]=Gg(`REASON-enable-db-sync`,!1),{isSyncing:he,lastSyncTime:ge,saveDocument:_e,deleteDocument:ve,queueDocumentForSync:ye}=$g(P,F,{enableSync:pe,syncInterval:5e3}),be=e=>{let t=new Map,n=[];return e.forEach(e=>{t.set(e.id,{...e,children:[]})}),e.forEach(e=>{let r=t.get(e.id);e.parentId&&t.has(e.parentId)?t.get(e.parentId).children.push(r):n.push(r)}),n},xe=(0,B.useMemo)(()=>be(P),[P]),Se=P.find(e=>e.id===I);(0,B.useEffect)(()=>{Se?.title?document.title=`${Se.title} - Reason Docs`:document.title=`Reason - Powerful Note-Taking App`},[Se?.title]),(0,B.useEffect)(()=>{te([])},[I]);let Ce=(0,B.useMemo)(()=>{let e=P.filter(e=>!e.isDeleted);if(!R.trim())return e;let t=R.toLowerCase();return e.filter(e=>e.title.toLowerCase().includes(t)||e.content.toLowerCase().includes(t))},[P,R]),we=(0,B.useMemo)(()=>R.trim()?be(Ce):xe,[Ce,R]),Te=async(e,t=!1)=>{let n=null;if(e){let t=P.find(t=>t.id===e);t&&(n=t.isFolder?e:t.parentId)}let r={id:Date.now().toString(),title:t?`New Folder`:``,content:``,parentId:n,children:[],isExpanded:t,isFolder:t,tags:[]};F([...P,r]),pe&&await _e(r),t||(L(r.id),re([...ne,r.id])),ue(r.id),setTimeout(()=>ue(null),500),n&&F(e=>e.map(e=>e.id===n?{...e,isExpanded:!0}:e)),Y.success(t?`Folder created`:`Note created`)},Ee=async e=>{let t=e=>[e,...P.filter(t=>t.parentId===e).flatMap(e=>t(e.id))],n=t(e),r=P.filter(e=>!n.includes(e.id));if(F(r),pe)for(let e of n)await ve(e);let i=ne.filter(e=>!n.includes(e));re(i),I&&n.includes(I)&&L(i.length>0?i[0]:r.length>0?r[0].id:null),Y.success(`Note deleted`)},z=e=>{let t=P.find(t=>t.id===e);if(!t)return;let n={...t,id:Date.now().toString(),title:t.title+` (Copy)`,children:[]};F([...P,n]),L(n.id),re([...ne,n.id]),Y.success(`Note duplicated`)},De=(e,t)=>{F(n=>n.map(n=>{if(n.id===e){let e={...n,...t};return pe&&ye(e),e}return n}))},Oe=e=>{F(t=>t.map(t=>t.id===e?{...t,isExpanded:!t.isExpanded}:t))},ke=(e,t,n)=>{let r=P.find(t=>t.id===e),i=P.find(e=>e.id===t);if(!r||e===t)return;let a=(e,t)=>P.filter(t=>t.parentId===e).some(e=>e.id===t||a(e.id,t));if(t&&a(e,t)){Y.error(`Cannot move a note into its own child`);return}let o;o=n===`child`?t:i?.parentId||null,F(i=>{let a=i.filter(t=>t.id!==e),s={...r,parentId:o},c;if(n===`child`){let e=a.findIndex(e=>e.id===t),n=a.findIndex((n,r)=>r>e&&n.parentId===t);c=n===-1?e+1:n}else if(n===`before`)c=a.findIndex(e=>e.id===t);else{let e=a.findIndex(e=>e.id===t),n=e,r=(e,t)=>{let n=t;for(let i=t+1;i<a.length;i++)if(a[i].parentId===e){n=i;let e=r(a[i].id,i);e>n&&(n=e,i=e)}return n};n=r(t,e),c=n+1}return[...a.slice(0,c),s,...a.slice(c)]}),Y.success(`Note moved`)};(0,B.useEffect)(()=>{let e=e=>{(e.ctrlKey||e.metaKey)&&e.key===`k`&&(e.preventDefault(),i(!0))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,B.useEffect)(()=>{h===`tree`?(v([`files`]),b(!1)):h===`outline`?(v([`outline`]),b(!1)):h===`split`&&(v([`files`,`openTabs`,`outline`]),b(!0))},[]);let Ae=(e,t)=>{F(n=>n.map(n=>n.id===e?{...n,tags:[...n.tags||[],t]}:n))},je=(e,t)=>{F(n=>n.map(n=>n.id===e?{...n,tags:(n.tags||[]).filter(e=>e!==t)}:n))},Me=e=>{m(e),f(!0)},Ne=async e=>{fe(e),Mn(e);let t=Nn();try{t.type===`local`?Y.success(`Switched to local storage`):Y.info(`Source switching for ${t.type} not yet implemented in standalone mode`)}catch(e){console.error(`Error loading documents from source:`,e),Y.error(`Failed to load documents from source`)}},Pe=e=>{p&&(F(t=>t.map(t=>t.id===p?{...t,tags:e}:t)),Y.success(`Tags updated`))},Fe=e=>{F(t=>t.map(t=>t.id===e?{...t,isDeleted:!1}:t)),Y.success(`Note restored`)},Ie=e=>{let t=e=>[e,...P.filter(t=>t.parentId===e).flatMap(e=>t(e.id))],n=t(e),r=P.filter(e=>!n.includes(e.id));F(r);let i=ne.filter(e=>!n.includes(e));re(i),I&&n.includes(I)&&L(i.length>0?i[0]:r.length>0?r[0].id:null),Y.success(`Note permanently deleted`)},Le=e=>{L(e)},Re=e=>{ae([e,...ie.slice(0,9)]);let t=ne.filter(t=>t!==e);if(re(t),I===e){let n=ne.indexOf(e),r=Math.max(0,n-1);L(t[r]||null)}},ze=()=>{Te(null)},Be=e=>{Re(e),Ee(e)},Ve=()=>{if(ie.length===0)return;let[e,...t]=ie;P.find(t=>t.id===e)?(ne.includes(e)||re([...ne,e]),L(e),ae(t),Y.success(`Tab reopened`)):(ae(t),t.length>0&&Ve())},He=e=>{se(e),Y.success(`Split view enabled`)},Ue=e=>{if(P.find(t=>t.id===e)?.isFolder){Oe(e);return}ne.includes(e)||re([...ne,e]),L(e)},We=async(e,t)=>{Y.info(`AI rewrite is not yet available for this editor`)},Ge=()=>{S(e=>e.filter(e=>e!==`ai`)),v(e=>e.length>1?e.filter(e=>e!==`ai`):e)};return(0,B.useEffect)(()=>{I&&!P.find(e=>e.id===I)&&L(P.length>0?P[0].id:null)},[P,I,L]),{isMobile:e,isSidebarOpen:t,setIsSidebarOpen:n,isSearchModalOpen:r,setIsSearchModalOpen:i,isSettingsOpen:a,setIsSettingsOpen:o,isTeamsOpen:s,setIsTeamsOpen:c,isInviteModalOpen:l,setIsInviteModalOpen:u,isTagDialogOpen:d,setIsTagDialogOpen:f,tagManagementDocId:p,defaultSidebarView:h,setDefaultSidebarView:g,leftPanels:_,setLeftPanels:v,leftSplit:y,setLeftSplit:b,rightPanels:x,setRightPanels:S,rightSplit:C,setRightSplit:w,showDynamicIsland:T,setShowDynamicIsland:E,sidebarWidth:D,setSidebarWidth:O,aiSuggestion:k,setAiSuggestion:A,isAiLoading:j,setIsAiLoading:ee,editorRef:M,headings:N,setHeadings:te,documents:P,setDocuments:F,activeDocId:I,setActiveDocId:L,openTabs:ne,setOpenTabs:re,closedTabsHistory:ie,splitViewDocId:oe,setSplitViewDocId:se,searchQuery:R,setSearchQuery:ce,newDocumentId:le,activeFileSourceId:de,enableDatabaseSync:pe,setEnableDatabaseSync:me,isSyncing:he,lastSyncTime:ge,documentTree:xe,activeDocument:Se,filteredDocuments:Ce,filteredTree:we,handleAddDocument:Te,handleDeleteDocument:Ee,handleDuplicateDocument:z,handleUpdateDocument:De,handleToggleExpand:Oe,handleMoveDocument:ke,handleAddTag:Ae,handleRemoveTag:je,handleManageTags:Me,handleFileSourceChange:Ne,handleUpdateTags:Pe,handleRestoreDocument:Fe,handlePermanentDelete:Ie,handleTabChange:Le,handleTabClose:Re,handleTabAdd:ze,handleTabDelete:Be,handleReopenLastClosed:Ve,handleSplitRight:He,handleSelectDocument:Ue,handleAIRewrite:We,handleAIApprove:()=>{A(null),Ge()},handleAIReject:()=>{A(null),Ge()},handleAIRegenerate:async e=>{Y.info(`AI rewrite is not yet available for this editor`)}}}var t_=(0,B.createContext)({});function n_(e){let t=(0,B.useRef)(null);return t.current===null&&(t.current=e()),t.current}var r_=typeof window<`u`?B.useLayoutEffect:B.useEffect,i_=(0,B.createContext)(null);function a_(e,t){e.indexOf(t)===-1&&e.push(t)}function o_(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}var s_=(e,t,n)=>n>t?t:n<e?e:n,c_={},l_=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),u_=e=>typeof e==`object`&&!!e,d_=e=>/^0[^.\s]+$/u.test(e);function f_(e){let t;return()=>(t===void 0&&(t=e()),t)}var p_=e=>e,m_=(...e)=>e.reduce((e,t)=>n=>t(e(n))),h_=(e,t,n)=>{let r=t-e;return r?(n-e)/r:1},g_=class{constructor(){this.subscriptions=[]}add(e){return a_(this.subscriptions,e),()=>o_(this.subscriptions,e)}notify(e,t,n){let r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,t,n);else for(let i=0;i<r;i++){let r=this.subscriptions[i];r&&r(e,t,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}},__=e=>e*1e3,v_=e=>e/1e3,y_=(e,t)=>t?1e3/t*e:0,b_=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,x_=1e-7,S_=12;function C_(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=b_(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>x_&&++s<S_);return o}function w_(e,t,n,r){if(e===t&&n===r)return p_;let i=t=>C_(t,0,1,e,n);return e=>e===0||e===1?e:b_(i(e),t,r)}var T_=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,E_=e=>t=>1-e(1-t),D_=w_(.33,1.53,.69,.99),O_=E_(D_),k_=T_(O_),A_=e=>e>=1?1:(e*=2)<1?.5*O_(e):.5*(2-2**(-10*(e-1))),j_=e=>1-Math.sin(Math.acos(e)),M_=E_(j_),N_=T_(j_),P_=w_(.42,0,1,1),F_=w_(0,0,.58,1),I_=w_(.42,0,.58,1),L_=e=>Array.isArray(e)&&typeof e[0]!=`number`,R_=e=>Array.isArray(e)&&typeof e[0]==`number`,z_={linear:p_,easeIn:P_,easeInOut:I_,easeOut:F_,circIn:j_,circInOut:N_,circOut:M_,backIn:O_,backInOut:k_,backOut:D_,anticipate:A_},B_=e=>typeof e==`string`,V_=e=>{if(R_(e)){e.length;let[t,n,r,i]=e;return w_(t,n,r,i)}return B_(e)?(z_[e],`${e}`,z_[e]):e},H_=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`];function U_(e){let t=new Set,n=new Set,r=!1,i=!1,a=new WeakSet,o={delta:0,timestamp:0,isProcessing:!1};function s(t){a.has(t)&&(c.schedule(t),e()),t(o)}let c={schedule:(e,i=!1,o=!1)=>{let s=o&&r?t:n;return i&&a.add(e),s.add(e),e},cancel:e=>{n.delete(e),a.delete(e)},process:e=>{if(o=e,r){i=!0;return}r=!0;let a=t;t=n,n=a,t.forEach(s),t.clear(),r=!1,i&&(i=!1,c.process(e))}};return c}var W_=40;function G_(e,t){let n=!1,r=!0,i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=H_.reduce((e,t)=>(e[t]=U_(a),e),{}),{setup:s,read:c,resolveKeyframes:l,preUpdate:u,update:d,preRender:f,render:p,postRender:m}=o,h=()=>{let a=c_.useManualTiming,o=a?i.timestamp:performance.now();n=!1,a||(i.delta=r?1e3/60:Math.max(Math.min(o-i.timestamp,W_),1)),i.timestamp=o,i.isProcessing=!0,s.process(i),c.process(i),l.process(i),u.process(i),d.process(i),f.process(i),p.process(i),m.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(h))},g=()=>{n=!0,r=!0,i.isProcessing||e(h)};return{schedule:H_.reduce((e,t)=>{let r=o[t];return e[t]=(e,t=!1,i=!1)=>(n||g(),r.schedule(e,t,i)),e},{}),cancel:e=>{for(let t=0;t<H_.length;t++)o[H_[t]].cancel(e)},state:i,steps:o}}var{schedule:Z,cancel:K_,state:q_,steps:J_}=G_(typeof requestAnimationFrame<`u`?requestAnimationFrame:p_,!0),Y_;function X_(){Y_=void 0}var Z_={now:()=>(Y_===void 0&&Z_.set(q_.isProcessing||c_.useManualTiming?q_.timestamp:performance.now()),Y_),set:e=>{Y_=e,queueMicrotask(X_)}},Q_=e=>t=>typeof t==`string`&&t.startsWith(e),$_=Q_(`--`),ev=Q_(`var(--`),tv=e=>ev(e)?nv.test(e.split(`/*`)[0].trim()):!1,nv=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function rv(e){return typeof e==`string`&&e.split(`/*`)[0].includes(`var(--`)}var iv={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},av={...iv,transform:e=>s_(0,1,e)},ov={...iv,default:1},sv=e=>Math.round(e*1e5)/1e5,cv=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function lv(e){return e==null}var uv=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,dv=(e,t)=>n=>!!(typeof n==`string`&&uv.test(n)&&n.startsWith(e)||t&&!lv(n)&&Object.prototype.hasOwnProperty.call(n,t)),fv=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(cv);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},pv=e=>s_(0,255,e),mv={...iv,transform:e=>Math.round(pv(e))},hv={test:dv(`rgb`,`red`),parse:fv(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+mv.transform(e)+`, `+mv.transform(t)+`, `+mv.transform(n)+`, `+sv(av.transform(r))+`)`};function gv(e){let t=``,n=``,r=``,i=``;return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}var _v={test:dv(`#`),parse:gv,transform:hv.transform},vv=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),yv=vv(`deg`),bv=vv(`%`),Q=vv(`px`),xv=vv(`vh`),Sv=vv(`vw`),Cv={...bv,parse:e=>bv.parse(e)/100,transform:e=>bv.transform(e*100)},wv={test:dv(`hsl`,`hue`),parse:fv(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+bv.transform(sv(t))+`, `+bv.transform(sv(n))+`, `+sv(av.transform(r))+`)`},Tv={test:e=>hv.test(e)||_v.test(e)||wv.test(e),parse:e=>hv.test(e)?hv.parse(e):wv.test(e)?wv.parse(e):_v.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?hv.transform(e):wv.transform(e),getAnimatableNone:e=>{let t=Tv.parse(e);return t.alpha=0,Tv.transform(t)}},Ev=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Dv(e){return isNaN(e)&&typeof e==`string`&&(e.match(cv)?.length||0)+(e.match(Ev)?.length||0)>0}var Ov=`number`,kv=`color`,Av=`var`,jv=`var(`,Mv="${}",Nv=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Pv(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(Nv,e=>(Tv.test(e)?(r.color.push(a),i.push(kv),n.push(Tv.parse(e))):e.startsWith(jv)?(r.var.push(a),i.push(Av),n.push(e)):(r.number.push(a),i.push(Ov),n.push(parseFloat(e))),++a,Mv)).split(Mv),indexes:r,types:i}}function Fv(e){return Pv(e).values}function Iv({split:e,types:t}){let n=e.length;return r=>{let i=``;for(let a=0;a<n;a++)if(i+=e[a],r[a]!==void 0){let e=t[a];i+=e===Ov?sv(r[a]):e===kv?Tv.transform(r[a]):r[a]}return i}}function Lv(e){return Iv(Pv(e))}var Rv=e=>typeof e==`number`?0:Tv.test(e)?Tv.getAnimatableNone(e):e,zv=(e,t)=>typeof e==`number`?t?.trim().endsWith(`/`)?e:0:Rv(e);function Bv(e){let t=Pv(e);return Iv(t)(t.values.map((e,n)=>zv(e,t.split[n])))}var Vv={test:Dv,parse:Fv,createTransformer:Lv,getAnimatableNone:Bv};function Hv(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function Uv({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,a=0,o=0;if(!t)i=a=o=n;else{let r=n<.5?n*(1+t):n+t-n*t,s=2*n-r;i=Hv(s,r,e+1/3),a=Hv(s,r,e),o=Hv(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function Wv(e,t){return n=>n>0?t:e}var $=(e,t,n)=>e+(t-e)*n,Gv=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},Kv=[_v,hv,wv],qv=e=>Kv.find(t=>t.test(e));function Jv(e){let t=qv(e);if(`${e}`,!t)return!1;let n=t.parse(e);return t===wv&&(n=Uv(n)),n}var Yv=(e,t)=>{let n=Jv(e),r=Jv(t);if(!n||!r)return Wv(e,t);let i={...n};return e=>(i.red=Gv(n.red,r.red,e),i.green=Gv(n.green,r.green,e),i.blue=Gv(n.blue,r.blue,e),i.alpha=$(n.alpha,r.alpha,e),hv.transform(i))},Xv=new Set([`none`,`hidden`]);function Zv(e,t){return Xv.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function Qv(e,t){return n=>$(e,t,n)}function $v(e){return typeof e==`number`?Qv:typeof e==`string`?tv(e)?Wv:Tv.test(e)?Yv:ry:Array.isArray(e)?ey:typeof e==`object`?Tv.test(e)?Yv:ty:Wv}function ey(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>$v(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=i[t](e);return n}}function ty(e,t){let n={...e,...t},r={};for(let i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=$v(e[i])(e[i],t[i]));return e=>{for(let t in r)n[t]=r[t](e);return n}}function ny(e,t){let n=[],r={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){let a=t.types[i],o=e.indexes[a][r[a]],s=e.values[o]??0;n[i]=s,r[a]++}return n}var ry=(e,t)=>{let n=Vv.createTransformer(t),r=Pv(e),i=Pv(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?Xv.has(e)&&!i.values.length||Xv.has(t)&&!r.values.length?Zv(e,t):m_(ey(ny(r,i),i.values),n):(`${e}${t}`,Wv(e,t))};function iy(e,t,n){return typeof e==`number`&&typeof t==`number`&&typeof n==`number`?$(e,t,n):$v(e)(e,t)}var ay=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>Z.update(t,e),stop:()=>K_(t),now:()=>q_.isProcessing?q_.timestamp:Z_.now()}},oy=(e,t,n=10)=>{let r=``,i=Math.max(Math.round(t/n),2);for(let t=0;t<i;t++)r+=Math.round(e(t/(i-1))*1e4)/1e4+`, `;return`linear(${r.substring(0,r.length-2)})`},sy=2e4;function cy(e){let t=0,n=e.next(t);for(;!n.done&&t<2e4;)t+=50,n=e.next(t);return t>=2e4?1/0:t}function ly(e,t=100,n){let r=n({...e,keyframes:[0,t]}),i=Math.min(cy(r),sy);return{type:`keyframes`,ease:e=>r.next(i*e).value/t,duration:v_(i)}}var uy={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function dy(e,t){return e*Math.sqrt(1-t*t)}var fy=12;function py(e,t,n){let r=n;for(let n=1;n<fy;n++)r-=e(r)/t(r);return r}var my=.001;function hy({duration:e=uy.duration,bounce:t=uy.bounce,velocity:n=uy.velocity,mass:r=uy.mass}){let i,a;uy.maxDuration;let o=1-t;o=s_(uy.minDamping,uy.maxDamping,o),e=s_(uy.minDuration,uy.maxDuration,v_(e)),o<1?(i=t=>{let r=t*o,i=r*e,a=r-n,s=dy(t,o),c=Math.exp(-i);return my-a/s*c},a=t=>{let r=t*o*e,a=r*n+n,s=o**2*t**2*e,c=Math.exp(-r),l=dy(t**2,o);return(-i(t)+my>0?-1:1)*((a-s)*c)/l}):(i=t=>-.001+Math.exp(-t*e)*((t-n)*e+1),a=t=>Math.exp(-t*e)*((n-t)*(e*e)));let s=5/e,c=py(i,a,s);if(e=__(e),isNaN(c))return{stiffness:uy.stiffness,damping:uy.damping,duration:e};{let t=c**2*r;return{stiffness:t,damping:o*2*Math.sqrt(r*t),duration:e}}}var gy=[`duration`,`bounce`],_y=[`stiffness`,`damping`,`mass`];function vy(e,t){return t.some(t=>e[t]!==void 0)}function yy(e){let t={velocity:uy.velocity,stiffness:uy.stiffness,damping:uy.damping,mass:uy.mass,isResolvedFromDuration:!1,...e};if(!vy(e,_y)&&vy(e,gy))if(t.velocity=0,e.visualDuration){let n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,a=2*s_(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:uy.mass,stiffness:i,damping:a}}else{let n=hy({...e,velocity:0});t={...t,...n,mass:uy.mass},t.isResolvedFromDuration=!0}return t}function by(e=uy.visualDuration,t=uy.bounce){let n=typeof e==`object`?e:{visualDuration:e,keyframes:[0,1],bounce:t},{restSpeed:r,restDelta:i}=n,a=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],s={done:!1,value:a},{stiffness:c,damping:l,mass:u,duration:d,velocity:f,isResolvedFromDuration:p}=yy({...n,velocity:-v_(n.velocity||0)}),m=f||0,h=l/(2*Math.sqrt(c*u)),g=o-a,_=v_(Math.sqrt(c/u)),v=Math.abs(g)<5;r||=v?uy.restSpeed.granular:uy.restSpeed.default,i||=v?uy.restDelta.granular:uy.restDelta.default;let y,b,x,S,C,w;if(h<1)x=dy(_,h),S=(m+h*_*g)/x,y=e=>{let t=Math.exp(-h*_*e);return o-t*(S*Math.sin(x*e)+g*Math.cos(x*e))},C=h*_*S+g*x,w=h*_*g-S*x,b=e=>Math.exp(-h*_*e)*(C*Math.sin(x*e)+w*Math.cos(x*e));else if(h===1){y=e=>o-Math.exp(-_*e)*(g+(m+_*g)*e);let e=m+_*g;b=t=>Math.exp(-_*t)*(_*e*t-m)}else{let e=_*Math.sqrt(h*h-1);y=t=>{let n=Math.exp(-h*_*t),r=Math.min(e*t,300);return o-n*((m+h*_*g)*Math.sinh(r)+e*g*Math.cosh(r))/e};let t=(m+h*_*g)/e,n=h*_*t-g*e,r=h*_*g-t*e;b=t=>{let i=Math.exp(-h*_*t),a=Math.min(e*t,300);return i*(n*Math.sinh(a)+r*Math.cosh(a))}}let T={calculatedDuration:p&&d||null,velocity:e=>__(b(e)),next:e=>{if(!p&&h<1){let t=Math.exp(-h*_*e),n=Math.sin(x*e),a=Math.cos(x*e),c=o-t*(S*n+g*a),l=__(t*(C*n+w*a));return s.done=Math.abs(l)<=r&&Math.abs(o-c)<=i,s.value=s.done?o:c,s}let t=y(e);if(p)s.done=e>=d;else{let n=__(b(e));s.done=Math.abs(n)<=r&&Math.abs(o-t)<=i}return s.value=s.done?o:t,s},toString:()=>{let e=Math.min(cy(T),sy),t=oy(t=>T.next(e*t).value,e,30);return e+`ms `+t},toTransition:()=>{}};return T}by.applyToOptions=e=>{let t=ly(e,100,by);return e.ease=t.ease,e.duration=__(t.duration),e.type=`keyframes`,e};var xy=5;function Sy(e,t,n){let r=Math.max(t-xy,0);return y_(n-e(r),t-r)}function Cy({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:s,max:c,restDelta:l=.5,restSpeed:u}){let d=e[0],f={done:!1,value:d},p=e=>s!==void 0&&e<s||c!==void 0&&e>c,m=e=>s===void 0?c:c===void 0||Math.abs(s-e)<Math.abs(c-e)?s:c,h=n*t,g=d+h,_=o===void 0?g:o(g);_!==g&&(h=_-d);let v=e=>-h*Math.exp(-e/r),y=e=>_+v(e),b=e=>{let t=v(e),n=y(e);f.done=Math.abs(t)<=l,f.value=f.done?_:n},x,S,C=e=>{p(f.value)&&(x=e,S=by({keyframes:[f.value,m(f.value)],velocity:Sy(y,e,f.value),damping:i,stiffness:a,restDelta:l,restSpeed:u}))};return C(0),{calculatedDuration:null,next:e=>{let t=!1;return!S&&x===void 0&&(t=!0,b(e),C(e)),x!==void 0&&e>=x?S.next(e-x):(!t&&b(e),f)}}}function wy(e,t,n){let r=[],i=n||c_.mix||iy,a=e.length-1;for(let n=0;n<a;n++){let a=i(e[n],e[n+1]);t&&(a=m_(Array.isArray(t)?t[n]||p_:t,a)),r.push(a)}return r}function Ty(e,t,{clamp:n=!0,ease:r,mixer:i}={}){let a=e.length;if(t.length,a===1)return()=>t[0];if(a===2&&t[0]===t[1])return()=>t[1];let o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());let s=wy(t,r,i),c=s.length,l=n=>{if(o&&n<e[0])return t[0];let r=0;if(c>1)for(;r<e.length-2&&!(n<e[r+1]);r++);let i=h_(e[r],e[r+1],n);return s[r](i)};return n?t=>l(s_(e[0],e[a-1],t)):l}function Ey(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=h_(0,t,r);e.push($(n,1,i))}}function Dy(e){let t=[0];return Ey(t,e.length-1),t}function Oy(e,t){return e.map(e=>e*t)}function ky(e,t){return e.map(()=>t||I_).splice(0,e.length-1)}function Ay({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=L_(r)?r.map(V_):V_(r),a={done:!1,value:t[0]},o=Ty(Oy(n&&n.length===t.length?n:Dy(t),e),t,{ease:Array.isArray(i)?i:ky(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}var jy=e=>e!==null;function My(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a=e.filter(jy),o=i<0||t&&n!==`loop`&&t%2==1?0:a.length-1;return!o||r===void 0?a[o]:r}var Ny={decay:Cy,inertia:Cy,tween:Ay,keyframes:Ay,spring:by};function Py(e){typeof e.type==`string`&&(e.type=Ny[e.type])}var Fy=class{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}},Iy=e=>e/100,Ly=class extends Fy{constructor(e){super(),this.state=`idle`,this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==Z_.now()&&this.tick(Z_.now()),this.isStopped=!0,this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){let{options:e}=this;Py(e);let{type:t=Ay,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e,{keyframes:o}=e,s=t||Ay;s!==Ay&&typeof o[0]!=`number`&&(this.mixKeyframes=m_(Iy,iy(o[0],o[1])),o=[0,100]);let c=s({...e,keyframes:o});i===`mirror`&&(this.mirroredGenerator=s({...e,keyframes:[...o].reverse(),velocity:-a})),c.calculatedDuration===null&&(c.calculatedDuration=cy(c));let{calculatedDuration:l}=c;this.calculatedDuration=l,this.resolvedDuration=l+r,this.totalDuration=this.resolvedDuration*(n+1)-r,this.generator=c}updateTime(e){let t=Math.round(e-this.startTime)*this.playbackSpeed;this.currentTime=this.holdTime===null?t:this.holdTime}tick(e,t=!1){let{generator:n,totalDuration:r,mixKeyframes:i,mirroredGenerator:a,resolvedDuration:o,calculatedDuration:s}=this;if(this.startTime===null)return n.next(0);let{delay:c=0,keyframes:l,repeat:u,repeatType:d,repeatDelay:f,type:p,onUpdate:m,finalKeyframe:h}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let g=this.currentTime-c*(this.playbackSpeed>=0?1:-1),_=this.playbackSpeed>=0?g<0:g>r;this.currentTime=Math.max(g,0),this.state===`finished`&&this.holdTime===null&&(this.currentTime=r);let v=this.currentTime,y=n;if(u){let e=Math.min(this.currentTime,r)/o,t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),n===1&&t--,t=Math.min(t,u+1),t%2&&(d===`reverse`?(n=1-n,f&&(n-=f/o)):d===`mirror`&&(y=a)),v=s_(0,1,n)*o}let b;_?(this.delayState.value=l[0],b=this.delayState):b=y.next(v),i&&!_&&(b.value=i(b.value));let{done:x}=b;!_&&s!==null&&(x=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);let S=this.holdTime===null&&(this.state===`finished`||this.state===`running`&&x);return S&&p!==Cy&&(b.value=My(l,this.options,h,this.speed)),m&&m(b.value),S&&this.finish(),b}then(e,t){return this.finished.then(e,t)}get duration(){return v_(this.calculatedDuration)}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+v_(e)}get time(){return v_(this.currentTime)}set time(e){e=__(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state=`paused`,this.holdTime=e,this.tick(e))}getGeneratorVelocity(){let e=this.currentTime;if(e<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(e);let t=this.generator.next(e).value;return Sy(e=>this.generator.next(e).value,e,t)}get speed(){return this.playbackSpeed}set speed(e){let t=this.playbackSpeed!==e;t&&this.driver&&this.updateTime(Z_.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=v_(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=ay,startTime:t}=this.options;this.driver||=e(e=>this.tick(e)),this.options.onPlay?.();let n=this.driver.now();this.state===`finished`?(this.updateFinished(),this.startTime=n):this.holdTime===null?this.startTime||=t??n:this.startTime=n-this.holdTime,this.state===`finished`&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state=`running`,this.driver.start()}pause(){this.state=`paused`,this.updateTime(Z_.now()),this.holdTime=this.currentTime}complete(){this.state!==`running`&&this.play(),this.state=`finished`,this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state=`finished`,this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state=`idle`,this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&=(this.driver.stop(),void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type=`keyframes`,this.options.ease=`linear`,this.initAnimation()),this.driver?.stop(),e.observe(this)}};function Ry(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}var zy=e=>e*180/Math.PI,By=e=>Hy(zy(Math.atan2(e[1],e[0]))),Vy={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:By,rotateZ:By,skewX:e=>zy(Math.atan(e[1])),skewY:e=>zy(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Hy=e=>(e%=360,e<0&&(e+=360),e),Uy=By,Wy=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),Gy=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),Ky={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Wy,scaleY:Gy,scale:e=>(Wy(e)+Gy(e))/2,rotateX:e=>Hy(zy(Math.atan2(e[6],e[5]))),rotateY:e=>Hy(zy(Math.atan2(-e[2],e[0]))),rotateZ:Uy,rotate:Uy,skewX:e=>zy(Math.atan(e[4])),skewY:e=>zy(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function qy(e){return+!!e.includes(`scale`)}function Jy(e,t){if(!e||e===`none`)return qy(t);let n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),r,i;if(n)r=Ky,i=n;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=Vy,i=t}if(!i)return qy(t);let a=r[t],o=i[1].split(`,`).map(Xy);return typeof a==`function`?a(o):o[a]}var Yy=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return Jy(n,t)};function Xy(e){return parseFloat(e.trim())}var Zy=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],Qy=new Set([...Zy,`pathRotation`]),$y=e=>e===iv||e===Q,eb=new Set([`x`,`y`,`z`]),tb=Zy.filter(e=>!eb.has(e));function nb(e){let t=[];return tb.forEach(n=>{let r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(+!!n.startsWith(`scale`)))}),t}var rb={width:({x:e},{paddingLeft:t=`0`,paddingRight:n=`0`,boxSizing:r})=>{let i=e.max-e.min;return r===`border-box`?i:i-parseFloat(t)-parseFloat(n)},height:({y:e},{paddingTop:t=`0`,paddingBottom:n=`0`,boxSizing:r})=>{let i=e.max-e.min;return r===`border-box`?i:i-parseFloat(t)-parseFloat(n)},top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>Jy(t,`x`),y:(e,{transform:t})=>Jy(t,`y`)};rb.translateX=rb.x,rb.translateY=rb.y;var ib=new Set,ab=!1,ob=!1,sb=!1;function cb(){if(ob){let e=Array.from(ib).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{let t=nb(e);t.length&&(n.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=n.get(e);t&&t.forEach(([t,n])=>{e.getValue(t)?.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{e.suspendedScrollY!==void 0&&window.scrollTo(0,e.suspendedScrollY)})}ob=!1,ab=!1,ib.forEach(e=>e.complete(sb)),ib.clear()}function lb(){ib.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(ob=!0)})}function ub(){sb=!0,lb(),cb(),sb=!1}var db=class{constructor(e,t,n,r,i,a=!1){this.state=`pending`,this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=i,this.isAsync=a}scheduleResolve(){this.state=`scheduled`,this.isAsync?(ib.add(this),ab||(ab=!0,Z.read(lb),Z.resolveKeyframes(cb))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;if(e[0]===null){let i=r?.get(),a=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&t){let r=n.readValue(t,a);r!=null&&(e[0]=r)}e[0]===void 0&&(e[0]=a),r&&i===void 0&&r.set(e[0])}Ry(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),ib.delete(this)}cancel(){this.state===`scheduled`&&(ib.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}},fb=e=>e.startsWith(`--`);function pb(e,t,n){fb(t)?e.style.setProperty(t,n):e.style[t]=n}var mb={};function hb(e,t){let n=f_(e);return()=>mb[t]??n()}var gb=hb(()=>window.ScrollTimeline!==void 0,`scrollTimeline`),_b=hb(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),vb=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,yb={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:vb([0,.65,.55,1]),circOut:vb([.55,0,1,.45]),backIn:vb([.31,.01,.66,-.59]),backOut:vb([.33,1.53,.69,.99])};function bb(e,t){if(e)return typeof e==`function`?_b()?oy(e,t):`ease-out`:R_(e)?vb(e):Array.isArray(e)?e.map(e=>bb(e,t)||yb.easeOut):yb[e]}function xb(e,t,n,{delay:r=0,duration:i=300,repeat:a=0,repeatType:o=`loop`,ease:s=`easeOut`,times:c}={},l=void 0){let u={[t]:n};c&&(u.offset=c);let d=bb(s,i);Array.isArray(d)&&(u.easing=d);let f={delay:r,duration:i,easing:Array.isArray(d)?`linear`:d,fill:`both`,iterations:a+1,direction:o===`reverse`?`alternate`:`normal`};return l&&(f.pseudoElement=l),e.animate(u,f)}function Sb(e){return typeof e==`function`&&`applyToOptions`in e}function Cb({type:e,...t}){return Sb(e)&&_b()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var wb=class extends Fy{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;let{element:t,name:n,keyframes:r,pseudoElement:i,allowFlatten:a=!1,finalKeyframe:o,onComplete:s}=e;this.isPseudoElement=!!i,this.allowFlatten=a,this.options=e,e.type;let c=Cb(e);this.animation=xb(t,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=My(r,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(e),pb(t,n,e),this.animation.cancel()}s?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state===`finished`&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:e}=this;e!==`idle`&&e!==`finished`&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){let e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){let e=this.animation.effect?.getComputedTiming?.().duration||0;return v_(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+v_(e)}get time(){return v_(Number(this.animation.currentTime)||0)}set time(e){let t=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=__(e),t&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime===null?this.animation.playState:`finished`}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,rangeStart:t,rangeEnd:n,observe:r}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:`linear`}),this.animation.onfinish=null,e&&gb()?(this.animation.timeline=e,t&&(this.animation.rangeStart=t),n&&(this.animation.rangeEnd=n),p_):r(this)}},Tb={anticipate:A_,backInOut:k_,circInOut:N_};function Eb(e){return e in Tb}function Db(e){typeof e.ease==`string`&&Eb(e.ease)&&(e.ease=Tb[e.ease])}var Ob=10,kb=class extends wb{constructor(e){Db(e),Py(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:t,onUpdate:n,onComplete:r,element:i,...a}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}let o=new Ly({...a,autoplay:!1}),s=Math.max(Ob,Z_.now()-this.startTime),c=s_(0,Ob,s-Ob),l=o.sample(s).value,{name:u}=this.options;i&&u&&pb(i,u,l),t.setWithVelocity(o.sample(Math.max(0,s-c)).value,l,c),o.stop()}},Ab=(e,t)=>t!==`zIndex`&&!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(Vv.test(e)||e===`0`)&&!e.startsWith(`url(`));function jb(e){let t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function Mb(e,t,n,r){let i=e[0];if(i===null)return!1;if(t===`display`||t===`visibility`)return!0;let a=e[e.length-1],o=Ab(i,t),s=Ab(a,t);return`${t}${i}${a}${o?a:i}`,!o||!s?!1:jb(e)||(n===`spring`||Sb(n))&&r}function Nb(e){e.duration=0,e.type=`keyframes`}var Pb=new Set([`opacity`,`clipPath`,`filter`,`transform`,`backgroundColor`]),Fb=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function Ib(e){for(let t=0;t<e.length;t++)if(typeof e[t]==`string`&&Fb.test(e[t]))return!0;return!1}var Lb=new Set([`color`,`backgroundColor`,`outlineColor`,`fill`,`stroke`,`borderColor`,`borderTopColor`,`borderRightColor`,`borderBottomColor`,`borderLeftColor`]),Rb=f_(()=>Object.hasOwnProperty.call(Element.prototype,`animate`));function zb(e){let{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:a,type:o,keyframes:s}=e,c=t?.owner?.current;if(!(c instanceof HTMLElement)&&!(c instanceof SVGElement))return!1;let{onUpdate:l,transformTemplate:u}=t.owner.getProps();return Rb()&&n&&(Pb.has(n)||Lb.has(n)&&Ib(s))&&(n!==`transform`||!u)&&!l&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`}var Bb=40,Vb=class extends Fy{constructor({autoplay:e=!0,delay:t=0,type:n=`keyframes`,repeat:r=0,repeatDelay:i=0,repeatType:a=`loop`,keyframes:o,name:s,motionValue:c,element:l,...u}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=Z_.now();let d={autoplay:e,delay:t,type:n,repeat:r,repeatDelay:i,repeatType:a,name:s,motionValue:c,element:l,...u},f=l?.KeyframeResolver||db;this.keyframeResolver=new f(o,(e,t,n)=>this.onKeyframesResolved(e,t,d,!n),s,c,l),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,n,r){this.keyframeResolver=void 0;let{name:i,type:a,velocity:o,delay:s,isHandoff:c,onUpdate:l}=n;this.resolvedAt=Z_.now();let u=!0;Mb(e,i,a,o)||(u=!1,(c_.instantAnimations||!s)&&l?.(My(e,n,t)),e[0]=e[e.length-1],Nb(n),n.repeat=0);let d={startTime:r?this.resolvedAt&&this.resolvedAt-this.createdAt>Bb?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...n,keyframes:e},f=u&&!c&&zb(d),p=d.motionValue?.owner?.current,m;if(f)try{m=new kb({...d,element:p})}catch{m=new Ly(d)}else m=new Ly(d);m.finished.then(()=>{this.notifyFinished()}).catch(p_),this.pendingTimeline&&=(this.stopTimeline=m.attachTimeline(this.pendingTimeline),void 0),this._animation=m}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),ub()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}};function Hb(e,t,n,r=0,i=1){let a=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),o=e.size,s=(o-1)*r;return typeof n==`function`?n(a,o):i===1?a*r:s-a*r}var Ub=30,Wb=e=>!isNaN(parseFloat(e)),Gb={current:void 0},Kb=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=Z_.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=Z_.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=Wb(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on(`change`,e)}on(e,t){this.events[e]||(this.events[e]=new g_);let n=this.events[e].add(t);return e===`change`?()=>{n(),Z.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||=new Set,this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return Gb.current&&Gb.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=Z_.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>Ub)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,Ub);return y_(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function qb(e,t){return new Kb(e,t)}function Jb(e,t){if(e?.inherit&&t){let{inherit:n,...r}=e;return{...t,...r}}return e}function Yb(e,t){let n=e?.[t]??e?.default??e;return n===e?n:Jb(n,e)}var Xb={type:`spring`,stiffness:500,damping:25,restSpeed:10},Zb=e=>({type:`spring`,stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),Qb={type:`keyframes`,duration:.8},$b={type:`keyframes`,ease:[.25,.1,.35,1],duration:.3},ex=(e,{keyframes:t})=>t.length>2?Qb:Qy.has(e)?e.startsWith(`scale`)?Zb(t[1]):Xb:$b,tx=new Set([`when`,`delay`,`delayChildren`,`staggerChildren`,`staggerDirection`,`repeat`,`repeatType`,`repeatDelay`,`from`,`elapsed`]);function nx(e){for(let t in e)if(!tx.has(t))return!0;return!1}var rx=(e,t,n,r={},i,a)=>o=>{let s=Yb(r,e)||{},c=s.delay||r.delay||0,{elapsed:l=0}=r;l-=__(c);let u={keyframes:Array.isArray(n)?n:[null,n],ease:`easeOut`,velocity:t.getVelocity(),...s,delay:-l,onUpdate:e=>{t.set(e),s.onUpdate&&s.onUpdate(e)},onComplete:()=>{o(),s.onComplete&&s.onComplete()},name:e,motionValue:t,element:a?void 0:i};nx(s)||Object.assign(u,ex(e,u)),u.duration&&=__(u.duration),u.repeatDelay&&=__(u.repeatDelay),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(Nb(u),u.delay===0&&(d=!0)),(c_.instantAnimations||c_.skipAnimations||i?.shouldSkipAnimations||s.skipAnimations)&&(d=!0,Nb(u),u.delay=0),u.allowFlatten=!s.type&&!s.ease,d&&!a&&t.get()!==void 0){let e=My(u.keyframes,s);if(e!==void 0){Z.update(()=>{u.onUpdate(e),u.onComplete()});return}}return s.isSync?new Ly(u):new Vb(u)},ix=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function ax(e){let t=ix.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}function ox(e,t,n=1){`${e}`;let[r,i]=ax(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return l_(e)?parseFloat(e):e}return tv(i)?ox(i,t,n+1):i}function sx(e){let t=[{},{}];return e?.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function cx(e,t,n,r){if(typeof t==`function`){let[i,a]=sx(r);t=t(n===void 0?e.custom:n,i,a)}if(typeof t==`string`&&(t=e.variants&&e.variants[t]),typeof t==`function`){let[i,a]=sx(r);t=t(n===void 0?e.custom:n,i,a)}return t}function lx(e,t,n){let r=e.getProps();return cx(r,t,n===void 0?r.custom:n,e)}var ux=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...Zy]),dx=e=>Array.isArray(e);function fx(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,qb(n))}function px(e){return dx(e)?e[e.length-1]||0:e}function mx(e,t){let{transitionEnd:n={},transition:r={},...i}=lx(e,t)||{};i={...i,...n};for(let t in i)fx(e,t,px(i[t]))}var hx=e=>!!(e&&e.getVelocity);function gx(e){return!!(hx(e)&&e.add)}function _x(e,t){let n=e.getValue(`willChange`);if(gx(n))return n.add(t);if(!n&&c_.WillChange){let n=new c_.WillChange(`auto`);e.addValue(`willChange`,n),n.add(t)}}function vx(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}var yx=`data-`+vx(`framerAppearId`);function bx(e){return e.props[yx]}function xx({protectedKeys:e,needsAnimating:t},n){let r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function Sx(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:a,transitionEnd:o,...s}=t,c=e.getDefaultTransition();a=a?Jb(a,c):c;let l=a?.reduceMotion,u=a?.skipAnimations;r&&(a=r);let d=[],f=i&&e.animationState&&e.animationState.getState()[i],p=a?.path;p&&p.animateVisualElement(e,s,a,n,d);for(let t in s){let r=e.getValue(t,e.latestValues[t]??null),i=s[t];if(i===void 0||f&&xx(f,t))continue;let o={delay:n,...Yb(a||{},t)};u&&(o.skipAnimations=!0);let c=r.get();if(c!==void 0&&!r.isAnimating()&&!Array.isArray(i)&&i===c&&!o.velocity){Z.update(()=>r.set(i));continue}let p=!1;if(window.MotionHandoffAnimation){let n=bx(e);if(n){let e=window.MotionHandoffAnimation(n,t,Z);e!==null&&(o.startTime=e,p=!0)}}_x(e,t);let m=l??e.shouldReduceMotion;r.start(rx(t,r,i,m&&ux.has(t)?{type:!1}:o,e,p));let h=r.animation;h&&d.push(h)}if(o){let t=()=>Z.update(()=>{o&&mx(e,o)});d.length?Promise.all(d).then(t):t()}return d}function Cx(e,t,n={}){let r=lx(e,t,n.type===`exit`?e.presenceContext?.custom:void 0),{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);let a=r?()=>Promise.all(Sx(e,r,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(r=0)=>{let{delayChildren:a=0,staggerChildren:o,staggerDirection:s}=i;return wx(e,t,r,a,o,s,n)}:()=>Promise.resolve(),{when:s}=i;if(s){let[e,t]=s===`beforeChildren`?[a,o]:[o,a];return e().then(()=>t())}return Promise.all([a(),o(n.delay)])}function wx(e,t,n=0,r=0,i=0,a=1,o){let s=[];for(let c of e.variantChildren)c.notify(`AnimationStart`,t),s.push(Cx(c,t,{...o,delay:n+(typeof r==`function`?0:r)+Hb(e.variantChildren,c,r,i,a)}).then(()=>c.notify(`AnimationComplete`,t)));return Promise.all(s)}function Tx(e,t,n={}){e.notify(`AnimationStart`,t);let r;if(Array.isArray(t)){let i=t.map(t=>Cx(e,t,n));r=Promise.all(i)}else if(typeof t==`string`)r=Cx(e,t,n);else{let i=typeof t==`function`?lx(e,t,n.custom):t;r=Promise.all(Sx(e,i,n))}return r.then(()=>{e.notify(`AnimationComplete`,t)})}var Ex={test:e=>e===`auto`,parse:e=>e},Dx=e=>t=>t.test(e),Ox=[iv,Q,bv,yv,Sv,xv,Ex],kx=e=>Ox.find(Dx(e));function Ax(e){return typeof e==`number`?e===0:e===null||e===`none`||e===`0`||d_(e)}var jx=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function Mx(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(cv)||[];if(!r)return e;let i=n.replace(r,``),a=+!!jx.has(t);return r!==n&&(a*=100),t+`(`+a+i+`)`}var Nx=/\b([a-z-]*)\(.*?\)/gu,Px={...Vv,getAnimatableNone:e=>{let t=e.match(Nx);return t?t.map(Mx).join(` `):e}},Fx={...Vv,getAnimatableNone:e=>{let t=Vv.parse(e);return Vv.createTransformer(e)(t.map(e=>typeof e==`number`?0:typeof e==`object`?{...e,alpha:1}:e))}},Ix={...iv,transform:Math.round},Lx={borderWidth:Q,borderTopWidth:Q,borderRightWidth:Q,borderBottomWidth:Q,borderLeftWidth:Q,borderRadius:Q,borderTopLeftRadius:Q,borderTopRightRadius:Q,borderBottomRightRadius:Q,borderBottomLeftRadius:Q,width:Q,maxWidth:Q,height:Q,maxHeight:Q,top:Q,right:Q,bottom:Q,left:Q,inset:Q,insetBlock:Q,insetBlockStart:Q,insetBlockEnd:Q,insetInline:Q,insetInlineStart:Q,insetInlineEnd:Q,padding:Q,paddingTop:Q,paddingRight:Q,paddingBottom:Q,paddingLeft:Q,paddingBlock:Q,paddingBlockStart:Q,paddingBlockEnd:Q,paddingInline:Q,paddingInlineStart:Q,paddingInlineEnd:Q,margin:Q,marginTop:Q,marginRight:Q,marginBottom:Q,marginLeft:Q,marginBlock:Q,marginBlockStart:Q,marginBlockEnd:Q,marginInline:Q,marginInlineStart:Q,marginInlineEnd:Q,fontSize:Q,backgroundPositionX:Q,backgroundPositionY:Q,rotate:yv,pathRotation:yv,rotateX:yv,rotateY:yv,rotateZ:yv,scale:ov,scaleX:ov,scaleY:ov,scaleZ:ov,skew:yv,skewX:yv,skewY:yv,distance:Q,translateX:Q,translateY:Q,translateZ:Q,x:Q,y:Q,z:Q,perspective:Q,transformPerspective:Q,opacity:av,originX:Cv,originY:Cv,originZ:Q,zIndex:Ix,fillOpacity:av,strokeOpacity:av,numOctaves:Ix},Rx={...Lx,color:Tv,backgroundColor:Tv,outlineColor:Tv,fill:Tv,stroke:Tv,borderColor:Tv,borderTopColor:Tv,borderRightColor:Tv,borderBottomColor:Tv,borderLeftColor:Tv,filter:Px,WebkitFilter:Px,mask:Fx,WebkitMask:Fx},zx=e=>Rx[e],Bx=new Set([Px,Fx]);function Vx(e,t){let n=zx(e);return Bx.has(n)||(n=Vv),n.getAnimatableNone?n.getAnimatableNone(t):void 0}var Hx=new Set([`auto`,`none`,`0`]);function Ux(e,t,n){let r=0,i;for(;r<e.length&&!i;){let t=e[r];typeof t==`string`&&!Hx.has(t)&&Pv(t).values.length&&(i=e[r]),r++}if(i&&n)for(let r of t)e[r]=Vx(n,i)}var Wx=class extends db{constructor(e,t,n,r,i){super(e,t,n,r,i,!0)}readKeyframes(){let{unresolvedKeyframes:e,element:t,name:n}=this;if(!t||!t.current)return;super.readKeyframes();for(let n=0;n<e.length;n++){let r=e[n];if(typeof r==`string`&&(r=r.trim(),tv(r))){let i=ox(r,t.current);i!==void 0&&(e[n]=i),n===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!ux.has(n)||e.length!==2)return;let[r,i]=e,a=kx(r),o=kx(i);if(rv(r)!==rv(i)&&rb[n]){this.needsMeasurement=!0;return}if(a!==o)if($y(a)&&$y(o))for(let t=0;t<e.length;t++){let n=e[t];typeof n==`string`&&(e[t]=parseFloat(n))}else rb[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,n=[];for(let t=0;t<e.length;t++)(e[t]===null||Ax(e[t]))&&n.push(t);n.length&&Ux(e,n,t)}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:n}=this;if(!e||!e.current)return;n===`height`&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=rb[n](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;let r=t[t.length-1];r!==void 0&&e.getValue(n,r).jump(r,!1)}measureEndState(){let{element:e,name:t,unresolvedKeyframes:n}=this;if(!e||!e.current)return;let r=e.getValue(t);r&&r.jump(this.measuredOrigin,!1);let i=n.length-1,a=n[i];n[i]=rb[t](e.measureViewportBox(),window.getComputedStyle(e.current)),a!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=a),this.removedTransforms?.length&&this.removedTransforms.forEach(([t,n])=>{e.getValue(t).set(n)}),this.resolveNoneKeyframes()}},Gx=[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomRightRadius`,`borderBottomLeftRadius`];function Kx(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e==`string`){let r=document;t&&(r=t.current);let i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e).filter(e=>e!=null)}var qx=(e,t)=>t&&typeof e==`number`?t.transform(e):e;function Jx(e){return u_(e)&&`offsetHeight`in e&&!(`ownerSVGElement`in e)}var{schedule:Yx,cancel:Xx}=G_(queueMicrotask,!1),Zx={x:!1,y:!1};function Qx(){return Zx.x||Zx.y}function $x(e){return e===`x`||e===`y`?Zx[e]?null:(Zx[e]=!0,()=>{Zx[e]=!1}):Zx.x||Zx.y?null:(Zx.x=Zx.y=!0,()=>{Zx.x=Zx.y=!1})}function eS(e,t){let n=Kx(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function tS(e){return!(e.pointerType===`touch`||Qx())}function nS(e,t,n={}){let[r,i,a]=eS(e,n);return r.forEach(e=>{let n=!1,r=!1,a,o=()=>{e.removeEventListener(`pointerleave`,u)},s=e=>{a&&=(a(e),void 0),o()},c=e=>{n=!1,window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c),r&&(r=!1,s(e))},l=()=>{n=!0,window.addEventListener(`pointerup`,c,i),window.addEventListener(`pointercancel`,c,i)},u=e=>{if(e.pointerType!==`touch`){if(n){r=!0;return}s(e)}};e.addEventListener(`pointerenter`,n=>{if(!tS(n))return;r=!1;let o=t(e,n);typeof o==`function`&&(a=o,e.addEventListener(`pointerleave`,u,i))},i),e.addEventListener(`pointerdown`,l,i)}),a}var rS=(e,t)=>t?e===t||rS(e,t.parentElement):!1,iS=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1,aS=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function oS(e){return aS.has(e.tagName)||e.isContentEditable===!0}var sS=new Set([`INPUT`,`SELECT`,`TEXTAREA`]);function cS(e){return sS.has(e.tagName)||e.isContentEditable===!0}var lS=new WeakSet;function uS(e){return t=>{t.key===`Enter`&&e(t)}}function dS(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}var fS=(e,t)=>{let n=e.currentTarget;if(!n)return;let r=uS(()=>{if(lS.has(n))return;dS(n,`down`);let e=uS(()=>{dS(n,`up`)});n.addEventListener(`keyup`,e,t),n.addEventListener(`blur`,()=>dS(n,`cancel`),t)});n.addEventListener(`keydown`,r,t),n.addEventListener(`blur`,()=>n.removeEventListener(`keydown`,r),t)};function pS(e){return iS(e)&&!Qx()}var mS=new WeakSet;function hS(e,t,n={}){let[r,i,a]=eS(e,n),o=e=>{let r=e.currentTarget;if(!pS(e)||mS.has(e))return;lS.add(r),n.stopPropagation&&mS.add(e);let a=t(r,e),o={...i,capture:!0},s=(e,t)=>{window.removeEventListener(`pointerup`,c,o),window.removeEventListener(`pointercancel`,l,o),lS.has(r)&&lS.delete(r),pS(e)&&typeof a==`function`&&a(e,{success:t})},c=e=>{s(e,r===window||r===document||n.useGlobalTarget||rS(r,e.target))},l=e=>{s(e,!1)};window.addEventListener(`pointerup`,c,o),window.addEventListener(`pointercancel`,l,o)};return r.forEach(e=>{(n.useGlobalTarget?window:e).addEventListener(`pointerdown`,o,i),Jx(e)&&(e.addEventListener(`focus`,e=>fS(e,i)),!oS(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}function gS(e){return u_(e)&&`ownerSVGElement`in e}var _S=new WeakMap,vS,yS=(e,t,n)=>(r,i)=>i&&i[0]?i[0][e+`Size`]:gS(r)&&`getBBox`in r?r.getBBox()[t]:r[n],bS=yS(`inline`,`width`,`offsetWidth`),xS=yS(`block`,`height`,`offsetHeight`);function SS({target:e,borderBoxSize:t}){_S.get(e)?.forEach(n=>{n(e,{get width(){return bS(e,t)},get height(){return xS(e,t)}})})}function CS(e){e.forEach(SS)}function wS(){typeof ResizeObserver>`u`||(vS=new ResizeObserver(CS))}function TS(e,t){vS||wS();let n=Kx(e);return n.forEach(e=>{let n=_S.get(e);n||(n=new Set,_S.set(e,n)),n.add(t),vS?.observe(e)}),()=>{n.forEach(e=>{let n=_S.get(e);n?.delete(t),n?.size||vS?.unobserve(e)})}}var ES=new Set,DS;function OS(){DS=()=>{let e={get width(){return window.innerWidth},get height(){return window.innerHeight}};ES.forEach(t=>t(e))},window.addEventListener(`resize`,DS)}function kS(e){return ES.add(e),DS||OS(),()=>{ES.delete(e),!ES.size&&typeof DS==`function`&&(window.removeEventListener(`resize`,DS),DS=void 0)}}function AS(e,t){return typeof e==`function`?kS(e):TS(e,t)}var jS={value:null,addProjectionMetrics:null};function MS(e){return gS(e)&&e.tagName===`svg`}var NS=[...Ox,Tv,Vv],PS=e=>NS.find(Dx(e)),FS=()=>({translate:0,scale:1,origin:0,originPoint:0}),IS=()=>({x:FS(),y:FS()}),LS=()=>({min:0,max:0}),RS=()=>({x:LS(),y:LS()}),zS=new WeakMap;function BS(e){return typeof e==`object`&&!!e&&typeof e.start==`function`}function VS(e){return typeof e==`string`||Array.isArray(e)}var HS=[`animate`,`whileInView`,`whileFocus`,`whileHover`,`whileTap`,`whileDrag`,`exit`],US=[`initial`,...HS];function WS(e){return BS(e.animate)||US.some(t=>VS(e[t]))}function GS(e){return!!(WS(e)||e.variants)}function KS(e,t,n){for(let r in t){let i=t[r],a=n[r];if(hx(i))e.addValue(r,i);else if(hx(a))e.addValue(r,qb(i,{owner:e}));else if(a!==i)if(e.hasValue(r)){let t=e.getValue(r);t.liveStyle===!0?t.jump(i):t.hasAnimated||t.set(i)}else{let t=e.getStaticValue(r);e.addValue(r,qb(t===void 0?i:t,{owner:e}))}}for(let r in n)t[r]===void 0&&e.removeValue(r);return t}var qS={current:null},JS={current:!1},YS=typeof window<`u`;function XS(){if(JS.current=!0,YS)if(window.matchMedia){let e=window.matchMedia(`(prefers-reduced-motion)`),t=()=>qS.current=e.matches;e.addEventListener(`change`,t),t()}else qS.current=!1}var ZS=[`AnimationStart`,`AnimationComplete`,`Update`,`BeforeLayoutMeasure`,`LayoutMeasure`,`LayoutAnimationStart`,`LayoutAnimationComplete`],QS={};function $S(e){QS=e}function eC(){return QS}var tC=class{scrapeMotionValuesFromProps(e,t,n){return{}}constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:r,skipAnimations:i,blockInitialAnimation:a,visualState:o},s={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=db,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify(`Update`,this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let e=Z_.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,Z.render(this.render,!1,!0))};let{latestValues:c,renderState:l}=o;this.latestValues=c,this.baseTarget={...c},this.initialValues=t.initial?{...c}:{},this.renderState=l,this.parent=e,this.props=t,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.skipAnimationsConfig=i,this.options=s,this.blockInitialAnimation=!!a,this.isControllingVariants=WS(t),this.isVariantNode=GS(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);let{willChange:u,...d}=this.scrapeMotionValuesFromProps(t,{},this);for(let e in d){let t=d[e];c[e]!==void 0&&hx(t)&&t.set(c[e])}}mount(e){if(this.hasBeenMounted)for(let e in this.initialValues)this.values.get(e)?.jump(this.initialValues[e]),this.latestValues[e]=this.initialValues[e];this.current=e,zS.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),this.reducedMotionConfig===`never`?this.shouldReduceMotion=!1:this.reducedMotionConfig===`always`?this.shouldReduceMotion=!0:(JS.current||XS(),this.shouldReduceMotion=qS.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),K_(this.notifyUpdate),K_(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(let e in this.events)this.events[e].clear();for(let e in this.features){let t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??=new Set,this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),t.accelerate&&Pb.has(e)&&this.current instanceof HTMLElement){let{factory:n,keyframes:r,times:i,ease:a,duration:o}=t.accelerate,s=new wb({element:this.current,name:e,keyframes:r,times:i,ease:a,duration:__(o)}),c=n(s);this.valueSubscriptions.set(e,()=>{c(),s.cancel()});return}let n=Qy.has(e);n&&this.onBindTransform&&this.onBindTransform();let r=t.on(`change`,t=>{this.latestValues[e]=t,this.props.onUpdate&&Z.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()}),i;typeof window<`u`&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{r(),i&&i()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e=`animation`;for(e in QS){let t=QS[e];if(!t)continue;let{isEnabled:n,Feature:r}=t;if(!this.features[e]&&r&&n(this.props)&&(this.features[e]=new r(this)),this.features[e]){let t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):RS()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t<ZS.length;t++){let n=ZS[t];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);let r=e[`on`+n];r&&(this.propEventSubscriptions[n]=this.on(n,r))}this.prevMotionValues=KS(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){let t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){let n=this.values.get(e);t!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);let t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&t!==void 0&&(n=qb(t===null?void 0:t,{owner:this}),this.addValue(e,n)),n}readValue(e,t){let n=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return n!=null&&(typeof n==`string`&&(l_(n)||d_(n))?n=parseFloat(n):!PS(n)&&Vv.test(t)&&(n=Vx(e,t)),this.setBaseTarget(e,hx(n)?n.get():n)),hx(n)?n.get():n}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){let{initial:t}=this.props,n;if(typeof t==`string`||typeof t==`object`){let r=cx(this.props,t,this.presenceContext?.custom);r&&(n=r[e])}if(t&&n!==void 0)return n;let r=this.getBaseTargetFromProps(this.props,e);return r!==void 0&&!hx(r)?r:this.initialValues[e]!==void 0&&n===void 0?void 0:this.baseTarget[e]}on(e,t){return this.events[e]||(this.events[e]=new g_),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){Yx.render(this.render)}},nC=class extends tC{constructor(){super(...arguments),this.KeyframeResolver=Wx}sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){let n=e.style;return n?n[t]:void 0}removeValueFromRenderState(e,{vars:t,style:n}){delete t[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;hx(e)&&(this.childSubscription=e.on(`change`,e=>{this.current&&(this.current.textContent=`${e}`)}))}},rC=class{constructor(e){this.isMounted=!1,this.node=e}update(){}};function iC({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function aC({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function oC(e,t){if(!t)return e;let n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function sC(e){return e===void 0||e===1}function cC({scale:e,scaleX:t,scaleY:n}){return!sC(e)||!sC(t)||!sC(n)}function lC(e){return cC(e)||uC(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function uC(e){return dC(e.x)||dC(e.y)}function dC(e){return e&&e!==`0%`}function fC(e,t,n){return n+t*(e-n)}function pC(e,t,n,r,i){return i!==void 0&&(e=fC(e,i,r)),fC(e,n,r)+t}function mC(e,t=0,n=1,r,i){e.min=pC(e.min,t,n,r,i),e.max=pC(e.max,t,n,r,i)}function hC(e,{x:t,y:n}){mC(e.x,t.translate,t.scale,t.originPoint),mC(e.y,n.translate,n.scale,n.originPoint)}var gC=.999999999999,_C=1.0000000000001;function vC(e,t,n,r=!1){let i=n.length;if(!i)return;t.x=t.y=1;let a,o;for(let s=0;s<i;s++){a=n[s],o=a.projectionDelta;let{visualElement:i}=a.options;i&&i.props.style&&i.props.style.display===`contents`||(r&&a.options.layoutScroll&&a.scroll&&a!==a.root&&(yC(e.x,-a.scroll.offset.x),yC(e.y,-a.scroll.offset.y)),o&&(t.x*=o.x.scale,t.y*=o.y.scale,hC(e,o)),r&&lC(a.latestValues)&&SC(e,a.latestValues,a.layout?.layoutBox))}t.x<_C&&t.x>gC&&(t.x=1),t.y<_C&&t.y>gC&&(t.y=1)}function yC(e,t){e.min+=t,e.max+=t}function bC(e,t,n,r,i=.5){mC(e,t,n,$(e.min,e.max,i),r)}function xC(e,t){return typeof e==`string`?parseFloat(e)/100*(t.max-t.min):e}function SC(e,t,n){let r=n??e;bC(e.x,xC(t.x,r.x),t.scaleX,t.scale,t.originX),bC(e.y,xC(t.y,r.y),t.scaleY,t.scale,t.originY)}function CC(e,t){return iC(oC(e.getBoundingClientRect(),t))}function wC(e,t,n){let r=CC(e,n),{scroll:i}=t;return i&&(yC(r.x,i.offset.x),yC(r.y,i.offset.y)),r}var TC={x:`translateX`,y:`translateY`,z:`translateZ`,transformPerspective:`perspective`},EC=Zy.length;function DC(e,t,n){let r=``,i=!0;for(let a=0;a<EC;a++){let o=Zy[a],s=e[o];if(s===void 0)continue;let c=!0;if(typeof s==`number`)c=s===+!!o.startsWith(`scale`);else{let e=parseFloat(s);c=o.startsWith(`scale`)?e===1:e===0}if(!c||n){let e=qx(s,Lx[o]);if(!c){i=!1;let t=TC[o]||o;r+=`${t}(${e}) `}n&&(t[o]=e)}}let a=e.pathRotation;return a&&(i=!1,r+=`rotate(${qx(a,Lx.pathRotation)}) `),r=r.trim(),n?r=n(t,i?``:r):i&&(r=`none`),r}function OC(e,t,n){let{style:r,vars:i,transformOrigin:a}=e,o=!1,s=!1;for(let e in t){let n=t[e];if(Qy.has(e)){o=!0;continue}if($_(e)){i[e]=n;continue}{let t=qx(n,Lx[e]);e.startsWith(`origin`)?(s=!0,a[e]=t):r[e]=t}}if(t.transform||(o||n?r.transform=DC(t,e.transform,n):r.transform&&=`none`),s){let{originX:e=`50%`,originY:t=`50%`,originZ:n=0}=a;r.transformOrigin=`${e} ${t} ${n}`}}function kC(e,{style:t,vars:n},r,i){let a=e.style,o;for(o in t)a[o]=t[o];for(o in i?.applyProjectionStyles(a,r),n)a.setProperty(o,n[o])}function AC(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}var jC={correct:(e,t)=>{if(!t.target)return e;if(typeof e==`string`)if(Q.test(e))e=parseFloat(e);else return e;return`${AC(e,t.target.x)}% ${AC(e,t.target.y)}%`}},MC={correct:(e,{treeScale:t,projectionDelta:n})=>{let r=e,i=Vv.parse(e);if(i.length>5)return r;let a=Vv.createTransformer(e),o=typeof i[0]==`number`?0:1,s=n.x.scale*t.x,c=n.y.scale*t.y;i[0+o]/=s,i[1+o]/=c;let l=$(s,c,.5);return typeof i[2+o]==`number`&&(i[2+o]/=l),typeof i[3+o]==`number`&&(i[3+o]/=l),a(i)}},NC={borderRadius:{...jC,applyTo:[...Gx]},borderTopLeftRadius:jC,borderTopRightRadius:jC,borderBottomLeftRadius:jC,borderBottomRightRadius:jC,boxShadow:MC};function PC(e,{layout:t,layoutId:n}){return Qy.has(e)||e.startsWith(`origin`)||(t||n!==void 0)&&(!!NC[e]||e===`opacity`)}function FC(e,t,n){let r=e.style,i=t?.style,a={};if(!r)return a;for(let t in r)(hx(r[t])||i&&hx(i[t])||PC(t,e)||n?.getValue(t)?.liveStyle!==void 0)&&(a[t]=r[t]);return a}function IC(e){return window.getComputedStyle(e)}var LC=class extends nC{constructor(){super(...arguments),this.type=`html`,this.renderInstance=kC}mount(e){e.style,super.mount(e)}readValueFromInstance(e,t){if(Qy.has(t))return this.projection?.isProjecting?qy(t):Yy(e,t);{let n=IC(e),r=($_(t)?n.getPropertyValue(t):n[t])||0;return typeof r==`string`?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return CC(e,t)}build(e,t,n){OC(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return FC(e,t,n)}},RC={offset:`stroke-dashoffset`,array:`stroke-dasharray`},zC={offset:`strokeDashoffset`,array:`strokeDasharray`};function BC(e,t,n=1,r=0,i=!0){e.pathLength=1;let a=i?RC:zC;e[a.offset]=`${-r}`,e[a.array]=`${t} ${n}`}var VC=[`offsetDistance`,`offsetPath`,`offsetRotate`,`offsetAnchor`];function HC(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:a=1,pathOffset:o=0,...s},c,l,u){if(OC(e,s,l),c){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:d,style:f}=e;d.transform&&(f.transform=d.transform,delete d.transform),(f.transform||d.transformOrigin)&&(f.transformOrigin=d.transformOrigin??`50% 50%`,delete d.transformOrigin),f.transform&&(f.transformBox=u?.transformBox??`fill-box`,delete d.transformBox);for(let e of VC)d[e]!==void 0&&(f[e]=d[e],delete d[e]);t!==void 0&&(d.x=t),n!==void 0&&(d.y=n),r!==void 0&&(d.scale=r),i!==void 0&&BC(d,i,a,o,!1)}var UC=new Set([`baseFrequency`,`diffuseConstant`,`kernelMatrix`,`kernelUnitLength`,`keySplines`,`keyTimes`,`limitingConeAngle`,`markerHeight`,`markerWidth`,`numOctaves`,`targetX`,`targetY`,`surfaceScale`,`specularConstant`,`specularExponent`,`stdDeviation`,`tableValues`,`viewBox`,`gradientTransform`,`pathLength`,`startOffset`,`textLength`,`lengthAdjust`]),WC=e=>typeof e==`string`&&e.toLowerCase()===`svg`;function GC(e,t,n,r){kC(e,t,void 0,r);for(let n in t.attrs)e.setAttribute(UC.has(n)?n:vx(n),t.attrs[n])}function KC(e,t,n){let r=FC(e,t,n);for(let n in e)if(hx(e[n])||hx(t[n])){let t=Zy.indexOf(n)===-1?n:`attr`+n.charAt(0).toUpperCase()+n.substring(1);r[t]=e[n]}return r}var qC=class extends nC{constructor(){super(...arguments),this.type=`svg`,this.isSVGTag=!1,this.measureInstanceViewportBox=RS}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(Qy.has(t)){let e=zx(t);return e&&e.default||0}return t=UC.has(t)?t:vx(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return KC(e,t,n)}build(e,t,n){HC(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){GC(e,t,n,r)}mount(e){this.isSVGTag=WC(e.tagName),super.mount(e)}},JC=US.length;function YC(e){if(!e)return;if(!e.isControllingVariants){let t=e.parent&&YC(e.parent)||{};return e.props.initial!==void 0&&(t.initial=e.props.initial),t}let t={};for(let n=0;n<JC;n++){let r=US[n],i=e.props[r];(VS(i)||i===!1)&&(t[r]=i)}return t}function XC(e,t){if(!Array.isArray(t))return!1;let n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}var ZC=[...HS].reverse(),QC=HS.length;function $C(e){return t=>Promise.all(t.map(({animation:t,options:n})=>Tx(e,t,n)))}function ew(e){let t=$C(e),n=rw(),r=!0,i=!1,a=t=>(n,r)=>{let i=lx(e,r,t===`exit`?e.presenceContext?.custom:void 0);if(i){let{transition:e,transitionEnd:t,...r}=i;n={...n,...r,...t}}return n};function o(n){t=n(e)}function s(o){let{props:s}=e,c=YC(e.parent)||{},l=[],u=new Set,d={},f=1/0;for(let t=0;t<QC;t++){let p=ZC[t],m=n[p],h=s[p]===void 0?c[p]:s[p],g=VS(h),_=p===o?m.isActive:null;_===!1&&(f=t);let v=h===c[p]&&h!==s[p]&&g;if(v&&(r||i)&&e.manuallyAnimateOnMount&&(v=!1),m.protectedKeys={...d},!m.isActive&&_===null||!h&&!m.prevProp||BS(h)||typeof h==`boolean`)continue;if(p===`exit`&&m.isActive&&_!==!0){m.prevResolvedValues&&(d={...d,...m.prevResolvedValues});continue}let y=tw(m.prevProp,h),b=y||p===o&&m.isActive&&!v&&g||t>f&&g,x=!1,S=Array.isArray(h)?h:[h],C=S.reduce(a(p),{});_===!1&&(C={});let{prevResolvedValues:w={}}=m,T={...w,...C},E=t=>{b=!0,u.has(t)&&(x=!0,u.delete(t)),m.needsAnimating[t]=!0;let n=e.getValue(t);n&&(n.liveStyle=!1)};for(let e in T){let t=C[e],n=w[e];if(d.hasOwnProperty(e))continue;let r=!1;r=dx(t)&&dx(n)?!XC(t,n)||y:t!==n,r?t==null?u.add(e):E(e):t!==void 0&&u.has(e)?E(e):m.protectedKeys[e]=!0}m.prevProp=h,m.prevResolvedValues=C,m.isActive&&(d={...d,...C}),(r||i)&&e.blockInitialAnimation&&(b=!1);let D=v&&y;b&&(!D||x)&&l.push(...S.map(t=>{let n={type:p};if(typeof t==`string`&&(r||i)&&!D&&e.manuallyAnimateOnMount&&e.parent){let{parent:r}=e,i=lx(r,t);if(r.enteringChildren&&i){let{delayChildren:t}=i.transition||{};n.delay=Hb(r.enteringChildren,e,t)}}return{animation:t,options:n}}))}if(u.size){let t={};if(typeof s.initial!=`boolean`){let n=lx(e,Array.isArray(s.initial)?s.initial[0]:s.initial);n&&n.transition&&(t.transition=n.transition)}u.forEach(n=>{let r=e.getBaseTarget(n),i=e.getValue(n);i&&(i.liveStyle=!0),t[n]=r??null}),l.push({animation:t})}let p=!!l.length;return r&&(s.initial===!1||s.initial===s.animate)&&!e.manuallyAnimateOnMount&&(p=!1),r=!1,i=!1,p?t(l):Promise.resolve()}function c(t,r){if(n[t].isActive===r)return Promise.resolve();e.variantChildren?.forEach(e=>e.animationState?.setActive(t,r)),n[t].isActive=r;let i=s(t);for(let e in n)n[e].protectedKeys={};return i}return{animateChanges:s,setActive:c,setAnimateFunction:o,getState:()=>n,reset:()=>{n=rw(),i=!0}}}function tw(e,t){return typeof t==`string`?t!==e:Array.isArray(t)?!XC(t,e):!1}function nw(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function rw(){return{animate:nw(!0),whileInView:nw(),whileHover:nw(),whileTap:nw(),whileDrag:nw(),whileFocus:nw(),exit:nw()}}function iw(e,t){e.min=t.min,e.max=t.max}function aw(e,t){iw(e.x,t.x),iw(e.y,t.y)}function ow(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}var sw=.9999,cw=1.0001,lw=-.01,uw=.01;function dw(e){return e.max-e.min}function fw(e,t,n){return Math.abs(e-t)<=n}function pw(e,t,n,r=.5){e.origin=r,e.originPoint=$(t.min,t.max,e.origin),e.scale=dw(n)/dw(t),e.translate=$(n.min,n.max,e.origin)-e.originPoint,(e.scale>=sw&&e.scale<=cw||isNaN(e.scale))&&(e.scale=1),(e.translate>=lw&&e.translate<=uw||isNaN(e.translate))&&(e.translate=0)}function mw(e,t,n,r){pw(e.x,t.x,n.x,r?r.originX:void 0),pw(e.y,t.y,n.y,r?r.originY:void 0)}function hw(e,t,n,r=0){e.min=(r?$(n.min,n.max,r):n.min)+t.min,e.max=e.min+dw(t)}function gw(e,t,n,r){hw(e.x,t.x,n.x,r?.x),hw(e.y,t.y,n.y,r?.y)}function _w(e,t,n,r=0){let i=r?$(n.min,n.max,r):n.min;e.min=t.min-i,e.max=e.min+dw(t)}function vw(e,t,n,r){_w(e.x,t.x,n.x,r?.x),_w(e.y,t.y,n.y,r?.y)}function yw(e,t,n,r,i){return e-=t,e=fC(e,1/n,r),i!==void 0&&(e=fC(e,1/i,r)),e}function bw(e,t=0,n=1,r=.5,i,a=e,o=e){if(bv.test(t)&&(t=parseFloat(t),t=$(o.min,o.max,t/100)-o.min),typeof t!=`number`)return;let s=$(a.min,a.max,r);e===a&&(s-=t),e.min=yw(e.min,t,n,s,i),e.max=yw(e.max,t,n,s,i)}function xw(e,t,[n,r,i],a,o){bw(e,t[n],t[r],t[i],t.scale,a,o)}var Sw=[`x`,`scaleX`,`originX`],Cw=[`y`,`scaleY`,`originY`];function ww(e,t,n,r){xw(e.x,t,Sw,n?n.x:void 0,r?r.x:void 0),xw(e.y,t,Cw,n?n.y:void 0,r?r.y:void 0)}function Tw(e){return e.translate===0&&e.scale===1}function Ew(e){return Tw(e.x)&&Tw(e.y)}function Dw(e,t){return e.min===t.min&&e.max===t.max}function Ow(e,t){return Dw(e.x,t.x)&&Dw(e.y,t.y)}function kw(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function Aw(e,t){return kw(e.x,t.x)&&kw(e.y,t.y)}function jw(e){return dw(e.x)/dw(e.y)}function Mw(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function Nw(e){return[e(`x`),e(`y`)]}function Pw(e,t,n){let r=``,i=e.x.translate/t.x,a=e.y.translate/t.y,o=n?.z||0;if((i||a||o)&&(r=`translate3d(${i}px, ${a}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){let{transformPerspective:e,rotate:t,pathRotation:i,rotateX:a,rotateY:o,skewX:s,skewY:c}=n;e&&(r=`perspective(${e}px) ${r}`),t&&(r+=`rotate(${t}deg) `),i&&(r+=`rotate(${i}deg) `),a&&(r+=`rotateX(${a}deg) `),o&&(r+=`rotateY(${o}deg) `),s&&(r+=`skewX(${s}deg) `),c&&(r+=`skewY(${c}deg) `)}let s=e.x.scale*t.x,c=e.y.scale*t.y;return(s!==1||c!==1)&&(r+=`scale(${s}, ${c})`),r||`none`}var Fw=Gx.length,Iw=e=>typeof e==`string`?parseFloat(e):e,Lw=e=>typeof e==`number`||Q.test(e);function Rw(e,t,n,r,i,a){i?(e.opacity=$(0,n.opacity??1,Bw(r)),e.opacityExit=$(t.opacity??1,0,Vw(r))):a&&(e.opacity=$(t.opacity??1,n.opacity??1,r));for(let i=0;i<Fw;i++){let a=Gx[i],o=zw(t,a),s=zw(n,a);(o!==void 0||s!==void 0)&&(o||=0,s||=0,o===0||s===0||Lw(o)===Lw(s)?(e[a]=Math.max($(Iw(o),Iw(s),r),0),(bv.test(s)||bv.test(o))&&(e[a]+=`%`)):e[a]=s)}(t.rotate||n.rotate)&&(e.rotate=$(t.rotate||0,n.rotate||0,r))}function zw(e,t){return e[t]===void 0?e.borderRadius:e[t]}var Bw=Hw(0,.5,M_),Vw=Hw(.5,.95,p_);function Hw(e,t,n){return r=>r<e?0:r>t?1:n(h_(e,t,r))}function Uw(e,t,n){let r=hx(e)?e:qb(e);return r.start(rx(``,r,t,n)),r.animation}function Ww(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}var Gw=(e,t)=>e.depth-t.depth,Kw=class{constructor(){this.children=[],this.isDirty=!1}add(e){a_(this.children,e),this.isDirty=!0}remove(e){o_(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Gw),this.isDirty=!1,this.children.forEach(e)}};function qw(e,t){let n=Z_.now(),r=({timestamp:i})=>{let a=i-n;a>=t&&(K_(r),e(a-t))};return Z.setup(r,!0),()=>K_(r)}function Jw(e){return hx(e)?e.get():e}var Yw=class{constructor(){this.members=[]}add(e){a_(this.members,e);for(let t=this.members.length-1;t>=0;t--){let n=this.members[t];if(n===e||n===this.lead||n===this.prevLead)continue;let r=n.instance;(!r||r.isConnected===!1)&&!n.snapshot&&(o_(this.members,n),n.unmount())}e.scheduleRender()}remove(e){if(o_(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){for(let t=this.members.indexOf(e)-1;t>=0;t--){let e=this.members[t];if(e.isPresent!==!1&&e.instance?.isConnected!==!1)return this.promote(e),!0}return!1}promote(e,t){let n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.updateSnapshot(),e.scheduleRender();let{layoutDependency:r}=n.options,{layoutDependency:i}=e.options;(r===void 0||r!==i)&&(e.resumeFrom=n,t&&(n.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root?.isUpdating&&(e.isLayoutDirty=!0)),e.options.crossfade===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{e.options.onExitComplete?.(),e.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}},Xw={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Zw={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},Qw=[``,`X`,`Y`,`Z`],$w=1e3,eT=0;function tT(e,t,n,r){let{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function nT(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;let{visualElement:t}=e.options;if(!t)return;let n=bx(t);if(window.MotionHasOptimisedAnimation(n,`transform`)){let{layout:t,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,`transform`,Z,!(t||r))}let{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&nT(r)}function rT({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(e={},n=t?.()){this.id=eT++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,jS.value&&(Zw.nodes=Zw.calculatedTargetDeltas=Zw.calculatedProjections=0),this.nodes.forEach(oT),this.nodes.forEach(hT),this.nodes.forEach(gT),this.nodes.forEach(sT),jS.addProjectionMetrics&&jS.addProjectionMetrics(Zw)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let e=0;e<this.path.length;e++)this.path[e].shouldResetTransform=!0;this.root===this&&(this.nodes=new Kw)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new g_),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){let n=this.eventHandlers.get(e);n&&n.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t){if(this.instance)return;this.isSVG=gS(t)&&!MS(t),this.instance=t;let{layoutId:n,layout:r,visualElement:i}=this.options;if(i&&!i.current&&i.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(r||n)&&(this.isLayoutDirty=!0),e){let n,r=0,i=()=>this.root.updateBlockedByResize=!1;Z.read(()=>{r=window.innerWidth}),e(t,()=>{let e=window.innerWidth;e!==r&&(r=e,this.root.updateBlockedByResize=!0,n&&n(),n=qw(i,250),Xw.hasAnimatedSinceResize&&(Xw.hasAnimatedSinceResize=!1,this.nodes.forEach(mT)))})}n&&this.root.registerSharedNode(n,this),this.options.animate!==!1&&i&&(n||r)&&this.addEventListener(`didUpdate`,({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:n,layout:r})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let a=this.options.transition||i.getDefaultTransition()||CT,{onLayoutAnimationStart:o,onLayoutAnimationComplete:s}=i.getProps(),c=!this.targetLayout||!Aw(this.targetLayout,r),l=!t&&n;if(this.options.layoutRoot||this.resumeFrom||l||t&&(c||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let t={...Yb(a,`layout`),onPlay:o,onComplete:s};(i.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,l,t.path)}else t||mT(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),K_(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(_T),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&nT(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let e=0;e<this.path.length;e++){let t=this.path[e];t.shouldResetTransform=!0,(typeof t.latestValues.x==`string`||typeof t.latestValues.y==`string`)&&(t.isLayoutDirty=!0),t.updateScroll(`snapshot`),t.options.layoutRoot&&t.willUpdate(!1)}let{layoutId:t,layout:n}=this.options;if(t===void 0&&!n)return;let r=this.getTransformTemplate();this.prevTransformTemplateValue=r?r(this.latestValues,``):void 0,this.updateSnapshot(),e&&this.notifyListeners(`willUpdate`)}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){let e=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),e&&this.nodes.forEach(uT),this.nodes.forEach(lT);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(dT);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(fT),this.nodes.forEach(pT),this.nodes.forEach(iT),this.nodes.forEach(aT)):this.nodes.forEach(dT),this.clearAllSnapshots();let e=Z_.now();q_.delta=s_(0,1e3/60,e-q_.timestamp),q_.timestamp=e,q_.isProcessing=!0,J_.update.process(q_),J_.preRender.process(q_),J_.render.process(q_),q_.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Yx.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(cT),this.sharedNodes.forEach(vT)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Z.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Z.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!dw(this.snapshot.measuredBox.x)&&!dw(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e<this.path.length;e++)this.path[e].updateScroll();let e=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||=RS(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners(`measure`,this.layout.layoutBox);let{visualElement:t}=this.options;t&&t.notify(`LayoutMeasure`,this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e=`measure`){let t=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t&&this.instance){let t=r(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!i)return;let e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!Ew(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,``):void 0,a=r!==this.prevTransformTemplateValue;e&&this.instance&&(t||lC(this.latestValues)||a)&&(i(this.instance,r),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){let t=this.measurePageBox(),n=this.removeElementScroll(t);return e&&(n=this.removeTransform(n)),DT(n),{animationId:this.root.animationId,measuredBox:t,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return RS();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(kT))){let{scroll:e}=this.root;e&&(yC(t.x,e.offset.x),yC(t.y,e.offset.y))}return t}removeElementScroll(e){let t=RS();if(aw(t,e),this.scroll?.wasRoot)return t;for(let n=0;n<this.path.length;n++){let r=this.path[n],{scroll:i,options:a}=r;r!==this.root&&i&&a.layoutScroll&&(i.wasRoot&&aw(t,e),yC(t.x,i.offset.x),yC(t.y,i.offset.y))}return t}applyTransform(e,t=!1,n){let r=n||RS();aw(r,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];!t&&n.options.layoutScroll&&n.scroll&&n!==n.root&&(yC(r.x,-n.scroll.offset.x),yC(r.y,-n.scroll.offset.y)),lC(n.latestValues)&&SC(r,n.latestValues,n.layout?.layoutBox)}return lC(this.latestValues)&&SC(r,this.latestValues,this.layout?.layoutBox),r}removeTransform(e){let t=RS();aw(t,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];if(!lC(n.latestValues))continue;let r;n.instance&&(cC(n.latestValues)&&n.updateSnapshot(),r=RS(),aw(r,n.measurePageBox())),ww(t,n.latestValues,n.snapshot?.layoutBox,r)}return lC(this.latestValues)&&ww(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:e.crossfade===void 0||e.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==q_.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){let t=this.getLead();this.isProjectionDirty||=t.isProjectionDirty,this.isTransformDirty||=t.isTransformDirty,this.isSharedProjectionDirty||=t.isSharedProjectionDirty;let n=!!this.resumingFrom||this!==t;if(!(e||n&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:r,layoutId:i}=this.options;if(!this.layout||!(r||i))return;this.resolvedRelativeTargetAt=q_.timestamp;let a=this.getClosestProjectingParent();a&&this.linkedParentVersion!==a.layoutVersion&&!a.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&a&&a.layout?this.createRelativeTarget(a,this.layout.layoutBox,a.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=RS(),this.targetWithTransforms=RS()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),gw(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):aw(this.target,this.layout.layoutBox),hC(this.target,this.targetDelta)):aw(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&a&&!!a.resumingFrom==!!this.resumingFrom&&!a.options.layoutScroll&&a.target&&this.animationProgress!==1?this.createRelativeTarget(a,this.target,a.target):this.relativeParent=this.relativeTarget=void 0),jS.value&&Zw.calculatedTargetDeltas++)}getClosestProjectingParent(){if(!(!this.parent||cC(this.parent.latestValues)||uC(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(e,t,n){this.relativeParent=e,this.linkedParentVersion=e.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=RS(),this.relativeTargetOrigin=RS(),vw(this.relativeTargetOrigin,t,n,this.options.layoutAnchor||void 0),aw(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){let e=this.getLead(),t=!!this.resumingFrom||this!==e,n=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(n=!1),t&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(n=!1),this.resolvedRelativeTargetAt===q_.timestamp&&(n=!1),n)return;let{layout:r,layoutId:i}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(r||i))return;aw(this.layoutCorrected,this.layout.layoutBox);let a=this.treeScale.x,o=this.treeScale.y;vC(this.layoutCorrected,this.treeScale,this.path,t),e.layout&&!e.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(e.target=e.layout.layoutBox,e.targetWithTransforms=RS());let{target:s}=e;if(!s){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(ow(this.prevProjectionDelta.x,this.projectionDelta.x),ow(this.prevProjectionDelta.y,this.projectionDelta.y)),mw(this.projectionDelta,this.layoutCorrected,s,this.latestValues),(this.treeScale.x!==a||this.treeScale.y!==o||!Mw(this.projectionDelta.x,this.prevProjectionDelta.x)||!Mw(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners(`projectionUpdate`,s)),jS.value&&Zw.calculatedProjections++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){if(this.options.visualElement?.scheduleRender(),e){let e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=IS(),this.projectionDelta=IS(),this.projectionDeltaWithTransform=IS()}setAnimationOrigin(e,t=!1,n){let r=this.snapshot,i=r?r.latestValues:{},a={...this.latestValues},o=IS();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let s=RS(),c=(r?r.source:void 0)!==(this.layout?this.layout.source:void 0),l=this.getStack(),u=!l||l.members.length<=1,d=!!(c&&!u&&this.options.crossfade===!0&&!this.path.some(ST));this.animationProgress=0;let f,p=n?.interpolateProjection(e);this.mixTargetDelta=t=>{let n=t/1e3,r=p?.(n);r?(o.x.translate=r.x,o.x.scale=$(e.x.scale,1,n),o.x.origin=e.x.origin,o.x.originPoint=e.x.originPoint,o.y.translate=r.y,o.y.scale=$(e.y.scale,1,n),o.y.origin=e.y.origin,o.y.originPoint=e.y.originPoint):(yT(o.x,e.x,n),yT(o.y,e.y,n)),this.setTargetDelta(o),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(vw(s,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),xT(this.relativeTarget,this.relativeTargetOrigin,s,n),f&&Ow(this.relativeTarget,f)&&(this.isProjectionDirty=!1),f||=RS(),aw(f,this.relativeTarget)),c&&(this.animationValues=a,Rw(a,i,this.latestValues,n,d,u)),r&&r.rotate!==void 0&&(this.animationValues||=a,this.animationValues.pathRotation=r.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners(`animationStart`),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&=(K_(this.pendingAnimation),void 0),this.pendingAnimation=Z.update(()=>{Xw.hasAnimatedSinceResize=!0,this.motionValue||=qb(0),this.motionValue.jump(0,!1),this.currentAnimation=Uw(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onComplete:()=>{e.onComplete&&e.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners(`animationComplete`)}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta($w),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:t,target:n,layout:r,latestValues:i}=e;if(!(!t||!n||!r)){if(this!==e&&this.layout&&r&&OT(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||RS();let t=dw(this.layout.layoutBox.x);n.x.min=e.target.x.min,n.x.max=n.x.min+t;let r=dw(this.layout.layoutBox.y);n.y.min=e.target.y.min,n.y.max=n.y.min+r}aw(t,n),SC(t,i),mw(this.projectionDeltaWithTransform,this.layoutCorrected,t,i)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new Yw),this.sharedNodes.get(e).add(t);let n=t.options.initialPromotionConfig;t.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(t):void 0})}isLead(){let e=this.getStack();return!e||e.lead===this}getLead(){let{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:n}={}){let r=this.getStack();r&&r.promote(this,n),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){let e=this.getStack();return e?e.relegate(this):!1}resetSkewAndRotation(){let{visualElement:e}=this.options;if(!e)return;let t=!1,{latestValues:n}=e;if((n.z||n.rotate||n.rotateX||n.rotateY||n.rotateZ||n.skewX||n.skewY)&&(t=!0),!t)return;let r={};n.z&&tT(`z`,e,r,this.animationValues);for(let t=0;t<Qw.length;t++)tT(`rotate${Qw[t]}`,e,r,this.animationValues),tT(`skew${Qw[t]}`,e,r,this.animationValues);e.render();for(let t in r)e.setStaticValue(t,r[t]),this.animationValues&&(this.animationValues[t]=r[t]);e.scheduleRender()}applyProjectionStyles(e,t){if(!this.instance||this.isSVG)return;if(!this.isVisible){e.visibility=`hidden`;return}let n=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,e.visibility=``,e.opacity=``,e.pointerEvents=Jw(t?.pointerEvents)||``,e.transform=n?n(this.latestValues,``):`none`;return}let r=this.getLead();if(!this.projectionDelta||!this.layout||!r.target){this.options.layoutId&&(e.opacity=this.latestValues.opacity===void 0?1:this.latestValues.opacity,e.pointerEvents=Jw(t?.pointerEvents)||``),this.hasProjected&&!lC(this.latestValues)&&(e.transform=n?n({},``):`none`,this.hasProjected=!1);return}e.visibility=``;let i=r.animationValues||r.latestValues;this.applyTransformsToTarget();let a=Pw(this.projectionDeltaWithTransform,this.treeScale,i);n&&(a=n(i,a)),e.transform=a;let{x:o,y:s}=this.projectionDelta;e.transformOrigin=`${o.origin*100}% ${s.origin*100}% 0`,e.opacity=r.animationValues?r===this?i.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:i.opacityExit:r===this?i.opacity===void 0?``:i.opacity:i.opacityExit===void 0?0:i.opacityExit;for(let t in NC){if(i[t]===void 0)continue;let{correct:n,applyTo:o,isCSSVariable:s}=NC[t],c=a===`none`?i[t]:n(i[t],r);if(o){let t=o.length;for(let n=0;n<t;n++)e[o[n]]=c}else s?this.options.visualElement.renderState.vars[t]=c:e[t]=c}this.options.layoutId&&(e.pointerEvents=r===this?Jw(t?.pointerEvents)||``:`none`)}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(lT),this.root.sharedNodes.clear()}}}function iT(e){e.updateLayout()}function aT(e){let t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners(`didUpdate`)){let{layoutBox:n,measuredBox:r}=e.layout,{animationType:i}=e.options,a=t.source!==e.layout.source;if(i===`size`)Nw(e=>{let r=a?t.measuredBox[e]:t.layoutBox[e],i=dw(r);r.min=n[e].min,r.max=r.min+i});else if(i===`x`||i===`y`){let e=i===`x`?`y`:`x`;iw(a?t.measuredBox[e]:t.layoutBox[e],n[e])}else OT(i,t.layoutBox,n)&&Nw(r=>{let i=a?t.measuredBox[r]:t.layoutBox[r],o=dw(n[r]);i.max=i.min+o,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[r].max=e.relativeTarget[r].min+o)});let o=IS();mw(o,n,t.layoutBox);let s=IS();a?mw(s,e.applyTransform(r,!0),t.measuredBox):mw(s,n,t.layoutBox);let c=!Ew(o),l=!1;if(!e.resumeFrom){let r=e.getClosestProjectingParent();if(r&&!r.resumeFrom){let{snapshot:i,layout:a}=r;if(i&&a){let o=e.options.layoutAnchor||void 0,s=RS();vw(s,t.layoutBox,i.layoutBox,o);let c=RS();vw(c,n,a.layoutBox,o),Aw(s,c)||(l=!0),r.options.layoutRoot&&(e.relativeTarget=c,e.relativeTargetOrigin=s,e.relativeParent=r)}}}e.notifyListeners(`didUpdate`,{layout:n,snapshot:t,delta:s,layoutDelta:o,hasLayoutChanged:c,hasRelativeLayoutChanged:l})}else if(e.isLead()){let{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function oT(e){jS.value&&Zw.nodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty),e.isTransformDirty||=e.parent.isTransformDirty)}function sT(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function cT(e){e.clearSnapshot()}function lT(e){e.clearMeasurements()}function uT(e){e.isLayoutDirty=!0,e.updateLayout()}function dT(e){e.isLayoutDirty=!1}function fT(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function pT(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify(`BeforeLayoutMeasure`),e.resetTransform()}function mT(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function hT(e){e.resolveTargetDelta()}function gT(e){e.calcProjection()}function _T(e){e.resetSkewAndRotation()}function vT(e){e.removeLeadSnapshot()}function yT(e,t,n){e.translate=$(t.translate,0,n),e.scale=$(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function bT(e,t,n,r){e.min=$(t.min,n.min,r),e.max=$(t.max,n.max,r)}function xT(e,t,n,r){bT(e.x,t.x,n.x,r),bT(e.y,t.y,n.y,r)}function ST(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}var CT={duration:.45,ease:[.4,0,.1,1]},wT=e=>typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),TT=wT(`applewebkit/`)&&!wT(`chrome/`)?Math.round:p_;function ET(e){e.min=TT(e.min),e.max=TT(e.max)}function DT(e){ET(e.x),ET(e.y)}function OT(e,t,n){return e===`position`||e===`preserve-aspect`&&!fw(jw(t),jw(n),.2)}function kT(e){return e!==e.root&&e.scroll?.wasRoot}var AT=rT({attachResizeListener:(e,t)=>Ww(e,`resize`,t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),jT={current:void 0},MT=rT({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!jT.current){let e=new AT({});e.mount(window),e.setOptions({layoutScroll:!0}),jT.current=e}return jT.current},resetTransform:(e,t)=>{e.style.transform=t===void 0?`none`:t},checkIsScrollRoot:e=>window.getComputedStyle(e).position===`fixed`}),NT=(0,B.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function PT(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function FT(...e){return t=>{let n=!1,r=e.map(e=>{let r=PT(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():PT(e[t],null)}}}}function IT(...e){return B.useCallback(FT(...e),e)}var LT=class extends B.Component{getSnapshotBeforeUpdate(e){let t=this.props.childRef.current;if(Jx(t)&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){let e=t.offsetParent,n=Jx(e)&&e.offsetWidth||0,r=Jx(e)&&e.offsetHeight||0,i=getComputedStyle(t),a=this.props.sizeRef.current;a.height=parseFloat(i.height),a.width=parseFloat(i.width),a.top=t.offsetTop,a.left=t.offsetLeft,a.right=n-a.width-a.left,a.bottom=r-a.height-a.top,a.direction=i.direction}return null}componentDidUpdate(){}render(){return this.props.children}};function RT({children:e,isPresent:t,anchorX:n,anchorY:r,root:i,pop:a}){let o=(0,B.useId)(),s=(0,B.useRef)(null),c=(0,B.useRef)({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:`ltr`}),{nonce:l}=(0,B.useContext)(NT),u=IT(s,a===!1?void 0:e.props?.ref??e?.ref);return(0,B.useInsertionEffect)(()=>{let{width:e,height:u,top:d,left:f,right:p,bottom:m,direction:h}=c.current;if(t||a===!1||!s.current||!e||!u)return;let g=h===`rtl`,_=n===`left`?g?`right: ${p}`:`left: ${f}`:g?`left: ${f}`:`right: ${p}`,v=r===`bottom`?`bottom: ${m}`:`top: ${d}`;s.current.dataset.motionPopId=o;let y=document.createElement(`style`);l&&(y.nonce=l);let b=i??document.head;return b.appendChild(y),y.sheet&&y.sheet.insertRule(`
3
+ [data-motion-pop-id="${o}"] {
4
+ position: absolute !important;
5
+ width: ${e}px !important;
6
+ height: ${u}px !important;
7
+ ${_}px !important;
8
+ ${v}px !important;
9
+ }
10
+ `),()=>{s.current?.removeAttribute(`data-motion-pop-id`),b.contains(y)&&b.removeChild(y)}},[t]),(0,V.jsx)(LT,{isPresent:t,childRef:s,sizeRef:c,pop:a,children:a===!1?e:B.cloneElement(e,{ref:u})})}var zT=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:a,mode:o,anchorX:s,anchorY:c,root:l})=>{let u=n_(BT),d=(0,B.useId)(),f=(0,B.useRef)(n),p=(0,B.useRef)(r);r_(()=>{f.current=n,p.current=r});let m=!0,h=(0,B.useMemo)(()=>(m=!1,{id:d,initial:t,isPresent:n,custom:i,onExitComplete:e=>{u.set(e,!0);for(let e of u.values())if(!e)return;r&&r()},register:e=>(u.set(e,!1),()=>{u.delete(e),!f.current&&!u.size&&p.current?.()})}),[n,u,r]);return a&&m&&(h={...h}),(0,B.useMemo)(()=>{u.forEach((e,t)=>u.set(t,!1))},[n]),B.useEffect(()=>{!n&&!u.size&&r&&r()},[n]),e=(0,V.jsx)(RT,{pop:o===`popLayout`,isPresent:n,anchorX:s,anchorY:c,root:l,children:e}),(0,V.jsx)(i_.Provider,{value:h,children:e})};function BT(){return new Map}function VT(e=!0){let t=(0,B.useContext)(i_);if(t===null)return[!0,null];let{isPresent:n,onExitComplete:r,register:i}=t,a=(0,B.useId)();(0,B.useEffect)(()=>{if(e)return i(a)},[e]);let o=(0,B.useCallback)(()=>e&&r&&r(a),[a,r,e]);return!n&&r?[!1,o]:[!0]}var HT=e=>e.key||``;function UT(e){let t=[];return B.Children.forEach(e,e=>{(0,B.isValidElement)(e)&&t.push(e)}),t}var WT=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:i=!0,mode:a=`sync`,propagate:o=!1,anchorX:s=`left`,anchorY:c=`top`,root:l})=>{let[u,d]=VT(o),f=(0,B.useMemo)(()=>UT(e),[e]),p=o&&!u?[]:f.map(HT),m=(0,B.useRef)(!0),h=(0,B.useRef)(f),g=n_(()=>new Map),_=(0,B.useRef)(new Set),[v,y]=(0,B.useState)(f),[b,x]=(0,B.useState)(f);r_(()=>{m.current=!1,h.current=f;for(let e=0;e<b.length;e++){let t=HT(b[e]);p.includes(t)?(g.delete(t),_.current.delete(t)):g.get(t)!==!0&&g.set(t,!1)}},[b,p.length,p.join(`-`)]);let S=[];if(f!==v){let e=[...f];for(let t=0;t<b.length;t++){let n=b[t],r=HT(n);p.includes(r)||(e.splice(t,0,n),S.push(n))}return a===`wait`&&S.length&&(e=S),x(UT(e)),y(f),null}let{forceRender:C}=(0,B.useContext)(t_);return(0,V.jsx)(V.Fragment,{children:b.map(e=>{let v=HT(e),y=o&&!u?!1:f===b||p.includes(v);return(0,V.jsx)(zT,{isPresent:y,initial:!m.current||n?void 0:!1,custom:t,presenceAffectsLayout:i,mode:a,root:l,onExitComplete:y?void 0:()=>{if(_.current.has(v))return;if(g.has(v))_.current.add(v),g.set(v,!0);else return;let e=!0;g.forEach(t=>{t||(e=!1)}),e&&(C?.(),x(h.current),o&&d?.(),r&&r())},anchorX:s,anchorY:c,children:e},v)})})},GT=(0,B.createContext)({strict:!1}),KT={animation:[`animate`,`variants`,`whileHover`,`whileTap`,`exit`,`whileInView`,`whileFocus`,`whileDrag`],exit:[`exit`],drag:[`drag`,`dragControls`],focus:[`whileFocus`],hover:[`whileHover`,`onHoverStart`,`onHoverEnd`],tap:[`whileTap`,`onTap`,`onTapStart`,`onTapCancel`],pan:[`onPan`,`onPanStart`,`onPanSessionStart`,`onPanEnd`],inView:[`whileInView`,`onViewportEnter`,`onViewportLeave`],layout:[`layout`,`layoutId`]},qT=!1;function JT(){if(qT)return;let e={};for(let t in KT)e[t]={isEnabled:e=>KT[t].some(t=>!!e[t])};$S(e),qT=!0}function YT(){return JT(),eC()}function XT(e){let t=YT();for(let n in e)t[n]={...t[n],...e[n]};$S(t)}var ZT=new Set(`animate.exit.variants.initial.style.values.variants.transition.transformTemplate.custom.inherit.onBeforeLayoutMeasure.onAnimationStart.onAnimationComplete.onUpdate.onDragStart.onDrag.onDragEnd.onMeasureDragConstraints.onDirectionLock.onDragTransitionEnd._dragX._dragY.onHoverStart.onHoverEnd.onViewportEnter.onViewportLeave.globalTapTarget.propagate.ignoreStrict.viewport`.split(`.`));function QT(e){return e.startsWith(`while`)||e.startsWith(`drag`)&&e!==`draggable`||e.startsWith(`layout`)||e.startsWith(`onTap`)||e.startsWith(`onPan`)||e.startsWith(`onLayout`)||ZT.has(e)}var $T=r({default:()=>eE}),eE,tE=t((()=>{throw eE={},Error(`Could not resolve "@emotion/is-prop-valid" imported by "framer-motion". Is it installed?`)})),nE=e=>!QT(e);function rE(e){typeof e==`function`&&(nE=t=>t.startsWith(`on`)?!QT(t):e(t))}try{rE((tE(),e($T)).default)}catch{}function iE(e,t,n){let r={};for(let i in e)(i!==`values`||typeof e.values!=`object`)&&(hx(e[i])||(nE(i)||n===!0&&QT(i)||!t&&!QT(i)||e.draggable&&i.startsWith(`onDrag`))&&(r[i]=e[i]));return r}var aE=(0,B.createContext)({});function oE(e,t){if(WS(e)){let{initial:t,animate:n}=e;return{initial:t===!1||VS(t)?t:void 0,animate:VS(n)?n:void 0}}return e.inherit===!1?{}:t}function sE(e){let{initial:t,animate:n}=oE(e,(0,B.useContext)(aE));return(0,B.useMemo)(()=>({initial:t,animate:n}),[cE(t),cE(n)])}function cE(e){return Array.isArray(e)?e.join(` `):e}var lE=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function uE(e,t,n){for(let r in t)!hx(t[r])&&!PC(r,n)&&(e[r]=t[r])}function dE({transformTemplate:e},t){return(0,B.useMemo)(()=>{let n=lE();return OC(n,t,e),Object.assign({},n.vars,n.style)},[t])}function fE(e,t){let n=e.style||{},r={};return uE(r,n,e),Object.assign(r,dE(e,t)),r}function pE(e,t){let n={},r=fE(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout=`none`,r.touchAction=e.drag===!0?`none`:`pan-${e.drag===`x`?`y`:`x`}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}var mE=()=>({...lE(),attrs:{}});function hE(e,t,n,r){let i=(0,B.useMemo)(()=>{let n=mE();return HC(n,t,WC(r),e.transformTemplate,e.style),{...n.attrs,style:{...n.style}}},[t]);if(e.style){let t={};uE(t,e.style,e),i.style={...t,...i.style}}return i}var gE=[`animate`,`circle`,`defs`,`desc`,`ellipse`,`g`,`image`,`line`,`filter`,`marker`,`mask`,`metadata`,`path`,`pattern`,`polygon`,`polyline`,`rect`,`stop`,`switch`,`symbol`,`svg`,`text`,`tspan`,`use`,`view`];function _E(e){return typeof e!=`string`||e.includes(`-`)?!1:!!(gE.indexOf(e)>-1||/[A-Z]/u.test(e))}function vE(e,t,n,{latestValues:r},i,a=!1,o){let s=(o??_E(e)?hE:pE)(t,r,i,e),c=iE(t,typeof e==`string`,a),l=e===B.Fragment?{}:{...c,...s,ref:n},{children:u}=t,d=(0,B.useMemo)(()=>hx(u)?u.get():u,[u]);return(0,B.createElement)(e,{...l,children:d})}function yE({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,i){return{latestValues:bE(n,r,i,e),renderState:t()}}function bE(e,t,n,r){let i={},a=r(e,{});for(let e in a)i[e]=Jw(a[e]);let{initial:o,animate:s}=e,c=WS(e),l=GS(e);t&&l&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),s===void 0&&(s=t.animate));let u=n?n.initial===!1:!1;u||=o===!1;let d=u?s:o;if(d&&typeof d!=`boolean`&&!BS(d)){let t=Array.isArray(d)?d:[d];for(let n=0;n<t.length;n++){let r=cx(e,t[n]);if(r){let{transitionEnd:e,transition:t,...n}=r;for(let e in n){let t=n[e];if(Array.isArray(t)){let e=u?t.length-1:0;t=t[e]}t!==null&&(i[e]=t)}for(let t in e)i[t]=e[t]}}}return i}var xE=e=>(t,n)=>{let r=(0,B.useContext)(aE),i=(0,B.useContext)(i_),a=()=>yE(e,t,r,i);return n?a():n_(a)},SE=xE({scrapeMotionValuesFromProps:FC,createRenderState:lE}),CE=xE({scrapeMotionValuesFromProps:KC,createRenderState:mE}),wE=Symbol.for(`motionComponentSymbol`);function TE(e,t,n){let r=(0,B.useRef)(n);(0,B.useInsertionEffect)(()=>{r.current=n});let i=(0,B.useRef)(null);return(0,B.useCallback)(n=>{n&&e.onMount?.(n),t&&(n?t.mount(n):t.unmount());let a=r.current;if(typeof a==`function`)if(n){let e=a(n);typeof e==`function`&&(i.current=e)}else i.current?(i.current(),i.current=null):a(n);else a&&(a.current=n)},[t])}var EE=(0,B.createContext)({});function DE(e){return e&&typeof e==`object`&&Object.prototype.hasOwnProperty.call(e,`current`)}function OE(e,t,n,r,i,a){let{visualElement:o}=(0,B.useContext)(aE),s=(0,B.useContext)(GT),c=(0,B.useContext)(i_),l=(0,B.useContext)(NT),u=l.reducedMotion,d=l.skipAnimations,f=(0,B.useRef)(null),p=(0,B.useRef)(!1);r||=s.renderer,!f.current&&r&&(f.current=r(e,{visualState:t,parent:o,props:n,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:u,skipAnimations:d,isSVG:a}),p.current&&f.current&&(f.current.manuallyAnimateOnMount=!0));let m=f.current,h=(0,B.useContext)(EE);m&&!m.projection&&i&&(m.type===`html`||m.type===`svg`)&&kE(f.current,n,i,h);let g=(0,B.useRef)(!1);(0,B.useInsertionEffect)(()=>{m&&g.current&&m.update(n,c)});let _=n[yx],v=(0,B.useRef)(!!_&&typeof window<`u`&&!window.MotionHandoffIsComplete?.(_)&&window.MotionHasOptimisedAnimation?.(_));return r_(()=>{p.current=!0,m&&(g.current=!0,window.MotionIsMounted=!0,m.updateFeatures(),m.scheduleRenderMicrotask(),v.current&&m.animationState&&m.animationState.animateChanges())}),(0,B.useEffect)(()=>{m&&(!v.current&&m.animationState&&m.animationState.animateChanges(),v.current&&=(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(_)}),!1),m.enteringChildren=void 0)}),m}function kE(e,t,n,r){let{layoutId:i,layout:a,drag:o,dragConstraints:s,layoutScroll:c,layoutRoot:l,layoutAnchor:u,layoutCrossfade:d}=t;e.projection=new n(e.latestValues,t[`data-framer-portal-id`]?void 0:AE(e.parent)),e.projection.setOptions({layoutId:i,layout:a,alwaysMeasureLayout:!!o||s&&DE(s),visualElement:e,animationType:typeof a==`string`?a:`both`,initialPromotionConfig:r,crossfade:d,layoutScroll:c,layoutRoot:l,layoutAnchor:u})}function AE(e){if(e)return e.options.allowProjection===!1?AE(e.parent):e.projection}function jE(e,{forwardMotionProps:t=!1,type:n}={},r,i){r&&XT(r);let a=n?n===`svg`:_E(e),o=a?CE:SE;function s(n,s){let c,l={...(0,B.useContext)(NT),...n,layoutId:ME(n)},{isStatic:u}=l,d=sE(n),f=o(n,u);if(!u&&typeof window<`u`){NE(l,r);let t=PE(l);c=t.MeasureLayout,d.visualElement=OE(e,f,l,i,t.ProjectionNode,a)}return(0,V.jsxs)(aE.Provider,{value:d,children:[c&&d.visualElement?(0,V.jsx)(c,{visualElement:d.visualElement,...l}):null,vE(e,n,TE(f,d.visualElement,s),f,u,t,a)]})}s.displayName=`motion.${typeof e==`string`?e:`create(${e.displayName??e.name??``})`}`;let c=(0,B.forwardRef)(s);return c[wE]=e,c}function ME({layoutId:e}){let t=(0,B.useContext)(t_).id;return t&&e!==void 0?t+`-`+e:e}function NE(e,t){(0,B.useContext)(GT).strict}function PE(e){let{drag:t,layout:n}=YT();if(!t&&!n)return{};let r={...t,...n};return{MeasureLayout:t?.isEnabled(e)||n?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function FE(e,t){if(typeof Proxy>`u`)return jE;let n=new Map,r=(n,r)=>jE(n,r,e,t);return new Proxy((e,t)=>r(e,t),{get:(i,a)=>a===`create`?r:(n.has(a)||n.set(a,jE(a,void 0,e,t)),n.get(a))})}var IE=(e,t)=>t.isSVG??_E(e)?new qC(t):new LC(t,{allowProjection:e!==B.Fragment}),LE=class extends rC{constructor(e){super(e),e.animationState||=ew(e)}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();BS(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}},RE=0,zE={animation:{Feature:LE},exit:{Feature:class extends rC{constructor(){super(...arguments),this.id=RE++,this.isExitComplete=!1}update(){if(!this.node.presenceContext)return;let{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;if(e&&n===!1){if(this.isExitComplete){let{initial:e,custom:t}=this.node.getProps();if(typeof e==`string`||typeof e==`object`&&e&&!Array.isArray(e)){let n=lx(this.node,e,t);if(n){let{transition:e,transitionEnd:t,...r}=n;for(let e in r)this.node.getValue(e)?.jump(r[e])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive(`exit`,!1);this.isExitComplete=!1;return}let r=this.node.animationState.setActive(`exit`,!e);t&&!e&&r.then(()=>{this.isExitComplete=!0,t(this.id)})}mount(){let{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}}};function BE(e){return{point:{x:e.pageX,y:e.pageY}}}var VE=e=>t=>iS(t)&&e(t,BE(t));function HE(e,t,n,r){return Ww(e,t,VE(n),r)}var UE=({current:e})=>e?e.ownerDocument.defaultView:null,WE=(e,t)=>Math.abs(e-t);function GE(e,t){let n=WE(e.x,t.x),r=WE(e.y,t.y);return Math.sqrt(n**2+r**2)}var KE=new Set([`auto`,`scroll`]),qE=class{constructor(e,t,{transformPagePoint:n,contextWindow:r=window,dragSnapToOrigin:i=!1,distanceThreshold:a=3,element:o}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=JE(this.lastRawMoveEventInfo,this.transformPagePoint));let e=XE(this.lastMoveEventInfo,this.history),t=this.startEvent!==null,n=GE(e.offset,{x:0,y:0})>=this.distanceThreshold;if(!t&&!n)return;let{point:r}=e,{timestamp:i}=q_;this.history.push({...r,timestamp:i});let{onStart:a,onMove:o}=this.handlers;t||(a&&a(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),o&&o(this.lastMoveEvent,e)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastRawMoveEventInfo=t,this.lastMoveEventInfo=JE(t,this.transformPagePoint),Z.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();let{onEnd:n,onSessionEnd:r,resumeAnimation:i}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&i&&i(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let a=XE(e.type===`pointercancel`?this.lastMoveEventInfo:JE(t,this.transformPagePoint),this.history);this.startEvent&&n&&n(e,a),r&&r(e,a)},!iS(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=n,this.distanceThreshold=a,this.contextWindow=r||window;let s=JE(BE(e),this.transformPagePoint),{point:c}=s,{timestamp:l}=q_;this.history=[{...c,timestamp:l}];let{onSessionStart:u}=t;u&&u(e,XE(s,this.history));let d={passive:!0,capture:!0};this.removeListeners=m_(HE(this.contextWindow,`pointermove`,this.handlePointerMove,d),HE(this.contextWindow,`pointerup`,this.handlePointerUp,d),HE(this.contextWindow,`pointercancel`,this.handlePointerUp,d)),o&&this.startScrollTracking(o)}startScrollTracking(e){let t=e.parentElement;for(;t;){let e=getComputedStyle(t);(KE.has(e.overflowX)||KE.has(e.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener(`scroll`,this.onElementScroll,{capture:!0}),window.addEventListener(`scroll`,this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener(`scroll`,this.onElementScroll,{capture:!0}),window.removeEventListener(`scroll`,this.onWindowScroll)}}handleScroll(e){let t=this.scrollPositions.get(e);if(!t)return;let n=e===window,r=n?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},i={x:r.x-t.x,y:r.y-t.y};(i.x!==0||i.y!==0)&&(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(e,r),Z.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),K_(this.updatePoint)}};function JE(e,t){return t?{point:t(e.point)}:e}function YE(e,t){return{x:e.x-t.x,y:e.y-t.y}}function XE({point:e},t){return{point:e,delta:YE(e,QE(t)),offset:YE(e,ZE(t)),velocity:$E(t,.1)}}function ZE(e){return e[0]}function QE(e){return e[e.length-1]}function $E(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null,i=QE(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>__(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&i.timestamp-r.timestamp>__(t)*2&&(r=e[1]);let a=v_(i.timestamp-r.timestamp);if(a===0)return{x:0,y:0};let o={x:(i.x-r.x)/a,y:(i.y-r.y)/a};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function eD(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?$(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?$(n,e,r.max):Math.min(e,n)),e}function tD(e,t,n){return{min:t===void 0?void 0:e.min+t,max:n===void 0?void 0:e.max+n-(e.max-e.min)}}function nD(e,{top:t,left:n,bottom:r,right:i}){return{x:tD(e.x,n,i),y:tD(e.y,t,r)}}function rD(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function iD(e,t){return{x:rD(e.x,t.x),y:rD(e.y,t.y)}}function aD(e,t){let n=.5,r=dw(e),i=dw(t);return i>r?n=h_(t.min,t.max-r,e.min):r>i&&(n=h_(e.min,e.max-i,t.min)),s_(0,1,n)}function oD(e,t){let n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}var sD=.35;function cD(e=sD){return e===!1?e=0:e===!0&&(e=sD),{x:lD(e,`left`,`right`),y:lD(e,`top`,`bottom`)}}function lD(e,t,n){return{min:uD(e,t),max:uD(e,n)}}function uD(e,t){return typeof e==`number`?e:e[t]||0}var dD=new WeakMap,fD=class{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=RS(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:n}={}){let{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;let i=e=>{t&&this.snapToCursor(BE(e).point),this.stopAnimation()},a=(e,t)=>{let{drag:n,dragPropagation:r,onDragStart:i}=this.getProps();if(n&&!r&&(this.openDragLock&&this.openDragLock(),this.openDragLock=$x(n),!this.openDragLock))return;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Nw(e=>{let t=this.getAxisMotionValue(e).get()||0;if(bv.test(t)){let{projection:n}=this.visualElement;if(n&&n.layout){let r=n.layout.layoutBox[e];r&&(t=dw(r)*(parseFloat(t)/100))}}this.originPoint[e]=t}),i&&Z.update(()=>i(e,t),!1,!0),_x(this.visualElement,`transform`);let{animationState:a}=this.visualElement;a&&a.setActive(`whileDrag`,!0)},o=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;let{dragPropagation:n,dragDirectionLock:r,onDirectionLock:i,onDrag:a}=this.getProps();if(!n&&!this.openDragLock)return;let{offset:o}=t;if(r&&this.currentDirection===null){this.currentDirection=gD(o),this.currentDirection!==null&&i&&i(this.currentDirection);return}this.updateAxis(`x`,t.point,o),this.updateAxis(`y`,t.point,o),this.visualElement.render(),a&&Z.update(()=>a(e,t),!1,!0)},s=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},c=()=>{let{dragSnapToOrigin:e}=this.getProps();(e||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:l}=this.getProps();this.panSession=new qE(e,{onSessionStart:i,onStart:a,onMove:o,onSessionEnd:s,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,distanceThreshold:n,contextWindow:UE(this.visualElement),element:this.visualElement.current})}stop(e,t){let n=e||this.latestPointerEvent,r=t||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!r||!n)return;let{velocity:a}=r;this.startAnimation(a);let{onDragEnd:o}=this.getProps();o&&Z.postRender(()=>o(n,r))}cancel(){this.isDragging=!1;let{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();let{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive(`whileDrag`,!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,n){let{drag:r}=this.getProps();if(!n||!hD(e,r,this.currentDirection))return;let i=this.getAxisMotionValue(e),a=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(a=eD(a,this.constraints[e],this.elastic[e])),i.set(a)}resolveConstraints(){let{dragConstraints:e,dragElastic:t}=this.getProps(),n=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,r=this.constraints;e&&DE(e)?this.constraints||=this.resolveRefConstraints():this.constraints=e&&n?nD(n.layoutBox,e):!1,this.elastic=cD(t),r!==this.constraints&&!DE(e)&&n&&this.constraints&&!this.hasMutatedConstraints&&Nw(e=>{this.constraints!==!1&&this.getAxisMotionValue(e)&&(this.constraints[e]=oD(n.layoutBox[e],this.constraints[e]))})}resolveRefConstraints(){let{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!DE(e))return!1;let n=e.current,{projection:r}=this.visualElement;if(!r||!r.layout)return!1;r.root&&(r.root.scroll=void 0,r.root.updateScroll());let i=wC(n,r.root,this.visualElement.getTransformPagePoint()),a=iD(r.layout.layoutBox,i);if(t){let e=t(aC(a));this.hasMutatedConstraints=!!e,e&&(a=iC(e))}return a}startAnimation(e){let{drag:t,dragMomentum:n,dragElastic:r,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:o}=this.getProps(),s=this.constraints||{},c=Nw(o=>{if(!hD(o,t,this.currentDirection))return;let c=s&&s[o]||{};(a===!0||a===o)&&(c={min:0,max:0});let l=r?200:1e6,u=r?40:1e7,d={type:`inertia`,velocity:n?e[o]:0,bounceStiffness:l,bounceDamping:u,timeConstant:750,restDelta:1,restSpeed:10,...i,...c};return this.startAxisValueAnimation(o,d)});return Promise.all(c).then(o)}startAxisValueAnimation(e,t){let n=this.getAxisMotionValue(e);return _x(this.visualElement,e),n.start(rx(e,n,0,t,this.visualElement,!1))}stopAnimation(){Nw(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){let t=`_drag${e.toUpperCase()}`;return this.visualElement.getProps()[t]||this.visualElement.getValue(e,this.visualElement.latestValues[e]??0)}snapToCursor(e){Nw(t=>{let{drag:n}=this.getProps();if(!hD(t,n,this.currentDirection))return;let{projection:r}=this.visualElement,i=this.getAxisMotionValue(t);if(r&&r.layout){let{min:n,max:a}=r.layout.layoutBox[t],o=i.get()||0;i.set(e[t]-$(n,a,.5)+o)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!DE(t)||!n||!this.constraints)return;this.stopAnimation();let r={x:0,y:0};Nw(e=>{let t=this.getAxisMotionValue(e);if(t&&this.constraints!==!1){let n=t.get();r[e]=aD({min:n,max:n},this.constraints[e])}});let{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},``):`none`,n.root&&n.root.updateScroll(),n.updateLayout(),this.constraints=!1,this.resolveConstraints(),Nw(t=>{if(!hD(t,e,null))return;let n=this.getAxisMotionValue(t),{min:i,max:a}=this.constraints[t];n.set($(i,a,r[t]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;dD.set(this.visualElement,this);let e=this.visualElement.current,t=HE(e,`pointerdown`,t=>{let{drag:n,dragListener:r=!0}=this.getProps(),i=t.target,a=i!==e&&cS(i);n&&r&&!a&&this.start(t)}),n,r=()=>{let{dragConstraints:t}=this.getProps();DE(t)&&t.current&&(this.constraints=this.resolveRefConstraints(),n||=mD(e,t.current,()=>this.scalePositionWithinConstraints()))},{projection:i}=this.visualElement,a=i.addEventListener(`measure`,r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),Z.read(r);let o=Ww(window,`resize`,()=>this.scalePositionWithinConstraints()),s=i.addEventListener(`didUpdate`,(({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(Nw(t=>{let n=this.getAxisMotionValue(t);n&&(this.originPoint[t]+=e[t].translate,n.set(n.get()+e[t].translate))}),this.visualElement.render())}));return()=>{o(),t(),a(),s&&s(),n&&n()}}getProps(){let e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:n=!1,dragPropagation:r=!1,dragConstraints:i=!1,dragElastic:a=sD,dragMomentum:o=!0}=e;return{...e,drag:t,dragDirectionLock:n,dragPropagation:r,dragConstraints:i,dragElastic:a,dragMomentum:o}}};function pD(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function mD(e,t,n){let r=AS(e,pD(n)),i=AS(t,pD(n));return()=>{r(),i()}}function hD(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function gD(e,t=10){let n=null;return Math.abs(e.y)>t?n=`y`:Math.abs(e.x)>t&&(n=`x`),n}var _D=class extends rC{constructor(e){super(e),this.removeGroupControls=p_,this.removeListeners=p_,this.controls=new fD(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||p_}update(){let{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},vD=e=>(t,n)=>{e&&Z.update(()=>e(t,n),!1,!0)},yD=class extends rC{constructor(){super(...arguments),this.removePointerDownListener=p_}onPointerDown(e){this.session=new qE(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:UE(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:vD(e),onStart:vD(t),onMove:vD(n),onEnd:(e,t)=>{delete this.session,r&&Z.postRender(()=>r(e,t))}}}mount(){this.removePointerDownListener=HE(this.node.current,`pointerdown`,e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}},bD=!1,xD=class extends B.Component{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n,layoutId:r}=this.props,{projection:i}=e;i&&(t.group&&t.group.add(i),n&&n.register&&r&&n.register(i),bD&&i.root.didUpdate(),i.addEventListener(`animationComplete`,()=>{this.safeToRemove()}),i.setOptions({...i.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Xw.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:t,visualElement:n,drag:r,isPresent:i}=this.props,{projection:a}=n;return a?(a.isPresent=i,e.layoutDependency!==t&&a.setOptions({...a.options,layoutDependency:t}),bD=!0,r||e.layoutDependency!==t||t===void 0||e.isPresent!==i?a.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?a.promote():a.relegate()||Z.postRender(()=>{let e=a.getStack();(!e||!e.members.length)&&this.safeToRemove()})),null):null}componentDidUpdate(){let{visualElement:e,layoutAnchor:t}=this.props,{projection:n}=e;n&&(n.options.layoutAnchor=t,n.root.didUpdate(),Yx.postRender(()=>{!n.currentAnimation&&n.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:r}=e;bD=!0,r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),n&&n.deregister&&n.deregister(r))}safeToRemove(){let{safeToRemove:e}=this.props;e&&e()}render(){return null}};function SD(e){let[t,n]=VT(),r=(0,B.useContext)(t_);return(0,V.jsx)(xD,{...e,layoutGroup:r,switchLayoutGroup:(0,B.useContext)(EE),isPresent:t,safeToRemove:n})}var CD={pan:{Feature:yD},drag:{Feature:_D,ProjectionNode:MT,MeasureLayout:SD}};function wD(e,t,n){let{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive(`whileHover`,n===`Start`);let i=r[`onHover`+n];i&&Z.postRender(()=>i(t,BE(t)))}var TD=class extends rC{mount(){let{current:e}=this.node;e&&(this.unmount=nS(e,(e,t)=>(wD(this.node,t,`Start`),e=>wD(this.node,e,`End`))))}unmount(){}},ED=class extends rC{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(`:focus-visible`)}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!1),this.isActive=!1)}mount(){this.unmount=m_(Ww(this.node.current,`focus`,()=>this.onFocus()),Ww(this.node.current,`blur`,()=>this.onBlur()))}unmount(){}};function DD(e,t,n){let{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive(`whileTap`,n===`Start`);let i=r[`onTap`+(n===`End`?``:n)];i&&Z.postRender(()=>i(t,BE(t)))}var OD=class extends rC{mount(){let{current:e}=this.node;if(!e)return;let{globalTapTarget:t,propagate:n}=this.node.props;this.unmount=hS(e,(e,t)=>(DD(this.node,t,`Start`),(e,{success:t})=>DD(this.node,e,t?`End`:`Cancel`)),{useGlobalTarget:t,stopPropagation:n?.tap===!1})}unmount(){}},kD=new WeakMap,AD=new WeakMap,jD=e=>{let t=kD.get(e.target);t&&t(e)},MD=e=>{e.forEach(jD)};function ND({root:e,...t}){let n=e||document;AD.has(n)||AD.set(n,{});let r=AD.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(MD,{root:e,...t})),r[i]}function PD(e,t,n){let r=ND(t);return kD.set(e,n),r.observe(e),()=>{kD.delete(e),r.unobserve(e)}}var FD={some:0,all:1},ID=class extends rC{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();let{viewport:e={}}=this.node.getProps(),{root:t,margin:n,amount:r=`some`,once:i}=e,a={root:t?t.current:void 0,rootMargin:n,threshold:typeof r==`number`?r:FD[r]},o=e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,i&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive(`whileInView`,t);let{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),a=t?n:r;a&&a(e)};this.stopObserver=PD(this.node.current,a,o)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>`u`)return;let{props:e,prevProps:t}=this.node;[`amount`,`margin`,`root`].some(LD(e,t))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}};function LD({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}var RD={inView:{Feature:ID},tap:{Feature:OD},focus:{Feature:ED},hover:{Feature:TD}},zD={layout:{ProjectionNode:MT,MeasureLayout:SD}},BD=FE({...zE,...RD,...CD,...zD},IE),VD={type:`tween`,ease:[.22,1,.36,1],duration:.5};function HD({percentage:e}){let t=2.5,n=21.5/2,r=2*Math.PI*n,i=r-e/100*r;return(0,V.jsxs)(`svg`,{width:24,height:24,className:`-rotate-90 shrink-0`,children:[(0,V.jsx)(`circle`,{cx:24/2,cy:24/2,r:n,fill:`none`,stroke:`var(--muted)`,strokeWidth:t}),(0,V.jsx)(BD.circle,{cx:24/2,cy:24/2,r:n,fill:`none`,stroke:`var(--foreground)`,strokeWidth:t,strokeDasharray:r,initial:{strokeDashoffset:r},animate:{strokeDashoffset:i},transition:{duration:.15,ease:`easeOut`},strokeLinecap:`round`})]})}function UD({headings:e,onNavigate:t,editorRef:n}){let[r,i]=(0,B.useState)(null),[a,o]=(0,B.useState)(null),[s,c]=(0,B.useState)(!1),[l,u]=(0,B.useState)(0),[d,f]=(0,B.useState)(44),p=(0,B.useRef)(null);(0,B.useEffect)(()=>{let e=()=>{let e=document.querySelector(`.toolbar`);e&&f(e.getBoundingClientRect().bottom+6)};e();let t=document.querySelector(`.toolbar`);if(!t)return;let n=new ResizeObserver(e);return n.observe(t),()=>n.disconnect()},[]);let m=(0,B.useMemo)(()=>e.length===0?1:Math.min(...e.map(([,,e])=>parseInt(e[1],10))),[e]);if((0,B.useEffect)(()=>{(()=>{if(!n?.current)return;let t=e[0]?.[0];if(!t)return;let r=n.current.getElementByKey(t);if(!r)return;let i=r.parentElement;for(;i;){let e=window.getComputedStyle(i);if(e.overflowY===`auto`||e.overflowY===`scroll`){p.current=i;return}i=i.parentElement}p.current=null})()},[e,n]),(0,B.useEffect)(()=>{if(e.length===0)return;let t=e=>n?.current?.getElementByKey(e)??null,r=()=>{let n=p.current,r=n?n.scrollTop:window.scrollY,a=n?n.clientHeight:window.innerHeight,o=(n?n.scrollHeight:document.documentElement.scrollHeight)-a;u(o>0?Math.min(100,Math.max(0,r/o*100)):0);let s=a*.3,c=null;for(let[r]of e){let e=t(r);if(!e)continue;let i=e.getBoundingClientRect(),a=n?n.getBoundingClientRect().top:0;if(i.top-a<=s)c=r;else break}!c&&e.length>0&&(c=e[0][0]),i(c)},a=p.current??window;return a.addEventListener(`scroll`,r,{passive:!0}),r(),()=>a.removeEventListener(`scroll`,r)},[e,n]),e.length===0)return null;let h=e.find(([e])=>e===r)?.[1]??`Contents`;return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(WT,{children:s&&(0,V.jsx)(BD.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:VD,className:`fixed inset-0 z-[9998] bg-black/20 backdrop-blur-[4px]`,onClick:()=>c(!1)})}),(0,V.jsx)(BD.div,{initial:{y:-50,opacity:0},animate:{y:0,opacity:1},transition:{type:`spring`,stiffness:300,damping:25},style:{top:d},className:`fixed left-1/2 z-[9999] flex -translate-x-1/2 flex-col items-center`,children:(0,V.jsxs)(BD.div,{onClick:()=>{s||c(!0)},initial:!1,animate:{width:s?340:280,height:s?400:52,borderRadius:s?24:26},transition:VD,style:{cursor:s?`default`:`pointer`},className:`relative overflow-hidden border border-foreground/10 bg-background text-foreground shadow-2xl`,children:[(0,V.jsxs)(BD.div,{initial:!1,animate:{opacity:+!s,scale:s?.95:1,filter:s?`blur(4px)`:`blur(0px)`},transition:{...VD,delay:s?0:.1},className:H(`absolute inset-0 flex items-center gap-4 px-4 sm:px-5`,s&&`pointer-events-none`),children:[(0,V.jsx)(`div`,{className:`h-2 w-2 shrink-0 rounded-full bg-foreground`}),(0,V.jsx)(`div`,{className:`relative flex h-full flex-1 items-center overflow-hidden text-left`,children:(0,V.jsx)(WT,{mode:`popLayout`,initial:!1,children:(0,V.jsx)(BD.span,{initial:{opacity:0,y:15},animate:{opacity:1,y:0},exit:{opacity:0,y:-15},transition:{duration:.35,ease:[.16,1,.3,1]},className:`block w-full overflow-hidden text-ellipsis whitespace-nowrap text-sm font-medium text-foreground`,children:h},r??`empty`)})}),(0,V.jsx)(HD,{percentage:l})]}),(0,V.jsxs)(BD.div,{initial:!1,animate:{opacity:+!!s,scale:s?1:1.05},transition:{...VD,delay:s?.1:0},className:H(`absolute inset-0 flex flex-col`,!s&&`pointer-events-none`),children:[(0,V.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between px-6 pb-3 pt-5`,children:[(0,V.jsx)(`span`,{className:`text-[11px] font-semibold tracking-[0.08em] text-muted-foreground`,children:`TABLE OF CONTENTS`}),(0,V.jsx)(`button`,{onClick:e=>{e.stopPropagation(),c(!1)},className:`text-muted-foreground transition-colors hover:text-foreground`,children:(0,V.jsx)(Le,{className:`h-5 w-5`})})]}),(0,V.jsx)(`div`,{className:`flex-1 overflow-y-auto px-3 pb-4`,children:(0,V.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:e.map(([e,n,i])=>{let s=parseInt(i[1],10),l=r===e,u=a===e,d=Math.max(0,s-m)*14+12;return(0,V.jsxs)(`button`,{onMouseEnter:()=>o(e),onMouseLeave:()=>o(null),onClick:n=>{n.stopPropagation(),t(e),c(!1)},style:{paddingLeft:`${d}px`},className:H(`group flex w-full shrink-0 cursor-pointer items-center rounded-lg border-none py-2 pr-3 text-left text-sm transition-all duration-300 ease-out`,l&&`bg-foreground/10 font-medium text-foreground`,!l&&u&&`bg-foreground/5 text-foreground/85`,!l&&!u&&`bg-transparent text-foreground/45`),children:[(0,V.jsx)(`span`,{className:`flex-1 overflow-hidden text-ellipsis whitespace-nowrap transition-transform duration-300 group-hover:translate-x-1`,children:n}),(0,V.jsx)(BD.div,{initial:!1,animate:{scale:+!!l,opacity:+!!l},transition:{duration:.3,ease:`easeOut`},className:`ml-3 h-1.5 w-1.5 shrink-0 rounded-full bg-foreground`})]},e)})})})]})]})})]})}var WD=()=>{let{theme:e,setTheme:t}=Fe(),n=e_(),[r,i]=(0,B.useState)(void 0),[a,o]=np({key:`reason-docs-sidebar`,storage:rp}),s=()=>{t(e===`dark`?`light`:`dark`)},c={documents:n.documents,activeId:n.activeDocId,activeDocument:n.activeDocument,onSelect:n.handleSelectDocument,onAdd:n.handleAddDocument,onDelete:n.handleDeleteDocument,onDuplicate:n.handleDuplicateDocument,onToggleExpand:n.handleToggleExpand,onMove:n.handleMoveDocument,onManageTags:n.handleManageTags,onRename:(e,t)=>n.handleUpdateDocument(e,{title:t}),searchQuery:n.searchQuery,onSearchChange:n.setSearchQuery,onSearchClear:()=>n.setSearchQuery(``),onSearchFocus:()=>n.setIsSearchModalOpen(!0),isOpen:n.isSidebarOpen,onOpenChange:n.setIsSidebarOpen,isMobile:n.isMobile,leftPanels:n.leftPanels,onLeftPanelsChange:n.setLeftPanels,leftSplit:n.leftSplit,onLeftSplitChange:n.setLeftSplit,rightPanels:n.rightPanels,onRightPanelsChange:n.setRightPanels,rightSplit:n.rightSplit,onRightSplitChange:n.setRightSplit,onSettingsClick:e=>{i(e),n.setIsSettingsOpen(!0)},onInviteClick:()=>n.setIsInviteModalOpen(!0),onRestore:n.handleRestoreDocument,onPermanentDelete:n.handlePermanentDelete,newDocumentId:n.newDocumentId,showDynamicIsland:n.showDynamicIsland,onToggleDynamicIsland:()=>n.setShowDynamicIsland(!n.showDynamicIsland),activeFileSourceId:n.activeFileSourceId,onFileSourceChange:n.handleFileSourceChange,onNavigate:e=>n.editorRef.current?.scrollToHeading(e),openTabs:n.openTabs,activeTab:n.activeDocId,onTabChange:n.handleTabChange,onTabClose:n.handleTabClose,onTabRename:(e,t)=>n.handleUpdateDocument(e,{title:t}),onSplitRight:n.handleSplitRight,onReopenLastClosed:n.handleReopenLastClosed,canReopenLastClosed:n.closedTabsHistory.length>0,aiProps:{isAiLoading:n.isAiLoading,aiSuggestion:n.aiSuggestion,onAiApprove:n.handleAIApprove,onAiReject:n.handleAIReject,onAiRegenerate:n.handleAIRegenerate}},l={activeDocument:n.activeDocument,documents:n.documents,splitViewDocId:n.splitViewDocId,activeDocId:n.activeDocId,isMobile:n.isMobile,editorRef:n.editorRef,onUpdateDocument:n.handleUpdateDocument,onHeadingsChange:n.setHeadings,onCloseSplitView:()=>n.setSplitViewDocId(null),aiSuggestion:n.aiSuggestion,isAiLoading:n.isAiLoading,onAiRewrite:n.handleAIRewrite,onAiApprove:n.handleAIApprove,onAiReject:n.handleAIReject,onAiRegenerate:n.handleAIRegenerate,onInviteClick:()=>n.setIsInviteModalOpen(!0),onShareClick:()=>n.setIsInviteModalOpen(!0)},u=n.rightPanels.length>0&&(0,V.jsx)(Mh,{panels:n.rightPanels,split:n.rightSplit,documents:n.documents,activeId:n.activeDocId,activeDocument:n.activeDocument,onSelect:n.handleSelectDocument,onAdd:n.handleAddDocument,onDelete:n.handleDeleteDocument,onDuplicate:n.handleDuplicateDocument,onMove:n.handleMoveDocument,onManageTags:n.handleManageTags,onRename:(e,t)=>n.handleUpdateDocument(e,{title:t}),headings:n.headings,onNavigate:e=>n.editorRef.current?.scrollToHeading(e),openTabs:n.openTabs,activeTab:n.activeDocId,onTabChange:n.handleTabChange,onTabClose:n.handleTabClose,onTabRename:(e,t)=>n.handleUpdateDocument(e,{title:t}),onSplitRight:n.handleSplitRight,onReopenLastClosed:n.handleReopenLastClosed,canReopenLastClosed:n.closedTabsHistory.length>0,aiProps:{isAiLoading:n.isAiLoading,aiSuggestion:n.aiSuggestion,onAiApprove:n.handleAIApprove,onAiReject:n.handleAIReject,onAiRegenerate:n.handleAIRegenerate},onClose:()=>n.setRightPanels([])});return(0,V.jsxs)(`div`,{className:`h-screen w-screen flex flex-col overflow-hidden`,children:[n.isMobile?(0,V.jsxs)(`div`,{className:`flex-1 flex overflow-hidden`,children:[(0,V.jsx)(ap,{...c,headings:n.headings}),(0,V.jsx)(`main`,{className:`flex-1 overflow-hidden flex flex-col`,children:(0,V.jsx)(kh,{...l})}),u]}):(0,V.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:(0,V.jsxs)(tp,{direction:`horizontal`,onResize:o,children:[(0,V.jsx)(Wf,{size:a?.[0]||`250px`,minSize:`0px`,maxSize:`600px`,children:(0,V.jsx)(`div`,{className:`overflow-y-auto overflow-x-hidden bg-background`,children:(0,V.jsx)(ap,{...c,headings:n.headings})})}),(0,V.jsx)(Wf,{children:(0,V.jsxs)(`div`,{className:`h-screen flex bg-background`,children:[(0,V.jsx)(`div`,{className:`flex-1 min-h-0 overflow-auto`,children:(0,V.jsx)(kh,{...l})}),u]})})]})}),n.headings.length>0&&n.rightPanels.length===0&&n.showDynamicIsland&&(0,V.jsx)(UD,{headings:n.headings,onNavigate:e=>n.editorRef.current?.scrollToHeading(e),editorRef:n.editorRef}),(0,V.jsx)(Qg,{isSearchModalOpen:n.isSearchModalOpen,setIsSearchModalOpen:n.setIsSearchModalOpen,isSettingsOpen:n.isSettingsOpen,setIsSettingsOpen:n.setIsSettingsOpen,settingsInitialSection:r,isTeamsOpen:n.isTeamsOpen,setIsTeamsOpen:n.setIsTeamsOpen,isInviteModalOpen:n.isInviteModalOpen,setIsInviteModalOpen:n.setIsInviteModalOpen,isTagDialogOpen:n.isTagDialogOpen,setIsTagDialogOpen:n.setIsTagDialogOpen,documents:n.documents,activeDocument:n.activeDocument,tagManagementDocId:n.tagManagementDocId,defaultSidebarView:n.defaultSidebarView,setDefaultSidebarView:n.setDefaultSidebarView,enableDatabaseSync:n.enableDatabaseSync,setEnableDatabaseSync:n.setEnableDatabaseSync,setDocuments:n.setDocuments,onSelectDocument:n.handleSelectDocument,onToggleTheme:s,currentTheme:e,onUpdateTags:n.handleUpdateTags})]})};function GD(){return(0,V.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:(0,V.jsx)(WD,{})})}function KD(){return(0,B.useEffect)(()=>{_t.setLang(`en`),je.setColor(`default`)},[]),(0,V.jsx)(bt,{attribute:`class`,defaultTheme:`light`,enableSystem:!0,children:(0,V.jsx)(`div`,{className:`flex flex-col h-screen bg-white dark:bg-gray-950`,children:(0,V.jsx)(GD,{})})})}(0,hn.createRoot)(document.getElementById(`root`)).render((0,V.jsx)(KD,{}));