@frontify/guideline-blocks-settings 0.34.2 → 0.34.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var pn=Object.defineProperty;var yn=(e,t,n)=>t in e?pn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var B=(e,t,n)=>(yn(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("@frontify/sidebar-settings"),a=require("react/jsx-runtime"),r=require("@frontify/fondue"),h=require("react"),G=require("@frontify/app-bridge"),T=require("@dnd-kit/core"),vn=require("@dnd-kit/modifiers"),ue=require("@dnd-kit/sortable"),tt=require("@react-aria/focus"),Cn=require("@react-stately/overlays"),_=require("@ctrl/tinycolor"),O=e=>e.filter(Boolean).join(" "),Sn=({onDrop:e,label:t,icon:n,secondaryLabel:s,isLoading:o,fillParentContainer:i,onAssetChooseClick:l,onUploadClick:u,withMenu:c=!0,onClick:f,validFileType:m,verticalLayout:d})=>{const[x,w]=h.useState(!1),[b,v]=h.useState(),k=h.useRef(null),[E,A]=h.useState(void 0),R=S=>{if(S.preventDefault(),w(!1),!F(S.dataTransfer.files)){A("Invalid"),setTimeout(()=>{A(void 0)},1e3);return}e==null||e(S.dataTransfer.files)},F=S=>{if(!m)return!0;for(let L=0;L<S.length;L++){const M=S[L].name.split(".").pop()??"";if(!G.FileExtensionSets[m].includes(M))return!1}return!0},U=S=>{if(!k.current||o)return;const{left:L,top:M}=k.current.getBoundingClientRect(),le=S.clientX-L,ce=S.clientY-M;v([le,ce])};return a.jsxs("button",{ref:k,"data-test-id":"block-inject-button",className:O(["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",d?"[&: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",i?"tw-h-full":"tw-h-[72px]",x&&!o?"tw-border-dashed":"tw-border-solid",b&&"tw-bg-blank-state-pressed-inverse",x&&"tw-bg-blank-state-weak-inverse",E?"!tw-border-red-50 !tw-cursor-not-allowed":" tw-border-blank-state-line",o||b||x||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",(x||b)&&!E?"[&>*]:tw-pointer-events-none tw-border-blank-state-line-hover":"tw-bg-blank-state-shaded-inverse tw-text-blank-state-shaded"]),onDragEnter:e?S=>{var L;if(w(!0),m==="Images")for(const M of Array.from(S.dataTransfer.items))(L=M==null?void 0:M.type)!=null&&L.startsWith("image/")?A(void 0):A("Invalid")}:void 0,onDragLeave:e?()=>{w(!1),A(void 0)}:void 0,onDrop:e?R:void 0,onClick:S=>{c&&U(S),f==null||f()},children:[o?a.jsx(r.LoadingCircle,{}):E?a.jsxs("div",{className:" tw-flex tw-items-center tw-justify-center tw-text-red-60 tw-font-medium",children:[a.jsx(r.IconExclamationMarkTriangle,{}),E]}):a.jsxs(a.Fragment,{children:[n&&a.jsx("div",{children:n}),(t||s)&&a.jsxs("div",{className:"tw-flex tw-flex-col tw-items-start",children:[t&&a.jsx("div",{className:"tw-font-medium",children:t}),s&&a.jsx("div",{className:"tw-font-normal",children:s})]})]}),b&&a.jsx("div",{className:"tw-absolute tw-left-0 tw-top-full tw-z-20",style:{left:b[0],top:b[1]},children:a.jsx(r.Flyout,{onOpenChange:S=>!S&&v(void 0),isOpen:!0,fitContent:!0,hug:!1,legacyFooter:!1,trigger:a.jsx("div",{}),children:a.jsx(r.ActionMenu,{menuBlocks:[{id:"menu",menuItems:[...u?[{id:"upload",size:r.MenuItemContentSize.XSmall,title:"Upload asset",onClick:()=>{u(),v(void 0)},initialValue:!0,decorator:a.jsx("div",{className:"tw-mr-2",children:a.jsx(r.IconArrowCircleUp20,{})})}]:[],...l?[{id:"asset",size:r.MenuItemContentSize.XSmall,title:"Browse asset",onClick:()=>{l(),v(void 0)},initialValue:!0,decorator:a.jsx("div",{className:"tw-mr-2",children:a.jsx(r.IconImageStack20,{})})}]:[]]}]})})})]})},X=e=>{const t=s=>typeof s=="object"&&["red","green","blue"].every(i=>s.hasOwnProperty(i)),n=s=>{const o=typeof s.alpha=="number"?s.alpha:1;return{r:s.red,g:s.green,b:s.blue,a:o}};return t(e)?n(e):e},kn=e=>typeof e=="object"&&["red","green","blue"].every(n=>e==null?void 0:e.hasOwnProperty(n)),Tn=(e,t)=>{const n=kn(e)?X(e):e,s=new _.TinyColor(n);return t?s.getBrightness()<t:s.isDark()||s.getAlpha()>.25&&s.getAlpha()<1},Pn=e=>new _.TinyColor(X(e)).toHex8String(),In=e=>new _.TinyColor(X(e)).toHexString(),Ee=e=>new _.TinyColor(X(e)).toRgbString(),En=(e,t)=>new _.TinyColor(t).setAlpha(e).toRgbString(),Bn=e=>{const{r:t,g:n,b:s,a:o}=new _.TinyColor(e);return{red:t,green:n,blue:s,alpha:o}},Ye=e=>typeof e=="object"&&["red","green","blue"].every(n=>e==null?void 0:e.hasOwnProperty(n)),jn=(e,t)=>{const n=Ye(e)?X(e):e,s=Ye(t)?X(t):t;let o=new _.TinyColor(n);const i=new _.TinyColor(s);for(;_.readability(o,i)<4.5;)o=o.darken(1);return o.toRgbString()},Nn=(e,t,n)=>{const s=[...e],o=n<0?s.length+n:n;if(o>=0&&o<s.length){const i=s.splice(t,1)[0];s.splice(o,0,i)}return s},Ln=e=>({backgroundColor:Ee(e)});var D=(e=>(e.Solid="Solid",e.Dashed="Dashed",e.Dotted="Dotted",e))(D||{});const nt={Solid:"solid",Dotted:"dotted",Dashed:"dashed"};var H=(e=>(e.None="None",e.Small="Small",e.Medium="Medium",e.Large="Large",e))(H||{});const q={None:"0px",Small:"2px",Medium:"4px",Large:"12px"};var z=(e=>(e.None="None",e.Small="Small",e.Medium="Medium",e.Large="Large",e))(z||{});const Y={None:"0px",Small:"24px",Medium:"36px",Large:"60px"};var $=(e=>(e.None="None",e.Small="Small",e.Medium="Medium",e.Large="Large",e))($||{});const J={None:"0px",Small:"24px",Medium:"36px",Large:"60px"};var K=(e=>(e.Global="Global",e.Custom="Custom",e))(K||{}),W=(e=>(e.Auto="Auto",e.S="S",e.M="M",e.L="L",e))(W||{});const rt={Auto:"4px",S:"10px",M:"30px",L:"50px"},An={red:241,green:241,blue:241,alpha:1},st={red:234,green:235,blue:235,alpha:1},Rn="1px",re="24px",se="24px",Mn=(e=D.Solid,t="1px",n=st)=>({borderStyle:nt[e],borderWidth:t,borderColor:Ee(n)}),Fn=(e,t=!1,n)=>({borderRadius:t?n:q[e]}),at=h.createContext(!1),ot=({children:e,isDragPreview:t})=>a.jsx(at.Provider,{value:t,children:e}),oe=()=>h.useContext(at),it=h.createContext({openFlyoutIds:[],setOpenFlyoutIds:()=>console.error("No MultiFlyoutContext Provider found")}),lt=({children:e,openFlyoutIds:t,setOpenFlyoutIds:n})=>{const s=h.useMemo(()=>({openFlyoutIds:t,setOpenFlyoutIds:n}),[t,n]);return a.jsx(it.Provider,{value:s,children:e})},ct=()=>h.useContext(it),he=e=>{const{openFlyoutIds:t,setOpenFlyoutIds:n}=ct(),s=h.useCallback(o=>{n(i=>{const l=i.filter(u=>u!==e);return o?[...l,e]:l})},[e,n]);return{isOpen:t.includes(e),onOpenChange:s}},Je=({children:e})=>a.jsx("div",{className:"tw-pointer-events-auto tw-flex tw-flex-shrink-0 tw-gap-px tw-px-px tw-h-[26px] tw-items-center tw-self-start tw-leading-none",children:e}),ut=(e,t)=>{const{blockAssets:n,addAssetIdsToKey:s,deleteAssetIdsFromKey:o,updateAssetIdsFromKey:i}=G.useBlockAssets(e),l=(n==null?void 0:n[t])||[];return{onAttachmentsAdd:async d=>{await s(t,d.map(x=>x.id))},onAttachmentDelete:async d=>{await o(t,[d.id])},onAttachmentReplace:async(d,x)=>{const w=l.map(b=>b.id===d.id?x.id:b.id);await i(t,w)},onAttachmentsSorted:async d=>{const x=d.map(w=>w.id);await i(t,x)},attachments:l,appBridge:e}},dt=h.createContext(null),gt=({appBridge:e,children:t,assetId:n})=>{const s=ut(e,n);return a.jsx(dt.Provider,{value:s,children:t})},mt=()=>{const e=h.useContext(dt);if(!e)throw new Error("No AttachmentsContext Provided. Component must be wrapped in an 'AttachmentsProvider' or the 'withAttachmentsProvider' HOC");return e},Dn=(e,t)=>{const n=s=>a.jsx(gt,{appBridge:s.appBridge,assetId:t,children:a.jsx(e,{...s})});return n.displayName="withAttachmentsProvider",n},On=[T.KeyboardCode.Down,T.KeyboardCode.Right,T.KeyboardCode.Up,T.KeyboardCode.Left],ht=(e,t)=>(n,{currentCoordinates:s,context:{activeNode:o}})=>{if(n.preventDefault(),On.includes(n.code)){const i=(o==null?void 0:o.offsetWidth)??0,l=(o==null?void 0:o.offsetHeight)??0;switch(n.code){case T.KeyboardCode.Right:return{...s,x:s.x+i+e};case T.KeyboardCode.Left:return{...s,x:s.x-i-e};case T.KeyboardCode.Down:return{...s,y:s.y+l+t};case T.KeyboardCode.Up:return{...s,y:s.y-l-t}}}},Un={start:["Space","Enter"],cancel:[],end:["Space","Enter","Escape"]},_n=(e=0,t=0)=>{const n=ht(e,t);return T.useSensors(T.useSensor(T.PointerSensor),T.useSensor(T.KeyboardSensor,{coordinateGetter:n,keyboardCodes:Un}))},Hn=e=>e==="IMAGE"?a.jsx(r.IconImage24,{}):e==="VIDEO"?a.jsx(r.IconPlayFrame24,{}):e==="AUDIO"?a.jsx(r.IconMusicNote24,{}):a.jsx(r.IconDocument24,{}),Be=h.forwardRef(({item:e,isEditing:t,draggableProps:n,transformStyle:s,isDragging:o,isOverlay:i,isLoading:l,onDelete:u,onReplaceWithBrowse:c,onReplaceWithUpload:f,onDownload:m},d)=>{const[x,w]=h.useState(),[b,{selectedFiles:v}]=G.useFileInput({multiple:!0,accept:"image/*"}),[k,{results:E,doneAll:A}]=G.useAssetUpload(),{focusProps:R,isFocusVisible:F}=tt.useFocusRing();h.useEffect(()=>{v&&k(v[0])},[v]),h.useEffect(()=>{A&&f(E[0])},[A,E]);const U=l||v&&!A;return a.jsxs("button",{"aria-label":"Download attachment","data-test-id":"attachments-item",onClick:()=>m==null?void 0:m(),ref:d,style:{...s,opacity:o&&!i?.3:1,fontFamily:"var(-f-theme-settings-body-font-family)"},className:O(["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",o?"tw-bg-box-neutral-hover":""]),children:[a.jsx("div",{className:"tw-text-text-weak group-hover:tw-text-box-neutral-inverse-hover",children:U?a.jsx(r.LoadingCircle,{size:r.LoadingCircleSize.Small}):Hn(e.objectType)}),a.jsxs("div",{className:"tw-text-s tw-flex-1 tw-min-w-0",children:[a.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}),a.jsx("div",{className:"tw-text-text-weak",children:`${e.fileSizeHumanReadable} - ${e.extension}`})]}),t&&a.jsxs("div",{"data-test-id":"attachments-actionbar",className:O(["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",i||(x==null?void 0:x.id)===e.id?"tw-opacity-100":"tw-opacity-0"]),children:[a.jsx("button",{...R,...n,"aria-label":"Drag attachment",className:O([" 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 ",o||i?"tw-cursor-grabbing tw-bg-button-background-pressed hover:tw-bg-button-background-pressed":"tw-cursor-grab hover:tw-bg-button-background-hover",F&&r.FOCUS_STYLE,F&&"tw-z-[2]"]),children:a.jsx(r.IconGrabHandle20,{})}),a.jsx("div",{"data-test-id":"attachments-actionbar-flyout",children:a.jsx(r.Flyout,{placement:r.FlyoutPlacement.Right,isOpen:(x==null?void 0:x.id)===e.id,fitContent:!0,legacyFooter:!1,onOpenChange:S=>w(S?e:void 0),trigger:(S,L)=>a.jsx(r.Button,{ref:L,icon:a.jsx(r.IconPen20,{}),emphasis:r.ButtonEmphasis.Default,onClick:()=>w(e)}),children:a.jsx(r.ActionMenu,{menuBlocks:[{id:"menu",menuItems:[{id:"upload",size:r.MenuItemContentSize.XSmall,title:"Replace with upload",onClick:()=>{b(),w(void 0)},initialValue:!0,decorator:a.jsx("div",{className:"tw-mr-2",children:a.jsx(r.IconArrowCircleUp20,{})})},{id:"asset",size:r.MenuItemContentSize.XSmall,title:"Replace with asset",onClick:()=>{c(),w(void 0)},initialValue:!0,decorator:a.jsx("div",{className:"tw-mr-2",children:a.jsx(r.IconImageStack20,{})})}]},{id:"menu-delete",menuItems:[{id:"delete",size:r.MenuItemContentSize.XSmall,title:"Delete",style:r.MenuItemStyle.Danger,onClick:()=>{u(),w(void 0)},initialValue:!0,decorator:a.jsx("div",{className:"tw-mr-2",children:a.jsx(r.IconTrashBin20,{})})}]}]})})})]})]})});Be.displayName="AttachmentItem";const Vn=e=>{const{attributes:t,listeners:n,setNodeRef:s,transform:o,transition:i,isDragging:l}=ue.useSortable({id:e.item.id}),u={transform:o?`translate(${o.x}px, ${o.y}px)`:"",transition:i,zIndex:l?2:1},c={...t,...n};return a.jsx(Be,{ref:s,isDragging:l,transformStyle:u,draggableProps:c,...e})},zn=({children:e,isFlyoutOpen:t,triggerProps:n,triggerRef:s})=>a.jsxs("button",{className:O(["tw-flex tw-text-xs tw-font-body tw-items-center tw-gap-1 tw-rounded-full tw-outline tw-outline-1 tw-outline-offset-1 tw-p-1.5 tw-outline-line",t?"tw-bg-box-neutral-pressed tw-text-box-neutral-inverse-pressed":"tw-bg-base hover:tw-bg-box-neutral-hover active:tw-bg-box-neutral-pressed tw-text-box-neutral-inverse hover:tw-text-box-neutral-inverse-hover active:tw-text-box-neutral-inverse-pressed"]),...n,ref:s,"data-test-id":"attachments-button-trigger",children:[a.jsx(r.IconPaperclip16,{}),e,a.jsx(r.IconCaretDown12,{})]}),ft=({items:e=[],onDelete:t,onReplaceWithBrowse:n,onReplaceWithUpload:s,onBrowse:o,onUpload:i,onSorted:l,appBridge:u,triggerComponent:c=zn,isOpen:f,onOpenChange:m})=>{const[d,x]=h.useState(e),[w,b]=h.useState(!1),v=T.useSensors(T.useSensor(T.PointerSensor),T.useSensor(T.KeyboardSensor)),[k,E]=h.useState(void 0),[A,R]=h.useState(!1),[F,U]=h.useState([]),[S,L]=h.useState(null),M=G.useEditorState(u),{openAssetChooser:le,closeAssetChooser:ce}=G.useAssetChooser(u),We=f!==void 0,pe=We?f:w,Q=d==null?void 0:d.find(y=>y.id===k),[mn,{results:qe,doneAll:Ge}]=G.useAssetUpload({onUploadProgress:()=>!A&&R(!0)}),ne=y=>{const I=We?m:b;I==null||I(y)};h.useEffect(()=>{x(e)},[e]),h.useEffect(()=>{S&&(R(!0),mn(S))},[S]),h.useEffect(()=>{(async()=>{Ge&&(await i(qe),R(!1))})()},[Ge,qe]);const hn=()=>{ne(!1),le(y=>{o(y),ce(),ne(!0)},{multiSelection:!0,selectedValueIds:d.map(y=>y.id)})},Ke=y=>{ne(!1),le(async I=>{ne(!0),ce(),U([...F,y.id]),await n(y,I[0]),U(F.filter(V=>V!==y.id))},{multiSelection:!1,selectedValueIds:d.map(I=>I.id)})},Xe=async(y,I)=>{U([...F,y.id]),await s(y,I),U(F.filter(V=>V!==y.id))},fn=y=>{const{active:I}=y;E(I.id)},xn=y=>{const{active:I,over:V}=y;if(V&&I.id!==V.id&&d){const wn=d.findIndex(ye=>ye.id===I.id),bn=d.findIndex(ye=>ye.id===V.id),Qe=ue.arrayMove(d,wn,bn);x(Qe),l(Qe)}E(void 0)};return M||((d==null?void 0:d.length)??0)>0?a.jsx(r.LegacyTooltip,{withArrow:!0,position:r.TooltipPosition.Top,content:"Attachments",disabled:pe,enterDelay:500,triggerElement:a.jsx("div",{"data-test-id":"attachments-flyout-button",children:a.jsx(r.Flyout,{placement:r.FlyoutPlacement.BottomRight,onOpenChange:y=>ne(Q?!0:y),isOpen:pe,hug:!1,fitContent:!0,legacyFooter:!1,trigger:(y,I)=>a.jsx(c,{isFlyoutOpen:pe,triggerProps:y,triggerRef:I,children:a.jsx("div",{children:e.length>0?e.length:"Add"})}),children:a.jsxs("div",{className:"tw-w-[300px]","data-test-id":"attachments-flyout-content",children:[d.length>0&&a.jsxs(T.DndContext,{sensors:v,collisionDetection:T.closestCenter,onDragStart:fn,onDragEnd:xn,modifiers:[vn.restrictToWindowEdges],children:[a.jsx(ue.SortableContext,{items:d,strategy:ue.rectSortingStrategy,children:a.jsx("div",{className:"tw-border-b tw-border-b-line",children:d.map(y=>a.jsx(Vn,{isEditing:M,isLoading:F.includes(y.id),item:y,onDelete:()=>t(y),onReplaceWithBrowse:()=>Ke(y),onReplaceWithUpload:I=>Xe(y,I),onDownload:()=>u.dispatch({name:"downloadAsset",payload:y})},y.id))})}),a.jsx(T.DragOverlay,{children:Q&&a.jsx(Be,{isOverlay:!0,isEditing:M,item:Q,isDragging:!0,onDelete:()=>t(Q),onReplaceWithBrowse:()=>Ke(Q),onReplaceWithUpload:y=>Xe(Q,y)},k)})]}),M&&a.jsxs("div",{className:"tw-px-5 tw-py-3",children:[a.jsx("div",{className:"tw-font-body tw-font-medium tw-text-text tw-text-s tw-my-4",children:"Add attachments"}),a.jsx(r.AssetInput,{isLoading:A,size:r.AssetInputSize.Small,onUploadClick:y=>L(y),onLibraryClick:hn})]})]})})})}):null},$n=(e,t)=>{const n=[r.FOCUS_VISIBLE_STYLE,"tw-relative tw-inline-flex tw-items-center tw-justify-center","tw-h-6 tw-p-1","tw-rounded","tw-text-xs tw-font-medium","tw-gap-0.5","focus-visible:tw-z-10"];return t?n.push("tw-bg-box-neutral-pressed","tw-text-box-neutral-inverse-pressed",e==="grab"?"tw-cursor-grabbing":"tw-cursor-pointer"):n.push("hover:tw-bg-box-neutral-hover active:tw-bg-box-neutral-pressed","tw-text-text-weak hover:tw-text-box-neutral-inverse-hover active:tw-text-box-neutral-inverse-pressed",e==="grab"?"!tw-cursor-grab active:tw-cursor-grabbing":"tw-cursor-pointer"),O(n)},ie=h.forwardRef(({onClick:e,children:t,forceActiveStyle:n,cursor:s="pointer","data-test-id":o="base-toolbar-button",...i},l)=>a.jsx("button",{onClick:e,className:$n(s,n),"data-test-id":o,...i,ref:l,children:t}));ie.displayName="BaseToolbarButton";const Wn=({children:e,isFlyoutOpen:t,triggerProps:n,triggerRef:s})=>a.jsxs(ie,{forceActiveStyle:t,"data-test-id":"attachments-toolbar-button-trigger",...n,ref:s,children:[a.jsx(r.IconPaperclip16,{}),e,a.jsx(r.IconCaretDown12,{})]}),xt="attachments",wt=({flyoutId:e=xt})=>{const t=r.useMemoizedId(e),{appBridge:n,attachments:s,onAttachmentsAdd:o,onAttachmentDelete:i,onAttachmentReplace:l,onAttachmentsSorted:u}=mt(),{isOpen:c,onOpenChange:f}=he(t),m=oe();return a.jsx(ft,{onUpload:o,onDelete:i,onReplaceWithBrowse:l,onReplaceWithUpload:l,onSorted:u,onBrowse:o,items:s,appBridge:n,triggerComponent:Wn,isOpen:c&&!m,onOpenChange:f})},je=({open:e,content:t,children:n,disabled:s})=>a.jsx(r.LegacyTooltip,{withArrow:!0,hoverDelay:0,enterDelay:300,open:e,disabled:s,position:r.TooltipPosition.Top,content:a.jsx("div",{children:t}),triggerElement:n,"data-test-id":"toolbar-button-tooltip"}),qn=({tooltip:e,icon:t,onClick:n})=>{const s=oe();return a.jsx(je,{disabled:s,content:e??"",children:a.jsx(ie,{"data-test-id":"block-item-wrapper-toolbar-btn",onClick:n,children:t})})},bt="Drag or press ↵ to move",pt="Move with ↑↓←→ and confirm with ↵",yt=({tooltip:e,icon:t,setActivatorNodeRef:n,draggableProps:s})=>{const o=oe();return a.jsx(je,{open:o,content:a.jsx("div",{children:o?pt:e??bt}),children:a.jsx(ie,{ref:n,"data-test-id":"block-item-wrapper-toolbar-btn",forceActiveStyle:o,cursor:"grab",...s,children:t})})},Ne=({content:e,icon:t,tooltip:n,flyoutId:s,flyoutFooter:o,flyoutHeader:i})=>{const l=r.useMemoizedId(s),{isOpen:u,onOpenChange:c}=he(l),f=oe();return a.jsx(je,{disabled:f||u,content:n,children:a.jsx("div",{className:"tw-flex tw-flex-shrink-0 tw-flex-1 tw-h-6 tw-relative",children:a.jsx(r.Flyout,{isOpen:u&&!f,legacyFooter:!1,fixedFooter:o,fixedHeader:i,fitContent:!0,hug:!1,placement:r.FlyoutPlacement.BottomRight,onOpenChange:c,trigger:(m,d)=>a.jsx(ie,{"data-test-id":"block-item-wrapper-toolbar-flyout",forceActiveStyle:u&&!f,...m,ref:d,children:t}),children:e})})})},vt=({items:e,flyoutId:t})=>{const{onOpenChange:n}=he(t);return a.jsx(r.ActionMenu,{menuBlocks:e.map((s,o)=>({id:o.toString(),menuItems:s.map((i,l)=>({id:o.toString()+l.toString(),size:r.MenuItemContentSize.XSmall,title:i.title,style:i.style,onClick:()=>{n(!1),i.onClick()},initialValue:!0,decorator:a.jsx("div",{className:"tw-mr-2",children:i.icon})}))}))})},Le="menu",Ct=({items:e,flyoutId:t=Le,tooltip:n="Options"})=>{const s=r.useMemoizedId(t);return a.jsx(Ne,{icon:a.jsx(r.IconDotsHorizontal16,{}),tooltip:n,flyoutId:s,content:a.jsx(vt,{items:e,flyoutId:s})})},St=({items:e,attachments:t})=>a.jsxs("div",{"data-test-id":"block-item-wrapper-toolbar",className:"tw-rounded-md tw-bg-base tw-border tw-border-line-strong tw-divide-x tw-divide-line-strong tw-shadow-lg tw-flex tw-flex-none tw-items-center tw-isolate",children:[t.isEnabled&&a.jsx(Je,{children:a.jsx(wt,{})}),a.jsx(Je,{children:e.map(n=>n.type==="dragHandle"?a.jsx(yt,{...n},n.tooltip+n.type):n.type==="menu"?a.jsx(Ct,{...n},n.tooltip+n.type):n.type==="flyout"?a.jsx(Ne,{...n},n.tooltip+n.type):a.jsx(qn,{...n},n.tooltip+n.type))})]}),Gn=({children:e,toolbarItems:t,shouldHideWrapper:n,shouldHideComponent:s=!1,isDragging:o=!1,shouldFillContainer:i,outlineOffset:l=2,shouldBeShown:u=!1,showAttachments:c=!1})=>{const[f,m]=h.useState(u?[Le]:[]),d=h.useRef(null);if(n)return a.jsx(a.Fragment,{children:e});const x=t==null?void 0:t.filter(b=>b!==void 0),w=f.length>0||u;return a.jsx(ot,{isDragPreview:o,children:a.jsx(lt,{openFlyoutIds:f,setOpenFlyoutIds:m,children:a.jsxs("div",{ref:d,"data-test-id":"block-item-wrapper",style:{outlineOffset:l},className:O(["tw-relative tw-group tw-outline-1 tw-outline-box-selected-inverse",i&&"tw-flex-1 tw-h-full tw-w-full","hover:tw-outline focus-within:tw-outline",w&&"tw-outline",s&&"tw-opacity-0"]),children:[a.jsx("div",{style:{right:-1-l,bottom:`calc(100% - ${2+l}px)`},className:O(["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","tw-flex tw-justify-end",w&&"tw-opacity-100"]),children:a.jsx(St,{attachments:{isEnabled:c},items:x})}),e]})})})},Kn=({onDownload:e})=>{const{isFocused:t,focusProps:n}=tt.useFocusRing();return a.jsx(r.LegacyTooltip,{withArrow:!0,position:r.TooltipPosition.Top,content:"Download",enterDelay:500,triggerElement:a.jsx("button",{tabIndex:0,"aria-label":"Download",...n,className:O(["tw-outline-none tw-rounded",t&&r.FOCUS_STYLE]),onClick:e,onPointerDown:s=>s.preventDefault(),children:a.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:a.jsx(r.IconArrowCircleDown16,{})})})})},Xn=({value:e="",gap:t,columns:n,show:s=!0,plugins:o})=>{const[i,l]=h.useState(null);return h.useEffect(()=>{(async()=>l(await r.serializeRawToHtmlAsync(e,o,n,t)))()},[e,n,t,o]),!s||i==="<br />"?null:i!==null?a.jsx("div",{className:"tw-w-full tw-whitespace-pre-wrap","data-test-id":"rte-content-html",dangerouslySetInnerHTML:{__html:i}}):a.jsx("div",{className:"tw-rounded-sm tw-bg-base-alt tw-animate-pulse tw-h-full tw-min-h-[10px] tw-w-full"})},Ae=r.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})),P=Ae.set,N=Ae.get,ae=()=>Ae.use,kt=e=>{if(!e)return!1;const t=n=>n.some(s=>s.text?s.text!=="":s.children?t(s.children):!1);try{const n=JSON.parse(e);return t(n)}catch{return!1}},Qn=(e="p",t="",n)=>kt(t)?t:JSON.stringify([{type:e,children:[{text:t,textStyle:e}],align:n}]),Yn=(e,t,n)=>e===K.Custom?t:n,Jn=e=>e.map(Tt),Tt=e=>({id:e.id,title:e.name,colors:e.colors.map(er)}),Zn=e=>"revision"in e,er=e=>{if(Zn(e)){const{title:t,revision:n}=e;return{alpha:n.rgba.alpha?n.rgba.alpha/255:1,red:n.rgba.red??0,green:n.rgba.green??0,blue:n.rgba.blue??0,name:t??""}}return{alpha:e.alpha?e.alpha/255:1,red:e.red??0,green:e.green??0,blue:e.blue??0,name:e.name??""}},Re=(e,t)=>{const n=r.getAboveNode(e,{match:{type:r.ELEMENT_LINK}});return Array.isArray(n)?t(n[0]):""},tr=e=>Re(e,t=>{var n,s;return((s=(n=t.chosenLink)==null?void 0:n.searchResult)==null?void 0:s.link)||""}),nr=e=>Re(e,t=>t.url||""),Me=e=>{var t,n;return e.url||((n=(t=e.chosenLink)==null?void 0:t.searchResult)==null?void 0:n.link)||""},rr=e=>Re(e,Me),Fe=/^\/(document|r)\/\S+$/i,fe=e=>{if(Fe.test(e))return e;try{return new URL(e),e}catch{return`https://${e}`}},xe=e=>{if(Fe.test(e))return!0;try{const t=new URL(e);return["http:","https:","mailto:","tel:"].includes(t.protocol)&&t.pathname!==""}catch{return!1}},ee=e=>xe(fe(e))||e==="",Pt=(e,{type:t})=>{const{apply:n,normalizeNode:s}=e;return e.apply=o=>{if(o.type!=="set_selection"){n(o);return}const i=o.newProperties;if(!(i!=null&&i.focus)||!i.anchor||!r.isCollapsed(i)){n(o);return}const l=r.getAboveNode(e,{at:i,match:{type:r.getPluginType(e,C)}});if(l){const[,u]=l;let c;r.isStartPoint(e,i.focus,u)&&(c=r.getPreviousNodeEndPoint(e,u)),r.isEndPoint(e,i.focus,u)&&(c=r.getNextNodeStartPoint(e,u)),c&&(o.newProperties={anchor:c,focus:c})}n(o)},e.normalizeNode=([o,i])=>{if(o.type===r.getPluginType(e,C)){const l=e.selection;if(l&&r.isCollapsed(l)&&r.isEndPoint(e,l.focus,i)){const u=r.getNextNodeStartPoint(e,i);if(u)r.select(e,u);else{const c=r.Path.next(i);r.insertNodes(e,{text:""},{at:c}),r.select(e,c)}}}s([o,i])},r.withRemoveEmptyNodes(e,r.mockPlugin({options:{types:t}}))},It=(e,t,n)=>{r.insertNodes(e,[Nt(e,t)],n)},De=e=>{if(!e.selection)return;const{isUrl:t,forceSubmit:n}=r.getPluginOptions(e,C),s=N.url();if(!((t==null?void 0:t(s))||n))return;const i=N.text(),l=N.buttonStyle(),u=N.newTab()?void 0:"_self";return P.reset(),Et(e,{url:s,text:i,buttonStyle:l,target:u,isUrl:c=>n||!t?!0:t(c)}),setTimeout(()=>{r.focusEditor(e,e.selection??void 0)},0),!0},te=(e,t)=>r.withoutNormalizing(e,()=>{var n,s,o,i,l,u;if(t!=null&&t.split){if(r.getAboveNode(e,{at:(n=e.selection)==null?void 0:n.anchor,match:{type:r.getPluginType(e,C)}}))return r.splitNodes(e,{at:(s=e.selection)==null?void 0:s.anchor,match:m=>r.isElement(m)&&m.type===r.getPluginType(e,C)}),te(e,{at:(o=e.selection)==null?void 0:o.anchor}),!0;if(r.getAboveNode(e,{at:(i=e.selection)==null?void 0:i.focus,match:{type:r.getPluginType(e,C)}}))return r.splitNodes(e,{at:(l=e.selection)==null?void 0:l.focus,match:m=>r.isElement(m)&&m.type===r.getPluginType(e,C)}),te(e,{at:(u=e.selection)==null?void 0:u.focus}),!0}r.unwrapNodes(e,{match:{type:r.getPluginType(e,C)},...t})}),Et=(e,{url:t,text:n,buttonStyle:s,target:o,insertTextInButton:i,insertNodesOptions:l,isUrl:u=r.getPluginOptions(e,C).isUrl})=>{var E;const c=e.selection;if(!c)return;const f=r.getAboveNode(e,{at:c,match:{type:r.getPluginType(e,C)}});if(i&&f)return e.insertText(t),!0;if(!(u!=null&&u(t)))return;if(r.isDefined(n)&&n.length===0&&(n=t),f)return or(t,e,f,o,s,n),!0;const m=r.findNode(e,{at:c,match:{type:r.getPluginType(e,C)}}),[d,x]=m??[],w=sr(e,x,n);if(r.isExpanded(c))return ar(f,e,t,s,o,n),!0;w&&r.removeNodes(e,{at:x});const b=r.getNodeProps(d??{}),v=(E=e.selection)==null?void 0:E.focus.path;if(!v)return;const k=r.getNodeLeaf(e,v);return n!=null&&n.length||(n=t),It(e,{...b,url:t,target:o,children:[{...k,text:n}]},l),!0};function sr(e,t,n){return t&&(n==null?void 0:n.length)&&n!==r.getEditorString(e,t)}function ar(e,t,n,s,o,i){e?te(t,{at:e[1]}):te(t,{split:!0}),Bt(t,{url:n,buttonStyle:s,target:o}),Oe(t,{url:n,target:o,text:i})}function or(e,t,n,s,o,i){var l,u,c;(e!==((l=n[0])==null?void 0:l.url)||s!==((u=n[0])==null?void 0:u.target)||o!==((c=n[0])==null?void 0:c.buttonStyle))&&r.setNodes(t,{url:e,target:s,buttonStyle:o},{at:n[1]}),Oe(t,{url:e,text:i,target:s})}const Oe=(e,{text:t})=>{const n=r.getAboveNode(e,{match:{type:r.getPluginType(e,C)}});if(n){const[s,o]=n;if(t!=null&&t.length&&t!==r.getEditorString(e,o)){const i=s.children[0];r.replaceNodeChildren(e,{at:o,nodes:{...i,text:t},insertOptions:{select:!0}})}}},Bt=(e,{url:t,buttonStyle:n,target:s,...o})=>{r.wrapNodes(e,{type:r.getPluginType(e,C),url:t,buttonStyle:n,target:s,children:[]},{split:!0,...o})},ir=(e,t)=>{const n=r.getAboveNode(e,{match:{type:C}});return Array.isArray(n)?t(n[0]):""},jt=e=>ir(e,t=>t.url??""),Nt=(e,{url:t,text:n="",buttonStyle:s="primary",target:o,children:i})=>({type:r.getPluginType(e,C),url:t,target:o,buttonStyle:s,children:i??[{text:n}]}),Lt=(e,{focused:t}={})=>{if(N.mode()==="edit"){we(e);return}Ue(e,{focused:t})},we=e=>{const t=r.findNode(e,{match:{type:r.getPluginType(e,C)}});if(!t)return;const[n,s]=t;let o=r.getEditorString(e,s);P.url(n.url),P.newTab(n.target===void 0),o===n.url&&(o=""),P.text(o),P.isEditing(!0)},Ue=(e,{focused:t}={})=>{N.mode()||!t||r.isRangeAcrossBlocks(e,{at:e.selection})||r.someNode(e,{match:{type:r.getPluginType(e,C)}})||(P.text(r.getEditorString(e,e.selection)),P.show("insert",e.id))},be={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)"}}},lr=e=>{var l,u;const{attributes:t,children:n}=e,s=e.element.url||((u=(l=e.element.chosenLink)==null?void 0:l.searchResult)==null?void 0:u.link)||"",o=e.element.target||"_self",i=String(e.element.buttonStyle)||"primary";return a.jsx(cr,{attributes:t,href:s,target:o,styles:be[`button${i.charAt(0).toUpperCase()+i.slice(1)}`],children:n})},cr=({attributes:e,styles:t={hover:{}},children:n,href:s="#",target:o})=>{const[i,l]=h.useState(!1);return a.jsx("a",{...e,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),href:s,target:o,style:i?{...t,...t.hover}:t,children:n})};class ur extends r.MarkupElement{constructor(t=C,n=lr){super(t,n)}}const At=h.forwardRef((e,t)=>{const n=r.useEditorRef();return a.jsx(r.ToolbarButton,{ref:t,...e,onMouseDown:()=>{r.focusEditor(n,n.selection??n.prevSelection??void 0)},onClick:()=>{Lt(n,{focused:!0})},children:a.jsx(r.IconStylingWrapper,{icon:a.jsx(r.IconButton16,{})})})});At.displayName="ButtonToolbarButton";const dr=({editorId:e,id:t})=>{const n=r.useEditorState(r.useEventPlateId(e)),s=!!r.isRangeInSameBlock(n,{at:n.selection}),o=r.getPluginType(n,C),i=!!(n!=null&&n.selection)&&r.someNode(n,{match:{type:o}});return a.jsx("div",{"data-plugin-id":t,children:a.jsx(At,{pressed:i,disabled:!s,tooltip:r.getTooltip(s?`Button
2
- ${r.getHotkeyByPlatform("Ctrl+Shift+K")}`:"Buttons can only be set for a single text block.")})})},gr=()=>{const e=r.useEditorRef();return a.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:a.jsxs("span",{"data-test-id":"preview-button-flyout",className:"tw-flex tw-justify-between tw-items-center",children:[a.jsx("span",{className:"tw-pointer-events-none",children:N.url()}),a.jsxs("span",{className:"tw-flex tw-gap-2",children:[a.jsx("button",{onClick:()=>{we(e)},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:a.jsx(r.IconPen16,{})}),a.jsx("button",{onClick:()=>{te(e),r.focusEditor(e,e.selection??void 0)},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:a.jsx(r.IconTrashBin16,{})})]})]})})},mr=({section:e,selectedUrl:t,onSelectUrl:n})=>{const s=e.permanentLink===t;return a.jsx("button",{"data-test-id":"internal-link-selector-section-link",className:r.merge(["tw-py-2 tw-pr-2.5 tw-pl-14 tw-leading-5 tw-cursor-pointer tw-w-full",s?"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:a.jsxs("div",{className:"tw-flex tw-flex-1 tw-space-x-2 tw-items-center tw-h-6",children:[a.jsx(r.IconDocumentText16,{}),a.jsx("span",{className:"tw-text-s",children:e.title}),a.jsx("span",{className:"tw-flex-auto tw-font-sans tw-text-xs tw-text-right",children:"Section"})]})})},hr=({page:e,selectedUrl:t,onSelectUrl:n,itemsToExpandInitially:s,getDocumentSectionsByDocumentPageId:o})=>{const[i,l]=h.useState(e.id===s.documentId),[u,c]=h.useState([]),f=e.permanentLink===t;h.useEffect(()=>{(async()=>{const w=await o(e.id);c(w)})()},[e.id,o]),h.useEffect(()=>{e.id===s.pageId&&l(!0)},[s,e.id]);const m=[...u.values()],d=m.length>0;return a.jsxs(a.Fragment,{children:[a.jsx("button",{"data-test-id":"internal-link-selector-page-link",className:r.merge(["tw-py-2 tw-pr-2.5 tw-leading-5 tw-cursor-pointer tw-flex tw-w-full",d?"tw-pl-7":"tw-pl-12",f?"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:a.jsxs("div",{className:"tw-flex tw-flex-1 tw-space-x-1 tw-items-center tw-h-6",children:[d&&a.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:()=>l(!i),children:a.jsx("div",{className:r.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",i?"tw-rotate-90":""])})}),a.jsx("span",{className:"tw-text-s",children:e.title}),a.jsx("span",{className:"tw-flex-auto tw-font-sans tw-text-xs tw-text-right",children:"Page"})]},e.id)}),i&&m.length>0&&m.map(x=>a.jsx(mr,{section:x,selectedUrl:t,onSelectUrl:n},x.id))]})},Rt=()=>a.jsx("div",{className:"tw-flex tw-justify-center tw-h-10 tw-items-center",children:a.jsx(r.LoadingCircle,{size:r.LoadingCircleSize.Small})}),fr=({documentId:e,selectedUrl:t,onSelectUrl:n,itemsToExpandInitially:s,getDocumentSectionsByDocumentPageId:o,getDocumentPagesByDocumentId:i})=>{const[l,u]=h.useState([]),[c,f]=h.useState(!0),m=[...l.values()],d=!c&&m.length>0;return h.useEffect(()=>{i(e).then(x=>{const w=x.filter(v=>!!v.category).sort((v,k)=>v.category.sort===k.category.sort?v.sort-k.sort:v.category.sort-k.category.sort),b=x.filter(v=>!v.category).sort((v,k)=>v.sort-k.sort);u([...w,...b])}).finally(()=>{f(!1)})},[]),c?a.jsx(Rt,{}):d?a.jsx(a.Fragment,{children:m.map(x=>a.jsx(hr,{page:x,selectedUrl:t,onSelectUrl:n,itemsToExpandInitially:s,getDocumentSectionsByDocumentPageId:o},x.id))}):a.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."})},xr=({document:e,selectedUrl:t,onSelectUrl:n,itemsToExpandInitially:s,getDocumentSectionsByDocumentPageId:o,getDocumentPagesByDocumentId:i})=>{const[l,u]=h.useState(e.id===s.documentId),c=e.permanentLink===t;return h.useEffect(()=>{e.id===s.documentId&&u(!0)},[s,e.id]),a.jsxs(a.Fragment,{children:[a.jsxs("button",{"data-test-id":"internal-link-selector-document-link",className:r.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",c?"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:[a.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:a.jsx("div",{className:r.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":""])})}),a.jsx(r.IconColorFan16,{}),a.jsx("span",{className:"tw-text-s",children:e.title}),a.jsx("span",{className:"tw-flex-auto tw-font-sans tw-text-xs tw-text-right",children:"Document"})]}),l&&a.jsx(fr,{documentId:e.id,selectedUrl:t,onSelectUrl:n,itemsToExpandInitially:s,getDocumentSectionsByDocumentPageId:o,getDocumentPagesByDocumentId:i})]})},wr=({selectedUrl:e,onSelectUrl:t,getAllDocuments:n,getDocumentPagesByDocumentId:s,getDocumentSectionsByDocumentPageId:o})=>{const[i,l]=h.useState(!0),[u,c]=h.useState([]),[f,m]=h.useState({documentId:void 0,pageId:void 0}),d=[...u.values()];h.useEffect(()=>{e&&d.length>0&&x().then(w=>{m(w)})},[d.length]),h.useEffect(()=>{n().then(w=>{c(w)}).finally(()=>{l(!1)})},[]);const x=async()=>{const w={documentId:void 0,pageId:void 0};if(d.find(v=>v.permanentLink===e))return w;for(const v of d){const E=[...(await s(v.id)).values()];if(!!E.find(R=>R.permanentLink===e))return w.documentId=v.id,w;for(const R of E)if(!![...(await o(R.id)).values()].find(L=>L.permanentLink===e))return w.documentId=v.id,w.pageId=R.id,w}return w};return i?a.jsx(Rt,{}):a.jsx(a.Fragment,{children:d.map(w=>a.jsx(xr,{document:w,selectedUrl:e,onSelectUrl:t,itemsToExpandInitially:f,getDocumentSectionsByDocumentPageId:o,getDocumentPagesByDocumentId:s},w.id))})},Mt=({url:e,onUrlChange:t,buttonSize:n=r.ButtonSize.Medium,getAllDocuments:s,getDocumentPagesByDocumentId:o,getDocumentSectionsByDocumentPageId:i})=>{const{open:l,isOpen:u,close:c}=Cn.useOverlayTriggerState({}),[f,m]=h.useState(e),d=b=>{m(b)},x=b=>{b.key==="Enter"&&w()};h.useEffect(()=>{e&&!f&&m(e)},[e,f]);const w=()=>{t==null||t(f),c()};return a.jsxs("div",{onPointerDown:b=>b.preventDefault(),"data-test-id":"internal-link-selector",onKeyDown:x,children:[a.jsx(r.Button,{icon:a.jsx(r.IconLink,{}),size:n,type:r.ButtonType.Button,style:r.ButtonStyle.Default,emphasis:r.ButtonEmphasis.Default,onClick:()=>l(),children:"Internal link"}),a.jsxs(r.Modal,{zIndex:1001,onClose:()=>c(),isOpen:u,isDismissable:!0,children:[a.jsx(r.Modal.Header,{title:"Select internal link"}),a.jsx(r.Modal.Body,{children:a.jsx(wr,{selectedUrl:f,onSelectUrl:d,getAllDocuments:s,getDocumentPagesByDocumentId:o,getDocumentSectionsByDocumentPageId:i})}),a.jsx(r.Modal.Footer,{buttons:[{children:"Cancel",onClick:()=>c(),style:r.ButtonStyle.Default,emphasis:r.ButtonEmphasis.Default},{children:"Choose",onClick:b=>{b==null||b.preventDefault(),w()},style:r.ButtonStyle.Default,emphasis:r.ButtonEmphasis.Strong,disabled:!f}]})]})]})},Ft=({onUrlChange:e,onToggleTab:t,isValidUrlOrEmpty:n,appBridge:s,clearable:o,placeholder:i,newTab:l,openInNewTab:u,url:c="",required:f,info:m,label:d,buttonSize:x,hideInternalLinkButton:w})=>{const b=n?n(c):ee(c),v=l??(u?r.CheckboxState.Checked:r.CheckboxState.Unchecked);return a.jsxs("div",{"data-test-id":"link-input",children:[a.jsx(r.FormControl,{label:{children:d,htmlFor:"url",required:f,tooltip:m?{content:m,position:r.TooltipPosition.Top}:void 0},children:a.jsx(r.TextInput,{id:"url",value:c,clearable:o,onChange:e,placeholder:i??"https://example.com",focusOnMount:!0})}),!b&&a.jsx("div",{className:"tw-text-text-negative tw-mt-1 tw-text-s",children:"Please enter a valid URL."}),!w&&a.jsx("div",{className:"tw-mt-3",children:a.jsx(Mt,{url:c,onUrlChange:e,buttonSize:x??r.ButtonSize.Medium,getAllDocuments:()=>s.getAllDocuments(),getDocumentPagesByDocumentId:k=>s.getDocumentPagesByDocumentId(k),getDocumentSectionsByDocumentPageId:k=>s.getDocumentSectionsByDocumentPageId(k)})}),a.jsx("div",{className:"tw-mt-3",children:a.jsx(r.Checkbox,{value:"new-tab",label:"Open in new tab",state:v,onChange:t})})]})},Dt=({state:e,onTextChange:t,onUrlChange:n,onToggleTab:s,onCancel:o,onSave:i,isValidUrlOrEmpty:l,hasValues:u,testId:c,appBridge:f,children:m})=>a.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:[a.jsx(r.FormControl,{label:{children:"Text",htmlFor:"linkText",required:!0},children:a.jsx(r.TextInput,{id:"linkText",value:e.text,placeholder:"Link Text",onChange:t})}),m,a.jsx("div",{className:"tw-mt-5",children:a.jsx(Ft,{url:e.url,newTab:e.newTab,onUrlChange:n,onToggleTab:s,isValidUrlOrEmpty:l,appBridge:f})}),a.jsx("div",{className:"tw-mt-3",children:a.jsxs("div",{className:"tw-pt-5 tw-flex tw-gap-x-3 tw-justify-end tw-border-t tw-border-t-black-10",children:[a.jsx(r.Button,{onClick:o,size:r.ButtonSize.Medium,style:r.ButtonStyle.Default,emphasis:r.ButtonEmphasis.Default,children:"Cancel"}),a.jsx(r.Button,{onClick:i,size:r.ButtonSize.Medium,icon:a.jsx(r.IconCheckMark20,{}),disabled:!l(e==null?void 0:e.url)||!u,children:"Save"})]})})]}),br=e=>{var n;const t=r.getAboveNode(e,{match:{type:C}});return Array.isArray(t)&&((n=t[0])==null?void 0:n.buttonStyle)||"primary"},pr={url:"",text:"",buttonStyle:"primary",newTab:r.CheckboxState.Unchecked},yr=()=>{const[e,t]=h.useReducer((n,s)=>{const{type:o,payload:i}=s;switch(o){case"NEW_TAB":return{...n,newTab:r.CheckboxState.Checked};case"SAME_TAB":return{...n,newTab:r.CheckboxState.Unchecked};case"URL":case"TEXT":case"BUTTON_STYLE":case"INIT":return{...n,...i};default:return n}},pr);return[e,t]},vr=()=>{const e=r.useEditorRef(),[t,n]=yr();h.useEffect(()=>{const d=br(e);n({type:"INIT",payload:{text:N.text(),buttonStyle:d,newTab:N.newTab()?r.CheckboxState.Checked:r.CheckboxState.Unchecked,url:N.url()}})},[n,e]);const s=d=>{n({type:"TEXT",payload:{text:d}})},o=d=>{n({type:"BUTTON_STYLE",payload:{buttonStyle:d}})},i=d=>{n({type:"URL",payload:{url:d}})},l=d=>{n(d?{type:"NEW_TAB"}:{type:"SAME_TAB"})},u=()=>{P.reset()},c=d=>{if(!ee(t.url)||!f)return;const x=fe(t.url);P.text(t.text),P.url(x),P.buttonStyle(t.buttonStyle),P.newTab(t.newTab===r.CheckboxState.Checked),De(e)&&(d==null||d.preventDefault())},f=t.url!==""&&t.text!=="",{appBridge:m}=r.getPluginOptions(e,C);return r.useHotkeys("enter",c,{enableOnFormTags:["INPUT"]},[]),{state:t,onTextChange:s,onButtonStyleChange:o,onUrlChange:i,onToggleTab:l,onCancel:u,onSave:c,hasValues:f,isValidUrlOrEmpty:ee,appBridge:m}},de="link-plugin";var p=(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))(p||{});const j={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)"},[de]:{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)"},...be},Cr=()=>{const e=vr(),{state:t,onButtonStyleChange:n}=e;return a.jsx(Dt,{...e,testId:"floating-button-insert",children:a.jsx("div",{className:"tw-pt-5",children:a.jsxs(r.FormControl,{label:{children:"Button Style",htmlFor:"buttonStyle",required:!0},children:[a.jsx(ve,{id:"primary",styles:j.buttonPrimary,isActive:t.buttonStyle==="primary",onClick:()=>n("primary"),children:t.text||"Primary Button"}),a.jsx(ve,{id:"secondary",styles:j.buttonSecondary,isActive:t.buttonStyle==="secondary",onClick:()=>n("secondary"),children:t.text||"Secondary Button"}),a.jsx(ve,{id:"tertiary",styles:j.buttonTertiary,isActive:t.buttonStyle==="tertiary",onClick:()=>n("tertiary"),children:t.text||"Tertiary Button"})]})})})},ve=({id:e,styles:t,isActive:n,onClick:s,children:o})=>{const[i,l]=h.useState(!1),u=()=>t&&t.hover&&i?{...t,...t.hover}:t;return a.jsx("button",{"data-test-id":`floating-button-insert-${e}`,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),onClick:s,style:{...u(),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:o})},Ze={placement:"bottom-start",strategy:"absolute",middleware:[r.offset(12),r.flip({padding:12,fallbackPlacements:["bottom-end","top-start","top-end"]})]},Sr=()=>{const{ref:e,...t}=Pr(Ze),{ref:n,...s}=kr(Ze),o=r.useEditorRef(),i=ae(),l=i.isOpen(o.id),u=i.isEditing(),c=i.mode(),f=a.jsx(Cr,{}),m=u?f:a.jsx(gr,{});return a.jsxs(a.Fragment,{children:[l&&c==="insert"&&a.jsx("div",{ref:e,...t,children:f}),l&&c==="edit"&&a.jsx("div",{ref:n,...s,children:m})]})},C="button",Ot="button-plugin",Ut=e=>r.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:Pt,renderAfterEditable:Sr,options:{isUrl:xe,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:s=>({type:n,url:s.getAttribute("href"),target:s.getAttribute("target")||"_blank"})}})})();class _t extends r.Plugin{constructor({styles:n=be,...s}){super(Ot,{button:dr,markupElement:new ur,...s});B(this,"styles",{});B(this,"appBridge");this.styles=n,this.appBridge=s==null?void 0:s.appBridge}plugins(){return[Ut(this.appBridge)]}}const kr=e=>{const t=r.useEditorRef(),n=ae().mode(),s=ae().isOpen(t.id),o=r.useEditorVersion(),{triggerFloatingButtonHotkeys:i}=r.getPluginOptions(t,C),l=h.useCallback(()=>{const d=r.getAboveNode(t,{match:{type:r.getPluginType(t,C)}});if(d){const[,x]=d;return r.getRangeBoundingClientRect(t,{anchor:r.getStartPoint(t,x),focus:r.getEndPoint(t,x)})}return r.getDefaultBoundingClientRect()},[t]),u=s&&n==="edit",{update:c,style:f,floating:m}=Vt({open:u,getBoundingClientRect:l,...e});return h.useEffect(()=>{const d=jt(t);if(d&&P.url(d),t.selection&&r.someNode(t,{match:{type:r.getPluginType(t,C)}})){P.show("edit",t.id),c();return}N.mode()==="edit"&&P.reset()},[t,o,c]),r.useHotkeys(i,d=>{d.preventDefault(),N.mode()==="edit"&&we(t)},{enableOnContentEditable:!0},[]),Tr(),Ht(),{style:{...f,zIndex:1e3},ref:r.useComposedRef(m)}},Tr=()=>{const e=r.useEditorRef();r.useHotkeys("*",t=>{t.key==="Enter"&&De(e)&&t.preventDefault()},{enableOnFormTags:["INPUT"]},[])},Ht=()=>{const e=r.useEditorRef();r.useHotkeys("escape",()=>{if(N.mode()==="edit"){if(N.isEditing()){P.show("edit",e.id),r.focusEditor(e,e.selection??void 0);return}P.reset()}},{enableOnFormTags:["INPUT"],enableOnContentEditable:!0},[])},Pr=e=>{const t=r.useEditorRef(),n=r.useFocused(),s=ae().mode(),o=ae().isOpen(t.id),{triggerFloatingButtonHotkeys:i}=r.getPluginOptions(t,C);r.useHotkeys(i,f=>{f.preventDefault(),Ue(t,{focused:n})},{enableOnContentEditable:!0},[n]);const{update:l,style:u,floating:c}=Vt({open:o&&s==="insert",getBoundingClientRect:r.getSelectionBoundingClientRect,whileElementsMounted:void 0,...e});return h.useEffect(()=>{o&&l(),P.updated(o)},[o,l]),Ht(),{style:{...u,zIndex:1e3},ref:r.useComposedRef(c)}},Ir=12,Er=-22,Br=96,Vt=e=>r.useVirtualFloating({placement:"bottom-start",middleware:[r.offset({mainAxis:Ir,alignmentAxis:Er}),r.flip({padding:Br})],...e}),jr=({id:e="rte",isEditing:t,value:n,columns:s,gap:o,placeholder:i,plugins:l,onTextChange:u,showSerializedText:c})=>{const[f,m]=h.useState(!1),d=h.useCallback(b=>{u&&b!==n&&u(b),m(!1)},[u,n]),x=h.useCallback(()=>m(!0),[]),w=h.useCallback(b=>{N.isOpen(b)&&P.reset()},[]);return h.useEffect(()=>{const b=v=>(v.preventDefault(),v.returnValue="Unprocessed changes");return f&&window.addEventListener("beforeunload",b),()=>window.removeEventListener("beforeunload",b)},[f]),t?a.jsx(r.RichTextEditor,{id:e,value:n,border:!1,placeholder:i,plugins:l,onValueChanged:x,onTextChange:d,hideExternalFloatingModals:w}):a.jsx(Xn,{value:n,columns:s,gap:o,show:c,plugins:l})},Nr=({editButtonProps:e,unlinkButtonProps:t})=>{const{element:n}=r.useLinkOpenButtonState(),s=n?Me(n):"";return a.jsx("div",{"data-test-id":"floating-link-edit",className:"tw-bg-white tw-rounded tw-shadow tw-p-4 tw-min-w-[400px]",children:a.jsxs("span",{"data-test-id":"preview-link-flyout",className:"tw-flex tw-justify-between tw-items-center",children:[a.jsx("span",{className:"tw-pointer-events-none",children:s}),a.jsxs("span",{className:"tw-flex tw-gap-2",children:[a.jsx("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",...e,children:a.jsx(r.IconPen16,{})}),a.jsx("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",...t,children:a.jsx(r.IconTrashBin16,{})})]})]})})},zt=(e,t)=>{const n=r.getAboveNode(e,{match:{type:r.ELEMENT_LINK}});return Array.isArray(n)?t(n[0]):""},Lr=e=>zt(e,t=>{var n,s;return((s=(n=t.chosenLink)==null?void 0:n.searchResult)==null?void 0:s.link)||""}),Ar=e=>zt(e,t=>t.url||""),Rr={url:"",text:"",newTab:r.CheckboxState.Unchecked},Mr=()=>{const[e,t]=h.useReducer((n,s)=>{const{type:o,payload:i}=s;switch(o){case"NEW_TAB":return{...n,newTab:r.CheckboxState.Checked};case"SAME_TAB":return{...n,newTab:r.CheckboxState.Unchecked};case"URL":case"TEXT":case"INIT":return{...n,...i};default:return n}},Rr);return[e,t]},Fr=()=>{const e=r.useEditorRef(),[t,n]=Mr();h.useEffect(()=>{const m=Lr(e),d=Ar(e),x=r.floatingLinkSelectors.newTab();n({type:"INIT",payload:{text:r.floatingLinkSelectors.text(),newTab:x?r.CheckboxState.Checked:r.CheckboxState.Unchecked,url:m&&d===""?m:r.floatingLinkSelectors.url()}})},[n,e]);const s=m=>{n({type:"TEXT",payload:{text:m}})},o=m=>{n({type:"URL",payload:{url:m}})},i=m=>{n(m?{type:"NEW_TAB"}:{type:"SAME_TAB"})},l=()=>{r.floatingLinkActions.reset()},u=m=>{!ee(t.url)||!c||(r.floatingLinkActions.text(t.text),r.floatingLinkActions.url(fe(t.url)),r.floatingLinkActions.newTab(t.newTab===r.CheckboxState.Checked),r.submitFloatingLink(e)&&(m==null||m.preventDefault()))},c=t.url!==""&&t.text!=="",{appBridge:f}=r.getPluginOptions(e,r.ELEMENT_LINK);return r.useHotkeys("enter",u,{enableOnFormTags:["INPUT"]},[]),{state:t,onTextChange:s,onUrlChange:o,onToggleTab:i,onCancel:l,onSave:u,hasValues:c,isValidUrlOrEmpty:ee,appBridge:f}},Dr=()=>a.jsx(Dt,{...Fr(),testId:"floating-link-insert"}),et={placement:"bottom-start",strategy:"absolute",middleware:[r.offset(12),r.flip({padding:12,fallbackPlacements:["bottom-end","top-start","top-end"]})]},Or=()=>{const e=r.useFloatingLinkInsertState({floatingOptions:et}),{props:t,ref:n,hidden:s}=r.useFloatingLinkInsert(e),o=r.useFloatingLinkEditState({floatingOptions:et}),{props:i,ref:l,editButtonProps:u,unlinkButtonProps:c}=r.useFloatingLinkEdit(o);if(s)return null;const f=a.jsx(Dr,{}),m=o.isEditing?f:a.jsx(Nr,{editButtonProps:u,unlinkButtonProps:c});return a.jsxs(a.Fragment,{children:[e.isOpen&&!o.isOpen&&a.jsx("div",{ref:n,...t,style:{...t.style,zIndex:1e3},children:f}),o.isOpen&&a.jsx("div",{ref:l,...i,style:{...i.style,zIndex:1e3},children:m})]})},$t=h.forwardRef((e,t)=>{const n=r.useEditorRef(),s=r.useLinkToolbarButtonState(),{props:o}=r.useLinkToolbarButton(s);return a.jsx(r.ToolbarButton,{onMouseDown:()=>{r.focusEditor(n,n.selection??n.prevSelection??void 0)},ref:t,...o,...e,children:a.jsx(r.IconStylingWrapper,{icon:a.jsx(r.IconLink16,{})})})});$t.displayName="LinkToolbarButton";const Ur=({id:e,editorId:t})=>{const n=r.useEditorState(r.useEventPlateId(t)),s=!!r.isRangeInSameBlock(n,{at:n.selection});return a.jsx("div",{"data-plugin-id":e,children:a.jsx($t,{disabled:!s,tooltip:r.getTooltip(s?`Link
3
- ${r.getHotkeyByPlatform("Ctrl+K")}`:"Links can only be set for a single text block.")})})},_r=e=>{var l,u;const{attributes:t,children:n}=e,{styles:s}=r.useRichTextEditorContext(),o=e.element.url||((u=(l=e.element.chosenLink)==null?void 0:l.searchResult)==null?void 0:u.link)||"",i=e.element.target||"_self";return a.jsx("a",{...t,href:o,target:i,style:s[de],children:n})};class Hr extends r.MarkupElement{constructor(t=r.ELEMENT_LINK,n=_r){super(t,n)}}const Wt=e=>r.createPluginFactory({...r.createLinkPlugin(),renderAfterEditable:Or,options:{isUrl:xe,rangeBeforeOptions:{matchString:" ",skipInvalid:!0,afterMatch:!0},triggerFloatingLinkHotkeys:"meta+k, ctrl+k",keepSelectedTextOnPaste:!0,appBridge:e}})();class qt extends r.Plugin{constructor({styles:n=j[de],...s}){super(de,{button:Ur,markupElement:new Hr,...s});B(this,"styles",{});B(this,"appBridge");this.styles=n,this.appBridge=s.appBridge}plugins(){return[Wt(this.appBridge)]}}const Vr="textstyle-custom1-plugin";class Gt extends r.Plugin{constructor({styles:n=j.custom1,...s}={}){super(p.custom1,{label:"Custom 1",markupElement:new zr,...s});B(this,"styles",{});this.styles=n}plugins(){return[$r(this.styles)]}}class zr extends r.MarkupElement{constructor(t=Vr,n=Kt){super(t,n)}}const Kt=({element:e,attributes:t,children:n,styles:s})=>{const o=e.align;return a.jsx("p",{...t,style:s,className:r.merge([o&&r.alignmentClassnames[o],r.getColumnBreakClasses(e)]),children:n})},$r=e=>r.createPluginFactory({key:p.custom1,isElement:!0,deserializeHtml:{rules:[{validClassName:p.custom1}]}})({component:t=>a.jsx(Kt,{...t,styles:e})}),Wr="textstyle-custom2-plugin";class Xt extends r.Plugin{constructor({styles:n=j.custom2,...s}={}){super(p.custom2,{label:"Custom 2",markupElement:new qr,...s});B(this,"styles",{});this.styles=n}plugins(){return[Gr(this.styles)]}}class qr extends r.MarkupElement{constructor(t=Wr,n=Qt){super(t,n)}}const Qt=({element:e,attributes:t,children:n,styles:s})=>{const o=e.align;return a.jsx("p",{...t,className:r.merge([o&&r.alignmentClassnames[o],r.getColumnBreakClasses(e)]),style:s,children:n})},Gr=e=>r.createPluginFactory({key:p.custom2,isElement:!0,deserializeHtml:{rules:[{validClassName:p.custom2}]}})({component:t=>a.jsx(Qt,{...t,styles:e})}),Kr="textstyle-custom3-plugin";class Yt extends r.Plugin{constructor({styles:n=j.custom3,...s}={}){super(r.TextStyles.custom3,{label:"Custom 3",markupElement:new Xr,...s});B(this,"styles",{});this.styles=n}plugins(){return[Qr(this.styles)]}}class Xr extends r.MarkupElement{constructor(t=Kr,n=Jt){super(t,n)}}const Jt=({element:e,attributes:t,children:n,styles:s})=>{const o=e.align;return a.jsx("p",{...t,className:r.merge([o&&r.alignmentClassnames[o],r.getColumnBreakClasses(e)]),style:s,children:n})},Qr=e=>r.createPluginFactory({key:r.TextStyles.custom3,isElement:!0,deserializeHtml:{rules:[{validClassName:r.TextStyles.custom3}]}})({component:t=>a.jsx(Jt,{...t,styles:e})}),Yr="textstyle-heading1-plugin";class Zt extends r.Plugin{constructor({styles:n=j.heading1,...s}={}){super(p.heading1,{label:"Heading 1",markupElement:new Jr,...s});B(this,"styles",{});this.styles=n}plugins(){return[Zr(this.styles)]}}class Jr extends r.MarkupElement{constructor(t=Yr,n=Ce){super(t,n)}}const Ce=({element:e,attributes:t,children:n,styles:s})=>{const o=e.align;return a.jsx("h1",{...t,className:r.merge([o&&r.alignmentClassnames[o],r.getColumnBreakClasses(e)]),style:s,children:n})},Zr=e=>r.createPluginFactory({key:p.heading1,isElement:!0,component:Ce,deserializeHtml:{rules:[{validNodeName:["h1","H1"]}]}})({component:t=>a.jsx(Ce,{...t,styles:e})}),es="textstyle-heading2-plugin";class en extends r.Plugin{constructor({styles:n=j.heading2,...s}={}){super(p.heading2,{label:"Heading 2",markupElement:new ts,...s});B(this,"styles",{});this.styles=n}plugins(){return[ns(this.styles)]}}class ts extends r.MarkupElement{constructor(t=es,n=Se){super(t,n)}}const Se=({element:e,attributes:t,children:n,styles:s})=>{const o=e.align;return a.jsx("h2",{...t,className:r.merge([o&&r.alignmentClassnames[o],r.getColumnBreakClasses(e)]),style:s,children:n})},ns=e=>r.createPluginFactory({key:p.heading2,isElement:!0,component:Se,deserializeHtml:{rules:[{validNodeName:["h2","H2"]}]}})({component:t=>a.jsx(Se,{...t,styles:e})}),rs="textstyle-heading3-plugin";class tn extends r.Plugin{constructor({styles:n=j.heading3,...s}={}){super(p.heading3,{label:"Heading 3",markupElement:new ss,...s});B(this,"styles",{});this.styles=n}plugins(){return[as(this.styles)]}}class ss extends r.MarkupElement{constructor(t=rs,n=ke){super(t,n)}}const ke=({element:e,attributes:t,children:n,styles:s})=>{const o=e.align;return a.jsx("h3",{...t,className:r.merge([o&&r.alignmentClassnames[o],r.getColumnBreakClasses(e)]),style:s,children:n})},as=e=>r.createPluginFactory({key:p.heading3,isElement:!0,component:ke,deserializeHtml:{rules:[{validNodeName:["h3","H3"]}]}})({component:t=>a.jsx(ke,{...t,styles:e})}),os="textstyle-heading4-plugin";class nn extends r.Plugin{constructor({styles:n=j.heading4,...s}={}){super(p.heading4,{label:"Heading 4",markupElement:new is,...s});B(this,"styles",{});this.styles=n}plugins(){return[ls(this.styles)]}}class is extends r.MarkupElement{constructor(t=os,n=Te){super(t,n)}}const Te=({element:e,attributes:t,children:n,styles:s})=>{const o=e.align;return a.jsx("h4",{...t,className:r.merge([o&&r.alignmentClassnames[o],r.getColumnBreakClasses(e)]),style:s,children:n})},ls=e=>r.createPluginFactory({key:p.heading4,isElement:!0,component:Te,deserializeHtml:{rules:[{validNodeName:["h4","H4"]}]}})({component:t=>a.jsx(Te,{...t,styles:e})}),cs="textstyle-imageCaption-plugin";class rn extends r.Plugin{constructor({styles:n=j.imageCaption,...s}={}){super(p.imageCaption,{label:"Image Caption",markupElement:new us,...s});B(this,"styles",{});this.styles=n}plugins(){return[ds(this.styles)]}}class us extends r.MarkupElement{constructor(t=cs,n=Pe){super(t,n)}}const Pe=({element:e,attributes:t,children:n,styles:s})=>{const o=e.align;return a.jsx("p",{...t,className:r.merge([o&&r.alignmentClassnames[o],r.getColumnBreakClasses(e)]),style:s,children:n})},ds=e=>r.createPluginFactory({key:p.imageCaption,isElement:!0,component:Pe,deserializeHtml:{rules:[{validClassName:p.imageCaption}]}})({component:t=>a.jsx(Pe,{...t,styles:e})}),gs="textstyle-imageTitle-plugin";class sn extends r.Plugin{constructor({styles:n=j.imageTitle,...s}={}){super(p.imageTitle,{label:"Image Title",markupElement:new ms,...s});B(this,"styles",{});this.styles=n}plugins(){return[hs(this.styles)]}}class ms extends r.MarkupElement{constructor(t=gs,n=Ie){super(t,n)}}const Ie=({element:e,attributes:t,children:n,styles:s})=>{const o=e.align;return a.jsx("p",{...t,className:r.merge([o&&r.alignmentClassnames[o],r.getColumnBreakClasses(e)]),style:s,children:n})},hs=e=>r.createPluginFactory({key:p.imageTitle,isElement:!0,component:Ie,deserializeHtml:{rules:[{validClassName:p.imageTitle}]}})({component:t=>a.jsx(Ie,{...t,styles:e})});class an extends r.Plugin{constructor({styles:n=j.p,...s}={}){super(p.p,{markupElement:new ln,label:"Body Text",...s});B(this,"styles",{});this.styles=n}plugins(){return[cn(this.styles)]}}const on="tw-m-0 tw-px-0 tw-py-0",ge=({element:e,attributes:t,children:n,styles:s})=>{const o=e.align,i=r.merge([o&&r.alignmentClassnames[o],on,r.getColumnBreakClasses(e)]);return a.jsx("p",{...t,className:i,style:s,children:n})};class ln extends r.MarkupElement{constructor(t=p.p,n=ge){super(t,n)}}const cn=e=>r.createPluginFactory({...r.createParagraphPlugin(),key:p.p,isElement:!0,component:ge})({component:t=>a.jsx(ge,{...t,styles:e})}),fs="textstyle-quote-plugin";class un extends r.Plugin{constructor({styles:n=j.quote,...s}={}){super(p.quote,{label:"Quote",markupElement:new xs,...s});B(this,"styles",{});this.styles=n}plugins(){return[dn(this.styles)]}}class xs extends r.MarkupElement{constructor(t=fs,n=me){super(t,n)}}const me=({element:e,attributes:t,children:n,styles:s})=>{const o=e.align;return a.jsx("blockquote",{...t,className:r.merge([o&&r.alignmentClassnames[o],r.getColumnBreakClasses(e)]),style:s,children:n})},dn=e=>r.createPluginFactory({key:p.quote,isElement:!0,component:me,deserializeHtml:{rules:[{validNodeName:["blockquote","BLOCKQUOTE"]}]}})({component:t=>a.jsx(me,{...t,styles:e})}),_e=[new Zt,new en,new tn,new nn,new Gt,new Xt,new Yt,new un,new an],Z=[p.heading1,p.heading2,p.heading3,p.heading4,p.custom1,p.custom2,p.custom3,p.quote,p.p],ws=[..._e,new rn,new sn],bs=[...Z,p.imageCaption,p.imageTitle],ps=e=>new r.PluginComposer().setPlugin(new r.SoftBreakPlugin,new r.TextStylePlugin({textStyles:_e})).setPlugin([new r.BoldPlugin,new r.ItalicPlugin,new r.UnderlinePlugin,new r.StrikethroughPlugin,new qt({appBridge:e}),new _t({appBridge:e}),new r.CodePlugin],[new r.AlignLeftPlugin({validTypes:Z}),new r.AlignCenterPlugin({validTypes:Z}),new r.AlignRightPlugin({validTypes:Z}),new r.AlignJustifyPlugin({validTypes:Z}),new r.UnorderedListPlugin,new r.CheckboxListPlugin,new r.OrderedListPlugin,new r.ResetFormattingPlugin,new r.AutoformatPlugin]),ys="--f-theme-settings-",vs=e=>{const t=e!=null&&e.id?`hasBackground${e.id}`:"hasBackground",n=e!=null&&e.id?`backgroundColor${e.id}`:"backgroundColor",s=e!=null&&e.preventDefaultColor?void 0:(e==null?void 0:e.defaultColor)||An,o=e!=null&&e.label?e.label:"Background",i=e!=null&&e.switchLabel?e.switchLabel:void 0;return{id:t,label:o,type:"switch",switchLabel:i,defaultValue:!!(e!=null&&e.defaultValue),on:[{id:n,defaultValue:s,type:"colorInput"}]}},Cs=e=>{const t=e!=null&&e.id?`hasBorder_${e.id}`:"hasBorder",n=e!=null&&e.id?`borderSelection_${e.id}`:"borderSelection",s=e!=null&&e.id?`borderStyle_${e.id}`:"borderStyle",o=e!=null&&e.id?`borderWidth_${e.id}`:"borderWidth",i=e!=null&&e.id?`borderColor_${e.id}`:"borderColor",l=(e==null?void 0:e.defaultColor)||st,u=e!=null&&e.switchLabel?e.switchLabel:void 0;return{id:t,label:"Border",type:"switch",switchLabel:u,defaultValue:!!(e!=null&&e.defaultValue),on:[{id:n,type:"multiInput",onChange:c=>g.appendUnit(c,o),layout:g.MultiInputLayout.Columns,lastItemFullWidth:!0,blocks:[{id:s,type:"dropdown",defaultValue:D.Solid,choices:[{value:D.Solid,label:D.Solid},{value:D.Dotted,label:D.Dotted},{value:D.Dashed,label:D.Dashed}]},{id:o,type:"input",defaultValue:Rn,rules:[g.numericalOrPixelRule,g.maximumNumericalOrPixelOrAutoRule(500)],placeholder:"e.g. 3px"},{id:i,type:"colorInput",defaultValue:l}]}],off:[]}},He=(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"}]}),Ss=e=>{const t=e!=null&&e.id?`hasRadius_${e.id}`:"hasRadius",n=e!=null&&e.id?`radiusValue_${e.id}`:"radiusValue",s=e!=null&&e.id?`radiusChoice_${e.id}`:"radiusChoice",o=(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:i=>{var l;return e!=null&&e.dependentSettingId?!!((l=i.getBlock(e.dependentSettingId))!=null&&l.value):!0},onChange:i=>g.presetCustomValue(i,s,n,(e==null?void 0:e.radiusStyleMap)||q),on:[{id:n,type:"input",placeholder:"e.g. 10px",rules:[g.numericalOrPixelRule],onChange:i=>g.appendUnit(i,n)}],off:[He(s,o)]}},ks=e=>{const t=e!=null&&e.id?`hasExtendedCustomRadius_${e.id}`:"hasExtendedCustomRadius",n=e!=null&&e.id?`extendedRadiusValue_${e.id}`:"extendedRadiusValue",s=e!=null&&e.id?`extendedRadiusChoice_${e.id}`:"extendedRadiusChoice",o=e!=null&&e.id?`extendedRadiusTopLeft_${e.id}`:"extendedRadiusTopLeft",i=e!=null&&e.id?`extendedRadiusTopRight_${e.id}`:"extendedRadiusTopRight",l=e!=null&&e.id?`extendedRadiusBottomLeft_${e.id}`:"extendedRadiusBottomLeft",u=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 f;return e!=null&&e.dependentSettingId?!!((f=c.getBlock(e.dependentSettingId))!=null&&f.value):!0},onChange:c=>{g.presetCustomValue(c,s,o,q),g.presetCustomValue(c,s,i,q),g.presetCustomValue(c,s,l,q),g.presetCustomValue(c,s,u,q)},on:[{id:n,type:"multiInput",layout:g.MultiInputLayout.Columns,blocks:[{id:o,type:"input",label:"Top Left",rules:[g.numericalOrPixelRule],onChange:c=>g.appendUnit(c,o)},{id:i,type:"input",label:"Top Right",rules:[g.numericalOrPixelRule],onChange:c=>g.appendUnit(c,i)},{id:l,type:"input",label:"Bottom Left",rules:[g.numericalOrPixelRule],onChange:c=>g.appendUnit(c,l)},{id:u,type:"input",label:"Bottom Right",rules:[g.numericalOrPixelRule],onChange:c=>g.appendUnit(c,u)}]}],off:[He(s,e==null?void 0:e.defaultValue)]}},Ts=e=>{const t=e!=null&&e.id?e.id:"hasCustomSpacing",n=e!=null&&e.dependentSettingId?e.dependentSettingId:"columns",s=e!=null&&e.spacingChoiceId?e.spacingChoiceId:"spacingChoice",o=e!=null&&e.spacingCustomId?e.spacingCustomId:"spacingCustom",i=e!=null&&e.defaultValueChoices?e.defaultValueChoices:W.M;return{id:t,type:"switch",defaultValue:!1,switchLabel:"Custom",label:"Gutter",info:"An official nerds term for ‘gap’",onChange:l=>g.presetCustomValue(l,s,o,rt),show:l=>{var u;return((u=l.getBlock(n))==null?void 0:u.value)!=="1"},on:[{id:o,type:"input",rules:[g.numericalOrPixelRule],onChange:l=>g.appendUnit(l,o)}],off:[{id:s,type:"slider",defaultValue:i,choices:[{value:W.Auto,label:"Auto"},{value:W.S,label:"S"},{value:W.M,label:"M"},{value:W.L,label:"L"}]}]}},Ve=e=>({id:e,type:"segmentedControls",defaultValue:$.None,choices:[{value:$.None,label:"None"},{value:$.Small,label:"S"},{value:$.Medium,label:"M"},{value:$.Large,label:"L"}]}),Ps=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",s=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:o=>g.presetCustomValue(o,s,n,(e==null?void 0:e.marginStyleMap)||J),on:[{id:n,type:"input",placeholder:se,rules:[g.numericalOrPixelRule,g.maximumNumericalOrPixelOrAutoRule(500)],onChange:o=>g.appendUnit(o,n)}],off:[Ve(s)]}},Is=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",s=e!=null&&e.id?`extendedMarginChoice_${e==null?void 0:e.id}`:"extendedMarginChoice",o=e!=null&&e.id?`extendedMarginTop_${e==null?void 0:e.id}`:"extendedMarginTop",i=e!=null&&e.id?`extendedMarginLeft_${e==null?void 0:e.id}`:"extendedMarginLeft",l=e!=null&&e.id?`extendedMarginRight_${e==null?void 0:e.id}`:"extendedMarginRight",u=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=>{g.presetCustomValue(c,s,o,J),g.presetCustomValue(c,s,i,J),g.presetCustomValue(c,s,l,J),g.presetCustomValue(c,s,u,J)},on:[{id:n,type:"multiInput",layout:g.MultiInputLayout.Spider,blocks:[{id:o,type:"input",label:"Top",placeholder:se,onChange:c=>g.appendUnit(c,o),rules:[g.numericalOrPixelRule,g.maximumNumericalOrPixelOrAutoRule(500)]},{id:i,type:"input",label:"Left",placeholder:se,onChange:c=>g.appendUnit(c,i),rules:[g.numericalOrPixelRule,g.maximumNumericalOrPixelOrAutoRule(500)]},{id:l,type:"input",label:"Right",placeholder:se,onChange:c=>g.appendUnit(c,l),rules:[g.numericalOrPixelRule,g.maximumNumericalOrPixelOrAutoRule(500)]},{id:u,type:"input",label:"Bottom",placeholder:se,onChange:c=>g.appendUnit(c,u),rules:[g.numericalOrPixelRule,g.maximumNumericalOrPixelOrAutoRule(500)]}]}],off:[Ve(s)]}},ze=e=>({id:e,type:"segmentedControls",defaultValue:z.Small,choices:[{value:z.None,label:"None"},{value:z.Small,label:"S"},{value:z.Medium,label:"M"},{value:z.Large,label:"L"}]}),Es=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",s=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:o=>g.presetCustomValue(o,s,n,(e==null?void 0:e.paddingStyleMap)||Y),on:[{id:n,type:"input",placeholder:re,rules:[g.numericalOrPixelRule,g.maximumNumericalOrPixelOrAutoRule(500)],onChange:o=>g.appendUnit(o,n)}],off:[ze(s)]}},Bs=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",s=e!=null&&e.id?`extendedPaddingChoice_${e==null?void 0:e.id}`:"extendedPaddingChoice",o=e!=null&&e.id?`extendedPaddingTop_${e==null?void 0:e.id}`:"extendedPaddingTop",i=e!=null&&e.id?`extendedPaddingLeft_${e==null?void 0:e.id}`:"extendedPaddingLeft",l=e!=null&&e.id?`extendedPaddingRight_${e==null?void 0:e.id}`:"extendedPaddingRight",u=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=>{g.presetCustomValue(c,s,o,Y),g.presetCustomValue(c,s,i,Y),g.presetCustomValue(c,s,l,Y),g.presetCustomValue(c,s,u,Y)},on:[{id:n,type:"multiInput",layout:g.MultiInputLayout.Spider,blocks:[{id:o,type:"input",label:"Top",placeholder:re,onChange:c=>g.appendUnit(c,o),rules:[g.numericalOrPixelRule,g.maximumNumericalOrPixelOrAutoRule(500)]},{id:i,type:"input",label:"Left",placeholder:re,onChange:c=>g.appendUnit(c,i),rules:[g.numericalOrPixelRule,g.maximumNumericalOrPixelOrAutoRule(500)]},{id:l,type:"input",label:"Right",placeholder:re,onChange:c=>g.appendUnit(c,l),rules:[g.numericalOrPixelRule,g.maximumNumericalOrPixelOrAutoRule(500)]},{id:u,type:"input",label:"Bottom",placeholder:re,onChange:c=>g.appendUnit(c,u),rules:[g.numericalOrPixelRule,g.maximumNumericalOrPixelOrAutoRule(500)]}]}],off:[ze(s)]}},js=e=>{const t=$e(e==null?void 0:e.globalControlId);return{id:e!=null&&e.id?e.id:"downloadable",type:"switch",defaultValue:!1,label:"Downloadable",show:n=>{var s;return((s=n.getBlock(t))==null?void 0:s.value)===K.Custom}}},$e=e=>e||"security",Ns=e=>[{id:$e(e),type:"segmentedControls",defaultValue:K.Global,choices:[{value:K.Global,label:"Global Settings"},{value:K.Custom,label:"Custom"}]},{id:"globalSettingsInfo",type:"notification",footer:g.createFooter({label:"Change global settings [here].",replace:{here:{event:"general-settings.open"}}})}];var gn=(e=>(e.Main="main",e.Basics="basics",e.Layout="layout",e.Style="style",e.Security="security",e.Targets="targets",e))(gn||{});const Ls=e=>e,As=e=>e;exports.AllTextStylePlugins=ws;exports.AllTextStyles=bs;exports.Attachments=ft;exports.AttachmentsProvider=gt;exports.AttachmentsToolbarButton=wt;exports.BUTTON_PLUGIN=Ot;exports.BlockButtonStyles=be;exports.BlockInjectButton=Sn;exports.BlockItemWrapper=Gn;exports.BlockStyles=j;exports.BorderStyle=D;exports.ButtonPlugin=_t;exports.Custom1Plugin=Gt;exports.Custom2Plugin=Xt;exports.Custom3Plugin=Yt;exports.DEFAULT_ATTACHMENTS_BUTTON_ID=xt;exports.DEFAULT_DRAGGING_TOOLTIP=pt;exports.DEFAULT_DRAG_TOOLTIP=bt;exports.DEFAULT_MENU_BUTTON_ID=Le;exports.DownloadButton=Kn;exports.DragHandleToolbarButton=yt;exports.DragPreviewContextProvider=ot;exports.ELEMENT_BUTTON=C;exports.FlyoutToolbarButton=Ne;exports.GutterSpacing=W;exports.Heading1Plugin=Zt;exports.Heading2Plugin=en;exports.Heading3Plugin=tn;exports.Heading4Plugin=nn;exports.ImageCaptionPlugin=rn;exports.ImageTitlePlugin=sn;exports.LinkInput=Ft;exports.LinkPlugin=qt;exports.LinkSelector=Mt;exports.Margin=$;exports.MenuToolbarButton=Ct;exports.MultiFlyoutContextProvider=lt;exports.PARAGRAPH_CLASSES=on;exports.Padding=z;exports.ParagraphMarkupElement=ln;exports.ParagraphMarkupElementNode=ge;exports.ParagraphPlugin=an;exports.QuoteMarkupElementNode=me;exports.QuotePlugin=un;exports.Radius=H;exports.RichTextEditor=jr;exports.Sections=gn;exports.Security=K;exports.THEME_PREFIX=ys;exports.TextStylePluginsWithoutImage=_e;exports.TextStyles=p;exports.TextStylesWithoutImage=Z;exports.Toolbar=St;exports.ToolbarFlyoutMenu=vt;exports.addHttps=fe;exports.borderStyleMap=nt;exports.convertToRteValue=Qn;exports.createButtonNode=Nt;exports.createButtonPlugin=Ut;exports.createLinkPlugin=Wt;exports.createParagraphPlugin=cn;exports.createQuotePlugin=dn;exports.customCoordinatesGetterFactory=ht;exports.defineBlock=Ls;exports.defineSettings=As;exports.getBackgroundColorStyles=Ln;exports.getBackgroundSettings=vs;exports.getBorderRadiusSettings=Ss;exports.getBorderRadiusSlider=He;exports.getBorderSettings=Cs;exports.getBorderStyles=Mn;exports.getDefaultPluginsWithLinkChooser=ps;exports.getExtendedBorderRadiusSettings=ks;exports.getGutterSettings=Ts;exports.getLegacyUrl=tr;exports.getLinkFromEditor=rr;exports.getMarginExtendedSettings=Is;exports.getMarginSettings=Ps;exports.getMarginSlider=Ve;exports.getPaddingExtendedSettings=Bs;exports.getPaddingSettings=Es;exports.getPaddingSlider=ze;exports.getRadiusStyles=Fn;exports.getReadableColor=jn;exports.getSecurityDownloadableSetting=js;exports.getSecurityGlobalControlId=$e;exports.getSecurityGlobalControlSetting=Ns;exports.getUrl=nr;exports.getUrlFromEditor=jt;exports.getUrlFromLinkOrLegacyLink=Me;exports.gutterSpacingStyleMap=rt;exports.hasRichTextValue=kt;exports.insertButton=It;exports.isDark=Tn;exports.isDownloadable=Yn;exports.isValidUrl=xe;exports.isValidUrlOrEmpty=ee;exports.joinClassNames=O;exports.mapAppBridgeColorPaletteToFonduePalette=Tt;exports.mapAppBridgeColorPalettesToFonduePalettes=Jn;exports.marginStyleMap=J;exports.moveItemInArray=Nn;exports.paddingStyleMap=Y;exports.radiusStyleMap=q;exports.relativeUrlRegex=Fe;exports.setAlpha=En;exports.submitFloatingButton=De;exports.toColorObject=Bn;exports.toHex8String=Pn;exports.toHexString=In;exports.toRgbaString=Ee;exports.toShortRgba=X;exports.triggerFloatingButton=Lt;exports.triggerFloatingButtonEdit=we;exports.triggerFloatingButtonInsert=Ue;exports.unwrapButton=te;exports.upsertButton=Et;exports.upsertButtonText=Oe;exports.useAttachments=ut;exports.useAttachmentsContext=mt;exports.useDndSensors=_n;exports.useDragPreviewContext=oe;exports.useMultiFlyoutContext=ct;exports.useMultiFlyoutState=he;exports.withAttachmentsProvider=Dn;exports.withButton=Pt;exports.wrapButton=Bt;Object.keys(g).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>g[e]})});
1
+ "use strict";var bn=Object.defineProperty;var yn=(e,t,n)=>t in e?bn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var B=(e,t,n)=>(yn(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("@frontify/sidebar-settings"),a=require("react/jsx-runtime"),r=require("@frontify/fondue"),h=require("react"),G=require("@frontify/app-bridge"),T=require("@dnd-kit/core"),vn=require("@dnd-kit/modifiers"),ue=require("@dnd-kit/sortable"),tt=require("@react-aria/focus"),Cn=require("@react-stately/overlays"),_=require("@ctrl/tinycolor"),O=e=>e.filter(Boolean).join(" "),Sn=({onDrop:e,label:t,icon:n,secondaryLabel:s,isLoading:o,fillParentContainer:i,onAssetChooseClick:l,onUploadClick:u,withMenu:c=!0,onClick:f,validFileType:m,verticalLayout:d})=>{const[x,p]=h.useState(!1),[w,v]=h.useState(),k=h.useRef(null),[E,A]=h.useState(void 0),M=S=>{if(S.preventDefault(),p(!1),!F(S.dataTransfer.files)){A("Invalid"),setTimeout(()=>{A(void 0)},1e3);return}e==null||e(S.dataTransfer.files)},F=S=>{if(!m)return!0;for(let L=0;L<S.length;L++){const R=S[L].name.split(".").pop()??"";if(!G.FileExtensionSets[m].includes(R))return!1}return!0},U=S=>{if(!k.current||o)return;const{left:L,top:R}=k.current.getBoundingClientRect(),le=S.clientX-L,ce=S.clientY-R;v([le,ce])};return a.jsxs("button",{ref:k,"data-test-id":"block-inject-button",className:O(["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",d?"[&: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",i?"tw-h-full":"tw-h-[72px]",x&&!o?"tw-border-dashed":"tw-border-solid",w&&"tw-bg-blank-state-pressed-inverse",x&&"tw-bg-blank-state-weak-inverse",E?"!tw-border-red-50 !tw-cursor-not-allowed":" tw-border-blank-state-line",o||w||x||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",(x||w)&&!E?"[&>*]:tw-pointer-events-none tw-border-blank-state-line-hover":"tw-bg-blank-state-shaded-inverse tw-text-blank-state-shaded"]),onDragEnter:e?S=>{var L;if(p(!0),m==="Images")for(const R of Array.from(S.dataTransfer.items))(L=R==null?void 0:R.type)!=null&&L.startsWith("image/")?A(void 0):A("Invalid")}:void 0,onDragLeave:e?()=>{p(!1),A(void 0)}:void 0,onDrop:e?M:void 0,onClick:S=>{c&&U(S),f==null||f()},children:[o?a.jsx(r.LoadingCircle,{}):E?a.jsxs("div",{className:" tw-flex tw-items-center tw-justify-center tw-text-red-60 tw-font-medium",children:[a.jsx(r.IconExclamationMarkTriangle,{}),E]}):a.jsxs(a.Fragment,{children:[n&&a.jsx("div",{children:n}),(t||s)&&a.jsxs("div",{className:"tw-flex tw-flex-col tw-items-start",children:[t&&a.jsx("div",{className:"tw-font-medium",children:t}),s&&a.jsx("div",{className:"tw-font-normal",children:s})]})]}),w&&a.jsx("div",{className:"tw-absolute tw-left-0 tw-top-full tw-z-20",style:{left:w[0],top:w[1]},children:a.jsx(r.Flyout,{onOpenChange:S=>!S&&v(void 0),isOpen:!0,fitContent:!0,hug:!1,legacyFooter:!1,trigger:a.jsx("div",{}),children:a.jsx(r.ActionMenu,{menuBlocks:[{id:"menu",menuItems:[...u?[{id:"upload",size:r.MenuItemContentSize.XSmall,title:"Upload asset",onClick:()=>{u(),v(void 0)},initialValue:!0,decorator:a.jsx("div",{className:"tw-mr-2",children:a.jsx(r.IconArrowCircleUp20,{})})}]:[],...l?[{id:"asset",size:r.MenuItemContentSize.XSmall,title:"Browse asset",onClick:()=>{l(),v(void 0)},initialValue:!0,decorator:a.jsx("div",{className:"tw-mr-2",children:a.jsx(r.IconImageStack20,{})})}]:[]]}]})})})]})},X=e=>{const t=s=>typeof s=="object"&&["red","green","blue"].every(i=>s.hasOwnProperty(i)),n=s=>{const o=typeof s.alpha=="number"?s.alpha:1;return{r:s.red,g:s.green,b:s.blue,a:o}};return t(e)?n(e):e},kn=e=>typeof e=="object"&&["red","green","blue"].every(n=>e==null?void 0:e.hasOwnProperty(n)),Tn=(e,t)=>{const n=kn(e)?X(e):e,s=new _.TinyColor(n);return t?s.getBrightness()<t:s.isDark()||s.getAlpha()>.25&&s.getAlpha()<1},Pn=e=>new _.TinyColor(X(e)).toHex8String(),In=e=>new _.TinyColor(X(e)).toHexString(),Ee=e=>new _.TinyColor(X(e)).toRgbString(),En=(e,t)=>new _.TinyColor(t).setAlpha(e).toRgbString(),Bn=e=>{const{r:t,g:n,b:s,a:o}=new _.TinyColor(e);return{red:t,green:n,blue:s,alpha:o}},Ye=e=>typeof e=="object"&&["red","green","blue"].every(n=>e==null?void 0:e.hasOwnProperty(n)),jn=(e,t)=>{const n=Ye(e)?X(e):e,s=Ye(t)?X(t):t;let o=new _.TinyColor(n);const i=new _.TinyColor(s);for(;_.readability(o,i)<4.5;)o=o.darken(1);return o.toRgbString()},Nn=(e,t,n)=>{const s=[...e],o=n<0?s.length+n:n;if(o>=0&&o<s.length){const i=s.splice(t,1)[0];s.splice(o,0,i)}return s},Ln=e=>({backgroundColor:Ee(e)});var D=(e=>(e.Solid="Solid",e.Dashed="Dashed",e.Dotted="Dotted",e))(D||{});const nt={Solid:"solid",Dotted:"dotted",Dashed:"dashed"};var H=(e=>(e.None="None",e.Small="Small",e.Medium="Medium",e.Large="Large",e))(H||{});const q={None:"0px",Small:"2px",Medium:"4px",Large:"12px"};var z=(e=>(e.None="None",e.Small="Small",e.Medium="Medium",e.Large="Large",e))(z||{});const Y={None:"0px",Small:"24px",Medium:"36px",Large:"60px"};var $=(e=>(e.None="None",e.Small="Small",e.Medium="Medium",e.Large="Large",e))($||{});const J={None:"0px",Small:"24px",Medium:"36px",Large:"60px"};var K=(e=>(e.Global="Global",e.Custom="Custom",e))(K||{}),W=(e=>(e.Auto="Auto",e.S="S",e.M="M",e.L="L",e))(W||{});const rt={Auto:"4px",S:"10px",M:"30px",L:"50px"},An={red:241,green:241,blue:241,alpha:1},st={red:234,green:235,blue:235,alpha:1},Mn="1px",re="24px",se="24px",Rn=(e=D.Solid,t="1px",n=st)=>({borderStyle:nt[e],borderWidth:t,borderColor:Ee(n)}),Fn=(e,t=!1,n)=>({borderRadius:t?n:q[e]}),at=h.createContext(!1),ot=({children:e,isDragPreview:t})=>a.jsx(at.Provider,{value:t,children:e}),oe=()=>h.useContext(at),it=h.createContext({openFlyoutIds:[],setOpenFlyoutIds:()=>console.error("No MultiFlyoutContext Provider found")}),lt=({children:e,openFlyoutIds:t,setOpenFlyoutIds:n})=>{const s=h.useMemo(()=>({openFlyoutIds:t,setOpenFlyoutIds:n}),[t,n]);return a.jsx(it.Provider,{value:s,children:e})},ct=()=>h.useContext(it),he=e=>{const{openFlyoutIds:t,setOpenFlyoutIds:n}=ct(),s=h.useCallback(o=>{n(i=>{const l=i.filter(u=>u!==e);return o?[...l,e]:l})},[e,n]);return{isOpen:t.includes(e),onOpenChange:s}},Je=({children:e})=>a.jsx("div",{className:"tw-pointer-events-auto tw-flex tw-flex-shrink-0 tw-gap-px tw-px-px tw-h-[26px] tw-items-center tw-self-start tw-leading-none",children:e}),ut=(e,t)=>{const{blockAssets:n,addAssetIdsToKey:s,deleteAssetIdsFromKey:o,updateAssetIdsFromKey:i}=G.useBlockAssets(e),l=(n==null?void 0:n[t])||[];return{onAttachmentsAdd:async d=>{await s(t,d.map(x=>x.id))},onAttachmentDelete:async d=>{await o(t,[d.id])},onAttachmentReplace:async(d,x)=>{const p=l.map(w=>w.id===d.id?x.id:w.id);await i(t,p)},onAttachmentsSorted:async d=>{const x=d.map(p=>p.id);await i(t,x)},attachments:l,appBridge:e}},dt=h.createContext(null),gt=({appBridge:e,children:t,assetId:n})=>{const s=ut(e,n);return a.jsx(dt.Provider,{value:s,children:t})},mt=()=>{const e=h.useContext(dt);if(!e)throw new Error("No AttachmentsContext Provided. Component must be wrapped in an 'AttachmentsProvider' or the 'withAttachmentsProvider' HOC");return e},Dn=(e,t)=>{const n=s=>a.jsx(gt,{appBridge:s.appBridge,assetId:t,children:a.jsx(e,{...s})});return n.displayName="withAttachmentsProvider",n},On=[T.KeyboardCode.Down,T.KeyboardCode.Right,T.KeyboardCode.Up,T.KeyboardCode.Left],ht=(e,t)=>(n,{currentCoordinates:s,context:{activeNode:o}})=>{if(n.preventDefault(),On.includes(n.code)){const i=(o==null?void 0:o.offsetWidth)??0,l=(o==null?void 0:o.offsetHeight)??0;switch(n.code){case T.KeyboardCode.Right:return{...s,x:s.x+i+e};case T.KeyboardCode.Left:return{...s,x:s.x-i-e};case T.KeyboardCode.Down:return{...s,y:s.y+l+t};case T.KeyboardCode.Up:return{...s,y:s.y-l-t}}}},Un={start:["Space","Enter"],cancel:[],end:["Space","Enter","Escape"]},_n=(e=0,t=0)=>{const n=ht(e,t);return T.useSensors(T.useSensor(T.PointerSensor),T.useSensor(T.KeyboardSensor,{coordinateGetter:n,keyboardCodes:Un}))},Hn=e=>e==="IMAGE"?a.jsx(r.IconImage24,{}):e==="VIDEO"?a.jsx(r.IconPlayFrame24,{}):e==="AUDIO"?a.jsx(r.IconMusicNote24,{}):a.jsx(r.IconDocument24,{}),Be=h.forwardRef(({item:e,isEditing:t,draggableProps:n,transformStyle:s,isDragging:o,isOverlay:i,isLoading:l,onDelete:u,onReplaceWithBrowse:c,onReplaceWithUpload:f,onDownload:m},d)=>{const[x,p]=h.useState(),[w,{selectedFiles:v}]=G.useFileInput({multiple:!0,accept:"image/*"}),[k,{results:E,doneAll:A}]=G.useAssetUpload(),{focusProps:M,isFocusVisible:F}=tt.useFocusRing();h.useEffect(()=>{v&&k(v[0])},[v]),h.useEffect(()=>{A&&f(E[0])},[A,E]);const U=l||v&&!A;return a.jsxs("button",{"aria-label":"Download attachment","data-test-id":"attachments-item",onClick:()=>m==null?void 0:m(),ref:d,style:{...s,opacity:o&&!i?.3:1,fontFamily:"var(-f-theme-settings-body-font-family)"},className:O(["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",o?"tw-bg-box-neutral-hover":""]),children:[a.jsx("div",{className:"tw-text-text-weak group-hover:tw-text-box-neutral-inverse-hover",children:U?a.jsx(r.LoadingCircle,{size:r.LoadingCircleSize.Small}):Hn(e.objectType)}),a.jsxs("div",{className:"tw-text-s tw-flex-1 tw-min-w-0",children:[a.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}),a.jsx("div",{className:"tw-text-text-weak",children:`${e.fileSizeHumanReadable} - ${e.extension}`})]}),t&&a.jsxs("div",{"data-test-id":"attachments-actionbar",className:O(["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",i||(x==null?void 0:x.id)===e.id?"tw-opacity-100":"tw-opacity-0"]),children:[a.jsx("button",{...M,...n,"aria-label":"Drag attachment",className:O([" 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 ",o||i?"tw-cursor-grabbing tw-bg-button-background-pressed hover:tw-bg-button-background-pressed":"tw-cursor-grab hover:tw-bg-button-background-hover",F&&r.FOCUS_STYLE,F&&"tw-z-[2]"]),children:a.jsx(r.IconGrabHandle20,{})}),a.jsx("div",{"data-test-id":"attachments-actionbar-flyout",children:a.jsx(r.Flyout,{placement:r.FlyoutPlacement.Right,isOpen:(x==null?void 0:x.id)===e.id,fitContent:!0,legacyFooter:!1,onOpenChange:S=>p(S?e:void 0),trigger:(S,L)=>a.jsx(r.Button,{ref:L,icon:a.jsx(r.IconPen20,{}),emphasis:r.ButtonEmphasis.Default,onClick:()=>p(e)}),children:a.jsx(r.ActionMenu,{menuBlocks:[{id:"menu",menuItems:[{id:"upload",size:r.MenuItemContentSize.XSmall,title:"Replace with upload",onClick:()=>{w(),p(void 0)},initialValue:!0,decorator:a.jsx("div",{className:"tw-mr-2",children:a.jsx(r.IconArrowCircleUp20,{})})},{id:"asset",size:r.MenuItemContentSize.XSmall,title:"Replace with asset",onClick:()=>{c(),p(void 0)},initialValue:!0,decorator:a.jsx("div",{className:"tw-mr-2",children:a.jsx(r.IconImageStack20,{})})}]},{id:"menu-delete",menuItems:[{id:"delete",size:r.MenuItemContentSize.XSmall,title:"Delete",style:r.MenuItemStyle.Danger,onClick:()=>{u(),p(void 0)},initialValue:!0,decorator:a.jsx("div",{className:"tw-mr-2",children:a.jsx(r.IconTrashBin20,{})})}]}]})})})]})]})});Be.displayName="AttachmentItem";const Vn=e=>{const{attributes:t,listeners:n,setNodeRef:s,transform:o,transition:i,isDragging:l}=ue.useSortable({id:e.item.id}),u={transform:o?`translate(${o.x}px, ${o.y}px)`:"",transition:i,zIndex:l?2:1},c={...t,...n};return a.jsx(Be,{ref:s,isDragging:l,transformStyle:u,draggableProps:c,...e})},zn=({children:e,isFlyoutOpen:t,triggerProps:n,triggerRef:s})=>a.jsxs("button",{className:O(["tw-flex tw-text-xs tw-font-body tw-items-center tw-gap-1 tw-rounded-full tw-outline tw-outline-1 tw-outline-offset-1 tw-p-1.5 tw-outline-line",t?"tw-bg-box-neutral-pressed tw-text-box-neutral-inverse-pressed":"tw-bg-base hover:tw-bg-box-neutral-hover active:tw-bg-box-neutral-pressed tw-text-box-neutral-inverse hover:tw-text-box-neutral-inverse-hover active:tw-text-box-neutral-inverse-pressed"]),...n,ref:s,"data-test-id":"attachments-button-trigger",children:[a.jsx(r.IconPaperclip16,{}),e,a.jsx(r.IconCaretDown12,{})]}),ft=({items:e=[],onDelete:t,onReplaceWithBrowse:n,onReplaceWithUpload:s,onBrowse:o,onUpload:i,onSorted:l,appBridge:u,triggerComponent:c=zn,isOpen:f,onOpenChange:m})=>{const[d,x]=h.useState(e),[p,w]=h.useState(!1),v=T.useSensors(T.useSensor(T.PointerSensor),T.useSensor(T.KeyboardSensor)),[k,E]=h.useState(void 0),[A,M]=h.useState(!1),[F,U]=h.useState([]),[S,L]=h.useState(null),R=G.useEditorState(u),{openAssetChooser:le,closeAssetChooser:ce}=G.useAssetChooser(u),We=f!==void 0,be=We?f:p,Q=d==null?void 0:d.find(y=>y.id===k),[mn,{results:qe,doneAll:Ge}]=G.useAssetUpload({onUploadProgress:()=>!A&&M(!0)}),ne=y=>{const I=We?m:w;I==null||I(y)};h.useEffect(()=>{x(e)},[e]),h.useEffect(()=>{S&&(M(!0),mn(S))},[S]),h.useEffect(()=>{(async()=>{Ge&&(await i(qe),M(!1))})()},[Ge,qe]);const hn=()=>{ne(!1),le(y=>{o(y),ce(),ne(!0)},{multiSelection:!0,selectedValueIds:d.map(y=>y.id)})},Ke=y=>{ne(!1),le(async I=>{ne(!0),ce(),U([...F,y.id]),await n(y,I[0]),U(F.filter(V=>V!==y.id))},{multiSelection:!1,selectedValueIds:d.map(I=>I.id)})},Xe=async(y,I)=>{U([...F,y.id]),await s(y,I),U(F.filter(V=>V!==y.id))},fn=y=>{const{active:I}=y;E(I.id)},xn=y=>{const{active:I,over:V}=y;if(V&&I.id!==V.id&&d){const pn=d.findIndex(ye=>ye.id===I.id),wn=d.findIndex(ye=>ye.id===V.id),Qe=ue.arrayMove(d,pn,wn);x(Qe),l(Qe)}E(void 0)};return R||((d==null?void 0:d.length)??0)>0?a.jsx(r.LegacyTooltip,{withArrow:!0,position:r.TooltipPosition.Top,content:"Attachments",disabled:be,enterDelay:500,triggerElement:a.jsx("div",{"data-test-id":"attachments-flyout-button",children:a.jsx(r.Flyout,{placement:r.FlyoutPlacement.BottomRight,onOpenChange:y=>ne(Q?!0:y),isOpen:be,hug:!1,fitContent:!0,legacyFooter:!1,trigger:(y,I)=>a.jsx(c,{isFlyoutOpen:be,triggerProps:y,triggerRef:I,children:a.jsx("div",{children:e.length>0?e.length:"Add"})}),children:a.jsxs("div",{className:"tw-w-[300px]","data-test-id":"attachments-flyout-content",children:[d.length>0&&a.jsxs(T.DndContext,{sensors:v,collisionDetection:T.closestCenter,onDragStart:fn,onDragEnd:xn,modifiers:[vn.restrictToWindowEdges],children:[a.jsx(ue.SortableContext,{items:d,strategy:ue.rectSortingStrategy,children:a.jsx("div",{className:"tw-border-b tw-border-b-line",children:d.map(y=>a.jsx(Vn,{isEditing:R,isLoading:F.includes(y.id),item:y,onDelete:()=>t(y),onReplaceWithBrowse:()=>Ke(y),onReplaceWithUpload:I=>Xe(y,I),onDownload:()=>u.dispatch({name:"downloadAsset",payload:y})},y.id))})}),a.jsx(T.DragOverlay,{children:Q&&a.jsx(Be,{isOverlay:!0,isEditing:R,item:Q,isDragging:!0,onDelete:()=>t(Q),onReplaceWithBrowse:()=>Ke(Q),onReplaceWithUpload:y=>Xe(Q,y)},k)})]}),R&&a.jsxs("div",{className:"tw-px-5 tw-py-3",children:[a.jsx("div",{className:"tw-font-body tw-font-medium tw-text-text tw-text-s tw-my-4",children:"Add attachments"}),a.jsx(r.AssetInput,{isLoading:A,size:r.AssetInputSize.Small,onUploadClick:y=>L(y),onLibraryClick:hn})]})]})})})}):null},$n=(e,t)=>{const n=[r.FOCUS_VISIBLE_STYLE,"tw-relative tw-inline-flex tw-items-center tw-justify-center","tw-h-6 tw-p-1","tw-rounded","tw-text-xs tw-font-medium","tw-gap-0.5","focus-visible:tw-z-10"];return t?n.push("tw-bg-box-neutral-pressed","tw-text-box-neutral-inverse-pressed",e==="grab"?"tw-cursor-grabbing":"tw-cursor-pointer"):n.push("hover:tw-bg-box-neutral-hover active:tw-bg-box-neutral-pressed","tw-text-text-weak hover:tw-text-box-neutral-inverse-hover active:tw-text-box-neutral-inverse-pressed",e==="grab"?"!tw-cursor-grab active:tw-cursor-grabbing":"tw-cursor-pointer"),O(n)},ie=h.forwardRef(({onClick:e,children:t,forceActiveStyle:n,cursor:s="pointer","data-test-id":o="base-toolbar-button",...i},l)=>a.jsx("button",{onClick:e,className:$n(s,n),"data-test-id":o,...i,ref:l,children:t}));ie.displayName="BaseToolbarButton";const Wn=({children:e,isFlyoutOpen:t,triggerProps:n,triggerRef:s})=>a.jsxs(ie,{forceActiveStyle:t,"data-test-id":"attachments-toolbar-button-trigger",...n,ref:s,children:[a.jsx(r.IconPaperclip16,{}),e,a.jsx(r.IconCaretDown12,{})]}),xt="attachments",pt=({flyoutId:e=xt})=>{const t=r.useMemoizedId(e),{appBridge:n,attachments:s,onAttachmentsAdd:o,onAttachmentDelete:i,onAttachmentReplace:l,onAttachmentsSorted:u}=mt(),{isOpen:c,onOpenChange:f}=he(t),m=oe();return a.jsx(ft,{onUpload:o,onDelete:i,onReplaceWithBrowse:l,onReplaceWithUpload:l,onSorted:u,onBrowse:o,items:s,appBridge:n,triggerComponent:Wn,isOpen:c&&!m,onOpenChange:f})},je=({open:e,content:t,children:n,disabled:s})=>a.jsx(r.LegacyTooltip,{withArrow:!0,hoverDelay:0,enterDelay:300,open:e,disabled:s,position:r.TooltipPosition.Top,content:a.jsx("div",{children:t}),triggerElement:n,"data-test-id":"toolbar-button-tooltip"}),qn=({tooltip:e,icon:t,onClick:n})=>{const s=oe();return a.jsx(je,{disabled:s,content:e??"",children:a.jsx(ie,{"data-test-id":"block-item-wrapper-toolbar-btn",onClick:n,children:t})})},wt="Drag or press ↵ to move",bt="Move with ↑↓←→ and confirm with ↵",yt=({tooltip:e,icon:t,setActivatorNodeRef:n,draggableProps:s})=>{const o=oe();return a.jsx(je,{open:o,content:a.jsx("div",{children:o?bt:e??wt}),children:a.jsx(ie,{ref:n,"data-test-id":"block-item-wrapper-toolbar-btn",forceActiveStyle:o,cursor:"grab",...s,children:t})})},Ne=({content:e,icon:t,tooltip:n,flyoutId:s,flyoutFooter:o,flyoutHeader:i})=>{const l=r.useMemoizedId(s),{isOpen:u,onOpenChange:c}=he(l),f=oe();return a.jsx(je,{disabled:f||u,content:n,children:a.jsx("div",{className:"tw-flex tw-flex-shrink-0 tw-flex-1 tw-h-6 tw-relative",children:a.jsx(r.Flyout,{isOpen:u&&!f,legacyFooter:!1,fixedFooter:o,fixedHeader:i,fitContent:!0,hug:!1,placement:r.FlyoutPlacement.BottomRight,onOpenChange:c,trigger:(m,d)=>a.jsx(ie,{"data-test-id":"block-item-wrapper-toolbar-flyout",forceActiveStyle:u&&!f,...m,ref:d,children:t}),children:e})})})},vt=({items:e,flyoutId:t})=>{const{onOpenChange:n}=he(t);return a.jsx(r.ActionMenu,{menuBlocks:e.map((s,o)=>({id:o.toString(),menuItems:s.map((i,l)=>({id:o.toString()+l.toString(),size:r.MenuItemContentSize.XSmall,title:i.title,style:i.style,onClick:()=>{n(!1),i.onClick()},initialValue:!0,decorator:a.jsx("div",{className:"tw-mr-2",children:i.icon})}))}))})},Le="menu",Ct=({items:e,flyoutId:t=Le,tooltip:n="Options"})=>{const s=r.useMemoizedId(t);return a.jsx(Ne,{icon:a.jsx(r.IconDotsHorizontal16,{}),tooltip:n,flyoutId:s,content:a.jsx(vt,{items:e,flyoutId:s})})},St=({items:e,attachments:t})=>a.jsxs("div",{"data-test-id":"block-item-wrapper-toolbar",className:"tw-rounded-md tw-bg-base tw-border tw-border-line-strong tw-divide-x tw-divide-line-strong tw-shadow-lg tw-flex tw-flex-none tw-items-center tw-isolate",children:[t.isEnabled&&a.jsx(Je,{children:a.jsx(pt,{})}),a.jsx(Je,{children:e.map(n=>n.type==="dragHandle"?a.jsx(yt,{...n},n.tooltip+n.type):n.type==="menu"?a.jsx(Ct,{...n},n.tooltip+n.type):n.type==="flyout"?a.jsx(Ne,{...n},n.tooltip+n.type):a.jsx(qn,{...n},n.tooltip+n.type))})]}),Gn=({children:e,toolbarItems:t,shouldHideWrapper:n,shouldHideComponent:s=!1,isDragging:o=!1,shouldFillContainer:i,outlineOffset:l=2,shouldBeShown:u=!1,showAttachments:c=!1})=>{const[f,m]=h.useState(u?[Le]:[]),d=h.useRef(null);if(n)return a.jsx(a.Fragment,{children:e});const x=t==null?void 0:t.filter(w=>w!==void 0),p=f.length>0||u;return a.jsx(ot,{isDragPreview:o,children:a.jsx(lt,{openFlyoutIds:f,setOpenFlyoutIds:m,children:a.jsxs("div",{ref:d,"data-test-id":"block-item-wrapper",style:{outlineOffset:l},className:O(["tw-relative tw-group tw-outline-1 tw-outline-box-selected-inverse",i&&"tw-flex-1 tw-h-full tw-w-full","hover:tw-outline focus-within:tw-outline",p&&"tw-outline",s&&"tw-opacity-0"]),children:[a.jsx("div",{style:{right:-1-l,bottom:`calc(100% - ${2+l}px)`},className:O(["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","tw-flex tw-justify-end",p&&"tw-opacity-100"]),children:a.jsx(St,{attachments:{isEnabled:c},items:x})}),e]})})})},Kn=({onDownload:e})=>{const{isFocused:t,focusProps:n}=tt.useFocusRing();return a.jsx(r.LegacyTooltip,{withArrow:!0,position:r.TooltipPosition.Top,content:"Download",enterDelay:500,triggerElement:a.jsx("button",{tabIndex:0,"aria-label":"Download",...n,className:O(["tw-outline-none tw-rounded",t&&r.FOCUS_STYLE]),onClick:e,onPointerDown:s=>s.preventDefault(),children:a.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:a.jsx(r.IconArrowCircleDown16,{})})})})},Xn=({value:e="",gap:t,columns:n,show:s=!0,plugins:o})=>{const[i,l]=h.useState(null);return h.useEffect(()=>{(async()=>l(await r.serializeRawToHtmlAsync(e,o,n,t)))()},[e,n,t,o]),!s||i==="<br />"?null:i!==null?a.jsx("div",{className:"tw-w-full tw-whitespace-pre-wrap","data-test-id":"rte-content-html",dangerouslySetInnerHTML:{__html:i}}):a.jsx("div",{className:"tw-rounded-sm tw-bg-base-alt tw-animate-pulse tw-h-full tw-min-h-[10px] tw-w-full"})},Ae=r.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})),P=Ae.set,N=Ae.get,ae=()=>Ae.use,kt=e=>{if(!e)return!1;const t=n=>n.some(s=>s.text?s.text!=="":s.children?t(s.children):!1);try{const n=JSON.parse(e);return t(n)}catch{return!1}},Qn=(e="p",t="",n)=>kt(t)?t:JSON.stringify([{type:e,children:[{text:t,textStyle:e}],align:n}]),Yn=(e,t,n)=>e===K.Custom?t:n,Jn=e=>e.map(Tt),Tt=e=>({id:e.id,title:e.name,colors:e.colors.map(er)}),Zn=e=>"revision"in e,er=e=>{if(Zn(e)){const{title:t,revision:n}=e;return{alpha:n.rgba.alpha?n.rgba.alpha/255:1,red:n.rgba.red??0,green:n.rgba.green??0,blue:n.rgba.blue??0,name:t??""}}return{alpha:e.alpha?e.alpha/255:1,red:e.red??0,green:e.green??0,blue:e.blue??0,name:e.name??""}},Me=(e,t)=>{const n=r.getAboveNode(e,{match:{type:r.ELEMENT_LINK}});return Array.isArray(n)?t(n[0]):""},tr=e=>Me(e,t=>{var n,s;return((s=(n=t.chosenLink)==null?void 0:n.searchResult)==null?void 0:s.link)||""}),nr=e=>Me(e,t=>t.url||""),Re=e=>{var t,n;return e.url||((n=(t=e.chosenLink)==null?void 0:t.searchResult)==null?void 0:n.link)||""},rr=e=>Me(e,Re),Fe=/^\/(document|r)\/\S+$/i,fe=e=>{if(Fe.test(e))return e;try{return new URL(e),e}catch{return`https://${e}`}},xe=e=>{if(Fe.test(e))return!0;try{const t=new URL(e);return["http:","https:","mailto:","tel:"].includes(t.protocol)&&t.pathname!==""}catch{return!1}},ee=e=>xe(fe(e))||e==="",Pt=(e,{type:t})=>{const{apply:n,normalizeNode:s}=e;return e.apply=o=>{if(o.type!=="set_selection"){n(o);return}const i=o.newProperties;if(!(i!=null&&i.focus)||!i.anchor||!r.isCollapsed(i)){n(o);return}const l=r.getAboveNode(e,{at:i,match:{type:r.getPluginType(e,C)}});if(l){const[,u]=l;let c;r.isStartPoint(e,i.focus,u)&&(c=r.getPreviousNodeEndPoint(e,u)),r.isEndPoint(e,i.focus,u)&&(c=r.getNextNodeStartPoint(e,u)),c&&(o.newProperties={anchor:c,focus:c})}n(o)},e.normalizeNode=([o,i])=>{if(o.type===r.getPluginType(e,C)){const l=e.selection;if(l&&r.isCollapsed(l)&&r.isEndPoint(e,l.focus,i)){const u=r.getNextNodeStartPoint(e,i);if(u)r.select(e,u);else{const c=r.Path.next(i);r.insertNodes(e,{text:""},{at:c}),r.select(e,c)}}}s([o,i])},r.withRemoveEmptyNodes(e,r.mockPlugin({options:{types:t}}))},It=(e,t,n)=>{r.insertNodes(e,[Nt(e,t)],n)},De=e=>{if(!e.selection)return;const{isUrl:t,forceSubmit:n}=r.getPluginOptions(e,C),s=N.url();if(!((t==null?void 0:t(s))||n))return;const i=N.text(),l=N.buttonStyle(),u=N.newTab()?void 0:"_self";return P.reset(),Et(e,{url:s,text:i,buttonStyle:l,target:u,isUrl:c=>n||!t?!0:t(c)}),setTimeout(()=>{r.focusEditor(e,e.selection??void 0)},0),!0},te=(e,t)=>r.withoutNormalizing(e,()=>{var n,s,o,i,l,u;if(t!=null&&t.split){if(r.getAboveNode(e,{at:(n=e.selection)==null?void 0:n.anchor,match:{type:r.getPluginType(e,C)}}))return r.splitNodes(e,{at:(s=e.selection)==null?void 0:s.anchor,match:m=>r.isElement(m)&&m.type===r.getPluginType(e,C)}),te(e,{at:(o=e.selection)==null?void 0:o.anchor}),!0;if(r.getAboveNode(e,{at:(i=e.selection)==null?void 0:i.focus,match:{type:r.getPluginType(e,C)}}))return r.splitNodes(e,{at:(l=e.selection)==null?void 0:l.focus,match:m=>r.isElement(m)&&m.type===r.getPluginType(e,C)}),te(e,{at:(u=e.selection)==null?void 0:u.focus}),!0}r.unwrapNodes(e,{match:{type:r.getPluginType(e,C)},...t})}),Et=(e,{url:t,text:n,buttonStyle:s,target:o,insertTextInButton:i,insertNodesOptions:l,isUrl:u=r.getPluginOptions(e,C).isUrl})=>{var E;const c=e.selection;if(!c)return;const f=r.getAboveNode(e,{at:c,match:{type:r.getPluginType(e,C)}});if(i&&f)return e.insertText(t),!0;if(!(u!=null&&u(t)))return;if(r.isDefined(n)&&n.length===0&&(n=t),f)return or(t,e,f,o,s,n),!0;const m=r.findNode(e,{at:c,match:{type:r.getPluginType(e,C)}}),[d,x]=m??[],p=sr(e,x,n);if(r.isExpanded(c))return ar(f,e,t,s,o,n),!0;p&&r.removeNodes(e,{at:x});const w=r.getNodeProps(d??{}),v=(E=e.selection)==null?void 0:E.focus.path;if(!v)return;const k=r.getNodeLeaf(e,v);return n!=null&&n.length||(n=t),It(e,{...w,url:t,target:o,children:[{...k,text:n}]},l),!0};function sr(e,t,n){return t&&(n==null?void 0:n.length)&&n!==r.getEditorString(e,t)}function ar(e,t,n,s,o,i){e?te(t,{at:e[1]}):te(t,{split:!0}),Bt(t,{url:n,buttonStyle:s,target:o}),Oe(t,{url:n,target:o,text:i})}function or(e,t,n,s,o,i){var l,u,c;(e!==((l=n[0])==null?void 0:l.url)||s!==((u=n[0])==null?void 0:u.target)||o!==((c=n[0])==null?void 0:c.buttonStyle))&&r.setNodes(t,{url:e,target:s,buttonStyle:o},{at:n[1]}),Oe(t,{url:e,text:i,target:s})}const Oe=(e,{text:t})=>{const n=r.getAboveNode(e,{match:{type:r.getPluginType(e,C)}});if(n){const[s,o]=n;if(t!=null&&t.length&&t!==r.getEditorString(e,o)){const i=s.children[0];r.replaceNodeChildren(e,{at:o,nodes:{...i,text:t},insertOptions:{select:!0}})}}},Bt=(e,{url:t,buttonStyle:n,target:s,...o})=>{r.wrapNodes(e,{type:r.getPluginType(e,C),url:t,buttonStyle:n,target:s,children:[]},{split:!0,...o})},ir=(e,t)=>{const n=r.getAboveNode(e,{match:{type:C}});return Array.isArray(n)?t(n[0]):""},jt=e=>ir(e,t=>t.url??""),Nt=(e,{url:t,text:n="",buttonStyle:s="primary",target:o,children:i})=>({type:r.getPluginType(e,C),url:t,target:o,buttonStyle:s,children:i??[{text:n}]}),Lt=(e,{focused:t}={})=>{if(N.mode()==="edit"){pe(e);return}Ue(e,{focused:t})},pe=e=>{const t=r.findNode(e,{match:{type:r.getPluginType(e,C)}});if(!t)return;const[n,s]=t;let o=r.getEditorString(e,s);P.url(n.url),P.newTab(n.target===void 0),o===n.url&&(o=""),P.text(o),P.isEditing(!0)},Ue=(e,{focused:t}={})=>{N.mode()||!t||r.isRangeAcrossBlocks(e,{at:e.selection})||r.someNode(e,{match:{type:r.getPluginType(e,C)}})||(P.text(r.getEditorString(e,e.selection)),P.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)"}}},lr=e=>{var l,u;const{attributes:t,children:n}=e,s=e.element.url||((u=(l=e.element.chosenLink)==null?void 0:l.searchResult)==null?void 0:u.link)||"",o=e.element.target||"_self",i=String(e.element.buttonStyle)||"primary";return a.jsx(cr,{attributes:t,href:s,target:o,styles:we[`button${i.charAt(0).toUpperCase()+i.slice(1)}`],children:n})},cr=({attributes:e,styles:t={hover:{}},children:n,href:s="#",target:o})=>{const[i,l]=h.useState(!1);return a.jsx("a",{...e,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),href:s,target:o,style:i?{...t,...t.hover}:t,children:n})};class ur extends r.MarkupElement{constructor(t=C,n=lr){super(t,n)}}const At=h.forwardRef((e,t)=>{const n=r.useEditorRef();return a.jsx(r.ToolbarButton,{ref:t,...e,onMouseDown:()=>{r.focusEditor(n,n.selection??n.prevSelection??void 0)},onClick:()=>{Lt(n,{focused:!0})},children:a.jsx(r.IconStylingWrapper,{icon:a.jsx(r.IconButton16,{})})})});At.displayName="ButtonToolbarButton";const dr=({editorId:e,id:t})=>{const n=r.useEditorState(r.useEventPlateId(e)),s=!!r.isRangeInSameBlock(n,{at:n.selection}),o=r.getPluginType(n,C),i=!!(n!=null&&n.selection)&&r.someNode(n,{match:{type:o}});return a.jsx("div",{"data-plugin-id":t,children:a.jsx(At,{pressed:i,disabled:!s,tooltip:r.getTooltip(s?`Button
2
+ ${r.getHotkeyByPlatform("Ctrl+Shift+K")}`:"Buttons can only be set for a single text block.")})})},gr=()=>{const e=r.useEditorRef();return a.jsx(r.FloatingModalWrapper,{padding:"16px",minWidth:"400px","data-test-id":"floating-button-edit",children:a.jsxs("span",{"data-test-id":"preview-button-flyout",className:"tw-flex tw-justify-between tw-items-center",children:[a.jsx("span",{className:"tw-pointer-events-none",children:N.url()}),a.jsxs("span",{className:"tw-flex tw-gap-2",children:[a.jsx("button",{onClick:()=>{pe(e)},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:a.jsx(r.IconPen16,{})}),a.jsx("button",{onClick:()=>{te(e),r.focusEditor(e,e.selection??void 0)},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:a.jsx(r.IconTrashBin16,{})})]})]})})},mr=({section:e,selectedUrl:t,onSelectUrl:n})=>{const s=e.permanentLink===t;return a.jsx("button",{"data-test-id":"internal-link-selector-section-link",className:r.merge(["tw-py-2 tw-pr-2.5 tw-pl-14 tw-leading-5 tw-cursor-pointer tw-w-full",s?"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:a.jsxs("div",{className:"tw-flex tw-flex-1 tw-space-x-2 tw-items-center tw-h-6",children:[a.jsx(r.IconDocumentText16,{}),a.jsx("span",{className:"tw-text-s",children:e.title}),a.jsx("span",{className:"tw-flex-auto tw-font-sans tw-text-xs tw-text-right",children:"Section"})]})})},hr=({page:e,selectedUrl:t,onSelectUrl:n,itemsToExpandInitially:s,getDocumentSectionsByDocumentPageId:o})=>{const[i,l]=h.useState(e.id===s.documentId),[u,c]=h.useState([]),f=e.permanentLink===t;h.useEffect(()=>{(async()=>{const p=await o(e.id);c(p)})()},[e.id,o]),h.useEffect(()=>{e.id===s.pageId&&l(!0)},[s,e.id]);const m=[...u.values()],d=m.length>0;return a.jsxs(a.Fragment,{children:[a.jsx("button",{"data-test-id":"internal-link-selector-page-link",className:r.merge(["tw-py-2 tw-pr-2.5 tw-leading-5 tw-cursor-pointer tw-flex tw-w-full",d?"tw-pl-7":"tw-pl-12",f?"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:a.jsxs("div",{className:"tw-flex tw-flex-1 tw-space-x-1 tw-items-center tw-h-6",children:[d&&a.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:()=>l(!i),children:a.jsx("div",{className:r.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",i?"tw-rotate-90":""])})}),a.jsx("span",{className:"tw-text-s",children:e.title}),a.jsx("span",{className:"tw-flex-auto tw-font-sans tw-text-xs tw-text-right",children:"Page"})]},e.id)}),i&&m.length>0&&m.map(x=>a.jsx(mr,{section:x,selectedUrl:t,onSelectUrl:n},x.id))]})},Mt=()=>a.jsx("div",{className:"tw-flex tw-justify-center tw-h-10 tw-items-center",children:a.jsx(r.LoadingCircle,{size:r.LoadingCircleSize.Small})}),fr=({documentId:e,selectedUrl:t,onSelectUrl:n,itemsToExpandInitially:s,getDocumentSectionsByDocumentPageId:o,getDocumentPagesByDocumentId:i})=>{const[l,u]=h.useState([]),[c,f]=h.useState(!0),m=[...l.values()],d=!c&&m.length>0;return h.useEffect(()=>{i(e).then(x=>{const p=x.filter(v=>!!v.category).sort((v,k)=>v.category.sort===k.category.sort?v.sort-k.sort:v.category.sort-k.category.sort),w=x.filter(v=>!v.category).sort((v,k)=>v.sort-k.sort);u([...p,...w])}).finally(()=>{f(!1)})},[]),c?a.jsx(Mt,{}):d?a.jsx(a.Fragment,{children:m.map(x=>a.jsx(hr,{page:x,selectedUrl:t,onSelectUrl:n,itemsToExpandInitially:s,getDocumentSectionsByDocumentPageId:o},x.id))}):a.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."})},xr=({document:e,selectedUrl:t,onSelectUrl:n,itemsToExpandInitially:s,getDocumentSectionsByDocumentPageId:o,getDocumentPagesByDocumentId:i})=>{const[l,u]=h.useState(e.id===s.documentId),c=e.permanentLink===t;return h.useEffect(()=>{e.id===s.documentId&&u(!0)},[s,e.id]),a.jsxs(a.Fragment,{children:[a.jsxs("button",{"data-test-id":"internal-link-selector-document-link",className:r.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",c?"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:[a.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:a.jsx("div",{className:r.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":""])})}),a.jsx(r.IconColorFan16,{}),a.jsx("span",{className:"tw-text-s",children:e.title}),a.jsx("span",{className:"tw-flex-auto tw-font-sans tw-text-xs tw-text-right",children:"Document"})]}),l&&a.jsx(fr,{documentId:e.id,selectedUrl:t,onSelectUrl:n,itemsToExpandInitially:s,getDocumentSectionsByDocumentPageId:o,getDocumentPagesByDocumentId:i})]})},pr=({selectedUrl:e,onSelectUrl:t,getAllDocuments:n,getDocumentPagesByDocumentId:s,getDocumentSectionsByDocumentPageId:o})=>{const[i,l]=h.useState(!0),[u,c]=h.useState([]),[f,m]=h.useState({documentId:void 0,pageId:void 0}),d=[...u.values()];h.useEffect(()=>{e&&d.length>0&&x().then(p=>{m(p)})},[d.length]),h.useEffect(()=>{n().then(p=>{c(p)}).finally(()=>{l(!1)})},[]);const x=async()=>{const p={documentId:void 0,pageId:void 0};if(d.find(v=>v.permanentLink===e))return p;for(const v of d){const E=[...(await s(v.id)).values()];if(!!E.find(M=>M.permanentLink===e))return p.documentId=v.id,p;for(const M of E)if(!![...(await o(M.id)).values()].find(L=>L.permanentLink===e))return p.documentId=v.id,p.pageId=M.id,p}return p};return i?a.jsx(Mt,{}):a.jsx(a.Fragment,{children:d.map(p=>a.jsx(xr,{document:p,selectedUrl:e,onSelectUrl:t,itemsToExpandInitially:f,getDocumentSectionsByDocumentPageId:o,getDocumentPagesByDocumentId:s},p.id))})},Rt=({url:e,onUrlChange:t,buttonSize:n=r.ButtonSize.Medium,getAllDocuments:s,getDocumentPagesByDocumentId:o,getDocumentSectionsByDocumentPageId:i})=>{const{open:l,isOpen:u,close:c}=Cn.useOverlayTriggerState({}),[f,m]=h.useState(e),d=w=>{m(w)},x=w=>{w.key==="Enter"&&p()};h.useEffect(()=>{e&&!f&&m(e)},[e,f]);const p=()=>{t==null||t(f),c()};return a.jsxs("div",{onPointerDown:w=>w.preventDefault(),"data-test-id":"internal-link-selector",onKeyDown:x,children:[a.jsx(r.Button,{icon:a.jsx(r.IconLink,{}),size:n,type:r.ButtonType.Button,style:r.ButtonStyle.Default,emphasis:r.ButtonEmphasis.Default,onClick:()=>l(),children:"Internal link"}),a.jsxs(r.Modal,{zIndex:1001,onClose:()=>c(),isOpen:u,isDismissable:!0,children:[a.jsx(r.Modal.Header,{title:"Select internal link"}),a.jsx(r.Modal.Body,{children:a.jsx(pr,{selectedUrl:f,onSelectUrl:d,getAllDocuments:s,getDocumentPagesByDocumentId:o,getDocumentSectionsByDocumentPageId:i})}),a.jsx(r.Modal.Footer,{buttons:[{children:"Cancel",onClick:()=>c(),style:r.ButtonStyle.Default,emphasis:r.ButtonEmphasis.Default},{children:"Choose",onClick:w=>{w==null||w.preventDefault(),p()},style:r.ButtonStyle.Default,emphasis:r.ButtonEmphasis.Strong,disabled:!f}]})]})]})},Ft=({onUrlChange:e,onToggleTab:t,isValidUrlOrEmpty:n,appBridge:s,clearable:o,placeholder:i,newTab:l,openInNewTab:u,url:c="",required:f,info:m,label:d,buttonSize:x,hideInternalLinkButton:p})=>{const w=n?n(c):ee(c),v=l??(u?r.CheckboxState.Checked:r.CheckboxState.Unchecked);return a.jsxs("div",{"data-test-id":"link-input",children:[a.jsx(r.FormControl,{label:{children:d,htmlFor:"url",required:f,tooltip:m?{content:m,position:r.TooltipPosition.Top}:void 0},children:a.jsx(r.TextInput,{id:"url",value:c,clearable:o,onChange:e,placeholder:i??"https://example.com",focusOnMount:!0})}),!w&&a.jsx("div",{className:"tw-text-text-negative tw-mt-1 tw-text-s",children:"Please enter a valid URL."}),!p&&a.jsx("div",{className:"tw-mt-3",children:a.jsx(Rt,{url:c,onUrlChange:e,buttonSize:x??r.ButtonSize.Medium,getAllDocuments:()=>s.getAllDocuments(),getDocumentPagesByDocumentId:k=>s.getDocumentPagesByDocumentId(k),getDocumentSectionsByDocumentPageId:k=>s.getDocumentSectionsByDocumentPageId(k)})}),a.jsx("div",{className:"tw-mt-3",children:a.jsx(r.Checkbox,{value:"new-tab",label:"Open in new tab",state:v,onChange:t})})]})},Dt=({state:e,onTextChange:t,onUrlChange:n,onToggleTab:s,onCancel:o,onSave:i,isValidUrlOrEmpty:l,hasValues:u,testId:c,appBridge:f,children:m})=>a.jsxs(r.FloatingModalWrapper,{"data-test-id":c,padding:"28px",minWidth:"400px",children:[a.jsx(r.FormControl,{label:{children:"Text",htmlFor:"linkText",required:!0},children:a.jsx(r.TextInput,{id:"linkText",value:e.text,placeholder:"Link Text",onChange:t})}),m,a.jsx("div",{className:"tw-mt-5",children:a.jsx(Ft,{url:e.url,newTab:e.newTab,onUrlChange:n,onToggleTab:s,isValidUrlOrEmpty:l,appBridge:f})}),a.jsx("div",{className:"tw-mt-3",children:a.jsxs("div",{className:"tw-pt-5 tw-flex tw-gap-x-3 tw-justify-end tw-border-t tw-border-t-black-10",children:[a.jsx(r.Button,{onClick:o,size:r.ButtonSize.Medium,style:r.ButtonStyle.Default,emphasis:r.ButtonEmphasis.Default,children:"Cancel"}),a.jsx(r.Button,{onClick:i,size:r.ButtonSize.Medium,icon:a.jsx(r.IconCheckMark20,{}),disabled:!l(e==null?void 0:e.url)||!u,children:"Save"})]})})]}),wr=e=>{var n;const t=r.getAboveNode(e,{match:{type:C}});return Array.isArray(t)&&((n=t[0])==null?void 0:n.buttonStyle)||"primary"},br={url:"",text:"",buttonStyle:"primary",newTab:r.CheckboxState.Unchecked},yr=()=>{const[e,t]=h.useReducer((n,s)=>{const{type:o,payload:i}=s;switch(o){case"NEW_TAB":return{...n,newTab:r.CheckboxState.Checked};case"SAME_TAB":return{...n,newTab:r.CheckboxState.Unchecked};case"URL":case"TEXT":case"BUTTON_STYLE":case"INIT":return{...n,...i};default:return n}},br);return[e,t]},vr=()=>{const e=r.useEditorRef(),[t,n]=yr();h.useEffect(()=>{const d=wr(e);n({type:"INIT",payload:{text:N.text(),buttonStyle:d,newTab:N.newTab()?r.CheckboxState.Checked:r.CheckboxState.Unchecked,url:N.url()}})},[n,e]);const s=d=>{n({type:"TEXT",payload:{text:d}})},o=d=>{n({type:"BUTTON_STYLE",payload:{buttonStyle:d}})},i=d=>{n({type:"URL",payload:{url:d}})},l=d=>{n(d?{type:"NEW_TAB"}:{type:"SAME_TAB"})},u=()=>{P.reset()},c=d=>{if(!ee(t.url)||!f)return;const x=fe(t.url);P.text(t.text),P.url(x),P.buttonStyle(t.buttonStyle),P.newTab(t.newTab===r.CheckboxState.Checked),De(e)&&(d==null||d.preventDefault())},f=t.url!==""&&t.text!=="",{appBridge:m}=r.getPluginOptions(e,C);return r.useHotkeys("enter",c,{enableOnFormTags:["INPUT"]},[]),{state:t,onTextChange:s,onButtonStyleChange:o,onUrlChange:i,onToggleTab:l,onCancel:u,onSave:c,hasValues:f,isValidUrlOrEmpty:ee,appBridge:m}},de="link-plugin";var b=(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))(b||{});const j={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)"},[de]:{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},Cr=()=>{const e=vr(),{state:t,onButtonStyleChange:n}=e;return a.jsx(Dt,{...e,testId:"floating-button-insert",children:a.jsx("div",{className:"tw-pt-5",children:a.jsxs(r.FormControl,{label:{children:"Button Style",htmlFor:"buttonStyle",required:!0},children:[a.jsx(ve,{id:"primary",styles:j.buttonPrimary,isActive:t.buttonStyle==="primary",onClick:()=>n("primary"),children:t.text||"Primary Button"}),a.jsx(ve,{id:"secondary",styles:j.buttonSecondary,isActive:t.buttonStyle==="secondary",onClick:()=>n("secondary"),children:t.text||"Secondary Button"}),a.jsx(ve,{id:"tertiary",styles:j.buttonTertiary,isActive:t.buttonStyle==="tertiary",onClick:()=>n("tertiary"),children:t.text||"Tertiary Button"})]})})})},ve=({id:e,styles:t,isActive:n,onClick:s,children:o})=>{const[i,l]=h.useState(!1),u=()=>t&&t.hover&&i?{...t,...t.hover}:t;return a.jsx("button",{"data-test-id":`floating-button-insert-${e}`,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),onClick:s,style:{...u(),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:o})},Ze={placement:"bottom-start",strategy:"absolute",middleware:[r.offset(12),r.flip({padding:12,fallbackPlacements:["bottom-end","top-start","top-end"]})]},Sr=()=>{const{ref:e,...t}=Pr(Ze),{ref:n,...s}=kr(Ze),o=r.useEditorRef(),i=ae(),l=i.isOpen(o.id),u=i.isEditing(),c=i.mode(),f=a.jsx(Cr,{}),m=u?f:a.jsx(gr,{});return a.jsxs(a.Fragment,{children:[l&&c==="insert"&&a.jsx("div",{ref:e,...t,children:f}),l&&c==="edit"&&a.jsx("div",{ref:n,...s,children:m})]})},C="button",Ot="button-plugin",Ut=e=>r.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:Pt,renderAfterEditable:Sr,options:{isUrl:xe,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:s=>({type:n,url:s.getAttribute("href"),target:s.getAttribute("target")||"_blank"})}})})();class _t extends r.Plugin{constructor({styles:n=we,...s}){super(Ot,{button:dr,markupElement:new ur,...s});B(this,"styles",{});B(this,"appBridge");this.styles=n,this.appBridge=s==null?void 0:s.appBridge}plugins(){return[Ut(this.appBridge)]}}const kr=e=>{const t=r.useEditorRef(),n=ae().mode(),s=ae().isOpen(t.id),o=r.useEditorVersion(),{triggerFloatingButtonHotkeys:i}=r.getPluginOptions(t,C),l=h.useCallback(()=>{const d=r.getAboveNode(t,{match:{type:r.getPluginType(t,C)}});if(d){const[,x]=d;return r.getRangeBoundingClientRect(t,{anchor:r.getStartPoint(t,x),focus:r.getEndPoint(t,x)})}return r.getDefaultBoundingClientRect()},[t]),u=s&&n==="edit",{update:c,style:f,floating:m}=Vt({open:u,getBoundingClientRect:l,...e});return h.useEffect(()=>{const d=jt(t);if(d&&P.url(d),t.selection&&r.someNode(t,{match:{type:r.getPluginType(t,C)}})){P.show("edit",t.id),c();return}N.mode()==="edit"&&P.reset()},[t,o,c]),r.useHotkeys(i,d=>{d.preventDefault(),N.mode()==="edit"&&pe(t)},{enableOnContentEditable:!0},[]),Tr(),Ht(),{style:{...f,zIndex:1e3},ref:r.useComposedRef(m)}},Tr=()=>{const e=r.useEditorRef();r.useHotkeys("*",t=>{t.key==="Enter"&&De(e)&&t.preventDefault()},{enableOnFormTags:["INPUT"]},[])},Ht=()=>{const e=r.useEditorRef();r.useHotkeys("escape",()=>{if(N.mode()==="edit"){if(N.isEditing()){P.show("edit",e.id),r.focusEditor(e,e.selection??void 0);return}P.reset()}},{enableOnFormTags:["INPUT"],enableOnContentEditable:!0},[])},Pr=e=>{const t=r.useEditorRef(),n=r.useFocused(),s=ae().mode(),o=ae().isOpen(t.id),{triggerFloatingButtonHotkeys:i}=r.getPluginOptions(t,C);r.useHotkeys(i,f=>{f.preventDefault(),Ue(t,{focused:n})},{enableOnContentEditable:!0},[n]);const{update:l,style:u,floating:c}=Vt({open:o&&s==="insert",getBoundingClientRect:r.getSelectionBoundingClientRect,whileElementsMounted:void 0,...e});return h.useEffect(()=>{o&&l(),P.updated(o)},[o,l]),Ht(),{style:{...u,zIndex:1e3},ref:r.useComposedRef(c)}},Ir=12,Er=-22,Br=96,Vt=e=>r.useVirtualFloating({placement:"bottom-start",middleware:[r.offset({mainAxis:Ir,alignmentAxis:Er}),r.flip({padding:Br})],...e}),jr=({id:e="rte",isEditing:t,value:n,columns:s,gap:o,placeholder:i,plugins:l,onTextChange:u,showSerializedText:c})=>{const[f,m]=h.useState(!1),d=h.useCallback(w=>{u&&w!==n&&u(w),m(!1)},[u,n]),x=h.useCallback(()=>m(!0),[]),p=h.useCallback(w=>{N.isOpen(w)&&P.reset()},[]);return h.useEffect(()=>{const w=v=>(v.preventDefault(),v.returnValue="Unprocessed changes");return f&&window.addEventListener("beforeunload",w),()=>window.removeEventListener("beforeunload",w)},[f]),t?a.jsx(r.RichTextEditor,{id:e,value:n,border:!1,placeholder:i,plugins:l,onValueChanged:x,onTextChange:d,hideExternalFloatingModals:p}):a.jsx(Xn,{value:n,columns:s,gap:o,show:c,plugins:l})},Nr=({editButtonProps:e,unlinkButtonProps:t})=>{const{element:n}=r.useLinkOpenButtonState(),s=n?Re(n):"";return a.jsx(r.FloatingModalWrapper,{"data-test-id":"floating-link-edit",padding:"16px",minWidth:"400px",children:a.jsxs("span",{"data-test-id":"preview-link-flyout",className:"tw-flex tw-justify-between tw-items-center",children:[a.jsx("span",{className:"tw-pointer-events-none",children:s}),a.jsxs("span",{className:"tw-flex tw-gap-2",children:[a.jsx("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",...e,children:a.jsx(r.IconPen16,{})}),a.jsx("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",...t,children:a.jsx(r.IconTrashBin16,{})})]})]})})},zt=(e,t)=>{const n=r.getAboveNode(e,{match:{type:r.ELEMENT_LINK}});return Array.isArray(n)?t(n[0]):""},Lr=e=>zt(e,t=>{var n,s;return((s=(n=t.chosenLink)==null?void 0:n.searchResult)==null?void 0:s.link)||""}),Ar=e=>zt(e,t=>t.url||""),Mr={url:"",text:"",newTab:r.CheckboxState.Unchecked},Rr=()=>{const[e,t]=h.useReducer((n,s)=>{const{type:o,payload:i}=s;switch(o){case"NEW_TAB":return{...n,newTab:r.CheckboxState.Checked};case"SAME_TAB":return{...n,newTab:r.CheckboxState.Unchecked};case"URL":case"TEXT":case"INIT":return{...n,...i};default:return n}},Mr);return[e,t]},Fr=()=>{const e=r.useEditorRef(),[t,n]=Rr();h.useEffect(()=>{const m=Lr(e),d=Ar(e),x=r.floatingLinkSelectors.newTab();n({type:"INIT",payload:{text:r.floatingLinkSelectors.text(),newTab:x?r.CheckboxState.Checked:r.CheckboxState.Unchecked,url:m&&d===""?m:r.floatingLinkSelectors.url()}})},[n,e]);const s=m=>{n({type:"TEXT",payload:{text:m}})},o=m=>{n({type:"URL",payload:{url:m}})},i=m=>{n(m?{type:"NEW_TAB"}:{type:"SAME_TAB"})},l=()=>{r.floatingLinkActions.reset()},u=m=>{!ee(t.url)||!c||(r.floatingLinkActions.text(t.text),r.floatingLinkActions.url(fe(t.url)),r.floatingLinkActions.newTab(t.newTab===r.CheckboxState.Checked),r.submitFloatingLink(e)&&(m==null||m.preventDefault()))},c=t.url!==""&&t.text!=="",{appBridge:f}=r.getPluginOptions(e,r.ELEMENT_LINK);return r.useHotkeys("enter",u,{enableOnFormTags:["INPUT"]},[]),{state:t,onTextChange:s,onUrlChange:o,onToggleTab:i,onCancel:l,onSave:u,hasValues:c,isValidUrlOrEmpty:ee,appBridge:f}},Dr=()=>a.jsx(Dt,{...Fr(),testId:"floating-link-insert"}),et={placement:"bottom-start",strategy:"absolute",middleware:[r.offset(12),r.flip({padding:12,fallbackPlacements:["bottom-end","top-start","top-end"]})]},Or=()=>{const e=r.useFloatingLinkInsertState({floatingOptions:et}),{props:t,ref:n,hidden:s}=r.useFloatingLinkInsert(e),o=r.useFloatingLinkEditState({floatingOptions:et}),{props:i,ref:l,editButtonProps:u,unlinkButtonProps:c}=r.useFloatingLinkEdit(o);if(s)return null;const f=a.jsx(Dr,{}),m=o.isEditing?f:a.jsx(Nr,{editButtonProps:u,unlinkButtonProps:c});return a.jsxs(a.Fragment,{children:[e.isOpen&&!o.isOpen&&a.jsx("div",{ref:n,...t,style:{...t.style,zIndex:1e3},children:f}),o.isOpen&&a.jsx("div",{ref:l,...i,style:{...i.style,zIndex:1e3},children:m})]})},$t=h.forwardRef((e,t)=>{const n=r.useEditorRef(),s=r.useLinkToolbarButtonState(),{props:o}=r.useLinkToolbarButton(s);return a.jsx(r.ToolbarButton,{onMouseDown:()=>{r.focusEditor(n,n.selection??n.prevSelection??void 0)},ref:t,...o,...e,children:a.jsx(r.IconStylingWrapper,{icon:a.jsx(r.IconLink16,{})})})});$t.displayName="LinkToolbarButton";const Ur=({id:e,editorId:t})=>{const n=r.useEditorState(r.useEventPlateId(t)),s=!!r.isRangeInSameBlock(n,{at:n.selection});return a.jsx("div",{"data-plugin-id":e,children:a.jsx($t,{disabled:!s,tooltip:r.getTooltip(s?`Link
3
+ ${r.getHotkeyByPlatform("Ctrl+K")}`:"Links can only be set for a single text block.")})})},_r=e=>{var l,u;const{attributes:t,children:n}=e,{styles:s}=r.useRichTextEditorContext(),o=e.element.url||((u=(l=e.element.chosenLink)==null?void 0:l.searchResult)==null?void 0:u.link)||"",i=e.element.target||"_self";return a.jsx("a",{...t,href:o,target:i,style:s[de],children:n})};class Hr extends r.MarkupElement{constructor(t=r.ELEMENT_LINK,n=_r){super(t,n)}}const Wt=e=>r.createPluginFactory({...r.createLinkPlugin(),renderAfterEditable:Or,options:{isUrl:xe,rangeBeforeOptions:{matchString:" ",skipInvalid:!0,afterMatch:!0},triggerFloatingLinkHotkeys:"meta+k, ctrl+k",keepSelectedTextOnPaste:!0,appBridge:e}})();class qt extends r.Plugin{constructor({styles:n=j[de],...s}){super(de,{button:Ur,markupElement:new Hr,...s});B(this,"styles",{});B(this,"appBridge");this.styles=n,this.appBridge=s.appBridge}plugins(){return[Wt(this.appBridge)]}}const Vr="textstyle-custom1-plugin";class Gt extends r.Plugin{constructor({styles:n=j.custom1,...s}={}){super(b.custom1,{label:"Custom 1",markupElement:new zr,...s});B(this,"styles",{});this.styles=n}plugins(){return[$r(this.styles)]}}class zr extends r.MarkupElement{constructor(t=Vr,n=Kt){super(t,n)}}const Kt=({element:e,attributes:t,children:n,styles:s})=>{const o=e.align;return a.jsx("p",{...t,style:s,className:r.merge([o&&r.alignmentClassnames[o],r.getColumnBreakClasses(e)]),children:n})},$r=e=>r.createPluginFactory({key:b.custom1,isElement:!0,deserializeHtml:{rules:[{validClassName:b.custom1}]}})({component:t=>a.jsx(Kt,{...t,styles:e})}),Wr="textstyle-custom2-plugin";class Xt extends r.Plugin{constructor({styles:n=j.custom2,...s}={}){super(b.custom2,{label:"Custom 2",markupElement:new qr,...s});B(this,"styles",{});this.styles=n}plugins(){return[Gr(this.styles)]}}class qr extends r.MarkupElement{constructor(t=Wr,n=Qt){super(t,n)}}const Qt=({element:e,attributes:t,children:n,styles:s})=>{const o=e.align;return a.jsx("p",{...t,className:r.merge([o&&r.alignmentClassnames[o],r.getColumnBreakClasses(e)]),style:s,children:n})},Gr=e=>r.createPluginFactory({key:b.custom2,isElement:!0,deserializeHtml:{rules:[{validClassName:b.custom2}]}})({component:t=>a.jsx(Qt,{...t,styles:e})}),Kr="textstyle-custom3-plugin";class Yt extends r.Plugin{constructor({styles:n=j.custom3,...s}={}){super(r.TextStyles.custom3,{label:"Custom 3",markupElement:new Xr,...s});B(this,"styles",{});this.styles=n}plugins(){return[Qr(this.styles)]}}class Xr extends r.MarkupElement{constructor(t=Kr,n=Jt){super(t,n)}}const Jt=({element:e,attributes:t,children:n,styles:s})=>{const o=e.align;return a.jsx("p",{...t,className:r.merge([o&&r.alignmentClassnames[o],r.getColumnBreakClasses(e)]),style:s,children:n})},Qr=e=>r.createPluginFactory({key:r.TextStyles.custom3,isElement:!0,deserializeHtml:{rules:[{validClassName:r.TextStyles.custom3}]}})({component:t=>a.jsx(Jt,{...t,styles:e})}),Yr="textstyle-heading1-plugin";class Zt extends r.Plugin{constructor({styles:n=j.heading1,...s}={}){super(b.heading1,{label:"Heading 1",markupElement:new Jr,...s});B(this,"styles",{});this.styles=n}plugins(){return[Zr(this.styles)]}}class Jr extends r.MarkupElement{constructor(t=Yr,n=Ce){super(t,n)}}const Ce=({element:e,attributes:t,children:n,styles:s})=>{const o=e.align;return a.jsx("h1",{...t,className:r.merge([o&&r.alignmentClassnames[o],r.getColumnBreakClasses(e)]),style:s,children:n})},Zr=e=>r.createPluginFactory({key:b.heading1,isElement:!0,component:Ce,deserializeHtml:{rules:[{validNodeName:["h1","H1"]}]}})({component:t=>a.jsx(Ce,{...t,styles:e})}),es="textstyle-heading2-plugin";class en extends r.Plugin{constructor({styles:n=j.heading2,...s}={}){super(b.heading2,{label:"Heading 2",markupElement:new ts,...s});B(this,"styles",{});this.styles=n}plugins(){return[ns(this.styles)]}}class ts extends r.MarkupElement{constructor(t=es,n=Se){super(t,n)}}const Se=({element:e,attributes:t,children:n,styles:s})=>{const o=e.align;return a.jsx("h2",{...t,className:r.merge([o&&r.alignmentClassnames[o],r.getColumnBreakClasses(e)]),style:s,children:n})},ns=e=>r.createPluginFactory({key:b.heading2,isElement:!0,component:Se,deserializeHtml:{rules:[{validNodeName:["h2","H2"]}]}})({component:t=>a.jsx(Se,{...t,styles:e})}),rs="textstyle-heading3-plugin";class tn extends r.Plugin{constructor({styles:n=j.heading3,...s}={}){super(b.heading3,{label:"Heading 3",markupElement:new ss,...s});B(this,"styles",{});this.styles=n}plugins(){return[as(this.styles)]}}class ss extends r.MarkupElement{constructor(t=rs,n=ke){super(t,n)}}const ke=({element:e,attributes:t,children:n,styles:s})=>{const o=e.align;return a.jsx("h3",{...t,className:r.merge([o&&r.alignmentClassnames[o],r.getColumnBreakClasses(e)]),style:s,children:n})},as=e=>r.createPluginFactory({key:b.heading3,isElement:!0,component:ke,deserializeHtml:{rules:[{validNodeName:["h3","H3"]}]}})({component:t=>a.jsx(ke,{...t,styles:e})}),os="textstyle-heading4-plugin";class nn extends r.Plugin{constructor({styles:n=j.heading4,...s}={}){super(b.heading4,{label:"Heading 4",markupElement:new is,...s});B(this,"styles",{});this.styles=n}plugins(){return[ls(this.styles)]}}class is extends r.MarkupElement{constructor(t=os,n=Te){super(t,n)}}const Te=({element:e,attributes:t,children:n,styles:s})=>{const o=e.align;return a.jsx("h4",{...t,className:r.merge([o&&r.alignmentClassnames[o],r.getColumnBreakClasses(e)]),style:s,children:n})},ls=e=>r.createPluginFactory({key:b.heading4,isElement:!0,component:Te,deserializeHtml:{rules:[{validNodeName:["h4","H4"]}]}})({component:t=>a.jsx(Te,{...t,styles:e})}),cs="textstyle-imageCaption-plugin";class rn extends r.Plugin{constructor({styles:n=j.imageCaption,...s}={}){super(b.imageCaption,{label:"Image Caption",markupElement:new us,...s});B(this,"styles",{});this.styles=n}plugins(){return[ds(this.styles)]}}class us extends r.MarkupElement{constructor(t=cs,n=Pe){super(t,n)}}const Pe=({element:e,attributes:t,children:n,styles:s})=>{const o=e.align;return a.jsx("p",{...t,className:r.merge([o&&r.alignmentClassnames[o],r.getColumnBreakClasses(e)]),style:s,children:n})},ds=e=>r.createPluginFactory({key:b.imageCaption,isElement:!0,component:Pe,deserializeHtml:{rules:[{validClassName:b.imageCaption}]}})({component:t=>a.jsx(Pe,{...t,styles:e})}),gs="textstyle-imageTitle-plugin";class sn extends r.Plugin{constructor({styles:n=j.imageTitle,...s}={}){super(b.imageTitle,{label:"Image Title",markupElement:new ms,...s});B(this,"styles",{});this.styles=n}plugins(){return[hs(this.styles)]}}class ms extends r.MarkupElement{constructor(t=gs,n=Ie){super(t,n)}}const Ie=({element:e,attributes:t,children:n,styles:s})=>{const o=e.align;return a.jsx("p",{...t,className:r.merge([o&&r.alignmentClassnames[o],r.getColumnBreakClasses(e)]),style:s,children:n})},hs=e=>r.createPluginFactory({key:b.imageTitle,isElement:!0,component:Ie,deserializeHtml:{rules:[{validClassName:b.imageTitle}]}})({component:t=>a.jsx(Ie,{...t,styles:e})});class an extends r.Plugin{constructor({styles:n=j.p,...s}={}){super(b.p,{markupElement:new ln,label:"Body Text",...s});B(this,"styles",{});this.styles=n}plugins(){return[cn(this.styles)]}}const on="tw-m-0 tw-px-0 tw-py-0",ge=({element:e,attributes:t,children:n,styles:s})=>{const o=e.align,i=r.merge([o&&r.alignmentClassnames[o],on,r.getColumnBreakClasses(e)]);return a.jsx("p",{...t,className:i,style:s,children:n})};class ln extends r.MarkupElement{constructor(t=b.p,n=ge){super(t,n)}}const cn=e=>r.createPluginFactory({...r.createParagraphPlugin(),key:b.p,isElement:!0,component:ge})({component:t=>a.jsx(ge,{...t,styles:e})}),fs="textstyle-quote-plugin";class un extends r.Plugin{constructor({styles:n=j.quote,...s}={}){super(b.quote,{label:"Quote",markupElement:new xs,...s});B(this,"styles",{});this.styles=n}plugins(){return[dn(this.styles)]}}class xs extends r.MarkupElement{constructor(t=fs,n=me){super(t,n)}}const me=({element:e,attributes:t,children:n,styles:s})=>{const o=e.align;return a.jsx("blockquote",{...t,className:r.merge([o&&r.alignmentClassnames[o],r.getColumnBreakClasses(e)]),style:s,children:n})},dn=e=>r.createPluginFactory({key:b.quote,isElement:!0,component:me,deserializeHtml:{rules:[{validNodeName:["blockquote","BLOCKQUOTE"]}]}})({component:t=>a.jsx(me,{...t,styles:e})}),_e=[new Zt,new en,new tn,new nn,new Gt,new Xt,new Yt,new un,new an],Z=[b.heading1,b.heading2,b.heading3,b.heading4,b.custom1,b.custom2,b.custom3,b.quote,b.p],ps=[..._e,new rn,new sn],ws=[...Z,b.imageCaption,b.imageTitle],bs=e=>new r.PluginComposer().setPlugin(new r.SoftBreakPlugin,new r.TextStylePlugin({textStyles:_e})).setPlugin([new r.BoldPlugin,new r.ItalicPlugin,new r.UnderlinePlugin,new r.StrikethroughPlugin,new qt({appBridge:e}),new _t({appBridge:e}),new r.CodePlugin],[new r.AlignLeftPlugin({validTypes:Z}),new r.AlignCenterPlugin({validTypes:Z}),new r.AlignRightPlugin({validTypes:Z}),new r.AlignJustifyPlugin({validTypes:Z}),new r.UnorderedListPlugin,new r.CheckboxListPlugin,new r.OrderedListPlugin,new r.ResetFormattingPlugin,new r.AutoformatPlugin]),ys="--f-theme-settings-",vs=e=>{const t=e!=null&&e.id?`hasBackground${e.id}`:"hasBackground",n=e!=null&&e.id?`backgroundColor${e.id}`:"backgroundColor",s=e!=null&&e.preventDefaultColor?void 0:(e==null?void 0:e.defaultColor)||An,o=e!=null&&e.label?e.label:"Background",i=e!=null&&e.switchLabel?e.switchLabel:void 0;return{id:t,label:o,type:"switch",switchLabel:i,defaultValue:!!(e!=null&&e.defaultValue),on:[{id:n,defaultValue:s,type:"colorInput"}]}},Cs=e=>{const t=e!=null&&e.id?`hasBorder_${e.id}`:"hasBorder",n=e!=null&&e.id?`borderSelection_${e.id}`:"borderSelection",s=e!=null&&e.id?`borderStyle_${e.id}`:"borderStyle",o=e!=null&&e.id?`borderWidth_${e.id}`:"borderWidth",i=e!=null&&e.id?`borderColor_${e.id}`:"borderColor",l=(e==null?void 0:e.defaultColor)||st,u=e!=null&&e.switchLabel?e.switchLabel:void 0;return{id:t,label:"Border",type:"switch",switchLabel:u,defaultValue:!!(e!=null&&e.defaultValue),on:[{id:n,type:"multiInput",onChange:c=>g.appendUnit(c,o),layout:g.MultiInputLayout.Columns,lastItemFullWidth:!0,blocks:[{id:s,type:"dropdown",defaultValue:D.Solid,choices:[{value:D.Solid,label:D.Solid},{value:D.Dotted,label:D.Dotted},{value:D.Dashed,label:D.Dashed}]},{id:o,type:"input",defaultValue:Mn,rules:[g.numericalOrPixelRule,g.maximumNumericalOrPixelOrAutoRule(500)],placeholder:"e.g. 3px"},{id:i,type:"colorInput",defaultValue:l}]}],off:[]}},He=(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"}]}),Ss=e=>{const t=e!=null&&e.id?`hasRadius_${e.id}`:"hasRadius",n=e!=null&&e.id?`radiusValue_${e.id}`:"radiusValue",s=e!=null&&e.id?`radiusChoice_${e.id}`:"radiusChoice",o=(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:i=>{var l;return e!=null&&e.dependentSettingId?!!((l=i.getBlock(e.dependentSettingId))!=null&&l.value):!0},onChange:i=>g.presetCustomValue(i,s,n,(e==null?void 0:e.radiusStyleMap)||q),on:[{id:n,type:"input",placeholder:"e.g. 10px",rules:[g.numericalOrPixelRule],onChange:i=>g.appendUnit(i,n)}],off:[He(s,o)]}},ks=e=>{const t=e!=null&&e.id?`hasExtendedCustomRadius_${e.id}`:"hasExtendedCustomRadius",n=e!=null&&e.id?`extendedRadiusValue_${e.id}`:"extendedRadiusValue",s=e!=null&&e.id?`extendedRadiusChoice_${e.id}`:"extendedRadiusChoice",o=e!=null&&e.id?`extendedRadiusTopLeft_${e.id}`:"extendedRadiusTopLeft",i=e!=null&&e.id?`extendedRadiusTopRight_${e.id}`:"extendedRadiusTopRight",l=e!=null&&e.id?`extendedRadiusBottomLeft_${e.id}`:"extendedRadiusBottomLeft",u=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 f;return e!=null&&e.dependentSettingId?!!((f=c.getBlock(e.dependentSettingId))!=null&&f.value):!0},onChange:c=>{g.presetCustomValue(c,s,o,q),g.presetCustomValue(c,s,i,q),g.presetCustomValue(c,s,l,q),g.presetCustomValue(c,s,u,q)},on:[{id:n,type:"multiInput",layout:g.MultiInputLayout.Columns,blocks:[{id:o,type:"input",label:"Top Left",rules:[g.numericalOrPixelRule],onChange:c=>g.appendUnit(c,o)},{id:i,type:"input",label:"Top Right",rules:[g.numericalOrPixelRule],onChange:c=>g.appendUnit(c,i)},{id:l,type:"input",label:"Bottom Left",rules:[g.numericalOrPixelRule],onChange:c=>g.appendUnit(c,l)},{id:u,type:"input",label:"Bottom Right",rules:[g.numericalOrPixelRule],onChange:c=>g.appendUnit(c,u)}]}],off:[He(s,e==null?void 0:e.defaultValue)]}},Ts=e=>{const t=e!=null&&e.id?e.id:"hasCustomSpacing",n=e!=null&&e.dependentSettingId?e.dependentSettingId:"columns",s=e!=null&&e.spacingChoiceId?e.spacingChoiceId:"spacingChoice",o=e!=null&&e.spacingCustomId?e.spacingCustomId:"spacingCustom",i=e!=null&&e.defaultValueChoices?e.defaultValueChoices:W.M;return{id:t,type:"switch",defaultValue:!1,switchLabel:"Custom",label:"Gutter",info:"An official nerds term for ‘gap’",onChange:l=>g.presetCustomValue(l,s,o,rt),show:l=>{var u;return((u=l.getBlock(n))==null?void 0:u.value)!=="1"},on:[{id:o,type:"input",rules:[g.numericalOrPixelRule],onChange:l=>g.appendUnit(l,o)}],off:[{id:s,type:"slider",defaultValue:i,choices:[{value:W.Auto,label:"Auto"},{value:W.S,label:"S"},{value:W.M,label:"M"},{value:W.L,label:"L"}]}]}},Ve=e=>({id:e,type:"segmentedControls",defaultValue:$.None,choices:[{value:$.None,label:"None"},{value:$.Small,label:"S"},{value:$.Medium,label:"M"},{value:$.Large,label:"L"}]}),Ps=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",s=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:o=>g.presetCustomValue(o,s,n,(e==null?void 0:e.marginStyleMap)||J),on:[{id:n,type:"input",placeholder:se,rules:[g.numericalOrPixelRule,g.maximumNumericalOrPixelOrAutoRule(500)],onChange:o=>g.appendUnit(o,n)}],off:[Ve(s)]}},Is=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",s=e!=null&&e.id?`extendedMarginChoice_${e==null?void 0:e.id}`:"extendedMarginChoice",o=e!=null&&e.id?`extendedMarginTop_${e==null?void 0:e.id}`:"extendedMarginTop",i=e!=null&&e.id?`extendedMarginLeft_${e==null?void 0:e.id}`:"extendedMarginLeft",l=e!=null&&e.id?`extendedMarginRight_${e==null?void 0:e.id}`:"extendedMarginRight",u=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=>{g.presetCustomValue(c,s,o,J),g.presetCustomValue(c,s,i,J),g.presetCustomValue(c,s,l,J),g.presetCustomValue(c,s,u,J)},on:[{id:n,type:"multiInput",layout:g.MultiInputLayout.Spider,blocks:[{id:o,type:"input",label:"Top",placeholder:se,onChange:c=>g.appendUnit(c,o),rules:[g.numericalOrPixelRule,g.maximumNumericalOrPixelOrAutoRule(500)]},{id:i,type:"input",label:"Left",placeholder:se,onChange:c=>g.appendUnit(c,i),rules:[g.numericalOrPixelRule,g.maximumNumericalOrPixelOrAutoRule(500)]},{id:l,type:"input",label:"Right",placeholder:se,onChange:c=>g.appendUnit(c,l),rules:[g.numericalOrPixelRule,g.maximumNumericalOrPixelOrAutoRule(500)]},{id:u,type:"input",label:"Bottom",placeholder:se,onChange:c=>g.appendUnit(c,u),rules:[g.numericalOrPixelRule,g.maximumNumericalOrPixelOrAutoRule(500)]}]}],off:[Ve(s)]}},ze=e=>({id:e,type:"segmentedControls",defaultValue:z.Small,choices:[{value:z.None,label:"None"},{value:z.Small,label:"S"},{value:z.Medium,label:"M"},{value:z.Large,label:"L"}]}),Es=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",s=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:o=>g.presetCustomValue(o,s,n,(e==null?void 0:e.paddingStyleMap)||Y),on:[{id:n,type:"input",placeholder:re,rules:[g.numericalOrPixelRule,g.maximumNumericalOrPixelOrAutoRule(500)],onChange:o=>g.appendUnit(o,n)}],off:[ze(s)]}},Bs=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",s=e!=null&&e.id?`extendedPaddingChoice_${e==null?void 0:e.id}`:"extendedPaddingChoice",o=e!=null&&e.id?`extendedPaddingTop_${e==null?void 0:e.id}`:"extendedPaddingTop",i=e!=null&&e.id?`extendedPaddingLeft_${e==null?void 0:e.id}`:"extendedPaddingLeft",l=e!=null&&e.id?`extendedPaddingRight_${e==null?void 0:e.id}`:"extendedPaddingRight",u=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=>{g.presetCustomValue(c,s,o,Y),g.presetCustomValue(c,s,i,Y),g.presetCustomValue(c,s,l,Y),g.presetCustomValue(c,s,u,Y)},on:[{id:n,type:"multiInput",layout:g.MultiInputLayout.Spider,blocks:[{id:o,type:"input",label:"Top",placeholder:re,onChange:c=>g.appendUnit(c,o),rules:[g.numericalOrPixelRule,g.maximumNumericalOrPixelOrAutoRule(500)]},{id:i,type:"input",label:"Left",placeholder:re,onChange:c=>g.appendUnit(c,i),rules:[g.numericalOrPixelRule,g.maximumNumericalOrPixelOrAutoRule(500)]},{id:l,type:"input",label:"Right",placeholder:re,onChange:c=>g.appendUnit(c,l),rules:[g.numericalOrPixelRule,g.maximumNumericalOrPixelOrAutoRule(500)]},{id:u,type:"input",label:"Bottom",placeholder:re,onChange:c=>g.appendUnit(c,u),rules:[g.numericalOrPixelRule,g.maximumNumericalOrPixelOrAutoRule(500)]}]}],off:[ze(s)]}},js=e=>{const t=$e(e==null?void 0:e.globalControlId);return{id:e!=null&&e.id?e.id:"downloadable",type:"switch",defaultValue:!1,label:"Downloadable",show:n=>{var s;return((s=n.getBlock(t))==null?void 0:s.value)===K.Custom}}},$e=e=>e||"security",Ns=e=>[{id:$e(e),type:"segmentedControls",defaultValue:K.Global,choices:[{value:K.Global,label:"Global Settings"},{value:K.Custom,label:"Custom"}]},{id:"globalSettingsInfo",type:"notification",footer:g.createFooter({label:"Change global settings [here].",replace:{here:{event:"general-settings.open"}}})}];var gn=(e=>(e.Main="main",e.Basics="basics",e.Layout="layout",e.Style="style",e.Security="security",e.Targets="targets",e))(gn||{});const Ls=e=>e,As=e=>e;exports.AllTextStylePlugins=ps;exports.AllTextStyles=ws;exports.Attachments=ft;exports.AttachmentsProvider=gt;exports.AttachmentsToolbarButton=pt;exports.BUTTON_PLUGIN=Ot;exports.BlockButtonStyles=we;exports.BlockInjectButton=Sn;exports.BlockItemWrapper=Gn;exports.BlockStyles=j;exports.BorderStyle=D;exports.ButtonPlugin=_t;exports.Custom1Plugin=Gt;exports.Custom2Plugin=Xt;exports.Custom3Plugin=Yt;exports.DEFAULT_ATTACHMENTS_BUTTON_ID=xt;exports.DEFAULT_DRAGGING_TOOLTIP=bt;exports.DEFAULT_DRAG_TOOLTIP=wt;exports.DEFAULT_MENU_BUTTON_ID=Le;exports.DownloadButton=Kn;exports.DragHandleToolbarButton=yt;exports.DragPreviewContextProvider=ot;exports.ELEMENT_BUTTON=C;exports.FlyoutToolbarButton=Ne;exports.GutterSpacing=W;exports.Heading1Plugin=Zt;exports.Heading2Plugin=en;exports.Heading3Plugin=tn;exports.Heading4Plugin=nn;exports.ImageCaptionPlugin=rn;exports.ImageTitlePlugin=sn;exports.LinkInput=Ft;exports.LinkPlugin=qt;exports.LinkSelector=Rt;exports.Margin=$;exports.MenuToolbarButton=Ct;exports.MultiFlyoutContextProvider=lt;exports.PARAGRAPH_CLASSES=on;exports.Padding=z;exports.ParagraphMarkupElement=ln;exports.ParagraphMarkupElementNode=ge;exports.ParagraphPlugin=an;exports.QuoteMarkupElementNode=me;exports.QuotePlugin=un;exports.Radius=H;exports.RichTextEditor=jr;exports.Sections=gn;exports.Security=K;exports.THEME_PREFIX=ys;exports.TextStylePluginsWithoutImage=_e;exports.TextStyles=b;exports.TextStylesWithoutImage=Z;exports.Toolbar=St;exports.ToolbarFlyoutMenu=vt;exports.addHttps=fe;exports.borderStyleMap=nt;exports.convertToRteValue=Qn;exports.createButtonNode=Nt;exports.createButtonPlugin=Ut;exports.createLinkPlugin=Wt;exports.createParagraphPlugin=cn;exports.createQuotePlugin=dn;exports.customCoordinatesGetterFactory=ht;exports.defineBlock=Ls;exports.defineSettings=As;exports.getBackgroundColorStyles=Ln;exports.getBackgroundSettings=vs;exports.getBorderRadiusSettings=Ss;exports.getBorderRadiusSlider=He;exports.getBorderSettings=Cs;exports.getBorderStyles=Rn;exports.getDefaultPluginsWithLinkChooser=bs;exports.getExtendedBorderRadiusSettings=ks;exports.getGutterSettings=Ts;exports.getLegacyUrl=tr;exports.getLinkFromEditor=rr;exports.getMarginExtendedSettings=Is;exports.getMarginSettings=Ps;exports.getMarginSlider=Ve;exports.getPaddingExtendedSettings=Bs;exports.getPaddingSettings=Es;exports.getPaddingSlider=ze;exports.getRadiusStyles=Fn;exports.getReadableColor=jn;exports.getSecurityDownloadableSetting=js;exports.getSecurityGlobalControlId=$e;exports.getSecurityGlobalControlSetting=Ns;exports.getUrl=nr;exports.getUrlFromEditor=jt;exports.getUrlFromLinkOrLegacyLink=Re;exports.gutterSpacingStyleMap=rt;exports.hasRichTextValue=kt;exports.insertButton=It;exports.isDark=Tn;exports.isDownloadable=Yn;exports.isValidUrl=xe;exports.isValidUrlOrEmpty=ee;exports.joinClassNames=O;exports.mapAppBridgeColorPaletteToFonduePalette=Tt;exports.mapAppBridgeColorPalettesToFonduePalettes=Jn;exports.marginStyleMap=J;exports.moveItemInArray=Nn;exports.paddingStyleMap=Y;exports.radiusStyleMap=q;exports.relativeUrlRegex=Fe;exports.setAlpha=En;exports.submitFloatingButton=De;exports.toColorObject=Bn;exports.toHex8String=Pn;exports.toHexString=In;exports.toRgbaString=Ee;exports.toShortRgba=X;exports.triggerFloatingButton=Lt;exports.triggerFloatingButtonEdit=pe;exports.triggerFloatingButtonInsert=Ue;exports.unwrapButton=te;exports.upsertButton=Et;exports.upsertButtonText=Oe;exports.useAttachments=ut;exports.useAttachmentsContext=mt;exports.useDndSensors=_n;exports.useDragPreviewContext=oe;exports.useMultiFlyoutContext=ct;exports.useMultiFlyoutState=he;exports.withAttachmentsProvider=Dn;exports.withButton=Pt;exports.wrapButton=Bt;Object.keys(g).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>g[e]})});
4
4
  //# sourceMappingURL=index.cjs.js.map