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