@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.
- package/dist/Accordion.mjs +1 -1
- package/dist/ActionButton.mjs +1 -1
- package/dist/ActionGroup.mjs +1 -1
- package/dist/ActionIconButton.mjs +1 -1
- package/dist/Actionable.mjs +1 -1
- package/dist/AlertDialog.mjs +1 -1
- package/dist/AudioPlayer.mjs +1 -1
- package/dist/Box.mjs +1 -1
- package/dist/Breadcrumbs.css +10 -0
- package/dist/Breadcrumbs.mjs +1 -0
- package/dist/ButtonSelect.mjs +1 -1
- package/dist/Calendar.css +1 -1
- package/dist/Calendar.mjs +1 -1
- package/dist/Checkbox.mjs +1 -1
- package/dist/ColorInput.mjs +1 -1
- package/dist/ColorSwatch.mjs +1 -1
- package/dist/ColorSwatchPicker.mjs +1 -1
- package/dist/ComboBox.mjs +1 -1
- package/dist/DateField.css +1 -1
- package/dist/DateField.mjs +1 -1
- package/dist/Dialog.mjs +1 -1
- package/dist/Disclosure.mjs +1 -1
- package/dist/DomNodeRenderer.mjs +1 -1
- package/dist/Drawer.mjs +1 -1
- package/dist/Editor.css +1 -1
- package/dist/Editor.mjs +1 -1
- package/dist/FileInput.mjs +1 -1
- package/dist/FileList.mjs +1 -1
- package/dist/FileUploader.mjs +1 -1
- package/dist/FrameProvider.mjs +1 -1
- package/dist/FreehandCanvas.mjs +1 -1
- package/dist/GridList.mjs +1 -1
- package/dist/I18nProvider.mjs +1 -1
- package/dist/Icon.mjs +1 -1
- package/dist/ImageDropZone.mjs +1 -1
- package/dist/ImageGallery.mjs +1 -1
- package/dist/InlineAlert.mjs +1 -1
- package/dist/InlineToolbar.mjs +2 -2
- package/dist/Kbd.mjs +1 -1
- package/dist/Link.mjs +1 -1
- package/dist/ListBox.mjs +1 -1
- package/dist/Markdown.css +1 -1
- package/dist/Markdown.mjs +1 -1
- package/dist/Menu.mjs +1 -1
- package/dist/MessageFormat.mjs +1 -1
- package/dist/Modal.mjs +1 -1
- package/dist/NumberInput.mjs +1 -1
- package/dist/Pagination.mjs +1 -1
- package/dist/PointPicker.mjs +1 -1
- package/dist/Popover.mjs +1 -1
- package/dist/Portal.mjs +1 -1
- package/dist/Preview.mjs +1 -1
- package/dist/ProgressBar.mjs +1 -1
- package/dist/RadioGroup.mjs +1 -1
- package/dist/Reaction.mjs +1 -1
- package/dist/ScrollControlButton.mjs +1 -1
- package/dist/SearchInput.mjs +1 -1
- package/dist/Select.mjs +1 -1
- package/dist/Slider.mjs +1 -1
- package/dist/StatusCard.mjs +1 -1
- package/dist/Stepper.mjs +1 -1
- package/dist/Switch.css +1 -1
- package/dist/Switch.mjs +1 -1
- package/dist/Table.mjs +1 -1
- package/dist/Tabs.mjs +1 -1
- package/dist/Tag.mjs +1 -1
- package/dist/TagGroup.mjs +1 -1
- package/dist/TaggedPagination.mjs +1 -1
- package/dist/Text.mjs +1 -1
- package/dist/TextInput.mjs +1 -1
- package/dist/ThemeProvider.mjs +1 -1
- package/dist/TimeField.mjs +1 -1
- package/dist/Toast.mjs +1 -1
- package/dist/ToggleButton.mjs +1 -1
- package/dist/ToggleIconButton.mjs +1 -1
- package/dist/Toolbar.mjs +1 -1
- package/dist/Tooltip.mjs +1 -1
- package/dist/TreeView.mjs +1 -1
- package/dist/UNSAFE_ListBox.mjs +1 -1
- package/dist/Virtualizer.mjs +1 -1
- package/dist/{chunk-UOWKAUCQ.mjs → chunk-23WMOYTQ.mjs} +2 -2
- package/dist/{chunk-7XLBV46W.mjs → chunk-2JRDTJWJ.mjs} +1 -1
- package/dist/chunk-3IPRT57V.mjs +10 -0
- package/dist/{chunk-O6FPWOHR.mjs → chunk-4QGZDJW4.mjs} +1 -1
- package/dist/{chunk-UO75BAPM.mjs → chunk-4Y4WKIL5.mjs} +1 -1
- package/dist/chunk-54ZKQAA3.mjs +10 -0
- package/dist/{chunk-GLAMJIYO.mjs → chunk-5EI2562M.mjs} +1 -1
- package/dist/{chunk-6GMU63H2.mjs → chunk-5GW36EQJ.mjs} +1 -1
- package/dist/{chunk-ZA2FH3MS.mjs → chunk-5ILCVLWY.mjs} +1 -1
- package/dist/{chunk-VXZT2JR2.mjs → chunk-5W6G3ZUT.mjs} +1 -1
- package/dist/{chunk-UYUYQFOW.mjs → chunk-5YKRWGEJ.mjs} +1 -1
- package/dist/{chunk-7BE6MOPW.mjs → chunk-6CEV43ZA.mjs} +2 -2
- package/dist/chunk-6DETJFO2.mjs +10 -0
- package/dist/chunk-6DYTFYPO.mjs +10 -0
- package/dist/{chunk-3DWFAHR2.mjs → chunk-6GV3YWV7.mjs} +1 -1
- package/dist/chunk-6TRBOQVN.mjs +10 -0
- package/dist/chunk-6Z3GYFG5.mjs +10 -0
- package/dist/chunk-73UBSCJ2.mjs +10 -0
- package/dist/{chunk-7XGNJE7J.mjs → chunk-7DCQF3EP.mjs} +1 -1
- package/dist/{chunk-MCN5JU6E.mjs → chunk-7YCV7MPI.mjs} +1 -1
- package/dist/{chunk-3M3WJHOI.mjs → chunk-AQTRFPF2.mjs} +1 -1
- package/dist/{chunk-HABKIEKC.mjs → chunk-B5VHU77N.mjs} +1 -1
- package/dist/{chunk-ONBEVR2G.mjs → chunk-BULEKXBD.mjs} +1 -1
- package/dist/chunk-CBV6KXGO.mjs +30 -0
- package/dist/chunk-CD5KKXIM.mjs +10 -0
- package/dist/{chunk-KW3BKIG4.mjs → chunk-DG5VNJOH.mjs} +1 -1
- package/dist/{chunk-O7XK2WIX.mjs → chunk-DIL5HL6K.mjs} +2 -2
- package/dist/{chunk-QWZBZ23U.mjs → chunk-EDMVODCD.mjs} +1 -1
- package/dist/{chunk-PYV5J322.mjs → chunk-EFFODO2N.mjs} +1 -1
- package/dist/{chunk-CTBCJZEG.mjs → chunk-EGYIHFEQ.mjs} +1 -1
- package/dist/{chunk-5VNC6UYE.mjs → chunk-F3THHK5C.mjs} +1 -1
- package/dist/chunk-F56P4EKI.mjs +10 -0
- package/dist/{chunk-NMK4W6K3.mjs → chunk-FJO6KCT5.mjs} +2 -2
- package/dist/{chunk-GL5GUKT7.mjs → chunk-FX3THTOK.mjs} +1 -1
- package/dist/{chunk-EL5OYHOX.mjs → chunk-G5MSZV5O.mjs} +2 -2
- package/dist/chunk-GJ6ZPLFR.mjs +10 -0
- package/dist/{chunk-JRCDMRIW.mjs → chunk-HTRO6BM5.mjs} +1 -1
- package/dist/{chunk-7MLFM55C.mjs → chunk-IDIZSV2Y.mjs} +1 -1
- package/dist/chunk-IGM72PUL.mjs +0 -0
- package/dist/{chunk-2M2LI4MI.mjs → chunk-IMXJCV7G.mjs} +1 -1
- package/dist/{chunk-43LOJ3SH.mjs → chunk-IN7BLI4M.mjs} +1 -1
- package/dist/{chunk-AFOW62QN.mjs → chunk-INFMXVHD.mjs} +1 -1
- package/dist/{chunk-5G6JNQQR.mjs → chunk-IVDIKT6F.mjs} +1 -1
- package/dist/{chunk-WFYFHANE.mjs → chunk-JHA7DIPG.mjs} +1 -1
- package/dist/{chunk-X5ZTXDQ4.mjs → chunk-JXCL5CUV.mjs} +1 -1
- package/dist/chunk-K3WFKO7R.mjs +10 -0
- package/dist/{chunk-TFSBTGTQ.mjs → chunk-KQOXSF4J.mjs} +1 -1
- package/dist/{chunk-LKSUUT3M.mjs → chunk-L45T2KGW.mjs} +1 -1
- package/dist/{chunk-7EQIV4GX.mjs → chunk-LDWNE2JT.mjs} +1 -1
- package/dist/{chunk-676DOXEK.mjs → chunk-LY2ZVEGJ.mjs} +2 -2
- package/dist/chunk-M3R4ZM34.mjs +10 -0
- package/dist/{chunk-USUPPN73.mjs → chunk-MJPCLLDU.mjs} +1 -1
- package/dist/{chunk-5W67PVZQ.mjs → chunk-MKHLBKSN.mjs} +2 -2
- package/dist/{chunk-LBHZV4BO.mjs → chunk-MURSKAKT.mjs} +1 -1
- package/dist/chunk-MYT5CSGX.mjs +10 -0
- package/dist/{chunk-2AKHB7Y5.mjs → chunk-NLVJYKSA.mjs} +1 -1
- package/dist/{chunk-5G7ABQYJ.mjs → chunk-NO3DNA2U.mjs} +1 -1
- package/dist/{chunk-DO5YROCG.mjs → chunk-NT2MFIKD.mjs} +1 -1
- package/dist/{chunk-7P7VZMTO.mjs → chunk-NWWH62TU.mjs} +1 -1
- package/dist/chunk-O6PPXOEX.mjs +10 -0
- package/dist/chunk-OBEPT4LR.mjs +10 -0
- package/dist/{chunk-DAI7V4TE.mjs → chunk-OPIPJTLG.mjs} +1 -1
- package/dist/{chunk-3KWSJRYK.mjs → chunk-P6V5EAYL.mjs} +1 -1
- package/dist/chunk-PCR5FD43.mjs +10 -0
- package/dist/{chunk-Z3ZMWJSV.mjs → chunk-PR3CD3UC.mjs} +2 -2
- package/dist/chunk-Q6R75IOP.mjs +10 -0
- package/dist/{chunk-6M7PJXEE.mjs → chunk-QIYZRQGP.mjs} +1 -1
- package/dist/{chunk-BAIVRB2I.mjs → chunk-QL7SC5BW.mjs} +1 -1
- package/dist/{chunk-X5ORCNAU.mjs → chunk-QUWRO3HT.mjs} +1 -1
- package/dist/{chunk-3UC5V5E3.mjs → chunk-RE7ZGPOY.mjs} +1 -1
- package/dist/chunk-RINS2TBF.mjs +10 -0
- package/dist/{chunk-SLFKSR3T.mjs → chunk-SAATXQOW.mjs} +1 -1
- package/dist/chunk-SSWWJZRE.mjs +10 -0
- package/dist/{chunk-D5VU5TED.mjs → chunk-SXZP556C.mjs} +1 -1
- package/dist/{chunk-2WA3KB7H.mjs → chunk-TDRN6VLD.mjs} +1 -1
- package/dist/{chunk-OWQRYRWF.mjs → chunk-TFBJ767L.mjs} +1 -1
- package/dist/{chunk-QXXKOFWM.mjs → chunk-TLU2GNUT.mjs} +1 -1
- package/dist/{chunk-GFKZXGWJ.mjs → chunk-UCDGZFQ7.mjs} +1 -1
- package/dist/{chunk-ABXTAFKP.mjs → chunk-UPCEZ32D.mjs} +1 -1
- package/dist/chunk-VE2UA2AH.mjs +0 -0
- package/dist/{chunk-JDIGAVFU.mjs → chunk-VIMSH5F5.mjs} +1 -1
- package/dist/chunk-VNWKXT3X.mjs +10 -0
- package/dist/chunk-VPVF5N62.mjs +10 -0
- package/dist/chunk-VQ2K6Q3G.mjs +10 -0
- package/dist/chunk-WDWBYTJG.mjs +10 -0
- package/dist/{chunk-LQHFBXCW.mjs → chunk-X3ACY7IY.mjs} +2 -2
- package/dist/chunk-XC2S3RLC.mjs +10 -0
- package/dist/{chunk-SI5WP6I7.mjs → chunk-XO7MAUFC.mjs} +1 -1
- package/dist/{chunk-AN26QORL.mjs → chunk-XVL2GXTB.mjs} +1 -1
- package/dist/{chunk-PLZ6ZFEO.mjs → chunk-YAI33K42.mjs} +1 -1
- package/dist/chunk-YEIRJNEA.mjs +10 -0
- package/dist/{chunk-LQ7PGSP4.mjs → chunk-YNJD34U4.mjs} +1 -1
- package/dist/{chunk-FGSVPRDN.mjs → chunk-YQKEP62C.mjs} +1 -1
- package/dist/{chunk-CENNHSIS.mjs → chunk-ZC5WXVNV.mjs} +1 -1
- package/dist/chunk-ZXN5VT4G.mjs +10 -0
- package/dist/{chunk-UPJHL37C.mjs → chunk-ZZ7YJ2FN.mjs} +1 -1
- package/dist/hooks/useDevice.mjs +1 -1
- package/dist/hooks/useI18n.mjs +1 -1
- package/dist/hooks/useIntersectionObserver.mjs +1 -1
- package/dist/hooks/useLiveInteractionModality.mjs +1 -1
- package/dist/hooks/useMedia.mjs +1 -1
- package/dist/hooks/useMutationObserver.mjs +1 -1
- package/dist/hooks/usePortalContainer.mjs +1 -1
- package/dist/hooks/usePreventFocus.mjs +1 -1
- package/dist/hooks/useResizeObserver.mjs +1 -1
- package/dist/hooks/useTextSelection.mjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +305 -95
- package/dist/index.js +22 -21
- package/dist/index.mjs +1 -1
- package/dist/messageIds.mjs +1 -1
- package/dist/utils/colors.mjs +1 -1
- package/dist/utils/dom.mjs +1 -1
- package/dist/utils/isInShadowDOM.mjs +1 -1
- package/dist/utils/keyboards.mjs +1 -1
- package/dist/utils/selection.mjs +1 -0
- package/intl/ar.json +2 -0
- package/intl/cs.json +2 -0
- package/intl/cy.json +2 -0
- package/intl/da.json +2 -0
- package/intl/de.json +2 -0
- package/intl/el.json +2 -0
- package/intl/en-GB.json +2 -0
- package/intl/en.json +2 -0
- package/intl/es.json +2 -0
- package/intl/fi.json +2 -0
- package/intl/fr-CA.json +2 -0
- package/intl/fr.json +2 -0
- package/intl/he.json +2 -0
- package/intl/hr.json +2 -0
- package/intl/id.json +2 -0
- package/intl/it.json +2 -0
- package/intl/ja.json +2 -0
- package/intl/ko.json +2 -0
- package/intl/ms.json +2 -0
- package/intl/nb-NO.json +2 -0
- package/intl/nl.json +2 -0
- package/intl/pl.json +2 -0
- package/intl/pt-PT.json +2 -0
- package/intl/pt.json +2 -0
- package/intl/ru.json +2 -0
- package/intl/sk.json +2 -0
- package/intl/sl.json +2 -0
- package/intl/sv.json +2 -0
- package/intl/th.json +2 -0
- package/intl/tr.json +2 -0
- package/intl/uk.json +2 -0
- package/intl/zh-Hans.json +2 -0
- package/intl/zh-Hant.json +2 -0
- package/messages.json +8 -0
- package/package.json +4 -4
- package/sbom.json +6 -6
- package/dist/chunk-335C37NB.mjs +0 -10
- package/dist/chunk-46RUOB4U.mjs +0 -29
- package/dist/chunk-AMVX34SS.mjs +0 -10
- package/dist/chunk-AYQN3OH2.mjs +0 -10
- package/dist/chunk-BET5GVGQ.mjs +0 -10
- package/dist/chunk-FNCHBVLF.mjs +0 -10
- package/dist/chunk-IHES52NR.mjs +0 -10
- package/dist/chunk-NMGKHMH3.mjs +0 -10
- package/dist/chunk-OMWMNUTI.mjs +0 -10
- package/dist/chunk-R6Q7UMQS.mjs +0 -10
- package/dist/chunk-SBGZCLF4.mjs +0 -10
- package/dist/chunk-T6J7G3YL.mjs +0 -10
- package/dist/chunk-TTVYMCU3.mjs +0 -10
- package/dist/chunk-UH6QIGD3.mjs +0 -10
- package/dist/chunk-UYAFH4CW.mjs +0 -10
- package/dist/chunk-X7CKWYUD.mjs +0 -10
- package/dist/chunk-XQC3DSTW.mjs +0 -10
- package/dist/chunk-Y3HXPORF.mjs +0 -10
- package/dist/chunk-YFBMCK5O.mjs +0 -10
- package/dist/chunk-YMYMFVW4.mjs +0 -10
- package/dist/chunk-YQHHE5AT.mjs +0 -10
- package/dist/chunk-YYU46XNM.mjs +0 -10
- /package/dist/{chunk-MAJ74VNE.mjs → chunk-HMAVZPRE.mjs} +0 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {a as a$s}from'./chunk-JI4SJ53O.mjs';import {a as a$9}from'./chunk-MJPCLLDU.mjs';import {a as a$2}from'./chunk-WDWBYTJG.mjs';import {b as b$3}from'./chunk-BPW4QRPV.mjs';import {a as a$t}from'./chunk-TDYBXLYP.mjs';import {a as a$q}from'./chunk-K3WFKO7R.mjs';import {a as a$p}from'./chunk-O7IU5NHN.mjs';import {b as b$b}from'./chunk-HZM2XZP4.mjs';import {b as b$6,a as a$n}from'./chunk-XVL2GXTB.mjs';import {b as b$4}from'./chunk-ZXN5VT4G.mjs';import {b as b$8,c as c$2}from'./chunk-54ZKQAA3.mjs';import {f}from'./chunk-5GW36EQJ.mjs';import {a as a$k}from'./chunk-5BAHJXOI.mjs';import {a as a$7}from'./chunk-FCKJCFMD.mjs';import {a as a$l}from'./chunk-NGZRN4SF.mjs';import {a as a$r}from'./chunk-LDWNE2JT.mjs';import {a as a$g}from'./chunk-TLU2GNUT.mjs';import {a as a$i}from'./chunk-4QGZDJW4.mjs';import {a as a$j}from'./chunk-NT2MFIKD.mjs';import {a as a$o}from'./chunk-6GV3YWV7.mjs';import {b as b$9,e as e$1}from'./chunk-VPVF5N62.mjs';import {b as b$7,f as f$1}from'./chunk-UZ672WDX.mjs';import {a as a$b}from'./chunk-JZXLV6JU.mjs';import {a as a$e}from'./chunk-R6TFTLMV.mjs';import {c as c$1,b as b$1}from'./chunk-IDIZSV2Y.mjs';import {b as b$a}from'./chunk-INFMXVHD.mjs';import {a as a$a}from'./chunk-DIL5HL6K.mjs';import {a as a$c}from'./chunk-OPIPJTLG.mjs';import {a as a$m}from'./chunk-CIPPPD6E.mjs';import {a as a$d}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$5}from'./chunk-RSKKEGJZ.mjs';import {a as a$3}from'./chunk-STMDFIUL.mjs';import {a as a$4}from'./chunk-B3EZOXNU.mjs';import {j}from'./chunk-KUDCYGII.mjs';import {e}from'./chunk-PPHSLODC.mjs';import {b,c}from'./chunk-3WKDIXCM.mjs';import {a as a$h,c as c$3}from'./chunk-ETM4MNG4.mjs';import {a as a$8,b as b$2,j as j$2,h}from'./chunk-SD43KVTU.mjs';import {a as a$f}from'./chunk-UBLCUHRL.mjs';import {a}from'./chunk-JQQGRJ5J.mjs';import {a as a$6}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 wt,{useCallback,useImperativeHandle,useEffect,useRef,useState,useMemo,useId,useContext,useLayoutEffect,Fragment as Fragment$1}from'react';import {useGranularLayoutEffect}from'granular-hooks';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import bi from'just-camel-case';import {QuestionmarkCircleIcon,TextIcon,HighlightTextIcon}from'@baseline-ui/icons/24';import*as xr from'dompurify';import Oi 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 Vo="f6jv6bm",Wo="_1yep5z64u _1yep5z64v _1yep5z64w _1yep5z676 _1yep5z677 _1yep5z678 _1yep5z6k8 _1yep5z6k9 _1yep5z6ka",it="_1yep5z689 _1yep5z68a _1yep5z68b _1yep5z65x _1yep5z65y _1yep5z65z",qo=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"]]}),xt=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:[]}),$o="f6jv6b6",Go="f6jv6bj _1yep5z6x7 _1yep5z6x8 _1yep5z6x9 _1yep5z6xv _1yep5z6xw _1yep5z6xx _1yep5z6yj _1yep5z6yk _1yep5z6yl _1yep5z6z7 _1yep5z6z8 _1yep5z6z9",Yo="f6jv6bk";var Xo="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",Zo=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:[]}),Jo="_1yep5z6ke _1yep5z6kf _1yep5z6kg",Qo="f6jv6bf f6jv6bb _1yep5z6ai _1yep5z6aj _1yep5z6ak _1yep5z6b6 _1yep5z6b7 _1yep5z6b8 _1yep5z6j5 _1yep5z6j6 _1yep5z6j7 _1yep5z6ey _1yep5z6e3 _1yep5z6m3",er=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:[]}),tr="f6jv6bl",nr="f6jv6bb _1yep5z6ai _1yep5z6aj _1yep5z6ak _1yep5z6b6 _1yep5z6b7 _1yep5z6b8 _1yep5z6j5 _1yep5z6j6 _1yep5z6j7 _1yep5z6ey",Wt=a({defaultClassName:"f6jv6b7",variantClassNames:{isInline:{true:"f6jv6b8",false:"f6jv6b9"}},defaultVariants:{},compoundVariants:[]}),qt="f6jv6ba _1yep5z6j8 _1yep5z6j9 _1yep5z6ja _1yep5z6jh _1yep5z6ji _1yep5z6jj _1yep5z6jz _1yep5z6k0 _1yep5z6k1",yt="f6jv6bo";var $t=wt.forwardRef(({value:t,defaultValue:e,onChange:n,placeholder:o,spellCheck:r,textBoxRef:i,isInline:s,isMinimal:l,isDisabled:a,editableContentAriaLabel:c$1,editorHandle:d,autoFocus:u,saveOnEnter:f,onSave:p},h)=>{let m=wt.useRef(null),[k,I]=a$1(t,e||"",n),$=useCallback(E=>{I(E.currentTarget.value||"");},[I]),w=useCallback(E=>{a$2(E)||(f&&E.key==="Enter"&&!E.shiftKey||(E.ctrlKey||E.metaKey)&&E.key==="Enter")&&(E.preventDefault(),p());},[f,p]);useImperativeHandle(h,()=>({clear:()=>{I("");}}));let j=useCallback(E=>{E.currentTarget.style.height="16px",E.currentTarget.style.height=E.currentTarget.scrollHeight+"px";},[]);useGranularLayoutEffect(()=>{let E=m.current;E&&(E.style.height="16px",E.style.height=E.scrollHeight+"px");},[l],[k]),useImperativeHandle(d,()=>({setCaretPosition:E=>{m.current&&(m.current.focus(),m.current.setSelectionRange(E,E));},focus:()=>{m.current&&m.current.focus();}}));let N=u===true||u==="start"||u==="end",D=typeof u=="string"?u:void 0;useEffect(()=>{if(D&&m.current){let E=D==="start"?0:D==="end"?m.current.value.length:void 0;E!==void 0&&m.current.setSelectionRange(E,E);}},[D]);let{focusProps:Q,isFocused:U,isFocusVisible:pe}=a$3(),{hoverProps:x,isHovered:M}=a$4({isDisabled:a}),G=a$5({"data-focus-visible":pe,"data-hovered":M,"data-focused":U});return jsx("textarea",{...c(Q,x,G),ref:b(m,i),className:a$6({[xt()]:!l,[Wt({isInline:s})]:!l,[nr]:!l,[Qo]:l},"BaselineUI-Editor-PlainEditorEditingArea"),autoFocus:N,onChange:$,disabled:a,onInput:j,value:k,placeholder:o,spellCheck:r,"aria-label":c$1,onKeyDown:w})});$t.displayName="PlainEditor";var sr=[["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:bt}}=layoutSprinkleValues,lr=({isOpen:t,onClose:e,toolbarFocusLabel:n,helpLabel:o,closeLabel:r,actionLabel:i,shortcutLabel:s,boldLabel:l,italicLabel:a,underlineLabel:c,selectAllLabel:d,cutLabel:u,copyLabel:f,pasteLabel:p,undoLabel:h,redoLabel:m,openHelpDialogLabel:k,submitLabel:I})=>{let{formatMessage:$}=b$1(),w=c$3(),j={toolbarFocus:n,help:o,close:r,action:i,shortcut:s,bold:l,italic:a,underline:c,selectAll:d,cut:u,copy:f,paste:p,undo:h,redo:m,openHelpDialog:k,submit:I},N=D=>j[D]??$(Ti[D]);return jsx(b$9,{isOpen:t,onOpenChange:D=>{D||e();},children:jsx(e$1,{enableDrawer:"auto",style:{zIndex:999999},children:jsxs(a$j,{"aria-labelledby":w,className:Go,drawerBackground:"subtle",children:[jsxs(a$a,{paddingLeft:bt.padding.horizontal.lg,paddingRight:bt.padding.horizontal.sm,display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",backgroundColor:"background.primary.subtle",className:Yo,children:[jsx(a$o,{id:w,elementType:"h3",type:"title",size:"md",children:N("help")}),jsx(a$c,{icon:XIcon,size:"md",variant:"secondary","aria-label":N("close"),"data-testid":"editor-help-dialog-close-button",onPress:e})]}),jsx(a$b,{className:tr}),jsxs(a$a,{paddingX:bt.padding.horizontal.lg,role:"table","aria-labelledby":w,backgroundColor:"background.primary.subtle",children:[jsx("div",{role:"rowgroup",children:jsxs(a$a,{role:"row",display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingY:bt.padding.vertical.md,color:"text.primary",children:[jsx("h6",{className:sprinkles({typography:"heading.h6.semibold"}),role:"columnheader",children:N("action")}),jsx("h6",{className:sprinkles({typography:"heading.h6.semibold"}),role:"columnheader",style:{textTransform:"capitalize"},children:N("shortcut")})]})}),jsx("div",{role:"rowgroup",children:sr.map(([D,Q],U)=>jsxs(Fragment$1,{children:[jsxs(a$a,{role:"row",display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingY:bt.padding.vertical.xs,style:{minHeight:40},children:[jsx(a$o,{type:"subtitle",size:"sm",role:"cell",children:N(bi(D))}),jsx(a$o,{elementType:"kbd",type:"subtitle",size:"sm",role:"cell",children:a$p(Q,true)})]}),U!==sr.length-1&&jsx(a$b,{})]},D))})]})]})})})},Ti=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 vi=a$7("#ffffff00").toString("hexa"),Mn=[{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"}];[...Mn,{label:"Transparent",color:vi}];var lt="p",X="a",ce="mention",Me="mention_input";function Ln(t,e){return typeof t=="object"&&t!==null&&"type"in t&&t.type===e}function g(t){return typeof t=="object"&&t!==null&&"text"in t&&!("type"in t)}function R(t){return Ln(t,X)}function oe(t){return Ln(t,ce)}function Z(t){return Ln(t,Me)}function re(t){return oe(t)||Z(t)}function ge(){return [{type:lt,children:[{text:""}]}]}function Et(t,e){return t.bold===e.bold&&t.italic===e.italic&&t.underline===e.underline&&b$b(t.color,e.color)&&b$b(t.backgroundColor,e.backgroundColor)&&t.fontFamily===e.fontFamily&&t.fontSize===e.fontSize}function ar(t,e){return t.text===e.text&&Et(t,e)}function Ri(t,e){return g(t)?g(e)&&ar(t,e):g(e)||t.type!==e.type||t.children.length!==e.children.length||R(t)&&R(e)&&t.url!==e.url||oe(t)&&oe(e)&&(t.value!==e.value||t.displayName!==e.displayName)?false:t.children.every((n,o)=>ar(n,e.children[o]))}function dr(t,e){return t.length===e.length&&t.every((n,o)=>Sn(n,e[o]))}function Sn(t,e){return t.textAlign===e.textAlign&&t.children.length===e.children.length&&t.children.every((n,o)=>Ri(n,e.children[o]))}function Cn(t){let[e]=t.children;return t.children.length===1&&g(e)&&e.text===""}function ur(t,e){let n=(a,c)=>Sn(a,c)||Cn(a)&&Cn(c)&&a.textAlign===c.textAlign,o=Math.min(t.length,e.length),r=0;for(;r<o&&n(t[r],e[r]);)r+=1;let i=0;for(;i<o-r&&n(t[t.length-1-i],e[e.length-1-i]);)i+=1;let s=null,l=(a,c)=>{let d=e[c];!Cn(d)||Sn(t[a],d)||(s??=[...t],s[a]=d);};for(let a=0;a<r;a++)l(a,a);for(let a=0;a<i;a++)l(t.length-1-a,e.length-1-a);return s??t}function Gt(t,e){let n=false;for(let i=0;i<t.length;i++){let s=t[i];if(s.text===""&&!(e&&t.length===1)){n=true;break}if(i>0&&Et(t[i-1],s)){n=true;break}}if(!n)return t;let o=t.filter(i=>i.text!==""),r=[];for(let i of o){let s=r.at(-1);s!==void 0&&Et(s,i)?r[r.length-1]={...s,text:s.text+i.text}:r.push(i);}return r}function ki(t){let e=(i,s)=>i===0&&s===t.length||i>0&&re(t[i-1]),n=false,o=-1;for(let i=0;i<=t.length;i++){let s=t[i],l=i<t.length&&g(s);if(l&&o===-1)o=i;else if(!l&&o!==-1){let a=t.slice(o,i);if(Gt(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 s=t[i],l=i<t.length&&g(s);if(l&&o===-1)o=i;else if(!l&&o!==-1){let a=t.slice(o,i),c=Gt(a,e(o,i));for(let d of c)r.push(d);o=-1;}!l&&i<t.length&&r.push(s);}return r}function Mi(t){let e=false;for(let o=1;o<t.length;o++){let r=t[o-1],i=t[o];if(R(r)&&R(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(R(o)&&r!==void 0&&R(r)&&r.url===o.url){let i=Gt([...r.children,...o.children],false);n[n.length-1]={...r,children:i};}else n.push(o);}return n}function Ci(t){let e=Gt(t.children,t.children.length===1);return e.reduce((o,r)=>o+r.text,"")===""?null:e===t.children?t:{...t,children:e}}function Si(t){let e=false,n=[];for(let a of t)if(R(a)){let c=Ci(a);c===null?e=true:(n.push(c),c!==a&&(e=true));}else n.push(a);let o=e?n:t,r=ki(o),i=Mi(r),s=(a,c)=>re(a[c])&&(c===a.length-1||!g(a[c+1])),l=i;if(i.some((a,c)=>s(i,c))){l=[];for(let[a,c]of i.entries())l.push(c),s(i,a)&&l.push({text:""});}return l.length===0?[{text:""}]:l===o&&!e?t:l}function L(t){if(t.length===0)return ge();let e=false,n=t.map(o=>{let r=Si(o.children);return r===o.children?o:(e=true,{...o,children:r})});return e?n:t}function Tt(t,e){let n=e>0&&e<t.length&&/[\uD800-\uDBFF]/.test(t[e-1]);return t.slice(0,n?e-1:e)}function Li(t,e){let n=[],o=e;for(let r of t){if(o<=0)break;n.push(r.text.length>o?{...r,text:Tt(r.text,o)}:r),o-=r.text.length;}return n}function Di(t,e){let n=[],o=e;for(let r of t){let i=B(r);if(i<=o)n.push(r),o-=i;else if(g(r)){n.push({...r,text:Tt(r.text,o)});break}else if(R(r)){n.push({...r,children:Li(r.children,o)});break}else break}return n}function cr(t){return t.reduce((e,n)=>e+B(n),0)}function Dn(t,e){if(A(t)<=e)return t;let n=[],o=e;for(let[r,i]of t.entries()){if(r>0){if(o===0)break;o-=1;}let s=Di(i.children,o);n.push({...i,children:s});let l=cr(s);if(l<cr(i.children))break;o-=l;}return L(n)}function fr(t){throw new Error(`Editor: unknown inline node "${String(t.type)}".`)}function zi(t){if(g(t))return t.text;switch(t.type){case X:return t.children.map(e=>e.text).join("");case ce:return t.displayName;case Me:return t.children[0].text;default:return fr(t)}}function zn(t){return t.map(e=>e.children.map(n=>zi(n)).join("")).join(`
|
|
11
|
+
`)}function B(t){if(g(t))return t.text.length;switch(t.type){case X:{let e=0;for(let n=0;n<t.children.length;n++)e+=t.children[n].text.length;return e}case ce:return t.displayName.length;case Me:return t.children[0].text.length;default:return fr(t)}}function A(t){if(t.length===0)return 0;let e=t.length-1;for(let n of t)for(let o of n.children)e+=B(o);return e}var vt=["color","backgroundColor"],hr=["color","backgroundColor","fontFamily","fontSize","textAlign"],Pi=1,wn=3;function Rt(t){return t.nodeType===Pi}function at(t,e){return t.tagName.toLowerCase()===e}function wi(t){if(!Rt(t))return false;let e=t.tagName.toLowerCase();return e==="p"||e==="div"}function Ai(t){return Rt(t)&&t.querySelector("p, div")!==null}var Ii=new RegExp("["+String.fromCodePoint(8203)+String.fromCodePoint(65279)+"]","g"),_i=String.fromCodePoint(160);function Ue(t){return t.replaceAll(Ii,"").replaceAll(_i," ")}function Yt(t,e,n){let o={...e},r=t.tagName.toLowerCase();(r==="b"||r==="strong")&&(o.bold=true),(r==="i"||r==="em")&&(o.italic=true),r==="u"&&(o.underline=true);let i=t.style;if(i){let s=i.fontWeight;(s==="bold"||Number.parseInt(s,10)>=600&&s!=="")&&(o.bold=true),i.fontStyle==="italic"&&(o.italic=true),i.textDecoration?.includes("underline")&&(o.underline=true);let l=i.color;l&&n.includes("color")&&(o.color=l);let a=i.backgroundColor;a&&n.includes("backgroundColor")&&(o.backgroundColor=a);let c=i.fontFamily;c&&n.includes("fontFamily")&&(o.fontFamily=c);let d=i.fontSize;d&&n.includes("fontSize")&&(o.fontSize=d);}return o}function Xt(t,e,n,o,r){for(let i=0;i<t.childNodes.length;i++){let s=t.childNodes[i];if(s.nodeType===wn){let a=s.nodeValue??"",c=Ue(a);c.length>0&&o.push(kt(c,e));continue}if(!Rt(s))continue;if(at(s,"span")&&s.dataset.userId!==void 0){let a=s.dataset.userId??"",c=s.textContent??"",d=c.startsWith("@")?c.slice(1):c;o.push({type:ce,value:a,displayName:d,children:[{text:""}]});continue}if(at(s,"span")&&s.dataset.mentionAnchor!==void 0){let a=s.textContent??"";o.push({type:Me,children:[{text:a}]});continue}if(at(s,"a")){let a=Yt(s,e,r);{let c=s.getAttribute("href")??"",d=[];mr(s,a,d,r);let u=An(d);u.some(p=>p.text.length>0)&&o.push({type:X,url:c,children:u});}continue}if(at(s,"br")){o.push({text:"\0BR\0"});continue}let l=Yt(s,e,r);Xt(s,l,n,o,r);}}function mr(t,e,n,o){for(let r=0;r<t.childNodes.length;r++){let i=t.childNodes[r];if(i.nodeType===wn){let l=i.nodeValue??"",a=Ue(l);a.length>0&&n.push(kt(a,e));continue}if(!Rt(i))continue;if(at(i,"br")){n.push({text:"\0BR\0"});continue}let s=Yt(i,e,o);mr(i,s,n,o);}}function kt(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),e.fontFamily&&(n.fontFamily=e.fontFamily),e.fontSize&&(n.fontSize=e.fontSize),n}var gr="\0BR\0";function An(t){let e=[...t];if(e.length===1&&Pn(e[0]))return [{text:""}];let n=e.length,o=0;for(;o<n&&Pn(e[n-1-o]);)o+=1;let r=o>=2?o-1:0;n-=o;let i=[];for(let s=0;s<n;s++){let l=e[s];Pn(l)?pr(i):i.push(l);}for(let s=0;s<r;s++)pr(i);return i}function Pn(t){return "text"in t&&t.text===gr}function pr(t){let e=t.at(-1);e!==void 0&&"text"in e&&!("type"in e)?e.text+=`
|
|
12
|
+
`:t.push({text:`
|
|
13
|
+
`});}function Ni(t,e){let n=[];Xt(t,Yt(t,{},e),false,n,e);let o=An(n),r=e.includes("textAlign")?t.style?.textAlign:void 0;return {type:lt,...r?{textAlign:r}:{},children:o.length>0?o:[{text:""}]}}function Zt(t,e=vt){let n=t.childNodes;if(n.length===0)return ge();let o=[],r=[];function i(){if(r.length===0)return;let l=An(r);o.push({type:lt,children:l.length>0?l:[{text:""}]}),r=[];}function s(l){for(let a of l)if(wi(a))i(),o.push(Ni(a,e));else if(a.nodeType===wn){let c=a.nodeValue??"",d=Ue(c);d.trim().length>0&&r.push({text:d});}else Rt(a)&&(at(a,"br")?r.push({text:gr}):Ai(a)?(i(),s(a.childNodes)):Xt(a,{},false,r,e));}return s(n),i(),o.length===0?ge():L(o)}function Bi(t){return Object.entries(t).map(([e,n])=>`${Oi(e)}:${n}`).filter(([,e])=>!!e).join(";")}function In(t){return !t.color&&!t.backgroundColor&&!t.fontFamily&&!t.fontSize?"":Bi(a$5({color:Ve(t.color),backgroundColor:Ve(t.backgroundColor),fontFamily:Ve(t.fontFamily),fontSize:Ve(t.fontSize)}))}function yr(t){return "text"in t}function Ve(t){if(!(t===void 0||/[;{}]|url\(/i.test(t)))return t}function ct(t){return t.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}function xe(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 _n(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 br(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=xe(o.getAttribute("href")??"");return {isLinkClick:true,url:r===""?null:r}}function Fi(t){return t.text.includes(`
|
|
14
|
+
`)?t.text.split(`
|
|
15
|
+
`).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),t.fontFamily!==void 0&&(o.fontFamily=t.fontFamily),t.fontSize!==void 0&&(o.fontSize=t.fontSize)),o}):[t]}function Ki(t){let e=[[]],n=0;for(let o of t)if(yr(o)){let r=Fi(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 ie(t){if(!t)return "";function e(n){if(yr(n)){if(n.text==="")return "";let r=ct(n.text);n.bold&&(r=`<b>${r}</b>`),n.italic&&(r=`<i>${r}</i>`),n.underline&&(r=`<u>${r}</u>`);let i=In(n);return i&&(r=`<span style="${ct(i)}">${r}</span>`),r}let o=n.children?.map(r=>ie(r)).join("");switch(n.type){case lt:{let r=Ki(n.children),i=Ve(n.textAlign),s=i?`<p style="text-align:${ct(i)}">`:"<p>";return r.map(l=>{let a=l.map(c=>ie(c)).join("");return `${s}${a}</p>`}).join("")}case X:return `<a href="${ct(xe(n.url))}">${o}</a>`;case ce:return `<span data-user-id="${ct(n.value)}">${ct(n.displayName)}</span>`;default:return o}}return Array.isArray(t)?t.map(n=>e(n)).join(""):e(t)}function Nn(t,e=vt){let n=new DOMParser().parseFromString(xr.default.sanitize(t),"text/html");if(!n.body.querySelector("p, div")){let o=n.createElement("p");o.append(...n.body.childNodes),n.body.append(o);}return Zt(n.body,e)}var Hi=new Set(["(","[","{","<",'"',"'","`","\xAB"]),ji=new Set([".",",","!","?",":",";",'"',"'","`","\xBB"]),Ui=new Map([[")","("],["]","["],["}","{"]]);function Er(t,e){let n=0;for(let o of t)o===e&&n++;return n}function Jt(t){let e=0,n=t.length;for(;e<n&&Hi.has(t[e]);)e++;for(;n>e;){let s=t[n-1];if(ji.has(s)){n--;continue}let l=Ui.get(s);if(l!==void 0){let a=t.slice(e,n);if(Er(a,s)>Er(a,l)){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 Vi(t){let e=[],n=/\S+/g,o;for(;(o=n.exec(t))!==null;){let r=Jt(o[0]);if(r){let i=o.index+r.start,s=o.index+r.end;e.push({start:i,end:s,text:t.slice(i,s),url:r.url});}}return e}function Tr(t){let e=t.trim();if(e===""||/\s/.test(e))return null;let n=Jt(e);return n&&n.start===0&&n.end===e.length?n.url:null}function Wi(t){let e=Vi(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:X,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 On(t){let e=false,n=t.map(o=>{let r=false,i=[];for(let s of o.children){let l=g(s)?Wi(s):null;l?(i.push(...l),r=true):i.push(s);}return r?(e=true,{...o,children:i}):o});return e?n:t}function vr(t){return oe(t)?0:B(t)}function Rr(t){return t.children.reduce((e,n)=>e+B(n),0)}function Bn(t,e,n){return Math.min(Math.max(t,e),n)}function J(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 z(t){return J(t.anchor,t.focus)===0}function Fn(t){return J(t.anchor,t.focus)<=0?t:{anchor:t.focus,focus:t.anchor}}function de(t,e){let n=Bn(e.path[0],0,t.length-1),o=t[n].children,r=Bn(e.path[1],0,o.length-1),i=Bn(e.offset,0,vr(o[r]));return {path:[n,r],offset:i}}function we(t){return {path:[0,0],offset:0}}function Ae(t){let e=t.length-1,n=t[e].children,o=n.length-1;return {path:[e,o],offset:vr(n[o])}}function P(t,e){let n=Math.max(e,0);for(let o=0;o<t.length;o++){let r=t[o],i=Rr(r);if(n>i){n-=i+1;continue}let s=r.children;for(let l=0;l<s.length;l++){let a=s[l],c=B(a);if(oe(a)){if(n===0)return {path:[o,l],offset:0};if(n<c)return {path:[o,l+1],offset:0}}else if(n<=c)return {path:[o,l],offset:n};n-=c;}}return Ae(t)}function C(t,e){let[n,o]=e.path,r=0;for(let s=0;s<n;s++)r+=Rr(t[s])+1;let i=t[n].children;for(let s=0;s<o;s++)r+=B(i[s]);return r+e.offset}function We(t){let e={};for(let[n,o]of Object.entries(t))o!==null&&Object.assign(e,{[n]:o});return e}var dt=Object.freeze({bold:false,italic:false,underline:false}),Kn=["color","backgroundColor","fontFamily","fontSize"];function Ie(t,e,n,o,r){let i=n==="atomic";if(t<o.path[0]||t>r.path[0])return null;let s=0;if(t===o.path[0]){if(e<o.path[1])return null;e===o.path[1]&&(s=i?0:o.offset);}let l=i?1:n;if(t===r.path[0]){if(e>r.path[1])return null;e===r.path[1]&&(l=i?r.offset>0?1:0:r.offset);}return s>=l?null:{from:s,to:l}}function Hn(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 Mr(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[s,l]of i.entries())if(!re(l)){if(g(l)){let a=Ie(r,s,l.text.length,e,n);a&&o(l,a.from,a.to);}else if(R(l)){let a=Ie(r,s,B(l),e,n);a&&Hn(l,a,(c,d,u)=>{d<u&&o(c,d,u);});}}}}function Cr(t){return g(t)?t:R(t)?t.children.at(-1)??null:null}function Sr(t,e){let n=de(t,e),o=t[n.path[0]].children,r=o[n.path[1]],i=n.path[1]>0?Cr(o[n.path[1]-1]):null;if(g(r))return n.offset>0?r:i??r;if(R(r)){if(n.offset===0)return i??r.children[0]??null;let s=0;for(let l of r.children)if(s+=l.text.length,n.offset<=s)return l;return r.children.at(-1)??null}return Z(r)?n.offset>0?r.children[0]:i??r.children[0]:i}function kr(t){let e={bold:!!t.bold,italic:!!t.italic,underline:!!t.underline};return t.color!==void 0&&(e.color=t.color),t.backgroundColor!==void 0&&(e.backgroundColor=t.backgroundColor),t.fontFamily!==void 0&&(e.fontFamily=t.fontFamily),t.fontSize!==void 0&&(e.fontSize=t.fontSize),e}function qi(t,e){let n={};t.bold!==void 0&&t.bold===e.bold&&(n.bold=t.bold),t.italic!==void 0&&t.italic===e.italic&&(n.italic=t.italic),t.underline!==void 0&&t.underline===e.underline&&(n.underline=t.underline);for(let o of Kn){let r=t[o],i=e[o];if(r===void 0&&i===void 0)continue;let s=o==="color"||o==="backgroundColor"?b$b(r??void 0,i??void 0):r===i;n[o]=s&&r!=null?r:null;}return n}function ye(t,e){if(z(e)){let s=Sr(t,e.focus);return s?kr(s):{...dt}}let n=Fn(e),o=de(t,n.anchor),r=de(t,n.focus),i=null;return Mr(t,o,r,s=>{let l=kr(s);i=i===null?l:qi(i,l);}),i??{...dt}}function Qt(t,e,n){if(n===t)return {doc:t,range:e};let o=L(n);return {doc:o,range:{anchor:P(o,C(t,de(t,e.anchor))),focus:P(o,C(t,de(t,e.focus)))}}}function Lr(t,e,n,o){let r={...t,text:t.text.slice(e,n)},i=o(r);if(Et(i,r))return null;let s=[];return e>0&&s.push({...t,text:t.text.slice(0,e)}),s.push(i),n<t.text.length&&s.push({...t,text:t.text.slice(n)}),s}function $i(t,e,n){let o=false,r=[];return Hn(t,e,(i,s,l)=>{let a=s<l?Lr(i,s,l,n):null;a?(r.push(...a),o=true):r.push(i);}),o?{...t,children:r}:null}function Dr(t,e,n,o){let r=false,i=t.map((s,l)=>{if(l<e.path[0]||l>n.path[0])return s;let a=false,c=[];for(let[d,u]of s.children.entries())if(g(u)){let f=Ie(l,d,u.text.length,e,n),p=f?Lr(u,f.from,f.to,o):null;p?(c.push(...p),a=true):c.push(u);}else if(R(u)){let f=Ie(l,d,B(u),e,n),p=f?$i(u,f,o):null;p?(c.push(p),a=true):c.push(u);}else c.push(u);return a?(r=true,{...s,children:c}):s});return r?i:t}function qe(t,e){let n=Fn(e);return [de(t,n.anchor),de(t,n.focus)]}function en(t,e,n){if(z(e))return {doc:t,range:e};let[o,r]=qe(t,e),i=false,s=true;return Mr(t,o,r,a=>{i=true,a[n]||(s=false);}),i?Qt(t,e,Dr(t,o,r,s?a=>{let c={...a};return delete c[n],c}:a=>a[n]?a:{...a,[n]:true})):{doc:t,range:e}}function tn(t,e,n,o){if(z(e))return {doc:t,range:e};let[r,i]=qe(t,e);return Qt(t,e,Dr(t,r,i,l=>{if(l[n]===o)return l;let a={...l};return o===void 0?delete a[n]:a[n]=o,a}))}function zr(t,e){let n=[],o=[],r=0;for(let i of t){let s=r+i.text.length;s<=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=s;}return [n,o]}function ue(t,e,n){if(e>=t.length)return [[...t],[]];let o=t.slice(0,e),r=t.slice(e+1),i=t[e];if(g(i))o.push({...i,text:i.text.slice(0,n)}),r.unshift({...i,text:i.text.slice(n)});else if(R(i)){let[s,l]=zr(i.children,n);o.push({...i,children:s}),r.unshift({...i,children:l});}else n===0?r.unshift(i):o.push(i);return [o,r]}function jn(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,s]of t[r].children.entries()){if(!R(s))continue;let l={path:[r,i],offset:0},a={path:[r,i],offset:B(s)};if(J(n,a)<=0&&J(o,l)>=0)return {paragraphIndex:r,inlineIndex:i,link:s}}return null}function Pr(t,e){let n=jn(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:B(i)}}}}function wr(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,s]of t[r].children.entries()){if(g(s))continue;let l=re(s)?"atomic":B(s);if(Ie(r,i,l,n,o))return true}return false}function Gi(t,e,n,o){let r=[],i=(s,l,a)=>{l<a&&r.push({...s,text:s.text.slice(l,a)});};for(let[s,l]of t[e].children.entries())if(!re(l)){if(g(l)){let a=Ie(e,s,l.text.length,n,o);a&&i(l,a.from,a.to);}else if(R(l)){let a=Ie(e,s,B(l),n,o);a&&Hn(l,a,i);}}return r}function Un(t,e,n){if(z(e))return {doc:t,range:e};let[o,r]=qe(t,e);for(let l=o.path[0];l<=r.path[0]&&l<t.length;l++)for(let[a,c]of t[l].children.entries())if(re(c)&&Ie(l,a,"atomic",o,r))return {doc:t,range:e};let i=false,s=t.map((l,a)=>{if(a<o.path[0]||a>r.path[0])return l;let c=Gi(t,a,o,r);if(c.length===0)return l;let d=l.children,[u]=a===o.path[0]?ue(d,o.path[1],o.offset):[[]],f=a===r.path[0]?ue(d,r.path[1],r.offset)[1]:[];return i=true,{...l,children:[...u,{type:X,url:n,children:c},...f]}});return i?Qt(t,e,s):{doc:t,range:e}}function Ar(t,e,n){let o=jn(t,e);if(!o||o.link.url===n)return {doc:t,range:e};let{paragraphIndex:r,inlineIndex:i,link:s}=o,l=t.map((a,c)=>c!==r?a:{...a,children:a.children.map((d,u)=>u===i?{...s,url:n}:d)});return {doc:L(l),range:e}}function Ir(t,e){let n=jn(t,e);if(!n)return {doc:t,range:e};let{paragraphIndex:o,inlineIndex:r,link:i}=n,s=t.map((l,a)=>a!==o?l:{...l,children:l.children.flatMap((c,d)=>d===r?i.children:[c])});return Qt(t,e,s)}function $e(t,e){if(z(e))return {doc:t,range:e};let[n,o]=qe(t,e);if(J(n,o)===0)return {doc:t,range:e};let r=C(t,n),i=ue(t[n.path[0]].children,n.path[1],n.offset)[0],s=ue(t[o.path[0]].children,o.path[1],o.offset)[1],l={...t[n.path[0]],children:[...i,...s]},a=L([...t.slice(0,n.path[0]),l,...t.slice(o.path[0]+1)]),c=P(a,r);return {doc:a,range:{anchor:c,focus:c}}}function Vn(t,e){if(z(e))return ge();let[n,o]=qe(t,e);if(J(n,o)===0)return ge();let r=t[n.path[0]],i=t[o.path[0]],s;if(r===i){let l=ue(r.children,o.path[1],o.offset)[0];s=[{...r,children:ue(l,n.path[1],n.offset)[1]}];}else s=[{...r,children:ue(r.children,n.path[1],n.offset)[1]},...t.slice(n.path[0]+1,o.path[0]),{...i,children:ue(i.children,o.path[1],o.offset)[0]}];return structuredClone(L(s.map(l=>({...l,children:l.children.map(a=>Z(a)?{text:a.children[0].text}:a)}))))}function Mt(t,e,n){let o=de(t,e);if(n==="")return {doc:t,range:{anchor:o,focus:o}};let r=Sr(t,o),i=r?{...r,text:n}:{text:n},s=o.path[0],l=t[s].children,a=l[o.path[1]],c;if(R(a)&&o.offset>0&&o.offset<B(a)){let[f,p]=zr(a.children,o.offset),h={...a,children:[...f,i,...p]};c=l.map((m,k)=>k===o.path[1]?h:m);}else {let[f,p]=ue(l,o.path[1],o.offset);c=[...f,i,...p];}let d=L(t.map((f,p)=>p===s?{...f,children:c}:f)),u=P(d,C(t,o)+n.length);return {doc:d,range:{anchor:u,focus:u}}}function Wn(t,e,n){let o=L(n),r=A(o),i=t,s;if(z(e))s=de(t,e.focus);else {let p=$e(t,e);i=p.doc,s=p.range.focus;}if(o.length===1&&r===0)return {doc:i,range:{anchor:s,focus:s}};let l=s.path[0],[a,c]=ue(i[l].children,s.path[1],s.offset),d=o.length===1?[{...i[l],children:[...a,...o[0].children,...c]}]:[{...i[l],children:[...a,...o[0].children]},...o.slice(1,-1),{...i[l],children:[...o.at(-1).children,...c]}],u=L([...i.slice(0,l),...d,...i.slice(l+1)]),f=P(u,C(i,s)+r);return {doc:u,range:{anchor:f,focus:f}}}function _r(t,e){if(z(e))return Mt(t,e.focus,`
|
|
16
|
+
`);let n=$e(t,e);return Mt(n.doc,n.range.focus,`
|
|
17
|
+
`)}function Nr(t,e){return Wn(t,e,[{type:"p",children:[{text:""}]},{type:"p",children:[{text:""}]}])}function Or(t,e){for(let[n,o]of t.entries()){let r=o.children.indexOf(e);if(r!==-1)return [n,r]}return null}function Br(t){for(let[e,n]of t.entries())for(let[o,r]of n.children.entries())if(Z(r))return [e,o];return null}function Fr(t){let e=Ae(t);return {anchor:e,focus:e}}function Kr(t,e){let n=t,o;if(z(e))o=de(t,e.focus);else {let u=$e(t,e);n=u.doc,o=u.range.focus;}let r={type:Me,children:[{text:""}]},i=o.path[0],[s,l]=ue(n[i].children,o.path[1],o.offset),a=L(n.map((u,f)=>f===i?{...u,children:[...s,r,...l]}:u)),d={path:Or(a,r)??[0,0],offset:0};return {doc:a,range:{anchor:d,focus:d}}}function Hr(t,e){let n=Br(t);if(!n)return {doc:t,range:Fr(t)};let[o,r]=n,i={type:ce,value:e.id,displayName:e.displayName,children:[{text:""}]},s=L(t.map((d,u)=>u===o?{...d,children:d.children.map((f,p)=>p===r?i:f)}:d)),[l,a]=Or(s,i)??[o,r],c={path:[l,a+1],offset:0};return {doc:s,range:{anchor:c,focus:c}}}function qn(t,e,n="end"){let o=Br(t);if(!o)return {doc:t,range:Fr(t)};let[r,i]=o,s=t[r].children,l=i>0?Cr(s[i-1]):null,a=l?{...l,text:e}:{text:e},c=C(t,{path:[r,i],offset:0})+(n==="end"?e.length:0),d=L(t.map((f,p)=>p===r?{...f,children:s.map((h,m)=>m===i?a:h)}:f)),u=P(d,c);return {doc:d,range:{anchor:u,focus:u}}}function Yi(t){for(let e of t.children)if(re(e)||R(e)&&e.children.map(o=>o.text).join("").length>0||g(e)&&e.text.length>0)return false;return true}function $n(t,e){let n=t.createElement("br");return e==="break"?n.dataset.editorNode="break":n.dataset.editorFiller="true",n}function jr(t,e,n,o){if(n.text==="")return;let r=n.text.split(`
|
|
18
|
+
`);for(let i=0;i<r.length;i++){let s=r[i],l=i===r.length-1;if(s.length>0){let c=t.createTextNode(s);if(n.underline){let f=t.createElement("u");f.append(c),c=f;}if(n.italic){let f=t.createElement("i");f.append(c),c=f;}if(n.bold){let f=t.createElement("b");f.append(c),c=f;}let d=t.createElement("span");d.dataset.editorNode="text";let u=In(n);u&&d.setAttribute("style",u),d.append(c),e.append(d);}l?s===""&&r.length>1&&o&&e.append($n(t,"filler")):e.append($n(t,"break"));}}function Xi(t,e,n,o){if(g(n)){jr(t,e,n,o);return}switch(n.type){case X:{let r=t.createElement("a");r.dataset.editorNode="link",r.setAttribute("href",xe(n.url)),r.className=a$t({size:"sm",variant:"inline"});for(let i of n.children)jr(t,r,i,false);e.append(r);break}case ce:{let r=t.createElement("span");r.setAttribute("contenteditable","false"),r.dataset.userId=n.value,r.dataset.editorNode="mention",r.textContent=`@${n.displayName}`,e.append(r);break}case Me:{let r=t.createElement("span");r.setAttribute("contenteditable","false"),r.dataset.mentionAnchor="true",r.dataset.editorNode="mention-input",r.textContent=n.children[0].text,e.append(r);break}}}function nn(t){return g(t)?t.text!=="":R(t)?t.children.some(e=>e.text!==""):true}function Zi(t,e){let n=t.createElement("p");n.dataset.editorNode="paragraph";let o=Ve(e.textAlign);if(o&&(n.style.textAlign=o),Yi(e)){let i=t.createElement("span");return i.dataset.editorNode="text",i.append($n(t,"filler")),n.append(i),n}let r=-1;for(let i=e.children.length-1;i>=0;i--)if(nn(e.children[i])){r=i;break}for(let[i,s]of e.children.entries())Xi(t,n,s,i===r);return n}function Ct(t,e){let n=e.ownerDocument,o=n.createDocumentFragment();for(let r of t)o.append(Zi(n,r));e.replaceChildren(o);}var Ji=1,Qi=3,es=11;function fe(t){return t.nodeType===Ji}function Vr(t){return t.nodeType===es&&"host"in t}function on(t){return t.nodeType===Qi}function St(t,e){return t.tagName.toLowerCase()===e}function ts(t){return St(t,"span")?t.getAttribute("contenteditable")==="false":false}function ns(t,e,n,o,r){if(o===t){let l=t.childNodes,a=Math.min(r,l.length);return a===0?{found:true,point:{path:[n,0],offset:0}}:os(e,n,a)}let i=t.childNodes,s=0;for(let l=0;l<e.children.length;l++){let a=e.children[l];if(g(a)){let c=rn(e.children,l),d=$r(a.text,i,s,n,l,o,r,c);if(d.found)return d;s+=Ye(a.text,c);}else if(R(a)){if(s>=i.length)continue;let c=i[s];if(!fe(c)||!St(c,"a")){s++;continue}let d=rs(a,c,n,l,o,r);if(d.found)return d;s++;}else if(oe(a)||Z(a)){if(s>=i.length)continue;let c=i[s];if(!fe(c)||!ts(c)){s++;continue}if(o===c||(fe(o)||on(o))&&h(c,o))return {found:true,point:{path:[n,l+1],offset:0}};s++;}}return {found:false}}function os(t,e,n){let o=0;for(let s=0;s<t.children.length;s++){let l=t.children[s],a=g(l)?Ye(l.text,rn(t.children,s)):1;if(o+a>=n){if(g(l))return {found:true,point:{path:[e,s],offset:qr(l.text,n-o)}};if(re(l))return {found:true,point:{path:[e,s+1],offset:0}};{let c=l.children.reduce((d,u)=>d+u.text.length,0);return {found:true,point:{path:[e,s],offset:c}}}}o+=a;}let r=t.children.length-1,i=t.children[r];if(g(i))return {found:true,point:{path:[e,r],offset:i.text.length}};if(re(i))return {found:true,point:{path:[e,r+1],offset:0}};if(R(i)){let s=i.children.reduce((l,a)=>l+a.text.length,0);return {found:true,point:{path:[e,r],offset:s}}}return {found:false}}function Wr(t){return !t.children.some(e=>nn(e))}function rn(t,e){for(let n=e+1;n<t.length;n++)if(nn(t[n]))return false;return true}function Ye(t,e){if(t==="")return 0;let n=t.split(`
|
|
19
|
+
`),o=0;for(let r=0;r<n.length;r++)n[r].length>0&&o++,r<n.length-1&&o++;return e&&t.endsWith(`
|
|
20
|
+
`)&&o++,o}function qr(t,e){if(t==="")return 0;let n=t.split(`
|
|
21
|
+
`),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(`
|
|
22
|
+
`)&&o<e&&(r=t.length),Math.min(r,t.length)}function $r(t,e,n,o,r,i,s,l=false){if(t==="")return {found:false};let a=t.split(`
|
|
23
|
+
`),c=n,d=0;for(let u=0;u<a.length;u++){let f=a[u],p=u===a.length-1;if(f.length>0&&c<e.length){let h$1=e[c],m=sn(h$1);if(m!==null){if(i===m){let k=Math.min(s,f.length);return {found:true,point:{path:[o,r],offset:d+k}}}if(fe(i)&&h(i,m))return {found:true,point:{path:[o,r],offset:d+(s===0?0:f.length)}}}d+=f.length,c++;}if(p){if(p&&l&&t.endsWith(`
|
|
24
|
+
`)&&f===""&&c<e.length){let h=e[c];if(fe(h)&&St(h,"br")&&i===h)return {found:true,point:{path:[o,r],offset:d}};c++;}}else if(c<e.length){let h=e[c];if(fe(h)&&St(h,"br")&&i===h)return {found:true,point:{path:[o,r],offset:d+(s===0?0:1)}};d++,c++;}}return {found:false}}function rs(t,e,n,o,r,i){if(!fe(e))return {found:false};if(r===e){let c=e.childNodes,d=Math.min(i,c.length),u=0,f=0,p=0;for(let h of t.children){let m=Ye(h.text,false);if(p+m>=d){f=u+qr(h.text,d-p);break}u+=h.text.length,p+=m;}return p>=t.children.reduce((h,m)=>h+Ye(m.text,false),0)&&(f=t.children.reduce((h,m)=>h+m.text.length,0)),{found:true,point:{path:[n,o],offset:f}}}if(!h(e,r))return {found:false};let s=e.childNodes,l=0,a=0;for(let c of t.children){let d=$r(c.text,s,a,n,o,r,i);if(d.found)return {found:true,point:{path:[n,o],offset:l+d.point.offset}};l+=c.text.length,a+=Ye(c.text,false);}return {found:false}}function sn(t){if(on(t))return t;if(fe(t)){let e=t;for(;fe(e)&&e.childNodes.length===1;){let n=e.childNodes[0];if(on(n))return n;if(fe(n))e=n;else break}}return null}function Ge(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 s=Math.min(i,e.length)-1,l=e[s];if(!l)return null;let a=l.children.length-1,c=l.children[a];if(!c)return null;let d=g(c)?c.text.length:R(c)?c.children.reduce((u,f)=>u+f.text.length,0):0;return {path:[s,a],offset:d}}let r=t.children;for(let i=0;i<e.length;i++){let s=r[i];if(!s)return null;let l=e[i];if(n!==s&&!h(s,n))continue;if(Wr(l))return {path:[i,0],offset:0};let a=ns(s,l,i,n,o);return a.found?a.point:null}return null}catch{return null}}function Ur(t,e,n){try{let[o,r]=n.path,i=n.offset;if(o<0||o>=e.length)return null;let s=e[o];if(r<0||r>=s.children.length)return null;let l=s.children[r],a=t.children[o];if(!a)return null;if(Wr(s))return {node:a.firstChild??a,offset:0};let c=a.childNodes,d=0;for(let u=0;u<r;u++){let f=s.children[u];g(f)?d+=Ye(f.text,rn(s.children,u)):d++;}if(g(l))return Gr(l.text,i,c,d,a,rn(s.children,r));if(R(l)){if(d>=c.length)return null;let u=c[d];return !fe(u)||!St(u,"a")?null:is(l,i,u)}else if(oe(l)||Z(l)){let u=d+1;if(u<c.length){let f=c[u];if(on(f))return {node:f,offset:0}}return {node:a,offset:Math.min(u,a.childNodes.length)}}return null}catch{return null}}function Gr(t,e,n,o,r,i=false){if(t==="")return {node:r,offset:o};let s=t.split(`
|
|
25
|
+
`),l=o,a=0;for(let c=0;c<s.length;c++){let d=s[c],u=c===s.length-1;if(d.length>0&&l<n.length){let f=n[l];if(e>=a&&e<=a+d.length){let p=sn(f);return p!==null?{node:p,offset:e-a}:{node:r,offset:l}}a+=d.length,l++;}if(u){if(u&&t.endsWith(`
|
|
26
|
+
`)&&d===""&&l<=n.length){if(e===a)return {node:r,offset:Math.min(l,r.childNodes.length)};i&&l++;}}else if(l<n.length){if(e===a)return {node:r,offset:l};a++,l++;}}if(l>o&&l-1<n.length){let c=n[l-1],d=sn(c);return d!==null?{node:d,offset:d.length}:{node:r,offset:l}}return {node:r,offset:Math.min(l,r.childNodes.length)}}function is(t,e,n){let o=n.childNodes,r=0,i=0;for(let s of t.children){let l=s.text.length;if(e<=r+l)return Gr(s.text,e-r,o,i,n);r+=l,i+=Ye(s.text,false);}if(o.length>0){let s=n.lastChild,l=s===null?null:sn(s);return l!==null?{node:l,offset:l.length}:{node:n,offset:o.length}}return {node:n,offset:0}}function ss(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 Gn(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(Vr(r)){let i=ss(e,r);if(i&&h(t,i.startContainer))return i}return o}function ut(t,e){try{let n=a$q(t);if(!n)return null;let{anchorNode:o,focusNode:r}=n;if(o&&r&&h(t,o)&&h(t,r)){let a=Ge(t,e,o,n.anchorOffset),c=Ge(t,e,r,n.focusOffset);if(a!==null&&c!==null)return {anchor:a,focus:c}}let i=Gn(t,n);if(!i)return null;let s=Ge(t,e,i.startContainer,i.startOffset);if(s===null)return null;let l=Ge(t,e,i.endContainer,i.endOffset);return l===null?null:{anchor:s,focus:l}}catch{return null}}function ft(t,e,n){try{let o=Ur(t,e,n.anchor);if(o===null)return;let r=Ur(t,e,n.focus);if(r===null)return;let i=t.ownerDocument;if(!i)return;let s=a$q(t);if(!s)return;if(J(n.anchor,n.focus)>0||Vr(t.getRootNode())){s.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),s.removeAllRanges(),s.addRange(a);}catch{}}var an=class{constructor(e,n){this.getEl=e;this.getDoc=n;}getEl;getDoc;remembered=null;lastEmitted=null;writeDeferred=null;focusFromPointer=false;get range(){return this.remembered}set(e,n){if(this.remembered=e,!e||n==="remember")return false;if(n==="place"&&!this.hasFocus())return this.writeDeferred="render",false;let o=this.getEl();return o?(ft(o,this.getDoc(),e),true):false}markEmitted(){this.lastEmitted=this.remembered;}hasFocus(){let e=this.getEl();return e?h(e,f$1(e)):false}select(e,n){let o=this.getEl();if(!o)return false;let r=!this.remembered||!ln(this.remembered,e);return this.remembered=e,r&&(this.lastEmitted=e),this.writeDeferred="select",!n&&!this.hasFocus()||(o.focus(),this.writeDeferred=null,ft(o,this.getDoc(),e)),r}collapseToFocus(){if(!this.getEl())return false;let e=this.current();return !e||z(e)?false:this.select({anchor:e.focus,focus:e.focus},true)}onPointerDown(){this.writeDeferred=null,this.focusFromPointer=!this.hasFocus();}onFocus(){let e=this.focusFromPointer,n=this.writeDeferred;this.focusFromPointer=false,this.writeDeferred=null;let o=this.getEl();if(e||!o||!this.remembered)return;let r=this.getDoc(),i=n===null?ut(o,r):null;if(i&&!ls(r,i)){this.remembered=i;return}ft(o,r,this.remembered);}current(){let e=this.getEl();if(!e)return this.remembered;let n=ut(e,this.getDoc());return n&&this.adoptsLiveSelection(n)&&(this.remembered=n),this.remembered}adoptsLiveSelection(e){return this.writeDeferred===null?true:this.writeDeferred==="select"||z(e)?false:(this.writeDeferred=null,true)}adopt(e){let n=this.remembered;return this.remembered=e,!n||!ln(n,e)}follow(e){if(e&&!this.adoptsLiveSelection(e))return "ignored";if(e===null)return "silent";let n=this.remembered;return this.remembered=e,!n||!ln(n,e)||!this.lastEmitted||!ln(this.lastEmitted,e)?"changed":"silent"}};function ls(t,e){let n=we();return J(e.anchor,n)===0&&J(e.focus,n)===0}function ln(t,e){return t.anchor.path[0]===e.anchor.path[0]&&t.anchor.path[1]===e.anchor.path[1]&&t.anchor.offset===e.anchor.offset&&t.focus.path[0]===e.focus.path[0]&&t.focus.path[1]===e.focus.path[1]&&t.focus.offset===e.focus.offset}var Yr="typing";var cn=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===Yr&&this.lastKind===Yr&&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 dn=10,un=class{pending=null;preserveSelectionChanges=0;get marks(){return this.pending?.marks}get caretOffset(){return this.pending?.caretOffset}merge(e){return this.pending?.marks??e}clear(){this.pending=null;}toggle(e,n,o){let r=this.effectiveMarks(e,n);r[o]=!r[o],this.pending={marks:r,caretOffset:C(e,n.anchor)};}setValue(e,n,o,r){let i=this.effectiveMarks(e,n);r===void 0?delete i[o]:i[o]=r,this.pending={marks:i,caretOffset:C(e,n.anchor)};}effectiveMarks(e,n){return this.pending?{...this.pending.marks}:We(ye(e,n))}afterCommand(e,n,o,r){let i=this.pending?.marks;if(this.pending=null,e==="insertText"&&i){let s=Math.min(C(n,o.anchor),C(n,o.focus)),l=C(r.doc,r.range.focus),a=this.applyMarkSnapshot(r.doc,i,s,l),c=P(a,l);r={doc:a,range:{anchor:c,focus:c}};}return (e==="insertSoftBreak"||e==="insertParagraph")&&this.carryAcrossBreak(n,o,i,r),this.keepOfEmptiedDoc(n,r.doc),r}afterInput(e,n,o,r){this.keepOfEmptiedDoc(e,o),this.inheritOfEmptyRun(e,n);let i=o,s=r,l=false;if(!this.pending)return {doc:i,range:s,remarked:l};if(!r)return this.pending=null,{doc:i,range:s,remarked:l};let a=this.applyToTypedText(o,r,this.pending);return a.doc!==o&&(i=a.doc,s=a.range,l=true),this.pending={marks:this.pending.marks,caretOffset:C(i,a.range.anchor)},this.preserveSelectionChanges=dn,{doc:i,range:s,remarked:l}}onSelectionChange(e,n){this.preserveSelectionChanges>0?(this.preserveSelectionChanges-=1,this.pending&&n&&(this.pending={...this.pending,caretOffset:C(e,n.anchor)})):this.pending&&n&&C(e,n.anchor)!==this.pending.caretOffset&&(this.pending=null);}onGenuineCaretMove(){this.preserveSelectionChanges=0;}keepOfEmptiedDoc(e,n){A(e)===0||A(n)!==0||(this.pending={marks:this.pending?.marks??We(ye(e,{anchor:we(),focus:P(e,1)})),caretOffset:0},this.preserveSelectionChanges=dn);}inheritOfEmptyRun(e,n){if(this.pending)return;let o;if(A(e)===0)o=we();else if(n&&z(n)&&A([e[n.anchor.path[0]]])===0)o=n.anchor;else return;let r=We(ye(e,{anchor:o,focus:o}));Object.values(r).some(Boolean)&&(this.pending={marks:r,caretOffset:C(e,o)},this.preserveSelectionChanges=dn);}carryAcrossBreak(e,n,o,r){let i=o?{...o}:We(ye(e,n));!o&&!Object.values(i).some(Boolean)||(this.pending={marks:i,caretOffset:C(r.doc,r.range.anchor)},this.preserveSelectionChanges=dn);}applyToTypedText(e,n,o){let r=o.caretOffset,i=C(e,n.anchor);if(i<=r)return {doc:e,range:n};let s=this.applyMarkSnapshot(e,o.marks,r,i),l=P(s,i);return {doc:s,range:{anchor:l,focus:l}}}applyMarkSnapshot(e,n,o,r){let i=e,s=()=>({anchor:P(i,o),focus:P(i,r)});for(let l of ["bold","italic","underline"]){let a=s(),c=!!n[l],d=!!ye(i,a)[l];c!==d&&(i=en(i,a,l).doc);}for(let l of Kn){let a=s(),c=n[l],d=ye(i,a)[l];d!==null&&(l==="color"||l==="backgroundColor"?b$b(c,d):c===d)||(i=tn(i,a,l,c).doc);}return i}};function Zr(t){return g(t)?[t]:R(t)||Z(t)?t.children:[]}function Xr(t){return t.some(e=>!!e.textAlign||e.children.some(n=>Zr(n).some(o=>!!o.fontFamily||!!o.fontSize)))}function Jr(t,e,n){if(!Xr(t)&&!Xr(e))return t;let o=n.createElement("span"),r=(u,f)=>(o.style.removeProperty(Oi(u)),o.style[u]=f,o.style[u]),i={fontFamily:new Map,fontSize:new Map,textAlign:new Map},s=(u,f)=>{if(!f)return;let p=r(u,f);i[u].has(p)||i[u].set(p,f);};for(let u of e){s("textAlign",u.textAlign);for(let f of u.children)for(let p of Zr(f))s("fontFamily",p.fontFamily),s("fontSize",p.fontSize);}let l=(u,f)=>f===void 0?void 0:i[u].get(r(u,f))??f,a=u=>{let f={...u};for(let p of ["fontFamily","fontSize"]){let h=l(p,u[p]);h!==void 0&&(f[p]=h);}return f.fontFamily===u.fontFamily&&f.fontSize===u.fontSize?u:f},c=false,d=t.map(u=>{let f=l("textAlign",u.textAlign),p=u.children.map(h=>{if(g(h))return a(h);if(R(h)||Z(h)){let m=h.children.map(k=>a(k));return m.some((k,I)=>k!==h.children[I])?{...h,children:m}:h}return h});return f===u.textAlign&&p.every((h,m)=>h===u.children[m])?u:(c=true,{...u,...f===void 0?{}:{textAlign:f},children:p})});return c?d:t}var cs=1,ds=new Set(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"]);function us(t){return (t.key==="ArrowLeft"||t.key==="ArrowRight")&&!t.shiftKey&&(t.ctrlKey||t.altKey||t.metaKey)}function Yn(t){if(t!==void 0&&!(Number.isInteger(t)&&t>=0))throw new Error(`Editor: maxLength must be a finite integer >= 0, received ${String(t)}.`)}var Lt=class t{doc=ge();lastKnownHtml="";lastAppliedValue=null;lastAppliedDoc=null;selection;composing=false;enterHasShift=false;pendingMarks=new un;history=new cn;opts;el=null;pendingExternalRender=null;keyboardShortcutsOverride=void 0;constructor(e={}){this.opts=e,this.selection=new an(()=>this.el,()=>this.doc),this.lastKnownHtml=ie(this.doc);}setKeyboardShortcutsEnabled(e){this.keyboardShortcutsOverride=e;}attach(e){this.maxLength(),this.el=e,Ct(this.doc,e),this.selection.set(this.selection.range,"write");let n=this.handleBeforeInputBound,o=this.handleInputBound,r=this.handlePasteBound,i=this.handleCopyBound,s=this.handleCompositionStartBound,l=this.handleCompositionEndBound,a=this.handleSelectionChangeBound,c=this.handlePointerDownBound,d=this.handleFocusBound,u=this.handleKeyDownBound,f=this.handleDocumentKeyDownBound,p=e.ownerDocument;return e.addEventListener("beforeinput",n),e.addEventListener("input",o),e.addEventListener("paste",r),e.addEventListener("copy",i),e.addEventListener("cut",i),e.addEventListener("compositionstart",s),e.addEventListener("compositionend",l),e.addEventListener("pointerdown",c),e.addEventListener("focus",d),e.addEventListener("keydown",u),p.addEventListener("selectionchange",a),p.addEventListener("keydown",f),()=>{e.removeEventListener("beforeinput",n),e.removeEventListener("input",o),e.removeEventListener("paste",r),e.removeEventListener("copy",i),e.removeEventListener("cut",i),e.removeEventListener("compositionstart",s),e.removeEventListener("compositionend",l),e.removeEventListener("pointerdown",c),e.removeEventListener("focus",d),e.removeEventListener("keydown",u),p.removeEventListener("selectionchange",a),p.removeEventListener("keydown",f),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.selection.current(),this.handleBeforeInput(n);}};handleInputBound=e=>{j$2(e)===this.el&&(this.composing||this.syncFromDom());};isClipboardTargetInEditor(e,n=false){let o=j$2(e);return !o||!h(this.el,o)?false:!(o.nodeType===cs?o:o.parentElement)?.closest(n?"input":'input, [contenteditable="false"]')}handlePasteBound=e=>{let n=e;if(!this.isClipboardTargetInEditor(n)||(n.preventDefault(),this.opts.isReadOnly?.())||this.composing)return;this.selection.current();let o;try{o=this.opts.onPaste?.(n),o&&(o=L(o));}catch(r){o=null,queueMicrotask(()=>{throw r});}if(o!==null){if(o!==void 0){this.exec("insertFragment",o);return}this.insertPastedData(n.clipboardData);}};handleCopyBound=e=>{let n=e;if(!this.opts.onCopy||!this.isClipboardTargetInEditor(n,true))return;let o=this.selection.current(),r=o!==null&&!z(o),i=this.doc,s=r?Vn(i,o):ge();this.opts.onCopy(n,s)&&(n.preventDefault(),r&&n.type==="cut"&&!this.opts.isReadOnly?.()&&this.doc===i&&(this.select(o),this.exec("deleteRange")));};handleKeyDownBound=e=>{this.enterHasShift=e.key==="Enter"&&e.shiftKey,ds.has(e.key)&&this.pendingMarks.onGenuineCaretMove();};handleDocumentKeyDownBound=e=>{e.defaultPrevented||!this.el||!e.composedPath().includes(this.el)||!us(e)||this.selection.collapseToFocus()&&this.emitSelectionChange();};handlePointerDownBound=()=>{this.pendingMarks.onGenuineCaretMove(),this.selection.onPointerDown();};handleFocusBound=()=>{this.selection.onFocus();};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();};getDoc(e){return e?Vn(this.doc,e):this.doc}getValue(){return ie(this.doc)}setValue(e,n={}){if(e===this.lastKnownHtml||e===this.lastAppliedValue)return;let o,r;try{o=L(Nn(e,this.allowedStyles())),r=ie(o);}catch(i){process.env.NODE_ENV!=="production"&&console.error("[Editor] setValue failed to parse value:",i);return}this.lastAppliedValue=e,this.lastAppliedDoc=null,this.replaceDoc(o,r,n);}setDoc(e,n={}){if(e===this.doc||e===this.lastAppliedDoc)return;let o=L(e);this.lastAppliedDoc=e,!dr(o,this.doc)&&(this.lastAppliedValue=null,this.replaceDoc(o,ie(o),n));}replaceDoc(e,n,o){let r=this.selection.range?C(this.doc,this.selection.range.anchor):null,i=null;if(r!==null){let s=P(e,Math.min(r,A(e)));i={anchor:s,focus:s};}this.history.clear(),this.commit(e,i,{type:"external",html:n,emit:!!o.emit});}static docHasMentionInput(e){return e.some(n=>n.children.some(o=>Z(o)))}exec(e,...n){let o=this.selection.current(),r=this.doc,i=o??this.collapsedAtDocEnd(),s={doc:r,range:o},l;try{let a=this.fitToCapacity(e,n,i);if(a===null)return;l=this.dispatchCommand(e,a);}catch(a){process.env.NODE_ENV!=="production"&&console.error(`[Editor] command "${e}" threw:`,a);return}if(e==="confirmMention"){let a=this.maxLength();a!==void 0&&A(l.doc)>Math.max(a,A(r))&&(l=qn(r,""));}if(l.doc===r){if(e==="toggleMark"&&z(i)){let[a]=n;this.pendingMarks.toggle(this.doc,i,a),this.emitSelectionChange();return}if(e==="setMarkValue"&&z(i)){let[a,c]=n;this.pendingMarks.setValue(this.doc,i,a,c),this.emitSelectionChange();return}this.pendingMarks.clear();return}l=this.pendingMarks.afterCommand(e,r,i,l),this.history.record(s,e),this.commit(l.doc,l.range,{type:"command"});}fitToCapacity(e,n,o){let r=this.capacity(o);if(r===void 0)return n;switch(e){case "insertText":{let[i]=n,s=Tt(i,r);return s===""?null:[s]}case "removeMentionInput":{let[i,s]=n;return [Tt(i,r),s]}case "insertFragment":{let[i]=n;if(r===0)return null;let s=Dn(i,r);return A(s)===0&&A(i)>0?null:[s]}case "insertSoftBreak":case "insertParagraph":return r===0?null:n;default:return n}}maxLength(){let e=this.opts.maxLength?.();return Yn(e),e}clampToMaxLength(e){let n=ut(this.el,e),o=this.maxLength(),r=o===void 0?void 0:Math.max(o,A(this.doc));if(r===void 0||A(e)<=r)return {doc:e,range:n,overflowed:false};let i=n?C(e,n.focus):this.insertionEnd(e),s=A(e)-r;if(i===void 0||i<s){let c=Dn(e,r);if(i===void 0)return {doc:c,range:n,overflowed:true};let d=P(c,Math.min(i,r));return {doc:c,range:{anchor:d,focus:d},overflowed:true}}let l=i-s;/[\uDC00-\uDFFF]/.test(zn(e)[l]??"")&&(l-=1);let a=$e(e,{anchor:P(e,l),focus:P(e,i)});return {doc:a.doc,range:a.range,overflowed:true}}insertionEnd(e){let n=this.selection.range;if(!n)return;let o=C(this.doc,n.anchor),r=C(this.doc,n.focus),i=A(this.doc)-Math.abs(o-r);return Math.min(o,r)+A(e)-i}capacity(e){let n=this.maxLength();if(n===void 0)return;let o=Math.abs(C(this.doc,e.anchor)-C(this.doc,e.focus)),r=A(this.doc);return Math.max(0,Math.max(n,r)-(r-o))}undo(){if(!this.history.canUndo)return;let e={doc:this.doc,range:this.selection.range},n=this.history.undo(e);n&&this.commit(n.doc,n.range,{type:"history"});}redo(){if(!this.history.canRedo)return;let e={doc:this.doc,range:this.selection.range},n=this.history.redo(e);n&&this.commit(n.doc,n.range,{type:"history"});}canUndo(){return this.history.canUndo}canRedo(){return this.history.canRedo}focus(){this.el?.focus();}setCaretPosition(e){if(!this.el)return;let n=P(this.doc,e);this.select({anchor:n,focus:n});}select(e,n){this.selection.select(e,n?.focus!==false)&&(this.pendingMarks.clear(),this.emitSelectionChange());}selectStart(){this.setCaretPosition(0);}selectEnd(){let e=Ae(this.doc);this.select({anchor:e,focus:e});}selectAll(e){this.select({anchor:we(this.doc),focus:Ae(this.doc)},e);}getSelectionState(){return this.buildSelectionState(this.selection.current())}buildSelectionState(e){let n=e?ye(this.doc,e):{...dt},o=this.pendingMarks.merge(n),r=e?Pr(this.doc,e):null;return {marks:o,link:r,range:e}}notifyChange(e,n){let o;try{this.opts.onChange?.(n);}catch(r){o={error:r};}if(this.doc===e&&this.opts.onDocChange?.(e),o)throw o.error}emitSelectionChange(){this.selection.markEmitted(),this.opts.onSelectionChange&&this.opts.onSelectionChange(this.buildSelectionState(this.selection.range));}commit(e,n,o){let r=o.type==="external"?o.html:ie(e),i=o.type==="external"&&t.docHasMentionInput(this.doc);this.doc=e,this.lastKnownHtml=r,(o.type==="history"||o.type==="external")&&this.pendingMarks.clear(),this.selection.set(n,"remember"),o.type!=="external"&&(this.lastAppliedValue=null,this.lastAppliedDoc=null);let s=this.el;switch(o.type){case "command":case "history":{s&&!this.composing&&(Ct(e,s),this.selection.set(n,"place"));break}case "native":{s&&o.rerender&&(Ct(e,s),this.selection.set(n,"write"));break}case "external":{if(!s)break;let l=()=>{this.el&&(Ct(e,this.el),n&&!this.selection.set(n,"place")&&!o.emit&&this.emitSelectionChange());};this.composing?this.pendingExternalRender=l:l();break}}o.type==="external"&&(i&&!t.docHasMentionInput(e)&&this.opts.onMentionInputRemoved?.(),!o.emit)||((o.type!=="native"||o.contentChanged)&&this.notifyChange(e,r),this.emitSelectionChange());}insertOverflowingText(e){if(!e.data)return false;let n=this.capacity(this.selection.current()??this.collapsedAtDocEnd());if(n===void 0||e.data.length<=n)return false;e.preventDefault();let o=this.pendingMarks.marks;return o?this.exec("insertFragment",[{type:"p",children:[kt(e.data,o)]}]):this.exec("insertText",e.data),true}handleNativeInsert(e){return e.inputType==="insertText"?this.insertOverflowingText(e):e.inputType==="insertReplacementText"&&this.replaceTargetText(e)}replaceTargetText(e){let n=this.el,o=e.getTargetRanges?.()[0],r=e.data??e.dataTransfer?.getData("text/plain");if(!n||!o||!r)return false;let i=Ge(n,this.doc,o.startContainer,o.startOffset),s=Ge(n,this.doc,o.endContainer,o.endOffset);if(!i||!s)return false;e.preventDefault();let l=kt(r,We(ye(this.doc,{anchor:i,focus:s}))),a=this.doc[i.path[0]]?.children[i.path[1]],c=R(a)&&i.path[0]===s.path[0]&&i.path[1]===s.path[1];return ft(n,this.doc,{anchor:i,focus:s}),this.exec("insertFragment",[{type:"p",children:[c?{...a,children:[l]}:l]}]),true}breakCommand(e){return e==="insertParagraph"&&!this.enterHasShift&&this.opts.enterInsertsParagraph?.()?"insertParagraph":"insertSoftBreak"}handleBeforeInput(e){let{inputType:n}=e;if(n==="insertParagraph"||n==="insertLineBreak"){e.preventDefault();let r=this.detectAutoLinkBeforeCaret(),i=this.doc;this.exec(this.breakCommand(n)),r&&this.applyAutoLink(r,i);return}if(n==="insertText"&&e.data===" "){let r=this.detectAutoLinkBeforeCaret();if(r){e.preventDefault();let i=this.doc;this.exec("insertText"," "),this.applyAutoLink(r,i);return}}if(this.handleNativeInsert(e))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.selection.range)return true;if(!z(this.selection.range))return false;let e=this.selection.range,[n,o]=e.anchor.path,r=e.anchor.offset,i=this.doc;if(n>=i.length)return true;let s=i[n];if(o>=s.children.length)return true;let l=s.children[o];if(r===0&&o===0)return true;let a=null;if(g(l)){let c=l.text;if(r>0)a=c[r-1];else if(o>0)a=this.lastCharOf(s.children[o-1]);else return true}else if(R(l)){let c=l.children.map(d=>d.text).join("");if(r>0)a=c[r-1]??null;else if(o>0)a=this.lastCharOf(s.children[o-1]);else return true}else if(r===0&&o>0)a=this.lastCharOf(s.children[o-1]);else return true;return a===null?true:/^[\s"']$/.test(a)}lastCharOf(e){if(g(e)){let n=e.text;return n.length>0?n.at(-1)??null:null}if(R(e)){let o=(e.children??[]).at(-1);return o&&o.text.length>0?o.text.at(-1)??null:null}if(oe(e)){let n=e.displayName??"";return n.length>0?n.at(-1)??null:null}return null}allowedStyles(){return this.opts.htmlStyles?.()??vt}autoLinkEnabled(){return this.opts.autoLink?.()??true}detectAutoLinkBeforeCaret(){return !this.autoLinkEnabled()||this.composing?null:this.findAutoLinkBeforeCaret()}findAutoLinkBeforeCaret(){let e=this.selection.range;if(!e||!z(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,s=n.path[1],l=n.offset;if(s>=i.length){s=i.length-1;let f=i[s];if(!f||!g(f))return null;l=f.text.length;}else {let f=i[s];g(f)&&l>f.text.length&&(l=f.text.length);}let a=i[s];if(g(a)&&l<a.text.length&&!/\s/.test(a.text[l]))return null;let c="";for(;;){let f=i[s];if(!f||!g(f))break;if(l>0){let p=f.text[l-1];if(/\s/.test(p))break;c=p+c,l-=1;}else {if(s===0)break;let p=i[s-1];if(!g(p))break;s-=1,l=p.text.length;}}if(c==="")return null;let d=Jt(c);if(!d)return null;let u=C(o,{path:[r,s],offset:l});return {startAbs:u+d.start,endAbs:u+d.end,url:d.url}}applyAutoLink(e,n){if(this.doc===n)return;let o=xe(e.url);if(o==="")return;let r=this.doc,i={anchor:P(r,e.startAbs),focus:P(r,e.endAbs)},s={doc:r,range:this.selection.range},l=Un(r,i,o);if(l.doc===r)return;let a=this.selection.range?C(r,this.selection.range.anchor):e.endAbs;this.history.record(s,"wrapLink");let c=P(l.doc,a);this.commit(l.doc,{anchor:c,focus:c},{type:"command"});}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(!oe(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.selection.range;if(i&&!z(i)&&i.anchor.path[0]===i.focus.path[0]){let s=Tr(o),l=s?xe(s):"";if(l&&!wr(this.doc,i)){this.exec("wrapLink",l);return}}}let r=e.getData("text/html");if(r)try{let i=L(this.resolvePastedMentions(Nn(r)));n&&(i=L(On(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=Ue(o.replaceAll(`\r
|
|
27
|
+
`,`
|
|
28
|
+
`).replaceAll("\r",`
|
|
29
|
+
`)),s=L([{type:"p",children:[{text:i}]}]);n&&(s=L(On(s))),this.exec("insertFragment",s);}}syncFromDom(){if(!this.el||this.composing)return;let e=this.doc,n={doc:e,range:this.selection.range},{doc:o,range:r,overflowed:i}=this.clampToMaxLength(ur(Jr(Zt(this.el,hr),e,this.el.ownerDocument),e)),l=ie(o)!==this.lastKnownHtml;if(!l&&!i){r&&this.selection.adopt(r)&&this.emitSelectionChange();return}l&&this.history.record(n,"typing");let a=o,c=r,d=i;if(!c&&n.range){let f=Math.max(A(o)-A(e),0),p=this.pendingMarks.caretOffset??C(e,n.range.anchor),h=P(o,p+f);c={anchor:h,focus:h};}let u=this.pendingMarks.afterInput(e,n.range,o,c);a=u.doc,c=u.range,u.remarked&&(d=true),this.commit(a,c,{type:"native",rerender:d,contentChanged:l});}handleSelectionChange(){if(!this.el)return;let e=a$q(this.el);if(!e)return;let n=Gn(this.el,e);if(!n||!h(this.el,n.startContainer))return;let o=ut(this.el,this.doc),r=this.selection.follow(o);r!=="ignored"&&(this.pendingMarks.onSelectionChange(this.doc,o),r==="changed"&&this.emitSelectionChange());}dispatchCommand(e,n){let o=this.doc,r=this.selection.range??this.collapsedAtDocEnd();switch(e){case "toggleMark":{let[i]=n;return en(o,r,i)}case "setMarkValue":{let[i,s]=n;return tn(o,r,i,s)}case "wrapLink":{let[i]=n;return Un(o,r,i)}case "updateLinkUrl":{let[i]=n;return Ar(o,r,i)}case "unwrapLink":return Ir(o,r);case "deleteRange":return $e(o,r);case "insertText":{let[i]=n;if(!z(r)){let s=$e(o,r);return Mt(s.doc,s.range.focus,i)}return Mt(o,r.anchor,i)}case "insertFragment":{let[i]=n;return Wn(o,r,i)}case "insertSoftBreak":return _r(o,r);case "insertParagraph":return Nr(o,r);case "insertMentionInput":return Kr(o,r);case "confirmMention":{let[i]=n;return Hr(o,i)}case "removeMentionInput":{let[i,s]=n;return qn(o,i,s)}default:return {doc:o,range:r}}}collapsedAtDocEnd(){let e=Ae(this.doc);return {anchor:e,focus:e}}};var Dt=wt.createContext(null);function Ce(){let t=wt.useContext(Dt);if(!t)throw new Error("useEditorContext must be used within an EditorProvider");return t}var fn=Object.freeze({marks:dt,link:null,range:null});function ps(t){let e=Ue(t.replaceAll(/<br\s*\/?>/gi,"").replaceAll(/<p\s[^>]*>/gi,"<p>"));return e==="<p></p>"||e===""||e==="<p> </p>"}function Xn(t={}){let{value:e,defaultValue:n,doc:o,defaultDoc:r,onChange:i,onDocChange:s,isDisabled:l,keyboardShortcuts:a,onSelectionChange:c,onMentionTrigger:d,onMentionInputRemoved:u,canStartMention:f,resolveMention:p,onPaste:h,onCopy:m,maxLength:k,htmlStyles:I,isReadOnly:$,autoLink:w,enterInsertsParagraph:j}=t;if(e!==void 0&&i===void 0&&a$d("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`."),(e!==void 0||n!==void 0)&&(o!==void 0||r!==void 0)||o!==void 0&&r!==void 0)throw new Error("useEditor: pass at most one of `doc` and `defaultDoc`, and not together with `value` or `defaultValue`.");o!==void 0&&s===void 0&&a$d("use-editor-doc-without-ondocchange","useEditor: `doc` without `onDocChange` is controlled but cannot reflect edits \u2014 they are discarded on the next render. Use `defaultDoc` for initial content, or add `onDocChange`."),Yn(k);let[D,Q]=useState(fn),U=o??r,[pe,x]=useState(()=>U?ie(L(U)):e??n??""),M=useMemo(()=>o===void 0?void 0:ie(L(o)),[o]),G=useRef(i);G.current=i;let E=useRef(s);E.current=s;let Ee=useRef(c);Ee.current=c;let he=useRef(d);he.current=d;let Te=useRef(u);Te.current=u;let ve=useRef(f);ve.current=f;let ee=useRef(p);ee.current=p;let V=useRef(h);V.current=h;let Se=useRef(m);Se.current=m;let Le=useRef(k);Le.current=k;let Ne=useRef(I);Ne.current=I;let Qe=useRef($);Qe.current=$;let Oe=useRef(l);Oe.current=l;let Be=useRef(a);Be.current=a;let le=useRef(w);le.current=w;let De=useRef(j);De.current=j;let y=useRef(null);if(y.current===null){y.current=new Lt({onChange:v=>{x(v),G.current?.(v);},onDocChange:v=>{E.current?.(v);},onSelectionChange:v=>{Q(v),Ee.current?.(v);},onMentionTrigger:()=>{he.current?.();},onMentionInputRemoved:()=>{Te.current?.();},canStartMention:()=>ve.current?.()??false,get resolveMention(){return ee.current},get onPaste(){return V.current},get onCopy(){return Se.current},maxLength:()=>Le.current,htmlStyles:()=>Ne.current,autoLink:()=>le.current!==false,isReadOnly:()=>Qe.current?.()??!!Oe.current,areKeyboardShortcutsEnabled:()=>Be.current!==false,enterInsertsParagraph:()=>!!De.current});let b=e??n;U?y.current.setDoc(U):b&&typeof DOMParser<"u"&&y.current.setValue(b);}let S=y.current;a$h(()=>{o!==void 0?S.setDoc(o):e!==void 0&&S.setValue(e);}),useEffect(()=>{l&&Q(fn);},[l]);let Re=M??e??pe,ze=ps(Re),Pe=S.canUndo(),T=S.canRedo();return useMemo(()=>({core:S,selectionState:D,value:Re,isEmpty:ze,isDisabled:!!l,keyboardShortcuts:a!==false,canUndo:Pe,canRedo:T,focus:()=>{S.focus();},selectStart:()=>{S.selectStart();},selectEnd:()=>{S.selectEnd();},setCaretPosition:b=>{S.setCaretPosition(b);},undo:()=>{S.undo();},redo:()=>{S.redo();},getValue:()=>S.getValue(),setValue:(b,v)=>{S.setValue(b,v);},getDoc:b=>S.getDoc(b),setDoc:(b,v)=>{S.setDoc(b,v);},selectAll:b=>{S.selectAll(b);},select:(b,v)=>{S.select(b,v);},getSelectionState:()=>S.getSelectionState(),exec:(b,...v)=>{S.exec(b,...v);},isMarkActive:b=>!!D.marks[b],toggleMark:b=>{S.exec("toggleMark",b);},setMark:(b,v)=>{S.exec("setMarkValue",b,v);}}),[S,D,Re,ze,l,a,Pe,T])}function oi(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 Jn(t,e={}){let n=ys(t),{ref:o,autoFocus:r,onKeyDown:i,keyboardShortcuts:s}=e,l=s??n.keyboardShortcuts,a=useId(),c=useRef(null),d=useRef(null),u=useCallback(m=>{d.current&&(d.current(),d.current=null),m&&(d.current=n.core.attach(m));},[n.core]),f=useMemo(()=>b(c,u,o??null),[u,o]);useEffect(()=>(n.core.setKeyboardShortcutsEnabled(s),()=>{n.core.setKeyboardShortcutsEnabled(void 0);}),[n.core,s]);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:h}=j({onKeyDown:m=>{i?.(m)||l&&oi(m,n)||m.continuePropagation();}});return {editableProps:{...h,id:a,ref:f,contentEditable:!n.isDisabled,suppressContentEditableWarning:true,role:"textbox","aria-multiline":true,"data-editor-root":"true"}}}function ys(t){let e=useContext(Dt);if(t)return t;if(!e)throw new Error("useEditable must be passed an editor or used within an EditorProvider");return e}var Qn=({editor:t,children:e})=>jsx(Dt.Provider,{value:t,children:e});var pn=({markName:t,icon:e,ariaLabel:n,isDisabled:o})=>{let{core:r,selectionState:i}=Ce(),s=!!i.marks[t];return jsx(a$g,{variant:"tertiary",isSelected:s,size:"sm",icon:e,"aria-label":n,"data-testid":`editor-${t}-button`,isDisabled:o,onPress:()=>{r.exec("toggleMark",t),r.focus();},preventFocusOnPress:true})},to=({colorKey:t,"aria-label":e,isDisabled:n})=>{let{core:o,selectionState:r}=Ce(),i=t==="color"?r.marks.color:r.marks.backgroundColor,s=wt.useRef(null),l=useCallback(()=>{s.current=r.range;},[r.range]),a=useCallback(p=>{setTimeout(()=>{let h=o.getSelectionState().range??s.current;h&&o.select(h),o.exec("setMarkValue",t,p);},0);},[o,t]),c=useCallback(p=>{a(p);},[a]),d=useCallback(()=>{a();},[a]),u=useCallback(({ref:p,triggerProps:h})=>jsx(a$c,{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:it,preventFocusOnPress:true,...h,ref:p}),[t,e,n]),f=useCallback(p=>{p?c(p.toString("rgba")):d();},[d,c]);return jsx(b$4,{presets:Mn,allowRemoval:true,pickerMode:"lazy",placement:"top end",colorLabel:false,renderTriggerButton:u,onTriggerPress:l,value:i||"#000000",onChange:f,isDisabled:n})};var Xe={Add:"add",Edit:"edit",Show:"show"},ii=({isDisabled:t,addLinkLabel:e,editLinkLabel:n,removeLinkLabel:o,linkAnnotationLabel:r,linkCancelLabel:i,linkSaveLabel:s})=>{let{formatMessage:l}=b$1(),{core:a}=Ce();return jsxs(b$5,{type:"dialog",children:[jsx(j$1,{children:jsx(a$c,{icon:LinkIcon,size:"sm",isDisabled:t,"aria-label":e??l(Ze.addLink),"data-testid":"editor-add-link-button",className:it,preventFocusOnPress:true})}),jsx(a$i,{className:sprinkles({boxShadow:"medium"}),placement:"top end",children:({close:c})=>jsx(a$j,{size:"content",style:{minWidth:240},children:jsx(Ms,{addLinkLabel:e,editLinkLabel:n,removeLinkLabel:o,linkAnnotationLabel:r,linkCancelLabel:i,linkSaveLabel:s,close:()=>{c(),setTimeout(()=>{a.focus();},0);}})})})]})},Ms=({close:t,addLinkLabel:e,editLinkLabel:n,removeLinkLabel:o,linkAnnotationLabel:r,linkCancelLabel:i,linkSaveLabel:s})=>{let{core:l,selectionState:a}=Ce(),{formatMessage:c}=b$1(),d=a.link?.url,[u,f]=wt.useState(d?Xe.Show:Xe.Add),[p,h]=wt.useState(d||""),m=jsx(a$a,{padding:"lg",children:jsx(a$r,{label:r??c(Ze.link),value:p,autoFocus:true,onChange:h,placeholder:"https://yourdomain.com","data-testid":"editor-link-input"})});return jsxs(Fragment,{children:[u===Xe.Add&&jsxs(Fragment,{children:[m,jsx(a$a,{display:"flex",justifyContent:"flex-end",padding:"lg",className:Vo,children:jsx(b$a,{isDisabled:!a$s(p,true)||xe(p)==="",label:e??c(Ze.addLink),"data-testid":"editor-link-add-button",size:"sm",onPress:()=>{l.exec("wrapLink",_n(p)),t?.();},preventFocusOnPress:true})})]}),u===Xe.Show&&jsxs(Fragment,{children:[jsx(a$a,{padding:"lg",children:jsx(a$o,{type:"subtitle",size:"sm",children:d})}),jsxs(a$a,{display:"flex",justifyContent:"flex-end",padding:"lg",gap:"lg",borderColor:"border.subtle",borderWidth:1,borderStyle:"solid",children:[jsx(b$a,{label:n??c(Ze.editLink),"data-testid":"editor-link-edit-button",size:"sm",variant:"secondary",onPress:()=>{f(Xe.Edit);},style:{flex:1,justifyContent:"center"}}),jsx(b$a,{label:o??c(Ze.removeLink),"data-testid":"editor-link-remove-button",size:"sm",onPress:()=>{l.exec("unwrapLink"),t?.();},preventFocusOnPress:true,style:{flex:1,justifyContent:"center"}})]})]}),u===Xe.Edit&&jsxs(Fragment,{children:[m,jsxs(a$a,{display:"flex",justifyContent:"flex-end",padding:"lg",gap:"lg",borderColor:"border.subtle",borderWidth:1,borderStyle:"solid",children:[jsx(b$a,{label:i??c(Ze.cancel),"data-testid":"editor-link-cancel-button",size:"sm",variant:"secondary",onPress:()=>{f(Xe.Show),t?.();}}),jsx(b$a,{label:s??c(Ze.save),"data-testid":"editor-link-save-button",size:"sm",isDisabled:!a$s(p,true)||xe(p)==="",onPress:()=>{l.exec("updateLinkUrl",_n(p)),t?.();}})]})]})]})},Ze=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 oo=wt.createContext({items:[],containerRef:{current:null},maxMentionableUsersSuggestions:10}),ws=({key:t,value:e},{isDisabled:n,optionProps:o,isFocused:r,_state:i},s)=>{let{hoverProps:l}=a$4({isDisabled:n}),{label:a,data:c$1}=e;return jsxs(Fragment,{children:[jsxs("li",{...c(o,l),className:Zo({isDisabled:n,isHovered:r}),"data-active":r||void 0,ref:s,children:[jsx(a$a,{elementType:"span",display:"flex","aria-hidden":true,children:jsx(a$f,{name:a,...c$1?.avatar})}),jsxs(a$a,{display:"flex",flexDirection:"column",children:[jsx(a$o,{type:"subtitle",size:"sm",children:a}),jsx(a$o,{type:"helper",size:"sm",children:c$1?.description})]})]}),t===i.collection.getLastKey()?null:jsx(a$b,{})]})};function no(t){return t.displayName?.trim()||t.name?.trim()||t.id}function ro(t){return t.displayName??no(t)}function io({anchor:t,onClose:e,mentionLabel:n}){let{core:o}=Ce(),{containerRef:r,items:i,maxMentionableUsersSuggestions:s}=useContext(oo),[l,a]=useState(""),{contains:c$1}=a$k({sensitivity:"base"}),{formatMessage:d}=b$1(),u=useRef(false),f$1=useCallback(()=>{u.current=true,e();},[e]),p=useMemo(()=>{let x=i.filter(M=>l===""||c$1(no(M),l)).map(M=>({id:M.id,label:no(M),data:M}));return s?x.slice(0,s):x},[i,s,l,c$1]),h=useCallback(x=>jsx(a$l,{textValue:x.label,children:x.label},x.id),[]),m=useCallback(x=>{if(u.current||x==null)return;let M=i.find(G=>G.id===x);M&&(f$1(),o.exec("confirmMention",{id:M.id,displayName:ro(M)}),o.exec("insertText"," "),o.focus());},[f$1,o,i]),k=b$6({items:p,children:h,menuTrigger:"focus",onSelectionChange:m}),I=useCallback(x=>{if(u.current)return;f$1();let M=x==="backspace"?"":`@${k.inputValue}`;o.exec("removeMentionInput",M,x==="arrowStart"?"start":"end"),o.focus();},[f$1,o,k.inputValue]),$=useRef(null),w=useRef(null),j=useRef(null),N=useRef(null);a$m({ref:N,onInteractOutside:()=>{k.close();}});let{inputProps:D,listBoxProps:Q}=a$n({defaultItems:p,inputRef:w,buttonRef:$,listBoxRef:j,popoverRef:N,menuTrigger:"focus","aria-label":n??d(As.mention)},k);useLayoutEffect(()=>{w.current?.focus(),setTimeout(()=>{w.current?.focus();});},[]);let U=useCallback(x=>{let M=x.currentTarget,G=M.selectionStart===0&&M.selectionEnd===0,E=M.selectionStart===M.value.length&&M.selectionEnd===M.value.length;if(x.key==="Backspace"&&G)x.preventDefault(),I("backspace");else if(x.key==="Escape")I("escape");else if(x.key==="ArrowLeft"||x.key==="ArrowRight"){let ee=V=>x.key==="ArrowLeft"!=(b$2(V).getComputedStyle(V).direction==="rtl");(ee(M)?G:E)&&(x.preventDefault(),I(ee(t)?"arrowStart":"arrowEnd"));}let Ee=x.metaKey||x.ctrlKey,he=x.key.toLowerCase(),Te=Ee&&!x.shiftKey&&he==="z"&&o.canUndo(),ve=(Ee&&x.shiftKey&&he==="z"||x.ctrlKey&&he==="y")&&o.canRedo();(Te||ve)&&(x.preventDefault(),Te?o.undo():o.redo(),f$1(),o.focus());},[t,I,f$1,o]),pe=useMemo(()=>{if(!CSS.supports("field-sizing","content")){let x=b$2(w.current),M=w.current?x?.getComputedStyle(w.current).font:void 0;return {width:M?b$7({text:k.inputValue,font:M,element:w.current}).width+10:"4ch"}}},[k.inputValue]);return jsxs(Fragment,{children:[createPortal(jsx("input",{...c(D,{onKeyDown:U,onBlur:()=>{I("blur");},onChange:x=>{a(x.target.value);}}),style:pe,dir:/\p{L}/u.test(k.inputValue)?"auto":void 0,className:Xo,ref:w}),t),jsx(b$8.Provider,{value:k,children:jsx(a$i,{triggerRef:r,isNonModal:true,ref:N,state:k,crossOffset:-2,children:jsx(c$2,{...Q,items:void 0,ref:j,"data-testid":"editor-mention-listbox",className:a$6(f,sprinkles({width:"full"})),renderOption:ws})})})]})}io.displayName="MentionInputOverlay";var As=c$1({mention:{defaultMessage:"Mention",id:"bui.editor.mention"}});var ao=wt.forwardRef(({value:t,defaultValue:e$1,onChange:n,style:o,spellCheck:r,placeholder:i,isInline:s,isDisabled:l,editableContentAriaLabel:a,containerRef:c,onHelpDialogOpenRequest:d,mentionableUsers:u,editorHandle:f,maxMentionableUsersSuggestions:p,autoFocus:h,editorRef:m,saveOnEnter:k,onSave:I,autoLink:$,mentionLabel:w,boldLabel:j,italicLabel:N,underlineLabel:D,fontColorLabel:Q,backgroundColorLabel:U,helpLabel:pe,addLinkLabel:x,editLinkLabel:M,removeLinkLabel:G,linkAnnotationLabel:E,linkCancelLabel:Ee,linkSaveLabel:he},Te)=>{let ve=useRef(null),ee=useRef(null),{formatMessage:V}=b$1(),[Se,Le]=useState(null),Ne=useRef(0),[Qe,Oe]=useState(false),Be=()=>{let T=ee.current?.querySelector("[data-mention-anchor]");T&&(Ne.current+=1,Le({anchor:T,id:Ne.current}));},le=Xn({value:t,defaultValue:e$1,onChange:n,isDisabled:l,onMentionTrigger:Be,onMentionInputRemoved:()=>{Le(null);},canStartMention:()=>(u?.length??0)>0,resolveMention:T=>{let b=u?.find(v=>v.id===T);return b&&ro(b)},autoLink:$}),De=le.core;wt.useEffect(()=>{m&&(m.current=De);},[De,m]);let y=T=>a$2(T)?false:k&&T.key==="Enter"&&!T.shiftKey||(T.ctrlKey||T.metaKey)&&T.key==="Enter"?(T.preventDefault(),I(),true):T.altKey&&T.key==="F10"?(T.preventDefault(),ve.current?.querySelector("button")?.focus(),true):false,{editableProps:S}=Jn(le,{ref:ee,autoFocus:h,onKeyDown:y}),Re=T=>{if(l)return;let{isLinkClick:b,url:v}=br(T.target,{metaKey:T.metaKey,ctrlKey:T.ctrlKey,mac:e()});b&&(T.preventDefault(),v&&b$2(T.currentTarget).open(v,"_blank","noopener,noreferrer"));};wt.useEffect(()=>{let T=ee.current;if(!T||l)return;let b=a$8(T),v=b$2(T),Fe=Ke=>{Oe(e()?Ke.metaKey:Ke.ctrlKey);},mt=()=>{Oe(false);};return b.addEventListener("keydown",Fe),b.addEventListener("keyup",Fe),v.addEventListener("blur",mt),()=>{b.removeEventListener("keydown",Fe),b.removeEventListener("keyup",Fe),v.removeEventListener("blur",mt),mt();}},[l]),useImperativeHandle(Te,()=>({startMention:()=>{u?.length&&(ee.current?.querySelector("input[role='combobox']")||(De.exec("insertMentionInput"),Be()));}})),useImperativeHandle(f,()=>({setCaretPosition:T=>{le.setCaretPosition(T);},focus:()=>{le.focus();}}));let ze=useMemo(()=>({items:u||[],containerRef:c,maxMentionableUsersSuggestions:p}),[u,c,p]),Pe=le.isEmpty;return jsx(oo.Provider,{value:ze,children:jsxs(Qn,{editor:le,children:[jsxs(a$9,{className:a$6(qt,"BaselineUI-Editor-RichEditorToolbar"),"aria-controls":S.id,ref:ve,children:[jsxs(a$a,{display:"flex",flexDirection:"row",role:"group",gap:"xs",paddingX:"sm",children:[jsx(pn,{markName:"bold",icon:BoldIcon,ariaLabel:j??V(ht.bold),isDisabled:l}),jsx(pn,{markName:"italic",icon:ItalicIcon,ariaLabel:N??V(ht.italic),isDisabled:l}),jsx(pn,{markName:"underline",icon:UnderlineIcon,ariaLabel:D??V(ht.underline),isDisabled:l})]}),jsx(a$b,{orientation:"vertical",className:yt}),jsx(to,{colorKey:"color","aria-label":Q??V(ht.fontColor),isDisabled:l}),jsx(a$b,{orientation:"vertical",className:yt}),jsx(to,{colorKey:"backgroundColor","aria-label":U??V(ht.backgroundColor),isDisabled:l}),jsx(a$b,{orientation:"vertical",className:yt}),jsx(ii,{isDisabled:l,addLinkLabel:x,editLinkLabel:M,removeLinkLabel:G,linkAnnotationLabel:E,linkCancelLabel:Ee,linkSaveLabel:he}),jsx(a$b,{orientation:"vertical",className:yt}),jsx(a$c,{className:it,icon:QuestionmarkCircleIcon,size:"sm","aria-label":pe??V(ht.help),"data-testid":"editor-help-button",onPress:d})]}),jsx(a$b,{variant:"secondary"}),jsxs("div",{style:{position:"relative"},children:[!!(i&&Pe)&&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$6(xt({isDisabled:l}),$o,"BaselineUI-Editor-RichEditorPlaceholder"),children:i}),jsx("div",{...S,onClick:Re,"data-mod-held":Qe?"":void 0,"aria-label":a,"aria-placeholder":i,spellCheck:r,style:o,className:a$6(xt({isDisabled:l}),Wt({isInline:s}),"BaselineUI-Editor-RichEditorEditingArea")})]}),Se!==null&&jsx(io,{anchor:Se.anchor,mentionLabel:w,onClose:()=>{Le(null);}},Se.id)]})})});ao.displayName="RichEditor";var ht=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 di=wt.memo(wt.forwardRef(({className:t,style:e,"data-block-id":n,"data-block-class":o,enableRichText:r=false,onCancel:i,onSave:s,isInline:l=true,submitButtonIcon:a=ArrowUpCircleFilledIcon,submitButtonAriaLabel:c$1,cancelButtonAriaLabel:d,"aria-label":u,"aria-describedby":f,"aria-labelledby":p,"aria-details":h,editableContentAriaLabel:m="Editing Area",footerButtons:k,clearOnCancel:I,clearOnSave:$,mentionLabel:w,boldLabel:j$1,italicLabel:N,underlineLabel:D,fontColorLabel:Q,backgroundColorLabel:U,helpLabel:pe,closeLabel:x,actionLabel:M,shortcutLabel:G,toolbarFocusLabel:E,selectAllLabel:Ee,cutLabel:he,copyLabel:Te,pasteLabel:ve,undoLabel:ee,redoLabel:V,openHelpDialogLabel:Se,submitLabel:Le,addLinkLabel:Ne,editLinkLabel:Qe,removeLinkLabel:Oe,linkAnnotationLabel:Be,linkCancelLabel:le,linkSaveLabel:De,...y},S)=>{let Re=useRef(null),{formatMessage:ze}=b$1(),Pe=useRef(null),T=useRef(null),b$2=useRef(null),v=!r&&y.variant==="minimal",Fe=useRef(null),[mt,Ke]=wt.useState(y.value||y.defaultValue),xn=y.value!==void 0&&y.onChange!==void 0;r&&y.value!==void 0&&!y.onChange&&a$d("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 po=y.value!==void 0&&(!r||xn),yn=y.value;wt.useEffect(()=>{po&&yn!==void 0&&Ke(yn);},[po,yn]);let bn=y.isDisabled||y.isSaveDisabled||!b$3(mt||""),{fieldProps:ui}=a$e({"aria-label":u,"aria-labelledby":p,"aria-describedby":f,"aria-details":h,labelElementType:"div"});v&&!y.avatarName&&console.warn("Editor: When using the minimal `variant` and `enableRichText` is `false`, you should provide an `avatarName`.");let En=useCallback(()=>{Ke(""),r?Re.current?.setValue("<p></p>",{emit:true}):T.current?.clear();},[r]),It=useCallback(()=>{bn||(s?.(r?Re.current?.getValue()??"":Pe.current.value),$&&En());},[En,$,r,s,bn]),ho=jsx(a$c,{variant:"ghost","aria-label":c$1||ze(uo.save),icon:a,isDisabled:bn,"data-testid":"editor-save-button",size:"md",excludeFromTabOrder:v,className:a$6({[Jo]:v},"BaselineUI-Editor-Save"),onPress:It,preventFocusOnPress:true}),[fi,Tn]=wt.useState(false),{keyboardProps:pi}=j({onKeyDown:W=>{(W.metaKey||W.ctrlKey)&&W.shiftKey&&W.key.toLowerCase()==="h"?(W.preventDefault(),Tn(true)):W.continuePropagation();}}),mo=useCallback(W=>{Ke(W),y.onChange?.(W);},[y]);return jsxs("div",{...c(ui,r?pi:{}),role:"application",ref:b(b$2,S),style:e,"data-block-id":n,"data-block-class":o,className:a$6(qo({isInline:l,isMinimal:v}),"BaselineUI-Editor",t),"aria-disabled":y.isDisabled,children:[v?jsxs(Fragment,{children:[l?jsx(a$f,{className:Wo,name:y.avatarName||""}):null,jsxs("div",{className:er({isInline:l}),children:[jsx($t,{isMinimal:v,textBoxRef:Pe,ref:T,isInline:l,editableContentAriaLabel:m,...y,onChange:mo,onSave:It}),ho]})]}):jsxs(Fragment,{children:[r?jsx(ao,{containerRef:b$2,ref:Fe,editorRef:Re,isInline:l,editableContentAriaLabel:m,onHelpDialogOpenRequest:()=>{Tn(true);},mentionLabel:w,boldLabel:j$1,italicLabel:N,underlineLabel:D,fontColorLabel:Q,backgroundColorLabel:U,helpLabel:pe,addLinkLabel:Ne,editLinkLabel:Qe,removeLinkLabel:Oe,linkAnnotationLabel:Be,linkCancelLabel:le,linkSaveLabel:De,...y,value:xn?y.value:void 0,defaultValue:y.defaultValue??(xn?void 0:y.value),onChange:mo,onSave:It}):jsxs(Fragment,{children:[!l&&jsx(a$b,{variant:"secondary"}),jsx($t,{onCancel:i,textBoxRef:Pe,ref:T,isInline:l,editableContentAriaLabel:m,...y,onChange:W=>{Ke(W),y.onChange?.(W);},onSave:It})]}),jsx(a$b,{variant:"secondary"}),jsxs("div",{className:a$6(qt,sprinkles({justifyContent:"space-between"}),"BaselineUI-Editor-Footer"),children:[jsxs(a$a,{paddingX:"sm",gap:"sm",display:"flex",children:[r&&y.mentionableUsers?jsx(a$c,{icon:AtIcon,size:"sm","aria-label":w??ze(uo.mention),"data-testid":"editor-mention-button",onPress:()=>Fe.current?.startMention(),preventFocusOnPress:true,className:"BaselineUI-Editor-Mention"}):null,k?.map(({type:W,props:_t},go)=>W==="action"?jsx(a$c,{..._t,size:"sm",isDisabled:y.isDisabled||_t.isDisabled},go):jsx(a$g,{..._t,size:"sm",variant:"tertiary",isDisabled:y.isDisabled||_t.isDisabled},go))]}),jsxs(a$a,{children:[!!i&&jsx(a$c,{variant:"secondary",icon:XCircleFilledIcon,isDisabled:y.isDisabled,"data-testid":"editor-cancel-button",size:"md",onPress:()=>{i(),I&&En();},"aria-label":d||ze(uo.cancel),className:"BaselineUI-Editor-Cancel"}),ho]})]})]}),jsx(lr,{isOpen:fi,onClose:()=>{Tn(false);},toolbarFocusLabel:E,helpLabel:pe,closeLabel:x,actionLabel:M,shortcutLabel:G,boldLabel:j$1,italicLabel:N,underlineLabel:D,selectAllLabel:Ee,cutLabel:he,copyLabel:Te,pasteLabel:ve,undoLabel:ee,redoLabel:V,openHelpDialogLabel:Se,submitLabel:Le})]})}));di.displayName="Editor";var uo=c$1({cancel:{defaultMessage:"Cancel",id:"bui.editor.cancel"},save:{defaultMessage:"Save",id:"bui.editor.save"},mention:{defaultMessage:"Mention",id:"bui.editor.mention"}});
|
|
30
|
+
export{zn as a,J as b,we as c,Ae as d,Lt as e,Ce as f,fn as g,Xn as h,oi as i,Jn as j,Qn as k,di as l};
|
|
@@ -0,0 +1,10 @@
|
|
|
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-6GV3YWV7.mjs';import {a}from'./chunk-R6TFTLMV.mjs';import {b,c as c$3}from'./chunk-IDIZSV2Y.mjs';import {b as b$2}from'./chunk-INFMXVHD.mjs';import {a as a$6}from'./chunk-OPIPJTLG.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 {a as a$2}from'./chunk-B3EZOXNU.mjs';import {j}from'./chunk-KUDCYGII.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 {useGranularEffect}from'granular-hooks';import {getStroke}from'perfect-freehand';import h,{useState,useCallback,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/g),d;for(let a=0;a<i;a++)if(!(!(a===i-1)&&!!r.current[a])){let C=t.slice(a*g-(a>0?1:0),a*g+g);d=a$a(getStroke(C.map(([k,v,l])=>({x:k,y:v,pressure:l})),o)),C.length>=(a>0?g+1:g)&&(r.current[a]=d);}return d},[t,o]);return [...r.current,m]}var g=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},pe=h.forwardRef(({className:t,style:o,canvasClassName:r,canvasStyle:m,isBound:i=true,strokeWidth:d$1=2,strokeColor:a$a="#3A87FD",onChange:P,defaultValue:H,onChangeEnd:C,enableHistory:k=false,isInline:v=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]),[p,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:G,canUndo:K,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?G&&x():K&&I());}}),[Ne,_]=useState(false),Te=useCallback(e=>{let c=e.currentTarget.getBoundingClientRect();z(c),e.target.setPointerCapture(e.pointerId);let y=[e.clientX-c.x,e.clientY-c.y,e.pressure];S(s=>[...s,[y]]),_(true);},[]),Ue=useCallback(e=>{if(e.buttons!==1||!p)return;let y=ue(e.nativeEvent).map(s=>[i?a$4(s.clientX-p.left,0,p.width):s.clientX-p.left,i?a$4(s.clientY-p.top,0,p.height):s.clientY-p.top,s.pressure]);S(s=>{let M=[...s];return M[s.length-1]=[...M[s.length-1],...y],M});},[p,i]),ze=()=>{p&&(C?.(u),W(u),_(false),z(void 0));};useGranularEffect(()=>{P?.(u);},[u],[P]);let A=()=>{S([]),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:v}),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:!K||l,icon:UndoIcon,onPress:I,"aria-label":he||T.formatMessage(me.undo)}),jsx(a$6,{variant:"secondary",size:"sm",isDisabled:!G||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:v,isHovered:Oe}),a$9({isFocusVisible:Me,isInline:v,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,c,y)=>c<y.length-1||!Ne?jsx(ce,{line:e,options:U,strokeColor:a$a,strokeWidth:d$1},c):jsx(fe,{line:e,options:U,strokeColor:a$a,strokeWidth:d$1},c))})]}),E||R?jsx("div",{style:Ce,className:a$7(c$2({isInline:v,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]})});pe.displayName="FreehandCanvas";var ce=h.memo(({line:t,options:o,strokeColor:r,strokeWidth:m})=>{let i=useMemo(()=>a$a(getStroke(t.map(([d,a,P])=>({x:d,y:a,pressure:P})),o)),[t,o]);return jsx("path",{d:i,stroke:r,strokeWidth:m})});ce.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{pe as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {a as a$3}from'./chunk-KVIV5RTE.mjs';import {q}from'./chunk-
|
|
1
|
+
import {a as a$3}from'./chunk-KVIV5RTE.mjs';import {q}from'./chunk-3IPRT57V.mjs';import {b as b$2}from'./chunk-4Y4WKIL5.mjs';import {c,b}from'./chunk-IDIZSV2Y.mjs';import {a as a$2}from'./chunk-DIL5HL6K.mjs';import {a as a$4}from'./chunk-OPIPJTLG.mjs';import {b as b$1}from'./chunk-K5RYVERS.mjs';import {j}from'./chunk-SD43KVTU.mjs';import {a}from'./chunk-JQQGRJ5J.mjs';import {a as a$1}from'./chunk-4QEH5CGK.mjs';import {MinusIcon}from'@baseline-ui/icons/12';import {AttachmentsIcon,ErrorCircleFilledIcon}from'@baseline-ui/icons/16';import {sprinkles}from'@baseline-ui/tokens';import d from'react';import {jsx,jsxs}from'react/jsx-runtime';/**
|
|
2
2
|
* Copyright (c) 2023-2024 PSPDFKit GmbH. All rights reserved.
|
|
3
3
|
*
|
|
4
4
|
* THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {a}from'./chunk-4QEH5CGK.mjs';import {sprinkles}from'@baseline-ui/tokens';import
|
|
1
|
+
import {a}from'./chunk-4QEH5CGK.mjs';import {sprinkles}from'@baseline-ui/tokens';import k,{useMemo}from'react';import {jsx}from'react/jsx-runtime';/**
|
|
2
2
|
* Copyright (c) 2023-2024 PSPDFKit GmbH. All rights reserved.
|
|
3
3
|
*
|
|
4
4
|
* THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
|
|
@@ -7,4 +7,4 @@ import {a}from'./chunk-4QEH5CGK.mjs';import {sprinkles}from'@baseline-ui/tokens'
|
|
|
7
7
|
* This notice may not be removed from this file.
|
|
8
8
|
*
|
|
9
9
|
*/
|
|
10
|
-
function
|
|
10
|
+
function y(s){return sprinkles.properties.has(s)}var P=k.forwardRef(({elementType:s="div",children:m,...e},l)=>{let a$1=s,{sprinkleProps:f,domProps:r}=useMemo(()=>{let p={},n={};for(let o in e)y(o)?p[o]=e[o]:n[o]=e[o];return {sprinkleProps:p,domProps:n}},[e]);return jsx(a$1,{...r,className:a(sprinkles(f),"BaselineUI-Box",r.className),ref:l,children:m})});P.displayName="Box";export{P as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {c as c$1}from'./chunk-RO5ZRU3Y.mjs';import {a as a$6}from'./chunk-
|
|
1
|
+
import {c as c$1}from'./chunk-RO5ZRU3Y.mjs';import {a as a$6}from'./chunk-OPIPJTLG.mjs';import {a as a$3}from'./chunk-66CUIXA6.mjs';import {a as a$4}from'./chunk-RSKKEGJZ.mjs';import {a as a$1}from'./chunk-STMDFIUL.mjs';import {a as a$2}from'./chunk-B3EZOXNU.mjs';import {d}from'./chunk-F7WPMQ3P.mjs';import {c}from'./chunk-3WKDIXCM.mjs';import {a as a$5}from'./chunk-ETM4MNG4.mjs';import {a}from'./chunk-JQQGRJ5J.mjs';import {a as a$7}from'./chunk-4QEH5CGK.mjs';import {TrashIcon}from'@baseline-ui/icons/16';import*as V from'dompurify';import F from'react';import {jsxs,jsx}from'react/jsx-runtime';/**
|
|
2
2
|
* Copyright (c) 2023-2024 PSPDFKit GmbH. All rights reserved.
|
|
3
3
|
*
|
|
4
4
|
* THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-2MS356Q7.mjs';import {f,d,b,h,g as g$1}from'./chunk-PG3WDHSK.mjs';import {a as a$2}from'./chunk-
|
|
1
|
+
import {a as a$1}from'./chunk-2MS356Q7.mjs';import {f,d,b,h,g as g$1}from'./chunk-PG3WDHSK.mjs';import {a as a$2}from'./chunk-DIL5HL6K.mjs';import {c as c$1}from'./chunk-4EAXDHSV.mjs';import {a}from'./chunk-B3EZOXNU.mjs';import {c}from'./chunk-3WKDIXCM.mjs';import {a as a$3}from'./chunk-4QEH5CGK.mjs';import A from'react';import {jsxs,jsx}from'react/jsx-runtime';/**
|
|
2
2
|
* Copyright (c) 2023-2024 PSPDFKit GmbH. All rights reserved.
|
|
3
3
|
*
|
|
4
4
|
* THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {a as a$2}from'./chunk-4SW77SGW.mjs';import {a as a$7}from'./chunk-
|
|
1
|
+
import {a as a$2}from'./chunk-4SW77SGW.mjs';import {a as a$7}from'./chunk-LDWNE2JT.mjs';import {a as a$3}from'./chunk-NT2MFIKD.mjs';import {a as a$1}from'./chunk-6GV3YWV7.mjs';import {a as a$8}from'./chunk-JZXLV6JU.mjs';import {b,c as c$1}from'./chunk-IDIZSV2Y.mjs';import {b as b$1}from'./chunk-INFMXVHD.mjs';import {a as a$4}from'./chunk-DIL5HL6K.mjs';import {a as a$5}from'./chunk-OPIPJTLG.mjs';import {c}from'./chunk-ETM4MNG4.mjs';import {a}from'./chunk-JQQGRJ5J.mjs';import {a as a$6}from'./chunk-4QEH5CGK.mjs';import {XIcon}from'@baseline-ui/icons/20';import Y from'react';import {jsx,jsxs,Fragment}from'react/jsx-runtime';/**
|
|
2
2
|
* Copyright (c) 2023-2024 PSPDFKit GmbH. All rights reserved.
|
|
3
3
|
*
|
|
4
4
|
* THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-
|
|
1
|
+
import {a as a$1}from'./chunk-DIL5HL6K.mjs';import {b}from'./chunk-SD43KVTU.mjs';import {a}from'./chunk-JQQGRJ5J.mjs';import z,{useLayoutEffect}from'react';import {jsxs,jsx}from'react/jsx-runtime';/**
|
|
2
2
|
* Copyright (c) 2023-2024 PSPDFKit GmbH. All rights reserved.
|
|
3
3
|
*
|
|
4
4
|
* THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import {b}from'./chunk-HZM2XZP4.mjs';import {c as c$1}from'./chunk-54ZKQAA3.mjs';import {I as I$1}from'./chunk-LY2ZVEGJ.mjs';import {a as a$1}from'./chunk-6GV3YWV7.mjs';import {a}from'./chunk-DIL5HL6K.mjs';import {a as a$5}from'./chunk-5W6G3ZUT.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 J,{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 B="ujkypy0 _1yep5z66 _1yep5z67 _1yep5z68 _1yep5z62i _1yep5z62j _1yep5z62k _1yep5z63o _1yep5z63p _1yep5z63q _1yep5z61c _1yep5z61d _1yep5z61e",I="_1yep5z61sj _1yep5z61sk _1yep5z61sl _1yep5z61ih _1yep5z61ii _1yep5z61ij";var D=J.forwardRef(({className:n,style:s,items:t,optionsContainerClassName:c$2,label:o,icon:i,value:a$4,defaultValue:l,onChange:d,isDisabled:C,optionClassName:E,optionStyle:F,labelPosition:P="top","data-block-id":M,"data-block-class":v,shouldFocusWrap:K,tooltip:q=true,"aria-label":m,"aria-labelledby":y,"aria-describedby":H,"aria-details":L,...U},W)=>{let b$1=useMemo(()=>t.map(e=>({id:e.color,label:e.label})),[t]),z=e=>(t.find(f=>f.color===e)??t.find(f=>b(f.color,e)))?.color??e,k=c(),[h,A]=useState(!!a$4);return a$4&&!h&&A(true),useEffect(()=>{!o&&!m&&!y&&console.warn("ColorSwatchPicker: Please provide a label or aria-label for accessibility.");},[o,m,y]),jsxs(a,{...a$3(U),className:a$2("BaselineUI-ColorSwatchPicker",n),"data-block-id":M,"data-block-class":v,display:"flex",flexDirection:P==="top"?"column":"row",alignItems:P==="top"?"flex-start":"center",justifyContent:"space-between",gap:"md",style:s,ref:W,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:k,type:"label",size:"sm",children:o}):null]}):null,jsx(c$1,{className:a$2(I,c$2),selectionMode:"single",items:b$1,orientation:"horizontal",defaultSelectedKeys:l?[z(l)]:void 0,disabledKeys:C?b$1.map(e=>e.id):void 0,isDisabled:C,selectedKeys:a$4?[z(a$4)]:h?[]:void 0,onSelectionChange:e=>{d?.([...e][0]);},optionClassName:E,optionStyle:F,renderOption:(...e)=>Z(...e,q),shouldFocusWrap:K,"aria-label":m,"aria-describedby":H,"aria-details":L,"aria-labelledby":o?k:y})]})});D.displayName="ColorSwatchPicker";var Z=({key:n,textValue:s},{isSelected:t,isFocusVisible:c,isDisabled:o,optionProps:i},a,l)=>{let{tooltipProps:d$1}=a$4({label:s,tooltip:l});return jsx(a$5,{...d$1,children:jsx(d,{children:jsx("li",{...i,"data-disabled":o||void 0,className:a$2(B,i.className),ref:a,children:jsx(I$1,{isFocusVisible:c,color:n,isSelected:t,"aria-label":s,isInteractive:true,isDisabled:o,tooltip:false})})})})};export{D as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {a as a$8}from'./chunk-G77E7EDE.mjs';import {c as c$1,d}from'./chunk-QMV2O57M.mjs';import {a as a$7}from'./chunk-NGZRN4SF.mjs';import {a as a$2}from'./chunk-
|
|
1
|
+
import {a as a$8}from'./chunk-G77E7EDE.mjs';import {c as c$1,d}from'./chunk-QMV2O57M.mjs';import {a as a$7}from'./chunk-NGZRN4SF.mjs';import {a as a$2}from'./chunk-OPIPJTLG.mjs';import {a as a$b}from'./chunk-D4NW56YQ.mjs';import {b}from'./chunk-N2XGJKZG.mjs';import {a as a$9}from'./chunk-Y2MIU76N.mjs';import {a as a$1}from'./chunk-66CUIXA6.mjs';import {a as a$6}from'./chunk-RSKKEGJZ.mjs';import {a as a$5}from'./chunk-STMDFIUL.mjs';import {c as c$3}from'./chunk-HH4VLTF3.mjs';import {a as a$4}from'./chunk-B3EZOXNU.mjs';import {j}from'./chunk-KUDCYGII.mjs';import {r}from'./chunk-PPHSLODC.mjs';import {c}from'./chunk-3WKDIXCM.mjs';import {a as a$a}from'./chunk-SVIYLH7R.mjs';import {c as c$2}from'./chunk-ETM4MNG4.mjs';import {a}from'./chunk-JQQGRJ5J.mjs';import {a as a$3}from'./chunk-4QEH5CGK.mjs';import R,{useMemo,useRef,useEffect}from'react';import {XIcon}from'@baseline-ui/icons/8';import {jsxs,jsx}from'react/jsx-runtime';/**
|
|
2
2
|
* Copyright (c) 2023-2024 PSPDFKit GmbH. All rights reserved.
|
|
3
3
|
*
|
|
4
4
|
* THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
|
|
@@ -7,4 +7,4 @@ import {a as a$8}from'./chunk-G77E7EDE.mjs';import {c as c$1,d}from'./chunk-QMV2
|
|
|
7
7
|
* This notice may not be removed from this file.
|
|
8
8
|
*
|
|
9
9
|
*/
|
|
10
|
-
var I=new WeakMap;function P(a,e,t){if(!a)return "";typeof e=="string"&&(e=e.replace(/\s+/g,""));let i=I.get(a);return process.env.NODE_ENV!=="production"&&!i&&console.error("There is no tab id, please check if you have rendered the tab panel before the tab list."),`${i}-${t}-${e}`}function C(a,e,t){let{key:i,isDisabled:
|
|
10
|
+
var I=new WeakMap;function P(a,e,t){if(!a)return "";typeof e=="string"&&(e=e.replace(/\s+/g,""));let i=I.get(a);return process.env.NODE_ENV!=="production"&&!i&&console.error("There is no tab id, please check if you have rendered the tab panel before the tab list."),`${i}-${t}-${e}`}function C(a,e,t){let{key:i,isDisabled:o,shouldSelectOnPressUp:r$1}=a,{selectionManager:l,selectedKey:b}=e,p=i===b,s=o||e.isDisabled||e.selectionManager.isDisabled(i),d$1=e.collection.getItem(i),{itemProps:n,isPressed:m}=d({selectionManager:l,key:i,ref:t,isDisabled:s,shouldSelectOnPressUp:r$1??d$1?.props.href!=null,linkBehavior:"selection"}),h=P(e,i,"tab"),c$1=P(e,i,"tabpanel"),{tabIndex:_}=n,x=a$a(d$1?.props,{labelable:true});delete x.id;let v=r(d$1?.props),{focusableProps:K}=c$3({...d$1?.props,isDisabled:s},t);return {tabProps:c(x,K,v,n,{id:h,"aria-selected":p,"aria-disabled":s||void 0,"aria-controls":p?c$1:void 0,tabIndex:s?void 0:_,role:"tab"}),isSelected:p,isDisabled:s,isPressed:m}}function A(a,e,t){let i=a$b(t)?void 0:0,o=P(e,a.id??e?.selectedKey,"tabpanel"),r=a$9({...a,id:o,"aria-labelledby":P(e,e?.selectedKey,"tab")});return {tabPanelProps:c(r,{tabIndex:i,role:"tabpanel","aria-describedby":a["aria-describedby"],"aria-details":a["aria-details"]})}}var L=class{collection;flipDirection;disabledKeys;tabDirection;constructor(e,t,i,o=new Set){this.collection=e,this.flipDirection=t==="rtl",this.disabledKeys=o,this.tabDirection=i==="horizontal";}getKeyLeftOf(e){return this.flipDirection?this.getNextKey(e):this.getPreviousKey(e)}getKeyRightOf(e){return this.flipDirection?this.getPreviousKey(e):this.getNextKey(e)}isDisabled(e){return this.disabledKeys.has(e)||!!this.collection.getItem(e)?.props?.isDisabled}getFirstKey(){let e=this.collection.getFirstKey();return e!=null&&this.isDisabled(e)&&(e=this.getNextKey(e)),e}getLastKey(){let e=this.collection.getLastKey();return e!=null&&this.isDisabled(e)&&(e=this.getPreviousKey(e)),e}getKeyAbove(e){return this.tabDirection?null:this.getPreviousKey(e)}getKeyBelow(e){return this.tabDirection?null:this.getNextKey(e)}getNextKey(e){let t=e;do t=this.collection.getKeyAfter(t),t==null&&(t=this.collection.getFirstKey());while(t!=null&&this.isDisabled(t)&&t!==e);return t}getPreviousKey(e){let t=e;do t=this.collection.getKeyBefore(t),t==null&&(t=this.collection.getLastKey());while(t!=null&&this.isDisabled(t)&&t!==e);return t}};function O(a,e,t){let{orientation:i="horizontal",keyboardActivation:o="automatic"}=a,{collection:r,selectionManager:l,disabledKeys:b$1}=e,{direction:p}=b(),s=useMemo(()=>new L(r,p,i,b$1),[r,b$1,i,p]),{collectionProps:d}=c$1({ref:t,selectionManager:l,keyboardDelegate:s,selectOnFocus:o==="automatic",disallowEmptySelection:true,scrollRef:t,linkBehavior:"selection"}),n=c$2();I.set(e,n);let m=a$9({...a,id:n});return {tabListProps:{...c(d,m),role:"tablist","aria-orientation":i,tabIndex:void 0}}}function N(a){let e=a$8({...a,onSelectionChange:a.onSelectionChange?l=>{l!=null&&a.onSelectionChange?.(l);}:void 0,suppressTextValueWarning:true,defaultSelectedKey:a.defaultSelectedKey??Z(a.collection,a.disabledKeys?new Set(a.disabledKeys):new Set)??void 0}),{selectionManager:t,collection:i,selectedKey:o}=e,r=useRef(o);return useEffect(()=>{let l=o;a.selectedKey==null&&(t.isEmpty||l==null||!i.getItem(l))&&(l=Z(i,e.disabledKeys),l!=null&&t.setSelectedKeys([l])),(l!=null&&t.focusedKey==null||!t.isFocused&&l!==r.current)&&t.setFocusedKey(l),r.current=l;}),{...e,isDisabled:a.isDisabled||false}}function Z(a,e){let t=null;if(a){for(t=a.getFirstKey();t!=null&&(e.has(t)||a.getItem(t)?.props?.isDisabled)&&t!==a.getLastKey();)t=a.getKeyAfter(t);t!=null&&(e.has(t)||a.getItem(t)?.props?.isDisabled)&&t===a.getLastKey()&&(t=a.getFirstKey());}return t}var ee="_1yep5z63 _1yep5z64 _1yep5z65 _1yep5z62f _1yep5z62g _1yep5z62h _1yep5z63l _1yep5z63m _1yep5z63n _1yep5z619 _1yep5z61a _1yep5z61b _1yep5z6j8 _1yep5z6j9 _1yep5z6ja _1yep5z6jz _1yep5z6k0 _1yep5z6k1",te=a({defaultClassName:"_1x62fhb6 _1yep5z63r _1yep5z63s _1yep5z63t _1yep5z61f _1yep5z61g _1yep5z61h _1yep5z6j8 _1yep5z6j9 _1yep5z6ja _1yep5z6jz _1yep5z6k0 _1yep5z6k1 _1yep5z6m5 _1yep5z6m6 _1yep5z6lq _1yep5z6lt _1yep5z6ez _1yep5z69i _1yep5z69j _1yep5z69k",variantClassNames:{isHovered:{true:"_1yep5z611h"},isSelected:{true:"_1x62fhb8"},isFocusVisible:{true:"_1x62fhb9"},isDisabled:{true:"_1x62fhba _1yep5z611l"},variant:{primary:"_1x62fhbb _1yep5z610e",ghost:"_1yep5z610h"}},defaultVariants:{},compoundVariants:[[{variant:"primary",isSelected:true,isDisabled:false},"_1yep5z61o0"],[{variant:"primary",isSelected:true},"_1yep5z61pb"],[{variant:"ghost",isSelected:true,isFocusVisible:false},"_1x62fhbd"],[{variant:"ghost",isSelected:true,isDisabled:false},"_1yep5z61o7"],[{variant:"ghost",isDisabled:true,isSelected:true},"_1x62fhbe _1yep5z6f2"],[{variant:"primary",isHovered:true},"_1yep5z61pc"]]}),ae=a({defaultClassName:"_1x62fhb3 _1yep5z6jb _1yep5z6jc _1yep5z6jd _1yep5z6jh _1yep5z6ji _1yep5z6jj",variantClassNames:{variant:{primary:"_1x62fhb4",ghost:"_1yep5z6w1 _1yep5z6w2 _1yep5z6w3"}},defaultVariants:{},compoundVariants:[]}),ie="_1x62fhbl",k=a({defaultClassName:"_1x62fhbf _1yep5z6fa",variantClassNames:{isHovered:{true:"_1yep5z611s"},isSelected:{true:"_1x62fhbh"},isDisabled:{true:"_1yep5z611u"},variant:{primary:"_1x62fhbj",ghost:"_1x62fhbk"}},defaultVariants:{},compoundVariants:[[{variant:"primary",isSelected:true,isDisabled:false},"_1yep5z61ob"],[{variant:"ghost",isSelected:true,isDisabled:false},"_1yep5z61og"],[{variant:"ghost",isDisabled:true,isSelected:true},"_1yep5z61od"]]}),re="_1yep5z6ma _1yep5z6m7 _1yep5z6id _1yep5z6m9",se=a({defaultClassName:"_1x62fhb0 _1yep5z6m3 _1yep5z6j8 _1yep5z6j9 _1yep5z6ja _1yep5z6jh _1yep5z6ji _1yep5z6jj",variantClassNames:{variant:{primary:"_1yep5z612u",ghost:"_1x62fhb2"}},defaultVariants:{},compoundVariants:[]});var oe=({state:a,...e})=>{let t=R.useRef(null),{tabPanelProps:i}=A(e,a,t),{selectedItem:o}=a,{focusProps:r,isFocusVisible:l}=a$5();if(!o?.value)return null;let{className:b,style:p,"data-block-id":s}=o.value;return jsx("div",{...c(i,r),ref:t,className:a$3({[re]:l},"Baseline-Tabs-TabPanel",b),"data-block-id":s,style:p,children:o?.props.children})};var M=R.forwardRef(({className:a,style:e,tabHeaderStyle:t,tabHeaderClassName:i,variant:o="primary",actions:r,onRemove:l,"data-block-id":b,"data-block-class":p,...s},d)=>{let n=N({...s,selectedKey:s.selectedValue,defaultSelectedKey:s.defaultSelectedValue,disabledKeys:s.disabledValues}),m=R.useRef(null),{tabListProps:h}=O({...s,selectedKey:s.selectedValue,defaultSelectedKey:s.defaultSelectedValue,disabledKeys:s.disabledValues},n,m);return jsxs("div",{className:a$3("BaselineUI-Tabs",a),style:e,ref:d,"data-block-id":b,"data-block-class":p,children:[jsxs("div",{className:a$3(se({variant:o}),i),style:t,children:[jsx("div",{...h,className:ae({variant:o}),ref:m,children:[...n.collection].map(c=>(a$1(c.value,"TabItem requires a value prop"),jsx(le,{item:c,state:n,onRemove:l,variant:o},c.key)))}),r?.map((c,_)=>jsx("div",{className:ee,children:jsx(a$2,{...c,variant:"secondary",size:"sm",className:a$3(ie,c.className)})},_))]}),jsx(oe,{state:n},n.selectedItem?.key)]})});M.displayName="TabsBase";var le=({item:a,onRemove:e,state:t,variant:i})=>{let{key:o,value:r}=a,l=R.useRef(null),{tabProps:b,isSelected:p,isDisabled:s}=C({key:o},t,l),{hoverProps:d,isHovered:n}=a$4({isDisabled:s});a$1(r,"TabButton requires a value prop");let{title:m,icon:h,titleStyle:c$1,titleClassName:_}=r,{focusProps:x,isFocusVisible:v,isFocused:K}=a$5(),{keyboardProps:de}=j({onKeyDown:w=>{w.key==="Backspace"&&e?e(o):w.continuePropagation();}}),ce=a$6({"data-selected":p,"data-disabled":s,"data-focused":K,"data-hovered":n,"data-focus-visible":v});return jsxs("div",{...c(de,b,d,x,ce),className:a$3(te({isHovered:n,isSelected:p,isFocusVisible:v,isDisabled:s,variant:i}),"BaselineUI-Tabs-TabButton",_),style:c$1,ref:l,children:[h?jsx(h,{size:20,className:k({isHovered:n,isSelected:p,isDisabled:s,variant:i})}):null,m,e?jsx(a$2,{variant:"secondary",elementType:"div",icon:XIcon,size:"xxs",onPress:()=>{e(o);},excludeFromTabOrder:true,isDisabled:s,UNSAFE_isVisuallyInteractiveOnly:true,style:{display:"inline-flex",opacity:p||K||n?1:0},className:k({isHovered:n,isSelected:p,isDisabled:s,variant:i})}):null]})};le.displayName="TabButton";var pe=R.forwardRef(function({children:e,...t},i){let o=useMemo(()=>(R.Children.map(e,r=>!r||!R.isValidElement(r)||typeof r.type=="string"?null:{...r.props,id:r.props.value})??[]).filter(Boolean),[e]);return jsx(M,{...t,ref:i,items:o,children:r=>jsx(a$7,{title:r.title,children:r.children},r.key)})});pe.displayName="Tabs";var be=({children:a,title:e,value:t})=>(a$1(t,"TabItem requires a value prop"),a$1(e,"TabItem requires a title prop"),a$1(a,"TabItem requires children"),a);be.displayName="TabItem";export{pe as a,be as b};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {b}from'./chunk-OQPYPKZV.mjs';import {j,e,c,h}from'./chunk-
|
|
1
|
+
import {b}from'./chunk-OQPYPKZV.mjs';import {j,e,c,h}from'./chunk-RINS2TBF.mjs';import {a as a$1}from'./chunk-STMDFIUL.mjs';import {a}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$3}from'./chunk-SVIYLH7R.mjs';import {j as j$1}from'./chunk-SD43KVTU.mjs';import {createContext,forwardRef}from'react';import {jsx,jsxs,Fragment}from'react/jsx-runtime';/**
|
|
2
2
|
* Copyright (c) 2023-2024 PSPDFKit GmbH. All rights reserved.
|
|
3
3
|
*
|
|
4
4
|
* THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {b}from'./chunk-
|
|
1
|
+
import {b}from'./chunk-VIMSH5F5.mjs';import {a as a$1}from'./chunk-JZXLV6JU.mjs';import {a as a$8}from'./chunk-DIL5HL6K.mjs';import {a as a$a}from'./chunk-AI6WQPRX.mjs';import {a as a$9}from'./chunk-FPM5UJRF.mjs';import {a as a$6}from'./chunk-SGZWUG3H.mjs';import {a as a$7}from'./chunk-RSKKEGJZ.mjs';import {a as a$3}from'./chunk-STMDFIUL.mjs';import {a as a$4}from'./chunk-B3EZOXNU.mjs';import {a as a$5}from'./chunk-RT4LMB6X.mjs';import {c}from'./chunk-3WKDIXCM.mjs';import {c as c$1,a as a$b}from'./chunk-ETM4MNG4.mjs';import {b as b$1}from'./chunk-RMUV6NJJ.mjs';import {a}from'./chunk-JQQGRJ5J.mjs';import {a as a$2}from'./chunk-4QEH5CGK.mjs';import {CaretUpIcon}from'@baseline-ui/icons/12';import {CheckmarkIcon,CircleFilledIcon,ErrorCircleIcon,WarningIcon}from'@baseline-ui/icons/16';import W,{useRef,useCallback,useEffect}from'react';import {flushSync}from'react-dom';import {jsxs,jsx}from'react/jsx-runtime';/**
|
|
2
2
|
* Copyright (c) 2023-2024 PSPDFKit GmbH. All rights reserved.
|
|
3
3
|
*
|
|
4
4
|
* THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
|
|
@@ -7,4 +7,4 @@ import {b}from'./chunk-JDIGAVFU.mjs';import {a as a$1}from'./chunk-JZXLV6JU.mjs'
|
|
|
7
7
|
* This notice may not be removed from this file.
|
|
8
8
|
*
|
|
9
9
|
*/
|
|
10
|
-
function _(n,r,s){let{isDisabled:
|
|
10
|
+
function _(n,r,s){let{isDisabled:i}=n,a=c$1(),o=c$1(),p=b$1(),t=useRef(null),f=useCallback(()=>{t.current=requestAnimationFrame(()=>{s.current&&s.current.setAttribute("hidden","until-found");}),flushSync(()=>{r.toggle();});},[s,r]);a$a(s,"beforematch",f);let l=useRef(null);return a$b(()=>{if(t.current&&cancelAnimationFrame(t.current),s.current&&!p){let e=s.current;l.current==null||typeof e.getAnimations!="function"?r.isExpanded?(e.removeAttribute("hidden"),e.style.setProperty("--disclosure-panel-width","auto"),e.style.setProperty("--disclosure-panel-height","auto")):(e.setAttribute("hidden","until-found"),e.style.setProperty("--disclosure-panel-width","0px"),e.style.setProperty("--disclosure-panel-height","0px")):r.isExpanded!==l.current&&(r.isExpanded?(e.removeAttribute("hidden"),e.style.setProperty("--disclosure-panel-width",e.scrollWidth+"px"),e.style.setProperty("--disclosure-panel-height",e.scrollHeight+"px"),Promise.all(e.getAnimations().map(d=>d.finished)).then(()=>{e.style.setProperty("--disclosure-panel-width","auto"),e.style.setProperty("--disclosure-panel-height","auto");}).catch(()=>{})):(e.style.setProperty("--disclosure-panel-width",e.scrollWidth+"px"),e.style.setProperty("--disclosure-panel-height",e.scrollHeight+"px"),window.getComputedStyle(e).height,e.style.setProperty("--disclosure-panel-width","0px"),e.style.setProperty("--disclosure-panel-height","0px"),Promise.all(e.getAnimations().map(d=>d.finished)).then(()=>e.setAttribute("hidden","until-found")).catch(()=>{}))),l.current=r.isExpanded;}},[i,s,r.isExpanded,p]),useEffect(()=>()=>{t.current&&cancelAnimationFrame(t.current);},[]),{buttonProps:{id:a,"aria-expanded":r.isExpanded,"aria-controls":o,onPress:e=>{!i&&e.pointerType!=="keyboard"&&r.toggle();},isDisabled:i,onPressStart(e){e.pointerType==="keyboard"&&!i&&r.toggle();}},panelProps:{id:o,role:"group","aria-labelledby":a,"aria-hidden":!r.isExpanded,hidden:p?!r.isExpanded:void 0}}}function g(n){let[r,s]=a$9(n.isExpanded,n.defaultExpanded||false,n.onExpandedChange),i=useCallback(()=>{s(true);},[s]),a=useCallback(()=>{s(false);},[s]),o=useCallback(()=>{s(!r);},[s,r]);return {isExpanded:r,setExpanded:s,expand:i,collapse:a,toggle:o}}var M=a({defaultClassName:"wf9zfn0 _1yep5z6al _1yep5z6am _1yep5z6an _1yep5z6b9 _1yep5z6ba _1yep5z6bb _1yep5z6bx _1yep5z6by _1yep5z6bz _1yep5z6cl _1yep5z6cm _1yep5z6cn _1yep5z6mh _1yep5z6mf",variantClassNames:{variant:{active:"_1yep5z613y _1yep5z612s",warning:"_1yep5z613y _1yep5z612s",error:"_1yep5z613y _1yep5z612s",success:"_1yep5z613y _1yep5z612s",denied:"_1yep5z613y _1yep5z612s","warning-tinted":"_1yep5z613n _1yep5z612g","error-tinted":"_1yep5z613d _1yep5z6126","active-tinted":"_1yep5z613s _1yep5z612l","success-tinted":"_1yep5z613i _1yep5z612b","denied-tinted":"_1yep5z613z _1yep5z612v"}},defaultVariants:{},compoundVariants:[]}),k=a({defaultClassName:"wf9zfnb _1yep5z6al _1yep5z6am _1yep5z6an _1yep5z6b9 _1yep5z6ba _1yep5z6bb _1yep5z6bx _1yep5z6by _1yep5z6bz _1yep5z6cl _1yep5z6cm _1yep5z6cn _1yep5z6me _1yep5z6m3 _1yep5z6lq _1yep5z6m7 _1yep5z6m8 _1yep5z6m5",variantClassNames:{isFocusVisible:{true:"_1yep5z618s _1yep5z614w _1yep5z618u"},isHovered:{true:"wf9zfnd"},variant:{active:"wf9zfne",warning:"wf9zfnf",error:"wf9zfng",success:"wf9zfnh",denied:"wf9zfni","warning-tinted":"wf9zfnj","error-tinted":"wf9zfnk","active-tinted":"wf9zfnl","success-tinted":"wf9zfnm","denied-tinted":"wf9zfnn"}},defaultVariants:{},compoundVariants:[[{isHovered:true,isFocusVisible:false},"_1yep5z61va _1yep5z61v9"],[{variant:"active",isHovered:true,isFocusVisible:false},"_1yep5z61ri"],[{variant:"warning",isHovered:true,isFocusVisible:false},"_1yep5z61ri"],[{variant:"error",isHovered:true,isFocusVisible:false},"_1yep5z61ri"],[{variant:"success",isHovered:true,isFocusVisible:false},"_1yep5z61ri"],[{variant:"denied",isHovered:true,isFocusVisible:false},"_1yep5z61ri"],[{variant:"active-tinted",isHovered:true,isFocusVisible:false},"_1yep5z61rc"],[{variant:"warning-tinted",isHovered:true,isFocusVisible:false},"_1yep5z61r7"],[{variant:"error-tinted",isHovered:true,isFocusVisible:false},"_1yep5z61qx"],[{variant:"success-tinted",isHovered:true,isFocusVisible:false},"_1yep5z61r2"],[{variant:"denied-tinted",isHovered:true,isFocusVisible:false},"_1yep5z61ri"]]}),L="wf9zfno",q={active:"wf9zfnp",warning:"wf9zfnq",error:"wf9zfnr",success:"wf9zfns",denied:"wf9zfnt","active-tinted":"wf9zfnu","warning-tinted":"wf9zfnv","error-tinted":"wf9zfnw","success-tinted":"wf9zfnx","denied-tinted":"wf9zfny"},O=a({defaultClassName:"wf9zfnz _1yep5z6f9",variantClassNames:{isPopupOpen:{true:"wf9zfn10",false:"wf9zfn11"}},defaultVariants:{},compoundVariants:[]});var te={warning:WarningIcon,error:ErrorCircleIcon,info:CircleFilledIcon,success:CheckmarkIcon},G=W.forwardRef(({className:n,style:r,children:s,title:i,description:a,variant:o="active",icon:p=te[o],headerClassName:t,headerStyle:f,panelClassName:l,panelStyle:e,shouldTruncateTitle:d,...y},m)=>{let u=g(y),v=useRef(null),b=useRef(null),{buttonProps:K,panelProps:Q}=_(y,u,b);return jsxs("div",{className:a$2(M({variant:o}),"BaselineUI-Disclosure",n),style:r,ref:m,"data-expanded":u.isExpanded||void 0,children:[jsx(J,{ref:v,...K,variant:o,title:i,description:a,icon:p,className:t,style:f,isExpanded:u.isExpanded,shouldTruncateTitle:d}),jsxs("div",{ref:b,...Q,className:a$2(L,"BaselineUI-Disclosure-Panel",l),style:e,"data-expanded":u.isExpanded||void 0,children:[jsx(a$1,{className:q[o]}),s]})]})});G.displayName="Disclosure";var J=W.forwardRef(({className:n,style:r,variant:s="active",icon:i,title:a,description:o,shouldTruncateTitle:p,...t},f)=>{let{isFocusVisible:l,focusProps:e}=a$3(),{hoverProps:d,isHovered:y}=a$4({isDisabled:t.isDisabled}),m=a$5(f),{buttonProps:u,isPressed:v}=a$6(t,m),b$1=a$7({"data-focus-visible":l,"data-hovered":y,"data-pressed":v});return jsx("button",{...c(u,e,d),ref:m,className:a$2(k({isFocusVisible:l,isHovered:y,variant:s}),"BaselineUI-Disclosure-Header",n),style:r,...b$1,children:jsx(b,{title:a,description:o,variant:s,icon:i,shouldTruncateTitle:p,renderTrailingElement:()=>jsx(a$8,{padding:"sm",display:"inline-flex",children:jsx(CaretUpIcon,{size:12,className:O({isPopupOpen:t.isExpanded})})}),style:{border:"none"}})})});J.displayName="DisclosureHeader";export{G as a};
|
|
@@ -0,0 +1,10 @@
|
|
|
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 {a as a$8}from'./chunk-B3EZOXNU.mjs';import {j}from'./chunk-KUDCYGII.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 N=new WeakMap;function w(e,a,r){let{value:t,children:p,"aria-label":n,"aria-labelledby":u,onPressStart:s,onPressEnd:l,onPressChange:d,onPress:m,onPressUp:v,onClick:g}=e,o=e.isDisabled||a.isDisabled,V=p!=null,x=n!=null||u!=null;!V&&!x&&process.env.NODE_ENV!=="production"&&console.warn("If you do not provide children, you must specify an aria-label for accessibility");let R=a.selectedValue===t,G=M=>{M.stopPropagation(),a.setSelectedValue(t);},{pressProps:D,isPressed:_}=d$2({onPressStart:s,onPressEnd:l,onPressChange:d,onPress:m,onPressUp:v,onClick:g,isDisabled:o}),{pressProps:P,isPressed:f}=d$2({onPressStart:s,onPressEnd:l,onPressChange:d,onPressUp:v,onClick:g,isDisabled:o,onPress(M){m?.(M),a.setSelectedValue(t),r.current?.focus();}}),{focusableProps:I}=c$3(c$1(e,{onFocus:()=>a.setLastFocusedValue(t)}),r),i=c$1(D,I),z=a$6(e,{labelable:true}),b=-1;a.selectedValue!=null?a.selectedValue===t&&(b=0):(a.lastFocusedValue===t||a.lastFocusedValue==null)&&(b=0),o&&(b=void 0);let{name:y,form:S,descriptionId:_e,errorMessageId:ze,validationBehavior:B}=N.get(a);a$9(r,a.defaultSelectedValue,a.setSelectedValue),a$a({validationBehavior:B},a,r);let W=a$b();return {labelProps:c$1(P,useMemo(()=>({onClick:M=>M.preventDefault(),onMouseDown:M=>M.preventDefault()}),[])),inputProps:c$1(z,{...i,type:"radio",name:y,form:S,tabIndex:b,disabled:o,required:a.isRequired&&B==="native",checked:R,value:t,onChange:G,"aria-describedby":[e["aria-describedby"],W.id,a.isInvalid?ze:null,_e].filter(Boolean).join(" ")||void 0}),descriptionProps:W,isDisabled:o,isSelected:R,isPressed:_||f}}function T(e,a,r){let{name:t,form:p,isReadOnly:n,isRequired:u,isDisabled:s,orientation:l="vertical",validationBehavior:d="aria"}=e,{direction:m}=b$1(),{isInvalid:v,validationErrors:g,validationDetails:o}=a.displayValidation,{labelProps:V,fieldProps:x,descriptionProps:R,errorMessageProps:G}=a$5({...e,labelElementType:"span",isInvalid:a.isInvalid,errorMessage:e.errorMessage||g,ref:r}),D=a$6(e,{labelable:true}),{focusWithinProps:_}=b$2({onBlurWithin(i){e.onBlur?.(i),a.selectedValue||a.setLastFocusedValue(null);},onFocusWithin:e.onFocus,onFocusWithinChange:e.onFocusChange});function P(i,z){let b=d$1(z.currentTarget,{from:j$1(z),accept:S=>S instanceof b$4(S).HTMLInputElement&&S.type==="radio"}),y;return i==="next"?(y=b.nextNode(),y||(b.currentNode=z.currentTarget,y=b.firstChild())):(y=b.previousNode(),y||(b.currentNode=z.currentTarget,y=b.lastChild())),y?(y.focus(),a.setSelectedValue(y.value),true):false}let{keyboardProps:f}=j({shortcuts:{ArrowRight:i=>P(m==="rtl"&&l!=="vertical"?"prev":"next",i),ArrowLeft:i=>P(m==="rtl"&&l!=="vertical"?"next":"prev",i),ArrowDown:i=>P("next",i),ArrowUp:i=>P("prev",i)},allowRepeats:true}),I=c$2(t);return N.set(a,{name:I,form:p,descriptionId:R.id,errorMessageId:G.id,validationBehavior:d}),{radioGroupProps:c$1(D,{role:"radiogroup",...f,"aria-invalid":a.isInvalid||void 0,"aria-errormessage":e["aria-errormessage"],"aria-readonly":n||void 0,"aria-required":u||void 0,"aria-disabled":s||void 0,"aria-orientation":l,...x,..._}),labelProps:V,descriptionProps:R,errorMessageProps:G,isInvalid:v,validationErrors:g,validationDetails:o}}var Oe=Math.round(Math.random()*1e10),Le=0;function E(e){let a=useMemo(()=>e.name||`radio-group-${Oe}-${++Le}`,[e.name]),[r,t]=a$4(e.value,e.defaultValue??null,e.onChange),[p]=useState(r),[n,u]=useState(null),s=d({...e,value:r}),l=m=>{!e.isReadOnly&&!e.isDisabled&&(t(m),s.commitValidation());},d$1=s.displayValidation.isInvalid;return {...s,name:a,selectedValue:r,defaultSelectedValue:e.value!==void 0?p:e.defaultValue??null,setSelectedValue:l,lastFocusedValue:n,setLastFocusedValue:u,isDisabled:e.isDisabled||false,isReadOnly:e.isReadOnly||false,isRequired:e.isRequired||false,validationState:e.validationState||(d$1?"invalid":null),isInvalid:d$1}}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:t,isDisabled:p,optionLabelPosition:n,isHovered:u,isReadOnly:s},l,d)=>jsxs("div",{className:b$5({labelPosition:n}),children:[jsx("div",{className:a$3(c$4({isSelected:r,isFocusVisible:t,isDisabled:p,isReadOnly:s,isHovered:u}),Ve({isHovered:u})),children:r?jsx("div",{className:ve}):null}),e?jsxs("div",{className:Re,children:[jsx("span",{id:l,className:a$c({isDisabled:p}),children:e}),a?jsx("span",{...d,className:Pe({isDisabled:p}),children:a}):null]}):null]}),xe=({state:e,renderOption:a,item:r,optionLabelPosition:t="end",optionStyle:p,optionClassName:n,isReadOnly:u,...s})=>{let l=!!s.isDisabled||!!s.disabledValues?.includes(r.id),d=Se.useRef(null),m=c$2(),v=!a&&!!r.label&&!!r.description,{inputProps:g,isPressed:o,isSelected:V,labelProps:x,descriptionProps:R}=w({...s,isDisabled:l,children:r.label,value:r.id,"aria-labelledby":v?m:s["aria-labelledby"]},e,d),{focusProps:G,isFocusVisible:D,isFocused:_}=a$7(),{hoverProps:P,isHovered:f}=a$8({isDisabled:l},d),I=a$2({"data-selected":V,"data-focused":_,"data-focus-visible":D,"data-hovered":f,"data-disabled":l,"data-pressed":o,"data-read-only":u}),i={isFocusVisible:D,isSelected:V,isFocused:_,isHovered:f,isDisabled:l,optionLabelPosition:t,isReadOnly:u};return jsxs("label",{...c$1(x,P,I),style:p,className:a$3("BaselineUI-Radio-Item",n),children:[jsx(b$3,{children:jsx("input",{...c$1(g,G),ref:d})}),a?a(r,i):he(r,i,v?m:void 0,R)]})};var De=Se.forwardRef(({className:e$1,style:a,optionsContainerClassName:r,optionsContainerStyle:t,items:p,labelPosition:n="top",renderOption:u,"aria-label":s,"aria-labelledby":l,"aria-describedby":d,"aria-details":m,"data-block-id":v,"data-block-class":g$1,...o},V)=>{let x=a$1(V),R=E(o),{radioGroupProps:G,labelProps:D,descriptionProps:_,errorMessageProps:P}=T({...o,"aria-label":s,"aria-labelledby":l,"aria-describedby":d,"aria-details":m},R,x),f$1=b({...o,descriptionProps:_,errorMessageProps:P,labelPosition:n}),I=a$2({"data-orientation":o.orientation,"data-block-id":v,"data-block-class":g$1,"data-disabled":o.isDisabled,"data-readonly":o.isReadOnly});return jsxs("div",{...c$1(G,I),className:a$3(g({labelPosition:n}),"BaselineUI-RadioGroup",e$1),style:a,ref:x,children:[o.label||f$1?jsxs("div",{className:f({labelPosition:n,hasMessage:!!f$1}),children:[jsx("span",{...D,className:a$3(e,"BaselineUI-RadioGroup-Label"),children:o.label}),n==="start"&&f$1]}):null,jsx("div",{className:a$3(ge,{[c]:o.isDisabled},r),style:t,children:p.map(i=>jsx(xe,{state:R,renderOption:u,item:i,optionLabelPosition:o.optionLabelPosition,optionStyle:o.optionStyle,optionClassName:o.optionClassName,isReadOnly:o.isReadOnly,isDisabled:o.isDisabled,disabledValues:o.disabledValues,value:i.id},i.id))}),n==="top"&&f$1]})});De.displayName="RadioGroup";export{De as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {a as a$6}from'./chunk-
|
|
1
|
+
import {a as a$6}from'./chunk-AQTRFPF2.mjs';import {a as a$e}from'./chunk-MURSKAKT.mjs';import {k,j,g,c,i,f as f$1,h as h$1,e as e$1,d as d$1,b as b$5,a as a$h}from'./chunk-5GW36EQJ.mjs';import {b as b$3,a as a$g,q as q$1,n,c as c$4}from'./chunk-3IPRT57V.mjs';import {a as a$b}from'./chunk-AMW7LGCF.mjs';import {a as a$9}from'./chunk-QUWRO3HT.mjs';import {b as b$6}from'./chunk-XAM3AXXK.mjs';import {b as b$7}from'./chunk-QMV2O57M.mjs';import {p}from'./chunk-6Z3GYFG5.mjs';import {b as b$8}from'./chunk-DF2D7NE6.mjs';import {a as a$3}from'./chunk-2MS356Q7.mjs';import {a as a$k}from'./chunk-YAI33K42.mjs';import {a as a$d}from'./chunk-4QGZDJW4.mjs';import {a as a$c,b as b$2}from'./chunk-SZTFMBPY.mjs';import {d,h,e,f,g as g$1}from'./chunk-PG3WDHSK.mjs';import {a as a$f}from'./chunk-JZXLV6JU.mjs';import {a as a$m}from'./chunk-CY6W27WG.mjs';import {b,c as c$2}from'./chunk-IDIZSV2Y.mjs';import {a as a$u}from'./chunk-6QQEK5I6.mjs';import {d as d$3}from'./chunk-W6QO7FPZ.mjs';import {b as b$4}from'./chunk-INFMXVHD.mjs';import {a as a$7}from'./chunk-DIL5HL6K.mjs';import {a as a$j}from'./chunk-5W6G3ZUT.mjs';import {a as a$a}from'./chunk-BA5OA5DY.mjs';import {a as a$l}from'./chunk-USMC34OO.mjs';import {a as a$s}from'./chunk-K5RYVERS.mjs';import {a as a$p}from'./chunk-IROFSPEN.mjs';import {a as a$i}from'./chunk-VDUFLHKK.mjs';import {a as a$q}from'./chunk-22VRCVTH.mjs';import {a as a$5}from'./chunk-66CUIXA6.mjs';import {a as a$r}from'./chunk-FPM5UJRF.mjs';import {a as a$t}from'./chunk-4QBHQCCK.mjs';import {a}from'./chunk-SGZWUG3H.mjs';import {a as a$4}from'./chunk-RSKKEGJZ.mjs';import {a as a$2}from'./chunk-STMDFIUL.mjs';import {a as a$1}from'./chunk-B3EZOXNU.mjs';import {j as j$1,d as d$2}from'./chunk-KUDCYGII.mjs';import {c as c$1,b as b$1,a as a$o}from'./chunk-3WKDIXCM.mjs';import {a as a$n}from'./chunk-SVIYLH7R.mjs';import {c as c$3}from'./chunk-ETM4MNG4.mjs';import {h as h$2,j as j$2}from'./chunk-SD43KVTU.mjs';import {a as a$8}from'./chunk-4QEH5CGK.mjs';import W,{useCallback,useContext,useEffect,useMemo,useRef,useState}from'react';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {CaretDownIcon}from'@baseline-ui/icons/8';import {sprinkles}from'@baseline-ui/tokens';/**
|
|
2
2
|
* Copyright (c) 2023-2024 PSPDFKit GmbH. All rights reserved.
|
|
3
3
|
*
|
|
4
4
|
* THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-XXANV3FM.mjs';import {b as b$3}from'./chunk-
|
|
1
|
+
import {a as a$1}from'./chunk-XXANV3FM.mjs';import {b as b$3}from'./chunk-TDRN6VLD.mjs';import {a,b as b$1,c}from'./chunk-LJZ7ZS4C.mjs';import {b as b$2}from'./chunk-N2XGJKZG.mjs';import {useContext,useMemo,useEffect}from'react';/**
|
|
2
2
|
* Copyright (c) 2023-2024 PSPDFKit GmbH. All rights reserved.
|
|
3
3
|
*
|
|
4
4
|
* THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
|
|
File without changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {a as a$8}from'./chunk-
|
|
1
|
+
import {a as a$8}from'./chunk-NO3DNA2U.mjs';import {a as a$4}from'./chunk-X3ACY7IY.mjs';import {a as a$3}from'./chunk-BA5OA5DY.mjs';import {b}from'./chunk-KG2EHFYA.mjs';import {b as b$1}from'./chunk-4S4GGUSH.mjs';import {a as a$5}from'./chunk-B3EZOXNU.mjs';import {c}from'./chunk-KUDCYGII.mjs';import {a as a$1}from'./chunk-RT4LMB6X.mjs';import {a as a$7}from'./chunk-PPHSLODC.mjs';import {c as c$1}from'./chunk-3WKDIXCM.mjs';import {a as a$9}from'./chunk-SVIYLH7R.mjs';import {a as a$6,c as c$2,e}from'./chunk-ETM4MNG4.mjs';import {j,h}from'./chunk-SD43KVTU.mjs';import {a}from'./chunk-JQQGRJ5J.mjs';import {a as a$2}from'./chunk-4QEH5CGK.mjs';import z,{useRef,useCallback,useEffect,useMemo,useState}from'react';import {useSyncExternalStore}from'use-sync-external-store/shim/index.js';import {jsx}from'react/jsx-runtime';/**
|
|
2
2
|
* Copyright (c) 2023-2024 PSPDFKit GmbH. All rights reserved.
|
|
3
3
|
*
|
|
4
4
|
* THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {a as a$1,b as b$1}from'./chunk-5ZC64ZG7.mjs';import {b as b$2}from'./chunk-SZTFMBPY.mjs';import {e,f,c,d,h as h$1,g}from'./chunk-PG3WDHSK.mjs';import {a as a$7}from'./chunk-JZXLV6JU.mjs';import {a as a$6}from'./chunk-
|
|
1
|
+
import {a as a$1,b as b$1}from'./chunk-5ZC64ZG7.mjs';import {b as b$2}from'./chunk-SZTFMBPY.mjs';import {e,f,c,d,h as h$1,g}from'./chunk-PG3WDHSK.mjs';import {a as a$7}from'./chunk-JZXLV6JU.mjs';import {a as a$6}from'./chunk-OPIPJTLG.mjs';import {c as c$2}from'./chunk-4EAXDHSV.mjs';import {b}from'./chunk-N2XGJKZG.mjs';import {a as a$4}from'./chunk-RSKKEGJZ.mjs';import {a as a$3}from'./chunk-STMDFIUL.mjs';import {a as a$2}from'./chunk-B3EZOXNU.mjs';import {c as c$1}from'./chunk-3WKDIXCM.mjs';import {a}from'./chunk-JQQGRJ5J.mjs';import {a as a$5}from'./chunk-4QEH5CGK.mjs';import {MinusIcon,PlusIcon}from'@baseline-ui/icons/8';import {ReadOnlyIcon,ErrorCircleFilledIcon}from'@baseline-ui/icons/16';import M,{useMemo}from'react';import {jsxs,jsx}from'react/jsx-runtime';/**
|
|
2
2
|
* Copyright (c) 2023-2024 PSPDFKit GmbH. All rights reserved.
|
|
3
3
|
*
|
|
4
4
|
* THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
|