@baseline-ui/core 3.5.0 → 3.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (255) hide show
  1. package/dist/Accordion.mjs +1 -1
  2. package/dist/ActionButton.mjs +1 -1
  3. package/dist/ActionGroup.mjs +1 -1
  4. package/dist/ActionIconButton.mjs +1 -1
  5. package/dist/Actionable.mjs +1 -1
  6. package/dist/AlertDialog.mjs +1 -1
  7. package/dist/AudioPlayer.mjs +1 -1
  8. package/dist/Box.mjs +1 -1
  9. package/dist/Breadcrumbs.css +10 -0
  10. package/dist/Breadcrumbs.mjs +1 -0
  11. package/dist/ButtonSelect.mjs +1 -1
  12. package/dist/Calendar.css +1 -1
  13. package/dist/Calendar.mjs +1 -1
  14. package/dist/Checkbox.mjs +1 -1
  15. package/dist/ColorInput.mjs +1 -1
  16. package/dist/ColorSwatch.mjs +1 -1
  17. package/dist/ColorSwatchPicker.mjs +1 -1
  18. package/dist/ComboBox.mjs +1 -1
  19. package/dist/DateField.css +1 -1
  20. package/dist/DateField.mjs +1 -1
  21. package/dist/Dialog.mjs +1 -1
  22. package/dist/Disclosure.mjs +1 -1
  23. package/dist/DomNodeRenderer.mjs +1 -1
  24. package/dist/Drawer.mjs +1 -1
  25. package/dist/Editor.css +1 -1
  26. package/dist/Editor.mjs +1 -1
  27. package/dist/FileInput.mjs +1 -1
  28. package/dist/FileList.mjs +1 -1
  29. package/dist/FileUploader.mjs +1 -1
  30. package/dist/FrameProvider.mjs +1 -1
  31. package/dist/FreehandCanvas.mjs +1 -1
  32. package/dist/GridList.mjs +1 -1
  33. package/dist/I18nProvider.mjs +1 -1
  34. package/dist/Icon.mjs +1 -1
  35. package/dist/ImageDropZone.mjs +1 -1
  36. package/dist/ImageGallery.mjs +1 -1
  37. package/dist/InlineAlert.mjs +1 -1
  38. package/dist/InlineToolbar.mjs +2 -2
  39. package/dist/Kbd.mjs +1 -1
  40. package/dist/Link.mjs +1 -1
  41. package/dist/ListBox.mjs +1 -1
  42. package/dist/Markdown.css +1 -1
  43. package/dist/Markdown.mjs +1 -1
  44. package/dist/Menu.mjs +1 -1
  45. package/dist/MessageFormat.mjs +1 -1
  46. package/dist/Modal.mjs +1 -1
  47. package/dist/NumberInput.mjs +1 -1
  48. package/dist/Pagination.mjs +1 -1
  49. package/dist/PointPicker.mjs +1 -1
  50. package/dist/Popover.mjs +1 -1
  51. package/dist/Portal.mjs +1 -1
  52. package/dist/Preview.mjs +1 -1
  53. package/dist/ProgressBar.mjs +1 -1
  54. package/dist/RadioGroup.mjs +1 -1
  55. package/dist/Reaction.mjs +1 -1
  56. package/dist/ScrollControlButton.mjs +1 -1
  57. package/dist/SearchInput.mjs +1 -1
  58. package/dist/Select.mjs +1 -1
  59. package/dist/Slider.mjs +1 -1
  60. package/dist/StatusCard.mjs +1 -1
  61. package/dist/Stepper.mjs +1 -1
  62. package/dist/Switch.css +1 -1
  63. package/dist/Switch.mjs +1 -1
  64. package/dist/Table.mjs +1 -1
  65. package/dist/Tabs.mjs +1 -1
  66. package/dist/Tag.mjs +1 -1
  67. package/dist/TagGroup.mjs +1 -1
  68. package/dist/TaggedPagination.mjs +1 -1
  69. package/dist/Text.mjs +1 -1
  70. package/dist/TextInput.mjs +1 -1
  71. package/dist/ThemeProvider.mjs +1 -1
  72. package/dist/TimeField.mjs +1 -1
  73. package/dist/Toast.mjs +1 -1
  74. package/dist/ToggleButton.mjs +1 -1
  75. package/dist/ToggleIconButton.mjs +1 -1
  76. package/dist/Toolbar.mjs +1 -1
  77. package/dist/Tooltip.mjs +1 -1
  78. package/dist/TreeView.mjs +1 -1
  79. package/dist/UNSAFE_ListBox.mjs +1 -1
  80. package/dist/Virtualizer.mjs +1 -1
  81. package/dist/{chunk-UOWKAUCQ.mjs → chunk-23WMOYTQ.mjs} +2 -2
  82. package/dist/{chunk-7XLBV46W.mjs → chunk-2JRDTJWJ.mjs} +1 -1
  83. package/dist/chunk-3IPRT57V.mjs +10 -0
  84. package/dist/{chunk-O6FPWOHR.mjs → chunk-4QGZDJW4.mjs} +1 -1
  85. package/dist/{chunk-UO75BAPM.mjs → chunk-4Y4WKIL5.mjs} +1 -1
  86. package/dist/chunk-54ZKQAA3.mjs +10 -0
  87. package/dist/{chunk-GLAMJIYO.mjs → chunk-5EI2562M.mjs} +1 -1
  88. package/dist/{chunk-6GMU63H2.mjs → chunk-5GW36EQJ.mjs} +1 -1
  89. package/dist/{chunk-ZA2FH3MS.mjs → chunk-5ILCVLWY.mjs} +1 -1
  90. package/dist/{chunk-VXZT2JR2.mjs → chunk-5W6G3ZUT.mjs} +1 -1
  91. package/dist/{chunk-UYUYQFOW.mjs → chunk-5YKRWGEJ.mjs} +1 -1
  92. package/dist/{chunk-7BE6MOPW.mjs → chunk-6CEV43ZA.mjs} +2 -2
  93. package/dist/chunk-6DETJFO2.mjs +10 -0
  94. package/dist/chunk-6DYTFYPO.mjs +10 -0
  95. package/dist/{chunk-3DWFAHR2.mjs → chunk-6GV3YWV7.mjs} +1 -1
  96. package/dist/chunk-6TRBOQVN.mjs +10 -0
  97. package/dist/chunk-6Z3GYFG5.mjs +10 -0
  98. package/dist/chunk-73UBSCJ2.mjs +10 -0
  99. package/dist/{chunk-7XGNJE7J.mjs → chunk-7DCQF3EP.mjs} +1 -1
  100. package/dist/{chunk-MCN5JU6E.mjs → chunk-7YCV7MPI.mjs} +1 -1
  101. package/dist/{chunk-3M3WJHOI.mjs → chunk-AQTRFPF2.mjs} +1 -1
  102. package/dist/{chunk-HABKIEKC.mjs → chunk-B5VHU77N.mjs} +1 -1
  103. package/dist/{chunk-ONBEVR2G.mjs → chunk-BULEKXBD.mjs} +1 -1
  104. package/dist/chunk-CBV6KXGO.mjs +30 -0
  105. package/dist/chunk-CD5KKXIM.mjs +10 -0
  106. package/dist/{chunk-KW3BKIG4.mjs → chunk-DG5VNJOH.mjs} +1 -1
  107. package/dist/{chunk-O7XK2WIX.mjs → chunk-DIL5HL6K.mjs} +2 -2
  108. package/dist/{chunk-QWZBZ23U.mjs → chunk-EDMVODCD.mjs} +1 -1
  109. package/dist/{chunk-PYV5J322.mjs → chunk-EFFODO2N.mjs} +1 -1
  110. package/dist/{chunk-CTBCJZEG.mjs → chunk-EGYIHFEQ.mjs} +1 -1
  111. package/dist/{chunk-5VNC6UYE.mjs → chunk-F3THHK5C.mjs} +1 -1
  112. package/dist/chunk-F56P4EKI.mjs +10 -0
  113. package/dist/{chunk-NMK4W6K3.mjs → chunk-FJO6KCT5.mjs} +2 -2
  114. package/dist/{chunk-GL5GUKT7.mjs → chunk-FX3THTOK.mjs} +1 -1
  115. package/dist/{chunk-EL5OYHOX.mjs → chunk-G5MSZV5O.mjs} +2 -2
  116. package/dist/chunk-GJ6ZPLFR.mjs +10 -0
  117. package/dist/{chunk-JRCDMRIW.mjs → chunk-HTRO6BM5.mjs} +1 -1
  118. package/dist/{chunk-7MLFM55C.mjs → chunk-IDIZSV2Y.mjs} +1 -1
  119. package/dist/chunk-IGM72PUL.mjs +0 -0
  120. package/dist/{chunk-2M2LI4MI.mjs → chunk-IMXJCV7G.mjs} +1 -1
  121. package/dist/{chunk-43LOJ3SH.mjs → chunk-IN7BLI4M.mjs} +1 -1
  122. package/dist/{chunk-AFOW62QN.mjs → chunk-INFMXVHD.mjs} +1 -1
  123. package/dist/{chunk-5G6JNQQR.mjs → chunk-IVDIKT6F.mjs} +1 -1
  124. package/dist/{chunk-WFYFHANE.mjs → chunk-JHA7DIPG.mjs} +1 -1
  125. package/dist/{chunk-X5ZTXDQ4.mjs → chunk-JXCL5CUV.mjs} +1 -1
  126. package/dist/chunk-K3WFKO7R.mjs +10 -0
  127. package/dist/{chunk-TFSBTGTQ.mjs → chunk-KQOXSF4J.mjs} +1 -1
  128. package/dist/{chunk-LKSUUT3M.mjs → chunk-L45T2KGW.mjs} +1 -1
  129. package/dist/{chunk-7EQIV4GX.mjs → chunk-LDWNE2JT.mjs} +1 -1
  130. package/dist/{chunk-676DOXEK.mjs → chunk-LY2ZVEGJ.mjs} +2 -2
  131. package/dist/chunk-M3R4ZM34.mjs +10 -0
  132. package/dist/{chunk-USUPPN73.mjs → chunk-MJPCLLDU.mjs} +1 -1
  133. package/dist/{chunk-5W67PVZQ.mjs → chunk-MKHLBKSN.mjs} +2 -2
  134. package/dist/{chunk-LBHZV4BO.mjs → chunk-MURSKAKT.mjs} +1 -1
  135. package/dist/chunk-MYT5CSGX.mjs +10 -0
  136. package/dist/{chunk-2AKHB7Y5.mjs → chunk-NLVJYKSA.mjs} +1 -1
  137. package/dist/{chunk-5G7ABQYJ.mjs → chunk-NO3DNA2U.mjs} +1 -1
  138. package/dist/{chunk-DO5YROCG.mjs → chunk-NT2MFIKD.mjs} +1 -1
  139. package/dist/{chunk-7P7VZMTO.mjs → chunk-NWWH62TU.mjs} +1 -1
  140. package/dist/chunk-O6PPXOEX.mjs +10 -0
  141. package/dist/chunk-OBEPT4LR.mjs +10 -0
  142. package/dist/{chunk-DAI7V4TE.mjs → chunk-OPIPJTLG.mjs} +1 -1
  143. package/dist/{chunk-3KWSJRYK.mjs → chunk-P6V5EAYL.mjs} +1 -1
  144. package/dist/chunk-PCR5FD43.mjs +10 -0
  145. package/dist/{chunk-Z3ZMWJSV.mjs → chunk-PR3CD3UC.mjs} +2 -2
  146. package/dist/chunk-Q6R75IOP.mjs +10 -0
  147. package/dist/{chunk-6M7PJXEE.mjs → chunk-QIYZRQGP.mjs} +1 -1
  148. package/dist/{chunk-BAIVRB2I.mjs → chunk-QL7SC5BW.mjs} +1 -1
  149. package/dist/{chunk-X5ORCNAU.mjs → chunk-QUWRO3HT.mjs} +1 -1
  150. package/dist/{chunk-3UC5V5E3.mjs → chunk-RE7ZGPOY.mjs} +1 -1
  151. package/dist/chunk-RINS2TBF.mjs +10 -0
  152. package/dist/{chunk-SLFKSR3T.mjs → chunk-SAATXQOW.mjs} +1 -1
  153. package/dist/chunk-SSWWJZRE.mjs +10 -0
  154. package/dist/{chunk-D5VU5TED.mjs → chunk-SXZP556C.mjs} +1 -1
  155. package/dist/{chunk-2WA3KB7H.mjs → chunk-TDRN6VLD.mjs} +1 -1
  156. package/dist/{chunk-OWQRYRWF.mjs → chunk-TFBJ767L.mjs} +1 -1
  157. package/dist/{chunk-QXXKOFWM.mjs → chunk-TLU2GNUT.mjs} +1 -1
  158. package/dist/{chunk-GFKZXGWJ.mjs → chunk-UCDGZFQ7.mjs} +1 -1
  159. package/dist/{chunk-ABXTAFKP.mjs → chunk-UPCEZ32D.mjs} +1 -1
  160. package/dist/chunk-VE2UA2AH.mjs +0 -0
  161. package/dist/{chunk-JDIGAVFU.mjs → chunk-VIMSH5F5.mjs} +1 -1
  162. package/dist/chunk-VNWKXT3X.mjs +10 -0
  163. package/dist/chunk-VPVF5N62.mjs +10 -0
  164. package/dist/chunk-VQ2K6Q3G.mjs +10 -0
  165. package/dist/chunk-WDWBYTJG.mjs +10 -0
  166. package/dist/{chunk-LQHFBXCW.mjs → chunk-X3ACY7IY.mjs} +2 -2
  167. package/dist/chunk-XC2S3RLC.mjs +10 -0
  168. package/dist/{chunk-SI5WP6I7.mjs → chunk-XO7MAUFC.mjs} +1 -1
  169. package/dist/{chunk-AN26QORL.mjs → chunk-XVL2GXTB.mjs} +1 -1
  170. package/dist/{chunk-PLZ6ZFEO.mjs → chunk-YAI33K42.mjs} +1 -1
  171. package/dist/chunk-YEIRJNEA.mjs +10 -0
  172. package/dist/{chunk-LQ7PGSP4.mjs → chunk-YNJD34U4.mjs} +1 -1
  173. package/dist/{chunk-FGSVPRDN.mjs → chunk-YQKEP62C.mjs} +1 -1
  174. package/dist/{chunk-CENNHSIS.mjs → chunk-ZC5WXVNV.mjs} +1 -1
  175. package/dist/chunk-ZXN5VT4G.mjs +10 -0
  176. package/dist/{chunk-UPJHL37C.mjs → chunk-ZZ7YJ2FN.mjs} +1 -1
  177. package/dist/hooks/useDevice.mjs +1 -1
  178. package/dist/hooks/useI18n.mjs +1 -1
  179. package/dist/hooks/useIntersectionObserver.mjs +1 -1
  180. package/dist/hooks/useLiveInteractionModality.mjs +1 -1
  181. package/dist/hooks/useMedia.mjs +1 -1
  182. package/dist/hooks/useMutationObserver.mjs +1 -1
  183. package/dist/hooks/usePortalContainer.mjs +1 -1
  184. package/dist/hooks/usePreventFocus.mjs +1 -1
  185. package/dist/hooks/useResizeObserver.mjs +1 -1
  186. package/dist/hooks/useTextSelection.mjs +1 -1
  187. package/dist/index.css +1 -1
  188. package/dist/index.d.ts +305 -95
  189. package/dist/index.js +22 -21
  190. package/dist/index.mjs +1 -1
  191. package/dist/messageIds.mjs +1 -1
  192. package/dist/utils/colors.mjs +1 -1
  193. package/dist/utils/dom.mjs +1 -1
  194. package/dist/utils/isInShadowDOM.mjs +1 -1
  195. package/dist/utils/keyboards.mjs +1 -1
  196. package/dist/utils/selection.mjs +1 -0
  197. package/intl/ar.json +2 -0
  198. package/intl/cs.json +2 -0
  199. package/intl/cy.json +2 -0
  200. package/intl/da.json +2 -0
  201. package/intl/de.json +2 -0
  202. package/intl/el.json +2 -0
  203. package/intl/en-GB.json +2 -0
  204. package/intl/en.json +2 -0
  205. package/intl/es.json +2 -0
  206. package/intl/fi.json +2 -0
  207. package/intl/fr-CA.json +2 -0
  208. package/intl/fr.json +2 -0
  209. package/intl/he.json +2 -0
  210. package/intl/hr.json +2 -0
  211. package/intl/id.json +2 -0
  212. package/intl/it.json +2 -0
  213. package/intl/ja.json +2 -0
  214. package/intl/ko.json +2 -0
  215. package/intl/ms.json +2 -0
  216. package/intl/nb-NO.json +2 -0
  217. package/intl/nl.json +2 -0
  218. package/intl/pl.json +2 -0
  219. package/intl/pt-PT.json +2 -0
  220. package/intl/pt.json +2 -0
  221. package/intl/ru.json +2 -0
  222. package/intl/sk.json +2 -0
  223. package/intl/sl.json +2 -0
  224. package/intl/sv.json +2 -0
  225. package/intl/th.json +2 -0
  226. package/intl/tr.json +2 -0
  227. package/intl/uk.json +2 -0
  228. package/intl/zh-Hans.json +2 -0
  229. package/intl/zh-Hant.json +2 -0
  230. package/messages.json +8 -0
  231. package/package.json +4 -4
  232. package/sbom.json +6 -6
  233. package/dist/chunk-335C37NB.mjs +0 -10
  234. package/dist/chunk-46RUOB4U.mjs +0 -29
  235. package/dist/chunk-AMVX34SS.mjs +0 -10
  236. package/dist/chunk-AYQN3OH2.mjs +0 -10
  237. package/dist/chunk-BET5GVGQ.mjs +0 -10
  238. package/dist/chunk-FNCHBVLF.mjs +0 -10
  239. package/dist/chunk-IHES52NR.mjs +0 -10
  240. package/dist/chunk-NMGKHMH3.mjs +0 -10
  241. package/dist/chunk-OMWMNUTI.mjs +0 -10
  242. package/dist/chunk-R6Q7UMQS.mjs +0 -10
  243. package/dist/chunk-SBGZCLF4.mjs +0 -10
  244. package/dist/chunk-T6J7G3YL.mjs +0 -10
  245. package/dist/chunk-TTVYMCU3.mjs +0 -10
  246. package/dist/chunk-UH6QIGD3.mjs +0 -10
  247. package/dist/chunk-UYAFH4CW.mjs +0 -10
  248. package/dist/chunk-X7CKWYUD.mjs +0 -10
  249. package/dist/chunk-XQC3DSTW.mjs +0 -10
  250. package/dist/chunk-Y3HXPORF.mjs +0 -10
  251. package/dist/chunk-YFBMCK5O.mjs +0 -10
  252. package/dist/chunk-YMYMFVW4.mjs +0 -10
  253. package/dist/chunk-YQHHE5AT.mjs +0 -10
  254. package/dist/chunk-YYU46XNM.mjs +0 -10
  255. /package/dist/{chunk-MAJ74VNE.mjs → chunk-HMAVZPRE.mjs} +0 -0
