@frontify/guideline-blocks-settings 0.29.6 → 0.29.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/components/Link/LinkSelector/DocumentLink.es.js +20 -22
  3. package/dist/components/Link/LinkSelector/DocumentLink.es.js.map +1 -1
  4. package/dist/components/Link/LinkSelector/DocumentLinks.es.js +19 -19
  5. package/dist/components/Link/LinkSelector/DocumentLinks.es.js.map +1 -1
  6. package/dist/components/Link/LinkSelector/LoadingIndicator.es.js +7 -0
  7. package/dist/components/Link/LinkSelector/LoadingIndicator.es.js.map +1 -0
  8. package/dist/components/Link/LinkSelector/PageLink.es.js +25 -28
  9. package/dist/components/Link/LinkSelector/PageLink.es.js.map +1 -1
  10. package/dist/components/Link/LinkSelector/PageLinks.es.js +19 -19
  11. package/dist/components/Link/LinkSelector/PageLinks.es.js.map +1 -1
  12. package/dist/components/Link/LinkSelector/SectionLink.es.js +11 -12
  13. package/dist/components/Link/LinkSelector/SectionLink.es.js.map +1 -1
  14. package/dist/components/RichTextEditor/SerializedText.es.js +14 -7
  15. package/dist/components/RichTextEditor/SerializedText.es.js.map +1 -1
  16. package/dist/components/RichTextEditor/pluginPresets/defaultPluginsWithLinkChooser.es.js +16 -15
  17. package/dist/components/RichTextEditor/pluginPresets/defaultPluginsWithLinkChooser.es.js.map +1 -1
  18. package/dist/index.cjs.js +3 -3
  19. package/dist/index.cjs.js.map +1 -1
  20. package/dist/index.umd.js +3 -3
  21. package/dist/index.umd.js.map +1 -1
  22. package/dist/styles.css +1 -1
  23. package/package.json +4 -4
  24. package/src/components/Link/LinkSelector/DocumentLink.tsx +4 -6
  25. package/src/components/Link/LinkSelector/DocumentLinks.tsx +2 -4
  26. package/src/components/Link/LinkSelector/LinkSelector.spec.ct.tsx +3 -0
  27. package/src/components/Link/LinkSelector/LoadingIndicator.tsx +11 -0
  28. package/src/components/Link/LinkSelector/PageLink.tsx +4 -7
  29. package/src/components/Link/LinkSelector/PageLinks.tsx +3 -7
  30. package/src/components/Link/LinkSelector/SectionLink.tsx +0 -1
  31. package/src/components/RichTextEditor/SerializedText.tsx +5 -1
  32. package/src/components/RichTextEditor/pluginPresets/defaultPluginsWithLinkChooser.tsx +2 -0
