@frontify/guideline-blocks-settings 0.36.13 → 0.36.14

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.
@@ -13,7 +13,7 @@ const D = x(
13
13
  shouldHideComponent: w = !1,
14
14
  isDragging: n = !1,
15
15
  shouldFillContainer: c,
16
- outlineOffset: o = 2,
16
+ outlineOffset: o = 0,
17
17
  shouldBeShown: i = !1,
18
18
  showAttachments: m = !1
19
19
  }) => {
@@ -1 +1 @@
1
- {"version":3,"file":"BlockItemWrapper.es.js","sources":["../../../src/components/BlockItemWrapper/BlockItemWrapper.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type ReactElement, memo, useRef, useState } from 'react';\n\nimport { joinClassNames } from '../../utilities';\n\nimport { DEFAULT_MENU_BUTTON_ID, Toolbar, type ToolbarItem } from './Toolbar';\nimport { DragPreviewContextProvider } from './Toolbar/context/DragPreviewContext';\nimport { MultiFlyoutContextProvider } from './Toolbar/context/MultiFlyoutContext';\nimport { type BlockItemWrapperProps } from './types';\n\nexport const BlockItemWrapper = memo(\n ({\n children,\n toolbarItems,\n shouldHideWrapper,\n shouldHideComponent = false,\n isDragging = false,\n shouldFillContainer,\n outlineOffset = 2,\n shouldBeShown = false,\n showAttachments = false,\n }: BlockItemWrapperProps): ReactElement => {\n const [openFlyoutIds, setOpenFlyoutIds] = useState<string[]>(shouldBeShown ? [DEFAULT_MENU_BUTTON_ID] : []);\n const wrapperRef = useRef<HTMLDivElement>(null);\n\n if (shouldHideWrapper) {\n // eslint-disable-next-line react/jsx-no-useless-fragment\n return <>{children}</>;\n }\n\n const items = toolbarItems?.filter((item): item is ToolbarItem => item !== undefined);\n\n const shouldToolbarBeVisible = openFlyoutIds.length > 0 || shouldBeShown;\n\n return (\n <DragPreviewContextProvider isDragPreview={isDragging}>\n <MultiFlyoutContextProvider openFlyoutIds={openFlyoutIds} setOpenFlyoutIds={setOpenFlyoutIds}>\n <div\n ref={wrapperRef}\n data-test-id=\"block-item-wrapper\"\n style={{\n outlineOffset,\n }}\n className={joinClassNames([\n 'tw-relative tw-group tw-outline-1 tw-outline-box-selected-inverse',\n shouldFillContainer && 'tw-flex-1 tw-h-full tw-w-full',\n 'hover:tw-outline focus-within:tw-outline',\n shouldToolbarBeVisible && 'tw-outline',\n shouldHideComponent && 'tw-opacity-0',\n ])}\n >\n <div\n style={{\n right: -1 - outlineOffset,\n bottom: `calc(100% - ${2 + outlineOffset}px)`,\n }}\n className={joinClassNames([\n 'tw-pointer-events-none tw-absolute tw-bottom-[calc(100%-4px)] tw-right-[-3px] tw-w-full tw-opacity-0 tw-z-[60]',\n 'group-hover:tw-opacity-100 group-focus:tw-opacity-100 focus-within:tw-opacity-100',\n 'tw-flex tw-justify-end',\n shouldToolbarBeVisible && 'tw-opacity-100',\n ])}\n >\n <Toolbar\n attachments={{\n isEnabled: showAttachments,\n }}\n items={items}\n />\n </div>\n {children}\n </div>\n </MultiFlyoutContextProvider>\n </DragPreviewContextProvider>\n );\n },\n);\n\nBlockItemWrapper.displayName = 'BlockItemWrapper';\n"],"names":["BlockItemWrapper","memo","children","toolbarItems","shouldHideWrapper","shouldHideComponent","isDragging","shouldFillContainer","outlineOffset","shouldBeShown","showAttachments","openFlyoutIds","setOpenFlyoutIds","useState","DEFAULT_MENU_BUTTON_ID","wrapperRef","useRef","items","item","shouldToolbarBeVisible","DragPreviewContextProvider","jsx","MultiFlyoutContextProvider","jsxs","joinClassNames","Toolbar"],"mappings":";;;;;;;AAWO,MAAMA,IAAmBC;AAAA,EAC5B,CAAC;AAAA,IACG,UAAAC;AAAA,IACA,cAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,qBAAAC,IAAsB;AAAA,IACtB,YAAAC,IAAa;AAAA,IACb,qBAAAC;AAAA,IACA,eAAAC,IAAgB;AAAA,IAChB,eAAAC,IAAgB;AAAA,IAChB,iBAAAC,IAAkB;AAAA,EAAA,MACqB;AACjC,UAAA,CAACC,GAAeC,CAAgB,IAAIC,EAAmBJ,IAAgB,CAACK,CAAsB,IAAI,CAAA,CAAE,GACpGC,IAAaC,EAAuB,IAAI;AAE9C,QAAIZ;AAEA,oCAAU,UAAAF,EAAS,CAAA;AAGvB,UAAMe,IAAQd,KAAA,gBAAAA,EAAc,OAAO,CAACe,MAA8BA,MAAS,SAErEC,IAAyBR,EAAc,SAAS,KAAKF;AAE3D,6BACKW,GAA2B,EAAA,eAAed,GACvC,UAAC,gBAAAe,EAAAC,GAAA,EAA2B,eAAAX,GAA8B,kBAAAC,GACtD,UAAA,gBAAAW;AAAA,MAAC;AAAA,MAAA;AAAA,QACG,KAAKR;AAAA,QACL,gBAAa;AAAA,QACb,OAAO;AAAA,UACH,eAAAP;AAAA,QACJ;AAAA,QACA,WAAWgB,EAAe;AAAA,UACtB;AAAA,UACAjB,KAAuB;AAAA,UACvB;AAAA,UACAY,KAA0B;AAAA,UAC1Bd,KAAuB;AAAA,QAAA,CAC1B;AAAA,QAED,UAAA;AAAA,UAAA,gBAAAgB;AAAA,YAAC;AAAA,YAAA;AAAA,cACG,OAAO;AAAA,gBACH,OAAO,KAAKb;AAAA,gBACZ,QAAQ,eAAe,IAAIA,CAAa;AAAA,cAC5C;AAAA,cACA,WAAWgB,EAAe;AAAA,gBACtB;AAAA,gBACA;AAAA,gBACA;AAAA,gBACAL,KAA0B;AAAA,cAAA,CAC7B;AAAA,cAED,UAAA,gBAAAE;AAAA,gBAACI;AAAA,gBAAA;AAAA,kBACG,aAAa;AAAA,oBACT,WAAWf;AAAA,kBACf;AAAA,kBACA,OAAAO;AAAA,gBAAA;AAAA,cACJ;AAAA,YAAA;AAAA,UACJ;AAAA,UACCf;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA,EAET,CAAA,EACJ,CAAA;AAAA,EAER;AACJ;AAEAF,EAAiB,cAAc;"}
1
+ {"version":3,"file":"BlockItemWrapper.es.js","sources":["../../../src/components/BlockItemWrapper/BlockItemWrapper.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type ReactElement, memo, useRef, useState } from 'react';\n\nimport { joinClassNames } from '../../utilities';\n\nimport { DEFAULT_MENU_BUTTON_ID, Toolbar, type ToolbarItem } from './Toolbar';\nimport { DragPreviewContextProvider } from './Toolbar/context/DragPreviewContext';\nimport { MultiFlyoutContextProvider } from './Toolbar/context/MultiFlyoutContext';\nimport { type BlockItemWrapperProps } from './types';\n\nexport const BlockItemWrapper = memo(\n ({\n children,\n toolbarItems,\n shouldHideWrapper,\n shouldHideComponent = false,\n isDragging = false,\n shouldFillContainer,\n outlineOffset = 0,\n shouldBeShown = false,\n showAttachments = false,\n }: BlockItemWrapperProps): ReactElement => {\n const [openFlyoutIds, setOpenFlyoutIds] = useState<string[]>(shouldBeShown ? [DEFAULT_MENU_BUTTON_ID] : []);\n const wrapperRef = useRef<HTMLDivElement>(null);\n\n if (shouldHideWrapper) {\n // eslint-disable-next-line react/jsx-no-useless-fragment\n return <>{children}</>;\n }\n\n const items = toolbarItems?.filter((item): item is ToolbarItem => item !== undefined);\n\n const shouldToolbarBeVisible = openFlyoutIds.length > 0 || shouldBeShown;\n\n return (\n <DragPreviewContextProvider isDragPreview={isDragging}>\n <MultiFlyoutContextProvider openFlyoutIds={openFlyoutIds} setOpenFlyoutIds={setOpenFlyoutIds}>\n <div\n ref={wrapperRef}\n data-test-id=\"block-item-wrapper\"\n style={{\n outlineOffset,\n }}\n className={joinClassNames([\n 'tw-relative tw-group tw-outline-1 tw-outline-box-selected-inverse',\n shouldFillContainer && 'tw-flex-1 tw-h-full tw-w-full',\n 'hover:tw-outline focus-within:tw-outline',\n shouldToolbarBeVisible && 'tw-outline',\n shouldHideComponent && 'tw-opacity-0',\n ])}\n >\n <div\n style={{\n right: -1 - outlineOffset,\n bottom: `calc(100% - ${2 + outlineOffset}px)`,\n }}\n className={joinClassNames([\n 'tw-pointer-events-none tw-absolute tw-bottom-[calc(100%-4px)] tw-right-[-3px] tw-w-full tw-opacity-0 tw-z-[60]',\n 'group-hover:tw-opacity-100 group-focus:tw-opacity-100 focus-within:tw-opacity-100',\n 'tw-flex tw-justify-end',\n shouldToolbarBeVisible && 'tw-opacity-100',\n ])}\n >\n <Toolbar\n attachments={{\n isEnabled: showAttachments,\n }}\n items={items}\n />\n </div>\n {children}\n </div>\n </MultiFlyoutContextProvider>\n </DragPreviewContextProvider>\n );\n },\n);\n\nBlockItemWrapper.displayName = 'BlockItemWrapper';\n"],"names":["BlockItemWrapper","memo","children","toolbarItems","shouldHideWrapper","shouldHideComponent","isDragging","shouldFillContainer","outlineOffset","shouldBeShown","showAttachments","openFlyoutIds","setOpenFlyoutIds","useState","DEFAULT_MENU_BUTTON_ID","wrapperRef","useRef","items","item","shouldToolbarBeVisible","DragPreviewContextProvider","jsx","MultiFlyoutContextProvider","jsxs","joinClassNames","Toolbar"],"mappings":";;;;;;;AAWO,MAAMA,IAAmBC;AAAA,EAC5B,CAAC;AAAA,IACG,UAAAC;AAAA,IACA,cAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,qBAAAC,IAAsB;AAAA,IACtB,YAAAC,IAAa;AAAA,IACb,qBAAAC;AAAA,IACA,eAAAC,IAAgB;AAAA,IAChB,eAAAC,IAAgB;AAAA,IAChB,iBAAAC,IAAkB;AAAA,EAAA,MACqB;AACjC,UAAA,CAACC,GAAeC,CAAgB,IAAIC,EAAmBJ,IAAgB,CAACK,CAAsB,IAAI,CAAA,CAAE,GACpGC,IAAaC,EAAuB,IAAI;AAE9C,QAAIZ;AAEA,oCAAU,UAAAF,EAAS,CAAA;AAGvB,UAAMe,IAAQd,KAAA,gBAAAA,EAAc,OAAO,CAACe,MAA8BA,MAAS,SAErEC,IAAyBR,EAAc,SAAS,KAAKF;AAE3D,6BACKW,GAA2B,EAAA,eAAed,GACvC,UAAC,gBAAAe,EAAAC,GAAA,EAA2B,eAAAX,GAA8B,kBAAAC,GACtD,UAAA,gBAAAW;AAAA,MAAC;AAAA,MAAA;AAAA,QACG,KAAKR;AAAA,QACL,gBAAa;AAAA,QACb,OAAO;AAAA,UACH,eAAAP;AAAA,QACJ;AAAA,QACA,WAAWgB,EAAe;AAAA,UACtB;AAAA,UACAjB,KAAuB;AAAA,UACvB;AAAA,UACAY,KAA0B;AAAA,UAC1Bd,KAAuB;AAAA,QAAA,CAC1B;AAAA,QAED,UAAA;AAAA,UAAA,gBAAAgB;AAAA,YAAC;AAAA,YAAA;AAAA,cACG,OAAO;AAAA,gBACH,OAAO,KAAKb;AAAA,gBACZ,QAAQ,eAAe,IAAIA,CAAa;AAAA,cAC5C;AAAA,cACA,WAAWgB,EAAe;AAAA,gBACtB;AAAA,gBACA;AAAA,gBACA;AAAA,gBACAL,KAA0B;AAAA,cAAA,CAC7B;AAAA,cAED,UAAA,gBAAAE;AAAA,gBAACI;AAAA,gBAAA;AAAA,kBACG,aAAa;AAAA,oBACT,WAAWf;AAAA,kBACf;AAAA,kBACA,OAAAO;AAAA,gBAAA;AAAA,cACJ;AAAA,YAAA;AAAA,UACJ;AAAA,UACCf;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA,EAET,CAAA,EACJ,CAAA;AAAA,EAER;AACJ;AAEAF,EAAiB,cAAc;"}
package/dist/index.cjs.js CHANGED
@@ -82,7 +82,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
82
82
  - less than the value passed to \`max\` (or ${zo} if no \`max\` prop is set)
83
83
  - \`null\` or \`undefined\` if the progress is indeterminate.
84
84
 
85
- Defaulting to \`null\`.`}var gp=Fs,bp=Ks;const wp=B1({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"}}}),yp=B1({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]"}}}),xp=C.forwardRef(({value:e,max:t=100,rounded:n=!0,variant:r="default",size:a="medium","data-test-id":o="fondue-loading-bar",...l},i)=>c.jsx(gp,{ref:i,"data-test-id":o,className:wp({rounded:n,size:a,variant:r}),"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(bp,{className:yp({variant:r,indeterminateState:e===null})})}));xp.displayName="LoadingBar";function Vo(e,[t,n]){return Math.min(n,Math.max(t,e))}function Cp(e,t){return p.useReducer((n,r)=>t[n][r]??n,e)}var Lo="ScrollArea",[qs,yg]=H0(Lo),[_p,U0]=qs(Lo),Gs=p.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:a,scrollHideDelay:o=600,...l}=e,[i,s]=p.useState(null),[u,d]=p.useState(null),[f,h]=p.useState(null),[g,x]=p.useState(null),[b,m]=p.useState(null),[S,y]=p.useState(0),[_,M]=p.useState(0),[E,I]=p.useState(!1),[k,T]=p.useState(!1),j=s0(t,K=>s(K)),z=Xt(a);return c.jsx(_p,{scope:n,type:r,dir:z,scrollHideDelay:o,scrollArea:i,viewport:u,onViewportChange:d,content:f,onContentChange:h,scrollbarX:g,onScrollbarXChange:x,scrollbarXEnabled:E,onScrollbarXEnabledChange:I,scrollbarY:b,onScrollbarYChange:m,scrollbarYEnabled:k,onScrollbarYEnabledChange:T,onCornerWidthChange:y,onCornerHeightChange:M,children:c.jsx(o0.div,{dir:z,...l,ref:j,style:{position:"relative","--radix-scroll-area-corner-width":S+"px","--radix-scroll-area-corner-height":_+"px",...e.style}})})});Gs.displayName=Lo;var Ys="ScrollAreaViewport",Xs=p.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,nonce:a,...o}=e,l=U0(Ys,n),i=p.useRef(null),s=s0(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:r})})]})});Xs.displayName=Ys;var r1="ScrollAreaScrollbar",Qs=p.forwardRef((e,t)=>{const{forceMount:n,...r}=e,a=U0(r1,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(Mp,{...r,ref:t,forceMount:n}):a.type==="scroll"?c.jsx(Sp,{...r,ref:t,forceMount:n}):a.type==="auto"?c.jsx(Zs,{...r,ref:t,forceMount:n}):a.type==="always"?c.jsx(jo,{...r,ref:t}):null});Qs.displayName=r1;var Mp=p.forwardRef((e,t)=>{const{forceMount:n,...r}=e,a=U0(r1,e.__scopeScrollArea),[o,l]=p.useState(!1);return p.useEffect(()=>{const i=a.scrollArea;let s=0;if(i){const u=()=>{window.clearTimeout(s),l(!0)},d=()=>{s=window.setTimeout(()=>l(!1),a.scrollHideDelay)};return i.addEventListener("pointerenter",u),i.addEventListener("pointerleave",d),()=>{window.clearTimeout(s),i.removeEventListener("pointerenter",u),i.removeEventListener("pointerleave",d)}}},[a.scrollArea,a.scrollHideDelay]),c.jsx(I0,{present:n||o,children:c.jsx(Zs,{"data-state":o?"visible":"hidden",...r,ref:t})})}),Sp=p.forwardRef((e,t)=>{const{forceMount:n,...r}=e,a=U0(r1,e.__scopeScrollArea),o=e.orientation==="horizontal",l=nn(()=>s("SCROLL_END"),100),[i,s]=Cp("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 u=window.setTimeout(()=>s("HIDE"),a.scrollHideDelay);return()=>window.clearTimeout(u)}},[i,a.scrollHideDelay,s]),p.useEffect(()=>{const u=a.viewport,d=o?"scrollLeft":"scrollTop";if(u){let f=u[d];const h=()=>{const g=u[d];f!==g&&(s("SCROLL"),l()),f=g};return u.addEventListener("scroll",h),()=>u.removeEventListener("scroll",h)}},[a.viewport,o,s,l]),c.jsx(I0,{present:n||i!=="hidden",children:c.jsx(jo,{"data-state":i==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:t0(e.onPointerEnter,()=>s("POINTER_ENTER")),onPointerLeave:t0(e.onPointerLeave,()=>s("POINTER_LEAVE"))})})}),Zs=p.forwardRef((e,t)=>{const n=U0(r1,e.__scopeScrollArea),{forceMount:r,...a}=e,[o,l]=p.useState(!1),i=e.orientation==="horizontal",s=nn(()=>{if(n.viewport){const u=n.viewport.offsetWidth<n.viewport.scrollWidth,d=n.viewport.offsetHeight<n.viewport.scrollHeight;l(i?u:d)}},10);return ie(n.viewport,s),ie(n.content,s),c.jsx(I0,{present:r||o,children:c.jsx(jo,{"data-state":o?"visible":"hidden",...a,ref:t})})}),jo=p.forwardRef((e,t)=>{const{orientation:n="vertical",...r}=e,a=U0(r1,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}}),u=rc(i.viewport,i.content),d={...r,sizes:i,onSizesChange:s,hasThumb:u>0&&u<1,onThumbChange:h=>o.current=h,onThumbPointerUp:()=>l.current=0,onThumbPointerDown:h=>l.current=h};function f(h,g){return Tp(h,l.current,i,g)}return n==="horizontal"?c.jsx(Ep,{...d,ref:t,onThumbPositionChange:()=>{if(a.viewport&&o.current){const h=a.viewport.scrollLeft,g=d5(h,i,a.dir);o.current.style.transform=`translate3d(${g}px, 0, 0)`}},onWheelScroll:h=>{a.viewport&&(a.viewport.scrollLeft=h)},onDragScroll:h=>{a.viewport&&(a.viewport.scrollLeft=f(h,a.dir))}}):n==="vertical"?c.jsx(Ap,{...d,ref:t,onThumbPositionChange:()=>{if(a.viewport&&o.current){const h=a.viewport.scrollTop,g=d5(h,i);o.current.style.transform=`translate3d(0, ${g}px, 0)`}},onWheelScroll:h=>{a.viewport&&(a.viewport.scrollTop=h)},onDragScroll:h=>{a.viewport&&(a.viewport.scrollTop=f(h))}}):null}),Ep=p.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...a}=e,o=U0(r1,e.__scopeScrollArea),[l,i]=p.useState(),s=p.useRef(null),u=s0(t,s,o.onScrollbarXChange);return p.useEffect(()=>{s.current&&i(getComputedStyle(s.current))},[s]),c.jsx(ec,{"data-orientation":"horizontal",...a,ref:u,sizes:n,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":tn(n)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.x),onDragScroll:d=>e.onDragScroll(d.x),onWheelScroll:(d,f)=>{if(o.viewport){const h=o.viewport.scrollLeft+d.deltaX;e.onWheelScroll(h),ac(h,f)&&d.preventDefault()}},onResize:()=>{s.current&&o.viewport&&l&&r({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:s.current.clientWidth,paddingStart:kt(l.paddingLeft),paddingEnd:kt(l.paddingRight)}})}})}),Ap=p.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...a}=e,o=U0(r1,e.__scopeScrollArea),[l,i]=p.useState(),s=p.useRef(null),u=s0(t,s,o.onScrollbarYChange);return p.useEffect(()=>{s.current&&i(getComputedStyle(s.current))},[s]),c.jsx(ec,{"data-orientation":"vertical",...a,ref:u,sizes:n,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":tn(n)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.y),onDragScroll:d=>e.onDragScroll(d.y),onWheelScroll:(d,f)=>{if(o.viewport){const h=o.viewport.scrollTop+d.deltaY;e.onWheelScroll(h),ac(h,f)&&d.preventDefault()}},onResize:()=>{s.current&&o.viewport&&l&&r({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:s.current.clientHeight,paddingStart:kt(l.paddingTop),paddingEnd:kt(l.paddingBottom)}})}})}),[Ip,Js]=qs(r1),ec=p.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:a,onThumbChange:o,onThumbPointerUp:l,onThumbPointerDown:i,onThumbPositionChange:s,onDragScroll:u,onWheelScroll:d,onResize:f,...h}=e,g=U0(r1,n),[x,b]=p.useState(null),m=s0(t,j=>b(j)),S=p.useRef(null),y=p.useRef(""),_=g.viewport,M=r.content-r.viewport,E=A0(d),I=A0(s),k=nn(f,10);function T(j){if(S.current){const z=j.clientX-S.current.left,K=j.clientY-S.current.top;u({x:z,y:K})}}return p.useEffect(()=>{const j=z=>{const K=z.target;(x==null?void 0:x.contains(K))&&E(z,M)};return document.addEventListener("wheel",j,{passive:!1}),()=>document.removeEventListener("wheel",j,{passive:!1})},[_,x,M,E]),p.useEffect(I,[r,I]),ie(x,k),ie(g.content,k),c.jsx(Ip,{scope:n,scrollbar:x,hasThumb:a,onThumbChange:A0(o),onThumbPointerUp:A0(l),onThumbPositionChange:I,onThumbPointerDown:A0(i),children:c.jsx(o0.div,{...h,ref:m,style:{position:"absolute",...h.style},onPointerDown:t0(e.onPointerDown,j=>{j.button===0&&(j.target.setPointerCapture(j.pointerId),S.current=x.getBoundingClientRect(),y.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",g.viewport&&(g.viewport.style.scrollBehavior="auto"),T(j))}),onPointerMove:t0(e.onPointerMove,T),onPointerUp:t0(e.onPointerUp,j=>{const z=j.target;z.hasPointerCapture(j.pointerId)&&z.releasePointerCapture(j.pointerId),document.body.style.webkitUserSelect=y.current,g.viewport&&(g.viewport.style.scrollBehavior=""),S.current=null})})})}),Tt="ScrollAreaThumb",tc=p.forwardRef((e,t)=>{const{forceMount:n,...r}=e,a=Js(Tt,e.__scopeScrollArea);return c.jsx(I0,{present:n||a.hasThumb,children:c.jsx(Pp,{ref:t,...r})})}),Pp=p.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...a}=e,o=U0(Tt,n),l=Js(Tt,n),{onThumbPositionChange:i}=l,s=s0(t,f=>l.onThumbChange(f)),u=p.useRef(),d=nn(()=>{u.current&&(u.current(),u.current=void 0)},100);return p.useEffect(()=>{const f=o.viewport;if(f){const h=()=>{if(d(),!u.current){const g=kp(f,i);u.current=g,i()}};return i(),f.addEventListener("scroll",h),()=>f.removeEventListener("scroll",h)}},[o.viewport,d,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)",...r},onPointerDownCapture:t0(e.onPointerDownCapture,f=>{const g=f.target.getBoundingClientRect(),x=f.clientX-g.left,b=f.clientY-g.top;l.onThumbPointerDown({x,y:b})}),onPointerUp:t0(e.onPointerUp,l.onThumbPointerUp)})});tc.displayName=Tt;var $o="ScrollAreaCorner",nc=p.forwardRef((e,t)=>{const n=U0($o,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?c.jsx(Rp,{...e,ref:t}):null});nc.displayName=$o;var Rp=p.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,a=U0($o,n),[o,l]=p.useState(0),[i,s]=p.useState(0),u=!!(o&&i);return ie(a.scrollbarX,()=>{var f;const d=((f=a.scrollbarX)==null?void 0:f.offsetHeight)||0;a.onCornerHeightChange(d),s(d)}),ie(a.scrollbarY,()=>{var f;const d=((f=a.scrollbarY)==null?void 0:f.offsetWidth)||0;a.onCornerWidthChange(d),l(d)}),u?c.jsx(o0.div,{...r,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 kt(e){return e?parseInt(e,10):0}function rc(e,t){const n=e/t;return isNaN(n)?0:n}function tn(e){const t=rc(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function Tp(e,t,n,r="ltr"){const a=tn(n),o=a/2,l=t||o,i=a-l,s=n.scrollbar.paddingStart+l,u=n.scrollbar.size-n.scrollbar.paddingEnd-i,d=n.content-n.viewport,f=r==="ltr"?[0,d]:[d*-1,0];return oc([s,u],f)(e)}function d5(e,t,n="ltr"){const r=tn(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-a,l=t.content-t.viewport,i=o-r,s=n==="ltr"?[0,l]:[l*-1,0],u=Vo(e,s);return oc([0,l],[0,i])(u)}function oc(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function ac(e,t){return e>0&&e<t}var kp=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return function a(){const o={left:e.scrollLeft,top:e.scrollTop},l=n.left!==o.left,i=n.top!==o.top;(l||i)&&t(),n=o,r=window.requestAnimationFrame(a)}(),()=>window.cancelAnimationFrame(r)};function nn(e,t){const n=A0(e),r=p.useRef(0);return p.useEffect(()=>()=>window.clearTimeout(r.current),[]),p.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function ie(e,t){const n=A0(t);w1(()=>{let r=0;if(e){const a=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return a.observe(e),()=>{window.cancelAnimationFrame(r),a.unobserve(e)}}},[e,n])}var Np=Gs,Dp=Xs,f5=Qs,h5=tc,Op=nc;const Hp="_root_xlbio_3",zp="_viewport_xlbio_10",Vp="_scrollbar_xlbio_16",Lp="_thumb_xlbio_41",jp="_corner_xlbio_60",A1={root:Hp,viewport:zp,scrollbar:Vp,thumb:Lp,corner:jp},$p=({type:e,maxHeight:t="100%",maxWidth:n="100%",children:r,"data-test-id":a="fondue-scroll-area"},o)=>c.jsxs(Np,{type:e,className:A1.root,style:{maxWidth:n},"data-test-id":a,ref:o,children:[c.jsx(Dp,{className:A1.viewport,style:{maxHeight:t},"data-test-id":`${a}-viewport`,children:r}),c.jsx(f5,{className:A1.scrollbar,orientation:"vertical","data-test-id":`${a}-vertical-scrollbar`,children:c.jsx(h5,{className:A1.thumb,"data-test-id":`${a}-vertical-scrollbar-thumb`})}),c.jsx(f5,{className:A1.scrollbar,orientation:"horizontal","data-test-id":`${a}-horizontal-scrollbar`,children:c.jsx(h5,{className:A1.thumb,"data-test-id":`${a}-horizontal-scrollbar-thumb`})}),c.jsx(Op,{className:A1.corner,"data-test-id":`${a}-corner`})]}),Bp=C.forwardRef($p);Bp.displayName="ScrollArea";var Fp="Toggle",lc=p.forwardRef((e,t)=>{const{pressed:n,defaultPressed:r=!1,onPressedChange:a,...o}=e,[l=!1,i]=n1({prop:n,onChange:a,defaultProp:r});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)})})});lc.displayName=Fp;var me="ToggleGroup",[ic,xg]=H0(me,[Zt]),sc=Zt(),Bo=C.forwardRef((e,t)=>{const{type:n,...r}=e;if(n==="single"){const a=r;return c.jsx(Up,{...a,ref:t})}if(n==="multiple"){const a=r;return c.jsx(Kp,{...a,ref:t})}throw new Error(`Missing prop \`type\` expected on \`${me}\``)});Bo.displayName=me;var[cc,uc]=ic(me),Up=C.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:a=()=>{},...o}=e,[l,i]=n1({prop:n,defaultProp:r,onChange:a});return c.jsx(cc,{scope:e.__scopeToggleGroup,type:"single",value:l?[l]:[],onItemActivate:i,onItemDeactivate:C.useCallback(()=>i(""),[i]),children:c.jsx(dc,{...o,ref:t})})}),Kp=C.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:a=()=>{},...o}=e,[l=[],i]=n1({prop:n,defaultProp:r,onChange:a}),s=C.useCallback(d=>i((f=[])=>[...f,d]),[i]),u=C.useCallback(d=>i((f=[])=>f.filter(h=>h!==d)),[i]);return c.jsx(cc,{scope:e.__scopeToggleGroup,type:"multiple",value:l,onItemActivate:s,onItemDeactivate:u,children:c.jsx(dc,{...o,ref:t})})});Bo.displayName=me;var[Wp,qp]=ic(me),dc=C.forwardRef((e,t)=>{const{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:a=!0,orientation:o,dir:l,loop:i=!0,...s}=e,u=sc(n),d=Xt(l),f={role:"group",dir:d,...s};return c.jsx(Wp,{scope:n,rovingFocus:a,disabled:r,children:a?c.jsx(qi,{asChild:!0,...u,orientation:o,dir:d,loop:i,children:c.jsx(o0.div,{...f,ref:t})}):c.jsx(o0.div,{...f,ref:t})})}),Nt="ToggleGroupItem",fc=C.forwardRef((e,t)=>{const n=uc(Nt,e.__scopeToggleGroup),r=qp(Nt,e.__scopeToggleGroup),a=sc(e.__scopeToggleGroup),o=n.value.includes(e.value),l=r.disabled||e.disabled,i={...e,pressed:o,disabled:l},s=C.useRef(null);return r.rovingFocus?c.jsx(Gi,{asChild:!0,...a,focusable:!l,active:o,ref:s,children:c.jsx(p5,{...i,ref:t})}):c.jsx(p5,{...i,ref:t})});fc.displayName=Nt;var p5=C.forwardRef((e,t)=>{const{__scopeToggleGroup:n,value:r,...a}=e,o=uc(Nt,n),l={role:"radio","aria-checked":e.pressed,"aria-pressed":void 0},i=o.type==="single"?l:void 0;return c.jsx(lc,{...i,...a,ref:t,onPressedChange:s=>{s?o.onItemActivate(r):o.onItemDeactivate(r)}})}),Gp=Bo,Yp=fc;const Xp=({prop:e,defaultProp:t,onChange:n=()=>{}})=>{const[r,a]=Qp({defaultProp:t,onChange:n}),o=e!==void 0,l=o?e:r,i=C.useMemo(()=>n,[n]),s=C.useCallback(u=>{if(o){const d=typeof u=="function"?u(e):u;d!==e&&i(d)}else a(u)},[o,e,a,i]);return[l,s]},Qp=({defaultProp:e,onChange:t})=>{const n=C.useState(e),[r]=n,a=C.useRef(r),o=C.useMemo(()=>t,[t]);return C.useEffect(()=>{a.current!==r&&(o==null||o(r),a.current=r)},[r,a,o]),n},Zp="_root_1b6uw_5",Jp="_item_1b6uw_25",ev="_itemLabel_1b6uw_45",tv="_itemLabelActive_1b6uw_64",nv="_itemLabelInactive_1b6uw_87",rv="_activeIndicator_1b6uw_111",ov="_separator_1b6uw_202",T1={root:Zp,item:Jp,itemLabel:ev,itemLabelActive:tv,itemLabelInactive:nv,activeIndicator:rv,separator:ov},hc=({children:e,value:t,defaultValue:n,onValueChange:r,...a},o)=>{const[l,i]=Xp({prop:t,defaultProp:n,onChange:r});return c.jsxs(Gp,{ref:o,...a,className:T1.root,onValueChange:s=>{s&&i(s)},value:l,type:"single",asChild:!1,"aria-disabled":a.disabled,children:[e,c.jsx("div",{className:T1.activeIndicator})]})};hc.displayName="SegmentedControl.Root";const pc=({children:e,...t},n)=>c.jsxs(Yp,{ref:n,...t,className:T1.item,asChild:!1,children:[c.jsx("span",{className:T1.separator}),c.jsxs("span",{className:T1.itemLabel,children:[c.jsx("span",{className:T1.itemLabelActive,children:e}),c.jsx("span",{className:T1.itemLabelInactive,children:e})]})]});pc.displayName="SegmentedControl.Item";C.forwardRef(hc),C.forwardRef(pc);var vc=["PageUp","PageDown"],mc=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],gc={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},ge="Slider",[rr,av,lv]=Ao(ge),[bc,Cg]=H0(ge,[lv]),[iv,rn]=bc(ge),wc=p.forwardRef((e,t)=>{const{name:n,min:r=0,max:a=100,step:o=1,orientation:l="horizontal",disabled:i=!1,minStepsBetweenThumbs:s=0,defaultValue:u=[r],value:d,onValueChange:f=()=>{},onValueCommit:h=()=>{},inverted:g=!1,...x}=e,b=p.useRef(new Set),m=p.useRef(0),y=l==="horizontal"?sv:cv,[_=[],M]=n1({prop:d,defaultProp:u,onChange:z=>{var N;(N=[...b.current][m.current])==null||N.focus(),f(z)}}),E=p.useRef(_);function I(z){const K=pv(_,z);j(z,K)}function k(z){j(z,m.current)}function T(){const z=E.current[m.current];_[m.current]!==z&&h(_)}function j(z,K,{commit:N}={commit:!1}){const F=bv(o),V=wv(Math.round((z-r)/o)*o+r,F),B=Vo(V,[r,a]);M((U=[])=>{const H=fv(U,B,K);if(gv(H,s*o)){m.current=H.indexOf(B);const L=String(H)!==String(U);return L&&N&&h(H),L?H:U}else return U})}return c.jsx(iv,{scope:e.__scopeSlider,name:n,disabled:i,min:r,max:a,valueIndexToChangeRef:m,thumbs:b.current,values:_,orientation:l,children:c.jsx(rr.Provider,{scope:e.__scopeSlider,children:c.jsx(rr.Slot,{scope:e.__scopeSlider,children:c.jsx(y,{"aria-disabled":i,"data-disabled":i?"":void 0,...x,ref:t,onPointerDown:t0(x.onPointerDown,()=>{i||(E.current=_)}),min:r,max:a,inverted:g,onSlideStart:i?void 0:I,onSlideMove:i?void 0:k,onSlideEnd:i?void 0:T,onHomeKeyDown:()=>!i&&j(r,0,{commit:!0}),onEndKeyDown:()=>!i&&j(a,_.length-1,{commit:!0}),onStepKeyDown:({event:z,direction:K})=>{if(!i){const V=vc.includes(z.key)||z.shiftKey&&mc.includes(z.key)?10:1,B=m.current,U=_[B],H=o*V*K;j(U+H,B,{commit:!0})}}})})})})});wc.displayName=ge;var[yc,xc]=bc(ge,{startEdge:"left",endEdge:"right",size:"width",direction:1}),sv=p.forwardRef((e,t)=>{const{min:n,max:r,dir:a,inverted:o,onSlideStart:l,onSlideMove:i,onSlideEnd:s,onStepKeyDown:u,...d}=e,[f,h]=p.useState(null),g=s0(t,_=>h(_)),x=p.useRef(),b=Xt(a),m=b==="ltr",S=m&&!o||!m&&o;function y(_){const M=x.current||f.getBoundingClientRect(),E=[0,M.width],k=Fo(E,S?[n,r]:[r,n]);return x.current=M,k(_-M.left)}return c.jsx(yc,{scope:e.__scopeSlider,startEdge:S?"left":"right",endEdge:S?"right":"left",direction:S?1:-1,size:"width",children:c.jsx(Cc,{dir:b,"data-orientation":"horizontal",...d,ref:g,style:{...d.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:_=>{const M=y(_.clientX);l==null||l(M)},onSlideMove:_=>{const M=y(_.clientX);i==null||i(M)},onSlideEnd:()=>{x.current=void 0,s==null||s()},onStepKeyDown:_=>{const E=gc[S?"from-left":"from-right"].includes(_.key);u==null||u({event:_,direction:E?-1:1})}})})}),cv=p.forwardRef((e,t)=>{const{min:n,max:r,inverted:a,onSlideStart:o,onSlideMove:l,onSlideEnd:i,onStepKeyDown:s,...u}=e,d=p.useRef(null),f=s0(t,d),h=p.useRef(),g=!a;function x(b){const m=h.current||d.current.getBoundingClientRect(),S=[0,m.height],_=Fo(S,g?[r,n]:[n,r]);return h.current=m,_(b-m.top)}return c.jsx(yc,{scope:e.__scopeSlider,startEdge:g?"bottom":"top",endEdge:g?"top":"bottom",size:"height",direction:g?1:-1,children:c.jsx(Cc,{"data-orientation":"vertical",...u,ref:f,style:{...u.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:b=>{const m=x(b.clientY);o==null||o(m)},onSlideMove:b=>{const m=x(b.clientY);l==null||l(m)},onSlideEnd:()=>{h.current=void 0,i==null||i()},onStepKeyDown:b=>{const S=gc[g?"from-bottom":"from-top"].includes(b.key);s==null||s({event:b,direction:S?-1:1})}})})}),Cc=p.forwardRef((e,t)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:a,onSlideEnd:o,onHomeKeyDown:l,onEndKeyDown:i,onStepKeyDown:s,...u}=e,d=rn(ge,n);return c.jsx(o0.span,{...u,ref:t,onKeyDown:t0(e.onKeyDown,f=>{f.key==="Home"?(l(f),f.preventDefault()):f.key==="End"?(i(f),f.preventDefault()):vc.concat(mc).includes(f.key)&&(s(f),f.preventDefault())}),onPointerDown:t0(e.onPointerDown,f=>{const h=f.target;h.setPointerCapture(f.pointerId),f.preventDefault(),d.thumbs.has(h)?h.focus():r(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))})})}),_c="SliderTrack",Mc=p.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,a=rn(_c,n);return c.jsx(o0.span,{"data-disabled":a.disabled?"":void 0,"data-orientation":a.orientation,...r,ref:t})});Mc.displayName=_c;var or="SliderRange",Sc=p.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,a=rn(or,n),o=xc(or,n),l=p.useRef(null),i=s0(t,l),s=a.values.length,u=a.values.map(h=>Ac(h,a.min,a.max)),d=s>1?Math.min(...u):0,f=100-Math.max(...u);return c.jsx(o0.span,{"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,...r,ref:i,style:{...e.style,[o.startEdge]:d+"%",[o.endEdge]:f+"%"}})});Sc.displayName=or;var ar="SliderThumb",Ec=p.forwardRef((e,t)=>{const n=av(e.__scopeSlider),[r,a]=p.useState(null),o=s0(t,i=>a(i)),l=p.useMemo(()=>r?n().findIndex(i=>i.ref.current===r):-1,[n,r]);return c.jsx(uv,{...e,ref:o,index:l})}),uv=p.forwardRef((e,t)=>{const{__scopeSlider:n,index:r,name:a,...o}=e,l=rn(ar,n),i=xc(ar,n),[s,u]=p.useState(null),d=s0(t,y=>u(y)),f=s?!!s.closest("form"):!0,h=Vt(s),g=l.values[r],x=g===void 0?0:Ac(g,l.min,l.max),b=hv(r,l.values.length),m=h==null?void 0:h[i.size],S=m?vv(m,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}% + ${S}px)`},children:[c.jsx(rr.ItemSlot,{scope:e.__scopeSlider,children:c.jsx(o0.span,{role:"slider","aria-label":e["aria-label"]||b,"aria-valuemin":l.min,"aria-valuenow":g,"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:d,style:g===void 0?{display:"none"}:e.style,onFocus:t0(e.onFocus,()=>{l.valueIndexToChangeRef.current=r})})}),f&&c.jsx(dv,{name:a??(l.name?l.name+(l.values.length>1?"[]":""):void 0),value:g},r)]})});Ec.displayName=ar;var dv=e=>{const{value:t,...n}=e,r=p.useRef(null),a=yr(t);return p.useEffect(()=>{const o=r.current,l=window.HTMLInputElement.prototype,s=Object.getOwnPropertyDescriptor(l,"value").set;if(a!==t&&s){const u=new Event("input",{bubbles:!0});s.call(o,t),o.dispatchEvent(u)}},[a,t]),c.jsx("input",{style:{display:"none"},...n,ref:r,defaultValue:t})};function fv(e=[],t,n){const r=[...e];return r[n]=t,r.sort((a,o)=>a-o)}function Ac(e,t,n){const o=100/(n-t)*(e-t);return Vo(o,[0,100])}function hv(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function pv(e,t){if(e.length===1)return 0;const n=e.map(a=>Math.abs(a-t)),r=Math.min(...n);return n.indexOf(r)}function vv(e,t,n){const r=e/2,o=Fo([0,50],[0,r]);return(r-o(t)*n)*n}function mv(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function gv(e,t){if(t>0){const n=mv(e);return Math.min(...n)>=t}return!0}function Fo(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function bv(e){return(String(e).split(".")[1]||"").length}function wv(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}var yv=wc,xv=Mc,Cv=Sc,_v=Ec;const Mv="_root_cpzhx_5",Sv="_thumb_cpzhx_16",Ev="_track_cpzhx_20",Av="_range_cpzhx_27",at={root:Mv,thumb:Sv,track:Ev,range:Av},Iv=({value:e,defaultValue:t=[0],onChange:n,onCommit:r,"data-test-id":a="fondue-slider",...o},l)=>{const i=C.useRef(null);return c.jsxs(yv,{ref:l,className:at.root,value:e,defaultValue:t,onValueChange:n,onValueCommit:r,"data-test-id":a,...o,children:[c.jsx(xv,{onPointerDown:()=>{i.current&&(i.current.dataset.showFocusRing="false")},className:at.track,children:c.jsx(Cv,{className:at.range})}),(e||t).map((s,u)=>c.jsx(_v,{ref:i,className:at.thumb,onPointerDown:d=>{d.currentTarget.dataset.showFocusRing="false"},onBlur:d=>{d.currentTarget.dataset.showFocusRing="true"}},u))]})},Pv=C.forwardRef(Iv);Pv.displayName="Slider";var Uo="Switch",[Rv,_g]=H0(Uo),[Tv,kv]=Rv(Uo),Ic=p.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:a,defaultChecked:o,required:l,disabled:i,value:s="on",onCheckedChange:u,...d}=e,[f,h]=p.useState(null),g=s0(t,y=>h(y)),x=p.useRef(!1),b=f?!!f.closest("form"):!0,[m=!1,S]=n1({prop:a,defaultProp:o,onChange:u});return c.jsxs(Tv,{scope:n,checked:m,disabled:i,children:[c.jsx(o0.button,{type:"button",role:"switch","aria-checked":m,"aria-required":l,"data-state":Tc(m),"data-disabled":i?"":void 0,disabled:i,value:s,...d,ref:g,onClick:t0(e.onClick,y=>{S(_=>!_),b&&(x.current=y.isPropagationStopped(),x.current||y.stopPropagation())})}),b&&c.jsx(Nv,{control:f,bubbles:!x.current,name:r,value:s,checked:m,required:l,disabled:i,style:{transform:"translateX(-100%)"}})]})});Ic.displayName=Uo;var Pc="SwitchThumb",Rc=p.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,a=kv(Pc,n);return c.jsx(o0.span,{"data-state":Tc(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:t})});Rc.displayName=Pc;var Nv=e=>{const{control:t,checked:n,bubbles:r=!0,...a}=e,o=p.useRef(null),l=yr(n),i=Vt(t);return p.useEffect(()=>{const s=o.current,u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(l!==n&&f){const h=new Event("click",{bubbles:r});f.call(s,n),s.dispatchEvent(h)}},[l,n,r]),c.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...a,tabIndex:-1,ref:o,style:{...e.style,...i,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Tc(e){return e?"checked":"unchecked"}var Dv=Ic,Ov=Rc;const Hv="_root_b6n55_5",zv="_small_b6n55_27",Vv="_medium_b6n55_31",Lv="_large_b6n55_35",jv="_thumb_b6n55_49",Tn={root:Hv,small:zv,medium:Vv,large:Lv,thumb:jv},$v=({value:e,defaultValue:t,size:n="medium",onChange:r,"data-test-id":a="fondue-switch","aria-label":o="Switch",...l},i)=>c.jsx(Dv,{ref:i,checked:e,defaultChecked:t,className:M1([Tn.root,Tn[n]]),onCheckedChange:r,"aria-label":o,"data-test-id":a,...l,children:c.jsx(Ov,{className:Tn.thumb})}),Bv=C.forwardRef($v);Bv.displayName="Switch";var Fv="VisuallyHidden",kc=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}}));kc.displayName=Fv;var Uv=kc,[on,Mg]=H0("Tooltip",[ve]),an=ve(),Nc="TooltipProvider",Kv=700,lr="tooltip.open",[Wv,Ko]=on(Nc),Dc=e=>{const{__scopeTooltip:t,delayDuration:n=Kv,skipDelayDuration:r=300,disableHoverableContent:a=!1,children:o}=e,[l,i]=p.useState(!0),s=p.useRef(!1),u=p.useRef(0);return p.useEffect(()=>{const d=u.current;return()=>window.clearTimeout(d)},[]),c.jsx(Wv,{scope:t,isOpenDelayed:l,delayDuration:n,onOpen:p.useCallback(()=>{window.clearTimeout(u.current),i(!1)},[]),onClose:p.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>i(!0),r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:p.useCallback(d=>{s.current=d},[]),disableHoverableContent:a,children:o})};Dc.displayName=Nc;var ln="Tooltip",[qv,Ke]=on(ln),Oc=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:a=!1,onOpenChange:o,disableHoverableContent:l,delayDuration:i}=e,s=Ko(ln,e.__scopeTooltip),u=an(t),[d,f]=p.useState(null),h=J1(),g=p.useRef(0),x=l??s.disableHoverableContent,b=i??s.delayDuration,m=p.useRef(!1),[S=!1,y]=n1({prop:r,defaultProp:a,onChange:k=>{k?(s.onOpen(),document.dispatchEvent(new CustomEvent(lr))):s.onClose(),o==null||o(k)}}),_=p.useMemo(()=>S?m.current?"delayed-open":"instant-open":"closed",[S]),M=p.useCallback(()=>{window.clearTimeout(g.current),m.current=!1,y(!0)},[y]),E=p.useCallback(()=>{window.clearTimeout(g.current),y(!1)},[y]),I=p.useCallback(()=>{window.clearTimeout(g.current),g.current=window.setTimeout(()=>{m.current=!0,y(!0)},b)},[b,y]);return p.useEffect(()=>()=>window.clearTimeout(g.current),[]),c.jsx(Il,{...u,children:c.jsx(qv,{scope:t,contentId:h,open:S,stateAttribute:_,trigger:d,onTriggerChange:f,onTriggerEnter:p.useCallback(()=>{s.isOpenDelayed?I():M()},[s.isOpenDelayed,I,M]),onTriggerLeave:p.useCallback(()=>{x?E():window.clearTimeout(g.current)},[E,x]),onOpen:M,onClose:E,disableHoverableContent:x,children:n})})};Oc.displayName=ln;var ir="TooltipTrigger",Hc=p.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,a=Ke(ir,n),o=Ko(ir,n),l=an(n),i=p.useRef(null),s=s0(t,i,a.onTriggerChange),u=p.useRef(!1),d=p.useRef(!1),f=p.useCallback(()=>u.current=!1,[]);return p.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),c.jsx(Ut,{asChild:!0,...l,children:c.jsx(o0.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...r,ref:s,onPointerMove:t0(e.onPointerMove,h=>{h.pointerType!=="touch"&&!d.current&&!o.isPointerInTransitRef.current&&(a.onTriggerEnter(),d.current=!0)}),onPointerLeave:t0(e.onPointerLeave,()=>{a.onTriggerLeave(),d.current=!1}),onPointerDown:t0(e.onPointerDown,()=>{u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:t0(e.onFocus,()=>{u.current||a.onOpen()}),onBlur:t0(e.onBlur,a.onClose),onClick:t0(e.onClick,a.onClose)})})});Hc.displayName=ir;var Wo="TooltipPortal",[Gv,Yv]=on(Wo,{forceMount:void 0}),zc=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:a}=e,o=Ke(Wo,t);return c.jsx(Gv,{scope:t,forceMount:n,children:c.jsx(I0,{present:n||o.open,children:c.jsx(Be,{asChild:!0,container:a,children:r})})})};zc.displayName=Wo;var se="TooltipContent",Vc=p.forwardRef((e,t)=>{const n=Yv(se,e.__scopeTooltip),{forceMount:r=n.forceMount,side:a="top",...o}=e,l=Ke(se,e.__scopeTooltip);return c.jsx(I0,{present:r||l.open,children:l.disableHoverableContent?c.jsx(Lc,{side:a,...o,ref:t}):c.jsx(Xv,{side:a,...o,ref:t})})}),Xv=p.forwardRef((e,t)=>{const n=Ke(se,e.__scopeTooltip),r=Ko(se,e.__scopeTooltip),a=p.useRef(null),o=s0(t,a),[l,i]=p.useState(null),{trigger:s,onClose:u}=n,d=a.current,{onPointerInTransitChange:f}=r,h=p.useCallback(()=>{i(null),f(!1)},[f]),g=p.useCallback((x,b)=>{const m=x.currentTarget,S={x:x.clientX,y:x.clientY},y=Jv(S,m.getBoundingClientRect()),_=e9(S,y),M=t9(b.getBoundingClientRect()),E=r9([..._,...M]);i(E),f(!0)},[f]);return p.useEffect(()=>()=>h(),[h]),p.useEffect(()=>{if(s&&d){const x=m=>g(m,d),b=m=>g(m,s);return s.addEventListener("pointerleave",x),d.addEventListener("pointerleave",b),()=>{s.removeEventListener("pointerleave",x),d.removeEventListener("pointerleave",b)}}},[s,d,g,h]),p.useEffect(()=>{if(l){const x=b=>{const m=b.target,S={x:b.clientX,y:b.clientY},y=(s==null?void 0:s.contains(m))||(d==null?void 0:d.contains(m)),_=!n9(S,l);y?h():_&&(h(),u())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[s,d,l,u,h]),c.jsx(Lc,{...e,ref:o})}),[Qv,Zv]=on(ln,{isInside:!1}),Lc=p.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":a,onEscapeKeyDown:o,onPointerDownOutside:l,...i}=e,s=Ke(se,n),u=an(n),{onClose:d}=s;return p.useEffect(()=>(document.addEventListener(lr,d),()=>document.removeEventListener(lr,d)),[d]),p.useEffect(()=>{if(s.trigger){const f=h=>{const g=h.target;g!=null&&g.contains(s.trigger)&&d()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[s.trigger,d]),c.jsx(je,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:c.jsxs(Dr,{"data-state":s.stateAttribute,...u,...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(G5,{children:r}),c.jsx(Qv,{scope:n,isInside:!0,children:c.jsx(Uv,{id:s.contentId,role:"tooltip",children:a||r})})]})})});Vc.displayName=se;var jc="TooltipArrow",$c=p.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,a=an(n);return Zv(jc,n).isInside?null:c.jsx(Or,{...a,...r,ref:t})});$c.displayName=jc;function Jv(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),a=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(n,r,a,o)){case o:return"left";case a:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function e9(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function t9(e){const{top:t,right:n,bottom:r,left:a}=e;return[{x:a,y:t},{x:n,y:t},{x:n,y:r},{x:a,y:r}]}function n9(e,t){const{x:n,y:r}=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,u=t[l].x,d=t[l].y;s>r!=d>r&&n<(u-i)*(r-s)/(d-s)+i&&(a=!a)}return a}function r9(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),o9(t)}function o9(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const a=e[r];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 n=[];for(let r=e.length-1;r>=0;r--){const a=e[r];for(;n.length>=2;){const o=n[n.length-1],l=n[n.length-2];if((o.x-l.x)*(a.y-l.y)>=(o.y-l.y)*(a.x-l.x))n.pop();else break}n.push(a)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var a9=Dc,l9=Oc,i9=Hc,s9=zc,c9=Vc,u9=$c;const d9="_root_m0ok9_4",f9="_arrow_m0ok9_21",v5={root:d9,arrow:f9},Bc=({children:e,enterDelay:t=700,open:n,onOpenChange:r})=>c.jsx(a9,{children:c.jsx(l9,{delayDuration:t,open:n,onOpenChange:r,children:e})});Bc.displayName="Tooltip.Root";const Fc=({children:e,"data-test-id":t="fondue-tooltip-trigger"},n)=>c.jsx(i9,{"data-test-id":t,asChild:!0,ref:n,children:e});Fc.displayName="Tooltip.Trigger";const Uc=({children:e,className:t,maxWidth:n,"data-test-id":r="fondue-tooltip-content",padding:a="spacious",...o},l)=>c.jsx(s9,{children:c.jsxs(c9,{"data-test-id":r,"data-tooltip-spacing":a,className:M1(v5.root,t),style:{maxWidth:n},collisionPadding:16,sideOffset:8,ref:l,...o,children:[e,c.jsx(u9,{"aria-hidden":"true",className:v5.arrow})]})});Uc.displayName="Tooltip.Content";const c1={Root:Bc,Trigger:C.forwardRef(Fc),Content:C.forwardRef(Uc)},h9=e=>e==="IMAGE"?c.jsx(v.IconImage24,{}):e==="VIDEO"?c.jsx(v.IconPlayFrame24,{}):e==="AUDIO"?c.jsx(v.IconMusicNote24,{}):c.jsx(v.IconDocument24,{}),qo=C.forwardRef(({item:e,isEditing:t,draggableProps:n,transformStyle:r,isDragging:a,isOverlay:o,isLoading:l,onDelete:i,onReplaceWithBrowse:s,onReplaceWithUpload:u,onDownload:d},f)=>{const[h,g]=C.useState(),[x,{selectedFiles:b}]=N1.useFileInput({multiple:!0,accept:"image/*"}),[m,{results:S,doneAll:y}]=N1.useAssetUpload(),{focusProps:_,isFocusVisible:M}=y5.useFocusRing();C.useEffect(()=>{b&&m(b[0])},[b]),C.useEffect(()=>{y&&u(S[0])},[y,S]);const E=l||b&&!y;return c.jsxs("button",{"aria-label":"Download attachment","data-test-id":"attachments-item",onClick:()=>d==null?void 0:d(),ref:f,style:{...r,opacity:a&&!o?.3:1,fontFamily:"var(-f-theme-settings-body-font-family)"},className:e1(["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:E?c.jsx(v.LoadingCircle,{size:v.LoadingCircleSize.Small}):h9(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:e1(["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",{..._,...n,"aria-label":"Drag attachment",className:e1([" 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&&v.FOCUS_STYLE,M&&"tw-z-[2]"]),children:c.jsx(v.IconGrabHandle20,{})}),c.jsx("div",{"data-test-id":"attachments-actionbar-flyout",children:c.jsx(v.Flyout,{placement:v.FlyoutPlacement.Right,isOpen:(h==null?void 0:h.id)===e.id,fitContent:!0,legacyFooter:!1,onOpenChange:I=>g(I?e:void 0),trigger:(I,k)=>c.jsx(v.Button,{ref:k,icon:c.jsx(v.IconPen20,{}),emphasis:v.ButtonEmphasis.Default,onClick:()=>g(e)}),children:c.jsx(v.ActionMenu,{menuBlocks:[{id:"menu",menuItems:[{id:"upload",size:v.MenuItemContentSize.XSmall,title:"Replace with upload",onClick:()=>{x(),g(void 0)},initialValue:!0,decorator:c.jsx("div",{className:"tw-mr-2",children:c.jsx(v.IconArrowCircleUp20,{})})},{id:"asset",size:v.MenuItemContentSize.XSmall,title:"Replace with asset",onClick:()=>{s(),g(void 0)},initialValue:!0,decorator:c.jsx("div",{className:"tw-mr-2",children:c.jsx(v.IconImageStack20,{})})}]},{id:"menu-delete",menuItems:[{id:"delete",size:v.MenuItemContentSize.XSmall,title:"Delete",style:v.MenuItemStyle.Danger,onClick:()=>{i(),g(void 0)},initialValue:!0,decorator:c.jsx("div",{className:"tw-mr-2",children:c.jsx(v.IconTrashBin20,{})})}]}]})})})]})]})});qo.displayName="AttachmentItem";const p9=e=>{const{attributes:t,listeners:n,setNodeRef:r,transform:a,transition:o,isDragging:l}=lt.useSortable({id:e.item.id}),i={transform:a?`translate(${a.x}px, ${a.y}px)`:"",transition:o,zIndex:l?2:1},s={...t,...n};return c.jsx(qo,{ref:r,isDragging:l,transformStyle:i,draggableProps:s,...e})},v9=({children:e,isFlyoutOpen:t,triggerProps:n,triggerRef:r})=>c.jsxs("button",{className:e1(["tw-flex tw-text-xs tw-font-body tw-items-center tw-gap-1 tw-rounded-full tw-outline tw-outline-1 tw-outline-offset-1 tw-p-1.5 tw-outline-line",t?"tw-bg-box-neutral-pressed tw-text-box-neutral-inverse-pressed":"tw-bg-base hover:tw-bg-box-neutral-hover active:tw-bg-box-neutral-pressed tw-text-box-neutral-inverse hover:tw-text-box-neutral-inverse-hover active:tw-text-box-neutral-inverse-pressed"]),...n,ref:r,"data-test-id":"attachments-button-trigger",children:[c.jsx(v.IconPaperclip16,{}),e,c.jsx(v.IconCaretDown12,{})]}),Kc=({items:e=[],onDelete:t,onReplaceWithBrowse:n,onReplaceWithUpload:r,onBrowse:a,onUpload:o,onSorted:l,appBridge:i,triggerComponent:s=v9,isOpen:u,onOpenChange:d})=>{const[f,h]=C.useState(e),[g,x]=C.useState(!1),b=w0.useSensors(w0.useSensor(w0.PointerSensor),w0.useSensor(w0.KeyboardSensor)),[m,S]=C.useState(void 0),[y,_]=C.useState(!1),[M,E]=C.useState([]),[I,k]=C.useState(null),T=N1.useEditorState(i),{openAssetChooser:j,closeAssetChooser:z}=N1.useAssetChooser(i),K=u!==void 0,N=K?u:g,F=f==null?void 0:f.find(R=>R.id===m),[V,{results:B,doneAll:U}]=N1.useAssetUpload({onUploadProgress:()=>!y&&_(!0)}),H=R=>{const D=K?d:x;D==null||D(R)};C.useEffect(()=>{h(e)},[e]),C.useEffect(()=>{I&&(_(!0),V(I))},[I]),C.useEffect(()=>{(async()=>{U&&(await o(B),_(!1))})()},[U,B]);const L=()=>{H(!1),j(R=>{a(R),z(),H(!0)},{multiSelection:!0,selectedValueIds:f.map(R=>R.id)})},P=R=>{H(!1),j(async D=>{H(!0),z(),E([...M,R.id]),await n(R,D[0]),E(M.filter(G=>G!==R.id))},{multiSelection:!1,selectedValueIds:f.map(D=>D.id)})},A=async(R,D)=>{E([...M,R.id]),await r(R,D),E(M.filter(G=>G!==R.id))},O=R=>{const{active:D}=R;S(D.id)},$=R=>{const{active:D,over:G}=R;if(G&&D.id!==G.id&&f){const Y=f.findIndex(Z=>Z.id===D.id),Q=f.findIndex(Z=>Z.id===G.id),J=lt.arrayMove(f,Y,Q);h(J),l(J)}S(void 0)};return T||((f==null?void 0:f.length)??0)>0?c.jsxs(c1.Root,{enterDelay:500,children:[c.jsx(c1.Trigger,{children:c.jsx("div",{"data-test-id":"attachments-flyout-button",children:c.jsx(v.Flyout,{placement:v.FlyoutPlacement.BottomRight,onOpenChange:R=>H(F?!0:R),isOpen:N,hug:!1,fitContent:!0,legacyFooter:!1,trigger:(R,D)=>c.jsx(s,{isFlyoutOpen:N,triggerProps:R,triggerRef:D,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(w0.DndContext,{sensors:b,collisionDetection:w0.closestCenter,onDragStart:O,onDragEnd:$,modifiers:[X7.restrictToWindowEdges],children:[c.jsx(lt.SortableContext,{items:f,strategy:lt.rectSortingStrategy,children:c.jsx("div",{className:"tw-border-b tw-border-b-line",children:f.map(R=>c.jsx(p9,{isEditing:T,isLoading:M.includes(R.id),item:R,onDelete:()=>t(R),onReplaceWithBrowse:()=>P(R),onReplaceWithUpload:D=>A(R,D),onDownload:()=>i.dispatch({name:"downloadAsset",payload:R})},R.id))})}),c.jsx(w0.DragOverlay,{children:F&&c.jsx(qo,{isOverlay:!0,isEditing:T,item:F,isDragging:!0,onDelete:()=>t(F),onReplaceWithBrowse:()=>P(F),onReplaceWithUpload:R=>A(F,R)},m)})]}),T&&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(v.AssetInput,{isLoading:y,size:v.AssetInputSize.Small,onUploadClick:R=>k(R),onLibraryClick:L})]})]})})})}),c.jsx(c1.Content,{side:"top",children:"Attachments"})]}):null},m9=(e,t)=>{const n=[v.FOCUS_VISIBLE_STYLE,"tw-relative tw-inline-flex tw-items-center tw-justify-center","tw-h-6 tw-p-1","tw-rounded","tw-text-xs tw-font-medium","tw-gap-0.5","focus-visible:tw-z-10"];return t?n.push("tw-bg-box-neutral-pressed","tw-text-box-neutral-inverse-pressed",e==="grab"?"tw-cursor-grabbing":"tw-cursor-pointer"):n.push("hover:tw-bg-box-neutral-hover active:tw-bg-box-neutral-pressed","tw-text-text-weak hover:tw-text-box-neutral-inverse-hover active:tw-text-box-neutral-inverse-pressed",e==="grab"?"!tw-cursor-grab active:tw-cursor-grabbing":"tw-cursor-pointer"),e1(n)},We=C.forwardRef(({onClick:e,children:t,forceActiveStyle:n,cursor:r="pointer","data-test-id":a="base-toolbar-button",...o},l)=>c.jsx("button",{onClick:e,className:m9(r,n),"data-test-id":a,...o,ref:l,children:t}));We.displayName="BaseToolbarButton";const g9=({children:e,isFlyoutOpen:t,triggerProps:n,triggerRef:r})=>c.jsxs(We,{forceActiveStyle:t,"data-test-id":"attachments-toolbar-button-trigger",...n,ref:r,children:[c.jsx(v.IconPaperclip16,{}),e,c.jsx(v.IconCaretDown12,{})]}),Wc="attachments",qc=({flyoutId:e=Wc})=>{const t=v.useMemoizedId(e),{appBridge:n,attachments:r,onAttachmentsAdd:a,onAttachmentDelete:o,onAttachmentReplace:l,onAttachmentsSorted:i}=N5(),{isOpen:s,onOpenChange:u}=Ht(t),d=Ve();return c.jsx(Kc,{onUpload:a,onDelete:o,onReplaceWithBrowse:l,onReplaceWithUpload:l,onSorted:i,onBrowse:a,items:r,appBridge:n,triggerComponent:g9,isOpen:s&&!d,onOpenChange:u})},Gc="Drag or press ↵ to move",Yc="Move with ↑↓←→ and confirm with ↵",Go=({content:e,children:t,open:n,disabled:r})=>r?t:c.jsxs(c1.Root,{enterDelay:300,open:n,children:[c.jsx(c1.Trigger,{children:t}),c.jsx(c1.Content,{side:"top",children:c.jsx("div",{children:e})})]}),Xc=({tooltip:e,icon:t,setActivatorNodeRef:n,draggableProps:r})=>{const a=Ve();return c.jsx(Go,{...a&&{open:a},content:c.jsx("div",{children:a?Yc:e??Gc}),children:c.jsx(We,{ref:n,"data-test-id":"block-item-wrapper-toolbar-btn",forceActiveStyle:a,cursor:"grab",...r,children:t})})},Yo=({content:e,icon:t,tooltip:n,flyoutId:r,flyoutFooter:a,flyoutHeader:o})=>{const l=v.useMemoizedId(r),{isOpen:i,onOpenChange:s}=Ht(l),u=Ve();return c.jsx(Go,{disabled:u||i,content:n,children:c.jsx("div",{className:"tw-flex tw-flex-shrink-0 tw-flex-1 tw-h-6 tw-relative",children:c.jsx(v.Flyout,{isOpen:i&&!u,legacyFooter:!1,fixedFooter:a,fixedHeader:o,fitContent:!0,hug:!1,placement:v.FlyoutPlacement.BottomRight,onOpenChange:s,trigger:(d,f)=>c.jsx(We,{"data-test-id":"block-item-wrapper-toolbar-flyout",forceActiveStyle:i&&!u,...d,ref:f,children:t}),children:e})})})},Qc=({items:e,flyoutId:t})=>{const{onOpenChange:n}=Ht(t);return c.jsx(v.ActionMenu,{menuBlocks:e.map((r,a)=>({id:a.toString(),menuItems:r.map((o,l)=>({id:a.toString()+l.toString(),size:v.MenuItemContentSize.XSmall,title:o.title,style:o.style,onClick:()=>{n(!1),o.onClick()},initialValue:!0,decorator:c.jsx("div",{className:"tw-mr-2",children:o.icon})}))}))})},Xo="menu",Zc=({items:e,flyoutId:t=Xo,tooltip:n="Options"})=>{const r=v.useMemoizedId(t);return c.jsx(Yo,{icon:c.jsx(v.IconDotsHorizontal16,{}),tooltip:n,flyoutId:r,content:c.jsx(Qc,{items:e,flyoutId:r})})},b9=({tooltip:e,icon:t,onClick:n})=>{const r=Ve();return c.jsx(Go,{disabled:r,content:e??"",children:c.jsx(We,{"data-test-id":"block-item-wrapper-toolbar-btn",onClick:n,children:t})})},m5=({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}),Jc=({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(m5,{children:c.jsx(qc,{})}),e.length>0&&c.jsx(m5,{children:e.map(n=>{switch(n.type){case"dragHandle":return c.jsx(Xc,{...n},n.tooltip+n.type);case"menu":return c.jsx(Zc,{...n},n.tooltip+n.type);case"flyout":return c.jsx(Yo,{...n},n.tooltip+n.type);default:return c.jsx(b9,{...n},n.tooltip+n.type)}})})]}),e7=C.memo(({children:e,toolbarItems:t,shouldHideWrapper:n,shouldHideComponent:r=!1,isDragging:a=!1,shouldFillContainer:o,outlineOffset:l=2,shouldBeShown:i=!1,showAttachments:s=!1})=>{const[u,d]=C.useState(i?[Xo]:[]),f=C.useRef(null);if(n)return c.jsx(c.Fragment,{children:e});const h=t==null?void 0:t.filter(x=>x!==void 0),g=u.length>0||i;return c.jsx(E5,{isDragPreview:a,children:c.jsx(I5,{openFlyoutIds:u,setOpenFlyoutIds:d,children:c.jsxs("div",{ref:f,"data-test-id":"block-item-wrapper",style:{outlineOffset:l},className:e1(["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",g&&"tw-outline",r&&"tw-opacity-0"]),children:[c.jsx("div",{style:{right:-1-l,bottom:`calc(100% - ${2+l}px)`},className:e1(["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",g&&"tw-opacity-100"]),children:c.jsx(Jc,{attachments:{isEnabled:s},items:h})}),e]})})})});e7.displayName="BlockItemWrapper";const w9=({onDownload:e})=>{const{isFocused:t,focusProps:n}=y5.useFocusRing();return c.jsxs(c1.Root,{enterDelay:500,children:[c.jsx(c1.Trigger,{children:c.jsx("button",{tabIndex:0,"aria-label":"Download",...n,className:e1(["tw-outline-none tw-rounded",t&&v.FOCUS_STYLE]),onClick:e,onPointerDown:r=>r.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(v.IconArrowCircleDown16,{})})})}),c.jsx(c1.Content,{side:"top",children:"Download"})]})},y9=({ref:e,disabled:t,onChange:n})=>{C.useEffect(()=>{if(t||!e.current)return;let r=!1;const a=new IntersectionObserver(([o])=>{o.isIntersecting!==r&&(r=o.isIntersecting,n(o.isIntersecting))});return a.observe(e.current),()=>{a.disconnect()}},[e,t,n])},x9=({value:e="",gap:t,customClass:n,show:r=!0,plugins:a})=>{const[o,l]=C.useState(null);return C.useEffect(()=>{(async()=>l(await v.serializeRawToHtmlAsync(e,a,void 0,t,n)))()},[e,t,a,n]),!r||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"})},Qo=v.createStore("floatingButton")({openEditorId:null,mouseDown:!1,updated:!1,url:"",text:"",buttonStyle:"primary",newTab:!1,mode:"",isEditing:!1}).extendActions(e=>({reset:()=>{e.url(""),e.text(""),e.buttonStyle("primary"),e.newTab(!1),e.mode(""),e.isEditing(!1)}})).extendActions(e=>({show:(t,n)=>{e.mode(t),e.isEditing(!1),e.openEditorId(n)},hide:()=>{e.reset(),e.openEditorId(null)}})).extendSelectors(e=>({isOpen:t=>e.openEditorId===t})),_0=Qo.set,R0=Qo.get,ze=()=>Qo.use,t7=e=>{if(!e)return!1;const t=n=>n.some(r=>r.text?r.text!=="":r.children?t(r.children):!1);try{const n=JSON.parse(e);return t(n)}catch{return!1}},C9=(e="p",t="",n)=>t7(t)?t:JSON.stringify([{type:e,children:[{text:t,textStyle:e}],align:n}]),_9=(e,t,n)=>e===D1.Custom?t:n,M9=e=>e.map(n7),n7=e=>({id:e.id,title:e.name,colors:e.colors.map(E9)}),S9=e=>"revision"in e,E9=e=>{if(S9(e)){const{title:t,revision:n}=e;return{alpha:n.rgba.alpha?n.rgba.alpha/255:1,red:n.rgba.red??0,green:n.rgba.green??0,blue:n.rgba.blue??0,name:t??""}}return{alpha:e.alpha?e.alpha/255:1,red:e.red??0,green:e.green??0,blue:e.blue??0,name:e.name??""}},Zo=(e,t)=>{const n=v.getAboveNode(e,{match:{type:v.ELEMENT_LINK}});return Array.isArray(n)?t(n[0]):""},A9=e=>Zo(e,t=>{var n,r;return((r=(n=t.chosenLink)==null?void 0:n.searchResult)==null?void 0:r.link)||""}),I9=e=>Zo(e,t=>t.url||""),Jo=e=>{var t,n;return e.url||((n=(t=e.chosenLink)==null?void 0:t.searchResult)==null?void 0:n.link)||""},P9=e=>Zo(e,Jo),ea=/^\/(document|r)\/\S+$/i,sn=e=>{if(ea.test(e))return e;try{return new URL(e),e}catch{return`https://${e}`}},cn=e=>{if(ea.test(e))return!0;try{const t=new URL(e);return["http:","https:","mailto:","tel:"].includes(t.protocol)&&t.pathname!==""}catch{return!1}},ce=e=>cn(sn(e))||e==="",r7=(e,{type:t})=>{const{apply:n,normalizeNode:r}=e;return e.apply=a=>{if(a.type!=="set_selection"){n(a);return}const o=a.newProperties;if(!(o!=null&&o.focus)||!o.anchor||!v.isCollapsed(o)){n(a);return}const l=v.getAboveNode(e,{at:o,match:{type:v.getPluginType(e,v0)}});if(l){const[,i]=l;let s;v.isStartPoint(e,o.focus,i)&&(s=v.getPreviousNodeEndPoint(e,i)),v.isEndPoint(e,o.focus,i)&&(s=v.getNextNodeStartPoint(e,i)),s&&(a.newProperties={anchor:s,focus:s})}n(a)},e.normalizeNode=([a,o])=>{if(a.type===v.getPluginType(e,v0)){const l=e.selection;if(l&&v.isCollapsed(l)&&v.isEndPoint(e,l.focus,o)){const i=v.getNextNodeStartPoint(e,o);if(i)v.select(e,i);else{const s=v.Path.next(o);v.insertNodes(e,{text:""},{at:s}),v.select(e,s)}}}r([a,o])},v.withRemoveEmptyNodes(e,v.mockPlugin({options:{types:t}}))},o7=(e,t,n)=>{v.insertNodes(e,[s7(e,t)],n)},ta=e=>{if(!e.selection)return;const{isUrl:t,forceSubmit:n}=v.getPluginOptions(e,v0),r=R0.url();if(!((t==null?void 0:t(r))||n))return;const o=R0.text(),l=R0.buttonStyle(),i=R0.newTab()?void 0:"_self";return _0.reset(),a7(e,{url:r,text:o,buttonStyle:l,target:i,isUrl:s=>n||!t?!0:t(s)}),setTimeout(()=>{v.focusEditor(e,e.selection??void 0)},0),!0},ue=(e,t)=>v.withoutNormalizing(e,()=>{var n,r,a,o,l,i;if(t!=null&&t.split){if(v.getAboveNode(e,{at:(n=e.selection)==null?void 0:n.anchor,match:{type:v.getPluginType(e,v0)}}))return v.splitNodes(e,{at:(r=e.selection)==null?void 0:r.anchor,match:d=>v.isElement(d)&&d.type===v.getPluginType(e,v0)}),ue(e,{at:(a=e.selection)==null?void 0:a.anchor}),!0;if(v.getAboveNode(e,{at:(o=e.selection)==null?void 0:o.focus,match:{type:v.getPluginType(e,v0)}}))return v.splitNodes(e,{at:(l=e.selection)==null?void 0:l.focus,match:d=>v.isElement(d)&&d.type===v.getPluginType(e,v0)}),ue(e,{at:(i=e.selection)==null?void 0:i.focus}),!0}v.unwrapNodes(e,{match:{type:v.getPluginType(e,v0)},...t})}),a7=(e,{url:t,text:n,buttonStyle:r,target:a,insertTextInButton:o,insertNodesOptions:l,isUrl:i=v.getPluginOptions(e,v0).isUrl})=>{var S;const s=e.selection;if(!s)return;const u=v.getAboveNode(e,{at:s,match:{type:v.getPluginType(e,v0)}});if(o&&u)return e.insertText(t),!0;if(!(i!=null&&i(t)))return;if(v.isDefined(n)&&n.length===0&&(n=t),u)return k9(t,e,u,a,r,n),!0;const d=v.findNode(e,{at:s,match:{type:v.getPluginType(e,v0)}}),[f,h]=d??[],g=R9(e,h,n);if(v.isExpanded(s))return T9(u,e,t,r,a,n),!0;g&&v.removeNodes(e,{at:h});const x=v.getNodeProps(f??{}),b=(S=e.selection)==null?void 0:S.focus.path;if(!b)return;const m=v.getNodeLeaf(e,b);return n!=null&&n.length||(n=t),o7(e,{...x,url:t,target:a,children:[{...m,text:n}]},l),!0};function R9(e,t,n){return t&&(n==null?void 0:n.length)&&n!==v.getEditorString(e,t)}function T9(e,t,n,r,a,o){e?ue(t,{at:e[1]}):ue(t,{split:!0}),l7(t,{url:n,buttonStyle:r,target:a}),na(t,{url:n,target:a,text:o})}function k9(e,t,n,r,a,o){var l,i,s;(e!==((l=n[0])==null?void 0:l.url)||r!==((i=n[0])==null?void 0:i.target)||a!==((s=n[0])==null?void 0:s.buttonStyle))&&v.setNodes(t,{url:e,target:r,buttonStyle:a},{at:n[1]}),na(t,{url:e,text:o,target:r})}const na=(e,{text:t})=>{const n=v.getAboveNode(e,{match:{type:v.getPluginType(e,v0)}});if(n){const[r,a]=n;if(t!=null&&t.length&&t!==v.getEditorString(e,a)){const o=r.children[0];v.replaceNodeChildren(e,{at:a,nodes:{...o,text:t},insertOptions:{select:!0}})}}},l7=(e,{url:t,buttonStyle:n,target:r,...a})=>{v.wrapNodes(e,{type:v.getPluginType(e,v0),url:t,buttonStyle:n,target:r,children:[]},{split:!0,...a})},N9=(e,t)=>{const n=v.getAboveNode(e,{match:{type:v0}});return Array.isArray(n)?t(n[0]):""},i7=e=>N9(e,t=>t.url??""),s7=(e,{url:t,text:n="",buttonStyle:r="primary",target:a,children:o})=>({type:v.getPluginType(e,v0),url:t,target:a,buttonStyle:r,children:o??[{text:n}]}),c7=(e,{focused:t}={})=>{if(R0.mode()==="edit"){un(e);return}ra(e,{focused:t})},un=e=>{const t=v.findNode(e,{match:{type:v.getPluginType(e,v0)}});if(!t)return;const[n,r]=t;let a=v.getEditorString(e,r);_0.url(n.url),_0.newTab(n.target===void 0),a===n.url&&(a=""),_0.text(a),_0.isEditing(!0)},ra=(e,{focused:t}={})=>{R0.mode()||!t||v.isRangeAcrossBlocks(e,{at:e.selection})||v.someNode(e,{match:{type:v.getPluginType(e,v0)}})||(_0.text(v.getEditorString(e,e.selection)),_0.show("insert",e.id))},kn={marginTop:"10px",marginBottom:"10px",display:"inline-block",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%",verticalAlign:"middle",boxSizing:"border-box",overflowWrap:"normal"},dn={buttonPrimary:{...kn,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:{...kn,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:{...kn,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)"}}},D9=e=>{var l,i;const{attributes:t,children:n}=e,r=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(O9,{attributes:t,href:r,target:a,styles:dn[`button${o.charAt(0).toUpperCase()+o.slice(1)}`],children:n})},O9=({attributes:e,styles:t={hover:{}},children:n,href:r="#",target:a})=>{const[o,l]=C.useState(!1);return c.jsx("a",{...e,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),href:r,target:a,style:o?{...t,...t.hover}:t,children:n})};class H9 extends v.MarkupElement{constructor(t=v0,n=D9){super(t,n)}}const u7=C.forwardRef((e,t)=>{const n=v.useEditorRef();return c.jsx(v.ToolbarButton,{ref:t,...e,onMouseDown:r=>{r.preventDefault(),v.focusEditor(n,n.selection??n.prevSelection??void 0)},onClick:()=>{c7(n,{focused:!0})},children:c.jsx(v.IconStylingWrapper,{icon:c.jsx(v.IconButton16,{})})})});u7.displayName="ButtonToolbarButton";const z9=({editorId:e,id:t})=>{const n=v.useEditorState(v.useEventPlateId(e)),r=!!v.isRangeInSameBlock(n,{at:n.selection}),a=v.getPluginType(n,v0),o=!!(n!=null&&n.selection)&&v.someNode(n,{match:{type:a}});return c.jsx("div",{"data-plugin-id":t,children:c.jsx(u7,{pressed:o,disabled:!r,tooltip:v.getTooltip(r?`Button
85
+ Defaulting to \`null\`.`}var gp=Fs,bp=Ks;const wp=B1({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"}}}),yp=B1({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]"}}}),xp=C.forwardRef(({value:e,max:t=100,rounded:n=!0,variant:r="default",size:a="medium","data-test-id":o="fondue-loading-bar",...l},i)=>c.jsx(gp,{ref:i,"data-test-id":o,className:wp({rounded:n,size:a,variant:r}),"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(bp,{className:yp({variant:r,indeterminateState:e===null})})}));xp.displayName="LoadingBar";function Vo(e,[t,n]){return Math.min(n,Math.max(t,e))}function Cp(e,t){return p.useReducer((n,r)=>t[n][r]??n,e)}var Lo="ScrollArea",[qs,yg]=H0(Lo),[_p,U0]=qs(Lo),Gs=p.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:a,scrollHideDelay:o=600,...l}=e,[i,s]=p.useState(null),[u,d]=p.useState(null),[f,h]=p.useState(null),[g,x]=p.useState(null),[b,m]=p.useState(null),[S,y]=p.useState(0),[_,M]=p.useState(0),[E,I]=p.useState(!1),[k,T]=p.useState(!1),j=s0(t,K=>s(K)),z=Xt(a);return c.jsx(_p,{scope:n,type:r,dir:z,scrollHideDelay:o,scrollArea:i,viewport:u,onViewportChange:d,content:f,onContentChange:h,scrollbarX:g,onScrollbarXChange:x,scrollbarXEnabled:E,onScrollbarXEnabledChange:I,scrollbarY:b,onScrollbarYChange:m,scrollbarYEnabled:k,onScrollbarYEnabledChange:T,onCornerWidthChange:y,onCornerHeightChange:M,children:c.jsx(o0.div,{dir:z,...l,ref:j,style:{position:"relative","--radix-scroll-area-corner-width":S+"px","--radix-scroll-area-corner-height":_+"px",...e.style}})})});Gs.displayName=Lo;var Ys="ScrollAreaViewport",Xs=p.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,nonce:a,...o}=e,l=U0(Ys,n),i=p.useRef(null),s=s0(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:r})})]})});Xs.displayName=Ys;var r1="ScrollAreaScrollbar",Qs=p.forwardRef((e,t)=>{const{forceMount:n,...r}=e,a=U0(r1,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(Mp,{...r,ref:t,forceMount:n}):a.type==="scroll"?c.jsx(Sp,{...r,ref:t,forceMount:n}):a.type==="auto"?c.jsx(Zs,{...r,ref:t,forceMount:n}):a.type==="always"?c.jsx(jo,{...r,ref:t}):null});Qs.displayName=r1;var Mp=p.forwardRef((e,t)=>{const{forceMount:n,...r}=e,a=U0(r1,e.__scopeScrollArea),[o,l]=p.useState(!1);return p.useEffect(()=>{const i=a.scrollArea;let s=0;if(i){const u=()=>{window.clearTimeout(s),l(!0)},d=()=>{s=window.setTimeout(()=>l(!1),a.scrollHideDelay)};return i.addEventListener("pointerenter",u),i.addEventListener("pointerleave",d),()=>{window.clearTimeout(s),i.removeEventListener("pointerenter",u),i.removeEventListener("pointerleave",d)}}},[a.scrollArea,a.scrollHideDelay]),c.jsx(I0,{present:n||o,children:c.jsx(Zs,{"data-state":o?"visible":"hidden",...r,ref:t})})}),Sp=p.forwardRef((e,t)=>{const{forceMount:n,...r}=e,a=U0(r1,e.__scopeScrollArea),o=e.orientation==="horizontal",l=nn(()=>s("SCROLL_END"),100),[i,s]=Cp("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 u=window.setTimeout(()=>s("HIDE"),a.scrollHideDelay);return()=>window.clearTimeout(u)}},[i,a.scrollHideDelay,s]),p.useEffect(()=>{const u=a.viewport,d=o?"scrollLeft":"scrollTop";if(u){let f=u[d];const h=()=>{const g=u[d];f!==g&&(s("SCROLL"),l()),f=g};return u.addEventListener("scroll",h),()=>u.removeEventListener("scroll",h)}},[a.viewport,o,s,l]),c.jsx(I0,{present:n||i!=="hidden",children:c.jsx(jo,{"data-state":i==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:t0(e.onPointerEnter,()=>s("POINTER_ENTER")),onPointerLeave:t0(e.onPointerLeave,()=>s("POINTER_LEAVE"))})})}),Zs=p.forwardRef((e,t)=>{const n=U0(r1,e.__scopeScrollArea),{forceMount:r,...a}=e,[o,l]=p.useState(!1),i=e.orientation==="horizontal",s=nn(()=>{if(n.viewport){const u=n.viewport.offsetWidth<n.viewport.scrollWidth,d=n.viewport.offsetHeight<n.viewport.scrollHeight;l(i?u:d)}},10);return ie(n.viewport,s),ie(n.content,s),c.jsx(I0,{present:r||o,children:c.jsx(jo,{"data-state":o?"visible":"hidden",...a,ref:t})})}),jo=p.forwardRef((e,t)=>{const{orientation:n="vertical",...r}=e,a=U0(r1,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}}),u=rc(i.viewport,i.content),d={...r,sizes:i,onSizesChange:s,hasThumb:u>0&&u<1,onThumbChange:h=>o.current=h,onThumbPointerUp:()=>l.current=0,onThumbPointerDown:h=>l.current=h};function f(h,g){return Tp(h,l.current,i,g)}return n==="horizontal"?c.jsx(Ep,{...d,ref:t,onThumbPositionChange:()=>{if(a.viewport&&o.current){const h=a.viewport.scrollLeft,g=d5(h,i,a.dir);o.current.style.transform=`translate3d(${g}px, 0, 0)`}},onWheelScroll:h=>{a.viewport&&(a.viewport.scrollLeft=h)},onDragScroll:h=>{a.viewport&&(a.viewport.scrollLeft=f(h,a.dir))}}):n==="vertical"?c.jsx(Ap,{...d,ref:t,onThumbPositionChange:()=>{if(a.viewport&&o.current){const h=a.viewport.scrollTop,g=d5(h,i);o.current.style.transform=`translate3d(0, ${g}px, 0)`}},onWheelScroll:h=>{a.viewport&&(a.viewport.scrollTop=h)},onDragScroll:h=>{a.viewport&&(a.viewport.scrollTop=f(h))}}):null}),Ep=p.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...a}=e,o=U0(r1,e.__scopeScrollArea),[l,i]=p.useState(),s=p.useRef(null),u=s0(t,s,o.onScrollbarXChange);return p.useEffect(()=>{s.current&&i(getComputedStyle(s.current))},[s]),c.jsx(ec,{"data-orientation":"horizontal",...a,ref:u,sizes:n,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":tn(n)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.x),onDragScroll:d=>e.onDragScroll(d.x),onWheelScroll:(d,f)=>{if(o.viewport){const h=o.viewport.scrollLeft+d.deltaX;e.onWheelScroll(h),ac(h,f)&&d.preventDefault()}},onResize:()=>{s.current&&o.viewport&&l&&r({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:s.current.clientWidth,paddingStart:kt(l.paddingLeft),paddingEnd:kt(l.paddingRight)}})}})}),Ap=p.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...a}=e,o=U0(r1,e.__scopeScrollArea),[l,i]=p.useState(),s=p.useRef(null),u=s0(t,s,o.onScrollbarYChange);return p.useEffect(()=>{s.current&&i(getComputedStyle(s.current))},[s]),c.jsx(ec,{"data-orientation":"vertical",...a,ref:u,sizes:n,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":tn(n)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.y),onDragScroll:d=>e.onDragScroll(d.y),onWheelScroll:(d,f)=>{if(o.viewport){const h=o.viewport.scrollTop+d.deltaY;e.onWheelScroll(h),ac(h,f)&&d.preventDefault()}},onResize:()=>{s.current&&o.viewport&&l&&r({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:s.current.clientHeight,paddingStart:kt(l.paddingTop),paddingEnd:kt(l.paddingBottom)}})}})}),[Ip,Js]=qs(r1),ec=p.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:a,onThumbChange:o,onThumbPointerUp:l,onThumbPointerDown:i,onThumbPositionChange:s,onDragScroll:u,onWheelScroll:d,onResize:f,...h}=e,g=U0(r1,n),[x,b]=p.useState(null),m=s0(t,j=>b(j)),S=p.useRef(null),y=p.useRef(""),_=g.viewport,M=r.content-r.viewport,E=A0(d),I=A0(s),k=nn(f,10);function T(j){if(S.current){const z=j.clientX-S.current.left,K=j.clientY-S.current.top;u({x:z,y:K})}}return p.useEffect(()=>{const j=z=>{const K=z.target;(x==null?void 0:x.contains(K))&&E(z,M)};return document.addEventListener("wheel",j,{passive:!1}),()=>document.removeEventListener("wheel",j,{passive:!1})},[_,x,M,E]),p.useEffect(I,[r,I]),ie(x,k),ie(g.content,k),c.jsx(Ip,{scope:n,scrollbar:x,hasThumb:a,onThumbChange:A0(o),onThumbPointerUp:A0(l),onThumbPositionChange:I,onThumbPointerDown:A0(i),children:c.jsx(o0.div,{...h,ref:m,style:{position:"absolute",...h.style},onPointerDown:t0(e.onPointerDown,j=>{j.button===0&&(j.target.setPointerCapture(j.pointerId),S.current=x.getBoundingClientRect(),y.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",g.viewport&&(g.viewport.style.scrollBehavior="auto"),T(j))}),onPointerMove:t0(e.onPointerMove,T),onPointerUp:t0(e.onPointerUp,j=>{const z=j.target;z.hasPointerCapture(j.pointerId)&&z.releasePointerCapture(j.pointerId),document.body.style.webkitUserSelect=y.current,g.viewport&&(g.viewport.style.scrollBehavior=""),S.current=null})})})}),Tt="ScrollAreaThumb",tc=p.forwardRef((e,t)=>{const{forceMount:n,...r}=e,a=Js(Tt,e.__scopeScrollArea);return c.jsx(I0,{present:n||a.hasThumb,children:c.jsx(Pp,{ref:t,...r})})}),Pp=p.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...a}=e,o=U0(Tt,n),l=Js(Tt,n),{onThumbPositionChange:i}=l,s=s0(t,f=>l.onThumbChange(f)),u=p.useRef(),d=nn(()=>{u.current&&(u.current(),u.current=void 0)},100);return p.useEffect(()=>{const f=o.viewport;if(f){const h=()=>{if(d(),!u.current){const g=kp(f,i);u.current=g,i()}};return i(),f.addEventListener("scroll",h),()=>f.removeEventListener("scroll",h)}},[o.viewport,d,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)",...r},onPointerDownCapture:t0(e.onPointerDownCapture,f=>{const g=f.target.getBoundingClientRect(),x=f.clientX-g.left,b=f.clientY-g.top;l.onThumbPointerDown({x,y:b})}),onPointerUp:t0(e.onPointerUp,l.onThumbPointerUp)})});tc.displayName=Tt;var $o="ScrollAreaCorner",nc=p.forwardRef((e,t)=>{const n=U0($o,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?c.jsx(Rp,{...e,ref:t}):null});nc.displayName=$o;var Rp=p.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,a=U0($o,n),[o,l]=p.useState(0),[i,s]=p.useState(0),u=!!(o&&i);return ie(a.scrollbarX,()=>{var f;const d=((f=a.scrollbarX)==null?void 0:f.offsetHeight)||0;a.onCornerHeightChange(d),s(d)}),ie(a.scrollbarY,()=>{var f;const d=((f=a.scrollbarY)==null?void 0:f.offsetWidth)||0;a.onCornerWidthChange(d),l(d)}),u?c.jsx(o0.div,{...r,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 kt(e){return e?parseInt(e,10):0}function rc(e,t){const n=e/t;return isNaN(n)?0:n}function tn(e){const t=rc(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function Tp(e,t,n,r="ltr"){const a=tn(n),o=a/2,l=t||o,i=a-l,s=n.scrollbar.paddingStart+l,u=n.scrollbar.size-n.scrollbar.paddingEnd-i,d=n.content-n.viewport,f=r==="ltr"?[0,d]:[d*-1,0];return oc([s,u],f)(e)}function d5(e,t,n="ltr"){const r=tn(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-a,l=t.content-t.viewport,i=o-r,s=n==="ltr"?[0,l]:[l*-1,0],u=Vo(e,s);return oc([0,l],[0,i])(u)}function oc(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function ac(e,t){return e>0&&e<t}var kp=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return function a(){const o={left:e.scrollLeft,top:e.scrollTop},l=n.left!==o.left,i=n.top!==o.top;(l||i)&&t(),n=o,r=window.requestAnimationFrame(a)}(),()=>window.cancelAnimationFrame(r)};function nn(e,t){const n=A0(e),r=p.useRef(0);return p.useEffect(()=>()=>window.clearTimeout(r.current),[]),p.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function ie(e,t){const n=A0(t);w1(()=>{let r=0;if(e){const a=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return a.observe(e),()=>{window.cancelAnimationFrame(r),a.unobserve(e)}}},[e,n])}var Np=Gs,Dp=Xs,f5=Qs,h5=tc,Op=nc;const Hp="_root_xlbio_3",zp="_viewport_xlbio_10",Vp="_scrollbar_xlbio_16",Lp="_thumb_xlbio_41",jp="_corner_xlbio_60",A1={root:Hp,viewport:zp,scrollbar:Vp,thumb:Lp,corner:jp},$p=({type:e,maxHeight:t="100%",maxWidth:n="100%",children:r,"data-test-id":a="fondue-scroll-area"},o)=>c.jsxs(Np,{type:e,className:A1.root,style:{maxWidth:n},"data-test-id":a,ref:o,children:[c.jsx(Dp,{className:A1.viewport,style:{maxHeight:t},"data-test-id":`${a}-viewport`,children:r}),c.jsx(f5,{className:A1.scrollbar,orientation:"vertical","data-test-id":`${a}-vertical-scrollbar`,children:c.jsx(h5,{className:A1.thumb,"data-test-id":`${a}-vertical-scrollbar-thumb`})}),c.jsx(f5,{className:A1.scrollbar,orientation:"horizontal","data-test-id":`${a}-horizontal-scrollbar`,children:c.jsx(h5,{className:A1.thumb,"data-test-id":`${a}-horizontal-scrollbar-thumb`})}),c.jsx(Op,{className:A1.corner,"data-test-id":`${a}-corner`})]}),Bp=C.forwardRef($p);Bp.displayName="ScrollArea";var Fp="Toggle",lc=p.forwardRef((e,t)=>{const{pressed:n,defaultPressed:r=!1,onPressedChange:a,...o}=e,[l=!1,i]=n1({prop:n,onChange:a,defaultProp:r});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)})})});lc.displayName=Fp;var me="ToggleGroup",[ic,xg]=H0(me,[Zt]),sc=Zt(),Bo=C.forwardRef((e,t)=>{const{type:n,...r}=e;if(n==="single"){const a=r;return c.jsx(Up,{...a,ref:t})}if(n==="multiple"){const a=r;return c.jsx(Kp,{...a,ref:t})}throw new Error(`Missing prop \`type\` expected on \`${me}\``)});Bo.displayName=me;var[cc,uc]=ic(me),Up=C.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:a=()=>{},...o}=e,[l,i]=n1({prop:n,defaultProp:r,onChange:a});return c.jsx(cc,{scope:e.__scopeToggleGroup,type:"single",value:l?[l]:[],onItemActivate:i,onItemDeactivate:C.useCallback(()=>i(""),[i]),children:c.jsx(dc,{...o,ref:t})})}),Kp=C.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:a=()=>{},...o}=e,[l=[],i]=n1({prop:n,defaultProp:r,onChange:a}),s=C.useCallback(d=>i((f=[])=>[...f,d]),[i]),u=C.useCallback(d=>i((f=[])=>f.filter(h=>h!==d)),[i]);return c.jsx(cc,{scope:e.__scopeToggleGroup,type:"multiple",value:l,onItemActivate:s,onItemDeactivate:u,children:c.jsx(dc,{...o,ref:t})})});Bo.displayName=me;var[Wp,qp]=ic(me),dc=C.forwardRef((e,t)=>{const{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:a=!0,orientation:o,dir:l,loop:i=!0,...s}=e,u=sc(n),d=Xt(l),f={role:"group",dir:d,...s};return c.jsx(Wp,{scope:n,rovingFocus:a,disabled:r,children:a?c.jsx(qi,{asChild:!0,...u,orientation:o,dir:d,loop:i,children:c.jsx(o0.div,{...f,ref:t})}):c.jsx(o0.div,{...f,ref:t})})}),Nt="ToggleGroupItem",fc=C.forwardRef((e,t)=>{const n=uc(Nt,e.__scopeToggleGroup),r=qp(Nt,e.__scopeToggleGroup),a=sc(e.__scopeToggleGroup),o=n.value.includes(e.value),l=r.disabled||e.disabled,i={...e,pressed:o,disabled:l},s=C.useRef(null);return r.rovingFocus?c.jsx(Gi,{asChild:!0,...a,focusable:!l,active:o,ref:s,children:c.jsx(p5,{...i,ref:t})}):c.jsx(p5,{...i,ref:t})});fc.displayName=Nt;var p5=C.forwardRef((e,t)=>{const{__scopeToggleGroup:n,value:r,...a}=e,o=uc(Nt,n),l={role:"radio","aria-checked":e.pressed,"aria-pressed":void 0},i=o.type==="single"?l:void 0;return c.jsx(lc,{...i,...a,ref:t,onPressedChange:s=>{s?o.onItemActivate(r):o.onItemDeactivate(r)}})}),Gp=Bo,Yp=fc;const Xp=({prop:e,defaultProp:t,onChange:n=()=>{}})=>{const[r,a]=Qp({defaultProp:t,onChange:n}),o=e!==void 0,l=o?e:r,i=C.useMemo(()=>n,[n]),s=C.useCallback(u=>{if(o){const d=typeof u=="function"?u(e):u;d!==e&&i(d)}else a(u)},[o,e,a,i]);return[l,s]},Qp=({defaultProp:e,onChange:t})=>{const n=C.useState(e),[r]=n,a=C.useRef(r),o=C.useMemo(()=>t,[t]);return C.useEffect(()=>{a.current!==r&&(o==null||o(r),a.current=r)},[r,a,o]),n},Zp="_root_1b6uw_5",Jp="_item_1b6uw_25",ev="_itemLabel_1b6uw_45",tv="_itemLabelActive_1b6uw_64",nv="_itemLabelInactive_1b6uw_87",rv="_activeIndicator_1b6uw_111",ov="_separator_1b6uw_202",T1={root:Zp,item:Jp,itemLabel:ev,itemLabelActive:tv,itemLabelInactive:nv,activeIndicator:rv,separator:ov},hc=({children:e,value:t,defaultValue:n,onValueChange:r,...a},o)=>{const[l,i]=Xp({prop:t,defaultProp:n,onChange:r});return c.jsxs(Gp,{ref:o,...a,className:T1.root,onValueChange:s=>{s&&i(s)},value:l,type:"single",asChild:!1,"aria-disabled":a.disabled,children:[e,c.jsx("div",{className:T1.activeIndicator})]})};hc.displayName="SegmentedControl.Root";const pc=({children:e,...t},n)=>c.jsxs(Yp,{ref:n,...t,className:T1.item,asChild:!1,children:[c.jsx("span",{className:T1.separator}),c.jsxs("span",{className:T1.itemLabel,children:[c.jsx("span",{className:T1.itemLabelActive,children:e}),c.jsx("span",{className:T1.itemLabelInactive,children:e})]})]});pc.displayName="SegmentedControl.Item";C.forwardRef(hc),C.forwardRef(pc);var vc=["PageUp","PageDown"],mc=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],gc={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},ge="Slider",[rr,av,lv]=Ao(ge),[bc,Cg]=H0(ge,[lv]),[iv,rn]=bc(ge),wc=p.forwardRef((e,t)=>{const{name:n,min:r=0,max:a=100,step:o=1,orientation:l="horizontal",disabled:i=!1,minStepsBetweenThumbs:s=0,defaultValue:u=[r],value:d,onValueChange:f=()=>{},onValueCommit:h=()=>{},inverted:g=!1,...x}=e,b=p.useRef(new Set),m=p.useRef(0),y=l==="horizontal"?sv:cv,[_=[],M]=n1({prop:d,defaultProp:u,onChange:z=>{var N;(N=[...b.current][m.current])==null||N.focus(),f(z)}}),E=p.useRef(_);function I(z){const K=pv(_,z);j(z,K)}function k(z){j(z,m.current)}function T(){const z=E.current[m.current];_[m.current]!==z&&h(_)}function j(z,K,{commit:N}={commit:!1}){const F=bv(o),V=wv(Math.round((z-r)/o)*o+r,F),B=Vo(V,[r,a]);M((U=[])=>{const H=fv(U,B,K);if(gv(H,s*o)){m.current=H.indexOf(B);const L=String(H)!==String(U);return L&&N&&h(H),L?H:U}else return U})}return c.jsx(iv,{scope:e.__scopeSlider,name:n,disabled:i,min:r,max:a,valueIndexToChangeRef:m,thumbs:b.current,values:_,orientation:l,children:c.jsx(rr.Provider,{scope:e.__scopeSlider,children:c.jsx(rr.Slot,{scope:e.__scopeSlider,children:c.jsx(y,{"aria-disabled":i,"data-disabled":i?"":void 0,...x,ref:t,onPointerDown:t0(x.onPointerDown,()=>{i||(E.current=_)}),min:r,max:a,inverted:g,onSlideStart:i?void 0:I,onSlideMove:i?void 0:k,onSlideEnd:i?void 0:T,onHomeKeyDown:()=>!i&&j(r,0,{commit:!0}),onEndKeyDown:()=>!i&&j(a,_.length-1,{commit:!0}),onStepKeyDown:({event:z,direction:K})=>{if(!i){const V=vc.includes(z.key)||z.shiftKey&&mc.includes(z.key)?10:1,B=m.current,U=_[B],H=o*V*K;j(U+H,B,{commit:!0})}}})})})})});wc.displayName=ge;var[yc,xc]=bc(ge,{startEdge:"left",endEdge:"right",size:"width",direction:1}),sv=p.forwardRef((e,t)=>{const{min:n,max:r,dir:a,inverted:o,onSlideStart:l,onSlideMove:i,onSlideEnd:s,onStepKeyDown:u,...d}=e,[f,h]=p.useState(null),g=s0(t,_=>h(_)),x=p.useRef(),b=Xt(a),m=b==="ltr",S=m&&!o||!m&&o;function y(_){const M=x.current||f.getBoundingClientRect(),E=[0,M.width],k=Fo(E,S?[n,r]:[r,n]);return x.current=M,k(_-M.left)}return c.jsx(yc,{scope:e.__scopeSlider,startEdge:S?"left":"right",endEdge:S?"right":"left",direction:S?1:-1,size:"width",children:c.jsx(Cc,{dir:b,"data-orientation":"horizontal",...d,ref:g,style:{...d.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:_=>{const M=y(_.clientX);l==null||l(M)},onSlideMove:_=>{const M=y(_.clientX);i==null||i(M)},onSlideEnd:()=>{x.current=void 0,s==null||s()},onStepKeyDown:_=>{const E=gc[S?"from-left":"from-right"].includes(_.key);u==null||u({event:_,direction:E?-1:1})}})})}),cv=p.forwardRef((e,t)=>{const{min:n,max:r,inverted:a,onSlideStart:o,onSlideMove:l,onSlideEnd:i,onStepKeyDown:s,...u}=e,d=p.useRef(null),f=s0(t,d),h=p.useRef(),g=!a;function x(b){const m=h.current||d.current.getBoundingClientRect(),S=[0,m.height],_=Fo(S,g?[r,n]:[n,r]);return h.current=m,_(b-m.top)}return c.jsx(yc,{scope:e.__scopeSlider,startEdge:g?"bottom":"top",endEdge:g?"top":"bottom",size:"height",direction:g?1:-1,children:c.jsx(Cc,{"data-orientation":"vertical",...u,ref:f,style:{...u.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:b=>{const m=x(b.clientY);o==null||o(m)},onSlideMove:b=>{const m=x(b.clientY);l==null||l(m)},onSlideEnd:()=>{h.current=void 0,i==null||i()},onStepKeyDown:b=>{const S=gc[g?"from-bottom":"from-top"].includes(b.key);s==null||s({event:b,direction:S?-1:1})}})})}),Cc=p.forwardRef((e,t)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:a,onSlideEnd:o,onHomeKeyDown:l,onEndKeyDown:i,onStepKeyDown:s,...u}=e,d=rn(ge,n);return c.jsx(o0.span,{...u,ref:t,onKeyDown:t0(e.onKeyDown,f=>{f.key==="Home"?(l(f),f.preventDefault()):f.key==="End"?(i(f),f.preventDefault()):vc.concat(mc).includes(f.key)&&(s(f),f.preventDefault())}),onPointerDown:t0(e.onPointerDown,f=>{const h=f.target;h.setPointerCapture(f.pointerId),f.preventDefault(),d.thumbs.has(h)?h.focus():r(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))})})}),_c="SliderTrack",Mc=p.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,a=rn(_c,n);return c.jsx(o0.span,{"data-disabled":a.disabled?"":void 0,"data-orientation":a.orientation,...r,ref:t})});Mc.displayName=_c;var or="SliderRange",Sc=p.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,a=rn(or,n),o=xc(or,n),l=p.useRef(null),i=s0(t,l),s=a.values.length,u=a.values.map(h=>Ac(h,a.min,a.max)),d=s>1?Math.min(...u):0,f=100-Math.max(...u);return c.jsx(o0.span,{"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,...r,ref:i,style:{...e.style,[o.startEdge]:d+"%",[o.endEdge]:f+"%"}})});Sc.displayName=or;var ar="SliderThumb",Ec=p.forwardRef((e,t)=>{const n=av(e.__scopeSlider),[r,a]=p.useState(null),o=s0(t,i=>a(i)),l=p.useMemo(()=>r?n().findIndex(i=>i.ref.current===r):-1,[n,r]);return c.jsx(uv,{...e,ref:o,index:l})}),uv=p.forwardRef((e,t)=>{const{__scopeSlider:n,index:r,name:a,...o}=e,l=rn(ar,n),i=xc(ar,n),[s,u]=p.useState(null),d=s0(t,y=>u(y)),f=s?!!s.closest("form"):!0,h=Vt(s),g=l.values[r],x=g===void 0?0:Ac(g,l.min,l.max),b=hv(r,l.values.length),m=h==null?void 0:h[i.size],S=m?vv(m,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}% + ${S}px)`},children:[c.jsx(rr.ItemSlot,{scope:e.__scopeSlider,children:c.jsx(o0.span,{role:"slider","aria-label":e["aria-label"]||b,"aria-valuemin":l.min,"aria-valuenow":g,"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:d,style:g===void 0?{display:"none"}:e.style,onFocus:t0(e.onFocus,()=>{l.valueIndexToChangeRef.current=r})})}),f&&c.jsx(dv,{name:a??(l.name?l.name+(l.values.length>1?"[]":""):void 0),value:g},r)]})});Ec.displayName=ar;var dv=e=>{const{value:t,...n}=e,r=p.useRef(null),a=yr(t);return p.useEffect(()=>{const o=r.current,l=window.HTMLInputElement.prototype,s=Object.getOwnPropertyDescriptor(l,"value").set;if(a!==t&&s){const u=new Event("input",{bubbles:!0});s.call(o,t),o.dispatchEvent(u)}},[a,t]),c.jsx("input",{style:{display:"none"},...n,ref:r,defaultValue:t})};function fv(e=[],t,n){const r=[...e];return r[n]=t,r.sort((a,o)=>a-o)}function Ac(e,t,n){const o=100/(n-t)*(e-t);return Vo(o,[0,100])}function hv(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function pv(e,t){if(e.length===1)return 0;const n=e.map(a=>Math.abs(a-t)),r=Math.min(...n);return n.indexOf(r)}function vv(e,t,n){const r=e/2,o=Fo([0,50],[0,r]);return(r-o(t)*n)*n}function mv(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function gv(e,t){if(t>0){const n=mv(e);return Math.min(...n)>=t}return!0}function Fo(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function bv(e){return(String(e).split(".")[1]||"").length}function wv(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}var yv=wc,xv=Mc,Cv=Sc,_v=Ec;const Mv="_root_cpzhx_5",Sv="_thumb_cpzhx_16",Ev="_track_cpzhx_20",Av="_range_cpzhx_27",at={root:Mv,thumb:Sv,track:Ev,range:Av},Iv=({value:e,defaultValue:t=[0],onChange:n,onCommit:r,"data-test-id":a="fondue-slider",...o},l)=>{const i=C.useRef(null);return c.jsxs(yv,{ref:l,className:at.root,value:e,defaultValue:t,onValueChange:n,onValueCommit:r,"data-test-id":a,...o,children:[c.jsx(xv,{onPointerDown:()=>{i.current&&(i.current.dataset.showFocusRing="false")},className:at.track,children:c.jsx(Cv,{className:at.range})}),(e||t).map((s,u)=>c.jsx(_v,{ref:i,className:at.thumb,onPointerDown:d=>{d.currentTarget.dataset.showFocusRing="false"},onBlur:d=>{d.currentTarget.dataset.showFocusRing="true"}},u))]})},Pv=C.forwardRef(Iv);Pv.displayName="Slider";var Uo="Switch",[Rv,_g]=H0(Uo),[Tv,kv]=Rv(Uo),Ic=p.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:a,defaultChecked:o,required:l,disabled:i,value:s="on",onCheckedChange:u,...d}=e,[f,h]=p.useState(null),g=s0(t,y=>h(y)),x=p.useRef(!1),b=f?!!f.closest("form"):!0,[m=!1,S]=n1({prop:a,defaultProp:o,onChange:u});return c.jsxs(Tv,{scope:n,checked:m,disabled:i,children:[c.jsx(o0.button,{type:"button",role:"switch","aria-checked":m,"aria-required":l,"data-state":Tc(m),"data-disabled":i?"":void 0,disabled:i,value:s,...d,ref:g,onClick:t0(e.onClick,y=>{S(_=>!_),b&&(x.current=y.isPropagationStopped(),x.current||y.stopPropagation())})}),b&&c.jsx(Nv,{control:f,bubbles:!x.current,name:r,value:s,checked:m,required:l,disabled:i,style:{transform:"translateX(-100%)"}})]})});Ic.displayName=Uo;var Pc="SwitchThumb",Rc=p.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,a=kv(Pc,n);return c.jsx(o0.span,{"data-state":Tc(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:t})});Rc.displayName=Pc;var Nv=e=>{const{control:t,checked:n,bubbles:r=!0,...a}=e,o=p.useRef(null),l=yr(n),i=Vt(t);return p.useEffect(()=>{const s=o.current,u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(l!==n&&f){const h=new Event("click",{bubbles:r});f.call(s,n),s.dispatchEvent(h)}},[l,n,r]),c.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...a,tabIndex:-1,ref:o,style:{...e.style,...i,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Tc(e){return e?"checked":"unchecked"}var Dv=Ic,Ov=Rc;const Hv="_root_b6n55_5",zv="_small_b6n55_27",Vv="_medium_b6n55_31",Lv="_large_b6n55_35",jv="_thumb_b6n55_49",Tn={root:Hv,small:zv,medium:Vv,large:Lv,thumb:jv},$v=({value:e,defaultValue:t,size:n="medium",onChange:r,"data-test-id":a="fondue-switch","aria-label":o="Switch",...l},i)=>c.jsx(Dv,{ref:i,checked:e,defaultChecked:t,className:M1([Tn.root,Tn[n]]),onCheckedChange:r,"aria-label":o,"data-test-id":a,...l,children:c.jsx(Ov,{className:Tn.thumb})}),Bv=C.forwardRef($v);Bv.displayName="Switch";var Fv="VisuallyHidden",kc=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}}));kc.displayName=Fv;var Uv=kc,[on,Mg]=H0("Tooltip",[ve]),an=ve(),Nc="TooltipProvider",Kv=700,lr="tooltip.open",[Wv,Ko]=on(Nc),Dc=e=>{const{__scopeTooltip:t,delayDuration:n=Kv,skipDelayDuration:r=300,disableHoverableContent:a=!1,children:o}=e,[l,i]=p.useState(!0),s=p.useRef(!1),u=p.useRef(0);return p.useEffect(()=>{const d=u.current;return()=>window.clearTimeout(d)},[]),c.jsx(Wv,{scope:t,isOpenDelayed:l,delayDuration:n,onOpen:p.useCallback(()=>{window.clearTimeout(u.current),i(!1)},[]),onClose:p.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>i(!0),r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:p.useCallback(d=>{s.current=d},[]),disableHoverableContent:a,children:o})};Dc.displayName=Nc;var ln="Tooltip",[qv,Ke]=on(ln),Oc=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:a=!1,onOpenChange:o,disableHoverableContent:l,delayDuration:i}=e,s=Ko(ln,e.__scopeTooltip),u=an(t),[d,f]=p.useState(null),h=J1(),g=p.useRef(0),x=l??s.disableHoverableContent,b=i??s.delayDuration,m=p.useRef(!1),[S=!1,y]=n1({prop:r,defaultProp:a,onChange:k=>{k?(s.onOpen(),document.dispatchEvent(new CustomEvent(lr))):s.onClose(),o==null||o(k)}}),_=p.useMemo(()=>S?m.current?"delayed-open":"instant-open":"closed",[S]),M=p.useCallback(()=>{window.clearTimeout(g.current),m.current=!1,y(!0)},[y]),E=p.useCallback(()=>{window.clearTimeout(g.current),y(!1)},[y]),I=p.useCallback(()=>{window.clearTimeout(g.current),g.current=window.setTimeout(()=>{m.current=!0,y(!0)},b)},[b,y]);return p.useEffect(()=>()=>window.clearTimeout(g.current),[]),c.jsx(Il,{...u,children:c.jsx(qv,{scope:t,contentId:h,open:S,stateAttribute:_,trigger:d,onTriggerChange:f,onTriggerEnter:p.useCallback(()=>{s.isOpenDelayed?I():M()},[s.isOpenDelayed,I,M]),onTriggerLeave:p.useCallback(()=>{x?E():window.clearTimeout(g.current)},[E,x]),onOpen:M,onClose:E,disableHoverableContent:x,children:n})})};Oc.displayName=ln;var ir="TooltipTrigger",Hc=p.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,a=Ke(ir,n),o=Ko(ir,n),l=an(n),i=p.useRef(null),s=s0(t,i,a.onTriggerChange),u=p.useRef(!1),d=p.useRef(!1),f=p.useCallback(()=>u.current=!1,[]);return p.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),c.jsx(Ut,{asChild:!0,...l,children:c.jsx(o0.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...r,ref:s,onPointerMove:t0(e.onPointerMove,h=>{h.pointerType!=="touch"&&!d.current&&!o.isPointerInTransitRef.current&&(a.onTriggerEnter(),d.current=!0)}),onPointerLeave:t0(e.onPointerLeave,()=>{a.onTriggerLeave(),d.current=!1}),onPointerDown:t0(e.onPointerDown,()=>{u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:t0(e.onFocus,()=>{u.current||a.onOpen()}),onBlur:t0(e.onBlur,a.onClose),onClick:t0(e.onClick,a.onClose)})})});Hc.displayName=ir;var Wo="TooltipPortal",[Gv,Yv]=on(Wo,{forceMount:void 0}),zc=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:a}=e,o=Ke(Wo,t);return c.jsx(Gv,{scope:t,forceMount:n,children:c.jsx(I0,{present:n||o.open,children:c.jsx(Be,{asChild:!0,container:a,children:r})})})};zc.displayName=Wo;var se="TooltipContent",Vc=p.forwardRef((e,t)=>{const n=Yv(se,e.__scopeTooltip),{forceMount:r=n.forceMount,side:a="top",...o}=e,l=Ke(se,e.__scopeTooltip);return c.jsx(I0,{present:r||l.open,children:l.disableHoverableContent?c.jsx(Lc,{side:a,...o,ref:t}):c.jsx(Xv,{side:a,...o,ref:t})})}),Xv=p.forwardRef((e,t)=>{const n=Ke(se,e.__scopeTooltip),r=Ko(se,e.__scopeTooltip),a=p.useRef(null),o=s0(t,a),[l,i]=p.useState(null),{trigger:s,onClose:u}=n,d=a.current,{onPointerInTransitChange:f}=r,h=p.useCallback(()=>{i(null),f(!1)},[f]),g=p.useCallback((x,b)=>{const m=x.currentTarget,S={x:x.clientX,y:x.clientY},y=Jv(S,m.getBoundingClientRect()),_=e9(S,y),M=t9(b.getBoundingClientRect()),E=r9([..._,...M]);i(E),f(!0)},[f]);return p.useEffect(()=>()=>h(),[h]),p.useEffect(()=>{if(s&&d){const x=m=>g(m,d),b=m=>g(m,s);return s.addEventListener("pointerleave",x),d.addEventListener("pointerleave",b),()=>{s.removeEventListener("pointerleave",x),d.removeEventListener("pointerleave",b)}}},[s,d,g,h]),p.useEffect(()=>{if(l){const x=b=>{const m=b.target,S={x:b.clientX,y:b.clientY},y=(s==null?void 0:s.contains(m))||(d==null?void 0:d.contains(m)),_=!n9(S,l);y?h():_&&(h(),u())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[s,d,l,u,h]),c.jsx(Lc,{...e,ref:o})}),[Qv,Zv]=on(ln,{isInside:!1}),Lc=p.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":a,onEscapeKeyDown:o,onPointerDownOutside:l,...i}=e,s=Ke(se,n),u=an(n),{onClose:d}=s;return p.useEffect(()=>(document.addEventListener(lr,d),()=>document.removeEventListener(lr,d)),[d]),p.useEffect(()=>{if(s.trigger){const f=h=>{const g=h.target;g!=null&&g.contains(s.trigger)&&d()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[s.trigger,d]),c.jsx(je,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:c.jsxs(Dr,{"data-state":s.stateAttribute,...u,...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(G5,{children:r}),c.jsx(Qv,{scope:n,isInside:!0,children:c.jsx(Uv,{id:s.contentId,role:"tooltip",children:a||r})})]})})});Vc.displayName=se;var jc="TooltipArrow",$c=p.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,a=an(n);return Zv(jc,n).isInside?null:c.jsx(Or,{...a,...r,ref:t})});$c.displayName=jc;function Jv(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),a=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(n,r,a,o)){case o:return"left";case a:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function e9(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function t9(e){const{top:t,right:n,bottom:r,left:a}=e;return[{x:a,y:t},{x:n,y:t},{x:n,y:r},{x:a,y:r}]}function n9(e,t){const{x:n,y:r}=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,u=t[l].x,d=t[l].y;s>r!=d>r&&n<(u-i)*(r-s)/(d-s)+i&&(a=!a)}return a}function r9(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),o9(t)}function o9(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const a=e[r];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 n=[];for(let r=e.length-1;r>=0;r--){const a=e[r];for(;n.length>=2;){const o=n[n.length-1],l=n[n.length-2];if((o.x-l.x)*(a.y-l.y)>=(o.y-l.y)*(a.x-l.x))n.pop();else break}n.push(a)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var a9=Dc,l9=Oc,i9=Hc,s9=zc,c9=Vc,u9=$c;const d9="_root_m0ok9_4",f9="_arrow_m0ok9_21",v5={root:d9,arrow:f9},Bc=({children:e,enterDelay:t=700,open:n,onOpenChange:r})=>c.jsx(a9,{children:c.jsx(l9,{delayDuration:t,open:n,onOpenChange:r,children:e})});Bc.displayName="Tooltip.Root";const Fc=({children:e,"data-test-id":t="fondue-tooltip-trigger"},n)=>c.jsx(i9,{"data-test-id":t,asChild:!0,ref:n,children:e});Fc.displayName="Tooltip.Trigger";const Uc=({children:e,className:t,maxWidth:n,"data-test-id":r="fondue-tooltip-content",padding:a="spacious",...o},l)=>c.jsx(s9,{children:c.jsxs(c9,{"data-test-id":r,"data-tooltip-spacing":a,className:M1(v5.root,t),style:{maxWidth:n},collisionPadding:16,sideOffset:8,ref:l,...o,children:[e,c.jsx(u9,{"aria-hidden":"true",className:v5.arrow})]})});Uc.displayName="Tooltip.Content";const c1={Root:Bc,Trigger:C.forwardRef(Fc),Content:C.forwardRef(Uc)},h9=e=>e==="IMAGE"?c.jsx(v.IconImage24,{}):e==="VIDEO"?c.jsx(v.IconPlayFrame24,{}):e==="AUDIO"?c.jsx(v.IconMusicNote24,{}):c.jsx(v.IconDocument24,{}),qo=C.forwardRef(({item:e,isEditing:t,draggableProps:n,transformStyle:r,isDragging:a,isOverlay:o,isLoading:l,onDelete:i,onReplaceWithBrowse:s,onReplaceWithUpload:u,onDownload:d},f)=>{const[h,g]=C.useState(),[x,{selectedFiles:b}]=N1.useFileInput({multiple:!0,accept:"image/*"}),[m,{results:S,doneAll:y}]=N1.useAssetUpload(),{focusProps:_,isFocusVisible:M}=y5.useFocusRing();C.useEffect(()=>{b&&m(b[0])},[b]),C.useEffect(()=>{y&&u(S[0])},[y,S]);const E=l||b&&!y;return c.jsxs("button",{"aria-label":"Download attachment","data-test-id":"attachments-item",onClick:()=>d==null?void 0:d(),ref:f,style:{...r,opacity:a&&!o?.3:1,fontFamily:"var(-f-theme-settings-body-font-family)"},className:e1(["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:E?c.jsx(v.LoadingCircle,{size:v.LoadingCircleSize.Small}):h9(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:e1(["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",{..._,...n,"aria-label":"Drag attachment",className:e1([" 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&&v.FOCUS_STYLE,M&&"tw-z-[2]"]),children:c.jsx(v.IconGrabHandle20,{})}),c.jsx("div",{"data-test-id":"attachments-actionbar-flyout",children:c.jsx(v.Flyout,{placement:v.FlyoutPlacement.Right,isOpen:(h==null?void 0:h.id)===e.id,fitContent:!0,legacyFooter:!1,onOpenChange:I=>g(I?e:void 0),trigger:(I,k)=>c.jsx(v.Button,{ref:k,icon:c.jsx(v.IconPen20,{}),emphasis:v.ButtonEmphasis.Default,onClick:()=>g(e)}),children:c.jsx(v.ActionMenu,{menuBlocks:[{id:"menu",menuItems:[{id:"upload",size:v.MenuItemContentSize.XSmall,title:"Replace with upload",onClick:()=>{x(),g(void 0)},initialValue:!0,decorator:c.jsx("div",{className:"tw-mr-2",children:c.jsx(v.IconArrowCircleUp20,{})})},{id:"asset",size:v.MenuItemContentSize.XSmall,title:"Replace with asset",onClick:()=>{s(),g(void 0)},initialValue:!0,decorator:c.jsx("div",{className:"tw-mr-2",children:c.jsx(v.IconImageStack20,{})})}]},{id:"menu-delete",menuItems:[{id:"delete",size:v.MenuItemContentSize.XSmall,title:"Delete",style:v.MenuItemStyle.Danger,onClick:()=>{i(),g(void 0)},initialValue:!0,decorator:c.jsx("div",{className:"tw-mr-2",children:c.jsx(v.IconTrashBin20,{})})}]}]})})})]})]})});qo.displayName="AttachmentItem";const p9=e=>{const{attributes:t,listeners:n,setNodeRef:r,transform:a,transition:o,isDragging:l}=lt.useSortable({id:e.item.id}),i={transform:a?`translate(${a.x}px, ${a.y}px)`:"",transition:o,zIndex:l?2:1},s={...t,...n};return c.jsx(qo,{ref:r,isDragging:l,transformStyle:i,draggableProps:s,...e})},v9=({children:e,isFlyoutOpen:t,triggerProps:n,triggerRef:r})=>c.jsxs("button",{className:e1(["tw-flex tw-text-xs tw-font-body tw-items-center tw-gap-1 tw-rounded-full tw-outline tw-outline-1 tw-outline-offset-1 tw-p-1.5 tw-outline-line",t?"tw-bg-box-neutral-pressed tw-text-box-neutral-inverse-pressed":"tw-bg-base hover:tw-bg-box-neutral-hover active:tw-bg-box-neutral-pressed tw-text-box-neutral-inverse hover:tw-text-box-neutral-inverse-hover active:tw-text-box-neutral-inverse-pressed"]),...n,ref:r,"data-test-id":"attachments-button-trigger",children:[c.jsx(v.IconPaperclip16,{}),e,c.jsx(v.IconCaretDown12,{})]}),Kc=({items:e=[],onDelete:t,onReplaceWithBrowse:n,onReplaceWithUpload:r,onBrowse:a,onUpload:o,onSorted:l,appBridge:i,triggerComponent:s=v9,isOpen:u,onOpenChange:d})=>{const[f,h]=C.useState(e),[g,x]=C.useState(!1),b=w0.useSensors(w0.useSensor(w0.PointerSensor),w0.useSensor(w0.KeyboardSensor)),[m,S]=C.useState(void 0),[y,_]=C.useState(!1),[M,E]=C.useState([]),[I,k]=C.useState(null),T=N1.useEditorState(i),{openAssetChooser:j,closeAssetChooser:z}=N1.useAssetChooser(i),K=u!==void 0,N=K?u:g,F=f==null?void 0:f.find(R=>R.id===m),[V,{results:B,doneAll:U}]=N1.useAssetUpload({onUploadProgress:()=>!y&&_(!0)}),H=R=>{const D=K?d:x;D==null||D(R)};C.useEffect(()=>{h(e)},[e]),C.useEffect(()=>{I&&(_(!0),V(I))},[I]),C.useEffect(()=>{(async()=>{U&&(await o(B),_(!1))})()},[U,B]);const L=()=>{H(!1),j(R=>{a(R),z(),H(!0)},{multiSelection:!0,selectedValueIds:f.map(R=>R.id)})},P=R=>{H(!1),j(async D=>{H(!0),z(),E([...M,R.id]),await n(R,D[0]),E(M.filter(G=>G!==R.id))},{multiSelection:!1,selectedValueIds:f.map(D=>D.id)})},A=async(R,D)=>{E([...M,R.id]),await r(R,D),E(M.filter(G=>G!==R.id))},O=R=>{const{active:D}=R;S(D.id)},$=R=>{const{active:D,over:G}=R;if(G&&D.id!==G.id&&f){const Y=f.findIndex(Z=>Z.id===D.id),Q=f.findIndex(Z=>Z.id===G.id),J=lt.arrayMove(f,Y,Q);h(J),l(J)}S(void 0)};return T||((f==null?void 0:f.length)??0)>0?c.jsxs(c1.Root,{enterDelay:500,children:[c.jsx(c1.Trigger,{children:c.jsx("div",{"data-test-id":"attachments-flyout-button",children:c.jsx(v.Flyout,{placement:v.FlyoutPlacement.BottomRight,onOpenChange:R=>H(F?!0:R),isOpen:N,hug:!1,fitContent:!0,legacyFooter:!1,trigger:(R,D)=>c.jsx(s,{isFlyoutOpen:N,triggerProps:R,triggerRef:D,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(w0.DndContext,{sensors:b,collisionDetection:w0.closestCenter,onDragStart:O,onDragEnd:$,modifiers:[X7.restrictToWindowEdges],children:[c.jsx(lt.SortableContext,{items:f,strategy:lt.rectSortingStrategy,children:c.jsx("div",{className:"tw-border-b tw-border-b-line",children:f.map(R=>c.jsx(p9,{isEditing:T,isLoading:M.includes(R.id),item:R,onDelete:()=>t(R),onReplaceWithBrowse:()=>P(R),onReplaceWithUpload:D=>A(R,D),onDownload:()=>i.dispatch({name:"downloadAsset",payload:R})},R.id))})}),c.jsx(w0.DragOverlay,{children:F&&c.jsx(qo,{isOverlay:!0,isEditing:T,item:F,isDragging:!0,onDelete:()=>t(F),onReplaceWithBrowse:()=>P(F),onReplaceWithUpload:R=>A(F,R)},m)})]}),T&&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(v.AssetInput,{isLoading:y,size:v.AssetInputSize.Small,onUploadClick:R=>k(R),onLibraryClick:L})]})]})})})}),c.jsx(c1.Content,{side:"top",children:"Attachments"})]}):null},m9=(e,t)=>{const n=[v.FOCUS_VISIBLE_STYLE,"tw-relative tw-inline-flex tw-items-center tw-justify-center","tw-h-6 tw-p-1","tw-rounded","tw-text-xs tw-font-medium","tw-gap-0.5","focus-visible:tw-z-10"];return t?n.push("tw-bg-box-neutral-pressed","tw-text-box-neutral-inverse-pressed",e==="grab"?"tw-cursor-grabbing":"tw-cursor-pointer"):n.push("hover:tw-bg-box-neutral-hover active:tw-bg-box-neutral-pressed","tw-text-text-weak hover:tw-text-box-neutral-inverse-hover active:tw-text-box-neutral-inverse-pressed",e==="grab"?"!tw-cursor-grab active:tw-cursor-grabbing":"tw-cursor-pointer"),e1(n)},We=C.forwardRef(({onClick:e,children:t,forceActiveStyle:n,cursor:r="pointer","data-test-id":a="base-toolbar-button",...o},l)=>c.jsx("button",{onClick:e,className:m9(r,n),"data-test-id":a,...o,ref:l,children:t}));We.displayName="BaseToolbarButton";const g9=({children:e,isFlyoutOpen:t,triggerProps:n,triggerRef:r})=>c.jsxs(We,{forceActiveStyle:t,"data-test-id":"attachments-toolbar-button-trigger",...n,ref:r,children:[c.jsx(v.IconPaperclip16,{}),e,c.jsx(v.IconCaretDown12,{})]}),Wc="attachments",qc=({flyoutId:e=Wc})=>{const t=v.useMemoizedId(e),{appBridge:n,attachments:r,onAttachmentsAdd:a,onAttachmentDelete:o,onAttachmentReplace:l,onAttachmentsSorted:i}=N5(),{isOpen:s,onOpenChange:u}=Ht(t),d=Ve();return c.jsx(Kc,{onUpload:a,onDelete:o,onReplaceWithBrowse:l,onReplaceWithUpload:l,onSorted:i,onBrowse:a,items:r,appBridge:n,triggerComponent:g9,isOpen:s&&!d,onOpenChange:u})},Gc="Drag or press ↵ to move",Yc="Move with ↑↓←→ and confirm with ↵",Go=({content:e,children:t,open:n,disabled:r})=>r?t:c.jsxs(c1.Root,{enterDelay:300,open:n,children:[c.jsx(c1.Trigger,{children:t}),c.jsx(c1.Content,{side:"top",children:c.jsx("div",{children:e})})]}),Xc=({tooltip:e,icon:t,setActivatorNodeRef:n,draggableProps:r})=>{const a=Ve();return c.jsx(Go,{...a&&{open:a},content:c.jsx("div",{children:a?Yc:e??Gc}),children:c.jsx(We,{ref:n,"data-test-id":"block-item-wrapper-toolbar-btn",forceActiveStyle:a,cursor:"grab",...r,children:t})})},Yo=({content:e,icon:t,tooltip:n,flyoutId:r,flyoutFooter:a,flyoutHeader:o})=>{const l=v.useMemoizedId(r),{isOpen:i,onOpenChange:s}=Ht(l),u=Ve();return c.jsx(Go,{disabled:u||i,content:n,children:c.jsx("div",{className:"tw-flex tw-flex-shrink-0 tw-flex-1 tw-h-6 tw-relative",children:c.jsx(v.Flyout,{isOpen:i&&!u,legacyFooter:!1,fixedFooter:a,fixedHeader:o,fitContent:!0,hug:!1,placement:v.FlyoutPlacement.BottomRight,onOpenChange:s,trigger:(d,f)=>c.jsx(We,{"data-test-id":"block-item-wrapper-toolbar-flyout",forceActiveStyle:i&&!u,...d,ref:f,children:t}),children:e})})})},Qc=({items:e,flyoutId:t})=>{const{onOpenChange:n}=Ht(t);return c.jsx(v.ActionMenu,{menuBlocks:e.map((r,a)=>({id:a.toString(),menuItems:r.map((o,l)=>({id:a.toString()+l.toString(),size:v.MenuItemContentSize.XSmall,title:o.title,style:o.style,onClick:()=>{n(!1),o.onClick()},initialValue:!0,decorator:c.jsx("div",{className:"tw-mr-2",children:o.icon})}))}))})},Xo="menu",Zc=({items:e,flyoutId:t=Xo,tooltip:n="Options"})=>{const r=v.useMemoizedId(t);return c.jsx(Yo,{icon:c.jsx(v.IconDotsHorizontal16,{}),tooltip:n,flyoutId:r,content:c.jsx(Qc,{items:e,flyoutId:r})})},b9=({tooltip:e,icon:t,onClick:n})=>{const r=Ve();return c.jsx(Go,{disabled:r,content:e??"",children:c.jsx(We,{"data-test-id":"block-item-wrapper-toolbar-btn",onClick:n,children:t})})},m5=({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}),Jc=({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(m5,{children:c.jsx(qc,{})}),e.length>0&&c.jsx(m5,{children:e.map(n=>{switch(n.type){case"dragHandle":return c.jsx(Xc,{...n},n.tooltip+n.type);case"menu":return c.jsx(Zc,{...n},n.tooltip+n.type);case"flyout":return c.jsx(Yo,{...n},n.tooltip+n.type);default:return c.jsx(b9,{...n},n.tooltip+n.type)}})})]}),e7=C.memo(({children:e,toolbarItems:t,shouldHideWrapper:n,shouldHideComponent:r=!1,isDragging:a=!1,shouldFillContainer:o,outlineOffset:l=0,shouldBeShown:i=!1,showAttachments:s=!1})=>{const[u,d]=C.useState(i?[Xo]:[]),f=C.useRef(null);if(n)return c.jsx(c.Fragment,{children:e});const h=t==null?void 0:t.filter(x=>x!==void 0),g=u.length>0||i;return c.jsx(E5,{isDragPreview:a,children:c.jsx(I5,{openFlyoutIds:u,setOpenFlyoutIds:d,children:c.jsxs("div",{ref:f,"data-test-id":"block-item-wrapper",style:{outlineOffset:l},className:e1(["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",g&&"tw-outline",r&&"tw-opacity-0"]),children:[c.jsx("div",{style:{right:-1-l,bottom:`calc(100% - ${2+l}px)`},className:e1(["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",g&&"tw-opacity-100"]),children:c.jsx(Jc,{attachments:{isEnabled:s},items:h})}),e]})})})});e7.displayName="BlockItemWrapper";const w9=({onDownload:e})=>{const{isFocused:t,focusProps:n}=y5.useFocusRing();return c.jsxs(c1.Root,{enterDelay:500,children:[c.jsx(c1.Trigger,{children:c.jsx("button",{tabIndex:0,"aria-label":"Download",...n,className:e1(["tw-outline-none tw-rounded",t&&v.FOCUS_STYLE]),onClick:e,onPointerDown:r=>r.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(v.IconArrowCircleDown16,{})})})}),c.jsx(c1.Content,{side:"top",children:"Download"})]})},y9=({ref:e,disabled:t,onChange:n})=>{C.useEffect(()=>{if(t||!e.current)return;let r=!1;const a=new IntersectionObserver(([o])=>{o.isIntersecting!==r&&(r=o.isIntersecting,n(o.isIntersecting))});return a.observe(e.current),()=>{a.disconnect()}},[e,t,n])},x9=({value:e="",gap:t,customClass:n,show:r=!0,plugins:a})=>{const[o,l]=C.useState(null);return C.useEffect(()=>{(async()=>l(await v.serializeRawToHtmlAsync(e,a,void 0,t,n)))()},[e,t,a,n]),!r||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"})},Qo=v.createStore("floatingButton")({openEditorId:null,mouseDown:!1,updated:!1,url:"",text:"",buttonStyle:"primary",newTab:!1,mode:"",isEditing:!1}).extendActions(e=>({reset:()=>{e.url(""),e.text(""),e.buttonStyle("primary"),e.newTab(!1),e.mode(""),e.isEditing(!1)}})).extendActions(e=>({show:(t,n)=>{e.mode(t),e.isEditing(!1),e.openEditorId(n)},hide:()=>{e.reset(),e.openEditorId(null)}})).extendSelectors(e=>({isOpen:t=>e.openEditorId===t})),_0=Qo.set,R0=Qo.get,ze=()=>Qo.use,t7=e=>{if(!e)return!1;const t=n=>n.some(r=>r.text?r.text!=="":r.children?t(r.children):!1);try{const n=JSON.parse(e);return t(n)}catch{return!1}},C9=(e="p",t="",n)=>t7(t)?t:JSON.stringify([{type:e,children:[{text:t,textStyle:e}],align:n}]),_9=(e,t,n)=>e===D1.Custom?t:n,M9=e=>e.map(n7),n7=e=>({id:e.id,title:e.name,colors:e.colors.map(E9)}),S9=e=>"revision"in e,E9=e=>{if(S9(e)){const{title:t,revision:n}=e;return{alpha:n.rgba.alpha?n.rgba.alpha/255:1,red:n.rgba.red??0,green:n.rgba.green??0,blue:n.rgba.blue??0,name:t??""}}return{alpha:e.alpha?e.alpha/255:1,red:e.red??0,green:e.green??0,blue:e.blue??0,name:e.name??""}},Zo=(e,t)=>{const n=v.getAboveNode(e,{match:{type:v.ELEMENT_LINK}});return Array.isArray(n)?t(n[0]):""},A9=e=>Zo(e,t=>{var n,r;return((r=(n=t.chosenLink)==null?void 0:n.searchResult)==null?void 0:r.link)||""}),I9=e=>Zo(e,t=>t.url||""),Jo=e=>{var t,n;return e.url||((n=(t=e.chosenLink)==null?void 0:t.searchResult)==null?void 0:n.link)||""},P9=e=>Zo(e,Jo),ea=/^\/(document|r)\/\S+$/i,sn=e=>{if(ea.test(e))return e;try{return new URL(e),e}catch{return`https://${e}`}},cn=e=>{if(ea.test(e))return!0;try{const t=new URL(e);return["http:","https:","mailto:","tel:"].includes(t.protocol)&&t.pathname!==""}catch{return!1}},ce=e=>cn(sn(e))||e==="",r7=(e,{type:t})=>{const{apply:n,normalizeNode:r}=e;return e.apply=a=>{if(a.type!=="set_selection"){n(a);return}const o=a.newProperties;if(!(o!=null&&o.focus)||!o.anchor||!v.isCollapsed(o)){n(a);return}const l=v.getAboveNode(e,{at:o,match:{type:v.getPluginType(e,v0)}});if(l){const[,i]=l;let s;v.isStartPoint(e,o.focus,i)&&(s=v.getPreviousNodeEndPoint(e,i)),v.isEndPoint(e,o.focus,i)&&(s=v.getNextNodeStartPoint(e,i)),s&&(a.newProperties={anchor:s,focus:s})}n(a)},e.normalizeNode=([a,o])=>{if(a.type===v.getPluginType(e,v0)){const l=e.selection;if(l&&v.isCollapsed(l)&&v.isEndPoint(e,l.focus,o)){const i=v.getNextNodeStartPoint(e,o);if(i)v.select(e,i);else{const s=v.Path.next(o);v.insertNodes(e,{text:""},{at:s}),v.select(e,s)}}}r([a,o])},v.withRemoveEmptyNodes(e,v.mockPlugin({options:{types:t}}))},o7=(e,t,n)=>{v.insertNodes(e,[s7(e,t)],n)},ta=e=>{if(!e.selection)return;const{isUrl:t,forceSubmit:n}=v.getPluginOptions(e,v0),r=R0.url();if(!((t==null?void 0:t(r))||n))return;const o=R0.text(),l=R0.buttonStyle(),i=R0.newTab()?void 0:"_self";return _0.reset(),a7(e,{url:r,text:o,buttonStyle:l,target:i,isUrl:s=>n||!t?!0:t(s)}),setTimeout(()=>{v.focusEditor(e,e.selection??void 0)},0),!0},ue=(e,t)=>v.withoutNormalizing(e,()=>{var n,r,a,o,l,i;if(t!=null&&t.split){if(v.getAboveNode(e,{at:(n=e.selection)==null?void 0:n.anchor,match:{type:v.getPluginType(e,v0)}}))return v.splitNodes(e,{at:(r=e.selection)==null?void 0:r.anchor,match:d=>v.isElement(d)&&d.type===v.getPluginType(e,v0)}),ue(e,{at:(a=e.selection)==null?void 0:a.anchor}),!0;if(v.getAboveNode(e,{at:(o=e.selection)==null?void 0:o.focus,match:{type:v.getPluginType(e,v0)}}))return v.splitNodes(e,{at:(l=e.selection)==null?void 0:l.focus,match:d=>v.isElement(d)&&d.type===v.getPluginType(e,v0)}),ue(e,{at:(i=e.selection)==null?void 0:i.focus}),!0}v.unwrapNodes(e,{match:{type:v.getPluginType(e,v0)},...t})}),a7=(e,{url:t,text:n,buttonStyle:r,target:a,insertTextInButton:o,insertNodesOptions:l,isUrl:i=v.getPluginOptions(e,v0).isUrl})=>{var S;const s=e.selection;if(!s)return;const u=v.getAboveNode(e,{at:s,match:{type:v.getPluginType(e,v0)}});if(o&&u)return e.insertText(t),!0;if(!(i!=null&&i(t)))return;if(v.isDefined(n)&&n.length===0&&(n=t),u)return k9(t,e,u,a,r,n),!0;const d=v.findNode(e,{at:s,match:{type:v.getPluginType(e,v0)}}),[f,h]=d??[],g=R9(e,h,n);if(v.isExpanded(s))return T9(u,e,t,r,a,n),!0;g&&v.removeNodes(e,{at:h});const x=v.getNodeProps(f??{}),b=(S=e.selection)==null?void 0:S.focus.path;if(!b)return;const m=v.getNodeLeaf(e,b);return n!=null&&n.length||(n=t),o7(e,{...x,url:t,target:a,children:[{...m,text:n}]},l),!0};function R9(e,t,n){return t&&(n==null?void 0:n.length)&&n!==v.getEditorString(e,t)}function T9(e,t,n,r,a,o){e?ue(t,{at:e[1]}):ue(t,{split:!0}),l7(t,{url:n,buttonStyle:r,target:a}),na(t,{url:n,target:a,text:o})}function k9(e,t,n,r,a,o){var l,i,s;(e!==((l=n[0])==null?void 0:l.url)||r!==((i=n[0])==null?void 0:i.target)||a!==((s=n[0])==null?void 0:s.buttonStyle))&&v.setNodes(t,{url:e,target:r,buttonStyle:a},{at:n[1]}),na(t,{url:e,text:o,target:r})}const na=(e,{text:t})=>{const n=v.getAboveNode(e,{match:{type:v.getPluginType(e,v0)}});if(n){const[r,a]=n;if(t!=null&&t.length&&t!==v.getEditorString(e,a)){const o=r.children[0];v.replaceNodeChildren(e,{at:a,nodes:{...o,text:t},insertOptions:{select:!0}})}}},l7=(e,{url:t,buttonStyle:n,target:r,...a})=>{v.wrapNodes(e,{type:v.getPluginType(e,v0),url:t,buttonStyle:n,target:r,children:[]},{split:!0,...a})},N9=(e,t)=>{const n=v.getAboveNode(e,{match:{type:v0}});return Array.isArray(n)?t(n[0]):""},i7=e=>N9(e,t=>t.url??""),s7=(e,{url:t,text:n="",buttonStyle:r="primary",target:a,children:o})=>({type:v.getPluginType(e,v0),url:t,target:a,buttonStyle:r,children:o??[{text:n}]}),c7=(e,{focused:t}={})=>{if(R0.mode()==="edit"){un(e);return}ra(e,{focused:t})},un=e=>{const t=v.findNode(e,{match:{type:v.getPluginType(e,v0)}});if(!t)return;const[n,r]=t;let a=v.getEditorString(e,r);_0.url(n.url),_0.newTab(n.target===void 0),a===n.url&&(a=""),_0.text(a),_0.isEditing(!0)},ra=(e,{focused:t}={})=>{R0.mode()||!t||v.isRangeAcrossBlocks(e,{at:e.selection})||v.someNode(e,{match:{type:v.getPluginType(e,v0)}})||(_0.text(v.getEditorString(e,e.selection)),_0.show("insert",e.id))},kn={marginTop:"10px",marginBottom:"10px",display:"inline-block",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%",verticalAlign:"middle",boxSizing:"border-box",overflowWrap:"normal"},dn={buttonPrimary:{...kn,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:{...kn,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:{...kn,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)"}}},D9=e=>{var l,i;const{attributes:t,children:n}=e,r=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(O9,{attributes:t,href:r,target:a,styles:dn[`button${o.charAt(0).toUpperCase()+o.slice(1)}`],children:n})},O9=({attributes:e,styles:t={hover:{}},children:n,href:r="#",target:a})=>{const[o,l]=C.useState(!1);return c.jsx("a",{...e,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),href:r,target:a,style:o?{...t,...t.hover}:t,children:n})};class H9 extends v.MarkupElement{constructor(t=v0,n=D9){super(t,n)}}const u7=C.forwardRef((e,t)=>{const n=v.useEditorRef();return c.jsx(v.ToolbarButton,{ref:t,...e,onMouseDown:r=>{r.preventDefault(),v.focusEditor(n,n.selection??n.prevSelection??void 0)},onClick:()=>{c7(n,{focused:!0})},children:c.jsx(v.IconStylingWrapper,{icon:c.jsx(v.IconButton16,{})})})});u7.displayName="ButtonToolbarButton";const z9=({editorId:e,id:t})=>{const n=v.useEditorState(v.useEventPlateId(e)),r=!!v.isRangeInSameBlock(n,{at:n.selection}),a=v.getPluginType(n,v0),o=!!(n!=null&&n.selection)&&v.someNode(n,{match:{type:a}});return c.jsx("div",{"data-plugin-id":t,children:c.jsx(u7,{pressed:o,disabled:!r,tooltip:v.getTooltip(r?`Button
86
86
  ${v.getHotkeyByPlatform("Ctrl+Shift+K")}`:"Buttons can only be set for a single text block.")})})},de="link-plugin";var i0=(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))(i0||{});const b0={heading1:{fontSize:"var(--f-theme-settings-heading1-font-size)",lineHeight:"var(--f-theme-settings-heading1-line-height)",marginTop:"var(--f-theme-settings-heading1-margin-top)",marginBottom:"var(--f-theme-settings-heading1-margin-bottom)",textDecoration:"var(--f-theme-settings-heading1-text-decoration)",fontStyle:"var(--f-theme-settings-heading1-font-style)",textTransform:"var(--f-theme-settings-heading1-text-transform)",letterSpacing:"var(--f-theme-settings-heading1-letter-spacing)",fontWeight:"var(--f-theme-settings-heading1-font-weight)",fontFamily:"var(--f-theme-settings-heading1-font-family)",color:"var(--f-theme-settings-heading1-color)"},heading2:{fontSize:"var(--f-theme-settings-heading2-font-size)",lineHeight:"var(--f-theme-settings-heading2-line-height)",marginTop:"var(--f-theme-settings-heading2-margin-top)",marginBottom:"var(--f-theme-settings-heading2-margin-bottom)",textDecoration:"var(--f-theme-settings-heading2-text-decoration)",fontStyle:"var(--f-theme-settings-heading2-font-style)",textTransform:"var(--f-theme-settings-heading2-text-transform)",letterSpacing:"var(--f-theme-settings-heading2-letter-spacing)",fontWeight:"var(--f-theme-settings-heading2-font-weight)",fontFamily:"var(--f-theme-settings-heading2-font-family)",color:"var(--f-theme-settings-heading2-color)"},heading3:{fontSize:"var(--f-theme-settings-heading3-font-size)",lineHeight:"var(--f-theme-settings-heading3-line-height)",marginTop:"var(--f-theme-settings-heading3-margin-top)",marginBottom:"var(--f-theme-settings-heading3-margin-bottom)",textDecoration:"var(--f-theme-settings-heading3-text-decoration)",fontStyle:"var(--f-theme-settings-heading3-font-style)",textTransform:"var(--f-theme-settings-heading3-text-transform)",letterSpacing:"var(--f-theme-settings-heading3-letter-spacing)",fontWeight:"var(--f-theme-settings-heading3-font-weight)",fontFamily:"var(--f-theme-settings-heading3-font-family)",color:"var(--f-theme-settings-heading3-color)"},heading4:{fontSize:"var(--f-theme-settings-heading4-font-size)",lineHeight:"var(--f-theme-settings-heading4-line-height)",marginTop:"var(--f-theme-settings-heading4-margin-top)",marginBottom:"var(--f-theme-settings-heading4-margin-bottom)",textDecoration:"var(--f-theme-settings-heading4-text-decoration)",fontStyle:"var(--f-theme-settings-heading4-font-style)",textTransform:"var(--f-theme-settings-heading4-text-transform)",letterSpacing:"var(--f-theme-settings-heading4-letter-spacing)",fontWeight:"var(--f-theme-settings-heading4-font-weight)",fontFamily:"var(--f-theme-settings-heading4-font-family)",color:"var(--f-theme-settings-heading4-color)"},custom1:{fontSize:"var(--f-theme-settings-custom1-font-size)",lineHeight:"var(--f-theme-settings-custom1-line-height)",marginTop:"var(--f-theme-settings-custom1-margin-top)",marginBottom:"var(--f-theme-settings-custom1-margin-bottom)",textDecoration:"var(--f-theme-settings-custom1-text-decoration)",fontStyle:"var(--f-theme-settings-custom1-font-style)",textTransform:"var(--f-theme-settings-custom1-text-transform)",letterSpacing:"var(--f-theme-settings-custom1-letter-spacing)",fontWeight:"var(--f-theme-settings-custom1-font-weight)",fontFamily:"var(--f-theme-settings-custom1-font-family)",color:"var(--f-theme-settings-custom1-color)"},custom2:{fontSize:"var(--f-theme-settings-custom2-font-size)",lineHeight:"var(--f-theme-settings-custom2-line-height)",marginTop:"var(--f-theme-settings-custom2-margin-top)",marginBottom:"var(--f-theme-settings-custom2-margin-bottom)",textDecoration:"var(--f-theme-settings-custom2-text-decoration)",fontStyle:"var(--f-theme-settings-custom2-font-style)",textTransform:"var(--f-theme-settings-custom2-text-transform)",letterSpacing:"var(--f-theme-settings-custom2-letter-spacing)",fontWeight:"var(--f-theme-settings-custom2-font-weight)",fontFamily:"var(--f-theme-settings-custom2-font-family)",color:"var(--f-theme-settings-custom2-color)"},custom3:{fontSize:"var(--f-theme-settings-custom3-font-size)",lineHeight:"var(--f-theme-settings-custom3-line-height)",marginTop:"var(--f-theme-settings-custom3-margin-top)",marginBottom:"var(--f-theme-settings-custom3-margin-bottom)",textDecoration:"var(--f-theme-settings-custom3-text-decoration)",fontStyle:"var(--f-theme-settings-custom3-font-style)",textTransform:"var(--f-theme-settings-custom3-text-transform)",letterSpacing:"var(--f-theme-settings-custom3-letter-spacing)",fontWeight:"var(--f-theme-settings-custom3-font-weight)",fontFamily:"var(--f-theme-settings-custom3-font-family)",color:"var(--f-theme-settings-custom3-color)"},p:{fontSize:"var(--f-theme-settings-body-font-size)",lineHeight:"var(--f-theme-settings-body-line-height)",marginTop:"var(--f-theme-settings-body-margin-top)",marginBottom:"var(--f-theme-settings-body-margin-bottom)",textDecoration:"var(--f-theme-settings-body-text-decoration)",fontStyle:"var(--f-theme-settings-body-font-style)",textTransform:"var(--f-theme-settings-body-text-transform)",letterSpacing:"var(--f-theme-settings-body-letter-spacing)",fontWeight:"var(--f-theme-settings-body-font-weight)",fontFamily:"var(--f-theme-settings-body-font-family)",color:"var(--f-theme-settings-body-color)"},quote:{fontSize:"var(--f-theme-settings-quote-font-size)",lineHeight:"var(--f-theme-settings-quote-line-height)",marginTop:"var(--f-theme-settings-quote-margin-top)",marginBottom:"var(--f-theme-settings-quote-margin-bottom)",textDecoration:"var(--f-theme-settings-quote-text-decoration)",fontStyle:"var(--f-theme-settings-quote-font-style)",textTransform:"var(--f-theme-settings-quote-text-transform)",letterSpacing:"var(--f-theme-settings-quote-letter-spacing)",fontWeight:"var(--f-theme-settings-quote-font-weight)",fontFamily:"var(--f-theme-settings-quote-font-family)",color:"var(--f-theme-settings-quote-color)"},imageCaption:{fontSize:"var(--f-theme-settings-image-caption-font-size)",lineHeight:"var(--f-theme-settings-image-caption-line-height)",marginTop:"var(--f-theme-settings-image-caption-margin-top)",marginBottom:"var(--f-theme-settings-image-caption-margin-bottom)",textDecoration:"var(--f-theme-settings-image-caption-text-decoration)",fontStyle:"var(--f-theme-settings-image-caption-font-style)",textTransform:"var(--f-theme-settings-image-caption-text-transform)",letterSpacing:"var(--f-theme-settings-image-caption-letter-spacing)",fontWeight:"var(--f-theme-settings-image-caption-font-weight)",fontFamily:"var(--f-theme-settings-image-caption-font-family)",color:"var(--f-theme-settings-image-caption-color)"},imageTitle:{fontSize:"var(--f-theme-settings-image-title-font-size)",lineHeight:"var(--f-theme-settings-image-title-line-height)",marginTop:"var(--f-theme-settings-image-title-margin-top)",marginBottom:"var(--f-theme-settings-image-title-margin-bottom)",textDecoration:"var(--f-theme-settings-image-title-text-decoration)",fontStyle:"var(--f-theme-settings-image-title-font-style)",textTransform:"var(--f-theme-settings-image-title-text-transform)",letterSpacing:"var(--f-theme-settings-image-title-letter-spacing)",fontWeight:"var(--f-theme-settings-image-title-font-weight)",fontFamily:"var(--f-theme-settings-image-title-font-family)",color:"var(--f-theme-settings-image-title-color)"},[de]:{fontSize:"var(--f-theme-settings-link-font-size)",lineHeight:"var(--f-theme-settings-link-line-height)",marginTop:"var(--f-theme-settings-link-margin-top)",marginBottom:"var(--f-theme-settings-link-margin-bottom)",textDecoration:"var(--f-theme-settings-link-text-decoration)",fontStyle:"var(--f-theme-settings-link-font-style)",textTransform:"var(--f-theme-settings-link-text-transform)",letterSpacing:"var(--f-theme-settings-link-letter-spacing)",fontWeight:"var(--f-theme-settings-link-font-weight)",fontFamily:"var(--f-theme-settings-link-font-family)",color:"var(--f-theme-settings-link-color)"},...dn},V9=()=>{const e=v.useEditorRef();return c.jsx(v.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:R0.url(),target:"_blank",rel:"noopener noreferrer",style:b0[de],children:R0.url()}),c.jsxs("span",{className:"tw-flex tw-gap-2",children:[c.jsx("button",{onClick:()=>{un(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(v.IconPen16,{})}),c.jsx("button",{onClick:()=>{ue(e),v.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(v.IconTrashBin16,{})})]})]})})},d7=e=>e.filter(t=>{var n;return!!((n=t.title)!=null&&n.trim())}),f7=()=>c.jsx("div",{className:"tw-flex tw-justify-center tw-h-10 tw-items-center",children:c.jsx(v.LoadingCircle,{size:v.LoadingCircleSize.Small})}),L9=({section:e,selectedUrl:t,onSelectUrl:n})=>{const r=e.permanentLink===t;return c.jsx("button",{"data-test-id":"internal-link-selector-section-link",className:v.merge(["tw-py-2 tw-pr-2.5 tw-pl-14 tw-leading-5 tw-cursor-pointer tw-w-full",r?"tw-bg-box-selected-strong tw-text-box-selected-strong-inverse hover:tw-bg-box-selected-strong-hover:hover hover:tw-text-box-selected-strong-inverse-hover:hover":"hover:tw-bg-box-neutral-hover hover:tw-text-box-neutral-inverse-hover"]),onClick:()=>n(e.permanentLink),children:c.jsxs("div",{className:"tw-flex tw-flex-1 tw-space-x-2 tw-items-center tw-h-6",children:[c.jsx(v.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"})]})})},j9=({page:e,selectedUrl:t,onSelectUrl:n,itemsToExpandInitially:r,getDocumentSectionsByDocumentPageId:a})=>{const[o,l]=C.useState(e.id===r.documentId),[i,s]=C.useState([]),u=e.permanentLink===t;C.useEffect(()=>{(async()=>{const h=await a(e.id),g=d7(h);s(g)})()},[e.id,a]),C.useEffect(()=>{e.id===r.pageId&&l(!0)},[r,e.id]);const d=i.length>0;return c.jsxs(c.Fragment,{children:[c.jsx("button",{"data-test-id":"internal-link-selector-page-link",className:v.merge(["tw-py-2 tw-pr-2.5 tw-leading-5 tw-cursor-pointer tw-flex tw-w-full",d?"tw-pl-7":"tw-pl-12",u?"tw-bg-box-selected-strong tw-text-box-selected-strong-inverse hover:tw-bg-box-selected-strong-hover:hover hover:tw-text-box-selected-strong-inverse-hover:hover":"hover:tw-bg-box-neutral-hover hover:tw-text-box-neutral-inverse-hover"]),onClick:()=>n(e.permanentLink),children:c.jsxs("div",{className:"tw-flex tw-flex-1 tw-space-x-1 tw-items-center tw-h-6",children:[d&&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:v.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(L9,{section:f,selectedUrl:t,onSelectUrl:n},f.id))]})},$9=({documentId:e,selectedUrl:t,onSelectUrl:n,itemsToExpandInitially:r,getDocumentSectionsByDocumentPageId:a,getDocumentPagesByDocumentId:o})=>{const[l,i]=C.useState([]),[s,u]=C.useState(!0),d=[...l.values()],f=!s&&d.length>0;return C.useEffect(()=>{o(e).then(h=>{const g=h.filter(b=>!!b.category).sort((b,m)=>b.category.sort===m.category.sort?b.sort-m.sort:b.category.sort-m.category.sort),x=h.filter(b=>!b.category).sort((b,m)=>b.sort-m.sort);i([...g,...x])}).finally(()=>{u(!1)})},[]),s?c.jsx(f7,{}):f?c.jsx(c.Fragment,{children:d.map(h=>c.jsx(j9,{page:h,selectedUrl:t,onSelectUrl:n,itemsToExpandInitially:r,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."})},B9=({document:e,selectedUrl:t,onSelectUrl:n,itemsToExpandInitially:r,getDocumentSectionsByDocumentPageId:a,getDocumentPagesByDocumentId:o})=>{const[l,i]=C.useState(e.id===r.documentId),s=e.permanentLink===t;return C.useEffect(()=>{e.id===r.documentId&&i(!0)},[r,e.id]),c.jsxs(c.Fragment,{children:[c.jsxs("button",{"data-test-id":"internal-link-selector-document-link",className:v.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:()=>n(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:v.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(v.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($9,{documentId:e.id,selectedUrl:t,onSelectUrl:n,itemsToExpandInitially:r,getDocumentSectionsByDocumentPageId:a,getDocumentPagesByDocumentId:o})]})},F9=({selectedUrl:e,onSelectUrl:t,getAllDocuments:n,getDocumentPagesByDocumentId:r,getDocumentSectionsByDocumentPageId:a})=>{const[o,l]=C.useState(!0),[i,s]=C.useState([]),[u,d]=C.useState({documentId:void 0,pageId:void 0});C.useEffect(()=>{e&&i.length>0&&f().then(h=>{d(h)})},[i.length]),C.useEffect(()=>{n().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 b=await r(x.id);if(!!b.find(S=>S.permanentLink===e))return h.documentId=x.id,h;for(const S of b){const y=await a(S.id);if(!!d7(y).find(E=>E.permanentLink===e))return h.documentId=x.id,h.pageId=S.id,h}}return h};return o?c.jsx(f7,{}):c.jsx(c.Fragment,{children:i.map(h=>c.jsx(B9,{document:h,selectedUrl:e,onSelectUrl:t,itemsToExpandInitially:u,getDocumentSectionsByDocumentPageId:a,getDocumentPagesByDocumentId:r},h.id))})},h7=({url:e,onUrlChange:t,buttonSize:n=v.ButtonSize.Medium,getAllDocuments:r,getDocumentPagesByDocumentId:a,getDocumentSectionsByDocumentPageId:o})=>{const{open:l,isOpen:i,close:s}=Q7.useOverlayTriggerState({}),[u,d]=C.useState(e),f=x=>{d(x)},h=x=>{x.key==="Enter"&&g()};C.useEffect(()=>{e&&!u&&d(e)},[e,u]);const g=()=>{t==null||t(u),s()};return c.jsxs("div",{onPointerDown:x=>x.preventDefault(),"data-test-id":"internal-link-selector",onKeyDown:h,children:[c.jsx(v.Button,{icon:c.jsx(v.IconLink,{}),size:n,type:v.ButtonType.Button,style:v.ButtonStyle.Default,emphasis:v.ButtonEmphasis.Default,onClick:()=>l(),children:"Internal link"}),c.jsxs(v.Modal,{zIndex:1001,onClose:()=>s(),isOpen:i,isDismissable:!0,children:[c.jsx(v.Modal.Header,{title:"Select internal link"}),c.jsx(v.Modal.Body,{children:c.jsx(F9,{selectedUrl:u,onSelectUrl:f,getAllDocuments:r,getDocumentPagesByDocumentId:a,getDocumentSectionsByDocumentPageId:o})}),c.jsx(v.Modal.Footer,{buttons:[{children:"Cancel",onClick:()=>s(),style:v.ButtonStyle.Default,emphasis:v.ButtonEmphasis.Default},{children:"Choose",onClick:x=>{x==null||x.preventDefault(),g()},style:v.ButtonStyle.Default,emphasis:v.ButtonEmphasis.Strong,disabled:!u}]})]})]})},p7=({onUrlChange:e,onToggleTab:t,isValidUrlOrEmpty:n,appBridge:r,clearable:a,placeholder:o,newTab:l,openInNewTab:i,url:s="",required:u,info:d,label:f,buttonSize:h,hideInternalLinkButton:g})=>{const x=n?n(s):ce(s),b=l??(i?v.CheckboxState.Checked:v.CheckboxState.Unchecked);return c.jsxs("div",{"data-test-id":"link-input",children:[c.jsx(v.FormControl,{label:{children:f,htmlFor:"url",required:u,tooltip:d?{content:d,position:v.TooltipPosition.Top}:void 0},children:c.jsx(v.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."}),!g&&c.jsx("div",{className:"tw-mt-3",children:c.jsx(h7,{url:s,onUrlChange:e,buttonSize:h??v.ButtonSize.Medium,getAllDocuments:()=>r.getAllDocuments(),getDocumentPagesByDocumentId:m=>r.getDocumentPagesByDocumentId(m),getDocumentSectionsByDocumentPageId:m=>r.getDocumentSectionsByDocumentPageId(m)})}),c.jsx("div",{className:"tw-mt-3",children:c.jsx(v.Checkbox,{value:"new-tab",label:"Open in new tab",state:b,onChange:t})})]})},v7=({state:e,onTextChange:t,onUrlChange:n,onToggleTab:r,onCancel:a,onSave:o,isValidUrlOrEmpty:l,hasValues:i,testId:s,appBridge:u,children:d})=>c.jsxs(v.FloatingModalWrapper,{"data-test-id":s,padding:"28px",minWidth:"400px",children:[c.jsx(v.FormControl,{label:{children:"Text",htmlFor:"linkText",required:!0},children:c.jsx(v.TextInput,{id:"linkText",value:e.text,placeholder:"Link Text",onChange:t})}),d,c.jsx("div",{className:"tw-mt-5",children:c.jsx(p7,{url:e.url,newTab:e.newTab,onUrlChange:n,onToggleTab:r,isValidUrlOrEmpty:l,appBridge:u})}),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(v.Button,{onClick:a,size:v.ButtonSize.Medium,style:v.ButtonStyle.Default,emphasis:v.ButtonEmphasis.Default,children:"Cancel"}),c.jsx(v.Button,{onClick:o,size:v.ButtonSize.Medium,icon:c.jsx(v.IconCheckMark20,{}),disabled:!l(e==null?void 0:e.url)||!i,children:"Save"})]})})]}),U9=e=>{var n;const t=v.getAboveNode(e,{match:{type:v0}});return Array.isArray(t)&&((n=t[0])==null?void 0:n.buttonStyle)||"primary"},K9={url:"",text:"",buttonStyle:"primary",newTab:v.CheckboxState.Unchecked},W9=()=>{const[e,t]=C.useReducer((n,r)=>{const{type:a,payload:o}=r;switch(a){case"NEW_TAB":return{...n,newTab:v.CheckboxState.Checked};case"SAME_TAB":return{...n,newTab:v.CheckboxState.Unchecked};case"URL":case"TEXT":case"BUTTON_STYLE":case"INIT":return{...n,...o};default:return n}},K9);return[e,t]},q9=()=>{const e=v.useEditorRef(),[t,n]=W9();C.useEffect(()=>{const f=U9(e);n({type:"INIT",payload:{text:R0.text(),buttonStyle:f,newTab:R0.newTab()?v.CheckboxState.Checked:v.CheckboxState.Unchecked,url:R0.url()}})},[n,e]);const r=f=>{n({type:"TEXT",payload:{text:f}})},a=f=>{n({type:"BUTTON_STYLE",payload:{buttonStyle:f}})},o=f=>{n({type:"URL",payload:{url:f}})},l=f=>{n(f?{type:"NEW_TAB"}:{type:"SAME_TAB"})},i=()=>{_0.reset()},s=f=>{if(!ce(t.url)||!u)return;const h=sn(t.url);_0.text(t.text),_0.url(h),_0.buttonStyle(t.buttonStyle),_0.newTab(t.newTab===v.CheckboxState.Checked),ta(e)&&(f==null||f.preventDefault())},u=t.url!==""&&t.text!=="",{appBridge:d}=v.getPluginOptions(e,v0);return v.useHotkeys("enter",s,{enableOnFormTags:["INPUT"]},[]),{state:t,onTextChange:r,onButtonStyleChange:a,onUrlChange:o,onToggleTab:l,onCancel:i,onSave:s,hasValues:u,isValidUrlOrEmpty:ce,appBridge:d}},G9=()=>{const e=q9(),{state:t,onButtonStyleChange:n}=e;return c.jsx(v7,{...e,testId:"floating-button-insert",children:c.jsx("div",{className:"tw-pt-5",children:c.jsxs(v.FormControl,{label:{children:"Button Style",htmlFor:"buttonStyle",required:!0},children:[c.jsx(Nn,{id:"primary",styles:b0.buttonPrimary,isActive:t.buttonStyle==="primary",onClick:()=>n("primary"),children:t.text||"Primary Button"}),c.jsx(Nn,{id:"secondary",styles:b0.buttonSecondary,isActive:t.buttonStyle==="secondary",onClick:()=>n("secondary"),children:t.text||"Secondary Button"}),c.jsx(Nn,{id:"tertiary",styles:b0.buttonTertiary,isActive:t.buttonStyle==="tertiary",onClick:()=>n("tertiary"),children:t.text||"Tertiary Button"})]})})})},Nn=({id:e,styles:t,isActive:n,onClick:r,children:a})=>{const[o,l]=C.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:r,style:{...i(),marginTop:0,marginBottom:0},className:n?"tw-outline tw-outline-1 tw-outline-violet-60 tw-outline-offset-2 tw-w-fit":"tw-w-fit",children:a})},g5={placement:"bottom-start",strategy:"absolute",middleware:[v.offset(12),v.flip({padding:12,fallbackPlacements:["bottom-end","top-start","top-end"]})]},Y9=()=>{const{ref:e,...t}=Z9(g5),{ref:n,...r}=X9(g5),a=v.useEditorRef(),o=ze(),l=o.isOpen(a.id),i=o.isEditing(),s=o.mode(),u=c.jsx(G9,{}),d=i?u:c.jsx(V9,{});return c.jsxs(c.Fragment,{children:[l&&s==="insert"&&re.createPortal(c.jsx("div",{"data-is-underlay":!0,ref:e,...t,style:{...t.style,...b0[v.TextStyles.p]},children:u}),document.body),l&&s==="edit"&&re.createPortal(c.jsx("div",{"data-is-underlay":!0,ref:n,...r,style:{...r.style,...b0[v.TextStyles.p]},children:d}),document.body)]})},v0="button",m7="button-plugin",g7=e=>v.createPluginFactory({key:v0,isElement:!0,isInline:!0,props:({element:t})=>({nodeProps:{href:t==null?void 0:t.url,target:t==null?void 0:t.target}}),withOverrides:r7,renderAfterEditable:Y9,options:{isUrl:cn,rangeBeforeOptions:{matchString:" ",skipInvalid:!0,afterMatch:!0},triggerFloatingButtonHotkeys:"command+shift+k, ctrl+shift+k",appBridge:e},then:(t,{type:n})=>({deserializeHtml:{rules:[{validNodeName:"A",validClassName:"btn"}],getNode:r=>({type:n,url:r.getAttribute("href"),target:r.getAttribute("target")||"_blank"})}})})();class b7 extends v.Plugin{constructor({styles:n=dn,...r}){super(m7,{button:z9,markupElement:new H9,...r});C0(this,"styles",{});C0(this,"appBridge");this.styles=n,this.appBridge=r==null?void 0:r.appBridge}plugins(){return[g7(this.appBridge)]}}const X9=e=>{const t=v.useEditorRef(),n=ze().mode(),r=ze().isOpen(t.id),a=v.useEditorVersion(),{triggerFloatingButtonHotkeys:o}=v.getPluginOptions(t,v0),l=C.useCallback(()=>{const f=v.getAboveNode(t,{match:{type:v.getPluginType(t,v0)}});if(f){const[,h]=f;return v.getRangeBoundingClientRect(t,{anchor:v.getStartPoint(t,h),focus:v.getEndPoint(t,h)})}return v.getDefaultBoundingClientRect()},[t]),i=r&&n==="edit",{update:s,style:u,floating:d}=y7({open:i,getBoundingClientRect:l,...e});return C.useEffect(()=>{const f=i7(t);if(f&&_0.url(f),t.selection&&v.someNode(t,{match:{type:v.getPluginType(t,v0)}})){_0.show("edit",t.id),s();return}R0.mode()==="edit"&&_0.reset()},[t,a,s]),v.useHotkeys(o,f=>{f.preventDefault(),R0.mode()==="edit"&&un(t)},{enableOnContentEditable:!0},[]),Q9(),w7(),{style:{...u,zIndex:1e3},ref:v.useComposedRef(d)}},Q9=()=>{const e=v.useEditorRef();v.useHotkeys("*",t=>{t.key==="Enter"&&ta(e)&&t.preventDefault()},{enableOnFormTags:["INPUT"]},[])},w7=()=>{const e=v.useEditorRef();v.useHotkeys("escape",()=>{if(R0.mode()==="edit"){if(R0.isEditing()){_0.show("edit",e.id),v.focusEditor(e,e.selection??void 0);return}_0.reset()}},{enableOnFormTags:["INPUT"],enableOnContentEditable:!0},[])},Z9=e=>{const t=v.useEditorRef(),n=v.useFocused(),r=ze().mode(),a=ze().isOpen(t.id),{triggerFloatingButtonHotkeys:o}=v.getPluginOptions(t,v0);v.useHotkeys(o,u=>{u.preventDefault(),ra(t,{focused:n})},{enableOnContentEditable:!0},[n]);const{update:l,style:i,floating:s}=y7({open:a&&r==="insert",getBoundingClientRect:v.getSelectionBoundingClientRect,whileElementsMounted:void 0,...e});return C.useEffect(()=>{a&&l(),_0.updated(a)},[a,l]),w7(),{style:{...i,zIndex:1e3},ref:v.useComposedRef(s)}},J9=12,em=-22,tm=96,y7=e=>v.useVirtualFloating({placement:"bottom-start",middleware:[v.offset({mainAxis:J9,alignmentAxis:em}),v.flip({padding:tm})],...e}),Dn="[&_.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",nm="[&_.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",b5={1:"tw-columns-1",2:`tw-columns-1 @sm:!tw-columns-2 ${nm}`,3:`tw-columns-1 @md:!tw-columns-3 ${Dn}`,4:`tw-columns-1 @md:!tw-columns-4 ${Dn}`,5:`tw-columns-1 @md:!tw-columns-5 ${Dn}`},x7=e=>e?b5[e]||b5[1]:"",C7=C.memo(({id:e="rte",isEnabled:t,value:n,columns:r,gap:a,placeholder:o,plugins:l,onTextChange:i,showSerializedText:s})=>{const u=x7(r),[d,f]=C.useState(!1),h=C.useCallback(b=>{b!==n&&(i==null||i(b)),f(!1)},[i,n]),g=C.useCallback(()=>f(!0),[]),x=C.useCallback(b=>{R0.isOpen(b)&&_0.reset()},[]);return C.useEffect(()=>{const b=m=>{m.preventDefault(),m.returnValue="Unprocessed changes"};return d&&window.addEventListener("beforeunload",b),()=>window.removeEventListener("beforeunload",b)},[d]),t?c.jsx(v.RichTextEditor,{id:e,value:n,border:!1,placeholder:o,plugins:l,onValueChanged:g,onTextChange:h,hideExternalFloatingModals:x}):c.jsx(x9,{value:n,gap:a,customClass:u,show:s,plugins:l})});C7.displayName="InternalRichTextEditor";const rm=e=>{const t=C.useRef(null),[n,r]=C.useState(!1),{isEditing:a,...o}=e,l=C.useCallback(i=>{i&&r(!0)},[]);return y9({ref:t,disabled:!a,onChange:l}),C.useEffect(()=>{a||r(!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(C7,{...o,isEnabled:a&&n})})},om=({editButtonProps:e,unlinkButtonProps:t})=>{const{element:n}=v.useLinkOpenButtonState(),r=n?Jo(n):"";return c.jsx(v.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:r,target:"_blank",rel:"noopener noreferrer",style:b0[de],children:r}),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(v.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(v.IconTrashBin16,{})})]})]})})},_7=(e,t)=>{const n=v.getAboveNode(e,{match:{type:v.ELEMENT_LINK}});return Array.isArray(n)?t(n[0]):""},am=e=>_7(e,t=>{var n,r;return((r=(n=t.chosenLink)==null?void 0:n.searchResult)==null?void 0:r.link)||""}),lm=e=>_7(e,t=>t.url||""),im={url:"",text:"",newTab:v.CheckboxState.Unchecked},sm=()=>{const[e,t]=C.useReducer((n,r)=>{const{type:a,payload:o}=r;switch(a){case"NEW_TAB":return{...n,newTab:v.CheckboxState.Checked};case"SAME_TAB":return{...n,newTab:v.CheckboxState.Unchecked};case"URL":case"TEXT":case"INIT":return{...n,...o};default:return n}},im);return[e,t]},cm=()=>{const e=v.useEditorRef(),[t,n]=sm();C.useEffect(()=>{const d=am(e),f=lm(e),h=v.floatingLinkSelectors.newTab();n({type:"INIT",payload:{text:v.floatingLinkSelectors.text(),newTab:h?v.CheckboxState.Checked:v.CheckboxState.Unchecked,url:d&&f===""?d:v.floatingLinkSelectors.url()}})},[n,e]);const r=d=>{n({type:"TEXT",payload:{text:d}})},a=d=>{n({type:"URL",payload:{url:d}})},o=d=>{n(d?{type:"NEW_TAB"}:{type:"SAME_TAB"})},l=()=>{v.floatingLinkActions.reset()},i=d=>{!ce(t.url)||!s||(v.floatingLinkActions.text(t.text),v.floatingLinkActions.url(sn(t.url)),v.floatingLinkActions.newTab(t.newTab===v.CheckboxState.Checked),v.submitFloatingLink(e)&&(d==null||d.preventDefault()))},s=t.url!==""&&t.text!=="",{appBridge:u}=v.getPluginOptions(e,v.ELEMENT_LINK);return v.useHotkeys("enter",i,{enableOnFormTags:["INPUT"]},[]),{state:t,onTextChange:r,onUrlChange:a,onToggleTab:o,onCancel:l,onSave:i,hasValues:s,isValidUrlOrEmpty:ce,appBridge:u}},um=()=>c.jsx(v7,{...cm(),testId:"floating-link-insert"}),w5={placement:"bottom-start",strategy:"absolute",middleware:[v.offset(12),v.flip({padding:12,fallbackPlacements:["bottom-end","top-start","top-end"]})]},dm=()=>{const e=v.useFloatingLinkInsertState({floatingOptions:w5}),{props:t,ref:n,hidden:r}=v.useFloatingLinkInsert(e),a=v.useFloatingLinkEditState({floatingOptions:w5}),{props:o,ref:l,editButtonProps:i,unlinkButtonProps:s}=v.useFloatingLinkEdit(a);if(r)return null;const u=c.jsx(um,{}),d=a.isEditing?u:c.jsx(om,{editButtonProps:i,unlinkButtonProps:s});return c.jsxs(c.Fragment,{children:[e.isOpen&&!a.isOpen&&re.createPortal(c.jsx("div",{"data-is-underlay":!0,ref:n,...t,style:{...t.style,...b0[i0.p]},children:u}),document.body),a.isOpen&&re.createPortal(c.jsx("div",{"data-is-underlay":!0,ref:l,...o,style:{...o.style,...b0[i0.p]},children:d}),document.body)]})},M7=C.forwardRef((e,t)=>{const n=v.useEditorRef(),r=v.useLinkToolbarButtonState(),{props:a}=v.useLinkToolbarButton(r);return c.jsx(v.ToolbarButton,{onMouseDown:o=>{o.preventDefault(),v.focusEditor(n,n.selection??n.prevSelection??void 0)},ref:t,...a,...e,children:c.jsx(v.IconStylingWrapper,{icon:c.jsx(v.IconLink16,{})})})});M7.displayName="LinkToolbarButton";const fm=({id:e,editorId:t})=>{const n=v.useEditorState(v.useEventPlateId(t)),r=!!v.isRangeInSameBlock(n,{at:n.selection});return c.jsx("div",{"data-plugin-id":e,children:c.jsx(M7,{disabled:!r,tooltip:v.getTooltip(r?`Link
87
87
  ${v.getHotkeyByPlatform("Ctrl+K")}`:"Links can only be set for a single text block.")})})},hm=e=>{var l,i;const{attributes:t,children:n}=e,{styles:r}=v.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:r[de],children:n})};class pm extends v.MarkupElement{constructor(t=v.ELEMENT_LINK,n=hm){super(t,n)}}const S7=e=>v.createPluginFactory({...v.createLinkPlugin(),renderAfterEditable:dm,options:{isUrl:cn,rangeBeforeOptions:{matchString:" ",skipInvalid:!0,afterMatch:!0},triggerFloatingLinkHotkeys:"meta+k, ctrl+k",keepSelectedTextOnPaste:!0,appBridge:e}})();class E7 extends v.Plugin{constructor({styles:n=b0[de],...r}){super(de,{button:fm,markupElement:new pm,...r});C0(this,"styles",{});C0(this,"appBridge");this.styles=n,this.appBridge=r.appBridge}plugins(){return[S7(this.appBridge)]}}const vm="breakAfterColumn",A7="normal";class mm extends v.Plugin{constructor(n){super("break-after-plugin",{button:v.ColumnBreakButton,...n});C0(this,"columns");C0(this,"gap");C0(this,"customClass");this.columns=(n==null?void 0:n.columns)??1,this.gap=(n==null?void 0:n.gap)??A7,this.customClass=x7(this.columns)}plugins(){return[v.createColumnBreakPlugin(this.columns,this.gap,this.customClass)]}}const gm="textstyle-custom1-plugin";class I7 extends v.Plugin{constructor({styles:n=b0.custom1,...r}={}){super(i0.custom1,{label:"Custom 1",markupElement:new bm,...r});C0(this,"styles",{});this.styles=n}plugins(){return[wm(this.styles)]}}class bm extends v.MarkupElement{constructor(t=gm,n=P7){super(t,n)}}const P7=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return c.jsx("p",{...t,style:r,className:v.merge([a&&v.alignmentClassnames[a],v.getColumnBreakClasses(e)]),children:n})},wm=e=>v.createPluginFactory({key:i0.custom1,isElement:!0,deserializeHtml:{rules:[{validClassName:i0.custom1}]}})({component:t=>c.jsx(P7,{...t,styles:e})}),ym="textstyle-custom2-plugin";class R7 extends v.Plugin{constructor({styles:n=b0.custom2,...r}={}){super(i0.custom2,{label:"Custom 2",markupElement:new xm,...r});C0(this,"styles",{});this.styles=n}plugins(){return[Cm(this.styles)]}}class xm extends v.MarkupElement{constructor(t=ym,n=T7){super(t,n)}}const T7=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return c.jsx("p",{...t,className:v.merge([a&&v.alignmentClassnames[a],v.getColumnBreakClasses(e)]),style:r,children:n})},Cm=e=>v.createPluginFactory({key:i0.custom2,isElement:!0,deserializeHtml:{rules:[{validClassName:i0.custom2}]}})({component:t=>c.jsx(T7,{...t,styles:e})}),_m="textstyle-custom3-plugin";class k7 extends v.Plugin{constructor({styles:n=b0.custom3,...r}={}){super(v.TextStyles.custom3,{label:"Custom 3",markupElement:new Mm,...r});C0(this,"styles",{});this.styles=n}plugins(){return[Sm(this.styles)]}}class Mm extends v.MarkupElement{constructor(t=_m,n=N7){super(t,n)}}const N7=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return c.jsx("p",{...t,className:v.merge([a&&v.alignmentClassnames[a],v.getColumnBreakClasses(e)]),style:r,children:n})},Sm=e=>v.createPluginFactory({key:v.TextStyles.custom3,isElement:!0,deserializeHtml:{rules:[{validClassName:v.TextStyles.custom3}]}})({component:t=>c.jsx(N7,{...t,styles:e})}),Em="textstyle-heading1-plugin";class D7 extends v.Plugin{constructor({styles:n=b0.heading1,...r}={}){super(i0.heading1,{label:"Heading 1",markupElement:new Am,...r});C0(this,"styles",{});this.styles=n}plugins(){return[Im(this.styles)]}}class Am extends v.MarkupElement{constructor(t=Em,n=sr){super(t,n)}}const sr=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return c.jsx("h1",{...t,className:v.merge([a&&v.alignmentClassnames[a],v.getColumnBreakClasses(e)]),style:r,children:n})},Im=e=>v.createPluginFactory({key:i0.heading1,isElement:!0,component:sr,deserializeHtml:{rules:[{validNodeName:["h1","H1"]}]}})({component:t=>c.jsx(sr,{...t,styles:e})}),Pm="textstyle-heading2-plugin";class O7 extends v.Plugin{constructor({styles:n=b0.heading2,...r}={}){super(i0.heading2,{label:"Heading 2",markupElement:new Rm,...r});C0(this,"styles",{});this.styles=n}plugins(){return[Tm(this.styles)]}}class Rm extends v.MarkupElement{constructor(t=Pm,n=cr){super(t,n)}}const cr=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return c.jsx("h2",{...t,className:v.merge([a&&v.alignmentClassnames[a],v.getColumnBreakClasses(e)]),style:r,children:n})},Tm=e=>v.createPluginFactory({key:i0.heading2,isElement:!0,component:cr,deserializeHtml:{rules:[{validNodeName:["h2","H2"]}]}})({component:t=>c.jsx(cr,{...t,styles:e})}),km="textstyle-heading3-plugin";class H7 extends v.Plugin{constructor({styles:n=b0.heading3,...r}={}){super(i0.heading3,{label:"Heading 3",markupElement:new Nm,...r});C0(this,"styles",{});this.styles=n}plugins(){return[Dm(this.styles)]}}class Nm extends v.MarkupElement{constructor(t=km,n=ur){super(t,n)}}const ur=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return c.jsx("h3",{...t,className:v.merge([a&&v.alignmentClassnames[a],v.getColumnBreakClasses(e)]),style:r,children:n})},Dm=e=>v.createPluginFactory({key:i0.heading3,isElement:!0,component:ur,deserializeHtml:{rules:[{validNodeName:["h3","H3"]}]}})({component:t=>c.jsx(ur,{...t,styles:e})}),Om="textstyle-heading4-plugin";class z7 extends v.Plugin{constructor({styles:n=b0.heading4,...r}={}){super(i0.heading4,{label:"Heading 4",markupElement:new Hm,...r});C0(this,"styles",{});this.styles=n}plugins(){return[zm(this.styles)]}}class Hm extends v.MarkupElement{constructor(t=Om,n=dr){super(t,n)}}const dr=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return c.jsx("h4",{...t,className:v.merge([a&&v.alignmentClassnames[a],v.getColumnBreakClasses(e)]),style:r,children:n})},zm=e=>v.createPluginFactory({key:i0.heading4,isElement:!0,component:dr,deserializeHtml:{rules:[{validNodeName:["h4","H4"]}]}})({component:t=>c.jsx(dr,{...t,styles:e})}),Vm="textstyle-imageCaption-plugin";class V7 extends v.Plugin{constructor({styles:n=b0.imageCaption,...r}={}){super(i0.imageCaption,{label:"Image Caption",markupElement:new Lm,...r});C0(this,"styles",{});this.styles=n}plugins(){return[jm(this.styles)]}}class Lm extends v.MarkupElement{constructor(t=Vm,n=fr){super(t,n)}}const fr=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return c.jsx("p",{...t,className:v.merge([a&&v.alignmentClassnames[a],v.getColumnBreakClasses(e)]),style:r,children:n})},jm=e=>v.createPluginFactory({key:i0.imageCaption,isElement:!0,component:fr,deserializeHtml:{rules:[{validClassName:i0.imageCaption}]}})({component:t=>c.jsx(fr,{...t,styles:e})}),$m="textstyle-imageTitle-plugin";class L7 extends v.Plugin{constructor({styles:n=b0.imageTitle,...r}={}){super(i0.imageTitle,{label:"Image Title",markupElement:new Bm,...r});C0(this,"styles",{});this.styles=n}plugins(){return[Fm(this.styles)]}}class Bm extends v.MarkupElement{constructor(t=$m,n=hr){super(t,n)}}const hr=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return c.jsx("p",{...t,className:v.merge([a&&v.alignmentClassnames[a],v.getColumnBreakClasses(e)]),style:r,children:n})},Fm=e=>v.createPluginFactory({key:i0.imageTitle,isElement:!0,component:hr,deserializeHtml:{rules:[{validClassName:i0.imageTitle}]}})({component:t=>c.jsx(hr,{...t,styles:e})});class j7 extends v.Plugin{constructor({styles:n=b0.p,...r}={}){super(i0.p,{markupElement:new B7,label:"Body Text",...r});C0(this,"styles",{});this.styles=n}plugins(){return[F7(this.styles)]}}const $7="tw-m-0 tw-px-0 tw-py-0",Dt=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align,o=v.merge([a&&v.alignmentClassnames[a],$7,v.getColumnBreakClasses(e)]);return c.jsx("p",{...t,className:o,style:r,children:n})};class B7 extends v.MarkupElement{constructor(t=i0.p,n=Dt){super(t,n)}}const F7=e=>v.createPluginFactory({...v.createParagraphPlugin(),key:i0.p,isElement:!0,component:Dt})({component:t=>c.jsx(Dt,{...t,styles:e})}),Um="textstyle-quote-plugin";class U7 extends v.Plugin{constructor({styles:n=b0.quote,...r}={}){super(i0.quote,{label:"Quote",markupElement:new Km,...r});C0(this,"styles",{});this.styles=n}plugins(){return[K7(this.styles)]}}class Km extends v.MarkupElement{constructor(t=Um,n=Ot){super(t,n)}}const Ot=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return c.jsx("blockquote",{...t,className:v.merge([a&&v.alignmentClassnames[a],v.getColumnBreakClasses(e)]),style:r,children:n})},K7=e=>v.createPluginFactory({key:i0.quote,isElement:!0,component:Ot,deserializeHtml:{rules:[{validNodeName:["blockquote","BLOCKQUOTE"]}]}})({component:t=>c.jsx(Ot,{...t,styles:e})}),oa=[new D7,new O7,new H7,new z7,new I7,new R7,new k7,new U7,new j7],Q1=[i0.heading1,i0.heading2,i0.heading3,i0.heading4,i0.custom1,i0.custom2,i0.custom3,i0.quote,i0.p],Wm=[...oa,new V7,new L7],qm=[...Q1,i0.imageCaption,i0.imageTitle],Gm=e=>new v.PluginComposer().setPlugin(new v.SoftBreakPlugin,new v.TextStylePlugin({textStyles:oa})).setPlugin([new v.BoldPlugin,new v.ItalicPlugin,new v.UnderlinePlugin,new v.StrikethroughPlugin,new E7({appBridge:e}),new b7({appBridge:e}),new v.CodePlugin],[new v.AlignLeftPlugin({validTypes:Q1}),new v.AlignCenterPlugin({validTypes:Q1}),new v.AlignRightPlugin({validTypes:Q1}),new v.AlignJustifyPlugin({validTypes:Q1}),new v.UnorderedListPlugin,new v.CheckboxListPlugin,new v.OrderedListPlugin,new v.ResetFormattingPlugin,new v.AutoformatPlugin]),Ym="--f-theme-settings-",Xm=e=>{const t=e!=null&&e.id?`hasBackground${e.id}`:"hasBackground",n=e!=null&&e.id?`backgroundColor${e.id}`:"backgroundColor",r=e!=null&&e.preventDefaultColor?void 0:(e==null?void 0:e.defaultColor)||su,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:n,defaultValue:r,type:"colorInput"}]}},Qm=e=>{const t=e!=null&&e.id?`hasBorder_${e.id}`:"hasBorder",n=e!=null&&e.id?`borderSelection_${e.id}`:"borderSelection",r=e!=null&&e.id?`borderStyle_${e.id}`:"borderStyle",a=e!=null&&e.id?`borderWidth_${e.id}`:"borderWidth",o=e!=null&&e.id?`borderColor_${e.id}`:"borderColor",l=(e==null?void 0:e.defaultColor)||C5,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:n,type:"multiInput",layout:e0.MultiInputLayout.Columns,lastItemFullWidth:!0,blocks:[{id:r,type:"dropdown",defaultValue:Z0.Solid,choices:[{value:Z0.Solid,label:Z0.Solid},{value:Z0.Dotted,label:Z0.Dotted},{value:Z0.Dashed,label:Z0.Dashed}]},{id:a,type:"input",defaultValue:cu,rules:[e0.numericalOrPixelRule,e0.maximumNumericalOrPixelOrAutoRule(500)],placeholder:"e.g. 3px",onChange:s=>e0.appendUnit(s,a)},{id:o,type:"colorInput",defaultValue:l}]}],off:[]}},aa=(e,t=b1.None)=>({id:e,type:"segmentedControls",defaultValue:t,choices:[{value:b1.None,label:"None"},{value:b1.Small,label:"S"},{value:b1.Medium,label:"M"},{value:b1.Large,label:"L"}]}),Zm=e=>{const t=e!=null&&e.id?`hasRadius_${e.id}`:"hasRadius",n=e!=null&&e.id?`radiusValue_${e.id}`:"radiusValue",r=e!=null&&e.id?`radiusChoice_${e.id}`:"radiusChoice",a=(e==null?void 0:e.defaultRadius)||b1.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=>e0.presetCustomValue(o,r,n,(e==null?void 0:e.radiusStyleMap)||k1),on:[{id:n,type:"input",placeholder:"e.g. 10px",rules:[e0.numericalOrPixelRule],onChange:o=>e0.appendUnit(o,n)}],off:[aa(r,a)]}},Jm=e=>{const t=e!=null&&e.id?`hasExtendedCustomRadius_${e.id}`:"hasExtendedCustomRadius",n=e!=null&&e.id?`extendedRadiusValue_${e.id}`:"extendedRadiusValue",r=e!=null&&e.id?`extendedRadiusChoice_${e.id}`:"extendedRadiusChoice",a=e!=null&&e.id?`extendedRadiusTopLeft_${e.id}`:"extendedRadiusTopLeft",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 u;return e!=null&&e.dependentSettingId?!!((u=s.getBlock(e.dependentSettingId))!=null&&u.value):!0},onChange:s=>{e0.presetCustomValue(s,r,a,k1),e0.presetCustomValue(s,r,o,k1),e0.presetCustomValue(s,r,l,k1),e0.presetCustomValue(s,r,i,k1)},on:[{id:n,type:"multiInput",layout:e0.MultiInputLayout.Columns,blocks:[{id:a,type:"input",label:"Top Left",rules:[e0.numericalOrPixelRule],onChange:s=>e0.appendUnit(s,a)},{id:o,type:"input",label:"Top Right",rules:[e0.numericalOrPixelRule],onChange:s=>e0.appendUnit(s,o)},{id:l,type:"input",label:"Bottom Left",rules:[e0.numericalOrPixelRule],onChange:s=>e0.appendUnit(s,l)},{id:i,type:"input",label:"Bottom Right",rules:[e0.numericalOrPixelRule],onChange:s=>e0.appendUnit(s,i)}]}],off:[aa(r,e==null?void 0:e.defaultValue)]}},eg=e=>{const t=e!=null&&e.id?e.id:"hasCustomSpacing",n=e!=null&&e.dependentSettingId?e.dependentSettingId:"columns",r=e!=null&&e.spacingChoiceId?e.spacingChoiceId:"spacingChoice",a=e!=null&&e.spacingCustomId?e.spacingCustomId:"spacingCustom",o=e!=null&&e.defaultValueChoices?e.defaultValueChoices:R1.M;return{id:t,type:"switch",defaultValue:!1,switchLabel:"Custom",label:"Gutter",info:"An official nerds term for ‘gap’",onChange:l=>e0.presetCustomValue(l,r,a,M5),show:l=>{var i;return((i=l.getBlock(n))==null?void 0:i.value)!=="1"},on:[{id:a,type:"input",rules:[e0.numericalOrPixelRule],onChange:l=>e0.appendUnit(l,a)}],off:[{id:r,type:"slider",defaultValue:o,choices:[{value:R1.Auto,label:"Auto"},{value:R1.S,label:"S"},{value:R1.M,label:"M"},{value:R1.L,label:"L"}]}]}},la=e=>({id:e,type:"segmentedControls",defaultValue:P1.None,choices:[{value:P1.None,label:"None"},{value:P1.Small,label:"S"},{value:P1.Medium,label:"M"},{value:P1.Large,label:"L"}]}),tg=e=>{const t=e!=null&&e.id?`hasCustomMarginValue_${e==null?void 0:e.id}`:"hasCustomMarginValue",n=e!=null&&e.id?`marginValue_${e==null?void 0:e.id}`:"marginValue",r=e!=null&&e.id?`marginChoice_${e==null?void 0:e.id}`:"marginChoice";return{id:t,label:"Margin",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more space",onChange:a=>e0.presetCustomValue(a,r,n,(e==null?void 0:e.marginStyleMap)||X1),on:[{id:n,type:"input",placeholder:Se,rules:[e0.numericalOrPixelRule,e0.maximumNumericalOrPixelOrAutoRule(500)],onChange:a=>e0.appendUnit(a,n)}],off:[la(r)]}},ng=e=>{const t=e!=null&&e.id?`hasExtendedCustomMargin_${e==null?void 0:e.id}`:"hasExtendedCustomMargin",n=e!=null&&e.id?`extendedMarginValues_${e==null?void 0:e.id}`:"extendedMarginValues",r=e!=null&&e.id?`extendedMarginChoice_${e==null?void 0:e.id}`:"extendedMarginChoice",a=e!=null&&e.id?`extendedMarginTop_${e==null?void 0:e.id}`:"extendedMarginTop",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=>{e0.presetCustomValue(s,r,a,X1),e0.presetCustomValue(s,r,o,X1),e0.presetCustomValue(s,r,l,X1),e0.presetCustomValue(s,r,i,X1)},on:[{id:n,type:"multiInput",layout:e0.MultiInputLayout.Spider,blocks:[{id:a,type:"input",label:"Top",placeholder:Se,onChange:s=>e0.appendUnit(s,a),rules:[e0.numericalOrPixelRule,e0.maximumNumericalOrPixelOrAutoRule(500)]},{id:o,type:"input",label:"Left",placeholder:Se,onChange:s=>e0.appendUnit(s,o),rules:[e0.numericalOrPixelRule,e0.maximumNumericalOrPixelOrAutoRule(500)]},{id:l,type:"input",label:"Right",placeholder:Se,onChange:s=>e0.appendUnit(s,l),rules:[e0.numericalOrPixelRule,e0.maximumNumericalOrPixelOrAutoRule(500)]},{id:i,type:"input",label:"Bottom",placeholder:Se,onChange:s=>e0.appendUnit(s,i),rules:[e0.numericalOrPixelRule,e0.maximumNumericalOrPixelOrAutoRule(500)]}]}],off:[la(r)]}},ia=e=>({id:e,type:"segmentedControls",defaultValue:I1.Small,choices:[{value:I1.None,label:"None"},{value:I1.Small,label:"S"},{value:I1.Medium,label:"M"},{value:I1.Large,label:"L"}]}),rg=e=>{const t=e!=null&&e.id?`hasCustomPaddingValue_${e==null?void 0:e.id}`:"hasCustomPaddingValue",n=e!=null&&e.id?`paddingValue_${e==null?void 0:e.id}`:"paddingValue",r=e!=null&&e.id?`paddingChoice_${e==null?void 0:e.id}`:"paddingChoice";return{id:t,label:"Padding",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more negative space",onChange:a=>e0.presetCustomValue(a,r,n,(e==null?void 0:e.paddingStyleMap)||Y1),on:[{id:n,type:"input",placeholder:Me,rules:[e0.numericalOrPixelRule,e0.maximumNumericalOrPixelOrAutoRule(500)],onChange:a=>e0.appendUnit(a,n)}],off:[ia(r)]}},og=e=>{const t=e!=null&&e.id?`hasExtendedCustomPadding_${e==null?void 0:e.id}`:"hasExtendedCustomPadding",n=e!=null&&e.id?`extendedPaddingValues_${e==null?void 0:e.id}`:"extendedPaddingValues",r=e!=null&&e.id?`extendedPaddingChoice_${e==null?void 0:e.id}`:"extendedPaddingChoice",a=e!=null&&e.id?`extendedPaddingTop_${e==null?void 0:e.id}`:"extendedPaddingTop",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=>{e0.presetCustomValue(s,r,a,Y1),e0.presetCustomValue(s,r,o,Y1),e0.presetCustomValue(s,r,l,Y1),e0.presetCustomValue(s,r,i,Y1)},on:[{id:n,type:"multiInput",layout:e0.MultiInputLayout.Spider,blocks:[{id:a,type:"input",label:"Top",placeholder:Me,onChange:s=>e0.appendUnit(s,a),rules:[e0.numericalOrPixelRule,e0.maximumNumericalOrPixelOrAutoRule(500)]},{id:o,type:"input",label:"Left",placeholder:Me,onChange:s=>e0.appendUnit(s,o),rules:[e0.numericalOrPixelRule,e0.maximumNumericalOrPixelOrAutoRule(500)]},{id:l,type:"input",label:"Right",placeholder:Me,onChange:s=>e0.appendUnit(s,l),rules:[e0.numericalOrPixelRule,e0.maximumNumericalOrPixelOrAutoRule(500)]},{id:i,type:"input",label:"Bottom",placeholder:Me,onChange:s=>e0.appendUnit(s,i),rules:[e0.numericalOrPixelRule,e0.maximumNumericalOrPixelOrAutoRule(500)]}]}],off:[ia(r)]}},ag=e=>{const t=sa(e==null?void 0:e.globalControlId);return{id:e!=null&&e.id?e.id:"downloadable",type:"switch",defaultValue:!1,label:"Downloadable",show:n=>{var r;return((r=n.getBlock(t))==null?void 0:r.value)===D1.Custom}}},sa=e=>e||"security",lg=e=>[{id:sa(e),type:"segmentedControls",defaultValue:D1.Global,choices:[{value:D1.Global,label:"Global Settings"},{value:D1.Custom,label:"Custom"}]},{id:"globalSettingsInfo",type:"notification",footer:e0.createFooter({label:"Change global settings [here].",replace:{here:{event:"general-settings.open"}}})}];var W7=(e=>(e.Main="main",e.Basics="basics",e.Layout="layout",e.Style="style",e.Security="security",e.Targets="targets",e))(W7||{});const ig=e=>e,sg=e=>e;exports.AllTextStylePlugins=Wm;exports.AllTextStyles=qm;exports.Attachments=Kc;exports.AttachmentsProvider=k5;exports.AttachmentsToolbarButton=qc;exports.BUTTON_PLUGIN=m7;exports.BlockButtonStyles=dn;exports.BlockInjectButton=Z7;exports.BlockItemWrapper=e7;exports.BlockStyles=b0;exports.BorderStyle=Z0;exports.BreakAfterPlugin=mm;exports.ButtonPlugin=b7;exports.Custom1Plugin=I7;exports.Custom2Plugin=R7;exports.Custom3Plugin=k7;exports.DEFAULT_ATTACHMENTS_BUTTON_ID=Wc;exports.DEFAULT_DRAGGING_TOOLTIP=Yc;exports.DEFAULT_DRAG_TOOLTIP=Gc;exports.DEFAULT_MENU_BUTTON_ID=Xo;exports.DownloadButton=w9;exports.DragHandleToolbarButton=Xc;exports.DragPreviewContextProvider=E5;exports.ELEMENT_BUTTON=v0;exports.FlyoutToolbarButton=Yo;exports.GAP_DEFAULT=A7;exports.GutterSpacing=R1;exports.Heading1Plugin=D7;exports.Heading2Plugin=O7;exports.Heading3Plugin=H7;exports.Heading4Plugin=z7;exports.ImageCaptionPlugin=V7;exports.ImageTitlePlugin=L7;exports.KEY_ELEMENT_BREAK_AFTER_COLUMN=vm;exports.LinkInput=p7;exports.LinkPlugin=E7;exports.LinkSelector=h7;exports.Margin=P1;exports.MenuToolbarButton=Zc;exports.MultiFlyoutContextProvider=I5;exports.PARAGRAPH_CLASSES=$7;exports.Padding=I1;exports.ParagraphMarkupElement=B7;exports.ParagraphMarkupElementNode=Dt;exports.ParagraphPlugin=j7;exports.QuoteMarkupElementNode=Ot;exports.QuotePlugin=U7;exports.Radius=b1;exports.RichTextEditor=rm;exports.Sections=W7;exports.Security=D1;exports.THEME_PREFIX=Ym;exports.TextStylePluginsWithoutImage=oa;exports.TextStyles=i0;exports.TextStylesWithoutImage=Q1;exports.Toolbar=Jc;exports.ToolbarFlyoutMenu=Qc;exports.addHttps=sn;exports.borderStyleMap=_5;exports.convertToRteValue=C9;exports.createButtonNode=s7;exports.createButtonPlugin=g7;exports.createLinkPlugin=S7;exports.createParagraphPlugin=F7;exports.createQuotePlugin=K7;exports.customCoordinatesGetterFactory=D5;exports.defineBlock=ig;exports.defineSettings=sg;exports.getBackgroundColorStyles=iu;exports.getBackgroundSettings=Xm;exports.getBorderRadiusSettings=Zm;exports.getBorderRadiusSlider=aa;exports.getBorderSettings=Qm;exports.getBorderStyles=uu;exports.getDefaultPluginsWithLinkChooser=Gm;exports.getExtendedBorderRadiusSettings=Jm;exports.getGutterSettings=eg;exports.getLegacyUrl=A9;exports.getLinkFromEditor=P9;exports.getMarginExtendedSettings=ng;exports.getMarginSettings=tg;exports.getMarginSlider=la;exports.getPaddingExtendedSettings=og;exports.getPaddingSettings=rg;exports.getPaddingSlider=ia;exports.getRadiusStyles=du;exports.getReadableColor=au;exports.getSecurityDownloadableSetting=ag;exports.getSecurityGlobalControlId=sa;exports.getSecurityGlobalControlSetting=lg;exports.getUrl=I9;exports.getUrlFromEditor=i7;exports.getUrlFromLinkOrLegacyLink=Jo;exports.gutterSpacingStyleMap=M5;exports.hasRichTextValue=t7;exports.insertButton=o7;exports.isDark=eu;exports.isDownloadable=_9;exports.isValidUrl=cn;exports.isValidUrlOrEmpty=ce;exports.joinClassNames=e1;exports.mapAppBridgeColorPaletteToFonduePalette=n7;exports.mapAppBridgeColorPalettesToFonduePalettes=M9;exports.marginStyleMap=X1;exports.moveItemInArray=lu;exports.paddingStyleMap=Y1;exports.radiusStyleMap=k1;exports.relativeUrlRegex=ea;exports.setAlpha=ru;exports.submitFloatingButton=ta;exports.toColorObject=ou;exports.toHex8String=tu;exports.toHexString=nu;exports.toRgbaString=vr;exports.toShortRgba=z1;exports.triggerFloatingButton=c7;exports.triggerFloatingButtonEdit=un;exports.triggerFloatingButtonInsert=ra;exports.unwrapButton=ue;exports.upsertButton=a7;exports.upsertButtonText=na;exports.useAttachments=R5;exports.useAttachmentsContext=N5;exports.useDndSensors=vu;exports.useDragPreviewContext=Ve;exports.useMultiFlyoutContext=P5;exports.useMultiFlyoutState=Ht;exports.withAttachmentsProvider=fu;exports.withButton=r7;exports.wrapButton=l7;Object.keys(e0).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>e0[e]})});
88
88
  //# sourceMappingURL=index.cjs.js.map