@@ -1,29 +0,0 @@
1
- import {a as a$p}from'./chunk-JI4SJ53O.mjs';import {a as a$8}from'./chunk-USUPPN73.mjs';import {b as b$3}from'./chunk-BPW4QRPV.mjs';import {a as a$n}from'./chunk-O7IU5NHN.mjs';import {a as a$q}from'./chunk-TDYBXLYP.mjs';import {b as b$6,a as a$l}from'./chunk-AN26QORL.mjs';import {b as b$4}from'./chunk-TTVYMCU3.mjs';import {f}from'./chunk-6GMU63H2.mjs';import {a as a$i}from'./chunk-5BAHJXOI.mjs';import {b as b$a}from'./chunk-HZM2XZP4.mjs';import {b as b$8,c as c$2}from'./chunk-XQC3DSTW.mjs';import {a as a$6}from'./chunk-FCKJCFMD.mjs';import {a as a$j}from'./chunk-NGZRN4SF.mjs';import {a as a$o}from'./chunk-7EQIV4GX.mjs';import {a as a$f}from'./chunk-QXXKOFWM.mjs';import {a as a$g}from'./chunk-O6FPWOHR.mjs';import {a as a$h}from'./chunk-DO5YROCG.mjs';import {b as b$9,e as e$1}from'./chunk-YYU46XNM.mjs';import {b as b$7,f as f$1}from'./chunk-UZ672WDX.mjs';import {a as a$m}from'./chunk-3DWFAHR2.mjs';import {a as a$a}from'./chunk-JZXLV6JU.mjs';import {a as a$d}from'./chunk-R6TFTLMV.mjs';import {c as c$1,b as b$1}from'./chunk-7MLFM55C.mjs';import {b as b$b}from'./chunk-AFOW62QN.mjs';import {a as a$9}from'./chunk-O7XK2WIX.mjs';import {a as a$b}from'./chunk-DAI7V4TE.mjs';import {a as a$k}from'./chunk-CIPPPD6E.mjs';import {a as a$c}from'./chunk-5IC46G5J.mjs';import {b as b$5,j as j$1}from'./chunk-MBRNO6IW.mjs';import {a as a$1}from'./chunk-FPM5UJRF.mjs';import {a as a$4}from'./chunk-RSKKEGJZ.mjs';import {a as a$2}from'./chunk-STMDFIUL.mjs';import {j}from'./chunk-KUDCYGII.mjs';import {a as a$3}from'./chunk-B3EZOXNU.mjs';import {e}from'./chunk-PPHSLODC.mjs';import {b,c}from'./chunk-3WKDIXCM.mjs';import {c as c$3}from'./chunk-ETM4MNG4.mjs';import {a as a$7,b as b$2,j as j$2,h}from'./chunk-SD43KVTU.mjs';import {a as a$e}from'./chunk-UBLCUHRL.mjs';import {a}from'./chunk-JQQGRJ5J.mjs';import {a as a$5}from'./chunk-4QEH5CGK.mjs';import {BoldIcon,ItalicIcon,UnderlineIcon,ArrowUpCircleFilledIcon,AtIcon,XCircleFilledIcon,LinkIcon,XIcon}from'@baseline-ui/icons/20';import {layoutSprinkleValues,sprinkles}from'@baseline-ui/tokens';import mt,{useCallback,useImperativeHandle,useEffect,useRef,useState,useMemo,useLayoutEffect,useId,useContext,Fragment as Fragment$1}from'react';import {useGranularLayoutEffect}from'granular-hooks';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import Kr from'just-camel-case';import {QuestionmarkCircleIcon,TextIcon,HighlightTextIcon}from'@baseline-ui/icons/24';import*as Fo from'dompurify';import ti from'just-kebab-case';import {createPortal}from'react-dom';/**
2
- * Copyright (c) 2023-2024 PSPDFKit GmbH. All rights reserved.
3
- *
4
- * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
5
- * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE PSPDFKIT LICENSE AGREEMENT.
6
- * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
7
- * This notice may not be removed from this file.
8
- *
9
- */
10
- var yo="f6jv6bm",Eo="_1yep5z64u _1yep5z64v _1yep5z64w _1yep5z676 _1yep5z677 _1yep5z678 _1yep5z6k8 _1yep5z6k9 _1yep5z6ka",He="_1yep5z689 _1yep5z68a _1yep5z68b _1yep5z65x _1yep5z65y _1yep5z65z",vo=a({defaultClassName:"f6jv6b0 _1yep5z6j8 _1yep5z6j9 _1yep5z6ja _1yep5z6g9",variantClassNames:{isInline:{true:"f6jv6b1"},isMinimal:{true:"_1yep5z6160 _1yep5z6161 _1yep5z6162 _1yep5z6w4 _1yep5z6w5 _1yep5z6w6 _1yep5z616i _1yep5z616j _1yep5z616k",false:"_1yep5z6163 _1yep5z6164 _1yep5z6165"}},defaultVariants:{},compoundVariants:[[{isInline:true,isMinimal:false},"_1yep5z61jn _1yep5z61jo _1yep5z61jp _1yep5z61kb _1yep5z61kc _1yep5z61kd _1yep5z61kz _1yep5z61l0 _1yep5z61l1 _1yep5z61ln _1yep5z61lo _1yep5z61lp _1yep5z61vj _1yep5z61vh _1yep5z61qi"]]}),ot=a({defaultClassName:"f6jv6b4 _1yep5z69 _1yep5z6a _1yep5z6b _1yep5z62l _1yep5z62m _1yep5z62n _1yep5z63r _1yep5z63s _1yep5z63t _1yep5z61f _1yep5z61g _1yep5z61h _1yep5z6e3 _1yep5z6ey _1yep5z6m6",variantClassNames:{isDisabled:{true:"f6jv6b5 _1yep5z611l"}},defaultVariants:{},compoundVariants:[]}),Ro="f6jv6b6",To="f6jv6bj _1yep5z6x7 _1yep5z6x8 _1yep5z6x9 _1yep5z6xv _1yep5z6xw _1yep5z6xx _1yep5z6yj _1yep5z6yk _1yep5z6yl _1yep5z6z7 _1yep5z6z8 _1yep5z6z9",ko="f6jv6bk";var Co="f6jv6bn _1yep5z63l _1yep5z63m _1yep5z63n _1yep5z619 _1yep5z61a _1yep5z61b _1yep5z6ai _1yep5z6aj _1yep5z6ak _1yep5z6b6 _1yep5z6b7 _1yep5z6b8 _1yep5z6bu _1yep5z6bv _1yep5z6bw _1yep5z6ci _1yep5z6cj _1yep5z6ck _1yep5z6jb _1yep5z6jc _1yep5z6jd _1yep5z6me _1yep5z6m9 _1yep5z6m7 _1yep5z6id _1yep5z6ey",Mo=a({defaultClassName:"f6jv6bg _1yep5z63r _1yep5z63s _1yep5z63t _1yep5z61f _1yep5z61g _1yep5z61h _1yep5z63 _1yep5z64 _1yep5z65 _1yep5z62f _1yep5z62g _1yep5z62h _1yep5z6j8 _1yep5z6j9 _1yep5z6ja _1yep5z6jh _1yep5z6ji _1yep5z6jj _1yep5z6jz _1yep5z6k0 _1yep5z6k1 _1yep5z69l _1yep5z69m _1yep5z69n _1yep5z6m6 _1yep5z6lq _1yep5z6lt _1yep5z6m5",variantClassNames:{isHovered:{true:"_1yep5z612u"},isDisabled:{true:"_1yep5z6zt"}},defaultVariants:{},compoundVariants:[]}),Lo="_1yep5z6ke _1yep5z6kf _1yep5z6kg",So="f6jv6bf f6jv6bb _1yep5z6ai _1yep5z6aj _1yep5z6ak _1yep5z6b6 _1yep5z6b7 _1yep5z6b8 _1yep5z6j5 _1yep5z6j6 _1yep5z6j7 _1yep5z6ey _1yep5z6e3 _1yep5z6m3",zo=a({defaultClassName:"f6jv6bc _1yep5z6ai _1yep5z6aj _1yep5z6ak _1yep5z6b6 _1yep5z6b7 _1yep5z6b8 _1yep5z6bu _1yep5z6bv _1yep5z6bw _1yep5z6ci _1yep5z6cj _1yep5z6ck _1yep5z6j8 _1yep5z6j9 _1yep5z6ja _1yep5z6jh _1yep5z6ji _1yep5z6jj _1yep5z69l _1yep5z69m _1yep5z69n _1yep5z6kk _1yep5z6kl _1yep5z6km",variantClassNames:{isInline:{true:"_1yep5z6q7 _1yep5z6q8 _1yep5z6q9 _1yep5z6190 _1yep5z618y _1yep5z613z",false:"_1yep5z6qa _1yep5z6qb _1yep5z6qc _1yep5z6xm _1yep5z6xn _1yep5z6xo _1yep5z6ya _1yep5z6yb _1yep5z6yc _1yep5z6yy _1yep5z6yz _1yep5z6z0 _1yep5z6zm _1yep5z6zn _1yep5z6zo"}},defaultVariants:{},compoundVariants:[]}),Po="f6jv6bl",Do="f6jv6bb _1yep5z6ai _1yep5z6aj _1yep5z6ak _1yep5z6b6 _1yep5z6b7 _1yep5z6b8 _1yep5z6j5 _1yep5z6j6 _1yep5z6j7 _1yep5z6ey",_t=a({defaultClassName:"f6jv6b7",variantClassNames:{isInline:{true:"f6jv6b8",false:"f6jv6b9"}},defaultVariants:{},compoundVariants:[]}),It="f6jv6ba _1yep5z6j8 _1yep5z6j9 _1yep5z6ja _1yep5z6jh _1yep5z6ji _1yep5z6jj _1yep5z6jz _1yep5z6k0 _1yep5z6k1",rt="f6jv6bo";var Nt=mt.forwardRef(({value:t,defaultValue:e,onChange:n,placeholder:o,spellCheck:r,textBoxRef:i,isInline:l,isMinimal:s,isDisabled:a,editableContentAriaLabel:c$1,editorHandle:u,autoFocus:d,saveOnEnter:f,onSave:p},m)=>{let h=mt.useRef(null),[C,D]=a$1(t,e||"",n),V=useCallback(b=>{D(b.currentTarget.value||"");},[D]),M=useCallback(b=>{(f&&b.key==="Enter"&&!b.shiftKey||(b.ctrlKey||b.metaKey)&&b.key==="Enter")&&(b.preventDefault(),p());},[f,p]);useImperativeHandle(m,()=>({clear:()=>{D("");}}));let B=useCallback(b=>{b.currentTarget.style.height="16px",b.currentTarget.style.height=b.currentTarget.scrollHeight+"px";},[]);useGranularLayoutEffect(()=>{let b=h.current;b&&(b.style.height="16px",b.style.height=b.scrollHeight+"px");},[s],[C]),useImperativeHandle(u,()=>({setCaretPosition:b=>{h.current&&(h.current.focus(),h.current.setSelectionRange(b,b));},focus:()=>{h.current&&h.current.focus();}}));let S=d===true||d==="start"||d==="end",L=typeof d=="string"?d:void 0;useEffect(()=>{if(L&&h.current){let b=L==="start"?0:L==="end"?h.current.value.length:void 0;b!==void 0&&h.current.setSelectionRange(b,b);}},[L]);let{focusProps:q,isFocused:$,isFocusVisible:te}=a$2(),{hoverProps:g,isHovered:y}=a$3({}),R=a$4({"data-focus-visible":te,"data-hovered":y,"data-focused":$});return jsx("textarea",{...c(q,g,R),ref:b(h,i),className:a$5({[ot()]:!s,[_t({isInline:l})]:!s,[Do]:!s,[So]:s},"BaselineUI-Editor-PlainEditorEditingArea"),autoFocus:S,onChange:V,disabled:a,onInput:B,value:C,placeholder:o,spellCheck:r,"aria-label":c$1,onKeyDown:M})});Nt.displayName="PlainEditor";var wo=[["Toolbar Focus","Alt+F10"],["Bold","Ctrl+B"],["Italic","Ctrl+I"],["Underline","Ctrl+U"],["Select All","Ctrl+A"],["Cut","Ctrl+X"],["Copy","Ctrl+C"],["Paste","Ctrl+V"],["Undo","Ctrl+Z"],["Redo","Ctrl+Shift+Z"],["Submit","Ctrl+Enter"],["Open Help Dialog","Ctrl+Shift+H"]],{dialog:{row:it}}=layoutSprinkleValues,Ao=({isOpen:t,onClose:e,toolbarFocusLabel:n,helpLabel:o,closeLabel:r,actionLabel:i,shortcutLabel:l,boldLabel:s,italicLabel:a,underlineLabel:c,selectAllLabel:u,cutLabel:d,copyLabel:f,pasteLabel:p,undoLabel:m,redoLabel:h,openHelpDialogLabel:C,submitLabel:D})=>{let{formatMessage:V}=b$1(),M=c$3(),B={toolbarFocus:n,help:o,close:r,action:i,shortcut:l,bold:s,italic:a,underline:c,selectAll:u,cut:d,copy:f,paste:p,undo:m,redo:h,openHelpDialog:C,submit:D},S=L=>B[L]??V(Ur[L]);return jsx(b$9,{isOpen:t,onOpenChange:L=>{L||e();},children:jsx(e$1,{enableDrawer:"auto",style:{zIndex:999999},children:jsxs(a$h,{"aria-labelledby":M,className:To,drawerBackground:"subtle",children:[jsxs(a$9,{paddingLeft:it.padding.horizontal.lg,paddingRight:it.padding.horizontal.sm,display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",backgroundColor:"background.primary.subtle",className:ko,children:[jsx(a$m,{id:M,elementType:"h3",type:"title",size:"md",children:S("help")}),jsx(a$b,{icon:XIcon,size:"md",variant:"secondary","aria-label":S("close"),"data-testid":"editor-help-dialog-close-button",onPress:e})]}),jsx(a$a,{className:Po}),jsxs(a$9,{paddingX:it.padding.horizontal.lg,role:"table","aria-labelledby":M,backgroundColor:"background.primary.subtle",children:[jsx("div",{role:"rowgroup",children:jsxs(a$9,{role:"row",display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingY:it.padding.vertical.md,color:"text.primary",children:[jsx("h6",{className:sprinkles({typography:"heading.h6.semibold"}),role:"columnheader",children:S("action")}),jsx("h6",{className:sprinkles({typography:"heading.h6.semibold"}),role:"columnheader",style:{textTransform:"capitalize"},children:S("shortcut")})]})}),jsx("div",{role:"rowgroup",children:wo.map(([L,q],$)=>jsxs(Fragment$1,{children:[jsxs(a$9,{role:"row",display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingY:it.padding.vertical.xs,style:{minHeight:40},children:[jsx(a$m,{type:"subtitle",size:"sm",role:"cell",children:S(Kr(L))}),jsx(a$m,{elementType:"kbd",type:"subtitle",size:"sm",role:"cell",children:a$n(q,true)})]}),$!==wo.length-1&&jsx(a$a,{})]},L))})]})]})})})},Ur=c$1({toolbarFocus:{id:"bui.editor.toolbarFocus",defaultMessage:"Toolbar Focus"},help:{id:"bui.editor.help",defaultMessage:"Help"},close:{id:"bui.editor.close",defaultMessage:"Close"},action:{id:"bui.editor.action",defaultMessage:"Action"},shortcut:{id:"bui.editor.shortcut",defaultMessage:"Shortcut"},bold:{id:"bui.editor.bold",defaultMessage:"Bold"},italic:{id:"bui.editor.italic",defaultMessage:"Italic"},underline:{id:"bui.editor.underline",defaultMessage:"Underline"},selectAll:{id:"bui.editor.selectAll",defaultMessage:"Select All"},cut:{id:"bui.editor.cut",defaultMessage:"Cut"},copy:{id:"bui.editor.copy",defaultMessage:"Copy"},paste:{id:"bui.editor.paste",defaultMessage:"Paste"},undo:{id:"bui.editor.undo",defaultMessage:"Undo"},redo:{id:"bui.editor.redo",defaultMessage:"Redo"},openHelpDialog:{id:"bui.editor.openHelpDialog",defaultMessage:"Open Help Dialog"},submit:{id:"bui.editor.submit",defaultMessage:"Submit"}});var Vr=a$6("#ffffff00").toString("hexa"),cn=[{label:"Red",color:"#ff0000"},{label:"Green",color:"#00ff00"},{label:"Blue",color:"#0000ff"},{label:"Yellow",color:"#ffff00"},{label:"Cyan",color:"#00ffff"},{label:"Magenta",color:"#ff00ff"},{label:"Black",color:"#000000"},{label:"White",color:"#ffffff"},{label:"Gray",color:"#808080"},{label:"Orange",color:"#ffa500"},{label:"Brown",color:"#a52a2a"},{label:"Purple",color:"#800080"}];[...cn,{label:"Transparent",color:Vr}];var Ke="p",Z="a",ae="mention",Ee="mention_input";function dn(t,e){return typeof t=="object"&&t!==null&&"type"in t&&t.type===e}function x(t){return typeof t=="object"&&t!==null&&"text"in t&&!("type"in t)}function k(t){return dn(t,Z)}function ce(t){return dn(t,ae)}function me(t){return dn(t,Ee)}function J(t){return ce(t)||me(t)}function Fe(){return [{type:Ke,children:[{text:""}]}]}function wt(t,e){return t.bold===e.bold&&t.italic===e.italic&&t.underline===e.underline&&b$a(t.color,e.color)&&b$a(t.backgroundColor,e.backgroundColor)}function At(t,e){let n=false;for(let i=0;i<t.length;i++){let l=t[i];if(l.text===""&&!(e&&t.length===1)){n=true;break}if(i>0&&wt(t[i-1],l)){n=true;break}}if(!n)return t;let o=t.filter(i=>i.text!==""),r=[];for(let i of o){let l=r.at(-1);l!==void 0&&wt(l,i)?r[r.length-1]={...l,text:l.text+i.text}:r.push(i);}return r}function Wr(t){let e=(i,l)=>i===0&&l===t.length||i>0&&J(t[i-1]),n=false,o=-1;for(let i=0;i<=t.length;i++){let l=t[i],s=i<t.length&&x(l);if(s&&o===-1)o=i;else if(!s&&o!==-1){let a=t.slice(o,i);if(At(a,e(o,i))!==a){n=true;break}o=-1;}}if(!n)return t;let r=[];o=-1;for(let i=0;i<=t.length;i++){let l=t[i],s=i<t.length&&x(l);if(s&&o===-1)o=i;else if(!s&&o!==-1){let a=t.slice(o,i),c=At(a,e(o,i));for(let u of c)r.push(u);o=-1;}!s&&i<t.length&&r.push(l);}return r}function qr(t){let e=false;for(let o=1;o<t.length;o++){let r=t[o-1],i=t[o];if(k(r)&&k(i)&&r.url===i.url){e=true;break}}if(!e)return t;let n=[];for(let o of t){let r=n.at(-1);if(k(o)&&r!==void 0&&k(r)&&r.url===o.url){let i=At([...r.children,...o.children],false);n[n.length-1]={...r,children:i};}else n.push(o);}return n}function $r(t){let e=At(t.children,t.children.length===1);return e.reduce((o,r)=>o+r.text,"")===""?null:e===t.children?t:{...t,children:e}}function Gr(t){let e=false,n=[];for(let a of t)if(k(a)){let c=$r(a);c===null?e=true:(n.push(c),c!==a&&(e=true));}else n.push(a);let o=e?n:t,r=Wr(o),i=qr(r),l=(a,c)=>J(a[c])&&(c===a.length-1||!x(a[c+1])),s=i;if(i.some((a,c)=>l(i,c))){s=[];for(let[a,c]of i.entries())s.push(c),l(i,a)&&s.push({text:""});}return s.length===0?[{text:""}]:s===o&&!e?t:s}function _(t){if(t.length===0)return Fe();let e=false,n=t.map(o=>{let r=Gr(o.children);return r===o.children?o:(e=true,{...o,children:r})});return e?n:t}function U(t){if(x(t))return t.text.length;switch(t.type){case Z:{let e=0;for(let n=0;n<t.children.length;n++)e+=t.children[n].text.length;return e}case ae:return t.displayName.length;case Ee:return t.children[0].text.length;default:return t}}function Ue(t){if(t.length===0)return 0;let e=t.length-1;for(let n of t)for(let o of n.children)e+=U(o);return e}var Xr=1,fn=3;function st(t){return t.nodeType===Xr}function Ve(t,e){return t.tagName.toLowerCase()===e}function Yr(t){if(!st(t))return false;let e=t.tagName.toLowerCase();return e==="p"||e==="div"}function Zr(t){return st(t)&&t.querySelector("p, div")!==null}var Jr=new RegExp("["+String.fromCodePoint(8203)+String.fromCodePoint(65279)+"]","g"),Qr=String.fromCodePoint(160);function Le(t){return t.replaceAll(Jr,"").replaceAll(Qr," ")}function Bo(t,e){let n={...e},o=t.tagName.toLowerCase();(o==="b"||o==="strong")&&(n.bold=true),(o==="i"||o==="em")&&(n.italic=true),o==="u"&&(n.underline=true);let r=t.style;if(r){let i=r.fontWeight;(i==="bold"||Number.parseInt(i,10)>=600&&i!=="")&&(n.bold=true),r.fontStyle==="italic"&&(n.italic=true),r.textDecoration?.includes("underline")&&(n.underline=true);let l=r.color;l&&(n.color=l);let s=r.backgroundColor;s&&(n.backgroundColor=s);}return n}function Ot(t,e,n,o){for(let r=0;r<t.childNodes.length;r++){let i=t.childNodes[r];if(i.nodeType===fn){let s=i.nodeValue??"",a=Le(s);a.length>0&&o.push(jo(a,e));continue}if(!st(i))continue;if(Ve(i,"span")&&i.dataset.userId!==void 0){let s=i.dataset.userId??"",a=i.textContent??"",c=a.startsWith("@")?a.slice(1):a;o.push({type:ae,value:s,displayName:c,children:[{text:""}]});continue}if(Ve(i,"span")&&i.dataset.mentionAnchor!==void 0){let s=i.textContent??"";o.push({type:Ee,children:[{text:s}]});continue}if(Ve(i,"a")){{let s=i.getAttribute("href")??"",a=[];Ho(i,e,a);let c=pn(a);c.some(d=>d.text.length>0)&&o.push({type:Z,url:s,children:c});}continue}if(Ve(i,"br")){o.push({text:"\0BR\0"});continue}let l=Bo(i,e);Ot(i,l,n,o);}}function Ho(t,e,n){for(let o=0;o<t.childNodes.length;o++){let r=t.childNodes[o];if(r.nodeType===fn){let l=r.nodeValue??"",s=Le(l);s.length>0&&n.push(jo(s,e));continue}if(!st(r))continue;if(Ve(r,"br")){n.push({text:"\0BR\0"});continue}let i=Bo(r,e);Ho(r,i,n);}}function jo(t,e){let n={text:t};return e.bold&&(n.bold=true),e.italic&&(n.italic=true),e.underline&&(n.underline=true),e.color&&(n.color=e.color),e.backgroundColor&&(n.backgroundColor=e.backgroundColor),n}var Ko="\0BR\0";function pn(t){let e=[...t];if(e.length===1&&un(e[0]))return [{text:""}];let n=e.length,o=0;for(;o<n&&un(e[n-1-o]);)o+=1;let r=o>=2?o-1:0;n-=o;let i=[];for(let l=0;l<n;l++){let s=e[l];un(s)?Oo(i):i.push(s);}for(let l=0;l<r;l++)Oo(i);return i}function un(t){return "text"in t&&t.text===Ko}function Oo(t){let e=t.at(-1);e!==void 0&&"text"in e&&!("type"in e)?e.text+=`
11
- `:t.push({text:`
12
- `});}function ei(t){let e=[];Ot(t,{},false,e);let n=pn(e);return {type:Ke,children:n.length>0?n:[{text:""}]}}function Bt(t){let e=t.childNodes;if(e.length===0)return Fe();let n=[],o=[];function r(){if(o.length===0)return;let l=pn(o);n.push({type:Ke,children:l.length>0?l:[{text:""}]}),o=[];}function i(l){for(let s of l)if(Yr(s))r(),n.push(ei(s));else if(s.nodeType===fn){let a=s.nodeValue??"",c=Le(a);c.trim().length>0&&o.push({text:c});}else st(s)&&(Ve(s,"br")?o.push({text:Ko}):Zr(s)?(r(),i(s.childNodes)):Ot(s,{},false,o));}return i(e),r(),n.length===0?Fe():_(n)}function ni(t){return Object.entries(t).map(([e,n])=>`${ti(e)}:${n}`).filter(([,e])=>!!e).join(";")}function Uo(t){return "text"in t}function lt(t){return t.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#039;")}function de(t){let e=t.trim(),n=e.replaceAll(/[\u0000- ]/g,""),o=/^([a-z][a-z0-9+.-]*):/i.exec(n);if(!o)return e;let r=o[1].toLowerCase();return new Set(["javascript","data","vbscript"]).has(r)?"":e}function hn(t){let e=t.trim();if(/^[/#?.]/.test(e))return e;let n=/^([^/:?#]+):\d+(?:[/?#]|$)/.exec(e)?.[1];if(n==="localhost"||n?.includes("."))return `https://${e}`;try{return new URL(e),e}catch{return `https://${e}`}}function Vo(t,e){if(!(e.mac?e.metaKey:e.ctrlKey))return {isLinkClick:false,url:null};let o=t?.closest?.("a")??null;if(!o)return {isLinkClick:false,url:null};let r=de(o.getAttribute("href")??"");return {isLinkClick:true,url:r===""?null:r}}function oi(t){return t.text.includes(`
13
- `)?t.text.split(`
14
- `).map(n=>{let o={text:n};return n.length>0&&(t.bold!==void 0&&(o.bold=t.bold),t.italic!==void 0&&(o.italic=t.italic),t.underline!==void 0&&(o.underline=t.underline),t.color!==void 0&&(o.color=t.color),t.backgroundColor!==void 0&&(o.backgroundColor=t.backgroundColor)),o}):[t]}function ri(t){let e=[[]],n=0;for(let o of t)if(Uo(o)){let r=oi(o);for(let i=0;i<r.length;i++)e[n].push(r[i]),i<r.length-1&&(n++,e[n]=[]);}else e[n].push(o);return e}function ge(t){if(!t)return "";function e(n){if(Uo(n)){if(n.text==="")return "";let r=lt(n.text);if(n.bold&&(r=`<b>${r}</b>`),n.italic&&(r=`<i>${r}</i>`),n.underline&&(r=`<u>${r}</u>`),n.color||n.backgroundColor){let i=ni(a$4({color:n.color||void 0,backgroundColor:n.backgroundColor||void 0}));r=`<span style="${lt(i)}">${r}</span>`;}return r}let o=n.children?.map(r=>ge(r)).join("");switch(n.type){case Ke:return ri(n.children).map(i=>`<p>${i.map(s=>ge(s)).join("")}</p>`).join("");case Z:return `<a href="${lt(de(n.url))}">${o}</a>`;case ae:return `<span data-user-id="${lt(n.value)}">${lt(n.displayName)}</span>`;default:return o}}return Array.isArray(t)?t.map(n=>e(n)).join(""):e(t)}function mn(t){let e=new DOMParser().parseFromString(Fo.default.sanitize(t),"text/html");if(!e.body.querySelector("p, div")){let n=e.createElement("p");n.append(...e.body.childNodes),e.body.append(n);}return Bt(e.body)}var ii=new Set(["(","[","{","<",'"',"'","`","\xAB"]),si=new Set([".",",","!","?",":",";",'"',"'","`","\xBB"]),li=new Map([[")","("],["]","["],["}","{"]]);function Wo(t,e){let n=0;for(let o of t)o===e&&n++;return n}function Ht(t){let e=0,n=t.length;for(;e<n&&ii.has(t[e]);)e++;for(;n>e;){let l=t[n-1];if(si.has(l)){n--;continue}let s=li.get(l);if(s!==void 0){let a=t.slice(e,n);if(Wo(a,l)>Wo(a,s)){n--;continue}}break}if(n<=e)return null;let o=t.slice(e,n),r;if(/^https?:\/\//i.test(o))r=o;else if(/^www\./i.test(o)){if(o.length<=4)return null;r=`https://${o}`;}else return null;let i;try{i=new URL(r);}catch{return null}return i.hostname===""?null:{start:e,end:n,url:r}}function ai(t){let e=[],n=/\S+/g,o;for(;(o=n.exec(t))!==null;){let r=Ht(o[0]);if(r){let i=o.index+r.start,l=o.index+r.end;e.push({start:i,end:l,text:t.slice(i,l),url:r.url});}}return e}function qo(t){let e=t.trim();if(e===""||/\s/.test(e))return null;let n=Ht(e);return n&&n.start===0&&n.end===e.length?n.url:null}function ci(t){let e=ai(t.text);if(e.length===0)return null;let n=[],o=0;for(let r of e)r.start>o&&n.push({...t,text:t.text.slice(o,r.start)}),n.push({type:Z,url:r.url,children:[{...t,text:r.text}]}),o=r.end;return o<t.text.length&&n.push({...t,text:t.text.slice(o)}),n}function gn(t){let e=false,n=t.map(o=>{let r=false,i=[];for(let l of o.children){let s=x(l)?ci(l):null;s?(i.push(...s),r=true):i.push(l);}return r?(e=true,{...o,children:i}):o});return e?n:t}function $o(t){return ce(t)?0:U(t)}function Go(t){return t.children.reduce((e,n)=>e+U(n),0)}function xn(t,e,n){return Math.min(Math.max(t,e),n)}function ve(t,e){return t.path[0]!==e.path[0]?t.path[0]<e.path[0]?-1:1:t.path[1]!==e.path[1]?t.path[1]<e.path[1]?-1:1:t.offset!==e.offset?t.offset<e.offset?-1:1:0}function w(t){return ve(t.anchor,t.focus)===0}function bn(t){return ve(t.anchor,t.focus)<=0?t:{anchor:t.focus,focus:t.anchor}}function oe(t,e){let n=xn(e.path[0],0,t.length-1),o=t[n].children,r=xn(e.path[1],0,o.length-1),i=xn(e.offset,0,$o(o[r]));return {path:[n,r],offset:i}}function We(t){let e=t.length-1,n=t[e].children,o=n.length-1;return {path:[e,o],offset:$o(n[o])}}function N(t,e){let n=Math.max(e,0);for(let o=0;o<t.length;o++){let r=t[o],i=Go(r);if(n>i){n-=i+1;continue}let l=r.children;for(let s=0;s<l.length;s++){let a=l[s],c=U(a);if(ce(a)){if(n===0)return {path:[o,s],offset:0};if(n<c)return {path:[o,s+1],offset:0}}else if(n<=c)return {path:[o,s],offset:n};n-=c;}}return We(t)}function P(t,e){let[n,o]=e.path,r=0;for(let l=0;l<n;l++)r+=Go(t[l])+1;let i=t[n].children;for(let l=0;l<o;l++)r+=U(i[l]);return r+e.offset}function Re(t,e,n,o,r){let i=n==="atomic";if(t<o.path[0]||t>r.path[0])return null;let l=0;if(t===o.path[0]){if(e<o.path[1])return null;e===o.path[1]&&(l=i?0:o.offset);}let s=i?1:n;if(t===r.path[0]){if(e>r.path[1])return null;e===r.path[1]&&(s=i?r.offset>0?1:0:r.offset);}return l>=s?null:{from:l,to:s}}function yn(t,e,n){let o=0;for(let r of t.children)n(r,Math.max(e.from-o,0),Math.min(e.to-o,r.text.length)),o+=r.text.length;}function Yo(t,e,n,o){for(let r=e.path[0];r<=n.path[0]&&r<t.length;r++){let i=t[r].children;for(let[l,s]of i.entries())if(!J(s)){if(x(s)){let a=Re(r,l,s.text.length,e,n);a&&o(s,a.from,a.to);}else if(k(s)){let a=Re(r,l,U(s),e,n);a&&yn(s,a,(c,u,d)=>{u<d&&o(c,u,d);});}}}}function Zo(t){return x(t)?t:k(t)?t.children.at(-1)??null:null}function Jo(t,e){let n=oe(t,e),o=t[n.path[0]].children,r=o[n.path[1]],i=n.path[1]>0?Zo(o[n.path[1]-1]):null;if(x(r))return n.offset>0?r:i??r;if(k(r)){if(n.offset===0)return i??r.children[0]??null;let l=0;for(let s of r.children)if(l+=s.text.length,n.offset<=l)return s;return r.children.at(-1)??null}return me(r)?n.offset>0?r.children[0]:i??r.children[0]:i}function Xo(t){let e={};return t.bold&&(e.bold=true),t.italic&&(e.italic=true),t.underline&&(e.underline=true),t.color!==void 0&&(e.color=t.color),t.backgroundColor!==void 0&&(e.backgroundColor=t.backgroundColor),e}function di(t,e){let n={};return t.bold&&e.bold&&(n.bold=true),t.italic&&e.italic&&(n.italic=true),t.underline&&e.underline&&(n.underline=true),t.color!==void 0&&b$a(t.color,e.color)&&(n.color=t.color),t.backgroundColor!==void 0&&b$a(t.backgroundColor,e.backgroundColor)&&(n.backgroundColor=t.backgroundColor),n}function ze(t,e){if(w(e)){let l=Jo(t,e.focus);return l?Xo(l):{}}let n=bn(e),o=oe(t,n.anchor),r=oe(t,n.focus),i=null;return Yo(t,o,r,l=>{let s=Xo(l);i=i===null?s:di(i,s);}),i??{}}function jt(t,e,n){if(n===t)return {doc:t,range:e};let o=_(n);return {doc:o,range:{anchor:N(o,P(t,oe(t,e.anchor))),focus:N(o,P(t,oe(t,e.focus)))}}}function Qo(t,e,n,o){let r={...t,text:t.text.slice(e,n)},i=o(r);if(wt(i,r))return null;let l=[];return e>0&&l.push({...t,text:t.text.slice(0,e)}),l.push(i),n<t.text.length&&l.push({...t,text:t.text.slice(n)}),l}function ui(t,e,n){let o=false,r=[];return yn(t,e,(i,l,s)=>{let a=l<s?Qo(i,l,s,n):null;a?(r.push(...a),o=true):r.push(i);}),o?{...t,children:r}:null}function er(t,e,n,o){let r=false,i=t.map((l,s)=>{if(s<e.path[0]||s>n.path[0])return l;let a=false,c=[];for(let[u,d]of l.children.entries())if(x(d)){let f=Re(s,u,d.text.length,e,n),p=f?Qo(d,f.from,f.to,o):null;p?(c.push(...p),a=true):c.push(d);}else if(k(d)){let f=Re(s,u,U(d),e,n),p=f?ui(d,f,o):null;p?(c.push(p),a=true):c.push(d);}else c.push(d);return a?(r=true,{...l,children:c}):l});return r?i:t}function qe(t,e){let n=bn(e);return [oe(t,n.anchor),oe(t,n.focus)]}function En(t,e,n){if(w(e))return {doc:t,range:e};let[o,r]=qe(t,e),i=false,l=true;return Yo(t,o,r,a=>{i=true,a[n]||(l=false);}),i?jt(t,e,er(t,o,r,l?a=>{let c={...a};return delete c[n],c}:a=>a[n]?a:{...a,[n]:true})):{doc:t,range:e}}function vn(t,e,n,o){if(w(e))return {doc:t,range:e};let[r,i]=qe(t,e);return jt(t,e,er(t,r,i,s=>{if(s[n]===o)return s;let a={...s};return o===void 0?delete a[n]:a[n]=o,a}))}function tr(t,e){let n=[],o=[],r=0;for(let i of t){let l=r+i.text.length;l<=e?n.push(i):r>=e?o.push(i):(n.push({...i,text:i.text.slice(0,e-r)}),o.push({...i,text:i.text.slice(e-r)})),r=l;}return [n,o]}function Se(t,e,n){if(e>=t.length)return [[...t],[]];let o=t.slice(0,e),r=t.slice(e+1),i=t[e];if(x(i))o.push({...i,text:i.text.slice(0,n)}),r.unshift({...i,text:i.text.slice(n)});else if(k(i)){let[l,s]=tr(i.children,n);o.push({...i,children:l}),r.unshift({...i,children:s});}else n===0?r.unshift(i):o.push(i);return [o,r]}function Rn(t,e){let[n,o]=qe(t,e);for(let r=n.path[0];r<=o.path[0]&&r<t.length;r++)for(let[i,l]of t[r].children.entries()){if(!k(l))continue;let s={path:[r,i],offset:0},a={path:[r,i],offset:U(l)};if(ve(n,a)<=0&&ve(o,s)>=0)return {paragraphIndex:r,inlineIndex:i,link:l}}return null}function nr(t,e){let n=Rn(t,e);if(!n)return null;let{paragraphIndex:o,inlineIndex:r,link:i}=n;return {url:i.url,range:{anchor:{path:[o,r],offset:0},focus:{path:[o,r],offset:U(i)}}}}function or(t,e){let[n,o]=qe(t,e);for(let r=n.path[0];r<=o.path[0]&&r<t.length;r++)for(let[i,l]of t[r].children.entries()){if(x(l))continue;let s=J(l)?"atomic":U(l);if(Re(r,i,s,n,o))return true}return false}function fi(t,e,n,o){let r=[],i=(l,s,a)=>{s<a&&r.push({...l,text:l.text.slice(s,a)});};for(let[l,s]of t[e].children.entries())if(!J(s)){if(x(s)){let a=Re(e,l,s.text.length,n,o);a&&i(s,a.from,a.to);}else if(k(s)){let a=Re(e,l,U(s),n,o);a&&yn(s,a,i);}}return r}function Tn(t,e,n){if(w(e))return {doc:t,range:e};let[o,r]=qe(t,e);for(let s=o.path[0];s<=r.path[0]&&s<t.length;s++)for(let[a,c]of t[s].children.entries())if(J(c)&&Re(s,a,"atomic",o,r))return {doc:t,range:e};let i=false,l=t.map((s,a)=>{if(a<o.path[0]||a>r.path[0])return s;let c=fi(t,a,o,r);if(c.length===0)return s;let u=s.children,[d]=a===o.path[0]?Se(u,o.path[1],o.offset):[[]],f=a===r.path[0]?Se(u,r.path[1],r.offset)[1]:[];return i=true,{...s,children:[...d,{type:Z,url:n,children:c},...f]}});return i?jt(t,e,l):{doc:t,range:e}}function rr(t,e,n){let o=Rn(t,e);if(!o||o.link.url===n)return {doc:t,range:e};let{paragraphIndex:r,inlineIndex:i,link:l}=o,s=t.map((a,c)=>c!==r?a:{...a,children:a.children.map((u,d)=>d===i?{...l,url:n}:u)});return {doc:_(s),range:e}}function ir(t,e){let n=Rn(t,e);if(!n)return {doc:t,range:e};let{paragraphIndex:o,inlineIndex:r,link:i}=n,l=t.map((s,a)=>a!==o?s:{...s,children:s.children.flatMap((c,u)=>u===r?i.children:[c])});return jt(t,e,l)}function $e(t,e){if(w(e))return {doc:t,range:e};let[n,o]=qe(t,e);if(ve(n,o)===0)return {doc:t,range:e};let r=P(t,n),i=Se(t[n.path[0]].children,n.path[1],n.offset)[0],l=Se(t[o.path[0]].children,o.path[1],o.offset)[1],s={...t[n.path[0]],children:[...i,...l]},a=_([...t.slice(0,n.path[0]),s,...t.slice(o.path[0]+1)]),c=N(a,r);return {doc:a,range:{anchor:c,focus:c}}}function at(t,e,n){let o=oe(t,e);if(n==="")return {doc:t,range:{anchor:o,focus:o}};let r=Jo(t,o),i=r?{...r,text:n}:{text:n},l=o.path[0],s=t[l].children,a=s[o.path[1]],c;if(k(a)&&o.offset>0&&o.offset<U(a)){let[f,p]=tr(a.children,o.offset),m={...a,children:[...f,i,...p]};c=s.map((h,C)=>C===o.path[1]?m:h);}else {let[f,p]=Se(s,o.path[1],o.offset);c=[...f,i,...p];}let u=_(t.map((f,p)=>p===l?{...f,children:c}:f)),d=N(u,P(t,o)+n.length);return {doc:u,range:{anchor:d,focus:d}}}function sr(t,e,n){let o=_(n),r=Ue(o),i=t,l;if(w(e))l=oe(t,e.focus);else {let p=$e(t,e);i=p.doc,l=p.range.focus;}if(o.length===1&&r===0)return {doc:i,range:{anchor:l,focus:l}};let s=l.path[0],[a,c]=Se(i[s].children,l.path[1],l.offset),u=o.length===1?[{...i[s],children:[...a,...o[0].children,...c]}]:[{...i[s],children:[...a,...o[0].children]},...o.slice(1,-1),{...o.at(-1),children:[...o.at(-1).children,...c]}],d=_([...i.slice(0,s),...u,...i.slice(s+1)]),f=N(d,P(i,l)+r);return {doc:d,range:{anchor:f,focus:f}}}function lr(t,e){if(w(e))return at(t,e.focus,`
15
- `);let n=$e(t,e);return at(n.doc,n.range.focus,`
16
- `)}function ar(t,e){for(let[n,o]of t.entries()){let r=o.children.indexOf(e);if(r!==-1)return [n,r]}return null}function cr(t){for(let[e,n]of t.entries())for(let[o,r]of n.children.entries())if(me(r))return [e,o];return null}function dr(t){let e=We(t);return {anchor:e,focus:e}}function ur(t,e){let n=t,o;if(w(e))o=oe(t,e.focus);else {let d=$e(t,e);n=d.doc,o=d.range.focus;}let r={type:Ee,children:[{text:""}]},i=o.path[0],[l,s]=Se(n[i].children,o.path[1],o.offset),a=_(n.map((d,f)=>f===i?{...d,children:[...l,r,...s]}:d)),u={path:ar(a,r)??[0,0],offset:0};return {doc:a,range:{anchor:u,focus:u}}}function fr(t,e){let n=cr(t);if(!n)return {doc:t,range:dr(t)};let[o,r]=n,i={type:ae,value:e.id,displayName:e.displayName,children:[{text:""}]},l=_(t.map((u,d)=>d===o?{...u,children:u.children.map((f,p)=>p===r?i:f)}:u)),[s,a]=ar(l,i)??[o,r],c={path:[s,a+1],offset:0};return {doc:l,range:{anchor:c,focus:c}}}function pr(t,e,n="end"){let o=cr(t);if(!o)return {doc:t,range:dr(t)};let[r,i]=o,l=t[r].children,s=i>0?Zo(l[i-1]):null,a=s?{...s,text:e}:{text:e},c=P(t,{path:[r,i],offset:0})+(n==="end"?e.length:0),u=_(t.map((f,p)=>p===r?{...f,children:l.map((m,h)=>h===i?a:m)}:f)),d=N(u,c);return {doc:u,range:{anchor:d,focus:d}}}function pi(t){let e=[];return t.color&&e.push(`color:${t.color}`),t.backgroundColor&&e.push(`background-color:${t.backgroundColor}`),e.join(";")}function hi(t){for(let e of t.children)if(J(e)||k(e)&&e.children.map(o=>o.text).join("").length>0||x(e)&&e.text.length>0)return false;return true}function hr(t,e,n,o){if(n.text==="")return;let r=n.text.split(`
17
- `);for(let i=0;i<r.length;i++){let l=r[i],s=i===r.length-1;if(l.length>0){let c=t.createTextNode(l);if(n.underline){let d=t.createElement("u");d.append(c),c=d;}if(n.italic){let d=t.createElement("i");d.append(c),c=d;}if(n.bold){let d=t.createElement("b");d.append(c),c=d;}let u=pi(n);if(u){let d=t.createElement("span");d.setAttribute("style",u),d.append(c),c=d;}e.append(c);}(!s||l===""&&r.length>1&&o)&&e.append(t.createElement("br"));}}function mi(t,e,n,o){if(x(n)){hr(t,e,n,o);return}switch(n.type){case Z:{let r=t.createElement("a");r.setAttribute("href",de(n.url)),r.className=a$q({size:"sm",variant:"inline"});for(let i of n.children)hr(t,r,i,false);e.append(r);break}case ae:{let r=t.createElement("span");r.setAttribute("contenteditable","false"),r.dataset.userId=n.value,r.textContent=`@${n.displayName}`,e.append(r);break}case Ee:{let r=t.createElement("span");r.setAttribute("contenteditable","false"),r.dataset.mentionAnchor="true",r.textContent=n.children[0].text,e.append(r);break}}}function kn(t){return x(t)?t.text!=="":k(t)?t.children.some(e=>e.text!==""):true}function gi(t,e){let n=t.createElement("p");if(hi(e))return n.append(t.createElement("br")),n;let o=-1;for(let r=e.children.length-1;r>=0;r--)if(kn(e.children[r])){o=r;break}for(let[r,i]of e.children.entries())mi(t,n,i,r===o);return n}function ct(t,e){let n=e.ownerDocument,o=n.createDocumentFragment();for(let r of t)o.append(gi(n,r));e.replaceChildren(o);}var xi=1,bi=3,yi=11;function re(t){return t.nodeType===xi}function gr(t){return t.nodeType===yi&&"host"in t}function Ft(t){return t.nodeType===bi}function dt(t,e){return t.tagName.toLowerCase()===e}function Ei(t){return dt(t,"span")?t.getAttribute("contenteditable")==="false":false}function vi(t,e,n,o,r){if(o===t){let s=t.childNodes,a=Math.min(r,s.length);return a===0?{found:true,point:{path:[n,0],offset:0}}:Ri(e,n,a)}let i=t.childNodes,l=0;for(let s=0;s<e.children.length;s++){let a=e.children[s];if(x(a)){let c=Ut(e.children,s),u=br(a.text,i,l,n,s,o,r,c);if(u.found)return u;l+=Pe(a.text,c);}else if(k(a)){if(l>=i.length)continue;let c=i[l];if(!re(c)||!dt(c,"a")){l++;continue}let u=Ti(a,c,n,s,o,r);if(u.found)return u;l++;}else if(ce(a)||me(a)){if(l>=i.length)continue;let c=i[l];if(!re(c)||!Ei(c)){l++;continue}if(o===c||(re(o)||Ft(o))&&h(c,o))return {found:true,point:{path:[n,s+1],offset:0}};l++;}}return {found:false}}function Ri(t,e,n){let o=0;for(let l=0;l<t.children.length;l++){let s=t.children[l],a=x(s)?Pe(s.text,Ut(t.children,l)):1;if(o+a>=n){if(x(s))return {found:true,point:{path:[e,l],offset:xr(s.text,n-o)}};if(J(s))return {found:true,point:{path:[e,l+1],offset:0}};{let c=s.children.reduce((u,d)=>u+d.text.length,0);return {found:true,point:{path:[e,l],offset:c}}}}o+=a;}let r=t.children.length-1,i=t.children[r];if(x(i))return {found:true,point:{path:[e,r],offset:i.text.length}};if(J(i))return {found:true,point:{path:[e,r+1],offset:0}};if(k(i)){let l=i.children.reduce((s,a)=>s+a.text.length,0);return {found:true,point:{path:[e,r],offset:l}}}return {found:false}}function Ut(t,e){for(let n=e+1;n<t.length;n++)if(kn(t[n]))return false;return true}function Pe(t,e){if(t==="")return 0;let n=t.split(`
18
- `),o=0;for(let r=0;r<n.length;r++)n[r].length>0&&o++,r<n.length-1&&o++;return e&&t.endsWith(`
19
- `)&&o++,o}function xr(t,e){if(t==="")return 0;let n=t.split(`
20
- `),o=0,r=0;for(let i=0;i<n.length&&!(o>=e);i++){if(n[i].length>0){if(o+1>=e){r+=n[i].length,o++;break}r+=n[i].length,o++;}if(i<n.length-1){if(o+1>=e){r++,o++;break}r++,o++;}}return t.endsWith(`
21
- `)&&o<e&&(r=t.length),Math.min(r,t.length)}function br(t,e,n,o,r,i,l,s=false){if(t==="")return {found:false};let a=t.split(`
22
- `),c=n,u=0;for(let d=0;d<a.length;d++){let f=a[d],p=d===a.length-1;if(f.length>0&&c<e.length){let m=e[c],h$1=Vt(m);if(h$1!==null){if(i===h$1){let C=Math.min(l,f.length);return {found:true,point:{path:[o,r],offset:u+C}}}if(re(i)&&h(i,h$1))return {found:true,point:{path:[o,r],offset:u+(l===0?0:f.length)}}}u+=f.length,c++;}if(p){if(p&&s&&t.endsWith(`
23
- `)&&f===""&&c<e.length){let m=e[c];if(re(m)&&dt(m,"br")&&i===m)return {found:true,point:{path:[o,r],offset:u}};c++;}}else if(c<e.length){let m=e[c];if(re(m)&&dt(m,"br")&&i===m)return {found:true,point:{path:[o,r],offset:u+(l===0?0:1)}};u++,c++;}}return {found:false}}function Ti(t,e,n,o,r,i){if(!re(e))return {found:false};if(r===e){let c=e.childNodes,u=Math.min(i,c.length),d=0,f=0,p=0;for(let m of t.children){let h=Pe(m.text,false);if(p+h>=u){f=d+xr(m.text,u-p);break}d+=m.text.length,p+=h;}return p>=t.children.reduce((m,h)=>m+Pe(h.text,false),0)&&(f=t.children.reduce((m,h)=>m+h.text.length,0)),{found:true,point:{path:[n,o],offset:f}}}if(!h(e,r))return {found:false};let l=e.childNodes,s=0,a=0;for(let c of t.children){let u=br(c.text,l,a,n,o,r,i);if(u.found)return {found:true,point:{path:[n,o],offset:s+u.point.offset}};s+=c.text.length,a+=Pe(c.text,false);}return {found:false}}function Vt(t){if(Ft(t))return t;if(re(t)){let e=t;for(;re(e)&&e.childNodes.length===1;){let n=e.childNodes[0];if(Ft(n))return n;if(re(n))e=n;else break}}return null}function Kt(t,e,n,o){try{if(n!==t&&!h(t,n)||e.length===0)return null;if(n===t){let i=Math.min(o,t.childNodes.length);if(i===0)return {path:[0,0],offset:0};let l=Math.min(i,e.length)-1,s=e[l];if(!s)return null;let a=s.children.length-1,c=s.children[a];if(!c)return null;let u=x(c)?c.text.length:k(c)?c.children.reduce((d,f)=>d+f.text.length,0):0;return {path:[l,a],offset:u}}let r=t.children;for(let i=0;i<e.length;i++){let l=r[i];if(!l)return null;let s=e[i];if(n!==l&&!h(l,n))continue;let a=vi(l,s,i,n,o);return a.found?a.point:null}return null}catch{return null}}function mr(t,e,n){try{let[o,r]=n.path,i=n.offset;if(o<0||o>=e.length)return null;let l=e[o];if(r<0||r>=l.children.length)return null;let s=l.children[r],a=t.children[o];if(!a)return null;let c=a.childNodes,u=0;for(let d=0;d<r;d++){let f=l.children[d];x(f)?u+=Pe(f.text,Ut(l.children,d)):u++;}if(x(s))return yr(s.text,i,c,u,a,Ut(l.children,r));if(k(s)){if(u>=c.length)return null;let d=c[u];return !re(d)||!dt(d,"a")?null:ki(s,i,d)}else if(ce(s)||me(s)){let d=u+1;if(d<c.length){let f=c[d];if(Ft(f))return {node:f,offset:0}}return {node:a,offset:Math.min(d,a.childNodes.length)}}return null}catch{return null}}function yr(t,e,n,o,r,i=false){if(t==="")return {node:r,offset:o};let l=t.split(`
24
- `),s=o,a=0;for(let c=0;c<l.length;c++){let u=l[c],d=c===l.length-1;if(u.length>0&&s<n.length){let f=n[s];if(e>=a&&e<=a+u.length){let p=Vt(f);return p!==null?{node:p,offset:e-a}:{node:r,offset:s}}a+=u.length,s++;}if(d){if(d&&t.endsWith(`
25
- `)&&u===""&&s<=n.length){if(e===a)return {node:r,offset:Math.min(s,r.childNodes.length)};i&&s++;}}else if(s<n.length){if(e===a)return {node:r,offset:s};a++,s++;}}if(s>o&&s-1<n.length){let c=n[s-1],u=Vt(c);return u!==null?{node:u,offset:u.length}:{node:r,offset:s}}return {node:r,offset:Math.min(s,r.childNodes.length)}}function ki(t,e,n){let o=n.childNodes,r=0,i=0;for(let l of t.children){let s=l.text.length;if(e<=r+s)return yr(l.text,e-r,o,i,n);r+=s,i+=Pe(l.text,false);}if(o.length>0){let l=n.lastChild,s=l===null?null:Vt(l);return s!==null?{node:s,offset:s.length}:{node:n,offset:o.length}}return {node:n,offset:0}}function Wt(t){let e=t.getRootNode();if(typeof e.getSelection=="function")return e.getSelection();let n=t.ownerDocument;if(!n)return null;let o=n.defaultView;return o?o.getSelection():null}function Ci(t,e){let n=t.getComposedRanges;if(typeof n!="function")return null;let o;try{o=n.call(t,{shadowRoots:[e]});}catch{try{o=n.call(t,e);}catch{return null}}let r=o?.[0];return r?{startContainer:r.startContainer,startOffset:r.startOffset,endContainer:r.endContainer,endOffset:r.endOffset}:null}function Cn(t,e){let n=e.rangeCount>0?e.getRangeAt(0):null,o=n?{startContainer:n.startContainer,startOffset:n.startOffset,endContainer:n.endContainer,endOffset:n.endOffset}:null;if(o&&h(t,o.startContainer))return o;let r=t.getRootNode();if(gr(r)){let i=Ci(e,r);if(i&&h(t,i.startContainer))return i}return o}function qt(t,e){try{let n=Wt(t);if(!n)return null;let{anchorNode:o,focusNode:r}=n;if(o&&r&&h(t,o)&&h(t,r)){let a=Kt(t,e,o,n.anchorOffset),c=Kt(t,e,r,n.focusOffset);if(a!==null&&c!==null)return {anchor:a,focus:c}}let i=Cn(t,n);if(!i)return null;let l=Kt(t,e,i.startContainer,i.startOffset);if(l===null)return null;let s=Kt(t,e,i.endContainer,i.endOffset);return s===null?null:{anchor:l,focus:s}}catch{return null}}function De(t,e,n){try{let o=mr(t,e,n.anchor);if(o===null)return;let r=mr(t,e,n.focus);if(r===null)return;let i=t.ownerDocument;if(!i)return;let l=Wt(t);if(!l)return;if(ve(n.anchor,n.focus)>0||gr(t.getRootNode())){l.setBaseAndExtent(o.node,o.offset,r.node,r.offset);return}let a=i.createRange();a.setStart(o.node,o.offset),a.setEnd(r.node,r.offset),l.removeAllRanges(),l.addRange(a);}catch{}}var Er="typing";var $t=class{undoStack=[];redoStack=[];now;maxDepth;lastKind=null;lastTime=null;constructor(e={}){this.now=e.now??Date.now,this.maxDepth=e.maxDepth??100;}record(e,n){let o=this.now();this.redoStack.length>0&&(this.redoStack=[]);let r=n===Er&&this.lastKind===Er&&this.lastTime!==null&&o-this.lastTime<=1e3;this.lastKind=n,this.lastTime=o,!r&&(this.undoStack.push(e),this.undoStack.length>this.maxDepth&&this.undoStack.shift());}undo(e){let n=this.undoStack.pop();return n?(this.redoStack.push(e),this.lastKind=null,this.lastTime=null,n):null}redo(e){let n=this.redoStack.pop();return n?(this.undoStack.push(e),this.lastKind=null,this.lastTime=null,n):null}clear(){this.undoStack=[],this.redoStack=[],this.lastKind=null,this.lastTime=null;}get canUndo(){return this.undoStack.length>0}get canRedo(){return this.redoStack.length>0}};var Mi=1,ut=class t{doc=Fe();lastKnownHtml="";lastAppliedValue=null;cachedRange=null;needsSelectionRestore=false;composing=false;pending=null;preservePendingSelectionChanges=0;history=new $t;opts;el=null;pendingExternalRender=null;keyboardShortcutsOverride=void 0;constructor(e={}){this.opts=e,this.lastKnownHtml=ge(this.doc);}setKeyboardShortcutsEnabled(e){this.keyboardShortcutsOverride=e;}attach(e){this.el=e,ct(this.doc,e),this.cachedRange&&De(e,this.doc,this.cachedRange);let n=this.handleBeforeInputBound,o=this.handleInputBound,r=this.handlePasteBound,i=this.handleCompositionStartBound,l=this.handleCompositionEndBound,s=this.handleSelectionChangeBound,a=this.handlePointerDownBound,c=this.handleFocusBound,u=e.ownerDocument;return e.addEventListener("beforeinput",n),e.addEventListener("input",o),e.addEventListener("paste",r),e.addEventListener("compositionstart",i),e.addEventListener("compositionend",l),e.addEventListener("pointerdown",a),e.addEventListener("focus",c),u.addEventListener("selectionchange",s),()=>{e.removeEventListener("beforeinput",n),e.removeEventListener("input",o),e.removeEventListener("paste",r),e.removeEventListener("compositionstart",i),e.removeEventListener("compositionend",l),e.removeEventListener("pointerdown",a),e.removeEventListener("focus",c),u.removeEventListener("selectionchange",s),this.el===e&&(this.el=null);}}handleBeforeInputBound=e=>{let n=e;if(j$2(n)===this.el){if(this.opts.isReadOnly?.()){n.preventDefault();return}this.refreshSelectionFromDom(),this.handleBeforeInput(n);}};handleInputBound=e=>{j$2(e)===this.el&&(this.composing||this.syncFromDom());};handlePasteBound=e=>{let n=e,o=j$2(n);!o||!h(this.el,o)||(o.nodeType===Mi?o:o.parentElement)?.closest('input, [contenteditable="false"]')||(n.preventDefault(),!this.opts.isReadOnly?.()&&(this.composing||(this.refreshSelectionFromDom(),this.insertPastedData(n.clipboardData))));};handlePointerDownBound=()=>{this.preservePendingSelectionChanges=0,this.needsSelectionRestore=false;};handleFocusBound=()=>{this.needsSelectionRestore&&(this.needsSelectionRestore=false,!(!this.el||!this.cachedRange)&&De(this.el,this.doc,this.cachedRange));};handleCompositionStartBound=()=>{this.composing=true;};handleCompositionEndBound=()=>{if(this.composing=false,this.pendingExternalRender){let e=this.pendingExternalRender;this.pendingExternalRender=null,e();return}this.syncFromDom();};handleSelectionChangeBound=()=>{this.el&&this.handleSelectionChange();};refreshSelectionFromDom(){if(!this.el)return;let e=qt(this.el,this.doc);e&&(this.cachedRange=e);}getDoc(){return this.doc}getValue(){return ge(this.doc)}setValue(e,n={}){if(e===this.lastKnownHtml||e===this.lastAppliedValue)return;let o,r;try{o=_(mn(e)),r=ge(o);}catch(a){process.env.NODE_ENV!=="production"&&console.error("[Editor] setValue failed to parse value:",a);return}let i=this.cachedRange?P(this.doc,this.cachedRange.anchor):null,l=t.docHasMentionInput(this.doc);this.doc=o,this.lastKnownHtml=r,this.lastAppliedValue=e,this.pending=null,this.history.clear();let s=()=>{if(this.el&&(ct(o,this.el),i!==null)){let a=Math.min(i,Ue(o)),c=N(o,a),u={anchor:c,focus:c};this.cachedRange=u,this.hasFocus()?De(this.el,o,u):(this.needsSelectionRestore=true,n.emit||this.emitSelectionChange());}};this.el&&(this.composing?this.pendingExternalRender=s:s()),l&&!t.docHasMentionInput(o)&&this.opts.onMentionInputRemoved?.(),n.emit&&(this.opts.onChange?.(r),this.emitSelectionChange());}static docHasMentionInput(e){return e.some(n=>n.children.some(o=>me(o)))}exec(e,...n){this.refreshSelectionFromDom();let o=this.cachedRange,r=this.doc,i=o??this.collapsedAtDocEnd(),l={doc:r,range:o},s;try{s=this.dispatchCommand(e,n);}catch(a){process.env.NODE_ENV!=="production"&&console.error(`[Editor] command "${e}" threw:`,a);return}if(s.doc===r){if(e==="toggleMark"&&w(i)){let[a]=n;this.setPendingMark(a,i),this.emitSelectionChange();return}if(e==="setMarkValue"&&w(i)){let[a,c]=n;this.setPendingColorMark(a,c,i),this.emitSelectionChange();return}this.pending=null;return}if(this.pending=null,e==="insertSoftBreak"){let a=this.mergePendingMarks(ze(r,i));if(Object.keys(a).length>0){let c=P(s.doc,s.range.anchor);this.pending={marks:a,caretOffset:c},this.preservePendingSelectionChanges=10;}}this.history.record(l,e),this.applyDocChange(s.doc,s.range,true);}undo(){if(!this.history.canUndo)return;let e={doc:this.doc,range:this.cachedRange},n=this.history.undo(e);n&&(this.pending=null,this.applyDocChange(n.doc,n.range,true));}redo(){if(!this.history.canRedo)return;let e={doc:this.doc,range:this.cachedRange},n=this.history.redo(e);n&&(this.pending=null,this.applyDocChange(n.doc,n.range,true));}canUndo(){return this.history.canUndo}canRedo(){return this.history.canRedo}focus(){this.el?.focus();}hasFocus(){return this.el?h(this.el,f$1(this.el)):false}setCaretPosition(e){if(!this.el)return;let n=N(this.doc,e);this.select({anchor:n,focus:n});}select(e){this.el&&(this.el.focus(),this.cachedRange=e,De(this.el,this.doc,e));}selectStart(){this.setCaretPosition(0);}selectEnd(){let e=We(this.doc);this.select({anchor:e,focus:e});}getSelectionState(){return this.buildSelectionState(this.cachedRange)}buildSelectionState(e){let n=e?ze(this.doc,e):{},o=this.mergePendingMarks(n),r=e?nr(this.doc,e):null;return {marks:o,link:r,range:e}}mergePendingMarks(e){return this.pending?this.pending.marks:e}setPendingMark(e,n){let o=P(this.doc,n.anchor),r=ze(this.doc,n),i=this.pending?{...this.pending.marks}:{...r};i[e]?delete i[e]:i[e]=true,this.pending={marks:i,caretOffset:o};}setPendingColorMark(e,n,o){let r=P(this.doc,o.anchor),i=ze(this.doc,o),l=this.pending?{...this.pending.marks}:{...i};n===void 0?delete l[e]:l[e]=n,this.pending={marks:l,caretOffset:r};}emitSelectionChange(){this.opts.onSelectionChange&&this.opts.onSelectionChange(this.buildSelectionState(this.cachedRange));}applyDocChange(e,n,o){if(this.doc=e,this.cachedRange=n,this.lastAppliedValue=null,this.el&&!this.composing&&(ct(e,this.el),n&&De(this.el,e,n)),o){let r=ge(e);this.lastKnownHtml=r,this.opts.onChange?.(r),this.emitSelectionChange();}}handleBeforeInput(e){let{inputType:n}=e;if(n==="insertParagraph"||n==="insertLineBreak"){e.preventDefault();let r=this.detectAutoLinkBeforeCaret();this.exec("insertSoftBreak"),r&&this.applyAutoLink(r);return}if(n==="insertText"&&e.data===" "){let r=this.detectAutoLinkBeforeCaret();if(r){e.preventDefault(),this.exec("insertText"," "),this.applyAutoLink(r);return}}if(n==="insertFromPaste"||n==="insertFromDrop"){e.preventDefault(),this.handlePasteInput(e);return}let o=this.keyboardShortcutsOverride??this.opts.areKeyboardShortcutsEnabled?.()??true;if(n==="formatBold"){e.preventDefault(),o&&this.exec("toggleMark","bold");return}if(n==="formatItalic"){e.preventDefault(),o&&this.exec("toggleMark","italic");return}if(n==="formatUnderline"){e.preventDefault(),o&&this.exec("toggleMark","underline");return}if(n==="historyUndo"){e.preventDefault(),o&&this.undo();return}if(n==="historyRedo"){e.preventDefault(),o&&this.redo();return}if(n==="insertText"&&e.data==="@"&&this.shouldTriggerMention()&&this.opts.canStartMention?.()!==false){e.preventDefault();let r=this.doc;this.exec("insertMentionInput"),this.doc===r?this.exec("insertText","@"):this.opts.onMentionTrigger?.();}}shouldTriggerMention(){if(!this.cachedRange)return true;if(!w(this.cachedRange))return false;let e=this.cachedRange,[n,o]=e.anchor.path,r=e.anchor.offset,i=this.doc;if(n>=i.length)return true;let l=i[n];if(o>=l.children.length)return true;let s=l.children[o];if(r===0&&o===0)return true;let a=null;if(x(s)){let c=s.text;if(r>0)a=c[r-1];else if(o>0)a=this.lastCharOf(l.children[o-1]);else return true}else if(k(s)){let c=s.children.map(u=>u.text).join("");if(r>0)a=c[r-1]??null;else if(o>0)a=this.lastCharOf(l.children[o-1]);else return true}else if(r===0&&o>0)a=this.lastCharOf(l.children[o-1]);else return true;return a===null?true:/^[\s"']$/.test(a)}lastCharOf(e){if(x(e)){let n=e.text;return n.length>0?n.at(-1)??null:null}if(k(e)){let o=(e.children??[]).at(-1);return o&&o.text.length>0?o.text.at(-1)??null:null}if(ce(e)){let n=e.displayName??"";return n.length>0?n.at(-1)??null:null}return null}autoLinkEnabled(){return this.opts.autoLink?.()??true}detectAutoLinkBeforeCaret(){return !this.autoLinkEnabled()||this.composing?null:this.findAutoLinkBeforeCaret()}findAutoLinkBeforeCaret(){let e=this.cachedRange;if(!e||!w(e))return null;let n=e.anchor,o=this.doc,r=n.path[0];if(r>=o.length)return null;let i=o[r].children,l=n.path[1],s=n.offset;if(l>=i.length){l=i.length-1;let f=i[l];if(!f||!x(f))return null;s=f.text.length;}else {let f=i[l];x(f)&&s>f.text.length&&(s=f.text.length);}let a=i[l];if(x(a)&&s<a.text.length&&!/\s/.test(a.text[s]))return null;let c="";for(;;){let f=i[l];if(!f||!x(f))break;if(s>0){let p=f.text[s-1];if(/\s/.test(p))break;c=p+c,s-=1;}else {if(l===0)break;let p=i[l-1];if(!x(p))break;l-=1,s=p.text.length;}}if(c==="")return null;let u=Ht(c);if(!u)return null;let d=P(o,{path:[r,l],offset:s});return {startAbs:d+u.start,endAbs:d+u.end,url:u.url}}applyAutoLink(e){let n=de(e.url);if(n==="")return;let o=this.doc,r={anchor:N(o,e.startAbs),focus:N(o,e.endAbs)},i={doc:o,range:this.cachedRange},l=Tn(o,r,n);if(l.doc===o)return;let s=this.cachedRange?P(o,this.cachedRange.anchor):e.endAbs;this.history.record(i,"wrapLink");let a=N(l.doc,s);this.applyDocChange(l.doc,{anchor:a,focus:a},true);}handlePasteInput(e){this.insertPastedData(e.dataTransfer);}resolvePastedMentions(e){let n=this.opts.resolveMention;return n?e.map(o=>({...o,children:o.children.map(r=>{if(!ce(r))return r;let i=n(r.value);return i===void 0?{text:`@${r.displayName}`}:{...r,displayName:i}})})):e}insertPastedData(e){if(!e)return;let n=this.autoLinkEnabled(),o=e.getData("text/plain");if(n&&o){let i=this.cachedRange;if(i&&!w(i)&&i.anchor.path[0]===i.focus.path[0]){let l=qo(o),s=l?de(l):"";if(s&&!or(this.doc,i)){this.exec("wrapLink",s);return}}}let r=e.getData("text/html");if(r)try{let i=_(this.resolvePastedMentions(mn(r)));n&&(i=_(gn(i))),this.exec("insertFragment",i);return}catch(i){process.env.NODE_ENV!=="production"&&console.error("[Editor] failed to parse pasted HTML:",i);}if(o){let i=Le(o.replaceAll(`\r
26
- `,`
27
- `).replaceAll("\r",`
28
- `)),l=_([{type:"p",children:[{text:i}]}]);n&&(l=_(gn(l))),this.exec("insertFragment",l);}}syncFromDom(){if(!this.el||this.composing)return;let e=this.doc,n={doc:e,range:this.cachedRange},o=Bt(this.el),r=qt(this.el,o);if(!(ge(o)!==this.lastKnownHtml)){if(r){let d=this.cachedRange;this.cachedRange=r,(!d||!this.rangesEqual(d,r))&&this.emitSelectionChange();}return}this.history.record(n,"typing");let s=o,a=r,c=false;if(!a&&n.range){let d=Math.max(Ue(o)-Ue(e),0),f=this.pending?this.pending.caretOffset:P(e,n.range.anchor),p=N(o,f+d);a={anchor:p,focus:p};}if(this.pending){let d=this.pending.marks,f=a;if(f){let p=this.applyPendingMarks(o,n.range,f);p.doc!==o&&(s=p.doc,a=p.range,c=true),this.pending=a?{marks:d,caretOffset:P(s,a.anchor)}:null,a&&(this.preservePendingSelectionChanges=10);}else this.pending=null;}this.doc=s,this.cachedRange=a;let u=ge(s);this.lastKnownHtml=u,this.lastAppliedValue=null,c&&(ct(s,this.el),a&&De(this.el,s,a)),this.opts.onChange?.(u),this.emitSelectionChange();}applyPendingMarks(e,n,o){if(!this.pending||!n||!o)return {doc:e,range:o??{anchor:{path:[0,0],offset:0},focus:{path:[0,0],offset:0}}};let r=this.pending.caretOffset,i=o?P(e,o.anchor):r;if(i<=r)return {doc:e,range:o??{anchor:{path:[0,0],offset:0},focus:{path:[0,0],offset:0}}};let l=this.applyPendingMarkSnapshot(e,this.pending.marks,r,i),s=N(l,i);return {doc:l,range:{anchor:s,focus:s}}}applyPendingMarkSnapshot(e,n,o,r){let i=e,l=()=>({anchor:N(i,o),focus:N(i,r)});for(let s of ["bold","italic","underline"]){let a=l(),c=!!n[s],u=!!ze(i,a)[s];if(c!==u){let d=En(i,a,s);d.doc!==i&&(i=d.doc);}}for(let s of ["color","backgroundColor"]){let a=l(),c=n[s],u=ze(i,a)[s];if(!b$a(c,u)){let d=vn(i,a,s,c);d.doc!==i&&(i=d.doc);}}return i}handleSelectionChange(){if(!this.el)return;let e=Wt(this.el);if(!e)return;let n=Cn(this.el,e);if(!n||!h(this.el,n.startContainer))return;let o=qt(this.el,this.doc),r=this.cachedRange;this.preservePendingSelectionChanges>0?(this.preservePendingSelectionChanges-=1,this.pending&&o&&(this.pending={...this.pending,caretOffset:P(this.doc,o.anchor)})):this.pending&&o&&P(this.doc,o.anchor)!==this.pending.caretOffset&&(this.pending=null),o!==null&&(this.cachedRange=o),(!r||!o||!this.rangesEqual(r,o))&&this.emitSelectionChange();}dispatchCommand(e,n){let o=this.doc,r=this.cachedRange??this.collapsedAtDocEnd();switch(e){case "toggleMark":{let[i]=n;return En(o,r,i)}case "setMarkValue":{let[i,l]=n;return vn(o,r,i,l)}case "wrapLink":{let[i]=n;return Tn(o,r,i)}case "updateLinkUrl":{let[i]=n;return rr(o,r,i)}case "unwrapLink":return ir(o,r);case "deleteRange":return $e(o,r);case "insertText":{let[i]=n;if(!w(r)){let l=$e(o,r);return at(l.doc,l.range.focus,i)}return at(o,r.anchor,i)}case "insertFragment":{let[i]=n;return sr(o,r,i)}case "insertSoftBreak":return lr(o,r);case "insertMentionInput":return ur(o,r);case "confirmMention":{let[i]=n;return fr(o,i)}case "removeMentionInput":{let[i,l]=n;return pr(o,i,l)}default:return {doc:o,range:r}}}collapsedAtDocEnd(){let e=We(this.doc);return {anchor:e,focus:e}}rangesEqual(e,n){return e.anchor.path[0]===n.anchor.path[0]&&e.anchor.path[1]===n.anchor.path[1]&&e.anchor.offset===n.anchor.offset&&e.focus.path[0]===n.focus.path[0]&&e.focus.path[1]===n.focus.path[1]&&e.focus.offset===n.focus.offset}};var ft=mt.createContext(null);function xe(){let t=mt.useContext(ft);if(!t)throw new Error("useEditorContext must be used within an EditorProvider");return t}var Gt=Object.freeze({marks:{},link:null,range:null});function zi(t){let e=Le(t.replaceAll(/<br\s*\/?>/gi,""));return e==="<p></p>"||e===""||e==="<p> </p>"}function Mn(t={}){let{value:e,defaultValue:n,onChange:o,isDisabled:r,keyboardShortcuts:i,onSelectionChange:l,onMentionTrigger:s,onMentionInputRemoved:a,canStartMention:c,resolveMention:u,isReadOnly:d,autoLink:f}=t;e!==void 0&&o===void 0&&a$c("use-editor-value-without-onchange","useEditor: `value` without `onChange` is controlled but cannot reflect edits \u2014 they are discarded on the next render. Use `defaultValue` for initial content, or add `onChange`.");let[p,m]=useState(Gt),[h,C]=useState(()=>e??n??""),D=useRef(o);D.current=o;let V=useRef(l);V.current=l;let M=useRef(s);M.current=s;let B=useRef(a);B.current=a;let S=useRef(c);S.current=c;let L=useRef(u);L.current=u;let q=useRef(d);q.current=d;let $=useRef(r);$.current=r;let te=useRef(i);te.current=i;let g=useRef(f);g.current=f;let y=useRef(null);y.current===null&&(y.current=new ut({onChange:E=>{C(E),D.current?.(E);},onSelectionChange:E=>{m(E),V.current?.(E);},onMentionTrigger:()=>{M.current?.();},onMentionInputRemoved:()=>{B.current?.();},canStartMention:()=>S.current?.()??false,get resolveMention(){return L.current},autoLink:()=>g.current!==false,isReadOnly:()=>q.current?.()??!!$.current,areKeyboardShortcutsEnabled:()=>te.current!==false}));let R=y.current;useLayoutEffect(()=>{e!==void 0&&R.setValue(e);});let b=useRef(false);useEffect(()=>{if(!b.current){b.current=true;let E=e??n;E&&R.setValue(E);}},[R]),useEffect(()=>{r&&m(Gt);},[r]);let ie=e??h,se=zi(ie),fe=R.canUndo(),pe=R.canRedo();return useMemo(()=>({core:R,selectionState:p,value:ie,isEmpty:se,isDisabled:!!r,keyboardShortcuts:i!==false,canUndo:fe,canRedo:pe,focus:()=>{R.focus();},selectStart:()=>{R.selectStart();},selectEnd:()=>{R.selectEnd();},setCaretPosition:E=>{R.setCaretPosition(E);},undo:()=>{R.undo();},redo:()=>{R.redo();},getValue:()=>R.getValue(),setValue:(E,I)=>{R.setValue(E,I);},exec:(E,...I)=>{R.exec(E,...I);},isMarkActive:E=>!!p.marks[E],toggleMark:E=>{R.exec("toggleMark",E);},setMark:(E,I)=>{R.exec("setMarkValue",E,I);}}),[R,p,ie,se,r,i,fe,pe])}function Cr(t,e){let n=t.ctrlKey||t.metaKey,o=t.key.toLowerCase();if(n&&!t.altKey&&o==="z")return t.preventDefault(),t.shiftKey?e.redo():e.undo(),true;if(t.ctrlKey&&!t.altKey&&!t.shiftKey&&o==="y")return t.preventDefault(),e.redo(),true;if(n&&!t.shiftKey&&!t.altKey){if(o==="b")return t.preventDefault(),e.toggleMark("bold"),true;if(o==="i")return t.preventDefault(),e.toggleMark("italic"),true;if(o==="u")return t.preventDefault(),e.toggleMark("underline"),true}return false}function Sn(t,e={}){let n=Ni(t),{ref:o,autoFocus:r,onKeyDown:i,keyboardShortcuts:l}=e,s=l??n.keyboardShortcuts,a=useId(),c=useRef(null),u=useRef(null),d=useCallback(h=>{u.current&&(u.current(),u.current=null),h&&(u.current=n.core.attach(h));},[n.core]),f=useMemo(()=>b(c,d,o??null),[d,o]);useEffect(()=>(n.core.setKeyboardShortcutsEnabled(l),()=>{n.core.setKeyboardShortcutsEnabled(void 0);}),[n.core,l]);let p=useRef(false);useEffect(()=>{if(!p.current)switch(p.current=true,r){case true:{n.focus();break}case "start":{n.selectStart();break}case "end":{n.selectEnd();break}}},[n.core]);let{keyboardProps:m}=j({onKeyDown:h=>{i?.(h)||s&&Cr(h,n)||h.continuePropagation();}});return {editableProps:{...m,id:a,ref:f,contentEditable:!n.isDisabled,suppressContentEditableWarning:true,role:"textbox","aria-multiline":true}}}function Ni(t){let e=useContext(ft);if(t)return t;if(!e)throw new Error("useEditable must be passed an editor or used within an EditorProvider");return e}var zn=({editor:t,children:e})=>jsx(ft.Provider,{value:t,children:e});var Xt=({markName:t,icon:e,ariaLabel:n,isDisabled:o})=>{let{core:r,selectionState:i}=xe(),l=!!i.marks[t];return jsx(a$f,{variant:"tertiary",isSelected:l,size:"sm",icon:e,"aria-label":n,"data-testid":`editor-${t}-button`,isDisabled:o,onPress:()=>{r.exec("toggleMark",t),r.focus();},preventFocusOnPress:true})},Dn=({colorKey:t,"aria-label":e,isDisabled:n})=>{let{core:o,selectionState:r}=xe(),i=t==="color"?r.marks.color:r.marks.backgroundColor,l=mt.useRef(null),s=useCallback(()=>{l.current=r.range;},[r.range]),a=useCallback(p=>{setTimeout(()=>{let m=o.getSelectionState().range??l.current;m&&o.select(m),o.exec("setMarkValue",t,p);},0);},[o,t]),c=useCallback(p=>{a(p);},[a]),u=useCallback(()=>{a();},[a]),d=useCallback(({ref:p,triggerProps:m})=>jsx(a$b,{icon:t==="color"?TextIcon:HighlightTextIcon,"aria-label":e,"data-testid":t==="color"?"editor-font-color-button":"editor-background-color-button",size:"md",variant:"popover",isDisabled:n,className:He,preventFocusOnPress:true,...m,ref:p}),[t,e,n]),f=useCallback(p=>{p?c(p.toString("rgba")):u();},[u,c]);return jsx(b$4,{presets:cn,allowRemoval:true,pickerMode:"lazy",placement:"top end",colorLabel:false,renderTriggerButton:d,onTriggerPress:s,value:i||"#000000",onChange:f,isDisabled:n})};var _e={Add:"add",Edit:"edit",Show:"show"},Lr=({isDisabled:t,addLinkLabel:e,editLinkLabel:n,removeLinkLabel:o,linkAnnotationLabel:r,linkCancelLabel:i,linkSaveLabel:l})=>{let{formatMessage:s}=b$1(),{core:a}=xe();return jsxs(b$5,{type:"dialog",children:[jsx(j$1,{children:jsx(a$b,{icon:LinkIcon,size:"sm",isDisabled:t,"aria-label":e??s(Ie.addLink),"data-testid":"editor-add-link-button",className:He,preventFocusOnPress:true})}),jsx(a$g,{className:sprinkles({boxShadow:"medium"}),placement:"top end",children:({close:c})=>jsx(a$h,{size:"content",style:{minWidth:240},children:jsx(Ki,{addLinkLabel:e,editLinkLabel:n,removeLinkLabel:o,linkAnnotationLabel:r,linkCancelLabel:i,linkSaveLabel:l,close:()=>{c(),setTimeout(()=>{a.focus();},0);}})})})]})},Ki=({close:t,addLinkLabel:e,editLinkLabel:n,removeLinkLabel:o,linkAnnotationLabel:r,linkCancelLabel:i,linkSaveLabel:l})=>{let{core:s,selectionState:a}=xe(),{formatMessage:c}=b$1(),u=a.link?.url,[d,f]=mt.useState(u?_e.Show:_e.Add),[p,m]=mt.useState(u||""),h=jsx(a$9,{padding:"lg",children:jsx(a$o,{label:r??c(Ie.link),value:p,autoFocus:true,onChange:m,placeholder:"https://yourdomain.com","data-testid":"editor-link-input"})});return jsxs(Fragment,{children:[d===_e.Add&&jsxs(Fragment,{children:[h,jsx(a$9,{display:"flex",justifyContent:"flex-end",padding:"lg",className:yo,children:jsx(b$b,{isDisabled:!a$p(p,true)||de(p)==="",label:e??c(Ie.addLink),"data-testid":"editor-link-add-button",size:"sm",onPress:()=>{s.exec("wrapLink",hn(p)),t?.();},preventFocusOnPress:true})})]}),d===_e.Show&&jsxs(Fragment,{children:[jsx(a$9,{padding:"lg",children:jsx(a$m,{type:"subtitle",size:"sm",children:u})}),jsxs(a$9,{display:"flex",justifyContent:"flex-end",padding:"lg",gap:"lg",borderColor:"border.subtle",borderWidth:1,borderStyle:"solid",children:[jsx(b$b,{label:n??c(Ie.editLink),"data-testid":"editor-link-edit-button",size:"sm",variant:"secondary",onPress:()=>{f(_e.Edit);},style:{flex:1,justifyContent:"center"}}),jsx(b$b,{label:o??c(Ie.removeLink),"data-testid":"editor-link-remove-button",size:"sm",onPress:()=>{s.exec("unwrapLink"),t?.();},preventFocusOnPress:true,style:{flex:1,justifyContent:"center"}})]})]}),d===_e.Edit&&jsxs(Fragment,{children:[h,jsxs(a$9,{display:"flex",justifyContent:"flex-end",padding:"lg",gap:"lg",borderColor:"border.subtle",borderWidth:1,borderStyle:"solid",children:[jsx(b$b,{label:i??c(Ie.cancel),"data-testid":"editor-link-cancel-button",size:"sm",variant:"secondary",onPress:()=>{f(_e.Show),t?.();}}),jsx(b$b,{label:l??c(Ie.save),"data-testid":"editor-link-save-button",size:"sm",isDisabled:!a$p(p,true)||de(p)==="",onPress:()=>{s.exec("updateLinkUrl",hn(p)),t?.();}})]})]})]})},Ie=c$1({addLink:{id:"bui.editor.addLink",defaultMessage:"Add Link"},editLink:{id:"bui.editor.editLink",defaultMessage:"Edit Link"},removeLink:{id:"bui.editor.removeLink",defaultMessage:"Remove Link"},cancel:{id:"bui.editor.cancel",defaultMessage:"Cancel"},save:{id:"bui.editor.save",defaultMessage:"Save"},link:{id:"bui.editor.linkAnnotation",defaultMessage:"Link"}});var In=mt.createContext({items:[],containerRef:{current:null},maxMentionableUsersSuggestions:10}),Gi=({key:t,value:e},{isDisabled:n,optionProps:o,isFocused:r,_state:i},l)=>{let{hoverProps:s}=a$3({isDisabled:n}),{label:a,data:c$1}=e;return jsxs(Fragment,{children:[jsxs("li",{...c(o,s),className:Mo({isDisabled:n,isHovered:r}),"data-active":r||void 0,ref:l,children:[jsx(a$9,{elementType:"span",display:"flex","aria-hidden":true,children:jsx(a$e,{name:a,...c$1?.avatar})}),jsxs(a$9,{display:"flex",flexDirection:"column",children:[jsx(a$m,{type:"subtitle",size:"sm",children:a}),jsx(a$m,{type:"helper",size:"sm",children:c$1?.description})]})]}),t===i.collection.getLastKey()?null:jsx(a$a,{})]})};function _n(t){return t.displayName?.trim()||t.name?.trim()||t.id}function Nn(t){return t.displayName??_n(t)}function wn({anchor:t,onClose:e,mentionLabel:n}){let{core:o}=xe(),{containerRef:r,items:i,maxMentionableUsersSuggestions:l}=useContext(In),[s,a]=useState(""),{contains:c$1}=a$i({sensitivity:"base"}),{formatMessage:u}=b$1(),d=useRef(false),f$1=useCallback(()=>{d.current=true,e();},[e]),p=useMemo(()=>{let g=i.filter(y=>s===""||c$1(_n(y),s)).map(y=>({id:y.id,label:_n(y),data:y}));return l?g.slice(0,l):g},[i,l,s,c$1]),m=useCallback(g=>jsx(a$j,{textValue:g.label,children:g.label},g.id),[]),h=useCallback(g=>{if(d.current||g==null)return;let y=i.find(R=>R.id===g);y&&(f$1(),o.exec("confirmMention",{id:y.id,displayName:Nn(y)}),o.exec("insertText"," "),o.focus());},[f$1,o,i]),C=b$6({items:p,children:m,menuTrigger:"focus",onSelectionChange:h}),D=useCallback(g=>{if(d.current)return;f$1();let y=g==="backspace"?"":`@${C.inputValue}`;o.exec("removeMentionInput",y,g==="arrowStart"?"start":"end"),o.focus();},[f$1,o,C.inputValue]),V=useRef(null),M=useRef(null),B=useRef(null),S=useRef(null);a$k({ref:S,onInteractOutside:()=>{C.close();}});let{inputProps:L,listBoxProps:q}=a$l({defaultItems:p,inputRef:M,buttonRef:V,listBoxRef:B,popoverRef:S,menuTrigger:"focus","aria-label":n??u(Xi.mention)},C);useLayoutEffect(()=>{M.current?.focus(),setTimeout(()=>{M.current?.focus();});},[]);let $=useCallback(g=>{let y=g.currentTarget,R=y.selectionStart===0&&y.selectionEnd===0,b=y.selectionStart===y.value.length&&y.selectionEnd===y.value.length;if(g.key==="Backspace"&&R)g.preventDefault(),D("backspace");else if(g.key==="Escape")D("escape");else if(g.key==="ArrowLeft"||g.key==="ArrowRight"){let E=I=>g.key==="ArrowLeft"!=(b$2(I).getComputedStyle(I).direction==="rtl");(E(y)?R:b)&&(g.preventDefault(),D(E(t)?"arrowStart":"arrowEnd"));}let ie=g.metaKey||g.ctrlKey,se=g.key.toLowerCase(),fe=ie&&!g.shiftKey&&se==="z"&&o.canUndo(),pe=(ie&&g.shiftKey&&se==="z"||g.ctrlKey&&se==="y")&&o.canRedo();(fe||pe)&&(g.preventDefault(),fe?o.undo():o.redo(),f$1(),o.focus());},[t,D,f$1,o]),te=useMemo(()=>{if(!CSS.supports("field-sizing","content")){let g=b$2(M.current),y=M.current?g?.getComputedStyle(M.current).font:void 0;return {width:y?b$7({text:C.inputValue,font:y,element:M.current}).width+10:"4ch"}}},[C.inputValue]);return jsxs(Fragment,{children:[createPortal(jsx("input",{...c(L,{onKeyDown:$,onBlur:()=>{D("blur");},onChange:g=>{a(g.target.value);}}),style:te,dir:/\p{L}/u.test(C.inputValue)?"auto":void 0,className:Co,ref:M}),t),jsx(b$8.Provider,{value:C,children:jsx(a$g,{triggerRef:r,isNonModal:true,ref:S,state:C,crossOffset:-2,children:jsx(c$2,{...q,items:void 0,ref:B,"data-testid":"editor-mention-listbox",className:a$5(f,sprinkles({width:"full"})),renderOption:Gi})})})]})}wn.displayName="MentionInputOverlay";var Xi=c$1({mention:{defaultMessage:"Mention",id:"bui.editor.mention"}});var Bn=mt.forwardRef(({value:t,defaultValue:e$1,onChange:n,style:o,spellCheck:r,placeholder:i,isInline:l,isDisabled:s,editableContentAriaLabel:a,containerRef:c,onHelpDialogOpenRequest:u,mentionableUsers:d,editorHandle:f,maxMentionableUsersSuggestions:p,autoFocus:m,editorRef:h,saveOnEnter:C,onSave:D,autoLink:V,mentionLabel:M,boldLabel:B,italicLabel:S,underlineLabel:L,fontColorLabel:q,backgroundColorLabel:$,helpLabel:te,addLinkLabel:g,editLinkLabel:y,removeLinkLabel:R,linkAnnotationLabel:b,linkCancelLabel:ie,linkSaveLabel:se},fe)=>{let pe=useRef(null),E=useRef(null),{formatMessage:I}=b$1(),[Ye,Ze]=useState(null),xt=useRef(0),[Qt,bt]=useState(false),yt=()=>{let v=E.current?.querySelector("[data-mention-anchor]");v&&(xt.current+=1,Ze({anchor:v,id:xt.current}));},be=Mn({value:t,defaultValue:e$1,onChange:n,isDisabled:s,onMentionTrigger:yt,onMentionInputRemoved:()=>{Ze(null);},canStartMention:()=>(d?.length??0)>0,resolveMention:v=>{let G=d?.find(H=>H.id===v);return G&&Nn(G)},autoLink:V}),Je=be.core;mt.useEffect(()=>{h&&(h.current=Je);},[Je,h]);let T=v=>C&&v.key==="Enter"&&!v.shiftKey||(v.ctrlKey||v.metaKey)&&v.key==="Enter"?(v.preventDefault(),D(),true):v.altKey&&v.key==="F10"?(v.preventDefault(),pe.current?.querySelector("button")?.focus(),true):false,{editableProps:Et}=Sn(be,{ref:E,autoFocus:m,onKeyDown:T}),Qe=v=>{if(s)return;let{isLinkClick:G,url:H}=Vo(v.target,{metaKey:v.metaKey,ctrlKey:v.ctrlKey,mac:e()});G&&(v.preventDefault(),H&&b$2(v.currentTarget).open(H,"_blank","noopener,noreferrer"));};mt.useEffect(()=>{let v=E.current;if(!v||s)return;let G=a$7(v),H=b$2(v),ke=Ce=>{bt(e()?Ce.metaKey:Ce.ctrlKey);},nt=()=>{bt(false);};return G.addEventListener("keydown",ke),G.addEventListener("keyup",ke),H.addEventListener("blur",nt),()=>{G.removeEventListener("keydown",ke),G.removeEventListener("keyup",ke),H.removeEventListener("blur",nt),nt();}},[s]),useImperativeHandle(fe,()=>({startMention:()=>{d?.length&&(E.current?.querySelector("input[role='combobox']")||(Je.exec("insertMentionInput"),yt()));}})),useImperativeHandle(f,()=>({setCaretPosition:v=>{be.setCaretPosition(v);},focus:()=>{be.focus();}}));let et=useMemo(()=>({items:d||[],containerRef:c,maxMentionableUsersSuggestions:p}),[d,c,p]),tt=be.isEmpty;return jsx(In.Provider,{value:et,children:jsxs(zn,{editor:be,children:[jsxs(a$8,{className:a$5(It,"BaselineUI-Editor-RichEditorToolbar"),"aria-controls":Et.id,ref:pe,children:[jsxs(a$9,{display:"flex",flexDirection:"row",role:"group",gap:"xs",paddingX:"sm",children:[jsx(Xt,{markName:"bold",icon:BoldIcon,ariaLabel:B??I(Xe.bold),isDisabled:s}),jsx(Xt,{markName:"italic",icon:ItalicIcon,ariaLabel:S??I(Xe.italic),isDisabled:s}),jsx(Xt,{markName:"underline",icon:UnderlineIcon,ariaLabel:L??I(Xe.underline),isDisabled:s})]}),jsx(a$a,{orientation:"vertical",className:rt}),jsx(Dn,{colorKey:"color","aria-label":q??I(Xe.fontColor),isDisabled:s}),jsx(a$a,{orientation:"vertical",className:rt}),jsx(Dn,{colorKey:"backgroundColor","aria-label":$??I(Xe.backgroundColor),isDisabled:s}),jsx(a$a,{orientation:"vertical",className:rt}),jsx(Lr,{isDisabled:s,addLinkLabel:g,editLinkLabel:y,removeLinkLabel:R,linkAnnotationLabel:b,linkCancelLabel:ie,linkSaveLabel:se}),jsx(a$a,{orientation:"vertical",className:rt}),jsx(a$b,{className:He,icon:QuestionmarkCircleIcon,size:"sm","aria-label":te??I(Xe.help),"data-testid":"editor-help-button",onPress:u})]}),jsx(a$a,{variant:"secondary"}),jsxs("div",{style:{position:"relative"},children:[!!(i&&tt)&&jsx("span",{"aria-hidden":true,"aria-disabled":true,"data-testid":"editor-placeholder",style:{position:"absolute",pointerEvents:"none",userSelect:"none",top:0,left:0,right:0},className:a$5(ot({isDisabled:s}),Ro,"BaselineUI-Editor-RichEditorPlaceholder"),children:i}),jsx("div",{...Et,onClick:Qe,"data-mod-held":Qt?"":void 0,"aria-label":a,"aria-placeholder":i,spellCheck:r,style:o,className:a$5(ot({isDisabled:s}),_t({isInline:l}),"BaselineUI-Editor-RichEditorEditingArea")})]}),Ye!==null&&jsx(wn,{anchor:Ye.anchor,mentionLabel:M,onClose:()=>{Ze(null);}},Ye.id)]})})});Bn.displayName="RichEditor";var Xe=c$1({bold:{defaultMessage:"Bold",id:"bui.editor.bold"},italic:{defaultMessage:"Italic",id:"bui.editor.italic"},underline:{defaultMessage:"Underline",id:"bui.editor.underline"},backgroundColor:{defaultMessage:"Background Color",id:"bui.editor.backgroundColor"},fontColor:{defaultMessage:"Font Color",id:"bui.editor.fontColor"},help:{defaultMessage:"Help",id:"bui.editor.help"}});var _r=mt.memo(mt.forwardRef(({className:t,style:e,"data-block-id":n,"data-block-class":o,enableRichText:r=false,onCancel:i,onSave:l,isInline:s=true,submitButtonIcon:a=ArrowUpCircleFilledIcon,submitButtonAriaLabel:c$1,cancelButtonAriaLabel:u,"aria-label":d,"aria-describedby":f,"aria-labelledby":p,"aria-details":m,editableContentAriaLabel:h="Editing Area",footerButtons:C,clearOnCancel:D,clearOnSave:V,mentionLabel:M,boldLabel:B,italicLabel:S,underlineLabel:L,fontColorLabel:q,backgroundColorLabel:$,helpLabel:te,closeLabel:g,actionLabel:y,shortcutLabel:R,toolbarFocusLabel:b$2,selectAllLabel:ie,cutLabel:se,copyLabel:fe,pasteLabel:pe,undoLabel:E,redoLabel:I,openHelpDialogLabel:Ye,submitLabel:Ze,addLinkLabel:xt,editLinkLabel:Qt,removeLinkLabel:bt,linkAnnotationLabel:yt,linkCancelLabel:be,linkSaveLabel:Je,...T},Et)=>{let Qe=useRef(null),{formatMessage:et}=b$1(),tt=useRef(null),v=useRef(null),G=useRef(null),H=!r&&T.variant==="minimal",ke=useRef(null),[nt,Ce]=mt.useState(T.value||T.defaultValue),en=T.value!==void 0&&T.onChange!==void 0;r&&T.value!==void 0&&!T.onChange&&a$c("editor-rich-value-uncontrolled","Editor: `value` without `onChange` in rich text mode sets the initial content only. Use `defaultValue` for uncontrolled content, or add `onChange` to control the value.");let Fn=T.value!==void 0&&(!r||en),tn=T.value;mt.useEffect(()=>{Fn&&tn!==void 0&&Ce(tn);},[Fn,tn]);let nn=T.isDisabled||T.isSaveDisabled||!b$3(nt||""),{fieldProps:Ir}=a$d({"aria-label":d,"aria-labelledby":p,"aria-describedby":f,"aria-details":m,labelElementType:"div"});H&&!T.avatarName&&console.warn("Editor: When using the minimal `variant` and `enableRichText` is `false`, you should provide an `avatarName`.");let on=useCallback(()=>{Ce(""),r?Qe.current?.setValue("<p></p>",{emit:true}):v.current?.clear();},[r]),vt=useCallback(()=>{nn||(l?.(r?Qe.current?.getValue()??"":tt.current.value),V&&on());},[on,V,r,l,nn]),Un=jsx(a$b,{variant:"ghost","aria-label":c$1||et(jn.save),icon:a,isDisabled:nn,"data-testid":"editor-save-button",size:"md",excludeFromTabOrder:H,className:a$5({[Lo]:H},"BaselineUI-Editor-Save"),onPress:vt,preventFocusOnPress:true}),[Nr,rn]=mt.useState(false),{keyboardProps:wr}=j({onKeyDown:j=>{(j.metaKey||j.ctrlKey)&&j.shiftKey&&j.key==="h"?(j.preventDefault(),rn(true)):j.continuePropagation();}}),Vn=useCallback(j=>{Ce(j),T.onChange?.(j);},[T]);return jsxs("div",{...c(Ir,r?wr:{}),role:"application",ref:b(G,Et),style:e,"data-block-id":n,"data-block-class":o,className:a$5(vo({isInline:s,isMinimal:H}),"BaselineUI-Editor",t),"aria-disabled":T.isDisabled,children:[H?jsxs(Fragment,{children:[s?jsx(a$e,{className:Eo,name:T.avatarName||""}):null,jsxs("div",{className:zo({isInline:s}),children:[jsx(Nt,{isMinimal:H,textBoxRef:tt,ref:v,isInline:s,editableContentAriaLabel:h,...T,onChange:Vn,onSave:vt}),Un]})]}):jsxs(Fragment,{children:[r?jsx(Bn,{containerRef:G,ref:ke,editorRef:Qe,isInline:s,editableContentAriaLabel:h,onHelpDialogOpenRequest:()=>{rn(true);},mentionLabel:M,boldLabel:B,italicLabel:S,underlineLabel:L,fontColorLabel:q,backgroundColorLabel:$,helpLabel:te,addLinkLabel:xt,editLinkLabel:Qt,removeLinkLabel:bt,linkAnnotationLabel:yt,linkCancelLabel:be,linkSaveLabel:Je,...T,value:en?T.value:void 0,defaultValue:T.defaultValue??(en?void 0:T.value),onChange:Vn,onSave:vt}):jsxs(Fragment,{children:[!s&&jsx(a$a,{variant:"secondary"}),jsx(Nt,{onCancel:i,textBoxRef:tt,ref:v,isInline:s,editableContentAriaLabel:h,...T,onChange:j=>{Ce(j),T.onChange?.(j);},onSave:vt})]}),jsx(a$a,{variant:"secondary"}),jsxs("div",{className:a$5(It,sprinkles({justifyContent:"space-between"}),"BaselineUI-Editor-Footer"),children:[jsxs(a$9,{paddingX:"sm",gap:"sm",display:"flex",children:[r&&T.mentionableUsers?jsx(a$b,{icon:AtIcon,size:"sm","aria-label":M??et(jn.mention),"data-testid":"editor-mention-button",onPress:()=>ke.current?.startMention(),preventFocusOnPress:true,className:"BaselineUI-Editor-Mention"}):null,C?.map(({type:j,props:Rt},Wn)=>j==="action"?jsx(a$b,{...Rt,size:"sm",isDisabled:T.isDisabled||Rt.isDisabled},Wn):jsx(a$f,{...Rt,size:"sm",variant:"tertiary",isDisabled:T.isDisabled||Rt.isDisabled},Wn))]}),jsxs(a$9,{children:[!!i&&jsx(a$b,{variant:"secondary",icon:XCircleFilledIcon,isDisabled:T.isDisabled,"data-testid":"editor-cancel-button",size:"md",onPress:()=>{i(),D&&on();},"aria-label":u||et(jn.cancel),className:"BaselineUI-Editor-Cancel"}),Un]})]})]}),jsx(Ao,{isOpen:Nr,onClose:()=>{rn(false);},toolbarFocusLabel:b$2,helpLabel:te,closeLabel:g,actionLabel:y,shortcutLabel:R,boldLabel:B,italicLabel:S,underlineLabel:L,selectAllLabel:ie,cutLabel:se,copyLabel:fe,pasteLabel:pe,undoLabel:E,redoLabel:I,openHelpDialogLabel:Ye,submitLabel:Ze})]})}));_r.displayName="Editor";var jn=c$1({cancel:{defaultMessage:"Cancel",id:"bui.editor.cancel"},save:{defaultMessage:"Save",id:"bui.editor.save"},mention:{defaultMessage:"Mention",id:"bui.editor.mention"}});
29
- export{ut as a,xe as b,Gt as c,Mn as d,Cr as e,Sn as f,zn as g,_r as h};
@@ -1,10 +0,0 @@
1
- import {b}from'./chunk-HZM2XZP4.mjs';import {c as c$1}from'./chunk-XQC3DSTW.mjs';import {I}from'./chunk-676DOXEK.mjs';import {a as a$1}from'./chunk-3DWFAHR2.mjs';import {a}from'./chunk-O7XK2WIX.mjs';import {a as a$5}from'./chunk-VXZT2JR2.mjs';import {a as a$4}from'./chunk-VDUFLHKK.mjs';import {d}from'./chunk-HH4VLTF3.mjs';import {a as a$3}from'./chunk-SVIYLH7R.mjs';import {c}from'./chunk-ETM4MNG4.mjs';import {a as a$2}from'./chunk-4QEH5CGK.mjs';import {sprinkles}from'@baseline-ui/tokens';import U,{useMemo,useState,useEffect}from'react';import {jsxs,jsx}from'react/jsx-runtime';/**
2
- * Copyright (c) 2023-2024 PSPDFKit GmbH. All rights reserved.
3
- *
4
- * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
5
- * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE PSPDFKIT LICENSE AGREEMENT.
6
- * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
7
- * This notice may not be removed from this file.
8
- *
9
- */
10
- var R="ujkypy0 _1yep5z66 _1yep5z67 _1yep5z68 _1yep5z62i _1yep5z62j _1yep5z62k _1yep5z63o _1yep5z63p _1yep5z63q _1yep5z61c _1yep5z61d _1yep5z61e",j="_1yep5z61sj _1yep5z61sk _1yep5z61sl _1yep5z61ih _1yep5z61ii _1yep5z61ij";var T=U.forwardRef(({className:c$2,style:s,items:t,optionsContainerClassName:d,label:o,icon:i,value:a$4,defaultValue:p,onChange:m,isDisabled:u,optionClassName:L,optionStyle:D,labelPosition:C="top","data-block-id":E,"data-block-class":F,shouldFocusWrap:M,tooltip:v=true,...l},K)=>{let P=useMemo(()=>t.map(e=>({id:e.color,label:e.label})),[t]),b$1=e=>(t.find(y=>y.color===e)??t.find(y=>b(y.color,e)))?.color??e,z=c(),[k,q]=useState(!!a$4);return a$4&&!k&&q(true),useEffect(()=>{!o&&!l["aria-label"]&&!l["aria-labelledby"]&&console.warn("ColorSwatchPicker: Please provide a label or aria-label for accessibility.");},[o,l]),jsxs(a,{...a$3(l),className:a$2("BaselineUI-ColorSwatchPicker",c$2),"data-block-id":E,"data-block-class":F,display:"flex",flexDirection:C==="top"?"column":"row",alignItems:C==="top"?"flex-start":"center",justifyContent:"space-between",gap:"md",style:s,ref:K,children:[i||o?jsxs(a,{display:"flex",alignItems:"center",gap:"md",children:[i?jsx(i,{"aria-hidden":"true",size:24,className:sprinkles({color:"icon.primary"})}):null,o?jsx(a$1,{id:z,type:"label",size:"sm",children:o}):null]}):null,jsx(c$1,{className:a$2(j,d),selectionMode:"single",items:P,orientation:"horizontal",defaultSelectedKeys:p?[b$1(p)]:void 0,disabledKeys:u?P.map(e=>e.id):void 0,isDisabled:u,selectedKeys:a$4?[b$1(a$4)]:k?[]:void 0,onSelectionChange:e=>{m?.([...e][0]);},optionClassName:L,optionStyle:D,renderOption:(...e)=>J(...e,v),shouldFocusWrap:M,...l,"aria-labelledby":o?z:l["aria-labelledby"]})]})});T.displayName="ColorSwatchPicker";var J=({key:c,textValue:s},{isSelected:t,isFocusVisible:d$1,isDisabled:o,optionProps:i},a,p)=>{let{tooltipProps:m}=a$4({label:s,tooltip:p});return jsx(a$5,{...m,children:jsx(d,{children:jsx("li",{...i,"data-disabled":o||void 0,className:a$2(R,i.className),ref:a,children:jsx(I,{isFocusVisible:d$1,color:c,isSelected:t,"aria-label":s,isInteractive:true,isDisabled:o,tooltip:false})})})})};export{T as a};
@@ -1,10 +0,0 @@
1
- import {a as a$1}from'./chunk-RT4LMB6X.mjs';import {b,c}from'./chunk-3WKDIXCM.mjs';import {a}from'./chunk-ETM4MNG4.mjs';import {forwardRef,createContext,useRef,useMemo,useContext,useState,useCallback}from'react';import {jsx,Fragment}from'react/jsx-runtime';/**
2
- * Copyright (c) 2023-2024 PSPDFKit GmbH. All rights reserved.
3
- *
4
- * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
5
- * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE PSPDFKIT LICENSE AGREEMENT.
6
- * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
7
- * This notice may not be removed from this file.
8
- *
9
- */
10
- var M=Symbol("default");function Y({values:e,children:t}){for(let[r,o]of e)t=jsx(r.Provider,{value:o,children:t});return t}function Z(e){let{className:t,style:r,children:o,defaultClassName:l=void 0,defaultChildren:n=void 0,defaultStyle:a,values:i,render:d}=e;return useMemo(()=>{let c,u,s;return typeof t=="function"?c=t({...i,defaultClassName:l}):c=t,typeof r=="function"?u=r({...i,defaultStyle:a||{}}):u=r,typeof o=="function"?s=o({...i,defaultChildren:n}):o==null?s=n:s=o,{className:c??l,style:u||a?{...a,...u}:void 0,children:s??n,"data-rac":"",render:d?C=>d(C,i):void 0}},[t,r,o,l,n,a,i,d])}function D(e,t){let r=useContext(e);if(t===null)return null;if(r&&typeof r=="object"&&"slots"in r&&r.slots){let o=t||M;if(!r.slots[o]){let l=new Intl.ListFormat().format(Object.keys(r.slots).map(a=>`"${a}"`)),n=t?`Invalid slot "${t}".`:"A slot prop is required.";throw new Error(`${n} Valid slot names are ${l}.`)}return r.slots[o]}return r}function ee(e,t,r){let o=D(r,e.slot)||{},{ref:l,...n}=o,a=a$1(useMemo(()=>b(t,l),[t,l])),i=c(n,e);return "style"in n&&n.style&&"style"in e&&e.style&&(typeof n.style=="function"||typeof e.style=="function"?i.style=d=>{let c=typeof n.style=="function"?n.style(d):n.style,u={...d.defaultStyle,...c},s=typeof e.style=="function"?e.style({...d,defaultStyle:u}):e.style;return {...u,...s}}:i.style={...n.style,...e.style}),[i,a]}function re(e=true){let[t,r]=useState(e),o=useRef(false),l=useCallback(n=>{o.current=true,r(!!n);},[]);return a(()=>{o.current||r(false);},[]),[l,t]}function te(e){let t=/^(data-.*)$/,r={};for(let o in e)t.test(o)||(r[o]=e[o]);return r}function A(e,t,r){let{render:o,...l}=t,n=useRef(null),a$1=useMemo(()=>b(r,n),[r,n]);a(()=>{process.env.NODE_ENV!=="production"&&o&&(n.current?n.current.localName!==e&&console.warn(`Unexpected DOM element returned by custom \`render\` function. Expected <${e}>, got <${n.current.localName}>. This may break the component behavior and accessibility.`):console.warn("Ref was not connected to DOM element returned by custom `render` function. Did you forget to pass through or merge the `ref`?"));},[e,o]);let i={...l,ref:a$1};return o?o(i,void 0):jsx(e,{...i})}var T={},oe=new Proxy({},{get(e,t){if(typeof t!="string")return;let r=T[t];return r||(r=forwardRef(A.bind(null,t)),T[t]=r),r}});typeof HTMLTemplateElement<"u"&&(Object.defineProperty(HTMLTemplateElement.prototype,"firstChild",{configurable:true,enumerable:true,get:function(){return this.content.firstChild}}),Object.defineProperty(HTMLTemplateElement.prototype,"appendChild",{configurable:true,enumerable:true,value:function(e){return this.content.appendChild(e)}}),Object.defineProperty(HTMLTemplateElement.prototype,"removeChild",{configurable:true,enumerable:true,value:function(e){return this.content.removeChild(e)}}),Object.defineProperty(HTMLTemplateElement.prototype,"insertBefore",{configurable:true,enumerable:true,value:function(e,t){return this.content.insertBefore(e,t)}}));var f=createContext(false);function fe(e){if(useContext(f))return jsx(Fragment,{children:e.children});let r=jsx(f.Provider,{value:true,children:e.children});return jsx("template",{children:r})}function g(e){let t=(r,o)=>useContext(f)?null:e(r,o);return t.displayName=e.displayName||e.name,forwardRef(t)}function F(){return useContext(f)}export{M as a,Y as b,Z as c,D as d,ee as e,re as f,te as g,oe as h,fe as i,g as j,F as k};
@@ -1,10 +0,0 @@
1
- import {a as a$a}from'./chunk-5HXTXIE5.mjs';import {a as a$3}from'./chunk-MZIQ27JP.mjs';import {d,a as a$9,c as c$2,b as b$3}from'./chunk-5MUEJ5WI.mjs';import {a as a$8}from'./chunk-RO5ZRU3Y.mjs';import {a as a$5}from'./chunk-3DWFAHR2.mjs';import {a}from'./chunk-R6TFTLMV.mjs';import {b,c as c$3}from'./chunk-7MLFM55C.mjs';import {b as b$2}from'./chunk-AFOW62QN.mjs';import {a as a$6}from'./chunk-DAI7V4TE.mjs';import {b as b$1}from'./chunk-K5RYVERS.mjs';import {a as a$4}from'./chunk-2VY4FAOY.mjs';import {a as a$1}from'./chunk-STMDFIUL.mjs';import {j}from'./chunk-KUDCYGII.mjs';import {a as a$2}from'./chunk-B3EZOXNU.mjs';import {c as c$1,b as b$4}from'./chunk-3WKDIXCM.mjs';import {c}from'./chunk-ETM4MNG4.mjs';import {a as a$7}from'./chunk-4QEH5CGK.mjs';import {UndoIcon,RedoIcon}from'@baseline-ui/icons/16';import {getStroke}from'perfect-freehand';import h,{useState,useCallback,useEffect,useMemo,useRef}from'react';import {jsxs,jsx,Fragment}from'react/jsx-runtime';/**
2
- * Copyright (c) 2023-2024 PSPDFKit GmbH. All rights reserved.
3
- *
4
- * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
5
- * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE PSPDFKIT LICENSE AGREEMENT.
6
- * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
7
- * This notice may not be removed from this file.
8
- *
9
- */
10
- function de({line:t,options:o}){let r=useRef([]),m=useMemo(()=>{let i=Math.ceil(t.length/P),d;for(let a=0;a<i;a++)if(!(!(a===i-1)&&!!r.current[a])){let C=t.slice(a*P-(a>0?1:0),a*P+P);d=a$a(getStroke(C.map(([k,g,l])=>({x:k,y:g,pressure:l})),o)),C.length>=(a>0?P+1:P)&&(r.current[a]=d);}return d},[t,o]);return [...r.current,m]}var P=180;var Xe={size:1,thinning:0,smoothing:0,streamline:0,easing:t=>t,start:{taper:0,easing:t=>t,cap:true},end:{taper:0,easing:t=>t,cap:true},simulatePressure:false},ce=h.forwardRef(({className:t,style:o,canvasClassName:r,canvasStyle:m,isBound:i=true,strokeWidth:d$1=2,strokeColor:a$a="#3A87FD",onChange:v,defaultValue:H,onChangeEnd:C,enableHistory:k=false,isInline:g=true,isDisabled:l,placeholder:E,clearLabel:R,undoLabel:he,redoLabel:ve,footerClassName:ge,canvasRef:Pe,value:N,footerStyle:Ce,"data-block-id":ke,"data-block-class":ye,"aria-label":Se="Drawing canvas",description:be="This is a canvas for drawing using a mouse or touch input.",...f},Fe)=>{let T=b(),De=h.useRef(null),[u,S]=h.useState(N||H||[]),U=h.useMemo(()=>({...Xe,...f}),[f]),[c$3,z]=h.useState(),V=c(),{labelProps:Ee,fieldProps:Re}=a({...f,"aria-label":Se,labelElementType:"span"}),{isFocusVisible:Me,focusProps:we}=a$1({within:true}),{hoverProps:Le,isHovered:Oe}=a$2({isDisabled:l}),{undo:I,redo:x,canRedo:K,canUndo:G,push:W}=a$3(u,{onAction:e=>{e&&(S(e),C?.(e));},isDisabled:!k}),{keyboardProps:He}=j({onKeyDown:e=>{e.key==="Backspace"?A():e.key==="z"&&(e.metaKey||e.ctrlKey)&&(e.shiftKey?K&&x():G&&I());}}),[Ne,_]=useState(false),Te=useCallback(e=>{let p=e.currentTarget.getBoundingClientRect();z(p),e.target.setPointerCapture(e.pointerId);let y=[e.clientX-p.x,e.clientY-p.y,e.pressure];S(s=>[...s,[y]]),_(true);},[]),Ue=useCallback(e=>{if(e.buttons!==1||!c$3)return;let y=ue(e.nativeEvent).map(s=>[i?a$4(s.clientX-c$3.left,0,c$3.width):s.clientX-c$3.left,i?a$4(s.clientY-c$3.top,0,c$3.height):s.clientY-c$3.top,s.pressure]);S(s=>{let M=[...s];return M[s.length-1]=[...M[s.length-1],...y],M});},[c$3,i]),ze=()=>{c$3&&(C?.(u),W(u),_(false),z(void 0));};useEffect(()=>{v?.(u);},[u,v]);let A=()=>{S([]),v?.([]),W([]);};return jsxs("div",{ref:b$4(De,Fe),className:a$7(b$3,"BaselineUI-FreehandCanvas",t),style:o,"aria-disabled":l,"data-block-id":ke,"data-block-class":ye,children:[f.label||k?jsxs("div",{className:d({isInline:g}),children:[f.label?jsx(a$5,{type:"label",size:"sm",...Ee,children:f.label}):jsx("span",{}),k?jsxs("div",{children:[jsx(a$6,{variant:"secondary",size:"sm",isDisabled:!G||l,icon:UndoIcon,onPress:I,"aria-label":he||T.formatMessage(me.undo)}),jsx(a$6,{variant:"secondary",size:"sm",isDisabled:!K||l,icon:RedoIcon,onPress:x,"aria-label":ve||T.formatMessage(me.redo)})]}):null]}):null,jsxs("div",{role:"application",...c$1(we,He,Le,Re),tabIndex:l?void 0:0,className:a$7(a$8({isInline:g,isHovered:Oe}),a$9({isFocusVisible:Me,isInline:g,isDisabled:!!l}),r),"aria-describedby":f["aria-describedby"]||V,style:m,ref:Pe,children:[jsx(b$1,{children:jsx("div",{id:V,children:be})}),jsx("svg",{width:m?.width||"100%",height:m?.height||"100%",onPointerDown:Te,onPointerMove:Ue,onPointerUp:ze,children:(N||u).map((e,p,y)=>p<y.length-1||!Ne?jsx(pe,{line:e,options:U,strokeColor:a$a,strokeWidth:d$1},p):jsx(fe,{line:e,options:U,strokeColor:a$a,strokeWidth:d$1},p))})]}),E||R?jsx("div",{style:Ce,className:a$7(c$2({isInline:g,isDisabled:l}),ge),children:(u.length||!E)&&R?jsx(b$2,{size:"sm",variant:"ghost",label:R,isDisabled:l,onPress:A}):jsx(b$2,{size:"sm",variant:"ghost",label:E,isDisabled:true})}):null]})});ce.displayName="FreehandCanvas";var pe=h.memo(({line:t,options:o,strokeColor:r,strokeWidth:m})=>{let i=useMemo(()=>a$a(getStroke(t.map(([d,a,v])=>({x:d,y:a,pressure:v})),o)),[t,o]);return jsx("path",{d:i,stroke:r,strokeWidth:m})});pe.displayName="Stroke";var fe=h.memo(({line:t,options:o,strokeColor:r,strokeWidth:m})=>{let i=de({line:t,options:o});return jsx(Fragment,{children:i.map((d,a)=>jsx("path",{d,stroke:r,strokeWidth:m},a))})});fe.displayName="SplitStroke";function ue(t){if(typeof t.getCoalescedEvents=="function"){let o=t.getCoalescedEvents();return o.length>0?o.flatMap(r=>ue(r)):[t]}return [t]}var me=c$3({undo:{defaultMessage:"Undo",id:"bui.freehandCanvas.undo"},redo:{defaultMessage:"Redo",id:"bui.freehandCanvas.redo"}});export{ce as a};
@@ -1,10 +0,0 @@
1
- import {a as a$4}from'./chunk-43LOJ3SH.mjs';import {a as a$d}from'./chunk-PLZ6ZFEO.mjs';import {a as a$f}from'./chunk-O6FPWOHR.mjs';import {a as a$3,b as b$2}from'./chunk-TIGGKOJQ.mjs';import {a as a$2}from'./chunk-XDTKLQJB.mjs';import {a as a$g}from'./chunk-DO5YROCG.mjs';import {b as b$1}from'./chunk-SZTFMBPY.mjs';import {b as b$6}from'./chunk-AFOW62QN.mjs';import {a as a$c}from'./chunk-O7XK2WIX.mjs';import {a as a$e}from'./chunk-VXZT2JR2.mjs';import {a as a$1}from'./chunk-RPIUPWPO.mjs';import {a as a$h}from'./chunk-GMALMQWI.mjs';import {b as b$3}from'./chunk-N2XGJKZG.mjs';import {b as b$4}from'./chunk-K5RYVERS.mjs';import {b as b$5,j as j$1}from'./chunk-MBRNO6IW.mjs';import {a as a$b}from'./chunk-VDUFLHKK.mjs';import {a as a$a}from'./chunk-FPM5UJRF.mjs';import {a as a$8}from'./chunk-RSKKEGJZ.mjs';import {a as a$6}from'./chunk-STMDFIUL.mjs';import {j}from'./chunk-KUDCYGII.mjs';import {a as a$7}from'./chunk-B3EZOXNU.mjs';import {a as a$9}from'./chunk-RT4LMB6X.mjs';import {b,c as c$1}from'./chunk-3WKDIXCM.mjs';import {c}from'./chunk-ETM4MNG4.mjs';import {a}from'./chunk-JQQGRJ5J.mjs';import {a as a$5}from'./chunk-4QEH5CGK.mjs';import A from'react';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {sprinkles}from'@baseline-ui/tokens';/**
2
- * Copyright (c) 2023-2024 PSPDFKit GmbH. All rights reserved.
3
- *
4
- * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
5
- * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE PSPDFKIT LICENSE AGREEMENT.
6
- * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
7
- * This notice may not be removed from this file.
8
- *
9
- */
10
- var ne="_1yep5z6j8 _1yep5z6j9 _1yep5z6ja _1yep5z6jk _1yep5z6jl _1yep5z6jm _1yep5z6m3",me="_14uvjig3 _1yep5z6j8 _1yep5z6j9 _1yep5z6ja _1yep5z6jz _1yep5z6k0 _1yep5z6k1 _1yep5z69i _1yep5z69j _1yep5z69k",ue="_1yep5z6j8 _1yep5z6j9 _1yep5z6ja _1yep5z6kz _1yep5z6l0 _1yep5z6l1 _1yep5z6jz _1yep5z6k0 _1yep5z6k1",ye=a({defaultClassName:"_14uvjig0 _1yep5z6dy _1yep5z6ez",variantClassNames:{isDisabled:{true:"_1yep5z611l"},hasNumberInput:{false:"_1yep5z6p1 _1yep5z6p2 _1yep5z6p3"}},defaultVariants:{},compoundVariants:[]}),ce=a({defaultClassName:"_14uvjigb _1yep5z6b0 _1yep5z6b1 _1yep5z6b2 _1yep5z6bo _1yep5z6bp _1yep5z6bq _1yep5z6cc _1yep5z6cd _1yep5z6ce _1yep5z6d0 _1yep5z6d1 _1yep5z6d2 _1yep5z6gh _1yep5z6m5 _1yep5z6lq",variantClassNames:{active:{true:"_14uvjigc _1yep5z6136 _1yep5z618x _1yep5z618p"},isDisabled:{true:"_14uvjigd _1yep5z613a"},isReadOnly:{true:"_1yep5z615l _1yep5z615m _1yep5z615n"},isFocusVisible:{true:"_14uvjigf _1yep5z6136 _1yep5z6189"},isHovered:{true:"_14uvjigg _1yep5z6136"}},defaultVariants:{},compoundVariants:[]}),fe="z9nup8a _1yep5z6j8 _1yep5z6j9 _1yep5z6ja _1yep5z6jz _1yep5z6k0 _1yep5z6k1 _1yep5z6kt _1yep5z6ku _1yep5z6kv",be="_14uvjig4 z9nup87 _1yep5z6gd _1yep5z6m3",_e=a({defaultClassName:"_14uvjig5 _1yep5z6gh _1yep5z6iw _1yep5z6ix _1yep5z6iy _1yep5z6m4",variantClassNames:{active:{true:"_1yep5z6136"},isFocusVisible:{true:"_1yep5z6136"},isDisabled:{true:"_1yep5z613a"},isHovered:{true:"_1yep5z6136"}},defaultVariants:{},compoundVariants:[]});var N=A.forwardRef(({className:v,style:h,onChange:i,onChangeEnd:d,numberFormatOptions:o,isDisabled:e,step:S,minValue:n,maxValue:x,value:y,"aria-label":s,"aria-labelledby":r,"aria-details":m,"aria-describedby":u,"data-block-id":c$1,"data-block-class":I,defaultValue:T,isReadOnly:f,label:b$2,description:j,id:k,includeNumberInput:_,numberInputClassName:l,numberInputStyle:he},Se)=>{let H=A.useRef(null),F=c(),O={onChange:i===void 0?void 0:g=>{i(g[0]);},isDisabled:e||f,step:S,minValue:n,maxValue:x,onChangeEnd:d===void 0?void 0:g=>{d(g[0]);},value:y===void 0?void 0:[y],defaultValue:T===void 0?void 0:[T],"aria-label":s,"aria-labelledby":r,"aria-details":m,"aria-describedby":[j?F:void 0,u].filter(Boolean).join(" ")||void 0,id:k,label:b$2},xe=a$1(o),z=a$2({...O,numberFormatter:xe}),{trackProps:je,groupProps:ke,labelProps:L}=a$3(O,z,H),U=jsx(a$4,{variant:"ghost",showStepper:false,className:l,"aria-label":s,"aria-labelledby":L.id,isDisabled:e,isReadOnly:f,value:z.getThumbValue(0),formatOptions:o,onChange:g=>{Number.isNaN(g)||(z.setThumbDragging(0,true),z.setThumbValue(0,g),z.setThumbDragging(0,false));},style:{width:60,textAlign:"right",flexShrink:0,...he}});return jsxs("div",{...ke,style:h,"data-block-id":c$1,"data-block-class":I,className:a$5(ne,"BaselineUI-Slider",v),children:[b$2?jsxs("div",{className:ue,children:[jsx("label",{...L,className:a$5(ye({isDisabled:e,hasNumberInput:!!_}),"BaselineUI-Slider-Label"),children:b$2}),_?U:null]}):null,jsxs("div",{className:me,children:[jsx("div",{...je,className:a$5(be,"BaselineUI-Slider-Track"),ref:b(H,Se),"data-testid":"track",children:jsx(Pe,{state:z,trackRef:H,isDisabled:e,isReadOnly:f})}),_&&!b$2?U:null]}),b$1({description:j,descriptionProps:{id:F},errorMessageProps:{},isDisabled:e})]})});N.displayName="Slider";function Pe({state:v,trackRef:h,isDisabled:i,isReadOnly:d}){let o=A.useRef(null),{thumbProps:e,inputProps:S,isDragging:n}=b$2({trackRef:h,inputRef:o},v),{focusProps:x,isFocused:y,isFocusVisible:s}=a$6(),{hoverProps:r,isHovered:m}=a$7({isDisabled:i}),{direction:u}=b$3(),c=a$8({"data-disabled":i,"data-readonly":d,"data-hovered":m,"data-focus-visible":s,"data-dragging":n,"data-focused":y});return jsxs(Fragment,{children:[jsx("div",{className:a$5(_e({isDisabled:i,isFocusVisible:s,active:n,isHovered:m}),"BaselineUI-Slider-TrackHighlight"),style:{width:u==="rtl"?`calc(100% - ${e.style?.left})`:e.style?.left},"data-testid":"track-highlight"}),jsxs("div",{...c$1(e,r,c),className:a$5(fe,"BaselineUI-Slider-ThumbHandle"),"data-testid":"thumb",children:[jsx("div",{className:a$5(ce({isDisabled:i,isFocusVisible:s,active:n,isReadOnly:d,isHovered:m}),"BaselineUI-Slider-Thumb")}),jsx(b$4,{children:jsx("input",{ref:o,...c$1(S,x)})})]})]})}var ve=A.forwardRef(({className:v,style:h,onChange:i,"data-block-id":d,icon:o,formatValue:e=u=>u,tooltip:S=true,iconTooltip:n=true,popoverContentProps:x,isDisabled:y,onTriggerPress:s,...r},m)=>{let u=a$9(m),[c,I]=a$a(r.value,r.defaultValue||0,i),[T,f]=A.useState(false),{keyboardProps:b}=j({onKeyDown:l=>{l.key==="Enter"||l.key==="Escape"?f(false):l.continuePropagation();}}),{tooltipProps:j$2}=a$b({label:r["aria-label"],tooltip:S}),k=e(c||0),_=j$2?.isDisabled||r["aria-label"]?`${r["aria-label"]}, ${k}`:k.toString();return jsxs(a$c,{display:"flex",flexDirection:"row",gap:"md",paddingX:"md",alignItems:"center",className:a$5("BaselineUI-IconSlider",v),"data-block-id":d,style:h,ref:u,children:[o?jsx(a$d,{icon:o,label:r["aria-label"],tooltip:n,"aria-hidden":"true",size:24,isFocusable:false,className:sprinkles({color:"icon.primary"})}):null,jsxs(b$5,{type:"dialog",isOpen:T,onOpenChange:f,children:[jsx(j$1,{children:jsx(a$e,{...j$2,children:jsx(b$6,{label:k,variant:"popover","aria-label":_,isDisabled:y,style:{fontVariantNumeric:"tabular-nums",minWidth:68,justifyContent:"space-between"},onPressStart:s})})}),jsx(a$f,{placement:"bottom start",...x,children:jsx(a$g,{size:"content","aria-label":_,children:jsx(a$h,{autoFocus:true,children:jsx(a$c,{paddingY:"sm",paddingX:"lg",marginY:"md",style:{width:215},...b,children:jsx(N,{...r,onChange:l=>{I(l),i?.(l);},value:c})})})})})]})]})});ve.displayName="IconSlider";export{N as a,ve as b};
@@ -1,10 +0,0 @@
1
- import {b as b$1}from'./chunk-4EAXDHSV.mjs';import {a as a$1}from'./chunk-2UUKKXBD.mjs';import {a}from'./chunk-KX7WG3L4.mjs';import {b}from'./chunk-N2XGJKZG.mjs';import {c}from'./chunk-3WKDIXCM.mjs';import {a as a$2}from'./chunk-4QEH5CGK.mjs';import {MotionConfig,MotionGlobalConfig}from'motion/react';export{MotionGlobalConfig as f}from'motion/react';import {lightTheme,themes,themeVars}from'@baseline-ui/tokens';import {assignInlineVars}from'@vanilla-extract/dynamic';import J,{createContext,useMemo,useEffect,useState}from'react';import {jsx}from'react/jsx-runtime';/**
2
- * Copyright (c) 2023-2024 PSPDFKit GmbH. All rights reserved.
3
- *
4
- * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
5
- * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE PSPDFKIT LICENSE AGREEMENT.
6
- * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
7
- * This notice may not be removed from this file.
8
- *
9
- */
10
- function v(r=typeof window>"u"?void 0:window){let[p,s]=useState("light"),[a,i]=useState(false),[u,n]=useState(false),[f,m]=useState(false);return useEffect(()=>{if(!r)return;let e=r.matchMedia("(prefers-color-scheme: dark)"),t=o=>{s(o.matches?"dark":"light");};return s(e.matches?"dark":"light"),e.addEventListener("change",t),()=>{e.removeEventListener("change",t);}},[r]),useEffect(()=>{if(!r)return;let e=r.matchMedia("(prefers-contrast: more)"),t=o=>{i(o.matches);};return i(e.matches),e.addEventListener("change",t),()=>{e.removeEventListener("change",t);}},[r]),useEffect(()=>{if(!r)return;let e=r.matchMedia("(prefers-reduced-motion: reduce)"),t=o=>{n(o.matches);};return n(e.matches),e.addEventListener("change",t),()=>{e.removeEventListener("change",t);}},[r]),useEffect(()=>{if(!r)return;let e=r.matchMedia("(prefers-reduced-transparency: reduce)"),t=o=>{m(o.matches);};return m(e.matches),e.addEventListener("change",t),()=>{e.removeEventListener("change",t);}},[r]),{colorScheme:p,highContrast:a,reducedMotion:u,transparency:f}}var k=createContext({theme:lightTheme,setTheme:()=>{},shouldHandleVirtualKeyboard:true});var A="var(--hj25q10)";var h={LIGHT:themes.base.light,DARK:themes.base.dark},R=J.forwardRef(({theme:r="system",children:p,setTheme:s,onThemeChange:a$3,className:i,style:u,UNSAFE_domProps:n,"data-block-id":f,"data-block-class":m,reducedMotion:e="user",shouldHandleVirtualKeyboard:t=true,minTouchTargetSize:o=24},U)=>{let{direction:P}=b(),{colorScheme:g,reducedMotion:V,highContrast:D,transparency:G}=v(),{name:K,...l}=useMemo(()=>{switch(r){case "system":return g==="light"?h.LIGHT:h.DARK;case "light":return h.LIGHT;case "dark":return h.DARK;default:return r}},[g,r]),N=a(),z={"data-theme":K,"data-block-id":f,"data-block-class":m,"data-reduced-motion":e==="user"?V:e==="always","data-high-contrast":D,"data-transparency":G,"data-device":N},B=useMemo(()=>({theme:l,setTheme:y=>{s?.(y),a$3?.(y);},shouldHandleVirtualKeyboard:t}),[l,s,a$3,t]);return useEffect(()=>{s&&console.warn("ThemeProvider: The `setTheme` prop is deprecated and will be removed in a future version of Baseline UI. Use the `onThemeChange` prop instead.");},[s]),jsx(k.Provider,{value:B,children:jsx(MotionConfig,{reducedMotion:e,children:jsx("div",{...c(n,z),className:a$2(b$1,"BaselineUI-ThemeProvider",i),style:{...assignInlineVars(themeVars,l),...assignInlineVars({[a$1]:P==="rtl"?"-1":"1",[A]:`${o}px`}),...u},dir:P,ref:U,children:p})})})});R.displayName="ThemeProvider";function ve(){MotionGlobalConfig.skipAnimations=true;}function Te(){MotionGlobalConfig.skipAnimations=false;}export{v as a,k as b,R as c,ve as d,Te as e};
@@ -1,10 +0,0 @@
1
- import {a as a$2}from'./chunk-2JGVUCP5.mjs';import {a as a$1}from'./chunk-7SKQUEHP.mjs';import {b}from'./chunk-K5RYVERS.mjs';import {a as a$5}from'./chunk-RSKKEGJZ.mjs';import {a as a$3}from'./chunk-STMDFIUL.mjs';import {a as a$4}from'./chunk-B3EZOXNU.mjs';import {c}from'./chunk-3WKDIXCM.mjs';import {a}from'./chunk-JQQGRJ5J.mjs';import {a as a$6}from'./chunk-4QEH5CGK.mjs';import C from'react';import {jsx,jsxs}from'react/jsx-runtime';/**
2
- * Copyright (c) 2023-2024 PSPDFKit GmbH. All rights reserved.
3
- *
4
- * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
5
- * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE PSPDFKIT LICENSE AGREEMENT.
6
- * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
7
- * This notice may not be removed from this file.
8
- *
9
- */
10
- var h=a({defaultClassName:"bpklwa7 z9nup88",variantClassNames:{isReadOnly:{true:"bpklwa8"},isDisabled:{true:"bpklwa9"},isSelected:{true:"bpklwaa"},isFocused:{true:"bpklwab"}},defaultVariants:{},compoundVariants:[[{isSelected:true,isDisabled:false,isReadOnly:false},"bpklwac"]]}),v=a({defaultClassName:"bpklwae",variantClassNames:{isDisabled:{true:"bpklwaf"},isSelected:{true:"bpklwag"},isReadOnly:{true:"bpklwah"}},defaultVariants:{},compoundVariants:[]}),g="bpklwad",y=a({defaultClassName:"bpklwa0",variantClassNames:{labelPosition:{top:"bpklwa1",left:"bpklwa2"}},defaultVariants:{},compoundVariants:[]}),x="bpklwa6",S=a({defaultClassName:"bpklwa3",variantClassNames:{labelPosition:{top:"bpklwa4",left:"bpklwa5"}},defaultVariants:{},compoundVariants:[]});var R=C.forwardRef(({className:V,label:r,labelPosition:d="top",statusLabel:l,style:D,"data-block-id":P,"data-block-class":O,...a},L)=>{let c$1=C.useRef(null),t=a$1(a),{inputProps:H,isPressed:I,labelProps:B}=a$2({...a,children:r},t,c$1),{isFocusVisible:s,focusProps:F}=a$3(),{hoverProps:T,isHovered:U}=a$4({isDisabled:a.isDisabled}),K=a$5({"data-block-id":P,"data-block-class":O,"data-focused":s,"data-disabled":a.isDisabled,"data-focus-visible":s,"data-selected":t.isSelected,"data-readonly":a.isReadOnly,"data-hovered":U,"data-pressed":I}),p=jsx("div",{className:a$6(h({isSelected:t.isSelected,isDisabled:!!a.isDisabled,isFocused:s,isReadOnly:!!a.isReadOnly}),"BaselineUI-Switch-Track"),children:jsx("div",{className:a$6(v({isSelected:t.isSelected,isDisabled:a.isDisabled,isReadOnly:a.isReadOnly}),"BaselineUI-Switch-Knob"),"data-testid":"switch-knob"})});return jsxs("label",{...c(K,B,T),className:a$6(y({labelPosition:d}),"BaselineUI-Switch",V),style:D,ref:L,children:[r?jsx("span",{className:a$6(g,"BaselineUI-Switch-Label"),children:r}):null,jsx(b,{children:jsx("input",{...c(H,F),ref:c$1})}),l?jsxs("div",{className:S({labelPosition:d}),children:[jsx("span",{className:a$6("BaselineUI-Switch-Status-Label",x),children:t.isSelected?l.on:l.off}),p]}):p]})});R.displayName="Switch";export{R as a};
@@ -1,10 +0,0 @@
1
- import {a as a$a}from'./chunk-KT4FTBJ2.mjs';import {j,c,i,l,p,r,s,m,x,u,v,k,f as f$2,e as e$1,y,d,q,a as a$h}from'./chunk-YQHHE5AT.mjs';import {a as a$e}from'./chunk-AMW7LGCF.mjs';import {b as b$1,c as c$5}from'./chunk-X5ORCNAU.mjs';import {c as c$8}from'./chunk-BROSGYL3.mjs';import {c as c$2,f as f$1,e as e$2,d as d$2}from'./chunk-WFYFHANE.mjs';import {a as a$f}from'./chunk-TAT552A5.mjs';import {a as a$l}from'./chunk-LSPDPDB6.mjs';import {b as b$3}from'./chunk-XAM3AXXK.mjs';import {d as d$3}from'./chunk-QMV2O57M.mjs';import {b,c as c$1}from'./chunk-DF2D7NE6.mjs';import {a as a$b,f as f$3}from'./chunk-ZQOR4LCM.mjs';import {f as f$4}from'./chunk-UZ672WDX.mjs';import {a as a$7,b as b$6}from'./chunk-UO75BAPM.mjs';import {a as a$c}from'./chunk-O7XK2WIX.mjs';import {b as b$9}from'./chunk-OQPYPKZV.mjs';import {a as a$3}from'./chunk-GMALMQWI.mjs';import {a}from'./chunk-USMC34OO.mjs';import {b as b$8}from'./chunk-KG2EHFYA.mjs';import {a as a$p}from'./chunk-Z4QTH4TB.mjs';import {b as b$2}from'./chunk-N2XGJKZG.mjs';import {a as a$o}from'./chunk-22MA6EYO.mjs';import {e,h,c as c$3,b as b$4,f,a as a$8,d as d$1,k as k$2}from'./chunk-AYQN3OH2.mjs';import {a as a$m}from'./chunk-22VRCVTH.mjs';import {a as a$g}from'./chunk-66CUIXA6.mjs';import {k as k$1,l as l$1,e as e$4}from'./chunk-TZGK36KC.mjs';import {a as a$k}from'./chunk-AI6WQPRX.mjs';import {a as a$1}from'./chunk-STMDFIUL.mjs';import {c as c$7}from'./chunk-HH4VLTF3.mjs';import {a as a$6}from'./chunk-4S4GGUSH.mjs';import {j as j$1,b as b$5,d as d$5,f as f$5}from'./chunk-KUDCYGII.mjs';import {a as a$5}from'./chunk-B3EZOXNU.mjs';import {d as d$4}from'./chunk-F7WPMQ3P.mjs';import {a as a$4}from'./chunk-RT4LMB6X.mjs';import {a as a$j,o,r as r$1,u as u$1,s as s$1,h as h$2,e as e$5}from'./chunk-PPHSLODC.mjs';import {c as c$4}from'./chunk-3WKDIXCM.mjs';import {a as a$2}from'./chunk-SVIYLH7R.mjs';import {c as c$6,a as a$i,e as e$3}from'./chunk-ETM4MNG4.mjs';import {m as m$1,h as h$1,j as j$2,i as i$1,b as b$7,a as a$n}from'./chunk-SD43KVTU.mjs';import {a as a$9}from'./chunk-JQQGRJ5J.mjs';import {a as a$d}from'./chunk-4QEH5CGK.mjs';import Me,{createContext,forwardRef,useContext,useMemo,useRef,useEffect,useCallback,useImperativeHandle,useState}from'react';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {ChevronRightFilledIcon}from'@baseline-ui/icons/8';import {CheckmarkIcon as CheckmarkIcon$1}from'@baseline-ui/icons/12';import {CheckmarkIcon}from'@baseline-ui/icons/24';/**
2
- * Copyright (c) 2023-2024 PSPDFKit GmbH. All rights reserved.
3
- *
4
- * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
5
- * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE PSPDFKIT LICENSE AGREEMENT.
6
- * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
7
- * This notice may not be removed from this file.
8
- *
9
- */
10
- var Pe=createContext({}),Ge=j(c,function(e$1,t){return [e$1,t]=e(e$1,t,Pe),jsx(h.header,{className:"react-aria-Header",...e$1,ref:t,children:e$1.children})});var Xe=createContext({});var pt=createContext(null),se=createContext(null),mt=forwardRef(function(e$1,t){[e$1,t]=e(e$1,t,pt);let o=useContext(se);return o?jsx(Ar,{state:o,props:e$1,listBoxRef:t}):jsx(i,{content:jsx(l,{...e$1}),children:n=>jsx(go,{props:e$1,listBoxRef:t,collection:n})})});function go({props:r,listBoxRef:e,collection:t}){r={...r,collection:t,children:null,items:null};let{layoutDelegate:o}=useContext(p),n=b({...r,layoutDelegate:o});return jsx(Ar,{state:n,props:r,listBoxRef:e})}function Ar({state:r$1,props:e$1,listBoxRef:t}){[e$1,t]=e(e$1,t,b$1);let{dragAndDropHooks:o,layout:n="stack",orientation:i="vertical",filter:l}=e$1,s$1=c$1(r$1,l),{collection:c,selectionManager:u$1}=s$1,a$4=!!o?.useDraggableCollectionState,d=!!o?.useDroppableCollectionState,{direction:g}=b$2(),{disabledBehavior:p$1,disabledKeys:x$1}=u$1,y=a({usage:"search",sensitivity:"base"}),{isVirtualized:m$1,layoutDelegate:b,dropTargetDelegate:S,CollectionRoot:M}=useContext(p),R=useMemo(()=>e$1.keyboardDelegate||new b$3({collection:c,collator:y,ref:t,disabledKeys:x$1,disabledBehavior:p$1,layout:n,orientation:i,direction:g,layoutDelegate:b}),[c,y,t,p$1,x$1,i,g,e$1.keyboardDelegate,n,b]),{listBoxProps:I}=c$2({...e$1,shouldSelectOnPressUp:a$4||e$1.shouldSelectOnPressUp,keyboardDelegate:R,isVirtualized:m$1},s$1,t),F=useRef(a$4),f=useRef(d);useEffect(()=>{process.env.NODE_ENV!=="production"&&(F.current!==a$4&&console.warn("Drag hooks were provided during one render, but not another. This should be avoided as it may produce unexpected behavior."),f.current!==d&&console.warn("Drop hooks were provided during one render, but not another. This should be avoided as it may produce unexpected behavior."));},[a$4,d]);let T,E,B,P=false,v$1=null,C=useRef(null);if(a$4&&o){T=o.useDraggableCollectionState({collection:c,selectionManager:u$1,preview:o.renderDragPreview?C:void 0}),o.useDraggableCollection({},T,t);let Y=o.DragPreview;v$1=o.renderDragPreview?jsx(Y,{ref:C,children:o.renderDragPreview}):null;}if(d&&o){E=o.useDroppableCollectionState({collection:c,selectionManager:u$1});let Y=o.dropTargetDelegate||S||new o.ListDropTargetDelegate(c,t,{orientation:i,layout:n,direction:g});B=o.useDroppableCollection({keyboardDelegate:R,dropTargetDelegate:Y},E,t),P=E.isDropTarget({type:"root"});}let{focusProps:_,isFocused:U,isFocusVisible:K}=a$1(),H=s$1.collection.size===0,X={isDropTarget:P,isEmpty:H,isFocused:U,isFocusVisible:K,layout:e$1.layout||"stack",orientation:i,state:s$1},ae=c$3({...e$1,children:void 0,defaultClassName:"react-aria-ListBox",values:X}),oe=null;H&&e$1.renderEmptyState&&(oe=jsx("div",{role:"option",style:{display:"contents"},children:e$1.renderEmptyState(X)}));let J=a$2(e$1,{global:true});return jsx(a$3,{children:jsxs(h.div,{...c$4(J,ae,I,_,B?.collectionProps),ref:t,slot:e$1.slot||void 0,onScroll:e$1.onScroll,"data-drop-target":P||void 0,"data-empty":H||void 0,"data-focused":U||void 0,"data-focus-visible":K||void 0,"data-layout":e$1.layout||"stack","data-orientation":i,children:[jsx(b$4,{values:[[pt,e$1],[se,s$1],[r,{dragAndDropHooks:o,dragState:T,dropState:E}],[Xe,{elementType:"div"}],[s,{render:yo}],[m,{name:"ListBoxSection",render:Ir}]],children:jsx(x,{children:jsx(M,{collection:c,scrollRef:t,persistedKeys:v(u$1,o,E),renderDropIndicator:u(o,E)})})}),oe,v$1]})})}function Ir(r$1,e,t,o="react-aria-ListBoxSection"){let n=useContext(se),{dragAndDropHooks:i,dropState:l}=useContext(r),{CollectionBranch:s}=useContext(p),[c,u$1]=f(),{headingProps:a,groupProps:d}=f$1({heading:u$1,"aria-label":r$1["aria-label"]??void 0}),g=c$3({...r$1,id:void 0,children:void 0,defaultClassName:o,values:void 0}),p$1=a$2(r$1,{global:true});return delete p$1.id,jsx(h.section,{...c$4(p$1,g,d),ref:e,children:jsx(Pe.Provider,{value:{...a,ref:c},children:jsx(s,{collection:n.collection,parent:t,renderDropIndicator:u(i,l)})})})}var ft=k(f$2,Ir),gt=j(e$1,function(e,t,o){let n=a$4(t),i=useContext(se),{dragAndDropHooks:l,dragState:s,dropState:c}=useContext(r),u=s&&!(s.isDisabled||s.selectionManager.isDisabled(o.key)),{optionProps:a,labelProps:d,descriptionProps:g,...p}=e$2({key:o.key,"aria-label":e?.["aria-label"]},i,n),{hoverProps:x,isHovered:y$1}=a$5({isDisabled:!p.allowsSelection&&!p.hasAction&&!u,onHoverStart:o.props.onHoverStart,onHoverChange:o.props.onHoverChange,onHoverEnd:o.props.onHoverEnd}),{keyboardProps:m}=j$1(e),{focusProps:b}=a$6(e),S=null;s&&l&&(S=l.useDraggableItem({key:o.key,hasAction:p.hasAction},s,n));let M=null;c&&l&&(M=l.useDroppableItem({target:{type:"item",key:o.key,dropPosition:"on"}},c,n));let R=s&&s.isDragging(o.key),I=c$3({...e,id:void 0,children:e.children,defaultClassName:"react-aria-ListBoxItem",values:{...p,isHovered:y$1,selectionMode:i.selectionManager.selectionMode,selectionBehavior:i.selectionManager.selectionBehavior,allowsDragging:!!s,isDragging:R,isDropTarget:M?.isDropTarget}});useEffect(()=>{!o.textValue&&process.env.NODE_ENV!=="production"&&console.warn("A `textValue` prop is required for <ListBoxItem> elements with non-plain text children in order to support accessibility features such as type to select.");},[o.textValue]);let F=e.href?h.a:h.div,f=a$2(e,{global:true});return delete f.id,delete f.onClick,e.href&&a.tabIndex==null&&(a.tabIndex=-1),jsx(F,{...c$4(f,I,a,x,m,b,S?.dragProps,M?.dropProps),ref:n,"data-allows-dragging":!!s||void 0,"data-selected":p.isSelected||void 0,"data-disabled":p.isDisabled||void 0,"data-hovered":y$1||void 0,"data-focused":p.isFocused||void 0,"data-focus-visible":p.isFocusVisible||void 0,"data-pressed":p.isPressed||void 0,"data-dragging":R||void 0,"data-drop-target":M?.isDropTarget||void 0,"data-selection-mode":i.selectionManager.selectionMode==="none"?void 0:i.selectionManager.selectionMode,children:jsx(b$4,{values:[[a$7,{slots:{[a$8]:d,label:d,description:g}}],[y,{isSelected:p.isSelected}]],children:I.children})})});function yo(r$1,e){e=a$4(e);let{dragAndDropHooks:t,dropState:o}=useContext(r),{dropIndicatorProps:n,isHidden:i,isDropTarget:l}=t.useDropIndicator(r$1,o,e);return i?null:jsx(bo,{...r$1,dropIndicatorProps:n,isDropTarget:l,ref:e})}function Po(r,e){let{dropIndicatorProps:t,isDropTarget:o,...n}=r,i=c$3({...n,defaultClassName:"react-aria-DropIndicator",values:{isDropTarget:o}});return jsx(Fragment,{children:jsx(h.div,{...t,...i,role:"option",ref:e,"data-drop-target":o||void 0})})}var bo=forwardRef(Po);j(d,function(e,t,o){let n=useContext(se),{isLoading:i,onLoadMore:l,scrollOffset:s,...c}=e,u=useRef(null),a=useMemo(()=>({onLoadMore:l,collection:n?.collection,sentinelRef:u,scrollOffset:s}),[l,s,n?.collection]);k$1(a,u);let d=c$3({...c,id:void 0,children:o.rendered,defaultClassName:"react-aria-ListBoxLoadingIndicator",values:void 0}),g={tabIndex:-1};return jsxs(Fragment,{children:[jsx("div",{style:{position:"relative",width:0,height:0},inert:l$1(true),children:jsx("div",{"data-testid":"loadMoreSentinel",ref:u,style:{position:"absolute",height:1,width:1}})}),i&&d.children&&jsx(Fragment,{children:jsx(h.div,{...c$4(a$2(e,{global:true}),g),...d,role:"option",ref:t,children:d.children})})]})});var $e=({renderOption:r,optionClassName:e,optionStyle:t,renderSectionHeader:o,sectionClassName:n,sectionStyle:i,showSectionHeader:l,withSectionHeaderPadding:s}={})=>Object.values({renderOption:r,optionClassName:e,optionStyle:t,renderSectionHeader:o,sectionClassName:n,sectionStyle:i,showSectionHeader:l,withSectionHeaderPadding:s});var Si=a$9({defaultClassName:"_1fjxa6ld _1yep5z6m8 _1yep5z6m7 _1yep5z6is _1yep5z6lq",variantClassNames:{isDropTarget:{true:"_1yep5z614w"},orientation:{vertical:"_1yep5z618m",horizontal:"_1yep5z618n"}},defaultVariants:{},compoundVariants:[]}),wr="_1fjxa6la _1yep5z6m6 _1yep5z6j8 _1yep5z6j9 _1yep5z6ja",Fr=a$9({defaultClassName:"_1fjxa6lb _1yep5z6ez _1yep5z6da _1yep5z6dv",variantClassNames:{isDisabled:{true:"_1yep5z6f2"}},defaultVariants:{},compoundVariants:[]}),Br=a$9({defaultClassName:"_1fjxa6l3 _1yep5z63r _1yep5z63s _1yep5z63t _1yep5z61f _1yep5z61g _1yep5z61h _1yep5z6j8 _1yep5z6j9 _1yep5z6ja _1yep5z6jh _1yep5z6ji _1yep5z6jj _1yep5z6jz _1yep5z6k0 _1yep5z6k1 _1yep5z6kz _1yep5z6l0 _1yep5z6l1 _1yep5z69l _1yep5z69m _1yep5z69n _1yep5z6dy _1yep5z6ey _1yep5z6lq _1yep5z6lt _1yep5z6m6 _1yep5z6m5 _1yep5z6m3 _1yep5z6m0",variantClassNames:{isSelected:{},isFocused:{true:"_1yep5z614w _1yep5z618s _1yep5z618q _1yep5z618t _1yep5z615c _1yep5z615d _1yep5z615e"},isFirstChild:{true:"_1fjxa6l5"},isLastChild:{true:"_1fjxa6l6"},isHovered:{true:"_1yep5z612t",false:"_1yep5z612s"},isDisabled:{true:"z9nup82 _1yep5z611l"}},defaultVariants:{},compoundVariants:[]}),Hr="_1fjxa6lh _1yep5z63 _1yep5z64 _1yep5z65 _1yep5z62f _1yep5z62g _1yep5z62h _1yep5z69l _1yep5z69m _1yep5z69n _1yep5z6j8 _1yep5z6j9 _1yep5z6ja _1yep5z6jz _1yep5z6k0 _1yep5z6k1",Nr="_1fjxa6l1",zr="_1fjxa6l2",_r="_1fjxa6l0";var Kr={"ar-AE":{longPressMessage:"\u0627\u0636\u063A\u0637 \u0645\u0637\u0648\u0644\u0627\u064B \u0623\u0648 \u0627\u0636\u063A\u0637 \u0639\u0644\u0649 Alt + \u0627\u0644\u0633\u0647\u0645 \u0644\u0623\u0633\u0641\u0644 \u0644\u0641\u062A\u062D \u0627\u0644\u0642\u0627\u0626\u0645\u0629"},"bg-BG":{longPressMessage:"\u041D\u0430\u0442\u0438\u0441\u043D\u0435\u0442\u0435 \u043F\u0440\u043E\u0434\u044A\u043B\u0436\u0438\u0442\u0435\u043B\u043D\u043E \u0438\u043B\u0438 \u043D\u0430\u0442\u0438\u0441\u043D\u0435\u0442\u0435 Alt+ \u0441\u0442\u0440\u0435\u043B\u043A\u0430 \u043D\u0430\u0434\u043E\u043B\u0443, \u0437\u0430 \u0434\u0430 \u043E\u0442\u0432\u043E\u0440\u0438\u0442\u0435 \u043C\u0435\u043D\u044E\u0442\u043E"},"cs-CZ":{longPressMessage:"Dlouh\xFDm stiskem nebo stisknut\xEDm kl\xE1ves Alt + \u0161ipka dol\u016F otev\u0159ete nab\xEDdku"},"da-DK":{longPressMessage:"Langt tryk eller tryk p\xE5 Alt + pil ned for at \xE5bne menuen"},"de-DE":{longPressMessage:"Dr\xFCcken Sie lange oder dr\xFCcken Sie Alt + Nach-unten, um das Men\xFC zu \xF6ffnen"},"el-GR":{longPressMessage:"\u03A0\u03B9\u03AD\u03C3\u03C4\u03B5 \u03C0\u03B1\u03C1\u03B1\u03C4\u03B5\u03C4\u03B1\u03BC\u03AD\u03BD\u03B1 \u03AE \u03C0\u03B1\u03C4\u03AE\u03C3\u03C4\u03B5 Alt + \u03BA\u03AC\u03C4\u03C9 \u03B2\u03AD\u03BB\u03BF\u03C2 \u03B3\u03B9\u03B1 \u03BD\u03B1 \u03B1\u03BD\u03BF\u03AF\u03BE\u03B5\u03C4\u03B5 \u03C4\u03BF \u03BC\u03B5\u03BD\u03BF\u03CD"},"en-US":{longPressMessage:"Long press or press Alt + ArrowDown to open menu"},"es-ES":{longPressMessage:"Mantenga pulsado o pulse Alt + flecha abajo para abrir el men\xFA"},"et-EE":{longPressMessage:"Men\xFC\xFC avamiseks vajutage pikalt v\xF5i vajutage klahve Alt + allanool"},"fi-FI":{longPressMessage:"Avaa valikko painamalla pohjassa tai n\xE4pp\xE4inyhdistelm\xE4ll\xE4 Alt + Alanuoli"},"fr-FR":{longPressMessage:"Appuyez de mani\xE8re prolong\xE9e ou appuyez sur Alt\xA0+\xA0Fl\xE8che vers le bas pour ouvrir le menu."},"he-IL":{longPressMessage:"\u05DC\u05D7\u05E5 \u05DC\u05D7\u05D9\u05E6\u05D4 \u05D0\u05E8\u05D5\u05DB\u05D4 \u05D0\u05D5 \u05D4\u05E7\u05E9 Alt + ArrowDown \u05DB\u05D3\u05D9 \u05DC\u05E4\u05EA\u05D5\u05D7 \u05D0\u05EA \u05D4\u05EA\u05E4\u05E8\u05D9\u05D8"},"hr-HR":{longPressMessage:"Dugo pritisnite ili pritisnite Alt + strelicu prema dolje za otvaranje izbornika"},"hu-HU":{longPressMessage:"Nyomja meg hosszan, vagy nyomja meg az Alt + lefele ny\xEDl gombot a men\xFC megnyit\xE1s\xE1hoz"},"it-IT":{longPressMessage:"Premi a lungo o premi Alt + Freccia gi\xF9 per aprire il menu"},"ja-JP":{longPressMessage:"\u9577\u62BC\u3057\u307E\u305F\u306F Alt+\u4E0B\u77E2\u5370\u30AD\u30FC\u3067\u30E1\u30CB\u30E5\u30FC\u3092\u958B\u304F"},"ko-KR":{longPressMessage:"\uAE38\uAC8C \uB204\uB974\uAC70\uB098 Alt + \uC544\uB798\uCABD \uD654\uC0B4\uD45C\uB97C \uB20C\uB7EC \uBA54\uB274 \uC5F4\uAE30"},"lt-LT":{longPressMessage:"Nor\u0117dami atidaryti meniu, nuspaud\u0119 palaikykite arba paspauskite \u201EAlt + ArrowDown\u201C."},"lv-LV":{longPressMessage:"Lai atv\u0113rtu izv\u0113lni, turiet nospiestu vai nospiediet tausti\u0146u kombin\u0101ciju Alt + lejupv\u0113rst\u0101 bulti\u0146a"},"nb-NO":{longPressMessage:"Langt trykk eller trykk Alt + PilNed for \xE5 \xE5pne menyen"},"nl-NL":{longPressMessage:"Druk lang op Alt + pijl-omlaag of druk op Alt om het menu te openen"},"pl-PL":{longPressMessage:"Naci\u015Bnij i przytrzymaj lub naci\u015Bnij klawisze Alt + Strza\u0142ka w d\xF3\u0142, aby otworzy\u0107 menu"},"pt-BR":{longPressMessage:"Pressione e segure ou pressione Alt + Seta para baixo para abrir o menu"},"pt-PT":{longPressMessage:"Prima continuamente ou prima Alt + Seta Para Baixo para abrir o menu"},"ro-RO":{longPressMessage:"Ap\u0103sa\u021Bi lung sau ap\u0103sa\u021Bi pe Alt + s\u0103geat\u0103 \xEEn jos pentru a deschide meniul"},"ru-RU":{longPressMessage:"\u041D\u0430\u0436\u043C\u0438\u0442\u0435 \u0438 \u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0439\u0442\u0435 \u0438\u043B\u0438 \u043D\u0430\u0436\u043C\u0438\u0442\u0435 Alt + \u0421\u0442\u0440\u0435\u043B\u043A\u0430 \u0432\u043D\u0438\u0437, \u0447\u0442\u043E\u0431\u044B \u043E\u0442\u043A\u0440\u044B\u0442\u044C \u043C\u0435\u043D\u044E"},"sk-SK":{longPressMessage:"Ponuku otvor\xEDte dlh\xFDm stla\u010Den\xEDm alebo stla\u010Den\xEDm kl\xE1vesu Alt + kl\xE1vesu so \u0161\xEDpkou nadol"},"sl-SI":{longPressMessage:"Za odprtje menija pritisnite in dr\u017Eite gumb ali pritisnite Alt+pu\u0161\u010Dica navzdol"},"sr-SP":{longPressMessage:"Dugo pritisnite ili pritisnite Alt + strelicu prema dole da otvorite meni"},"sv-SE":{longPressMessage:"H\xE5ll nedtryckt eller tryck p\xE5 Alt + pil ned\xE5t f\xF6r att \xF6ppna menyn"},"tr-TR":{longPressMessage:"Men\xFCy\xFC a\xE7mak i\xE7in uzun bas\u0131n veya Alt + A\u015Fa\u011F\u0131 Ok tu\u015Funa bas\u0131n"},"uk-UA":{longPressMessage:"\u0414\u043E\u0432\u0433\u043E \u0430\u0431\u043E \u0437\u0432\u0438\u0447\u0430\u0439\u043D\u043E \u043D\u0430\u0442\u0438\u0441\u043D\u0456\u0442\u044C \u043A\u043E\u043C\u0431\u0456\u043D\u0430\u0446\u0456\u044E \u043A\u043B\u0430\u0432\u0456\u0448 Alt \u0456 \u0441\u0442\u0440\u0456\u043B\u043A\u0430 \u0432\u043D\u0438\u0437, \u0449\u043E\u0431 \u0432\u0456\u0434\u043A\u0440\u0438\u0442\u0438 \u043C\u0435\u043D\u044E"},"zh-CN":{longPressMessage:"\u957F\u6309\u6216\u6309 Alt + \u5411\u4E0B\u65B9\u5411\u952E\u4EE5\u6253\u5F00\u83DC\u5355"},"zh-TW":{longPressMessage:"\u9577\u6309\u6216\u6309 Alt+\u5411\u4E0B\u9375\u4EE5\u958B\u555F\u529F\u80FD\u8868"}};function Vr(r){let{onContextMenu:e}=r,t=useRef(false),{longPressProps:o}=a$p({onLongPressStart(){t.current=false;},onLongPress(n){t.current?t.current=false:e?.({target:n.target,x:n.x,y:n.y});}});return e?{contextMenuProps:c$4(h$2()?o:{},{onContextMenu(n){n.stopPropagation(),n.preventDefault(),t.current=true;let i=n.currentTarget.getBoundingClientRect();e({target:n.currentTarget,x:n.clientX-i.x,y:n.clientY-i.y});},onKeyDown(n){if(e$5()&&n.ctrlKey&&n.key==="Enter"){t.current=false;let i=n.currentTarget;n.stopPropagation(),setTimeout(()=>{if(t.current)t.current=false;else {let l=i.getBoundingClientRect();e({target:i,x:l.width/2,y:l.height/2});}},10);}}})}:{contextMenuProps:{}}}function yt(r,e,t){let{type:o="menu",isDisabled:n,trigger:i="press"}=r,l=c$6(),{triggerProps:s,overlayProps:c}=a$o({type:o},e,t),u=(m,b,S="first")=>{if(!m||b.isDefaultPrevented())return false;e.toggle(S);},{keyboardProps:a}=j$1({isDisabled:n,shortcuts:{Enter:m=>u(i!=="longPress",m,"first")," ":m=>u(i!=="longPress",m,"first"),ArrowDown:m=>u(i!=="longPress",m,"first"),ArrowUp:m=>u(i!=="longPress",m,"last"),"Alt+Enter":m=>u(i==="longPress",m,"first"),"Alt+ ":m=>u(i==="longPress",m,"first"),"Alt+ArrowDown":m=>u(true,m,"first"),"Alt+ArrowUp":m=>u(true,m,"last")}}),d=b$8(Kr,"@react-aria/menu"),{longPressProps:g}=a$p({isDisabled:n||i!=="longPress",accessibilityDescription:d.format("longPressMessage"),ref:t,onLongPressStart(){e.close();},onLongPress(){e.open("first");}}),p={preventFocusOnPress:true,onPressStart(m){m.pointerType!=="touch"&&m.pointerType!=="keyboard"&&!n&&(a$j(m.target),e.open(m.pointerType==="virtual"?"first":null));},onPress(m){m.pointerType==="touch"&&!n&&(a$j(m.target),e.toggle());}};delete s.onPress;let{contextMenuProps:x}=Vr({onContextMenu(m){let b=m.target.getBoundingClientRect();e.setPoint({x:b.x+m.x,y:b.y+m.y}),e.open();}});useEffect(()=>{if(e.isOpen&&i==="contextMenu"){let m=b=>{(b.button===2||b.button===0&&b.ctrlKey===true)&&j$2(b)===document.body&&e.close();};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)}},[e,i]);let y;if(i==="press")y={...p,...a};else if(i==="longPress")y={...g,...a};else if(i==="contextMenu"){y=x;let{"aria-haspopup":m,"aria-expanded":b,"aria-controls":S,...M}=s;s=M;}return {menuTriggerProps:{...s,...y,id:l},menuProps:{...c,"aria-labelledby":l,autoFocus:e.focusStrategy||true,onClose:e.close}}}var Je=new WeakMap;function Pt(r,e,t){let{shouldFocusWrap:o=true,onKeyDown:n,onKeyUp:i,...l}=r;!r["aria-label"]&&!r["aria-labelledby"]&&process.env.NODE_ENV!=="production"&&console.warn("An aria-label or aria-labelledby prop is required for accessibility.");let s=a$2(r,{labelable:true}),{listProps:c}=a$l({...l,ref:t,selectionManager:e.selectionManager,collection:e.collection,disabledKeys:e.disabledKeys,shouldFocusWrap:o,linkBehavior:"override"});return Je.set(e,{onClose:r.onClose,onAction:r.onAction,shouldUseVirtualFocus:r.shouldUseVirtualFocus}),{menuProps:c$4(s,{onKeyDown:n,onKeyUp:i},{role:"menu",...c,onKeyDown:u=>{(u.key!=="Escape"||r.shouldUseVirtualFocus)&&c.onKeyDown?.(u);}})}}function bt(r,e,t){let{id:o$1,key:n,closeOnSelect:i,shouldCloseOnSelect:l,isVirtualized:s,"aria-haspopup":c,onPressStart:u,onPressUp:a,onPress:d,onPressChange:g,onPressEnd:p,onClick:x,onHoverStart:y,onHoverChange:m,onHoverEnd:b,onKeyDown:S,onKeyUp:M,onFocus:R,onFocusChange:I,onBlur:F,selectionManager:f=e.selectionManager}=r,T=!!c,E=T&&r["aria-expanded"]==="true",B=r.isDisabled??f.isDisabled(n),P=r.isSelected??f.isSelected(n),v=Je.get(e),C=e.collection.getItem(n),_=r.onClose||v.onClose,U=o(),K=()=>{if(!T&&(C?.props?.onAction?C.props.onAction():r.onAction&&r.onAction(n),v.onAction)){let h=v.onAction;h(n,C?.value);}},H="menuitem";T||(f.selectionMode==="single"?H="menuitemradio":f.selectionMode==="multiple"&&(H="menuitemcheckbox"));let X=e$3([],t),ae=e$3([],t),oe=e$3([],t),J={id:o$1,"aria-disabled":B||void 0,role:H,"aria-label":r["aria-label"],"aria-labelledby":X,"aria-describedby":[r["aria-describedby"],ae,oe].filter(Boolean).join(" ")||void 0,"aria-controls":r["aria-controls"],"aria-haspopup":c,"aria-expanded":r["aria-expanded"]};if(f.selectionMode!=="none"&&!T&&(J["aria-checked"]=P),s){let h=Number(C?.index);J["aria-posinset"]=Number.isNaN(h)?void 0:h+1,J["aria-setsize"]=d$2(e.collection);}let Y=useRef(false),Re=h=>{g?.(h),Y.current=h;},Z=useRef(null),D=h=>{h.pointerType!=="keyboard"&&(Z.current={pointerType:h.pointerType}),h.pointerType==="mouse"&&(Y.current||h.target.click()),a?.(h);},de=h=>{x?.(h),K(),s$1(h,U,C.props.href,C?.props.routerOptions);let ce=Z.current?.pointerType==="keyboard"?Z.current?.key==="Enter"||f.selectionMode==="none"||f.isLink(n):f.selectionMode!=="multiple"||f.isLink(n);ce=l??i??ce,_&&!T&&ce&&_(),Z.current=null;},{itemProps:ne,isFocused:Ht}=d$3({id:o$1,selectionManager:f,key:n,ref:t,shouldSelectOnPressUp:true,allowsDifferentPressOrigin:true,linkBehavior:"none",shouldUseVirtualFocus:v.shouldUseVirtualFocus}),{pressProps:io,isPressed:lo}=d$4({onPressStart:u,onPress:d,onPressUp:D,onPressChange:Re,onPressEnd:p,isDisabled:B}),{hoverProps:so}=a$5({isDisabled:B,onHoverStart(h){!b$5()&&!(E&&c)&&(f.setFocused(true),f.setFocusedKey(n)),y?.(h);},onHoverChange:m,onHoverEnd:b}),{keyboardProps:ao}=j$1({shortcuts:{" ":h=>{Z.current={pointerType:"keyboard",key:" "},j$2(h).click(),d$5("keyboard");},Enter:h=>{Z.current={pointerType:"keyboard",key:"Enter"};let ce=j$2(h);if(ce.tagName!=="A"){ce.click(),d$5("keyboard");return}return d$5("keyboard"),{shouldPreventDefault:false,shouldContinuePropagation:false}}},onKeyDown:S,onKeyUp:M}),{focusableProps:uo}=c$7({onBlur:F,onFocus:R,onFocusChange:I},t),Nt=a$2(C?.props);delete Nt.id;let co=r$1(C?.props);return {menuItemProps:{...J,...c$4(Nt,co,T?{onFocus:ne.onFocus,"data-collection":ne["data-collection"],"data-key":ne["data-key"]}:ne,io,so,ao,uo,v.shouldUseVirtualFocus||T?{onMouseDown:h=>h.preventDefault()}:void 0,B?void 0:{onClick:de}),tabIndex:ne.tabIndex!=null&&E&&!v.shouldUseVirtualFocus?-1:ne.tabIndex},labelProps:{id:X},descriptionProps:{id:ae},keyboardShortcutProps:{id:oe},isFocused:Ht,isFocusVisible:Ht&&f.isFocused&&b$5()&&!E,isSelected:P,isPressed:lo,isDisabled:B}}function xt(r){let{heading:e,"aria-label":t}=r,o=e$3([!!e]);return {itemProps:{role:"presentation"},headingProps:e?{id:o,role:"presentation"}:{},groupProps:{role:"group","aria-label":t,"aria-labelledby":e?o:void 0}}}var Ye=2,Co=50,ho=1e3,Ur=Math.PI/12;function Wr(r){let{menuRef:e,submenuRef:t,isOpen:o,isDisabled:n}=r,i=useRef(void 0),l=useRef(void 0),s=useRef(0),c=useRef(void 0),u=useRef(void 0),a=useRef(void 0),d=useRef(2),[g,p]=useState(false);e$4({ref:o?t:void 0,onResize:()=>{t.current&&(l.current=t.current.getBoundingClientRect(),a.current=void 0);}});let y=()=>{p(false),d.current=Ye,i.current=void 0;},m=f$5(),b=u$1(S=>{g&&S.preventDefault();});useEffect(()=>{g&&e.current?e.current.style.pointerEvents="none":e.current.style.pointerEvents="";},[e,g]),a$i(()=>{let S=t.current,M=e.current;if(n||!S||!o||m!=="pointer"||!M){y();return}l.current=S.getBoundingClientRect();let R=F=>{if(F.pointerType==="touch"||F.pointerType==="pen")return;let f=Date.now();if(f-s.current<Co)return;clearTimeout(c.current),clearTimeout(u.current);let{clientX:T,clientY:E}=F;if(!i.current){i.current={x:T,y:E};return}if(!l.current)return;if(a.current||(a.current=T>l.current.right?"left":"right"),T<M.getBoundingClientRect().left||T>M.getBoundingClientRect().right||E<M.getBoundingClientRect().top||E>M.getBoundingClientRect().bottom){y();return}let B=i.current.x,P=i.current.y,v=a.current==="right"?l.current.left-B:B-l.current.right,C=Math.atan2(P-l.current.top,v)+Ur,_=Math.atan2(P-l.current.bottom,v)-Ur,U=Math.atan2(P-E,a.current==="left"?-(T-B):T-B),K=U<C&&U>_;d.current=K?Math.min(d.current+1,Ye):Math.max(d.current-1,0),d.current>=Ye?p(true):p(false),s.current=f,i.current={x:T,y:E},K&&(c.current=setTimeout(()=>{y(),u.current=setTimeout(()=>{let H=a$n(M).elementFromPoint(T,E);H&&h$1(M,H)&&H.dispatchEvent(new PointerEvent("pointerover",{bubbles:true,cancelable:true}));},100);},ho));},I=b$7(M);return I.addEventListener("pointermove",R),process.env.NODE_ENV!=="test"&&I.addEventListener("pointerdown",b,true),()=>{I.removeEventListener("pointermove",R),process.env.NODE_ENV!=="test"&&I.removeEventListener("pointerdown",b,true),clearTimeout(c.current),clearTimeout(u.current),d.current=Ye;}},[n,o,e,m,p,t]);}function Mt(r,e,t){let{parentMenuRef:o,submenuRef:n,type:i="menu",isDisabled:l,delay:s=200,shouldUseVirtualFocus:c}=r,u=c$6(),a=c$6(),{direction:d}=b$2(),g=useRef(void 0),p=useCallback(()=>{g.current&&(clearTimeout(g.current),g.current=void 0);},[g]),x=useCallback(f=>{p(),e.open(f);},[e,p]),y=useCallback(()=>{p(),e.close();},[e,p]);a$i(()=>()=>{p();},[p]);let{keyboardProps:m}=j$1({shortcuts:{ArrowLeft:f=>{if(!m$1(f.currentTarget))return false;if(d==="ltr"&&h$1(f.currentTarget,j$2(f))){y(),!c&&t.current&&a$j(t.current);return}return false},ArrowRight:f=>{if(!m$1(f.currentTarget))return false;if(d==="rtl"&&h$1(f.currentTarget,j$2(f))){y(),!c&&t.current&&a$j(t.current);return}return false},Escape:f=>{if(!m$1(f.currentTarget))return false;if(h$1(n.current,j$2(f))){y(),!c&&t.current&&a$j(t.current);return}return false}}}),b={id:a,"aria-labelledby":u,submenuLevel:e.submenuLevel,...i==="menu"&&{onClose:e.closeAll,autoFocus:e.focusStrategy??void 0,...m}},{keyboardProps:S}=j$1({shortcuts:{ArrowRight:()=>{if(!l)if(d==="ltr"){e.isOpen||x("first"),i==="menu"&&n?.current&&i$1()===t?.current&&a$j(n.current);return}else if(e.isOpen){y();return}else return false;return false},ArrowLeft:()=>{if(!l)if(d==="rtl"){e.isOpen||x("first"),i==="menu"&&n?.current&&i$1()===t?.current&&a$j(n.current);return}else if(e.isOpen){y();return}else return false;return false}}}),M=f=>{!l&&(f.pointerType==="virtual"||f.pointerType==="keyboard")&&x("first");},R=f=>{!l&&(f.pointerType==="touch"||f.pointerType==="mouse")&&x();},I=f=>{l||(f&&!e.isOpen?g.current||(g.current=setTimeout(()=>{x();},s)):f||p());};a$k(o,"focusin",f=>{e.isOpen&&h$1(o.current,j$2(f))&&j$2(f)!==t.current&&y();});let F=f=>f!==t.current;return Wr({menuRef:o,submenuRef:n,isOpen:e.isOpen,isDisabled:l}),{submenuTriggerProps:{onKeyDown:S.onKeyDown,onKeyUp:S.onKeyUp,id:u,"aria-controls":e.isOpen?a:void 0,"aria-haspopup":l?void 0:i,"aria-expanded":e.isOpen?"true":"false",onPressStart:M,onPress:R,onHoverChange:I,isOpen:e.isOpen},submenuProps:b,popoverProps:{isNonModal:true,shouldCloseOnInteractOutside:F}}}function Ze(r){let e=a$m(r),[t,o]=useState(null),[n,i]=useState([]),l=()=>{i([]),e.close();};return {focusStrategy:t,...e,open(u=null){o(u),e.open();},toggle(u=null){o(u),e.toggle();},close(){l();},expandedKeysStack:n,openSubmenu:(u,a)=>{i(d=>a>d.length?d:[...d.slice(0,a),u]);},closeSubmenu:(u,a)=>{i(d=>d[a]===u?d.slice(0,a):d);}}}function Tt(r,e){let{triggerKey:t}=r,{expandedKeysStack:o,openSubmenu:n,closeSubmenu:i,close:l}=e,[s]=useState(o?.length),c=useMemo(()=>o[s]===t,[o,t,s]),[u,a]=useState(null),d=useCallback(x=>{a(x??null),n(t,s);},[n,s,t]),g=useCallback(()=>{a(null),i(t,s);},[i,s,t]),p=useCallback(x=>{a(x??null),c?g():d(x);},[g,d,c]);return useMemo(()=>({focusStrategy:u,isOpen:c,open:d,close:g,closeAll:l,submenuLevel:s,setOpen:()=>{},toggle:p,point:null,setPoint:()=>{}}),[c,d,g,l,u,p,s])}var Ct=createContext({});forwardRef(function(e$1,t){return [e$1,t]=e(e$1,t,Ct),jsx(h.kbd,{dir:"ltr",...e$1,ref:t})});var Io=createContext({}),cs=forwardRef(function(e$1,t){[e$1,t]=e(e$1,t,Io);let{children:o,level:n=3,className:i,...l}=e$1,s=h[`h${n}`];return jsx(s,{...l,ref:t,className:i??"react-aria-Heading",children:o})});var ht=createContext(null);createContext(null);createContext(null);var Dt=createContext(null);var tt=createContext(null),ve=createContext(null),Le=createContext(null),et=createContext(null);function Fo(r){let e=Ze(r),t=useRef(null),{menuTriggerProps:o,menuProps:n}=yt({...r,type:"menu"},e,t),i=useRef(null);return k$2()?null:jsx(b$4,{values:[[tt,{...n,ref:i}],[Dt,e],[Le,e],[ht,{trigger:"MenuTrigger",triggerRef:t,scrollRef:i,placement:"bottom start","aria-labelledby":n["aria-labelledby"],offset:r.trigger==="contextMenu"?0:void 0}]],children:jsx(b$9,{...o,ref:t,isPressed:e.isOpen,children:r.children})})}var Qr=createContext(null),Lt=class extends a$h{static type="submenutrigger";filter(e,t,o){let n=e.getItem(this.firstChildKey);if(n&&o(n.textValue,this)){let i=this.clone();return t.addDescendants(i,e),i}return null}},Bo=k(Lt,(r,e,t)=>{let{CollectionBranch:o}=useContext(p),n=useContext(ve),i=useContext(Le),l=Tt({triggerKey:t.key},i),s=useRef(null),c=a$4(e),{parentMenuRef:u,shouldUseVirtualFocus:a}=useContext(Qr),{submenuTriggerProps:d,submenuProps:g,popoverProps:p$1}=Mt({parentMenuRef:u,submenuRef:s,delay:r.delay,shouldUseVirtualFocus:a},l,c);return jsxs(b$4,{values:[[be,{...d,onAction:void 0,ref:c}],[tt,{ref:s,...g}],[Dt,l],[ht,{trigger:"SubmenuTrigger",triggerRef:c,placement:"end top","aria-labelledby":g["aria-labelledby"],...p$1}]],children:[jsx(o,{collection:n.collection,parent:t}),r.children[1]]})},r=>r.children[0]),Ho=forwardRef(function(e$1,t){return [e$1,t]=e(e$1,t,tt),jsx(i,{content:jsx(l,{...e$1}),children:o=>jsx(No,{props:e$1,collection:o,menuRef:t})})});function No({props:r,collection:e$1,menuRef:t}){[r,t]=e(r,t,b$1);let{filter:o,...n}=r,i=useMemo(()=>o?e$1.filter(o):e$1,[e$1,o]),l=a$a({...r,collection:i,children:void 0}),s=useContext(Le),{isVirtualized:c,CollectionRoot:u}=useContext(p),{menuProps:a}=Pt({...r,isVirtualized:c,onClose:r.onClose||s?.close},l,t),d=c$3({...r,children:void 0,defaultClassName:"react-aria-Menu",values:{isEmpty:l.collection.size===0}}),g=null;l.collection.size===0&&r.renderEmptyState&&(g=jsx("div",{role:"menuitem",style:{display:"contents"},children:r.renderEmptyState()}));let p$1=a$2(r,{global:true});return jsx(a$3,{children:jsxs(h.div,{...c$4(p$1,d,a),ref:t,slot:r.slot||void 0,"data-empty":l.collection.size===0||void 0,onScroll:r.onScroll,children:[jsx(b$4,{values:[[ve,l],[Xe,{elementType:"div"}],[m,{name:"MenuSection",render:eo}],[Qr,{parentMenuRef:t,shouldUseVirtualFocus:n?.shouldUseVirtualFocus}],[be,{shouldCloseOnSelect:r.shouldCloseOnSelect}],[b$1,null],[c$5,null],[et,l.selectionManager],[Le,s??Ze({})]],children:jsx(x,{children:jsx(u,{collection:l.collection,persistedKeys:q(l.selectionManager.focusedKey),scrollRef:t})})}),g]})})}var Rt=class extends f$3{parent;constructor(e,t){super(e.collection,t),this.parent=e;}get focusedKey(){return this.parent.focusedKey}get isFocused(){return this.parent.isFocused}setFocusedKey(e,t){return this.parent.setFocusedKey(e,t)}setFocused(e){this.parent.setFocused(e);}get childFocusStrategy(){return this.parent.childFocusStrategy}};function eo(r,e,t,o="react-aria-MenuSection"){let n=useContext(ve),{CollectionBranch:i}=useContext(p),[l,s]=f(),{headingProps:c,groupProps:u}=xt({heading:s,"aria-label":t.props["aria-label"]??void 0}),a=c$3({...r,id:void 0,children:void 0,defaultClassName:o,className:t.props?.className,style:t.props?.style,values:void 0}),d=useContext(et),g=a$b(r),p$1=r.selectionMode!=null?new Rt(d,g):d,x=d$1(be)?.shouldCloseOnSelect,y=a$2(r,{global:true});return delete y.id,jsx(h.section,{...c$4(y,a,u),ref:e,children:jsx(b$4,{values:[[Pe,{...c,ref:l}],[et,p$1],[be,{shouldCloseOnSelect:r.shouldCloseOnSelect??x}]],children:jsx(i,{collection:n.collection,parent:t})})})}var Et=k(f$2,eo),be=createContext(null),Ot=j(e$1,function(e$1,t,o){[e$1,t]=e(e$1,t,be);let n=d$1(be)?.id,i=useContext(ve),l=a$4(t),s=useContext(et),{isVirtualized:c}=useContext(p),{menuItemProps:u,labelProps:a,descriptionProps:d,keyboardShortcutProps:g,...p$1}=bt({...e$1,id:n,key:o.key,selectionManager:s,isVirtualized:c},i,l),{hoverProps:x,isHovered:y$1}=a$5({isDisabled:p$1.isDisabled}),m=c$3({...e$1,id:void 0,children:o.rendered,defaultClassName:"react-aria-MenuItem",values:{...p$1,isHovered:y$1,isFocusVisible:p$1.isFocusVisible,selectionMode:s.selectionMode,selectionBehavior:s.selectionBehavior,hasSubmenu:!!e$1["aria-haspopup"],isOpen:e$1["aria-expanded"]==="true"}}),b=e$1.href?h.a:h.div,S=a$2(e$1,{global:true});return delete S.id,delete S.onClick,jsx(b,{...c$4(S,m,u,x),ref:l,"data-disabled":p$1.isDisabled||void 0,"data-hovered":y$1||void 0,"data-focused":p$1.isFocused||void 0,"data-focus-visible":p$1.isFocusVisible||void 0,"data-pressed":p$1.isPressed||void 0,"data-selected":p$1.isSelected||void 0,"data-selection-mode":s.selectionMode==="none"?void 0:s.selectionMode,"data-has-submenu":!!e$1["aria-haspopup"]||void 0,"data-open":e$1["aria-expanded"]==="true"||void 0,children:jsx(b$4,{values:[[a$7,{slots:{[a$8]:a,label:a,description:d}}],[Ct,g],[y,{isSelected:p$1.isSelected}]],children:m.children})})});j(d,function(e,t,o){let n=useContext(ve),{isLoading:i,onLoadMore:l,scrollOffset:s,...c}=e,u=useRef(null),a=useMemo(()=>({onLoadMore:l,collection:n?.collection,sentinelRef:u,scrollOffset:s}),[l,s,n?.collection]);k$1(a,u);let d=c$3({...c,id:void 0,children:o.rendered,defaultClassName:"react-aria-MenuLoadingIndicator",values:void 0}),g={tabIndex:-1};return jsxs(Fragment,{children:[jsx("div",{style:{position:"relative",width:0,height:0},inert:l$1(true),children:jsx("div",{"data-testid":"loadMoreSentinel",ref:u,style:{position:"absolute",height:1,width:1}})}),i&&d.children&&jsx(Fragment,{children:jsx(h.div,{...c$4(a$2(e,{global:true}),g),...d,role:"menuitem",ref:t,children:d.children})})]})});var kt=Me.forwardRef(({section:r,isFirstCollectionItem:e,showSectionHeader:t,renderSectionHeader:o,withSectionHeaderPadding:n,sectionStyle:i,sectionClassName:l$1,componentName:s="ListBox",selectionMode:c,selectedKeys:u,defaultSelectedKeys:a,onSelectionChange:d,disabledKeys:g,disallowEmptySelection:p$1,...x},y)=>{let{isVirtualized:m}=useContext(p),b=o?.(r),S=s==="ListBox"?ft:Et,M=c==null?{}:{selectionMode:c,selectedKeys:u,defaultSelectedKeys:a,onSelectionChange:d,disabledKeys:g,disallowEmptySelection:p$1};return jsxs(S,{id:r.id,"aria-label":r.title,...M,className:a$d(`BaselineUI-${s}-Section`,Nr,m&&!e&&zr,typeof l$1=="function"?l$1(r):l$1),style:typeof i=="function"?i(r):i,ref:y,children:[t?b?jsx(Ge,{className:`BaselineUI-${s}-SectionHeader`,children:b}):jsx(Ge,{className:`BaselineUI-${s}-SectionHeader`,children:jsx(a$c,{className:a$d(Hr,`BaselineUI-${s}-SectionHeaderDefault`),paddingX:"lg",typography:"label.md.semibold",color:"text.primary",paddingInlineStart:n?"5xl":"lg",paddingInlineEnd:"lg",children:r.title})}):null,jsx(l,{items:r.children,dependencies:$e(x),children:R=>jsx(rt,{componentName:s,item:R,...x},R.id)})]})});kt.displayName="ListSection";var jo=({componentName:r})=>{let{direction:e}=b$2();return jsx(a$c,{"aria-hidden":true,display:"flex",alignItems:"center",color:"icon.secondary",className:`BaselineUI-${r}-SubmenuChevron`,style:e==="rtl"?{transform:"scaleX(-1)"}:void 0,children:jsx(ChevronRightFilledIcon,{size:8})})},Uo=({item:r,isSelected:e,isHovered:t,isFocusVisible:o,isDisabled:n,selectionIcon:i="checkmark",selectionMode:l,componentName:s="ListBox",hasSubmenu:c=false})=>{let u=r.icon,a=l!=="none",d=r.keyboardShortcut??r.description;return jsxs(a$c,{display:"flex",alignItems:"center",gap:"lg",className:a$d(Br({isHovered:t,isFocused:o,isDisabled:n}),`BaselineUI-${s}-OptionDefault`),children:[jsxs(a$c,{display:"flex",alignItems:"center",flex:1,gap:"lg",children:[a&&i==="checkmark"?jsx("span",{"aria-hidden":true,style:{height:24,width:24},className:`BaselineUI-${s}-SelectionIndicator`,children:e?jsx(CheckmarkIcon,{size:24}):null}):null,a&&i==="checkbox"?jsx("span",{"aria-hidden":true,style:{height:16,width:16},children:jsx("div",{className:c$8({isSelected:e,isIndeterminate:false,isFocusVisible:false,isDisabled:n,isReadOnly:false,hasError:false,isHovered:false}),children:e?jsx(CheckmarkIcon$1,{size:12}):null})}):null,u?jsx(u,{size:24}):null,jsx(b$6,{slot:"label",elementType:"span",children:r.label})]}),c?jsx(jo,{componentName:s}):d?jsx(b$6,{slot:"description",className:a$d(Fr({isDisabled:n}),`BaselineUI-${s}-OptionDescription`),children:d}):null]})},rt=Me.forwardRef(({item:r,optionStyle:e,optionClassName:t,renderOption:o,componentName:n="ListBox",...i},l)=>{let{onPress:s,onKeyDown:c}=useContext(oo);return jsx(n==="ListBox"?gt:Ot,{...c$4(a$e(i),{onPress:a=>s?.(a,r.id),onKeyDown:c?a=>{c(a,r.id),a.continuePropagation();}:void 0}),id:r.id,value:r,className:a=>a$d(_r,`BaselineUI-${n}-Option`,typeof t=="function"?t(r,a):t),style:a=>typeof e=="function"?e(r,a):e,textValue:r.label,ref:l,children:a=>o?o(r,a):jsx(Uo,{componentName:n,...a,item:r})})});rt.displayName="ListOption";var no=new Set(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"]),oo=Me.createContext({}),Go=Me.forwardRef(({withSectionHeaderPadding:r=false,showSectionHeader:e=false,renderSectionHeader:t,optionStyle:o,optionClassName:n,sectionStyle:i,sectionClassName:l,renderOption:s,className:c,dragAndDropHooks:u,listBoxHandle:a,"data-block-id":d,"data-block-class":g,...p$1},x)=>{let y=a$4(x),m=Me.useRef(false),b=Me.useRef(null),S=useContext(se),{isVirtualized:M,layoutDelegate:R}=useContext(p);useEffect(()=>{S&&(s||o||n)&&console.warn("ListBox: If a state is provided via the ListStateContext, the `renderOption`, `optionStyle`, `optionClassName`, `sectionStyle`, `sectionClassName`, and `renderSectionHeader` props will be ignored.");},[S,s,o,n,i,l,t]),a$f({ref:y,isDisabled:!u});let I=useCallback(P=>[...y.current?.querySelectorAll('[role="option"][data-key]')??[]].find(C=>C.dataset.key===String(P)),[y]);useEffect(()=>{if(!M)return;let P=y.current,v=P?.ownerDocument,C=v?.defaultView;if(P==null||v==null||C==null)return;let _=()=>{let D=f$4(P);return D==null||D===v.body||D===v.documentElement},U=()=>P.querySelector('[role="option"][tabindex="0"]')??P.querySelector('[role="option"][data-focused="true"]'),K=()=>{let D=f$4(P);return D!=null&&h$1(P,D)},H=D=>D.composedPath().some(de=>de instanceof C.Node&&h$1(P,de)),X=()=>{m.current=false;},ae=()=>{b.current!=null&&C.cancelAnimationFrame(b.current),b.current=C.requestAnimationFrame(()=>{if(b.current=null,K())return;if(!_()){X();return}let D=U();D?.focus({preventScroll:true});});},oe=D=>{no.has(D.key)&&(m.current=true);},J=D=>{!no.has(D.key)||!_()||!m.current||ae();},Y=D=>{H(D)||K()||X();},Re=D=>{H(D)||X();},Z=new MutationObserver(D=>{D.some(({addedNodes:de,removedNodes:ne})=>de.length>0||ne.length>0)&&m.current&&ae();});return P.addEventListener("keydown",oe),v.addEventListener("keydown",J,true),v.addEventListener("focusin",Y,true),v.addEventListener("pointerdown",Re,true),Z.observe(P,{childList:true,subtree:true}),()=>{P.removeEventListener("keydown",oe),v.removeEventListener("keydown",J,true),v.removeEventListener("focusin",Y,true),v.removeEventListener("pointerdown",Re,true),Z.disconnect(),b.current!=null&&C.cancelAnimationFrame(b.current),X(),b.current=null;}},[M,y]);let F=Me.useRef(null),f=useCallback(()=>{let P=F.current;P&&(P.ownerWindow.cancelAnimationFrame(P.frameId),F.current=null);},[]);useEffect(()=>f,[f]);let T=useCallback((P,v)=>{if(f(),!y.current)return;let C=()=>{let U=I(P);if(U)return U.scrollIntoView({block:"nearest",inline:"nearest",...v}),true;if(M&&R){let K=R.getItemRect(P);return K?(R.virtualizer.delegate.setVisibleRect(K),true):false}return false};if(C())return;let _=y.current.ownerDocument?.defaultView;_&&(F.current={ownerWindow:_,frameId:_.requestAnimationFrame(()=>{F.current=null,C();})});},[f,I,M,R,y]);useImperativeHandle(a,()=>({scrollIntoView:T,setFocusedKey:P=>{let v=I(P);!y.current||!v||(v.focus(),T(P));}}),[T,I,y]);let E={renderOption:s,optionClassName:n,optionStyle:o,renderSectionHeader:t,sectionClassName:l,sectionStyle:i,showSectionHeader:e,withSectionHeaderPadding:r},B=p$1.items?.[0]?.id;return jsx(mt,{...p$1,dependencies:[...p$1.dependencies??[],B,...$e(E)],"data-block-id":d,"data-block-class":g,dragAndDropHooks:u,ref:y,className:a$d(wr,"BaselineUI-ListBox",c),children:P=>jsx(qo,{item:P,isFirstCollectionItem:B===P.id,...E},P.id)})});Go.displayName="UNSAFE_ListBox";var Xo=Me.createContext({}),qo=r=>{let e=useContext(Xo),{item:t,isFirstCollectionItem:o,id:n,value:i,...l}={...e,...r};return a$g(t,"Item is required"),"children"in t?jsx(kt,{section:t,componentName:"ListBox",isFirstCollectionItem:o,...l}):jsx(rt,{item:t,componentName:"ListBox",...l})};export{pt as a,se as b,yt as c,$e as d,Si as e,Io as f,cs as g,ht as h,Dt as i,Fo as j,Bo as k,Ho as l,kt as m,Uo as n,rt as o,oo as p,Go as q,qo as r};
@@ -1,10 +0,0 @@
1
- import {a as a$3}from'./chunk-CWPFUB7B.mjs';import {a as a$e}from'./chunk-NV7KQVPE.mjs';import {a as a$f}from'./chunk-KVIV5RTE.mjs';import {f,b as b$4,i,g,a as a$b,h,c as c$2,e as e$1,d}from'./chunk-5VNC6UYE.mjs';import {a as a$9}from'./chunk-OVJT5F2R.mjs';import {q as q$1}from'./chunk-OMWMNUTI.mjs';import {p,t}from'./chunk-YQHHE5AT.mjs';import {a as a$a}from'./chunk-NMSOOQB2.mjs';import {a as a$8}from'./chunk-CTBCJZEG.mjs';import {a as a$7,b as b$5}from'./chunk-KCHAWPUN.mjs';import {b as b$3,e}from'./chunk-YYU46XNM.mjs';import {b}from'./chunk-UO75BAPM.mjs';import {b as b$2,c as c$1}from'./chunk-7MLFM55C.mjs';import {a as a$d}from'./chunk-O7XK2WIX.mjs';import {a as a$c}from'./chunk-DAI7V4TE.mjs';import {a as a$4}from'./chunk-VXZT2JR2.mjs';import {a as a$6}from'./chunk-FPM5UJRF.mjs';import {a}from'./chunk-SGZWUG3H.mjs';import {a as a$1}from'./chunk-B3EZOXNU.mjs';import {a as a$5}from'./chunk-RT4LMB6X.mjs';import {b as b$1,c}from'./chunk-3WKDIXCM.mjs';import {a as a$2}from'./chunk-4QEH5CGK.mjs';import {sprinkles}from'@baseline-ui/tokens';import J,{useRef,useLayoutEffect,useState,useContext,useEffect,useCallback,useMemo}from'react';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {XIcon}from'@baseline-ui/icons/12';import {useReducedMotion,motion}from'motion/react';/**
2
- * Copyright (c) 2023-2024 PSPDFKit GmbH. All rights reserved.
3
- *
4
- * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
5
- * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE PSPDFKIT LICENSE AGREEMENT.
6
- * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
7
- * This notice may not be removed from this file.
8
- *
9
- */
10
- var Me=t$1=>a$9({getItems:(e,o)=>o.map(s=>({"text/plain":s.label})),renderDropIndicator(e){return jsx(t,{target:e,className:({isDropTarget:o})=>a$2(a$a({isDropTarget:o}),"BaselineUI-DropIndicator")})},...t$1});function q(t,e){return t.find(o=>o.id===e)}function Re(t,e,o){let s=[...t],l=s.filter(r=>o.has(r.id)),n=s.filter(r=>!o.has(r.id)),i=n.findIndex(r=>r.id===e);return n.flatMap((r,c)=>c===i?[...l,r]:r)}function Ee(t,e,o){let s=[...t],l=s.filter(r=>o.has(r.id)),n=s.filter(r=>!o.has(r.id)),i=n.findIndex(r=>r.id===e);return n.flatMap((r,c)=>c===i?[r,...l]:r)}function V(t){return t.map(e=>({id:e.id,label:e.label,data:{src:e.src,alt:e.alt}}))}function E(t){return t.map(e=>({id:e.id,label:e.label,src:e.data?.src,alt:e.data?.alt}))}var K={src:"src",alt:"alt"},T={sm:102,md:170};function Ke(t,e){let o=q(t,e);return {[K.src]:o?.data?.src||"",[K.alt]:o?.data?.alt||"",key:String(e)}}function He(t){let e=t[K.src];return e?{src:String(e),alt:t[K.alt]?String(t[K.alt]):""}:null}function _e({fit:t,imageDimensions:e,item:o,isSelected:s}){let l={display:"block",objectFit:t},n=typeof e=="function"?o?e(o,{isSelected:s}):void 0:e;if(!n)return l;let i=typeof n.width=="string"?T[n.width]:n.width;return l.width=i,l.aspectRatio="height"in n?`${i} / ${n.height}`:n.aspectRatio.toString(),l}var ze=J.forwardRef(({className:t,children:e,style:o,isDisabled:s,onTruncatedChange:l,onHoverChange:n},i)=>{let r=useRef(null),{buttonProps:c$1}=a({elementType:"span",isDisabled:s},r);useLayoutEffect(()=>{r.current&&l?.(r.current.scrollWidth>r.current.clientWidth);},[e,l]);let{hoverProps:I}=a$1({isDisabled:s,onHoverChange:n});return jsx(b,{elementType:"span",slot:"label",...c(c$1,I),className:a$2(t,"BaselineUI-AdaptiveText"),tabIndex:-1,ref:b$1(r,i),style:o,role:void 0,children:e})});ze.displayName="Label";var re=J.memo(J.forwardRef(({children:t,isOpen:e,isDisabled:o,...s},l)=>{let[n,i]=useState(false),[r,c]=useState(false),I=a$3(),S=o||!r||I;return jsx(a$4,{text:t,variant:"inverse",includeArrow:false,size:"sm",placement:"bottom start",isOpen:(n||e)&&r,isDisabled:S,children:jsx(ze,{...s,isDisabled:S,onTruncatedChange:c,onHoverChange:i,ref:l,children:t})})}));re.displayName="AdaptiveText";var mt=({fit:t,item:e,deleteElement:o,loadingLabel:s})=>{let{formatMessage:l}=b$2(),{isLoading:n,imgProps:i}=a$e({src:e.data?.src,alt:e.data?.alt||""});return jsxs("div",{className:e$1,children:[n?jsx(a$f,{"aria-label":s??l(H.loading)}):jsx("div",{role:"img",className:d({isLoading:n}),"aria-label":i.alt||"",style:{backgroundImage:`url(${i.src})`,backgroundSize:t}}),o]})},Fe=({item:t,options:{isFocusVisible:e,isSelected:o,isFocused:s,isDisabled:l,isPressed:n},fit:i="contain",onDelete:r,className:c,imageClassName:I,imageLabelClassName:S,imageDimensions:A,style:_,layoutTransition:L=true,deleteLabel:U,loadingLabel:z,renderImage:F=(w,{deleteElement:G})=>jsx(mt,{item:w,deleteElement:G,fit:i,loadingLabel:z})})=>{let{formatMessage:w}=b$2(),G=r?jsx("div",{className:a$b,children:jsx(a$c,{"aria-label":U??w(H.delete),size:"xs",icon:XIcon,onPress:()=>{r(t.id);},UNSAFE_isVisuallyInteractiveOnly:true})}):null,v=E([t])[0],k=useCallback(C=>{let f={},m=typeof C=="function"?C(v,{isSelected:o}):C;return m&&(f.width=typeof m.width=="string"?T[m.width]:m.width,f.aspectRatio="height"in m?`${f.width} / ${m.height}`:m?.aspectRatio?.toString()),f},[v,o]),x=useMemo(()=>({isFocusVisible:e,isSelected:o,isFocused:s,isDisabled:l,isPressed:n}),[e,o,s,l,n]),O=!useReducedMotion()&&(typeof L=="boolean"?L:true),b=typeof L=="object"?L:void 0,$=k(A),W=O?motion.div:"div";return jsxs(W,{...O?{layout:"position",initial:false,transition:b}:{},className:a$2(c$2,a$7(c,v,x)),style:b$5(_,v,x),children:[jsx(a$d,{display:"flex",flexDirection:"column",flex:1,justifyContent:"center",alignItems:"center",flexGrow:0,children:jsx("div",{className:a$2(g({isFocusVisible:e,isSelected:o,isLoading:true}),a$7(I,v,x)),style:$,"data-image-key":t.id,children:F(t,{deleteElement:G??void 0,onDelete:r})})}),jsx(re,{className:a$2(h({isFocusVisible:e,isSelected:o}),S),style:{maxWidth:$.width},isOpen:e,children:t.label})]})};function ft(t,e){return t==="all"?true:"has"in t&&typeof t.has=="function"?t.has(e):[...t].includes(e)}var Xe=J.forwardRef(({className:t$1,style:e$1,fit:o="cover",onReorder:s,"data-block-id":l,"data-block-class":n,onDelete:i$1,imageWidth:r=T.sm,aspectRatio:c=3/4,items:I,defaultItems:S=[],onKeyDown:A,imageContainerClassName:_,imageClassName:L,labelClassName:U,onListChange:z,renderImage:F,layoutTransition:w,imageDimensions:G,imageContainerStyle:v,deleteConfirmationTitle:k="Are you sure you want to delete this item?",deleteLabel:x,cancelLabel:ae,loadingLabel:O,...b},$)=>{let{isVirtualized:W}=useContext(p),C=a$5($),[f$1,m]=useState([]),{formatMessage:ne}=b$2();useEffect(()=>{(c||r)&&console.warn("ImageGallery: aspectRatio and imageWidth are deprecated. Use imageDimensions instead.");},[r,c]);let Q=J.useMemo(()=>G??{width:r,aspectRatio:c},[G,r,c]),[P,je]=a$6(b.selectedKeys,b.defaultSelectedKeys??[],b.onSelectionChange),qe=J.useMemo(()=>I?V(I):void 0,[I]),Je=J.useMemo(()=>V(S),[]),[u,B]=a$6(qe,Je,z?a=>{z?.(E(a));}:void 0),Qe=useCallback(a=>{let p=a.target.key,d=a.keys;if(a.target.dropPosition==="before"){let g=Re(u,p,d);B(g);}else if(a.target.dropPosition==="after"){let g=Ee(u,p,d);B(g);}s?.(a);},[u,s,B]),{dragAndDropHooks:Ye}=Me({onReorder:Qe,isDisabled:!s,renderDragPreview:a=>jsx(i,{items:a,containerClassName:".BaselineUI-ImageGallery",previewClassName:g(),itemDataAttribute:"data-image-key",showCount:true,renderFallback:p=>{let d=He(p);if(!d)return null;let g=q(u,p.key),N=g?E([g])[0]:void 0;return jsx("img",{...d,style:_e({fit:o,imageDimensions:Q,item:N,isSelected:ft(P,p.key)})})}}),getItems:a=>[...a].map(p=>Ke(u,p)),renderDropIndicator(a){return jsx(t,{target:a,className:a$2(b$4({isVirtualized:!!W}),"BaselineUI-DropIndicator")})}}),Ze=useCallback(()=>{i$1&&f$1.length&&(B(u.filter(a=>!f$1.includes(a.id))),i$1(f$1),m([]));},[f$1,u,i$1,B]),Ve=useCallback((a,p)=>{let d={id:a.id,label:a.label,src:a.data?.src,alt:a.data?.alt};return jsx(Fe,{item:a,options:p,fit:o,onDelete:i$1?g=>{m([g]);}:void 0,renderImage:F,className:a$7(_,d,p),imageClassName:L,imageLabelClassName:U,imageDimensions:Q,style:v,layoutTransition:w,deleteLabel:x,loadingLabel:O},a.id)},[o,i$1,F,_,L,U,Q,v,w,x,O]);return useEffect(()=>{let a=C.current;if(!a)return;let p=d=>{if(A?.(d),d.key==="Backspace"||d.key==="Delete"){if(!i$1)return;if(P==="all"){let et=new Set(b.disabledKeys);m(u.map(Y=>Y.id).filter(Y=>!et.has(Y)));return}let g=[...P];if(g.length){m(g);return}let N=d.target.closest("[data-key]");if(!N||!a.contains(N))return;m([N.dataset.key]);}};return a.addEventListener("keydown",p),()=>{a.removeEventListener("keydown",p);}},[C,i$1,A,P,u,b.disabledKeys]),jsxs(Fragment,{children:[jsx(q$1,{...b,ref:C,style:e$1,className:a$2(f,"BaselineUI-ImageGallery",t$1),"data-block-id":l,"data-block-class":n,selectedKeys:P,items:u,dragAndDropHooks:Ye,layout:"grid",orientation:"vertical",renderOption:Ve,onSelectionChange:je,optionClassName:s&&!W?sprinkles({marginLeft:"sm"}):void 0}),jsx(b$3,{isOpen:!![...f$1].length,onOpenChange:a=>{a||m([]);},children:jsx(e,{isDismissable:true,children:jsx(a$8,{showCloseButton:false,title:typeof k=="function"?k(P==="all"?"all":new Set(P)):k,primaryActionLabel:x??ne(H.delete),cancelLabel:ae??ne(H.cancel),onCancel:()=>{m([]);},onPrimaryAction:Ze,autoFocusButton:"cancel"})})})]})});Xe.displayName="ImageGallery";var H=c$1({delete:{id:"bui.imageGallery.delete",defaultMessage:"Delete"},cancel:{id:"bui.imageGallery.cancel",defaultMessage:"Cancel"},loading:{id:"bui.imageGallery.loading",defaultMessage:"Loading"}});export{Xe as a};
@@ -1,10 +0,0 @@
1
- import {a as a$b}from'./chunk-5USQ6HBY.mjs';import {c as c$4,a as a$c,b as b$5}from'./chunk-BROSGYL3.mjs';import {b}from'./chunk-SZTFMBPY.mjs';import {e,f,g}from'./chunk-PG3WDHSK.mjs';import {a as a$5}from'./chunk-CY6W27WG.mjs';import {a as a$a}from'./chunk-6QQEK5I6.mjs';import {d}from'./chunk-W6QO7FPZ.mjs';import {c}from'./chunk-4EAXDHSV.mjs';import {d as d$1}from'./chunk-GMALMQWI.mjs';import {b as b$1}from'./chunk-N2XGJKZG.mjs';import {b as b$3}from'./chunk-K5RYVERS.mjs';import {a as a$4}from'./chunk-FPM5UJRF.mjs';import {a as a$9}from'./chunk-4QBHQCCK.mjs';import {a as a$2}from'./chunk-RSKKEGJZ.mjs';import {a as a$7}from'./chunk-STMDFIUL.mjs';import {c as c$3}from'./chunk-HH4VLTF3.mjs';import {b as b$2}from'./chunk-4S4GGUSH.mjs';import {j}from'./chunk-KUDCYGII.mjs';import {a as a$8}from'./chunk-B3EZOXNU.mjs';import {d as d$2}from'./chunk-F7WPMQ3P.mjs';import {a as a$1}from'./chunk-RT4LMB6X.mjs';import {c as c$1}from'./chunk-3WKDIXCM.mjs';import {a as a$6}from'./chunk-SVIYLH7R.mjs';import {c as c$2}from'./chunk-ETM4MNG4.mjs';import {b as b$4,j as j$1}from'./chunk-SD43KVTU.mjs';import {a}from'./chunk-JQQGRJ5J.mjs';import {a as a$3}from'./chunk-4QEH5CGK.mjs';import Se,{useMemo,useState}from'react';import {jsxs,jsx}from'react/jsx-runtime';/**
2
- * Copyright (c) 2023-2024 PSPDFKit GmbH. All rights reserved.
3
- *
4
- * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
5
- * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE PSPDFKIT LICENSE AGREEMENT.
6
- * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
7
- * This notice may not be removed from this file.
8
- *
9
- */
10
- var A=new WeakMap;function k(e,a,r){let{value:i,children:d,"aria-label":l,"aria-labelledby":p,onPressStart:s,onPressEnd:n,onPressChange:u,onPress:c,onPressUp:v,onClick:R}=e,o=e.isDisabled||a.isDisabled,_=d!=null,P=l!=null||p!=null;!_&&!P&&process.env.NODE_ENV!=="production"&&console.warn("If you do not provide children, you must specify an aria-label for accessibility");let f=a.selectedValue===i,g=M=>{M.stopPropagation(),a.setSelectedValue(i);},{pressProps:V,isPressed:z}=d$2({onPressStart:s,onPressEnd:n,onPressChange:u,onPress:c,onPressUp:v,onClick:R,isDisabled:o}),{pressProps:x,isPressed:G}=d$2({onPressStart:s,onPressEnd:n,onPressChange:u,onPressUp:v,onClick:R,isDisabled:o,onPress(M){c?.(M),a.setSelectedValue(i),r.current?.focus();}}),{focusableProps:L}=c$3(c$1(e,{onFocus:()=>a.setLastFocusedValue(i)}),r),t=c$1(V,L),D=a$6(e,{labelable:true}),b=-1;a.selectedValue!=null?a.selectedValue===i&&(b=0):(a.lastFocusedValue===i||a.lastFocusedValue==null)&&(b=0),o&&(b=void 0);let{name:y,form:S,descriptionId:_e,errorMessageId:ze,validationBehavior:H}=A.get(a);a$9(r,a.defaultSelectedValue,a.setSelectedValue),a$a({validationBehavior:H},a,r);let B=a$b();return {labelProps:c$1(x,useMemo(()=>({onClick:M=>M.preventDefault(),onMouseDown:M=>M.preventDefault()}),[])),inputProps:c$1(D,{...t,type:"radio",name:y,form:S,tabIndex:b,disabled:o,required:a.isRequired&&H==="native",checked:f,value:i,onChange:g,"aria-describedby":[e["aria-describedby"],B.id,a.isInvalid?ze:null,_e].filter(Boolean).join(" ")||void 0}),descriptionProps:B,isDisabled:o,isSelected:f,isPressed:z||G}}function w(e,a,r){let{name:i,form:d,isReadOnly:l,isRequired:p,isDisabled:s,orientation:n="vertical",validationBehavior:u="aria"}=e,{direction:c}=b$1(),{isInvalid:v,validationErrors:R,validationDetails:o}=a.displayValidation,{labelProps:_,fieldProps:P,descriptionProps:f,errorMessageProps:g}=a$5({...e,labelElementType:"span",isInvalid:a.isInvalid,errorMessage:e.errorMessage||R,ref:r}),V=a$6(e,{labelable:true}),{focusWithinProps:z}=b$2({onBlurWithin(t){e.onBlur?.(t),a.selectedValue||a.setLastFocusedValue(null);},onFocusWithin:e.onFocus,onFocusWithinChange:e.onFocusChange});function x(t,D){let b=d$1(D.currentTarget,{from:j$1(D),accept:S=>S instanceof b$4(S).HTMLInputElement&&S.type==="radio"}),y;return t==="next"?(y=b.nextNode(),y||(b.currentNode=D.currentTarget,y=b.firstChild())):(y=b.previousNode(),y||(b.currentNode=D.currentTarget,y=b.lastChild())),y?(y.focus(),a.setSelectedValue(y.value),true):false}let{keyboardProps:G}=j({shortcuts:{ArrowRight:t=>x(c==="rtl"&&n!=="vertical"?"prev":"next",t),ArrowLeft:t=>x(c==="rtl"&&n!=="vertical"?"next":"prev",t),ArrowDown:t=>x("next",t),ArrowUp:t=>x("prev",t)},allowRepeats:true}),L=c$2(i);return A.set(a,{name:L,form:d,descriptionId:f.id,errorMessageId:g.id,validationBehavior:u}),{radioGroupProps:c$1(V,{role:"radiogroup",...G,"aria-invalid":a.isInvalid||void 0,"aria-errormessage":e["aria-errormessage"],"aria-readonly":l||void 0,"aria-required":p||void 0,"aria-disabled":s||void 0,"aria-orientation":n,...P,...z}),labelProps:_,descriptionProps:f,errorMessageProps:g,isInvalid:v,validationErrors:R,validationDetails:o}}var Oe=Math.round(Math.random()*1e10),Le=0;function T(e){let a=useMemo(()=>e.name||`radio-group-${Oe}-${++Le}`,[e.name]),[r,i]=a$4(e.value,e.defaultValue??null,e.onChange),[d$1]=useState(r),[l,p]=useState(null),s=d({...e,value:r}),n=c=>{!e.isReadOnly&&!e.isDisabled&&(i(c),s.commitValidation());},u=s.displayValidation.isInvalid;return {...s,name:a,selectedValue:r,defaultSelectedValue:e.value!==void 0?d$1:e.defaultValue??null,setSelectedValue:n,lastFocusedValue:l,setLastFocusedValue:p,isDisabled:e.isDisabled||false,isReadOnly:e.isReadOnly||false,isRequired:e.isRequired||false,validationState:e.validationState||(u?"invalid":null),isInvalid:u}}var Re="_1yep5z6j8 _1yep5z6j9 _1yep5z6ja _1yep5z6jk _1yep5z6jl _1yep5z6jm _1yep5z69c _1yep5z69d _1yep5z69e",Pe=a({defaultClassName:"cw3m0n5 _1yep5z6f0 _1yep5z6dv",variantClassNames:{isDisabled:{true:"_1yep5z611l"}},defaultVariants:{},compoundVariants:[]}),ve="cw3m0n4",ge="_1yep5z6ai _1yep5z6aj _1yep5z6ak _1yep5z6b6 _1yep5z6b7 _1yep5z6b8 _1yep5z6bu _1yep5z6bv _1yep5z6bw _1yep5z6ci _1yep5z6cj _1yep5z6ck _1yep5z6j8 _1yep5z6j9 _1yep5z6ja _1yep5z6jk _1yep5z6jl _1yep5z6jm _1yep5z69i _1yep5z69j _1yep5z69k _1yep5z6m0",Ve=a({defaultClassName:"cw3m0n0 _1yep5z61k2 _1yep5z61k3 _1yep5z61k4 _1yep5z61kq _1yep5z61kr _1yep5z61ks _1yep5z61le _1yep5z61lf _1yep5z61lg _1yep5z61m2 _1yep5z61m3 _1yep5z61m4 _1yep5z61ob _1yep5z61us",variantClassNames:{isHovered:{true:"cw3m0n1"},isReadOnly:{true:"cw3m0n2"}},defaultVariants:{},compoundVariants:[[{isHovered:true,isReadOnly:false},"cw3m0n3"]]});var he=({label:e,description:a},{isSelected:r,isFocusVisible:i,isDisabled:d,optionLabelPosition:l,isHovered:p,isReadOnly:s})=>jsxs("div",{className:b$5({labelPosition:l}),children:[jsx("div",{className:a$3(c$4({isSelected:r,isFocusVisible:i,isDisabled:d,isReadOnly:s,isHovered:p}),Ve({isHovered:p})),children:r?jsx("div",{className:ve}):null}),e?jsxs("div",{className:Re,children:[jsx("span",{className:a$c({isDisabled:d}),children:e}),a?jsx("span",{className:Pe({isDisabled:d}),children:a}):null]}):null]}),xe=({state:e,renderOption:a=he,item:r,optionLabelPosition:i="end",optionStyle:d,optionClassName:l,isReadOnly:p,...s})=>{let n=!!s.isDisabled||!!s.disabledValues?.includes(r.id),u=Se.useRef(null),{inputProps:c,isPressed:v,isSelected:R,labelProps:o}=k({...s,isDisabled:n,children:r.label,value:r.id},e,u),{focusProps:_,isFocusVisible:P,isFocused:f}=a$7(),{hoverProps:g,isHovered:V}=a$8({isDisabled:n},u),z=a$2({"data-selected":R,"data-focused":f,"data-focus-visible":P,"data-hovered":V,"data-disabled":n,"data-pressed":v,"data-read-only":p});return jsxs("label",{...c$1(o,g,z),style:d,className:a$3("BaselineUI-Radio-Item",l),children:[jsx(b$3,{children:jsx("input",{...c$1(c,_),ref:u})}),a(r,{isFocusVisible:P,isSelected:R,isFocused:f,isHovered:V,isDisabled:n,optionLabelPosition:i,isReadOnly:p})]})};var De=Se.forwardRef(({className:e$1,style:a,optionsContainerClassName:r,optionsContainerStyle:i,items:d,labelPosition:l="top",renderOption:p,"aria-label":s,"aria-labelledby":n,"aria-describedby":u,"aria-details":c$2,"data-block-id":v,"data-block-class":R,...o},_)=>{let P=a$1(_),f$1=T(o),{radioGroupProps:g$1,labelProps:V,descriptionProps:z,errorMessageProps:x}=w({...o,"aria-label":s,"aria-labelledby":n,"aria-describedby":u,"aria-details":c$2},f$1,P),G=b({...o,descriptionProps:z,errorMessageProps:x,labelPosition:l}),L=a$2({"data-orientation":o.orientation,"data-block-id":v,"data-block-class":R,"data-disabled":o.isDisabled,"data-readonly":o.isReadOnly});return jsxs("div",{...c$1(g$1,L),className:a$3(g({labelPosition:l}),"BaselineUI-RadioGroup",e$1),style:a,ref:P,children:[o.label||G?jsxs("div",{className:f({labelPosition:l,hasMessage:!!G}),children:[jsx("span",{...V,className:a$3(e,"BaselineUI-RadioGroup-Label"),children:o.label}),l==="start"&&G]}):null,jsx("div",{className:a$3(ge,{[c]:o.isDisabled},r),style:i,children:d.map(t=>jsx(xe,{state:f$1,renderOption:p,item:t,optionLabelPosition:o.optionLabelPosition,optionStyle:o.optionStyle,optionClassName:o.optionClassName,isReadOnly:o.isReadOnly,isDisabled:o.isDisabled,disabledValues:o.disabledValues,value:t.id},t.id))}),l==="top"&&G]})});De.displayName="RadioGroup";export{De as a};
@@ -1,10 +0,0 @@
1
- import {a as a$4}from'./chunk-G77E7EDE.mjs';import {a as a$6}from'./chunk-LSPDPDB6.mjs';import {d}from'./chunk-QMV2O57M.mjs';import {a as a$1}from'./chunk-NGZRN4SF.mjs';import {c,b}from'./chunk-7MLFM55C.mjs';import {b as b$1}from'./chunk-KG2EHFYA.mjs';import {b as b$2}from'./chunk-K5RYVERS.mjs';import {a as a$5}from'./chunk-FPM5UJRF.mjs';import {a as a$9}from'./chunk-STMDFIUL.mjs';import {a as a$8}from'./chunk-B3EZOXNU.mjs';import {a as a$2}from'./chunk-RT4LMB6X.mjs';import {c as c$1}from'./chunk-3WKDIXCM.mjs';import {a as a$7}from'./chunk-SVIYLH7R.mjs';import {a}from'./chunk-JQQGRJ5J.mjs';import {a as a$3}from'./chunk-4QEH5CGK.mjs';import fe,{useMemo,useCallback,useEffect,useRef}from'react';import {CheckmarkIcon}from'@baseline-ui/icons/12';import {CheckmarkIcon as CheckmarkIcon$1}from'@baseline-ui/icons/16';import {jsx,jsxs}from'react/jsx-runtime';/**
2
- * Copyright (c) 2023-2024 PSPDFKit GmbH. All rights reserved.
3
- *
4
- * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
5
- * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE PSPDFKIT LICENSE AGREEMENT.
6
- * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
7
- * This notice may not be removed from this file.
8
- *
9
- */
10
- var X={"ar-AE":{steplist:"\u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u062E\u0637\u0648\u0627\u062A"},"bg-BG":{steplist:"\u0421\u043F\u0438\u0441\u044A\u043A \u0441\u044A\u0441 \u0441\u0442\u044A\u043F\u043A\u0438"},"cs-CZ":{steplist:"Seznam krok\u016F"},"da-DK":{steplist:"Trinliste"},"de-DE":{steplist:"Schrittliste"},"el-GR":{steplist:"\u039B\u03AF\u03C3\u03C4\u03B1 \u03B2\u03B7\u03BC\u03AC\u03C4\u03C9\u03BD"},"en-US":{steplist:"Step List"},"es-ES":{steplist:"Lista de pasos"},"et-EE":{steplist:"Sammude loend"},"fi-FI":{steplist:"Vaiheluettelo"},"fr-FR":{steplist:"Liste des \xE9tapes"},"he-IL":{steplist:"\u05E8\u05E9\u05D9\u05DE\u05EA \u05E6\u05E2\u05D3\u05D9\u05DD"},"hr-HR":{steplist:"Lista koraka"},"hu-HU":{steplist:"L\xE9p\xE9sek list\xE1ja"},"it-IT":{steplist:"Elenco dei passaggi"},"ja-JP":{steplist:"\u624B\u9806\u30EA\u30B9\u30C8"},"ko-KR":{steplist:"\uB2E8\uACC4 \uBAA9\uB85D"},"lt-LT":{steplist:"\u017Dingsni\u0173 s\u0105ra\u0161as"},"lv-LV":{steplist:"Darb\u012Bbu saraksts"},"nb-NO":{steplist:"Trinnliste"},"nl-NL":{steplist:"Stappenlijst"},"pl-PL":{steplist:"Lista krok\xF3w"},"pt-BR":{steplist:"Lista de etapas"},"pt-PT":{steplist:"Lista de passos"},"ro-RO":{steplist:"Lista de pa\u0219i"},"ru-RU":{steplist:"\u0421\u043F\u0438\u0441\u043E\u043A \u0448\u0430\u0433\u043E\u0432"},"sk-SK":{steplist:"Zoznam krokov"},"sl-SI":{steplist:"Seznam korakov"},"sr-SP":{steplist:"Lista koraka"},"sv-SE":{steplist:"Steglista"},"tr-TR":{steplist:"Ad\u0131m Listesi"},"uk-UA":{steplist:"\u0421\u043F\u0438\u0441\u043E\u043A \u043A\u0440\u043E\u043A\u0456\u0432"},"zh-CN":{steplist:"\u6B65\u9AA4\u5217\u8868"},"zh-TW":{steplist:"\u6B65\u9A5F\u6E05\u55AE"}};function w(p,t,a){let{"aria-label":s}=p,{listProps:r}=a$6({...p,...t,allowsTabNavigation:true,ref:a}),o=b$1(X,"@react-aria/steplist");return {listProps:{...{...c$1(r,a$7(p,{labelable:true})),"aria-label":s||o.format("steplist")},tabIndex:void 0}}}function N(p){let t=a$4({...p,onSelectionChange:p.onSelectionChange?e=>{e!=null&&p.onSelectionChange?.(e);}:void 0}),[a,s]=a$5(p.lastCompletedStep,p.defaultLastCompletedStep??null,p.onLastCompletedStepChange),{setSelectedKey:r,selectedKey:o,collection:d}=t,{indexMap:y,keysLinkedList:c}=useMemo(()=>me(d),[d]),_=o!=null?y.get(o):0,m=useCallback(e=>e===void 0?false:e!==null&&a!==null&&y.has(e)&&y.has(a)&&y.get(e)<=y.get(a),[y,a]),k=useCallback((e,n)=>{let l=null;if(e&&e.size>0)for(l=e.getFirstKey();l!==e.getLastKey()&&l&&(n.has(l)||m(l));)l=e.getKeyAfter(l);return l},[m]);useEffect(()=>{let e=t.selectedKey;(t.selectionManager.isEmpty||e==null||!t.collection.getItem(e))&&(e=k(t.collection,t.disabledKeys),e!==null&&t.selectionManager.replaceSelection(e)),t.selectionManager.focusedKey==null&&t.selectionManager.setFocusedKey(e);let n=(a!==null?y.get(a):-1)??-1;_!==void 0&&_>0&&_>n+1&&e!==null&&c.has(e)&&s(c.get(e));});function g(e){if(p.isDisabled||t.disabledKeys.has(e)||p.isReadOnly)return false;if(m(e))return true;let n=c.get(e);return m(n)||e===t.collection.getFirstKey()}function h(e){let n=c.get(e);n&&!m(n)&&s(n),r(e);}return {...t,setSelectedKey:h,setLastCompletedStep:s,isCompleted:m,isSelectable:g}}function me(p){let t=new Map,a=new Map,s=0,r;for(let o of p)t.set(o.key,s),a.set(o.key,r?.key),r=o,s++;return {indexMap:t,keysLinkedList:a}}var $=a({defaultClassName:"_41r3q2q _1yep5z6kb _1yep5z6kc _1yep5z6kd",variantClassNames:{variant:{condensed:"_41r3q2r _1yep5z618j",expanded:"_41r3q2s _1yep5z6us _1yep5z6ut _1yep5z6uu _1yep5z6sg _1yep5z6sh _1yep5z6si _1yep5z6173 _1yep5z6174 _1yep5z6175"},status:{complete:"_1yep5z6136",active:"_41r3q2u",incomplete:"_41r3q2v"}},defaultVariants:{},compoundVariants:[]}),ee=a({defaultClassName:"_1yep5z6ez",variantClassNames:{size:{sm:"_1yep5z610e",md:"_1yep5z610h"},isDisabled:{true:"_1yep5z611l"}},defaultVariants:{},compoundVariants:[]}),te=a({defaultClassName:"_41r3q28 _1yep5z6b0 _1yep5z6b1 _1yep5z6b2 _1yep5z6bo _1yep5z6bp _1yep5z6bq _1yep5z6cc _1yep5z6cd _1yep5z6ce _1yep5z6d0 _1yep5z6d1 _1yep5z6d2 _1yep5z6mf _1yep5z6mh _1yep5z6jb _1yep5z6jc _1yep5z6jd _1yep5z6jz _1yep5z6k0 _1yep5z6k1 _1yep5z6kt _1yep5z6ku _1yep5z6kv _1yep5z6m0",variantClassNames:{size:{sm:"_41r3q29 _1yep5z610e",md:"_41r3q2a _1yep5z610h"},status:{complete:"_41r3q2b _1yep5z6136 _1yep5z611n",active:"_1yep5z612s _1yep5z611h _1yep5z6142",incomplete:"_1yep5z612s _1yep5z611h _1yep5z613z"},isDisabled:{true:"_41r3q2e"},isFocusVisible:{true:"_41r3q2f"}},defaultVariants:{},compoundVariants:[[{status:"complete",isDisabled:true},"_41r3q2g _1yep5z61pt _1yep5z61o6"],[{status:"active",isDisabled:true},"_1yep5z61pb _1yep5z61o4 _1yep5z61qp"],[{status:"incomplete",isDisabled:true},"_1yep5z61pb _1yep5z61o4 _1yep5z61qp"]]}),se=a({defaultClassName:"_41r3q23 _1yep5z6j8 _1yep5z6j9 _1yep5z6ja _1yep5z6jh _1yep5z6ji _1yep5z6jj _1yep5z6jz _1yep5z6k0 _1yep5z6k1",variantClassNames:{variant:{condensed:"_1yep5z618j _1yep5z6vy _1yep5z6vz _1yep5z6w0",expanded:"_41r3q25 _1yep5z6173 _1yep5z6174 _1yep5z6175"},isLast:{true:"_41r3q26"}},defaultVariants:{},compoundVariants:[]}),pe="_41r3q27 _1yep5z60 _1yep5z61 _1yep5z62 _1yep5z62c _1yep5z62d _1yep5z62e _1yep5z63i _1yep5z63j _1yep5z63k _1yep5z616 _1yep5z617 _1yep5z618 _1yep5z6al _1yep5z6am _1yep5z6an _1yep5z6b9 _1yep5z6ba _1yep5z6bb _1yep5z6bx _1yep5z6by _1yep5z6bz _1yep5z6cl _1yep5z6cm _1yep5z6cn _1yep5z6jb _1yep5z6jc _1yep5z6jd _1yep5z6jh _1yep5z6ji _1yep5z6jj _1yep5z6jz _1yep5z6k0 _1yep5z6k1 _1yep5z69i _1yep5z69j _1yep5z69k _1yep5z6m5",ae=a({defaultClassName:"_41r3q20 _1yep5z613 _1yep5z614 _1yep5z615 _1yep5z63f _1yep5z63g _1yep5z63h _1yep5z64l _1yep5z64m _1yep5z64n _1yep5z629 _1yep5z62a _1yep5z62b _1yep5z65r _1yep5z65s _1yep5z65t _1yep5z683 _1yep5z684 _1yep5z685 _1yep5z699 _1yep5z69a _1yep5z69b _1yep5z66x _1yep5z66y _1yep5z66z _1yep5z6j8 _1yep5z6j9 _1yep5z6ja _1yep5z6jh _1yep5z6ji _1yep5z6jj",variantClassNames:{variant:{condensed:"_1yep5z616i _1yep5z616j _1yep5z616k _1yep5z6vy _1yep5z6vz _1yep5z6w0",expanded:"_1yep5z616c _1yep5z616d _1yep5z616e _1yep5z618m _1yep5z618l _1yep5z6wy _1yep5z6wz _1yep5z6x0"}},defaultVariants:{},compoundVariants:[]}),ie="_41r3q2h _1yep5z6j8 _1yep5z6j9 _1yep5z6ja _1yep5z6jk _1yep5z6jl _1yep5z6jm _1yep5z6jw _1yep5z6jx _1yep5z6jy _1yep5z6kt _1yep5z6ku _1yep5z6kv _1yep5z6kk _1yep5z6kl _1yep5z6km _1yep5z69c _1yep5z69d _1yep5z69e",re=a({defaultClassName:"_1yep5z6ey",variantClassNames:{size:{sm:"_1yep5z610h",md:"_1yep5z610k"},isDisabled:{true:"_1yep5z611l"}},defaultVariants:{},compoundVariants:[]});function A(p,t,a){let{key:s}=p,{selectionManager:r,selectedKey:o}=t,d$1=!t.isSelectable(s),{itemProps:y}=d({isDisabled:d$1,key:s,ref:a,selectionManager:r});return {stepProps:{...y,role:"link","aria-current":o===s?"step":void 0,"aria-disabled":d$1?true:void 0,tabIndex:d$1?void 0:0}}}function le({state:p,item:t,size:a,variant:s,index:r,isLast:o,stepLabel:d,completedLabel:y}){let c=useRef(null),_=b(),{stepProps:m}=A({key:t.key},p,c),{hoverProps:k,isHovered:g}=a$8({}),{focusProps:h,isFocused:e,isFocusVisible:n}=a$9(),l=p.isCompleted(t.key),I=p.selectedKey===t.key,b$1=l?"complete":I?"active":"incomplete",L=p.disabledKeys.has(t.key),z=t["aria-label"],P=!!z&&!t.description,C=s==="expanded"&&!!t.title&&!P,x=s==="expanded"&&!!t.description,q=t.title||((typeof d=="function"?d({index:r+1}):d)??_.formatMessage(oe.step,{index:r+1})),i=y??_.formatMessage(oe.completed),v=a==="sm"?CheckmarkIcon:CheckmarkIcon$1;return jsxs("li",{className:a$3("BaselineUI-Stepper-Item",se({variant:s,isLast:o})),"data-status":b$1,children:[jsxs("a",{...c$1(m,k,h),ref:c,"aria-label":l&&z?[i,z].join(" "):z||void 0,className:a$3("BaselineUI-Stepper-StepLink",pe),"data-status":b$1,"data-hovered":g||void 0,"data-focused":e||void 0,"data-focus-visible":n||void 0,"data-disabled":L||void 0,children:[jsx("span",{className:a$3("BaselineUI-Stepper-Indicator",te({size:a,status:b$1,isDisabled:L,isFocusVisible:n})),"aria-hidden":"true",children:l?jsx(v,{}):jsx("span",{children:r+1})}),l?jsx(b$2,{children:i}):null,C?jsxs("span",{className:a$3("BaselineUI-Stepper-Text",ie),children:[jsx("span",{className:a$3("BaselineUI-Stepper-Title",re({size:a,isDisabled:L})),children:t.title}),x?jsx("span",{className:a$3("BaselineUI-Stepper-Description",ee({size:a,isDisabled:L})),children:t.description}):null]}):z?null:jsx(b$2,{children:q})]}),!o&&jsx("span",{className:a$3("BaselineUI-Stepper-Connector",$({variant:s,status:b$1})),"aria-hidden":"true"})]})}var oe=c({step:{defaultMessage:"Step {index}",id:"bui.stepper.step"},completed:{defaultMessage:"Completed",id:"bui.stepper.completed"}});var ne=fe.forwardRef(function(t,a){let{items:s,variant:r="expanded",size:o="md",selectedStep:d,defaultSelectedStep:y,onSelectionChange:c,lastCompletedStep:_,defaultLastCompletedStep:m,onLastCompletedStepChange:k,isDisabled:g,className:h,style:e,"aria-label":n,stepLabel:l,completedLabel:I}=t,b$1=b(),L=useMemo(()=>new Set(s.filter(i=>i.isDisabled).map(i=>i.key)),[s]),z=useMemo(()=>s.map(i=>jsx(a$1,{textValue:i.title??String(i.key),children:i.title??""},i.key)),[s]),P=useMemo(()=>new Map(s.map(i=>[i.key,i])),[s]),C=N({children:z,selectedKey:d,defaultSelectedKey:y,onSelectionChange:c,lastCompletedStep:_,defaultLastCompletedStep:m,onLastCompletedStepChange:k,disabledKeys:L,isDisabled:g}),x=a$2(a),{listProps:q}=w({children:z,"aria-label":n||b$1.formatMessage(Se.label)},C,x);return jsx("ol",{...q,ref:x,className:a$3("BaselineUI-Stepper",ae({variant:r}),h),style:e,"data-variant":r,"data-size":o,children:[...C.collection].map((i,v,de)=>{let V=P.get(i.key);return V?jsx(le,{state:C,item:V,size:o,variant:r,index:v,isLast:v===de.length-1,stepLabel:l,completedLabel:I},i.key):null})})});ne.displayName="Stepper";var Se=c({label:{defaultMessage:"Progress",id:"bui.stepper.label"}});export{ne as a};