@@ -1 +1 @@
1
- {"version":3,"file":"defaultPluginsWithLinkChooser.es.js","sources":["../../../../src/components/RichTextEditor/pluginPresets/defaultPluginsWithLinkChooser.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { AppBridgeBlock } from '@frontify/app-bridge';\nimport {\n AlignCenterPlugin,\n AlignJustifyPlugin,\n AlignLeftPlugin,\n AlignRightPlugin,\n BoldPlugin,\n CheckboxListPlugin,\n CodePlugin,\n ItalicPlugin,\n OrderedListPlugin,\n PluginComposer,\n ResetFormattingPlugin,\n SoftBreakPlugin,\n StrikethroughPlugin,\n TextStylePlugin,\n UnderlinePlugin,\n UnorderedListPlugin,\n} from '@frontify/fondue';\nimport { ButtonPlugin, LinkPlugin, TextStylePluginsWithoutImage, TextStylesWithoutImage } from '../plugins';\n\nexport const getDefaultPluginsWithLinkChooser = (appBridge: AppBridgeBlock) => {\n return new PluginComposer()\n .setPlugin(\n new SoftBreakPlugin(),\n new TextStylePlugin({\n textStyles: TextStylePluginsWithoutImage,\n }),\n )\n .setPlugin(\n [\n new BoldPlugin(),\n new ItalicPlugin(),\n new UnderlinePlugin(),\n new StrikethroughPlugin(),\n new LinkPlugin({ appBridge }),\n new ButtonPlugin({ appBridge }),\n new CodePlugin(),\n ],\n [\n new AlignLeftPlugin({ validTypes: TextStylesWithoutImage }),\n new AlignCenterPlugin({ validTypes: TextStylesWithoutImage }),\n new AlignRightPlugin({ validTypes: TextStylesWithoutImage }),\n new AlignJustifyPlugin({ validTypes: TextStylesWithoutImage }),\n new UnorderedListPlugin(),\n new CheckboxListPlugin(),\n new OrderedListPlugin(),\n new ResetFormattingPlugin(),\n ],\n );\n};\n"],"names":["getDefaultPluginsWithLinkChooser","appBridge","PluginComposer","SoftBreakPlugin","TextStylePlugin","TextStylePluginsWithoutImage","BoldPlugin","ItalicPlugin","UnderlinePlugin","StrikethroughPlugin","LinkPlugin","ButtonPlugin","CodePlugin","AlignLeftPlugin","TextStylesWithoutImage","AlignCenterPlugin","AlignRightPlugin","AlignJustifyPlugin","UnorderedListPlugin","CheckboxListPlugin","OrderedListPlugin","ResetFormattingPlugin"],"mappings":";;;;AAuBa,MAAAA,IAAmC,CAACC,MACtC,IAAIC,IACN;AAAA,EACG,IAAIC,EAAgB;AAAA,EACpB,IAAIC,EAAgB;AAAA,IAChB,YAAYC;AAAA,EAAA,CACf;AAAA,EAEJ;AAAA,EACG;AAAA,IACI,IAAIC,EAAW;AAAA,IACf,IAAIC,EAAa;AAAA,IACjB,IAAIC,EAAgB;AAAA,IACpB,IAAIC,EAAoB;AAAA,IACxB,IAAIC,EAAW,EAAE,WAAAT,GAAW;AAAA,IAC5B,IAAIU,EAAa,EAAE,WAAAV,GAAW;AAAA,IAC9B,IAAIW,EAAW;AAAA,EACnB;AAAA,EACA;AAAA,IACI,IAAIC,EAAgB,EAAE,YAAYC,GAAwB;AAAA,IAC1D,IAAIC,EAAkB,EAAE,YAAYD,GAAwB;AAAA,IAC5D,IAAIE,EAAiB,EAAE,YAAYF,GAAwB;AAAA,IAC3D,IAAIG,EAAmB,EAAE,YAAYH,GAAwB;AAAA,IAC7D,IAAII,EAAoB;AAAA,IACxB,IAAIC,EAAmB;AAAA,IACvB,IAAIC,EAAkB;AAAA,IACtB,IAAIC,EAAsB;AAAA,EAC9B;AAAA;"}
1
+ {"version":3,"file":"defaultPluginsWithLinkChooser.es.js","sources":["../../../../src/components/RichTextEditor/pluginPresets/defaultPluginsWithLinkChooser.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { AppBridgeBlock } from '@frontify/app-bridge';\nimport {\n AlignCenterPlugin,\n AlignJustifyPlugin,\n AlignLeftPlugin,\n AlignRightPlugin,\n AutoformatPlugin,\n BoldPlugin,\n CheckboxListPlugin,\n CodePlugin,\n ItalicPlugin,\n OrderedListPlugin,\n PluginComposer,\n ResetFormattingPlugin,\n SoftBreakPlugin,\n StrikethroughPlugin,\n TextStylePlugin,\n UnderlinePlugin,\n UnorderedListPlugin,\n} from '@frontify/fondue';\nimport { ButtonPlugin, LinkPlugin, TextStylePluginsWithoutImage, TextStylesWithoutImage } from '../plugins';\n\nexport const getDefaultPluginsWithLinkChooser = (appBridge: AppBridgeBlock) => {\n return new PluginComposer()\n .setPlugin(\n new SoftBreakPlugin(),\n new TextStylePlugin({\n textStyles: TextStylePluginsWithoutImage,\n }),\n )\n .setPlugin(\n [\n new BoldPlugin(),\n new ItalicPlugin(),\n new UnderlinePlugin(),\n new StrikethroughPlugin(),\n new LinkPlugin({ appBridge }),\n new ButtonPlugin({ appBridge }),\n new CodePlugin(),\n ],\n [\n new AlignLeftPlugin({ validTypes: TextStylesWithoutImage }),\n new AlignCenterPlugin({ validTypes: TextStylesWithoutImage }),\n new AlignRightPlugin({ validTypes: TextStylesWithoutImage }),\n new AlignJustifyPlugin({ validTypes: TextStylesWithoutImage }),\n new UnorderedListPlugin(),\n new CheckboxListPlugin(),\n new OrderedListPlugin(),\n new ResetFormattingPlugin(),\n new AutoformatPlugin(),\n ],\n );\n};\n"],"names":["getDefaultPluginsWithLinkChooser","appBridge","PluginComposer","SoftBreakPlugin","TextStylePlugin","TextStylePluginsWithoutImage","BoldPlugin","ItalicPlugin","UnderlinePlugin","StrikethroughPlugin","LinkPlugin","ButtonPlugin","CodePlugin","AlignLeftPlugin","TextStylesWithoutImage","AlignCenterPlugin","AlignRightPlugin","AlignJustifyPlugin","UnorderedListPlugin","CheckboxListPlugin","OrderedListPlugin","ResetFormattingPlugin","AutoformatPlugin"],"mappings":";;;;AAwBa,MAAAA,IAAmC,CAACC,MACtC,IAAIC,IACN;AAAA,EACG,IAAIC,EAAgB;AAAA,EACpB,IAAIC,EAAgB;AAAA,IAChB,YAAYC;AAAA,EAAA,CACf;AAAA,EAEJ;AAAA,EACG;AAAA,IACI,IAAIC,EAAW;AAAA,IACf,IAAIC,EAAa;AAAA,IACjB,IAAIC,EAAgB;AAAA,IACpB,IAAIC,EAAoB;AAAA,IACxB,IAAIC,EAAW,EAAE,WAAAT,GAAW;AAAA,IAC5B,IAAIU,EAAa,EAAE,WAAAV,GAAW;AAAA,IAC9B,IAAIW,EAAW;AAAA,EACnB;AAAA,EACA;AAAA,IACI,IAAIC,EAAgB,EAAE,YAAYC,GAAwB;AAAA,IAC1D,IAAIC,EAAkB,EAAE,YAAYD,GAAwB;AAAA,IAC5D,IAAIE,EAAiB,EAAE,YAAYF,GAAwB;AAAA,IAC3D,IAAIG,EAAmB,EAAE,YAAYH,GAAwB;AAAA,IAC7D,IAAII,EAAoB;AAAA,IACxB,IAAIC,EAAmB;AAAA,IACvB,IAAIC,EAAkB;AAAA,IACtB,IAAIC,EAAsB;AAAA,IAC1B,IAAIC,EAAiB;AAAA,EACzB;AAAA;"}
package/dist/index.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("@frontify/sidebar-settings"),s=require("react/jsx-runtime"),i=require("@frontify/fondue"),x=require("react"),G=require("@frontify/app-bridge"),P=require("@dnd-kit/core"),oe=require("@dnd-kit/sortable"),_e=require("@react-aria/focus"),_t=require("@dnd-kit/modifiers"),o=require("@udecode/plate"),Ve=require("slate-react"),Vt=require("@react-stately/overlays"),zt=require("slate"),U=require("@ctrl/tinycolor");const D=e=>e.filter(Boolean).join(" "),$t=({onDrop:e,label:t,icon:n,secondaryLabel:r,isLoading:a,fillParentContainer:l,onAssetChooseClick:u,onUploadClick:d,withMenu:c=!0,onClick:m,validFileType:f,verticalLayout:g})=>{const[w,b]=x.useState(!1),[p,S]=x.useState(),j=x.useRef(null),[E,N]=x.useState(void 0),O=k=>{if(k.preventDefault(),b(!1),!X(k.dataTransfer.files)){N("Invalid"),setTimeout(()=>{N(void 0)},1e3);return}e==null||e(k.dataTransfer.files)},X=k=>{if(!f)return!0;for(let L=0;L<k.length;L++){const A=k[L].name.split(".").pop()??"";if(!G.FileExtensionSets[f].includes(A))return!1}return!0},F=k=>{if(!j.current||a)return;const{left:L,top:A}=j.current.getBoundingClientRect(),Q=k.clientX-L,re=k.clientY-A;S([Q,re])};return s.jsxs("button",{ref:j,"data-test-id":"block-inject-button",className:D(["tw-font-body tw-relative tw-text-sm tw-leading-4 tw-border tw-flex tw-items-center tw-justify-center tw-cursor-pointer tw-gap-3 tw-w-full first:tw-rounded-tl last:tw-rounded-br",g?"[&:not(:first-child)]:tw-border-t-0 first:tw-rounded-tr last:tw-rounded-bl":"[&:not(:first-child)]:tw-border-l-0 first:tw-rounded-bl last:tw-rounded-tr",l?"tw-h-full":"tw-h-[72px]",w&&!a?"tw-border-dashed":"tw-border-solid",p&&"tw-bg-blank-state-pressed-inverse",w&&"tw-bg-blank-state-weak-inverse",E?"!tw-border-red-50 !tw-cursor-not-allowed":" tw-border-blank-state-line",a||p||w||E?"":"tw-text-text-weak hover:tw-text-blank-state-hover hover:tw-bg-blank-state-hover-inverse hover:tw-border-blank-state-line-hover active:tw-text-blank-state-pressed active:tw-bg-blank-state-pressed-inverse active:tw-border-blank-state-line-hover",(w||p)&&!E?"[&>*]:tw-pointer-events-none tw-border-blank-state-line-hover":"tw-bg-blank-state-shaded-inverse tw-text-blank-state-shaded"]),onDragEnter:e?k=>{var L;if(b(!0),f==="Images")for(const A of Array.from(k.dataTransfer.items))(L=A==null?void 0:A.type)!=null&&L.startsWith("image/")?N(void 0):N("Invalid")}:void 0,onDragLeave:e?()=>{b(!1),N(void 0)}:void 0,onDrop:e?O:void 0,onClick:k=>{c&&F(k),m==null||m()},children:[a?s.jsx(i.LoadingCircle,{}):E?s.jsxs("div",{className:" tw-flex tw-items-center tw-justify-center tw-text-red-60 tw-font-medium",children:[s.jsx(i.IconExclamationMarkTriangle,{}),E]}):s.jsxs(s.Fragment,{children:[n&&s.jsx("div",{children:n}),(t||r)&&s.jsxs("div",{className:"tw-flex tw-flex-col tw-items-start",children:[t&&s.jsx("div",{className:"tw-font-medium",children:t}),r&&s.jsx("div",{className:"tw-font-normal",children:r})]})]}),p&&s.jsx("div",{className:"tw-absolute tw-left-0 tw-top-full tw-z-20",style:{left:p[0],top:p[1]},children:s.jsx(i.Flyout,{onOpenChange:k=>!k&&S(void 0),isOpen:!0,fitContent:!0,hug:!1,legacyFooter:!1,trigger:s.jsx("div",{}),children:s.jsx(i.ActionMenu,{menuBlocks:[{id:"menu",menuItems:[...d?[{id:"upload",size:i.MenuItemContentSize.XSmall,title:"Upload asset",onClick:()=>{d(),S(void 0)},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:s.jsx(i.IconArrowCircleUp20,{})})}]:[],...u?[{id:"asset",size:i.MenuItemContentSize.XSmall,title:"Browse asset",onClick:()=>{u(),S(void 0)},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:s.jsx(i.IconImageStack20,{})})}]:[]]}]})})})]})},K=e=>{const t=r=>typeof r=="object"&&["red","green","blue"].every(l=>r.hasOwnProperty(l)),n=r=>{const a=typeof r.alpha=="number"?r.alpha:1;return{r:r.red,g:r.green,b:r.blue,a}};return t(e)?n(e):e},Wt=e=>typeof e=="object"&&["red","green","blue"].every(n=>e==null?void 0:e.hasOwnProperty(n)),qt=(e,t)=>{const n=Wt(e)?K(e):e,r=new U.TinyColor(n);return t?r.getBrightness()<t:r.isDark()||r.getAlpha()>.25&&r.getAlpha()<1},Gt=e=>new U.TinyColor(K(e)).toHex8String(),Kt=e=>new U.TinyColor(K(e)).toHexString(),Ee=e=>new U.TinyColor(K(e)).toRgbString(),Xt=(e,t)=>new U.TinyColor(t).setAlpha(e).toRgbString(),Qt=e=>{const{r:t,g:n,b:r,a}=new U.TinyColor(e);return{red:t,green:n,blue:r,alpha:a}},He=e=>typeof e=="object"&&["red","green","blue"].every(n=>e==null?void 0:e.hasOwnProperty(n)),Yt=(e,t)=>{const n=He(e)?K(e):e,r=He(t)?K(t):t;let a=new U.TinyColor(n);const l=new U.TinyColor(r);for(;U.readability(a,l)<4.5;)a=a.darken(1);return a.toRgbString()},Jt=(e,t,n)=>{const r=[...e],a=n<0?r.length+n:n;if(a>=0&&a<r.length){const l=r.splice(t,1)[0];r.splice(a,0,l)}return r},Zt=e=>({backgroundColor:Ee(e)});var M=(e=>(e.Solid="Solid",e.Dashed="Dashed",e.Dotted="Dotted",e))(M||{});const ze={Solid:"solid",Dotted:"dotted",Dashed:"dashed"};var H=(e=>(e.None="None",e.Small="Small",e.Medium="Medium",e.Large="Large",e))(H||{});const W={None:"0px",Small:"2px",Medium:"4px",Large:"12px"};var V=(e=>(e.None="None",e.Small="Small",e.Medium="Medium",e.Large="Large",e))(V||{});const J={None:"0px",Small:"24px",Medium:"36px",Large:"60px"};var z=(e=>(e.None="None",e.Small="Small",e.Medium="Medium",e.Large="Large",e))(z||{});const Z={None:"0px",Small:"24px",Medium:"36px",Large:"60px"};var q=(e=>(e.Global="Global",e.Custom="Custom",e))(q||{}),$=(e=>(e.Auto="Auto",e.S="S",e.M="M",e.L="L",e))($||{});const $e={Auto:"4px",S:"10px",M:"30px",L:"50px"},en={red:241,green:241,blue:241,alpha:1},We={red:234,green:235,blue:235,alpha:1},tn="1px",ae="24px",ie="24px",nn=(e=M.Solid,t="1px",n=We)=>({borderStyle:ze[e],borderWidth:t,borderColor:Ee(n)}),sn=(e,t=!1,n)=>({borderRadius:t?n:W[e]}),qe="Drag or press ↵ to move",Ge="Move with ↑↓←→ and confirm with ↵",rn=({items:e,flyoutItems:t,isFlyoutOpen:n,setIsFlyoutOpen:r,isDragging:a,isFlyoutDisabled:l})=>s.jsx("div",{"data-test-id":"block-item-wrapper-toolbar",className:"tw-flex tw-justify-end",children:s.jsxs("div",{className:"tw-bg-white tw-isolate tw-text-box-selected-inverse tw-pointer-events-auto tw-flex tw-flex-shrink-0 tw-gap-[2px] tw-px-[1px] tw-spacing tw-items-center tw-h-7 tw-self-start tw-border tw-border-box-selected-inverse tw-rounded",children:[e.map((u,d)=>"draggableProps"in u?s.jsx(i.LegacyTooltip,{withArrow:!0,hoverDelay:0,enterDelay:300,open:a,position:i.TooltipPosition.Top,content:s.jsx("div",{children:a?Ge:u.tooltip??qe}),triggerElement:s.jsx("button",{ref:u.setActivatorNodeRef,"data-test-id":"block-item-wrapper-toolbar-btn",...u.draggableProps,className:D(["tw-bg-base tw-inline-flex tw-items-center tw-justify-center tw-w-6 tw-h-6 tw-rounded-sm",a?"tw-cursor-grabbing tw-bg-box-selected-pressed":"tw-cursor-grab hover:tw-bg-box-selected-hover"]),children:u.icon})},d):s.jsx(i.LegacyTooltip,{withArrow:!0,enterDelay:300,hoverDelay:0,disabled:a,position:i.TooltipPosition.Top,content:s.jsx("div",{children:u.tooltip??""}),triggerElement:s.jsx("button",{"data-test-id":"block-item-wrapper-toolbar-btn",onClick:u.onClick,className:D(["tw-bg-base tw-relative hover:tw-bg-box-selected-hover active:tw-bg-box-selected-pressed tw-cursor-pointer tw-inline-flex tw-items-center tw-justify-center tw-w-6 tw-h-6 tw-rounded-sm focus-visible:tw-z-10",i.FOCUS_VISIBLE_STYLE]),children:u.icon})},d)),t.length>0&&s.jsx("div",{className:"tw-flex tw-flex-shrink-0 tw-flex-1 tw-h-6 tw-relative",children:s.jsx(i.Flyout,{isOpen:n&&!a,isTriggerDisabled:l,legacyFooter:!1,fitContent:!0,hug:!1,onOpenChange:r,trigger:s.jsx(i.LegacyTooltip,{withArrow:!0,hoverDelay:0,enterDelay:300,disabled:a,position:i.TooltipPosition.Top,content:s.jsx("div",{children:"Options"}),triggerElement:s.jsx("div",{"data-test-id":"block-item-wrapper-toolbar-flyout",className:"tw-bg-base hover:tw-bg-box-selected-hover active:tw-bg-box-selected-pressed tw-cursor-pointer tw-inline-flex tw-items-center tw-justify-center tw-w-6 tw-h-6 tw-rounded-sm tw-relative",children:s.jsx(i.IconDotsHorizontal16,{})})}),children:s.jsx(i.ActionMenu,{menuBlocks:t.map((u,d)=>({id:d.toString(),menuItems:u.map((c,m)=>({id:d.toString()+m.toString(),size:i.MenuItemContentSize.XSmall,title:c.title,style:c.style,onClick:()=>{r(!1),c.onClick()},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:c.icon})}))}))})})})]})}),an=({children:e,toolbarFlyoutItems:t,toolbarItems:n,shouldHideWrapper:r,shouldHideComponent:a=!1,isDragging:l,shouldFillContainer:u,outlineOffset:d=2,shouldBeShown:c=!1})=>{const[m,f]=x.useState(c),[g,w]=x.useState(!1),b=x.useRef(null);if(x.useEffect(()=>{m||w(!0)},[m]),r)return s.jsx(s.Fragment,{children:e});const p=n==null?void 0:n.filter(S=>S!==void 0);return s.jsxs("div",{ref:b,onFocus:()=>w(!1),onPointerEnter:()=>w(!1),"data-test-id":"block-item-wrapper",style:{outlineOffset:d},className:D(["tw-relative tw-group tw-outline-1 tw-outline-box-selected-inverse",u&&"tw-flex-1 tw-h-full tw-w-full","hover:tw-outline focus-within:tw-outline",(m||c)&&"tw-outline",a&&"tw-opacity-0"]),children:[s.jsx("div",{style:{right:-1-d,bottom:`calc(100% - ${2+d}px)`},className:D(["tw-pointer-events-none tw-absolute tw-bottom-[calc(100%-4px)] tw-right-[-3px] tw-w-full tw-opacity-0 tw-z-[60]","group-hover:tw-opacity-100 group-focus:tw-opacity-100 focus-within:tw-opacity-100",(m||c)&&"tw-opacity-100"]),children:s.jsx(rn,{isFlyoutOpen:m,isFlyoutDisabled:g,setIsFlyoutOpen:f,flyoutItems:t,items:p,isDragging:l})}),e]})},on=e=>e==="IMAGE"?s.jsx(i.IconImage24,{}):e==="VIDEO"?s.jsx(i.IconPlayFrame24,{}):e==="AUDIO"?s.jsx(i.IconMusicNote24,{}):s.jsx(i.IconDocument24,{}),Pe=x.forwardRef(({item:e,isEditing:t,draggableProps:n,transformStyle:r,isDragging:a,isOverlay:l,isLoading:u,onDelete:d,onReplaceWithBrowse:c,onReplaceWithUpload:m},f)=>{const[g,w]=x.useState(),[b,{selectedFiles:p}]=G.useFileInput({multiple:!0,accept:"image/*"}),[S,{results:j,doneAll:E}]=G.useAssetUpload(),{focusProps:N,isFocusVisible:O}=_e.useFocusRing();x.useEffect(()=>{p&&S(p[0])},[p]),x.useEffect(()=>{E&&m(j[0])},[E,j]);const X=(k,L)=>{fetch(k).then(A=>{A.blob().then(Q=>{const re=URL.createObjectURL(Q),Y=document.createElement("a");Y.href=re,Y.download=L,Y.click()})})},F=u||p&&!E;return s.jsxs("button",{"aria-label":"Download attachment","data-test-id":"attachments-item",onClick:()=>X(e.genericUrl,e.fileName),ref:f,style:{...r,opacity:a&&!l?.3:1,fontFamily:"var(-f-theme-settings-body-font-family)"},className:D(["tw-cursor-pointer tw-text-left tw-w-full tw-relative tw-flex tw-gap-3 tw-px-5 tw-py-3 tw-items-center tw-group hover:tw-bg-box-neutral-hover",a?"tw-bg-box-neutral-hover":""]),children:[s.jsx("div",{className:"tw-text-text-weak group-hover:tw-text-box-neutral-inverse-hover",children:F?s.jsx(i.LoadingCircle,{size:i.LoadingCircleSize.Small}):on(e.objectType)}),s.jsxs("div",{className:"tw-text-s tw-flex-1 tw-min-w-0",children:[s.jsx("div",{className:"tw-whitespace-nowrap tw-overflow-hidden tw-text-ellipsis tw-font-bold tw-text-text-weak group-hover:tw-text-box-neutral-inverse-hover",children:e.title}),s.jsx("div",{className:"tw-text-text-weak",children:`${e.fileSizeHumanReadable} - ${e.extension}`})]}),t&&s.jsxs("div",{"data-test-id":"attachments-actionbar",className:D(["tw-flex tw-gap-0.5 group-focus:tw-opacity-100 focus-visible:tw-opacity-100 focus-within:tw-opacity-100 group-hover:tw-opacity-100",l||(g==null?void 0:g.id)===e.id?"tw-opacity-100":"tw-opacity-0"]),children:[s.jsx("button",{...N,...n,"aria-label":"Drag attachment",className:D([" tw-border-button-border tw-bg-button-background active:tw-bg-button-background-pressed tw-group tw-border tw-box-box tw-relative tw-flex tw-items-center tw-justify-center tw-outline-none tw-font-medium tw-rounded tw-h-9 tw-w-9 ",a||l?"tw-cursor-grabbing tw-bg-button-background-pressed hover:tw-bg-button-background-pressed":"tw-cursor-grab hover:tw-bg-button-background-hover",O&&i.FOCUS_STYLE,O&&"tw-z-[2]"]),children:s.jsx(i.IconGrabHandle20,{})}),s.jsx("div",{"data-test-id":"attachments-actionbar-flyout",children:s.jsx(i.Flyout,{placement:i.FlyoutPlacement.Right,isOpen:(g==null?void 0:g.id)===e.id,fitContent:!0,legacyFooter:!1,onOpenChange:k=>w(k?e:void 0),trigger:(k,L)=>s.jsx(i.Button,{ref:L,icon:s.jsx(i.IconPen20,{}),emphasis:i.ButtonEmphasis.Default,onClick:()=>w(e)}),children:s.jsx(i.ActionMenu,{menuBlocks:[{id:"menu",menuItems:[{id:"upload",size:i.MenuItemContentSize.XSmall,title:"Replace with upload",onClick:()=>{b(),w(void 0)},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:s.jsx(i.IconArrowCircleUp20,{})})},{id:"asset",size:i.MenuItemContentSize.XSmall,title:"Replace with asset",onClick:()=>{c(),w(void 0)},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:s.jsx(i.IconImageStack20,{})})}]},{id:"menu-delete",menuItems:[{id:"delete",size:i.MenuItemContentSize.XSmall,title:"Delete",style:i.MenuItemStyle.Danger,onClick:()=>{d(),w(void 0)},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:s.jsx(i.IconTrashBin20,{})})}]}]})})})]})]})});Pe.displayName="AttachmentItem";const ln=e=>{const{attributes:t,listeners:n,setNodeRef:r,transform:a,transition:l,isDragging:u}=oe.useSortable({id:e.item.id}),d={transform:a?`translate(${a.x}px, ${a.y}px)`:"",transition:l,zIndex:u?2:1},c={...t,...n};return s.jsx(Pe,{ref:r,isDragging:u,transformStyle:d,draggableProps:c,...e})},cn=({items:e=[],onDelete:t,onReplaceWithBrowse:n,onReplaceWithUpload:r,onBrowse:a,onUpload:l,onSorted:u,appBridge:d})=>{const[c,m]=x.useState(e),[f,g]=x.useState(!1),w=P.useSensors(P.useSensor(P.PointerSensor),P.useSensor(P.KeyboardSensor)),[b,p]=x.useState(void 0),[S,j]=x.useState(!1),[E,N]=x.useState([]),[O,X]=x.useState(null),F=G.useEditorState(d),k=c==null?void 0:c.find(v=>v.id===b),[L,{results:A,doneAll:Q}]=G.useAssetUpload({onUploadProgress:()=>!S&&j(!0)});x.useEffect(()=>{m(e)},[e]),x.useEffect(()=>{O&&(j(!0),L(O))},[O]),x.useEffect(()=>{(async()=>{Q&&(await l(A),j(!1))})()},[Q,A]);const re=()=>{g(!1),d.openAssetChooser(v=>{a(v),d.closeAssetChooser(),g(!0)},{multiSelection:!0,selectedValueIds:c.map(v=>v.id)})},Y=v=>{g(!1),d.openAssetChooser(async R=>{g(!0),d.closeAssetChooser(),N([...E,v.id]),await n(v,R[0]),N(E.filter(_=>_!==v.id))},{multiSelection:!1,selectedValueIds:c.map(R=>R.id)})},Oe=async(v,R)=>{N([...E,v.id]),await r(v,R),N(E.filter(_=>_!==v.id))},Dt=v=>{const{active:R}=v;p(R.id)},Ot=v=>{const{active:R,over:_}=v;if(_&&R.id!==_.id&&c){const Ut=c.findIndex(xe=>xe.id===R.id),Ht=c.findIndex(xe=>xe.id===_.id),Ue=oe.arrayMove(c,Ut,Ht);m(Ue),u(Ue)}p(void 0)};return F||((c==null?void 0:c.length)??0)>0?s.jsx(i.LegacyTooltip,{withArrow:!0,position:i.TooltipPosition.Top,content:"Attachments",disabled:f,enterDelay:500,triggerElement:s.jsx("div",{"data-test-id":"attachments-flyout-button",children:s.jsx(i.Flyout,{placement:i.FlyoutPlacement.BottomRight,onOpenChange:v=>g(k?!0:v),isOpen:f,hug:!1,fitContent:!0,legacyFooter:!1,trigger:s.jsxs("div",{className:"tw-flex tw-text-[13px] tw-font-body tw-items-center tw-gap-1 tw-rounded-full tw-bg-box-neutral-strong-inverse hover:tw-bg-box-neutral-strong-inverse-hover active:tw-bg-box-neutral-strong-inverse-pressed tw-text-box-neutral-strong tw-outline tw-outline-1 tw-outline-offset-[1px] tw-p-[6px] tw-outline-line",children:[s.jsx(i.IconPaperclip16,{}),s.jsx("div",{children:e.length>0?e.length:"Add"}),s.jsx(i.IconCaretDown12,{})]}),children:s.jsxs("div",{className:"tw-w-[300px]",children:[c.length>0&&s.jsxs(P.DndContext,{sensors:w,collisionDetection:P.closestCenter,onDragStart:Dt,onDragEnd:Ot,modifiers:[_t.restrictToWindowEdges],children:[s.jsx(oe.SortableContext,{items:c,strategy:oe.rectSortingStrategy,children:s.jsx("div",{className:"tw-border-b tw-border-b-line",children:c.map(v=>s.jsx(ln,{isEditing:F,isLoading:E.includes(v.id),item:v,onDelete:()=>t(v),onReplaceWithBrowse:()=>Y(v),onReplaceWithUpload:R=>Oe(v,R)},v.id))})}),s.jsx(P.DragOverlay,{children:k&&s.jsx(Pe,{isOverlay:!0,isEditing:F,item:k,isDragging:!0,onDelete:()=>t(k),onReplaceWithBrowse:()=>Y(k),onReplaceWithUpload:v=>Oe(k,v)},b)})]}),F&&s.jsxs("div",{className:"tw-px-5 tw-py-3",children:[s.jsx("div",{className:"tw-font-body tw-font-medium tw-text-text tw-text-s tw-my-4",children:"Add attachments"}),s.jsx(i.AssetInput,{isLoading:S,size:i.AssetInputSize.Small,onUploadClick:v=>X(v),onLibraryClick:re})]})]})})})}):null},un=({onDownload:e})=>{const{isFocused:t,focusProps:n}=_e.useFocusRing();return s.jsx(i.LegacyTooltip,{withArrow:!0,position:i.TooltipPosition.Top,content:"Download",enterDelay:500,triggerElement:s.jsx("button",{tabIndex:0,"aria-label":"Download",...n,className:D(["tw-outline-none tw-rounded",t&&i.FOCUS_STYLE]),onClick:e,onPointerDown:r=>r.preventDefault(),children:s.jsx("span",{"data-test-id":"download-button",className:"tw-flex tw-text-xs tw-font-body tw-items-center tw-gap-1 tw-rounded-full tw-bg-box-neutral-strong-inverse hover:tw-bg-box-neutral-strong-inverse-hover active:tw-bg-box-neutral-strong-inverse-pressed tw-text-box-neutral-strong tw-outline tw-outline-1 tw-outline-offset-1 tw-p-1.5 tw-outline-line",children:s.jsx(i.IconArrowCircleDown16,{})})})})},dn=({value:e="",gap:t,columns:n,show:r=!0,plugins:a})=>{const[l,u]=x.useState(null);return x.useEffect(()=>{(async()=>u(await i.serializeRawToHtmlAsync(e,a,n,t)))()},[e,n,t,a]),!r||l==="<br />"?null:l!==null?s.jsx("div",{className:"tw-w-full","data-test-id":"rte-content-html",dangerouslySetInnerHTML:{__html:l}}):s.jsx("div",{className:"tw-rounded-sm tw-bg-base-alt tw-animate-pulse tw-h-full tw-min-h-[10px] tw-w-full"})},Ke=e=>{if(!e)return!1;const t=n=>n.some(r=>r.text?r.text!=="":r.children?t(r.children):!1);try{const n=JSON.parse(e);return t(n)}catch{return!1}},gn=(e="p",t="",n)=>Ke(t)?t:JSON.stringify([{type:e,children:[{text:t,textStyle:e}],align:n}]),mn=[P.KeyboardCode.Down,P.KeyboardCode.Right,P.KeyboardCode.Up,P.KeyboardCode.Left],Xe=(e,t)=>(n,{currentCoordinates:r,context:{activeNode:a}})=>{if(n.preventDefault(),mn.includes(n.code)){const l=(a==null?void 0:a.offsetWidth)??0,u=(a==null?void 0:a.offsetHeight)??0;switch(n.code){case P.KeyboardCode.Right:return{...r,x:r.x+l+e};case P.KeyboardCode.Left:return{...r,x:r.x-l-e};case P.KeyboardCode.Down:return{...r,y:r.y+u+t};case P.KeyboardCode.Up:return{...r,y:r.y-u-t}}}},hn=(e,t,n)=>e===q.Custom?t:n,fn=e=>e.map(Qe),Qe=e=>({id:e.id,title:e.name,colors:e.colors.map(t=>({alpha:t.alpha?t.alpha/255:1,red:t.red??0,green:t.green??0,blue:t.blue??0,name:t.name??""}))}),Ie=(e,t)=>{const n=o.getAboveNode(e,{match:{type:o.ELEMENT_LINK}});return Array.isArray(n)?t(n[0]):""},Ye=e=>Ie(e,t=>{var n,r;return((r=(n=t.chosenLink)==null?void 0:n.searchResult)==null?void 0:r.link)||""}),Je=e=>Ie(e,t=>t.url||""),Ze=e=>{var t,n;return e.url||((n=(t=e.chosenLink)==null?void 0:t.searchResult)==null?void 0:n.link)||""},et=e=>Ie(e,Ze),Te=/^\/(document|r)\/\S+$/i,me=e=>{if(Te.test(e))return e;try{return new URL(e),e}catch{return`https://${e}`}},he=e=>{if(Te.test(e))return!0;try{const t=new URL(e);return["http:","https:","mailto:","tel:"].includes(t.protocol)&&t.pathname!==""}catch{return!1}},te=e=>he(me(e))||e==="",tt=(e,{type:t})=>{const{apply:n,normalizeNode:r}=e;return e.apply=a=>{if(a.type!=="set_selection"){n(a);return}const l=a.newProperties;if(!(l!=null&&l.focus)||!l.anchor||!o.isCollapsed(l)){n(a);return}const u=o.getAboveNode(e,{at:l,match:{type:o.getPluginType(e,C)}});if(u){const[,d]=u;let c;o.isStartPoint(e,l.focus,d)&&(c=o.getPreviousNodeEndPoint(e,d)),o.isEndPoint(e,l.focus,d)&&(c=o.getNextNodeStartPoint(e,d)),c&&(a.newProperties={anchor:c,focus:c})}n(a)},e.normalizeNode=([a,l])=>{if(a.type===o.getPluginType(e,C)){const u=e.selection;if(u&&o.isCollapsed(u)&&o.isEndPoint(e,u.focus,l)){const d=o.getNextNodeStartPoint(e,l);if(d)o.select(e,d);else{const c=zt.Path.next(l);o.insertNodes(e,{text:""},{at:c}),o.select(e,c)}}}r([a,l])},o.withRemoveEmptyNodes(e,o.mockPlugin({options:{types:t}}))},nt=(e,t,n)=>{o.insertNodes(e,[it(e,t)],n)},Be=o.createStore("floatingButton")({openEditorId:null,mouseDown:!1,updated:!1,url:"",text:"",buttonStyle:"primary",newTab:!1,mode:"",isEditing:!1}).extendActions(e=>({reset:()=>{e.url(""),e.text(""),e.buttonStyle("primary"),e.newTab(!1),e.mode(""),e.isEditing(!1)}})).extendActions(e=>({show:(t,n)=>{e.mode(t),e.isEditing(!1),e.openEditorId(n)},hide:()=>{e.reset(),e.openEditorId(null)}})).extendSelectors(e=>({isOpen:t=>e.openEditorId===t})),I=Be.set,B=Be.get,ne=()=>Be.use,Le=e=>{if(!e.selection)return;const{isUrl:t,forceSubmit:n}=o.getPluginOptions(e,C),r=B.url();if(!((t==null?void 0:t(r))||n))return;const l=B.text(),u=B.buttonStyle(),d=B.newTab()?void 0:"_self";return I.hide(),st(e,{url:r,text:l,buttonStyle:u,target:d,isUrl:c=>n||!t?!0:t(c)}),setTimeout(()=>{o.focusEditor(e,e.selection??void 0)},0),!0},se=(e,t)=>o.withoutNormalizing(e,()=>{var n,r,a,l,u,d;if(t!=null&&t.split){if(o.getAboveNode(e,{at:(n=e.selection)==null?void 0:n.anchor,match:{type:o.getPluginType(e,C)}}))return o.splitNodes(e,{at:(r=e.selection)==null?void 0:r.anchor,match:f=>o.isElement(f)&&f.type===o.getPluginType(e,C)}),se(e,{at:(a=e.selection)==null?void 0:a.anchor}),!0;if(o.getAboveNode(e,{at:(l=e.selection)==null?void 0:l.focus,match:{type:o.getPluginType(e,C)}}))return o.splitNodes(e,{at:(u=e.selection)==null?void 0:u.focus,match:f=>o.isElement(f)&&f.type===o.getPluginType(e,C)}),se(e,{at:(d=e.selection)==null?void 0:d.focus}),!0}o.unwrapNodes(e,{match:{type:o.getPluginType(e,C)},...t})}),st=(e,{url:t,text:n,buttonStyle:r,target:a,insertTextInButton:l,insertNodesOptions:u,isUrl:d=o.getPluginOptions(e,C).isUrl})=>{var E;const c=e.selection;if(!c)return;const m=o.getAboveNode(e,{at:c,match:{type:o.getPluginType(e,C)}});if(l&&m)return e.insertText(t),!0;if(!(d!=null&&d(t)))return;if(o.isDefined(n)&&n.length===0&&(n=t),m)return yn(t,e,m,a,r,n),!0;const f=o.findNode(e,{at:c,match:{type:o.getPluginType(e,C)}}),[g,w]=f??[],b=wn(e,w,n);if(o.isExpanded(c))return xn(m,e,t,r,a,n),!0;b&&o.removeNodes(e,{at:w});const p=o.getNodeProps(g??{}),S=(E=e.selection)==null?void 0:E.focus.path;if(!S)return;const j=o.getNodeLeaf(e,S);return n!=null&&n.length||(n=t),nt(e,{...p,url:t,target:a,children:[{...j,text:n}]},u),!0};function wn(e,t,n){return t&&(n==null?void 0:n.length)&&n!==o.getEditorString(e,t)}function xn(e,t,n,r,a,l){e?se(t,{at:e[1]}):se(t,{split:!0}),rt(t,{url:n,buttonStyle:r,target:a}),je(t,{url:n,target:a,text:l})}function yn(e,t,n,r,a,l){var u,d,c;(e!==((u=n[0])==null?void 0:u.url)||r!==((d=n[0])==null?void 0:d.target)||a!==((c=n[0])==null?void 0:c.buttonStyle))&&o.setNodes(t,{url:e,target:r,buttonStyle:a},{at:n[1]}),je(t,{url:e,text:l,target:r})}const je=(e,{text:t})=>{const n=o.getAboveNode(e,{match:{type:o.getPluginType(e,C)}});if(n){const[r,a]=n;if(t!=null&&t.length&&t!==o.getEditorString(e,a)){const l=r.children[0];o.replaceNodeChildren(e,{at:a,nodes:{...l,text:t},insertOptions:{select:!0}})}}},rt=(e,{url:t,buttonStyle:n,target:r,...a})=>{o.wrapNodes(e,{type:o.getPluginType(e,C),url:t,buttonStyle:n,target:r,children:[]},{split:!0,...a})},pn=(e,t)=>{const n=o.getAboveNode(e,{match:{type:C}});return Array.isArray(n)?t(n[0]):""},at=e=>pn(e,t=>t.url??""),it=(e,{url:t,text:n="",buttonStyle:r="primary",target:a,children:l})=>({type:o.getPluginType(e,C),url:t,target:a,buttonStyle:r,children:l??[{text:n}]}),ot=(e,{focused:t}={})=>{if(B.mode()==="edit"){fe(e);return}Ne(e,{focused:t})},fe=e=>{const t=o.findNode(e,{match:{type:o.getPluginType(e,C)}});if(!t)return;const[n,r]=t;let a=o.getEditorString(e,r);I.url(n.url),I.newTab(n.target===void 0),a===n.url&&(a=""),I.text(a),I.isEditing(!0)},Ne=(e,{focused:t}={})=>{B.mode()||!t||o.isRangeAcrossBlocks(e,{at:e.selection})||o.someNode(e,{match:{type:o.getPluginType(e,C)}})||(I.text(o.getEditorString(e,e.selection)),I.show("insert",e.id))},we={buttonPrimary:{fontFamily:"var(--f-theme-settings-button-primary-font-family)",fontSize:"var(--f-theme-settings-button-primary-font-size)",fontWeight:"var(--f-theme-settings-button-primary-font-weight)",lineHeight:"var(--f-theme-settings-button-primary-line-height)",paddingTop:"var(--f-theme-settings-button-primary-padding-top)",paddingRight:"var(--f-theme-settings-button-primary-padding-right)",paddingBottom:"var(--f-theme-settings-button-primary-padding-bottom)",paddingLeft:"var(--f-theme-settings-button-primary-padding-left)",fontStyle:"var(--f-theme-settings-button-primary-font-style)",textTransform:"var(--f-theme-settings-button-primary-text-transform)",backgroundColor:"var(--f-theme-settings-button-primary-background-color)",borderColor:"var(--f-theme-settings-button-primary-border-color)",borderRadius:"var(--f-theme-settings-button-primary-border-radius)",borderWidth:"var(--f-theme-settings-button-primary-border-width)",color:"var(--f-theme-settings-button-primary-color)",marginTop:"10px",marginBottom:"10px",display:"inline-block",hover:{backgroundColor:"var(--f-theme-settings-button-primary-background-color-hover)",borderColor:"var(--f-theme-settings-button-primary-border-color-hover)",color:"var(--f-theme-settings-button-primary-color-hover)"}},buttonSecondary:{fontFamily:"var(--f-theme-settings-button-secondary-font-family)",fontSize:"var(--f-theme-settings-button-secondary-font-size)",fontWeight:"var(--f-theme-settings-button-secondary-font-weight)",lineHeight:"var(--f-theme-settings-button-secondary-line-height)",paddingTop:"var(--f-theme-settings-button-secondary-padding-top)",paddingRight:"var(--f-theme-settings-button-secondary-padding-right)",paddingBottom:"var(--f-theme-settings-button-secondary-padding-bottom)",paddingLeft:"var(--f-theme-settings-button-secondary-padding-left)",fontStyle:"var(--f-theme-settings-button-secondary-font-style)",textTransform:"var(--f-theme-settings-button-secondary-text-transform)",backgroundColor:"var(--f-theme-settings-button-secondary-background-color)",borderColor:"var(--f-theme-settings-button-secondary-border-color)",borderRadius:"var(--f-theme-settings-button-secondary-border-radius)",borderWidth:"var(--f-theme-settings-button-secondary-border-width)",color:"var(--f-theme-settings-button-secondary-color)",display:"inline-block",marginTop:"10px",marginBottom:"10px",hover:{backgroundColor:"var(--f-theme-settings-button-secondary-background-color-hover)",borderColor:"var(--f-theme-settings-button-secondary-border-color-hover)",color:"var(--f-theme-settings-button-secondary-color-hover)"}},buttonTertiary:{fontFamily:"var(--f-theme-settings-button-tertiary-font-family)",fontSize:"var(--f-theme-settings-button-tertiary-font-size)",fontWeight:"var(--f-theme-settings-button-tertiary-font-weight)",lineHeight:"var(--f-theme-settings-button-tertiary-line-height)",paddingTop:"var(--f-theme-settings-button-tertiary-padding-top)",paddingRight:"var(--f-theme-settings-button-tertiary-padding-right)",paddingBottom:"var(--f-theme-settings-button-tertiary-padding-bottom)",paddingLeft:"var(--f-theme-settings-button-tertiary-padding-left)",fontStyle:"var(--f-theme-settings-button-tertiary-font-style)",textTransform:"var(--f-theme-settings-button-tertiary-text-transform)",backgroundColor:"var(--f-theme-settings-button-tertiary-background-color)",borderColor:"var(--f-theme-settings-button-tertiary-border-color)",borderRadius:"var(--f-theme-settings-button-tertiary-border-radius)",borderWidth:"var(--f-theme-settings-button-tertiary-border-width)",color:"var(--f-theme-settings-button-tertiary-color)",display:"inline-block",marginTop:"10px",marginBottom:"10px",hover:{backgroundColor:"var(--f-theme-settings-button-tertiary-background-color-hover)",borderColor:"var(--f-theme-settings-button-tertiary-border-color-hover)",color:"var(--f-theme-settings-button-tertiary-color-hover)"}}},bn=e=>({...o.useElementProps({...e,elementToAttributes:n=>({url:n.href,buttonStyle:n.buttonStyle||"primary",target:n.target||"_blank"})}),onMouseOver:n=>{n.stopPropagation()}}),vn=e=>{const{href:t,target:n,buttonStyle:r}=bn(e),{attributes:a,children:l}=e;return s.jsx(kn,{attributes:a,href:t,target:n,styles:we[`button${r.charAt(0).toUpperCase()+r.slice(1)}`],children:l})},kn=({attributes:e,styles:t={hover:{}},children:n,href:r="#",target:a})=>{const[l,u]=x.useState(!1);return s.jsx("a",{...e,onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),href:r,target:a,style:l?{...t,...t.hover}:t,children:n})};class Cn extends i.MarkupElement{constructor(t=C,n=vn){super(t,n)}}const Sn=({type:e,...t})=>{const n=o.useEditorRef(),r=!!o.isRangeInSameBlock(n,{at:n.selection}),a=!!(n!=null&&n.selection)&&o.someNode(n,{match:{type:e}});return s.jsx(o.ToolbarButton,{tooltip:i.getTooltip(r?`Button
2
- ${i.getHotkeyByPlatform("Ctrl+Shift+K")}`:"Buttons can only be set for a single text block."),classNames:i.getButtonClassNames(r),active:a,onMouseDown:async l=>{n&&(l.preventDefault(),l.stopPropagation(),o.focusEditor(n,n.selection??n.prevSelection??void 0),setTimeout(()=>{ot(n,{focused:!0})},0))},...t})},En=({editor:e,id:t})=>s.jsx("div",{"data-plugin-id":t,children:s.jsx(Sn,{type:o.getPluginType(e,C),icon:s.jsx("span",{className:"tw-p-2 tw-h-8 tw-justify-center tw-items-center tw-flex",children:s.jsx(i.IconButton16,{})}),styles:i.buttonStyles})}),Pn=()=>{const e=qn({});return s.jsx("div",{"data-test-id":"floating-button-edit",className:"tw-bg-white tw-text-text tw-rounded tw-shadow tw-p-4 tw-min-w-[400px]",children:s.jsxs("span",{"data-test-id":"preview-button-flyout",className:"tw-flex tw-justify-between tw-items-center",children:[s.jsx("span",{className:"tw-pointer-events-none",children:e.defaultValue}),s.jsxs("span",{className:"tw-flex tw-gap-2",children:[s.jsx("span",{role:"button",tabIndex:0,"data-test-id":"edit-button-button",className:"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1",children:s.jsx(ce.EditButton,{children:s.jsx(i.IconPen16,{})})}),s.jsx("span",{role:"button",tabIndex:0,"data-test-id":"remove-button-button",className:"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1",children:s.jsx(ce.UnlinkButton,{children:s.jsx(i.IconTrashBin16,{})})})]})]})})},In=({section:e,selectedUrl:t,onSelectUrl:n})=>{const r=e.permanentLink===t;return s.jsx("button",{"data-test-id":"internal-link-selector-section-link",className:i.merge(["tw-py-2 tw-px-2.5 tw-pl-14 tw-leading-5 tw-cursor-pointer tw-w-full",r?"tw-bg-box-selected-strong tw-text-box-selected-strong-inverse hover:tw-bg-box-selected-strong-hover:hover hover:tw-text-box-selected-strong-inverse-hover:hover":"hover:tw-bg-box-neutral-hover hover:tw-text-box-neutral-inverse-hover"]),onClick:()=>n(e.permanentLink),onFocus:()=>n(e.permanentLink),children:s.jsxs("div",{className:"tw-flex tw-flex-1 tw-space-x-2 tw-items-center tw-h-6",children:[s.jsx(i.IconDocumentText16,{}),s.jsx("span",{className:"tw-text-s",children:e.title}),s.jsx("span",{className:"tw-flex-auto tw-font-sans tw-text-xs tw-text-right",children:"Section"})]})})},Tn=({page:e,selectedUrl:t,onSelectUrl:n,itemsToExpandInitially:r,appBridge:a})=>{const[l,u]=x.useState(e.id===r.documentId),d=e.permanentLink===t,{documentSections:c}=G.useDocumentSection(a,e.id),m=[...c.values()],f=m.length>0;return x.useEffect(()=>{e.id===r.pageId&&u(!0)},[r,e.id]),s.jsxs(s.Fragment,{children:[s.jsx("div",{tabIndex:0,"data-test-id":"internal-link-selector-page-link",className:i.merge(["tw-py-2 tw-px-2.5 tw-leading-5 tw-cursor-pointer",f?"tw-pl-7":"tw-pl-12",d?"tw-bg-box-selected-strong tw-text-box-selected-strong-inverse hover:tw-bg-box-selected-strong-hover:hover hover:tw-text-box-selected-strong-inverse-hover:hover":"hover:tw-bg-box-neutral-hover hover:tw-text-box-neutral-inverse-hover"]),onClick:()=>n(e.permanentLink),onFocus:()=>n(e.permanentLink),children:s.jsxs("div",{className:"tw-flex tw-flex-1 tw-space-x-1 tw-items-center tw-h-6",children:[f&&s.jsx("button",{"data-test-id":"tree-item-toggle",className:"tw-flex tw-items-center tw-justify-center tw-p-1.5 tw-cursor-pointer",onClick:()=>u(!l),onFocus:()=>u(!l),children:s.jsx("div",{className:i.merge(["tw-transition-transform tw-w-0 tw-h-0 tw-font-normal tw-border-t-4 tw-border-t-transparent tw-border-b-4 tw-border-b-transparent tw-border-l-4 tw-border-l-x-strong",l?"tw-rotate-90":""])})}),s.jsx("span",{className:"tw-text-s",children:e.title}),s.jsx("span",{className:"tw-flex-auto tw-font-sans tw-text-xs tw-text-right",children:"Page"})]},e.id)}),l&&m.length>0&&m.map(g=>s.jsx(In,{section:g,selectedUrl:t,onSelectUrl:n},g.id))]})},Bn=({appBridge:e,documentId:t,selectedUrl:n,onSelectUrl:r,itemsToExpandInitially:a})=>{const[l,u]=x.useState([]),[d,c]=x.useState(!0),m=[...l.values()],f=!d&&m.length>0;return x.useEffect(()=>{e.getDocumentPagesByDocumentId(t).then(g=>{const w=g.filter(p=>!!p.category).sort((p,S)=>p.category.sort===S.category.sort?p.sort-S.sort:p.category.sort-S.category.sort),b=g.filter(p=>!p.category).sort((p,S)=>p.sort-S.sort);u([...w,...b])}).finally(()=>{c(!1)})},[]),d?s.jsx("div",{className:"tw-flex tw-justify-center tw-p-4",children:s.jsx(i.LoadingCircle,{})}):f?s.jsx(s.Fragment,{children:m.map(g=>s.jsx(Tn,{page:g,appBridge:e,selectedUrl:n,onSelectUrl:r,itemsToExpandInitially:a},g.id))}):s.jsx("div",{className:"tw-py-2 tw-px-2.5 tw-pl-7 tw-leading-5 tw-text-s tw-text-text-weak",children:"This document does not contain any pages."})},Ln=({document:e,appBridge:t,selectedUrl:n,onSelectUrl:r,itemsToExpandInitially:a})=>{const[l,u]=x.useState(e.id===a.documentId),d=e.permanentLink===n;return x.useEffect(()=>{e.id===a.documentId&&u(!0)},[a,e.id]),s.jsxs(s.Fragment,{children:[s.jsxs("button",{"data-test-id":"internal-link-selector-document-link",className:i.merge(["tw-flex tw-flex-1 tw-space-x-2 tw-items-center tw-py-2 tw-px-2.5 tw-leading-5 tw-cursor-pointer tw-w-full",d?"tw-bg-box-selected-strong tw-text-box-selected-strong-inverse hover:tw-bg-box-selected-strong-hover:hover hover:tw-text-box-selected-strong-inverse-hover:hover":"hover:tw-bg-box-neutral-hover hover:tw-text-box-neutral-inverse-hover"]),onClick:()=>r(e.permanentLink),onFocus:()=>r(e.permanentLink),children:[s.jsx("div",{role:"button",tabIndex:0,"data-test-id":"tree-item-toggle",className:"tw-flex tw-items-center tw-justify-center tw-p-1.5 tw-cursor-pointer",onClick:()=>u(!l),onFocus:()=>u(!l),children:s.jsx("div",{className:i.merge(["tw-transition-transform tw-w-0 tw-h-0 tw-font-normal tw-border-t-4 tw-border-t-transparent tw-border-b-4 tw-border-b-transparent tw-border-l-4 tw-border-l-x-strong",l?"tw-rotate-90":""])})}),s.jsx(i.IconColorFan16,{}),s.jsx("span",{className:"tw-text-s",children:e.title}),s.jsx("span",{className:"tw-flex-auto tw-font-sans tw-text-xs tw-text-right",children:"Document"})]}),l&&s.jsx(Bn,{appBridge:t,documentId:e.id,selectedUrl:n,onSelectUrl:r,itemsToExpandInitially:a})]})},jn=({appBridge:e,selectedUrl:t,onSelectUrl:n})=>{const[r,a]=x.useState(!0),[l,u]=x.useState([]),[d,c]=x.useState({documentId:void 0,pageId:void 0}),m=[...l.values()];x.useEffect(()=>{t&&m.length>0&&f().then(g=>{c(g)})},[m.length]),x.useEffect(()=>{e.getAllDocuments().then(g=>{u(g)}).finally(()=>{a(!1)})},[]);const f=async()=>{const g={documentId:void 0,pageId:void 0};if(m.find(b=>b.permanentLink===t))return g;for(const b of m){const p=await e.getDocumentPagesByDocumentId(b.id);e.getAllDocuments();const S=[...p.values()];if(!!S.find(E=>E.permanentLink===t))return g.documentId=b.id,g;for(const E of S)if(!![...(await e.getDocumentSectionsByDocumentPageId(E.id)).values()].find(F=>F.permanentLink===t))return g.documentId=b.id,g.pageId=E.id,g}return g};return r?s.jsx("div",{className:"tw-flex tw-justify-center tw-p-4",children:s.jsx(i.LoadingCircle,{})}):s.jsx(s.Fragment,{children:m.map(g=>s.jsx(Ln,{document:g,appBridge:e,selectedUrl:t,onSelectUrl:n,itemsToExpandInitially:d},g.id))})},lt=({appBridge:e,url:t,onUrlChange:n,buttonSize:r=i.ButtonSize.Medium})=>{const{open:a,isOpen:l,close:u}=Vt.useOverlayTriggerState({}),[d,c]=x.useState(t),m=w=>{c(w)},f=w=>{w.key==="Enter"&&g()};x.useEffect(()=>{t&&!d&&c(t)},[t,d]);const g=()=>{n==null||n(d),u()};return s.jsxs("div",{"data-test-id":"internal-link-selector",onKeyDown:f,children:[s.jsx(i.Button,{icon:s.jsx(i.IconLink,{}),size:r,type:i.ButtonType.Button,style:i.ButtonStyle.Default,emphasis:i.ButtonEmphasis.Default,onClick:()=>a(),children:"Internal link"}),s.jsxs(i.Modal,{zIndex:1001,onClose:()=>u(),isOpen:l,isDismissable:!0,children:[s.jsx(i.Modal.Header,{title:"Select internal link"}),s.jsx(i.Modal.Body,{children:s.jsx(jn,{appBridge:e,selectedUrl:d,onSelectUrl:m})}),s.jsx(i.Modal.Footer,{buttons:[{children:"Cancel",onClick:()=>u(),style:i.ButtonStyle.Default,emphasis:i.ButtonEmphasis.Default},{children:"Choose",onClick:w=>{w==null||w.preventDefault(),g()},style:i.ButtonStyle.Default,emphasis:i.ButtonEmphasis.Strong,disabled:!d}]})]})]})},ct=({onUrlChange:e,onToggleTab:t,isValidUrlOrEmpty:n,appBridge:r,clearable:a,placeholder:l,newTab:u,openInNewTab:d,url:c="",required:m,info:f,label:g,buttonSize:w,hideInternalLinkButton:b})=>{const p=n?n(c):te(c),S=u??(d?i.CheckboxState.Checked:i.CheckboxState.Unchecked);return s.jsxs("div",{"data-test-id":"link-input",children:[s.jsx(i.FormControl,{label:{children:g,htmlFor:"url",required:m,tooltip:f?{content:f,position:i.TooltipPosition.Top}:void 0},children:s.jsx(i.TextInput,{id:"url",value:c,clearable:a,onChange:e,placeholder:l??"https://example.com",focusOnMount:!0})}),!p&&s.jsx("div",{className:"tw-text-text-negative tw-mt-1 tw-text-s",children:"Please enter a valid URL."}),!b&&s.jsx("div",{className:"tw-mt-3",children:s.jsx(lt,{url:c,appBridge:r,onUrlChange:e,buttonSize:w??i.ButtonSize.Medium})}),s.jsx("div",{className:"tw-mt-3",children:s.jsx(i.Checkbox,{value:"new-tab",label:"Open in new tab",state:S,onChange:t})})]})},ut=({state:e,onTextChange:t,onUrlChange:n,onToggleTab:r,onCancel:a,onSave:l,isValidUrlOrEmpty:u,hasValues:d,testId:c,appBridge:m,children:f})=>s.jsxs("div",{"data-test-id":c,className:"tw-bg-white tw-rounded tw-shadow tw-p-7 tw-min-w-[400px] tw-overflow-y-auto",children:[s.jsx(i.FormControl,{label:{children:"Text",htmlFor:"linkText",required:!0},children:s.jsx(i.TextInput,{id:"linkText",value:e.text,placeholder:"Link Text",onChange:t})}),f,s.jsx("div",{className:"tw-mt-5",children:s.jsx(ct,{url:e.url,newTab:e.newTab,onUrlChange:n,onToggleTab:r,isValidUrlOrEmpty:u,appBridge:m})}),s.jsx("div",{className:"tw-mt-3",children:s.jsxs("div",{className:"tw-pt-5 tw-flex tw-gap-x-3 tw-justify-end tw-border-t tw-border-t-black-10",children:[s.jsx(i.Button,{onClick:a,size:i.ButtonSize.Medium,style:i.ButtonStyle.Default,emphasis:i.ButtonEmphasis.Default,children:"Cancel"}),s.jsx(i.Button,{onClick:l,size:i.ButtonSize.Medium,icon:s.jsx(i.IconCheckMark20,{}),disabled:!d||!u(e==null?void 0:e.url),children:"Save"})]})})]}),Nn=e=>{var n;const t=o.getAboveNode(e,{match:{type:C}});return Array.isArray(t)&&((n=t[0])==null?void 0:n.buttonStyle)||"primary"},An={url:"",text:"",buttonStyle:"primary",newTab:i.CheckboxState.Unchecked},Rn=()=>{const[e,t]=x.useReducer((n,r)=>{const{type:a,payload:l}=r;switch(a){case"NEW_TAB":return{...n,newTab:i.CheckboxState.Checked};case"SAME_TAB":return{...n,newTab:i.CheckboxState.Unchecked};case"URL":case"TEXT":case"BUTTON_STYLE":case"INIT":return{...n,...l};default:return n}},An);return[e,t]},Fn=()=>{const e=o.useEditorRef(),[t,n]=Rn();x.useEffect(()=>{const g=Nn(e);n({type:"INIT",payload:{text:B.text(),buttonStyle:g,newTab:B.newTab()?i.CheckboxState.Checked:i.CheckboxState.Unchecked,url:B.url()}})},[n,e]);const r=g=>{n({type:"TEXT",payload:{text:g}})},a=g=>{n({type:"BUTTON_STYLE",payload:{buttonStyle:g}})},l=g=>{n({type:"URL",payload:{url:g}})},u=g=>{n(g?{type:"NEW_TAB"}:{type:"SAME_TAB"})},d=()=>{I.hide()},c=g=>{if(!te(t.url)||!m)return;const w=me(t.url);I.text(t.text),I.url(w),I.buttonStyle(t.buttonStyle),I.newTab(t.newTab===i.CheckboxState.Checked),Le(e)&&(g==null||g.preventDefault())},m=t.url!==""&&t.text!=="",{appBridge:f}=o.getPluginOptions(e,C);return o.useHotkeys("enter",c,{enableOnFormTags:["INPUT"]},[]),{state:t,onTextChange:r,onButtonStyleChange:a,onUrlChange:l,onToggleTab:u,onCancel:d,onSave:c,hasValues:m,isValidUrlOrEmpty:te,appBridge:f}},le="link-plugin";var y=(e=>(e.heading1="heading1",e.heading2="heading2",e.heading3="heading3",e.heading4="heading4",e.custom1="custom1",e.custom2="custom2",e.custom3="custom3",e.quote="quote",e.imageCaption="imageCaption",e.imageTitle="imageTitle",e.p="p",e))(y||{});const T={heading1:{fontSize:"var(--f-theme-settings-heading1-font-size)",lineHeight:"var(--f-theme-settings-heading1-line-height)",marginTop:"var(--f-theme-settings-heading1-margin-top)",marginBottom:"var(--f-theme-settings-heading1-margin-bottom)",textDecoration:"var(--f-theme-settings-heading1-text-decoration)",fontStyle:"var(--f-theme-settings-heading1-font-style)",textTransform:"var(--f-theme-settings-heading1-text-transform)",letterSpacing:"var(--f-theme-settings-heading1-letter-spacing)",fontWeight:"var(--f-theme-settings-heading1-font-weight)",fontFamily:"var(--f-theme-settings-heading1-font-family)",color:"var(--f-theme-settings-heading1-color)"},heading2:{fontSize:"var(--f-theme-settings-heading2-font-size)",lineHeight:"var(--f-theme-settings-heading2-line-height)",marginTop:"var(--f-theme-settings-heading2-margin-top)",marginBottom:"var(--f-theme-settings-heading2-margin-bottom)",textDecoration:"var(--f-theme-settings-heading2-text-decoration)",fontStyle:"var(--f-theme-settings-heading2-font-style)",textTransform:"var(--f-theme-settings-heading2-text-transform)",letterSpacing:"var(--f-theme-settings-heading2-letter-spacing)",fontWeight:"var(--f-theme-settings-heading2-font-weight)",fontFamily:"var(--f-theme-settings-heading2-font-family)",color:"var(--f-theme-settings-heading2-color)"},heading3:{fontSize:"var(--f-theme-settings-heading3-font-size)",lineHeight:"var(--f-theme-settings-heading3-line-height)",marginTop:"var(--f-theme-settings-heading3-margin-top)",marginBottom:"var(--f-theme-settings-heading3-margin-bottom)",textDecoration:"var(--f-theme-settings-heading3-text-decoration)",fontStyle:"var(--f-theme-settings-heading3-font-style)",textTransform:"var(--f-theme-settings-heading3-text-transform)",letterSpacing:"var(--f-theme-settings-heading3-letter-spacing)",fontWeight:"var(--f-theme-settings-heading3-font-weight)",fontFamily:"var(--f-theme-settings-heading3-font-family)",color:"var(--f-theme-settings-heading3-color)"},heading4:{fontSize:"var(--f-theme-settings-heading4-font-size)",lineHeight:"var(--f-theme-settings-heading4-line-height)",marginTop:"var(--f-theme-settings-heading4-margin-top)",marginBottom:"var(--f-theme-settings-heading4-margin-bottom)",textDecoration:"var(--f-theme-settings-heading4-text-decoration)",fontStyle:"var(--f-theme-settings-heading4-font-style)",textTransform:"var(--f-theme-settings-heading4-text-transform)",letterSpacing:"var(--f-theme-settings-heading4-letter-spacing)",fontWeight:"var(--f-theme-settings-heading4-font-weight)",fontFamily:"var(--f-theme-settings-heading4-font-family)",color:"var(--f-theme-settings-heading4-color)"},custom1:{fontSize:"var(--f-theme-settings-custom1-font-size)",lineHeight:"var(--f-theme-settings-custom1-line-height)",marginTop:"var(--f-theme-settings-custom1-margin-top)",marginBottom:"var(--f-theme-settings-custom1-margin-bottom)",textDecoration:"var(--f-theme-settings-custom1-text-decoration)",fontStyle:"var(--f-theme-settings-custom1-font-style)",textTransform:"var(--f-theme-settings-custom1-text-transform)",letterSpacing:"var(--f-theme-settings-custom1-letter-spacing)",fontWeight:"var(--f-theme-settings-custom1-font-weight)",fontFamily:"var(--f-theme-settings-custom1-font-family)",color:"var(--f-theme-settings-custom1-color)"},custom2:{fontSize:"var(--f-theme-settings-custom2-font-size)",lineHeight:"var(--f-theme-settings-custom2-line-height)",marginTop:"var(--f-theme-settings-custom2-margin-top)",marginBottom:"var(--f-theme-settings-custom2-margin-bottom)",textDecoration:"var(--f-theme-settings-custom2-text-decoration)",fontStyle:"var(--f-theme-settings-custom2-font-style)",textTransform:"var(--f-theme-settings-custom2-text-transform)",letterSpacing:"var(--f-theme-settings-custom2-letter-spacing)",fontWeight:"var(--f-theme-settings-custom2-font-weight)",fontFamily:"var(--f-theme-settings-custom2-font-family)",color:"var(--f-theme-settings-custom2-color)"},custom3:{fontSize:"var(--f-theme-settings-custom3-font-size)",lineHeight:"var(--f-theme-settings-custom3-line-height)",marginTop:"var(--f-theme-settings-custom3-margin-top)",marginBottom:"var(--f-theme-settings-custom3-margin-bottom)",textDecoration:"var(--f-theme-settings-custom3-text-decoration)",fontStyle:"var(--f-theme-settings-custom3-font-style)",textTransform:"var(--f-theme-settings-custom3-text-transform)",letterSpacing:"var(--f-theme-settings-custom3-letter-spacing)",fontWeight:"var(--f-theme-settings-custom3-font-weight)",fontFamily:"var(--f-theme-settings-custom3-font-family)",color:"var(--f-theme-settings-custom3-color)"},p:{fontSize:"var(--f-theme-settings-body-font-size)",lineHeight:"var(--f-theme-settings-body-line-height)",marginTop:"var(--f-theme-settings-body-margin-top)",marginBottom:"var(--f-theme-settings-body-margin-bottom)",textDecoration:"var(--f-theme-settings-body-text-decoration)",fontStyle:"var(--f-theme-settings-body-font-style)",textTransform:"var(--f-theme-settings-body-text-transform)",letterSpacing:"var(--f-theme-settings-body-letter-spacing)",fontWeight:"var(--f-theme-settings-body-font-weight)",fontFamily:"var(--f-theme-settings-body-font-family)",color:"var(--f-theme-settings-body-color)"},quote:{fontSize:"var(--f-theme-settings-quote-font-size)",lineHeight:"var(--f-theme-settings-quote-line-height)",marginTop:"var(--f-theme-settings-quote-margin-top)",marginBottom:"var(--f-theme-settings-quote-margin-bottom)",textDecoration:"var(--f-theme-settings-quote-text-decoration)",fontStyle:"var(--f-theme-settings-quote-font-style)",textTransform:"var(--f-theme-settings-quote-text-transform)",letterSpacing:"var(--f-theme-settings-quote-letter-spacing)",fontWeight:"var(--f-theme-settings-quote-font-weight)",fontFamily:"var(--f-theme-settings-quote-font-family)",color:"var(--f-theme-settings-quote-color)"},imageCaption:{fontSize:"var(--f-theme-settings-image-caption-font-size)",lineHeight:"var(--f-theme-settings-image-caption-line-height)",marginTop:"var(--f-theme-settings-image-caption-margin-top)",marginBottom:"var(--f-theme-settings-image-caption-margin-bottom)",textDecoration:"var(--f-theme-settings-image-caption-text-decoration)",fontStyle:"var(--f-theme-settings-image-caption-font-style)",textTransform:"var(--f-theme-settings-image-caption-text-transform)",letterSpacing:"var(--f-theme-settings-image-caption-letter-spacing)",fontWeight:"var(--f-theme-settings-image-caption-font-weight)",fontFamily:"var(--f-theme-settings-image-caption-font-family)",color:"var(--f-theme-settings-image-caption-color)"},imageTitle:{fontSize:"var(--f-theme-settings-image-title-font-size)",lineHeight:"var(--f-theme-settings-image-title-line-height)",marginTop:"var(--f-theme-settings-image-title-margin-top)",marginBottom:"var(--f-theme-settings-image-title-margin-bottom)",textDecoration:"var(--f-theme-settings-image-title-text-decoration)",fontStyle:"var(--f-theme-settings-image-title-font-style)",textTransform:"var(--f-theme-settings-image-title-text-transform)",letterSpacing:"var(--f-theme-settings-image-title-letter-spacing)",fontWeight:"var(--f-theme-settings-image-title-font-weight)",fontFamily:"var(--f-theme-settings-image-title-font-family)",color:"var(--f-theme-settings-image-title-color)"},[le]:{fontSize:"var(--f-theme-settings-link-font-size)",lineHeight:"var(--f-theme-settings-link-line-height)",marginTop:"var(--f-theme-settings-link-margin-top)",marginBottom:"var(--f-theme-settings-link-margin-bottom)",textDecoration:"var(--f-theme-settings-link-text-decoration)",fontStyle:"var(--f-theme-settings-link-font-style)",textTransform:"var(--f-theme-settings-link-text-transform)",letterSpacing:"var(--f-theme-settings-link-letter-spacing)",fontWeight:"var(--f-theme-settings-link-font-weight)",fontFamily:"var(--f-theme-settings-link-font-family)",color:"var(--f-theme-settings-link-color)"},...we},Mn=()=>{const e=Fn(),{state:t,onButtonStyleChange:n}=e;return s.jsx(ut,{...e,testId:"floating-button-insert",children:s.jsx("div",{className:"tw-pt-5",children:s.jsxs(i.FormControl,{label:{children:"Button Style",htmlFor:"buttonStyle",required:!0},children:[s.jsx(ye,{id:"primary",styles:T.buttonPrimary,isActive:t.buttonStyle==="primary",onClick:()=>n("primary"),children:t.text||"Primary Button"}),s.jsx(ye,{id:"secondary",styles:T.buttonSecondary,isActive:t.buttonStyle==="secondary",onClick:()=>n("secondary"),children:t.text||"Secondary Button"}),s.jsx(ye,{id:"tertiary",styles:T.buttonTertiary,isActive:t.buttonStyle==="tertiary",onClick:()=>n("tertiary"),children:t.text||"Tertiary Button"})]})})})},ye=({id:e,styles:t,isActive:n,onClick:r,children:a})=>{const[l,u]=x.useState(!1),d=()=>t&&t.hover&&l?{...t,...t.hover}:t;return s.jsx("button",{"data-test-id":`floating-button-insert-${e}`,onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),onClick:r,style:{...d(),marginTop:0,marginBottom:0},className:n?"tw-outline tw-outline-1 tw-outline-violet-60 tw-outline-offset-2 tw-w-fit":"tw-w-fit",children:a})},Dn=()=>{const e=ne().isEditing(),t=s.jsx(Mn,{}),n=e?t:s.jsx(Pn,{});return s.jsxs(s.Fragment,{children:[s.jsx(ce.InsertRoot,{children:t}),s.jsx(ce.EditRoot,{children:n})]})},C="button",dt="button-plugin",gt=e=>o.createPluginFactory({key:C,isElement:!0,isInline:!0,props:({element:t})=>({nodeProps:{href:t==null?void 0:t.url,target:t==null?void 0:t.target}}),withOverrides:tt,renderAfterEditable:Dn,options:{isUrl:he,rangeBeforeOptions:{matchString:" ",skipInvalid:!0,afterMatch:!0},triggerFloatingButtonHotkeys:"command+shift+k, ctrl+shift+k",appBridge:e},then:(t,{type:n})=>({deserializeHtml:{rules:[{validNodeName:"A",validClassName:"btn"}],getNode:r=>({type:n,url:r.getAttribute("href"),target:r.getAttribute("target")||"_blank"})}})})();class mt extends i.Plugin{constructor({styles:t=we,...n}){super(dt,{button:En,markupElement:new Cn,...n}),this.styles={},this.styles=t,this.appBridge=n==null?void 0:n.appBridge}plugins(){return[gt(this.appBridge)]}}const On=({floatingOptions:e,...t})=>{const n=o.useEditorRef(),r=o.usePlateSelectors(n.id).keyEditor(),a=ne().mode(),l=ne().isOpen(n.id),{triggerFloatingButtonHotkeys:u}=o.getPluginOptions(n,C),d=x.useCallback(()=>{const w=o.getAboveNode(n,{match:{type:o.getPluginType(n,C)}});if(w){const[,b]=w;return o.getRangeBoundingClientRect(n,{anchor:o.getStartPoint(n,b),focus:o.getEndPoint(n,b)})}return o.getDefaultBoundingClientRect()},[n]),c=l&&a==="edit",{update:m,style:f,floating:g}=ft({open:c,getBoundingClientRect:d,...e});return x.useEffect(()=>{const w=at(n);if(w&&I.url(w),n.selection&&o.someNode(n,{match:{type:o.getPluginType(n,C)}})){I.show("edit",n.id),m();return}B.mode()==="edit"&&I.hide()},[n,r,m]),o.useHotkeys(u,w=>{w.preventDefault(),B.mode()==="edit"&&fe(n)},{enableOnContentEditable:!0},[]),Gn(),ht(),{style:{...f,zIndex:1e3},...t,ref:o.useComposedRef(t.ref,g)}},Un=({floatingOptions:e,...t})=>{const n=o.useEditorRef(),r=Ve.useFocused(),a=ne().mode(),l=ne().isOpen(n.id),{triggerFloatingButtonHotkeys:u}=o.getPluginOptions(n,C);o.useHotkeys(u,f=>{f.preventDefault(),Ne(n,{focused:r})},{enableOnContentEditable:!0},[r]);const{update:d,style:c,floating:m}=ft({open:l&&a==="insert",getBoundingClientRect:o.getSelectionBoundingClientRect,whileElementsMounted:void 0,...e});return x.useEffect(()=>{l&&d(),I.updated(l)},[l,d]),ht(),{style:{...c,zIndex:1e3},...t,ref:o.useComposedRef(t.ref,m)}},Hn=e=>{const t=o.useEditorRef();return{onClick:x.useCallback(()=>{fe(t)},[t]),...e}},_n=o.createComponentAs(e=>{const t=Hn(e);return o.createElementAs("button",t)}),Vn=e=>{const t=o.useEditorRef();return{onClick:x.useCallback(()=>{se(t),o.focusEditor(t,t.selection??void 0)},[t]),...e}},zn=o.createComponentAs(e=>{const t=Vn(e);return o.createElementAs(o.Button,t)}),$n=o.createComponentAs(e=>{var n;const t=On(e);return((n=t.style)==null?void 0:n.display)==="none"?null:o.createElementAs("div",t)}),Wn=o.createComponentAs(e=>{var n;const t=Un(e);return((n=t.style)==null?void 0:n.display)==="none"?null:o.createElementAs("div",t)}),ce={EditRoot:$n,InsertRoot:Wn,EditButton:_n,UnlinkButton:zn},qn=e=>{const t=ne().updated(),n=x.useRef(null);x.useEffect(()=>{n.current&&t&&setTimeout(()=>{var a;(a=n.current)==null||a.focus()},0)},[t]);const r=x.useCallback(a=>{I.url(a.target.value)},[]);return o.mergeProps({onChange:r,defaultValue:B.url()},{...e,ref:o.useComposedRef(e.ref,n)})},Gn=()=>{const e=o.useEditorRef();o.useHotkeys("*",t=>{t.key==="Enter"&&Le(e)&&t.preventDefault()},{enableOnFormTags:["INPUT"]},[])},ht=()=>{const e=o.useEditorRef();o.useHotkeys("escape",()=>{if(B.mode()==="edit"){if(B.isEditing()){I.show("edit",e.id),o.focusEditor(e,e.selection??void 0);return}I.hide()}},{enableOnFormTags:["INPUT"],enableOnContentEditable:!0},[])},Kn=12,Xn=-22,Qn=96,ft=e=>o.useVirtualFloating({placement:"bottom-start",middleware:[o.offset({mainAxis:Kn,alignmentAxis:Xn}),o.flip({padding:Qn})],...e}),Yn=({id:e="rte",isEditing:t,value:n,columns:r,gap:a,placeholder:l,plugins:u,onTextChange:d,showSerializedText:c})=>{const[m,f]=x.useState(!1),g=w=>{d&&w!==n&&d(w),f(!1)};return x.useEffect(()=>{const w=b=>(b.preventDefault(),b.returnValue="Unprocessed changes");return m&&window.addEventListener("beforeunload",w),()=>window.removeEventListener("beforeunload",w)},[m]),t?s.jsx(i.RichTextEditor,{id:e,value:n,border:!1,placeholder:l,plugins:u,onValueChanged:()=>f(!0),onTextChange:g,hideExternalFloatingModals:w=>{B.isOpen(w)&&I.reset()}}):s.jsx(dn,{value:n,columns:r,gap:a,show:c,plugins:u})},Jn=({floatingOptions:e,...t})=>{const n=o.useEditorRef(),r=Ve.useFocused(),a=o.useFloatingLinkSelectors().mode(),l=o.useFloatingLinkSelectors().isOpen(n.id),{triggerFloatingLinkHotkeys:u}=o.getPluginOptions(n,o.ELEMENT_LINK);o.useHotkeys(u,f=>{o.triggerFloatingLinkInsert(n,{focused:r})&&f.preventDefault()},{enableOnContentEditable:!0},[r]);const{update:d,style:c,floating:m}=o.useVirtualFloatingLink({editorId:n.id,open:l&&a==="insert",getBoundingClientRect:o.getSelectionBoundingClientRect,whileElementsMounted:()=>{},...e});return x.useEffect(()=>{l?(d(),o.floatingLinkActions.updated(!0)):o.floatingLinkActions.updated(!1)},[l,d]),o.useFloatingLinkEscape(),{style:{...c,zIndex:1e3},...t,ref:o.useComposedRef(t.ref,m)}},Zn=o.createComponentAs(e=>{var n;const t=Jn({...e,floatingOptions:{strategy:"absolute"}});return((n=t.style)==null?void 0:n.display)==="none"?null:o.createElementAs("div",t)}),es=o.createComponentAs(e=>{var n;const t=ns({...e,floatingOptions:{strategy:"absolute"}});return((n=t.style)==null?void 0:n.display)==="none"?null:o.createElementAs("div",t)});o.FloatingLink.EditRoot=es;o.FloatingLink.InsertRoot=Zn;const ue=o.FloatingLink,ts=()=>{const e=o.useFloatingLinkUrlInput({});return s.jsx("div",{"data-test-id":"floating-link-edit",className:"tw-bg-white tw-text-text tw-rounded tw-shadow tw-p-4 tw-min-w-[400px]",children:s.jsxs("span",{"data-test-id":"preview-link-flyout",className:"tw-flex tw-justify-between tw-items-center",children:[s.jsx("span",{className:"tw-pointer-events-none",children:e.defaultValue}),s.jsxs("span",{className:"tw-flex tw-gap-2",children:[s.jsx("span",{role:"button",tabIndex:0,"data-test-id":"edit-link-button",className:"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1",children:s.jsx(ue.EditButton,{children:s.jsx(i.IconPen16,{})})}),s.jsx("span",{role:"button",tabIndex:0,"data-test-id":"remove-link-button",className:"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1",children:s.jsx(ue.UnlinkButton,{children:s.jsx(i.IconTrashBin16,{})})})]})]})})},ns=({floatingOptions:e,...t})=>{const n=o.useEditorRef(),r=o.usePlateSelectors().keyEditor(),a=o.useFloatingLinkSelectors().mode(),l=o.useFloatingLinkSelectors().isOpen(n.id),{triggerFloatingLinkHotkeys:u="command+k, ctrl+k"}=o.getPluginOptions(n,o.ELEMENT_LINK),d=x.useCallback(()=>{const w=o.getAboveNode(n,{match:{type:o.getPluginType(n,o.ELEMENT_LINK)}});if(w){const[,b]=w;return o.getRangeBoundingClientRect(n,{anchor:o.getStartPoint(n,b),focus:o.getEndPoint(n,b)})}return o.getDefaultBoundingClientRect()},[n]),c=l&&a==="edit",{update:m,style:f,floating:g}=o.useVirtualFloatingLink({editorId:n.id,open:c,getBoundingClientRect:d,...e});return x.useEffect(()=>{const w=et(n);if(w&&o.floatingLinkActions.url(w),n.selection&&o.someNode(n,{match:{type:o.getPluginType(n,o.ELEMENT_LINK)}})){o.floatingLinkActions.show("edit",n.id),m();return}o.floatingLinkSelectors.mode()==="edit"&&o.floatingLinkActions.hide()},[n,r,m]),o.useHotkeys(u,w=>{w.preventDefault(),o.floatingLinkSelectors.mode()==="edit"&&o.triggerFloatingLinkEdit(n)},{enableOnContentEditable:!0},[]),o.useFloatingLinkEnter(),o.useFloatingLinkEscape(),{style:{...f,zIndex:1e3},...t,ref:o.useComposedRef(t.ref,g)}},ss={url:"",text:"",newTab:i.CheckboxState.Unchecked},rs=()=>{const[e,t]=x.useReducer((n,r)=>{const{type:a,payload:l}=r;switch(a){case"NEW_TAB":return{...n,newTab:i.CheckboxState.Checked};case"SAME_TAB":return{...n,newTab:i.CheckboxState.Unchecked};case"URL":case"TEXT":case"INIT":return{...n,...l};default:return n}},ss);return[e,t]},as=()=>{const e=o.useEditorRef(),[t,n]=rs();x.useEffect(()=>{const f=Ye(e),g=Je(e);n({type:"INIT",payload:{text:o.floatingLinkSelectors.text(),newTab:o.floatingLinkSelectors.newTab()?i.CheckboxState.Checked:i.CheckboxState.Unchecked,url:f&&g===""?f:o.floatingLinkSelectors.url()}})},[n,e]);const r=f=>{n({type:"TEXT",payload:{text:f}})},a=f=>{n({type:"URL",payload:{url:f}})},l=f=>{n(f?{type:"NEW_TAB"}:{type:"SAME_TAB"})},u=()=>{o.floatingLinkActions.hide()},d=f=>{if(!te(t.url)||!c)return;const g=me(t.url);o.floatingLinkActions.text(t.text),o.floatingLinkActions.url(g),o.floatingLinkActions.newTab(t.newTab===i.CheckboxState.Checked),o.submitFloatingLink(e)&&(f==null||f.preventDefault())},c=t.url!==""&&t.text!=="",{appBridge:m}=o.getPluginOptions(e,o.ELEMENT_LINK);return o.useHotkeys("enter",d,{enableOnFormTags:["INPUT"]},[]),{state:t,onTextChange:r,onUrlChange:a,onToggleTab:l,onCancel:u,onSave:d,hasValues:c,isValidUrlOrEmpty:te,appBridge:m}},is=()=>s.jsx(ut,{...as(),testId:"floating-link-insert"}),os=({readOnly:e})=>{const t=o.useFloatingLinkSelectors().isEditing();if(e)return null;const n=s.jsx(is,{}),r=t?n:s.jsx(ts,{});return s.jsxs(s.Fragment,{children:[s.jsx(ue.InsertRoot,{children:n}),s.jsx(ue.EditRoot,{children:r})]})},ls=({id:e,editorId:t})=>{const n=o.usePlateEditorState(o.useEventPlateId(t)),r=!!o.isRangeInSameBlock(n,{at:n.selection});return s.jsx("div",{"data-plugin-id":e,children:s.jsx(o.LinkToolbarButton,{tooltip:i.getTooltip(r?`Link
3
- ${i.getHotkeyByPlatform("Ctrl+K")}`:"Links can only be set for a single text block."),icon:s.jsx("span",{className:"tw-p-2 tw-h-8 tw-justify-center tw-items-center tw-flex",children:s.jsx(i.IconLink,{size:i.IconSize.Size16})}),classNames:i.getButtonClassNames(r),styles:{root:{width:"24px",height:"24px"}},actionHandler:"onMouseDown"})})},cs=e=>({...o.useElementProps({...e,elementToAttributes:n=>{var r,a;return{href:n.url||((a=(r=n.chosenLink)==null?void 0:r.searchResult)==null?void 0:a.link)||"",target:n.target||"_self"}}}),onMouseOver:n=>{n.stopPropagation()}}),us=e=>{const t=cs(e),{attributes:n,children:r}=e;return s.jsx("a",{...n,href:t.href,target:t.target,style:T[le],children:r})};class ds extends i.MarkupElement{constructor(t=o.ELEMENT_LINK,n=us){super(t,n)}}const wt=e=>o.createPluginFactory({...o.createLinkPlugin(),renderAfterEditable:os,options:{isUrl:he,rangeBeforeOptions:{matchString:" ",skipInvalid:!0,afterMatch:!0},triggerFloatingLinkHotkeys:"command+k, ctrl+k",appBridge:e}})();class xt extends i.Plugin{constructor(t,n=T[le]){super(le,{button:ls,markupElement:new ds,...t}),this.styles={},this.styles=n,this.appBridge=t==null?void 0:t.appBridge}plugins(){return[wt(this.appBridge)]}}const gs="textstyle-custom1-plugin";class yt extends i.Plugin{constructor({styles:t=T.custom1,...n}={}){super(y.custom1,{label:"Custom 1",markupElement:new ms,...n}),this.styles={},this.styles=t}plugins(){return[hs(this.styles)]}}class ms extends i.MarkupElement{constructor(t=gs,n=pt){super(t,n)}}const pt=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("p",{...t,style:r,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),children:n})},hs=e=>o.createPluginFactory({key:y.custom1,isElement:!0,deserializeHtml:{rules:[{validClassName:y.custom1}]}})({component:t=>s.jsx(pt,{...t,styles:e})}),fs="textstyle-custom2-plugin";class bt extends i.Plugin{constructor({styles:t=T.custom2,...n}={}){super(y.custom2,{label:"Custom 2",markupElement:new ws,...n}),this.styles={},this.styles=t}plugins(){return[xs(this.styles)]}}class ws extends i.MarkupElement{constructor(t=fs,n=vt){super(t,n)}}const vt=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("p",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},xs=e=>o.createPluginFactory({key:y.custom2,isElement:!0,deserializeHtml:{rules:[{validClassName:y.custom2}]}})({component:t=>s.jsx(vt,{...t,styles:e})}),ys="textstyle-custom3-plugin";class kt extends i.Plugin{constructor({styles:t=T.custom3,...n}={}){super(i.TextStyles.custom3,{label:"Custom 3",markupElement:new ps,...n}),this.styles={},this.styles=t}plugins(){return[bs(this.styles)]}}class ps extends i.MarkupElement{constructor(t=ys,n=Ct){super(t,n)}}const Ct=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("p",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},bs=e=>o.createPluginFactory({key:i.TextStyles.custom3,isElement:!0,deserializeHtml:{rules:[{validClassName:i.TextStyles.custom3}]}})({component:t=>s.jsx(Ct,{...t,styles:e})}),vs="textstyle-heading1-plugin";class St extends i.Plugin{constructor({styles:t=T.heading1,...n}={}){super(y.heading1,{label:"Heading 1",markupElement:new ks,...n}),this.styles={},this.styles=t}plugins(){return[Cs(this.styles)]}}class ks extends i.MarkupElement{constructor(t=vs,n=pe){super(t,n)}}const pe=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("h1",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},Cs=e=>o.createPluginFactory({key:y.heading1,isElement:!0,component:pe,deserializeHtml:{rules:[{validNodeName:["h1","H1"]}]}})({component:t=>s.jsx(pe,{...t,styles:e})}),Ss="textstyle-heading2-plugin";class Et extends i.Plugin{constructor({styles:t=T.heading2,...n}={}){super(y.heading2,{label:"Heading 2",markupElement:new Es,...n}),this.styles={},this.styles=t}plugins(){return[Ps(this.styles)]}}class Es extends i.MarkupElement{constructor(t=Ss,n=be){super(t,n)}}const be=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("h2",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},Ps=e=>o.createPluginFactory({key:y.heading2,isElement:!0,component:be,deserializeHtml:{rules:[{validNodeName:["h2","H2"]}]}})({component:t=>s.jsx(be,{...t,styles:e})}),Is="textstyle-heading3-plugin";class Pt extends i.Plugin{constructor({styles:t=T.heading3,...n}={}){super(y.heading3,{label:"Heading 3",markupElement:new Ts,...n}),this.styles={},this.styles=t}plugins(){return[Bs(this.styles)]}}class Ts extends i.MarkupElement{constructor(t=Is,n=ve){super(t,n)}}const ve=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("h3",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},Bs=e=>o.createPluginFactory({key:y.heading3,isElement:!0,component:ve,deserializeHtml:{rules:[{validNodeName:["h3","H3"]}]}})({component:t=>s.jsx(ve,{...t,styles:e})}),Ls="textstyle-heading4-plugin";class It extends i.Plugin{constructor({styles:t=T.heading4,...n}={}){super(y.heading4,{label:"Heading 4",markupElement:new js,...n}),this.styles={},this.styles=t}plugins(){return[Ns(this.styles)]}}class js extends i.MarkupElement{constructor(t=Ls,n=ke){super(t,n)}}const ke=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("h4",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},Ns=e=>o.createPluginFactory({key:y.heading4,isElement:!0,component:ke,deserializeHtml:{rules:[{validNodeName:["h4","H4"]}]}})({component:t=>s.jsx(ke,{...t,styles:e})}),As="textstyle-imageCaption-plugin";class Tt extends i.Plugin{constructor({styles:t=T.imageCaption,...n}={}){super(y.imageCaption,{label:"Image Caption",markupElement:new Rs,...n}),this.styles={},this.styles=t}plugins(){return[Fs(this.styles)]}}class Rs extends i.MarkupElement{constructor(t=As,n=Ce){super(t,n)}}const Ce=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("p",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},Fs=e=>o.createPluginFactory({key:y.imageCaption,isElement:!0,component:Ce,deserializeHtml:{rules:[{validClassName:y.imageCaption}]}})({component:t=>s.jsx(Ce,{...t,styles:e})}),Ms="textstyle-imageTitle-plugin";class Bt extends i.Plugin{constructor({styles:t=T.imageTitle,...n}={}){super(y.imageTitle,{label:"Image Title",markupElement:new Ds,...n}),this.styles={},this.styles=t}plugins(){return[Os(this.styles)]}}class Ds extends i.MarkupElement{constructor(t=Ms,n=Se){super(t,n)}}const Se=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("p",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},Os=e=>o.createPluginFactory({key:y.imageTitle,isElement:!0,component:Se,deserializeHtml:{rules:[{validClassName:y.imageTitle}]}})({component:t=>s.jsx(Se,{...t,styles:e})});class Lt extends i.Plugin{constructor({styles:t=T.p,...n}={}){super(y.p,{markupElement:new Nt,label:"Body Text",...n}),this.styles={},this.styles=t}plugins(){return[At(this.styles)]}}const jt="tw-m-0 tw-px-0 tw-py-0",de=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align,l=i.merge([a&&i.alignmentClassnames[a],jt,i.getColumnBreakClasses(e)]);return s.jsx("p",{...t,className:l,style:r,children:n})};class Nt extends i.MarkupElement{constructor(t=y.p,n=de){super(t,n)}}const At=e=>o.createPluginFactory({...o.createParagraphPlugin(),key:y.p,isElement:!0,component:de})({component:t=>s.jsx(de,{...t,styles:e})}),Us="textstyle-quote-plugin";class Rt extends i.Plugin{constructor({styles:t=T.quote,...n}={}){super(y.quote,{label:"Quote",markupElement:new Hs,...n}),this.styles={},this.styles=t}plugins(){return[Ft(this.styles)]}}class Hs extends i.MarkupElement{constructor(t=Us,n=ge){super(t,n)}}const ge=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("blockquote",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},Ft=e=>o.createPluginFactory({key:y.quote,isElement:!0,component:ge,deserializeHtml:{rules:[{validNodeName:["blockquote","BLOCKQUOTE"]}]}})({component:t=>s.jsx(ge,{...t,styles:e})}),Ae=[new St,new Et,new Pt,new It,new yt,new bt,new kt,new Rt,new Lt],ee=[y.heading1,y.heading2,y.heading3,y.heading4,y.custom1,y.custom2,y.custom3,y.quote,y.p],_s=[...Ae,new Tt,new Bt],Vs=[...ee,y.imageCaption,y.imageTitle],zs=e=>new i.PluginComposer().setPlugin(new i.SoftBreakPlugin,new i.TextStylePlugin({textStyles:Ae})).setPlugin([new i.BoldPlugin,new i.ItalicPlugin,new i.UnderlinePlugin,new i.StrikethroughPlugin,new xt({appBridge:e}),new mt({appBridge:e}),new i.CodePlugin],[new i.AlignLeftPlugin({validTypes:ee}),new i.AlignCenterPlugin({validTypes:ee}),new i.AlignRightPlugin({validTypes:ee}),new i.AlignJustifyPlugin({validTypes:ee}),new i.UnorderedListPlugin,new i.CheckboxListPlugin,new i.OrderedListPlugin,new i.ResetFormattingPlugin]),$s="--f-theme-settings-",Ws=(e,t)=>{const{blockAssets:n,updateAssetIdsFromKey:r}=G.useBlockAssets(e),a=(n==null?void 0:n[t])||[];return{onAddAttachments:async m=>{const f=a.map(g=>g.id);for(const g of m)f.push(g.id);await r(t,f)},onAttachmentDelete:async m=>{const f=a.filter(g=>g.id!==m.id).map(g=>g.id);await r(t,f)},onAttachmentReplace:async(m,f)=>{const g=a.map(w=>w.id===m.id?f.id:w.id);await r(t,g)},onAttachmentsSorted:async m=>{const f=m.map(g=>g.id);await r(t,f)},attachments:a}},qs={start:["Space","Enter"],cancel:[],end:["Space","Enter","Escape"]},Gs=(e=0,t=0)=>{const n=Xe(e,t);return P.useSensors(P.useSensor(P.PointerSensor),P.useSensor(P.KeyboardSensor,{coordinateGetter:n,keyboardCodes:qs}))},Ks=e=>{const t=e!=null&&e.id?`hasBackground${e.id}`:"hasBackground",n=e!=null&&e.id?`backgroundColor${e.id}`:"backgroundColor",r=e!=null&&e.preventDefaultColor?void 0:(e==null?void 0:e.defaultColor)||en,a=e!=null&&e.switchLabel?e.switchLabel:void 0;return{id:t,label:"Background",type:"switch",switchLabel:a,defaultValue:!!(e!=null&&e.defaultValue),on:[{id:n,defaultValue:r,type:"colorInput"}]}},Xs=e=>{const t=e!=null&&e.id?`hasBorder_${e.id}`:"hasBorder",n=e!=null&&e.id?`borderSelection_${e.id}`:"borderSelection",r=e!=null&&e.id?`borderStyle_${e.id}`:"borderStyle",a=e!=null&&e.id?`borderWidth_${e.id}`:"borderWidth",l=e!=null&&e.id?`borderColor_${e.id}`:"borderColor",u=(e==null?void 0:e.defaultColor)||We,d=e!=null&&e.switchLabel?e.switchLabel:void 0;return{id:t,label:"Border",type:"switch",switchLabel:d,defaultValue:!!(e!=null&&e.defaultValue),on:[{id:n,type:"multiInput",onChange:c=>h.appendUnit(c,a),layout:h.MultiInputLayout.Columns,lastItemFullWidth:!0,blocks:[{id:r,type:"dropdown",defaultValue:M.Solid,choices:[{value:M.Solid,label:M.Solid},{value:M.Dotted,label:M.Dotted},{value:M.Dashed,label:M.Dashed}]},{id:a,type:"input",defaultValue:tn,rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)],placeholder:"e.g. 3px"},{id:l,type:"colorInput",defaultValue:u}]}],off:[]}},Re=(e,t=H.None)=>({id:e,type:"segmentedControls",defaultValue:t,choices:[{value:H.None,label:"None"},{value:H.Small,label:"S"},{value:H.Medium,label:"M"},{value:H.Large,label:"L"}]}),Qs=e=>{const t=e!=null&&e.id?`hasRadius_${e.id}`:"hasRadius",n=e!=null&&e.id?`radiusValue_${e.id}`:"radiusValue",r=e!=null&&e.id?`radiusChoice_${e.id}`:"radiusChoice",a=(e==null?void 0:e.defaultRadius)||H.None;return{id:t,label:"Corner radius",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"Determining how rounded the corners are.",show:l=>{var u;return e!=null&&e.dependentSettingId?!!((u=l.getBlock(e.dependentSettingId))!=null&&u.value):!0},onChange:l=>h.presetCustomValue(l,r,n,(e==null?void 0:e.radiusStyleMap)||W),on:[{id:n,type:"input",placeholder:"e.g. 10px",rules:[h.numericalOrPixelRule],onChange:l=>h.appendUnit(l,n)}],off:[Re(r,a)]}},Ys=e=>{const t=e!=null&&e.id?`hasExtendedCustomRadius_${e.id}`:"hasExtendedCustomRadius",n=e!=null&&e.id?`extendedRadiusValue_${e.id}`:"extendedRadiusValue",r=e!=null&&e.id?`extendedRadiusChoice_${e.id}`:"extendedRadiusChoice",a=e!=null&&e.id?`extendedRadiusTopLeft_${e.id}`:"extendedRadiusTopLeft",l=e!=null&&e.id?`extendedRadiusTopRight_${e.id}`:"extendedRadiusTopRight",u=e!=null&&e.id?`extendedRadiusBottomLeft_${e.id}`:"extendedRadiusBottomLeft",d=e!=null&&e.id?`extendedRadiusBottomRight_${e.id}`:"extendedRadiusBottomRight";return{id:t,label:"Corner radius",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"Determining how rounded the corners are.",show:c=>{var m;return e!=null&&e.dependentSettingId?!!((m=c.getBlock(e.dependentSettingId))!=null&&m.value):!0},onChange:c=>{h.presetCustomValue(c,r,a,W),h.presetCustomValue(c,r,l,W),h.presetCustomValue(c,r,u,W),h.presetCustomValue(c,r,d,W)},on:[{id:n,type:"multiInput",layout:h.MultiInputLayout.Columns,blocks:[{id:a,type:"input",label:"Top Left",rules:[h.numericalOrPixelRule],onChange:c=>h.appendUnit(c,a)},{id:l,type:"input",label:"Top Right",rules:[h.numericalOrPixelRule],onChange:c=>h.appendUnit(c,l)},{id:u,type:"input",label:"Bottom Left",rules:[h.numericalOrPixelRule],onChange:c=>h.appendUnit(c,u)},{id:d,type:"input",label:"Bottom Right",rules:[h.numericalOrPixelRule],onChange:c=>h.appendUnit(c,d)}]}],off:[Re(r,e==null?void 0:e.defaultValue)]}},Js=e=>{const t=e!=null&&e.id?e.id:"hasCustomSpacing",n=e!=null&&e.dependentSettingId?e.dependentSettingId:"columns",r=e!=null&&e.spacingChoiceId?e.spacingChoiceId:"spacingChoice",a=e!=null&&e.spacingCustomId?e.spacingCustomId:"spacingCustom",l=e!=null&&e.defaultValueChoices?e.defaultValueChoices:$.M;return{id:t,type:"switch",defaultValue:!1,switchLabel:"Custom",label:"Gutter",info:"An official nerds term for ‘gap’",onChange:u=>h.presetCustomValue(u,r,a,$e),show:u=>{var d;return((d=u.getBlock(n))==null?void 0:d.value)!=="1"},on:[{id:a,type:"input",rules:[h.numericalOrPixelRule],onChange:u=>h.appendUnit(u,a)}],off:[{id:r,type:"slider",defaultValue:l,choices:[{value:$.Auto,label:"Auto"},{value:$.S,label:"S"},{value:$.M,label:"M"},{value:$.L,label:"L"}]}]}},Fe=e=>({id:e,type:"segmentedControls",defaultValue:z.None,choices:[{value:z.None,label:"None"},{value:z.Small,label:"S"},{value:z.Medium,label:"M"},{value:z.Large,label:"L"}]}),Zs=e=>{const t=e!=null&&e.id?`hasCustomMarginValue_${e==null?void 0:e.id}`:"hasCustomMarginValue",n=e!=null&&e.id?`marginValue_${e==null?void 0:e.id}`:"marginValue",r=e!=null&&e.id?`marginChoice_${e==null?void 0:e.id}`:"marginChoice";return{id:t,label:"Margin",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more space",onChange:a=>h.presetCustomValue(a,r,n,(e==null?void 0:e.marginStyleMap)||Z),on:[{id:n,type:"input",placeholder:ie,rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)],onChange:a=>h.appendUnit(a,n)}],off:[Fe(r)]}},er=e=>{const t=e!=null&&e.id?`hasExtendedCustomMargin_${e==null?void 0:e.id}`:"hasExtendedCustomMargin",n=e!=null&&e.id?`extendedMarginValues_${e==null?void 0:e.id}`:"extendedMarginValues",r=e!=null&&e.id?`extendedMarginChoice_${e==null?void 0:e.id}`:"extendedMarginChoice",a=e!=null&&e.id?`extendedMarginTop_${e==null?void 0:e.id}`:"extendedMarginTop",l=e!=null&&e.id?`extendedMarginLeft_${e==null?void 0:e.id}`:"extendedMarginLeft",u=e!=null&&e.id?`extendedMarginRight_${e==null?void 0:e.id}`:"extendedMarginRight",d=e!=null&&e.id?`extendedMarginBottom_${e==null?void 0:e.id}`:"extendedMarginBottom";return{id:t,label:"Margin",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more negative space",onChange:c=>{h.presetCustomValue(c,r,a,Z),h.presetCustomValue(c,r,l,Z),h.presetCustomValue(c,r,u,Z),h.presetCustomValue(c,r,d,Z)},on:[{id:n,type:"multiInput",layout:h.MultiInputLayout.Spider,blocks:[{id:a,type:"input",label:"Top",placeholder:ie,onChange:c=>h.appendUnit(c,a),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:l,type:"input",label:"Left",placeholder:ie,onChange:c=>h.appendUnit(c,l),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:u,type:"input",label:"Right",placeholder:ie,onChange:c=>h.appendUnit(c,u),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:d,type:"input",label:"Bottom",placeholder:ie,onChange:c=>h.appendUnit(c,d),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]}]}],off:[Fe(r)]}},Me=e=>({id:e,type:"segmentedControls",defaultValue:V.Small,choices:[{value:V.None,label:"None"},{value:V.Small,label:"S"},{value:V.Medium,label:"M"},{value:V.Large,label:"L"}]}),tr=e=>{const t=e!=null&&e.id?`hasCustomPaddingValue_${e==null?void 0:e.id}`:"hasCustomPaddingValue",n=e!=null&&e.id?`paddingValue_${e==null?void 0:e.id}`:"paddingValue",r=e!=null&&e.id?`paddingChoice_${e==null?void 0:e.id}`:"paddingChoice";return{id:t,label:"Padding",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more negative space",onChange:a=>h.presetCustomValue(a,r,n,(e==null?void 0:e.paddingStyleMap)||J),on:[{id:n,type:"input",placeholder:ae,rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)],onChange:a=>h.appendUnit(a,n)}],off:[Me(r)]}},nr=e=>{const t=e!=null&&e.id?`hasExtendedCustomPadding_${e==null?void 0:e.id}`:"hasExtendedCustomPadding",n=e!=null&&e.id?`extendedPaddingValues_${e==null?void 0:e.id}`:"extendedPaddingValues",r=e!=null&&e.id?`extendedPaddingChoice_${e==null?void 0:e.id}`:"extendedPaddingChoice",a=e!=null&&e.id?`extendedPaddingTop_${e==null?void 0:e.id}`:"extendedPaddingTop",l=e!=null&&e.id?`extendedPaddingLeft_${e==null?void 0:e.id}`:"extendedPaddingLeft",u=e!=null&&e.id?`extendedPaddingRight_${e==null?void 0:e.id}`:"extendedPaddingRight",d=e!=null&&e.id?`extendedPaddingBottom_${e==null?void 0:e.id}`:"extendedPaddingBottom";return{id:t,label:"Padding",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more negative space",onChange:c=>{h.presetCustomValue(c,r,a,J),h.presetCustomValue(c,r,l,J),h.presetCustomValue(c,r,u,J),h.presetCustomValue(c,r,d,J)},on:[{id:n,type:"multiInput",layout:h.MultiInputLayout.Spider,blocks:[{id:a,type:"input",label:"Top",placeholder:ae,onChange:c=>h.appendUnit(c,a),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:l,type:"input",label:"Left",placeholder:ae,onChange:c=>h.appendUnit(c,l),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:u,type:"input",label:"Right",placeholder:ae,onChange:c=>h.appendUnit(c,u),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:d,type:"input",label:"Bottom",placeholder:ae,onChange:c=>h.appendUnit(c,d),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]}]}],off:[Me(r)]}},sr=e=>{const t=De(e==null?void 0:e.globalControlId);return{id:e!=null&&e.id?e.id:"downloadable",type:"switch",defaultValue:!1,label:"Downloadable",show:n=>{var r;return((r=n.getBlock(t))==null?void 0:r.value)===q.Custom}}},De=e=>e||"security",rr=e=>[{id:De(e),type:"segmentedControls",defaultValue:q.Global,choices:[{value:q.Global,label:"Global Settings"},{value:q.Custom,label:"Custom"}]},{id:"globalSettingsInfo",type:"notification",footer:h.createFooter({label:"Change global settings [here].",replace:{here:{event:"general-settings.open"}}})}];var Mt=(e=>(e.Main="main",e.Basics="basics",e.Layout="layout",e.Style="style",e.Security="security",e.Targets="targets",e))(Mt||{});const ar=e=>e,ir=e=>e;exports.AllTextStylePlugins=_s;exports.AllTextStyles=Vs;exports.Attachments=cn;exports.BUTTON_PLUGIN=dt;exports.BlockButtonStyles=we;exports.BlockInjectButton=$t;exports.BlockItemWrapper=an;exports.BlockStyles=T;exports.BorderStyle=M;exports.ButtonPlugin=mt;exports.Custom1Plugin=yt;exports.Custom2Plugin=bt;exports.Custom3Plugin=kt;exports.DEFAULT_DRAGGING_TOOLTIP=Ge;exports.DEFAULT_DRAG_TOOLTIP=qe;exports.DownloadButton=un;exports.ELEMENT_BUTTON=C;exports.GutterSpacing=$;exports.Heading1Plugin=St;exports.Heading2Plugin=Et;exports.Heading3Plugin=Pt;exports.Heading4Plugin=It;exports.ImageCaptionPlugin=Tt;exports.ImageTitlePlugin=Bt;exports.LinkInput=ct;exports.LinkPlugin=xt;exports.LinkSelector=lt;exports.Margin=z;exports.PARAGRAPH_CLASSES=jt;exports.Padding=V;exports.ParagraphMarkupElement=Nt;exports.ParagraphMarkupElementNode=de;exports.ParagraphPlugin=Lt;exports.QuoteMarkupElementNode=ge;exports.QuotePlugin=Rt;exports.Radius=H;exports.RichTextEditor=Yn;exports.Sections=Mt;exports.Security=q;exports.THEME_PREFIX=$s;exports.TextStylePluginsWithoutImage=Ae;exports.TextStyles=y;exports.TextStylesWithoutImage=ee;exports.addHttps=me;exports.borderStyleMap=ze;exports.convertToRteValue=gn;exports.createButtonNode=it;exports.createButtonPlugin=gt;exports.createLinkPlugin=wt;exports.createParagraphPlugin=At;exports.createQuotePlugin=Ft;exports.customCoordinatesGetterFactory=Xe;exports.defineBlock=ar;exports.defineSettings=ir;exports.getBackgroundColorStyles=Zt;exports.getBackgroundSettings=Ks;exports.getBorderRadiusSettings=Qs;exports.getBorderRadiusSlider=Re;exports.getBorderSettings=Xs;exports.getBorderStyles=nn;exports.getDefaultPluginsWithLinkChooser=zs;exports.getExtendedBorderRadiusSettings=Ys;exports.getGutterSettings=Js;exports.getLegacyUrl=Ye;exports.getLinkFromEditor=et;exports.getMarginExtendedSettings=er;exports.getMarginSettings=Zs;exports.getMarginSlider=Fe;exports.getPaddingExtendedSettings=nr;exports.getPaddingSettings=tr;exports.getPaddingSlider=Me;exports.getRadiusStyles=sn;exports.getReadableColor=Yt;exports.getSecurityDownloadableSetting=sr;exports.getSecurityGlobalControlId=De;exports.getSecurityGlobalControlSetting=rr;exports.getUrl=Je;exports.getUrlFromEditor=at;exports.getUrlFromLinkOrLegacyLink=Ze;exports.gutterSpacingStyleMap=$e;exports.hasRichTextValue=Ke;exports.insertButton=nt;exports.isDark=qt;exports.isDownloadable=hn;exports.isValidUrl=he;exports.isValidUrlOrEmpty=te;exports.joinClassNames=D;exports.mapAppBridgeColorPaletteToFonduePalette=Qe;exports.mapAppBridgeColorPalettesToFonduePalettes=fn;exports.marginStyleMap=Z;exports.moveItemInArray=Jt;exports.paddingStyleMap=J;exports.radiusStyleMap=W;exports.relativeUrlRegex=Te;exports.setAlpha=Xt;exports.submitFloatingButton=Le;exports.toColorObject=Qt;exports.toHex8String=Gt;exports.toHexString=Kt;exports.toRgbaString=Ee;exports.toShortRgba=K;exports.triggerFloatingButton=ot;exports.triggerFloatingButtonEdit=fe;exports.triggerFloatingButtonInsert=Ne;exports.unwrapButton=se;exports.upsertButton=st;exports.upsertButtonText=je;exports.useAttachments=Ws;exports.useDndSensors=Gs;exports.withButton=tt;exports.wrapButton=rt;Object.keys(h).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>h[e]})});
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("@frontify/sidebar-settings"),s=require("react/jsx-runtime"),i=require("@frontify/fondue"),x=require("react"),G=require("@frontify/app-bridge"),P=require("@dnd-kit/core"),oe=require("@dnd-kit/sortable"),_e=require("@react-aria/focus"),Vt=require("@dnd-kit/modifiers"),o=require("@udecode/plate"),Ve=require("slate-react"),zt=require("@react-stately/overlays"),$t=require("slate"),U=require("@ctrl/tinycolor");const D=e=>e.filter(Boolean).join(" "),Wt=({onDrop:e,label:t,icon:n,secondaryLabel:r,isLoading:a,fillParentContainer:l,onAssetChooseClick:u,onUploadClick:d,withMenu:c=!0,onClick:m,validFileType:f,verticalLayout:g})=>{const[w,b]=x.useState(!1),[p,S]=x.useState(),L=x.useRef(null),[E,N]=x.useState(void 0),O=k=>{if(k.preventDefault(),b(!1),!X(k.dataTransfer.files)){N("Invalid"),setTimeout(()=>{N(void 0)},1e3);return}e==null||e(k.dataTransfer.files)},X=k=>{if(!f)return!0;for(let j=0;j<k.length;j++){const A=k[j].name.split(".").pop()??"";if(!G.FileExtensionSets[f].includes(A))return!1}return!0},F=k=>{if(!L.current||a)return;const{left:j,top:A}=L.current.getBoundingClientRect(),Q=k.clientX-j,re=k.clientY-A;S([Q,re])};return s.jsxs("button",{ref:L,"data-test-id":"block-inject-button",className:D(["tw-font-body tw-relative tw-text-sm tw-leading-4 tw-border tw-flex tw-items-center tw-justify-center tw-cursor-pointer tw-gap-3 tw-w-full first:tw-rounded-tl last:tw-rounded-br",g?"[&:not(:first-child)]:tw-border-t-0 first:tw-rounded-tr last:tw-rounded-bl":"[&:not(:first-child)]:tw-border-l-0 first:tw-rounded-bl last:tw-rounded-tr",l?"tw-h-full":"tw-h-[72px]",w&&!a?"tw-border-dashed":"tw-border-solid",p&&"tw-bg-blank-state-pressed-inverse",w&&"tw-bg-blank-state-weak-inverse",E?"!tw-border-red-50 !tw-cursor-not-allowed":" tw-border-blank-state-line",a||p||w||E?"":"tw-text-text-weak hover:tw-text-blank-state-hover hover:tw-bg-blank-state-hover-inverse hover:tw-border-blank-state-line-hover active:tw-text-blank-state-pressed active:tw-bg-blank-state-pressed-inverse active:tw-border-blank-state-line-hover",(w||p)&&!E?"[&>*]:tw-pointer-events-none tw-border-blank-state-line-hover":"tw-bg-blank-state-shaded-inverse tw-text-blank-state-shaded"]),onDragEnter:e?k=>{var j;if(b(!0),f==="Images")for(const A of Array.from(k.dataTransfer.items))(j=A==null?void 0:A.type)!=null&&j.startsWith("image/")?N(void 0):N("Invalid")}:void 0,onDragLeave:e?()=>{b(!1),N(void 0)}:void 0,onDrop:e?O:void 0,onClick:k=>{c&&F(k),m==null||m()},children:[a?s.jsx(i.LoadingCircle,{}):E?s.jsxs("div",{className:" tw-flex tw-items-center tw-justify-center tw-text-red-60 tw-font-medium",children:[s.jsx(i.IconExclamationMarkTriangle,{}),E]}):s.jsxs(s.Fragment,{children:[n&&s.jsx("div",{children:n}),(t||r)&&s.jsxs("div",{className:"tw-flex tw-flex-col tw-items-start",children:[t&&s.jsx("div",{className:"tw-font-medium",children:t}),r&&s.jsx("div",{className:"tw-font-normal",children:r})]})]}),p&&s.jsx("div",{className:"tw-absolute tw-left-0 tw-top-full tw-z-20",style:{left:p[0],top:p[1]},children:s.jsx(i.Flyout,{onOpenChange:k=>!k&&S(void 0),isOpen:!0,fitContent:!0,hug:!1,legacyFooter:!1,trigger:s.jsx("div",{}),children:s.jsx(i.ActionMenu,{menuBlocks:[{id:"menu",menuItems:[...d?[{id:"upload",size:i.MenuItemContentSize.XSmall,title:"Upload asset",onClick:()=>{d(),S(void 0)},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:s.jsx(i.IconArrowCircleUp20,{})})}]:[],...u?[{id:"asset",size:i.MenuItemContentSize.XSmall,title:"Browse asset",onClick:()=>{u(),S(void 0)},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:s.jsx(i.IconImageStack20,{})})}]:[]]}]})})})]})},K=e=>{const t=r=>typeof r=="object"&&["red","green","blue"].every(l=>r.hasOwnProperty(l)),n=r=>{const a=typeof r.alpha=="number"?r.alpha:1;return{r:r.red,g:r.green,b:r.blue,a}};return t(e)?n(e):e},qt=e=>typeof e=="object"&&["red","green","blue"].every(n=>e==null?void 0:e.hasOwnProperty(n)),Gt=(e,t)=>{const n=qt(e)?K(e):e,r=new U.TinyColor(n);return t?r.getBrightness()<t:r.isDark()||r.getAlpha()>.25&&r.getAlpha()<1},Kt=e=>new U.TinyColor(K(e)).toHex8String(),Xt=e=>new U.TinyColor(K(e)).toHexString(),Ee=e=>new U.TinyColor(K(e)).toRgbString(),Qt=(e,t)=>new U.TinyColor(t).setAlpha(e).toRgbString(),Yt=e=>{const{r:t,g:n,b:r,a}=new U.TinyColor(e);return{red:t,green:n,blue:r,alpha:a}},He=e=>typeof e=="object"&&["red","green","blue"].every(n=>e==null?void 0:e.hasOwnProperty(n)),Jt=(e,t)=>{const n=He(e)?K(e):e,r=He(t)?K(t):t;let a=new U.TinyColor(n);const l=new U.TinyColor(r);for(;U.readability(a,l)<4.5;)a=a.darken(1);return a.toRgbString()},Zt=(e,t,n)=>{const r=[...e],a=n<0?r.length+n:n;if(a>=0&&a<r.length){const l=r.splice(t,1)[0];r.splice(a,0,l)}return r},en=e=>({backgroundColor:Ee(e)});var M=(e=>(e.Solid="Solid",e.Dashed="Dashed",e.Dotted="Dotted",e))(M||{});const ze={Solid:"solid",Dotted:"dotted",Dashed:"dashed"};var H=(e=>(e.None="None",e.Small="Small",e.Medium="Medium",e.Large="Large",e))(H||{});const W={None:"0px",Small:"2px",Medium:"4px",Large:"12px"};var V=(e=>(e.None="None",e.Small="Small",e.Medium="Medium",e.Large="Large",e))(V||{});const J={None:"0px",Small:"24px",Medium:"36px",Large:"60px"};var z=(e=>(e.None="None",e.Small="Small",e.Medium="Medium",e.Large="Large",e))(z||{});const Z={None:"0px",Small:"24px",Medium:"36px",Large:"60px"};var q=(e=>(e.Global="Global",e.Custom="Custom",e))(q||{}),$=(e=>(e.Auto="Auto",e.S="S",e.M="M",e.L="L",e))($||{});const $e={Auto:"4px",S:"10px",M:"30px",L:"50px"},tn={red:241,green:241,blue:241,alpha:1},We={red:234,green:235,blue:235,alpha:1},nn="1px",ae="24px",ie="24px",sn=(e=M.Solid,t="1px",n=We)=>({borderStyle:ze[e],borderWidth:t,borderColor:Ee(n)}),rn=(e,t=!1,n)=>({borderRadius:t?n:W[e]}),qe="Drag or press ↵ to move",Ge="Move with ↑↓←→ and confirm with ↵",an=({items:e,flyoutItems:t,isFlyoutOpen:n,setIsFlyoutOpen:r,isDragging:a,isFlyoutDisabled:l})=>s.jsx("div",{"data-test-id":"block-item-wrapper-toolbar",className:"tw-flex tw-justify-end",children:s.jsxs("div",{className:"tw-bg-white tw-isolate tw-text-box-selected-inverse tw-pointer-events-auto tw-flex tw-flex-shrink-0 tw-gap-[2px] tw-px-[1px] tw-spacing tw-items-center tw-h-7 tw-self-start tw-border tw-border-box-selected-inverse tw-rounded",children:[e.map((u,d)=>"draggableProps"in u?s.jsx(i.LegacyTooltip,{withArrow:!0,hoverDelay:0,enterDelay:300,open:a,position:i.TooltipPosition.Top,content:s.jsx("div",{children:a?Ge:u.tooltip??qe}),triggerElement:s.jsx("button",{ref:u.setActivatorNodeRef,"data-test-id":"block-item-wrapper-toolbar-btn",...u.draggableProps,className:D(["tw-bg-base tw-inline-flex tw-items-center tw-justify-center tw-w-6 tw-h-6 tw-rounded-sm",a?"tw-cursor-grabbing tw-bg-box-selected-pressed":"tw-cursor-grab hover:tw-bg-box-selected-hover"]),children:u.icon})},d):s.jsx(i.LegacyTooltip,{withArrow:!0,enterDelay:300,hoverDelay:0,disabled:a,position:i.TooltipPosition.Top,content:s.jsx("div",{children:u.tooltip??""}),triggerElement:s.jsx("button",{"data-test-id":"block-item-wrapper-toolbar-btn",onClick:u.onClick,className:D(["tw-bg-base tw-relative hover:tw-bg-box-selected-hover active:tw-bg-box-selected-pressed tw-cursor-pointer tw-inline-flex tw-items-center tw-justify-center tw-w-6 tw-h-6 tw-rounded-sm focus-visible:tw-z-10",i.FOCUS_VISIBLE_STYLE]),children:u.icon})},d)),t.length>0&&s.jsx("div",{className:"tw-flex tw-flex-shrink-0 tw-flex-1 tw-h-6 tw-relative",children:s.jsx(i.Flyout,{isOpen:n&&!a,isTriggerDisabled:l,legacyFooter:!1,fitContent:!0,hug:!1,onOpenChange:r,trigger:s.jsx(i.LegacyTooltip,{withArrow:!0,hoverDelay:0,enterDelay:300,disabled:a,position:i.TooltipPosition.Top,content:s.jsx("div",{children:"Options"}),triggerElement:s.jsx("div",{"data-test-id":"block-item-wrapper-toolbar-flyout",className:"tw-bg-base hover:tw-bg-box-selected-hover active:tw-bg-box-selected-pressed tw-cursor-pointer tw-inline-flex tw-items-center tw-justify-center tw-w-6 tw-h-6 tw-rounded-sm tw-relative",children:s.jsx(i.IconDotsHorizontal16,{})})}),children:s.jsx(i.ActionMenu,{menuBlocks:t.map((u,d)=>({id:d.toString(),menuItems:u.map((c,m)=>({id:d.toString()+m.toString(),size:i.MenuItemContentSize.XSmall,title:c.title,style:c.style,onClick:()=>{r(!1),c.onClick()},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:c.icon})}))}))})})})]})}),on=({children:e,toolbarFlyoutItems:t,toolbarItems:n,shouldHideWrapper:r,shouldHideComponent:a=!1,isDragging:l,shouldFillContainer:u,outlineOffset:d=2,shouldBeShown:c=!1})=>{const[m,f]=x.useState(c),[g,w]=x.useState(!1),b=x.useRef(null);if(x.useEffect(()=>{m||w(!0)},[m]),r)return s.jsx(s.Fragment,{children:e});const p=n==null?void 0:n.filter(S=>S!==void 0);return s.jsxs("div",{ref:b,onFocus:()=>w(!1),onPointerEnter:()=>w(!1),"data-test-id":"block-item-wrapper",style:{outlineOffset:d},className:D(["tw-relative tw-group tw-outline-1 tw-outline-box-selected-inverse",u&&"tw-flex-1 tw-h-full tw-w-full","hover:tw-outline focus-within:tw-outline",(m||c)&&"tw-outline",a&&"tw-opacity-0"]),children:[s.jsx("div",{style:{right:-1-d,bottom:`calc(100% - ${2+d}px)`},className:D(["tw-pointer-events-none tw-absolute tw-bottom-[calc(100%-4px)] tw-right-[-3px] tw-w-full tw-opacity-0 tw-z-[60]","group-hover:tw-opacity-100 group-focus:tw-opacity-100 focus-within:tw-opacity-100",(m||c)&&"tw-opacity-100"]),children:s.jsx(an,{isFlyoutOpen:m,isFlyoutDisabled:g,setIsFlyoutOpen:f,flyoutItems:t,items:p,isDragging:l})}),e]})},ln=e=>e==="IMAGE"?s.jsx(i.IconImage24,{}):e==="VIDEO"?s.jsx(i.IconPlayFrame24,{}):e==="AUDIO"?s.jsx(i.IconMusicNote24,{}):s.jsx(i.IconDocument24,{}),Pe=x.forwardRef(({item:e,isEditing:t,draggableProps:n,transformStyle:r,isDragging:a,isOverlay:l,isLoading:u,onDelete:d,onReplaceWithBrowse:c,onReplaceWithUpload:m},f)=>{const[g,w]=x.useState(),[b,{selectedFiles:p}]=G.useFileInput({multiple:!0,accept:"image/*"}),[S,{results:L,doneAll:E}]=G.useAssetUpload(),{focusProps:N,isFocusVisible:O}=_e.useFocusRing();x.useEffect(()=>{p&&S(p[0])},[p]),x.useEffect(()=>{E&&m(L[0])},[E,L]);const X=(k,j)=>{fetch(k).then(A=>{A.blob().then(Q=>{const re=URL.createObjectURL(Q),Y=document.createElement("a");Y.href=re,Y.download=j,Y.click()})})},F=u||p&&!E;return s.jsxs("button",{"aria-label":"Download attachment","data-test-id":"attachments-item",onClick:()=>X(e.genericUrl,e.fileName),ref:f,style:{...r,opacity:a&&!l?.3:1,fontFamily:"var(-f-theme-settings-body-font-family)"},className:D(["tw-cursor-pointer tw-text-left tw-w-full tw-relative tw-flex tw-gap-3 tw-px-5 tw-py-3 tw-items-center tw-group hover:tw-bg-box-neutral-hover",a?"tw-bg-box-neutral-hover":""]),children:[s.jsx("div",{className:"tw-text-text-weak group-hover:tw-text-box-neutral-inverse-hover",children:F?s.jsx(i.LoadingCircle,{size:i.LoadingCircleSize.Small}):ln(e.objectType)}),s.jsxs("div",{className:"tw-text-s tw-flex-1 tw-min-w-0",children:[s.jsx("div",{className:"tw-whitespace-nowrap tw-overflow-hidden tw-text-ellipsis tw-font-bold tw-text-text-weak group-hover:tw-text-box-neutral-inverse-hover",children:e.title}),s.jsx("div",{className:"tw-text-text-weak",children:`${e.fileSizeHumanReadable} - ${e.extension}`})]}),t&&s.jsxs("div",{"data-test-id":"attachments-actionbar",className:D(["tw-flex tw-gap-0.5 group-focus:tw-opacity-100 focus-visible:tw-opacity-100 focus-within:tw-opacity-100 group-hover:tw-opacity-100",l||(g==null?void 0:g.id)===e.id?"tw-opacity-100":"tw-opacity-0"]),children:[s.jsx("button",{...N,...n,"aria-label":"Drag attachment",className:D([" tw-border-button-border tw-bg-button-background active:tw-bg-button-background-pressed tw-group tw-border tw-box-box tw-relative tw-flex tw-items-center tw-justify-center tw-outline-none tw-font-medium tw-rounded tw-h-9 tw-w-9 ",a||l?"tw-cursor-grabbing tw-bg-button-background-pressed hover:tw-bg-button-background-pressed":"tw-cursor-grab hover:tw-bg-button-background-hover",O&&i.FOCUS_STYLE,O&&"tw-z-[2]"]),children:s.jsx(i.IconGrabHandle20,{})}),s.jsx("div",{"data-test-id":"attachments-actionbar-flyout",children:s.jsx(i.Flyout,{placement:i.FlyoutPlacement.Right,isOpen:(g==null?void 0:g.id)===e.id,fitContent:!0,legacyFooter:!1,onOpenChange:k=>w(k?e:void 0),trigger:(k,j)=>s.jsx(i.Button,{ref:j,icon:s.jsx(i.IconPen20,{}),emphasis:i.ButtonEmphasis.Default,onClick:()=>w(e)}),children:s.jsx(i.ActionMenu,{menuBlocks:[{id:"menu",menuItems:[{id:"upload",size:i.MenuItemContentSize.XSmall,title:"Replace with upload",onClick:()=>{b(),w(void 0)},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:s.jsx(i.IconArrowCircleUp20,{})})},{id:"asset",size:i.MenuItemContentSize.XSmall,title:"Replace with asset",onClick:()=>{c(),w(void 0)},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:s.jsx(i.IconImageStack20,{})})}]},{id:"menu-delete",menuItems:[{id:"delete",size:i.MenuItemContentSize.XSmall,title:"Delete",style:i.MenuItemStyle.Danger,onClick:()=>{d(),w(void 0)},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:s.jsx(i.IconTrashBin20,{})})}]}]})})})]})]})});Pe.displayName="AttachmentItem";const cn=e=>{const{attributes:t,listeners:n,setNodeRef:r,transform:a,transition:l,isDragging:u}=oe.useSortable({id:e.item.id}),d={transform:a?`translate(${a.x}px, ${a.y}px)`:"",transition:l,zIndex:u?2:1},c={...t,...n};return s.jsx(Pe,{ref:r,isDragging:u,transformStyle:d,draggableProps:c,...e})},un=({items:e=[],onDelete:t,onReplaceWithBrowse:n,onReplaceWithUpload:r,onBrowse:a,onUpload:l,onSorted:u,appBridge:d})=>{const[c,m]=x.useState(e),[f,g]=x.useState(!1),w=P.useSensors(P.useSensor(P.PointerSensor),P.useSensor(P.KeyboardSensor)),[b,p]=x.useState(void 0),[S,L]=x.useState(!1),[E,N]=x.useState([]),[O,X]=x.useState(null),F=G.useEditorState(d),k=c==null?void 0:c.find(v=>v.id===b),[j,{results:A,doneAll:Q}]=G.useAssetUpload({onUploadProgress:()=>!S&&L(!0)});x.useEffect(()=>{m(e)},[e]),x.useEffect(()=>{O&&(L(!0),j(O))},[O]),x.useEffect(()=>{(async()=>{Q&&(await l(A),L(!1))})()},[Q,A]);const re=()=>{g(!1),d.openAssetChooser(v=>{a(v),d.closeAssetChooser(),g(!0)},{multiSelection:!0,selectedValueIds:c.map(v=>v.id)})},Y=v=>{g(!1),d.openAssetChooser(async R=>{g(!0),d.closeAssetChooser(),N([...E,v.id]),await n(v,R[0]),N(E.filter(_=>_!==v.id))},{multiSelection:!1,selectedValueIds:c.map(R=>R.id)})},Oe=async(v,R)=>{N([...E,v.id]),await r(v,R),N(E.filter(_=>_!==v.id))},Ot=v=>{const{active:R}=v;p(R.id)},Ut=v=>{const{active:R,over:_}=v;if(_&&R.id!==_.id&&c){const Ht=c.findIndex(xe=>xe.id===R.id),_t=c.findIndex(xe=>xe.id===_.id),Ue=oe.arrayMove(c,Ht,_t);m(Ue),u(Ue)}p(void 0)};return F||((c==null?void 0:c.length)??0)>0?s.jsx(i.LegacyTooltip,{withArrow:!0,position:i.TooltipPosition.Top,content:"Attachments",disabled:f,enterDelay:500,triggerElement:s.jsx("div",{"data-test-id":"attachments-flyout-button",children:s.jsx(i.Flyout,{placement:i.FlyoutPlacement.BottomRight,onOpenChange:v=>g(k?!0:v),isOpen:f,hug:!1,fitContent:!0,legacyFooter:!1,trigger:s.jsxs("div",{className:"tw-flex tw-text-[13px] tw-font-body tw-items-center tw-gap-1 tw-rounded-full tw-bg-box-neutral-strong-inverse hover:tw-bg-box-neutral-strong-inverse-hover active:tw-bg-box-neutral-strong-inverse-pressed tw-text-box-neutral-strong tw-outline tw-outline-1 tw-outline-offset-[1px] tw-p-[6px] tw-outline-line",children:[s.jsx(i.IconPaperclip16,{}),s.jsx("div",{children:e.length>0?e.length:"Add"}),s.jsx(i.IconCaretDown12,{})]}),children:s.jsxs("div",{className:"tw-w-[300px]",children:[c.length>0&&s.jsxs(P.DndContext,{sensors:w,collisionDetection:P.closestCenter,onDragStart:Ot,onDragEnd:Ut,modifiers:[Vt.restrictToWindowEdges],children:[s.jsx(oe.SortableContext,{items:c,strategy:oe.rectSortingStrategy,children:s.jsx("div",{className:"tw-border-b tw-border-b-line",children:c.map(v=>s.jsx(cn,{isEditing:F,isLoading:E.includes(v.id),item:v,onDelete:()=>t(v),onReplaceWithBrowse:()=>Y(v),onReplaceWithUpload:R=>Oe(v,R)},v.id))})}),s.jsx(P.DragOverlay,{children:k&&s.jsx(Pe,{isOverlay:!0,isEditing:F,item:k,isDragging:!0,onDelete:()=>t(k),onReplaceWithBrowse:()=>Y(k),onReplaceWithUpload:v=>Oe(k,v)},b)})]}),F&&s.jsxs("div",{className:"tw-px-5 tw-py-3",children:[s.jsx("div",{className:"tw-font-body tw-font-medium tw-text-text tw-text-s tw-my-4",children:"Add attachments"}),s.jsx(i.AssetInput,{isLoading:S,size:i.AssetInputSize.Small,onUploadClick:v=>X(v),onLibraryClick:re})]})]})})})}):null},dn=({onDownload:e})=>{const{isFocused:t,focusProps:n}=_e.useFocusRing();return s.jsx(i.LegacyTooltip,{withArrow:!0,position:i.TooltipPosition.Top,content:"Download",enterDelay:500,triggerElement:s.jsx("button",{tabIndex:0,"aria-label":"Download",...n,className:D(["tw-outline-none tw-rounded",t&&i.FOCUS_STYLE]),onClick:e,onPointerDown:r=>r.preventDefault(),children:s.jsx("span",{"data-test-id":"download-button",className:"tw-flex tw-text-xs tw-font-body tw-items-center tw-gap-1 tw-rounded-full tw-bg-box-neutral-strong-inverse hover:tw-bg-box-neutral-strong-inverse-hover active:tw-bg-box-neutral-strong-inverse-pressed tw-text-box-neutral-strong tw-outline tw-outline-1 tw-outline-offset-1 tw-p-1.5 tw-outline-line",children:s.jsx(i.IconArrowCircleDown16,{})})})})},gn=({value:e="",gap:t,columns:n,show:r=!0,plugins:a})=>{const[l,u]=x.useState(null);return x.useEffect(()=>{(async()=>u(await i.serializeRawToHtmlAsync(e,a,n,t)))()},[e,n,t,a]),!r||l==="<br />"?null:l!==null?s.jsx("div",{className:"tw-w-full tw-whitespace-pre-wrap","data-test-id":"rte-content-html",dangerouslySetInnerHTML:{__html:l}}):s.jsx("div",{className:"tw-rounded-sm tw-bg-base-alt tw-animate-pulse tw-h-full tw-min-h-[10px] tw-w-full"})},Ke=e=>{if(!e)return!1;const t=n=>n.some(r=>r.text?r.text!=="":r.children?t(r.children):!1);try{const n=JSON.parse(e);return t(n)}catch{return!1}},mn=(e="p",t="",n)=>Ke(t)?t:JSON.stringify([{type:e,children:[{text:t,textStyle:e}],align:n}]),hn=[P.KeyboardCode.Down,P.KeyboardCode.Right,P.KeyboardCode.Up,P.KeyboardCode.Left],Xe=(e,t)=>(n,{currentCoordinates:r,context:{activeNode:a}})=>{if(n.preventDefault(),hn.includes(n.code)){const l=(a==null?void 0:a.offsetWidth)??0,u=(a==null?void 0:a.offsetHeight)??0;switch(n.code){case P.KeyboardCode.Right:return{...r,x:r.x+l+e};case P.KeyboardCode.Left:return{...r,x:r.x-l-e};case P.KeyboardCode.Down:return{...r,y:r.y+u+t};case P.KeyboardCode.Up:return{...r,y:r.y-u-t}}}},fn=(e,t,n)=>e===q.Custom?t:n,wn=e=>e.map(Qe),Qe=e=>({id:e.id,title:e.name,colors:e.colors.map(t=>({alpha:t.alpha?t.alpha/255:1,red:t.red??0,green:t.green??0,blue:t.blue??0,name:t.name??""}))}),Ie=(e,t)=>{const n=o.getAboveNode(e,{match:{type:o.ELEMENT_LINK}});return Array.isArray(n)?t(n[0]):""},Ye=e=>Ie(e,t=>{var n,r;return((r=(n=t.chosenLink)==null?void 0:n.searchResult)==null?void 0:r.link)||""}),Je=e=>Ie(e,t=>t.url||""),Ze=e=>{var t,n;return e.url||((n=(t=e.chosenLink)==null?void 0:t.searchResult)==null?void 0:n.link)||""},et=e=>Ie(e,Ze),Te=/^\/(document|r)\/\S+$/i,me=e=>{if(Te.test(e))return e;try{return new URL(e),e}catch{return`https://${e}`}},he=e=>{if(Te.test(e))return!0;try{const t=new URL(e);return["http:","https:","mailto:","tel:"].includes(t.protocol)&&t.pathname!==""}catch{return!1}},te=e=>he(me(e))||e==="",tt=(e,{type:t})=>{const{apply:n,normalizeNode:r}=e;return e.apply=a=>{if(a.type!=="set_selection"){n(a);return}const l=a.newProperties;if(!(l!=null&&l.focus)||!l.anchor||!o.isCollapsed(l)){n(a);return}const u=o.getAboveNode(e,{at:l,match:{type:o.getPluginType(e,C)}});if(u){const[,d]=u;let c;o.isStartPoint(e,l.focus,d)&&(c=o.getPreviousNodeEndPoint(e,d)),o.isEndPoint(e,l.focus,d)&&(c=o.getNextNodeStartPoint(e,d)),c&&(a.newProperties={anchor:c,focus:c})}n(a)},e.normalizeNode=([a,l])=>{if(a.type===o.getPluginType(e,C)){const u=e.selection;if(u&&o.isCollapsed(u)&&o.isEndPoint(e,u.focus,l)){const d=o.getNextNodeStartPoint(e,l);if(d)o.select(e,d);else{const c=$t.Path.next(l);o.insertNodes(e,{text:""},{at:c}),o.select(e,c)}}}r([a,l])},o.withRemoveEmptyNodes(e,o.mockPlugin({options:{types:t}}))},nt=(e,t,n)=>{o.insertNodes(e,[it(e,t)],n)},Be=o.createStore("floatingButton")({openEditorId:null,mouseDown:!1,updated:!1,url:"",text:"",buttonStyle:"primary",newTab:!1,mode:"",isEditing:!1}).extendActions(e=>({reset:()=>{e.url(""),e.text(""),e.buttonStyle("primary"),e.newTab(!1),e.mode(""),e.isEditing(!1)}})).extendActions(e=>({show:(t,n)=>{e.mode(t),e.isEditing(!1),e.openEditorId(n)},hide:()=>{e.reset(),e.openEditorId(null)}})).extendSelectors(e=>({isOpen:t=>e.openEditorId===t})),I=Be.set,B=Be.get,ne=()=>Be.use,je=e=>{if(!e.selection)return;const{isUrl:t,forceSubmit:n}=o.getPluginOptions(e,C),r=B.url();if(!((t==null?void 0:t(r))||n))return;const l=B.text(),u=B.buttonStyle(),d=B.newTab()?void 0:"_self";return I.hide(),st(e,{url:r,text:l,buttonStyle:u,target:d,isUrl:c=>n||!t?!0:t(c)}),setTimeout(()=>{o.focusEditor(e,e.selection??void 0)},0),!0},se=(e,t)=>o.withoutNormalizing(e,()=>{var n,r,a,l,u,d;if(t!=null&&t.split){if(o.getAboveNode(e,{at:(n=e.selection)==null?void 0:n.anchor,match:{type:o.getPluginType(e,C)}}))return o.splitNodes(e,{at:(r=e.selection)==null?void 0:r.anchor,match:f=>o.isElement(f)&&f.type===o.getPluginType(e,C)}),se(e,{at:(a=e.selection)==null?void 0:a.anchor}),!0;if(o.getAboveNode(e,{at:(l=e.selection)==null?void 0:l.focus,match:{type:o.getPluginType(e,C)}}))return o.splitNodes(e,{at:(u=e.selection)==null?void 0:u.focus,match:f=>o.isElement(f)&&f.type===o.getPluginType(e,C)}),se(e,{at:(d=e.selection)==null?void 0:d.focus}),!0}o.unwrapNodes(e,{match:{type:o.getPluginType(e,C)},...t})}),st=(e,{url:t,text:n,buttonStyle:r,target:a,insertTextInButton:l,insertNodesOptions:u,isUrl:d=o.getPluginOptions(e,C).isUrl})=>{var E;const c=e.selection;if(!c)return;const m=o.getAboveNode(e,{at:c,match:{type:o.getPluginType(e,C)}});if(l&&m)return e.insertText(t),!0;if(!(d!=null&&d(t)))return;if(o.isDefined(n)&&n.length===0&&(n=t),m)return pn(t,e,m,a,r,n),!0;const f=o.findNode(e,{at:c,match:{type:o.getPluginType(e,C)}}),[g,w]=f??[],b=xn(e,w,n);if(o.isExpanded(c))return yn(m,e,t,r,a,n),!0;b&&o.removeNodes(e,{at:w});const p=o.getNodeProps(g??{}),S=(E=e.selection)==null?void 0:E.focus.path;if(!S)return;const L=o.getNodeLeaf(e,S);return n!=null&&n.length||(n=t),nt(e,{...p,url:t,target:a,children:[{...L,text:n}]},u),!0};function xn(e,t,n){return t&&(n==null?void 0:n.length)&&n!==o.getEditorString(e,t)}function yn(e,t,n,r,a,l){e?se(t,{at:e[1]}):se(t,{split:!0}),rt(t,{url:n,buttonStyle:r,target:a}),Le(t,{url:n,target:a,text:l})}function pn(e,t,n,r,a,l){var u,d,c;(e!==((u=n[0])==null?void 0:u.url)||r!==((d=n[0])==null?void 0:d.target)||a!==((c=n[0])==null?void 0:c.buttonStyle))&&o.setNodes(t,{url:e,target:r,buttonStyle:a},{at:n[1]}),Le(t,{url:e,text:l,target:r})}const Le=(e,{text:t})=>{const n=o.getAboveNode(e,{match:{type:o.getPluginType(e,C)}});if(n){const[r,a]=n;if(t!=null&&t.length&&t!==o.getEditorString(e,a)){const l=r.children[0];o.replaceNodeChildren(e,{at:a,nodes:{...l,text:t},insertOptions:{select:!0}})}}},rt=(e,{url:t,buttonStyle:n,target:r,...a})=>{o.wrapNodes(e,{type:o.getPluginType(e,C),url:t,buttonStyle:n,target:r,children:[]},{split:!0,...a})},bn=(e,t)=>{const n=o.getAboveNode(e,{match:{type:C}});return Array.isArray(n)?t(n[0]):""},at=e=>bn(e,t=>t.url??""),it=(e,{url:t,text:n="",buttonStyle:r="primary",target:a,children:l})=>({type:o.getPluginType(e,C),url:t,target:a,buttonStyle:r,children:l??[{text:n}]}),ot=(e,{focused:t}={})=>{if(B.mode()==="edit"){fe(e);return}Ne(e,{focused:t})},fe=e=>{const t=o.findNode(e,{match:{type:o.getPluginType(e,C)}});if(!t)return;const[n,r]=t;let a=o.getEditorString(e,r);I.url(n.url),I.newTab(n.target===void 0),a===n.url&&(a=""),I.text(a),I.isEditing(!0)},Ne=(e,{focused:t}={})=>{B.mode()||!t||o.isRangeAcrossBlocks(e,{at:e.selection})||o.someNode(e,{match:{type:o.getPluginType(e,C)}})||(I.text(o.getEditorString(e,e.selection)),I.show("insert",e.id))},we={buttonPrimary:{fontFamily:"var(--f-theme-settings-button-primary-font-family)",fontSize:"var(--f-theme-settings-button-primary-font-size)",fontWeight:"var(--f-theme-settings-button-primary-font-weight)",lineHeight:"var(--f-theme-settings-button-primary-line-height)",paddingTop:"var(--f-theme-settings-button-primary-padding-top)",paddingRight:"var(--f-theme-settings-button-primary-padding-right)",paddingBottom:"var(--f-theme-settings-button-primary-padding-bottom)",paddingLeft:"var(--f-theme-settings-button-primary-padding-left)",fontStyle:"var(--f-theme-settings-button-primary-font-style)",textTransform:"var(--f-theme-settings-button-primary-text-transform)",backgroundColor:"var(--f-theme-settings-button-primary-background-color)",borderColor:"var(--f-theme-settings-button-primary-border-color)",borderRadius:"var(--f-theme-settings-button-primary-border-radius)",borderWidth:"var(--f-theme-settings-button-primary-border-width)",color:"var(--f-theme-settings-button-primary-color)",marginTop:"10px",marginBottom:"10px",display:"inline-block",hover:{backgroundColor:"var(--f-theme-settings-button-primary-background-color-hover)",borderColor:"var(--f-theme-settings-button-primary-border-color-hover)",color:"var(--f-theme-settings-button-primary-color-hover)"}},buttonSecondary:{fontFamily:"var(--f-theme-settings-button-secondary-font-family)",fontSize:"var(--f-theme-settings-button-secondary-font-size)",fontWeight:"var(--f-theme-settings-button-secondary-font-weight)",lineHeight:"var(--f-theme-settings-button-secondary-line-height)",paddingTop:"var(--f-theme-settings-button-secondary-padding-top)",paddingRight:"var(--f-theme-settings-button-secondary-padding-right)",paddingBottom:"var(--f-theme-settings-button-secondary-padding-bottom)",paddingLeft:"var(--f-theme-settings-button-secondary-padding-left)",fontStyle:"var(--f-theme-settings-button-secondary-font-style)",textTransform:"var(--f-theme-settings-button-secondary-text-transform)",backgroundColor:"var(--f-theme-settings-button-secondary-background-color)",borderColor:"var(--f-theme-settings-button-secondary-border-color)",borderRadius:"var(--f-theme-settings-button-secondary-border-radius)",borderWidth:"var(--f-theme-settings-button-secondary-border-width)",color:"var(--f-theme-settings-button-secondary-color)",display:"inline-block",marginTop:"10px",marginBottom:"10px",hover:{backgroundColor:"var(--f-theme-settings-button-secondary-background-color-hover)",borderColor:"var(--f-theme-settings-button-secondary-border-color-hover)",color:"var(--f-theme-settings-button-secondary-color-hover)"}},buttonTertiary:{fontFamily:"var(--f-theme-settings-button-tertiary-font-family)",fontSize:"var(--f-theme-settings-button-tertiary-font-size)",fontWeight:"var(--f-theme-settings-button-tertiary-font-weight)",lineHeight:"var(--f-theme-settings-button-tertiary-line-height)",paddingTop:"var(--f-theme-settings-button-tertiary-padding-top)",paddingRight:"var(--f-theme-settings-button-tertiary-padding-right)",paddingBottom:"var(--f-theme-settings-button-tertiary-padding-bottom)",paddingLeft:"var(--f-theme-settings-button-tertiary-padding-left)",fontStyle:"var(--f-theme-settings-button-tertiary-font-style)",textTransform:"var(--f-theme-settings-button-tertiary-text-transform)",backgroundColor:"var(--f-theme-settings-button-tertiary-background-color)",borderColor:"var(--f-theme-settings-button-tertiary-border-color)",borderRadius:"var(--f-theme-settings-button-tertiary-border-radius)",borderWidth:"var(--f-theme-settings-button-tertiary-border-width)",color:"var(--f-theme-settings-button-tertiary-color)",display:"inline-block",marginTop:"10px",marginBottom:"10px",hover:{backgroundColor:"var(--f-theme-settings-button-tertiary-background-color-hover)",borderColor:"var(--f-theme-settings-button-tertiary-border-color-hover)",color:"var(--f-theme-settings-button-tertiary-color-hover)"}}},vn=e=>({...o.useElementProps({...e,elementToAttributes:n=>({url:n.href,buttonStyle:n.buttonStyle||"primary",target:n.target||"_blank"})}),onMouseOver:n=>{n.stopPropagation()}}),kn=e=>{const{href:t,target:n,buttonStyle:r}=vn(e),{attributes:a,children:l}=e;return s.jsx(Cn,{attributes:a,href:t,target:n,styles:we[`button${r.charAt(0).toUpperCase()+r.slice(1)}`],children:l})},Cn=({attributes:e,styles:t={hover:{}},children:n,href:r="#",target:a})=>{const[l,u]=x.useState(!1);return s.jsx("a",{...e,onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),href:r,target:a,style:l?{...t,...t.hover}:t,children:n})};class Sn extends i.MarkupElement{constructor(t=C,n=kn){super(t,n)}}const En=({type:e,...t})=>{const n=o.useEditorRef(),r=!!o.isRangeInSameBlock(n,{at:n.selection}),a=!!(n!=null&&n.selection)&&o.someNode(n,{match:{type:e}});return s.jsx(o.ToolbarButton,{tooltip:i.getTooltip(r?`Button
2
+ ${i.getHotkeyByPlatform("Ctrl+Shift+K")}`:"Buttons can only be set for a single text block."),classNames:i.getButtonClassNames(r),active:a,onMouseDown:async l=>{n&&(l.preventDefault(),l.stopPropagation(),o.focusEditor(n,n.selection??n.prevSelection??void 0),setTimeout(()=>{ot(n,{focused:!0})},0))},...t})},Pn=({editor:e,id:t})=>s.jsx("div",{"data-plugin-id":t,children:s.jsx(En,{type:o.getPluginType(e,C),icon:s.jsx("span",{className:"tw-p-2 tw-h-8 tw-justify-center tw-items-center tw-flex",children:s.jsx(i.IconButton16,{})}),styles:i.buttonStyles})}),In=()=>{const e=Gn({});return s.jsx("div",{"data-test-id":"floating-button-edit",className:"tw-bg-white tw-text-text tw-rounded tw-shadow tw-p-4 tw-min-w-[400px]",children:s.jsxs("span",{"data-test-id":"preview-button-flyout",className:"tw-flex tw-justify-between tw-items-center",children:[s.jsx("span",{className:"tw-pointer-events-none",children:e.defaultValue}),s.jsxs("span",{className:"tw-flex tw-gap-2",children:[s.jsx("span",{role:"button",tabIndex:0,"data-test-id":"edit-button-button",className:"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1",children:s.jsx(ce.EditButton,{children:s.jsx(i.IconPen16,{})})}),s.jsx("span",{role:"button",tabIndex:0,"data-test-id":"remove-button-button",className:"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1",children:s.jsx(ce.UnlinkButton,{children:s.jsx(i.IconTrashBin16,{})})})]})]})})},Tn=({section:e,selectedUrl:t,onSelectUrl:n})=>{const r=e.permanentLink===t;return s.jsx("button",{"data-test-id":"internal-link-selector-section-link",className:i.merge(["tw-py-2 tw-px-2.5 tw-pl-14 tw-leading-5 tw-cursor-pointer tw-w-full",r?"tw-bg-box-selected-strong tw-text-box-selected-strong-inverse hover:tw-bg-box-selected-strong-hover:hover hover:tw-text-box-selected-strong-inverse-hover:hover":"hover:tw-bg-box-neutral-hover hover:tw-text-box-neutral-inverse-hover"]),onClick:()=>n(e.permanentLink),children:s.jsxs("div",{className:"tw-flex tw-flex-1 tw-space-x-2 tw-items-center tw-h-6",children:[s.jsx(i.IconDocumentText16,{}),s.jsx("span",{className:"tw-text-s",children:e.title}),s.jsx("span",{className:"tw-flex-auto tw-font-sans tw-text-xs tw-text-right",children:"Section"})]})})},Bn=({page:e,selectedUrl:t,onSelectUrl:n,itemsToExpandInitially:r,appBridge:a})=>{const[l,u]=x.useState(e.id===r.documentId),d=e.permanentLink===t,{documentSections:c}=G.useDocumentSection(a,e.id),m=[...c.values()],f=m.length>0;return x.useEffect(()=>{e.id===r.pageId&&u(!0)},[r,e.id]),s.jsxs(s.Fragment,{children:[s.jsx("button",{"data-test-id":"internal-link-selector-page-link",className:i.merge(["tw-py-2 tw-pr-2.5 tw-leading-5 tw-cursor-pointer tw-flex tw-w-full",f?"tw-pl-7":"tw-pl-12",d?"tw-bg-box-selected-strong tw-text-box-selected-strong-inverse hover:tw-bg-box-selected-strong-hover:hover hover:tw-text-box-selected-strong-inverse-hover:hover":"hover:tw-bg-box-neutral-hover hover:tw-text-box-neutral-inverse-hover"]),onClick:()=>n(e.permanentLink),children:s.jsxs("div",{className:"tw-flex tw-flex-1 tw-space-x-1 tw-items-center tw-h-6",children:[f&&s.jsx("button",{"data-test-id":"tree-item-toggle",className:"tw-flex tw-items-center tw-justify-center -tw-mr-2 tw-pr-3.5 tw-pt-1.5 tw-pb-1.5 tw-pl-3.5 tw-cursor-pointer",onClick:()=>u(!l),children:s.jsx("div",{className:i.merge(["tw-transition-transform tw-w-0 tw-h-0 tw-font-normal tw-border-t-4 tw-border-t-transparent tw-border-b-4 tw-border-b-transparent tw-border-l-4 tw-border-l-x-strong",l?"tw-rotate-90":""])})}),s.jsx("span",{className:"tw-text-s",children:e.title}),s.jsx("span",{className:"tw-flex-auto tw-font-sans tw-text-xs tw-text-right",children:"Page"})]},e.id)}),l&&m.length>0&&m.map(g=>s.jsx(Tn,{section:g,selectedUrl:t,onSelectUrl:n},g.id))]})},lt=()=>s.jsx("div",{className:"tw-flex tw-justify-center tw-h-10 tw-items-center",children:s.jsx(i.LoadingCircle,{size:i.LoadingCircleSize.Small})}),jn=({appBridge:e,documentId:t,selectedUrl:n,onSelectUrl:r,itemsToExpandInitially:a})=>{const[l,u]=x.useState([]),[d,c]=x.useState(!0),m=[...l.values()],f=!d&&m.length>0;return x.useEffect(()=>{e.getDocumentPagesByDocumentId(t).then(g=>{const w=g.filter(p=>!!p.category).sort((p,S)=>p.category.sort===S.category.sort?p.sort-S.sort:p.category.sort-S.category.sort),b=g.filter(p=>!p.category).sort((p,S)=>p.sort-S.sort);u([...w,...b])}).finally(()=>{c(!1)})},[]),d?s.jsx(lt,{}):f?s.jsx(s.Fragment,{children:m.map(g=>s.jsx(Bn,{page:g,appBridge:e,selectedUrl:n,onSelectUrl:r,itemsToExpandInitially:a},g.id))}):s.jsx("div",{className:"tw-h-10 tw-flex tw-items-center tw-pr-2.5 tw-pl-7 tw-leading-5 tw-text-s tw-text-text-weak",children:"This document does not contain any pages."})},Ln=({document:e,appBridge:t,selectedUrl:n,onSelectUrl:r,itemsToExpandInitially:a})=>{const[l,u]=x.useState(e.id===a.documentId),d=e.permanentLink===n;return x.useEffect(()=>{e.id===a.documentId&&u(!0)},[a,e.id]),s.jsxs(s.Fragment,{children:[s.jsxs("button",{"data-test-id":"internal-link-selector-document-link",className:i.merge(["tw-flex tw-flex-1 tw-space-x-2 tw-items-center tw-py-2 tw-pr-2.5 tw-leading-5 tw-cursor-pointer tw-w-full",d?"tw-bg-box-selected-strong tw-text-box-selected-strong-inverse hover:tw-bg-box-selected-strong-hover:hover hover:tw-text-box-selected-strong-inverse-hover:hover":"hover:tw-bg-box-neutral-hover hover:tw-text-box-neutral-inverse-hover"]),onClick:()=>r(e.permanentLink),children:[s.jsx("button",{role:"button",tabIndex:0,"data-test-id":"tree-item-toggle",className:"tw-flex tw-items-center tw-justify-center -tw-mr-2 tw-pr-3.5 tw-pt-1.5 tw-pb-1.5 tw-pl-3.5 tw-cursor-pointer",onClick:()=>u(!l),children:s.jsx("div",{className:i.merge(["tw-transition-transform tw-w-0 tw-h-0 tw-font-normal tw-border-t-4 tw-border-t-transparent tw-border-b-4 tw-border-b-transparent tw-border-l-4 tw-border-l-x-strong",l?"tw-rotate-90":""])})}),s.jsx(i.IconColorFan16,{}),s.jsx("span",{className:"tw-text-s",children:e.title}),s.jsx("span",{className:"tw-flex-auto tw-font-sans tw-text-xs tw-text-right",children:"Document"})]}),l&&s.jsx(jn,{appBridge:t,documentId:e.id,selectedUrl:n,onSelectUrl:r,itemsToExpandInitially:a})]})},Nn=({appBridge:e,selectedUrl:t,onSelectUrl:n})=>{const[r,a]=x.useState(!0),[l,u]=x.useState([]),[d,c]=x.useState({documentId:void 0,pageId:void 0}),m=[...l.values()];x.useEffect(()=>{t&&m.length>0&&f().then(g=>{c(g)})},[m.length]),x.useEffect(()=>{e.getAllDocuments().then(g=>{u(g)}).finally(()=>{a(!1)})},[]);const f=async()=>{const g={documentId:void 0,pageId:void 0};if(m.find(b=>b.permanentLink===t))return g;for(const b of m){const p=await e.getDocumentPagesByDocumentId(b.id);e.getAllDocuments();const S=[...p.values()];if(!!S.find(E=>E.permanentLink===t))return g.documentId=b.id,g;for(const E of S)if(!![...(await e.getDocumentSectionsByDocumentPageId(E.id)).values()].find(F=>F.permanentLink===t))return g.documentId=b.id,g.pageId=E.id,g}return g};return r?s.jsx(lt,{}):s.jsx(s.Fragment,{children:m.map(g=>s.jsx(Ln,{document:g,appBridge:e,selectedUrl:t,onSelectUrl:n,itemsToExpandInitially:d},g.id))})},ct=({appBridge:e,url:t,onUrlChange:n,buttonSize:r=i.ButtonSize.Medium})=>{const{open:a,isOpen:l,close:u}=zt.useOverlayTriggerState({}),[d,c]=x.useState(t),m=w=>{c(w)},f=w=>{w.key==="Enter"&&g()};x.useEffect(()=>{t&&!d&&c(t)},[t,d]);const g=()=>{n==null||n(d),u()};return s.jsxs("div",{"data-test-id":"internal-link-selector",onKeyDown:f,children:[s.jsx(i.Button,{icon:s.jsx(i.IconLink,{}),size:r,type:i.ButtonType.Button,style:i.ButtonStyle.Default,emphasis:i.ButtonEmphasis.Default,onClick:()=>a(),children:"Internal link"}),s.jsxs(i.Modal,{zIndex:1001,onClose:()=>u(),isOpen:l,isDismissable:!0,children:[s.jsx(i.Modal.Header,{title:"Select internal link"}),s.jsx(i.Modal.Body,{children:s.jsx(Nn,{appBridge:e,selectedUrl:d,onSelectUrl:m})}),s.jsx(i.Modal.Footer,{buttons:[{children:"Cancel",onClick:()=>u(),style:i.ButtonStyle.Default,emphasis:i.ButtonEmphasis.Default},{children:"Choose",onClick:w=>{w==null||w.preventDefault(),g()},style:i.ButtonStyle.Default,emphasis:i.ButtonEmphasis.Strong,disabled:!d}]})]})]})},ut=({onUrlChange:e,onToggleTab:t,isValidUrlOrEmpty:n,appBridge:r,clearable:a,placeholder:l,newTab:u,openInNewTab:d,url:c="",required:m,info:f,label:g,buttonSize:w,hideInternalLinkButton:b})=>{const p=n?n(c):te(c),S=u??(d?i.CheckboxState.Checked:i.CheckboxState.Unchecked);return s.jsxs("div",{"data-test-id":"link-input",children:[s.jsx(i.FormControl,{label:{children:g,htmlFor:"url",required:m,tooltip:f?{content:f,position:i.TooltipPosition.Top}:void 0},children:s.jsx(i.TextInput,{id:"url",value:c,clearable:a,onChange:e,placeholder:l??"https://example.com",focusOnMount:!0})}),!p&&s.jsx("div",{className:"tw-text-text-negative tw-mt-1 tw-text-s",children:"Please enter a valid URL."}),!b&&s.jsx("div",{className:"tw-mt-3",children:s.jsx(ct,{url:c,appBridge:r,onUrlChange:e,buttonSize:w??i.ButtonSize.Medium})}),s.jsx("div",{className:"tw-mt-3",children:s.jsx(i.Checkbox,{value:"new-tab",label:"Open in new tab",state:S,onChange:t})})]})},dt=({state:e,onTextChange:t,onUrlChange:n,onToggleTab:r,onCancel:a,onSave:l,isValidUrlOrEmpty:u,hasValues:d,testId:c,appBridge:m,children:f})=>s.jsxs("div",{"data-test-id":c,className:"tw-bg-white tw-rounded tw-shadow tw-p-7 tw-min-w-[400px] tw-overflow-y-auto",children:[s.jsx(i.FormControl,{label:{children:"Text",htmlFor:"linkText",required:!0},children:s.jsx(i.TextInput,{id:"linkText",value:e.text,placeholder:"Link Text",onChange:t})}),f,s.jsx("div",{className:"tw-mt-5",children:s.jsx(ut,{url:e.url,newTab:e.newTab,onUrlChange:n,onToggleTab:r,isValidUrlOrEmpty:u,appBridge:m})}),s.jsx("div",{className:"tw-mt-3",children:s.jsxs("div",{className:"tw-pt-5 tw-flex tw-gap-x-3 tw-justify-end tw-border-t tw-border-t-black-10",children:[s.jsx(i.Button,{onClick:a,size:i.ButtonSize.Medium,style:i.ButtonStyle.Default,emphasis:i.ButtonEmphasis.Default,children:"Cancel"}),s.jsx(i.Button,{onClick:l,size:i.ButtonSize.Medium,icon:s.jsx(i.IconCheckMark20,{}),disabled:!d||!u(e==null?void 0:e.url),children:"Save"})]})})]}),An=e=>{var n;const t=o.getAboveNode(e,{match:{type:C}});return Array.isArray(t)&&((n=t[0])==null?void 0:n.buttonStyle)||"primary"},Rn={url:"",text:"",buttonStyle:"primary",newTab:i.CheckboxState.Unchecked},Fn=()=>{const[e,t]=x.useReducer((n,r)=>{const{type:a,payload:l}=r;switch(a){case"NEW_TAB":return{...n,newTab:i.CheckboxState.Checked};case"SAME_TAB":return{...n,newTab:i.CheckboxState.Unchecked};case"URL":case"TEXT":case"BUTTON_STYLE":case"INIT":return{...n,...l};default:return n}},Rn);return[e,t]},Mn=()=>{const e=o.useEditorRef(),[t,n]=Fn();x.useEffect(()=>{const g=An(e);n({type:"INIT",payload:{text:B.text(),buttonStyle:g,newTab:B.newTab()?i.CheckboxState.Checked:i.CheckboxState.Unchecked,url:B.url()}})},[n,e]);const r=g=>{n({type:"TEXT",payload:{text:g}})},a=g=>{n({type:"BUTTON_STYLE",payload:{buttonStyle:g}})},l=g=>{n({type:"URL",payload:{url:g}})},u=g=>{n(g?{type:"NEW_TAB"}:{type:"SAME_TAB"})},d=()=>{I.hide()},c=g=>{if(!te(t.url)||!m)return;const w=me(t.url);I.text(t.text),I.url(w),I.buttonStyle(t.buttonStyle),I.newTab(t.newTab===i.CheckboxState.Checked),je(e)&&(g==null||g.preventDefault())},m=t.url!==""&&t.text!=="",{appBridge:f}=o.getPluginOptions(e,C);return o.useHotkeys("enter",c,{enableOnFormTags:["INPUT"]},[]),{state:t,onTextChange:r,onButtonStyleChange:a,onUrlChange:l,onToggleTab:u,onCancel:d,onSave:c,hasValues:m,isValidUrlOrEmpty:te,appBridge:f}},le="link-plugin";var y=(e=>(e.heading1="heading1",e.heading2="heading2",e.heading3="heading3",e.heading4="heading4",e.custom1="custom1",e.custom2="custom2",e.custom3="custom3",e.quote="quote",e.imageCaption="imageCaption",e.imageTitle="imageTitle",e.p="p",e))(y||{});const T={heading1:{fontSize:"var(--f-theme-settings-heading1-font-size)",lineHeight:"var(--f-theme-settings-heading1-line-height)",marginTop:"var(--f-theme-settings-heading1-margin-top)",marginBottom:"var(--f-theme-settings-heading1-margin-bottom)",textDecoration:"var(--f-theme-settings-heading1-text-decoration)",fontStyle:"var(--f-theme-settings-heading1-font-style)",textTransform:"var(--f-theme-settings-heading1-text-transform)",letterSpacing:"var(--f-theme-settings-heading1-letter-spacing)",fontWeight:"var(--f-theme-settings-heading1-font-weight)",fontFamily:"var(--f-theme-settings-heading1-font-family)",color:"var(--f-theme-settings-heading1-color)"},heading2:{fontSize:"var(--f-theme-settings-heading2-font-size)",lineHeight:"var(--f-theme-settings-heading2-line-height)",marginTop:"var(--f-theme-settings-heading2-margin-top)",marginBottom:"var(--f-theme-settings-heading2-margin-bottom)",textDecoration:"var(--f-theme-settings-heading2-text-decoration)",fontStyle:"var(--f-theme-settings-heading2-font-style)",textTransform:"var(--f-theme-settings-heading2-text-transform)",letterSpacing:"var(--f-theme-settings-heading2-letter-spacing)",fontWeight:"var(--f-theme-settings-heading2-font-weight)",fontFamily:"var(--f-theme-settings-heading2-font-family)",color:"var(--f-theme-settings-heading2-color)"},heading3:{fontSize:"var(--f-theme-settings-heading3-font-size)",lineHeight:"var(--f-theme-settings-heading3-line-height)",marginTop:"var(--f-theme-settings-heading3-margin-top)",marginBottom:"var(--f-theme-settings-heading3-margin-bottom)",textDecoration:"var(--f-theme-settings-heading3-text-decoration)",fontStyle:"var(--f-theme-settings-heading3-font-style)",textTransform:"var(--f-theme-settings-heading3-text-transform)",letterSpacing:"var(--f-theme-settings-heading3-letter-spacing)",fontWeight:"var(--f-theme-settings-heading3-font-weight)",fontFamily:"var(--f-theme-settings-heading3-font-family)",color:"var(--f-theme-settings-heading3-color)"},heading4:{fontSize:"var(--f-theme-settings-heading4-font-size)",lineHeight:"var(--f-theme-settings-heading4-line-height)",marginTop:"var(--f-theme-settings-heading4-margin-top)",marginBottom:"var(--f-theme-settings-heading4-margin-bottom)",textDecoration:"var(--f-theme-settings-heading4-text-decoration)",fontStyle:"var(--f-theme-settings-heading4-font-style)",textTransform:"var(--f-theme-settings-heading4-text-transform)",letterSpacing:"var(--f-theme-settings-heading4-letter-spacing)",fontWeight:"var(--f-theme-settings-heading4-font-weight)",fontFamily:"var(--f-theme-settings-heading4-font-family)",color:"var(--f-theme-settings-heading4-color)"},custom1:{fontSize:"var(--f-theme-settings-custom1-font-size)",lineHeight:"var(--f-theme-settings-custom1-line-height)",marginTop:"var(--f-theme-settings-custom1-margin-top)",marginBottom:"var(--f-theme-settings-custom1-margin-bottom)",textDecoration:"var(--f-theme-settings-custom1-text-decoration)",fontStyle:"var(--f-theme-settings-custom1-font-style)",textTransform:"var(--f-theme-settings-custom1-text-transform)",letterSpacing:"var(--f-theme-settings-custom1-letter-spacing)",fontWeight:"var(--f-theme-settings-custom1-font-weight)",fontFamily:"var(--f-theme-settings-custom1-font-family)",color:"var(--f-theme-settings-custom1-color)"},custom2:{fontSize:"var(--f-theme-settings-custom2-font-size)",lineHeight:"var(--f-theme-settings-custom2-line-height)",marginTop:"var(--f-theme-settings-custom2-margin-top)",marginBottom:"var(--f-theme-settings-custom2-margin-bottom)",textDecoration:"var(--f-theme-settings-custom2-text-decoration)",fontStyle:"var(--f-theme-settings-custom2-font-style)",textTransform:"var(--f-theme-settings-custom2-text-transform)",letterSpacing:"var(--f-theme-settings-custom2-letter-spacing)",fontWeight:"var(--f-theme-settings-custom2-font-weight)",fontFamily:"var(--f-theme-settings-custom2-font-family)",color:"var(--f-theme-settings-custom2-color)"},custom3:{fontSize:"var(--f-theme-settings-custom3-font-size)",lineHeight:"var(--f-theme-settings-custom3-line-height)",marginTop:"var(--f-theme-settings-custom3-margin-top)",marginBottom:"var(--f-theme-settings-custom3-margin-bottom)",textDecoration:"var(--f-theme-settings-custom3-text-decoration)",fontStyle:"var(--f-theme-settings-custom3-font-style)",textTransform:"var(--f-theme-settings-custom3-text-transform)",letterSpacing:"var(--f-theme-settings-custom3-letter-spacing)",fontWeight:"var(--f-theme-settings-custom3-font-weight)",fontFamily:"var(--f-theme-settings-custom3-font-family)",color:"var(--f-theme-settings-custom3-color)"},p:{fontSize:"var(--f-theme-settings-body-font-size)",lineHeight:"var(--f-theme-settings-body-line-height)",marginTop:"var(--f-theme-settings-body-margin-top)",marginBottom:"var(--f-theme-settings-body-margin-bottom)",textDecoration:"var(--f-theme-settings-body-text-decoration)",fontStyle:"var(--f-theme-settings-body-font-style)",textTransform:"var(--f-theme-settings-body-text-transform)",letterSpacing:"var(--f-theme-settings-body-letter-spacing)",fontWeight:"var(--f-theme-settings-body-font-weight)",fontFamily:"var(--f-theme-settings-body-font-family)",color:"var(--f-theme-settings-body-color)"},quote:{fontSize:"var(--f-theme-settings-quote-font-size)",lineHeight:"var(--f-theme-settings-quote-line-height)",marginTop:"var(--f-theme-settings-quote-margin-top)",marginBottom:"var(--f-theme-settings-quote-margin-bottom)",textDecoration:"var(--f-theme-settings-quote-text-decoration)",fontStyle:"var(--f-theme-settings-quote-font-style)",textTransform:"var(--f-theme-settings-quote-text-transform)",letterSpacing:"var(--f-theme-settings-quote-letter-spacing)",fontWeight:"var(--f-theme-settings-quote-font-weight)",fontFamily:"var(--f-theme-settings-quote-font-family)",color:"var(--f-theme-settings-quote-color)"},imageCaption:{fontSize:"var(--f-theme-settings-image-caption-font-size)",lineHeight:"var(--f-theme-settings-image-caption-line-height)",marginTop:"var(--f-theme-settings-image-caption-margin-top)",marginBottom:"var(--f-theme-settings-image-caption-margin-bottom)",textDecoration:"var(--f-theme-settings-image-caption-text-decoration)",fontStyle:"var(--f-theme-settings-image-caption-font-style)",textTransform:"var(--f-theme-settings-image-caption-text-transform)",letterSpacing:"var(--f-theme-settings-image-caption-letter-spacing)",fontWeight:"var(--f-theme-settings-image-caption-font-weight)",fontFamily:"var(--f-theme-settings-image-caption-font-family)",color:"var(--f-theme-settings-image-caption-color)"},imageTitle:{fontSize:"var(--f-theme-settings-image-title-font-size)",lineHeight:"var(--f-theme-settings-image-title-line-height)",marginTop:"var(--f-theme-settings-image-title-margin-top)",marginBottom:"var(--f-theme-settings-image-title-margin-bottom)",textDecoration:"var(--f-theme-settings-image-title-text-decoration)",fontStyle:"var(--f-theme-settings-image-title-font-style)",textTransform:"var(--f-theme-settings-image-title-text-transform)",letterSpacing:"var(--f-theme-settings-image-title-letter-spacing)",fontWeight:"var(--f-theme-settings-image-title-font-weight)",fontFamily:"var(--f-theme-settings-image-title-font-family)",color:"var(--f-theme-settings-image-title-color)"},[le]:{fontSize:"var(--f-theme-settings-link-font-size)",lineHeight:"var(--f-theme-settings-link-line-height)",marginTop:"var(--f-theme-settings-link-margin-top)",marginBottom:"var(--f-theme-settings-link-margin-bottom)",textDecoration:"var(--f-theme-settings-link-text-decoration)",fontStyle:"var(--f-theme-settings-link-font-style)",textTransform:"var(--f-theme-settings-link-text-transform)",letterSpacing:"var(--f-theme-settings-link-letter-spacing)",fontWeight:"var(--f-theme-settings-link-font-weight)",fontFamily:"var(--f-theme-settings-link-font-family)",color:"var(--f-theme-settings-link-color)"},...we},Dn=()=>{const e=Mn(),{state:t,onButtonStyleChange:n}=e;return s.jsx(dt,{...e,testId:"floating-button-insert",children:s.jsx("div",{className:"tw-pt-5",children:s.jsxs(i.FormControl,{label:{children:"Button Style",htmlFor:"buttonStyle",required:!0},children:[s.jsx(ye,{id:"primary",styles:T.buttonPrimary,isActive:t.buttonStyle==="primary",onClick:()=>n("primary"),children:t.text||"Primary Button"}),s.jsx(ye,{id:"secondary",styles:T.buttonSecondary,isActive:t.buttonStyle==="secondary",onClick:()=>n("secondary"),children:t.text||"Secondary Button"}),s.jsx(ye,{id:"tertiary",styles:T.buttonTertiary,isActive:t.buttonStyle==="tertiary",onClick:()=>n("tertiary"),children:t.text||"Tertiary Button"})]})})})},ye=({id:e,styles:t,isActive:n,onClick:r,children:a})=>{const[l,u]=x.useState(!1),d=()=>t&&t.hover&&l?{...t,...t.hover}:t;return s.jsx("button",{"data-test-id":`floating-button-insert-${e}`,onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),onClick:r,style:{...d(),marginTop:0,marginBottom:0},className:n?"tw-outline tw-outline-1 tw-outline-violet-60 tw-outline-offset-2 tw-w-fit":"tw-w-fit",children:a})},On=()=>{const e=ne().isEditing(),t=s.jsx(Dn,{}),n=e?t:s.jsx(In,{});return s.jsxs(s.Fragment,{children:[s.jsx(ce.InsertRoot,{children:t}),s.jsx(ce.EditRoot,{children:n})]})},C="button",gt="button-plugin",mt=e=>o.createPluginFactory({key:C,isElement:!0,isInline:!0,props:({element:t})=>({nodeProps:{href:t==null?void 0:t.url,target:t==null?void 0:t.target}}),withOverrides:tt,renderAfterEditable:On,options:{isUrl:he,rangeBeforeOptions:{matchString:" ",skipInvalid:!0,afterMatch:!0},triggerFloatingButtonHotkeys:"command+shift+k, ctrl+shift+k",appBridge:e},then:(t,{type:n})=>({deserializeHtml:{rules:[{validNodeName:"A",validClassName:"btn"}],getNode:r=>({type:n,url:r.getAttribute("href"),target:r.getAttribute("target")||"_blank"})}})})();class ht extends i.Plugin{constructor({styles:t=we,...n}){super(gt,{button:Pn,markupElement:new Sn,...n}),this.styles={},this.styles=t,this.appBridge=n==null?void 0:n.appBridge}plugins(){return[mt(this.appBridge)]}}const Un=({floatingOptions:e,...t})=>{const n=o.useEditorRef(),r=o.usePlateSelectors(n.id).keyEditor(),a=ne().mode(),l=ne().isOpen(n.id),{triggerFloatingButtonHotkeys:u}=o.getPluginOptions(n,C),d=x.useCallback(()=>{const w=o.getAboveNode(n,{match:{type:o.getPluginType(n,C)}});if(w){const[,b]=w;return o.getRangeBoundingClientRect(n,{anchor:o.getStartPoint(n,b),focus:o.getEndPoint(n,b)})}return o.getDefaultBoundingClientRect()},[n]),c=l&&a==="edit",{update:m,style:f,floating:g}=wt({open:c,getBoundingClientRect:d,...e});return x.useEffect(()=>{const w=at(n);if(w&&I.url(w),n.selection&&o.someNode(n,{match:{type:o.getPluginType(n,C)}})){I.show("edit",n.id),m();return}B.mode()==="edit"&&I.hide()},[n,r,m]),o.useHotkeys(u,w=>{w.preventDefault(),B.mode()==="edit"&&fe(n)},{enableOnContentEditable:!0},[]),Kn(),ft(),{style:{...f,zIndex:1e3},...t,ref:o.useComposedRef(t.ref,g)}},Hn=({floatingOptions:e,...t})=>{const n=o.useEditorRef(),r=Ve.useFocused(),a=ne().mode(),l=ne().isOpen(n.id),{triggerFloatingButtonHotkeys:u}=o.getPluginOptions(n,C);o.useHotkeys(u,f=>{f.preventDefault(),Ne(n,{focused:r})},{enableOnContentEditable:!0},[r]);const{update:d,style:c,floating:m}=wt({open:l&&a==="insert",getBoundingClientRect:o.getSelectionBoundingClientRect,whileElementsMounted:void 0,...e});return x.useEffect(()=>{l&&d(),I.updated(l)},[l,d]),ft(),{style:{...c,zIndex:1e3},...t,ref:o.useComposedRef(t.ref,m)}},_n=e=>{const t=o.useEditorRef();return{onClick:x.useCallback(()=>{fe(t)},[t]),...e}},Vn=o.createComponentAs(e=>{const t=_n(e);return o.createElementAs("button",t)}),zn=e=>{const t=o.useEditorRef();return{onClick:x.useCallback(()=>{se(t),o.focusEditor(t,t.selection??void 0)},[t]),...e}},$n=o.createComponentAs(e=>{const t=zn(e);return o.createElementAs(o.Button,t)}),Wn=o.createComponentAs(e=>{var n;const t=Un(e);return((n=t.style)==null?void 0:n.display)==="none"?null:o.createElementAs("div",t)}),qn=o.createComponentAs(e=>{var n;const t=Hn(e);return((n=t.style)==null?void 0:n.display)==="none"?null:o.createElementAs("div",t)}),ce={EditRoot:Wn,InsertRoot:qn,EditButton:Vn,UnlinkButton:$n},Gn=e=>{const t=ne().updated(),n=x.useRef(null);x.useEffect(()=>{n.current&&t&&setTimeout(()=>{var a;(a=n.current)==null||a.focus()},0)},[t]);const r=x.useCallback(a=>{I.url(a.target.value)},[]);return o.mergeProps({onChange:r,defaultValue:B.url()},{...e,ref:o.useComposedRef(e.ref,n)})},Kn=()=>{const e=o.useEditorRef();o.useHotkeys("*",t=>{t.key==="Enter"&&je(e)&&t.preventDefault()},{enableOnFormTags:["INPUT"]},[])},ft=()=>{const e=o.useEditorRef();o.useHotkeys("escape",()=>{if(B.mode()==="edit"){if(B.isEditing()){I.show("edit",e.id),o.focusEditor(e,e.selection??void 0);return}I.hide()}},{enableOnFormTags:["INPUT"],enableOnContentEditable:!0},[])},Xn=12,Qn=-22,Yn=96,wt=e=>o.useVirtualFloating({placement:"bottom-start",middleware:[o.offset({mainAxis:Xn,alignmentAxis:Qn}),o.flip({padding:Yn})],...e}),Jn=({id:e="rte",isEditing:t,value:n,columns:r,gap:a,placeholder:l,plugins:u,onTextChange:d,showSerializedText:c})=>{const[m,f]=x.useState(!1),g=w=>{d&&w!==n&&d(w),f(!1)};return x.useEffect(()=>{const w=b=>(b.preventDefault(),b.returnValue="Unprocessed changes");return m&&window.addEventListener("beforeunload",w),()=>window.removeEventListener("beforeunload",w)},[m]),t?s.jsx(i.RichTextEditor,{id:e,value:n,border:!1,placeholder:l,plugins:u,onValueChanged:()=>f(!0),onTextChange:g,hideExternalFloatingModals:w=>{B.isOpen(w)&&I.reset()}}):s.jsx(gn,{value:n,columns:r,gap:a,show:c,plugins:u})},Zn=({floatingOptions:e,...t})=>{const n=o.useEditorRef(),r=Ve.useFocused(),a=o.useFloatingLinkSelectors().mode(),l=o.useFloatingLinkSelectors().isOpen(n.id),{triggerFloatingLinkHotkeys:u}=o.getPluginOptions(n,o.ELEMENT_LINK);o.useHotkeys(u,f=>{o.triggerFloatingLinkInsert(n,{focused:r})&&f.preventDefault()},{enableOnContentEditable:!0},[r]);const{update:d,style:c,floating:m}=o.useVirtualFloatingLink({editorId:n.id,open:l&&a==="insert",getBoundingClientRect:o.getSelectionBoundingClientRect,whileElementsMounted:()=>{},...e});return x.useEffect(()=>{l?(d(),o.floatingLinkActions.updated(!0)):o.floatingLinkActions.updated(!1)},[l,d]),o.useFloatingLinkEscape(),{style:{...c,zIndex:1e3},...t,ref:o.useComposedRef(t.ref,m)}},es=o.createComponentAs(e=>{var n;const t=Zn({...e,floatingOptions:{strategy:"absolute"}});return((n=t.style)==null?void 0:n.display)==="none"?null:o.createElementAs("div",t)}),ts=o.createComponentAs(e=>{var n;const t=ss({...e,floatingOptions:{strategy:"absolute"}});return((n=t.style)==null?void 0:n.display)==="none"?null:o.createElementAs("div",t)});o.FloatingLink.EditRoot=ts;o.FloatingLink.InsertRoot=es;const ue=o.FloatingLink,ns=()=>{const e=o.useFloatingLinkUrlInput({});return s.jsx("div",{"data-test-id":"floating-link-edit",className:"tw-bg-white tw-text-text tw-rounded tw-shadow tw-p-4 tw-min-w-[400px]",children:s.jsxs("span",{"data-test-id":"preview-link-flyout",className:"tw-flex tw-justify-between tw-items-center",children:[s.jsx("span",{className:"tw-pointer-events-none",children:e.defaultValue}),s.jsxs("span",{className:"tw-flex tw-gap-2",children:[s.jsx("span",{role:"button",tabIndex:0,"data-test-id":"edit-link-button",className:"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1",children:s.jsx(ue.EditButton,{children:s.jsx(i.IconPen16,{})})}),s.jsx("span",{role:"button",tabIndex:0,"data-test-id":"remove-link-button",className:"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1",children:s.jsx(ue.UnlinkButton,{children:s.jsx(i.IconTrashBin16,{})})})]})]})})},ss=({floatingOptions:e,...t})=>{const n=o.useEditorRef(),r=o.usePlateSelectors().keyEditor(),a=o.useFloatingLinkSelectors().mode(),l=o.useFloatingLinkSelectors().isOpen(n.id),{triggerFloatingLinkHotkeys:u="command+k, ctrl+k"}=o.getPluginOptions(n,o.ELEMENT_LINK),d=x.useCallback(()=>{const w=o.getAboveNode(n,{match:{type:o.getPluginType(n,o.ELEMENT_LINK)}});if(w){const[,b]=w;return o.getRangeBoundingClientRect(n,{anchor:o.getStartPoint(n,b),focus:o.getEndPoint(n,b)})}return o.getDefaultBoundingClientRect()},[n]),c=l&&a==="edit",{update:m,style:f,floating:g}=o.useVirtualFloatingLink({editorId:n.id,open:c,getBoundingClientRect:d,...e});return x.useEffect(()=>{const w=et(n);if(w&&o.floatingLinkActions.url(w),n.selection&&o.someNode(n,{match:{type:o.getPluginType(n,o.ELEMENT_LINK)}})){o.floatingLinkActions.show("edit",n.id),m();return}o.floatingLinkSelectors.mode()==="edit"&&o.floatingLinkActions.hide()},[n,r,m]),o.useHotkeys(u,w=>{w.preventDefault(),o.floatingLinkSelectors.mode()==="edit"&&o.triggerFloatingLinkEdit(n)},{enableOnContentEditable:!0},[]),o.useFloatingLinkEnter(),o.useFloatingLinkEscape(),{style:{...f,zIndex:1e3},...t,ref:o.useComposedRef(t.ref,g)}},rs={url:"",text:"",newTab:i.CheckboxState.Unchecked},as=()=>{const[e,t]=x.useReducer((n,r)=>{const{type:a,payload:l}=r;switch(a){case"NEW_TAB":return{...n,newTab:i.CheckboxState.Checked};case"SAME_TAB":return{...n,newTab:i.CheckboxState.Unchecked};case"URL":case"TEXT":case"INIT":return{...n,...l};default:return n}},rs);return[e,t]},is=()=>{const e=o.useEditorRef(),[t,n]=as();x.useEffect(()=>{const f=Ye(e),g=Je(e);n({type:"INIT",payload:{text:o.floatingLinkSelectors.text(),newTab:o.floatingLinkSelectors.newTab()?i.CheckboxState.Checked:i.CheckboxState.Unchecked,url:f&&g===""?f:o.floatingLinkSelectors.url()}})},[n,e]);const r=f=>{n({type:"TEXT",payload:{text:f}})},a=f=>{n({type:"URL",payload:{url:f}})},l=f=>{n(f?{type:"NEW_TAB"}:{type:"SAME_TAB"})},u=()=>{o.floatingLinkActions.hide()},d=f=>{if(!te(t.url)||!c)return;const g=me(t.url);o.floatingLinkActions.text(t.text),o.floatingLinkActions.url(g),o.floatingLinkActions.newTab(t.newTab===i.CheckboxState.Checked),o.submitFloatingLink(e)&&(f==null||f.preventDefault())},c=t.url!==""&&t.text!=="",{appBridge:m}=o.getPluginOptions(e,o.ELEMENT_LINK);return o.useHotkeys("enter",d,{enableOnFormTags:["INPUT"]},[]),{state:t,onTextChange:r,onUrlChange:a,onToggleTab:l,onCancel:u,onSave:d,hasValues:c,isValidUrlOrEmpty:te,appBridge:m}},os=()=>s.jsx(dt,{...is(),testId:"floating-link-insert"}),ls=({readOnly:e})=>{const t=o.useFloatingLinkSelectors().isEditing();if(e)return null;const n=s.jsx(os,{}),r=t?n:s.jsx(ns,{});return s.jsxs(s.Fragment,{children:[s.jsx(ue.InsertRoot,{children:n}),s.jsx(ue.EditRoot,{children:r})]})},cs=({id:e,editorId:t})=>{const n=o.usePlateEditorState(o.useEventPlateId(t)),r=!!o.isRangeInSameBlock(n,{at:n.selection});return s.jsx("div",{"data-plugin-id":e,children:s.jsx(o.LinkToolbarButton,{tooltip:i.getTooltip(r?`Link
3
+ ${i.getHotkeyByPlatform("Ctrl+K")}`:"Links can only be set for a single text block."),icon:s.jsx("span",{className:"tw-p-2 tw-h-8 tw-justify-center tw-items-center tw-flex",children:s.jsx(i.IconLink,{size:i.IconSize.Size16})}),classNames:i.getButtonClassNames(r),styles:{root:{width:"24px",height:"24px"}},actionHandler:"onMouseDown"})})},us=e=>({...o.useElementProps({...e,elementToAttributes:n=>{var r,a;return{href:n.url||((a=(r=n.chosenLink)==null?void 0:r.searchResult)==null?void 0:a.link)||"",target:n.target||"_self"}}}),onMouseOver:n=>{n.stopPropagation()}}),ds=e=>{const t=us(e),{attributes:n,children:r}=e;return s.jsx("a",{...n,href:t.href,target:t.target,style:T[le],children:r})};class gs extends i.MarkupElement{constructor(t=o.ELEMENT_LINK,n=ds){super(t,n)}}const xt=e=>o.createPluginFactory({...o.createLinkPlugin(),renderAfterEditable:ls,options:{isUrl:he,rangeBeforeOptions:{matchString:" ",skipInvalid:!0,afterMatch:!0},triggerFloatingLinkHotkeys:"command+k, ctrl+k",appBridge:e}})();class yt extends i.Plugin{constructor(t,n=T[le]){super(le,{button:cs,markupElement:new gs,...t}),this.styles={},this.styles=n,this.appBridge=t==null?void 0:t.appBridge}plugins(){return[xt(this.appBridge)]}}const ms="textstyle-custom1-plugin";class pt extends i.Plugin{constructor({styles:t=T.custom1,...n}={}){super(y.custom1,{label:"Custom 1",markupElement:new hs,...n}),this.styles={},this.styles=t}plugins(){return[fs(this.styles)]}}class hs extends i.MarkupElement{constructor(t=ms,n=bt){super(t,n)}}const bt=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("p",{...t,style:r,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),children:n})},fs=e=>o.createPluginFactory({key:y.custom1,isElement:!0,deserializeHtml:{rules:[{validClassName:y.custom1}]}})({component:t=>s.jsx(bt,{...t,styles:e})}),ws="textstyle-custom2-plugin";class vt extends i.Plugin{constructor({styles:t=T.custom2,...n}={}){super(y.custom2,{label:"Custom 2",markupElement:new xs,...n}),this.styles={},this.styles=t}plugins(){return[ys(this.styles)]}}class xs extends i.MarkupElement{constructor(t=ws,n=kt){super(t,n)}}const kt=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("p",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},ys=e=>o.createPluginFactory({key:y.custom2,isElement:!0,deserializeHtml:{rules:[{validClassName:y.custom2}]}})({component:t=>s.jsx(kt,{...t,styles:e})}),ps="textstyle-custom3-plugin";class Ct extends i.Plugin{constructor({styles:t=T.custom3,...n}={}){super(i.TextStyles.custom3,{label:"Custom 3",markupElement:new bs,...n}),this.styles={},this.styles=t}plugins(){return[vs(this.styles)]}}class bs extends i.MarkupElement{constructor(t=ps,n=St){super(t,n)}}const St=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("p",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},vs=e=>o.createPluginFactory({key:i.TextStyles.custom3,isElement:!0,deserializeHtml:{rules:[{validClassName:i.TextStyles.custom3}]}})({component:t=>s.jsx(St,{...t,styles:e})}),ks="textstyle-heading1-plugin";class Et extends i.Plugin{constructor({styles:t=T.heading1,...n}={}){super(y.heading1,{label:"Heading 1",markupElement:new Cs,...n}),this.styles={},this.styles=t}plugins(){return[Ss(this.styles)]}}class Cs extends i.MarkupElement{constructor(t=ks,n=pe){super(t,n)}}const pe=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("h1",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},Ss=e=>o.createPluginFactory({key:y.heading1,isElement:!0,component:pe,deserializeHtml:{rules:[{validNodeName:["h1","H1"]}]}})({component:t=>s.jsx(pe,{...t,styles:e})}),Es="textstyle-heading2-plugin";class Pt extends i.Plugin{constructor({styles:t=T.heading2,...n}={}){super(y.heading2,{label:"Heading 2",markupElement:new Ps,...n}),this.styles={},this.styles=t}plugins(){return[Is(this.styles)]}}class Ps extends i.MarkupElement{constructor(t=Es,n=be){super(t,n)}}const be=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("h2",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},Is=e=>o.createPluginFactory({key:y.heading2,isElement:!0,component:be,deserializeHtml:{rules:[{validNodeName:["h2","H2"]}]}})({component:t=>s.jsx(be,{...t,styles:e})}),Ts="textstyle-heading3-plugin";class It extends i.Plugin{constructor({styles:t=T.heading3,...n}={}){super(y.heading3,{label:"Heading 3",markupElement:new Bs,...n}),this.styles={},this.styles=t}plugins(){return[js(this.styles)]}}class Bs extends i.MarkupElement{constructor(t=Ts,n=ve){super(t,n)}}const ve=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("h3",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},js=e=>o.createPluginFactory({key:y.heading3,isElement:!0,component:ve,deserializeHtml:{rules:[{validNodeName:["h3","H3"]}]}})({component:t=>s.jsx(ve,{...t,styles:e})}),Ls="textstyle-heading4-plugin";class Tt extends i.Plugin{constructor({styles:t=T.heading4,...n}={}){super(y.heading4,{label:"Heading 4",markupElement:new Ns,...n}),this.styles={},this.styles=t}plugins(){return[As(this.styles)]}}class Ns extends i.MarkupElement{constructor(t=Ls,n=ke){super(t,n)}}const ke=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("h4",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},As=e=>o.createPluginFactory({key:y.heading4,isElement:!0,component:ke,deserializeHtml:{rules:[{validNodeName:["h4","H4"]}]}})({component:t=>s.jsx(ke,{...t,styles:e})}),Rs="textstyle-imageCaption-plugin";class Bt extends i.Plugin{constructor({styles:t=T.imageCaption,...n}={}){super(y.imageCaption,{label:"Image Caption",markupElement:new Fs,...n}),this.styles={},this.styles=t}plugins(){return[Ms(this.styles)]}}class Fs extends i.MarkupElement{constructor(t=Rs,n=Ce){super(t,n)}}const Ce=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("p",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},Ms=e=>o.createPluginFactory({key:y.imageCaption,isElement:!0,component:Ce,deserializeHtml:{rules:[{validClassName:y.imageCaption}]}})({component:t=>s.jsx(Ce,{...t,styles:e})}),Ds="textstyle-imageTitle-plugin";class jt extends i.Plugin{constructor({styles:t=T.imageTitle,...n}={}){super(y.imageTitle,{label:"Image Title",markupElement:new Os,...n}),this.styles={},this.styles=t}plugins(){return[Us(this.styles)]}}class Os extends i.MarkupElement{constructor(t=Ds,n=Se){super(t,n)}}const Se=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("p",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},Us=e=>o.createPluginFactory({key:y.imageTitle,isElement:!0,component:Se,deserializeHtml:{rules:[{validClassName:y.imageTitle}]}})({component:t=>s.jsx(Se,{...t,styles:e})});class Lt extends i.Plugin{constructor({styles:t=T.p,...n}={}){super(y.p,{markupElement:new At,label:"Body Text",...n}),this.styles={},this.styles=t}plugins(){return[Rt(this.styles)]}}const Nt="tw-m-0 tw-px-0 tw-py-0",de=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align,l=i.merge([a&&i.alignmentClassnames[a],Nt,i.getColumnBreakClasses(e)]);return s.jsx("p",{...t,className:l,style:r,children:n})};class At extends i.MarkupElement{constructor(t=y.p,n=de){super(t,n)}}const Rt=e=>o.createPluginFactory({...o.createParagraphPlugin(),key:y.p,isElement:!0,component:de})({component:t=>s.jsx(de,{...t,styles:e})}),Hs="textstyle-quote-plugin";class Ft extends i.Plugin{constructor({styles:t=T.quote,...n}={}){super(y.quote,{label:"Quote",markupElement:new _s,...n}),this.styles={},this.styles=t}plugins(){return[Mt(this.styles)]}}class _s extends i.MarkupElement{constructor(t=Hs,n=ge){super(t,n)}}const ge=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("blockquote",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},Mt=e=>o.createPluginFactory({key:y.quote,isElement:!0,component:ge,deserializeHtml:{rules:[{validNodeName:["blockquote","BLOCKQUOTE"]}]}})({component:t=>s.jsx(ge,{...t,styles:e})}),Ae=[new Et,new Pt,new It,new Tt,new pt,new vt,new Ct,new Ft,new Lt],ee=[y.heading1,y.heading2,y.heading3,y.heading4,y.custom1,y.custom2,y.custom3,y.quote,y.p],Vs=[...Ae,new Bt,new jt],zs=[...ee,y.imageCaption,y.imageTitle],$s=e=>new i.PluginComposer().setPlugin(new i.SoftBreakPlugin,new i.TextStylePlugin({textStyles:Ae})).setPlugin([new i.BoldPlugin,new i.ItalicPlugin,new i.UnderlinePlugin,new i.StrikethroughPlugin,new yt({appBridge:e}),new ht({appBridge:e}),new i.CodePlugin],[new i.AlignLeftPlugin({validTypes:ee}),new i.AlignCenterPlugin({validTypes:ee}),new i.AlignRightPlugin({validTypes:ee}),new i.AlignJustifyPlugin({validTypes:ee}),new i.UnorderedListPlugin,new i.CheckboxListPlugin,new i.OrderedListPlugin,new i.ResetFormattingPlugin,new i.AutoformatPlugin]),Ws="--f-theme-settings-",qs=(e,t)=>{const{blockAssets:n,updateAssetIdsFromKey:r}=G.useBlockAssets(e),a=(n==null?void 0:n[t])||[];return{onAddAttachments:async m=>{const f=a.map(g=>g.id);for(const g of m)f.push(g.id);await r(t,f)},onAttachmentDelete:async m=>{const f=a.filter(g=>g.id!==m.id).map(g=>g.id);await r(t,f)},onAttachmentReplace:async(m,f)=>{const g=a.map(w=>w.id===m.id?f.id:w.id);await r(t,g)},onAttachmentsSorted:async m=>{const f=m.map(g=>g.id);await r(t,f)},attachments:a}},Gs={start:["Space","Enter"],cancel:[],end:["Space","Enter","Escape"]},Ks=(e=0,t=0)=>{const n=Xe(e,t);return P.useSensors(P.useSensor(P.PointerSensor),P.useSensor(P.KeyboardSensor,{coordinateGetter:n,keyboardCodes:Gs}))},Xs=e=>{const t=e!=null&&e.id?`hasBackground${e.id}`:"hasBackground",n=e!=null&&e.id?`backgroundColor${e.id}`:"backgroundColor",r=e!=null&&e.preventDefaultColor?void 0:(e==null?void 0:e.defaultColor)||tn,a=e!=null&&e.switchLabel?e.switchLabel:void 0;return{id:t,label:"Background",type:"switch",switchLabel:a,defaultValue:!!(e!=null&&e.defaultValue),on:[{id:n,defaultValue:r,type:"colorInput"}]}},Qs=e=>{const t=e!=null&&e.id?`hasBorder_${e.id}`:"hasBorder",n=e!=null&&e.id?`borderSelection_${e.id}`:"borderSelection",r=e!=null&&e.id?`borderStyle_${e.id}`:"borderStyle",a=e!=null&&e.id?`borderWidth_${e.id}`:"borderWidth",l=e!=null&&e.id?`borderColor_${e.id}`:"borderColor",u=(e==null?void 0:e.defaultColor)||We,d=e!=null&&e.switchLabel?e.switchLabel:void 0;return{id:t,label:"Border",type:"switch",switchLabel:d,defaultValue:!!(e!=null&&e.defaultValue),on:[{id:n,type:"multiInput",onChange:c=>h.appendUnit(c,a),layout:h.MultiInputLayout.Columns,lastItemFullWidth:!0,blocks:[{id:r,type:"dropdown",defaultValue:M.Solid,choices:[{value:M.Solid,label:M.Solid},{value:M.Dotted,label:M.Dotted},{value:M.Dashed,label:M.Dashed}]},{id:a,type:"input",defaultValue:nn,rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)],placeholder:"e.g. 3px"},{id:l,type:"colorInput",defaultValue:u}]}],off:[]}},Re=(e,t=H.None)=>({id:e,type:"segmentedControls",defaultValue:t,choices:[{value:H.None,label:"None"},{value:H.Small,label:"S"},{value:H.Medium,label:"M"},{value:H.Large,label:"L"}]}),Ys=e=>{const t=e!=null&&e.id?`hasRadius_${e.id}`:"hasRadius",n=e!=null&&e.id?`radiusValue_${e.id}`:"radiusValue",r=e!=null&&e.id?`radiusChoice_${e.id}`:"radiusChoice",a=(e==null?void 0:e.defaultRadius)||H.None;return{id:t,label:"Corner radius",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"Determining how rounded the corners are.",show:l=>{var u;return e!=null&&e.dependentSettingId?!!((u=l.getBlock(e.dependentSettingId))!=null&&u.value):!0},onChange:l=>h.presetCustomValue(l,r,n,(e==null?void 0:e.radiusStyleMap)||W),on:[{id:n,type:"input",placeholder:"e.g. 10px",rules:[h.numericalOrPixelRule],onChange:l=>h.appendUnit(l,n)}],off:[Re(r,a)]}},Js=e=>{const t=e!=null&&e.id?`hasExtendedCustomRadius_${e.id}`:"hasExtendedCustomRadius",n=e!=null&&e.id?`extendedRadiusValue_${e.id}`:"extendedRadiusValue",r=e!=null&&e.id?`extendedRadiusChoice_${e.id}`:"extendedRadiusChoice",a=e!=null&&e.id?`extendedRadiusTopLeft_${e.id}`:"extendedRadiusTopLeft",l=e!=null&&e.id?`extendedRadiusTopRight_${e.id}`:"extendedRadiusTopRight",u=e!=null&&e.id?`extendedRadiusBottomLeft_${e.id}`:"extendedRadiusBottomLeft",d=e!=null&&e.id?`extendedRadiusBottomRight_${e.id}`:"extendedRadiusBottomRight";return{id:t,label:"Corner radius",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"Determining how rounded the corners are.",show:c=>{var m;return e!=null&&e.dependentSettingId?!!((m=c.getBlock(e.dependentSettingId))!=null&&m.value):!0},onChange:c=>{h.presetCustomValue(c,r,a,W),h.presetCustomValue(c,r,l,W),h.presetCustomValue(c,r,u,W),h.presetCustomValue(c,r,d,W)},on:[{id:n,type:"multiInput",layout:h.MultiInputLayout.Columns,blocks:[{id:a,type:"input",label:"Top Left",rules:[h.numericalOrPixelRule],onChange:c=>h.appendUnit(c,a)},{id:l,type:"input",label:"Top Right",rules:[h.numericalOrPixelRule],onChange:c=>h.appendUnit(c,l)},{id:u,type:"input",label:"Bottom Left",rules:[h.numericalOrPixelRule],onChange:c=>h.appendUnit(c,u)},{id:d,type:"input",label:"Bottom Right",rules:[h.numericalOrPixelRule],onChange:c=>h.appendUnit(c,d)}]}],off:[Re(r,e==null?void 0:e.defaultValue)]}},Zs=e=>{const t=e!=null&&e.id?e.id:"hasCustomSpacing",n=e!=null&&e.dependentSettingId?e.dependentSettingId:"columns",r=e!=null&&e.spacingChoiceId?e.spacingChoiceId:"spacingChoice",a=e!=null&&e.spacingCustomId?e.spacingCustomId:"spacingCustom",l=e!=null&&e.defaultValueChoices?e.defaultValueChoices:$.M;return{id:t,type:"switch",defaultValue:!1,switchLabel:"Custom",label:"Gutter",info:"An official nerds term for ‘gap’",onChange:u=>h.presetCustomValue(u,r,a,$e),show:u=>{var d;return((d=u.getBlock(n))==null?void 0:d.value)!=="1"},on:[{id:a,type:"input",rules:[h.numericalOrPixelRule],onChange:u=>h.appendUnit(u,a)}],off:[{id:r,type:"slider",defaultValue:l,choices:[{value:$.Auto,label:"Auto"},{value:$.S,label:"S"},{value:$.M,label:"M"},{value:$.L,label:"L"}]}]}},Fe=e=>({id:e,type:"segmentedControls",defaultValue:z.None,choices:[{value:z.None,label:"None"},{value:z.Small,label:"S"},{value:z.Medium,label:"M"},{value:z.Large,label:"L"}]}),er=e=>{const t=e!=null&&e.id?`hasCustomMarginValue_${e==null?void 0:e.id}`:"hasCustomMarginValue",n=e!=null&&e.id?`marginValue_${e==null?void 0:e.id}`:"marginValue",r=e!=null&&e.id?`marginChoice_${e==null?void 0:e.id}`:"marginChoice";return{id:t,label:"Margin",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more space",onChange:a=>h.presetCustomValue(a,r,n,(e==null?void 0:e.marginStyleMap)||Z),on:[{id:n,type:"input",placeholder:ie,rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)],onChange:a=>h.appendUnit(a,n)}],off:[Fe(r)]}},tr=e=>{const t=e!=null&&e.id?`hasExtendedCustomMargin_${e==null?void 0:e.id}`:"hasExtendedCustomMargin",n=e!=null&&e.id?`extendedMarginValues_${e==null?void 0:e.id}`:"extendedMarginValues",r=e!=null&&e.id?`extendedMarginChoice_${e==null?void 0:e.id}`:"extendedMarginChoice",a=e!=null&&e.id?`extendedMarginTop_${e==null?void 0:e.id}`:"extendedMarginTop",l=e!=null&&e.id?`extendedMarginLeft_${e==null?void 0:e.id}`:"extendedMarginLeft",u=e!=null&&e.id?`extendedMarginRight_${e==null?void 0:e.id}`:"extendedMarginRight",d=e!=null&&e.id?`extendedMarginBottom_${e==null?void 0:e.id}`:"extendedMarginBottom";return{id:t,label:"Margin",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more negative space",onChange:c=>{h.presetCustomValue(c,r,a,Z),h.presetCustomValue(c,r,l,Z),h.presetCustomValue(c,r,u,Z),h.presetCustomValue(c,r,d,Z)},on:[{id:n,type:"multiInput",layout:h.MultiInputLayout.Spider,blocks:[{id:a,type:"input",label:"Top",placeholder:ie,onChange:c=>h.appendUnit(c,a),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:l,type:"input",label:"Left",placeholder:ie,onChange:c=>h.appendUnit(c,l),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:u,type:"input",label:"Right",placeholder:ie,onChange:c=>h.appendUnit(c,u),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:d,type:"input",label:"Bottom",placeholder:ie,onChange:c=>h.appendUnit(c,d),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]}]}],off:[Fe(r)]}},Me=e=>({id:e,type:"segmentedControls",defaultValue:V.Small,choices:[{value:V.None,label:"None"},{value:V.Small,label:"S"},{value:V.Medium,label:"M"},{value:V.Large,label:"L"}]}),nr=e=>{const t=e!=null&&e.id?`hasCustomPaddingValue_${e==null?void 0:e.id}`:"hasCustomPaddingValue",n=e!=null&&e.id?`paddingValue_${e==null?void 0:e.id}`:"paddingValue",r=e!=null&&e.id?`paddingChoice_${e==null?void 0:e.id}`:"paddingChoice";return{id:t,label:"Padding",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more negative space",onChange:a=>h.presetCustomValue(a,r,n,(e==null?void 0:e.paddingStyleMap)||J),on:[{id:n,type:"input",placeholder:ae,rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)],onChange:a=>h.appendUnit(a,n)}],off:[Me(r)]}},sr=e=>{const t=e!=null&&e.id?`hasExtendedCustomPadding_${e==null?void 0:e.id}`:"hasExtendedCustomPadding",n=e!=null&&e.id?`extendedPaddingValues_${e==null?void 0:e.id}`:"extendedPaddingValues",r=e!=null&&e.id?`extendedPaddingChoice_${e==null?void 0:e.id}`:"extendedPaddingChoice",a=e!=null&&e.id?`extendedPaddingTop_${e==null?void 0:e.id}`:"extendedPaddingTop",l=e!=null&&e.id?`extendedPaddingLeft_${e==null?void 0:e.id}`:"extendedPaddingLeft",u=e!=null&&e.id?`extendedPaddingRight_${e==null?void 0:e.id}`:"extendedPaddingRight",d=e!=null&&e.id?`extendedPaddingBottom_${e==null?void 0:e.id}`:"extendedPaddingBottom";return{id:t,label:"Padding",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more negative space",onChange:c=>{h.presetCustomValue(c,r,a,J),h.presetCustomValue(c,r,l,J),h.presetCustomValue(c,r,u,J),h.presetCustomValue(c,r,d,J)},on:[{id:n,type:"multiInput",layout:h.MultiInputLayout.Spider,blocks:[{id:a,type:"input",label:"Top",placeholder:ae,onChange:c=>h.appendUnit(c,a),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:l,type:"input",label:"Left",placeholder:ae,onChange:c=>h.appendUnit(c,l),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:u,type:"input",label:"Right",placeholder:ae,onChange:c=>h.appendUnit(c,u),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:d,type:"input",label:"Bottom",placeholder:ae,onChange:c=>h.appendUnit(c,d),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]}]}],off:[Me(r)]}},rr=e=>{const t=De(e==null?void 0:e.globalControlId);return{id:e!=null&&e.id?e.id:"downloadable",type:"switch",defaultValue:!1,label:"Downloadable",show:n=>{var r;return((r=n.getBlock(t))==null?void 0:r.value)===q.Custom}}},De=e=>e||"security",ar=e=>[{id:De(e),type:"segmentedControls",defaultValue:q.Global,choices:[{value:q.Global,label:"Global Settings"},{value:q.Custom,label:"Custom"}]},{id:"globalSettingsInfo",type:"notification",footer:h.createFooter({label:"Change global settings [here].",replace:{here:{event:"general-settings.open"}}})}];var Dt=(e=>(e.Main="main",e.Basics="basics",e.Layout="layout",e.Style="style",e.Security="security",e.Targets="targets",e))(Dt||{});const ir=e=>e,or=e=>e;exports.AllTextStylePlugins=Vs;exports.AllTextStyles=zs;exports.Attachments=un;exports.BUTTON_PLUGIN=gt;exports.BlockButtonStyles=we;exports.BlockInjectButton=Wt;exports.BlockItemWrapper=on;exports.BlockStyles=T;exports.BorderStyle=M;exports.ButtonPlugin=ht;exports.Custom1Plugin=pt;exports.Custom2Plugin=vt;exports.Custom3Plugin=Ct;exports.DEFAULT_DRAGGING_TOOLTIP=Ge;exports.DEFAULT_DRAG_TOOLTIP=qe;exports.DownloadButton=dn;exports.ELEMENT_BUTTON=C;exports.GutterSpacing=$;exports.Heading1Plugin=Et;exports.Heading2Plugin=Pt;exports.Heading3Plugin=It;exports.Heading4Plugin=Tt;exports.ImageCaptionPlugin=Bt;exports.ImageTitlePlugin=jt;exports.LinkInput=ut;exports.LinkPlugin=yt;exports.LinkSelector=ct;exports.Margin=z;exports.PARAGRAPH_CLASSES=Nt;exports.Padding=V;exports.ParagraphMarkupElement=At;exports.ParagraphMarkupElementNode=de;exports.ParagraphPlugin=Lt;exports.QuoteMarkupElementNode=ge;exports.QuotePlugin=Ft;exports.Radius=H;exports.RichTextEditor=Jn;exports.Sections=Dt;exports.Security=q;exports.THEME_PREFIX=Ws;exports.TextStylePluginsWithoutImage=Ae;exports.TextStyles=y;exports.TextStylesWithoutImage=ee;exports.addHttps=me;exports.borderStyleMap=ze;exports.convertToRteValue=mn;exports.createButtonNode=it;exports.createButtonPlugin=mt;exports.createLinkPlugin=xt;exports.createParagraphPlugin=Rt;exports.createQuotePlugin=Mt;exports.customCoordinatesGetterFactory=Xe;exports.defineBlock=ir;exports.defineSettings=or;exports.getBackgroundColorStyles=en;exports.getBackgroundSettings=Xs;exports.getBorderRadiusSettings=Ys;exports.getBorderRadiusSlider=Re;exports.getBorderSettings=Qs;exports.getBorderStyles=sn;exports.getDefaultPluginsWithLinkChooser=$s;exports.getExtendedBorderRadiusSettings=Js;exports.getGutterSettings=Zs;exports.getLegacyUrl=Ye;exports.getLinkFromEditor=et;exports.getMarginExtendedSettings=tr;exports.getMarginSettings=er;exports.getMarginSlider=Fe;exports.getPaddingExtendedSettings=sr;exports.getPaddingSettings=nr;exports.getPaddingSlider=Me;exports.getRadiusStyles=rn;exports.getReadableColor=Jt;exports.getSecurityDownloadableSetting=rr;exports.getSecurityGlobalControlId=De;exports.getSecurityGlobalControlSetting=ar;exports.getUrl=Je;exports.getUrlFromEditor=at;exports.getUrlFromLinkOrLegacyLink=Ze;exports.gutterSpacingStyleMap=$e;exports.hasRichTextValue=Ke;exports.insertButton=nt;exports.isDark=Gt;exports.isDownloadable=fn;exports.isValidUrl=he;exports.isValidUrlOrEmpty=te;exports.joinClassNames=D;exports.mapAppBridgeColorPaletteToFonduePalette=Qe;exports.mapAppBridgeColorPalettesToFonduePalettes=wn;exports.marginStyleMap=Z;exports.moveItemInArray=Zt;exports.paddingStyleMap=J;exports.radiusStyleMap=W;exports.relativeUrlRegex=Te;exports.setAlpha=Qt;exports.submitFloatingButton=je;exports.toColorObject=Yt;exports.toHex8String=Kt;exports.toHexString=Xt;exports.toRgbaString=Ee;exports.toShortRgba=K;exports.triggerFloatingButton=ot;exports.triggerFloatingButtonEdit=fe;exports.triggerFloatingButtonInsert=Ne;exports.unwrapButton=se;exports.upsertButton=st;exports.upsertButtonText=Le;exports.useAttachments=qs;exports.useDndSensors=Ks;exports.withButton=tt;exports.wrapButton=rt;Object.keys(h).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>h[e]})});
4
4
  //# sourceMappingURL=index.cjs.js.map