@frontify/guideline-blocks-settings 0.37.6 → 0.37.7
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/RichTextEditor/RichTextEditor.es.js +39 -40
- package/dist/components/RichTextEditor/RichTextEditor.es.js.map +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -871,6 +871,9 @@ export declare type RichTextButtonStyle = 'primary' | 'secondary' | 'tertiary';
|
|
|
871
871
|
export declare const RichTextEditor: (props: RichTextEditorProps) => JSX_2.Element;
|
|
872
872
|
|
|
873
873
|
declare type RichTextEditorProps = {
|
|
874
|
+
/**
|
|
875
|
+
* @deprecated not needed anymore, handled automatically
|
|
876
|
+
*/
|
|
874
877
|
id?: string;
|
|
875
878
|
isEditing: boolean;
|
|
876
879
|
value?: string;
|
package/dist/index.umd.js
CHANGED
|
@@ -83,6 +83,6 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
|
|
|
83
83
|
- \`null\` or \`undefined\` if the progress is indeterminate.
|
|
84
84
|
|
|
85
85
|
Defaulting to \`null\`.`}var Yg=Ac,Xg=Ec;const Qg=K1({base:"tw-relative tw-w-full tw-overflow-hidden",variants:{rounded:{true:"tw-rounded"},size:{small:"tw-h-1",medium:"tw-h-2",large:"tw-h-3","x-large":"tw-h-4"},variant:{default:"tw-bg-box-selected",positive:"tw-bg-box-positive",negative:"tw-bg-box-negative"}}}),Zg=K1({base:"tw-h-full tw-w-full",variants:{variant:{default:"tw-bg-text-interactive",positive:"tw-bg-text-positive",negative:"tw-bg-text-negative"},indeterminateState:{true:"tw-animate-loading-bar-infinite tw-origin-left-right",false:"tw-transition-all tw-origin-left tw-scale-x-[--loading-bar-proportion]"}}}),Jg=y.forwardRef(({value:e,max:t=100,rounded:r=!0,variant:n="default",size:a="medium","data-test-id":o="fondue-loading-bar",...l},i)=>c.jsx(Yg,{ref:i,"data-test-id":o,className:Qg({rounded:r,size:a,variant:n}),"aria-busy":e!==t,value:e,max:t,style:{"--loading-bar-value":e,"--loading-bar-max":t,"--loading-bar-proportion":"calc(var(--loading-bar-value) / var(--loading-bar-max))"},...l,children:c.jsx(Xg,{className:Zg({variant:n,indeterminateState:e===null})})}));Jg.displayName="LoadingBar";const e9="_root_t4a4t_8",t9={root:e9},Tc=y.forwardRef(({variant:e="progress",size:t="medium","data-test-id":r="fondue-loading-circle-content"},n)=>c.jsx("div",{ref:n,"data-test-id":r,"data-variant":e,"data-size":t,className:t9.root}));Tc.displayName="LoadingCircle";function Xo(e,[t,r]){return Math.min(r,Math.max(t,e))}function r9(e,t){return p.useReducer((r,n)=>t[r][n]??r,e)}var Qo="ScrollArea",[Nc,Oy]=D0(Qo),[n9,q0]=Nc(Qo),zc=p.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:n="hover",dir:a,scrollHideDelay:o=600,...l}=e,[i,s]=p.useState(null),[d,u]=p.useState(null),[f,h]=p.useState(null),[v,x]=p.useState(null),[m,g]=p.useState(null),[_,C]=p.useState(0),[A,M]=p.useState(0),[S,P]=p.useState(!1),[N,D]=p.useState(!1),U=d0(t,K=>s(K)),R=ne(a);return c.jsx(n9,{scope:r,type:n,dir:R,scrollHideDelay:o,scrollArea:i,viewport:d,onViewportChange:u,content:f,onContentChange:h,scrollbarX:v,onScrollbarXChange:x,scrollbarXEnabled:S,onScrollbarXEnabledChange:P,scrollbarY:m,onScrollbarYChange:g,scrollbarYEnabled:N,onScrollbarYEnabledChange:D,onCornerWidthChange:C,onCornerHeightChange:M,children:c.jsx(o0.div,{dir:R,...l,ref:U,style:{position:"relative","--radix-scroll-area-corner-width":_+"px","--radix-scroll-area-corner-height":A+"px",...e.style}})})});zc.displayName=Qo;var Oc="ScrollAreaViewport",Dc=p.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,nonce:a,...o}=e,l=q0(Oc,r),i=p.useRef(null),s=d0(t,i,l.onViewportChange);return c.jsxs(c.Fragment,{children:[c.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:a}),c.jsx(o0.div,{"data-radix-scroll-area-viewport":"",...o,ref:s,style:{overflowX:l.scrollbarXEnabled?"scroll":"hidden",overflowY:l.scrollbarYEnabled?"scroll":"hidden",...e.style},children:c.jsx("div",{ref:l.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});Dc.displayName=Oc;var s1="ScrollAreaScrollbar",Hc=p.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=q0(s1,e.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:l}=a,i=e.orientation==="horizontal";return p.useEffect(()=>(i?o(!0):l(!0),()=>{i?o(!1):l(!1)}),[i,o,l]),a.type==="hover"?c.jsx(o9,{...n,ref:t,forceMount:r}):a.type==="scroll"?c.jsx(a9,{...n,ref:t,forceMount:r}):a.type==="auto"?c.jsx(Vc,{...n,ref:t,forceMount:r}):a.type==="always"?c.jsx(Zo,{...n,ref:t}):null});Hc.displayName=s1;var o9=p.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=q0(s1,e.__scopeScrollArea),[o,l]=p.useState(!1);return p.useEffect(()=>{const i=a.scrollArea;let s=0;if(i){const d=()=>{window.clearTimeout(s),l(!0)},u=()=>{s=window.setTimeout(()=>l(!1),a.scrollHideDelay)};return i.addEventListener("pointerenter",d),i.addEventListener("pointerleave",u),()=>{window.clearTimeout(s),i.removeEventListener("pointerenter",d),i.removeEventListener("pointerleave",u)}}},[a.scrollArea,a.scrollHideDelay]),c.jsx(I0,{present:r||o,children:c.jsx(Vc,{"data-state":o?"visible":"hidden",...n,ref:t})})}),a9=p.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=q0(s1,e.__scopeScrollArea),o=e.orientation==="horizontal",l=br(()=>s("SCROLL_END"),100),[i,s]=r9("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return p.useEffect(()=>{if(i==="idle"){const d=window.setTimeout(()=>s("HIDE"),a.scrollHideDelay);return()=>window.clearTimeout(d)}},[i,a.scrollHideDelay,s]),p.useEffect(()=>{const d=a.viewport,u=o?"scrollLeft":"scrollTop";if(d){let f=d[u];const h=()=>{const v=d[u];f!==v&&(s("SCROLL"),l()),f=v};return d.addEventListener("scroll",h),()=>d.removeEventListener("scroll",h)}},[a.viewport,o,s,l]),c.jsx(I0,{present:r||i!=="hidden",children:c.jsx(Zo,{"data-state":i==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:t0(e.onPointerEnter,()=>s("POINTER_ENTER")),onPointerLeave:t0(e.onPointerLeave,()=>s("POINTER_LEAVE"))})})}),Vc=p.forwardRef((e,t)=>{const r=q0(s1,e.__scopeScrollArea),{forceMount:n,...a}=e,[o,l]=p.useState(!1),i=e.orientation==="horizontal",s=br(()=>{if(r.viewport){const d=r.viewport.offsetWidth<r.viewport.scrollWidth,u=r.viewport.offsetHeight<r.viewport.scrollHeight;l(i?d:u)}},10);return Ae(r.viewport,s),Ae(r.content,s),c.jsx(I0,{present:n||o,children:c.jsx(Zo,{"data-state":o?"visible":"hidden",...a,ref:t})})}),Zo=p.forwardRef((e,t)=>{const{orientation:r="vertical",...n}=e,a=q0(s1,e.__scopeScrollArea),o=p.useRef(null),l=p.useRef(0),[i,s]=p.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),d=Rc(i.viewport,i.content),u={...n,sizes:i,onSizesChange:s,hasThumb:d>0&&d<1,onThumbChange:h=>o.current=h,onThumbPointerUp:()=>l.current=0,onThumbPointerDown:h=>l.current=h};function f(h,v){return u9(h,l.current,i,v)}return r==="horizontal"?c.jsx(l9,{...u,ref:t,onThumbPositionChange:()=>{if(a.viewport&&o.current){const h=a.viewport.scrollLeft,v=Uc(h,i,a.dir);o.current.style.transform=`translate3d(${v}px, 0, 0)`}},onWheelScroll:h=>{a.viewport&&(a.viewport.scrollLeft=h)},onDragScroll:h=>{a.viewport&&(a.viewport.scrollLeft=f(h,a.dir))}}):r==="vertical"?c.jsx(i9,{...u,ref:t,onThumbPositionChange:()=>{if(a.viewport&&o.current){const h=a.viewport.scrollTop,v=Uc(h,i);o.current.style.transform=`translate3d(0, ${v}px, 0)`}},onWheelScroll:h=>{a.viewport&&(a.viewport.scrollTop=h)},onDragScroll:h=>{a.viewport&&(a.viewport.scrollTop=f(h))}}):null}),l9=p.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...a}=e,o=q0(s1,e.__scopeScrollArea),[l,i]=p.useState(),s=p.useRef(null),d=d0(t,s,o.onScrollbarXChange);return p.useEffect(()=>{s.current&&i(getComputedStyle(s.current))},[s]),c.jsx($c,{"data-orientation":"horizontal",...a,ref:d,sizes:r,style:{bottom:0,left:o.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:o.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":mr(r)+"px",...e.style},onThumbPointerDown:u=>e.onThumbPointerDown(u.x),onDragScroll:u=>e.onDragScroll(u.x),onWheelScroll:(u,f)=>{if(o.viewport){const h=o.viewport.scrollLeft+u.deltaX;e.onWheelScroll(h),Kc(h,f)&&u.preventDefault()}},onResize:()=>{s.current&&o.viewport&&l&&n({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:s.current.clientWidth,paddingStart:gr(l.paddingLeft),paddingEnd:gr(l.paddingRight)}})}})}),i9=p.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...a}=e,o=q0(s1,e.__scopeScrollArea),[l,i]=p.useState(),s=p.useRef(null),d=d0(t,s,o.onScrollbarYChange);return p.useEffect(()=>{s.current&&i(getComputedStyle(s.current))},[s]),c.jsx($c,{"data-orientation":"vertical",...a,ref:d,sizes:r,style:{top:0,right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":mr(r)+"px",...e.style},onThumbPointerDown:u=>e.onThumbPointerDown(u.y),onDragScroll:u=>e.onDragScroll(u.y),onWheelScroll:(u,f)=>{if(o.viewport){const h=o.viewport.scrollTop+u.deltaY;e.onWheelScroll(h),Kc(h,f)&&u.preventDefault()}},onResize:()=>{s.current&&o.viewport&&l&&n({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:s.current.clientHeight,paddingStart:gr(l.paddingTop),paddingEnd:gr(l.paddingBottom)}})}})}),[s9,Lc]=Nc(s1),$c=p.forwardRef((e,t)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:a,onThumbChange:o,onThumbPointerUp:l,onThumbPointerDown:i,onThumbPositionChange:s,onDragScroll:d,onWheelScroll:u,onResize:f,...h}=e,v=q0(s1,r),[x,m]=p.useState(null),g=d0(t,U=>m(U)),_=p.useRef(null),C=p.useRef(""),A=v.viewport,M=n.content-n.viewport,S=A0(u),P=A0(s),N=br(f,10);function D(U){if(_.current){const R=U.clientX-_.current.left,K=U.clientY-_.current.top;d({x:R,y:K})}}return p.useEffect(()=>{const U=R=>{const K=R.target;(x==null?void 0:x.contains(K))&&S(R,M)};return document.addEventListener("wheel",U,{passive:!1}),()=>document.removeEventListener("wheel",U,{passive:!1})},[A,x,M,S]),p.useEffect(P,[n,P]),Ae(x,N),Ae(v.content,N),c.jsx(s9,{scope:r,scrollbar:x,hasThumb:a,onThumbChange:A0(o),onThumbPointerUp:A0(l),onThumbPositionChange:P,onThumbPointerDown:A0(i),children:c.jsx(o0.div,{...h,ref:g,style:{position:"absolute",...h.style},onPointerDown:t0(e.onPointerDown,U=>{U.button===0&&(U.target.setPointerCapture(U.pointerId),_.current=x.getBoundingClientRect(),C.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",v.viewport&&(v.viewport.style.scrollBehavior="auto"),D(U))}),onPointerMove:t0(e.onPointerMove,D),onPointerUp:t0(e.onPointerUp,U=>{const R=U.target;R.hasPointerCapture(U.pointerId)&&R.releasePointerCapture(U.pointerId),document.body.style.webkitUserSelect=C.current,v.viewport&&(v.viewport.style.scrollBehavior=""),_.current=null})})})}),vr="ScrollAreaThumb",Bc=p.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=Lc(vr,e.__scopeScrollArea);return c.jsx(I0,{present:r||a.hasThumb,children:c.jsx(c9,{ref:t,...n})})}),c9=p.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...a}=e,o=q0(vr,r),l=Lc(vr,r),{onThumbPositionChange:i}=l,s=d0(t,f=>l.onThumbChange(f)),d=p.useRef(void 0),u=br(()=>{d.current&&(d.current(),d.current=void 0)},100);return p.useEffect(()=>{const f=o.viewport;if(f){const h=()=>{if(u(),!d.current){const v=f9(f,i);d.current=v,i()}};return i(),f.addEventListener("scroll",h),()=>f.removeEventListener("scroll",h)}},[o.viewport,u,i]),c.jsx(o0.div,{"data-state":l.hasThumb?"visible":"hidden",...a,ref:s,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:t0(e.onPointerDownCapture,f=>{const v=f.target.getBoundingClientRect(),x=f.clientX-v.left,m=f.clientY-v.top;l.onThumbPointerDown({x,y:m})}),onPointerUp:t0(e.onPointerUp,l.onThumbPointerUp)})});Bc.displayName=vr;var Jo="ScrollAreaCorner",Fc=p.forwardRef((e,t)=>{const r=q0(Jo,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?c.jsx(d9,{...e,ref:t}):null});Fc.displayName=Jo;var d9=p.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,a=q0(Jo,r),[o,l]=p.useState(0),[i,s]=p.useState(0),d=!!(o&&i);return Ae(a.scrollbarX,()=>{var f;const u=((f=a.scrollbarX)==null?void 0:f.offsetHeight)||0;a.onCornerHeightChange(u),s(u)}),Ae(a.scrollbarY,()=>{var f;const u=((f=a.scrollbarY)==null?void 0:f.offsetWidth)||0;a.onCornerWidthChange(u),l(u)}),d?c.jsx(o0.div,{...n,ref:t,style:{width:o,height:i,position:"absolute",right:a.dir==="ltr"?0:void 0,left:a.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function gr(e){return e?parseInt(e,10):0}function Rc(e,t){const r=e/t;return isNaN(r)?0:r}function mr(e){const t=Rc(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function u9(e,t,r,n="ltr"){const a=mr(r),o=a/2,l=t||o,i=a-l,s=r.scrollbar.paddingStart+l,d=r.scrollbar.size-r.scrollbar.paddingEnd-i,u=r.content-r.viewport,f=n==="ltr"?[0,u]:[u*-1,0];return Wc([s,d],f)(e)}function Uc(e,t,r="ltr"){const n=mr(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-a,l=t.content-t.viewport,i=o-n,s=r==="ltr"?[0,l]:[l*-1,0],d=Xo(e,s);return Wc([0,l],[0,i])(d)}function Wc(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}function Kc(e,t){return e>0&&e<t}var f9=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return function a(){const o={left:e.scrollLeft,top:e.scrollTop},l=r.left!==o.left,i=r.top!==o.top;(l||i)&&t(),r=o,n=window.requestAnimationFrame(a)}(),()=>window.cancelAnimationFrame(n)};function br(e,t){const r=A0(e),n=p.useRef(0);return p.useEffect(()=>()=>window.clearTimeout(n.current),[]),p.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function Ae(e,t){const r=A0(t);y1(()=>{let n=0;if(e){const a=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return a.observe(e),()=>{window.cancelAnimationFrame(n),a.unobserve(e)}}},[e,r])}var h9=zc,p9=Dc,jc=Hc,Gc=Bc,v9=Fc;const g9="_root_hkznm_4",m9="_viewport_hkznm_12",b9="_scrollbar_hkznm_43",w9="_thumb_hkznm_75",y9="_corner_hkznm_93",Q1={root:g9,viewport:m9,scrollbar:b9,thumb:w9,corner:y9},C9=({type:e="hover",maxHeight:t="100%",maxWidth:r="100%",showShadow:n=!1,scrollbarGutter:a="auto",padding:o,children:l,"data-test-id":i="fondue-scroll-area"},s)=>c.jsxs(h9,{type:e,className:Q1.root,style:{maxWidth:r},"data-test-id":i,ref:s,children:[c.jsx(p9,{className:Q1.viewport,style:{maxHeight:t},"data-scroll-padding":o,"data-show-shadow":n,"data-scrollbar-type":e,"data-scrollbar-gutter":a,"data-test-id":`${i}-viewport`,children:l}),c.jsx(jc,{className:Q1.scrollbar,orientation:"vertical","data-test-id":`${i}-vertical-scrollbar`,children:c.jsx(Gc,{className:Q1.thumb,"data-test-id":`${i}-vertical-scrollbar-thumb`})}),c.jsx(jc,{className:Q1.scrollbar,orientation:"horizontal","data-test-id":`${i}-horizontal-scrollbar`,children:c.jsx(Gc,{className:Q1.thumb,"data-test-id":`${i}-horizontal-scrollbar-thumb`})}),c.jsx(v9,{className:Q1.corner,"data-test-id":`${i}-corner`})]}),x9=y.forwardRef(C9);x9.displayName="ScrollArea";const _9="_root_yrjuz_5",M9={root:_9},A9=y.forwardRef(({"data-test-id":e="fondue-section",children:t,role:r,"aria-label":n,"aria-hidden":a,"aria-describedby":o,"aria-labelledby":l,"aria-expanded":i,"aria-haspopup":s,...d},u)=>c.jsx("section",{className:M9.root,"data-test-id":e,style:wt(d),role:r,"aria-label":n,"aria-hidden":a,"aria-describedby":o,"aria-labelledby":l,"aria-expanded":i,"aria-haspopup":s,ref:u,children:t}));A9.displayName="Section";var S9="Toggle",qc=p.forwardRef((e,t)=>{const{pressed:r,defaultPressed:n=!1,onPressedChange:a,...o}=e,[l=!1,i]=F0({prop:r,onChange:a,defaultProp:n});return c.jsx(o0.button,{type:"button","aria-pressed":l,"data-state":l?"on":"off","data-disabled":e.disabled?"":void 0,...o,ref:t,onClick:t0(e.onClick,()=>{e.disabled||i(!l)})})});qc.displayName=S9;var Se="ToggleGroup",[Yc,Dy]=D0(Se,[_e]),Xc=_e(),ea=y.forwardRef((e,t)=>{const{type:r,...n}=e;if(r==="single"){const a=n;return c.jsx(E9,{...a,ref:t})}if(r==="multiple"){const a=n;return c.jsx(I9,{...a,ref:t})}throw new Error(`Missing prop \`type\` expected on \`${Se}\``)});ea.displayName=Se;var[Qc,Zc]=Yc(Se),E9=y.forwardRef((e,t)=>{const{value:r,defaultValue:n,onValueChange:a=()=>{},...o}=e,[l,i]=F0({prop:r,defaultProp:n,onChange:a});return c.jsx(Qc,{scope:e.__scopeToggleGroup,type:"single",value:l?[l]:[],onItemActivate:i,onItemDeactivate:y.useCallback(()=>i(""),[i]),children:c.jsx(Jc,{...o,ref:t})})}),I9=y.forwardRef((e,t)=>{const{value:r,defaultValue:n,onValueChange:a=()=>{},...o}=e,[l=[],i]=F0({prop:r,defaultProp:n,onChange:a}),s=y.useCallback(u=>i((f=[])=>[...f,u]),[i]),d=y.useCallback(u=>i((f=[])=>f.filter(h=>h!==u)),[i]);return c.jsx(Qc,{scope:e.__scopeToggleGroup,type:"multiple",value:l,onItemActivate:s,onItemDeactivate:d,children:c.jsx(Jc,{...o,ref:t})})});ea.displayName=Se;var[P9,k9]=Yc(Se),Jc=y.forwardRef((e,t)=>{const{__scopeToggleGroup:r,disabled:n=!1,rovingFocus:a=!0,orientation:o,dir:l,loop:i=!0,...s}=e,d=Xc(r),u=ne(l),f={role:"group",dir:u,...s};return c.jsx(P9,{scope:r,rovingFocus:a,disabled:n,children:a?c.jsx(Ho,{asChild:!0,...d,orientation:o,dir:u,loop:i,children:c.jsx(o0.div,{...f,ref:t})}):c.jsx(o0.div,{...f,ref:t})})}),wr="ToggleGroupItem",e7=y.forwardRef((e,t)=>{const r=Zc(wr,e.__scopeToggleGroup),n=k9(wr,e.__scopeToggleGroup),a=Xc(e.__scopeToggleGroup),o=r.value.includes(e.value),l=n.disabled||e.disabled,i={...e,pressed:o,disabled:l},s=y.useRef(null);return n.rovingFocus?c.jsx(Vo,{asChild:!0,...a,focusable:!l,active:o,ref:s,children:c.jsx(t7,{...i,ref:t})}):c.jsx(t7,{...i,ref:t})});e7.displayName=wr;var t7=y.forwardRef((e,t)=>{const{__scopeToggleGroup:r,value:n,...a}=e,o=Zc(wr,r),l={role:"radio","aria-checked":e.pressed,"aria-pressed":void 0},i=o.type==="single"?l:void 0;return c.jsx(qc,{...i,...a,ref:t,onPressedChange:s=>{s?o.onItemActivate(n):o.onItemDeactivate(n)}})}),T9=ea,N9=e7;const r7=({prop:e,defaultProp:t,onChange:r=()=>{}})=>{const[n,a]=z9({defaultProp:t,onChange:r}),o=e!==void 0,l=o?e:n,i=y.useMemo(()=>r,[r]),s=y.useCallback(d=>{if(o){const u=typeof d=="function"?d(e):d;u!==e&&i(u)}else a(d)},[o,e,a,i]);return[l,s]},z9=({defaultProp:e,onChange:t})=>{const r=y.useState(e),[n]=r,a=y.useRef(n),o=y.useMemo(()=>t,[t]);return y.useEffect(()=>{a.current!==n&&(o==null||o(n),a.current=n)},[n,a,o]),r},O9="_root_1yzu4_5",D9="_item_1yzu4_30",H9="_itemLabel_1yzu4_50",V9="_itemLabelActive_1yzu4_70",L9="_itemLabelInactive_1yzu4_100",$9="_activeIndicator_1yzu4_130",B9="_separator_1yzu4_227",Z1={root:O9,item:D9,itemLabel:H9,itemLabelActive:V9,itemLabelInactive:L9,activeIndicator:$9,separator:B9},n7=({children:e,value:t,defaultValue:r,onValueChange:n,hugWidth:a=!0,...o},l)=>{const[i,s]=r7({prop:t,defaultProp:r,onChange:n});return c.jsxs(T9,{ref:l,...o,className:Z1.root,onValueChange:d=>{d&&s(d)},value:i,type:"single",asChild:!1,"data-hug-width":a,"aria-disabled":o.disabled,children:[e,c.jsx("div",{className:Z1.activeIndicator})]})};n7.displayName="SegmentedControl.Root";const o7=({children:e,...t},r)=>c.jsxs(N9,{ref:r,...t,className:Z1.item,asChild:!1,children:[c.jsx("span",{className:Z1.separator}),c.jsxs("span",{className:Z1.itemLabel,children:[c.jsx("span",{className:Z1.itemLabelActive,children:e}),c.jsx("span",{className:Z1.itemLabelInactive,children:e})]})]});o7.displayName="SegmentedControl.Item",y.forwardRef(n7),y.forwardRef(o7);var a7=["PageUp","PageDown"],l7=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],i7={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Ee="Slider",[ta,F9,R9]=Vr(Ee),[s7,Hy]=D0(Ee,[R9]),[U9,yr]=s7(Ee),c7=p.forwardRef((e,t)=>{const{name:r,min:n=0,max:a=100,step:o=1,orientation:l="horizontal",disabled:i=!1,minStepsBetweenThumbs:s=0,defaultValue:d=[n],value:u,onValueChange:f=()=>{},onValueCommit:h=()=>{},inverted:v=!1,form:x,...m}=e,g=p.useRef(new Set),_=p.useRef(0),A=l==="horizontal"?W9:K9,[M=[],S]=F0({prop:u,defaultProp:d,onChange:K=>{var B;(B=[...g.current][_.current])==null||B.focus(),f(K)}}),P=p.useRef(M);function N(K){const k=X9(M,K);R(K,k)}function D(K){R(K,_.current)}function U(){const K=P.current[_.current];M[_.current]!==K&&h(M)}function R(K,k,{commit:B}={commit:!1}){const $=em(o),q=tm(Math.round((K-n)/o)*o+n,$),W=Xo(q,[n,a]);S((H=[])=>{const L=q9(H,W,k);if(J9(L,s*o)){_.current=L.indexOf(W);const I=String(L)!==String(H);return I&&B&&h(L),I?L:H}else return H})}return c.jsx(U9,{scope:e.__scopeSlider,name:r,disabled:i,min:n,max:a,valueIndexToChangeRef:_,thumbs:g.current,values:M,orientation:l,form:x,children:c.jsx(ta.Provider,{scope:e.__scopeSlider,children:c.jsx(ta.Slot,{scope:e.__scopeSlider,children:c.jsx(A,{"aria-disabled":i,"data-disabled":i?"":void 0,...m,ref:t,onPointerDown:t0(m.onPointerDown,()=>{i||(P.current=M)}),min:n,max:a,inverted:v,onSlideStart:i?void 0:N,onSlideMove:i?void 0:D,onSlideEnd:i?void 0:U,onHomeKeyDown:()=>!i&&R(n,0,{commit:!0}),onEndKeyDown:()=>!i&&R(a,M.length-1,{commit:!0}),onStepKeyDown:({event:K,direction:k})=>{if(!i){const q=a7.includes(K.key)||K.shiftKey&&l7.includes(K.key)?10:1,W=_.current,H=M[W],L=o*q*k;R(H+L,W,{commit:!0})}}})})})})});c7.displayName=Ee;var[d7,u7]=s7(Ee,{startEdge:"left",endEdge:"right",size:"width",direction:1}),W9=p.forwardRef((e,t)=>{const{min:r,max:n,dir:a,inverted:o,onSlideStart:l,onSlideMove:i,onSlideEnd:s,onStepKeyDown:d,...u}=e,[f,h]=p.useState(null),v=d0(t,A=>h(A)),x=p.useRef(void 0),m=ne(a),g=m==="ltr",_=g&&!o||!g&&o;function C(A){const M=x.current||f.getBoundingClientRect(),S=[0,M.width],N=oa(S,_?[r,n]:[n,r]);return x.current=M,N(A-M.left)}return c.jsx(d7,{scope:e.__scopeSlider,startEdge:_?"left":"right",endEdge:_?"right":"left",direction:_?1:-1,size:"width",children:c.jsx(f7,{dir:m,"data-orientation":"horizontal",...u,ref:v,style:{...u.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:A=>{const M=C(A.clientX);l==null||l(M)},onSlideMove:A=>{const M=C(A.clientX);i==null||i(M)},onSlideEnd:()=>{x.current=void 0,s==null||s()},onStepKeyDown:A=>{const S=i7[_?"from-left":"from-right"].includes(A.key);d==null||d({event:A,direction:S?-1:1})}})})}),K9=p.forwardRef((e,t)=>{const{min:r,max:n,inverted:a,onSlideStart:o,onSlideMove:l,onSlideEnd:i,onStepKeyDown:s,...d}=e,u=p.useRef(null),f=d0(t,u),h=p.useRef(void 0),v=!a;function x(m){const g=h.current||u.current.getBoundingClientRect(),_=[0,g.height],A=oa(_,v?[n,r]:[r,n]);return h.current=g,A(m-g.top)}return c.jsx(d7,{scope:e.__scopeSlider,startEdge:v?"bottom":"top",endEdge:v?"top":"bottom",size:"height",direction:v?1:-1,children:c.jsx(f7,{"data-orientation":"vertical",...d,ref:f,style:{...d.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:m=>{const g=x(m.clientY);o==null||o(g)},onSlideMove:m=>{const g=x(m.clientY);l==null||l(g)},onSlideEnd:()=>{h.current=void 0,i==null||i()},onStepKeyDown:m=>{const _=i7[v?"from-bottom":"from-top"].includes(m.key);s==null||s({event:m,direction:_?-1:1})}})})}),f7=p.forwardRef((e,t)=>{const{__scopeSlider:r,onSlideStart:n,onSlideMove:a,onSlideEnd:o,onHomeKeyDown:l,onEndKeyDown:i,onStepKeyDown:s,...d}=e,u=yr(Ee,r);return c.jsx(o0.span,{...d,ref:t,onKeyDown:t0(e.onKeyDown,f=>{f.key==="Home"?(l(f),f.preventDefault()):f.key==="End"?(i(f),f.preventDefault()):a7.concat(l7).includes(f.key)&&(s(f),f.preventDefault())}),onPointerDown:t0(e.onPointerDown,f=>{const h=f.target;h.setPointerCapture(f.pointerId),f.preventDefault(),u.thumbs.has(h)?h.focus():n(f)}),onPointerMove:t0(e.onPointerMove,f=>{f.target.hasPointerCapture(f.pointerId)&&a(f)}),onPointerUp:t0(e.onPointerUp,f=>{const h=f.target;h.hasPointerCapture(f.pointerId)&&(h.releasePointerCapture(f.pointerId),o(f))})})}),h7="SliderTrack",p7=p.forwardRef((e,t)=>{const{__scopeSlider:r,...n}=e,a=yr(h7,r);return c.jsx(o0.span,{"data-disabled":a.disabled?"":void 0,"data-orientation":a.orientation,...n,ref:t})});p7.displayName=h7;var ra="SliderRange",v7=p.forwardRef((e,t)=>{const{__scopeSlider:r,...n}=e,a=yr(ra,r),o=u7(ra,r),l=p.useRef(null),i=d0(t,l),s=a.values.length,d=a.values.map(h=>m7(h,a.min,a.max)),u=s>1?Math.min(...d):0,f=100-Math.max(...d);return c.jsx(o0.span,{"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,...n,ref:i,style:{...e.style,[o.startEdge]:u+"%",[o.endEdge]:f+"%"}})});v7.displayName=ra;var na="SliderThumb",g7=p.forwardRef((e,t)=>{const r=F9(e.__scopeSlider),[n,a]=p.useState(null),o=d0(t,i=>a(i)),l=p.useMemo(()=>n?r().findIndex(i=>i.ref.current===n):-1,[r,n]);return c.jsx(j9,{...e,ref:o,index:l})}),j9=p.forwardRef((e,t)=>{const{__scopeSlider:r,index:n,name:a,...o}=e,l=yr(na,r),i=u7(na,r),[s,d]=p.useState(null),u=d0(t,C=>d(C)),f=s?l.form||!!s.closest("form"):!0,h=yt(s),v=l.values[n],x=v===void 0?0:m7(v,l.min,l.max),m=Y9(n,l.values.length),g=h==null?void 0:h[i.size],_=g?Q9(g,x,i.direction):0;return p.useEffect(()=>{if(s)return l.thumbs.add(s),()=>{l.thumbs.delete(s)}},[s,l.thumbs]),c.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[i.startEdge]:`calc(${x}% + ${_}px)`},children:[c.jsx(ta.ItemSlot,{scope:e.__scopeSlider,children:c.jsx(o0.span,{role:"slider","aria-label":e["aria-label"]||m,"aria-valuemin":l.min,"aria-valuenow":v,"aria-valuemax":l.max,"aria-orientation":l.orientation,"data-orientation":l.orientation,"data-disabled":l.disabled?"":void 0,tabIndex:l.disabled?void 0:0,...o,ref:u,style:v===void 0?{display:"none"}:e.style,onFocus:t0(e.onFocus,()=>{l.valueIndexToChangeRef.current=n})})}),f&&c.jsx(G9,{name:a??(l.name?l.name+(l.values.length>1?"[]":""):void 0),form:l.form,value:v},n)]})});g7.displayName=na;var G9=e=>{const{value:t,...r}=e,n=p.useRef(null),a=qr(t);return p.useEffect(()=>{const o=n.current,l=window.HTMLInputElement.prototype,s=Object.getOwnPropertyDescriptor(l,"value").set;if(a!==t&&s){const d=new Event("input",{bubbles:!0});s.call(o,t),o.dispatchEvent(d)}},[a,t]),c.jsx("input",{style:{display:"none"},...r,ref:n,defaultValue:t})};function q9(e=[],t,r){const n=[...e];return n[r]=t,n.sort((a,o)=>a-o)}function m7(e,t,r){const o=100/(r-t)*(e-t);return Xo(o,[0,100])}function Y9(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function X9(e,t){if(e.length===1)return 0;const r=e.map(a=>Math.abs(a-t)),n=Math.min(...r);return r.indexOf(n)}function Q9(e,t,r){const n=e/2,o=oa([0,50],[0,n]);return(n-o(t)*r)*r}function Z9(e){return e.slice(0,-1).map((t,r)=>e[r+1]-t)}function J9(e,t){if(t>0){const r=Z9(e);return Math.min(...r)>=t}return!0}function oa(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}function em(e){return(String(e).split(".")[1]||"").length}function tm(e,t){const r=Math.pow(10,t);return Math.round(e*r)/r}var rm=c7,nm=p7,om=v7,am=g7;const lm="_root_fs3zj_5",im="_thumb_fs3zj_17",sm="_track_fs3zj_21",cm="_range_fs3zj_28",Cr={root:lm,thumb:im,track:sm,range:cm},dm=({value:e,defaultValue:t=[0],onChange:r,onCommit:n,"data-test-id":a="fondue-slider",...o},l)=>{const i=y.useRef(null);return c.jsxs(rm,{ref:l,className:Cr.root,value:e,defaultValue:t,onValueChange:r,onValueCommit:n,"data-test-id":a,...o,children:[c.jsx(nm,{onPointerDown:()=>{i.current&&(i.current.dataset.showFocusRing="false")},className:Cr.track,children:c.jsx(om,{className:Cr.range})}),(e||t).map((s,d)=>c.jsx(am,{ref:i,className:Cr.thumb,onPointerDown:u=>{u.currentTarget.dataset.showFocusRing="false"},onBlur:u=>{u.currentTarget.dataset.showFocusRing="true"}},d))]})},um=y.forwardRef(dm);um.displayName="Slider";var aa="Switch",[fm,Vy]=D0(aa),[hm,pm]=fm(aa),b7=p.forwardRef((e,t)=>{const{__scopeSwitch:r,name:n,checked:a,defaultChecked:o,required:l,disabled:i,value:s="on",onCheckedChange:d,form:u,...f}=e,[h,v]=p.useState(null),x=d0(t,A=>v(A)),m=p.useRef(!1),g=h?u||!!h.closest("form"):!0,[_=!1,C]=F0({prop:a,defaultProp:o,onChange:d});return c.jsxs(hm,{scope:r,checked:_,disabled:i,children:[c.jsx(o0.button,{type:"button",role:"switch","aria-checked":_,"aria-required":l,"data-state":C7(_),"data-disabled":i?"":void 0,disabled:i,value:s,...f,ref:x,onClick:t0(e.onClick,A=>{C(M=>!M),g&&(m.current=A.isPropagationStopped(),m.current||A.stopPropagation())})}),g&&c.jsx(vm,{control:h,bubbles:!m.current,name:n,value:s,checked:_,required:l,disabled:i,form:u,style:{transform:"translateX(-100%)"}})]})});b7.displayName=aa;var w7="SwitchThumb",y7=p.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,a=pm(w7,r);return c.jsx(o0.span,{"data-state":C7(a.checked),"data-disabled":a.disabled?"":void 0,...n,ref:t})});y7.displayName=w7;var vm=e=>{const{control:t,checked:r,bubbles:n=!0,...a}=e,o=p.useRef(null),l=qr(r),i=yt(t);return p.useEffect(()=>{const s=o.current,d=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(d,"checked").set;if(l!==r&&f){const h=new Event("click",{bubbles:n});f.call(s,r),s.dispatchEvent(h)}},[l,r,n]),c.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...a,tabIndex:-1,ref:o,style:{...e.style,...i,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function C7(e){return e?"checked":"unchecked"}var gm=b7,mm=y7;const bm="_root_1dkcu_5",wm="_small_1dkcu_14",ym="_medium_1dkcu_18",Cm="_large_1dkcu_22",xm="_thumb_1dkcu_59",la={root:bm,small:wm,medium:ym,large:Cm,thumb:xm},_m=({value:e,defaultValue:t,size:r="medium",onChange:n,"data-test-id":a="fondue-switch","aria-label":o="Switch",...l},i)=>c.jsx(gm,{ref:i,checked:e,defaultChecked:t,className:a1([la.root,la[r]]),onCheckedChange:n,"aria-label":o,"data-test-id":a,...l,children:c.jsx(mm,{className:la.thumb})}),Mm=y.forwardRef(_m);Mm.displayName="Switch";const x7=e=>{y.useEffect(()=>{if(!e.current)return;const t=e.current,r=new ResizeObserver(()=>{const n=t.scrollWidth>t.clientWidth;t.title=n&&t.textContent||""});return r.observe(t),()=>r.disconnect()},[e])},Am="_table_1outv_4",Sm="_headerCell_1outv_18",Em="_rowCell_1outv_19",Im="_caption_1outv_46",Pm="_cellContent_1outv_71",km="_sortIndicator_1outv_96",Tm="_body_1outv_100",Nm="_row_1outv_19",zm="_buttonText_1outv_164",Y0={table:Am,headerCell:Sm,rowCell:Em,caption:Im,cellContent:Pm,sortIndicator:km,body:Tm,row:Nm,buttonText:zm};function Om(e,t){const r='tr[tabindex="0"]',n=e.closest("table");if(!n)return null;const a=Array.from(n.querySelectorAll(r)),o=a.indexOf(e)+(t==="ArrowUp"?-1:1);return o>=0&&o<a.length?a[o]:null}function Dm(e){const t=e.target,r=t.closest("tr");if(!r||t!==r||!["ArrowUp","ArrowDown"].includes(e.key))return;const n=Om(r,e.key);n&&(e.preventDefault(),n.focus())}const Hm=y.forwardRef(({layout:e="auto",fontSize:t="medium",sticky:r,children:n,...a},o)=>c.jsx("div",{onKeyDown:Dm,role:"grid",tabIndex:-1,children:c.jsx("table",{ref:o,className:Y0.table,"data-layout":e,"data-font-size":t,"data-sticky":r,...a,children:n})}));Hm.displayName="Table.Root";const Vm=y.forwardRef(({children:e},t)=>c.jsx("caption",{ref:t,className:Y0.caption,children:e}));Vm.displayName="Table.Caption";const Lm=y.forwardRef(({children:e,"aria-label":t,"aria-busy":r},n)=>c.jsx("thead",{ref:n,className:Y0.header,"aria-label":t,"aria-busy":r,children:e}));Lm.displayName="Table.Header";const $m=y.forwardRef(({noShrink:e=!1,truncate:t=!1,align:r="left",scope:n="col",sortTranslations:a,sortDirection:o,colSpan:l,width:i,state:s="idle",loadingStateAriaLabel:d,onSortChange:u,children:f},h)=>{const v=y.useRef(null);zo(v,h),x7(v);const x=y.useMemo(()=>typeof f=="string"?o==="ascending"?(a==null?void 0:a.sortDescending)??`Sort by ${f} descending`:(a==null?void 0:a.sortAscending)??`Sort by ${f} ascending`:o==="ascending"?"Sort descending":"Sort ascending",[f,o,a]),m=()=>{u&&u(o===void 0||o==="descending"?"ascending":"descending")};return c.jsx("th",{ref:v,style:{width:i},className:Y0.headerCell,scope:n,colSpan:l,"data-align":r,"data-truncate":t,"data-no-shrink":e,"data-sortable":!!u,"aria-sort":u?o||"none":void 0,children:s==="loading"?c.jsxs("div",{className:Y0.cellContent,"aria-live":"polite","aria-label":d,children:[typeof f=="string"&&t?c.jsx("span",{className:Y0.buttonText,children:f}):f,c.jsx(Tc,{"data-test-id":"fondue-loading-circle",size:"xx-small"})]}):u?c.jsxs("button",{className:Y0.cellContent,"aria-label":x,"data-active":!!o,onClick:m,children:[typeof f=="string"&&t?c.jsx("span",{className:Y0.buttonText,children:f}):f,c.jsx(c5,{width:3,children:o==="ascending"?c.jsx(Pu,{size:"12"}):o==="descending"?c.jsx(Iu,{size:"12"}):c.jsx(Eu,{className:Y0.sortIndicator,size:"12"})})]}):f})});$m.displayName="Table.HeaderCell";const Bm=y.forwardRef(({children:e,"aria-busy":t},r)=>c.jsx("tbody",{ref:r,className:Y0.body,"aria-busy":t,children:e}));Bm.displayName="Table.Body";const Fm=y.forwardRef(({disabled:e=!1,selected:t=!1,onClick:r,children:n,"aria-label":a,"data-test-id":o},l)=>{const i=r!==void 0&&!e,s=()=>{e||r&&r(t)},d=u=>{i&&(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),s())};return c.jsx("tr",{ref:l,className:Y0.row,tabIndex:0,role:i?"button":"row","data-disabled":e,"data-interactive":i,"data-selected":t,"aria-disabled":e,"aria-label":a,"aria-selected":t,onClick:i?s:void 0,onKeyDown:i?d:void 0,"data-test-id":o,children:n})});Fm.displayName="Table.Row";const Rm=y.forwardRef(({colSpan:e,truncate:t,align:r="left",children:n,"aria-label":a},o)=>{const l=y.useRef(null);return zo(l,o),x7(l),c.jsx("td",{ref:l,className:Y0.rowCell,colSpan:e,"data-align":r,"data-truncate":t,"aria-label":a,children:n})});Rm.displayName="Table.RowCell";var ia="Tabs",[Um,Ly]=D0(ia,[_e]),_7=_e(),[Wm,sa]=Um(ia),M7=p.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,onValueChange:a,defaultValue:o,orientation:l="horizontal",dir:i,activationMode:s="automatic",...d}=e,u=ne(i),[f,h]=F0({prop:n,onChange:a,defaultProp:o});return c.jsx(Wm,{scope:r,baseId:X0(),value:f,onValueChange:h,orientation:l,dir:u,activationMode:s,children:c.jsx(o0.div,{dir:u,"data-orientation":l,...d,ref:t})})});M7.displayName=ia;var A7="TabsList",S7=p.forwardRef((e,t)=>{const{__scopeTabs:r,loop:n=!0,...a}=e,o=sa(A7,r),l=_7(r);return c.jsx(Ho,{asChild:!0,...l,orientation:o.orientation,dir:o.dir,loop:n,children:c.jsx(o0.div,{role:"tablist","aria-orientation":o.orientation,...a,ref:t})})});S7.displayName=A7;var E7="TabsTrigger",I7=p.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,disabled:a=!1,...o}=e,l=sa(E7,r),i=_7(r),s=T7(l.baseId,n),d=N7(l.baseId,n),u=n===l.value;return c.jsx(Vo,{asChild:!0,...i,focusable:!a,active:u,children:c.jsx(o0.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":d,"data-state":u?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:s,...o,ref:t,onMouseDown:t0(e.onMouseDown,f=>{!a&&f.button===0&&f.ctrlKey===!1?l.onValueChange(n):f.preventDefault()}),onKeyDown:t0(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&l.onValueChange(n)}),onFocus:t0(e.onFocus,()=>{const f=l.activationMode!=="manual";!u&&!a&&f&&l.onValueChange(n)})})})});I7.displayName=E7;var P7="TabsContent",k7=p.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,forceMount:a,children:o,...l}=e,i=sa(P7,r),s=T7(i.baseId,n),d=N7(i.baseId,n),u=n===i.value,f=p.useRef(u);return p.useEffect(()=>{const h=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(h)},[]),c.jsx(I0,{present:a||u,children:({present:h})=>c.jsx(o0.div,{"data-state":u?"active":"inactive","data-orientation":i.orientation,role:"tabpanel","aria-labelledby":s,hidden:!h,id:d,tabIndex:0,...l,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:h&&o})})});k7.displayName=P7;function T7(e,t){return`${e}-trigger-${t}`}function N7(e,t){return`${e}-content-${t}`}var Km=M7,jm=S7,Gm=I7,qm=k7;const Ym=(e,t)=>e.filter(r=>{var n;const a=(n=r.ref)==null?void 0:n.current;return a?a.offsetLeft+a.offsetWidth>(t==null?void 0:t.scrollLeft)+t.offsetWidth||a.offsetLeft-t.scrollLeft<0:!1}),xr=(e,t)=>{const r=t.current,n=e==null?void 0:e.querySelector('[data-state="active"]');if(!e||!(n instanceof HTMLButtonElement)||!(r instanceof HTMLSpanElement))return;const a=(e==null?void 0:e.scrollLeft)>(n==null?void 0:n.offsetLeft),o=(n==null?void 0:n.offsetLeft)+(n==null?void 0:n.offsetWidth)>(e==null?void 0:e.offsetWidth);a?(e.offsetWidth>n.offsetWidth+n.offsetLeft?r.style.left=`${n.offsetLeft}px`:r.style.left=`${e.offsetWidth-n.offsetWidth}px`,r.style.width=`${n==null?void 0:n.offsetWidth}px`):o?(r.style.left=`${e.clientWidth-n.offsetWidth}px`,r.style.width=`${n.offsetWidth}px`):(r.style.left=`${n.offsetLeft}px`,r.style.width=`${n.offsetWidth}px`)},Xm=({activeTab:e})=>{const t=y.useRef(null),r=y.useRef(null),[n,a]=y.useState([]),[o,l]=y.useState([]);return y.useEffect(()=>{const i=t.current,s=i==null?void 0:i.querySelector('[data-state="active"]');s instanceof HTMLButtonElement&&i instanceof HTMLDivElement&&(xr(i,r),s.scrollIntoView({behavior:"smooth",block:"nearest",inline:"end"}))},[e,r]),y.useLayoutEffect(()=>{var i;const s=t.current,d=s==null?void 0:s.querySelector('[data-state="active"]');if(s instanceof HTMLDivElement&&d instanceof HTMLButtonElement){xr(s,r);const u=new MutationObserver(()=>{d.scrollIntoView({behavior:"instant",block:"nearest",inline:"end"}),xr(s,r)});s.parentNode&&u.observe(s.parentNode,{childList:!0});const f=new IntersectionObserver(()=>{l(Ym(n,s)),xr(s,r)},{root:s,threshold:1});for(const h of n)(i=h.ref)!=null&&i.current&&f.observe(h.ref.current);return()=>{f.disconnect(),u.disconnect()}}},[n,t,r]),{triggerListRef:t,activeIndicatorRef:r,triggersOutOfView:o,triggers:n,addTrigger:i=>{a(s=>[...s,i])}}},Qm="_root_13jbx_5",Zm="_triggerList_13jbx_14",Jm="_triggerListWrapper_13jbx_28",eb="_trigger_13jbx_14",tb="_content_13jbx_78",rb="_activeIndicator_13jbx_94",Ie={root:Qm,triggerList:Zm,triggerListWrapper:Jm,trigger:eb,content:tb,activeIndicator:rb},ca=y.createContext({value:"",disabled:!1}),z7=y.createContext({addTrigger:()=>{}}),O7=({padding:e="compact",activeTab:t,defaultActiveTab:r,size:n="medium",onActiveTabChange:a,children:o,...l},i)=>{var s;const[d,u]=r7({prop:t,defaultProp:r,onChange:a}),f=y.useCallback(_=>{u(_)},[u]),{triggerListRef:h,activeIndicatorRef:v,triggers:x,triggersOutOfView:m,addTrigger:g}=Xm({activeTab:d});return c.jsx(z7.Provider,{value:{addTrigger:g},children:c.jsxs(Km,{ref:i,className:Ie.root,onValueChange:f,value:d??((s=x[0])==null?void 0:s.value),"data-tabs-content-padding":e,...l,children:[c.jsxs("div",{className:Ie.triggerListWrapper,children:[c.jsx(jm,{ref:h,"data-size":n,className:Ie.triggerList,children:x.map(_=>y.createElement(Gm,{..._.props,key:_.value,value:_.value,disabled:_.disabled,className:Ie.trigger,ref:_.ref},_.element))}),c.jsxs(fr.Root,{children:[m.length>0&&c.jsx(fr.Trigger,{"data-test-id":"overflow-items-dropdown-trigger",children:c.jsx(D5,{emphasis:"default",aspect:"square",size:"small",children:c.jsx(Tu,{size:16})})}),c.jsx(fr.Content,{align:"end","data-test-id":"overflow-items-dropdown-content",children:m.map(_=>y.createElement(fr.Item,{..._.props,disabled:_.disabled,onSelect:()=>f(_.value),key:_.value},_.element))})]}),c.jsx("span",{"data-test-id":"active-tab-indicator",ref:v,className:Ie.activeIndicator})]}),o]})})};O7.displayName="Tabs.Root";const D7=({children:e,value:t,disabled:r})=>c.jsx(ca.Provider,{value:{value:t,disabled:r},children:e});D7.displayName="Tabs.Tab";const H7=({children:e,...t},r)=>{const{value:n,disabled:a}=y.useContext(ca),{addTrigger:o}=y.useContext(z7),l=y.useRef(null);return y.useEffect(()=>{o({ref:l||r,value:n??"",disabled:a,props:t,element:e})},[]),null};H7.displayName="Tabs.Trigger";const V7=({children:e,...t},r)=>{const{value:n}=y.useContext(ca);return c.jsx(qm,{ref:r,...t,className:Ie.content,value:n??"",children:e})};V7.displayName="Tabs.Content",y.forwardRef(O7),y.forwardRef(D7),y.forwardRef(H7),y.forwardRef(V7);const nb="_root_1cjgh_2",_r={root:nb,"weight-default":"_weight-default_1cjgh_7","weight-strong":"_weight-strong_1cjgh_11","weight-x-strong":"_weight-x-strong_1cjgh_15","size-x-small":"_size-x-small_1cjgh_19","size-small":"_size-small_1cjgh_24","size-medium":"_size-medium_1cjgh_29","size-large":"_size-large_1cjgh_34","color-default":"_color-default_1cjgh_39","color-weak":"_color-weak_1cjgh_43","color-x-weak":"_color-x-weak_1cjgh_47","color-disabled":"_color-disabled_1cjgh_51","color-negative":"_color-negative_1cjgh_55","color-positive":"_color-positive_1cjgh_59","color-warning":"_color-warning_1cjgh_63","color-interactive":"_color-interactive_1cjgh_67","color-box-neutral":"_color-box-neutral_1cjgh_71","color-box-selected":"_color-box-selected_1cjgh_75","color-box-disabled":"_color-box-disabled_1cjgh_79","color-box-positive":"_color-box-positive_1cjgh_83","color-box-negative":"_color-box-negative_1cjgh_87","color-box-warning":"_color-box-warning_1cjgh_91"},ob=y.forwardRef(({children:e,as:t="span",size:r="medium",weight:n="default",color:a="default",boxColor:o,className:l,...i},s)=>c.jsx(t,{"data-test-id":"text",className:a1([_r.root,_r[`size-${r}`],_r[`weight-${n}`],_r[o?`color-box-${o}`:`color-${a}`],l]),ref:s,...i,children:e}));ob.displayName="FondueText";var ab="VisuallyHidden",L7=p.forwardRef((e,t)=>c.jsx(o0.span,{...e,ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}));L7.displayName=ab;var lb=L7,[Mr,$y]=D0("Tooltip",[he]),Ar=he(),$7="TooltipProvider",ib=700,da="tooltip.open",[sb,ua]=Mr($7),B7=e=>{const{__scopeTooltip:t,delayDuration:r=ib,skipDelayDuration:n=300,disableHoverableContent:a=!1,children:o}=e,l=p.useRef(!0),i=p.useRef(!1),s=p.useRef(0);return p.useEffect(()=>{const d=s.current;return()=>window.clearTimeout(d)},[]),c.jsx(sb,{scope:t,isOpenDelayedRef:l,delayDuration:r,onOpen:p.useCallback(()=>{window.clearTimeout(s.current),l.current=!1},[]),onClose:p.useCallback(()=>{window.clearTimeout(s.current),s.current=window.setTimeout(()=>l.current=!0,n)},[n]),isPointerInTransitRef:i,onPointerInTransitChange:p.useCallback(d=>{i.current=d},[]),disableHoverableContent:a,children:o})};B7.displayName=$7;var Sr="Tooltip",[cb,st]=Mr(Sr),F7=e=>{const{__scopeTooltip:t,children:r,open:n,defaultOpen:a=!1,onOpenChange:o,disableHoverableContent:l,delayDuration:i}=e,s=ua(Sr,e.__scopeTooltip),d=Ar(t),[u,f]=p.useState(null),h=X0(),v=p.useRef(0),x=l??s.disableHoverableContent,m=i??s.delayDuration,g=p.useRef(!1),[_=!1,C]=F0({prop:n,defaultProp:a,onChange:N=>{N?(s.onOpen(),document.dispatchEvent(new CustomEvent(da))):s.onClose(),o==null||o(N)}}),A=p.useMemo(()=>_?g.current?"delayed-open":"instant-open":"closed",[_]),M=p.useCallback(()=>{window.clearTimeout(v.current),v.current=0,g.current=!1,C(!0)},[C]),S=p.useCallback(()=>{window.clearTimeout(v.current),v.current=0,C(!1)},[C]),P=p.useCallback(()=>{window.clearTimeout(v.current),v.current=window.setTimeout(()=>{g.current=!0,C(!0),v.current=0},m)},[m,C]);return p.useEffect(()=>()=>{v.current&&(window.clearTimeout(v.current),v.current=0)},[]),c.jsx(zt,{...d,children:c.jsx(cb,{scope:t,contentId:h,open:_,stateAttribute:A,trigger:u,onTriggerChange:f,onTriggerEnter:p.useCallback(()=>{s.isOpenDelayedRef.current?P():M()},[s.isOpenDelayedRef,P,M]),onTriggerLeave:p.useCallback(()=>{x?S():(window.clearTimeout(v.current),v.current=0)},[S,x]),onOpen:M,onClose:S,disableHoverableContent:x,children:r})})};F7.displayName=Sr;var fa="TooltipTrigger",R7=p.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,a=st(fa,r),o=ua(fa,r),l=Ar(r),i=p.useRef(null),s=d0(t,i,a.onTriggerChange),d=p.useRef(!1),u=p.useRef(!1),f=p.useCallback(()=>d.current=!1,[]);return p.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),c.jsx(Ot,{asChild:!0,...l,children:c.jsx(o0.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...n,ref:s,onPointerMove:t0(e.onPointerMove,h=>{h.pointerType!=="touch"&&!u.current&&!o.isPointerInTransitRef.current&&(a.onTriggerEnter(),u.current=!0)}),onPointerLeave:t0(e.onPointerLeave,()=>{a.onTriggerLeave(),u.current=!1}),onPointerDown:t0(e.onPointerDown,()=>{a.open&&a.onClose(),d.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:t0(e.onFocus,()=>{d.current||a.onOpen()}),onBlur:t0(e.onBlur,a.onClose),onClick:t0(e.onClick,a.onClose)})})});R7.displayName=fa;var ha="TooltipPortal",[db,ub]=Mr(ha,{forceMount:void 0}),U7=e=>{const{__scopeTooltip:t,forceMount:r,children:n,container:a}=e,o=st(ha,t);return c.jsx(db,{scope:t,forceMount:r,children:c.jsx(I0,{present:r||o.open,children:c.jsx(Ze,{asChild:!0,container:a,children:n})})})};U7.displayName=ha;var Pe="TooltipContent",W7=p.forwardRef((e,t)=>{const r=ub(Pe,e.__scopeTooltip),{forceMount:n=r.forceMount,side:a="top",...o}=e,l=st(Pe,e.__scopeTooltip);return c.jsx(I0,{present:n||l.open,children:l.disableHoverableContent?c.jsx(K7,{side:a,...o,ref:t}):c.jsx(fb,{side:a,...o,ref:t})})}),fb=p.forwardRef((e,t)=>{const r=st(Pe,e.__scopeTooltip),n=ua(Pe,e.__scopeTooltip),a=p.useRef(null),o=d0(t,a),[l,i]=p.useState(null),{trigger:s,onClose:d}=r,u=a.current,{onPointerInTransitChange:f}=n,h=p.useCallback(()=>{i(null),f(!1)},[f]),v=p.useCallback((x,m)=>{const g=x.currentTarget,_={x:x.clientX,y:x.clientY},C=gb(_,g.getBoundingClientRect()),A=mb(_,C),M=bb(m.getBoundingClientRect()),S=yb([...A,...M]);i(S),f(!0)},[f]);return p.useEffect(()=>()=>h(),[h]),p.useEffect(()=>{if(s&&u){const x=g=>v(g,u),m=g=>v(g,s);return s.addEventListener("pointerleave",x),u.addEventListener("pointerleave",m),()=>{s.removeEventListener("pointerleave",x),u.removeEventListener("pointerleave",m)}}},[s,u,v,h]),p.useEffect(()=>{if(l){const x=m=>{const g=m.target,_={x:m.clientX,y:m.clientY},C=(s==null?void 0:s.contains(g))||(u==null?void 0:u.contains(g)),A=!wb(_,l);C?h():A&&(h(),d())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[s,u,l,d,h]),c.jsx(K7,{...e,ref:o})}),[hb,pb]=Mr(Sr,{isInside:!1}),vb=Vu("TooltipContent"),K7=p.forwardRef((e,t)=>{const{__scopeTooltip:r,children:n,"aria-label":a,onEscapeKeyDown:o,onPointerDownOutside:l,...i}=e,s=st(Pe,r),d=Ar(r),{onClose:u}=s;return p.useEffect(()=>(document.addEventListener(da,u),()=>document.removeEventListener(da,u)),[u]),p.useEffect(()=>{if(s.trigger){const f=h=>{const v=h.target;v!=null&&v.contains(s.trigger)&&u()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[s.trigger,u]),c.jsx(qe,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:f=>f.preventDefault(),onDismiss:u,children:c.jsxs(_n,{"data-state":s.stateAttribute,...d,...i,ref:t,style:{...i.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[c.jsx(vb,{children:n}),c.jsx(hb,{scope:r,isInside:!0,children:c.jsx(lb,{id:s.contentId,role:"tooltip",children:a||n})})]})})});W7.displayName=Pe;var j7="TooltipArrow",G7=p.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,a=Ar(r);return pb(j7,r).isInside?null:c.jsx(Mn,{...a,...n,ref:t})});G7.displayName=j7;function gb(e,t){const r=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),a=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(r,n,a,o)){case o:return"left";case a:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function mb(e,t,r=5){const n=[];switch(t){case"top":n.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":n.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":n.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":n.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r});break}return n}function bb(e){const{top:t,right:r,bottom:n,left:a}=e;return[{x:a,y:t},{x:r,y:t},{x:r,y:n},{x:a,y:n}]}function wb(e,t){const{x:r,y:n}=e;let a=!1;for(let o=0,l=t.length-1;o<t.length;l=o++){const i=t[o].x,s=t[o].y,d=t[l].x,u=t[l].y;s>n!=u>n&&r<(d-i)*(n-s)/(u-s)+i&&(a=!a)}return a}function yb(e){const t=e.slice();return t.sort((r,n)=>r.x<n.x?-1:r.x>n.x?1:r.y<n.y?-1:r.y>n.y?1:0),Cb(t)}function Cb(e){if(e.length<=1)return e.slice();const t=[];for(let n=0;n<e.length;n++){const a=e[n];for(;t.length>=2;){const o=t[t.length-1],l=t[t.length-2];if((o.x-l.x)*(a.y-l.y)>=(o.y-l.y)*(a.x-l.x))t.pop();else break}t.push(a)}t.pop();const r=[];for(let n=e.length-1;n>=0;n--){const a=e[n];for(;r.length>=2;){const o=r[r.length-1],l=r[r.length-2];if((o.x-l.x)*(a.y-l.y)>=(o.y-l.y)*(a.x-l.x))r.pop();else break}r.push(a)}return r.pop(),t.length===1&&r.length===1&&t[0].x===r[0].x&&t[0].y===r[0].y?t:t.concat(r)}var xb=B7,_b=F7,Mb=R7,Ab=U7,Sb=W7,Eb=G7;const Ib="_root_13m98_4",Pb="_arrow_13m98_25",q7={root:Ib,arrow:Pb},Y7=({children:e,enterDelay:t=700,open:r,onOpenChange:n,...a})=>c.jsx(xb,{children:c.jsx(_b,{delayDuration:t,open:r,onOpenChange:n,...a,children:e})});Y7.displayName="Tooltip.Root";const X7=({asChild:e=!1,children:t,"data-test-id":r="fondue-tooltip-trigger"},n)=>c.jsx(Mb,{"data-test-id":r,type:e?void 0:"button",asChild:e,ref:n,children:t});X7.displayName="Tooltip.Trigger";const Q7=({children:e,className:t,maxWidth:r,"data-test-id":n="fondue-tooltip-content",padding:a="spacious",...o},l)=>{const i=ye();return c.jsx(Ab,{children:c.jsx(Ce,{theme:i,children:c.jsxs(Sb,{"data-test-id":n,"data-tooltip-spacing":a,className:a1(q7.root,t),style:{maxWidth:r},collisionPadding:16,sideOffset:8,ref:l,...o,children:[e,c.jsx(Eb,{"aria-hidden":"true",className:q7.arrow})]})})})};Q7.displayName="Tooltip.Content";const b1={Root:Y7,Trigger:y.forwardRef(X7),Content:y.forwardRef(Q7)},kb=e=>e==="IMAGE"?c.jsx(b.IconImage24,{}):e==="VIDEO"?c.jsx(b.IconPlayFrame24,{}):e==="AUDIO"?c.jsx(b.IconMusicNote24,{}):c.jsx(b.IconDocument24,{}),pa=y.forwardRef(({item:e,isEditing:t,draggableProps:r,transformStyle:n,isDragging:a,isOverlay:o,isLoading:l,onDelete:i,onReplaceWithBrowse:s,onReplaceWithUpload:d,onDownload:u},f)=>{const[h,v]=y.useState(),[x,{selectedFiles:m}]=V1.useFileInput({multiple:!0,accept:"image/*"}),[g,{results:_,doneAll:C}]=V1.useAssetUpload(),{focusProps:A,isFocusVisible:M}=$a.useFocusRing();y.useEffect(()=>{m&&g(m[0])},[m]),y.useEffect(()=>{C&&d(_[0])},[C,_]);const S=l||m&&!C;return c.jsxs("button",{"aria-label":"Download attachment","data-test-id":"attachments-item",onClick:()=>u==null?void 0:u(),ref:f,style:{...n,opacity:a&&!o?.3:1,fontFamily:"var(-f-theme-settings-body-font-family)"},className:n1(["tw-cursor-pointer tw-text-left tw-w-full tw-relative tw-flex tw-gap-3 tw-px-5 tw-py-3 tw-items-center tw-group hover:tw-bg-box-neutral-hover",a?"tw-bg-box-neutral-hover":""]),children:[c.jsx("div",{className:"tw-text-text-weak group-hover:tw-text-box-neutral-inverse-hover",children:S?c.jsx(b.LoadingCircle,{size:b.LoadingCircleSize.Small}):kb(e.objectType)}),c.jsxs("div",{className:"tw-text-s tw-flex-1 tw-min-w-0",children:[c.jsx("div",{className:"tw-whitespace-nowrap tw-overflow-hidden tw-text-ellipsis tw-font-bold tw-text-text-weak group-hover:tw-text-box-neutral-inverse-hover",children:e.title}),c.jsx("div",{className:"tw-text-text-weak",children:`${e.fileSizeHumanReadable} - ${e.extension}`})]}),t&&c.jsxs("div",{"data-test-id":"attachments-actionbar",className:n1(["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||(h==null?void 0:h.id)===e.id?"tw-opacity-100":"tw-opacity-0"]),children:[c.jsx("button",{...A,...r,"aria-label":"Drag attachment",className:n1([" tw-border-button-border tw-bg-button-background active:tw-bg-button-background-pressed tw-group tw-border tw-box-box tw-relative tw-flex tw-items-center tw-justify-center tw-outline-none tw-font-medium tw-rounded tw-h-9 tw-w-9 ",a||o?"tw-cursor-grabbing tw-bg-button-background-pressed hover:tw-bg-button-background-pressed":"tw-cursor-grab hover:tw-bg-button-background-hover",M&&b.FOCUS_STYLE,M&&"tw-z-[2]"]),children:c.jsx(b.IconGrabHandle20,{})}),c.jsx("div",{"data-test-id":"attachments-actionbar-flyout",children:c.jsx(b.Flyout,{placement:b.FlyoutPlacement.Right,isOpen:(h==null?void 0:h.id)===e.id,fitContent:!0,legacyFooter:!1,onOpenChange:P=>v(P?e:void 0),trigger:(P,N)=>c.jsx(b.Button,{ref:N,icon:c.jsx(b.IconPen20,{}),emphasis:b.ButtonEmphasis.Default,onClick:()=>v(e)}),children:c.jsx(b.ActionMenu,{menuBlocks:[{id:"menu",menuItems:[{id:"upload",size:b.MenuItemContentSize.XSmall,title:"Replace with upload",onClick:()=>{x(),v(void 0)},initialValue:!0,decorator:c.jsx("div",{className:"tw-mr-2",children:c.jsx(b.IconArrowCircleUp20,{})})},{id:"asset",size:b.MenuItemContentSize.XSmall,title:"Replace with asset",onClick:()=>{s(),v(void 0)},initialValue:!0,decorator:c.jsx("div",{className:"tw-mr-2",children:c.jsx(b.IconImageStack20,{})})}]},{id:"menu-delete",menuItems:[{id:"delete",size:b.MenuItemContentSize.XSmall,title:"Delete",style:b.MenuItemStyle.Danger,onClick:()=>{i(),v(void 0)},initialValue:!0,decorator:c.jsx("div",{className:"tw-mr-2",children:c.jsx(b.IconTrashBin20,{})})}]}]})})})]})]})});pa.displayName="AttachmentItem";const Tb=e=>{const{attributes:t,listeners:r,setNodeRef:n,transform:a,transition:o,isDragging:l}=ht.useSortable({id:e.item.id}),i={transform:a?`translate(${a.x}px, ${a.y}px)`:"",transition:o,zIndex:l?2:1},s={...t,...r};return c.jsx(pa,{ref:n,isDragging:l,transformStyle:i,draggableProps:s,...e})},Nb=({children:e,isFlyoutOpen:t,triggerProps:r,triggerRef:n})=>c.jsxs("button",{className:n1(["tw-flex tw-text-xs tw-font-body tw-items-center tw-gap-1 tw-rounded-full tw-outline tw-outline-1 tw-outline-offset-1 tw-p-1.5 tw-outline-line",t?"tw-bg-box-neutral-pressed tw-text-box-neutral-inverse-pressed":"tw-bg-base hover:tw-bg-box-neutral-hover active:tw-bg-box-neutral-pressed tw-text-box-neutral-inverse hover:tw-text-box-neutral-inverse-hover active:tw-text-box-neutral-inverse-pressed"]),...r,ref:n,"data-test-id":"attachments-button-trigger",children:[c.jsx(b.IconPaperclip16,{}),e,c.jsx(b.IconCaretDown12,{})]}),Z7=({items:e=[],onDelete:t,onReplaceWithBrowse:r,onReplaceWithUpload:n,onBrowse:a,onUpload:o,onSorted:l,appBridge:i,triggerComponent:s=Nb,isOpen:d,onOpenChange:u})=>{const[f,h]=y.useState(e),[v,x]=y.useState(!1),m=x0.useSensors(x0.useSensor(x0.PointerSensor),x0.useSensor(x0.KeyboardSensor)),[g,_]=y.useState(void 0),[C,A]=y.useState(!1),[M,S]=y.useState([]),[P,N]=y.useState(null),D=V1.useEditorState(i),{openAssetChooser:U,closeAssetChooser:R}=V1.useAssetChooser(i),K=d!==void 0,k=K?d:v,B=f==null?void 0:f.find(z=>z.id===g),[$,{results:q,doneAll:W}]=V1.useAssetUpload({onUploadProgress:()=>!C&&A(!0)}),H=z=>{const V=K?u:x;V==null||V(z)};y.useEffect(()=>{h(e)},[e]),y.useEffect(()=>{P&&(A(!0),$(P))},[P]),y.useEffect(()=>{(async()=>{W&&(await o(q),A(!1))})()},[W,q]);const L=()=>{H(!1),U(z=>{a(z),R(),H(!0)},{multiSelection:!0,selectedValueIds:f.map(z=>z.id)})},I=z=>{H(!1),U(async V=>{H(!0),R(),S([...M,z.id]),await r(z,V[0]),S(M.filter(Y=>Y!==z.id))},{multiSelection:!1,selectedValueIds:f.map(V=>V.id)})},E=async(z,V)=>{S([...M,z.id]),await n(z,V),S(M.filter(Y=>Y!==z.id))},O=z=>{const{active:V}=z;_(V.id)},F=z=>{const{active:V,over:Y}=z;if(Y&&V.id!==Y.id&&f){const Q=f.findIndex(e0=>e0.id===V.id),J=f.findIndex(e0=>e0.id===Y.id),r0=ht.arrayMove(f,Q,J);h(r0),l(r0)}_(void 0)};return D||((f==null?void 0:f.length)??0)>0?c.jsxs(b1.Root,{enterDelay:500,children:[c.jsx(b1.Trigger,{asChild:!0,children:c.jsx("div",{"data-test-id":"attachments-flyout-button",children:c.jsx(b.Flyout,{placement:b.FlyoutPlacement.BottomRight,onOpenChange:z=>H(B?!0:z),isOpen:k,hug:!1,fitContent:!0,legacyFooter:!1,trigger:(z,V)=>c.jsx(s,{isFlyoutOpen:k,triggerProps:z,triggerRef:V,children:c.jsx("div",{children:e.length>0?e.length:"Add"})}),children:c.jsxs("div",{className:"tw-w-[300px]","data-test-id":"attachments-flyout-content",children:[f.length>0&&c.jsxs(x0.DndContext,{sensors:m,collisionDetection:x0.closestCenter,onDragStart:O,onDragEnd:F,modifiers:[ou.restrictToWindowEdges],children:[c.jsx(ht.SortableContext,{items:f,strategy:ht.rectSortingStrategy,children:c.jsx("div",{className:"tw-border-b tw-border-b-line",children:f.map(z=>c.jsx(Tb,{isEditing:D,isLoading:M.includes(z.id),item:z,onDelete:()=>t(z),onReplaceWithBrowse:()=>I(z),onReplaceWithUpload:V=>E(z,V),onDownload:()=>i.dispatch({name:"downloadAsset",payload:z})},z.id))})}),c.jsx(x0.DragOverlay,{children:B&&c.jsx(pa,{isOverlay:!0,isEditing:D,item:B,isDragging:!0,onDelete:()=>t(B),onReplaceWithBrowse:()=>I(B),onReplaceWithUpload:z=>E(B,z)},g)})]}),D&&c.jsxs("div",{className:"tw-px-5 tw-py-3",children:[c.jsx("div",{className:"tw-font-body tw-font-medium tw-text-text tw-text-s tw-my-4",children:"Add attachments"}),c.jsx(b.AssetInput,{isLoading:C,size:b.AssetInputSize.Small,onUploadClick:z=>N(z),onLibraryClick:L})]})]})})})}),c.jsx(b1.Content,{side:"top",children:"Attachments"})]}):null},zb=(e,t)=>{const r=[b.FOCUS_VISIBLE_STYLE,"tw-relative tw-inline-flex tw-items-center tw-justify-center","tw-h-6 tw-p-1","tw-rounded","tw-text-xs tw-font-medium","tw-gap-0.5","focus-visible:tw-z-10"];return t?r.push("tw-bg-box-neutral-pressed","tw-text-box-neutral-inverse-pressed",e==="grab"?"tw-cursor-grabbing":"tw-cursor-pointer"):r.push("hover:tw-bg-box-neutral-hover active:tw-bg-box-neutral-pressed","tw-text-text-weak hover:tw-text-box-neutral-inverse-hover active:tw-text-box-neutral-inverse-pressed",e==="grab"?"!tw-cursor-grab active:tw-cursor-grabbing":"tw-cursor-pointer"),n1(r)},ct=y.forwardRef(({onClick:e,children:t,forceActiveStyle:r,cursor:n="pointer","data-test-id":a="base-toolbar-button",...o},l)=>c.jsx("button",{onClick:e,className:zb(n,r),"data-test-id":a,...o,ref:l,children:t}));ct.displayName="BaseToolbarButton";const Ob=({children:e,isFlyoutOpen:t,triggerProps:r,triggerRef:n})=>c.jsxs(ct,{forceActiveStyle:t,"data-test-id":"attachments-toolbar-button-trigger",...r,ref:n,children:[c.jsx(b.IconPaperclip16,{}),e,c.jsx(b.IconCaretDown12,{})]}),J7="attachments",ed=({flyoutId:e=J7})=>{const t=b.useMemoizedId(e),{appBridge:r,attachments:n,onAttachmentsAdd:a,onAttachmentDelete:o,onAttachmentReplace:l,onAttachmentsSorted:i}=e5(),{isOpen:s,onOpenChange:d}=pt(t),u=He();return c.jsx(Z7,{onUpload:a,onDelete:o,onReplaceWithBrowse:l,onReplaceWithUpload:l,onSorted:i,onBrowse:a,items:n,appBridge:r,triggerComponent:Ob,isOpen:s&&!u,onOpenChange:d})},td="Drag or press ↵ to move",rd="Move with ↑↓←→ and confirm with ↵",va=({content:e,children:t,open:r,disabled:n})=>n?t:c.jsxs(b1.Root,{enterDelay:300,open:r,children:[c.jsx(b1.Trigger,{asChild:!0,children:t}),c.jsx(b1.Content,{side:"top",children:c.jsx("div",{children:e})})]}),nd=({tooltip:e,icon:t,setActivatorNodeRef:r,draggableProps:n})=>{const a=He();return c.jsx(va,{...a&&{open:a},content:c.jsx("div",{children:a?rd:e??td}),children:c.jsx(ct,{ref:r,"data-test-id":"block-item-wrapper-toolbar-btn",forceActiveStyle:a,cursor:"grab",...n,children:t})})},ga=({content:e,icon:t,tooltip:r,flyoutId:n,flyoutFooter:a,flyoutHeader:o})=>{const l=b.useMemoizedId(n),{isOpen:i,onOpenChange:s}=pt(l),d=He();return c.jsx(va,{disabled:d||i,content:r,children:c.jsx("div",{className:"tw-flex tw-flex-shrink-0 tw-flex-1 tw-h-6 tw-relative",children:c.jsx(b.Flyout,{isOpen:i&&!d,legacyFooter:!1,fixedFooter:a,fixedHeader:o,fitContent:!0,hug:!1,placement:b.FlyoutPlacement.BottomRight,onOpenChange:s,trigger:(u,f)=>c.jsx(ct,{"data-test-id":"block-item-wrapper-toolbar-flyout",forceActiveStyle:i&&!d,...u,ref:f,children:t}),children:e})})})},od=({items:e,flyoutId:t})=>{const{onOpenChange:r}=pt(t);return c.jsx(b.ActionMenu,{menuBlocks:e.map((n,a)=>({id:a.toString(),menuItems:n.map((o,l)=>({id:a.toString()+l.toString(),size:b.MenuItemContentSize.XSmall,title:o.title,style:o.style,onClick:()=>{r(!1),o.onClick()},initialValue:!0,decorator:c.jsx("div",{className:"tw-mr-2",children:o.icon})}))}))})},ma="menu",ad=({items:e,flyoutId:t=ma,tooltip:r="Options"})=>{const n=b.useMemoizedId(t);return c.jsx(ga,{icon:c.jsx(b.IconDotsHorizontal16,{}),tooltip:r,flyoutId:n,content:c.jsx(od,{items:e,flyoutId:n})})},Db=({tooltip:e,icon:t,onClick:r})=>{const n=He();return c.jsx(va,{disabled:n,content:e??"",children:c.jsx(ct,{"data-test-id":"block-item-wrapper-toolbar-btn",onClick:r,children:t})})},ld=({children:e})=>c.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:e}),id=({items:e,attachments:t})=>c.jsxs("div",{"data-test-id":"block-item-wrapper-toolbar",className:"tw-rounded-md tw-bg-base tw-border tw-border-line-strong tw-divide-x tw-divide-line-strong tw-shadow-lg tw-flex tw-flex-none tw-items-center tw-isolate",children:[t.isEnabled&&c.jsx(ld,{children:c.jsx(ed,{})}),e.length>0&&c.jsx(ld,{children:e.map(r=>{switch(r.type){case"dragHandle":return c.jsx(nd,{...r},r.tooltip+r.type);case"menu":return c.jsx(ad,{...r},r.tooltip+r.type);case"flyout":return c.jsx(ga,{...r},r.tooltip+r.type);default:return c.jsx(Db,{...r},r.tooltip+r.type)}})})]}),sd=y.memo(({children:e,toolbarItems:t,shouldHideWrapper:r,shouldHideComponent:n=!1,isDragging:a=!1,shouldFillContainer:o,outlineOffset:l=0,shouldBeShown:i=!1,showAttachments:s=!1})=>{const[d,u]=y.useState(i?[ma]:[]),f=y.useRef(null);if(r)return c.jsx(c.Fragment,{children:e});const h=t==null?void 0:t.filter(x=>x!==void 0),v=d.length>0||i;return c.jsx(Ga,{isDragPreview:a,children:c.jsx(Ya,{openFlyoutIds:d,setOpenFlyoutIds:u,children:c.jsxs("div",{ref:f,"data-test-id":"block-item-wrapper",style:{outlineOffset:l},className:n1(["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",v&&"tw-outline",n&&"tw-opacity-0"]),children:[c.jsx("div",{style:{right:-1-l,bottom:`calc(100% - ${2+l}px)`},className:n1(["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",v&&"tw-opacity-100"]),children:c.jsx(id,{attachments:{isEnabled:s},items:h})}),e]})})})});sd.displayName="BlockItemWrapper";const Hb=({onDownload:e})=>{const{isFocused:t,focusProps:r}=$a.useFocusRing();return c.jsxs(b1.Root,{enterDelay:500,children:[c.jsx(b1.Trigger,{asChild:!0,children:c.jsx("button",{tabIndex:0,"aria-label":"Download",...r,className:n1(["tw-outline-none tw-rounded",t&&b.FOCUS_STYLE]),onClick:e,onPointerDown:n=>n.preventDefault(),children:c.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:c.jsx(b.IconArrowCircleDown16,{})})})}),c.jsx(b1.Content,{side:"top",children:"Download"})]})},Vb=({ref:e,disabled:t,onChange:r})=>{y.useEffect(()=>{if(t||!e.current)return;let n=!1;const a=new IntersectionObserver(([o])=>{o.isIntersecting!==n&&(n=o.isIntersecting,r(o.isIntersecting))});return a.observe(e.current),()=>{a.disconnect()}},[e,t,r])},Lb=({value:e="",gap:t,customClass:r,show:n=!0,plugins:a})=>{const[o,l]=y.useState(null);return y.useEffect(()=>{(async()=>l(await b.serializeRawToHtmlAsync(e,a,void 0,t,r)))()},[e,t,a,r]),!n||o==="<br />"?null:o!==null?c.jsx("div",{className:"tw-w-full tw-whitespace-pre-wrap","data-test-id":"rte-content-html",dangerouslySetInnerHTML:{__html:o}}):c.jsx("div",{className:"tw-rounded-sm tw-bg-base-alt tw-animate-pulse tw-h-full tw-min-h-[10px] tw-w-full"})},ba=b.createStore("floatingButton")({openEditorId:null,mouseDown:!1,updated:!1,url:"",text:"",buttonStyle:"primary",newTab:!1,mode:"",isEditing:!1}).extendActions(e=>({reset:()=>{e.url(""),e.text(""),e.buttonStyle("primary"),e.newTab(!1),e.mode(""),e.isEditing(!1)}})).extendActions(e=>({show:(t,r)=>{e.mode(t),e.isEditing(!1),e.openEditorId(r)},hide:()=>{e.reset(),e.openEditorId(null)}})).extendSelectors(e=>({isOpen:t=>e.openEditorId===t})),S0=ba.set,T0=ba.get,dt=()=>ba.use,cd=e=>{if(!e)return!1;const t=r=>r.some(n=>n.text?n.text!=="":n.children?t(n.children):!1);try{const r=JSON.parse(e);return t(r)}catch{return!1}},$b=(e="p",t="",r)=>cd(t)?t:JSON.stringify([{type:e,children:[{text:t,textStyle:e}],align:r}]),Bb=(e,t,r)=>e===R1.Custom?t:r,Fb=e=>e.map(dd),dd=e=>({id:e.id,title:e.name,colors:e.colors.map(Ub)}),Rb=e=>"revision"in e,Ub=e=>{if(Rb(e)){const{title:t,revision:r}=e;return{alpha:r.rgba.alpha?r.rgba.alpha/255:1,red:r.rgba.red??0,green:r.rgba.green??0,blue:r.rgba.blue??0,name:t??""}}return{alpha:e.alpha?e.alpha/255:1,red:e.red??0,green:e.green??0,blue:e.blue??0,name:e.name??""}},wa=(e,t)=>{const r=b.getAboveNode(e,{match:{type:b.ELEMENT_LINK}});return Array.isArray(r)?t(r[0]):""},Wb=e=>wa(e,t=>{var r,n;return((n=(r=t.chosenLink)==null?void 0:r.searchResult)==null?void 0:n.link)||""}),Kb=e=>wa(e,t=>t.url||""),ya=e=>{var t,r;return e.url||((r=(t=e.chosenLink)==null?void 0:t.searchResult)==null?void 0:r.link)||""},jb=e=>wa(e,ya),Ca=/^\/(document|r)\/\S+$/i,Er=e=>{if(Ca.test(e))return e;try{return new URL(e),e}catch{return`https://${e}`}},Ir=e=>{if(Ca.test(e))return!0;try{const t=new URL(e);return["http:","https:","mailto:","tel:"].includes(t.protocol)&&t.pathname!==""}catch{return!1}},ke=e=>Ir(Er(e))||e==="",ud=(e,{type:t})=>{const{apply:r,normalizeNode:n}=e;return e.apply=a=>{if(a.type!=="set_selection"){r(a);return}const o=a.newProperties;if(!(o!=null&&o.focus)||!o.anchor||!b.isCollapsed(o)){r(a);return}const l=b.getAboveNode(e,{at:o,match:{type:b.getPluginType(e,m0)}});if(l){const[,i]=l;let s;b.isStartPoint(e,o.focus,i)&&(s=b.getPreviousNodeEndPoint(e,i)),b.isEndPoint(e,o.focus,i)&&(s=b.getNextNodeStartPoint(e,i)),s&&(a.newProperties={anchor:s,focus:s})}r(a)},e.normalizeNode=([a,o])=>{if(a.type===b.getPluginType(e,m0)){const l=e.selection;if(l&&b.isCollapsed(l)&&b.isEndPoint(e,l.focus,o)){const i=b.getNextNodeStartPoint(e,o);if(i)b.select(e,i);else{const s=b.Path.next(o);b.insertNodes(e,{text:""},{at:s}),b.select(e,s)}}}n([a,o])},b.withRemoveEmptyNodes(e,b.mockPlugin({options:{types:t}}))},fd=(e,t,r)=>{b.insertNodes(e,[gd(e,t)],r)},xa=e=>{if(!e.selection)return;const{isUrl:t,forceSubmit:r}=b.getPluginOptions(e,m0),n=T0.url();if(!((t==null?void 0:t(n))||r))return;const o=T0.text(),l=T0.buttonStyle(),i=T0.newTab()?void 0:"_self";return S0.reset(),hd(e,{url:n,text:o,buttonStyle:l,target:i,isUrl:s=>r||!t?!0:t(s)}),setTimeout(()=>{b.focusEditor(e,e.selection??void 0)},0),!0},Te=(e,t)=>b.withoutNormalizing(e,()=>{var r,n,a,o,l,i;if(t!=null&&t.split){if(b.getAboveNode(e,{at:(r=e.selection)==null?void 0:r.anchor,match:{type:b.getPluginType(e,m0)}}))return b.splitNodes(e,{at:(n=e.selection)==null?void 0:n.anchor,match:u=>b.isElement(u)&&u.type===b.getPluginType(e,m0)}),Te(e,{at:(a=e.selection)==null?void 0:a.anchor}),!0;if(b.getAboveNode(e,{at:(o=e.selection)==null?void 0:o.focus,match:{type:b.getPluginType(e,m0)}}))return b.splitNodes(e,{at:(l=e.selection)==null?void 0:l.focus,match:u=>b.isElement(u)&&u.type===b.getPluginType(e,m0)}),Te(e,{at:(i=e.selection)==null?void 0:i.focus}),!0}b.unwrapNodes(e,{match:{type:b.getPluginType(e,m0)},...t})}),hd=(e,{url:t,text:r,buttonStyle:n,target:a,insertTextInButton:o,insertNodesOptions:l,isUrl:i=b.getPluginOptions(e,m0).isUrl})=>{var _;const s=e.selection;if(!s)return;const d=b.getAboveNode(e,{at:s,match:{type:b.getPluginType(e,m0)}});if(o&&d)return e.insertText(t),!0;if(!(i!=null&&i(t)))return;if(b.isDefined(r)&&r.length===0&&(r=t),d)return Yb(t,e,d,a,n,r),!0;const u=b.findNode(e,{at:s,match:{type:b.getPluginType(e,m0)}}),[f,h]=u??[],v=Gb(e,h,r);if(b.isExpanded(s))return qb(d,e,t,n,a,r),!0;v&&b.removeNodes(e,{at:h});const x=b.getNodeProps(f??{}),m=(_=e.selection)==null?void 0:_.focus.path;if(!m)return;const g=b.getNodeLeaf(e,m);return r!=null&&r.length||(r=t),fd(e,{...x,url:t,target:a,children:[{...g,text:r}]},l),!0};function Gb(e,t,r){return t&&(r==null?void 0:r.length)&&r!==b.getEditorString(e,t)}function qb(e,t,r,n,a,o){e?Te(t,{at:e[1]}):Te(t,{split:!0}),pd(t,{url:r,buttonStyle:n,target:a}),_a(t,{url:r,target:a,text:o})}function Yb(e,t,r,n,a,o){var l,i,s;(e!==((l=r[0])==null?void 0:l.url)||n!==((i=r[0])==null?void 0:i.target)||a!==((s=r[0])==null?void 0:s.buttonStyle))&&b.setNodes(t,{url:e,target:n,buttonStyle:a},{at:r[1]}),_a(t,{url:e,text:o,target:n})}const _a=(e,{text:t})=>{const r=b.getAboveNode(e,{match:{type:b.getPluginType(e,m0)}});if(r){const[n,a]=r;if(t!=null&&t.length&&t!==b.getEditorString(e,a)){const o=n.children[0];b.replaceNodeChildren(e,{at:a,nodes:{...o,text:t},insertOptions:{select:!0}})}}},pd=(e,{url:t,buttonStyle:r,target:n,...a})=>{b.wrapNodes(e,{type:b.getPluginType(e,m0),url:t,buttonStyle:r,target:n,children:[]},{split:!0,...a})},Xb=(e,t)=>{const r=b.getAboveNode(e,{match:{type:m0}});return Array.isArray(r)?t(r[0]):""},vd=e=>Xb(e,t=>t.url??""),gd=(e,{url:t,text:r="",buttonStyle:n="primary",target:a,children:o})=>({type:b.getPluginType(e,m0),url:t,target:a,buttonStyle:n,children:o??[{text:r}]}),md=(e,{focused:t}={})=>{if(T0.mode()==="edit"){Pr(e);return}Ma(e,{focused:t})},Pr=e=>{const t=b.findNode(e,{match:{type:b.getPluginType(e,m0)}});if(!t)return;const[r,n]=t;let a=b.getEditorString(e,n);S0.url(r.url),S0.newTab(r.target===void 0),a===r.url&&(a=""),S0.text(a),S0.isEditing(!0)},Ma=(e,{focused:t}={})=>{T0.mode()||!t||b.isRangeAcrossBlocks(e,{at:e.selection})||b.someNode(e,{match:{type:b.getPluginType(e,m0)}})||(S0.text(b.getEditorString(e,e.selection)),S0.show("insert",e.id))},Aa={marginTop:"10px",marginBottom:"10px",display:"inline-block",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%",verticalAlign:"middle",boxSizing:"border-box",overflowWrap:"normal"},kr={buttonPrimary:{...Aa,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)",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:{...Aa,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)",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:{...Aa,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)",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)"}}},Qb=e=>{var l,i;const{attributes:t,children:r}=e,n=e.element.url||((i=(l=e.element.chosenLink)==null?void 0:l.searchResult)==null?void 0:i.link)||"",a=e.element.target||"_self",o=String(e.element.buttonStyle)||"primary";return c.jsx(Zb,{attributes:t,href:n,target:a,styles:kr[`button${o.charAt(0).toUpperCase()+o.slice(1)}`],children:r})},Zb=({attributes:e,styles:t={hover:{}},children:r,href:n="#",target:a})=>{const[o,l]=y.useState(!1);return c.jsx("a",{...e,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),href:n,target:a,style:o?{...t,...t.hover}:t,children:r})};class Jb extends b.MarkupElement{constructor(t=m0,r=Qb){super(t,r)}}const bd=y.forwardRef((e,t)=>{const r=b.useEditorRef();return c.jsx(b.ToolbarButton,{ref:t,...e,onMouseDown:n=>{n.preventDefault(),b.focusEditor(r,r.selection??r.prevSelection??void 0)},onClick:()=>{md(r,{focused:!0})},children:c.jsx(b.IconStylingWrapper,{icon:c.jsx(b.IconButton16,{})})})});bd.displayName="ButtonToolbarButton";const ew=({editorId:e,id:t})=>{const r=b.useEditorState(b.useEventPlateId(e)),n=!!b.isRangeInSameBlock(r,{at:r.selection}),a=b.getPluginType(r,m0),o=!!(r!=null&&r.selection)&&b.someNode(r,{match:{type:a}});return c.jsx("div",{"data-plugin-id":t,children:c.jsx(bd,{pressed:o,disabled:!n,tooltip:b.getTooltip(n?`Button
|
|
86
|
-
${b.getHotkeyByPlatform("Ctrl+Shift+K")}`:"Buttons can only be set for a single text block.")})})},Ne="link-plugin";var c0=(e=>(e.heading1="heading1",e.heading2="heading2",e.heading3="heading3",e.heading4="heading4",e.custom1="custom1",e.custom2="custom2",e.custom3="custom3",e.quote="quote",e.imageCaption="imageCaption",e.imageTitle="imageTitle",e.p="p",e))(c0||{});const C0={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)"},[Ne]:{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)"},...kr},tw=()=>{const e=b.useEditorRef();return c.jsx(b.FloatingModalWrapper,{padding:"16px",minWidth:"400px","data-test-id":"floating-button-edit",children:c.jsxs("span",{"data-test-id":"preview-button-flyout",className:"tw-flex tw-justify-between tw-items-center tw-gap-2",children:[c.jsx("a",{"data-test-id":"floating-button-edit-url",href:T0.url(),target:"_blank",rel:"noopener noreferrer",style:C0[Ne],className:"tw-break-all",children:T0.url()}),c.jsxs("span",{className:"tw-flex tw-gap-2",children:[c.jsx("button",{onClick:()=>{Pr(e)},tabIndex:0,"data-test-id":"edit-button-button",className:"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1",children:c.jsx(b.IconPen16,{})}),c.jsx("button",{onClick:()=>{Te(e),b.focusEditor(e,e.selection??void 0)},tabIndex:0,"data-test-id":"remove-button-button",className:"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1",children:c.jsx(b.IconTrashBin16,{})})]})]})})},wd=e=>e.filter(t=>{var r;return!!((r=t.title)!=null&&r.trim())}),yd=()=>c.jsx("div",{className:"tw-flex tw-justify-center tw-h-10 tw-items-center",children:c.jsx(b.LoadingCircle,{size:b.LoadingCircleSize.Small})}),rw=({section:e,selectedUrl:t,onSelectUrl:r})=>{const n=e.permanentLink===t;return c.jsx("button",{"data-test-id":"internal-link-selector-section-link",className:b.merge(["tw-py-2 tw-pr-2.5 tw-pl-14 tw-leading-5 tw-cursor-pointer tw-w-full",n?"tw-bg-box-selected-strong tw-text-box-selected-strong-inverse hover:tw-bg-box-selected-strong-hover:hover hover:tw-text-box-selected-strong-inverse-hover:hover":"hover:tw-bg-box-neutral-hover hover:tw-text-box-neutral-inverse-hover"]),onClick:()=>r(e.permanentLink),children:c.jsxs("div",{className:"tw-flex tw-flex-1 tw-space-x-2 tw-items-center tw-h-6",children:[c.jsx(b.IconDocumentText16,{}),c.jsx("span",{className:"tw-text-s",children:e.title}),c.jsx("span",{className:"tw-flex-auto tw-font-sans tw-text-xs tw-text-right",children:"Section"})]})})},nw=({page:e,selectedUrl:t,onSelectUrl:r,itemsToExpandInitially:n,getDocumentSectionsByDocumentPageId:a})=>{const[o,l]=y.useState(e.id===n.documentId),[i,s]=y.useState([]),d=e.permanentLink===t;y.useEffect(()=>{(async()=>{const h=await a(e.id),v=wd(h);s(v)})()},[e.id,a]),y.useEffect(()=>{e.id===n.pageId&&l(!0)},[n,e.id]);const u=i.length>0;return c.jsxs(c.Fragment,{children:[c.jsx("button",{"data-test-id":"internal-link-selector-page-link",className:b.merge(["tw-py-2 tw-pr-2.5 tw-leading-5 tw-cursor-pointer tw-flex tw-w-full",u?"tw-pl-7":"tw-pl-12",d?"tw-bg-box-selected-strong tw-text-box-selected-strong-inverse hover:tw-bg-box-selected-strong-hover:hover hover:tw-text-box-selected-strong-inverse-hover:hover":"hover:tw-bg-box-neutral-hover hover:tw-text-box-neutral-inverse-hover"]),onClick:()=>r(e.permanentLink),children:c.jsxs("div",{className:"tw-flex tw-flex-1 tw-space-x-1 tw-items-center tw-h-6",children:[u&&c.jsx("button",{"data-test-id":"tree-item-toggle",className:"tw-flex tw-items-center tw-justify-center -tw-mr-2 tw-pr-3.5 tw-pt-1.5 tw-pb-1.5 tw-pl-3.5 tw-cursor-pointer",onClick:()=>l(!o),children:c.jsx("div",{className:b.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":""])})}),c.jsx("span",{className:"tw-text-s",children:e.title}),c.jsx("span",{className:"tw-flex-auto tw-font-sans tw-text-xs tw-text-right",children:"Page"})]},e.id)}),o&&i.length>0&&i.map(f=>c.jsx(rw,{section:f,selectedUrl:t,onSelectUrl:r},f.id))]})},ow=({documentId:e,selectedUrl:t,onSelectUrl:r,itemsToExpandInitially:n,getDocumentSectionsByDocumentPageId:a,getDocumentPagesByDocumentId:o})=>{const[l,i]=y.useState([]),[s,d]=y.useState(!0),u=[...l.values()],f=!s&&u.length>0;return y.useEffect(()=>{o(e).then(h=>{const v=h.filter(m=>!!m.category).sort((m,g)=>m.category.sort===g.category.sort?m.sort-g.sort:m.category.sort-g.category.sort),x=h.filter(m=>!m.category).sort((m,g)=>m.sort-g.sort);i([...v,...x])}).finally(()=>{d(!1)})},[]),s?c.jsx(yd,{}):f?c.jsx(c.Fragment,{children:u.map(h=>c.jsx(nw,{page:h,selectedUrl:t,onSelectUrl:r,itemsToExpandInitially:n,getDocumentSectionsByDocumentPageId:a},h.id))}):c.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."})},aw=({document:e,selectedUrl:t,onSelectUrl:r,itemsToExpandInitially:n,getDocumentSectionsByDocumentPageId:a,getDocumentPagesByDocumentId:o})=>{const[l,i]=y.useState(e.id===n.documentId),s=e.permanentLink===t;return y.useEffect(()=>{e.id===n.documentId&&i(!0)},[n,e.id]),c.jsxs(c.Fragment,{children:[c.jsxs("button",{"data-test-id":"internal-link-selector-document-link",className:b.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",s?"tw-bg-box-selected-strong tw-text-box-selected-strong-inverse hover:tw-bg-box-selected-strong-hover:hover hover:tw-text-box-selected-strong-inverse-hover:hover":"hover:tw-bg-box-neutral-hover hover:tw-text-box-neutral-inverse-hover"]),onClick:()=>r(e.permanentLink),children:[c.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:()=>i(!l),children:c.jsx("div",{className:b.merge(["tw-transition-transform tw-w-0 tw-h-0 tw-font-normal tw-border-t-4 tw-border-t-transparent tw-border-b-4 tw-border-b-transparent tw-border-l-4 tw-border-l-x-strong",l?"tw-rotate-90":""])})}),c.jsx(b.IconColorFan16,{}),c.jsx("span",{className:"tw-text-s",children:e.title}),c.jsx("span",{className:"tw-flex-auto tw-font-sans tw-text-xs tw-text-right",children:"Document"})]}),l&&c.jsx(ow,{documentId:e.id,selectedUrl:t,onSelectUrl:r,itemsToExpandInitially:n,getDocumentSectionsByDocumentPageId:a,getDocumentPagesByDocumentId:o})]})},lw=({selectedUrl:e,onSelectUrl:t,getAllDocuments:r,getDocumentPagesByDocumentId:n,getDocumentSectionsByDocumentPageId:a})=>{const[o,l]=y.useState(!0),[i,s]=y.useState([]),[d,u]=y.useState({documentId:void 0,pageId:void 0});y.useEffect(()=>{e&&i.length>0&&f().then(h=>{u(h)})},[i.length]),y.useEffect(()=>{r().then(h=>{s(h)}).finally(()=>{l(!1)})},[]);const f=async()=>{const h={documentId:void 0,pageId:void 0};if(i.find(x=>x.permanentLink===e))return h;for(const x of i){const m=await n(x.id);if(!!m.find(_=>_.permanentLink===e))return h.documentId=x.id,h;for(const _ of m){const C=await a(_.id);if(!!wd(C).find(S=>S.permanentLink===e))return h.documentId=x.id,h.pageId=_.id,h}}return h};return o?c.jsx(yd,{}):c.jsx(c.Fragment,{children:i.map(h=>c.jsx(aw,{document:h,selectedUrl:e,onSelectUrl:t,itemsToExpandInitially:d,getDocumentSectionsByDocumentPageId:a,getDocumentPagesByDocumentId:n},h.id))})},Cd=({url:e,onUrlChange:t,buttonSize:r=b.ButtonSize.Medium,getAllDocuments:n,getDocumentPagesByDocumentId:a,getDocumentSectionsByDocumentPageId:o})=>{const{open:l,isOpen:i,close:s}=au.useOverlayTriggerState({}),[d,u]=y.useState(e),f=x=>{u(x)},h=x=>{x.key==="Enter"&&v()};y.useEffect(()=>{e&&!d&&u(e)},[e,d]);const v=()=>{t==null||t(d),s()};return c.jsxs("div",{onPointerDown:x=>x.preventDefault(),"data-test-id":"internal-link-selector",onKeyDown:h,children:[c.jsx(b.Button,{icon:c.jsx(b.IconLink,{}),size:r,type:b.ButtonType.Button,style:b.ButtonStyle.Default,emphasis:b.ButtonEmphasis.Default,onClick:()=>l(),children:"Internal link"}),c.jsxs(b.Modal,{zIndex:1001,onClose:()=>s(),isOpen:i,isDismissable:!0,children:[c.jsx(b.Modal.Header,{title:"Select internal link"}),c.jsx(b.Modal.Body,{children:c.jsx(lw,{selectedUrl:d,onSelectUrl:f,getAllDocuments:n,getDocumentPagesByDocumentId:a,getDocumentSectionsByDocumentPageId:o})}),c.jsx(b.Modal.Footer,{buttons:[{children:"Cancel",onClick:()=>s(),style:b.ButtonStyle.Default,emphasis:b.ButtonEmphasis.Default},{children:"Choose",onClick:x=>{x==null||x.preventDefault(),v()},style:b.ButtonStyle.Default,emphasis:b.ButtonEmphasis.Strong,disabled:!d}]})]})]})},xd=({onUrlChange:e,onToggleTab:t,isValidUrlOrEmpty:r,appBridge:n,clearable:a,placeholder:o,newTab:l,openInNewTab:i,url:s="",required:d,info:u,label:f,buttonSize:h,hideInternalLinkButton:v})=>{const x=r?r(s):ke(s),m=l??(i?b.CheckboxState.Checked:b.CheckboxState.Unchecked);return c.jsxs("div",{"data-test-id":"link-input",children:[c.jsx(b.FormControl,{label:{children:f,htmlFor:"url",required:d,tooltip:u?{content:u,position:b.TooltipPosition.Top}:void 0},children:c.jsx(b.TextInput,{id:"url",value:s,clearable:a,onChange:e,placeholder:o??"https://example.com",focusOnMount:!0})}),!x&&c.jsx("div",{className:"tw-text-text-negative tw-mt-1 tw-text-s",children:"Please enter a valid URL."}),!v&&c.jsx("div",{className:"tw-mt-3",children:c.jsx(Cd,{url:s,onUrlChange:e,buttonSize:h??b.ButtonSize.Medium,getAllDocuments:()=>n.getAllDocuments(),getDocumentPagesByDocumentId:g=>n.getDocumentPagesByDocumentId(g),getDocumentSectionsByDocumentPageId:g=>n.getDocumentSectionsByDocumentPageId(g)})}),c.jsx("div",{className:"tw-mt-3",children:c.jsx(b.Checkbox,{value:"new-tab",label:"Open in new tab",state:m,onChange:t})})]})},_d=({state:e,onTextChange:t,onUrlChange:r,onToggleTab:n,onCancel:a,onSave:o,isValidUrlOrEmpty:l,hasValues:i,testId:s,appBridge:d,children:u})=>c.jsxs(b.FloatingModalWrapper,{"data-test-id":s,padding:"28px",minWidth:"400px",children:[c.jsx(b.FormControl,{label:{children:"Text",htmlFor:"linkText",required:!0},children:c.jsx(b.TextInput,{id:"linkText",value:e.text,placeholder:"Link Text",onChange:t})}),u,c.jsx("div",{className:"tw-mt-5",children:c.jsx(xd,{url:e.url,newTab:e.newTab,onUrlChange:r,onToggleTab:n,isValidUrlOrEmpty:l,appBridge:d})}),c.jsx("div",{className:"tw-mt-3",children:c.jsxs("div",{className:"tw-pt-5 tw-flex tw-gap-x-3 tw-justify-end tw-border-t tw-border-t-black-10",children:[c.jsx(b.Button,{onClick:a,size:b.ButtonSize.Medium,style:b.ButtonStyle.Default,emphasis:b.ButtonEmphasis.Default,children:"Cancel"}),c.jsx(b.Button,{onClick:o,size:b.ButtonSize.Medium,icon:c.jsx(b.IconCheckMark20,{}),disabled:!l(e==null?void 0:e.url)||!i,children:"Save"})]})})]}),iw=e=>{var r;const t=b.getAboveNode(e,{match:{type:m0}});return Array.isArray(t)&&((r=t[0])==null?void 0:r.buttonStyle)||"primary"},sw={url:"",text:"",buttonStyle:"primary",newTab:b.CheckboxState.Unchecked},cw=()=>{const[e,t]=y.useReducer((r,n)=>{const{type:a,payload:o}=n;switch(a){case"NEW_TAB":return{...r,newTab:b.CheckboxState.Checked};case"SAME_TAB":return{...r,newTab:b.CheckboxState.Unchecked};case"URL":case"TEXT":case"BUTTON_STYLE":case"INIT":return{...r,...o};default:return r}},sw);return[e,t]},dw=()=>{const e=b.useEditorRef(),[t,r]=cw();y.useEffect(()=>{const f=iw(e);r({type:"INIT",payload:{text:T0.text()||T0.url(),buttonStyle:f,newTab:T0.newTab()?b.CheckboxState.Checked:b.CheckboxState.Unchecked,url:T0.url()}})},[r,e]);const n=f=>{r({type:"TEXT",payload:{text:f}})},a=f=>{r({type:"BUTTON_STYLE",payload:{buttonStyle:f}})},o=f=>{r({type:"URL",payload:{url:f}})},l=f=>{r(f?{type:"NEW_TAB"}:{type:"SAME_TAB"})},i=()=>{S0.reset()},s=f=>{if(!ke(t.url)||!d)return;const h=Er(t.url);S0.text(t.text),S0.url(h),S0.buttonStyle(t.buttonStyle),S0.newTab(t.newTab===b.CheckboxState.Checked),xa(e)&&(f==null||f.preventDefault())},d=t.url!==""&&t.text!=="",{appBridge:u}=b.getPluginOptions(e,m0);return b.useHotkeys("enter",s,{enableOnFormTags:["INPUT"]},[]),{state:t,onTextChange:n,onButtonStyleChange:a,onUrlChange:o,onToggleTab:l,onCancel:i,onSave:s,hasValues:d,isValidUrlOrEmpty:ke,appBridge:u}},uw=()=>{const e=dw(),{state:t,onButtonStyleChange:r}=e;return c.jsx(_d,{...e,testId:"floating-button-insert",children:c.jsx("div",{className:"tw-pt-5",children:c.jsxs(b.FormControl,{label:{children:"Button Style",htmlFor:"buttonStyle",required:!0},children:[c.jsx(Sa,{id:"primary",styles:C0.buttonPrimary,isActive:t.buttonStyle==="primary",onClick:()=>r("primary"),children:t.text||"Primary Button"}),c.jsx(Sa,{id:"secondary",styles:C0.buttonSecondary,isActive:t.buttonStyle==="secondary",onClick:()=>r("secondary"),children:t.text||"Secondary Button"}),c.jsx(Sa,{id:"tertiary",styles:C0.buttonTertiary,isActive:t.buttonStyle==="tertiary",onClick:()=>r("tertiary"),children:t.text||"Tertiary Button"})]})})})},Sa=({id:e,styles:t,isActive:r,onClick:n,children:a})=>{const[o,l]=y.useState(!1),i=()=>t&&t.hover&&o?{...t,...t.hover}:t;return c.jsx("button",{"data-test-id":`floating-button-insert-${e}`,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),onClick:n,style:{...i(),marginTop:0,marginBottom:0},className:r?"tw-outline tw-outline-1 tw-outline-violet-60 tw-outline-offset-2 tw-w-fit":"tw-w-fit",children:a})},Md={placement:"bottom-start",strategy:"absolute",middleware:[b.offset(12),b.flip({padding:12,fallbackPlacements:["bottom-end","top-start","top-end"]})]},fw=()=>{const{ref:e,...t}=vw(Md),{ref:r,...n}=hw(Md),a=b.useEditorRef(),o=dt(),l=o.isOpen(a.id),i=o.isEditing(),s=o.mode(),d=c.jsx(uw,{}),u=i?d:c.jsx(tw,{});return c.jsxs(c.Fragment,{children:[l&&s==="insert"&&ee.createPortal(c.jsx("div",{"data-is-underlay":!0,ref:e,...t,style:{...t.style,...C0[b.TextStyles.p]},children:d}),document.body),l&&s==="edit"&&ee.createPortal(c.jsx("div",{"data-is-underlay":!0,ref:r,...n,style:{...n.style,...C0[b.TextStyles.p]},children:u}),document.body)]})},m0="button",Ad="button-plugin",Sd=e=>b.createPluginFactory({key:m0,isElement:!0,isInline:!0,props:({element:t})=>({nodeProps:{href:t==null?void 0:t.url,target:t==null?void 0:t.target}}),withOverrides:ud,renderAfterEditable:fw,options:{isUrl:Ir,rangeBeforeOptions:{matchString:" ",skipInvalid:!0,afterMatch:!0},triggerFloatingButtonHotkeys:"command+shift+k, ctrl+shift+k",appBridge:e},then:(t,{type:r})=>({deserializeHtml:{rules:[{validNodeName:"A",validClassName:"btn"}],getNode:n=>({type:r,url:n.getAttribute("href"),target:n.getAttribute("target")||"_blank"})}})})();class Ed extends b.Plugin{constructor({styles:r=kr,...n}){super(Ad,{button:ew,markupElement:new Jb,...n});E0(this,"styles",{});E0(this,"appBridge");this.styles=r,this.appBridge=n==null?void 0:n.appBridge}plugins(){return[Sd(this.appBridge)]}}const hw=e=>{const t=b.useEditorRef(),r=dt().mode(),n=dt().isOpen(t.id),a=b.useEditorVersion(),{triggerFloatingButtonHotkeys:o}=b.getPluginOptions(t,m0),l=y.useCallback(()=>{const f=b.getAboveNode(t,{match:{type:b.getPluginType(t,m0)}});if(f){const[,h]=f;return b.getRangeBoundingClientRect(t,{anchor:b.getStartPoint(t,h),focus:b.getEndPoint(t,h)})}return b.getDefaultBoundingClientRect()},[t]),i=n&&r==="edit",{update:s,style:d,floating:u}=Pd({open:i,getBoundingClientRect:l,...e});return y.useEffect(()=>{const f=vd(t);if(f&&S0.url(f),t.selection&&b.someNode(t,{match:{type:b.getPluginType(t,m0)}})){S0.show("edit",t.id),s();return}T0.mode()==="edit"&&S0.reset()},[t,a,s]),b.useHotkeys(o,f=>{f.preventDefault(),T0.mode()==="edit"&&Pr(t)},{enableOnContentEditable:!0},[]),pw(),Id(),{style:{...d,zIndex:1e3},ref:b.useComposedRef(u)}},pw=()=>{const e=b.useEditorRef();b.useHotkeys("*",t=>{t.key==="Enter"&&xa(e)&&t.preventDefault()},{enableOnFormTags:["INPUT"]},[])},Id=()=>{const e=b.useEditorRef();b.useHotkeys("escape",()=>{if(T0.mode()==="edit"){if(T0.isEditing()){S0.show("edit",e.id),b.focusEditor(e,e.selection??void 0);return}S0.reset()}},{enableOnFormTags:["INPUT"],enableOnContentEditable:!0},[])},vw=e=>{const t=b.useEditorRef(),r=b.useFocused(),n=dt().mode(),a=dt().isOpen(t.id),{triggerFloatingButtonHotkeys:o}=b.getPluginOptions(t,m0);b.useHotkeys(o,d=>{d.preventDefault(),Ma(t,{focused:r})},{enableOnContentEditable:!0},[r]);const{update:l,style:i,floating:s}=Pd({open:a&&n==="insert",getBoundingClientRect:b.getSelectionBoundingClientRect,whileElementsMounted:void 0,...e});return y.useEffect(()=>{a&&l(),S0.updated(a)},[a,l]),Id(),{style:{...i,zIndex:1e3},ref:b.useComposedRef(s)}},gw=12,mw=-22,bw=96,Pd=e=>b.useVirtualFloating({placement:"bottom-start",middleware:[b.offset({mainAxis:gw,alignmentAxis:mw}),b.flip({padding:bw})],...e}),Ea="[&_.tw-break-after-column]:tw-break-after-auto [&_.tw-break-inside-avoid-column]:tw-break-inside-auto [&_.tw-break-after-column.tw-pb-5]:tw-pb-0 @md:[&_.tw-break-after-column.tw-pb-5]:!tw-pb-5 @md:[&_.tw-break-after-column]:!tw-break-after-column @md:[&_.tw-break-inside-avoid-column]:!tw-break-inside-avoid-column",kd={1:"tw-columns-1",2:"tw-columns-1 @sm:!tw-columns-2 [&_.tw-break-after-column]:tw-break-after-auto [&_.tw-break-inside-avoid-column]:tw-break-inside-auto [&_.tw-break-after-column.tw-pb-5]:tw-pb-0 @sm:[&_.tw-break-after-column.tw-pb-5]:!tw-pb-5 @sm:[&_.tw-break-after-column]:!tw-break-after-column @sm:[&_.tw-break-inside-avoid-column]:!tw-break-inside-avoid-column",3:`tw-columns-1 @md:!tw-columns-3 ${Ea}`,4:`tw-columns-1 @md:!tw-columns-4 ${Ea}`,5:`tw-columns-1 @md:!tw-columns-5 ${Ea}`},Td=e=>e?kd[e]||kd[1]:"",Nd=y.memo(({id:e="rte",isEnabled:t,value:r,columns:n,gap:a,placeholder:o,plugins:l,onTextChange:i,showSerializedText:s})=>{const d=Td(n),[u,f]=y.useState(!1),h=y.useCallback(m=>{m!==r&&(i==null||i(m)),f(!1)},[i,r]),v=y.useCallback(()=>f(!0),[]),x=y.useCallback(m=>{T0.isOpen(m)&&S0.reset()},[]);return y.useEffect(()=>{const m=g=>{g.preventDefault(),g.returnValue="Unprocessed changes"};return u&&window.addEventListener("beforeunload",m),()=>window.removeEventListener("beforeunload",m)},[u]),t?c.jsx(b.RichTextEditor,{id:e,value:r,border:!1,placeholder:o,plugins:l,onValueChanged:v,onTextChange:h,hideExternalFloatingModals:x,placeholderOpacity:"high"}):c.jsx(Lb,{value:r,gap:a,customClass:d,show:s,plugins:l})});Nd.displayName="InternalRichTextEditor";const ww=e=>{const t=y.useRef(null),[r,n]=y.useState(!1),{isEditing:a,...o}=e,l=y.useCallback(i=>{i&&n(!0)},[]);return Vb({ref:t,disabled:!a,onChange:l}),y.useEffect(()=>{a||n(!1)},[a]),c.jsx("div",{"data-test-id":"rich-text-editor-container",className:"tw-block tw-w-full tw-@container",ref:t,children:c.jsx(Nd,{...o,isEnabled:a&&r})})},yw=({editButtonProps:e,unlinkButtonProps:t})=>{const{element:r}=b.useLinkOpenButtonState(),n=r?ya(r):"";return c.jsx(b.FloatingModalWrapper,{"data-test-id":"floating-link-edit",padding:"16px",minWidth:"400px",children:c.jsxs("span",{"data-test-id":"preview-link-flyout",className:"tw-flex tw-justify-between tw-items-center tw-gap-2",children:[c.jsx("a",{"data-test-id":"floating-link-edit-url",href:n,target:"_blank",rel:"noopener noreferrer",style:C0[Ne],className:"tw-break-all",children:n}),c.jsxs("span",{className:"tw-flex tw-gap-2",children:[c.jsx("button",{tabIndex:0,"data-test-id":"edit-link-button",className:"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1",...e,children:c.jsx(b.IconPen16,{})}),c.jsx("button",{tabIndex:0,"data-test-id":"remove-link-button",className:"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1",...t,children:c.jsx(b.IconTrashBin16,{})})]})]})})},zd=(e,t)=>{const r=b.getAboveNode(e,{match:{type:b.ELEMENT_LINK}});return Array.isArray(r)?t(r[0]):""},Cw=e=>zd(e,t=>{var r,n;return((n=(r=t.chosenLink)==null?void 0:r.searchResult)==null?void 0:n.link)||""}),xw=e=>zd(e,t=>t.url||""),_w={url:"",text:"",newTab:b.CheckboxState.Unchecked},Mw=()=>{const[e,t]=y.useReducer((r,n)=>{const{type:a,payload:o}=n;switch(a){case"NEW_TAB":return{...r,newTab:b.CheckboxState.Checked};case"SAME_TAB":return{...r,newTab:b.CheckboxState.Unchecked};case"URL":case"TEXT":case"INIT":return{...r,...o};default:return r}},_w);return[e,t]},Aw=()=>{const e=b.useEditorRef(),[t,r]=Mw();y.useEffect(()=>{const u=Cw(e),f=xw(e),h=b.floatingLinkSelectors.newTab();r({type:"INIT",payload:{text:b.floatingLinkSelectors.text()||b.floatingLinkSelectors.url(),newTab:h?b.CheckboxState.Checked:b.CheckboxState.Unchecked,url:u&&f===""?u:b.floatingLinkSelectors.url()}})},[r,e]);const n=u=>{r({type:"TEXT",payload:{text:u}})},a=u=>{r({type:"URL",payload:{url:u}})},o=u=>{r(u?{type:"NEW_TAB"}:{type:"SAME_TAB"})},l=()=>{b.floatingLinkActions.reset()},i=u=>{!ke(t.url)||!s||(b.floatingLinkActions.text(t.text),b.floatingLinkActions.url(Er(t.url)),b.floatingLinkActions.newTab(t.newTab===b.CheckboxState.Checked),b.submitFloatingLink(e)&&(u==null||u.preventDefault()))},s=t.url!==""&&t.text!=="",{appBridge:d}=b.getPluginOptions(e,b.ELEMENT_LINK);return b.useHotkeys("enter",i,{enableOnFormTags:["INPUT"]},[]),{state:t,onTextChange:n,onUrlChange:a,onToggleTab:o,onCancel:l,onSave:i,hasValues:s,isValidUrlOrEmpty:ke,appBridge:d}},Sw=()=>c.jsx(_d,{...Aw(),testId:"floating-link-insert"}),Od={placement:"bottom-start",strategy:"absolute",middleware:[b.offset(12),b.flip({padding:12,fallbackPlacements:["bottom-end","top-start","top-end"]})]},Ew=()=>{const e=b.useFloatingLinkInsertState({floatingOptions:Od}),{props:t,ref:r,hidden:n}=b.useFloatingLinkInsert(e),a=b.useFloatingLinkEditState({floatingOptions:Od}),{props:o,ref:l,editButtonProps:i,unlinkButtonProps:s}=b.useFloatingLinkEdit(a);if(n)return null;const d=c.jsx(Sw,{}),u=a.isEditing?d:c.jsx(yw,{editButtonProps:i,unlinkButtonProps:s});return c.jsxs(c.Fragment,{children:[e.isOpen&&!a.isOpen&&ee.createPortal(c.jsx("div",{"data-is-underlay":!0,ref:r,...t,style:{...t.style,...C0[c0.p]},children:d}),document.body),a.isOpen&&ee.createPortal(c.jsx("div",{"data-is-underlay":!0,ref:l,...o,style:{...o.style,...C0[c0.p]},children:u}),document.body)]})},Dd=y.forwardRef((e,t)=>{const r=b.useEditorRef(),n=b.useLinkToolbarButtonState(),{props:a}=b.useLinkToolbarButton(n);return c.jsx(b.ToolbarButton,{onMouseDown:o=>{o.preventDefault(),b.focusEditor(r,r.selection??r.prevSelection??void 0)},ref:t,...a,...e,children:c.jsx(b.IconStylingWrapper,{icon:c.jsx(b.IconLink16,{})})})});Dd.displayName="LinkToolbarButton";const Iw=({id:e,editorId:t})=>{const r=b.useEditorState(b.useEventPlateId(t)),n=!!b.isRangeInSameBlock(r,{at:r.selection});return c.jsx("div",{"data-plugin-id":e,children:c.jsx(Dd,{disabled:!n,tooltip:b.getTooltip(n?`Link
|
|
86
|
+
${b.getHotkeyByPlatform("Ctrl+Shift+K")}`:"Buttons can only be set for a single text block.")})})},Ne="link-plugin";var c0=(e=>(e.heading1="heading1",e.heading2="heading2",e.heading3="heading3",e.heading4="heading4",e.custom1="custom1",e.custom2="custom2",e.custom3="custom3",e.quote="quote",e.imageCaption="imageCaption",e.imageTitle="imageTitle",e.p="p",e))(c0||{});const C0={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)"},[Ne]:{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)"},...kr},tw=()=>{const e=b.useEditorRef();return c.jsx(b.FloatingModalWrapper,{padding:"16px",minWidth:"400px","data-test-id":"floating-button-edit",children:c.jsxs("span",{"data-test-id":"preview-button-flyout",className:"tw-flex tw-justify-between tw-items-center tw-gap-2",children:[c.jsx("a",{"data-test-id":"floating-button-edit-url",href:T0.url(),target:"_blank",rel:"noopener noreferrer",style:C0[Ne],className:"tw-break-all",children:T0.url()}),c.jsxs("span",{className:"tw-flex tw-gap-2",children:[c.jsx("button",{onClick:()=>{Pr(e)},tabIndex:0,"data-test-id":"edit-button-button",className:"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1",children:c.jsx(b.IconPen16,{})}),c.jsx("button",{onClick:()=>{Te(e),b.focusEditor(e,e.selection??void 0)},tabIndex:0,"data-test-id":"remove-button-button",className:"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1",children:c.jsx(b.IconTrashBin16,{})})]})]})})},wd=e=>e.filter(t=>{var r;return!!((r=t.title)!=null&&r.trim())}),yd=()=>c.jsx("div",{className:"tw-flex tw-justify-center tw-h-10 tw-items-center",children:c.jsx(b.LoadingCircle,{size:b.LoadingCircleSize.Small})}),rw=({section:e,selectedUrl:t,onSelectUrl:r})=>{const n=e.permanentLink===t;return c.jsx("button",{"data-test-id":"internal-link-selector-section-link",className:b.merge(["tw-py-2 tw-pr-2.5 tw-pl-14 tw-leading-5 tw-cursor-pointer tw-w-full",n?"tw-bg-box-selected-strong tw-text-box-selected-strong-inverse hover:tw-bg-box-selected-strong-hover:hover hover:tw-text-box-selected-strong-inverse-hover:hover":"hover:tw-bg-box-neutral-hover hover:tw-text-box-neutral-inverse-hover"]),onClick:()=>r(e.permanentLink),children:c.jsxs("div",{className:"tw-flex tw-flex-1 tw-space-x-2 tw-items-center tw-h-6",children:[c.jsx(b.IconDocumentText16,{}),c.jsx("span",{className:"tw-text-s",children:e.title}),c.jsx("span",{className:"tw-flex-auto tw-font-sans tw-text-xs tw-text-right",children:"Section"})]})})},nw=({page:e,selectedUrl:t,onSelectUrl:r,itemsToExpandInitially:n,getDocumentSectionsByDocumentPageId:a})=>{const[o,l]=y.useState(e.id===n.documentId),[i,s]=y.useState([]),d=e.permanentLink===t;y.useEffect(()=>{(async()=>{const h=await a(e.id),v=wd(h);s(v)})()},[e.id,a]),y.useEffect(()=>{e.id===n.pageId&&l(!0)},[n,e.id]);const u=i.length>0;return c.jsxs(c.Fragment,{children:[c.jsx("button",{"data-test-id":"internal-link-selector-page-link",className:b.merge(["tw-py-2 tw-pr-2.5 tw-leading-5 tw-cursor-pointer tw-flex tw-w-full",u?"tw-pl-7":"tw-pl-12",d?"tw-bg-box-selected-strong tw-text-box-selected-strong-inverse hover:tw-bg-box-selected-strong-hover:hover hover:tw-text-box-selected-strong-inverse-hover:hover":"hover:tw-bg-box-neutral-hover hover:tw-text-box-neutral-inverse-hover"]),onClick:()=>r(e.permanentLink),children:c.jsxs("div",{className:"tw-flex tw-flex-1 tw-space-x-1 tw-items-center tw-h-6",children:[u&&c.jsx("button",{"data-test-id":"tree-item-toggle",className:"tw-flex tw-items-center tw-justify-center -tw-mr-2 tw-pr-3.5 tw-pt-1.5 tw-pb-1.5 tw-pl-3.5 tw-cursor-pointer",onClick:()=>l(!o),children:c.jsx("div",{className:b.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":""])})}),c.jsx("span",{className:"tw-text-s",children:e.title}),c.jsx("span",{className:"tw-flex-auto tw-font-sans tw-text-xs tw-text-right",children:"Page"})]},e.id)}),o&&i.length>0&&i.map(f=>c.jsx(rw,{section:f,selectedUrl:t,onSelectUrl:r},f.id))]})},ow=({documentId:e,selectedUrl:t,onSelectUrl:r,itemsToExpandInitially:n,getDocumentSectionsByDocumentPageId:a,getDocumentPagesByDocumentId:o})=>{const[l,i]=y.useState([]),[s,d]=y.useState(!0),u=[...l.values()],f=!s&&u.length>0;return y.useEffect(()=>{o(e).then(h=>{const v=h.filter(m=>!!m.category).sort((m,g)=>m.category.sort===g.category.sort?m.sort-g.sort:m.category.sort-g.category.sort),x=h.filter(m=>!m.category).sort((m,g)=>m.sort-g.sort);i([...v,...x])}).finally(()=>{d(!1)})},[]),s?c.jsx(yd,{}):f?c.jsx(c.Fragment,{children:u.map(h=>c.jsx(nw,{page:h,selectedUrl:t,onSelectUrl:r,itemsToExpandInitially:n,getDocumentSectionsByDocumentPageId:a},h.id))}):c.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."})},aw=({document:e,selectedUrl:t,onSelectUrl:r,itemsToExpandInitially:n,getDocumentSectionsByDocumentPageId:a,getDocumentPagesByDocumentId:o})=>{const[l,i]=y.useState(e.id===n.documentId),s=e.permanentLink===t;return y.useEffect(()=>{e.id===n.documentId&&i(!0)},[n,e.id]),c.jsxs(c.Fragment,{children:[c.jsxs("button",{"data-test-id":"internal-link-selector-document-link",className:b.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",s?"tw-bg-box-selected-strong tw-text-box-selected-strong-inverse hover:tw-bg-box-selected-strong-hover:hover hover:tw-text-box-selected-strong-inverse-hover:hover":"hover:tw-bg-box-neutral-hover hover:tw-text-box-neutral-inverse-hover"]),onClick:()=>r(e.permanentLink),children:[c.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:()=>i(!l),children:c.jsx("div",{className:b.merge(["tw-transition-transform tw-w-0 tw-h-0 tw-font-normal tw-border-t-4 tw-border-t-transparent tw-border-b-4 tw-border-b-transparent tw-border-l-4 tw-border-l-x-strong",l?"tw-rotate-90":""])})}),c.jsx(b.IconColorFan16,{}),c.jsx("span",{className:"tw-text-s",children:e.title}),c.jsx("span",{className:"tw-flex-auto tw-font-sans tw-text-xs tw-text-right",children:"Document"})]}),l&&c.jsx(ow,{documentId:e.id,selectedUrl:t,onSelectUrl:r,itemsToExpandInitially:n,getDocumentSectionsByDocumentPageId:a,getDocumentPagesByDocumentId:o})]})},lw=({selectedUrl:e,onSelectUrl:t,getAllDocuments:r,getDocumentPagesByDocumentId:n,getDocumentSectionsByDocumentPageId:a})=>{const[o,l]=y.useState(!0),[i,s]=y.useState([]),[d,u]=y.useState({documentId:void 0,pageId:void 0});y.useEffect(()=>{e&&i.length>0&&f().then(h=>{u(h)})},[i.length]),y.useEffect(()=>{r().then(h=>{s(h)}).finally(()=>{l(!1)})},[]);const f=async()=>{const h={documentId:void 0,pageId:void 0};if(i.find(x=>x.permanentLink===e))return h;for(const x of i){const m=await n(x.id);if(!!m.find(_=>_.permanentLink===e))return h.documentId=x.id,h;for(const _ of m){const C=await a(_.id);if(!!wd(C).find(S=>S.permanentLink===e))return h.documentId=x.id,h.pageId=_.id,h}}return h};return o?c.jsx(yd,{}):c.jsx(c.Fragment,{children:i.map(h=>c.jsx(aw,{document:h,selectedUrl:e,onSelectUrl:t,itemsToExpandInitially:d,getDocumentSectionsByDocumentPageId:a,getDocumentPagesByDocumentId:n},h.id))})},Cd=({url:e,onUrlChange:t,buttonSize:r=b.ButtonSize.Medium,getAllDocuments:n,getDocumentPagesByDocumentId:a,getDocumentSectionsByDocumentPageId:o})=>{const{open:l,isOpen:i,close:s}=au.useOverlayTriggerState({}),[d,u]=y.useState(e),f=x=>{u(x)},h=x=>{x.key==="Enter"&&v()};y.useEffect(()=>{e&&!d&&u(e)},[e,d]);const v=()=>{t==null||t(d),s()};return c.jsxs("div",{onPointerDown:x=>x.preventDefault(),"data-test-id":"internal-link-selector",onKeyDown:h,children:[c.jsx(b.Button,{icon:c.jsx(b.IconLink,{}),size:r,type:b.ButtonType.Button,style:b.ButtonStyle.Default,emphasis:b.ButtonEmphasis.Default,onClick:()=>l(),children:"Internal link"}),c.jsxs(b.Modal,{zIndex:1001,onClose:()=>s(),isOpen:i,isDismissable:!0,children:[c.jsx(b.Modal.Header,{title:"Select internal link"}),c.jsx(b.Modal.Body,{children:c.jsx(lw,{selectedUrl:d,onSelectUrl:f,getAllDocuments:n,getDocumentPagesByDocumentId:a,getDocumentSectionsByDocumentPageId:o})}),c.jsx(b.Modal.Footer,{buttons:[{children:"Cancel",onClick:()=>s(),style:b.ButtonStyle.Default,emphasis:b.ButtonEmphasis.Default},{children:"Choose",onClick:x=>{x==null||x.preventDefault(),v()},style:b.ButtonStyle.Default,emphasis:b.ButtonEmphasis.Strong,disabled:!d}]})]})]})},xd=({onUrlChange:e,onToggleTab:t,isValidUrlOrEmpty:r,appBridge:n,clearable:a,placeholder:o,newTab:l,openInNewTab:i,url:s="",required:d,info:u,label:f,buttonSize:h,hideInternalLinkButton:v})=>{const x=r?r(s):ke(s),m=l??(i?b.CheckboxState.Checked:b.CheckboxState.Unchecked);return c.jsxs("div",{"data-test-id":"link-input",children:[c.jsx(b.FormControl,{label:{children:f,htmlFor:"url",required:d,tooltip:u?{content:u,position:b.TooltipPosition.Top}:void 0},children:c.jsx(b.TextInput,{id:"url",value:s,clearable:a,onChange:e,placeholder:o??"https://example.com",focusOnMount:!0})}),!x&&c.jsx("div",{className:"tw-text-text-negative tw-mt-1 tw-text-s",children:"Please enter a valid URL."}),!v&&c.jsx("div",{className:"tw-mt-3",children:c.jsx(Cd,{url:s,onUrlChange:e,buttonSize:h??b.ButtonSize.Medium,getAllDocuments:()=>n.getAllDocuments(),getDocumentPagesByDocumentId:g=>n.getDocumentPagesByDocumentId(g),getDocumentSectionsByDocumentPageId:g=>n.getDocumentSectionsByDocumentPageId(g)})}),c.jsx("div",{className:"tw-mt-3",children:c.jsx(b.Checkbox,{value:"new-tab",label:"Open in new tab",state:m,onChange:t})})]})},_d=({state:e,onTextChange:t,onUrlChange:r,onToggleTab:n,onCancel:a,onSave:o,isValidUrlOrEmpty:l,hasValues:i,testId:s,appBridge:d,children:u})=>c.jsxs(b.FloatingModalWrapper,{"data-test-id":s,padding:"28px",minWidth:"400px",children:[c.jsx(b.FormControl,{label:{children:"Text",htmlFor:"linkText",required:!0},children:c.jsx(b.TextInput,{id:"linkText",value:e.text,placeholder:"Link Text",onChange:t})}),u,c.jsx("div",{className:"tw-mt-5",children:c.jsx(xd,{url:e.url,newTab:e.newTab,onUrlChange:r,onToggleTab:n,isValidUrlOrEmpty:l,appBridge:d})}),c.jsx("div",{className:"tw-mt-3",children:c.jsxs("div",{className:"tw-pt-5 tw-flex tw-gap-x-3 tw-justify-end tw-border-t tw-border-t-black-10",children:[c.jsx(b.Button,{onClick:a,size:b.ButtonSize.Medium,style:b.ButtonStyle.Default,emphasis:b.ButtonEmphasis.Default,children:"Cancel"}),c.jsx(b.Button,{onClick:o,size:b.ButtonSize.Medium,icon:c.jsx(b.IconCheckMark20,{}),disabled:!l(e==null?void 0:e.url)||!i,children:"Save"})]})})]}),iw=e=>{var r;const t=b.getAboveNode(e,{match:{type:m0}});return Array.isArray(t)&&((r=t[0])==null?void 0:r.buttonStyle)||"primary"},sw={url:"",text:"",buttonStyle:"primary",newTab:b.CheckboxState.Unchecked},cw=()=>{const[e,t]=y.useReducer((r,n)=>{const{type:a,payload:o}=n;switch(a){case"NEW_TAB":return{...r,newTab:b.CheckboxState.Checked};case"SAME_TAB":return{...r,newTab:b.CheckboxState.Unchecked};case"URL":case"TEXT":case"BUTTON_STYLE":case"INIT":return{...r,...o};default:return r}},sw);return[e,t]},dw=()=>{const e=b.useEditorRef(),[t,r]=cw();y.useEffect(()=>{const f=iw(e);r({type:"INIT",payload:{text:T0.text()||T0.url(),buttonStyle:f,newTab:T0.newTab()?b.CheckboxState.Checked:b.CheckboxState.Unchecked,url:T0.url()}})},[r,e]);const n=f=>{r({type:"TEXT",payload:{text:f}})},a=f=>{r({type:"BUTTON_STYLE",payload:{buttonStyle:f}})},o=f=>{r({type:"URL",payload:{url:f}})},l=f=>{r(f?{type:"NEW_TAB"}:{type:"SAME_TAB"})},i=()=>{S0.reset()},s=f=>{if(!ke(t.url)||!d)return;const h=Er(t.url);S0.text(t.text),S0.url(h),S0.buttonStyle(t.buttonStyle),S0.newTab(t.newTab===b.CheckboxState.Checked),xa(e)&&(f==null||f.preventDefault())},d=t.url!==""&&t.text!=="",{appBridge:u}=b.getPluginOptions(e,m0);return b.useHotkeys("enter",s,{enableOnFormTags:["INPUT"]},[]),{state:t,onTextChange:n,onButtonStyleChange:a,onUrlChange:o,onToggleTab:l,onCancel:i,onSave:s,hasValues:d,isValidUrlOrEmpty:ke,appBridge:u}},uw=()=>{const e=dw(),{state:t,onButtonStyleChange:r}=e;return c.jsx(_d,{...e,testId:"floating-button-insert",children:c.jsx("div",{className:"tw-pt-5",children:c.jsxs(b.FormControl,{label:{children:"Button Style",htmlFor:"buttonStyle",required:!0},children:[c.jsx(Sa,{id:"primary",styles:C0.buttonPrimary,isActive:t.buttonStyle==="primary",onClick:()=>r("primary"),children:t.text||"Primary Button"}),c.jsx(Sa,{id:"secondary",styles:C0.buttonSecondary,isActive:t.buttonStyle==="secondary",onClick:()=>r("secondary"),children:t.text||"Secondary Button"}),c.jsx(Sa,{id:"tertiary",styles:C0.buttonTertiary,isActive:t.buttonStyle==="tertiary",onClick:()=>r("tertiary"),children:t.text||"Tertiary Button"})]})})})},Sa=({id:e,styles:t,isActive:r,onClick:n,children:a})=>{const[o,l]=y.useState(!1),i=()=>t&&t.hover&&o?{...t,...t.hover}:t;return c.jsx("button",{"data-test-id":`floating-button-insert-${e}`,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),onClick:n,style:{...i(),marginTop:0,marginBottom:0},className:r?"tw-outline tw-outline-1 tw-outline-violet-60 tw-outline-offset-2 tw-w-fit":"tw-w-fit",children:a})},Md={placement:"bottom-start",strategy:"absolute",middleware:[b.offset(12),b.flip({padding:12,fallbackPlacements:["bottom-end","top-start","top-end"]})]},fw=()=>{const{ref:e,...t}=vw(Md),{ref:r,...n}=hw(Md),a=b.useEditorRef(),o=dt(),l=o.isOpen(a.id),i=o.isEditing(),s=o.mode(),d=c.jsx(uw,{}),u=i?d:c.jsx(tw,{});return c.jsxs(c.Fragment,{children:[l&&s==="insert"&&ee.createPortal(c.jsx("div",{"data-is-underlay":!0,ref:e,...t,style:{...t.style,...C0[b.TextStyles.p]},children:d}),document.body),l&&s==="edit"&&ee.createPortal(c.jsx("div",{"data-is-underlay":!0,ref:r,...n,style:{...n.style,...C0[b.TextStyles.p]},children:u}),document.body)]})},m0="button",Ad="button-plugin",Sd=e=>b.createPluginFactory({key:m0,isElement:!0,isInline:!0,props:({element:t})=>({nodeProps:{href:t==null?void 0:t.url,target:t==null?void 0:t.target}}),withOverrides:ud,renderAfterEditable:fw,options:{isUrl:Ir,rangeBeforeOptions:{matchString:" ",skipInvalid:!0,afterMatch:!0},triggerFloatingButtonHotkeys:"command+shift+k, ctrl+shift+k",appBridge:e},then:(t,{type:r})=>({deserializeHtml:{rules:[{validNodeName:"A",validClassName:"btn"}],getNode:n=>({type:r,url:n.getAttribute("href"),target:n.getAttribute("target")||"_blank"})}})})();class Ed extends b.Plugin{constructor({styles:r=kr,...n}){super(Ad,{button:ew,markupElement:new Jb,...n});E0(this,"styles",{});E0(this,"appBridge");this.styles=r,this.appBridge=n==null?void 0:n.appBridge}plugins(){return[Sd(this.appBridge)]}}const hw=e=>{const t=b.useEditorRef(),r=dt().mode(),n=dt().isOpen(t.id),a=b.useEditorVersion(),{triggerFloatingButtonHotkeys:o}=b.getPluginOptions(t,m0),l=y.useCallback(()=>{const f=b.getAboveNode(t,{match:{type:b.getPluginType(t,m0)}});if(f){const[,h]=f;return b.getRangeBoundingClientRect(t,{anchor:b.getStartPoint(t,h),focus:b.getEndPoint(t,h)})}return b.getDefaultBoundingClientRect()},[t]),i=n&&r==="edit",{update:s,style:d,floating:u}=Pd({open:i,getBoundingClientRect:l,...e});return y.useEffect(()=>{const f=vd(t);if(f&&S0.url(f),t.selection&&b.someNode(t,{match:{type:b.getPluginType(t,m0)}})){S0.show("edit",t.id),s();return}T0.mode()==="edit"&&S0.reset()},[t,a,s]),b.useHotkeys(o,f=>{f.preventDefault(),T0.mode()==="edit"&&Pr(t)},{enableOnContentEditable:!0},[]),pw(),Id(),{style:{...d,zIndex:1e3},ref:b.useComposedRef(u)}},pw=()=>{const e=b.useEditorRef();b.useHotkeys("*",t=>{t.key==="Enter"&&xa(e)&&t.preventDefault()},{enableOnFormTags:["INPUT"]},[])},Id=()=>{const e=b.useEditorRef();b.useHotkeys("escape",()=>{if(T0.mode()==="edit"){if(T0.isEditing()){S0.show("edit",e.id),b.focusEditor(e,e.selection??void 0);return}S0.reset()}},{enableOnFormTags:["INPUT"],enableOnContentEditable:!0},[])},vw=e=>{const t=b.useEditorRef(),r=b.useFocused(),n=dt().mode(),a=dt().isOpen(t.id),{triggerFloatingButtonHotkeys:o}=b.getPluginOptions(t,m0);b.useHotkeys(o,d=>{d.preventDefault(),Ma(t,{focused:r})},{enableOnContentEditable:!0},[r]);const{update:l,style:i,floating:s}=Pd({open:a&&n==="insert",getBoundingClientRect:b.getSelectionBoundingClientRect,whileElementsMounted:void 0,...e});return y.useEffect(()=>{a&&l(),S0.updated(a)},[a,l]),Id(),{style:{...i,zIndex:1e3},ref:b.useComposedRef(s)}},gw=12,mw=-22,bw=96,Pd=e=>b.useVirtualFloating({placement:"bottom-start",middleware:[b.offset({mainAxis:gw,alignmentAxis:mw}),b.flip({padding:bw})],...e}),Ea="[&_.tw-break-after-column]:tw-break-after-auto [&_.tw-break-inside-avoid-column]:tw-break-inside-auto [&_.tw-break-after-column.tw-pb-5]:tw-pb-0 @md:[&_.tw-break-after-column.tw-pb-5]:!tw-pb-5 @md:[&_.tw-break-after-column]:!tw-break-after-column @md:[&_.tw-break-inside-avoid-column]:!tw-break-inside-avoid-column",kd={1:"tw-columns-1",2:"tw-columns-1 @sm:!tw-columns-2 [&_.tw-break-after-column]:tw-break-after-auto [&_.tw-break-inside-avoid-column]:tw-break-inside-auto [&_.tw-break-after-column.tw-pb-5]:tw-pb-0 @sm:[&_.tw-break-after-column.tw-pb-5]:!tw-pb-5 @sm:[&_.tw-break-after-column]:!tw-break-after-column @sm:[&_.tw-break-inside-avoid-column]:!tw-break-inside-avoid-column",3:`tw-columns-1 @md:!tw-columns-3 ${Ea}`,4:`tw-columns-1 @md:!tw-columns-4 ${Ea}`,5:`tw-columns-1 @md:!tw-columns-5 ${Ea}`},Td=e=>e?kd[e]||kd[1]:"",Nd=y.memo(({isEnabled:e,value:t,columns:r,gap:n,placeholder:a,plugins:o,onTextChange:l,showSerializedText:i})=>{const s=Td(r),[d,u]=y.useState(!1),f=y.useId(),h=y.useCallback(m=>{m!==t&&(l==null||l(m)),u(!1)},[l,t]),v=y.useCallback(()=>u(!0),[]),x=y.useCallback(m=>{T0.isOpen(m)&&S0.reset()},[]);return y.useEffect(()=>{const m=g=>{g.preventDefault(),g.returnValue="Unprocessed changes"};return d&&window.addEventListener("beforeunload",m),()=>window.removeEventListener("beforeunload",m)},[d]),e?c.jsx(b.RichTextEditor,{id:f,value:t,border:!1,placeholder:a,plugins:o,onValueChanged:v,onTextChange:h,hideExternalFloatingModals:x,placeholderOpacity:"high"}):c.jsx(Lb,{value:t,gap:n,customClass:s,show:i,plugins:o})});Nd.displayName="InternalRichTextEditor";const ww=e=>{const t=y.useRef(null),[r,n]=y.useState(!1),{isEditing:a,...o}=e,l=y.useCallback(i=>{i&&n(!0)},[]);return Vb({ref:t,disabled:!a,onChange:l}),y.useEffect(()=>{a||n(!1)},[a]),c.jsx("div",{"data-test-id":"rich-text-editor-container",className:"tw-block tw-w-full tw-@container",ref:t,children:c.jsx(Nd,{...o,isEnabled:a&&r})})},yw=({editButtonProps:e,unlinkButtonProps:t})=>{const{element:r}=b.useLinkOpenButtonState(),n=r?ya(r):"";return c.jsx(b.FloatingModalWrapper,{"data-test-id":"floating-link-edit",padding:"16px",minWidth:"400px",children:c.jsxs("span",{"data-test-id":"preview-link-flyout",className:"tw-flex tw-justify-between tw-items-center tw-gap-2",children:[c.jsx("a",{"data-test-id":"floating-link-edit-url",href:n,target:"_blank",rel:"noopener noreferrer",style:C0[Ne],className:"tw-break-all",children:n}),c.jsxs("span",{className:"tw-flex tw-gap-2",children:[c.jsx("button",{tabIndex:0,"data-test-id":"edit-link-button",className:"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1",...e,children:c.jsx(b.IconPen16,{})}),c.jsx("button",{tabIndex:0,"data-test-id":"remove-link-button",className:"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1",...t,children:c.jsx(b.IconTrashBin16,{})})]})]})})},zd=(e,t)=>{const r=b.getAboveNode(e,{match:{type:b.ELEMENT_LINK}});return Array.isArray(r)?t(r[0]):""},Cw=e=>zd(e,t=>{var r,n;return((n=(r=t.chosenLink)==null?void 0:r.searchResult)==null?void 0:n.link)||""}),xw=e=>zd(e,t=>t.url||""),_w={url:"",text:"",newTab:b.CheckboxState.Unchecked},Mw=()=>{const[e,t]=y.useReducer((r,n)=>{const{type:a,payload:o}=n;switch(a){case"NEW_TAB":return{...r,newTab:b.CheckboxState.Checked};case"SAME_TAB":return{...r,newTab:b.CheckboxState.Unchecked};case"URL":case"TEXT":case"INIT":return{...r,...o};default:return r}},_w);return[e,t]},Aw=()=>{const e=b.useEditorRef(),[t,r]=Mw();y.useEffect(()=>{const u=Cw(e),f=xw(e),h=b.floatingLinkSelectors.newTab();r({type:"INIT",payload:{text:b.floatingLinkSelectors.text()||b.floatingLinkSelectors.url(),newTab:h?b.CheckboxState.Checked:b.CheckboxState.Unchecked,url:u&&f===""?u:b.floatingLinkSelectors.url()}})},[r,e]);const n=u=>{r({type:"TEXT",payload:{text:u}})},a=u=>{r({type:"URL",payload:{url:u}})},o=u=>{r(u?{type:"NEW_TAB"}:{type:"SAME_TAB"})},l=()=>{b.floatingLinkActions.reset()},i=u=>{!ke(t.url)||!s||(b.floatingLinkActions.text(t.text),b.floatingLinkActions.url(Er(t.url)),b.floatingLinkActions.newTab(t.newTab===b.CheckboxState.Checked),b.submitFloatingLink(e)&&(u==null||u.preventDefault()))},s=t.url!==""&&t.text!=="",{appBridge:d}=b.getPluginOptions(e,b.ELEMENT_LINK);return b.useHotkeys("enter",i,{enableOnFormTags:["INPUT"]},[]),{state:t,onTextChange:n,onUrlChange:a,onToggleTab:o,onCancel:l,onSave:i,hasValues:s,isValidUrlOrEmpty:ke,appBridge:d}},Sw=()=>c.jsx(_d,{...Aw(),testId:"floating-link-insert"}),Od={placement:"bottom-start",strategy:"absolute",middleware:[b.offset(12),b.flip({padding:12,fallbackPlacements:["bottom-end","top-start","top-end"]})]},Ew=()=>{const e=b.useFloatingLinkInsertState({floatingOptions:Od}),{props:t,ref:r,hidden:n}=b.useFloatingLinkInsert(e),a=b.useFloatingLinkEditState({floatingOptions:Od}),{props:o,ref:l,editButtonProps:i,unlinkButtonProps:s}=b.useFloatingLinkEdit(a);if(n)return null;const d=c.jsx(Sw,{}),u=a.isEditing?d:c.jsx(yw,{editButtonProps:i,unlinkButtonProps:s});return c.jsxs(c.Fragment,{children:[e.isOpen&&!a.isOpen&&ee.createPortal(c.jsx("div",{"data-is-underlay":!0,ref:r,...t,style:{...t.style,...C0[c0.p]},children:d}),document.body),a.isOpen&&ee.createPortal(c.jsx("div",{"data-is-underlay":!0,ref:l,...o,style:{...o.style,...C0[c0.p]},children:u}),document.body)]})},Dd=y.forwardRef((e,t)=>{const r=b.useEditorRef(),n=b.useLinkToolbarButtonState(),{props:a}=b.useLinkToolbarButton(n);return c.jsx(b.ToolbarButton,{onMouseDown:o=>{o.preventDefault(),b.focusEditor(r,r.selection??r.prevSelection??void 0)},ref:t,...a,...e,children:c.jsx(b.IconStylingWrapper,{icon:c.jsx(b.IconLink16,{})})})});Dd.displayName="LinkToolbarButton";const Iw=({id:e,editorId:t})=>{const r=b.useEditorState(b.useEventPlateId(t)),n=!!b.isRangeInSameBlock(r,{at:r.selection});return c.jsx("div",{"data-plugin-id":e,children:c.jsx(Dd,{disabled:!n,tooltip:b.getTooltip(n?`Link
|
|
87
87
|
${b.getHotkeyByPlatform("Ctrl+K")}`:"Links can only be set for a single text block.")})})},Pw=e=>{var l,i;const{attributes:t,children:r}=e,{styles:n}=b.useRichTextEditorContext(),a=e.element.url||((i=(l=e.element.chosenLink)==null?void 0:l.searchResult)==null?void 0:i.link)||"",o=e.element.target||"_self";return c.jsx("a",{...t,href:a,target:o,style:n[Ne],children:r})};class kw extends b.MarkupElement{constructor(t=b.ELEMENT_LINK,r=Pw){super(t,r)}}const Hd=e=>b.createPluginFactory({...b.createLinkPlugin(),renderAfterEditable:Ew,options:{isUrl:Ir,rangeBeforeOptions:{matchString:" ",skipInvalid:!0,afterMatch:!0},triggerFloatingLinkHotkeys:"meta+k, ctrl+k",keepSelectedTextOnPaste:!0,appBridge:e}})();class Vd extends b.Plugin{constructor({styles:r=C0[Ne],...n}){super(Ne,{button:Iw,markupElement:new kw,...n});E0(this,"styles",{});E0(this,"appBridge");this.styles=r,this.appBridge=n.appBridge}plugins(){return[Hd(this.appBridge)]}}const Tw="breakAfterColumn",Ld="normal";class Nw extends b.Plugin{constructor(r){super("break-after-plugin",{button:b.ColumnBreakButton,...r});E0(this,"columns");E0(this,"gap");E0(this,"customClass");this.columns=(r==null?void 0:r.columns)??1,this.gap=(r==null?void 0:r.gap)??Ld,this.customClass=Td(this.columns)}plugins(){return[b.createColumnBreakPlugin(this.columns,this.gap,this.customClass)]}}const zw="textstyle-custom1-plugin";class $d extends b.Plugin{constructor({styles:r=C0.custom1,...n}={}){super(c0.custom1,{label:"Custom 1",markupElement:new Ow,...n});E0(this,"styles",{});this.styles=r}plugins(){return[Dw(this.styles)]}}class Ow extends b.MarkupElement{constructor(t=zw,r=Bd){super(t,r)}}const Bd=({element:e,attributes:t,children:r,styles:n})=>{const a=e.align;return c.jsx("p",{...t,style:n,className:b.merge([a&&b.alignmentClassnames[a],b.getColumnBreakClasses(e)]),children:r})},Dw=e=>b.createPluginFactory({key:c0.custom1,isElement:!0,deserializeHtml:{rules:[{validClassName:c0.custom1}]}})({component:t=>c.jsx(Bd,{...t,styles:e})}),Hw="textstyle-custom2-plugin";class Fd extends b.Plugin{constructor({styles:r=C0.custom2,...n}={}){super(c0.custom2,{label:"Custom 2",markupElement:new Vw,...n});E0(this,"styles",{});this.styles=r}plugins(){return[Lw(this.styles)]}}class Vw extends b.MarkupElement{constructor(t=Hw,r=Rd){super(t,r)}}const Rd=({element:e,attributes:t,children:r,styles:n})=>{const a=e.align;return c.jsx("p",{...t,className:b.merge([a&&b.alignmentClassnames[a],b.getColumnBreakClasses(e)]),style:n,children:r})},Lw=e=>b.createPluginFactory({key:c0.custom2,isElement:!0,deserializeHtml:{rules:[{validClassName:c0.custom2}]}})({component:t=>c.jsx(Rd,{...t,styles:e})}),$w="textstyle-custom3-plugin";class Ud extends b.Plugin{constructor({styles:r=C0.custom3,...n}={}){super(b.TextStyles.custom3,{label:"Custom 3",markupElement:new Bw,...n});E0(this,"styles",{});this.styles=r}plugins(){return[Fw(this.styles)]}}class Bw extends b.MarkupElement{constructor(t=$w,r=Wd){super(t,r)}}const Wd=({element:e,attributes:t,children:r,styles:n})=>{const a=e.align;return c.jsx("p",{...t,className:b.merge([a&&b.alignmentClassnames[a],b.getColumnBreakClasses(e)]),style:n,children:r})},Fw=e=>b.createPluginFactory({key:b.TextStyles.custom3,isElement:!0,deserializeHtml:{rules:[{validClassName:b.TextStyles.custom3}]}})({component:t=>c.jsx(Wd,{...t,styles:e})}),Rw="textstyle-heading1-plugin";class Kd extends b.Plugin{constructor({styles:r=C0.heading1,...n}={}){super(c0.heading1,{label:"Heading 1",markupElement:new Uw,...n});E0(this,"styles",{});this.styles=r}plugins(){return[Ww(this.styles)]}}class Uw extends b.MarkupElement{constructor(t=Rw,r=Ia){super(t,r)}}const Ia=({element:e,attributes:t,children:r,styles:n})=>{const a=e.align;return c.jsx("h1",{...t,className:b.merge([a&&b.alignmentClassnames[a],b.getColumnBreakClasses(e)]),style:n,children:r})},Ww=e=>b.createPluginFactory({key:c0.heading1,isElement:!0,component:Ia,deserializeHtml:{rules:[{validNodeName:["h1","H1"]}]}})({component:t=>c.jsx(Ia,{...t,styles:e})}),Kw="textstyle-heading2-plugin";class jd extends b.Plugin{constructor({styles:r=C0.heading2,...n}={}){super(c0.heading2,{label:"Heading 2",markupElement:new jw,...n});E0(this,"styles",{});this.styles=r}plugins(){return[Gw(this.styles)]}}class jw extends b.MarkupElement{constructor(t=Kw,r=Pa){super(t,r)}}const Pa=({element:e,attributes:t,children:r,styles:n})=>{const a=e.align;return c.jsx("h2",{...t,className:b.merge([a&&b.alignmentClassnames[a],b.getColumnBreakClasses(e)]),style:n,children:r})},Gw=e=>b.createPluginFactory({key:c0.heading2,isElement:!0,component:Pa,deserializeHtml:{rules:[{validNodeName:["h2","H2"]}]}})({component:t=>c.jsx(Pa,{...t,styles:e})}),qw="textstyle-heading3-plugin";class Gd extends b.Plugin{constructor({styles:r=C0.heading3,...n}={}){super(c0.heading3,{label:"Heading 3",markupElement:new Yw,...n});E0(this,"styles",{});this.styles=r}plugins(){return[Xw(this.styles)]}}class Yw extends b.MarkupElement{constructor(t=qw,r=ka){super(t,r)}}const ka=({element:e,attributes:t,children:r,styles:n})=>{const a=e.align;return c.jsx("h3",{...t,className:b.merge([a&&b.alignmentClassnames[a],b.getColumnBreakClasses(e)]),style:n,children:r})},Xw=e=>b.createPluginFactory({key:c0.heading3,isElement:!0,component:ka,deserializeHtml:{rules:[{validNodeName:["h3","H3"]}]}})({component:t=>c.jsx(ka,{...t,styles:e})}),Qw="textstyle-heading4-plugin";class qd extends b.Plugin{constructor({styles:r=C0.heading4,...n}={}){super(c0.heading4,{label:"Heading 4",markupElement:new Zw,...n});E0(this,"styles",{});this.styles=r}plugins(){return[Jw(this.styles)]}}class Zw extends b.MarkupElement{constructor(t=Qw,r=Ta){super(t,r)}}const Ta=({element:e,attributes:t,children:r,styles:n})=>{const a=e.align;return c.jsx("h4",{...t,className:b.merge([a&&b.alignmentClassnames[a],b.getColumnBreakClasses(e)]),style:n,children:r})},Jw=e=>b.createPluginFactory({key:c0.heading4,isElement:!0,component:Ta,deserializeHtml:{rules:[{validNodeName:["h4","H4"]}]}})({component:t=>c.jsx(Ta,{...t,styles:e})}),ey="textstyle-imageCaption-plugin";class Yd extends b.Plugin{constructor({styles:r=C0.imageCaption,...n}={}){super(c0.imageCaption,{label:"Image Caption",markupElement:new ty,...n});E0(this,"styles",{});this.styles=r}plugins(){return[ry(this.styles)]}}class ty extends b.MarkupElement{constructor(t=ey,r=Na){super(t,r)}}const Na=({element:e,attributes:t,children:r,styles:n})=>{const a=e.align;return c.jsx("p",{...t,className:b.merge([a&&b.alignmentClassnames[a],b.getColumnBreakClasses(e)]),style:n,children:r})},ry=e=>b.createPluginFactory({key:c0.imageCaption,isElement:!0,component:Na,deserializeHtml:{rules:[{validClassName:c0.imageCaption}]}})({component:t=>c.jsx(Na,{...t,styles:e})}),ny="textstyle-imageTitle-plugin";class Xd extends b.Plugin{constructor({styles:r=C0.imageTitle,...n}={}){super(c0.imageTitle,{label:"Image Title",markupElement:new oy,...n});E0(this,"styles",{});this.styles=r}plugins(){return[ay(this.styles)]}}class oy extends b.MarkupElement{constructor(t=ny,r=za){super(t,r)}}const za=({element:e,attributes:t,children:r,styles:n})=>{const a=e.align;return c.jsx("p",{...t,className:b.merge([a&&b.alignmentClassnames[a],b.getColumnBreakClasses(e)]),style:n,children:r})},ay=e=>b.createPluginFactory({key:c0.imageTitle,isElement:!0,component:za,deserializeHtml:{rules:[{validClassName:c0.imageTitle}]}})({component:t=>c.jsx(za,{...t,styles:e})});class Qd extends b.Plugin{constructor({styles:r=C0.p,...n}={}){super(c0.p,{markupElement:new Jd,label:"Body Text",...n});E0(this,"styles",{});this.styles=r}plugins(){return[eu(this.styles)]}}const Zd="tw-m-0 tw-px-0 tw-py-0",Tr=({element:e,attributes:t,children:r,styles:n})=>{const a=e.align,o=b.merge([a&&b.alignmentClassnames[a],Zd,b.getColumnBreakClasses(e)]);return c.jsx("p",{...t,className:o,style:n,children:r})};class Jd extends b.MarkupElement{constructor(t=c0.p,r=Tr){super(t,r)}}const eu=e=>b.createPluginFactory({...b.createParagraphPlugin(),key:c0.p,isElement:!0,component:Tr})({component:t=>c.jsx(Tr,{...t,styles:e})}),ly="textstyle-quote-plugin";class tu extends b.Plugin{constructor({styles:r=C0.quote,...n}={}){super(c0.quote,{label:"Quote",markupElement:new iy,...n});E0(this,"styles",{});this.styles=r}plugins(){return[ru(this.styles)]}}class iy extends b.MarkupElement{constructor(t=ly,r=Nr){super(t,r)}}const Nr=({element:e,attributes:t,children:r,styles:n})=>{const a=e.align;return c.jsx("blockquote",{...t,className:b.merge([a&&b.alignmentClassnames[a],b.getColumnBreakClasses(e)]),style:n,children:r})},ru=e=>b.createPluginFactory({key:c0.quote,isElement:!0,component:Nr,deserializeHtml:{rules:[{validNodeName:["blockquote","BLOCKQUOTE"]}]}})({component:t=>c.jsx(Nr,{...t,styles:e})}),Oa=[new Kd,new jd,new Gd,new qd,new $d,new Fd,new Ud,new tu,new Qd],ze=[c0.heading1,c0.heading2,c0.heading3,c0.heading4,c0.custom1,c0.custom2,c0.custom3,c0.quote,c0.p],sy=[...Oa,new Yd,new Xd],cy=[...ze,c0.imageCaption,c0.imageTitle],dy=e=>new b.PluginComposer().setPlugin(new b.SoftBreakPlugin,new b.TextStylePlugin({textStyles:Oa})).setPlugin([new b.BoldPlugin,new b.ItalicPlugin,new b.UnderlinePlugin,new b.StrikethroughPlugin,new Vd({appBridge:e}),new Ed({appBridge:e}),new b.CodePlugin],[new b.AlignLeftPlugin({validTypes:ze}),new b.AlignCenterPlugin({validTypes:ze}),new b.AlignRightPlugin({validTypes:ze}),new b.AlignJustifyPlugin({validTypes:ze}),new b.UnorderedListPlugin,new b.CheckboxListPlugin,new b.OrderedListPlugin,new b.ResetFormattingPlugin,new b.AutoformatPlugin]),uy="--f-theme-settings-",fy=e=>{const t=e!=null&&e.id?`hasBackground${e.id}`:"hasBackground",r=e!=null&&e.id?`backgroundColor${e.id}`:"backgroundColor",n=e!=null&&e.preventDefaultColor?void 0:(e==null?void 0:e.defaultColor)||gu,a=e!=null&&e.label?e.label:"Background",o=e!=null&&e.switchLabel?e.switchLabel:void 0;return{id:t,label:a,type:"switch",switchLabel:o,defaultValue:!!(e!=null&&e.defaultValue),on:[{id:r,defaultValue:n,type:"colorInput"}]}},hy=e=>{const t=e!=null&&e.id?`hasBorder_${e.id}`:"hasBorder",r=e!=null&&e.id?`borderSelection_${e.id}`:"borderSelection",n=e!=null&&e.id?`borderStyle_${e.id}`:"borderStyle",a=e!=null&&e.id?`borderWidth_${e.id}`:"borderWidth",o=e!=null&&e.id?`borderColor_${e.id}`:"borderColor",l=(e==null?void 0:e.defaultColor)||Ua,i=e!=null&&e.switchLabel?e.switchLabel:void 0;return{id:t,label:"Border",type:"switch",switchLabel:i,defaultValue:!!(e!=null&&e.defaultValue),on:[{id:r,type:"multiInput",layout:X.MultiInputLayout.Columns,lastItemFullWidth:!0,blocks:[{id:n,type:"dropdown",defaultValue:o1.Solid,choices:[{value:o1.Solid,label:o1.Solid},{value:o1.Dotted,label:o1.Dotted},{value:o1.Dashed,label:o1.Dashed}]},{id:a,type:"input",defaultValue:mu,rules:[X.numericalOrPixelRule,X.minimumNumericalOrPixelRule(0),X.maximumNumericalOrPixelOrAutoRule(500)],placeholder:"e.g. 3px",onChange:s=>X.appendUnit(s,a)},{id:o,type:"colorInput",defaultValue:l}]}],off:[]}},Da=(e,t=w1.None)=>({id:e,type:"segmentedControls",defaultValue:t,choices:[{value:w1.None,label:"None"},{value:w1.Small,label:"S"},{value:w1.Medium,label:"M"},{value:w1.Large,label:"L"}]}),py=e=>{const t=e!=null&&e.id?`hasRadius_${e.id}`:"hasRadius",r=e!=null&&e.id?`radiusValue_${e.id}`:"radiusValue",n=e!=null&&e.id?`radiusChoice_${e.id}`:"radiusChoice",a=(e==null?void 0:e.defaultRadius)||w1.None;return{id:t,label:"Corner radius",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"Determining how rounded the corners are.",show:o=>{var l;return e!=null&&e.dependentSettingId?!!((l=o.getBlock(e.dependentSettingId))!=null&&l.value):!0},onChange:o=>X.presetCustomValue(o,n,r,(e==null?void 0:e.radiusStyleMap)||$1),on:[{id:r,type:"input",placeholder:"e.g. 10px",rules:[X.numericalOrPixelRule],onChange:o=>X.appendUnit(o,r)}],off:[Da(n,a)]}},vy=e=>{const t=e!=null&&e.id?`hasExtendedCustomRadius_${e.id}`:"hasExtendedCustomRadius",r=e!=null&&e.id?`extendedRadiusValue_${e.id}`:"extendedRadiusValue",n=e!=null&&e.id?`extendedRadiusChoice_${e.id}`:"extendedRadiusChoice",a=e!=null&&e.id?`extendedRadiusTopLeft_${e.id}`:"extendedRadiusTopLeft",o=e!=null&&e.id?`extendedRadiusTopRight_${e.id}`:"extendedRadiusTopRight",l=e!=null&&e.id?`extendedRadiusBottomLeft_${e.id}`:"extendedRadiusBottomLeft",i=e!=null&&e.id?`extendedRadiusBottomRight_${e.id}`:"extendedRadiusBottomRight";return{id:t,label:"Corner radius",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"Determining how rounded the corners are.",show:s=>{var d;return e!=null&&e.dependentSettingId?!!((d=s.getBlock(e.dependentSettingId))!=null&&d.value):!0},onChange:s=>{X.presetCustomValue(s,n,a,$1),X.presetCustomValue(s,n,o,$1),X.presetCustomValue(s,n,l,$1),X.presetCustomValue(s,n,i,$1)},on:[{id:r,type:"multiInput",layout:X.MultiInputLayout.Columns,blocks:[{id:a,type:"input",label:"Top Left",rules:[X.numericalOrPixelRule],onChange:s=>X.appendUnit(s,a)},{id:o,type:"input",label:"Top Right",rules:[X.numericalOrPixelRule],onChange:s=>X.appendUnit(s,o)},{id:l,type:"input",label:"Bottom Left",rules:[X.numericalOrPixelRule],onChange:s=>X.appendUnit(s,l)},{id:i,type:"input",label:"Bottom Right",rules:[X.numericalOrPixelRule],onChange:s=>X.appendUnit(s,i)}]}],off:[Da(n,e==null?void 0:e.defaultValue)]}},gy=e=>{const t=e!=null&&e.id?e.id:"hasCustomSpacing",r=e!=null&&e.dependentSettingId?e.dependentSettingId:"columns",n=e!=null&&e.spacingChoiceId?e.spacingChoiceId:"spacingChoice",a=e!=null&&e.spacingCustomId?e.spacingCustomId:"spacingCustom",o=e!=null&&e.defaultValueChoices?e.defaultValueChoices:U1.M;return{id:t,type:"switch",defaultValue:!1,switchLabel:"Custom",label:"Gutter",info:"An official nerds term for ‘gap’",onChange:l=>X.presetCustomValue(l,n,a,Ka),show:l=>{var i;return((i=l.getBlock(r))==null?void 0:i.value)!=="1"},on:[{id:a,type:"input",rules:[X.numericalOrPixelRule],onChange:l=>X.appendUnit(l,a)}],off:[{id:n,type:"slider",defaultValue:o,choices:[{value:U1.Auto,label:"Auto"},{value:U1.S,label:"S"},{value:U1.M,label:"M"},{value:U1.L,label:"L"}]}]}},Ha=e=>({id:e,type:"segmentedControls",defaultValue:F1.None,choices:[{value:F1.None,label:"None"},{value:F1.Small,label:"S"},{value:F1.Medium,label:"M"},{value:F1.Large,label:"L"}]}),my=e=>{const t=e!=null&&e.id?`hasCustomMarginValue_${e==null?void 0:e.id}`:"hasCustomMarginValue",r=e!=null&&e.id?`marginValue_${e==null?void 0:e.id}`:"marginValue",n=e!=null&&e.id?`marginChoice_${e==null?void 0:e.id}`:"marginChoice";return{id:t,label:"Margin",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more space",onChange:a=>X.presetCustomValue(a,n,r,(e==null?void 0:e.marginStyleMap)||re),on:[{id:r,type:"input",placeholder:De,rules:[X.numericalOrPixelRule,X.maximumNumericalOrPixelOrAutoRule(500)],onChange:a=>X.appendUnit(a,r)}],off:[Ha(n)]}},by=e=>{const t=e!=null&&e.id?`hasExtendedCustomMargin_${e==null?void 0:e.id}`:"hasExtendedCustomMargin",r=e!=null&&e.id?`extendedMarginValues_${e==null?void 0:e.id}`:"extendedMarginValues",n=e!=null&&e.id?`extendedMarginChoice_${e==null?void 0:e.id}`:"extendedMarginChoice",a=e!=null&&e.id?`extendedMarginTop_${e==null?void 0:e.id}`:"extendedMarginTop",o=e!=null&&e.id?`extendedMarginLeft_${e==null?void 0:e.id}`:"extendedMarginLeft",l=e!=null&&e.id?`extendedMarginRight_${e==null?void 0:e.id}`:"extendedMarginRight",i=e!=null&&e.id?`extendedMarginBottom_${e==null?void 0:e.id}`:"extendedMarginBottom";return{id:t,label:"Margin",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more negative space",onChange:s=>{X.presetCustomValue(s,n,a,re),X.presetCustomValue(s,n,o,re),X.presetCustomValue(s,n,l,re),X.presetCustomValue(s,n,i,re)},on:[{id:r,type:"multiInput",layout:X.MultiInputLayout.Spider,blocks:[{id:a,type:"input",label:"Top",placeholder:De,onChange:s=>X.appendUnit(s,a),rules:[X.numericalOrPixelRule,X.maximumNumericalOrPixelOrAutoRule(500)]},{id:o,type:"input",label:"Left",placeholder:De,onChange:s=>X.appendUnit(s,o),rules:[X.numericalOrPixelRule,X.maximumNumericalOrPixelOrAutoRule(500)]},{id:l,type:"input",label:"Right",placeholder:De,onChange:s=>X.appendUnit(s,l),rules:[X.numericalOrPixelRule,X.maximumNumericalOrPixelOrAutoRule(500)]},{id:i,type:"input",label:"Bottom",placeholder:De,onChange:s=>X.appendUnit(s,i),rules:[X.numericalOrPixelRule,X.maximumNumericalOrPixelOrAutoRule(500)]}]}],off:[Ha(n)]}},Va=e=>({id:e,type:"segmentedControls",defaultValue:B1.Small,choices:[{value:B1.None,label:"None"},{value:B1.Small,label:"S"},{value:B1.Medium,label:"M"},{value:B1.Large,label:"L"}]}),wy=e=>{const t=e!=null&&e.id?`hasCustomPaddingValue_${e==null?void 0:e.id}`:"hasCustomPaddingValue",r=e!=null&&e.id?`paddingValue_${e==null?void 0:e.id}`:"paddingValue",n=e!=null&&e.id?`paddingChoice_${e==null?void 0:e.id}`:"paddingChoice";return{id:t,label:"Padding",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more negative space",onChange:a=>X.presetCustomValue(a,n,r,(e==null?void 0:e.paddingStyleMap)||te),on:[{id:r,type:"input",placeholder:Oe,rules:[X.numericalOrPixelRule,X.maximumNumericalOrPixelOrAutoRule(500)],onChange:a=>X.appendUnit(a,r)}],off:[Va(n)]}},yy=e=>{const t=e!=null&&e.id?`hasExtendedCustomPadding_${e==null?void 0:e.id}`:"hasExtendedCustomPadding",r=e!=null&&e.id?`extendedPaddingValues_${e==null?void 0:e.id}`:"extendedPaddingValues",n=e!=null&&e.id?`extendedPaddingChoice_${e==null?void 0:e.id}`:"extendedPaddingChoice",a=e!=null&&e.id?`extendedPaddingTop_${e==null?void 0:e.id}`:"extendedPaddingTop",o=e!=null&&e.id?`extendedPaddingLeft_${e==null?void 0:e.id}`:"extendedPaddingLeft",l=e!=null&&e.id?`extendedPaddingRight_${e==null?void 0:e.id}`:"extendedPaddingRight",i=e!=null&&e.id?`extendedPaddingBottom_${e==null?void 0:e.id}`:"extendedPaddingBottom";return{id:t,label:"Padding",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more negative space",onChange:s=>{X.presetCustomValue(s,n,a,te),X.presetCustomValue(s,n,o,te),X.presetCustomValue(s,n,l,te),X.presetCustomValue(s,n,i,te)},on:[{id:r,type:"multiInput",layout:X.MultiInputLayout.Spider,blocks:[{id:a,type:"input",label:"Top",placeholder:Oe,onChange:s=>X.appendUnit(s,a),rules:[X.numericalOrPixelRule,X.maximumNumericalOrPixelOrAutoRule(500)]},{id:o,type:"input",label:"Left",placeholder:Oe,onChange:s=>X.appendUnit(s,o),rules:[X.numericalOrPixelRule,X.maximumNumericalOrPixelOrAutoRule(500)]},{id:l,type:"input",label:"Right",placeholder:Oe,onChange:s=>X.appendUnit(s,l),rules:[X.numericalOrPixelRule,X.maximumNumericalOrPixelOrAutoRule(500)]},{id:i,type:"input",label:"Bottom",placeholder:Oe,onChange:s=>X.appendUnit(s,i),rules:[X.numericalOrPixelRule,X.maximumNumericalOrPixelOrAutoRule(500)]}]}],off:[Va(n)]}},Cy=e=>{const t=La(e==null?void 0:e.globalControlId);return{id:e!=null&&e.id?e.id:"downloadable",type:"switch",defaultValue:!1,label:"Downloadable",show:r=>{var n;return((n=r.getBlock(t))==null?void 0:n.value)===R1.Custom}}},La=e=>e||"security",xy=e=>[{id:La(e),type:"segmentedControls",defaultValue:R1.Global,choices:[{value:R1.Global,label:"Global Settings"},{value:R1.Custom,label:"Custom"}]},{id:"globalSettingsInfo",type:"notification",footer:X.createFooter({label:"Change global settings [here].",replace:{here:{event:"general-settings.open"}}})}];var nu=(e=>(e.Main="main",e.Basics="basics",e.Layout="layout",e.Style="style",e.Security="security",e.Targets="targets",e))(nu||{});const _y=e=>e,My=e=>e;T.AllTextStylePlugins=sy,T.AllTextStyles=cy,T.Attachments=Z7,T.AttachmentsProvider=Ja,T.AttachmentsToolbarButton=ed,T.BUTTON_PLUGIN=Ad,T.BlockButtonStyles=kr,T.BlockInjectButton=lu,T.BlockItemWrapper=sd,T.BlockStyles=C0,T.BorderStyle=o1,T.BreakAfterPlugin=Nw,T.ButtonPlugin=Ed,T.Custom1Plugin=$d,T.Custom2Plugin=Fd,T.Custom3Plugin=Ud,T.DEFAULT_ATTACHMENTS_BUTTON_ID=J7,T.DEFAULT_DRAGGING_TOOLTIP=rd,T.DEFAULT_DRAG_TOOLTIP=td,T.DEFAULT_MENU_BUTTON_ID=ma,T.DownloadButton=Hb,T.DragHandleToolbarButton=nd,T.DragPreviewContextProvider=Ga,T.ELEMENT_BUTTON=m0,T.FlyoutToolbarButton=ga,T.GAP_DEFAULT=Ld,T.GutterSpacing=U1,T.Heading1Plugin=Kd,T.Heading2Plugin=jd,T.Heading3Plugin=Gd,T.Heading4Plugin=qd,T.ImageCaptionPlugin=Yd,T.ImageTitlePlugin=Xd,T.KEY_ELEMENT_BREAK_AFTER_COLUMN=Tw,T.LinkInput=xd,T.LinkPlugin=Vd,T.LinkSelector=Cd,T.Margin=F1,T.MenuToolbarButton=ad,T.MultiFlyoutContextProvider=Ya,T.PARAGRAPH_CLASSES=Zd,T.Padding=B1,T.ParagraphMarkupElement=Jd,T.ParagraphMarkupElementNode=Tr,T.ParagraphPlugin=Qd,T.QuoteMarkupElementNode=Nr,T.QuotePlugin=tu,T.Radius=w1,T.RichTextEditor=ww,T.Sections=nu,T.Security=R1,T.THEME_PREFIX=uy,T.TextStylePluginsWithoutImage=Oa,T.TextStyles=c0,T.TextStylesWithoutImage=ze,T.Toolbar=id,T.ToolbarFlyoutMenu=od,T.addHttps=Er,T.borderStyleMap=Wa,T.convertToRteValue=$b,T.createButtonNode=gd,T.createButtonPlugin=Sd,T.createLinkPlugin=Hd,T.createParagraphPlugin=eu,T.createQuotePlugin=ru,T.customCoordinatesGetterFactory=t5,T.defineBlock=_y,T.defineSettings=My,T.getBackgroundColorStyles=vu,T.getBackgroundSettings=fy,T.getBorderRadiusSettings=py,T.getBorderRadiusSlider=Da,T.getBorderSettings=hy,T.getBorderStyles=bu,T.getDefaultPluginsWithLinkChooser=dy,T.getExtendedBorderRadiusSettings=vy,T.getGutterSettings=gy,T.getLegacyUrl=Wb,T.getLinkFromEditor=jb,T.getMarginExtendedSettings=by,T.getMarginSettings=my,T.getMarginSlider=Ha,T.getPaddingExtendedSettings=yy,T.getPaddingSettings=wy,T.getPaddingSlider=Va,T.getRadiusStyles=wu,T.getReadableColor=hu,T.getSecurityDownloadableSetting=Cy,T.getSecurityGlobalControlId=La,T.getSecurityGlobalControlSetting=xy,T.getUrl=Kb,T.getUrlFromEditor=vd,T.getUrlFromLinkOrLegacyLink=ya,T.gutterSpacingStyleMap=Ka,T.hasRichTextValue=cd,T.insertButton=fd,T.isDark=su,T.isDownloadable=Bb,T.isValidUrl=Ir,T.isValidUrlOrEmpty=ke,T.joinClassNames=n1,T.mapAppBridgeColorPaletteToFonduePalette=dd,T.mapAppBridgeColorPalettesToFonduePalettes=Fb,T.marginStyleMap=re,T.moveItemInArray=pu,T.paddingStyleMap=te,T.radiusStyleMap=$1,T.relativeUrlRegex=Ca,T.setAlpha=uu,T.submitFloatingButton=xa,T.toColorObject=fu,T.toHex8String=cu,T.toHexString=du,T.toRgbaString=Or,T.toShortRgba=L1,T.triggerFloatingButton=md,T.triggerFloatingButtonEdit=Pr,T.triggerFloatingButtonInsert=Ma,T.unwrapButton=Te,T.upsertButton=hd,T.upsertButtonText=_a,T.useAttachments=Qa,T.useAttachmentsContext=e5,T.useDndSensors=_u,T.useDragPreviewContext=He,T.useMultiFlyoutContext=Xa,T.useMultiFlyoutState=pt,T.withAttachmentsProvider=yu,T.withButton=ud,T.wrapButton=pd,Object.keys(X).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(T,e)&&Object.defineProperty(T,e,{enumerable:!0,get:()=>X[e]})}),Object.defineProperty(T,Symbol.toStringTag,{value:"Module"})});
|
|
88
88
|
//# sourceMappingURL=index.umd.js.map
|