@spteck/react-controls-v2 2.5.3 → 2.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2 -2
- package/dist/index.js +25 -13
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -28,7 +28,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
28
28
|
&::-webkit-scrollbar-thumb:hover {
|
|
29
29
|
background: ${i.tokens.colorBrandBackgroundHover} !important;
|
|
30
30
|
}
|
|
31
|
-
`},[u])}},Qe=e=>{let{children:r,className:i,onScroll:a}=e,{gridStyles:o,scrollbarClassName:s}=Ze(e),l=t.useRef(null),[u,d]=t.useState(0),[f,p]=t.useState(0);return t.useEffect(()=>{let e;return l.current&&(e=new c.ResizeObserver(e=>{for(let t of e){let{width:e,height:n}=t.contentRect;d(e),p(n)}}),e.observe(l.current)),()=>{e&&e.disconnect()}},[]),(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(`div`,{className:[i,s].filter(Boolean).join(` `),style:o(u,f),ref:l,onScroll:t.useCallback(e=>{if(!a)return;let{scrollTop:t,scrollHeight:n,clientHeight:r}=e.currentTarget;(t+r)/n>=.95&&a(e)},[a]),children:r})})},$e=e=>{let{maxWith:n}=e,{getBaseStyles:r}=xe();return{rootStyles:t.useCallback((t,i)=>({...r(e,t,i),maxWidth:n}),[r,n,e]),layoutGridStyles:(0,l.css)({display:`grid`,overflow:`hidden`})}},et={areas:[`header header header`,`sidebar content sidebar`,`footer footer footer`],columns:`1fr 3fr 1fr`,rows:`auto 1fr auto`},tt=e=>{let{className:r,children:a,layoutConfig:o=et}=e,s=t.useRef(null),[l,u]=t.useState(0),[d,f]=t.useState(0),{rootStyles:p,layoutGridStyles:m}=$e({...e,layoutConfig:o}),h=((e,n)=>{let r;return t.useCallback((...t)=>{clearTimeout(r),r=setTimeout(()=>e(...t),n)},[e,n])})((e,t)=>{u(e),f(t)},200);return t.useEffect(()=>{if(!s.current)return;let e=new c.ResizeObserver(e=>{for(let t of e){let{width:e,height:n}=t.contentRect;h(e,n)}});return e.observe(s.current),()=>e.disconnect()},[h]),(0,n.jsx)(`div`,{id:`-Layout`,className:(0,i.mergeClasses)(r,m),style:{...p(l,d),gridTemplateAreas:o.areas.join(` `),gridTemplateColumns:o.columns,gridTemplateRows:o.rows},ref:s,children:t.Children.map(a,(e,r)=>t.isValidElement(e)?(0,n.jsx)(`div`,{style:{gridArea:e.props?.area??`area-${r}`},children:e},r):e)})},nt=e=>{let{area:t,children:r}=e;return(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(`div`,{style:{gridArea:t},children:r})})},rt=e=>{let{verticalSpacing:n,horizontalSpacing:r}=e,{getSpacing:i}=xe();return{spaceStyles:t.useCallback(e=>e?r?{width:i(r,e,`horizontal`)}:n?{height:i(n,e,`vertical`)}:{}:{},[i,r,n])}},it=e=>{let r=t.useRef(null),[i,a]=t.useState(0),{spaceStyles:o}=rt(e);return t.useEffect(()=>{let e;return r.current&&(e=new c.ResizeObserver(e=>{for(let t of e){let{width:e}=t.contentRect;a(e)}}),e.observe(r.current)),()=>{e&&e.disconnect()}},[]),(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(`div`,{id:`-space`,style:o(i),ref:r})})},at=e=>{let{horizontal:n,horizontalAlign:r,verticalAlign:i,verticalFill:a,wrap:o,columnGap:s,RowGap:c}=e,{getBaseStyles:l}=xe();return{stackStyles:t.useCallback((t,u)=>{let d=i||`start`,f=n?r:`start`,p=n?{flexFlow:o?`row wrap`:`row nowrap`,height:`100%`}:{height:`100%`,maxHeight:`100%`},m=l(e,t,u);return{columnGap:s,rowGap:c,display:`flex`,flexDirection:n?`row`:`column`,alignItems:d,justifyContent:f,...p,height:a?`100%`:m.height,...m,...e.styles}},[l,n,r,e,i,a,o])}},V=e=>{let{children:r,className:i}=e,{stackStyles:a}=at(e),o=t.useRef(null),[s,l]=t.useState(0),[u,d]=t.useState(0);return t.useEffect(()=>{let e;return o.current&&(e=new c.ResizeObserver(e=>{for(let t of e){let{width:e,height:n}=t.contentRect;l(e),d(n)}}),e.observe(o.current)),()=>{e&&e.disconnect()}},[]),(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(`div`,{className:i,style:a(s,u),ref:o,children:r})})},ot=e=>{let{children:r,grow:i,disableShrink:a,shrink:o,order:s,alignSelf:l,verticalFill:u}=e,{getBaseStyles:d}=xe(),f=t.useRef(null),[p,m]=t.useState(0),[h,g]=t.useState(0),_=d(e,p,h);return t.useEffect(()=>{let e;return f.current&&(e=new c.ResizeObserver(e=>{for(let t of e){let{width:e,height:n}=t.contentRect;m(e),g(n)}}),e.observe(f.current)),()=>{e&&e.disconnect()}},[]),(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(`div`,{ref:f,style:{..._,alignSelf:l,order:s,height:u?`100%`:`auto`,flexGrow:i?typeof i==`boolean`?1:i:void 0,flexShrink:a||!i&&!o?0:1,minWidth:0,minHeight:0,width:`auto`},children:r})})},st=({ratio:e,children:t,maxWidth:r,maxHeight:i,style:a={},...o})=>{let s={position:`relative`,width:`100%`,paddingTop:`${100/e}%`,maxWidth:r||`none`,maxHeight:i||`none`,...a},c={position:`absolute`,top:0,left:0,width:`100%`,height:`100%`};return(0,n.jsx)(`div`,{style:s,...o,children:(0,n.jsx)(`div`,{style:c,children:t})})},ct=e=>{let{styles:n}=e,{getBaseStyles:r}=xe();return{aspectRatioStyles:t.useCallback((t,i)=>({...r(e,t,i),...n}),[r,e,n])}},lt=e=>{let{styles:n}=e,{getBaseStyles:r}=xe();return{centerStyles:t.useCallback((t,i)=>({...r(e,t,i),...n,overflow:`hidden`,display:`flex`,justifyContent:`center`,alignItems:`center`,width:`100%`,height:`100%`}),[r,e,n]),childrenStyles:(0,l.css)({justifyContent:`center`,textAlign:`center`})}},ut=e=>{let{className:r,children:i}=e,a=t.useRef(null),[o,s]=t.useState(0),[l,u]=t.useState(0),{centerStyles:d}=lt(e),f=(e,t)=>{let n;return(...r)=>{clearTimeout(n),n=setTimeout(()=>e(...r),t)}};return t.useEffect(()=>{let e=f(e=>{for(let t of e){let{width:e,height:n}=t.contentRect;s(e),u(n)}},200),t=new c.ResizeObserver(t=>{e(t)});return a.current&&t.observe(a.current),()=>{t.disconnect()}},[]),(0,n.jsx)(`div`,{id:`center`,className:r,style:{...d(o,l),display:`flex`,justifyContent:`center`,alignItems:`center`,height:`100%`,width:`100%`},ref:a,children:i})},dt=e=>{let{maxWidth:n}=e,{getBaseStyles:r}=xe();return{containerStyles:t.useCallback((t,i)=>!t||!i?{}:{...r(e,t,i),maxWidth:n},[r,n,e])}},ft=e=>{let{className:r,children:i,style:a,alignItems:o=`center`,justifyContent:l=`center`,flexDirection:u=`row`,centerContent:d=!0}=e,f=t.useRef(null),[p,m]=t.useState(0),[h,g]=t.useState(0),{containerStyles:_}=dt(e),v=t.useMemo(()=>(0,s.debounce)(e=>{for(let t of e){let{width:e,height:n}=t.contentRect;m(e),g(n)}},200),[]);t.useEffect(()=>{let e=new c.ResizeObserver(e=>{v(e)});return f.current&&e.observe(f.current),()=>{e.disconnect(),v.cancel()}},[v]);let y=t.useMemo(()=>{if(!a)return;let{padding:e,margin:t,...n}=a;return n},[a]);return(0,n.jsx)(`div`,{id:`container`,className:r,style:{..._(p,h),display:`flex`,justifyContent:l,alignItems:o,flexDirection:u,...y},ref:f,children:d?(0,n.jsx)(ut,{children:i}):i})},pt=e=>{let[n,r]=(0,t.useState)(!0),[i,a]=(0,t.useState)(!0),o=(0,t.useCallback)(()=>{e&&e.scrollPrev()},[e]),s=(0,t.useCallback)(()=>{e&&e.scrollNext()},[e]),c=(0,t.useCallback)(e=>{r(!e.canScrollPrev()),a(!e.canScrollNext())},[]);return(0,t.useEffect)(()=>{e&&(c(e),e.on(`reInit`,c),e.on(`select`,c))},[e,c]),{prevBtnDisabled:n,nextBtnDisabled:i,onPrevButtonClick:o,onNextButtonClick:s}},mt=(e,n)=>{let{getCurrentDevice:r}=xe(),a=t.useCallback(()=>{let e=r(n),t=`95%`;switch(e){case`Medium`:t=`45%`;break;case`Large`:t=`calc(95% / 4)`;break;case`ExtraLarge`:t=`calc(95% / 5)`;break;case`ExtraExtraLarge`:t=`calc(95% / 6)`;break;default:t=`95%`;break}return t},[n,r]),o=t.useCallback(()=>{let e=r(n),t=i.tokens.spacingVerticalM;switch(e){case`Medium`:t=i.tokens.spacingVerticalM;break;case`Large`:t=i.tokens.spacingVerticalL;break;case`ExtraLarge`:t=i.tokens.spacingVerticalXL;break;default:t=i.tokens.spacingVerticalM;break}return t},[n,r]);return{enableControls:(0,l.css)({display:`flex`,justifyContent:`space-between`,alignItems:`stretch`,gap:10,padding:5}),embla__viewport:(0,l.css)({overflow:`hidden`,paddingTop:`10px`,paddingBottom:`20px`}),embla__container:(0,l.css)({backfaceVisibility:`hidden`,display:`flex`,touchAction:`pan-y`}),embla:(0,l.css)({".embla":{}}),embla__slide:(0,l.css)({minWidth:0,flex:`0 0 ${a()}`,paddingLeft:`${o()}`}),embla__buttons:(0,l.css)({display:`grid`,gridTemplateColumns:`repeat(2, 1fr)`,gap:0,alignItems:`center`})}},ht=e=>{let{styles:n}=e,{getBaseStyles:r}=xe();return{carouselStyles:t.useCallback((t,i)=>({...r(e,t,i),...n}),[r,e,n])}},gt=()=>({titleStyles:(0,l.css)({display:`-webkit-box`,overflow:`hidden`,textOverflow:`ellipsis`,WebkitLineClamp:`1`,WebkitBoxOrient:`vertical`,textAlign:`start`})}),_t=e=>{let{className:r,items:a,title:o}=e,s=t.useRef(null),[l,f]=t.useState(0),[p,m]=t.useState(0),{carouselStyles:h}=ht(e),[g,_]=(0,u.default)(),v=gt(),{enableControls:y,embla__slide:b,embla__container:x,embla__viewport:S,embla__buttons:C}=mt(e,l),{prevBtnDisabled:w,nextBtnDisabled:T,onPrevButtonClick:E,onNextButtonClick:D}=pt(_);return t.useEffect(()=>{let e;return s.current&&(e=new c.ResizeObserver(e=>{for(let t of e){let{width:e,height:n}=t.contentRect;f(e),m(n)}}),f(s.current.clientWidth),m(s.current.clientHeight),e.observe(s.current)),()=>{e&&e.disconnect()}},[]),(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)(`div`,{id:`-carousel`,role:`region`,"aria-roledescription":`carousel`,"aria-label":o||`Carousel`,className:(0,i.mergeClasses)(r,`embla`),style:{...h(l,p)},ref:s,children:[(0,n.jsxs)(`div`,{className:y,children:[(0,n.jsx)(i.Subtitle2,{className:v.titleStyles,children:o}),(0,n.jsxs)(`div`,{className:C,children:[(0,n.jsx)(i.Button,{onClick:E,disabled:w,appearance:`subtle`,icon:(0,n.jsx)(d.ChevronLeftRegular,{}),"aria-label":`Previous slide`}),(0,n.jsx)(i.Button,{onClick:D,disabled:T,appearance:`subtle`,icon:(0,n.jsx)(d.ChevronRightRegular,{}),"aria-label":`Next slide`})]})]}),(0,n.jsx)(`div`,{className:S,ref:g,children:(0,n.jsx)(`div`,{className:x,children:a.map((e,t)=>(0,n.jsx)(`div`,{className:b,role:`group`,"aria-roledescription":`slide`,"aria-label":`Slide ${t+1} of ${a.length}`,children:e},t))})})]})})},vt=e=>{let{direction:t=`horizontal`,resizerSize:n=6}=e,r=t===`horizontal`;return{root:(0,l.css)({position:`relative`,width:`100%`,height:`100%`}),pane:e=>{let t=e===void 0?void 0:typeof e==`number`?`${e}px`:e;return(0,l.css)({overflow:`auto`,position:`relative`,...r?{width:t,height:`100%`}:{height:t,width:`100%`}})},secondaryPane:(0,l.css)({flex:1,overflow:`auto`,position:`relative`,minWidth:0,minHeight:0}),resizer:(0,l.css)({flex:`0 0 auto`,...r?{width:n,cursor:`col-resize`,height:`100%`}:{height:n,cursor:`row-resize`,width:`100%`},backgroundColor:i.tokens.colorNeutralStroke1,transition:`background-color 150ms ease`,userSelect:`none`,zIndex:1}),resizerActive:(0,l.css)({backgroundColor:i.tokens.colorBrandStroke1}),resizerGrip:(0,l.css)({gap:`2px`}),gripDot:(0,l.css)({width:3,height:3,borderRadius:`50%`,backgroundColor:i.tokens.colorNeutralForeground3})}},H={xs:i.tokens.spacingHorizontalXS,s:i.tokens.spacingHorizontalS,m:i.tokens.spacingHorizontalM,l:i.tokens.spacingHorizontalL,xl:i.tokens.spacingHorizontalXL,xxl:i.tokens.spacingHorizontalXXL},U=t.default.memo(t.default.forwardRef(({direction:e=`vertical`,justifyContent:t=`flex-start`,alignItems:r=`stretch`,gap:a,columnGap:o,rowGap:s,margin:c,padding:u,marginTop:d,marginBottom:f,marginLeft:p,marginRight:m,paddingTop:h,paddingBottom:g,paddingLeft:_,paddingRight:v,width:y,height:b,wrap:x=!1,children:S,style:C,className:w,overflow:T,background:E},D)=>(0,n.jsx)(`div`,{ref:D,className:(0,i.mergeClasses)(w,(0,l.css)({display:`flex`,flexDirection:e===`horizontal`?`row`:`column`,justifyContent:t,alignItems:r,gap:a&&H[a]?H[a]:a,columnGap:o&&H[o]?H[o]:o,rowGap:s&&H[s]?H[s]:s,margin:c&&H[c]?H[c]:c,padding:u&&H[u]?H[u]:u,marginTop:d&&H[d]?H[d]:d,marginBottom:f&&H[f]?H[f]:f,marginLeft:p&&H[p]?H[p]:p,marginRight:m&&H[m]?H[m]:m,paddingTop:h&&H[h]?H[h]:h,paddingBottom:g&&H[g]?H[g]:g,paddingLeft:_&&H[_]?H[_]:_,paddingRight:v&&H[v]?H[v]:v,width:y,height:b,overflow:T,flexWrap:x?`wrap`:`nowrap`,backgroundColor:E,...C})),children:S}))),yt=e=>{let{direction:r=`horizontal`,defaultSize:i=`50%`,minSize:a=100,maxSize:o=1/0,minSecondarySize:s=100,resizable:c=!0,onResize:l,onResizeEnd:u,primaryContent:d,secondaryContent:f,className:p,styles:m}=e,h=vt(e),g=r===`horizontal`,_=t.useRef(null),v=t.useRef(null),[y,b]=t.useState(null),[x,S]=t.useState(!1),[C,w]=t.useState(!1);t.useEffect(()=>{if(y!==null||!_.current)return;let e=_.current.getBoundingClientRect(),t=g?e.width:e.height;if(typeof i==`number`)b(Math.min(Math.max(i,a),o));else if(typeof i==`string`&&i.endsWith(`%`)){let e=parseFloat(i)/100;b(Math.min(Math.max(t*e,a),o))}else b(t/2)},[i,a,o,g,y]);let T=t.useCallback(t=>{if(!_.current)return t;let n=_.current.getBoundingClientRect(),r=(g?n.width:n.height)-(e.resizerSize??6)-s;return Math.min(Math.max(t,a),Math.min(o,r))},[g,o,a,s,e.resizerSize]),E=t.useCallback(e=>{if(!c)return;e.preventDefault(),S(!0);let t=g?e.clientX:e.clientY,n=y??0,r=e=>{let r=T(n+((g?e.clientX:e.clientY)-t));b(r),l?.(r)},i=()=>{if(S(!1),document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,i),v.current){let e=g?v.current.getBoundingClientRect().width:v.current.getBoundingClientRect().height;u?.(e)}};document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,i)},[c,g,y,T,l,u]),D=t.useCallback(e=>{if(!c)return;S(!0);let t=e.touches[0],n=g?t.clientX:t.clientY,r=y??0,i=e=>{let t=e.touches[0],i=T(r+((g?t.clientX:t.clientY)-n));b(i),l?.(i)},a=()=>{if(S(!1),document.removeEventListener(`touchmove`,i),document.removeEventListener(`touchend`,a),v.current){let e=g?v.current.getBoundingClientRect().width:v.current.getBoundingClientRect().height;u?.(e)}};document.addEventListener(`touchmove`,i,{passive:!1}),document.addEventListener(`touchend`,a)},[c,g,y,T,l,u]),O=t.useCallback(e=>{if(!c||y===null)return;let t=e.shiftKey?50:10,n=0;if(g?e.key===`ArrowLeft`?n=-t:e.key===`ArrowRight`&&(n=t):e.key===`ArrowUp`?n=-t:e.key===`ArrowDown`&&(n=t),n!==0){e.preventDefault();let t=T(y+n);b(t),l?.(t),u?.(t)}},[c,y,g,T,l,u]);t.useEffect(()=>(x?(document.body.style.userSelect=`none`,document.body.style.cursor=g?`col-resize`:`row-resize`):(document.body.style.userSelect=``,document.body.style.cursor=``),()=>{document.body.style.userSelect=``,document.body.style.cursor=``}),[x,g]);let k=t.useRef(null),A=[h.resizer,C||x?h.resizerActive:``].filter(Boolean).join(` `);return t.useEffect(()=>{if(!c||!k.current)return;let e=k.current,t=e=>E(e),n=e=>D(e),r=e=>O(e),i=()=>w(!0),a=()=>w(!1);return e.addEventListener(`mousedown`,t),e.addEventListener(`touchstart`,n),e.addEventListener(`keydown`,r),e.addEventListener(`mouseenter`,i),e.addEventListener(`mouseleave`,a),()=>{e.removeEventListener(`mousedown`,t),e.removeEventListener(`touchstart`,n),e.removeEventListener(`keydown`,r),e.removeEventListener(`mouseenter`,i),e.removeEventListener(`mouseleave`,a)}},[c,E,D,O]),(0,n.jsxs)(U,{ref:_,className:[h.root,p].filter(Boolean).join(` `),style:{height:`100%`,width:`100%`,...m},direction:g?`horizontal`:`vertical`,overflow:`hidden`,children:[(0,n.jsx)(U,{ref:v,className:h.pane(y??void 0),style:{flex:`0 0 auto`},children:d}),c&&(0,n.jsx)(`div`,{ref:k,className:A,style:{flex:`0 0 auto`,display:`flex`,alignItems:`center`,justifyContent:`center`},role:`separator`,"aria-orientation":g?`vertical`:`horizontal`,"aria-valuenow":Math.round(y??a),"aria-valuemin":a,"aria-valuemax":o===1/0?void 0:o,"aria-label":`Resize pane`,tabIndex:0,children:(0,n.jsxs)(U,{className:h.resizerGrip,direction:g?`vertical`:`horizontal`,alignItems:`center`,justifyContent:`center`,children:[(0,n.jsx)(U,{className:h.gripDot,children:``}),(0,n.jsx)(U,{className:h.gripDot,children:``}),(0,n.jsx)(U,{className:h.gripDot,children:``})]})}),(0,n.jsx)(U,{className:h.secondaryPane,style:{flex:1,minWidth:0,minHeight:0},children:f})]})},bt=({anchorPoint:e,isOpen:r,onClose:a,excludeRefs:o,children:s,theme:c})=>{let l=(0,t.useRef)(null),[u,d]=(0,t.useState)(null);(0,t.useLayoutEffect)(()=>{if(!r){d(null);return}if(l.current){let t=l.current.getBoundingClientRect(),n=e.left,r=e.top;n+t.width>window.innerWidth&&(n=window.innerWidth-t.width-10),r+t.height>window.innerHeight&&(r=window.innerHeight-t.height-10),d({left:n,top:r})}},[e,r,s]);let p=t.default.useCallback(e=>{let t=e.target;if(l.current&&!l.current.contains(t)){if(o&&o.some(e=>e.current&&e.current.contains(t)))return;a()}},[a,o]);if((0,t.useEffect)(()=>{if(!r)return;let e=requestAnimationFrame(()=>{document.addEventListener(`mousedown`,p)}),t=e=>{e.key===`Escape`&&a()};return document.addEventListener(`keydown`,t),()=>{cancelAnimationFrame(e),document.removeEventListener(`mousedown`,p),document.removeEventListener(`keydown`,t)}},[r,p,a]),!r)return null;let m=u||e;return f.default.createPortal(c?(0,n.jsx)(i.FluentProvider,{theme:c,children:(0,n.jsx)(i.Card,{ref:l,role:`dialog`,"aria-modal":`true`,style:{position:`fixed`,zIndex:1e3,top:m.top,left:m.left},children:s})}):(0,n.jsx)(i.Card,{ref:l,role:`dialog`,"aria-modal":`true`,style:{position:`fixed`,zIndex:1e3,top:m.top,left:m.left},children:s}),document.body)},xt=(0,i.makeStyles)({labelContainer:{display:`flex`,flexDirection:`row`,justifyContent:`flex-start`,alignItems:`center`,...i.shorthands.gap(`6px`)},iconStyles:{width:`26px`},item:{paddingLeft:`15px`}}),St=e=>{let{label:r,icon:a,isRequired:o}=e,s=xt();return(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)(`div`,{className:s.labelContainer,children:[a&&t.isValidElement(a)?a:(0,n.jsx)(p.Icon,{icon:a,className:s.iconStyles,width:`20px`,height:`20px`,color:i.tokens.colorBrandForeground1,"aria-hidden":`true`}),(0,n.jsx)(i.Caption1,{style:{color:i.tokens.colorBrandForeground1},children:r}),(0,n.jsx)(i.Caption1,{style:{color:i.tokens.colorPaletteRedForeground1},children:o?` *`:``})]})})},Ct=(0,i.makeStyles)({root:{display:`flex`,justifyContent:`center`,alignItems:`center`,height:`100%`,width:`100%`},spinner:{width:`100px`,height:`100px`}}),wt=e=>{let{size:t,label:r,labelPosition:a,style:o,className:s}=e,c=Ct();return(0,n.jsx)(`div`,{className:c.root,children:(0,n.jsx)(i.Spinner,{style:o,className:(0,i.mergeClasses)(c.spinner,s),size:t,label:r,labelPosition:a,"aria-label":r?void 0:`Loading`})})},Tt={xs:i.tokens.fontSizeBase200,s:i.tokens.fontSizeBase300,m:i.tokens.fontSizeBase400,l:i.tokens.fontSizeBase500,xl:i.tokens.fontSizeBase600,xxl:i.tokens.fontSizeHero700},W={xs:i.tokens.spacingHorizontalXS,s:i.tokens.spacingHorizontalS,m:i.tokens.spacingHorizontalM,l:i.tokens.spacingHorizontalL,xl:i.tokens.spacingHorizontalXL,xxl:i.tokens.spacingHorizontalXXL},Et={regular:i.tokens.fontWeightRegular,semibold:i.tokens.fontWeightSemibold,bold:i.tokens.fontWeightBold},Dt=e=>{let{fontSize:t,fontFamily:r,fontWeight:a,numberOfLines:o,as:s,padding:c,paddingTop:u,paddingBottom:d,paddingLeft:f,paddingRight:p,margin:m,marginTop:h,marginBottom:g,marginLeft:_,marginRight:v,children:y,style:b,className:x,color:S,block:C,truncate:w,wrap:T}=e,E=(0,l.css)({color:S,padding:c&&W[c]?W[c]:c,paddingTop:u&&W[u]?W[u]:u,paddingBottom:d&&W[d]?W[d]:d,paddingLeft:f&&W[f]?W[f]:f,paddingRight:p&&W[p]?W[p]:p,margin:m&&W[m]?W[m]:m,marginTop:h&&W[h]?W[h]:h,marginBottom:g&&W[g]?W[g]:g,marginLeft:_&&W[_]?W[_]:_,marginRight:v&&W[v]?W[v]:v}),D={...b,...r?{fontFamily:r}:{},...t?{fontSize:Tt[t]?Tt[t]:t}:{},...a?{fontWeight:Et[a]?Et[a]:a}:{},...o?{display:`-webkit-box`,WebkitBoxOrient:`vertical`,overflow:`hidden`,WebkitLineClamp:o}:{}};return(0,n.jsx)(i.Text,{as:s,className:(0,i.mergeClasses)(x,E),style:D,block:C,truncate:w,wrap:T,children:y})},Ot=e=>{let{onSelected:r,value:a,styles:o,options:s,apparence:c,shape:l,label:u}=e,d=t.useRef(),[f,p]=t.useState(a??s[0]),[m,h]=t.useState({option:[a?a?.key:s?.[0]?.key]}),g=t.useRef(null);t.useEffect(()=>{a!==void 0&&(p(a),h({option:[a.key]})),d.current=s.find(e=>e.key===(a?.key??s[0]?.key))?.icon},[a]);let[_,v]=t.useState(!1),y=t.useCallback((e,t)=>{v(t.open)},[]),b=t.useCallback(e=>e?.text??``,[]),x=t.useCallback((e,{name:t,checkedItems:n})=>{if(t===`option`){let e=n[0];p(s.find(t=>t.key===e)),h({option:n}),d.current=s.find(t=>t.key===e)?.icon,r(s.find(t=>t.key===e))}},[s,r]);return(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(i.Field,{label:u,style:o,ref:g,children:(0,n.jsxs)(i.Menu,{open:_,onOpenChange:y,children:[(0,n.jsx)(i.MenuTrigger,{disableButtonEnhancement:!0,children:(0,n.jsx)(i.MenuButton,{shape:l??`circular`,icon:d.current,appearance:c??`secondary`,children:b(f)??`No data available`})}),(0,n.jsx)(i.MenuPopover,{children:(0,n.jsx)(i.MenuList,{onCheckedValueChange:x,checkedValues:m,style:{width:g.current?.offsetWidth},children:s.map(e=>(0,n.jsx)(i.MenuItemRadio,{name:`option`,value:e.key,icon:e.icon,disabled:e.disabled,children:b(e)},e.key))})})]})})})},kt=()=>({styles:{container:(0,l.css)({display:`flex`,alignItems:`center`,alignContent:`center`,overflow:`hidden`,whiteSpace:`nowrap`,padding:`8px`,backgroundColor:`transparent`}),breadcrumbItem:(0,l.css)({minWidth:`fit-content`,padding:0,margin:`0px`}),separator:(0,l.css)({marginRight:`8px`})},getStyles:(e,t)=>{let{icon:n}=e;switch(t){case`small`:return(0,l.css)({fontSize:`12px`,padding:`4px`,paddingLeft:n?`0px`:`4px`});case`medium`:return(0,l.css)({fontSize:`14px`,padding:`6px`,paddingLeft:n?`0px`:`6px`});case`large`:return(0,l.css)({fontSize:`16px`,padding:`8px`,paddingLeft:n?`0px`:`8px`});case`current`:return(0,l.css)({fontWeight:i.tokens.fontWeightBold,cursor:`default`,display:`-webkit-box`,"-webkit-line-clamp":`1`,"-webkit-box-orient":`vertical`,overflow:`hidden`,textAlign:`start`,textOverflow:`ellipsis`,wordBreak:`break-word`,fontFamily:i.tokens.fontFamilyBase});default:return(0,l.css)({fontSize:`14px`,padding:`6px`,paddingLeft:n?`0px`:`6px`})}}}),At=({items:e,theme:r,size:a=`medium`})=>{let[o,s]=(0,t.useState)(!1),c=(0,t.useRef)(null),l=(0,t.useRef)(null),[u,p]=(0,t.useState)({top:0,left:0,position:`absolute`}),{getStyles:m}=kt();return(0,t.useEffect)(()=>{let e=e=>{!c.current?.contains(e.target)&&!l.current?.contains(e.target)&&o&&s(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[o]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(i.Button,{ref:c,icon:(0,n.jsx)(d.MoreHorizontalRegular,{}),appearance:`transparent`,onClick:()=>{if(c.current){let e=c.current.getBoundingClientRect(),t=window.innerWidth,n=window.innerHeight,r=l.current?.offsetWidth||200,i=l.current?.offsetHeight||100,a=e.bottom+window.scrollY,o=e.left+window.scrollX;o+r>t&&(o=t-r-10),a+i>n&&(a=e.top+window.scrollY-i),p({top:a,left:o,position:`absolute`}),s(e=>!e)}},"aria-label":`More items`}),o&&(0,f.createPortal)(r?(0,n.jsx)(i.FluentProvider,{theme:r,children:(0,n.jsx)(i.Card,{ref:l,style:{...u,zIndex:1e3,padding:`8px`,minWidth:`150px`},children:e.map((e,t)=>(0,n.jsx)(i.Button,{icon:e.icon?e.icon:null,appearance:`transparent`,onClick:()=>{e.onClick?.(),s(!1)},children:(0,n.jsx)(i.Text,{className:m(e,a),children:e.label})},`overflow-${t}`))})}):(0,n.jsx)(i.Card,{ref:l,style:{...u,zIndex:1e3,padding:`8px`,minWidth:`150px`},children:e.map((e,t)=>(0,n.jsx)(i.Button,{icon:e.icon?e.icon:null,appearance:`transparent`,onClick:()=>{e.onClick?.(),s(!1)},children:(0,n.jsx)(i.Text,{className:m(e,a),children:e.label})},`overflow-${t}`))}),document.body)]})},jt=(e,t)=>{let n;return(...r)=>{clearTimeout(n),n=setTimeout(()=>e(...r),t)}},Mt=({items:e,maxWidth:r=`100%`,styles:a,theme:o,size:s=`medium`,currentIndex:l=e.length-1,className:u})=>{let{styles:f,getStyles:p}=kt(),m=(0,t.useRef)(null),[h,g]=(0,t.useState)([]),[_,v]=(0,t.useState)([]);return(0,t.useEffect)(()=>{let t=()=>{if(!m.current)return;let t=m.current.offsetWidth,n=0,r=[],i=[];e.forEach(e=>{n+80<=t-50?(r.push(e),n+=80):i.push(e)}),g(r),v(i)},n=jt(t,100),r=new c.ResizeObserver(()=>{n()});return m.current&&r.observe(m.current),t(),()=>{r.disconnect()}},[e]),(0,n.jsx)(`div`,{ref:m,className:(0,i.mergeClasses)(f.container,u),style:{maxWidth:r,...a},children:(0,n.jsxs)(V,{horizontal:!0,verticalAlign:`center`,horizontalAlign:`start`,children:[h.map((e,r)=>(0,n.jsxs)(t.default.Fragment,{children:[r===l?(0,n.jsxs)(V,{horizontal:!0,verticalAlign:`center`,horizontalAlign:`start`,columnGap:5,styles:{overflow:`hidden`},children:[e.icon?t.default.cloneElement(e.icon,{style:{fontSize:s===`large`?`20px`:s===`medium`?`16px`:`12px`}}):null,(0,n.jsx)(i.Text,{className:(0,i.mergeClasses)(f.breadcrumbItem,p(e,s),p(e,`current`)),"aria-current":`page`,children:e.label},e.label)]}):(0,n.jsx)(i.Button,{icon:e.icon?e.icon:null,appearance:`transparent`,className:`${f.breadcrumbItem}`,onClick:e.onClick,children:(0,n.jsx)(i.Text,{className:p(e,s),children:e.label})},e.label),r<h.length-1&&(0,n.jsx)(d.ChevronRightRegular,{style:{fontSize:s===`large`?`20px`:s===`medium`?`16px`:`12px`}})]},e.label??`breadcrumb-${r}`)),_.length>0&&(0,n.jsx)(At,{items:_,theme:o})]})})},Nt=({icon:e,hoverIcon:r,imageSrc:a,width:o=24,height:s=24,color:c,hoverColor:l,onClick:u,enabled:d=!0,ariaLabel:f})=>{let p=c||i.tokens.colorBrandBackground,m=l||i.tokens.colorBrandBackgroundHover,h=i.tokens.fontFamilyBase,[g,_]=(0,t.useState)(!1),v=(0,t.useCallback)(()=>{d&&_(!0)},[d]),y=(0,t.useCallback)(()=>{d&&_(!1)},[d]),b=(0,t.useMemo)(()=>d&&g&&r?r:e,[g,r,e,d]),x=(0,t.useMemo)(()=>({width:o,height:s,color:g?m:p,display:`flex`,alignItems:`center`,justifyContent:`center`,opacity:d?1:.5,fontFamily:h,fontSize:`inherit`}),[o,s,g,m,p,d,h]),S=(0,t.useMemo)(()=>({border:`none`,background:`none`,padding:0,cursor:d?`pointer`:`default`}),[d]),C=(0,t.useMemo)(()=>({width:o,height:s,objectFit:`contain`,opacity:d?1:.5}),[o,s,d]);return(0,n.jsx)(i.Button,{onClick:d?u:void 0,onMouseEnter:v,onMouseLeave:y,disabled:!d,style:S,"aria-label":f??`Icon Button`,children:a?(0,n.jsx)(`img`,{src:a,alt:`icon`,style:C}):t.default.cloneElement(b,{style:{...b.props.style,...x}})})},Pt=t.default.memo(Nt),Ft=()=>({getSpanSlots:t.useCallback((e,t)=>{let n=new Date(e),r=new Date(t),i=n.getHours(),a=n.getMinutes(),o=i*2+(a>=1?1:0),s=r.getHours(),c=r.getMinutes(),l=s*2+(c>=1?2:0);return{spanSlots:l-o,startSlot:o,endSlot:l}},[]),generateLightAndHoverColors:t.useCallback((e,t=20,n=10)=>{let r=e=>{let t=parseInt(e.slice(1,3),16)/255,n=parseInt(e.slice(3,5),16)/255,r=parseInt(e.slice(5,7),16)/255,i=Math.max(t,n,r),a=Math.min(t,n,r),o=i-a,s=0,c=0,l=(i+a)/2;if(o!==0){switch(c=l>.5?o/(2-i-a):o/(i+a),i){case t:s=(n-r)/o+(n<r?6:0);break;case n:s=(r-t)/o+2;break;case r:s=(t-n)/o+4;break}s/=6}return{h:s*360,s:c*100,l:l*100}},i=(e,t,n)=>{let r=t*Math.min(n,100-n)/100,i=t=>{let i=(t+e/30)%12,a=n-r*Math.max(Math.min(i-3,9-i,1),-1);return Math.round(255*a).toString(16).padStart(2,`0`)};return`#${i(0)}${i(8)}${i(4)}`},{h:a,s:o,l:s}=r(e);return{lightColor:i(a,o,Math.min(s+t,100)),hoverColor:i(a,o,Math.min(s+n,100))}},[]),getEventColors:t.useCallback(e=>{let t={backgroundColor:i.tokens.colorNeutralBackground3,hoverColor:i.tokens.colorNeutralBackground3Hover};return{"no category":t,meeting:{backgroundColor:i.tokens.colorPaletteBlueBackground2,hoverColor:i.tokens.colorPaletteBlueBorderActive},appointment:{backgroundColor:i.tokens.colorPaletteGreenBackground2,hoverColor:i.tokens.colorPaletteGreenBorderActive},task:{backgroundColor:i.tokens.colorPaletteRedBackground2,hoverColor:i.tokens.colorPaletteRedBorderActive},deadline:{backgroundColor:i.tokens.colorPaletteYellowBackground2,hoverColor:i.tokens.colorPaletteYellowBorderActive},holiday:{backgroundColor:i.tokens.colorPalettePurpleBackground2,hoverColor:i.tokens.colorPalettePurpleBorderActive},celebration:{backgroundColor:i.tokens.colorPaletteDarkOrangeBackground2,hoverColor:i.tokens.colorPaletteDarkOrangeBorderActive},reminder:{backgroundColor:i.tokens.colorPaletteTealBackground2,hoverColor:i.tokens.colorPaletteTealBorderActive},workshop:{backgroundColor:i.tokens.colorPaletteTealBackground2,hoverColor:i.tokens.colorPaletteTealBorderActive},webinar:{backgroundColor:i.tokens.colorPaletteMagentaBackground2,hoverColor:i.tokens.colorPaletteMagentaBorderActive},conference:{backgroundColor:i.tokens.colorPaletteBrownBackground2,hoverColor:i.tokens.colorPaletteBrownBorderActive}}[e.toLowerCase()]||t},[]),generateColor:t.useCallback(e=>{let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+((t<<5)-t);let n=(t&16777215).toString(16).toUpperCase();return`#${`00000`.substring(0,6-n.length)+n}`},[]),getCalendarColors:t.useCallback(e=>{let t={beige:{backgroundColor:i.tokens.colorPaletteBeigeBackground2,hoverColor:i.tokens.colorPaletteBeigeBorderActive},blue:{backgroundColor:i.tokens.colorPaletteBlueBackground2,hoverColor:i.tokens.colorPaletteBlueBorderActive},brown:{backgroundColor:i.tokens.colorPaletteBrownBackground2,hoverColor:i.tokens.colorPaletteBrownBorderActive},gold:{backgroundColor:i.tokens.colorPaletteGoldBackground2,hoverColor:i.tokens.colorPaletteGoldBorderActive},lavender:{backgroundColor:i.tokens.colorPaletteLavenderBackground2,hoverColor:i.tokens.colorPaletteLavenderBorderActive},magenta:{backgroundColor:i.tokens.colorPaletteMagentaBackground2,hoverColor:i.tokens.colorPaletteMagentaBorderActive},navy:{backgroundColor:i.tokens.colorPaletteNavyBackground2,hoverColor:i.tokens.colorPaletteNavyBorderActive},pink:{backgroundColor:i.tokens.colorPalettePinkBackground2,hoverColor:i.tokens.colorPalettePinkBorderActive},plum:{backgroundColor:i.tokens.colorPalettePlumBackground2,hoverColor:i.tokens.colorPalettePlumBorderActive},purple:{backgroundColor:i.tokens.colorPalettePurpleBackground2,hoverColor:i.tokens.colorPalettePurpleBorderActive},red:{backgroundColor:i.tokens.colorPaletteRedBackground2,hoverColor:i.tokens.colorPaletteRedBorderActive},teal:{backgroundColor:i.tokens.colorPaletteTealBackground2,hoverColor:i.tokens.colorPaletteTealBorderActive},anchor:{backgroundColor:i.tokens.colorPaletteAnchorBackground2,hoverColor:i.tokens.colorPaletteAnchorBorderActive},"dark-red":{backgroundColor:i.tokens.colorPaletteDarkRedBackground2,hoverColor:i.tokens.colorPaletteDarkRedBorderActive},cranberry:{backgroundColor:i.tokens.colorPaletteCranberryBackground2,hoverColor:i.tokens.colorPaletteCranberryBorderActive},pumpkin:{backgroundColor:i.tokens.colorPalettePumpkinBackground2,hoverColor:i.tokens.colorPalettePumpkinBorderActive},peach:{backgroundColor:i.tokens.colorPalettePeachBackground2,hoverColor:i.tokens.colorPalettePeachBorderActive},marigold:{backgroundColor:i.tokens.colorPaletteMarigoldBackground2,hoverColor:i.tokens.colorPaletteMarigoldBorderActive},brass:{backgroundColor:i.tokens.colorPaletteBrassBackground2,hoverColor:i.tokens.colorPaletteBrassBorderActive},forest:{backgroundColor:i.tokens.colorPaletteForestBackground2,hoverColor:i.tokens.colorPaletteForestBorderActive},seafoam:{backgroundColor:i.tokens.colorPaletteSeafoamBackground2,hoverColor:i.tokens.colorPaletteSeafoamBorderActive},"dark-green":{backgroundColor:i.tokens.colorPaletteDarkGreenBackground2,hoverColor:i.tokens.colorPaletteDarkGreenBorderActive},"light-teal":{backgroundColor:i.tokens.colorPaletteLightTealBackground2,hoverColor:i.tokens.colorPaletteLightTealBorderActive},steel:{backgroundColor:i.tokens.colorPaletteSteelBackground2,hoverColor:i.tokens.colorPaletteSteelBorderActive},"royal-blue":{backgroundColor:i.tokens.colorPaletteRoyalBlueBackground2,hoverColor:i.tokens.colorPaletteRoyalBlueBorderActive},cornflower:{backgroundColor:i.tokens.colorPaletteCornflowerBackground2,hoverColor:i.tokens.colorPaletteCornflowerBorderActive},grape:{backgroundColor:i.tokens.colorPaletteGrapeBackground2,hoverColor:i.tokens.colorPaletteGrapeBorderActive},lilac:{backgroundColor:i.tokens.colorPaletteLilacBackground2,hoverColor:i.tokens.colorPaletteLilacBorderActive},mink:{backgroundColor:i.tokens.colorPaletteMinkBackground2,hoverColor:i.tokens.colorPaletteMinkBorderActive},platinum:{backgroundColor:i.tokens.colorPalettePlatinumBackground2,hoverColor:i.tokens.colorPalettePlatinumBorderActive}},n=t[`royal-blue`];return t[e]||n},[]),formatDate:t.useCallback((e,t)=>(0,a.format)((0,a.parseISO)(e),t),[])}),It={start:`Start`,end:`End`,location:`Location`,attendees:`Attendees`,details:`Details`},Lt=`32px`,Rt=e=>({styles:{banner:(0,l.css)({display:`flex`,justifyContent:`center`,alignContent:`center`,alignItems:`center`,padding:`5px 10px 0px 10px`}),fieldContainer:(0,l.css)({paddingLeft:Lt}),title:(0,l.css)({lineClamp:2,overflow:`hidden`,display:`-webkit-box`,WebkitBoxOrient:`vertical`,wordBreak:`break-word`,WebkitLineClamp:2})}}),zt=({fieldLabel:e,fieldValue:t,icon:r})=>(0,n.jsxs)(V,{children:[(0,n.jsx)(St,{label:e,icon:r}),(0,n.jsx)(V,{paddingLeft:Lt,children:(0,n.jsx)(i.Body1,{children:t})})]}),Bt=e=>{let{event:r,strings:a=It}=e,{title:o,start:s,end:c,location:l,category:u,attendees:d,weblink:f}=r,{styles:p}=Rt(r),{formatDate:m}=Ft(),h=m(s,`PPp`),g=m(c,`PPp`),_=(0,i.partitionAvatarGroupItems)({items:d?.map(e=>e.id)||[]}),v=t.useCallback(e=>d?.find(t=>t.id===e)||void 0,[d]),y=t.useCallback(()=>(0,n.jsxs)(V,{children:[(0,n.jsx)(St,{label:a.attendees,icon:`ph:users-three`}),(0,n.jsx)(V,{paddingLeft:Lt,children:(0,n.jsxs)(i.AvatarGroup,{layout:`stack`,children:[_.inlineItems.map(e=>(0,n.jsx)(i.AvatarGroupItem,{name:v(e)?.name,image:{src:v(e)?.imageUrl}},e)),_.overflowItems&&(0,n.jsx)(i.AvatarGroupPopover,{children:_.overflowItems.map(e=>(0,n.jsx)(i.AvatarGroupItem,{name:v(e)?.name,image:{src:v(e)?.imageUrl}},e))})]})})]}),[_,v,a.attendees]);return(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(Xe,{appearance:`subtle`,padding:`m`,paddingTop:`s`,width:`250px`,cardBody:(0,n.jsxs)(V,{RowGap:10,children:[(0,n.jsx)(`div`,{className:p.banner,children:(0,n.jsx)(i.Subtitle1,{className:p.title,children:o})}),(0,n.jsx)(i.Divider,{}),u&&(0,n.jsx)(V,{horizontal:!0,horizontalAlign:`end`,width:`100%`,children:(0,n.jsx)(i.Badge,{appearance:`filled`,children:u})}),(0,n.jsx)(zt,{fieldLabel:a.start,fieldValue:h,icon:`mingcute:time-line`}),(0,n.jsx)(zt,{fieldLabel:a.end,fieldValue:g,icon:`mingcute:time-line`}),(0,n.jsx)(zt,{fieldLabel:a.location,fieldValue:l,icon:`mingcute:location-line`}),(0,n.jsx)(y,{})]}),cardFooterContent:(0,n.jsx)(V,{horizontal:!0,horizontalAlign:`end`,width:`100%`,children:(0,n.jsx)(i.Button,{appearance:`subtle`,onClick:()=>{window.open(f,`_blank`)},children:a.details})})})})},Vt=()=>({styles:{calendarWrapper:(0,l.css)({padding:`20px`,paddingTop:`10px`,overflow:`auto`,flex:1,display:`grid`,gridTemplateColumns:`repeat(7, 1fr)`,gridTemplateRows:`auto`,gridAutoRows:`minmax(100px, 1fr)`,gap:`1px`,width:`calc(100% - 40px)`}),header:(0,l.css)({display:`flex`,justifyContent:`start`,gap:`10px`,alignItems:`center`,padding:`16px`}),dayHeader:(0,l.css)({textAlign:`start`,padding:`8px`,borderBottom:`1px solid ${i.tokens.colorNeutralStroke1}`}),day:(0,l.css)({display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,border:`1px solid ${i.tokens.colorNeutralStroke1}`,backgroundColor:i.tokens.colorNeutralBackground1,position:`relative`}),otherMonthDay:(0,l.css)({color:i.tokens.colorNeutralStroke2,backgroundColor:i.tokens.colorNeutralBackground2}),cardDay:(0,l.css)({height:`100%`,minHeight:100,borderRadius:0,overflow:`hidden !important`,rowGap:5}),cardDayOnHover:(0,l.css)({":hover":{backgroundColor:i.tokens.colorNeutralBackground2}}),currentDay:(0,l.css)({borderTop:`5px solid ${i.tokens.colorBrandBackground}`}),currentDayLabel:(0,l.css)({color:i.tokens.colorBrandBackground,fontWeight:600}),eventCard:(0,l.css)({display:`flex`,flexDirection:`column`,alignItems:`flex-start`,zIndex:1}),eventContainer:(0,l.css)({display:`flex`,flexDirection:`column`,overflowY:`auto`,paddingTop:`5px`,paddingBottom:`5px`,paddingLeft:`5px`,paddingRight:`5px`,"::-webkit-scrollbar":{width:`5px`,height:`5px`},"::-webkit-scrollbar-track":{background:i.tokens.colorNeutralBackground4,borderRadius:`10px`},"::-webkit-scrollbar-thumb":{background:i.tokens.colorBrandStroke2Hover,borderRadius:`10px`},"::-webkit-scrollbar-thumb:hover":{background:i.tokens.colorNeutralStroke2}}),eventCardWeekView:(0,l.css)({backgroundColor:i.tokens.colorBrandBackground,color:i.tokens.colorNeutralForegroundOnBrand,borderRadius:`4px`,padding:`4px`,margin:`2px`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,height:`100%`}),popoverContent:(0,l.css)({padding:0,borderTopWidth:20,borderTopStyle:`solid`}),cardMonthTitle:(0,l.css)({display:`-webkit-box`,"-webkit-line-clamp":`1`,"-webkit-box-orient":`vertical`,textAlign:`start`,textOverflow:`ellipsis`,paddingLeft:`8px`,wordBreak:`break-word`,overflow:`hidden`})},applyEventHouverColorClass:(e,t)=>(0,l.css)({backgroundColor:e??i.tokens.colorBrandBackground,":hover":{backgroundColor:t??i.tokens.colorBrandBackgroundHover}})}),Ht=e=>{let r=(0,i.useId)(),{events:o,date:s,onCardHoverChange:c,columnHeight:l}=e,{styles:u,applyEventHouverColorClass:d}=Vt(),f=t.useRef(null),{getEventColors:p,getCalendarColors:m}=Ft(),h=t.useCallback(e=>{c&&c(!0,e)},[c]),g=t.useCallback(e=>{c&&c(!1,e)},[c]),_=t.useCallback(e=>{f.current?.setTarget(e)},[f]),v=t.useCallback((e,t,r)=>(0,n.jsx)(`div`,{ref:_,children:(0,n.jsx)(Xe,{className:(0,i.mergeClasses)(u.eventCard,d(r.backgroundColor,r.backgroundColor)),paddingTop:`4px`,paddingBottom:`4px`,paddingLeft:`8px`,paddingRight:`8px`,marginTop:e===0?`0px`:`5px`,cardHeader:(0,n.jsx)(i.Caption1,{className:u.cardMonthTitle,children:t.title}),onMouseEnter:()=>h(t.title),onMouseLeave:()=>g(t.title)})},t.id??`card-${e}`),[h,g,d]),y=t.useCallback((e,t,a)=>(0,n.jsxs)(i.Popover,{withArrow:!0,mouseLeaveDelay:30,closeOnScroll:!0,closeOnIframeFocus:!0,openOnHover:!0,children:[(0,n.jsx)(i.PopoverTrigger,{children:v(t,e,a)}),(0,n.jsx)(i.PopoverSurface,{"aria-labelledby":r,className:(0,i.mergeClasses)(u.popoverContent),children:(0,n.jsx)(Bt,{event:e})})]},t),[v,r,u.popoverContent]);return!o||!o?.length?(0,n.jsx)(n.Fragment,{children:` `}):(0,n.jsx)(`div`,{style:{height:l},className:u.eventContainer,children:o.map((e,n)=>{if(!(0,a.isWithinInterval)(s,{start:(0,a.startOfDay)(new Date(e.start)),end:(0,a.endOfDay)(new Date(e.end))}))return null;let r;r=e.hexColor?{backgroundColor:e.hexColor,hoverColor:e.hexColor}:e.color?m(e.color):p(e.category);let o=e.onRenderInMonthView?.(e),c=e.id??`event-${n}`;return t.isValidElement(o)?t.cloneElement(o,{key:c,className:(0,i.mergeClasses)(o.props.className,u.eventCard)}):e.enableOnHouver?y(e,n,r):v(n,e,r)})})},Ut=e=>{let{day:r,currentMonth:o,events:s,date:c,columnHeight:l,onDayClick:u}=e,{styles:d}=Vt(),f=new Date,[p,m]=t.useState(!1),h=t.useMemo(()=>(0,a.isSameDay)(c,f),[c,f]),g=t.useMemo(()=>(0,n.jsx)(V,{horizontal:!0,horizontalAlign:`start`,verticalAlign:`center`,paddingLeft:`m`,paddingRight:`m`,children:(0,n.jsxs)(i.Body2,{className:d.currentDayLabel,children:[r,` `,f.toLocaleString(`default`,{month:`short`})]})}),[r]),_=t.useCallback(e=>{m(e)},[]);return(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(Xe,{onClick:u?()=>u(c):void 0,className:(0,i.mergeClasses)(d.cardDay,o?``:d.otherMonthDay,h?d.currentDay:``,p?``:d.cardDayOnHover),cardHeader:h?g:(0,n.jsx)(V,{horizontal:!0,paddingLeft:`m`,paddingRight:`m`,children:(0,n.jsx)(i.Body2,{children:r})}),paddingTop:`m`,paddingBottom:`m`,paddingLeft:`0px`,paddingRight:`0px`,cardBody:(0,n.jsx)(Ht,{events:s,date:c,onCardHoverChange:_,columnHeight:l-60})})})},Wt=()=>({styles:{container:(0,l.css)({display:`flex`,flexDirection:`column`,width:`calc(100% - 40px)`,height:`100vh`,overflow:`hidden`,padding:`20px`}),header:(0,l.css)({display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:`16px`,borderBottom:`1px solid ${i.tokens.colorNeutralStroke1}`}),weekGrid:(0,l.css)({display:`grid`,gridTemplateColumns:`80px repeat(7, 1fr)`,gridTemplateRows:`50px 40px repeat(48, 33px)`,height:`fit-content`,overflowY:`auto`,border:`1px solid ${i.tokens.colorNeutralStroke1}`,maxHeight:`calc(100vh - 100px)`,scrollbarWidth:`thin`,scrollbarColor:`${i.tokens.colorBrandBackground} ${i.tokens.colorNeutralBackground1}`,"&::-webkit-scrollbar":{width:`8px`},"&::-webkit-scrollbar-track":{background:i.tokens.colorNeutralBackground1},"&::-webkit-scrollbar-thumb":{background:i.tokens.colorBrandBackground,borderRadius:`4px`},"&::-webkit-scrollbar-thumb:hover":{background:i.tokens.colorBrandBackgroundHover}}),blankHeader:(0,l.css)({gridColumn:`1`,backgroundColor:i.tokens.colorNeutralBackground3,borderBottom:`3px solid ${i.tokens.colorNeutralStroke3}`,position:`sticky`,top:0,zIndex:10}),timeColumn:(0,l.css)({gridColumn:`1`,gridRow:`3 / span 49`,display:`flex`,flexDirection:`column`,backgroundColor:i.tokens.colorNeutralBackground1,borderRight:`1px solid ${i.tokens.colorNeutralStroke1}`}),timeCell:(0,l.css)({height:`100%`,display:`flex`,alignItems:`center`,fontSize:`12px`,color:i.tokens.colorNeutralForeground3,borderBottom:`1px solid ${i.tokens.colorNeutralStroke1}`,justifyContent:`center`}),fullDayRow:(0,l.css)({gridRow:`2`,display:`grid`,gridTemplateColumns:`80px repeat(7, 1fr)`,gap:`0`,padding:`0`,backgroundColor:i.tokens.colorNeutralBackground2,borderBottom:`3px solid ${i.tokens.colorNeutralStroke2}`}),fullDayLabel:(0,l.css)({gridColumn:`1`,display:`flex`,alignItems:`center`,justifyContent:`center`,alignContent:`center`,color:i.tokens.colorBrandBackground,padding:`5px`,borderRight:`1px solid ${i.tokens.colorNeutralStroke1}`,borderBottom:`3px solid ${i.tokens.colorNeutralStroke2}`}),fullDayCell:(0,l.css)({borderRight:`1px solid ${i.tokens.colorNeutralStroke1}`,display:`flex`,flexDirection:`row`,gap:`0px`,padding:`4px`,borderBottom:`3px solid ${i.tokens.colorNeutralStroke2}`,overflow:`hidden`}),fullDayEvent:(0,l.css)({flex:`1 1 auto`,minWidth:`24px`,height:`24px`,padding:`4px 8px`,backgroundColor:i.tokens.colorBrandBackground,borderRadius:`4px`,overflow:`hidden`,display:`flex`,alignItems:`center`,justifyContent:`center`}),dayHeaderCell:(0,l.css)({textAlign:`center`,backgroundColor:i.tokens.colorNeutralBackground2,padding:`8px`,fontWeight:`bold`,borderBottom:`1px solid ${i.tokens.colorNeutralStroke1}`,position:`sticky`,top:0,zIndex:10}),todayHeaderCell:(0,l.css)({borderTop:`5px solid ${i.tokens.colorBrandBackground}`}),eventCard:(0,l.css)({padding:2,alignItems:`center`,justifyContent:`center`,marginRight:`2px`,zIndex:1,position:`absolute`,alignContent:`center`,overflow:`hidden`,":hover":{pointerEvents:`auto`,cursor:`pointer`}}),event:(0,l.css)({height:`100%`,backgroundColor:i.tokens.colorBrandBackground,borderRadius:`4px`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,overflow:`hidden`,display:`flex`,alignItems:`center`,justifyContent:`center`,marginRight:`2px`,zIndex:1,position:`absolute`,alignContent:`center`,":hover":{pointerEvents:`auto`,cursor:`pointer`}}),dayCell:(0,l.css)({borderBottom:`1px solid ${i.tokens.colorNeutralStroke1}`,borderRight:`1px solid ${i.tokens.colorNeutralStroke1}`,position:`relative`,overflow:`visible`,FlexDirection:`column`,gap:`4px`}),currentTimeIndicator:(0,l.css)({position:`absolute`,left:0,height:`2px`,backgroundColor:i.tokens.colorPaletteRedBorderActive,width:`100%`,zIndex:1}),currentHalfHourCell:(0,l.css)({border:`2px solid ${i.tokens.colorPaletteRedBorderActive}`}),eventTitle:(0,l.css)({display:`-webkit-box`,"-webkit-line-clamp":`1`,"-webkit-box-orient":`vertical`,textAlign:`start`,textOverflow:`ellipsis`,paddingLeft:`8px`,wordBreak:`break-word`,overflow:`hidden`}),popoverContent:(0,l.css)({padding:0,borderTopWidth:20,borderTopStyle:`solid`})},applyEventHouverColorClass:t.default.useCallback((e,t)=>(0,l.css)({backgroundColor:e??i.tokens.colorBrandBackground,":hover":{backgroundColor:t??i.tokens.colorBrandBackgroundHover}}),[i.tokens.colorBrandBackground,i.tokens.colorBrandBackgroundHover]),appyDynamicStyles:t.default.useCallback((e,t,n,r)=>(0,l.css)({flex:`0 0 calc(100% / ${t})`,height:`${n*r}px`,left:`${e*10}%`,width:`calc(${100-e*10}% - 8px)`,margin:4,marginTop:0,marginBottom:0}),[])}),Gt={timeSeparator:` - `,hourSuffix:`H`},Kt=({event:e,colors:r,spanSlots:a,rowHeight:o,eventIndex:s,eventCount:c,strings:l=Gt})=>{let u=(0,i.useId)(),{styles:d,applyEventHouverColorClass:f,appyDynamicStyles:p}=Wt(),m=t.useRef(null),{formatDate:h}=Ft(),g=t.useMemo(()=>(0,n.jsx)(`div`,{children:(0,n.jsxs)(V,{columnGap:4,verticalAlign:`center`,children:[(0,n.jsx)(i.Caption1Strong,{className:d.eventTitle,children:e.title}),(0,n.jsxs)(V,{columnGap:4,horizontal:!0,verticalAlign:`center`,horizontalAlign:`start`,children:[(0,n.jsxs)(i.Caption1,{children:[h(e.start,`HH:mm`),l.hourSuffix]}),l.timeSeparator,(0,n.jsxs)(i.Caption1,{children:[h(e.end,`HH:mm`),l.hourSuffix]})]})]})}),[e,h,l,d.eventTitle]);return(0,n.jsx)(i.Card,{ref:m,className:(0,i.mergeClasses)(d.eventCard,f(r.backgroundColor,r.backgroundColor),p(s,c,o,a)),children:e.enableOnHouver?(0,n.jsxs)(i.Popover,{withArrow:!0,mouseLeaveDelay:50,closeOnScroll:!0,closeOnIframeFocus:!0,openOnHover:!0,children:[(0,n.jsx)(i.PopoverTrigger,{children:g}),(0,n.jsx)(i.PopoverSurface,{"aria-labelledby":u,className:(0,i.mergeClasses)(d.popoverContent),children:(0,n.jsx)(Bt,{event:e})})]}):g},e.id)},qt=({event:e,eventCount:r,spanSlots:a,rowHeight:o,eventIndex:s,view:c})=>{let{styles:l,appyDynamicStyles:u}=Wt(),{getEventColors:d,getCalendarColors:f}=Ft(),p=e.hexColor?{backgroundColor:e.hexColor,hoverColor:e.hexColor}:e.color?f(e.color):d(e.category),m=c===`day`?e.onRenderInDayView?.(e):e.onRenderInWeekView?.(e);return t.isValidElement(m)?t.cloneElement(m,{event:e,className:(0,i.mergeClasses)(m.props.className,l.eventCard,u(s,r,o,a)),style:{...m.props.style}}):(0,n.jsx)(Kt,{event:e,colors:p,spanSlots:a,rowHeight:o,eventIndex:s,eventCount:r},e.id)},Jt=e=>{let n=(0,t.useCallback)(e=>e.map(e=>({...e,id:e.id||(0,m.v4)()})),[]),r=(0,t.useCallback)(t=>new Date(new Date(t).toLocaleString(void 0,{timeZone:e})),[e]);return{getMonthCalendar:(0,t.useCallback)((e,t,i)=>{let o=n(e),s=new Date(t,i+1,0).getDate(),c={};for(let e=1;e<=s;e++){let n=(0,a.format)(new Date(t,i,e),`yyyy-MM-dd`);c[n]=[]}return o.forEach(e=>{let t=r(e.start),n=r(e.end),i=new Date(t);for(;i<=n;){let t=(0,a.format)(i,`yyyy-MM-dd`);c[t]&&c[t].push(e),i.setDate(i.getDate()+1)}}),c},[r]),getWeekEvents:(0,t.useCallback)((e,t)=>{let i=[],o=r(t),s=n(e);for(let e=0;e<7;e++){let t=new Date(o);t.setDate(o.getDate()+e);let n=(0,a.format)(t,`yyyy-MM-dd`),c=Array.from({length:48},(e,t)=>({time:`${String(Math.floor(t/2)).padStart(2,`0`)}:${t%2==0?`00`:`30`}`,events:[]})),l=[];s.forEach(e=>{let t=r(e.start),i=r(e.end);if(e.isFullDay){(0,a.format)(t,`yyyy-MM-dd`)<=n&&(0,a.format)(i,`yyyy-MM-dd`)>=n&&l.push(e);return}if((0,a.format)(t,`yyyy-MM-dd`)<=n&&(0,a.format)(i,`yyyy-MM-dd`)>=n){let r=new Date(t);for(;r<=i;){if((0,a.format)(r,`yyyy-MM-dd`)===n){let t=r.getHours()*2+(r.getMinutes()>=30?1:0);c[t]&&c[t].events.push(e)}r.setMinutes(r.getMinutes()+30)}}}),i.push({date:n,fullDayEvents:l,timeSlots:c})}return i},[r])}},Yt=()=>({styles:{container:(0,l.css)({display:`flex`,flexDirection:`column`,width:`calc(100% - 40px)`,height:`100vh`,overflow:`hidden`,padding:`20px`}),header:(0,l.css)({display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:`16px`,borderBottom:`1px solid ${i.tokens.colorNeutralStroke1}`}),dayGrid:(0,l.css)({display:`grid`,gridTemplateColumns:`80px 1fr`,gridTemplateRows:`50px 40px repeat(48, 33px)`,height:`calc(100vh - 100px)`,overflowY:`auto`,border:`1px solid ${i.tokens.colorNeutralStroke1}`,maxHeight:`fit-content`,scrollbarWidth:`thin`,scrollbarColor:`${i.tokens.colorBrandBackground} ${i.tokens.colorNeutralBackground1}`,"&::-webkit-scrollbar":{width:`8px`},"&::-webkit-scrollbar-track":{background:i.tokens.colorNeutralBackground1},"&::-webkit-scrollbar-thumb":{background:i.tokens.colorBrandBackground,borderRadius:`4px`},"&::-webkit-scrollbar-thumb:hover":{background:i.tokens.colorBrandBackgroundHover}}),blankHeader:(0,l.css)({gridColumn:`1`,backgroundColor:i.tokens.colorNeutralBackground3,borderBottom:`3px solid ${i.tokens.colorNeutralStroke3}`}),timeColumn:(0,l.css)({gridColumn:`1`,gridRow:`3 / span 49`,display:`flex`,flexDirection:`column`,backgroundColor:i.tokens.colorNeutralBackground1,borderRight:`1px solid ${i.tokens.colorNeutralStroke1}`}),timeCell:(0,l.css)({height:`100%`,maxHeight:`32px`,minHeight:`32px`,display:`flex`,alignItems:`center`,fontSize:`12px`,color:i.tokens.colorNeutralForeground3,borderBottom:`1px solid ${i.tokens.colorNeutralStroke1}`,justifyContent:`center`}),fullDayRow:(0,l.css)({gridRow:`2`,display:`grid`,gridTemplateColumns:`80px 33px`,gap:`0`,padding:`0`,backgroundColor:i.tokens.colorNeutralBackground2,borderBottom:`3px solid ${i.tokens.colorNeutralStroke2}`}),fullDayLabel:(0,l.css)({gridColumn:`1`,display:`flex`,alignItems:`center`,justifyContent:`center`,alignContent:`center`,color:i.tokens.colorBrandBackground,padding:`5px`,borderRight:`1px solid ${i.tokens.colorNeutralStroke1}`,borderBottom:`3px solid ${i.tokens.colorNeutralStroke2}`}),fullDayCell:(0,l.css)({borderRight:`1px solid ${i.tokens.colorNeutralStroke1}`,display:`flex`,flexDirection:`row`,gap:`2px`,padding:`4px`,borderBottom:`3px solid ${i.tokens.colorNeutralStroke2}`,overflow:`hidden`}),fullDayEvent:(0,l.css)({flex:`1 1 auto`,minWidth:`24px`,height:`24px`,padding:`4px 8px`,backgroundColor:i.tokens.colorBrandBackground,color:i.tokens.colorNeutralForegroundOnBrand,borderRadius:`4px`,overflow:`hidden`,display:`flex`,alignItems:`center`,justifyContent:`center`}),dayHeaderCell:(0,l.css)({textAlign:`center`,backgroundColor:i.tokens.colorNeutralBackground2,padding:`8px`,fontWeight:`bold`,borderBottom:`1px solid ${i.tokens.colorNeutralStroke1}`}),todayHeaderCell:(0,l.css)({borderTop:`5px solid ${i.tokens.colorBrandBackground}`}),eventCard:(0,l.css)({alignItems:`center`,justifyContent:`center`,marginRight:`2px`,zIndex:1,position:`absolute`,alignContent:`center`,overflow:`hidden`}),dayCell:(0,l.css)({borderBottom:`1px solid ${i.tokens.colorNeutralStroke1}`,borderRight:`1px solid ${i.tokens.colorNeutralStroke1}`,position:`relative`,overflow:`visible`,FlexDirection:`column`,gap:`4px`}),currentTimeIndicator:(0,l.css)({position:`absolute`,left:0,height:`2px`,backgroundColor:i.tokens.colorPaletteRedBorderActive,width:`100%`,zIndex:1}),currentHalfHourCell:(0,l.css)({border:`2px solid ${i.tokens.colorPaletteRedBorderActive}`}),eventTitle:(0,l.css)({display:`-webkit-box`,"-webkit-line-clamp":`1`,"-webkit-box-orient":`vertical`,textAlign:`start`,textOverflow:`ellipsis`,paddingLeft:`8px`,wordBreak:`break-word`,overflow:`hidden`})},applyEventHouverColorClass:(e,t)=>(0,l.css)({backgroundColor:e??i.tokens.colorBrandBackground,":hover":{backgroundColor:t??i.tokens.colorBrandBackgroundHover}})}),Xt={allDay:`All Day`},Zt=33,Qt=e=>{let{events:r,currentDay:o,height:s,strings:c=Xt}=e,{styles:l}=Yt(),u=(0,t.useRef)(null),{getSpanSlots:d,getEventColors:f,getCalendarColors:p}=Ft(),m=Intl.DateTimeFormat().resolvedOptions().timeZone,{getWeekEvents:h}=Jt(m),g=t.useCallback(()=>Array.from({length:24},(e,r)=>(0,n.jsxs)(t.Fragment,{children:[(0,n.jsx)(`div`,{className:l.timeCell,children:(0,n.jsxs)(i.Body1Strong,{children:[r,`:00`]})}),(0,n.jsx)(`div`,{className:l.timeCell})]},r)),[l.timeCell]),_=t.useCallback(()=>(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:l.blankHeader}),Array.from({length:1},(e,t)=>{let r=(0,a.addDays)(o,t),s=(0,a.isToday)(r)?l.todayHeaderCell:``;return(0,n.jsxs)(`div`,{className:(0,i.mergeClasses)(l.dayHeaderCell,s),children:[(0,n.jsx)(i.Text,{weight:`semibold`,size:600,style:{paddingRight:10},children:(0,a.format)(r,`dd`)}),(0,n.jsx)(i.Subtitle1,{children:(0,a.format)(r,`LLLL, yyyy`)})]},t)})]}),[o,l.blankHeader,l.dayHeaderCell,l.todayHeaderCell]),v=t.useCallback(()=>{let e=h(r,o.toISOString());return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:l.fullDayLabel,children:(0,n.jsx)(i.Body1,{children:c.allDay})}),Array.from({length:1},(t,r)=>{let s=(0,a.format)((0,a.addDays)(o,r),`yyyy-MM-dd`),c=e.find(e=>e.date===s)?.fullDayEvents||[];return(0,n.jsx)(`div`,{className:l.fullDayCell,children:c.map(e=>(0,n.jsx)(`div`,{className:l.fullDayEvent,style:{gridColumn:`${r+2}`,backgroundColor:e.color?p(e.color).backgroundColor:f(e.category).backgroundColor},children:(0,n.jsx)(i.Caption1Strong,{className:l.eventTitle,children:e.title})},e.id))},r)})]})},[o,h,l.fullDayCell,l.fullDayEvent,l.fullDayLabel,l.eventTitle,p,f,r,c.allDay]),y=t.useCallback(()=>{let e=h(r,o.toISOString());return Array.from({length:1},(r,i)=>{let s=(0,a.format)((0,a.addDays)(o,i),`yyyy-MM-dd`),c=e.find(e=>e.date===s);return(0,n.jsx)(t.Fragment,{children:c?.timeSlots.map((e,t)=>{let r=e.events.length;return(0,n.jsx)(`div`,{className:l.dayCell,style:{gridRow:t+3},children:e.events.map((e,i)=>{let{spanSlots:a,startSlot:o}=d(new Date(e.start),new Date(e.end));return t===o?(0,n.jsx)(qt,{event:e,eventCount:r,spanSlots:a,rowHeight:Zt,eventIndex:i,view:`day`},e.id):null})},t)})},i)})},[o,d,h,l.dayCell,r]);return(0,n.jsx)(`div`,{className:l.container,style:{height:s},children:(0,n.jsxs)(`div`,{ref:u,className:l.dayGrid,children:[(0,n.jsx)(`div`,{className:l.timeColumn,children:g()}),_(),v(),y()]})})},G=function(e){return e.Day=`day`,e.Week=`week`,e.Month=`month`,e}({}),$t={month:`Month`,week:`Week`,day:`Day`},en=e=>{let{onSelected:r,value:a,strings:o=$t}=e,[s,c]=t.useState(a??G.Month),[l,u]=t.useState({view:[a??G.Month]}),f=t.useMemo(()=>(0,d.bundleIcon)(d.CalendarDayFilled,d.CalendarDayRegular),[]),p=t.useMemo(()=>(0,d.bundleIcon)(d.CalendarMonthFilled,d.CalendarMonthRegular),[]),m=t.useMemo(()=>(0,d.bundleIcon)(d.CalendarWorkWeekFilled,d.CalendarWorkWeekRegular),[]);t.useEffect(()=>{a!==void 0&&(c(a),u({view:[a]}))},[a]);let[h,g]=t.useState(!1),_=t.useCallback((e,t)=>{g(t.open)},[]),v=t.useCallback(()=>{switch(s){case G.Month:return(0,n.jsx)(p,{});case G.Week:return(0,n.jsx)(m,{});case G.Day:return(0,n.jsx)(f,{});default:return(0,n.jsx)(p,{})}},[s]),y=t.useCallback(e=>{switch(e){case G.Month:return o.month;case G.Week:return o.week;case G.Day:return o.day;default:return o.month}},[o]),b=t.useCallback((e,{name:t,checkedItems:n})=>{if(t===`view`){let e=n[0];c(e),u({view:n}),r(e)}},[r]);return(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)(i.Menu,{open:h,onOpenChange:_,children:[(0,n.jsx)(i.MenuTrigger,{disableButtonEnhancement:!0,children:(0,n.jsx)(i.MenuButton,{shape:`circular`,icon:v(),style:{minWidth:`150px`},children:y(s)})}),(0,n.jsx)(i.MenuPopover,{children:(0,n.jsxs)(i.MenuList,{onCheckedValueChange:b,checkedValues:l,children:[(0,n.jsx)(i.MenuItemRadio,{icon:(0,n.jsx)(f,{}),name:`view`,value:G.Day,children:o.day}),(0,n.jsx)(i.MenuItemRadio,{icon:(0,n.jsx)(m,{}),name:`view`,value:G.Week,children:o.week}),(0,n.jsx)(i.MenuItemRadio,{icon:(0,n.jsx)(p,{}),name:`view`,value:G.Month,children:o.month})]})})]})})},tn=t.memo(e=>{let{onSelected:a,value:o}=e,[s,c]=t.useState(o??new Date),[l,u]=t.useState(()=>(0,r.format)(o??new Date,`dd MMM, yyyy`)),[f,p]=t.useState(!1),m=t.useCallback((e,t)=>{p(t.open)},[]),g=t.useMemo(()=>(0,d.bundleIcon)(d.CalendarMonthFilled,d.CalendarMonthRegular),[]),_=t.useCallback(e=>{if(e){let t=Intl.DateTimeFormat().resolvedOptions().timeZone,n=(0,r.utcToZonedTime)(e,t);c(n),u((0,r.format)(n,`dd MMM, yyyy`)),a(n),p(!1)}},[a]);return(0,n.jsxs)(i.Menu,{open:f,onOpenChange:m,children:[(0,n.jsx)(i.MenuTrigger,{disableButtonEnhancement:!0,children:(0,n.jsx)(i.MenuButton,{shape:`circular`,icon:(0,n.jsx)(g,{}),style:{minWidth:`200px`},"aria-label":`Select date: ${l}`,children:l})}),(0,n.jsx)(i.MenuPopover,{style:{maxWidth:`fit-content`},children:(0,n.jsx)(i.MenuList,{children:(0,n.jsx)(h.Calendar,{highlightSelectedMonth:!0,showGoToToday:!0,onSelectDate:_,value:s})})})]})}),nn=()=>({root:(0,l.css)({outline:`none`})}),rn={months:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],shortMonths:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],days:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],shortDays:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],goToToday:`Go to today`},an=e=>{let{onDateChange:r,defaultSelectedDate:i,onDismiss:a,strings:o=rn}=e,s=nn(),[c,l]=t.useState(i??new Date),u=t.useCallback((e,t)=>{l(e),r(e),a()},[r,a]);return(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(h.Calendar,{className:s.root,dateRangeType:h.DateRangeType.Month,highlightSelectedMonth:!0,isDayPickerVisible:!1,onSelectDate:u,value:c,onDismiss:a,showGoToToday:!1,allFocusable:!1,strings:o})})},on=e=>{let{onSelected:r,value:o}=e,s=(0,d.bundleIcon)(d.CalendarMonthFilled,d.CalendarMonthRegular),[c,l]=t.useState(o??new Date);t.useEffect(()=>{r(o??new Date),l(o??new Date)},[o]);let[u,f]=t.useState(!1),p=(e,t)=>{f(t.open)},m=t.useCallback(e=>{r(e),l(e)},[]);return(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)(i.Menu,{open:u,onOpenChange:p,children:[(0,n.jsx)(i.MenuTrigger,{disableButtonEnhancement:!0,children:(0,n.jsx)(i.MenuButton,{shape:`circular`,icon:(0,n.jsx)(s,{}),style:{minWidth:`200px`},"aria-label":`Select month: ${(0,a.format)(c,`MMMM yyyy`)}`,children:(0,a.format)(c,`MMMM yyyy`)})}),(0,n.jsx)(i.MenuPopover,{children:(0,n.jsx)(i.MenuList,{children:(0,n.jsx)(an,{onDateChange:m,defaultSelectedDate:c,onDismiss:()=>{f(!1)}})})})]})})},sn={selectWeekPlaceholder:`Select a week`},cn=e=>{let t=Intl.DateTimeFormat().resolvedOptions().timeZone,n=(0,r.format)(e.start,`MMM`,{timeZone:t}),i=(0,r.format)(e.end,`MMM`,{timeZone:t});return(0,r.format)(e.start,`yyyy`,{timeZone:t})===(0,r.format)(e.end,`yyyy`,{timeZone:t})?n===i?`${(0,r.format)(e.start,`dd`,{timeZone:t})} - ${(0,r.format)(e.end,`dd MMM yyyy`,{timeZone:t})}`:`${(0,r.format)(e.start,`dd MMM`,{timeZone:t})} - ${(0,r.format)(e.end,`dd MMM yyyy`,{timeZone:t})}`:`${(0,r.format)(e.start,`dd MMM yyyy`,{timeZone:t})} - ${(0,r.format)(e.end,`dd MMM yyyy`,{timeZone:t})}`},ln=e=>{let t=Intl.DateTimeFormat().resolvedOptions().timeZone,n=(0,r.utcToZonedTime)(e,t),i=new Date(n);i.setDate(n.getDate()-n.getDay());let a=new Date(i);return a.setDate(i.getDate()+6),{start:(0,r.utcToZonedTime)(i,t),end:(0,r.utcToZonedTime)(a,t)}},un=t.memo(e=>{let{onSelected:r,value:a,strings:o=sn}=e,s=h.DateRangeType.Week,[c,l]=t.useState(a??new Date),[u,f]=t.useState(()=>{let e=a??new Date;return e?cn(ln(e)):o.selectWeekPlaceholder}),[p,m]=t.useState(!1),g=t.useCallback((e,t)=>{m(t.open)},[]),_=t.useMemo(()=>(0,d.bundleIcon)(d.CalendarMonthFilled,d.CalendarMonthRegular),[]),v=t.useCallback(e=>{if(e){l(e);let t=ln(e);f(cn(t)),r({startDate:t.start,endDate:t.end}),m(!1)}},[r]),y=t.useMemo(()=>0,[]);return(0,n.jsxs)(i.Menu,{open:p,onOpenChange:g,children:[(0,n.jsx)(i.MenuTrigger,{disableButtonEnhancement:!0,children:(0,n.jsx)(i.MenuButton,{shape:`circular`,icon:(0,n.jsx)(_,{}),style:{minWidth:`200px`},"aria-label":`Select week: ${u}`,children:u})}),(0,n.jsx)(i.MenuPopover,{style:{maxWidth:`fit-content`},children:(0,n.jsx)(i.MenuList,{children:(0,n.jsx)(h.Calendar,{dateRangeType:s,highlightSelectedMonth:!0,showGoToToday:!0,onSelectDate:v,value:c,firstDayOfWeek:y})})})]})}),dn={today:`Today`,previous:`Previous`,next:`Next`},fn=t.memo(({selectedView:e,onSelectedView:r,currentDate:a,setCurrentDate:o,onWeekChange:s,onMonthChange:c,onDayChange:l,strings:u=dn})=>{let f=t.useMemo(()=>(0,d.bundleIcon)(d.ArrowDownFilled,d.ArrowDownRegular),[]),p=t.useMemo(()=>(0,d.bundleIcon)(d.ArrowUpFilled,d.ArrowUpRegular),[]),m=t.useCallback(e=>{s(e.startDate),o(e.startDate)},[s,o]),h=t.useCallback(e=>{c(e),o(e)},[c,o]),g=t.useCallback(e=>{l(e),o(e)},[l,o]),_=t.useCallback(()=>{switch(e){case G.Month:return(0,n.jsx)(on,{onSelected:h,value:a});case G.Week:return(0,n.jsx)(un,{onSelected:m,value:a});case G.Day:return(0,n.jsx)(tn,{onSelected:g,value:a});default:return(0,n.jsx)(on,{onSelected:h,value:a})}},[e,h,m,g,a]),v=t.useCallback(()=>(0,n.jsx)(i.Tooltip,{content:u.today,relationship:`label`,children:(0,n.jsx)(i.Button,{shape:`circular`,icon:(0,n.jsx)(d.CalendarTodayRegular,{}),size:`medium`,onClick:()=>l(new Date),children:u.today})}),[l,u.today]),y=t.useCallback(t=>{let n=new Date(a);switch(e){case G.Month:n.setMonth(n.getMonth()+t),c(n);break;case G.Week:n.setDate(n.getDate()+t*7),s(n);break;case G.Day:n.setDate(n.getDate()+t),l(n);break;default:break}o(n)},[a,e,c,s,l,o]);return(0,n.jsxs)(V,{width:`calc(100% - 40px)`,height:`fit-content`,horizontal:!0,horizontalAlign:`space-between`,verticalAlign:`center`,paddingLeft:`20px`,paddingRight:`20px`,paddingBottom:`10px`,paddingTop:`10px`,columnGap:10,styles:{overflow:`hidden`},children:[(0,n.jsxs)(V,{horizontal:!0,horizontalAlign:`start`,verticalAlign:`center`,columnGap:10,children:[(0,n.jsx)(v,{}),(0,n.jsx)(_,{}),(0,n.jsx)(i.Tooltip,{content:u.previous,relationship:`label`,children:(0,n.jsx)(i.Button,{size:`medium`,icon:(0,n.jsx)(p,{fontSize:14}),onClick:()=>y(-1)})}),(0,n.jsx)(i.Tooltip,{content:u.next,relationship:`label`,children:(0,n.jsx)(i.Button,{size:`medium`,icon:(0,n.jsx)(f,{fontSize:14}),onClick:()=>y(1)})})]}),(0,n.jsx)(V,{horizontal:!0,horizontalAlign:`start`,verticalAlign:`center`,columnGap:10,children:(0,n.jsx)(en,{onSelected:r,value:e})})]})}),pn={allDay:`All Day`},mn=e=>{let{events:r,currentDay:o,height:s,strings:l=pn}=e,{styles:u}=Wt(),[d]=(0,t.useState)(o),[f,p]=(0,t.useState)(32),m=(0,t.useRef)(null),{getSpanSlots:h,getEventColors:g,getCalendarColors:_,formatDate:v}=Ft(),y=(0,a.startOfWeek)(d,{weekStartsOn:0}),b=Intl.DateTimeFormat().resolvedOptions().timeZone,{getWeekEvents:x}=Jt(b);(0,t.useEffect)(()=>{let e=new c.ResizeObserver(()=>{if(m.current){let e=m.current.querySelector(`.dayCell`);e&&p(e.offsetHeight)}});return m.current&&e.observe(m.current),()=>{e.disconnect()}},[]);let S=t.useCallback(()=>Array.from({length:24},(e,r)=>(0,n.jsxs)(t.Fragment,{children:[(0,n.jsx)(`div`,{className:u.timeCell,children:(0,n.jsxs)(i.Body1Strong,{children:[r,`:00`]})}),(0,n.jsx)(`div`,{className:u.timeCell})]},r)),[u.timeCell]),C=t.useCallback(()=>(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:u.blankHeader}),Array.from({length:7},(e,t)=>{let r=(0,a.addDays)(y,t),o=(0,a.isToday)(r)?u.todayHeaderCell:``;return(0,n.jsxs)(`div`,{className:(0,i.mergeClasses)(u.dayHeaderCell,o),children:[(0,n.jsx)(i.Text,{weight:`regular`,size:600,style:{paddingRight:10},children:v(r.toISOString(),`dd`)}),(0,n.jsx)(i.Body1,{children:v(r.toISOString(),`EEE`)})]},t)})]}),[y,u,v]),w=t.useCallback(()=>{let e=x(r,y.toISOString());return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:u.fullDayLabel,children:(0,n.jsx)(i.Body1,{children:l.allDay})}),Array.from({length:7},(t,r)=>{let o=v((0,a.addDays)(y,r).toISOString(),`yyyy-MM-dd`),s=e.find(e=>e.date===o)?.fullDayEvents||[];return(0,n.jsx)(`div`,{className:u.fullDayCell,children:s.map(e=>(0,n.jsx)(`div`,{className:u.fullDayEvent,style:{gridColumn:`${r+2}`,backgroundColor:e.color?_(e.color).backgroundColor:g(e.category).backgroundColor},children:(0,n.jsx)(i.Caption1Strong,{className:u.eventTitle,children:e.title})},e.id))},r)})]})},[y,u,x,_,g,r,v,l.allDay]),T=t.useCallback(()=>{let e=x(r,y.toISOString());return Array.from({length:7},(t,r)=>{let i=(0,a.format)((0,a.addDays)(y,r),`yyyy-MM-dd`);return(0,n.jsx)(n.Fragment,{children:e.find(e=>e.date===i)?.timeSlots.map((e,t)=>{let r=e.events.length;return(0,n.jsx)(`div`,{className:u.dayCell,style:{gridRow:t+3},children:e.events.map((e,i)=>{let{spanSlots:a,startSlot:o}=h(new Date(e.start),new Date(e.end));return t===o?(0,n.jsx)(qt,{event:e,eventCount:r,spanSlots:a,rowHeight:f,eventIndex:i,view:`week`},e.id):null})},t)})})})},[y,u,x,h,f,r]);return(0,n.jsx)(`div`,{className:u.container,style:{height:s},children:(0,n.jsxs)(`div`,{ref:m,className:u.weekGrid,children:[(0,n.jsx)(`div`,{className:u.timeColumn,children:S()}),C(),w(),T()]})})},hn={daysOfWeek:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},gn=({currentDate:e,rowHeight:t,getCalendarDays:r,getEventsForDay:a,styles:o,onDaySlotClick:s,height:c,calendarRef:l,strings:u})=>{let d=u?.daysOfWeek||hn.daysOfWeek;return(0,n.jsx)(V,{height:c,width:`100%`,verticalAlign:`start`,horizontalAlign:`start`,children:(0,n.jsxs)(`div`,{className:o.calendarWrapper,ref:l,role:`grid`,"aria-label":`Calendar`,children:[d.map(e=>(0,n.jsx)(i.Body1,{className:o.dayHeader,role:`columnheader`,children:e},e)),r(e).map((e,r)=>{let{day:i,currentMonth:o}=e,c=o?a(e):[];return(0,n.jsx)(Ut,{day:i,date:e.date,currentMonth:e.currentMonth,events:c,columnHeight:t||0,onDayClick:s},r)})]})})},_n=t.memo(({events:e,currentDay:t,height:r,strings:i})=>(0,n.jsx)(mn,{events:e,currentDay:t,height:r,strings:i})),vn=t.memo(({events:e,currentDay:t,height:r,strings:i})=>(0,n.jsx)(Qt,{currentDay:t,events:e,height:r,strings:i})),yn=({events:e,height:r=800,theme:o,onDayChange:s,onMonthChange:l,onWeekChange:u,onViewChange:d,onDaySlotClick:f,defaultView:p,strings:m})=>{let{styles:h}=Vt(),g=(0,t.useRef)(null),[_,v]=(0,t.useState)(null),y=(0,t.useRef)(0),[b,x]=(0,t.useState)(new Date),[S,C]=(0,t.useState)(p??G.Month),{getMonthCalendar:w}=Jt(Intl.DateTimeFormat().resolvedOptions().timeZone),T=t.useCallback(e=>{let t=e.getMonth(),n=(0,a.startOfWeek)((0,a.startOfMonth)(e));return Array.from({length:42},(e,r)=>{let i=(0,a.addDays)(n,r);return{day:i.getDate(),currentMonth:i.getMonth()===t,date:i}})},[42]),E=t.useCallback(e=>{l&&l(e),x(e)},[l]),D=t.useCallback(e=>{s&&s(e),x(e)},[s]),O=t.useCallback(e=>{u&&u(e),x(e)},[u]),k=t.useCallback(e=>{d&&d(e),C(e)},[d]),A=t.useCallback(t=>{let{date:n}=t;return w(e,b.getFullYear(),b.getMonth())[(0,a.format)(n,`yyyy-MM-dd`)]?.flatMap(e=>e)||[]},[b,e]),j=t.useCallback(()=>{g.current&&requestAnimationFrame(()=>{if(g.current){let e=g.current.querySelector(`.${h.calendarWrapper} > div:nth-child(8)`);e&&(v(e.offsetHeight),y.current=e.offsetHeight)}})},[h.calendarWrapper]);(0,t.useEffect)(()=>{let e=new c.ResizeObserver(j);return g.current&&e.observe(g.current),j(),window.addEventListener(`resize`,j),()=>{e.disconnect(),window.removeEventListener(`resize`,j)}},[j,S]),(0,t.useEffect)(()=>{C(p||G.Month)},[p]);let M=t.useCallback(()=>{switch(S){case G.Month:return(0,n.jsx)(gn,{events:e,currentDate:b,rowHeight:_,getCalendarDays:T,getEventsForDay:A,styles:h,onDaySlotClick:f,height:r,calendarRef:g,strings:m?.calendarControl});case G.Week:return(0,n.jsx)(_n,{events:e,currentDay:b,height:r,strings:m?.weekView});case G.Day:return(0,n.jsx)(vn,{events:e,currentDay:b,height:r,strings:m?.dayView});default:return(0,n.jsx)(gn,{events:e,currentDate:b,rowHeight:_,getCalendarDays:T,getEventsForDay:A,styles:h,onDaySlotClick:f,height:r,calendarRef:g,strings:m?.calendarControl})}},[S,e,b,_,T,A,h,f,r]),N=(0,n.jsxs)(V,{height:`100%`,verticalAlign:`start`,children:[(0,n.jsx)(fn,{selectedView:S,onSelectedView:k,currentDate:b,setCurrentDate:x,onWeekChange:O,onMonthChange:E,onDayChange:D,strings:m?.toolbar}),(0,n.jsx)(M,{})]});return(0,n.jsx)(i.IdPrefixProvider,{value:`calendarControl-`,children:o?(0,n.jsx)(i.FluentProvider,{theme:o,applyStylesToPortals:!0,style:{width:`100%`},children:N}):(0,n.jsx)(`div`,{style:{width:`100%`},children:N})})},bn=()=>({styles:{root:(0,l.css)({containerType:`inline-size`}),header:(0,l.css)({borderBottom:`1px solid ${i.tokens.colorNeutralStroke2}`}),headerBackButton:(0,l.css)({fontSize:`clamp(6px, 3.5cqw, 22px)`}),headerLabel:(0,l.css)({textTransform:`capitalize`}),calendar:(0,l.css)({borderBottom:`1px solid ${i.tokens.colorNeutralStroke2}`}),weekdaysCorner:(0,l.css)({flex:`0 0 32px`}),weekday:(0,l.css)({flex:`1 1 calc(100% / 7)`,maxWidth:`calc(100% / 7)`,textAlign:`center`,textTransform:`capitalize`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`default`,userSelect:`none`,paddingBlock:`4px`,boxSizing:`border-box`}),weekNumber:(0,l.css)({flex:`0 0 28px`,marginInlineEnd:`4px`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`default`,userSelect:`none`}),day:(0,l.css)({flex:`1 1 calc(100% / 7)`,maxWidth:`calc(100% / 7)`,height:`48px`,minWidth:`0 !important`,padding:`4px !important`,fontWeight:500,fontSize:`clamp(6px, 3.5cqw, 22px)`,color:`${i.tokens.colorNeutralForeground1} !important`,cursor:`pointer`,userSelect:`none`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,position:`relative`,zIndex:0,borderRadius:0,"::before":{width:`32px`,height:`32px`,borderRadius:`100%`,content:`""`,position:`absolute`,top:`7px`,left:`calc(50% - 16px)`,zIndex:-1,pointerEvents:`none`},":focus-visible":{zIndex:1,outline:`2px solid ${i.tokens.colorBrandStroke1}`,outlineOffset:`-2px`,borderRadius:i.tokens.borderRadiusMedium},":hover::before":{backgroundColor:i.tokens.colorNeutralBackground1Hover}}),dayHidden:(0,l.css)({visibility:`hidden`,pointerEvents:`none`}),dayWeekend:(0,l.css)({color:`${i.tokens.colorPaletteRedForeground1} !important`}),dayOutside:(0,l.css)({color:`${i.tokens.colorNeutralForeground3} !important`}),dayToday:(0,l.css)({"::before":{backgroundColor:i.tokens.colorNeutralBackground3}}),daySelected:(0,l.css)({color:`${i.tokens.colorNeutralForegroundOnBrand} !important`,"::before":{backgroundColor:i.tokens.colorBrandBackground},":hover::before":{backgroundColor:i.tokens.colorBrandBackgroundHover}}),dayIndicators:(0,l.css)({position:`absolute`,bottom:`2px`,insetInline:0,paddingInlineStart:`2px`}),dayIndicator:(0,l.css)({width:`5px`,height:`5px`,borderRadius:`100%`,marginInlineStart:`-1px`}),eventsList:(0,l.css)({flex:1,minHeight:0,overflowY:`auto`}),eventsHeader:(0,l.css)({textTransform:`capitalize`}),event:(0,l.css)({cursor:`pointer`,borderBottom:`1px solid ${i.tokens.colorNeutralStroke2}`,padding:`0 !important`,borderRadius:0,boxShadow:`none`,":last-child":{borderBottom:`none`},":hover":{backgroundColor:i.tokens.colorNeutralBackground1Hover},":focus-visible":{outline:`2px solid ${i.tokens.colorBrandStroke1}`,outlineOffset:`-2px`,borderRadius:i.tokens.borderRadiusMedium}}),eventColor:(0,l.css)({width:`4px`,borderRadius:`2px`,flexShrink:0,alignSelf:`stretch`}),eventTimeColor:i.tokens.colorNeutralForeground3}}),xn=e=>(0,a.getISOWeek)(e[0]),Sn=t.memo(e=>{let{weeks:r,date:o,selectedDate:s,today:c,orderedShortDays:l,groupedEvents:u,weekendDays:d,highlightToday:f,withOutsideDays:p,withWeekNumbers:m,onDayClick:h,getEventColor:g,locale:_}=e,{styles:v}=bn(),y=t.useRef([]),b=t.useRef(null);b.current=null;let x=t.useCallback((e,t,n)=>{let r=e,i=t;switch(n.key){case`ArrowRight`:i+=1,i>=7&&(i=0,r+=1);break;case`ArrowLeft`:--i,i<0&&(i=6,--r);break;case`ArrowDown`:r+=1;break;case`ArrowUp`:--r;break;default:return}n.preventDefault();let a=y.current[r]?.[i];a&&a instanceof HTMLElement&&a.focus()},[]),S=t.useMemo(()=>(0,n.jsxs)(U,{direction:`horizontal`,marginBottom:i.tokens.spacingVerticalXS,children:[m&&(0,n.jsx)(`div`,{className:v.weekdaysCorner}),l.map((e,t)=>(0,n.jsx)(Dt,{as:`span`,fontSize:i.tokens.fontSizeBase200,fontWeight:`semibold`,color:i.tokens.colorNeutralForeground3,className:v.weekday,style:{textAlign:`center`,width:`100%`},children:e},t))]}),[l,m,v.weekdaysCorner,v.weekday]),C=t.useMemo(()=>r.map((e,t)=>{let r=e.map((e,r)=>{let l=!(0,a.isSameMonth)(e,o),m=d.includes((0,a.getDay)(e)),S=(0,a.isSameDay)(e,c)&&f,C=s?(0,a.isSameDay)(e,s):!1,w=u[(0,a.format)(e,`yyyy-MM-dd`)]||[],T=p||!l;T&&b.current===null&&(b.current={weekIndex:t,dayIndex:r});let E=b.current?.weekIndex===t&&b.current?.dayIndex===r,D=w.slice(0,3).map(e=>(0,n.jsx)(`div`,{className:v.dayIndicator,style:{backgroundColor:g(e)}},e.id));return(0,n.jsxs)(i.Button,{appearance:`transparent`,className:(0,i.mergeClasses)(v.day,!T&&v.dayHidden,l&&T&&!C&&!m&&v.dayOutside,m&&T&&!C&&v.dayWeekend,S&&!C&&v.dayToday,C&&v.daySelected),"aria-label":(0,a.format)(e,`MMMM d, yyyy`,{locale:_}),"aria-selected":C||void 0,tabIndex:T&&E?0:-1,onClick:T?()=>h(e):void 0,onKeyDown:T?e=>x(t,r,e):void 0,ref:e=>{y.current[t]||(y.current[t]=[]),y.current[t][r]=e},children:[T?e.getDate():null,T&&(0,n.jsx)(U,{direction:`horizontal`,justifyContent:`center`,className:v.dayIndicators,children:D})]},e.toISOString())}),l=xn(e);return(0,n.jsxs)(U,{direction:`horizontal`,children:[m&&(0,n.jsx)(Dt,{fontSize:`xs`,color:i.tokens.colorNeutralForeground3,className:v.weekNumber,children:l}),r]},t)}),[r,o,s,c,d,f,p,m,u,g,h,x,v,_]);return(0,n.jsxs)(U,{direction:`vertical`,padding:i.tokens.spacingVerticalS,className:v.calendar,children:[S,C]})}),Cn=t.memo(e=>{let{date:r,renderHeader:o,onYearClick:s,locale:c}=e,{styles:l}=bn(),u=(0,a.format)(r,`MMMM yyyy`,{locale:c}),f=t.useMemo(()=>(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(i.Button,{appearance:`subtle`,className:l.headerBackButton,onClick:s,icon:(0,n.jsx)(d.ChevronRight20Regular,{style:{transform:`rotate(90deg)`}}),children:(0,a.format)(r,`yyyy`)}),(0,n.jsx)(Dt,{fontWeight:`bold`,className:l.headerLabel,children:u})]}),[r,s,l]),p=t.useMemo(()=>typeof o==`function`?o({date:r,defaultHeader:f}):f,[o,r,f]);return(0,n.jsx)(U,{direction:`horizontal`,alignItems:`center`,justifyContent:`space-between`,padding:i.tokens.spacingVerticalS,className:l.header,children:p})}),wn=e=>{let{events:r,header:o,allDayLabel:s,noEventsLabel:c,onEventClick:l,renderEvent:u,getEventColor:d,locale:f}=e,{styles:p}=bn(),m=t.useCallback(e=>{let t=(0,a.format)(new Date(e.start),`p`,{locale:f}),r=(0,a.format)(new Date(e.end),`p`,{locale:f}),o=e.isFullDay||t===`00:00`&&r===`00:00`;return(0,n.jsx)(Xe,{className:p.event,onClick:t=>l?.(e,t),cardBody:(0,n.jsxs)(U,{direction:`horizontal`,gap:`s`,paddingTop:i.tokens.spacingVerticalXS,paddingBottom:i.tokens.spacingVerticalXS,children:[(0,n.jsx)(`div`,{className:p.eventColor,style:{backgroundColor:d(e)}}),(0,n.jsxs)(U,{direction:`vertical`,children:[(0,n.jsx)(Dt,{as:`span`,fontWeight:`semibold`,fontSize:`s`,children:e.title}),(0,n.jsx)(Dt,{as:`span`,fontSize:`xs`,color:p.eventTimeColor,children:o?s:`${t} – ${r}`})]})]})},e.id)},[s,d,l,p]);return(0,n.jsxs)(U,{direction:`vertical`,padding:i.tokens.spacingVerticalS,className:p.eventsList,children:[(0,n.jsx)(Dt,{as:`span`,fontWeight:`bold`,marginBottom:i.tokens.spacingVerticalS,className:p.eventsHeader,children:o}),(0,n.jsx)(U,{direction:`vertical`,gap:`s`,style:{backgroundColor:`transparent`},padding:`s`,children:r.length>0?r.map(e=>u?u(e,m(e)):m(e)):(0,n.jsx)(Dt,{block:!0,color:i.tokens.colorNeutralForeground3,paddingTop:i.tokens.spacingVerticalXXL,paddingBottom:i.tokens.spacingVerticalXXL,style:{textAlign:`center`},children:c})})]})},Tn=e=>{let t=(0,a.startOfDay)(new Date(e.start)),n=(0,a.startOfDay)(new Date(e.end));return t.getTime()!==n.getTime()},En=(e,t)=>{if(Tn(e)){let n=(0,a.startOfDay)(new Date(e.start)),r=(0,a.startOfDay)(new Date(e.end)),i=n;for(;(0,a.isBefore)(i,r)||(0,a.isEqual)(i,r);){let n=(0,a.format)(i,`yyyy-MM-dd`);t[n]||(t[n]=[]),t[n].push(e),i=(0,a.addDays)(i,1)}return}let n=(0,a.format)(new Date(e.start),`yyyy-MM-dd`);t[n]||(t[n]=[]),t[n].push(e)},Dn=(e,t)=>{let n={};if(!t)return n;let r=new Set;for(let i of t)if((0,a.isSameMonth)(new Date(i.start),e)){if(r.has(i.id)){console.warn(`[CompactCalendar] Duplicate event id found: ${i.id}`);continue}r.add(i.id),En(i,n)}return n},On=(e,n)=>(0,t.useMemo)(()=>Dn(e,n),[e,n]),kn={en:o.enUS,"en-US":o.enUS,"en-us":o.enUS,ar:o.ar,"ar-SA":o.arSA,"ar-sa":o.arSA,az:o.az,"az-AZ":o.az,bg:o.bg,"bg-BG":o.bg,bs:o.bs,"bs-BA":o.bs,ca:o.ca,"ca-ES":o.ca,cs:o.cs,"cs-CZ":o.cs,cy:o.cy,da:o.da,"da-DK":o.da,de:o.de,"de-DE":o.de,el:o.el,"el-GR":o.el,es:o.es,"es-ES":o.es,et:o.et,"et-EE":o.et,eu:o.eu,fi:o.fi,"fi-FI":o.fi,fr:o.fr,"fr-FR":o.fr,gl:o.gl,he:o.he,"he-IL":o.he,hi:o.hi,"hi-IN":o.hi,hr:o.hr,"hr-HR":o.hr,hu:o.hu,"hu-HU":o.hu,id:o.id,"id-ID":o.id,it:o.it,"it-IT":o.it,ja:o.ja,"ja-JP":o.ja,kk:o.kk,"kk-KZ":o.kk,ko:o.ko,"ko-KR":o.ko,lt:o.lt,"lt-LT":o.lt,lv:o.lv,"lv-LV":o.lv,mk:o.mk,"mk-MK":o.mk,ms:o.ms,"ms-MY":o.ms,nb:o.nb,"nb-NO":o.nb,nl:o.nl,"nl-NL":o.nl,pl:o.pl,"pl-PL":o.pl,pt:o.pt,"pt-PT":o.pt,"pt-BR":o.ptBR,ro:o.ro,"ro-RO":o.ro,ru:o.ru,"ru-RU":o.ru,sk:o.sk,"sk-SK":o.sk,sl:o.sl,"sl-SI":o.sl,sr:o.sr,"sr-RS":o.sr,sv:o.sv,"sv-SE":o.sv,th:o.th,"th-TH":o.th,tr:o.tr,"tr-TR":o.tr,uk:o.uk,"uk-UA":o.uk,vi:o.vi,"vi-VN":o.vi,zh:o.zhCN,"zh-CN":o.zhCN};function An(e){return e?typeof e==`object`&&e?e:kn[e]||(kn[e.split(`-`)[0].toLowerCase()]??o.enUS):o.enUS}var jn=[0,6],Mn=(e,t,n)=>{let r=(0,a.startOfMonth)(e),i=(0,a.getDay)(r),o=(0,a.getDaysInMonth)(e),s=(i-t+7)%7,c=(0,a.subDays)(r,s),l=n?42:Math.ceil((s+o)/7)*7,u=[],d=c;for(let e=0;e<l;e++){let t=Math.floor(e/7);u[t]||(u[t]=[]),u[t].push(d),d=(0,a.addDays)(d,1)}return u},Nn=r=>{let{date:o,selectedDate:s,defaultSelectedDate:c,onSelectedDateChange:l,withWeekNumbers:u=!1,firstDayOfWeek:d=1,weekendDays:f=jn,consistentWeeks:p=!0,highlightToday:m=!0,withOutsideDays:h=!1,events:g,onDayClick:_,onEventClick:v,onYearClick:y,renderHeader:b,renderEvent:x,eventsHeaderFormat:S=`EEEE, MMMM d`,locale:C,height:w,className:T,strings:E}=r,{styles:D}=bn(),{getCalendarColors:O}=Ft(),k=e.s(),A=e.m(),j=t.useMemo(()=>An(C??A?.locale),[C,A?.locale]),[M,N]=t.useState(c??new Date),P=s===void 0?M:s,F=t.useCallback(e=>{s===void 0&&N(e),l?.(e)},[s,l]),I=t.useMemo(()=>new Date,[]),L=On(o,g),R=E?.shortDays??k.shortDays,z=t.useMemo(()=>{let e=[];for(let t=0;t<7;t++)e.push(R[(d+t)%7]);return e},[R,d]),ee=t.useMemo(()=>Mn(o,d,p),[o,d,p]),te=t.useCallback(e=>e.hexColor?e.hexColor:e.color?O(e.color).backgroundColor:O(`royal-blue`).backgroundColor,[O]),ne=t.useCallback(e=>{F(e),_?.(e)},[F,_]),re=P?(0,a.format)(P,`yyyy-MM-dd`):``,B=re?(L[re]||[]).sort((e,t)=>new Date(e.start).getTime()-new Date(t.start).getTime()):[],ie=P?(0,a.format)(P,S,{locale:j}):``;return(0,n.jsxs)(U,{direction:`vertical`,height:w??`100%`,className:(0,i.mergeClasses)(D.root,T),children:[(0,n.jsx)(Cn,{date:o,renderHeader:b,onYearClick:y,locale:j}),(0,n.jsx)(Sn,{weeks:ee,date:o,selectedDate:P,today:I,orderedShortDays:z,groupedEvents:L,weekendDays:f,highlightToday:m,withOutsideDays:h,withWeekNumbers:u,onDayClick:ne,getEventColor:te,locale:j}),(0,n.jsx)(wn,{events:B,header:ie,allDayLabel:E?.allDay??k.allDay,noEventsLabel:E?.noEvents??k.noEvents,onEventClick:v,renderEvent:x,getEventColor:te,locale:j})]})},Pn=(0,g.atom)(!1),Fn=(0,g.atom)(-1),In=(0,g.atom)(``),Ln=(0,g.atom)(``),Rn=(0,g.atom)(new Set),zn=(0,g.atom)(!0),Bn=(0,g.atom)(void 0);function Vn(){return(0,g.createStore)()}var Hn=Vn();function Un(e){return{opened:e.get(Pn),selected:e.get(Fn),listId:e.get(In),query:e.get(Ln),registeredActions:e.get(Rn)}}var K={open(e){e.set(Pn,!0),e.set(Fn,-1)},close(e){e.set(Pn,!1)},toggle(e){e.get(Pn)?e.set(Pn,!1):(e.set(Pn,!0),e.set(Fn,-1))},setQuery(e,t){t.get(Bn)?.(e),t.set(Ln,e),Promise.resolve().then(()=>{K.selectAction(0,t)})},setListId(e,t){t.set(In,e)},selectAction(e,t){let n=t.get(In),r=n?document.getElementById(n):null,i=r?.querySelector(`[data-spotlight-selected]`),a=r?.querySelectorAll(`[data-spotlight-action]`)??[];if(a.length===0)return t.set(Fn,-1),-1;let o=e<0?a.length-1:e>=a.length?0:e,s=Math.max(0,Math.min(o,a.length-1));return i?.removeAttribute(`data-spotlight-selected`),a[s]?.scrollIntoView({block:`nearest`}),a[s]?.setAttribute(`data-spotlight-selected`,`true`),t.set(Fn,s),s},selectNextAction(e){return K.selectAction(e.get(Fn)+1,e)},selectPreviousAction(e){return K.selectAction(e.get(Fn)-1,e)},triggerSelectedAction(e){let t=e.get(In);(t?document.querySelector(`#${t} [data-spotlight-selected]`):null)?.click()},clearState(e,t){t.set(Fn,-1),e.clearQuery&&t.set(Ln,``)}},Wn={open:()=>K.open(Hn),close:()=>K.close(Hn),toggle:()=>K.toggle(Hn)},Gn=Wn.open,Kn=Wn.close,qn=Wn.toggle;function Jn(){let e=Vn();return[e,{open:()=>K.open(e),close:()=>K.close(e),toggle:()=>K.toggle(e)}]}function Yn(e=Hn){let[n,r]=(0,t.useState)(()=>Un(e));return(0,t.useEffect)(()=>{let t=()=>r(Un(e)),n=[e.sub(Pn,t),e.sub(Fn,t),e.sub(In,t),e.sub(Ln,t),e.sub(Rn,t)];return t(),()=>n.forEach(e=>e())},[e]),n}function Xn(e){let t=e.toLowerCase().split(`+`).map(e=>e.trim()),n=typeof navigator<`u`&&/Mac|iPhone|iPad|iPod/i.test(navigator.userAgent);return{key:t[t.length-1],ctrlKey:t.includes(`ctrl`)||!n&&t.includes(`mod`),metaKey:t.includes(`meta`)||n&&t.includes(`mod`),shiftKey:t.includes(`shift`),altKey:t.includes(`alt`)}}function Zn(e,n=Hn,r=[`INPUT`,`TEXTAREA`,`SELECT`]){let i=(0,t.useCallback)(t=>{if(!e)return;let i=t.target;if(r.includes(i.tagName)||i.isContentEditable)return;let a=Array.isArray(e)?e:[e];for(let e of a){let r=Xn(e);if(t.key.toLowerCase()===r.key&&t.ctrlKey===r.ctrlKey&&t.metaKey===r.metaKey&&t.shiftKey===r.shiftKey&&t.altKey===r.altKey){t.preventDefault(),K.toggle(n);return}}},[e,n,r]);(0,t.useEffect)(()=>{if(e)return document.addEventListener(`keydown`,i),()=>document.removeEventListener(`keydown`,i)},[e,i])}var Qn=()=>({backdrop:(0,l.css)({position:`fixed`,inset:0,backgroundColor:`rgba(0, 0, 0, 0.35)`,backdropFilter:`blur(4px)`,zIndex:999999}),surface:(0,l.css)({padding:`0 !important`,overflow:`hidden`,borderRadius:i.tokens.borderRadiusXLarge,boxShadow:i.tokens.shadow64}),search:(0,l.css)({padding:i.tokens.spacingVerticalM,paddingInline:i.tokens.spacingHorizontalL,width:`100%`,boxSizing:`border-box`,"& > div":{width:`100%`}}),actionsList:(0,l.css)({borderTop:`1px solid ${i.tokens.colorNeutralStroke2}`,overflowY:`auto`}),action:(0,l.css)({alignItems:`flex-start`,width:`100%`,padding:`${i.tokens.spacingVerticalS} ${i.tokens.spacingHorizontalL}`,textAlign:`left`,gap:i.tokens.spacingHorizontalM,transition:`background-color 0.1s ease`,"&:hover":{backgroundColor:i.tokens.colorNeutralBackground1Hover},'&[data-spotlight-selected="true"]':{backgroundColor:i.tokens.colorBrandBackground,color:i.tokens.colorNeutralForegroundOnBrand}}),actionBody:(0,l.css)({flex:1,minWidth:0}),actionSectionLeft:(0,l.css)({flexShrink:0,fontSize:`30px`,paddingTop:`2px`,color:i.tokens.colorNeutralForeground3,'[data-spotlight-selected="true"] &':{color:i.tokens.colorNeutralForegroundOnBrand,opacity:.85}}),actionSectionRight:(0,l.css)({flexShrink:0,color:i.tokens.colorNeutralForeground3,'[data-spotlight-selected="true"] &':{color:i.tokens.colorNeutralForegroundOnBrand,opacity:.7}}),actionDescription:(0,l.css)({'[data-spotlight-selected="true"] &':{color:i.tokens.colorNeutralForegroundOnBrand,opacity:.7}}),actionsGroup:(0,l.css)({"&:not(:first-child)":{marginTop:i.tokens.spacingVerticalM}}),actionsGroupLabel:(0,l.css)({textTransform:`uppercase`,paddingInline:i.tokens.spacingHorizontalL,paddingBlock:i.tokens.spacingVerticalXS}),empty:(0,l.css)({padding:i.tokens.spacingVerticalL}),footer:(0,l.css)({borderTop:`1px solid ${i.tokens.colorNeutralStroke2}`}),highlight:(0,l.css)({backgroundColor:i.tokens.colorPaletteYellowBackground2,color:`inherit`,borderRadius:i.tokens.borderRadiusSmall,padding:`0 1px`,'[data-spotlight-selected="true"] &':{backgroundColor:`rgba(255, 255, 255, 0.3)`}})}),$n=({store:e=Hn,query:r,onQueryChange:a,clearQueryOnClose:o=!0,shortcut:s=`mod+K`,tagsToIgnore:c=[`INPUT`,`TEXTAREA`,`SELECT`],disabled:l=!1,onSpotlightOpen:u,onSpotlightClose:d,forceOpened:f=!1,closeOnActionTrigger:p=!0,maxWidth:m=600,yOffset:h=80,maxHeight:_=400,scrollable:v=!0,children:y,className:b})=>{let x=Qn(),{opened:S}=Yn(e),C=(0,t.useRef)(S);(0,t.useEffect)(()=>{e.set(zn,p)},[e,p]),(0,t.useEffect)(()=>{e.set(Bn,a)},[e,a]),(0,t.useEffect)(()=>{typeof r==`string`&&e.set(Ln,r)},[e,r]),Zn(s,e,c),(0,t.useEffect)(()=>{C.current!==S&&(C.current=S,S?u?.():(d?.(),o&&K.setQuery(``,e),K.clearState({clearQuery:o},e)))},[S,u,d,o,e]);let w=(0,t.useCallback)(()=>{K.close(e)},[e]);if(l)return null;let T=S||f,E={position:`fixed`,top:typeof h==`number`?`${h}px`:h,left:`50%`,transform:`translateX(-50%)`,maxWidth:typeof m==`number`?`${m}px`:m,width:`100%`,zIndex:1e6,maxHeight:v?`calc(100vh - ${typeof h==`number`?`${h*2}px`:h})`:void 0,display:`flex`,flexDirection:`column`},D={display:`flex`,flexDirection:`column`,overflow:`hidden`,maxHeight:v?typeof _==`number`?`${_}px`:_:void 0,gap:0,padding:0};return(0,n.jsx)(g.Provider,{store:e,children:T&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:x.backdrop,onClick:w,"aria-hidden":`true`}),(0,n.jsx)(i.Dialog,{open:!0,modalType:`non-modal`,onOpenChange:(t,n)=>{n.open||K.close(e)},children:(0,n.jsx)(i.DialogSurface,{className:`${x.surface}${b?` ${b}`:``}`,style:E,"aria-label":`Spotlight search`,children:(0,n.jsx)(i.DialogBody,{style:D,children:y})})})]})})},er=()=>({searchBoxStyles:_.css`
|
|
31
|
+
`},[u])}},Qe=e=>{let{children:r,className:i,onScroll:a}=e,{gridStyles:o,scrollbarClassName:s}=Ze(e),l=t.useRef(null),[u,d]=t.useState(0),[f,p]=t.useState(0);return t.useEffect(()=>{let e;return l.current&&(e=new c.ResizeObserver(e=>{for(let t of e){let{width:e,height:n}=t.contentRect;d(e),p(n)}}),e.observe(l.current)),()=>{e&&e.disconnect()}},[]),(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(`div`,{className:[i,s].filter(Boolean).join(` `),style:o(u,f),ref:l,onScroll:t.useCallback(e=>{if(!a)return;let{scrollTop:t,scrollHeight:n,clientHeight:r}=e.currentTarget;(t+r)/n>=.95&&a(e)},[a]),children:r})})},$e=e=>{let{maxWith:n}=e,{getBaseStyles:r}=xe();return{rootStyles:t.useCallback((t,i)=>({...r(e,t,i),maxWidth:n}),[r,n,e]),layoutGridStyles:(0,l.css)({display:`grid`,overflow:`hidden`})}},et={areas:[`header header header`,`sidebar content sidebar`,`footer footer footer`],columns:`1fr 3fr 1fr`,rows:`auto 1fr auto`},tt=e=>{let{className:r,children:a,layoutConfig:o=et}=e,s=t.useRef(null),[l,u]=t.useState(0),[d,f]=t.useState(0),{rootStyles:p,layoutGridStyles:m}=$e({...e,layoutConfig:o}),h=((e,n)=>{let r;return t.useCallback((...t)=>{clearTimeout(r),r=setTimeout(()=>e(...t),n)},[e,n])})((e,t)=>{u(e),f(t)},200);return t.useEffect(()=>{if(!s.current)return;let e=new c.ResizeObserver(e=>{for(let t of e){let{width:e,height:n}=t.contentRect;h(e,n)}});return e.observe(s.current),()=>e.disconnect()},[h]),(0,n.jsx)(`div`,{id:`-Layout`,className:(0,i.mergeClasses)(r,m),style:{...p(l,d),gridTemplateAreas:o.areas.join(` `),gridTemplateColumns:o.columns,gridTemplateRows:o.rows},ref:s,children:t.Children.map(a,(e,r)=>t.isValidElement(e)?(0,n.jsx)(`div`,{style:{gridArea:e.props?.area??`area-${r}`},children:e},r):e)})},nt=e=>{let{area:t,children:r}=e;return(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(`div`,{style:{gridArea:t},children:r})})},rt=e=>{let{verticalSpacing:n,horizontalSpacing:r}=e,{getSpacing:i}=xe();return{spaceStyles:t.useCallback(e=>e?r?{width:i(r,e,`horizontal`)}:n?{height:i(n,e,`vertical`)}:{}:{},[i,r,n])}},it=e=>{let r=t.useRef(null),[i,a]=t.useState(0),{spaceStyles:o}=rt(e);return t.useEffect(()=>{let e;return r.current&&(e=new c.ResizeObserver(e=>{for(let t of e){let{width:e}=t.contentRect;a(e)}}),e.observe(r.current)),()=>{e&&e.disconnect()}},[]),(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(`div`,{id:`-space`,style:o(i),ref:r})})},at=e=>{let{horizontal:n,horizontalAlign:r,verticalAlign:i,verticalFill:a,wrap:o,columnGap:s,RowGap:c}=e,{getBaseStyles:l}=xe();return{stackStyles:t.useCallback((t,u)=>{let d=i||`start`,f=n?r:`start`,p=n?{flexFlow:o?`row wrap`:`row nowrap`,height:`100%`}:{height:`100%`,maxHeight:`100%`},m=l(e,t,u);return{columnGap:s,rowGap:c,display:`flex`,flexDirection:n?`row`:`column`,alignItems:d,justifyContent:f,...p,height:a?`100%`:m.height,...m,...e.styles}},[l,n,r,e,i,a,o])}},V=e=>{let{children:r,className:i}=e,{stackStyles:a}=at(e),o=t.useRef(null),[s,l]=t.useState(0),[u,d]=t.useState(0);return t.useEffect(()=>{let e;return o.current&&(e=new c.ResizeObserver(e=>{for(let t of e){let{width:e,height:n}=t.contentRect;l(e),d(n)}}),e.observe(o.current)),()=>{e&&e.disconnect()}},[]),(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(`div`,{className:i,style:a(s,u),ref:o,children:r})})},ot=e=>{let{children:r,grow:i,disableShrink:a,shrink:o,order:s,alignSelf:l,verticalFill:u}=e,{getBaseStyles:d}=xe(),f=t.useRef(null),[p,m]=t.useState(0),[h,g]=t.useState(0),_=d(e,p,h);return t.useEffect(()=>{let e;return f.current&&(e=new c.ResizeObserver(e=>{for(let t of e){let{width:e,height:n}=t.contentRect;m(e),g(n)}}),e.observe(f.current)),()=>{e&&e.disconnect()}},[]),(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(`div`,{ref:f,style:{..._,alignSelf:l,order:s,height:u?`100%`:`auto`,flexGrow:i?typeof i==`boolean`?1:i:void 0,flexShrink:a||!i&&!o?0:1,minWidth:0,minHeight:0,width:`auto`},children:r})})},st=({ratio:e,children:t,maxWidth:r,maxHeight:i,style:a={},...o})=>{let s={position:`relative`,width:`100%`,paddingTop:`${100/e}%`,maxWidth:r||`none`,maxHeight:i||`none`,...a},c={position:`absolute`,top:0,left:0,width:`100%`,height:`100%`};return(0,n.jsx)(`div`,{style:s,...o,children:(0,n.jsx)(`div`,{style:c,children:t})})},ct=e=>{let{styles:n}=e,{getBaseStyles:r}=xe();return{aspectRatioStyles:t.useCallback((t,i)=>({...r(e,t,i),...n}),[r,e,n])}},lt=e=>{let{styles:n}=e,{getBaseStyles:r}=xe();return{centerStyles:t.useCallback((t,i)=>({...r(e,t,i),...n,overflow:`hidden`,display:`flex`,justifyContent:`center`,alignItems:`center`,width:`100%`,height:`100%`}),[r,e,n]),childrenStyles:(0,l.css)({justifyContent:`center`,textAlign:`center`})}},ut=e=>{let{className:r,children:i}=e,a=t.useRef(null),[o,s]=t.useState(0),[l,u]=t.useState(0),{centerStyles:d}=lt(e),f=(e,t)=>{let n;return(...r)=>{clearTimeout(n),n=setTimeout(()=>e(...r),t)}};return t.useEffect(()=>{let e=f(e=>{for(let t of e){let{width:e,height:n}=t.contentRect;s(e),u(n)}},200),t=new c.ResizeObserver(t=>{e(t)});return a.current&&t.observe(a.current),()=>{t.disconnect()}},[]),(0,n.jsx)(`div`,{id:`center`,className:r,style:{...d(o,l),display:`flex`,justifyContent:`center`,alignItems:`center`,height:`100%`,width:`100%`},ref:a,children:i})},dt=e=>{let{maxWidth:n}=e,{getBaseStyles:r}=xe();return{containerStyles:t.useCallback((t,i)=>!t||!i?{}:{...r(e,t,i),maxWidth:n},[r,n,e])}},ft=e=>{let{className:r,children:i,style:a,alignItems:o=`center`,justifyContent:l=`center`,flexDirection:u=`row`,centerContent:d=!0}=e,f=t.useRef(null),[p,m]=t.useState(0),[h,g]=t.useState(0),{containerStyles:_}=dt(e),v=t.useMemo(()=>(0,s.debounce)(e=>{for(let t of e){let{width:e,height:n}=t.contentRect;m(e),g(n)}},200),[]);t.useEffect(()=>{let e=new c.ResizeObserver(e=>{v(e)});return f.current&&e.observe(f.current),()=>{e.disconnect(),v.cancel()}},[v]);let y=t.useMemo(()=>{if(!a)return;let{padding:e,margin:t,...n}=a;return n},[a]);return(0,n.jsx)(`div`,{id:`container`,className:r,style:{..._(p,h),display:`flex`,justifyContent:l,alignItems:o,flexDirection:u,...y},ref:f,children:d?(0,n.jsx)(ut,{children:i}):i})},pt=e=>{let[n,r]=(0,t.useState)(!0),[i,a]=(0,t.useState)(!0),o=(0,t.useCallback)(()=>{e&&e.scrollPrev()},[e]),s=(0,t.useCallback)(()=>{e&&e.scrollNext()},[e]),c=(0,t.useCallback)(e=>{r(!e.canScrollPrev()),a(!e.canScrollNext())},[]);return(0,t.useEffect)(()=>{e&&(c(e),e.on(`reInit`,c),e.on(`select`,c))},[e,c]),{prevBtnDisabled:n,nextBtnDisabled:i,onPrevButtonClick:o,onNextButtonClick:s}},mt=(e,n)=>{let{getCurrentDevice:r}=xe(),a=t.useCallback(()=>{let e=r(n),t=`95%`;switch(e){case`Medium`:t=`45%`;break;case`Large`:t=`calc(95% / 4)`;break;case`ExtraLarge`:t=`calc(95% / 5)`;break;case`ExtraExtraLarge`:t=`calc(95% / 6)`;break;default:t=`95%`;break}return t},[n,r]),o=t.useCallback(()=>{let e=r(n),t=i.tokens.spacingVerticalM;switch(e){case`Medium`:t=i.tokens.spacingVerticalM;break;case`Large`:t=i.tokens.spacingVerticalL;break;case`ExtraLarge`:t=i.tokens.spacingVerticalXL;break;default:t=i.tokens.spacingVerticalM;break}return t},[n,r]);return{enableControls:(0,l.css)({display:`flex`,justifyContent:`space-between`,alignItems:`stretch`,gap:10,padding:5}),embla__viewport:(0,l.css)({overflow:`hidden`,paddingTop:`10px`,paddingBottom:`20px`}),embla__container:(0,l.css)({backfaceVisibility:`hidden`,display:`flex`,touchAction:`pan-y`}),embla:(0,l.css)({".embla":{}}),embla__slide:(0,l.css)({minWidth:0,flex:`0 0 ${a()}`,paddingLeft:`${o()}`}),embla__buttons:(0,l.css)({display:`grid`,gridTemplateColumns:`repeat(2, 1fr)`,gap:0,alignItems:`center`})}},ht=e=>{let{styles:n}=e,{getBaseStyles:r}=xe();return{carouselStyles:t.useCallback((t,i)=>({...r(e,t,i),...n}),[r,e,n])}},gt=()=>({titleStyles:(0,l.css)({display:`-webkit-box`,overflow:`hidden`,textOverflow:`ellipsis`,WebkitLineClamp:`1`,WebkitBoxOrient:`vertical`,textAlign:`start`})}),_t=e=>{let{className:r,items:a,title:o}=e,s=t.useRef(null),[l,f]=t.useState(0),[p,m]=t.useState(0),{carouselStyles:h}=ht(e),[g,_]=(0,u.default)(),v=gt(),{enableControls:y,embla__slide:b,embla__container:x,embla__viewport:S,embla__buttons:C}=mt(e,l),{prevBtnDisabled:w,nextBtnDisabled:T,onPrevButtonClick:E,onNextButtonClick:D}=pt(_);return t.useEffect(()=>{let e;return s.current&&(e=new c.ResizeObserver(e=>{for(let t of e){let{width:e,height:n}=t.contentRect;f(e),m(n)}}),f(s.current.clientWidth),m(s.current.clientHeight),e.observe(s.current)),()=>{e&&e.disconnect()}},[]),(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)(`div`,{id:`-carousel`,role:`region`,"aria-roledescription":`carousel`,"aria-label":o||`Carousel`,className:(0,i.mergeClasses)(r,`embla`),style:{...h(l,p)},ref:s,children:[(0,n.jsxs)(`div`,{className:y,children:[(0,n.jsx)(i.Subtitle2,{className:v.titleStyles,children:o}),(0,n.jsxs)(`div`,{className:C,children:[(0,n.jsx)(i.Button,{onClick:E,disabled:w,appearance:`subtle`,icon:(0,n.jsx)(d.ChevronLeftRegular,{}),"aria-label":`Previous slide`}),(0,n.jsx)(i.Button,{onClick:D,disabled:T,appearance:`subtle`,icon:(0,n.jsx)(d.ChevronRightRegular,{}),"aria-label":`Next slide`})]})]}),(0,n.jsx)(`div`,{className:S,ref:g,children:(0,n.jsx)(`div`,{className:x,children:a.map((e,t)=>(0,n.jsx)(`div`,{className:b,role:`group`,"aria-roledescription":`slide`,"aria-label":`Slide ${t+1} of ${a.length}`,children:e},t))})})]})})},vt=e=>{let{direction:t=`horizontal`,resizerSize:n=6}=e,r=t===`horizontal`;return{root:(0,l.css)({position:`relative`,width:`100%`,height:`100%`}),pane:e=>{let t=e===void 0?void 0:typeof e==`number`?`${e}px`:e;return(0,l.css)({overflow:`auto`,position:`relative`,...r?{width:t,height:`100%`}:{height:t,width:`100%`}})},secondaryPane:(0,l.css)({flex:1,overflow:`auto`,position:`relative`,minWidth:0,minHeight:0}),resizer:(0,l.css)({flex:`0 0 auto`,...r?{width:n,cursor:`col-resize`,height:`100%`}:{height:n,cursor:`row-resize`,width:`100%`},backgroundColor:i.tokens.colorNeutralStroke1,transition:`background-color 150ms ease`,userSelect:`none`,zIndex:1}),resizerActive:(0,l.css)({backgroundColor:i.tokens.colorBrandStroke1}),resizerGrip:(0,l.css)({gap:`2px`}),gripDot:(0,l.css)({width:3,height:3,borderRadius:`50%`,backgroundColor:i.tokens.colorNeutralForeground3})}},H={xs:i.tokens.spacingHorizontalXS,s:i.tokens.spacingHorizontalS,m:i.tokens.spacingHorizontalM,l:i.tokens.spacingHorizontalL,xl:i.tokens.spacingHorizontalXL,xxl:i.tokens.spacingHorizontalXXL},U=t.default.memo(t.default.forwardRef(({direction:e=`vertical`,justifyContent:t=`flex-start`,alignItems:r=`stretch`,gap:a,columnGap:o,rowGap:s,margin:c,padding:u,marginTop:d,marginBottom:f,marginLeft:p,marginRight:m,paddingTop:h,paddingBottom:g,paddingLeft:_,paddingRight:v,width:y,height:b,wrap:x=!1,children:S,style:C,className:w,overflow:T,background:E},D)=>(0,n.jsx)(`div`,{ref:D,className:(0,i.mergeClasses)(w,(0,l.css)({display:`flex`,flexDirection:e===`horizontal`?`row`:`column`,justifyContent:t,alignItems:r,gap:a&&H[a]?H[a]:a,columnGap:o&&H[o]?H[o]:o,rowGap:s&&H[s]?H[s]:s,margin:c&&H[c]?H[c]:c,padding:u&&H[u]?H[u]:u,marginTop:d&&H[d]?H[d]:d,marginBottom:f&&H[f]?H[f]:f,marginLeft:p&&H[p]?H[p]:p,marginRight:m&&H[m]?H[m]:m,paddingTop:h&&H[h]?H[h]:h,paddingBottom:g&&H[g]?H[g]:g,paddingLeft:_&&H[_]?H[_]:_,paddingRight:v&&H[v]?H[v]:v,width:y,height:b,overflow:T,flexWrap:x?`wrap`:`nowrap`,backgroundColor:E,...C})),children:S}))),yt=e=>{let{direction:r=`horizontal`,defaultSize:i=`50%`,minSize:a=100,maxSize:o=1/0,minSecondarySize:s=100,resizable:c=!0,onResize:l,onResizeEnd:u,primaryContent:d,secondaryContent:f,className:p,styles:m}=e,h=vt(e),g=r===`horizontal`,_=t.useRef(null),v=t.useRef(null),[y,b]=t.useState(null),[x,S]=t.useState(!1),[C,w]=t.useState(!1);t.useEffect(()=>{if(y!==null||!_.current)return;let e=_.current.getBoundingClientRect(),t=g?e.width:e.height;if(typeof i==`number`)b(Math.min(Math.max(i,a),o));else if(typeof i==`string`&&i.endsWith(`%`)){let e=parseFloat(i)/100;b(Math.min(Math.max(t*e,a),o))}else b(t/2)},[i,a,o,g,y]);let T=t.useCallback(t=>{if(!_.current)return t;let n=_.current.getBoundingClientRect(),r=(g?n.width:n.height)-(e.resizerSize??6)-s;return Math.min(Math.max(t,a),Math.min(o,r))},[g,o,a,s,e.resizerSize]),E=t.useCallback(e=>{if(!c)return;e.preventDefault(),S(!0);let t=g?e.clientX:e.clientY,n=y??0,r=e=>{let r=T(n+((g?e.clientX:e.clientY)-t));b(r),l?.(r)},i=()=>{if(S(!1),document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,i),v.current){let e=g?v.current.getBoundingClientRect().width:v.current.getBoundingClientRect().height;u?.(e)}};document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,i)},[c,g,y,T,l,u]),D=t.useCallback(e=>{if(!c)return;S(!0);let t=e.touches[0],n=g?t.clientX:t.clientY,r=y??0,i=e=>{let t=e.touches[0],i=T(r+((g?t.clientX:t.clientY)-n));b(i),l?.(i)},a=()=>{if(S(!1),document.removeEventListener(`touchmove`,i),document.removeEventListener(`touchend`,a),v.current){let e=g?v.current.getBoundingClientRect().width:v.current.getBoundingClientRect().height;u?.(e)}};document.addEventListener(`touchmove`,i,{passive:!1}),document.addEventListener(`touchend`,a)},[c,g,y,T,l,u]),O=t.useCallback(e=>{if(!c||y===null)return;let t=e.shiftKey?50:10,n=0;if(g?e.key===`ArrowLeft`?n=-t:e.key===`ArrowRight`&&(n=t):e.key===`ArrowUp`?n=-t:e.key===`ArrowDown`&&(n=t),n!==0){e.preventDefault();let t=T(y+n);b(t),l?.(t),u?.(t)}},[c,y,g,T,l,u]);t.useEffect(()=>(x?(document.body.style.userSelect=`none`,document.body.style.cursor=g?`col-resize`:`row-resize`):(document.body.style.userSelect=``,document.body.style.cursor=``),()=>{document.body.style.userSelect=``,document.body.style.cursor=``}),[x,g]);let k=t.useRef(null),A=[h.resizer,C||x?h.resizerActive:``].filter(Boolean).join(` `);return t.useEffect(()=>{if(!c||!k.current)return;let e=k.current,t=e=>E(e),n=e=>D(e),r=e=>O(e),i=()=>w(!0),a=()=>w(!1);return e.addEventListener(`mousedown`,t),e.addEventListener(`touchstart`,n),e.addEventListener(`keydown`,r),e.addEventListener(`mouseenter`,i),e.addEventListener(`mouseleave`,a),()=>{e.removeEventListener(`mousedown`,t),e.removeEventListener(`touchstart`,n),e.removeEventListener(`keydown`,r),e.removeEventListener(`mouseenter`,i),e.removeEventListener(`mouseleave`,a)}},[c,E,D,O]),(0,n.jsxs)(U,{ref:_,className:[h.root,p].filter(Boolean).join(` `),style:{height:`100%`,width:`100%`,...m},direction:g?`horizontal`:`vertical`,overflow:`hidden`,children:[(0,n.jsx)(U,{ref:v,className:h.pane(y??void 0),style:{flex:`0 0 auto`},children:d}),c&&(0,n.jsx)(`div`,{ref:k,className:A,style:{flex:`0 0 auto`,display:`flex`,alignItems:`center`,justifyContent:`center`},role:`separator`,"aria-orientation":g?`vertical`:`horizontal`,"aria-valuenow":Math.round(y??a),"aria-valuemin":a,"aria-valuemax":o===1/0?void 0:o,"aria-label":`Resize pane`,tabIndex:0,children:(0,n.jsxs)(U,{className:h.resizerGrip,direction:g?`vertical`:`horizontal`,alignItems:`center`,justifyContent:`center`,children:[(0,n.jsx)(U,{className:h.gripDot,children:``}),(0,n.jsx)(U,{className:h.gripDot,children:``}),(0,n.jsx)(U,{className:h.gripDot,children:``})]})}),(0,n.jsx)(U,{className:h.secondaryPane,style:{flex:1,minWidth:0,minHeight:0},children:f})]})},bt=({anchorPoint:e,isOpen:r,onClose:a,excludeRefs:o,children:s,theme:c})=>{let l=(0,t.useRef)(null),[u,d]=(0,t.useState)(null);(0,t.useLayoutEffect)(()=>{if(!r){d(null);return}if(l.current){let t=l.current.getBoundingClientRect(),n=e.left,r=e.top;n+t.width>window.innerWidth&&(n=window.innerWidth-t.width-10),r+t.height>window.innerHeight&&(r=window.innerHeight-t.height-10),d({left:n,top:r})}},[e,r,s]);let p=t.default.useCallback(e=>{let t=e.target;if(l.current&&!l.current.contains(t)){if(o&&o.some(e=>e.current&&e.current.contains(t)))return;a()}},[a,o]);if((0,t.useEffect)(()=>{if(!r)return;let e=requestAnimationFrame(()=>{document.addEventListener(`mousedown`,p)}),t=e=>{e.key===`Escape`&&a()};return document.addEventListener(`keydown`,t),()=>{cancelAnimationFrame(e),document.removeEventListener(`mousedown`,p),document.removeEventListener(`keydown`,t)}},[r,p,a]),!r)return null;let m=u||e;return f.default.createPortal(c?(0,n.jsx)(i.FluentProvider,{theme:c,children:(0,n.jsx)(i.Card,{ref:l,role:`dialog`,"aria-modal":`true`,style:{position:`fixed`,zIndex:1e3,top:m.top,left:m.left},children:s})}):(0,n.jsx)(i.Card,{ref:l,role:`dialog`,"aria-modal":`true`,style:{position:`fixed`,zIndex:1e3,top:m.top,left:m.left},children:s}),document.body)},xt=(0,i.makeStyles)({labelContainer:{display:`flex`,flexDirection:`row`,justifyContent:`flex-start`,alignItems:`center`,...i.shorthands.gap(`6px`)},iconStyles:{width:`26px`},item:{paddingLeft:`15px`}}),St=e=>{let{label:r,icon:a,isRequired:o}=e,s=xt();return(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)(`div`,{className:s.labelContainer,children:[a&&t.isValidElement(a)?a:(0,n.jsx)(p.Icon,{icon:a,className:s.iconStyles,width:`20px`,height:`20px`,color:i.tokens.colorBrandForeground1,"aria-hidden":`true`}),(0,n.jsx)(i.Caption1,{style:{color:i.tokens.colorBrandForeground1},children:r}),(0,n.jsx)(i.Caption1,{style:{color:i.tokens.colorPaletteRedForeground1},children:o?` *`:``})]})})},Ct=(0,i.makeStyles)({root:{display:`flex`,justifyContent:`center`,alignItems:`center`,height:`100%`,width:`100%`},spinner:{width:`100px`,height:`100px`}}),wt=e=>{let{size:t,label:r,labelPosition:a,style:o,className:s}=e,c=Ct();return(0,n.jsx)(`div`,{className:c.root,children:(0,n.jsx)(i.Spinner,{style:o,className:(0,i.mergeClasses)(c.spinner,s),size:t,label:r,labelPosition:a,"aria-label":r?void 0:`Loading`})})},Tt={xs:i.tokens.fontSizeBase200,s:i.tokens.fontSizeBase300,m:i.tokens.fontSizeBase400,l:i.tokens.fontSizeBase500,xl:i.tokens.fontSizeBase600,xxl:i.tokens.fontSizeHero700},W={xs:i.tokens.spacingHorizontalXS,s:i.tokens.spacingHorizontalS,m:i.tokens.spacingHorizontalM,l:i.tokens.spacingHorizontalL,xl:i.tokens.spacingHorizontalXL,xxl:i.tokens.spacingHorizontalXXL},Et={regular:i.tokens.fontWeightRegular,semibold:i.tokens.fontWeightSemibold,bold:i.tokens.fontWeightBold},Dt=e=>{let{fontSize:t,fontFamily:r,fontWeight:a,numberOfLines:o,as:s,padding:c,paddingTop:u,paddingBottom:d,paddingLeft:f,paddingRight:p,margin:m,marginTop:h,marginBottom:g,marginLeft:_,marginRight:v,children:y,style:b,className:x,color:S,block:C,truncate:w,wrap:T}=e,E=(0,l.css)({color:S,padding:c&&W[c]?W[c]:c,paddingTop:u&&W[u]?W[u]:u,paddingBottom:d&&W[d]?W[d]:d,paddingLeft:f&&W[f]?W[f]:f,paddingRight:p&&W[p]?W[p]:p,margin:m&&W[m]?W[m]:m,marginTop:h&&W[h]?W[h]:h,marginBottom:g&&W[g]?W[g]:g,marginLeft:_&&W[_]?W[_]:_,marginRight:v&&W[v]?W[v]:v}),D={...b,...r?{fontFamily:r}:{},...t?{fontSize:Tt[t]?Tt[t]:t}:{},...a?{fontWeight:Et[a]?Et[a]:a}:{},...o?{display:`-webkit-box`,WebkitBoxOrient:`vertical`,overflow:`hidden`,WebkitLineClamp:o}:{}};return(0,n.jsx)(i.Text,{as:s,className:(0,i.mergeClasses)(x,E),style:D,block:C,truncate:w,wrap:T,children:y})},Ot=e=>{let{onSelected:r,value:a,styles:o,options:s,apparence:c,shape:l,label:u}=e,d=t.useRef(),[f,p]=t.useState(a??s[0]),[m,h]=t.useState({option:[a?a?.key:s?.[0]?.key]}),g=t.useRef(null);t.useEffect(()=>{a!==void 0&&(p(a),h({option:[a.key]})),d.current=s.find(e=>e.key===(a?.key??s[0]?.key))?.icon},[a]);let[_,v]=t.useState(!1),y=t.useCallback((e,t)=>{v(t.open)},[]),b=t.useCallback(e=>e?.text??``,[]),x=t.useCallback((e,{name:t,checkedItems:n})=>{if(t===`option`){let e=n[0];p(s.find(t=>t.key===e)),h({option:n}),d.current=s.find(t=>t.key===e)?.icon,r(s.find(t=>t.key===e))}},[s,r]);return(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(i.Field,{label:u,style:o,ref:g,children:(0,n.jsxs)(i.Menu,{open:_,onOpenChange:y,children:[(0,n.jsx)(i.MenuTrigger,{disableButtonEnhancement:!0,children:(0,n.jsx)(i.MenuButton,{shape:l??`circular`,icon:d.current,appearance:c??`secondary`,children:b(f)??`No data available`})}),(0,n.jsx)(i.MenuPopover,{children:(0,n.jsx)(i.MenuList,{onCheckedValueChange:x,checkedValues:m,style:{width:g.current?.offsetWidth},children:s.map(e=>(0,n.jsx)(i.MenuItemRadio,{name:`option`,value:e.key,icon:e.icon,disabled:e.disabled,children:b(e)},e.key))})})]})})})},kt=()=>({styles:{container:(0,l.css)({display:`flex`,alignItems:`center`,alignContent:`center`,overflow:`hidden`,whiteSpace:`nowrap`,padding:`8px`,backgroundColor:`transparent`}),breadcrumbItem:(0,l.css)({minWidth:`fit-content`,padding:0,margin:`0px`}),separator:(0,l.css)({marginRight:`8px`})},getStyles:(e,t)=>{let{icon:n}=e;switch(t){case`small`:return(0,l.css)({fontSize:`12px`,padding:`4px`,paddingLeft:n?`0px`:`4px`});case`medium`:return(0,l.css)({fontSize:`14px`,padding:`6px`,paddingLeft:n?`0px`:`6px`});case`large`:return(0,l.css)({fontSize:`16px`,padding:`8px`,paddingLeft:n?`0px`:`8px`});case`current`:return(0,l.css)({fontWeight:i.tokens.fontWeightBold,cursor:`default`,display:`-webkit-box`,"-webkit-line-clamp":`1`,"-webkit-box-orient":`vertical`,overflow:`hidden`,textAlign:`start`,textOverflow:`ellipsis`,wordBreak:`break-word`,fontFamily:i.tokens.fontFamilyBase});default:return(0,l.css)({fontSize:`14px`,padding:`6px`,paddingLeft:n?`0px`:`6px`})}}}),At=({items:e,theme:r,size:a=`medium`})=>{let[o,s]=(0,t.useState)(!1),c=(0,t.useRef)(null),l=(0,t.useRef)(null),[u,p]=(0,t.useState)({top:0,left:0,position:`absolute`}),{getStyles:m}=kt();return(0,t.useEffect)(()=>{let e=e=>{!c.current?.contains(e.target)&&!l.current?.contains(e.target)&&o&&s(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[o]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(i.Button,{ref:c,icon:(0,n.jsx)(d.MoreHorizontalRegular,{}),appearance:`transparent`,onClick:()=>{if(c.current){let e=c.current.getBoundingClientRect(),t=window.innerWidth,n=window.innerHeight,r=l.current?.offsetWidth||200,i=l.current?.offsetHeight||100,a=e.bottom+window.scrollY,o=e.left+window.scrollX;o+r>t&&(o=t-r-10),a+i>n&&(a=e.top+window.scrollY-i),p({top:a,left:o,position:`absolute`}),s(e=>!e)}},"aria-label":`More items`}),o&&(0,f.createPortal)(r?(0,n.jsx)(i.FluentProvider,{theme:r,children:(0,n.jsx)(i.Card,{ref:l,style:{...u,zIndex:1e3,padding:`8px`,minWidth:`150px`},children:e.map((e,t)=>(0,n.jsx)(i.Button,{icon:e.icon?e.icon:null,appearance:`transparent`,onClick:()=>{e.onClick?.(),s(!1)},children:(0,n.jsx)(i.Text,{className:m(e,a),children:e.label})},`overflow-${t}`))})}):(0,n.jsx)(i.Card,{ref:l,style:{...u,zIndex:1e3,padding:`8px`,minWidth:`150px`},children:e.map((e,t)=>(0,n.jsx)(i.Button,{icon:e.icon?e.icon:null,appearance:`transparent`,onClick:()=>{e.onClick?.(),s(!1)},children:(0,n.jsx)(i.Text,{className:m(e,a),children:e.label})},`overflow-${t}`))}),document.body)]})},jt=(e,t)=>{let n;return(...r)=>{clearTimeout(n),n=setTimeout(()=>e(...r),t)}},Mt=({items:e,maxWidth:r=`100%`,styles:a,theme:o,size:s=`medium`,currentIndex:l=e.length-1,className:u})=>{let{styles:f,getStyles:p}=kt(),m=(0,t.useRef)(null),[h,g]=(0,t.useState)([]),[_,v]=(0,t.useState)([]);return(0,t.useEffect)(()=>{let t=()=>{if(!m.current)return;let t=m.current.offsetWidth,n=0,r=[],i=[];e.forEach(e=>{n+80<=t-50?(r.push(e),n+=80):i.push(e)}),g(r),v(i)},n=jt(t,100),r=new c.ResizeObserver(()=>{n()});return m.current&&r.observe(m.current),t(),()=>{r.disconnect()}},[e]),(0,n.jsx)(`div`,{ref:m,className:(0,i.mergeClasses)(f.container,u),style:{maxWidth:r,...a},children:(0,n.jsxs)(V,{horizontal:!0,verticalAlign:`center`,horizontalAlign:`start`,children:[h.map((e,r)=>(0,n.jsxs)(t.default.Fragment,{children:[r===l?(0,n.jsxs)(V,{horizontal:!0,verticalAlign:`center`,horizontalAlign:`start`,columnGap:5,styles:{overflow:`hidden`},children:[e.icon?t.default.cloneElement(e.icon,{style:{fontSize:s===`large`?`20px`:s===`medium`?`16px`:`12px`}}):null,(0,n.jsx)(i.Text,{className:(0,i.mergeClasses)(f.breadcrumbItem,p(e,s),p(e,`current`)),"aria-current":`page`,children:e.label},e.label)]}):(0,n.jsx)(i.Button,{icon:e.icon?e.icon:null,appearance:`transparent`,className:`${f.breadcrumbItem}`,onClick:e.onClick,children:(0,n.jsx)(i.Text,{className:p(e,s),children:e.label})},e.label),r<h.length-1&&(0,n.jsx)(d.ChevronRightRegular,{style:{fontSize:s===`large`?`20px`:s===`medium`?`16px`:`12px`}})]},e.label??`breadcrumb-${r}`)),_.length>0&&(0,n.jsx)(At,{items:_,theme:o})]})})},Nt=({icon:e,hoverIcon:r,imageSrc:a,width:o=24,height:s=24,color:c,hoverColor:l,onClick:u,enabled:d=!0,ariaLabel:f})=>{let p=c||i.tokens.colorBrandBackground,m=l||i.tokens.colorBrandBackgroundHover,h=i.tokens.fontFamilyBase,[g,_]=(0,t.useState)(!1),v=(0,t.useCallback)(()=>{d&&_(!0)},[d]),y=(0,t.useCallback)(()=>{d&&_(!1)},[d]),b=(0,t.useMemo)(()=>d&&g&&r?r:e,[g,r,e,d]),x=(0,t.useMemo)(()=>({width:o,height:s,color:g?m:p,display:`flex`,alignItems:`center`,justifyContent:`center`,opacity:d?1:.5,fontFamily:h,fontSize:`inherit`}),[o,s,g,m,p,d,h]),S=(0,t.useMemo)(()=>({border:`none`,background:`none`,padding:0,cursor:d?`pointer`:`default`}),[d]),C=(0,t.useMemo)(()=>({width:o,height:s,objectFit:`contain`,opacity:d?1:.5}),[o,s,d]);return(0,n.jsx)(i.Button,{onClick:d?u:void 0,onMouseEnter:v,onMouseLeave:y,disabled:!d,style:S,"aria-label":f??`Icon Button`,children:a?(0,n.jsx)(`img`,{src:a,alt:`icon`,style:C}):t.default.cloneElement(b,{style:{...b.props.style,...x}})})},Pt=t.default.memo(Nt),Ft=()=>({getSpanSlots:t.useCallback((e,t)=>{let n=new Date(e),r=new Date(t),i=n.getHours(),a=n.getMinutes(),o=i*2+(a>=1?1:0),s=r.getHours(),c=r.getMinutes(),l=s*2+(c>=1?2:0);return{spanSlots:l-o,startSlot:o,endSlot:l}},[]),generateLightAndHoverColors:t.useCallback((e,t=20,n=10)=>{let r=e=>{let t=parseInt(e.slice(1,3),16)/255,n=parseInt(e.slice(3,5),16)/255,r=parseInt(e.slice(5,7),16)/255,i=Math.max(t,n,r),a=Math.min(t,n,r),o=i-a,s=0,c=0,l=(i+a)/2;if(o!==0){switch(c=l>.5?o/(2-i-a):o/(i+a),i){case t:s=(n-r)/o+(n<r?6:0);break;case n:s=(r-t)/o+2;break;case r:s=(t-n)/o+4;break}s/=6}return{h:s*360,s:c*100,l:l*100}},i=(e,t,n)=>{let r=t*Math.min(n,100-n)/100,i=t=>{let i=(t+e/30)%12,a=n-r*Math.max(Math.min(i-3,9-i,1),-1);return Math.round(255*a).toString(16).padStart(2,`0`)};return`#${i(0)}${i(8)}${i(4)}`},{h:a,s:o,l:s}=r(e);return{lightColor:i(a,o,Math.min(s+t,100)),hoverColor:i(a,o,Math.min(s+n,100))}},[]),getEventColors:t.useCallback(e=>{let t={backgroundColor:i.tokens.colorNeutralBackground3,hoverColor:i.tokens.colorNeutralBackground3Hover};return{"no category":t,meeting:{backgroundColor:i.tokens.colorPaletteBlueBackground2,hoverColor:i.tokens.colorPaletteBlueBorderActive},appointment:{backgroundColor:i.tokens.colorPaletteGreenBackground2,hoverColor:i.tokens.colorPaletteGreenBorderActive},task:{backgroundColor:i.tokens.colorPaletteRedBackground2,hoverColor:i.tokens.colorPaletteRedBorderActive},deadline:{backgroundColor:i.tokens.colorPaletteYellowBackground2,hoverColor:i.tokens.colorPaletteYellowBorderActive},holiday:{backgroundColor:i.tokens.colorPalettePurpleBackground2,hoverColor:i.tokens.colorPalettePurpleBorderActive},celebration:{backgroundColor:i.tokens.colorPaletteDarkOrangeBackground2,hoverColor:i.tokens.colorPaletteDarkOrangeBorderActive},reminder:{backgroundColor:i.tokens.colorPaletteTealBackground2,hoverColor:i.tokens.colorPaletteTealBorderActive},workshop:{backgroundColor:i.tokens.colorPaletteTealBackground2,hoverColor:i.tokens.colorPaletteTealBorderActive},webinar:{backgroundColor:i.tokens.colorPaletteMagentaBackground2,hoverColor:i.tokens.colorPaletteMagentaBorderActive},conference:{backgroundColor:i.tokens.colorPaletteBrownBackground2,hoverColor:i.tokens.colorPaletteBrownBorderActive}}[e.toLowerCase()]||t},[]),generateColor:t.useCallback(e=>{let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+((t<<5)-t);let n=(t&16777215).toString(16).toUpperCase();return`#${`00000`.substring(0,6-n.length)+n}`},[]),getCalendarColors:t.useCallback(e=>{let t={beige:{backgroundColor:i.tokens.colorPaletteBeigeBackground2,hoverColor:i.tokens.colorPaletteBeigeBorderActive},blue:{backgroundColor:i.tokens.colorPaletteBlueBackground2,hoverColor:i.tokens.colorPaletteBlueBorderActive},brown:{backgroundColor:i.tokens.colorPaletteBrownBackground2,hoverColor:i.tokens.colorPaletteBrownBorderActive},gold:{backgroundColor:i.tokens.colorPaletteGoldBackground2,hoverColor:i.tokens.colorPaletteGoldBorderActive},lavender:{backgroundColor:i.tokens.colorPaletteLavenderBackground2,hoverColor:i.tokens.colorPaletteLavenderBorderActive},magenta:{backgroundColor:i.tokens.colorPaletteMagentaBackground2,hoverColor:i.tokens.colorPaletteMagentaBorderActive},navy:{backgroundColor:i.tokens.colorPaletteNavyBackground2,hoverColor:i.tokens.colorPaletteNavyBorderActive},pink:{backgroundColor:i.tokens.colorPalettePinkBackground2,hoverColor:i.tokens.colorPalettePinkBorderActive},plum:{backgroundColor:i.tokens.colorPalettePlumBackground2,hoverColor:i.tokens.colorPalettePlumBorderActive},purple:{backgroundColor:i.tokens.colorPalettePurpleBackground2,hoverColor:i.tokens.colorPalettePurpleBorderActive},red:{backgroundColor:i.tokens.colorPaletteRedBackground2,hoverColor:i.tokens.colorPaletteRedBorderActive},teal:{backgroundColor:i.tokens.colorPaletteTealBackground2,hoverColor:i.tokens.colorPaletteTealBorderActive},anchor:{backgroundColor:i.tokens.colorPaletteAnchorBackground2,hoverColor:i.tokens.colorPaletteAnchorBorderActive},"dark-red":{backgroundColor:i.tokens.colorPaletteDarkRedBackground2,hoverColor:i.tokens.colorPaletteDarkRedBorderActive},cranberry:{backgroundColor:i.tokens.colorPaletteCranberryBackground2,hoverColor:i.tokens.colorPaletteCranberryBorderActive},pumpkin:{backgroundColor:i.tokens.colorPalettePumpkinBackground2,hoverColor:i.tokens.colorPalettePumpkinBorderActive},peach:{backgroundColor:i.tokens.colorPalettePeachBackground2,hoverColor:i.tokens.colorPalettePeachBorderActive},marigold:{backgroundColor:i.tokens.colorPaletteMarigoldBackground2,hoverColor:i.tokens.colorPaletteMarigoldBorderActive},brass:{backgroundColor:i.tokens.colorPaletteBrassBackground2,hoverColor:i.tokens.colorPaletteBrassBorderActive},forest:{backgroundColor:i.tokens.colorPaletteForestBackground2,hoverColor:i.tokens.colorPaletteForestBorderActive},seafoam:{backgroundColor:i.tokens.colorPaletteSeafoamBackground2,hoverColor:i.tokens.colorPaletteSeafoamBorderActive},"dark-green":{backgroundColor:i.tokens.colorPaletteDarkGreenBackground2,hoverColor:i.tokens.colorPaletteDarkGreenBorderActive},"light-teal":{backgroundColor:i.tokens.colorPaletteLightTealBackground2,hoverColor:i.tokens.colorPaletteLightTealBorderActive},steel:{backgroundColor:i.tokens.colorPaletteSteelBackground2,hoverColor:i.tokens.colorPaletteSteelBorderActive},"royal-blue":{backgroundColor:i.tokens.colorPaletteRoyalBlueBackground2,hoverColor:i.tokens.colorPaletteRoyalBlueBorderActive},cornflower:{backgroundColor:i.tokens.colorPaletteCornflowerBackground2,hoverColor:i.tokens.colorPaletteCornflowerBorderActive},grape:{backgroundColor:i.tokens.colorPaletteGrapeBackground2,hoverColor:i.tokens.colorPaletteGrapeBorderActive},lilac:{backgroundColor:i.tokens.colorPaletteLilacBackground2,hoverColor:i.tokens.colorPaletteLilacBorderActive},mink:{backgroundColor:i.tokens.colorPaletteMinkBackground2,hoverColor:i.tokens.colorPaletteMinkBorderActive},platinum:{backgroundColor:i.tokens.colorPalettePlatinumBackground2,hoverColor:i.tokens.colorPalettePlatinumBorderActive}},n=t[`royal-blue`];return t[e]||n},[]),formatDate:t.useCallback((e,t)=>(0,a.format)((0,a.parseISO)(e),t),[])}),It={start:`Start`,end:`End`,location:`Location`,attendees:`Attendees`,details:`Details`},Lt=`32px`,Rt=e=>({styles:{banner:(0,l.css)({display:`flex`,justifyContent:`center`,alignContent:`center`,alignItems:`center`,padding:`5px 10px 0px 10px`}),fieldContainer:(0,l.css)({paddingLeft:Lt}),title:(0,l.css)({lineClamp:2,overflow:`hidden`,display:`-webkit-box`,WebkitBoxOrient:`vertical`,wordBreak:`break-word`,WebkitLineClamp:2})}}),zt=({fieldLabel:e,fieldValue:t,icon:r})=>(0,n.jsxs)(V,{children:[(0,n.jsx)(St,{label:e,icon:r}),(0,n.jsx)(V,{paddingLeft:Lt,children:(0,n.jsx)(i.Body1,{children:t})})]}),Bt=e=>{let{event:r,strings:a=It}=e,{title:o,start:s,end:c,location:l,category:u,attendees:d,weblink:f}=r,{styles:p}=Rt(r),{formatDate:m}=Ft(),h=m(s,`PPp`),g=m(c,`PPp`),_=(0,i.partitionAvatarGroupItems)({items:d?.map(e=>e.id)||[]}),v=t.useCallback(e=>d?.find(t=>t.id===e)||void 0,[d]),y=t.useCallback(()=>(0,n.jsxs)(V,{children:[(0,n.jsx)(St,{label:a.attendees,icon:`ph:users-three`}),(0,n.jsx)(V,{paddingLeft:Lt,children:(0,n.jsxs)(i.AvatarGroup,{layout:`stack`,children:[_.inlineItems.map(e=>(0,n.jsx)(i.AvatarGroupItem,{name:v(e)?.name,image:{src:v(e)?.imageUrl}},e)),_.overflowItems&&(0,n.jsx)(i.AvatarGroupPopover,{children:_.overflowItems.map(e=>(0,n.jsx)(i.AvatarGroupItem,{name:v(e)?.name,image:{src:v(e)?.imageUrl}},e))})]})})]}),[_,v,a.attendees]);return(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(Xe,{appearance:`subtle`,padding:`m`,paddingTop:`s`,width:`250px`,cardBody:(0,n.jsxs)(V,{RowGap:10,children:[(0,n.jsx)(`div`,{className:p.banner,children:(0,n.jsx)(i.Subtitle1,{className:p.title,children:o})}),(0,n.jsx)(i.Divider,{}),u&&(0,n.jsx)(V,{horizontal:!0,horizontalAlign:`end`,width:`100%`,children:(0,n.jsx)(i.Badge,{appearance:`filled`,children:u})}),(0,n.jsx)(zt,{fieldLabel:a.start,fieldValue:h,icon:`mingcute:time-line`}),(0,n.jsx)(zt,{fieldLabel:a.end,fieldValue:g,icon:`mingcute:time-line`}),(0,n.jsx)(zt,{fieldLabel:a.location,fieldValue:l,icon:`mingcute:location-line`}),(0,n.jsx)(y,{})]}),cardFooterContent:(0,n.jsx)(V,{horizontal:!0,horizontalAlign:`end`,width:`100%`,children:(0,n.jsx)(i.Button,{appearance:`subtle`,onClick:()=>{window.open(f,`_blank`)},children:a.details})})})})},Vt=()=>({styles:{calendarWrapper:(0,l.css)({padding:`20px`,paddingTop:`10px`,overflow:`auto`,flex:1,display:`grid`,gridTemplateColumns:`repeat(7, 1fr)`,gridTemplateRows:`auto`,gridAutoRows:`minmax(100px, 1fr)`,gap:`1px`,width:`calc(100% - 40px)`}),header:(0,l.css)({display:`flex`,justifyContent:`start`,gap:`10px`,alignItems:`center`,padding:`16px`}),dayHeader:(0,l.css)({textAlign:`start`,padding:`8px`,borderBottom:`1px solid ${i.tokens.colorNeutralStroke1}`}),day:(0,l.css)({display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,border:`1px solid ${i.tokens.colorNeutralStroke1}`,backgroundColor:i.tokens.colorNeutralBackground1,position:`relative`}),otherMonthDay:(0,l.css)({color:i.tokens.colorNeutralStroke2,backgroundColor:i.tokens.colorNeutralBackground2}),cardDay:(0,l.css)({height:`100%`,minHeight:100,borderRadius:0,overflow:`hidden !important`,rowGap:5}),cardDayOnHover:(0,l.css)({":hover":{backgroundColor:i.tokens.colorNeutralBackground2}}),currentDay:(0,l.css)({borderTop:`5px solid ${i.tokens.colorBrandBackground}`}),currentDayLabel:(0,l.css)({color:i.tokens.colorBrandBackground,fontWeight:600}),eventCard:(0,l.css)({display:`flex`,flexDirection:`column`,alignItems:`flex-start`,zIndex:1}),eventContainer:(0,l.css)({display:`flex`,flexDirection:`column`,overflowY:`auto`,paddingTop:`5px`,paddingBottom:`5px`,paddingLeft:`5px`,paddingRight:`5px`,"::-webkit-scrollbar":{width:`5px`,height:`5px`},"::-webkit-scrollbar-track":{background:i.tokens.colorNeutralBackground4,borderRadius:`10px`},"::-webkit-scrollbar-thumb":{background:i.tokens.colorBrandStroke2Hover,borderRadius:`10px`},"::-webkit-scrollbar-thumb:hover":{background:i.tokens.colorNeutralStroke2}}),eventCardWeekView:(0,l.css)({backgroundColor:i.tokens.colorBrandBackground,color:i.tokens.colorNeutralForegroundOnBrand,borderRadius:`4px`,padding:`4px`,margin:`2px`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,height:`100%`}),popoverContent:(0,l.css)({padding:0,borderTopWidth:20,borderTopStyle:`solid`}),cardMonthTitle:(0,l.css)({display:`-webkit-box`,"-webkit-line-clamp":`1`,"-webkit-box-orient":`vertical`,textAlign:`start`,textOverflow:`ellipsis`,paddingLeft:`8px`,wordBreak:`break-word`,overflow:`hidden`})},applyEventHouverColorClass:(e,t)=>(0,l.css)({backgroundColor:e??i.tokens.colorBrandBackground,":hover":{backgroundColor:t??i.tokens.colorBrandBackgroundHover}})}),Ht=e=>{let r=(0,i.useId)(),{events:o,date:s,onCardHoverChange:c,columnHeight:l}=e,{styles:u,applyEventHouverColorClass:d}=Vt(),f=t.useRef(null),{getEventColors:p,getCalendarColors:m}=Ft(),h=t.useCallback(e=>{c&&c(!0,e)},[c]),g=t.useCallback(e=>{c&&c(!1,e)},[c]),_=t.useCallback(e=>{f.current?.setTarget(e)},[f]),v=t.useCallback((e,t,r)=>(0,n.jsx)(`div`,{ref:_,children:(0,n.jsx)(Xe,{className:(0,i.mergeClasses)(u.eventCard,d(r.backgroundColor,r.backgroundColor)),paddingTop:`4px`,paddingBottom:`4px`,paddingLeft:`8px`,paddingRight:`8px`,marginTop:e===0?`0px`:`5px`,cardHeader:(0,n.jsx)(i.Caption1,{className:u.cardMonthTitle,children:t.title}),onMouseEnter:()=>h(t.title),onMouseLeave:()=>g(t.title)})},t.id??`card-${e}`),[h,g,d]),y=t.useCallback((e,t,a)=>(0,n.jsxs)(i.Popover,{withArrow:!0,mouseLeaveDelay:30,closeOnScroll:!0,closeOnIframeFocus:!0,openOnHover:!0,children:[(0,n.jsx)(i.PopoverTrigger,{children:v(t,e,a)}),(0,n.jsx)(i.PopoverSurface,{"aria-labelledby":r,className:(0,i.mergeClasses)(u.popoverContent),children:(0,n.jsx)(Bt,{event:e})})]},t),[v,r,u.popoverContent]);return!o||!o?.length?(0,n.jsx)(n.Fragment,{children:` `}):(0,n.jsx)(`div`,{style:{height:l},className:u.eventContainer,children:o.map((e,n)=>{if(!(0,a.isWithinInterval)(s,{start:(0,a.startOfDay)(new Date(e.start)),end:(0,a.endOfDay)(new Date(e.end))}))return null;let r;r=e.hexColor?{backgroundColor:e.hexColor,hoverColor:e.hexColor}:e.color?m(e.color):p(e.category);let o=e.onRenderInMonthView?.(e),c=e.id??`event-${n}`;return t.isValidElement(o)?t.cloneElement(o,{key:c,className:(0,i.mergeClasses)(o.props.className,u.eventCard)}):e.enableOnHouver?y(e,n,r):v(n,e,r)})})},Ut=e=>{let{day:r,currentMonth:o,events:s,date:c,columnHeight:l,onDayClick:u}=e,{styles:d}=Vt(),f=new Date,[p,m]=t.useState(!1),h=c.getDay()===0||c.getDay()===6,g=t.useMemo(()=>(0,a.isSameDay)(c,f),[c,f]),_=t.useMemo(()=>(0,n.jsx)(V,{horizontal:!0,horizontalAlign:`start`,verticalAlign:`center`,paddingLeft:`m`,paddingRight:`m`,children:(0,n.jsxs)(i.Body2,{className:d.currentDayLabel,style:{color:h?`${i.tokens.colorPaletteRedForeground1} !important`:``},children:[r,` `,f.toLocaleString(`default`,{month:`short`})]})}),[r,h,f,d.currentDayLabel]),v=t.useCallback(e=>{m(e)},[]);return(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(Xe,{onClick:u?()=>u(c):void 0,className:(0,i.mergeClasses)(d.cardDay,o?``:d.otherMonthDay,g?d.currentDay:``,p?``:d.cardDayOnHover),cardHeader:g?_:(0,n.jsx)(V,{horizontal:!0,paddingLeft:`m`,paddingRight:`m`,children:(0,n.jsx)(i.Body2,{style:{color:h?`${i.tokens.colorPaletteRedForeground1} !important`:``},children:r})}),paddingTop:`m`,paddingBottom:`m`,paddingLeft:`0px`,paddingRight:`0px`,cardBody:(0,n.jsx)(Ht,{events:s,date:c,onCardHoverChange:v,columnHeight:l-60})})})},Wt=()=>({styles:{container:(0,l.css)({display:`flex`,flexDirection:`column`,width:`calc(100% - 40px)`,height:`100vh`,overflow:`hidden`,padding:`20px`}),header:(0,l.css)({display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:`16px`,borderBottom:`1px solid ${i.tokens.colorNeutralStroke1}`}),weekGrid:(0,l.css)({display:`grid`,gridTemplateColumns:`80px repeat(7, 1fr)`,gridTemplateRows:`50px 40px repeat(48, 33px)`,height:`fit-content`,overflowY:`auto`,border:`1px solid ${i.tokens.colorNeutralStroke1}`,maxHeight:`calc(100vh - 100px)`,scrollbarWidth:`thin`,scrollbarColor:`${i.tokens.colorBrandBackground} ${i.tokens.colorNeutralBackground1}`,"&::-webkit-scrollbar":{width:`8px`},"&::-webkit-scrollbar-track":{background:i.tokens.colorNeutralBackground1},"&::-webkit-scrollbar-thumb":{background:i.tokens.colorBrandBackground,borderRadius:`4px`},"&::-webkit-scrollbar-thumb:hover":{background:i.tokens.colorBrandBackgroundHover}}),blankHeader:(0,l.css)({gridColumn:`1`,backgroundColor:i.tokens.colorNeutralBackground3,borderBottom:`3px solid ${i.tokens.colorNeutralStroke3}`,position:`sticky`,top:0,zIndex:10}),timeColumn:(0,l.css)({gridColumn:`1`,gridRow:`3 / span 49`,display:`flex`,flexDirection:`column`,backgroundColor:i.tokens.colorNeutralBackground1,borderRight:`1px solid ${i.tokens.colorNeutralStroke1}`}),timeCell:(0,l.css)({height:`100%`,display:`flex`,alignItems:`center`,fontSize:`12px`,color:i.tokens.colorNeutralForeground3,borderBottom:`1px solid ${i.tokens.colorNeutralStroke1}`,justifyContent:`center`}),fullDayRow:(0,l.css)({gridRow:`2`,display:`grid`,gridTemplateColumns:`80px repeat(7, 1fr)`,gap:`0`,padding:`0`,backgroundColor:i.tokens.colorNeutralBackground2,borderBottom:`3px solid ${i.tokens.colorNeutralStroke2}`}),fullDayLabel:(0,l.css)({gridColumn:`1`,display:`flex`,alignItems:`center`,justifyContent:`center`,alignContent:`center`,color:i.tokens.colorBrandBackground,padding:`5px`,borderRight:`1px solid ${i.tokens.colorNeutralStroke1}`,borderBottom:`3px solid ${i.tokens.colorNeutralStroke2}`}),fullDayCell:(0,l.css)({borderRight:`1px solid ${i.tokens.colorNeutralStroke1}`,display:`flex`,flexDirection:`row`,gap:`0px`,padding:`4px`,borderBottom:`3px solid ${i.tokens.colorNeutralStroke2}`,overflow:`hidden`}),fullDayEvent:(0,l.css)({flex:`1 1 auto`,minWidth:`24px`,height:`24px`,padding:`4px 8px`,backgroundColor:i.tokens.colorBrandBackground,borderRadius:`4px`,overflow:`hidden`,display:`flex`,alignItems:`center`,justifyContent:`center`}),dayHeaderCell:(0,l.css)({textAlign:`center`,backgroundColor:i.tokens.colorNeutralBackground2,padding:`8px`,fontWeight:`bold`,borderBottom:`1px solid ${i.tokens.colorNeutralStroke1}`,position:`sticky`,top:0,zIndex:10}),todayHeaderCell:(0,l.css)({borderTop:`5px solid ${i.tokens.colorBrandBackground}`}),eventCard:(0,l.css)({padding:2,alignItems:`center`,justifyContent:`center`,marginRight:`2px`,zIndex:1,position:`absolute`,alignContent:`center`,overflow:`hidden`,":hover":{pointerEvents:`auto`,cursor:`pointer`}}),event:(0,l.css)({height:`100%`,backgroundColor:i.tokens.colorBrandBackground,borderRadius:`4px`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,overflow:`hidden`,display:`flex`,alignItems:`center`,justifyContent:`center`,marginRight:`2px`,zIndex:1,position:`absolute`,alignContent:`center`,":hover":{pointerEvents:`auto`,cursor:`pointer`}}),dayCell:(0,l.css)({borderBottom:`1px solid ${i.tokens.colorNeutralStroke1}`,borderRight:`1px solid ${i.tokens.colorNeutralStroke1}`,position:`relative`,overflow:`visible`,FlexDirection:`column`,gap:`4px`}),currentTimeIndicator:(0,l.css)({position:`absolute`,left:0,height:`2px`,backgroundColor:i.tokens.colorPaletteRedBorderActive,width:`100%`,zIndex:1}),currentHalfHourCell:(0,l.css)({border:`2px solid ${i.tokens.colorPaletteRedBorderActive}`}),eventTitle:(0,l.css)({display:`-webkit-box`,"-webkit-line-clamp":`1`,"-webkit-box-orient":`vertical`,textAlign:`start`,textOverflow:`ellipsis`,paddingLeft:`8px`,wordBreak:`break-word`,overflow:`hidden`}),popoverContent:(0,l.css)({padding:0,borderTopWidth:20,borderTopStyle:`solid`})},applyEventHouverColorClass:t.default.useCallback((e,t)=>(0,l.css)({backgroundColor:e??i.tokens.colorBrandBackground,":hover":{backgroundColor:t??i.tokens.colorBrandBackgroundHover}}),[i.tokens.colorBrandBackground,i.tokens.colorBrandBackgroundHover]),appyDynamicStyles:t.default.useCallback((e,t,n,r)=>(0,l.css)({flex:`0 0 calc(100% / ${t})`,height:`${n*r}px`,left:`${e*10}%`,width:`calc(${100-e*10}% - 8px)`,margin:4,marginTop:0,marginBottom:0}),[])}),Gt={timeSeparator:` - `,hourSuffix:`H`},Kt=({event:e,colors:r,spanSlots:a,rowHeight:o,eventIndex:s,eventCount:c,strings:l=Gt})=>{let u=(0,i.useId)(),{styles:d,applyEventHouverColorClass:f,appyDynamicStyles:p}=Wt(),m=t.useRef(null),{formatDate:h}=Ft(),g=t.useMemo(()=>(0,n.jsx)(`div`,{children:(0,n.jsxs)(V,{columnGap:4,verticalAlign:`center`,children:[(0,n.jsx)(i.Caption1Strong,{className:d.eventTitle,children:e.title}),(0,n.jsxs)(V,{columnGap:4,horizontal:!0,verticalAlign:`center`,horizontalAlign:`start`,children:[(0,n.jsxs)(i.Caption1,{children:[h(e.start,`HH:mm`),l.hourSuffix]}),l.timeSeparator,(0,n.jsxs)(i.Caption1,{children:[h(e.end,`HH:mm`),l.hourSuffix]})]})]})}),[e,h,l,d.eventTitle]);return(0,n.jsx)(i.Card,{ref:m,className:(0,i.mergeClasses)(d.eventCard,f(r.backgroundColor,r.backgroundColor),p(s,c,o,a)),children:e.enableOnHouver?(0,n.jsxs)(i.Popover,{withArrow:!0,mouseLeaveDelay:50,closeOnScroll:!0,closeOnIframeFocus:!0,openOnHover:!0,children:[(0,n.jsx)(i.PopoverTrigger,{children:g}),(0,n.jsx)(i.PopoverSurface,{"aria-labelledby":u,className:(0,i.mergeClasses)(d.popoverContent),children:(0,n.jsx)(Bt,{event:e})})]}):g},e.id)},qt=({event:e,eventCount:r,spanSlots:a,rowHeight:o,eventIndex:s,view:c})=>{let{styles:l,appyDynamicStyles:u}=Wt(),{getEventColors:d,getCalendarColors:f}=Ft(),p=e.hexColor?{backgroundColor:e.hexColor,hoverColor:e.hexColor}:e.color?f(e.color):d(e.category),m=c===`day`?e.onRenderInDayView?.(e):e.onRenderInWeekView?.(e);return t.isValidElement(m)?t.cloneElement(m,{event:e,className:(0,i.mergeClasses)(m.props.className,l.eventCard,u(s,r,o,a)),style:{...m.props.style}}):(0,n.jsx)(Kt,{event:e,colors:p,spanSlots:a,rowHeight:o,eventIndex:s,eventCount:r},e.id)},Jt=e=>{let n=(0,t.useCallback)(e=>e.map(e=>({...e,id:e.id||(0,m.v4)()})),[]),r=(0,t.useCallback)(t=>new Date(new Date(t).toLocaleString(void 0,{timeZone:e})),[e]);return{getMonthCalendar:(0,t.useCallback)((e,t,i)=>{let o=n(e),s=new Date(t,i+1,0).getDate(),c={};for(let e=1;e<=s;e++){let n=(0,a.format)(new Date(t,i,e),`yyyy-MM-dd`);c[n]=[]}return o.forEach(e=>{let t=r(e.start),n=r(e.end),i=new Date(t);for(;i<=n;){let t=(0,a.format)(i,`yyyy-MM-dd`);c[t]&&c[t].push(e),i.setDate(i.getDate()+1)}}),c},[r]),getWeekEvents:(0,t.useCallback)((e,t)=>{let i=[],o=r(t),s=n(e);for(let e=0;e<7;e++){let t=new Date(o);t.setDate(o.getDate()+e);let n=(0,a.format)(t,`yyyy-MM-dd`),c=Array.from({length:48},(e,t)=>({time:`${String(Math.floor(t/2)).padStart(2,`0`)}:${t%2==0?`00`:`30`}`,events:[]})),l=[];s.forEach(e=>{let t=r(e.start),i=r(e.end);if(e.isFullDay){(0,a.format)(t,`yyyy-MM-dd`)<=n&&(0,a.format)(i,`yyyy-MM-dd`)>=n&&l.push(e);return}if((0,a.format)(t,`yyyy-MM-dd`)<=n&&(0,a.format)(i,`yyyy-MM-dd`)>=n){let r=new Date(t);for(;r<=i;){if((0,a.format)(r,`yyyy-MM-dd`)===n){let t=r.getHours()*2+(r.getMinutes()>=30?1:0);c[t]&&c[t].events.push(e)}r.setMinutes(r.getMinutes()+30)}}}),i.push({date:n,fullDayEvents:l,timeSlots:c})}return i},[r])}},Yt=()=>({styles:{container:(0,l.css)({display:`flex`,flexDirection:`column`,width:`calc(100% - 40px)`,height:`100vh`,overflow:`hidden`,padding:`20px`}),header:(0,l.css)({display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:`16px`,borderBottom:`1px solid ${i.tokens.colorNeutralStroke1}`}),dayGrid:(0,l.css)({display:`grid`,gridTemplateColumns:`80px 1fr`,gridTemplateRows:`50px 40px repeat(48, 33px)`,height:`calc(100vh - 100px)`,overflowY:`auto`,border:`1px solid ${i.tokens.colorNeutralStroke1}`,maxHeight:`fit-content`,scrollbarWidth:`thin`,scrollbarColor:`${i.tokens.colorBrandBackground} ${i.tokens.colorNeutralBackground1}`,"&::-webkit-scrollbar":{width:`8px`},"&::-webkit-scrollbar-track":{background:i.tokens.colorNeutralBackground1},"&::-webkit-scrollbar-thumb":{background:i.tokens.colorBrandBackground,borderRadius:`4px`},"&::-webkit-scrollbar-thumb:hover":{background:i.tokens.colorBrandBackgroundHover}}),blankHeader:(0,l.css)({gridColumn:`1`,backgroundColor:i.tokens.colorNeutralBackground3,borderBottom:`3px solid ${i.tokens.colorNeutralStroke3}`}),timeColumn:(0,l.css)({gridColumn:`1`,gridRow:`3 / span 49`,display:`flex`,flexDirection:`column`,backgroundColor:i.tokens.colorNeutralBackground1,borderRight:`1px solid ${i.tokens.colorNeutralStroke1}`}),timeCell:(0,l.css)({height:`100%`,maxHeight:`32px`,minHeight:`32px`,display:`flex`,alignItems:`center`,fontSize:`12px`,color:i.tokens.colorNeutralForeground3,borderBottom:`1px solid ${i.tokens.colorNeutralStroke1}`,justifyContent:`center`}),fullDayRow:(0,l.css)({gridRow:`2`,display:`grid`,gridTemplateColumns:`80px 33px`,gap:`0`,padding:`0`,backgroundColor:i.tokens.colorNeutralBackground2,borderBottom:`3px solid ${i.tokens.colorNeutralStroke2}`}),fullDayLabel:(0,l.css)({gridColumn:`1`,display:`flex`,alignItems:`center`,justifyContent:`center`,alignContent:`center`,color:i.tokens.colorBrandBackground,padding:`5px`,borderRight:`1px solid ${i.tokens.colorNeutralStroke1}`,borderBottom:`3px solid ${i.tokens.colorNeutralStroke2}`}),fullDayCell:(0,l.css)({borderRight:`1px solid ${i.tokens.colorNeutralStroke1}`,display:`flex`,flexDirection:`row`,gap:`2px`,padding:`4px`,borderBottom:`3px solid ${i.tokens.colorNeutralStroke2}`,overflow:`hidden`}),fullDayEvent:(0,l.css)({flex:`1 1 auto`,minWidth:`24px`,height:`24px`,padding:`4px 8px`,backgroundColor:i.tokens.colorBrandBackground,color:i.tokens.colorNeutralForegroundOnBrand,borderRadius:`4px`,overflow:`hidden`,display:`flex`,alignItems:`center`,justifyContent:`center`}),dayHeaderCell:(0,l.css)({textAlign:`center`,backgroundColor:i.tokens.colorNeutralBackground2,padding:`8px`,fontWeight:`bold`,borderBottom:`1px solid ${i.tokens.colorNeutralStroke1}`}),todayHeaderCell:(0,l.css)({borderTop:`5px solid ${i.tokens.colorBrandBackground}`}),eventCard:(0,l.css)({alignItems:`center`,justifyContent:`center`,marginRight:`2px`,zIndex:1,position:`absolute`,alignContent:`center`,overflow:`hidden`}),dayCell:(0,l.css)({borderBottom:`1px solid ${i.tokens.colorNeutralStroke1}`,borderRight:`1px solid ${i.tokens.colorNeutralStroke1}`,position:`relative`,overflow:`visible`,FlexDirection:`column`,gap:`4px`}),currentTimeIndicator:(0,l.css)({position:`absolute`,left:0,height:`2px`,backgroundColor:i.tokens.colorPaletteRedBorderActive,width:`100%`,zIndex:1}),currentHalfHourCell:(0,l.css)({border:`2px solid ${i.tokens.colorPaletteRedBorderActive}`}),eventTitle:(0,l.css)({display:`-webkit-box`,"-webkit-line-clamp":`1`,"-webkit-box-orient":`vertical`,textAlign:`start`,textOverflow:`ellipsis`,paddingLeft:`8px`,wordBreak:`break-word`,overflow:`hidden`})},applyEventHouverColorClass:(e,t)=>(0,l.css)({backgroundColor:e??i.tokens.colorBrandBackground,":hover":{backgroundColor:t??i.tokens.colorBrandBackgroundHover}})}),Xt={allDay:`All Day`},Zt=33,Qt=e=>{let{events:r,currentDay:o,height:s,strings:c=Xt}=e,{styles:l}=Yt(),u=(0,t.useRef)(null),{getSpanSlots:d,getEventColors:f,getCalendarColors:p}=Ft(),m=Intl.DateTimeFormat().resolvedOptions().timeZone,{getWeekEvents:h}=Jt(m),g=t.useCallback(()=>Array.from({length:24},(e,r)=>(0,n.jsxs)(t.Fragment,{children:[(0,n.jsx)(`div`,{className:l.timeCell,children:(0,n.jsxs)(i.Body1Strong,{children:[r,`:00`]})}),(0,n.jsx)(`div`,{className:l.timeCell})]},r)),[l.timeCell]),_=t.useCallback(()=>(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:l.blankHeader}),Array.from({length:1},(e,t)=>{let r=(0,a.addDays)(o,t),s=(0,a.isToday)(r)?l.todayHeaderCell:``;return(0,n.jsxs)(`div`,{className:(0,i.mergeClasses)(l.dayHeaderCell,s),children:[(0,n.jsx)(i.Text,{weight:`semibold`,size:600,style:{paddingRight:10},children:(0,a.format)(r,`dd`)}),(0,n.jsx)(i.Subtitle1,{children:(0,a.format)(r,`LLLL, yyyy`)})]},t)})]}),[o,l.blankHeader,l.dayHeaderCell,l.todayHeaderCell]),v=t.useCallback(()=>{let e=h(r,o.toISOString());return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:l.fullDayLabel,children:(0,n.jsx)(i.Body1,{children:c.allDay})}),Array.from({length:1},(t,r)=>{let s=(0,a.format)((0,a.addDays)(o,r),`yyyy-MM-dd`),c=e.find(e=>e.date===s)?.fullDayEvents||[];return(0,n.jsx)(`div`,{className:l.fullDayCell,children:c.map(e=>(0,n.jsx)(`div`,{className:l.fullDayEvent,style:{gridColumn:`${r+2}`,backgroundColor:e.color?p(e.color).backgroundColor:f(e.category).backgroundColor},children:(0,n.jsx)(i.Caption1Strong,{className:l.eventTitle,children:e.title})},e.id))},r)})]})},[o,h,l.fullDayCell,l.fullDayEvent,l.fullDayLabel,l.eventTitle,p,f,r,c.allDay]),y=t.useCallback(()=>{let e=h(r,o.toISOString());return Array.from({length:1},(r,i)=>{let s=(0,a.format)((0,a.addDays)(o,i),`yyyy-MM-dd`),c=e.find(e=>e.date===s);return(0,n.jsx)(t.Fragment,{children:c?.timeSlots.map((e,t)=>{let r=e.events.length;return(0,n.jsx)(`div`,{className:l.dayCell,style:{gridRow:t+3},children:e.events.map((e,i)=>{let{spanSlots:a,startSlot:o}=d(new Date(e.start),new Date(e.end));return t===o?(0,n.jsx)(qt,{event:e,eventCount:r,spanSlots:a,rowHeight:Zt,eventIndex:i,view:`day`},e.id):null})},t)})},i)})},[o,d,h,l.dayCell,r]);return(0,n.jsx)(`div`,{className:l.container,style:{height:s},children:(0,n.jsxs)(`div`,{ref:u,className:l.dayGrid,children:[(0,n.jsx)(`div`,{className:l.timeColumn,children:g()}),_(),v(),y()]})})},G=function(e){return e.Day=`day`,e.Week=`week`,e.Month=`month`,e}({}),$t={month:`Month`,week:`Week`,day:`Day`},en=e=>{let{onSelected:r,value:a,strings:o=$t}=e,[s,c]=t.useState(a??G.Month),[l,u]=t.useState({view:[a??G.Month]}),f=t.useMemo(()=>(0,d.bundleIcon)(d.CalendarDayFilled,d.CalendarDayRegular),[]),p=t.useMemo(()=>(0,d.bundleIcon)(d.CalendarMonthFilled,d.CalendarMonthRegular),[]),m=t.useMemo(()=>(0,d.bundleIcon)(d.CalendarWorkWeekFilled,d.CalendarWorkWeekRegular),[]);t.useEffect(()=>{a!==void 0&&(c(a),u({view:[a]}))},[a]);let[h,g]=t.useState(!1),_=t.useCallback((e,t)=>{g(t.open)},[]),v=t.useCallback(()=>{switch(s){case G.Month:return(0,n.jsx)(p,{});case G.Week:return(0,n.jsx)(m,{});case G.Day:return(0,n.jsx)(f,{});default:return(0,n.jsx)(p,{})}},[s]),y=t.useCallback(e=>{switch(e){case G.Month:return o.month;case G.Week:return o.week;case G.Day:return o.day;default:return o.month}},[o]),b=t.useCallback((e,{name:t,checkedItems:n})=>{if(t===`view`){let e=n[0];c(e),u({view:n}),r(e)}},[r]);return(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)(i.Menu,{open:h,onOpenChange:_,children:[(0,n.jsx)(i.MenuTrigger,{disableButtonEnhancement:!0,children:(0,n.jsx)(i.MenuButton,{shape:`circular`,icon:v(),style:{minWidth:`150px`},children:y(s)})}),(0,n.jsx)(i.MenuPopover,{children:(0,n.jsxs)(i.MenuList,{onCheckedValueChange:b,checkedValues:l,children:[(0,n.jsx)(i.MenuItemRadio,{icon:(0,n.jsx)(f,{}),name:`view`,value:G.Day,children:o.day}),(0,n.jsx)(i.MenuItemRadio,{icon:(0,n.jsx)(m,{}),name:`view`,value:G.Week,children:o.week}),(0,n.jsx)(i.MenuItemRadio,{icon:(0,n.jsx)(p,{}),name:`view`,value:G.Month,children:o.month})]})})]})})},tn=t.memo(e=>{let{onSelected:a,value:o}=e,[s,c]=t.useState(o??new Date),[l,u]=t.useState(()=>(0,r.format)(o??new Date,`dd MMM, yyyy`)),[f,p]=t.useState(!1),m=t.useCallback((e,t)=>{p(t.open)},[]),g=t.useMemo(()=>(0,d.bundleIcon)(d.CalendarMonthFilled,d.CalendarMonthRegular),[]),_=t.useCallback(e=>{if(e){let t=Intl.DateTimeFormat().resolvedOptions().timeZone,n=(0,r.utcToZonedTime)(e,t);c(n),u((0,r.format)(n,`dd MMM, yyyy`)),a(n),p(!1)}},[a]);return(0,n.jsxs)(i.Menu,{open:f,onOpenChange:m,children:[(0,n.jsx)(i.MenuTrigger,{disableButtonEnhancement:!0,children:(0,n.jsx)(i.MenuButton,{shape:`circular`,icon:(0,n.jsx)(g,{}),style:{minWidth:`200px`},"aria-label":`Select date: ${l}`,children:l})}),(0,n.jsx)(i.MenuPopover,{style:{maxWidth:`fit-content`},children:(0,n.jsx)(i.MenuList,{children:(0,n.jsx)(h.Calendar,{highlightSelectedMonth:!0,showGoToToday:!0,onSelectDate:_,value:s})})})]})}),nn=()=>({root:(0,l.css)({outline:`none`})}),rn={months:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],shortMonths:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],days:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],shortDays:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],goToToday:`Go to today`},an=e=>{let{onDateChange:r,defaultSelectedDate:i,onDismiss:a,strings:o=rn}=e,s=nn(),[c,l]=t.useState(i??new Date),u=t.useCallback((e,t)=>{l(e),r(e),a()},[r,a]);return(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(h.Calendar,{className:s.root,dateRangeType:h.DateRangeType.Month,highlightSelectedMonth:!0,isDayPickerVisible:!1,onSelectDate:u,value:c,onDismiss:a,showGoToToday:!1,allFocusable:!1,strings:o})})},on=e=>{let{onSelected:r,value:o}=e,s=(0,d.bundleIcon)(d.CalendarMonthFilled,d.CalendarMonthRegular),[c,l]=t.useState(o??new Date);t.useEffect(()=>{r(o??new Date),l(o??new Date)},[o]);let[u,f]=t.useState(!1),p=(e,t)=>{f(t.open)},m=t.useCallback(e=>{r(e),l(e)},[]);return(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)(i.Menu,{open:u,onOpenChange:p,children:[(0,n.jsx)(i.MenuTrigger,{disableButtonEnhancement:!0,children:(0,n.jsx)(i.MenuButton,{shape:`circular`,icon:(0,n.jsx)(s,{}),style:{minWidth:`200px`},"aria-label":`Select month: ${(0,a.format)(c,`MMMM yyyy`)}`,children:(0,a.format)(c,`MMMM yyyy`)})}),(0,n.jsx)(i.MenuPopover,{children:(0,n.jsx)(i.MenuList,{children:(0,n.jsx)(an,{onDateChange:m,defaultSelectedDate:c,onDismiss:()=>{f(!1)}})})})]})})},sn={selectWeekPlaceholder:`Select a week`},cn=e=>{let t=Intl.DateTimeFormat().resolvedOptions().timeZone,n=(0,r.format)(e.start,`MMM`,{timeZone:t}),i=(0,r.format)(e.end,`MMM`,{timeZone:t});return(0,r.format)(e.start,`yyyy`,{timeZone:t})===(0,r.format)(e.end,`yyyy`,{timeZone:t})?n===i?`${(0,r.format)(e.start,`dd`,{timeZone:t})} - ${(0,r.format)(e.end,`dd MMM yyyy`,{timeZone:t})}`:`${(0,r.format)(e.start,`dd MMM`,{timeZone:t})} - ${(0,r.format)(e.end,`dd MMM yyyy`,{timeZone:t})}`:`${(0,r.format)(e.start,`dd MMM yyyy`,{timeZone:t})} - ${(0,r.format)(e.end,`dd MMM yyyy`,{timeZone:t})}`},ln=e=>{let t=Intl.DateTimeFormat().resolvedOptions().timeZone,n=(0,r.utcToZonedTime)(e,t),i=new Date(n);i.setDate(n.getDate()-n.getDay());let a=new Date(i);return a.setDate(i.getDate()+6),{start:(0,r.utcToZonedTime)(i,t),end:(0,r.utcToZonedTime)(a,t)}},un=t.memo(e=>{let{onSelected:r,value:a,strings:o=sn}=e,s=h.DateRangeType.Week,[c,l]=t.useState(a??new Date),[u,f]=t.useState(()=>{let e=a??new Date;return e?cn(ln(e)):o.selectWeekPlaceholder}),[p,m]=t.useState(!1),g=t.useCallback((e,t)=>{m(t.open)},[]),_=t.useMemo(()=>(0,d.bundleIcon)(d.CalendarMonthFilled,d.CalendarMonthRegular),[]),v=t.useCallback(e=>{if(e){l(e);let t=ln(e);f(cn(t)),r({startDate:t.start,endDate:t.end}),m(!1)}},[r]),y=t.useMemo(()=>0,[]);return(0,n.jsxs)(i.Menu,{open:p,onOpenChange:g,children:[(0,n.jsx)(i.MenuTrigger,{disableButtonEnhancement:!0,children:(0,n.jsx)(i.MenuButton,{shape:`circular`,icon:(0,n.jsx)(_,{}),style:{minWidth:`200px`},"aria-label":`Select week: ${u}`,children:u})}),(0,n.jsx)(i.MenuPopover,{style:{maxWidth:`fit-content`},children:(0,n.jsx)(i.MenuList,{children:(0,n.jsx)(h.Calendar,{dateRangeType:s,highlightSelectedMonth:!0,showGoToToday:!0,onSelectDate:v,value:c,firstDayOfWeek:y})})})]})}),dn={today:`Today`,previous:`Previous`,next:`Next`},fn=t.memo(({selectedView:e,onSelectedView:r,currentDate:a,setCurrentDate:o,onWeekChange:s,onMonthChange:c,onDayChange:l,strings:u=dn})=>{let f=t.useMemo(()=>(0,d.bundleIcon)(d.ArrowDownFilled,d.ArrowDownRegular),[]),p=t.useMemo(()=>(0,d.bundleIcon)(d.ArrowUpFilled,d.ArrowUpRegular),[]),m=t.useCallback(e=>{s(e.startDate),o(e.startDate)},[s,o]),h=t.useCallback(e=>{c(e),o(e)},[c,o]),g=t.useCallback(e=>{l(e),o(e)},[l,o]),_=t.useCallback(()=>{switch(e){case G.Month:return(0,n.jsx)(on,{onSelected:h,value:a});case G.Week:return(0,n.jsx)(un,{onSelected:m,value:a});case G.Day:return(0,n.jsx)(tn,{onSelected:g,value:a});default:return(0,n.jsx)(on,{onSelected:h,value:a})}},[e,h,m,g,a]),v=t.useCallback(()=>(0,n.jsx)(i.Tooltip,{content:u.today,relationship:`label`,children:(0,n.jsx)(i.Button,{shape:`circular`,icon:(0,n.jsx)(d.CalendarTodayRegular,{}),size:`medium`,onClick:()=>l(new Date),children:u.today})}),[l,u.today]),y=t.useCallback(t=>{let n=new Date(a);switch(e){case G.Month:n.setMonth(n.getMonth()+t),c(n);break;case G.Week:n.setDate(n.getDate()+t*7),s(n);break;case G.Day:n.setDate(n.getDate()+t),l(n);break;default:break}o(n)},[a,e,c,s,l,o]);return(0,n.jsxs)(V,{width:`calc(100% - 40px)`,height:`fit-content`,horizontal:!0,horizontalAlign:`space-between`,verticalAlign:`center`,paddingLeft:`20px`,paddingRight:`20px`,paddingBottom:`10px`,paddingTop:`10px`,columnGap:10,styles:{overflow:`hidden`},children:[(0,n.jsxs)(V,{horizontal:!0,horizontalAlign:`start`,verticalAlign:`center`,columnGap:10,children:[(0,n.jsx)(v,{}),(0,n.jsx)(_,{}),(0,n.jsx)(i.Tooltip,{content:u.previous,relationship:`label`,children:(0,n.jsx)(i.Button,{size:`medium`,icon:(0,n.jsx)(p,{fontSize:14}),onClick:()=>y(-1)})}),(0,n.jsx)(i.Tooltip,{content:u.next,relationship:`label`,children:(0,n.jsx)(i.Button,{size:`medium`,icon:(0,n.jsx)(f,{fontSize:14}),onClick:()=>y(1)})})]}),(0,n.jsx)(V,{horizontal:!0,horizontalAlign:`start`,verticalAlign:`center`,columnGap:10,children:(0,n.jsx)(en,{onSelected:r,value:e})})]})}),pn={allDay:`All Day`},mn=e=>{let{events:r,currentDay:o,height:s,strings:l=pn}=e,{styles:u}=Wt(),[d]=(0,t.useState)(o),[f,p]=(0,t.useState)(32),m=(0,t.useRef)(null),{getSpanSlots:h,getEventColors:g,getCalendarColors:_,formatDate:v}=Ft(),y=(0,a.startOfWeek)(d,{weekStartsOn:0}),b=Intl.DateTimeFormat().resolvedOptions().timeZone,{getWeekEvents:x}=Jt(b);(0,t.useEffect)(()=>{let e=new c.ResizeObserver(()=>{if(m.current){let e=m.current.querySelector(`.dayCell`);e&&p(e.offsetHeight)}});return m.current&&e.observe(m.current),()=>{e.disconnect()}},[]);let S=t.useCallback(()=>Array.from({length:24},(e,r)=>(0,n.jsxs)(t.Fragment,{children:[(0,n.jsx)(`div`,{className:u.timeCell,children:(0,n.jsxs)(i.Body1Strong,{children:[r,`:00`]})}),(0,n.jsx)(`div`,{className:u.timeCell})]},r)),[u.timeCell]),C=t.useCallback(()=>(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:u.blankHeader}),Array.from({length:7},(e,t)=>{let r=(0,a.addDays)(y,t),o=(0,a.isToday)(r)?u.todayHeaderCell:``;return(0,n.jsxs)(`div`,{className:(0,i.mergeClasses)(u.dayHeaderCell,o),children:[(0,n.jsx)(i.Text,{weight:`regular`,size:600,style:{paddingRight:10},children:v(r.toISOString(),`dd`)}),(0,n.jsx)(i.Body1,{children:v(r.toISOString(),`EEE`)})]},t)})]}),[y,u,v]),w=t.useCallback(()=>{let e=x(r,y.toISOString());return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:u.fullDayLabel,children:(0,n.jsx)(i.Body1,{children:l.allDay})}),Array.from({length:7},(t,r)=>{let o=v((0,a.addDays)(y,r).toISOString(),`yyyy-MM-dd`),s=e.find(e=>e.date===o)?.fullDayEvents||[];return(0,n.jsx)(`div`,{className:u.fullDayCell,children:s.map(e=>(0,n.jsx)(`div`,{className:u.fullDayEvent,style:{gridColumn:`${r+2}`,backgroundColor:e.color?_(e.color).backgroundColor:g(e.category).backgroundColor},children:(0,n.jsx)(i.Caption1Strong,{className:u.eventTitle,children:e.title})},e.id))},r)})]})},[y,u,x,_,g,r,v,l.allDay]),T=t.useCallback(()=>{let e=x(r,y.toISOString());return Array.from({length:7},(t,r)=>{let i=(0,a.format)((0,a.addDays)(y,r),`yyyy-MM-dd`);return(0,n.jsx)(n.Fragment,{children:e.find(e=>e.date===i)?.timeSlots.map((e,t)=>{let r=e.events.length;return(0,n.jsx)(`div`,{className:u.dayCell,style:{gridRow:t+3},children:e.events.map((e,i)=>{let{spanSlots:a,startSlot:o}=h(new Date(e.start),new Date(e.end));return t===o?(0,n.jsx)(qt,{event:e,eventCount:r,spanSlots:a,rowHeight:f,eventIndex:i,view:`week`},e.id):null})},t)})})})},[y,u,x,h,f,r]);return(0,n.jsx)(`div`,{className:u.container,style:{height:s},children:(0,n.jsxs)(`div`,{ref:m,className:u.weekGrid,children:[(0,n.jsx)(`div`,{className:u.timeColumn,children:S()}),C(),w(),T()]})})},hn={daysOfWeek:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},gn=({currentDate:e,rowHeight:t,getCalendarDays:r,getEventsForDay:a,styles:o,onDaySlotClick:s,height:c,calendarRef:l,strings:u})=>{let d=u?.daysOfWeek||hn.daysOfWeek;return(0,n.jsx)(V,{height:c,width:`100%`,verticalAlign:`start`,horizontalAlign:`start`,children:(0,n.jsxs)(`div`,{className:o.calendarWrapper,ref:l,role:`grid`,"aria-label":`Calendar`,children:[d.map(e=>(0,n.jsx)(i.Body1,{className:o.dayHeader,role:`columnheader`,children:e},e)),r(e).map((e,r)=>{let{day:i,currentMonth:o}=e,c=o?a(e):[];return(0,n.jsx)(Ut,{day:i,date:e.date,currentMonth:e.currentMonth,events:c,columnHeight:t||0,onDayClick:s},r)})]})})},_n=t.memo(({events:e,currentDay:t,height:r,strings:i})=>(0,n.jsx)(mn,{events:e,currentDay:t,height:r,strings:i})),vn=t.memo(({events:e,currentDay:t,height:r,strings:i})=>(0,n.jsx)(Qt,{currentDay:t,events:e,height:r,strings:i})),yn=({events:e,height:r=800,theme:o,onDayChange:s,onMonthChange:l,onWeekChange:u,onViewChange:d,onDaySlotClick:f,defaultView:p,strings:m})=>{let{styles:h}=Vt(),g=(0,t.useRef)(null),[_,v]=(0,t.useState)(null),y=(0,t.useRef)(0),[b,x]=(0,t.useState)(new Date),[S,C]=(0,t.useState)(p??G.Month),{getMonthCalendar:w}=Jt(Intl.DateTimeFormat().resolvedOptions().timeZone),T=t.useCallback(e=>{let t=e.getMonth(),n=(0,a.startOfWeek)((0,a.startOfMonth)(e));return Array.from({length:42},(e,r)=>{let i=(0,a.addDays)(n,r);return{day:i.getDate(),currentMonth:i.getMonth()===t,date:i}})},[42]),E=t.useCallback(e=>{l&&l(e),x(e)},[l]),D=t.useCallback(e=>{s&&s(e),x(e)},[s]),O=t.useCallback(e=>{u&&u(e),x(e)},[u]),k=t.useCallback(e=>{d&&d(e),C(e)},[d]),A=t.useCallback(t=>{let{date:n}=t;return w(e,b.getFullYear(),b.getMonth())[(0,a.format)(n,`yyyy-MM-dd`)]?.flatMap(e=>e)||[]},[b,e]),j=t.useCallback(()=>{g.current&&requestAnimationFrame(()=>{if(g.current){let e=g.current.querySelector(`.${h.calendarWrapper} > div:nth-child(8)`);e&&(v(e.offsetHeight),y.current=e.offsetHeight)}})},[h.calendarWrapper]);(0,t.useEffect)(()=>{let e=new c.ResizeObserver(j);return g.current&&e.observe(g.current),j(),window.addEventListener(`resize`,j),()=>{e.disconnect(),window.removeEventListener(`resize`,j)}},[j,S]),(0,t.useEffect)(()=>{C(p||G.Month)},[p]);let M=t.useCallback(()=>{switch(S){case G.Month:return(0,n.jsx)(gn,{events:e,currentDate:b,rowHeight:_,getCalendarDays:T,getEventsForDay:A,styles:h,onDaySlotClick:f,height:r,calendarRef:g,strings:m?.calendarControl});case G.Week:return(0,n.jsx)(_n,{events:e,currentDay:b,height:r,strings:m?.weekView});case G.Day:return(0,n.jsx)(vn,{events:e,currentDay:b,height:r,strings:m?.dayView});default:return(0,n.jsx)(gn,{events:e,currentDate:b,rowHeight:_,getCalendarDays:T,getEventsForDay:A,styles:h,onDaySlotClick:f,height:r,calendarRef:g,strings:m?.calendarControl})}},[S,e,b,_,T,A,h,f,r]),N=(0,n.jsxs)(V,{height:`100%`,verticalAlign:`start`,children:[(0,n.jsx)(fn,{selectedView:S,onSelectedView:k,currentDate:b,setCurrentDate:x,onWeekChange:O,onMonthChange:E,onDayChange:D,strings:m?.toolbar}),(0,n.jsx)(M,{})]});return(0,n.jsx)(i.IdPrefixProvider,{value:`calendarControl-`,children:o?(0,n.jsx)(i.FluentProvider,{theme:o,applyStylesToPortals:!0,style:{width:`100%`},children:N}):(0,n.jsx)(`div`,{style:{width:`100%`},children:N})})},bn=()=>({styles:{root:(0,l.css)({containerType:`inline-size`}),header:(0,l.css)({borderBottom:`1px solid ${i.tokens.colorNeutralStroke2}`}),headerBackButton:(0,l.css)({fontSize:`clamp(6px, 3.5cqw, 22px)`}),headerLabel:(0,l.css)({textTransform:`capitalize`}),calendar:(0,l.css)({borderBottom:`1px solid ${i.tokens.colorNeutralStroke2}`,backgroundColor:i.tokens.colorNeutralBackground2}),weekdaysCorner:(0,l.css)({flex:`0 0 32px`}),weekday:(0,l.css)({flex:`1 1 calc(100% / 7)`,maxWidth:`calc(100% / 7)`,textAlign:`center`,textTransform:`capitalize`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`default`,userSelect:`none`,paddingBlock:`4px`,boxSizing:`border-box`}),weekNumber:(0,l.css)({flex:`0 0 28px`,marginInlineEnd:`4px`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`default`,userSelect:`none`}),day:(0,l.css)({flex:`1 1 calc(100% / 7)`,maxWidth:`calc(100% / 7)`,height:`48px`,minWidth:`0 !important`,padding:`4px !important`,fontWeight:500,fontSize:`clamp(6px, 3.5cqw, 22px)`,color:`${i.tokens.colorNeutralForeground1} !important`,cursor:`pointer`,userSelect:`none`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,position:`relative`,zIndex:0,borderRadius:0,"::before":{width:`32px`,height:`32px`,borderRadius:`100%`,content:`""`,position:`absolute`,top:`7px`,left:`calc(50% - 16px)`,zIndex:-1,pointerEvents:`none`},":focus-visible":{zIndex:1,outline:`2px solid ${i.tokens.colorBrandStroke1}`,outlineOffset:`-2px`,borderRadius:i.tokens.borderRadiusMedium},":hover::before":{backgroundColor:i.tokens.colorNeutralBackground1Hover}}),dayHidden:(0,l.css)({visibility:`hidden`,pointerEvents:`none`}),dayWeekend:(0,l.css)({color:`${i.tokens.colorPaletteRedForeground1} !important`}),dayOutside:(0,l.css)({color:`${i.tokens.colorNeutralForeground3} !important`}),dayToday:(0,l.css)({"::before":{backgroundColor:i.tokens.colorNeutralBackground3}}),daySelected:(0,l.css)({color:`${i.tokens.colorNeutralForegroundOnBrand} !important`,"::before":{backgroundColor:i.tokens.colorBrandBackground},":hover::before":{backgroundColor:i.tokens.colorBrandBackgroundHover}}),dayIndicators:(0,l.css)({position:`absolute`,bottom:`2px`,insetInline:0,paddingInlineStart:`2px`}),dayIndicator:(0,l.css)({width:`5px`,height:`5px`,borderRadius:`100%`,marginInlineStart:`-1px`}),eventsList:(0,l.css)({flex:1,minHeight:0,overflowY:`auto`}),eventsHeader:(0,l.css)({textTransform:`capitalize`}),event:(0,l.css)({cursor:`pointer`,borderBottom:`1px solid ${i.tokens.colorNeutralStroke2}`,padding:`0 !important`,borderRadius:0,boxShadow:`none`,":last-child":{borderBottom:`none`},":hover":{backgroundColor:i.tokens.colorNeutralBackground1Hover},":focus-visible":{outline:`2px solid ${i.tokens.colorBrandStroke1}`,outlineOffset:`-2px`,borderRadius:i.tokens.borderRadiusMedium}}),eventColor:(0,l.css)({width:`4px`,borderRadius:`2px`,flexShrink:0,alignSelf:`stretch`}),eventTimeColor:i.tokens.colorNeutralForeground3}}),xn=e=>(0,a.getISOWeek)(e[0]),Sn=t.memo(e=>{let{weeks:r,date:o,selectedDate:s,today:c,orderedShortDays:l,groupedEvents:u,weekendDays:d,highlightToday:f,withOutsideDays:p,withWeekNumbers:m,onDayClick:h,getEventColor:g,locale:_}=e,{styles:v}=bn(),y=t.useRef([]),b=t.useRef(null);b.current=null;let x=t.useCallback((e,t,n)=>{let r=e,i=t;switch(n.key){case`ArrowRight`:i+=1,i>=7&&(i=0,r+=1);break;case`ArrowLeft`:--i,i<0&&(i=6,--r);break;case`ArrowDown`:r+=1;break;case`ArrowUp`:--r;break;default:return}n.preventDefault();let a=y.current[r]?.[i];a&&a instanceof HTMLElement&&a.focus()},[]),S=t.useMemo(()=>(0,n.jsxs)(U,{direction:`horizontal`,marginBottom:i.tokens.spacingVerticalXS,children:[m&&(0,n.jsx)(`div`,{className:v.weekdaysCorner}),l.map((e,t)=>(0,n.jsx)(Dt,{as:`span`,fontSize:i.tokens.fontSizeBase200,fontWeight:`semibold`,color:i.tokens.colorNeutralForeground3,className:v.weekday,style:{textAlign:`center`,width:`100%`},children:e},t))]}),[l,m,v.weekdaysCorner,v.weekday]),C=t.useMemo(()=>r.map((e,t)=>{let r=e.map((e,r)=>{let l=!(0,a.isSameMonth)(e,o),m=d.includes((0,a.getDay)(e)),S=(0,a.isSameDay)(e,c)&&f,C=s?(0,a.isSameDay)(e,s):!1,w=u[(0,a.format)(e,`yyyy-MM-dd`)]||[],T=p||!l;T&&b.current===null&&(b.current={weekIndex:t,dayIndex:r});let E=b.current?.weekIndex===t&&b.current?.dayIndex===r,D=w.slice(0,3).map(e=>(0,n.jsx)(`div`,{className:v.dayIndicator,style:{backgroundColor:g(e)}},e.id));return(0,n.jsxs)(i.Button,{appearance:`transparent`,className:(0,i.mergeClasses)(v.day,!T&&v.dayHidden,l&&T&&!C&&!m&&v.dayOutside,m&&T&&!C&&v.dayWeekend,S&&!C&&v.dayToday,C&&v.daySelected),"aria-label":(0,a.format)(e,`MMMM d, yyyy`,{locale:_}),"aria-selected":C||void 0,tabIndex:T&&E?0:-1,onClick:T?()=>h(e):void 0,onKeyDown:T?e=>x(t,r,e):void 0,ref:e=>{y.current[t]||(y.current[t]=[]),y.current[t][r]=e},children:[T?e.getDate():null,T&&(0,n.jsx)(U,{direction:`horizontal`,justifyContent:`center`,className:v.dayIndicators,children:D})]},e.toISOString())}),l=xn(e);return(0,n.jsxs)(U,{direction:`horizontal`,children:[m&&(0,n.jsx)(Dt,{fontSize:`xs`,color:i.tokens.colorNeutralForeground3,className:v.weekNumber,children:l}),r]},t)}),[r,o,s,c,d,f,p,m,u,g,h,x,v,_]);return(0,n.jsxs)(U,{direction:`vertical`,padding:i.tokens.spacingVerticalS,className:v.calendar,children:[S,C]})}),Cn=t.memo(e=>{let{date:r,renderHeader:o,onYearClick:s,locale:c}=e,{styles:l}=bn(),u=(0,a.format)(r,`MMMM yyyy`,{locale:c}),f=t.useMemo(()=>(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(i.Button,{appearance:`subtle`,className:l.headerBackButton,onClick:s,icon:(0,n.jsx)(d.ChevronRight20Regular,{style:{transform:`rotate(90deg)`}}),children:(0,a.format)(r,`yyyy`)}),(0,n.jsx)(Dt,{fontWeight:`bold`,className:l.headerLabel,children:u})]}),[r,s,l]),p=t.useMemo(()=>typeof o==`function`?o({date:r,defaultHeader:f}):f,[o,r,f]);return(0,n.jsx)(U,{direction:`horizontal`,alignItems:`center`,justifyContent:`space-between`,padding:i.tokens.spacingVerticalS,className:l.header,children:p})}),wn=e=>{let{events:r,header:o,allDayLabel:s,noEventsLabel:c,onEventClick:l,renderEvent:u,getEventColor:d,locale:f}=e,{styles:p}=bn(),m=t.useCallback(e=>{let t=(0,a.format)(new Date(e.start),`p`,{locale:f}),r=(0,a.format)(new Date(e.end),`p`,{locale:f}),o=e.isFullDay||t===`00:00`&&r===`00:00`;return(0,n.jsx)(Xe,{className:p.event,onClick:t=>l?.(e,t),cardBody:(0,n.jsxs)(U,{direction:`horizontal`,gap:`s`,paddingTop:i.tokens.spacingVerticalXS,paddingBottom:i.tokens.spacingVerticalXS,children:[(0,n.jsx)(`div`,{className:p.eventColor,style:{backgroundColor:d(e)}}),(0,n.jsxs)(U,{direction:`vertical`,children:[(0,n.jsx)(Dt,{as:`span`,fontWeight:`semibold`,fontSize:`s`,children:e.title}),(0,n.jsx)(Dt,{as:`span`,fontSize:`xs`,color:p.eventTimeColor,children:o?s:`${t} – ${r}`})]})]})},e.id)},[s,d,l,p]);return(0,n.jsxs)(U,{direction:`vertical`,padding:i.tokens.spacingVerticalS,className:p.eventsList,children:[(0,n.jsx)(Dt,{as:`span`,fontWeight:`bold`,marginBottom:i.tokens.spacingVerticalS,className:p.eventsHeader,children:o}),(0,n.jsx)(U,{direction:`vertical`,gap:`s`,style:{backgroundColor:`transparent`},padding:`s`,children:r.length>0?r.map(e=>u?u(e,m(e)):m(e)):(0,n.jsx)(Dt,{block:!0,color:i.tokens.colorNeutralForeground3,paddingTop:i.tokens.spacingVerticalXXL,paddingBottom:i.tokens.spacingVerticalXXL,style:{textAlign:`center`},children:c})})]})},Tn=e=>{let t=(0,a.startOfDay)(new Date(e.start)),n=(0,a.startOfDay)(new Date(e.end));return t.getTime()!==n.getTime()},En=(e,t)=>{if(Tn(e)){let n=(0,a.startOfDay)(new Date(e.start)),r=(0,a.startOfDay)(new Date(e.end)),i=n;for(;(0,a.isBefore)(i,r)||(0,a.isEqual)(i,r);){let n=(0,a.format)(i,`yyyy-MM-dd`);t[n]||(t[n]=[]),t[n].push(e),i=(0,a.addDays)(i,1)}return}let n=(0,a.format)(new Date(e.start),`yyyy-MM-dd`);t[n]||(t[n]=[]),t[n].push(e)},Dn=(e,t)=>{let n={};if(!t)return n;let r=new Set;for(let i of t)if((0,a.isSameMonth)(new Date(i.start),e)){if(r.has(i.id)){console.warn(`[CompactCalendar] Duplicate event id found: ${i.id}`);continue}r.add(i.id),En(i,n)}return n},On=(e,n)=>(0,t.useMemo)(()=>Dn(e,n),[e,n]),kn={en:o.enUS,"en-US":o.enUS,"en-us":o.enUS,ar:o.ar,"ar-SA":o.arSA,"ar-sa":o.arSA,az:o.az,"az-AZ":o.az,bg:o.bg,"bg-BG":o.bg,bs:o.bs,"bs-BA":o.bs,ca:o.ca,"ca-ES":o.ca,cs:o.cs,"cs-CZ":o.cs,cy:o.cy,da:o.da,"da-DK":o.da,de:o.de,"de-DE":o.de,el:o.el,"el-GR":o.el,es:o.es,"es-ES":o.es,et:o.et,"et-EE":o.et,eu:o.eu,fi:o.fi,"fi-FI":o.fi,fr:o.fr,"fr-FR":o.fr,gl:o.gl,he:o.he,"he-IL":o.he,hi:o.hi,"hi-IN":o.hi,hr:o.hr,"hr-HR":o.hr,hu:o.hu,"hu-HU":o.hu,id:o.id,"id-ID":o.id,it:o.it,"it-IT":o.it,ja:o.ja,"ja-JP":o.ja,kk:o.kk,"kk-KZ":o.kk,ko:o.ko,"ko-KR":o.ko,lt:o.lt,"lt-LT":o.lt,lv:o.lv,"lv-LV":o.lv,mk:o.mk,"mk-MK":o.mk,ms:o.ms,"ms-MY":o.ms,nb:o.nb,"nb-NO":o.nb,nl:o.nl,"nl-NL":o.nl,pl:o.pl,"pl-PL":o.pl,pt:o.pt,"pt-PT":o.pt,"pt-BR":o.ptBR,ro:o.ro,"ro-RO":o.ro,ru:o.ru,"ru-RU":o.ru,sk:o.sk,"sk-SK":o.sk,sl:o.sl,"sl-SI":o.sl,sr:o.sr,"sr-RS":o.sr,sv:o.sv,"sv-SE":o.sv,th:o.th,"th-TH":o.th,tr:o.tr,"tr-TR":o.tr,uk:o.uk,"uk-UA":o.uk,vi:o.vi,"vi-VN":o.vi,zh:o.zhCN,"zh-CN":o.zhCN};function An(e){return e?typeof e==`object`&&e?e:kn[e]||(kn[e.split(`-`)[0].toLowerCase()]??o.enUS):o.enUS}var jn=[0,6],Mn=(e,t,n)=>{let r=(0,a.startOfMonth)(e),i=(0,a.getDay)(r),o=(0,a.getDaysInMonth)(e),s=(i-t+7)%7,c=(0,a.subDays)(r,s),l=n?42:Math.ceil((s+o)/7)*7,u=[],d=c;for(let e=0;e<l;e++){let t=Math.floor(e/7);u[t]||(u[t]=[]),u[t].push(d),d=(0,a.addDays)(d,1)}return u},Nn=r=>{let{date:o,selectedDate:s,defaultSelectedDate:c,onSelectedDateChange:l,withWeekNumbers:u=!1,firstDayOfWeek:d=1,weekendDays:f=jn,consistentWeeks:p=!0,highlightToday:m=!0,withOutsideDays:h=!1,events:g,onDayClick:_,onEventClick:v,onYearClick:y,renderHeader:b,renderEvent:x,eventsHeaderFormat:S=`EEEE, MMMM d`,locale:C,height:w,className:T,strings:E}=r,{styles:D}=bn(),{getCalendarColors:O}=Ft(),k=e.s(),A=e.m(),j=t.useMemo(()=>An(C??A?.locale),[C,A?.locale]),[M,N]=t.useState(c??new Date),P=s===void 0?M:s,F=t.useCallback(e=>{s===void 0&&N(e),l?.(e)},[s,l]),I=t.useMemo(()=>new Date,[]),L=On(o,g),R=E?.shortDays??k.shortDays,z=t.useMemo(()=>{let e=[];for(let t=0;t<7;t++)e.push(R[(d+t)%7]);return e},[R,d]),ee=t.useMemo(()=>Mn(o,d,p),[o,d,p]),te=t.useCallback(e=>e.hexColor?e.hexColor:e.color?O(e.color).backgroundColor:O(`royal-blue`).backgroundColor,[O]),ne=t.useCallback(e=>{F(e),_?.(e)},[F,_]),re=P?(0,a.format)(P,`yyyy-MM-dd`):``,B=re?(L[re]||[]).sort((e,t)=>new Date(e.start).getTime()-new Date(t.start).getTime()):[],ie=P?(0,a.format)(P,S,{locale:j}):``;return(0,n.jsxs)(U,{direction:`vertical`,height:w??`100%`,className:(0,i.mergeClasses)(D.root,T),children:[(0,n.jsx)(Cn,{date:o,renderHeader:b,onYearClick:y,locale:j}),(0,n.jsx)(Sn,{weeks:ee,date:o,selectedDate:P,today:I,orderedShortDays:z,groupedEvents:L,weekendDays:f,highlightToday:m,withOutsideDays:h,withWeekNumbers:u,onDayClick:ne,getEventColor:te,locale:j}),(0,n.jsx)(wn,{events:B,header:ie,allDayLabel:E?.allDay??k.allDay,noEventsLabel:E?.noEvents??k.noEvents,onEventClick:v,renderEvent:x,getEventColor:te,locale:j})]})},Pn=(0,g.atom)(!1),Fn=(0,g.atom)(-1),In=(0,g.atom)(``),Ln=(0,g.atom)(``),Rn=(0,g.atom)(new Set),zn=(0,g.atom)(!0),Bn=(0,g.atom)(void 0);function Vn(){return(0,g.createStore)()}var Hn=Vn();function Un(e){return{opened:e.get(Pn),selected:e.get(Fn),listId:e.get(In),query:e.get(Ln),registeredActions:e.get(Rn)}}var K={open(e){e.set(Pn,!0),e.set(Fn,-1)},close(e){e.set(Pn,!1)},toggle(e){e.get(Pn)?e.set(Pn,!1):(e.set(Pn,!0),e.set(Fn,-1))},setQuery(e,t){t.get(Bn)?.(e),t.set(Ln,e),Promise.resolve().then(()=>{K.selectAction(0,t)})},setListId(e,t){t.set(In,e)},selectAction(e,t){let n=t.get(In),r=n?document.getElementById(n):null,i=r?.querySelector(`[data-spotlight-selected]`),a=r?.querySelectorAll(`[data-spotlight-action]`)??[];if(a.length===0)return t.set(Fn,-1),-1;let o=e<0?a.length-1:e>=a.length?0:e,s=Math.max(0,Math.min(o,a.length-1));return i?.removeAttribute(`data-spotlight-selected`),a[s]?.scrollIntoView({block:`nearest`}),a[s]?.setAttribute(`data-spotlight-selected`,`true`),t.set(Fn,s),s},selectNextAction(e){return K.selectAction(e.get(Fn)+1,e)},selectPreviousAction(e){return K.selectAction(e.get(Fn)-1,e)},triggerSelectedAction(e){let t=e.get(In);(t?document.querySelector(`#${t} [data-spotlight-selected]`):null)?.click()},clearState(e,t){t.set(Fn,-1),e.clearQuery&&t.set(Ln,``)}},Wn={open:()=>K.open(Hn),close:()=>K.close(Hn),toggle:()=>K.toggle(Hn)},Gn=Wn.open,Kn=Wn.close,qn=Wn.toggle;function Jn(){let e=Vn();return[e,{open:()=>K.open(e),close:()=>K.close(e),toggle:()=>K.toggle(e)}]}function Yn(e=Hn){let[n,r]=(0,t.useState)(()=>Un(e));return(0,t.useEffect)(()=>{let t=()=>r(Un(e)),n=[e.sub(Pn,t),e.sub(Fn,t),e.sub(In,t),e.sub(Ln,t),e.sub(Rn,t)];return t(),()=>n.forEach(e=>e())},[e]),n}function Xn(e){let t=e.toLowerCase().split(`+`).map(e=>e.trim()),n=typeof navigator<`u`&&/Mac|iPhone|iPad|iPod/i.test(navigator.userAgent);return{key:t[t.length-1],ctrlKey:t.includes(`ctrl`)||!n&&t.includes(`mod`),metaKey:t.includes(`meta`)||n&&t.includes(`mod`),shiftKey:t.includes(`shift`),altKey:t.includes(`alt`)}}function Zn(e,n=Hn,r=[`INPUT`,`TEXTAREA`,`SELECT`]){let i=(0,t.useCallback)(t=>{if(!e)return;let i=t.target;if(r.includes(i.tagName)||i.isContentEditable)return;let a=Array.isArray(e)?e:[e];for(let e of a){let r=Xn(e);if(t.key.toLowerCase()===r.key&&t.ctrlKey===r.ctrlKey&&t.metaKey===r.metaKey&&t.shiftKey===r.shiftKey&&t.altKey===r.altKey){t.preventDefault(),K.toggle(n);return}}},[e,n,r]);(0,t.useEffect)(()=>{if(e)return document.addEventListener(`keydown`,i),()=>document.removeEventListener(`keydown`,i)},[e,i])}var Qn=()=>({backdrop:(0,l.css)({position:`fixed`,inset:0,backgroundColor:`rgba(0, 0, 0, 0.35)`,backdropFilter:`blur(4px)`,zIndex:999999}),surface:(0,l.css)({padding:`0 !important`,overflow:`hidden`,borderRadius:i.tokens.borderRadiusXLarge,boxShadow:i.tokens.shadow64}),search:(0,l.css)({padding:i.tokens.spacingVerticalM,paddingInline:i.tokens.spacingHorizontalL,width:`100%`,boxSizing:`border-box`,"& > div":{width:`100%`}}),actionsList:(0,l.css)({borderTop:`1px solid ${i.tokens.colorNeutralStroke2}`,overflowY:`auto`}),action:(0,l.css)({alignItems:`flex-start`,width:`100%`,padding:`${i.tokens.spacingVerticalS} ${i.tokens.spacingHorizontalL}`,textAlign:`left`,gap:i.tokens.spacingHorizontalM,transition:`background-color 0.1s ease`,"&:hover":{backgroundColor:i.tokens.colorNeutralBackground1Hover},'&[data-spotlight-selected="true"]':{backgroundColor:i.tokens.colorBrandBackground,color:i.tokens.colorNeutralForegroundOnBrand}}),actionBody:(0,l.css)({flex:1,minWidth:0}),actionSectionLeft:(0,l.css)({flexShrink:0,fontSize:`30px`,paddingTop:`2px`,color:i.tokens.colorNeutralForeground3,'[data-spotlight-selected="true"] &':{color:i.tokens.colorNeutralForegroundOnBrand,opacity:.85}}),actionSectionRight:(0,l.css)({flexShrink:0,color:i.tokens.colorNeutralForeground3,'[data-spotlight-selected="true"] &':{color:i.tokens.colorNeutralForegroundOnBrand,opacity:.7}}),actionDescription:(0,l.css)({'[data-spotlight-selected="true"] &':{color:i.tokens.colorNeutralForegroundOnBrand,opacity:.7}}),actionsGroup:(0,l.css)({"&:not(:first-child)":{marginTop:i.tokens.spacingVerticalM}}),actionsGroupLabel:(0,l.css)({textTransform:`uppercase`,paddingInline:i.tokens.spacingHorizontalL,paddingBlock:i.tokens.spacingVerticalXS}),empty:(0,l.css)({padding:i.tokens.spacingVerticalL}),footer:(0,l.css)({borderTop:`1px solid ${i.tokens.colorNeutralStroke2}`}),highlight:(0,l.css)({backgroundColor:i.tokens.colorPaletteYellowBackground2,color:`inherit`,borderRadius:i.tokens.borderRadiusSmall,padding:`0 1px`,'[data-spotlight-selected="true"] &':{backgroundColor:`rgba(255, 255, 255, 0.3)`}})}),$n=({store:e=Hn,query:r,onQueryChange:a,clearQueryOnClose:o=!0,shortcut:s=`mod+K`,tagsToIgnore:c=[`INPUT`,`TEXTAREA`,`SELECT`],disabled:l=!1,onSpotlightOpen:u,onSpotlightClose:d,forceOpened:f=!1,closeOnActionTrigger:p=!0,maxWidth:m=600,yOffset:h=80,maxHeight:_=400,scrollable:v=!0,children:y,className:b})=>{let x=Qn(),{opened:S}=Yn(e),C=(0,t.useRef)(S);(0,t.useEffect)(()=>{e.set(zn,p)},[e,p]),(0,t.useEffect)(()=>{e.set(Bn,a)},[e,a]),(0,t.useEffect)(()=>{typeof r==`string`&&e.set(Ln,r)},[e,r]),Zn(s,e,c),(0,t.useEffect)(()=>{C.current!==S&&(C.current=S,S?u?.():(d?.(),o&&K.setQuery(``,e),K.clearState({clearQuery:o},e)))},[S,u,d,o,e]);let w=(0,t.useCallback)(()=>{K.close(e)},[e]);if(l)return null;let T=S||f,E={position:`fixed`,top:typeof h==`number`?`${h}px`:h,left:`50%`,transform:`translateX(-50%)`,maxWidth:typeof m==`number`?`${m}px`:m,width:`100%`,zIndex:1e6,maxHeight:v?`calc(100vh - ${typeof h==`number`?`${h*2}px`:h})`:void 0,display:`flex`,flexDirection:`column`},D={display:`flex`,flexDirection:`column`,overflow:`hidden`,maxHeight:v?typeof _==`number`?`${_}px`:_:void 0,gap:0,padding:0};return(0,n.jsx)(g.Provider,{store:e,children:T&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:x.backdrop,onClick:w,"aria-hidden":`true`}),(0,n.jsx)(i.Dialog,{open:!0,modalType:`non-modal`,onOpenChange:(t,n)=>{n.open||K.close(e)},children:(0,n.jsx)(i.DialogSurface,{className:`${x.surface}${b?` ${b}`:``}`,style:E,"aria-label":`Spotlight search`,children:(0,n.jsx)(i.DialogBody,{style:D,children:y})})})]})})},er=()=>({searchBoxStyles:_.css`
|
|
32
32
|
border: 1px solid ${i.tokens.colorNeutralStroke2};
|
|
33
33
|
border-radius: 50px;
|
|
34
34
|
background-color: ${i.tokens.colorNeutralBackground1};
|
|
@@ -141,7 +141,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
141
141
|
align-items: center;
|
|
142
142
|
padding: 2px;
|
|
143
143
|
margin-right: 8px;
|
|
144
|
-
`}),tr=({placeholder:n,onSearch:r,onChange:a,onClear:o,disabled:s=!1,className:c,width:l,value:u,shape:f=`circular`,contentBefore:p,size:m})=>{let[h,g]=(0,t.useState)(``),_=(0,t.useRef)(null),{searchBoxStyles:y,searchBoxNormalStyles:b,iconWrapperStyles:x}=er(),S=e.v(),C=n||S.placeholder,w=u!==void 0,T=w?u:h,E=f===`circular`?y:b,D=(0,t.useCallback)((e,t)=>{w||g(t.value),a?.(t.value)},[w,a]),O=(0,t.useCallback)(()=>{w||g(``),_.current?.blur(),o?.(),r?.(``)},[w,o,r]),k=(0,t.useCallback)(e=>{e.key===`Enter`&&T.trim()?r?.(T.trim()):e.key===`Escape`&&(_.current?.blur(),w||g(``),o?.())},[T,w,r,o]);return(0,v.jsx)(i.SearchBox,{ref:_,css:E,className:c,style:{width:l},placeholder:C,value:T,onChange:D,onKeyDown:k,disabled:s,size:m,contentBefore:p??(0,v.jsx)(`span`,{css:x,children:(0,v.jsx)(d.SearchRegular,{})}),dismiss:{onClick:O}})},nr=t.memo(function({placeholder:r,size:i=`large`,onKeyDown:a,onChange:o,className:s}){let c=(0,g.useStore)(),u=(0,g.useAtomValue)(Ln),d=Qn(),f=e.b(),[p,m]=(0,t.useState)(!1),h=(0,t.useRef)(null),_=(0,t.useRef)(p),v=r||f.searchPlaceholder,y=t.useCallback(e=>{K.setQuery(e,c),o?.(e)},[c,o]);return _.current=p,(0,t.useEffect)(()=>{let e=h.current;if(!e)return;let t=e=>{a?.(e),!_.current&&(e.key===`ArrowDown`&&(e.preventDefault(),K.selectNextAction(c)),e.key===`ArrowUp`&&(e.preventDefault(),K.selectPreviousAction(c)),e.key===`Enter`&&(e.preventDefault(),K.triggerSelectedAction(c)))},n=()=>m(!0),r=()=>m(!1);return e.addEventListener(`keydown`,t),e.addEventListener(`compositionstart`,n),e.addEventListener(`compositionend`,r),()=>{e.removeEventListener(`keydown`,t),e.removeEventListener(`compositionstart`,n),e.removeEventListener(`compositionend`,r)}},[a,c]),(0,n.jsx)(U,{ref:h,className:`${d.search}${s?` ${s}`:``}`,children:(0,n.jsx)(tr,{value:u,onChange:y,placeholder:v,size:i,shape:`circular`,className:(0,l.css)({maxWidth:`100% !important`})})})});function rr({text:e,query:r,highlightClassName:i}){if(!r.trim())return(0,n.jsx)(n.Fragment,{children:e});let a=r.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);return(0,n.jsx)(n.Fragment,{children:e.split(RegExp(`(${a})`,`gi`)).map((e,a)=>e.toLowerCase()===r.toLowerCase()?(0,n.jsx)(`mark`,{className:i,children:e},a):(0,n.jsx)(t.Fragment,{children:e},a))})}var ir=t.memo(function({label:e,description:r,leftSection:a,rightSection:o,children:s,highlightQuery:c=!1,closeSpotlightOnTrigger:l,onClick:u,className:d}){let f=(0,g.useStore)(),p=(0,g.useAtomValue)(Ln),m=(0,g.useAtomValue)(zn),h=Qn(),_=(0,t.useMemo)(()=>e=>{u?.(e),(l??m)&&K.close(f)},[u,l,m,f]),v=(0,t.useMemo)(()=>e=>{e.preventDefault()},[]),y=(0,t.useMemo)(()=>e?c&&typeof e==`string`?(0,n.jsx)(Dt,{as:`span`,fontSize:`m`,fontWeight:`regular`,children:(0,n.jsx)(rr,{text:e,query:p,highlightClassName:h.highlight})}):(0,n.jsx)(Dt,{as:`span`,fontSize:`m`,fontWeight:`regular`,children:e}):null,[e,c,p,h.highlight]);return(0,n.jsx)(i.Button,{"data-spotlight-action":!0,role:`option`,appearance:`subtle`,className:`${h.action}${d?` ${d}`:``}`,onClick:_,onMouseDown:v,tabIndex:-1,children:s||(0,n.jsxs)(n.Fragment,{children:[a&&(0,n.jsx)(U,{direction:`horizontal`,alignItems:`start`,justifyContent:`start`,className:h.actionSectionLeft,children:a}),(0,n.jsxs)(U,{direction:`vertical`,gap:`none`,className:h.actionBody,children:[y,r&&(0,n.jsx)(Dt,{as:`span`,fontSize:`xs`,color:`dimmed`,className:h.actionDescription,numberOfLines:1,children:r})]}),o&&(0,n.jsx)(U,{direction:`horizontal`,alignItems:`center`,justifyContent:`center`,className:h.actionSectionRight,children:o})]})})}),ar=t.memo(function({label:e,children:t,className:r}){let i=Qn();return(0,n.jsxs)(U,{direction:`vertical`,className:`${i.actionsGroup}${r?` ${r}`:``}`,children:[e&&(0,n.jsx)(Dt,{as:`span`,fontSize:`xs`,fontWeight:`bold`,color:`dimmed`,className:i.actionsGroupLabel,children:e}),t]})}),or=t.memo(function({children:e,className:r,id:i}){let a=(0,g.useStore)(),o=Qn(),s=(0,t.useId)().replace(/:/g,``),c=i||`spotlight-${s}`,l=(0,t.useRef)(null);return(0,t.useEffect)(()=>{let e=l.current;e&&(e.id=c,e.setAttribute(`role`,`listbox`),e.setAttribute(`aria-label`,`Actions`))},[c]),(0,t.useEffect)(()=>(K.setListId(c,a),()=>K.setListId(``,a)),[c,a]),(0,n.jsx)(U,{ref:l,direction:`vertical`,padding:`xs`,className:`${o.actionsList}${r?` ${r}`:``}`,children:e})}),sr=t.memo(function({children:e,className:t}){return(0,n.jsx)(U,{direction:`vertical`,alignItems:`center`,justifyContent:`center`,padding:`l`,className:t,children:(0,n.jsx)(Dt,{as:`p`,fontSize:`s`,color:`dimmed`,children:e})})}),cr=t.memo(function({children:e,className:t}){let r=Qn();return(0,n.jsx)(U,{padding:`${i.tokens.spacingVerticalS} ${i.tokens.spacingHorizontalL}`,className:`${r.footer}${t?` ${t}`:``}`,children:e})}),lr=e=>Array.isArray(e)?e.map(e=>e.trim()).join(`,`).toLowerCase().trim():typeof e==`string`?e.toLowerCase().trim():``,ur=e=>e.group!==void 0&&Array.isArray(e.actions),dr=e=>e.reduce((e,t)=>ur(t)?[...e,...t.actions.map(e=>({...e,group:t.group}))]:[...e,t],[]),fr=e=>{let t={},n=[];return e.forEach(e=>{e.group?(t[e.group]||(t[e.group]={pushed:!1,data:{group:e.group,actions:[]}}),t[e.group].data.actions.push(e),t[e.group].pushed||(t[e.group].pushed=!0,n.push(t[e.group].data))):n.push(e)}),n},pr=(e,t)=>{let n=(e??``).trim().toLowerCase();if(!n)return t;let r=[[],[]];return dr(t).forEach(e=>{e.label?.toLowerCase().includes(n)?r[0].push(e):(e.description?.toLowerCase().includes(n)||lr(e.keywords).includes(n))&&r[1].push(e)}),fr(r.flat())},mr=(e,t)=>{if(!Array.isArray(e))return[];let n=0;return e.reduce((e,r)=>{if(n>=t)return e;if(ur(r)){let i=mr(r.actions,t-n);e.push({group:r.group,actions:i}),n+=i.length}else e.push(r),n+=1;return e},[])},hr=({searchProps:r,actions:i,filter:a=pr,nothingFound:o,highlightQuery:s=!1,limit:c=1/0,query:l,onQueryChange:u,store:d=Hn,...f})=>{let p=e.b(),[m,h]=(0,t.useState)(``),g=typeof l==`string`,_=(g?l:m)??``,v=(0,t.useCallback)(e=>{g||h(e),u?.(e)},[g,u]),y=(0,t.useMemo)(()=>mr(a(_,i),c),[_,i,a,c]),b=o??p.nothingFound,x=(0,t.useMemo)(()=>y.map(e=>{if(ur(e)){let t=e.actions.map(({id:e,...t})=>(0,n.jsx)(ir,{highlightQuery:s,...t},e));return(0,n.jsx)(ar,{label:e.group,children:t},e.group)}return(0,n.jsx)(ir,{highlightQuery:s,...e},e.id)}),[y,s]);return(0,n.jsxs)($n,{...f,store:d,query:_,onQueryChange:v,children:[(0,n.jsx)(nr,{...r}),x.length>0&&(0,n.jsx)(or,{children:x}),x.length===0&&b&&(0,n.jsx)(sr,{children:b})]})};hr.Root=$n,hr.Search=nr,hr.Action=ir,hr.ActionsGroup=ar,hr.ActionsList=or,hr.Empty=sr,hr.Footer=cr;var gr=(0,t.createContext)(null),_r=gr.Provider,vr=()=>{let e=(0,t.useContext)(gr);if(!e)throw Error(`useDropzoneContext must be used within a <Dropzone> component`);return e};function yr(e){let t=({children:t})=>vr()[e]?(0,n.jsx)(n.Fragment,{children:t}):null;return t.displayName=`Dropzone${e.charAt(0).toUpperCase()+e.slice(1)}`,t}var br=yr(`accept`),xr=yr(`reject`),Sr=yr(`idle`),Cr=(e=`outline`,t)=>{let n=t??i.tokens.borderRadiusMedium;return{root:(0,l.css)({position:`relative`,display:`flex`,alignItems:`center`,justifyContent:`center`,border:e===`outline`?`2px dashed ${i.tokens.colorNeutralStroke2}`:`none`,borderRadius:n,backgroundColor:e===`filled`?i.tokens.colorNeutralBackground3:i.tokens.colorNeutralBackground1,padding:i.tokens.spacingVerticalL+` `+i.tokens.spacingHorizontalL,cursor:`pointer`,userSelect:`none`,transition:`background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease`,outline:`none`,"&:hover":{borderColor:e===`outline`?i.tokens.colorBrandStroke1:void 0,backgroundColor:e===`filled`?i.tokens.colorNeutralBackground3Hover:i.tokens.colorNeutralBackground1Hover},"&:focus-visible":{borderColor:i.tokens.colorBrandStroke1,boxShadow:`0 0 0 2px ${i.tokens.colorStrokeFocus2}`}}),rootAccept:(0,l.css)({borderColor:i.tokens.colorPaletteGreenBorder1,backgroundColor:i.tokens.colorPaletteGreenBackground1,"&:hover":{borderColor:i.tokens.colorPaletteGreenBorder1,backgroundColor:i.tokens.colorPaletteGreenBackground1}}),rootReject:(0,l.css)({borderColor:i.tokens.colorPaletteRedBorder1,backgroundColor:i.tokens.colorPaletteRedBackground1,"&:hover":{borderColor:i.tokens.colorPaletteRedBorder1,backgroundColor:i.tokens.colorPaletteRedBackground1}}),rootDisabled:(0,l.css)({opacity:.5,cursor:`default`,pointerEvents:`none`}),inner:(0,l.css)({display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,width:`100%`,pointerEvents:`none`}),loadingOverlay:(0,l.css)({position:`absolute`,inset:0,display:`flex`,alignItems:`center`,justifyContent:`center`,backgroundColor:i.tokens.colorNeutralBackgroundAlpha,borderRadius:n,zIndex:1}),fullScreen:(0,l.css)({position:`fixed`,inset:0,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:i.tokens.spacingVerticalXXXL+` `+i.tokens.spacingHorizontalXXXL,backgroundColor:i.tokens.colorNeutralBackgroundAlpha})}},wr=(e,t)=>{typeof e==`function`?e(t):e&&typeof e==`object`&&`current`in e&&(e.current=t)},Tr=Object.assign(t.forwardRef((t,r)=>{let{onDrop:a,onDropAny:o,onReject:s,accept:c,multiple:l=!0,maxSize:u=1/0,maxFiles:d,name:f,disabled:p=!1,loading:m=!1,openRef:h,activateOnClick:g=!0,activateOnDrag:_=!0,activateOnKeyboard:v=!0,dragEventsBubbling:b=!0,onDragEnter:x,onDragLeave:S,onDragOver:C,onFileDialogCancel:w,onFileDialogOpen:T,preventDropOnDocument:E=!0,useFsAccessApi:D=!0,getFilesFromEvent:O,validator:k,enablePointerEvents:A=!1,spinnerProps:j,inputProps:M,appearance:N=`outline`,borderRadius:P,className:F,styles:I,children:L,"aria-label":R,...z}=t,ee=e.l(),te=Cr(N,P),ne=Array.isArray(c)?c.reduce((e,t)=>(e[t]=[],e),{}):c,{getRootProps:re,getInputProps:B,isDragActive:ie,isDragAccept:ae,isDragReject:oe,open:se}=(0,y.useDropzone)({onDrop:o,onDropAccepted:a,onDropRejected:s,disabled:p||m,accept:ne,multiple:l,maxSize:u,maxFiles:d,noClick:!g,noDrag:!_,noDragEventsBubbling:!b,noKeyboard:!v,onDragEnter:x,onDragLeave:S,onDragOver:C,onFileDialogCancel:w,onFileDialogOpen:T,preventDropOnDocument:E,useFsAccessApi:D,validator:k,...O?{getFilesFromEvent:O}:null});wr(h,se);let ce=ie&&ae,le=ie&&oe,ue=!ce&&!le,de=(0,i.mergeClasses)(te.root,ce&&te.rootAccept,le&&te.rootReject,(p||m)&&te.rootDisabled,F),{verticalSpacing:fe,horizontalSpacing:pe,paddingLeft:me,paddingRight:he,paddingTop:ge,paddingBottom:_e,padding:ve,margin:ye,marginLeft:be,marginRight:xe,marginTop:Se,marginBottom:Ce,background:we,width:Te,height:Ee,maxWidth:De,maxHeight:Oe,...ke}=z;return(0,n.jsx)(_r,{value:{accept:ce,reject:le,idle:ue},children:(0,n.jsxs)(`div`,{...re({ref:r,className:de,style:I,role:`button`,tabIndex:0,"aria-label":R??ee.dropHere,"aria-disabled":p||m||void 0,...ke}),children:[m&&(0,n.jsx)(`div`,{className:te.loadingOverlay,children:(0,n.jsx)(i.Spinner,{size:`medium`,label:ee.loading,...j})}),(0,n.jsx)(`input`,{...B(M),name:f}),(0,n.jsx)(`div`,{className:te.inner,style:A?{pointerEvents:`auto`}:void 0,children:L})]})})}),{Accept:br,Reject:xr,Idle:Sr,displayName:`Dropzone`}),Er=t.forwardRef((e,r)=>{let{active:a=!0,zIndex:o=9999,onDrop:s,onReject:c,children:u,className:d,...f}=e,[p,m]=t.useState(0),[h,g]=t.useState(!1);t.useEffect(()=>{p===0&&g(!1)},[p]),t.useEffect(()=>{if(!a)return;let e=e=>{e.dataTransfer?.types.includes(`Files`)&&(e.preventDefault(),m(e=>e+1),g(!0))},t=()=>{m(e=>e-1)},n=e=>{e.dataTransfer?.types.includes(`Files`)&&e.preventDefault()},r=e=>{e.preventDefault(),m(0),g(!1)};return document.addEventListener(`dragenter`,e,!1),document.addEventListener(`dragleave`,t,!1),document.addEventListener(`dragover`,n,!1),document.addEventListener(`drop`,r,!1),()=>{document.removeEventListener(`dragenter`,e,!1),document.removeEventListener(`dragleave`,t,!1),document.removeEventListener(`dragover`,n,!1),document.removeEventListener(`drop`,r,!1)}},[a]);let _=t.useCallback(e=>{s?.(e),g(!1),m(0)},[s]),v=t.useCallback(e=>{c?.(e),g(!1),m(0)},[c]);if(!h)return null;let y=(0,l.css)({position:`fixed`,inset:0,display:h?`flex`:`none`,alignItems:`center`,justifyContent:`center`,padding:i.tokens.spacingVerticalXXXL+` `+i.tokens.spacingHorizontalXXXL,backgroundColor:i.tokens.colorBackgroundOverlay,zIndex:o}),b=(0,l.css)({width:`100%`,maxWidth:`600px`,minHeight:`200px`});return(0,n.jsx)(i.Portal,{children:(0,n.jsx)(`div`,{ref:r,className:y,children:(0,n.jsx)(Tr,{...f,activateOnClick:!1,onDrop:_,onReject:v,className:b,children:u})})})});Er.displayName=`DropzoneFullScreen`;var Dr={png:`image/png`,gif:`image/gif`,jpeg:`image/jpeg`,svg:`image/svg+xml`,webp:`image/webp`,avif:`image/avif`,heic:`image/heic`,heif:`image/heif`,mp4:`video/mp4`,zip:`application/zip`,rar:`application/x-rar`,"7z":`application/x-7z-compressed`,csv:`text/csv`,pdf:`application/pdf`,doc:`application/msword`,docx:`application/vnd.openxmlformats-officedocument.wordprocessingml.document`,xls:`application/vnd.ms-excel`,xlsx:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,ppt:`application/vnd.ms-powerpoint`,pptx:`application/vnd.openxmlformats-officedocument.presentationml.presentation`,exe:`application/vnd.microsoft.portable-executable`},Or=[Dr.png,Dr.gif,Dr.jpeg,Dr.svg,Dr.webp,Dr.avif,Dr.heic,Dr.heif],kr=[Dr.pdf],Ar=[Dr.doc,Dr.docx],jr=[Dr.xls,Dr.xlsx],Mr=[Dr.ppt,Dr.pptx],Nr=[Dr.exe],Pr=(0,t.createContext)(null),Fr=Pr.Provider;function Ir(){let e=(0,t.useContext)(Pr);if(!e)throw Error(`RichTextEditor component was not found in tree`);return e}var Lr=(e=`default`)=>{let t=e===`subtle`,n=t?`32px`:`26px`,r=t?`32px`:`26px`,a=t?`20px`:`16px`;return{root:(0,l.css)({position:`relative`,border:`1px solid ${i.tokens.colorNeutralStroke2}`,borderRadius:i.tokens.borderRadiusMedium}),toolbar:(0,l.css)({display:`flex`,alignItems:`center`,flexWrap:`wrap`,gap:i.tokens.spacingHorizontalS,backgroundColor:i.tokens.colorNeutralBackground1,zIndex:1,borderTopLeftRadius:i.tokens.borderRadiusMedium,borderTopRightRadius:i.tokens.borderRadiusMedium,borderBottom:`1px solid ${i.tokens.colorNeutralStroke2}`,padding:t?`4px`:`${i.tokens.spacingVerticalXS} ${i.tokens.spacingHorizontalM}`,...t&&{rowGap:0}}),toolbarSticky:(0,l.css)({position:`sticky`,zIndex:2}),controlsGroup:(0,l.css)({display:`flex`,backgroundColor:i.tokens.colorNeutralBackground1,...!t&&{"& > button":{borderRadius:0,"&:not(:last-of-type)":{borderInlineEndWidth:0},"&:last-of-type":{borderStartEndRadius:i.tokens.borderRadiusMedium,borderEndEndRadius:i.tokens.borderRadiusMedium},"&:first-of-type":{borderStartStartRadius:i.tokens.borderRadiusMedium,borderEndStartRadius:i.tokens.borderRadiusMedium}}}}),control:(0,l.css)({display:`flex`,justifyContent:`center`,alignItems:`center`,borderRadius:i.tokens.borderRadiusMedium,cursor:`default`,border:t?`none`:`1px solid ${i.tokens.colorNeutralStroke2}`,minWidth:n,height:r,backgroundColor:t?i.tokens.colorNeutralBackground3:i.tokens.colorNeutralBackground1,color:i.tokens.colorNeutralForeground2,padding:0,outline:`none`,fontFamily:`inherit`,fontSize:`inherit`,lineHeight:1,transition:`background-color 100ms ease, color 100ms ease`,"&[data-interactive]:not([data-disabled])":{cursor:`pointer`,"&:hover":{color:i.tokens.colorNeutralForeground1,backgroundColor:t?i.tokens.colorNeutralBackground3Hover:i.tokens.colorNeutralBackground1Hover}},"&:focus-visible":{outlineOffset:`2px`,outline:`2px solid ${i.tokens.colorStrokeFocus2}`}}),controlActive:(0,l.css)({backgroundColor:i.tokens.colorBrandBackground2,color:i.tokens.colorBrandForeground1,"&:hover":{backgroundColor:i.tokens.colorBrandBackground2Hover}}),controlDisabled:(0,l.css)({cursor:`not-allowed`,color:i.tokens.colorNeutralForegroundDisabled,backgroundColor:i.tokens.colorNeutralBackgroundDisabled}),controlIcon:(0,l.css)({width:a,height:a}),content:(0,l.css)({backgroundColor:i.tokens.colorNeutralBackground1,borderBottomLeftRadius:i.tokens.borderRadiusMedium,borderBottomRightRadius:i.tokens.borderRadiusMedium,"& .ProseMirror":{outline:0,padding:i.tokens.spacingVerticalM+` `+i.tokens.spacingHorizontalM,fontFamily:i.tokens.fontFamilyBase,fontSize:i.tokens.fontSizeBase300,fontWeight:i.tokens.fontWeightRegular,lineHeight:i.tokens.lineHeightBase300,color:i.tokens.colorNeutralForeground1},"& .ProseMirror > *:last-child":{marginBottom:0},"& .ProseMirror a":{color:i.tokens.colorBrandForeground1,textDecorationLine:`underline`,textDecorationColor:i.tokens.colorBrandStroke1,cursor:`pointer`,transition:`color 100ms ease, text-decoration-color 100ms ease`,"&:hover":{color:i.tokens.colorBrandForeground2Hover,textDecorationColor:i.tokens.colorBrandForeground2Hover},"&:active":{color:i.tokens.colorBrandForeground2Pressed},"&:visited":{color:i.tokens.colorBrandForeground1}},"& .ProseMirror p.is-editor-empty:first-of-type::before":{content:`attr(data-placeholder)`,pointerEvents:`none`,userSelect:`none`,float:`left`,height:0,color:i.tokens.colorNeutralForeground4},"& div:not(.ProseMirror)":{zIndex:2},"& pre":{fontFamily:i.tokens.fontFamilyMonospace,borderRadius:i.tokens.borderRadiusMedium,padding:`${i.tokens.spacingVerticalS} ${i.tokens.spacingHorizontalM}`,backgroundColor:i.tokens.colorNeutralBackground3,color:i.tokens.colorNeutralForeground1,"& code":{background:`none !important`,color:`inherit`,fontSize:i.tokens.fontSizeBase300,padding:0}}}),typography:(0,l.css)({padding:0,margin:0,"& li > p":{margin:0},"& ul li, & ol li":{marginTop:`2px`},"& p":{marginBottom:`7px`,fontSize:i.tokens.fontSizeBase300,lineHeight:i.tokens.lineHeightBase300},"& h1, & h2, & h3, & h4, & h5, & h6, & p":{marginTop:0},"& h1":{fontFamily:i.tokens.fontFamilyBase,fontSize:i.tokens.fontSizeHero800,fontWeight:i.tokens.fontWeightBold,lineHeight:i.tokens.lineHeightHero800},"& h2":{fontFamily:i.tokens.fontFamilyBase,fontSize:i.tokens.fontSizeHero700,fontWeight:i.tokens.fontWeightSemibold,lineHeight:i.tokens.lineHeightHero700},"& h3":{fontFamily:i.tokens.fontFamilyBase,fontSize:i.tokens.fontSizeBase600,fontWeight:i.tokens.fontWeightSemibold,lineHeight:i.tokens.lineHeightBase600},"& h4":{fontFamily:i.tokens.fontFamilyBase,fontSize:i.tokens.fontSizeBase500,fontWeight:i.tokens.fontWeightSemibold,lineHeight:i.tokens.lineHeightBase500},"& h5":{fontFamily:i.tokens.fontFamilyBase,fontSize:i.tokens.fontSizeBase400,fontWeight:i.tokens.fontWeightSemibold,lineHeight:i.tokens.lineHeightBase400},"& h6":{fontFamily:i.tokens.fontFamilyBase,fontSize:i.tokens.fontSizeBase300,fontWeight:i.tokens.fontWeightSemibold,lineHeight:i.tokens.lineHeightBase300},"& blockquote":{fontFamily:i.tokens.fontFamilyBase,fontStyle:`italic`,color:i.tokens.colorNeutralForeground2,borderInlineStart:`3px solid ${i.tokens.colorBrandStroke1}`,paddingInlineStart:i.tokens.spacingHorizontalM,margin:`${i.tokens.spacingVerticalS} 0`},"& code":{fontFamily:i.tokens.fontFamilyMonospace,fontSize:i.tokens.fontSizeBase200,backgroundColor:i.tokens.colorNeutralBackground3,borderRadius:i.tokens.borderRadiusSmall,padding:`1px ${i.tokens.spacingHorizontalXS}`}}),linkEditorDropdown:(0,l.css)({backgroundColor:i.tokens.colorNeutralBackground1}),linkEditor:(0,l.css)({display:`flex`,gap:0}),linkEditorInput:(0,l.css)({borderStartEndRadius:0,borderEndEndRadius:0,borderInlineEnd:0,flex:1}),linkEditorExternalControl:(0,l.css)({border:`1px solid ${i.tokens.colorNeutralStroke2}`,color:i.tokens.colorNeutralForeground1,height:`24px`,width:`24px`,display:`flex`,justifyContent:`center`,alignItems:`center`,borderRadius:i.tokens.borderRadiusMedium,backgroundColor:i.tokens.colorNeutralBackground1,cursor:`pointer`,padding:0,outline:`none`}),linkEditorExternalControlActive:(0,l.css)({backgroundColor:i.tokens.colorBrandBackground2,color:i.tokens.colorBrandForeground1,"&:hover":{backgroundColor:i.tokens.colorBrandBackground2Hover}}),linkEditorSave:(0,l.css)({borderStartStartRadius:0,borderEndStartRadius:0}),colorSwatch:(0,l.css)({width:`26px`,height:`26px`,borderRadius:i.tokens.borderRadiusSmall,border:`1px solid ${i.tokens.colorNeutralStroke2}`,cursor:`pointer`,padding:0,outline:`none`,transition:`transform 100ms ease`,"&:hover":{transform:`scale(1.1)`},"&:focus-visible":{outlineOffset:`2px`,outline:`2px solid ${i.tokens.colorStrokeFocus2}`}}),colorSwatchGrid:(0,l.css)({display:`grid`,gridTemplateColumns:`repeat(7, 1fr)`,gap:`2px`}),colorPickerActions:(0,l.css)({display:`flex`,justifyContent:`flex-end`,gap:i.tokens.spacingHorizontalXS,marginTop:i.tokens.spacingVerticalS}),taskList:(0,l.css)({listStyleType:`none`,padding:0,paddingInlineStart:0,"& li":{margin:0,padding:0,display:`flex`},"& li[data-checked] > div":{flex:`1 1 auto`,minWidth:0},"& ul":{marginTop:`5px`},"& p":{margin:0,padding:0},"& label":{display:`inline-block`},"& input":{cursor:`pointer`,appearance:`none`,width:`18px`,height:`18px`,border:`1px solid ${i.tokens.colorNeutralStroke2}`,borderRadius:i.tokens.borderRadiusSmall,verticalAlign:`middle`,position:`relative`,backgroundColor:i.tokens.colorNeutralBackground1,"&:checked":{backgroundColor:i.tokens.colorBrandBackground,borderColor:i.tokens.colorBrandBackground,"&::before":{position:`absolute`,content:`''`,inset:0,backgroundImage:`url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCAxMCA3Ij48cGF0aCBmaWxsPSIjZmZmIiBkPSJNNCA0LjU4NkwxLjcwNyAyLjI5M0ExIDEgMCAxMC4yOTMgMy43MDdsMyAzYS45OTcuOTk3IDAgMDAxLjQxNCAwbDUtNUExIDEgMCAxMDguMjkzLjI5M0w0IDQuNTg2eiIvPjwvc3ZnPg==')`,backgroundRepeat:`no-repeat`,backgroundSize:`10px`,backgroundPosition:`center`}}},"& li > label":{marginInlineEnd:i.tokens.spacingHorizontalS}}),fontFamilyList:(0,l.css)({listStyleType:`none`,margin:0,padding:`${i.tokens.spacingVerticalXS} 0`,maxHeight:`280px`,overflowY:`auto`,minWidth:`200px`}),fontFamilyItem:(0,l.css)({display:`flex`,alignItems:`center`,width:`100%`,padding:`${i.tokens.spacingVerticalXS} ${i.tokens.spacingHorizontalM}`,border:`none`,backgroundColor:`transparent`,color:i.tokens.colorNeutralForeground1,fontSize:i.tokens.fontSizeBase300,cursor:`pointer`,outline:`none`,textAlign:`start`,transition:`background-color 100ms ease`,"&:hover":{backgroundColor:i.tokens.colorNeutralBackground1Hover},"&:focus-visible":{outlineOffset:`-2px`,outline:`2px solid ${i.tokens.colorStrokeFocus2}`}}),fontFamilyItemActive:(0,l.css)({backgroundColor:i.tokens.colorBrandBackground2,color:i.tokens.colorBrandForeground1,fontWeight:i.tokens.fontWeightSemibold,"&:hover":{backgroundColor:i.tokens.colorBrandBackground2Hover}})}},Rr=({sticky:e=!1,stickyOffset:t=0,children:r,className:i,style:a})=>{let{variant:o}=Ir(),s=Lr(o);return(0,n.jsx)(`div`,{className:(0,l.cx)(s.toolbar,e&&s.toolbarSticky,i),style:e?{...a,top:t}:a,role:`toolbar`,"aria-label":`Text formatting`,children:r})};Rr.displayName=`RichTextEditorToolbar`;var zr=({className:e,style:r})=>{let{editor:i,withTypographyStyles:a,variant:o,onContentChange:s,onFocus:c,onBlur:u,onCreate:d,onSelectionChange:f,fontFamily:p}=Ir(),m=Lr(o),h=t.useRef(s),g=t.useRef(c),_=t.useRef(u),v=t.useRef(d),y=t.useRef(f);return t.useEffect(()=>{h.current=s},[s]),t.useEffect(()=>{g.current=c},[c]),t.useEffect(()=>{_.current=u},[u]),t.useEffect(()=>{v.current=d},[d]),t.useEffect(()=>{y.current=f},[f]),t.useEffect(()=>{if(!i)return;let e=()=>{h.current?.(i.getHTML(),i.getJSON())},t=({event:e})=>{g.current?.(e)},n=({event:e})=>{_.current?.(e)},r=()=>{v.current?.()},a=()=>{y.current?.()};return i.on(`update`,e),i.on(`focus`,t),i.on(`blur`,n),i.on(`create`,r),i.on(`selectionUpdate`,a),()=>{i.off(`update`,e),i.off(`focus`,t),i.off(`blur`,n),i.off(`create`,r),i.off(`selectionUpdate`,a)}},[i]),(0,n.jsx)(`div`,{className:(0,l.cx)(m.content,a&&m.typography,e),style:{...r,...p?{fontFamily:p}:{}},children:(0,n.jsx)(b.EditorContent,{editor:i})})};zr.displayName=`RichTextEditorContent`;var Br=({children:e,className:t,style:r})=>{let{variant:i}=Ir();return(0,n.jsx)(`div`,{className:(0,l.cx)(Lr(i).controlsGroup,t),style:r,role:`group`,children:e})};Br.displayName=`RichTextEditorControlsGroup`;var Vr=t.forwardRef((e,t)=>{let{interactive:r=!0,active:a,disabled:o,onClick:s,onMouseDown:c,children:l,className:u,style:d,...f}=e,{variant:p}=Ir(),m=Lr(p);return(0,n.jsx)(`button`,{ref:t,type:`button`,...f,className:(0,i.mergeClasses)(m.control,a&&m.controlActive,o&&m.controlDisabled,u),style:d,disabled:o,tabIndex:r?0:-1,"data-interactive":r||void 0,"data-disabled":o||void 0,"data-active":a||void 0,"aria-pressed":a&&r?!0:void 0,"aria-hidden":!r||void 0,onMouseDown:e=>{e.preventDefault(),c?.(e)},onClick:s,children:l})});Vr.displayName=`RichTextEditorControl`;var Hr=t.forwardRef(({icon:e,className:t,...r},i)=>{let{variant:a}=Ir(),o=Lr(a),s=a===`subtle`?`16px`:`20px`;return(0,n.jsx)(Vr,{ref:i,className:t,...r,children:(0,n.jsx)(`span`,{className:o.controlIcon,children:(0,n.jsx)(e,{style:{width:s,height:s}})})})});Hr.displayName=`RichTextEditorControlBase`;function q({label:e,isActive:t,operation:r,icon:i,isDisabled:a}){let o=o=>{let{editor:s,labels:c}=Ir(),l=c[e],u=typeof l==`function`?``:l;return(0,n.jsx)(Hr,{"aria-label":u,title:u,active:t?.name?s?.isActive(t.name,t.attributes):!1,icon:o.icon||i,disabled:a?.(s)||!1,...o,onClick:()=>s?.chain().focus()[r.name](r.attributes).run()})};return o.displayName=`RichTextEditorControl_${e}`,o}function J(e){return(0,n.jsx)(`svg`,{...e,xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,strokeWidth:`1.5`,stroke:`currentColor`,fill:`none`,strokeLinecap:`round`,strokeLinejoin:`round`})}function Ur(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M7 5h6a3.5 3.5 0 0 1 0 7h-6z`}),(0,n.jsx)(`path`,{d:`M13 12h1a3.5 3.5 0 0 1 0 7h-7v-7`})]})}function Wr(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M11 5l6 0`}),(0,n.jsx)(`path`,{d:`M7 19l6 0`}),(0,n.jsx)(`path`,{d:`M14 5l-4 14`})]})}function Gr(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M7 5v5a5 5 0 0 0 10 0v-5`}),(0,n.jsx)(`path`,{d:`M5 19h14`})]})}function Kr(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M5 12l14 0`}),(0,n.jsx)(`path`,{d:`M16 6.5a4 2 0 0 0 -4 -1.5h-1a3.5 3.5 0 0 0 0 7h2a3.5 3.5 0 0 1 0 7h-1.5a4 2 0 0 1 -4 -1.5`})]})}function qr(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M17 15l4 4m0 -4l-4 4`}),(0,n.jsx)(`path`,{d:`M7 6v-1h11v1`}),(0,n.jsx)(`path`,{d:`M7 19l4 0`}),(0,n.jsx)(`path`,{d:`M13 5l-4 14`})]})}function Jr(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M19 18v-8l-2 2`}),(0,n.jsx)(`path`,{d:`M4 6v12`}),(0,n.jsx)(`path`,{d:`M12 6v12`}),(0,n.jsx)(`path`,{d:`M11 18h2`}),(0,n.jsx)(`path`,{d:`M3 18h2`}),(0,n.jsx)(`path`,{d:`M4 12h8`}),(0,n.jsx)(`path`,{d:`M3 6h2`}),(0,n.jsx)(`path`,{d:`M11 6h2`})]})}function Yr(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M17 12a2 2 0 1 1 4 0c0 .591 -.417 1.318 -.816 1.858l-3.184 4.143l4 0`}),(0,n.jsx)(`path`,{d:`M4 6v12`}),(0,n.jsx)(`path`,{d:`M12 6v12`}),(0,n.jsx)(`path`,{d:`M11 18h2`}),(0,n.jsx)(`path`,{d:`M3 18h2`}),(0,n.jsx)(`path`,{d:`M4 12h8`}),(0,n.jsx)(`path`,{d:`M3 6h2`}),(0,n.jsx)(`path`,{d:`M11 6h2`})]})}function Xr(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M19 14a2 2 0 1 0 -2 -2`}),(0,n.jsx)(`path`,{d:`M17 16a2 2 0 1 0 2 -2`}),(0,n.jsx)(`path`,{d:`M4 6v12`}),(0,n.jsx)(`path`,{d:`M12 6v12`}),(0,n.jsx)(`path`,{d:`M11 18h2`}),(0,n.jsx)(`path`,{d:`M3 18h2`}),(0,n.jsx)(`path`,{d:`M4 12h8`}),(0,n.jsx)(`path`,{d:`M3 6h2`}),(0,n.jsx)(`path`,{d:`M11 6h2`})]})}function Zr(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M20 18v-8l-4 6h5`}),(0,n.jsx)(`path`,{d:`M4 6v12`}),(0,n.jsx)(`path`,{d:`M12 6v12`}),(0,n.jsx)(`path`,{d:`M11 18h2`}),(0,n.jsx)(`path`,{d:`M3 18h2`}),(0,n.jsx)(`path`,{d:`M4 12h8`}),(0,n.jsx)(`path`,{d:`M3 6h2`}),(0,n.jsx)(`path`,{d:`M11 6h2`})]})}function Qr(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M17 18h2a2 2 0 1 0 0 -4h-2v-4h4`}),(0,n.jsx)(`path`,{d:`M4 6v12`}),(0,n.jsx)(`path`,{d:`M12 6v12`}),(0,n.jsx)(`path`,{d:`M11 18h2`}),(0,n.jsx)(`path`,{d:`M3 18h2`}),(0,n.jsx)(`path`,{d:`M4 12h8`}),(0,n.jsx)(`path`,{d:`M3 6h2`}),(0,n.jsx)(`path`,{d:`M11 6h2`})]})}function $r(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M19 14a2 2 0 1 0 0 4a2 2 0 0 0 0 -4z`}),(0,n.jsx)(`path`,{d:`M21 12a2 2 0 1 0 -4 0v4`}),(0,n.jsx)(`path`,{d:`M4 6v12`}),(0,n.jsx)(`path`,{d:`M12 6v12`}),(0,n.jsx)(`path`,{d:`M11 18h2`}),(0,n.jsx)(`path`,{d:`M3 18h2`}),(0,n.jsx)(`path`,{d:`M4 12h8`}),(0,n.jsx)(`path`,{d:`M3 6h2`}),(0,n.jsx)(`path`,{d:`M11 6h2`})]})}function ei(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M9 6l11 0`}),(0,n.jsx)(`path`,{d:`M9 12l11 0`}),(0,n.jsx)(`path`,{d:`M9 18l11 0`}),(0,n.jsx)(`path`,{d:`M5 6l0 .01`}),(0,n.jsx)(`path`,{d:`M5 12l0 .01`}),(0,n.jsx)(`path`,{d:`M5 18l0 .01`})]})}function ti(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M11 6h9`}),(0,n.jsx)(`path`,{d:`M11 12h9`}),(0,n.jsx)(`path`,{d:`M12 18h8`}),(0,n.jsx)(`path`,{d:`M4 16a2 2 0 1 1 4 0c0 .591 -.5 1 -1 1.5l-3 2.5h4`}),(0,n.jsx)(`path`,{d:`M6 10v-6l-2 2`})]})}function ni(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M17 22v-2`}),(0,n.jsx)(`path`,{d:`M9 15l6 -6`}),(0,n.jsx)(`path`,{d:`M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464`}),(0,n.jsx)(`path`,{d:`M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463`}),(0,n.jsx)(`path`,{d:`M20 17h2`}),(0,n.jsx)(`path`,{d:`M2 7h2`}),(0,n.jsx)(`path`,{d:`M7 2v2`})]})}function ri(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M6 15h15`}),(0,n.jsx)(`path`,{d:`M21 19h-15`}),(0,n.jsx)(`path`,{d:`M15 11h6`}),(0,n.jsx)(`path`,{d:`M21 7h-6`}),(0,n.jsx)(`path`,{d:`M9 9h1a1 1 0 1 1 -1 1v-2.5a2 2 0 0 1 2 -2`}),(0,n.jsx)(`path`,{d:`M3 9h1a1 1 0 1 1 -1 1v-2.5a2 2 0 0 1 2 -2`})]})}function ii(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M4 6l16 0`}),(0,n.jsx)(`path`,{d:`M4 12l10 0`}),(0,n.jsx)(`path`,{d:`M4 18l14 0`})]})}function ai(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M4 6l16 0`}),(0,n.jsx)(`path`,{d:`M10 12l10 0`}),(0,n.jsx)(`path`,{d:`M6 18l14 0`})]})}function oi(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M4 6l16 0`}),(0,n.jsx)(`path`,{d:`M8 12l8 0`}),(0,n.jsx)(`path`,{d:`M6 18l12 0`})]})}function si(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M4 6l16 0`}),(0,n.jsx)(`path`,{d:`M4 12l16 0`}),(0,n.jsx)(`path`,{d:`M4 18l12 0`})]})}function ci(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M5 7l8 10m-8 0l8 -10`}),(0,n.jsx)(`path`,{d:`M21 20h-4l3.5 -4a1.73 1.73 0 0 0 -3.5 -2`})]})}function li(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M5 7l8 10m-8 0l8 -10`}),(0,n.jsx)(`path`,{d:`M21 11h-4l3.5 -4a1.73 1.73 0 0 0 -3.5 -2`})]})}function ui(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M7 8l-4 4l4 4`}),(0,n.jsx)(`path`,{d:`M17 8l4 4l-4 4`}),(0,n.jsx)(`path`,{d:`M14 4l-4 16`})]})}function di(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M3 19h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4`}),(0,n.jsx)(`path`,{d:`M12.5 5.5l4 4`}),(0,n.jsx)(`path`,{d:`M4.5 13.5l4 4`}),(0,n.jsx)(`path`,{d:`M21 15v4h-8l4 -4z`})]})}function fi(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M5 12h2`}),(0,n.jsx)(`path`,{d:`M17 12h2`}),(0,n.jsx)(`path`,{d:`M11 12h2`})]})}function pi(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M20.042 16.045a9 9 0 0 0 -12.087 -12.087m-2.318 1.677a9 9 0 1 0 12.725 12.73`}),(0,n.jsx)(`path`,{d:`M3 3l18 18`})]})}function mi(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M11 7l6 6`}),(0,n.jsx)(`path`,{d:`M4 16l11.7 -11.7a1 1 0 0 1 1.4 0l2.6 2.6a1 1 0 0 1 0 1.4l-11.7 11.7h-4v-4z`})]})}function hi(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M18 6l-12 12`}),(0,n.jsx)(`path`,{d:`M6 6l12 12`})]})}function gi(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M12 21a9 9 0 0 1 0 -18c4.97 0 9 3.582 9 8c0 1.06 -.474 2.078 -1.318 2.828c-.844 .75 -1.989 1.172 -3.182 1.172h-2.5a2 2 0 0 0 -1 3.75a1.3 1.3 0 0 1 -1 2.25`}),(0,n.jsx)(`path`,{d:`M8.5 10.5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`}),(0,n.jsx)(`path`,{d:`M12.5 7.5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`}),(0,n.jsx)(`path`,{d:`M16.5 10.5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`})]})}function _i(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M5 12l5 5l10 -10`})]})}function vi(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M9 15l6 -6`}),(0,n.jsx)(`path`,{d:`M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464`}),(0,n.jsx)(`path`,{d:`M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463`})]})}function yi(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M12 6h-6a2 2 0 0 0 -2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-6`}),(0,n.jsx)(`path`,{d:`M11 13l9 -9`}),(0,n.jsx)(`path`,{d:`M15 4h5v5`})]})}function bi(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M9 14l-4 -4l4 -4`}),(0,n.jsx)(`path`,{d:`M5 10h11a4 4 0 1 1 0 8h-1`})]})}function xi(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M15 14l4 -4l-4 -4`}),(0,n.jsx)(`path`,{d:`M19 10h-11a4 4 0 1 0 0 8h1`})]})}function Si(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M3.5 5.5l1.5 1.5l2.5 -2.5`}),(0,n.jsx)(`path`,{d:`M3.5 11.5l1.5 1.5l2.5 -2.5`}),(0,n.jsx)(`path`,{d:`M3.5 17.5l1.5 1.5l2.5 -2.5`}),(0,n.jsx)(`path`,{d:`M11 6l9 0`}),(0,n.jsx)(`path`,{d:`M11 12l9 0`}),(0,n.jsx)(`path`,{d:`M11 18l9 0`})]})}function Ci(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M20 6l-11 0`}),(0,n.jsx)(`path`,{d:`M20 12l-7 0`}),(0,n.jsx)(`path`,{d:`M20 18l-11 0`}),(0,n.jsx)(`path`,{d:`M4 8l4 4l-4 4`})]})}function wi(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M20 6l-7 0`}),(0,n.jsx)(`path`,{d:`M20 12l-9 0`}),(0,n.jsx)(`path`,{d:`M20 18l-7 0`}),(0,n.jsx)(`path`,{d:`M8 8l-4 4l4 4`})]})}function Ti(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M19 3v16a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V7.914a1 1 0 0 1 .293-.707l3.914-3.914A1 1 0 0 1 9.914 3H18a1 1 0 0 1 1 1Z`}),(0,n.jsx)(`path`,{d:`M10 11l-2 2 2 2`}),(0,n.jsx)(`path`,{d:`M14 11l2 2-2 2`})]})}function Ei(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M4 20l3 0`}),(0,n.jsx)(`path`,{d:`M14 20l7 0`}),(0,n.jsx)(`path`,{d:`M6.9 15l6.9 0`}),(0,n.jsx)(`path`,{d:`M10.2 6.3l5.8 13.7`}),(0,n.jsx)(`path`,{d:`M5 20l6 -16l2 0l7 16`})]})}var Di=({disableTooltips:e=!1,initialExternal:r=!1,className:a,style:o,...s})=>{let{editor:c,labels:u,variant:d}=Ir(),f=Lr(d),[p,m]=t.useState(``),[h,g]=t.useState(r),[_,v]=t.useState(!1),y=t.useCallback(()=>{v(!0);let e=c?.getAttributes(`link`);m(e?.href||``),g(typeof e?.target==`string`?e.target===`_blank`:r)},[c,r]),b=t.useCallback(()=>{v(!1),m(``),g(r)},[r]),x=t.useCallback(()=>{b(),(c?.chain().focus().extendMarkRange(`link`)).setLink({href:p,target:h?`_blank`:null}).run()},[c,p,h,b]),S=t.useCallback(e=>{e.key===`Enter`&&(e.preventDefault(),x())},[x]);return t.useEffect(()=>{let e=()=>y();return window.addEventListener(`edit-link`,e),()=>window.removeEventListener(`edit-link`,e)},[y]),(0,n.jsxs)(i.Popover,{open:_,onOpenChange:(e,t)=>{t.open||b()},positioning:`below`,trapFocus:!0,children:[(0,n.jsx)(i.PopoverTrigger,{disableButtonEnhancement:!0,children:(0,n.jsx)(Hr,{icon:e=>(0,n.jsx)(vi,{...e}),"aria-label":u.linkControlLabel,title:u.linkControlLabel,active:c?.isActive(`link`),onClick:y,className:a,style:o,...s})}),(0,n.jsx)(i.PopoverSurface,{className:f.linkEditorDropdown,children:(0,n.jsxs)(`div`,{className:f.linkEditor,children:[(0,n.jsx)(i.Input,{placeholder:u.linkEditorInputPlaceholder,"aria-label":u.linkEditorInputLabel,type:`url`,value:p,onChange:(e,t)=>m(t.value),onKeyDown:S,className:f.linkEditorInput,size:`small`}),e?(0,n.jsx)(i.Button,{appearance:`subtle`,size:`small`,className:(0,l.cx)(f.linkEditorExternalControl,h&&f.linkEditorExternalControlActive),onClick:()=>g(e=>!e),"aria-label":h?u.linkEditorExternalLink:u.linkEditorInternalLink,icon:(0,n.jsx)(yi,{style:{width:14,height:14}})}):(0,n.jsx)(i.Tooltip,{content:h?u.linkEditorExternalLink:u.linkEditorInternalLink,relationship:`label`,children:(0,n.jsx)(i.Button,{appearance:`subtle`,size:`small`,className:(0,l.cx)(f.linkEditorExternalControl,h&&f.linkEditorExternalControlActive),onClick:()=>g(e=>!e),icon:(0,n.jsx)(yi,{style:{width:14,height:14}})})}),(0,n.jsx)(i.Button,{size:`small`,appearance:`primary`,className:f.linkEditorSave,onClick:x,children:u.linkEditorSave})]})})]})};Di.displayName=`RichTextEditorLinkControl`;var Oi=({color:e,className:t,style:r})=>{let{editor:i,labels:a,variant:o}=Ir(),s=Lr(o),c=typeof a.colorControlLabel==`function`?a.colorControlLabel(e):`${a.colorControlLabel} ${e}`;return(0,n.jsx)(`button`,{type:`button`,className:(0,l.cx)(s.control,t),style:r,"aria-label":c,title:c,onClick:()=>(i?.chain().focus()).setColor(e).run(),children:(0,n.jsx)(`span`,{className:s.colorSwatch,style:{backgroundColor:e}})})};Oi.displayName=`RichTextEditorColorControl`;var ki=({colors:e,className:r,style:a})=>{let{editor:o,labels:s,variant:c}=Ir(),l=Lr(c),[u,d]=t.useState(!1),[f,p]=t.useState(`palette`),[m,h]=t.useState(``),g=t.useRef(null),_=t.useCallback(()=>{d(!1)},[]),v=t.useCallback(()=>{(o?.chain().focus()).setColor(m).run(),_()},[o,m,_]),y=t.useCallback(()=>{(o?.chain().focus()).unsetColor().run(),_()},[o,_]),b=t.useCallback(e=>{(o?.chain().focus()).setColor(e).run(),_()},[o,_]);return(0,n.jsxs)(i.Popover,{open:u,onOpenChange:(e,t)=>{t.open?(d(!0),p(`palette`),h(``)):_()},positioning:`below`,trapFocus:!0,children:[(0,n.jsx)(i.PopoverTrigger,{disableButtonEnhancement:!0,children:(0,n.jsx)(Hr,{icon:e=>(0,n.jsx)(mi,{...e}),"aria-label":s.colorPickerControlLabel,title:s.colorPickerControlLabel,className:r,style:a})}),(0,n.jsxs)(i.PopoverSurface,{className:l.linkEditorDropdown,children:[f===`palette`?(0,n.jsx)(`div`,{className:l.colorSwatchGrid,children:e.map(e=>{let t=typeof s.colorPickerColorLabel==`function`?s.colorPickerColorLabel(e):`${s.colorPickerColorLabel} ${e}`;return(0,n.jsx)(`button`,{type:`button`,className:l.colorSwatch,style:{backgroundColor:e},"aria-label":t,title:t,onClick:()=>b(e)},e)})}):(0,n.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`,padding:8},children:(0,n.jsx)(`input`,{ref:g,type:`color`,value:m||`#000000`,onChange:e=>h(e.target.value),style:{width:200,height:40,border:`none`,cursor:`pointer`},"aria-label":s.colorPickerColorPicker})}),(0,n.jsxs)(`div`,{className:l.colorPickerActions,children:[(0,n.jsx)(i.Button,{size:`small`,appearance:`subtle`,icon:(0,n.jsx)(hi,{style:{width:14,height:14}}),onClick:_,title:s.colorPickerCancel,"aria-label":s.colorPickerCancel}),(0,n.jsx)(i.Button,{size:`small`,appearance:`subtle`,icon:(0,n.jsx)(pi,{style:{width:14,height:14}}),onClick:y,title:s.colorPickerClear,"aria-label":s.colorPickerClear}),(0,n.jsx)(i.Button,{size:`small`,appearance:`subtle`,icon:f===`palette`?(0,n.jsx)(mi,{style:{width:14,height:14}}):(0,n.jsx)(gi,{style:{width:14,height:14}}),onClick:()=>p(e=>e===`palette`?`colorPicker`:`palette`),title:f===`palette`?s.colorPickerColorPicker:s.colorPickerPalette,"aria-label":f===`palette`?s.colorPickerColorPicker:s.colorPickerPalette}),f===`colorPicker`&&(0,n.jsx)(i.Button,{size:`small`,appearance:`subtle`,icon:(0,n.jsx)(_i,{style:{width:14,height:14}}),onClick:v,title:s.colorPickerSave,"aria-label":s.colorPickerSave})]})]})]})};ki.displayName=`RichTextEditorColorPickerControl`;var Ai=({className:e,style:r})=>{let{labels:i,editor:a}=Ir(),o=t.useCallback(()=>{if(!a)return;let e=a.getHTML(),t=a.storage;t?.sourceCode?.active?(a.commands.setContent(a.getText()),t.sourceCode={active:!1}):(a.commands.setContent(`<pre><code>${e}</code></pre>`),t.sourceCode={active:!0})},[a]);return(0,n.jsx)(Hr,{icon:e=>(0,n.jsx)(Ti,{...e}),"aria-label":i.sourceCodeControlLabel,title:i.sourceCodeControlLabel,onClick:o,className:e,style:r})};Ai.displayName=`RichTextEditorSourceCodeControl`;var ji=[`Arial`,`Verdana`,`Tahoma`,`Trebuchet MS`,`Georgia`,`Times New Roman`,`Courier New`,`Segoe UI`],Mi=({fontFamilies:e,className:r,style:a})=>{let{editor:o,labels:s,variant:c,fontFamilies:u}=Ir(),d=Lr(c),[f,p]=t.useState(!1),m=e??u??ji,h=t.useMemo(()=>{let e=new Set;return m.filter(t=>{let n=t.toLowerCase();return e.has(n)?!1:(e.add(n),!0)})},[m]),g=o?.getAttributes(`textStyle`)?.fontFamily,_=t.useCallback(e=>{(o?.chain().focus()).setFontFamily(e).run(),p(!1)},[o]),v=t.useCallback(()=>{(o?.chain().focus()).unsetFontFamily().run(),p(!1)},[o]);return(0,n.jsxs)(i.Popover,{open:f,onOpenChange:(e,t)=>p(t.open),positioning:`below`,trapFocus:!0,children:[(0,n.jsx)(i.PopoverTrigger,{disableButtonEnhancement:!0,children:(0,n.jsx)(Hr,{icon:e=>(0,n.jsx)(Ei,{...e}),"aria-label":s.fontFamilyControlLabel,title:s.fontFamilyControlLabel,className:r,style:a})}),(0,n.jsx)(i.PopoverSurface,{className:d.linkEditorDropdown,children:(0,n.jsxs)(`div`,{className:d.fontFamilyList,role:`menu`,"aria-label":s.fontFamilyControlLabel,children:[(0,n.jsx)(`button`,{type:`button`,role:`menuitem`,className:(0,l.cx)(d.fontFamilyItem,!g&&d.fontFamilyItemActive),onClick:v,children:`Default`}),h.map(e=>{let t=e.split(`,`)[0].replace(/['"]/g,``).trim(),r=g===e;return(0,n.jsx)(`button`,{type:`button`,role:`menuitem`,className:(0,l.cx)(d.fontFamilyItem,r&&d.fontFamilyItemActive),style:{fontFamily:e},onClick:()=>_(e),children:t},e)})]})})]})};Mi.displayName=`RichTextEditorFontFamilyControl`;var Ni=q({label:`boldControlLabel`,icon:e=>(0,n.jsx)(Ur,{...e}),isActive:{name:`bold`},operation:{name:`toggleBold`}}),Pi=q({label:`italicControlLabel`,icon:e=>(0,n.jsx)(Wr,{...e}),isActive:{name:`italic`},operation:{name:`toggleItalic`}}),Fi=q({label:`underlineControlLabel`,icon:e=>(0,n.jsx)(Gr,{...e}),isActive:{name:`underline`},operation:{name:`toggleUnderline`}}),Ii=q({label:`strikeControlLabel`,icon:e=>(0,n.jsx)(Kr,{...e}),isActive:{name:`strike`},operation:{name:`toggleStrike`}}),Li=q({label:`clearFormattingControlLabel`,icon:e=>(0,n.jsx)(qr,{...e}),operation:{name:`unsetAllMarks`}}),Ri=q({label:`unlinkControlLabel`,icon:e=>(0,n.jsx)(ni,{...e}),operation:{name:`unsetLink`}}),zi=q({label:`bulletListControlLabel`,icon:e=>(0,n.jsx)(ei,{...e}),isActive:{name:`bulletList`},operation:{name:`toggleBulletList`}}),Bi=q({label:`orderedListControlLabel`,icon:e=>(0,n.jsx)(ti,{...e}),isActive:{name:`orderedList`},operation:{name:`toggleOrderedList`}}),Vi=q({label:`h1ControlLabel`,icon:e=>(0,n.jsx)(Jr,{...e}),isActive:{name:`heading`,attributes:{level:1}},operation:{name:`toggleHeading`,attributes:{level:1}}}),Hi=q({label:`h2ControlLabel`,icon:e=>(0,n.jsx)(Yr,{...e}),isActive:{name:`heading`,attributes:{level:2}},operation:{name:`toggleHeading`,attributes:{level:2}}}),Ui=q({label:`h3ControlLabel`,icon:e=>(0,n.jsx)(Xr,{...e}),isActive:{name:`heading`,attributes:{level:3}},operation:{name:`toggleHeading`,attributes:{level:3}}}),Wi=q({label:`h4ControlLabel`,icon:e=>(0,n.jsx)(Zr,{...e}),isActive:{name:`heading`,attributes:{level:4}},operation:{name:`toggleHeading`,attributes:{level:4}}}),Gi=q({label:`h5ControlLabel`,icon:e=>(0,n.jsx)(Qr,{...e}),isActive:{name:`heading`,attributes:{level:5}},operation:{name:`toggleHeading`,attributes:{level:5}}}),Ki=q({label:`h6ControlLabel`,icon:e=>(0,n.jsx)($r,{...e}),isActive:{name:`heading`,attributes:{level:6}},operation:{name:`toggleHeading`,attributes:{level:6}}}),qi=q({label:`blockquoteControlLabel`,icon:e=>(0,n.jsx)(ri,{...e}),isActive:{name:`blockquote`},operation:{name:`toggleBlockquote`}}),Ji=q({label:`alignLeftControlLabel`,icon:e=>(0,n.jsx)(ii,{...e}),operation:{name:`setTextAlign`,attributes:`left`}}),Yi=q({label:`alignRightControlLabel`,icon:e=>(0,n.jsx)(ai,{...e}),operation:{name:`setTextAlign`,attributes:`right`}}),Xi=q({label:`alignCenterControlLabel`,icon:e=>(0,n.jsx)(oi,{...e}),operation:{name:`setTextAlign`,attributes:`center`}}),Zi=q({label:`alignJustifyControlLabel`,icon:e=>(0,n.jsx)(si,{...e}),operation:{name:`setTextAlign`,attributes:`justify`}}),Qi=q({label:`subscriptControlLabel`,icon:e=>(0,n.jsx)(ci,{...e}),isActive:{name:`subscript`},operation:{name:`toggleSubscript`}}),$i=q({label:`superscriptControlLabel`,icon:e=>(0,n.jsx)(li,{...e}),isActive:{name:`superscript`},operation:{name:`toggleSuperscript`}}),ea=q({label:`codeControlLabel`,icon:e=>(0,n.jsx)(ui,{...e}),isActive:{name:`code`},operation:{name:`toggleCode`}}),ta=q({label:`codeBlockControlLabel`,icon:e=>(0,n.jsx)(ui,{...e}),isActive:{name:`codeBlock`},operation:{name:`toggleCodeBlock`}}),na=q({label:`highlightControlLabel`,icon:e=>(0,n.jsx)(di,{...e}),isActive:{name:`highlight`},operation:{name:`toggleHighlight`}}),ra=q({label:`hrControlLabel`,icon:e=>(0,n.jsx)(fi,{...e}),operation:{name:`setHorizontalRule`}}),ia=q({label:`unsetColorControlLabel`,icon:e=>(0,n.jsx)(pi,{...e}),operation:{name:`unsetColor`}}),aa=q({label:`undoControlLabel`,icon:e=>(0,n.jsx)(bi,{...e}),operation:{name:`undo`}}),oa=q({label:`redoControlLabel`,icon:e=>(0,n.jsx)(xi,{...e}),operation:{name:`redo`}}),sa=q({label:`tasksControlLabel`,icon:e=>(0,n.jsx)(Si,{...e}),isActive:{name:`taskList`},operation:{name:`toggleTaskList`}}),ca=q({label:`tasksSinkLabel`,icon:e=>(0,n.jsx)(Ci,{...e}),operation:{name:`sinkListItem`,attributes:`taskItem`},isDisabled:e=>!e?.can().sinkListItem(`taskItem`)}),la=q({label:`tasksLiftLabel`,icon:e=>(0,n.jsx)(wi,{...e}),operation:{name:`liftListItem`,attributes:`taskItem`},isDisabled:e=>!e?.can().liftListItem(`taskItem`)}),ua={boldControlLabel:`Bold`,italicControlLabel:`Italic`,underlineControlLabel:`Underline`,strikeControlLabel:`Strikethrough`,clearFormattingControlLabel:`Clear formatting`,linkControlLabel:`Link`,unlinkControlLabel:`Unlink`,bulletListControlLabel:`Bullet list`,orderedListControlLabel:`Ordered list`,h1ControlLabel:`Heading 1`,h2ControlLabel:`Heading 2`,h3ControlLabel:`Heading 3`,h4ControlLabel:`Heading 4`,h5ControlLabel:`Heading 5`,h6ControlLabel:`Heading 6`,blockquoteControlLabel:`Blockquote`,alignLeftControlLabel:`Align left`,alignCenterControlLabel:`Align center`,alignRightControlLabel:`Align right`,alignJustifyControlLabel:`Align justify`,codeControlLabel:`Code`,codeBlockControlLabel:`Code block`,subscriptControlLabel:`Subscript`,superscriptControlLabel:`Superscript`,colorPickerControlLabel:`Text color`,unsetColorControlLabel:`Unset color`,highlightControlLabel:`Highlight`,hrControlLabel:`Horizontal rule`,undoControlLabel:`Undo`,redoControlLabel:`Redo`,colorControlLabel:e=>`Set text color ${e}`,sourceCodeControlLabel:`Source code`,linkEditorInputLabel:`Enter URL`,linkEditorInputPlaceholder:`https://example.com`,linkEditorExternalLink:`Open link in a new tab`,linkEditorInternalLink:`Open link in the same tab`,linkEditorSave:`Save`,colorPickerCancel:`Cancel`,colorPickerClear:`Clear color`,colorPickerColorPicker:`Color picker`,colorPickerPalette:`Color palette`,colorPickerSave:`Save`,colorPickerColorLabel:e=>`Set text color ${e}`,tasksControlLabel:`Task list`,tasksSinkLabel:`Increase indent`,tasksLiftLabel:`Decrease indent`,fontFamilyControlLabel:`Font family`},da=({editor:e,withCodeHighlightStyles:r=!0,withTypographyStyles:i=!0,labels:a,variant:o=`default`,onSourceCodeTextSwitch:s,onContentChange:c,onFocus:u,onBlur:d,onCreate:f,onSelectionChange:p,fontFamily:m,fontFamilies:h,children:g,className:_,style:v})=>{let y=Lr(o),b=t.useMemo(()=>({...ua,...a}),[a]);return(0,n.jsx)(Fr,{value:t.useMemo(()=>({editor:e,labels:b,withCodeHighlightStyles:r,withTypographyStyles:i,variant:o,onSourceCodeTextSwitch:s,onContentChange:c,onFocus:u,onBlur:d,onCreate:f,onSelectionChange:p,fontFamily:m,fontFamilies:h}),[e,b,r,i,o,s,c,u,d,f,p,m,h]),children:(0,n.jsx)(`div`,{className:(0,l.cx)(y.root,_),style:v,children:g})})};da.displayName=`RichTextEditor`;var fa=Object.assign(da,{Toolbar:Rr,Content:zr,ControlsGroup:Br,Control:Vr,ControlBase:Hr,Bold:Ni,Italic:Pi,Underline:Fi,Strikethrough:Ii,ClearFormatting:Li,H1:Vi,H2:Hi,H3:Ui,H4:Wi,H5:Gi,H6:Ki,BulletList:zi,OrderedList:Bi,Blockquote:qi,Link:Di,Unlink:Ri,AlignLeft:Ji,AlignRight:Yi,AlignCenter:Xi,AlignJustify:Zi,Code:ea,CodeBlock:ta,Subscript:Qi,Superscript:$i,Color:Oi,ColorPicker:ki,Highlight:na,UnsetColor:ia,Hr:ra,Undo:aa,Redo:oa,TaskList:sa,TaskListSink:ca,TaskListLift:la,SourceCode:Ai,FontFamily:Mi}),pa=x.default.extend({addKeyboardShortcuts(){return{"Mod-k":()=>(window.dispatchEvent(new Event(`edit-link`)),!0)}}});function ma(e){return e.extend({addKeyboardShortcuts(){return{"Mod-]":()=>this.editor.commands.sinkListItem?.(`taskItem`)??!1,"Mod-[":()=>this.editor.commands.liftListItem?.(`taskItem`)??!1}}})}var ha=()=>({dropdownRoot:(0,l.css)({border:`1px solid ${i.tokens.colorNeutralStroke2} !important`,borderBottom:`1px solid ${i.tokens.colorNeutralStroke2} !important`,borderRadius:`50px !important`,backgroundColor:`${i.tokens.colorNeutralBackground1} !important`,padding:`0px 10px !important`,boxShadow:`none !important`,transition:`all 0.2s ease`,"&::after":{display:`none !important`,borderWidth:`0 !important`,content:`"none !important"`},"&:hover":{borderColor:`${i.tokens.colorBrandStroke1} !important`},"&:focus-within":{borderColor:`${i.tokens.colorBrandStroke1} !important`,boxShadow:`0 0 0 2px ${i.tokens.colorBrandBackground2} !important`}})}),ga=({options:e,onChange:r,renderItem:a,validate:o,label:s,placeholder:c,defaultValue:l,message:u,messageType:f,required:p,size:m,hint:h})=>{let g=l?e.find(e=>e.value===l):void 0,[_,v]=(0,t.useState)(l||``),[y,b]=(0,t.useState)(g?.text||``),[x,S]=(0,t.useState)(``),C=ha(),w=(e,t)=>{let n=t.optionValue||``,i=t.optionText||``;v(n),b(i);let a=o?o(n):``;S(a),!a&&r&&r(n)},T=t.useMemo(()=>x?`error`:f===`warning`?`warning`:f===`info`?`success`:`none`,[x,f]);return(0,n.jsx)(i.Field,{label:s,required:p,validationMessage:t.useMemo(()=>x||u,[x,u]),validationMessageIcon:t.useCallback(()=>{switch(T){case`error`:return(0,n.jsx)(d.ErrorCircle12Filled,{});case`warning`:return(0,n.jsx)(d.Warning12Filled,{});case`success`:return(0,n.jsx)(d.CheckmarkCircle12Filled,{});default:return null}},[T])(),size:m,hint:h,validationState:T,children:(0,n.jsx)(i.Dropdown,{placeholder:c,onOptionSelect:w,value:y,selectedOptions:_?[_]:[],className:C.dropdownRoot,children:e.map(e=>{let t=e.icon??e.checkIcon;return(0,n.jsx)(i.Option,{value:e.value,disabled:e.disabled,as:e.as,text:e.text||``,children:a?a(e):(0,n.jsxs)(n.Fragment,{children:[t&&(0,n.jsx)(`span`,{style:{marginRight:4,display:`inline-flex`,alignItems:`center`},children:t}),e.text]})},e.value)})})})},_a=()=>({inputRoot:(0,l.css)({border:`1px solid ${i.tokens.colorNeutralStroke2} !important`,borderBottom:`1px solid ${i.tokens.colorNeutralStroke2} !important`,borderRadius:`50px !important`,backgroundColor:`${i.tokens.colorNeutralBackground1} !important`,padding:`0px 10px !important`,boxShadow:`none !important`,transition:`all 0.2s ease`,"&::after":{display:`none !important`,borderWidth:`0 !important`,content:`"none !important"`},"&:hover":{borderColor:`${i.tokens.colorBrandStroke1} !important`},"&:focus-within":{borderColor:`${i.tokens.colorBrandStroke1} !important`,boxShadow:`0 0 0 2px ${i.tokens.colorBrandBackground2} !important`}})}),va=({value:r,type:a=`text`,shape:o=`normal`,onChange:s,validate:c,label:l,placeholder:u,message:f,messageType:p,required:m,size:h,hint:g,disabled:_,readOnly:v,min:y,max:b,step:x,contentBefore:S,contentAfter:C})=>{let[w,T]=(0,t.useState)(r===void 0?``:String(r)),[E,D]=(0,t.useState)(``),O=_a(),k=e.u(),A=r!==void 0,j=A?String(r):w,M=(0,t.useCallback)(e=>{if(m&&e.trim()===``)return a===`number`?k.numberRequired:k.fieldRequired;if(a===`number`&&e.trim()!==``){let t=Number(e);if(isNaN(t))return k.invalidNumber;if(y!==void 0&&t<y)return k.valueMustBeAtLeast.replace(`{0}`,String(y));if(b!==void 0&&t>b)return k.valueMustBeAtMost.replace(`{0}`,String(b))}return c?c(a===`number`&&e.trim()!==``?Number(e):e):``},[m,a,c,y,b,k]),N=(0,t.useCallback)((e,t)=>{let n=t.value;if(a===`number`&&n!==``&&!/^-?\d*\.?\d*$/.test(n))return;A||T(n);let r=M(n);D(r),!r&&s&&s(a===`number`&&n.trim()!==``?Number(n):n)},[a,A,M,s]),P=(0,t.useCallback)(()=>{D(M(j))},[M,j]),F=(0,t.useMemo)(()=>E?`error`:p===`warning`?`warning`:p===`info`?`success`:`none`,[E,p]),I=(0,t.useMemo)(()=>E||f,[E,f]),L=(0,t.useCallback)(()=>{switch(F){case`error`:return(0,n.jsx)(d.ErrorCircle12Filled,{});case`warning`:return(0,n.jsx)(d.Warning12Filled,{});case`success`:return(0,n.jsx)(d.CheckmarkCircle12Filled,{});default:return null}},[F]),R=o===`circular`?O.inputRoot:void 0;return(0,n.jsx)(i.Field,{label:l,required:m,validationMessage:I,validationMessageIcon:L(),size:h,hint:g,validationState:F,children:(0,n.jsx)(i.Input,{value:j,placeholder:u,onChange:N,onBlur:P,disabled:_,readOnly:v,type:`text`,inputMode:a===`number`?`decimal`:`text`,step:a===`number`?x:void 0,className:R,contentBefore:S,contentAfter:C})})},ya=({onChange:e,defaultKey:r,label:a,options:o=[],minWidth:s,styles:c})=>{let[l,u]=(0,t.useState)(()=>o.map(e=>({...e,selected:e.key===(r??`status`)})));(0,t.useEffect)(()=>{let t=l.find(e=>e.selected);t&&e(t.key)},[]);let d=t.default.useCallback(t=>{u(l.map(e=>({...e,selected:e.key===t.key}))),e(t.key)},[l,e]);return(0,n.jsxs)(U,{gap:`s`,children:[a&&(0,n.jsx)(i.Label,{children:a}),(0,n.jsx)(Ot,{options:l,onSelected:d,styles:s?{minWidth:s}:c??{}})]})},ba=()=>({menuButton:(0,l.css)({minWidth:200}),popover:(0,l.css)({padding:i.tokens.spacingVerticalS,minWidth:200}),timePicker:(0,l.css)({width:`100%`})}),xa=()=>({root:(0,l.css)({maxHeight:280,overflowY:`auto`,padding:`${i.tokens.spacingVerticalXS} 0`}),item:(0,l.css)({cursor:`pointer`})}),Sa=`time`,Ca=(e,t,n)=>{let r=new Date(e);return r.setHours(t,n,0,0),r},wa=(e,t,n)=>{let r={hour:`numeric`,minute:`2-digit`,...n&&{second:`2-digit`},...t&&{hourCycle:t}};return new Intl.DateTimeFormat(void 0,r).format(e)},Ta=e=>`${String(e.getHours()).padStart(2,`0`)}:${String(e.getMinutes()).padStart(2,`0`)}`,Ea=(e,t,n,r)=>{let i=[],a=e*60,o=t*60;for(let e=a;e<o;e+=n){let t=Math.floor(e/60),n=e%60;i.push(Ca(r,t,n))}return i},Da=t.memo(e=>{let{onTimeSelect:r,hourCycle:a,showSeconds:o=!1,startHour:s=0,endHour:c=24,increment:l=30,dateAnchor:u}=e,f=xa(),p=t.useMemo(()=>u??new Date,[u]),m=t.useMemo(()=>Ea(s,c,l,p),[s,c,l,p]),h=t.useCallback((e,t)=>()=>{r(e,t)},[r]);return(0,n.jsx)(`div`,{className:f.root,children:m.map(e=>{let t=wa(e,a,o),r=Ta(e);return(0,n.jsx)(i.MenuItemRadio,{name:Sa,value:r,onClick:h(e,t),icon:(0,n.jsx)(d.ClockRegular,{}),className:f.item,children:t},r)})})}),Oa=(e,t)=>{let n=t?new Date(t):new Date,r=n.getHours()*60+n.getMinutes(),i=Math.ceil(r/e)*e,a=new Date(n);return a.setHours(Math.floor(i/60),i%60,0,0),a},ka=t.memo(e=>{let{onSelected:r,value:a,placeholder:o=`Select a time`,hourCycle:s,showSeconds:c=!1,startHour:l,endHour:u,increment:f=30,dateAnchor:p}=e,m=ba(),h=t.useMemo(()=>Oa(f,p),[f,p]),g=a??h,[_,v]=t.useState(g),[y,b]=t.useState(()=>wa(g,s,c)),[x,S]=t.useState(!1);t.useEffect(()=>{a&&(v(a),b(wa(a,s,c)))},[a,s,c]);let C=t.useCallback((e,t)=>{S(t.open)},[]),w=t.useMemo(()=>(0,d.bundleIcon)(d.ClockFilled,d.ClockRegular),[]),T=t.useMemo(()=>_?{[Sa]:[Ta(_)]}:{[Sa]:[]},[_]),E=t.useCallback((e,t)=>{v(e),b(t),r(e),S(!1)},[r]);return(0,n.jsxs)(i.Menu,{open:x,onOpenChange:C,checkedValues:T,onCheckedValueChange:t.useCallback((e,t)=>{},[]),children:[(0,n.jsx)(i.MenuTrigger,{disableButtonEnhancement:!0,children:(0,n.jsx)(i.MenuButton,{shape:`circular`,icon:(0,n.jsx)(w,{}),className:m.menuButton,"aria-label":`Select time: ${y||o}`,children:y||o})}),(0,n.jsx)(i.MenuPopover,{className:m.popover,children:(0,n.jsx)(i.MenuList,{children:(0,n.jsx)(Da,{value:_,onTimeSelect:E,hourCycle:s,showSeconds:c,startHour:l,endHour:u,increment:f,dateAnchor:p})})})]})}),Aa=()=>({container:(0,l.css)({display:`flex`,flexDirection:`column`,gap:i.tokens.spacingVerticalS,position:`relative`}),pickerList:(0,l.css)({maxHeight:300,overflowY:`auto`,backgroundColor:i.tokens.colorNeutralBackground1,border:`1px solid ${i.tokens.colorNeutralStroke2}`,borderRadius:i.tokens.borderRadiusMedium,boxShadow:i.tokens.shadow16,scrollbarColor:`${i.tokens.colorBrandForeground1} ${i.tokens.colorNeutralBackground1}`,scrollbarWidth:`thin`,"&::-webkit-scrollbar-track":{borderRadius:10,borderWidth:1},"&::-webkit-scrollbar-thumb":{borderRadius:10,borderWidth:1},"&::-webkit-scrollbar":{height:7,width:7}}),optionContent:(0,l.css)({display:`flex`,flexDirection:`column`,gap:i.tokens.spacingVerticalXXS}),optionSecondary:(0,l.css)({fontSize:i.tokens.fontSizeBase200,color:i.tokens.colorNeutralForeground3,fontWeight:i.tokens.fontWeightRegular}),tagPickerControl:(0,l.css)({}),tagPickerInput:(0,l.css)({backgroundColor:`transparent`,border:`none`,outline:`none`,fontSize:i.tokens.fontSizeBase300,"&::placeholder":{color:i.tokens.colorNeutralForeground4},"&:focus":{outline:`none`}})}),ja=({options:r,selectedOptions:a=[],onSelectionChange:o,onSearchChange:s,onLoadMore:c,pagingInfo:l,placeholder:u,disabled:d=!1,maxSelectedOptions:f,width:p,className:m,noResultsMessage:h,loadingMessage:g,loadingMoreMessage:_,searchDebounceMs:v=300})=>{let y=Aa(),b=e.d(),x=u||b.placeholder,S=h||b.noResultsFound,C=g||b.searching,w=_||b.loadingMore,[T,E]=(0,t.useState)(``),D=(0,t.useRef)(null),O=(0,t.useRef)(null),k=a.map(e=>e.value),A=l?.isLoading??!1,j=l?.isLoadingMore??!1,M=l?.hasMore??!1,N=r.filter(e=>!k.includes(e.value)),P=(0,t.useCallback)(e=>{E(e),D.current&&clearTimeout(D.current),D.current=setTimeout(()=>{s?.(e)},v)},[s,v]),F=(0,t.useCallback)(e=>{if(!M||j)return;let{scrollTop:t,scrollHeight:n,clientHeight:r}=e.currentTarget;t+r>=n-100&&c?.()},[M,j,c]),I=(0,t.useCallback)((e,t)=>{if(t.value===`no-options`||t.value===`loading`||t.value===`loading-more`)return;let n=t.selectedOptions,i=a.filter(e=>n.includes(e.value));if(n.length>k.length){let e=n.find(e=>!k.includes(e));if(e){let t=r.find(t=>t.value===e);if(t){if(f&&a.length>=f)return;i.push(t)}}E(``),s?.(``)}o?.(i)},[r,a,k,o,s,f]);return(0,t.useEffect)(()=>()=>{D.current&&clearTimeout(D.current)},[]),(0,n.jsx)(`div`,{className:`${y.container} ${m||``}`,...p&&{style:{width:p}},children:(0,n.jsxs)(i.TagPicker,{onOptionSelect:I,selectedOptions:k,disabled:d,children:[(0,n.jsxs)(i.TagPickerControl,{className:y.tagPickerControl,children:[(0,n.jsx)(i.TagPickerGroup,{"aria-label":b.selectedItems,children:a.map(e=>(0,n.jsx)(i.Tag,{shape:`circular`,media:e.tagMedia??e.media,value:e.value,dismissible:!0,disabled:d,style:{minHeight:30},children:e.text},e.value))}),(0,n.jsx)(i.TagPickerInput,{className:y.tagPickerInput,"aria-label":b.searchItems,placeholder:x,value:T,onChange:e=>P(e.target.value),disabled:d})]}),(0,n.jsx)(i.TagPickerList,{ref:O,onScroll:F,className:y.pickerList,children:A?(0,n.jsx)(i.TagPickerOption,{value:`loading`,children:C}):N.length>0?(0,n.jsxs)(n.Fragment,{children:[N.map(e=>(0,n.jsx)(i.TagPickerOption,{value:e.value,text:e.text,media:e.media,children:(0,n.jsxs)(`div`,{className:y.optionContent,children:[(0,n.jsx)(i.Text,{weight:`semibold`,children:e.text}),e.secondaryText&&(0,n.jsx)(i.Text,{size:200,className:y.optionSecondary,children:e.secondaryText})]})},e.value)),j&&(0,n.jsx)(i.TagPickerOption,{value:`loading-more`,children:w})]}):(0,n.jsx)(i.TagPickerOption,{value:`no-options`,children:S})})]})})},Ma=(e,t=0,n=10**t)=>Math.round(n*e)/n,Na=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Pa=({h:e,s:t,v:n,a:r})=>{let i=e/360*6,a=t/100,o=n/100,s=Math.floor(i),c=o*(1-a),l=o*(1-(i-s)*a),u=o*(1-(1-i+s)*a),d=s%6,f=[o,l,c,c,u,o][d],p=[u,o,o,l,c,c][d],m=[c,c,u,o,o,l][d];return{r:Ma(f*255),g:Ma(p*255),b:Ma(m*255),a:Ma(r,2)}},Fa=({r:e,g:t,b:n,a:r})=>{let i=Math.max(e,t,n),a=i-Math.min(e,t,n),o=a?i===e?(t-n)/a:i===t?2+(n-e)/a:4+(e-t)/a:0;return{h:Ma(60*(o<0?o+6:o)),s:Ma(i?a/i*100:0),v:Ma(i/255*100),a:r}},Ia=({h:e,s:t,v:n,a:r})=>{let i=(200-t)*n/100;return{h:Ma(e),s:Ma(i>0&&i<200?t*n/100/(i<=100?i:200-i)*100:0),l:Ma(i/2),a:Ma(r,2)}},La=({h:e,s:t,l:n,a:r})=>(t*=(n<50?n:100-n)/100,{h:e,s:t>0?2*t/(n+t)*100:0,v:n+t,a:r}),Ra=e=>Fa(Va(e)),za=e=>Ha(Pa(e)),Ba=e=>{let t=Math.round(e.a*255).toString(16).padStart(2,`0`);return`${za(e)}${t}`},Va=e=>{let t=e.startsWith(`#`)?e.slice(1):e;return t.length<=4?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:t.length===4?Ma(parseInt(t[3]+t[3],16)/255,2):1}:{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16),a:t.length>=8?Ma(parseInt(t.slice(6,8),16)/255,2):1}},Ha=({r:e,g:t,b:n})=>`#${[e,t,n].map(e=>e.toString(16).padStart(2,`0`)).join(``)}`,Ua=({r:e,g:t,b:n,a:r})=>{let i=Math.round(r*255).toString(16).padStart(2,`0`);return`#${[e,t,n].map(e=>e.toString(16).padStart(2,`0`)).join(``)}${i}`},Wa=e=>{let{h:t,s:n,l:r}=Ia(e);return`hsl(${t}, ${n}%, ${r}%)`},Ga=e=>{let{h:t,s:n,l:r,a:i}=Ia(e);return`hsla(${t}, ${n}%, ${r}%, ${i})`},Ka=e=>{let{r:t,g:n,b:r}=Pa(e);return`rgb(${t}, ${n}, ${r})`},qa=e=>{let{r:t,g:n,b:r,a:i}=Pa(e);return`rgba(${t}, ${n}, ${r}, ${i})`},Ja=(e,t=`deg`)=>Number(e.replace(RegExp(`${t}$`),``)),Ya=e=>{let t=e.match(/hsla?\(?\s*(-?\d*\.?\d+)(deg|rad|grad|turn)?\s*[,/ ]?\s*(-?\d*\.?\d+)%?\s*[,/ ]?\s*(-?\d*\.?\d+)%?\s*[,/ ]?\s*(-?\d*\.?\d+)?\s*\)?/i);return t?La({h:Ja(t[1],t[2]),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])}):{h:0,s:0,v:0,a:1}},Xa=e=>{let t=e.match(/rgba?\(?\s*(-?\d*\.?\d+)(%?)?\s*[,/ ]?\s*(-?\d*\.?\d+)(%?)?\s*[,/ ]?\s*(-?\d*\.?\d+)(%?)?\s*[,/ ]?\s*(-?\d*\.?\d+)?\s*\)?/i);return t?Fa({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])}):{h:0,s:0,v:0,a:1}},Za={aliceblue:`#f0f8ff`,antiquewhite:`#faebd7`,aqua:`#00ffff`,aquamarine:`#7fffd4`,azure:`#f0ffff`,beige:`#f5f5dc`,bisque:`#ffe4c4`,black:`#000000`,blanchedalmond:`#ffebcd`,blue:`#0000ff`,blueviolet:`#8a2be2`,brown:`#a52a2a`,burlywood:`#deb887`,cadetblue:`#5f9ea0`,chartreuse:`#7fff00`,chocolate:`#d2691e`,coral:`#ff7f50`,cornflowerblue:`#6495ed`,cornsilk:`#fff8dc`,crimson:`#dc143c`,cyan:`#00ffff`,darkblue:`#00008b`,darkcyan:`#008b8b`,darkgoldenrod:`#b8860b`,darkgray:`#a9a9a9`,darkgreen:`#006400`,darkgrey:`#a9a9a9`,darkkhaki:`#bdb76b`,darkmagenta:`#8b008b`,darkolivegreen:`#556b2f`,darkorange:`#ff8c00`,darkorchid:`#9932cc`,darkred:`#8b0000`,darksalmon:`#e9967a`,darkseagreen:`#8fbc8f`,darkslateblue:`#483d8b`,darkslategray:`#2f4f4f`,darkslategrey:`#2f4f4f`,darkturquoise:`#00ced1`,darkviolet:`#9400d3`,deeppink:`#ff1493`,deepskyblue:`#00bfff`,dimgray:`#696969`,dimgrey:`#696969`,dodgerblue:`#1e90ff`,firebrick:`#b22222`,floralwhite:`#fffaf0`,forestgreen:`#228b22`,fuchsia:`#ff00ff`,gainsboro:`#dcdcdc`,ghostwhite:`#f8f8ff`,gold:`#ffd700`,goldenrod:`#daa520`,gray:`#808080`,green:`#008000`,greenyellow:`#adff2f`,grey:`#808080`,honeydew:`#f0fff0`,hotpink:`#ff69b4`,indianred:`#cd5c5c`,indigo:`#4b0082`,ivory:`#fffff0`,khaki:`#f0e68c`,lavender:`#e6e6fa`,lavenderblush:`#fff0f5`,lawngreen:`#7cfc00`,lemonchiffon:`#fffacd`,lightblue:`#add8e6`,lightcoral:`#f08080`,lightcyan:`#e0ffff`,lightgoldenrodyellow:`#fafad2`,lightgray:`#d3d3d3`,lightgreen:`#90ee90`,lightgrey:`#d3d3d3`,lightpink:`#ffb6c1`,lightsalmon:`#ffa07a`,lightseagreen:`#20b2aa`,lightskyblue:`#87cefa`,lightslategray:`#778899`,lightslategrey:`#778899`,lightsteelblue:`#b0c4de`,lightyellow:`#ffffe0`,lime:`#00ff00`,limegreen:`#32cd32`,linen:`#faf0e6`,magenta:`#ff00ff`,maroon:`#800000`,mediumaquamarine:`#66cdaa`,mediumblue:`#0000cd`,mediumorchid:`#ba55d3`,mediumpurple:`#9370db`,mediumseagreen:`#3cb371`,mediumslateblue:`#7b68ee`,mediumspringgreen:`#00fa9a`,mediumturquoise:`#48d1cc`,mediumvioletred:`#c71585`,midnightblue:`#191970`,mintcream:`#f5fffa`,mistyrose:`#ffe4e1`,moccasin:`#ffe4b5`,navajowhite:`#ffdead`,navy:`#000080`,oldlace:`#fdf5e6`,olive:`#808000`,olivedrab:`#6b8e23`,orange:`#ffa500`,orangered:`#ff4500`,orchid:`#da70d6`,palegoldenrod:`#eee8aa`,palegreen:`#98fb98`,paleturquoise:`#afeeee`,palevioletred:`#db7093`,papayawhip:`#ffefd5`,peachpuff:`#ffdab9`,peru:`#cd853f`,pink:`#ffc0cb`,plum:`#dda0dd`,powderblue:`#b0e0e6`,purple:`#800080`,rebeccapurple:`#663399`,red:`#ff0000`,rosybrown:`#bc8f8f`,royalblue:`#4169e1`,saddlebrown:`#8b4513`,salmon:`#fa8072`,sandybrown:`#f4a460`,seagreen:`#2e8b57`,seashell:`#fff5ee`,sienna:`#a0522d`,silver:`#c0c0c0`,skyblue:`#87ceeb`,slateblue:`#6a5acd`,slategray:`#708090`,slategrey:`#708090`,snow:`#fffafa`,springgreen:`#00ff7f`,steelblue:`#4682b4`,tan:`#d2b48c`,teal:`#008080`,thistle:`#d8bfd8`,tomato:`#ff6347`,turquoise:`#40e0d0`,violet:`#ee82ee`,wheat:`#f5deb3`,white:`#ffffff`,whitesmoke:`#f5f5f5`,yellow:`#ffff00`,yellowgreen:`#9acd32`},Y=e=>{let t;if(typeof e!=`string`)t=e;else{let n=e.trim().toLowerCase();t=n in Za?Ra(Za[n]):n.startsWith(`#`)?Ra(n):n.startsWith(`rgb`)?Xa(n):n.startsWith(`hsl`)?Ya(n):Ra(n)}let n=Pa(t),r=Ia(t);return{hsva:t,hsla:r,rgba:n,hex:Ha(n),hexa:Ua(n)}},Qa=e=>/^#?([0-9A-Fa-f]{3}|[0-9A-Fa-f]{4}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/.test(e),$a=e=>{let{r:t,g:n,b:r}=Pa(typeof e==`string`?Y(e).hsva:e);return(.299*t+.587*n+.114*r)/255>.5?`#000000`:`#ffffff`},eo=(e,t)=>e.h===t.h&&e.s===t.s&&e.v===t.v&&e.a===t.a,to=(e,t)=>{if(e===t)return!0;let n=e=>e.replace(`#`,``).toLowerCase();return n(e)===n(t)},no=e=>({h:Na(e.h,0,360),s:Na(e.s,0,100),v:Na(e.v,0,100),a:Na(e.a,0,1)}),X=()=>({pointer:(0,l.css)({position:`absolute`,width:12,height:12,borderRadius:`50%`,border:`2px solid ${i.tokens.colorNeutralBackground1}`,boxShadow:i.tokens.shadow4,transform:`translate(-50%, -50%)`,pointerEvents:`none`,boxSizing:`border-box`}),interactiveContainer:(0,l.css)({position:`relative`,touchAction:`none`,userSelect:`none`,outline:`none`,cursor:`crosshair`,"&:focus-visible":{outline:`2px solid ${i.tokens.colorBrandStroke1}`,outlineOffset:2}}),saturation:(0,l.css)({position:`relative`,width:`100%`,borderRadius:i.tokens.borderRadiusMedium,overflow:`hidden`,cursor:`crosshair`}),bar:(0,l.css)({position:`relative`,borderRadius:i.tokens.borderRadiusMedium,overflow:`hidden`,cursor:`crosshair`}),checkerboard:(0,l.css)({backgroundImage:`url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAADFJREFUOE9jZGBgEGHAD97gk2YcNYBhmIQBgWSAP52AwoaFBQJouucRlsGnBCgGDAYAAIpGBAWLkEGCAAAAAElFTkSuQmCC")`,backgroundSize:`8px 8px`,backgroundPosition:`0 0, 4px 4px`,position:`absolute`,inset:0,borderRadius:`inherit`}),swatchContainer:(0,l.css)({display:`flex`,flexWrap:`wrap`,gap:i.tokens.spacingHorizontalXS}),swatch:(0,l.css)({position:`relative`,borderRadius:i.tokens.borderRadiusSmall,cursor:`pointer`,border:`1px solid ${i.tokens.colorNeutralStroke2}`,boxSizing:`border-box`,transition:`transform 120ms ease, box-shadow 120ms ease`,outline:`none`,"&:hover":{transform:`scale(1.2)`,zIndex:1,boxShadow:`0 0 0 2px rgba(255,255,255,0.8), 0 2px 6px rgba(0,0,0,0.3)`},"&:focus-visible":{outline:`2px solid ${i.tokens.colorBrandStroke1}`,outlineOffset:2}}),swatchSelected:(0,l.css)({transform:`scale(1.2)`,zIndex:1,boxShadow:`0 0 0 1px ${i.tokens.colorBrandStroke1}`}),editableInputContainer:(0,l.css)({display:`flex`,flexDirection:`column`,alignItems:`center`,gap:i.tokens.spacingVerticalXXS,flex:1,minWidth:36,overflow:`hidden`}),editableInputLabel:(0,l.css)({fontSize:i.tokens.fontSizeBase200,color:i.tokens.colorNeutralForeground3,lineHeight:i.tokens.lineHeightBase200,textTransform:`uppercase`}),sketchContainer:(0,l.css)({padding:i.tokens.spacingHorizontalM,borderRadius:i.tokens.borderRadiusMedium,backgroundColor:i.tokens.colorNeutralBackground1,boxShadow:i.tokens.shadow8,boxSizing:`border-box`}),chromeContainer:(0,l.css)({padding:i.tokens.spacingHorizontalM,borderRadius:i.tokens.borderRadiusMedium,backgroundColor:i.tokens.colorNeutralBackground1,boxShadow:i.tokens.shadow8,boxSizing:`border-box`}),chromePreview:(0,l.css)({width:28,height:28,borderRadius:`50%`,border:`1px solid ${i.tokens.colorNeutralStroke2}`,boxSizing:`border-box`,flexShrink:0}),colorfulContainer:(0,l.css)({borderRadius:i.tokens.borderRadiusMedium,overflow:`hidden`}),wheelContainer:(0,l.css)({position:`relative`,borderRadius:`50%`,overflow:`hidden`}),circleContainer:(0,l.css)({display:`flex`,flexWrap:`wrap`,gap:i.tokens.spacingHorizontalS,justifyContent:`center`}),circlePoint:(0,l.css)({borderRadius:`50%`,cursor:`pointer`,border:`2px solid transparent`,transition:`border-color ${i.tokens.durationNormal} ${i.tokens.curveEasyEase}`,outline:`none`,"&:hover":{opacity:.85},"&:focus-visible":{outline:`2px solid ${i.tokens.colorBrandStroke1}`,outlineOffset:2}}),circlePointSelected:(0,l.css)({borderColor:i.tokens.colorNeutralBackground1,boxShadow:`0 0 0 2px ${i.tokens.colorNeutralStroke1}`}),compactContainer:(0,l.css)({padding:i.tokens.spacingHorizontalS,borderRadius:i.tokens.borderRadiusMedium,backgroundColor:i.tokens.colorNeutralBackground1,boxShadow:i.tokens.shadow4,boxSizing:`border-box`,width:`fit-content`}),blockContainer:(0,l.css)({borderRadius:i.tokens.borderRadiusMedium,backgroundColor:i.tokens.colorNeutralBackground1,boxShadow:i.tokens.shadow8,overflow:`hidden`,boxSizing:`border-box`}),blockHeader:(0,l.css)({display:`flex`,alignItems:`center`,justifyContent:`center`,height:110,position:`relative`,fontSize:i.tokens.fontSizeHero800,fontWeight:i.tokens.fontWeightBold}),blockTriangle:(0,l.css)({position:`absolute`,bottom:-6,left:`50%`,transform:`translateX(-50%)`,width:0,height:0,borderLeft:`6px solid transparent`,borderRight:`6px solid transparent`}),materialContainer:(0,l.css)({width:98,padding:i.tokens.spacingHorizontalM,borderRadius:i.tokens.borderRadiusMedium,backgroundColor:i.tokens.colorNeutralBackground1,boxShadow:i.tokens.shadow8,boxSizing:`border-box`}),materialInputUnderline:(0,l.css)({width:`100%`,height:2,marginTop:i.tokens.spacingVerticalXXS,borderRadius:i.tokens.borderRadiusSmall}),githubContainer:(0,l.css)({padding:i.tokens.spacingHorizontalM,borderRadius:i.tokens.borderRadiusMedium,backgroundColor:i.tokens.colorNeutralBackground1,boxShadow:i.tokens.shadow8,boxSizing:`border-box`,position:`relative`}),githubArrow:(0,l.css)({position:`absolute`,width:0,height:0}),sliderContainer:(0,l.css)({display:`flex`,flexDirection:`column`,gap:i.tokens.spacingVerticalXS})}),ro=(e,t,n)=>{let r=e.getBoundingClientRect();return{left:Math.max(0,Math.min(1,(t-r.left)/r.width)),top:Math.max(0,Math.min(1,(n-r.top)/r.height))}},io=({onMove:e,onDown:r,className:a,style:o,children:s})=>{let c=(0,t.useRef)(null),l=(0,t.useRef)(!1),u=X(),d=(0,t.useCallback)((t,n)=>{c.current&&e?.(ro(c.current,t,n))},[e]),f=(0,t.useCallback)(()=>{let e=e=>d(e.clientX,e.clientY),t=()=>{document.removeEventListener(`mousemove`,e),document.removeEventListener(`mouseup`,t)};return{onMouseMove:e,onMouseUp:t}},[d]),p=(0,t.useCallback)(t=>{if(l.current){l.current=!1;return}if(t.preventDefault(),!c.current)return;let n=ro(c.current,t.clientX,t.clientY);r?.(n),e?.(n);let{onMouseMove:i,onMouseUp:a}=f();document.addEventListener(`mousemove`,i),document.addEventListener(`mouseup`,a)},[r,e,f]),m=(0,t.useCallback)(t=>{if(l.current=!0,!c.current||!t.touches[0])return;let n=ro(c.current,t.touches[0].clientX,t.touches[0].clientY);r?.(n),e?.(n)},[r,e]),h=(0,t.useCallback)(e=>{e.touches[0]&&d(e.touches[0].clientX,e.touches[0].clientY)},[d]);return(0,n.jsx)(`div`,{ref:c,className:(0,i.mergeClasses)(u.interactiveContainer,a),style:o,onMouseDown:p,onTouchStart:m,onTouchMove:h,role:`none`,children:s})},ao=({color:e,left:t,top:r})=>(0,n.jsx)(`div`,{className:X().pointer,style:{left:`${(t??0)*100}%`,top:`${(r??0)*100}%`,backgroundColor:e}}),oo=({hsva:e,onChange:r,pointer:a=ao,radius:o=6,className:s,style:c})=>{let u=X(),d=(0,t.useCallback)(t=>{let n=no({h:e.h,s:t.left*100,v:(1-t.top)*100,a:e.a});r?.(Y(n))},[e.h,e.a,r]),f=(0,t.useCallback)(t=>{let{s:n,v:i}=e,a=t.shiftKey?10:1;switch(t.key){case`ArrowRight`:n=Math.min(100,n+a);break;case`ArrowLeft`:n=Math.max(0,n-a);break;case`ArrowUp`:i=Math.min(100,i+a);break;case`ArrowDown`:i=Math.max(0,i-a);break;default:return}t.preventDefault(),r?.(Y(no({...e,s:n,v:i})))},[e,r]),p=(0,t.useMemo)(()=>(0,l.css)({height:typeof c?.height==`number`?c.height:150,...c,backgroundImage:`linear-gradient(0deg, #000, transparent), linear-gradient(90deg, #fff, transparent)`,backgroundColor:`hsl(${e.h}, 100%, 50%)`}),[e.h,c]);return(0,n.jsx)(io,{onMove:d,className:(0,i.mergeClasses)(u.saturation,s),children:(0,n.jsx)(`div`,{className:p,onKeyDown:f,tabIndex:0,role:`slider`,"aria-label":`Saturation and brightness`,"aria-valuetext":`Saturation ${Math.round(e.s)}%, Brightness ${Math.round(e.v)}%`,style:{borderRadius:o},children:(0,n.jsx)(a,{color:Y(e).hex,left:e.s/100,top:1-e.v/100})})})},so=`linear-gradient(to right, #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000)`,co=`linear-gradient(to bottom, #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000)`,lo=({color:e,left:t,top:r})=>(0,n.jsx)(`div`,{className:X().pointer,style:{left:`${(t??0)*100}%`,top:`${(r??0)*100}%`,backgroundColor:e}}),uo=({hsva:e,onChange:r,width:a=`100%`,height:o=12,direction:s=`horizontal`,pointer:c=lo,radius:u=6,className:d,style:f})=>{let p=X(),m=s===`horizontal`,h=(0,t.useCallback)(t=>{let n=m?t.left:t.top,i=no({...e,h:n*360});r?.(Y(i))},[e,r,m]),g=(0,t.useCallback)(t=>{let{h:n}=e,i=t.shiftKey?10:1,a=m?`ArrowRight`:`ArrowDown`,o=m?`ArrowLeft`:`ArrowUp`;if(t.key===a)n=(n+i)%360;else if(t.key===o)n=(n-i+360)%360;else return;t.preventDefault(),r?.(Y(no({...e,h:n})))},[e,r,m]),_=(0,t.useMemo)(()=>(0,l.css)({width:a,height:o,backgroundImage:m?so:co,borderRadius:u,...f}),[a,o,m,u,f]),v=e.h/360;return(0,n.jsx)(io,{onMove:h,className:(0,i.mergeClasses)(p.bar,d),children:(0,n.jsx)(`div`,{className:_,onKeyDown:g,tabIndex:0,role:`slider`,"aria-label":`Hue`,"aria-valuemin":0,"aria-valuemax":360,"aria-valuenow":Math.round(e.h),children:(0,n.jsx)(c,{color:`hsl(${e.h}, 100%, 50%)`,left:m?v:.5,top:m?.5:v})})})},fo=({color:e,left:t,top:r})=>(0,n.jsx)(`div`,{className:X().pointer,style:{left:`${(t??0)*100}%`,top:`${(r??0)*100}%`,backgroundColor:e}}),po=({hsva:e,onChange:r,width:a=`100%`,height:o=12,direction:s=`horizontal`,pointer:c=fo,radius:u=6,className:d,style:f})=>{let p=X(),m=s===`horizontal`,h=(0,t.useCallback)(t=>{let n=m?t.left:t.top,i=no({...e,a:Math.round(n*100)/100});r?.(Y(i))},[e,r,m]),g=(0,t.useCallback)(t=>{let{a:n}=e,i=t.shiftKey?.1:.01,a=m?`ArrowRight`:`ArrowDown`,o=m?`ArrowLeft`:`ArrowUp`;if(t.key===a)n=Math.min(1,n+i);else if(t.key===o)n=Math.max(0,n-i);else return;t.preventDefault(),r?.(Y(no({...e,a:Math.round(n*100)/100})))},[e,r,m]),_=qa({...e,a:0}),v=qa({...e,a:1}),y=m?`linear-gradient(to right, ${_}, ${v})`:`linear-gradient(to bottom, ${_}, ${v})`,b=(0,t.useMemo)(()=>(0,l.css)({width:a,height:o,position:`relative`,borderRadius:u,...f}),[a,o,u,f]),x=(0,t.useMemo)(()=>(0,l.css)({position:`absolute`,inset:0,backgroundImage:y,borderRadius:`inherit`}),[y]),S=e.a;return(0,n.jsx)(io,{onMove:h,className:(0,i.mergeClasses)(p.bar,d),children:(0,n.jsxs)(`div`,{className:b,onKeyDown:g,tabIndex:0,role:`slider`,"aria-label":`Alpha`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(e.a*100),children:[(0,n.jsx)(`div`,{className:p.checkerboard}),(0,n.jsx)(`div`,{className:x,children:(0,n.jsx)(c,{color:qa(e),left:m?S:.5,top:m?.5:S})})]})})},mo=({color:e,left:t})=>(0,n.jsx)(`div`,{className:X().pointer,style:{left:`${(t??0)*100}%`,top:`50%`,backgroundColor:e}}),ho=({hsva:e,onChange:r,width:a=`100%`,height:o=12,pointer:s=mo,radius:c=6,className:u,style:d})=>{let f=X(),p=(0,t.useCallback)(t=>{let n=(1-t.left)*100,i=no({...e,v:n});r?.(Y(i))},[e,r]),m=(0,t.useCallback)(t=>{let{v:n}=e,i=t.shiftKey?10:1;if(t.key===`ArrowRight`)n=Math.max(0,n-i);else if(t.key===`ArrowLeft`)n=Math.min(100,n+i);else return;t.preventDefault(),r?.(Y(no({...e,v:n})))},[e,r]),{h,s:g}=Ia(e),_=`linear-gradient(to right, hsl(${h}, ${g}%, 50%), hsl(${h}, ${g}%, 0%))`,v=(0,t.useMemo)(()=>(0,l.css)({width:a,height:o,backgroundImage:_,borderRadius:c,position:`relative`,...d}),[a,o,_,c,d]),y=1-e.v/100;return(0,n.jsx)(io,{onMove:p,className:(0,i.mergeClasses)(f.bar,u),children:(0,n.jsx)(`div`,{className:v,onKeyDown:m,tabIndex:0,role:`slider`,"aria-label":`Shade`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(e.v),children:(0,n.jsx)(s,{color:Y(e).hex,left:y})})})},go=e=>typeof e==`string`?{color:e}:e,_o=({color:e,title:r,checked:a,disabled:o,size:s=24,radius:c=4,onClick:u,rectRender:d,addonBefore:f,addonAfter:p,colors:m=[],className:h,style:g})=>{let _=X(),v=(0,t.useCallback)(e=>{o||u?.(e)},[o,u]);if(m.length===0&&e){let t=a??!1,o=(0,l.css)({width:s,height:s,borderRadius:c,backgroundColor:e}),u=d?d({className:(0,i.mergeClasses)(_.swatch,t?_.swatchSelected:void 0,o,h),style:g,onClick:()=>v(e),role:`button`,"aria-pressed":t,tabIndex:0}):(0,n.jsx)(`div`,{className:(0,i.mergeClasses)(_.swatch,t?_.swatchSelected:void 0,o,h),style:g,onClick:()=>v(e),role:`button`,"aria-pressed":t?`true`:void 0,"aria-label":r??e,tabIndex:0,onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),v(e))}});return r?(0,n.jsx)(i.Tooltip,{content:r,relationship:`label`,children:u}):u}let y=(0,t.useMemo)(()=>new Map(m.map(e=>{let{color:t}=go(e);return[t,za(Y(t).hsva)]})),[m]);return(0,n.jsxs)(U,{direction:`vertical`,gap:`xs`,children:[f,(0,n.jsx)(`div`,{className:_.swatchContainer,role:`listbox`,"aria-label":`Color swatches`,children:m.map((t,r)=>{let{color:a,title:o}=go(t),u=y.get(a)||a,d=e?to(u,e):!1,f=(0,l.css)({width:s,height:s,borderRadius:c,backgroundColor:a}),p=(0,n.jsx)(`div`,{className:(0,i.mergeClasses)(_.swatch,d?_.swatchSelected:void 0,f),onClick:()=>v(a),role:`option`,"aria-selected":d?`true`:void 0,"aria-label":o??a,tabIndex:0,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),v(a))},children:d&&(0,n.jsx)(`svg`,{viewBox:`0 0 16 16`,width:s*.6,height:s*.6,style:{position:`absolute`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,fill:$a(Ra(a))},children:(0,n.jsx)(`path`,{d:`M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z`})})},`${a}-${r}`);return o?(0,n.jsx)(i.Tooltip,{content:o,relationship:`label`,children:p},`${a}-${r}`):p})}),p]})},vo={width:`100%`,minWidth:0,textAlign:`center`},yo=({label:e,value:r,onChange:a,placeholder:o,className:s,style:c})=>{let l=X(),[u,d]=(0,t.useState)(String(r??``));(0,t.useEffect)(()=>{d(String(r??``))},[r]);let f=(0,t.useCallback)((e,t)=>{d(t.value)},[]),p=(0,t.useCallback)(()=>{a?.(u)},[u,a]),m=(0,t.useCallback)(e=>{e.key===`Enter`&&a?.(u)},[u,a]);return(0,n.jsxs)(`div`,{className:l.editableInputContainer,style:c,children:[(0,n.jsx)(i.Input,{size:`small`,value:u,onChange:f,onBlur:p,onKeyDown:m,placeholder:o,className:s,"aria-label":e,style:vo}),e&&(0,n.jsx)(`span`,{className:l.editableInputLabel,children:e})]})},bo=({hsva:e,onChange:r,showAlpha:i=!0,className:a,style:o})=>{let s=Pa(e),c=(0,t.useCallback)((e,t)=>{let n=Number(t);if(isNaN(n))return;let i={...s};e===`a`?i.a=Math.max(0,Math.min(1,n/100)):i[e]=Math.max(0,Math.min(255,Math.round(n)));let a=Fa(i);r?.(Y(a))},[s,r]);return(0,n.jsxs)(U,{direction:`horizontal`,gap:`xs`,className:a,style:(0,t.useMemo)(()=>({flex:3,minWidth:0,...o}),[o]),children:[(0,n.jsx)(yo,{label:`R`,value:s.r,onChange:e=>c(`r`,e)}),(0,n.jsx)(yo,{label:`G`,value:s.g,onChange:e=>c(`g`,e)}),(0,n.jsx)(yo,{label:`B`,value:s.b,onChange:e=>c(`b`,e)}),i&&(0,n.jsx)(yo,{label:`A`,value:Math.round(s.a*100),onChange:e=>c(`a`,e)})]})},xo=({hsva:e,onChange:r,showAlpha:i=!0,className:a,style:o})=>{let s=Ia(e),c=(0,t.useCallback)((e,t)=>{let n=Number(t);if(isNaN(n))return;let i={...s};e===`a`?i.a=Math.max(0,Math.min(1,n/100)):e===`h`?i.h=Math.max(0,Math.min(360,Math.round(n))):i[e]=Math.max(0,Math.min(100,Math.round(n)));let a=La(i);r?.(Y(a))},[s,r]);return(0,n.jsxs)(U,{direction:`horizontal`,gap:`xs`,className:a,style:(0,t.useMemo)(()=>({flex:3,minWidth:0,...o}),[o]),children:[(0,n.jsx)(yo,{label:`H`,value:Math.round(s.h),onChange:e=>c(`h`,e)}),(0,n.jsx)(yo,{label:`S`,value:Math.round(s.s),onChange:e=>c(`s`,e)}),(0,n.jsx)(yo,{label:`L`,value:Math.round(s.l),onChange:e=>c(`l`,e)}),i&&(0,n.jsx)(yo,{label:`A`,value:Math.round(s.a*100),onChange:e=>c(`a`,e)})]})},So=[`#D0021B`,`#F5A623`,`#F8E71C`,`#8B572A`,`#7ED321`,`#417505`,`#BD10E0`,`#9013FE`,`#4A90D9`,`#50E3C2`,`#B8E986`,`#000000`,`#4A4A4A`,`#9B9B9B`,`#FFFFFF`],Co=({color:e,onChange:r,width:a=320,presetColors:o=So,editableDisable:s=!1,disableAlpha:c=!1,className:l,style:u})=>{let d=X(),f=e=>e?typeof e==`string`?Y(e).hsva:e:{h:0,s:0,v:100,a:1},[p,m]=(0,t.useState)(()=>f(e));(0,t.useEffect)(()=>{e!==void 0&&m(f(e))},[e]);let h=(0,t.useCallback)(e=>{m(e.hsva),r?.(e)},[r]),g=(0,t.useCallback)(e=>{let t=e.startsWith(`#`)?e:`#${e}`;if(Qa(t)){let e=Y(t);m(e.hsva),r?.(e)}},[r]),_=(0,t.useCallback)(e=>{let t=Y(e);m(t.hsva),r?.(t)},[r]),v=za(p),y=(0,t.useMemo)(()=>({width:a,...u}),[a,u]);return(0,n.jsxs)(U,{direction:`vertical`,gap:`m`,className:(0,i.mergeClasses)(d.sketchContainer,l),style:y,children:[(0,n.jsx)(oo,{hsva:p,onChange:h}),(0,n.jsxs)(U,{direction:`vertical`,gap:`s`,children:[(0,n.jsx)(uo,{hsva:p,onChange:h}),!c&&(0,n.jsx)(po,{hsva:p,onChange:h})]}),!s&&(0,n.jsxs)(U,{direction:`horizontal`,gap:`xs`,alignItems:`flex-end`,children:[(0,n.jsx)(yo,{label:`Hex`,value:v.replace(`#`,``),onChange:g}),(0,n.jsx)(bo,{hsva:p,onChange:h,showAlpha:!c})]}),o.length>0&&(0,n.jsx)(_o,{colors:o,color:v,onClick:_,size:16,radius:3})]})},wo=function(e){return e.HEXA=`hexa`,e.RGBA=`rgba`,e.HSLA=`hsla`,e}({}),To={flex:1},Eo={flex:`none`},Do={minWidth:28,width:28,padding:0},Oo=[wo.HEXA,wo.RGBA,wo.HSLA],ko=({color:e,onChange:r,width:a=320,showAlpha:o=!0,showColorPreview:s=!0,showEditableInput:c=!0,showEyeDropper:l=!0,inputType:u=wo.HEXA,className:d,style:f})=>{let p=X(),m=e=>e?typeof e==`string`?Y(e).hsva:e:{h:0,s:68,v:100,a:1},[h,g]=(0,t.useState)(()=>m(e)),[_,v]=(0,t.useState)(u);(0,t.useEffect)(()=>{e!==void 0&&g(m(e))},[e]);let y=(0,t.useCallback)(e=>{g(e.hsva),r?.(e)},[r]),b=(0,t.useCallback)(e=>{let t=e.startsWith(`#`)?e:`#${e}`;if(Qa(t)){let e=Y(t);g(e.hsva),r?.(e)}},[r]),x=(0,t.useCallback)(()=>{v(e=>Oo[(Oo.indexOf(e)+1)%Oo.length])},[]),S=(0,t.useCallback)(async()=>{if(`EyeDropper`in window)try{let e=await new window.EyeDropper().open();if(e?.sRGBHex){let t=Y(e.sRGBHex);g(t.hsva),r?.(t)}}catch{}},[r]),C=za(h),w=Ba(h),T=(0,t.useMemo)(()=>({width:a,...f}),[a,f]);return(0,n.jsxs)(U,{direction:`vertical`,gap:`m`,className:(0,i.mergeClasses)(p.chromeContainer,d),style:T,children:[(0,n.jsx)(oo,{hsva:h,onChange:y}),(0,n.jsxs)(U,{direction:`horizontal`,gap:`m`,alignItems:`center`,children:[s&&(0,n.jsx)(`div`,{className:p.chromePreview,style:{backgroundColor:qa(h)},"aria-label":`Selected color: ${C}`}),(0,n.jsxs)(U,{direction:`vertical`,gap:`xs`,style:To,children:[(0,n.jsx)(uo,{hsva:h,onChange:y}),o&&(0,n.jsx)(po,{hsva:h,onChange:y})]})]}),c&&(0,n.jsxs)(U,{direction:`horizontal`,gap:`xs`,alignItems:`flex-start`,children:[_===wo.HEXA&&(0,n.jsx)(yo,{label:`HEX`,value:o?w.replace(`#`,``):C.replace(`#`,``),onChange:b}),_===wo.RGBA&&(0,n.jsx)(bo,{hsva:h,onChange:y,showAlpha:o}),_===wo.HSLA&&(0,n.jsx)(xo,{hsva:h,onChange:y,showAlpha:o}),(0,n.jsxs)(U,{direction:`horizontal`,gap:`xs`,style:Eo,children:[(0,n.jsx)(i.Button,{appearance:`subtle`,size:`small`,icon:(0,n.jsx)(`span`,{children:`⇅`}),onClick:x,"aria-label":`Toggle color format`,style:Do}),l&&`EyeDropper`in window&&(0,n.jsx)(i.Button,{appearance:`subtle`,size:`small`,icon:(0,n.jsx)(`span`,{children:`💧`}),onClick:S,"aria-label":`Pick color from screen`,style:Do})]})]})]})},Ao=({color:e,onChange:r,disableAlpha:a=!1,className:o,style:s})=>{let c=X(),l=e=>e?typeof e==`string`?Y(e).hsva:e:{h:0,s:100,v:100,a:1},[u,d]=(0,t.useState)(()=>l(e));(0,t.useEffect)(()=>{e!==void 0&&d(l(e))},[e]);let f=(0,t.useCallback)(e=>{d(e.hsva),r?.(e)},[r]);return(0,n.jsxs)(U,{direction:`vertical`,gap:`m`,className:(0,i.mergeClasses)(c.colorfulContainer,o),style:s,children:[(0,n.jsx)(oo,{hsva:u,onChange:f}),(0,n.jsx)(uo,{hsva:u,onChange:f}),!a&&(0,n.jsx)(po,{hsva:u,onChange:f})]})},jo=({color:e,left:t,top:r})=>(0,n.jsx)(`div`,{className:X().pointer,style:{left:`${(t??0)*100}%`,top:`${(r??0)*100}%`,backgroundColor:e}}),Mo=(e,t)=>{let n=t/2,r=n*(e.s/100),i=e.h*Math.PI/180;return{x:n+r*Math.cos(i),y:n+r*Math.sin(i)}},No=(e,t,n)=>{let r=n/2,i=e-r,a=t-r,o=Math.atan2(a,i)*180/Math.PI;o<0&&(o+=360);let s=Math.min(Math.sqrt(i*i+a*a),r);return{h:o,s:s/r*100}},Po=({color:e,onChange:r,width:a=200,height:o,pointer:s=jo,className:c,style:u})=>{let d=X(),f=o??a,p=(0,t.useRef)(null),m=e=>e?typeof e==`string`?Y(e).hsva:e:{h:0,s:100,v:100,a:1},[h,g]=(0,t.useState)(()=>m(e));(0,t.useEffect)(()=>{e!==void 0&&g(m(e))},[e]);let _=(0,t.useCallback)(e=>{let{h:t,s:n}=No(e.left*a,e.top*f,Math.min(a,f)),i=Y({h:t,s:n,v:h.v,a:h.a});g(i.hsva),r?.(i)},[a,f,h.v,h.a,r]),v=Mo(h,Math.min(a,f)),y=(0,t.useMemo)(()=>(0,l.css)({width:a,height:f,background:`conic-gradient(
|
|
144
|
+
`}),tr=({placeholder:n,onSearch:r,onChange:a,onClear:o,disabled:s=!1,className:c,width:l,value:u,shape:f=`circular`,contentBefore:p,size:m})=>{let[h,g]=(0,t.useState)(``),_=(0,t.useRef)(null),{searchBoxStyles:y,searchBoxNormalStyles:b,iconWrapperStyles:x}=er(),S=e.v(),C=n||S.placeholder,w=u!==void 0,T=w?u:h,E=f===`circular`?y:b,D=(0,t.useCallback)((e,t)=>{w||g(t.value),a?.(t.value)},[w,a]),O=(0,t.useCallback)(()=>{w||g(``),_.current?.blur(),o?.(),r?.(``)},[w,o,r]),k=(0,t.useCallback)(e=>{e.key===`Enter`&&T.trim()?r?.(T.trim()):e.key===`Escape`&&(_.current?.blur(),w||g(``),o?.())},[T,w,r,o]);return(0,v.jsx)(i.SearchBox,{ref:_,css:E,className:c,style:{width:l},placeholder:C,value:T,onChange:D,onKeyDown:k,disabled:s,size:m,contentBefore:p??(0,v.jsx)(`span`,{css:x,children:(0,v.jsx)(d.SearchRegular,{})}),dismiss:{onClick:O}})},nr=t.memo(function({placeholder:r,size:i=`large`,onKeyDown:a,onChange:o,className:s}){let c=(0,g.useStore)(),u=(0,g.useAtomValue)(Ln),d=Qn(),f=e.b(),[p,m]=(0,t.useState)(!1),h=(0,t.useRef)(null),_=(0,t.useRef)(p),v=r||f.searchPlaceholder,y=t.useCallback(e=>{K.setQuery(e,c),o?.(e)},[c,o]);return _.current=p,(0,t.useEffect)(()=>{let e=h.current;if(!e)return;let t=e=>{a?.(e),!_.current&&(e.key===`ArrowDown`&&(e.preventDefault(),K.selectNextAction(c)),e.key===`ArrowUp`&&(e.preventDefault(),K.selectPreviousAction(c)),e.key===`Enter`&&(e.preventDefault(),K.triggerSelectedAction(c)))},n=()=>m(!0),r=()=>m(!1);return e.addEventListener(`keydown`,t),e.addEventListener(`compositionstart`,n),e.addEventListener(`compositionend`,r),()=>{e.removeEventListener(`keydown`,t),e.removeEventListener(`compositionstart`,n),e.removeEventListener(`compositionend`,r)}},[a,c]),(0,n.jsx)(U,{ref:h,className:`${d.search}${s?` ${s}`:``}`,children:(0,n.jsx)(tr,{value:u,onChange:y,placeholder:v,size:i,shape:`circular`,className:(0,l.css)({maxWidth:`100% !important`})})})});function rr({text:e,query:r,highlightClassName:i}){if(!r.trim())return(0,n.jsx)(n.Fragment,{children:e});let a=r.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);return(0,n.jsx)(n.Fragment,{children:e.split(RegExp(`(${a})`,`gi`)).map((e,a)=>e.toLowerCase()===r.toLowerCase()?(0,n.jsx)(`mark`,{className:i,children:e},a):(0,n.jsx)(t.Fragment,{children:e},a))})}var ir=t.memo(function({label:e,description:r,leftSection:a,rightSection:o,children:s,highlightQuery:c=!1,closeSpotlightOnTrigger:l,onClick:u,className:d}){let f=(0,g.useStore)(),p=(0,g.useAtomValue)(Ln),m=(0,g.useAtomValue)(zn),h=Qn(),_=(0,t.useMemo)(()=>e=>{u?.(e),(l??m)&&K.close(f)},[u,l,m,f]),v=(0,t.useMemo)(()=>e=>{e.preventDefault()},[]),y=(0,t.useMemo)(()=>e?c&&typeof e==`string`?(0,n.jsx)(Dt,{as:`span`,fontSize:`m`,fontWeight:`regular`,children:(0,n.jsx)(rr,{text:e,query:p,highlightClassName:h.highlight})}):(0,n.jsx)(Dt,{as:`span`,fontSize:`m`,fontWeight:`regular`,children:e}):null,[e,c,p,h.highlight]);return(0,n.jsx)(i.Button,{"data-spotlight-action":!0,role:`option`,appearance:`subtle`,className:`${h.action}${d?` ${d}`:``}`,onClick:_,onMouseDown:v,tabIndex:-1,children:s||(0,n.jsxs)(n.Fragment,{children:[a&&(0,n.jsx)(U,{direction:`horizontal`,alignItems:`start`,justifyContent:`start`,className:h.actionSectionLeft,children:a}),(0,n.jsxs)(U,{direction:`vertical`,gap:`none`,className:h.actionBody,children:[y,r&&(0,n.jsx)(Dt,{as:`span`,fontSize:`xs`,color:`dimmed`,className:h.actionDescription,numberOfLines:1,children:r})]}),o&&(0,n.jsx)(U,{direction:`horizontal`,alignItems:`center`,justifyContent:`center`,className:h.actionSectionRight,children:o})]})})}),ar=t.memo(function({label:e,children:t,className:r}){let i=Qn();return(0,n.jsxs)(U,{direction:`vertical`,className:`${i.actionsGroup}${r?` ${r}`:``}`,children:[e&&(0,n.jsx)(Dt,{as:`span`,fontSize:`xs`,fontWeight:`bold`,color:`dimmed`,className:i.actionsGroupLabel,children:e}),t]})}),or=t.memo(function({children:e,className:r,id:i}){let a=(0,g.useStore)(),o=Qn(),s=(0,t.useId)().replace(/:/g,``),c=i||`spotlight-${s}`,l=(0,t.useRef)(null);return(0,t.useEffect)(()=>{let e=l.current;e&&(e.id=c,e.setAttribute(`role`,`listbox`),e.setAttribute(`aria-label`,`Actions`))},[c]),(0,t.useEffect)(()=>(K.setListId(c,a),()=>K.setListId(``,a)),[c,a]),(0,n.jsx)(U,{ref:l,direction:`vertical`,padding:`xs`,className:`${o.actionsList}${r?` ${r}`:``}`,children:e})}),sr=t.memo(function({children:e,className:t}){return(0,n.jsx)(U,{direction:`vertical`,alignItems:`center`,justifyContent:`center`,padding:`l`,className:t,children:(0,n.jsx)(Dt,{as:`p`,fontSize:`s`,color:`dimmed`,children:e})})}),cr=t.memo(function({children:e,className:t}){let r=Qn();return(0,n.jsx)(U,{padding:`${i.tokens.spacingVerticalS} ${i.tokens.spacingHorizontalL}`,className:`${r.footer}${t?` ${t}`:``}`,children:e})}),lr=e=>Array.isArray(e)?e.map(e=>e.trim()).join(`,`).toLowerCase().trim():typeof e==`string`?e.toLowerCase().trim():``,ur=e=>e.group!==void 0&&Array.isArray(e.actions),dr=e=>e.reduce((e,t)=>ur(t)?[...e,...t.actions.map(e=>({...e,group:t.group}))]:[...e,t],[]),fr=e=>{let t={},n=[];return e.forEach(e=>{e.group?(t[e.group]||(t[e.group]={pushed:!1,data:{group:e.group,actions:[]}}),t[e.group].data.actions.push(e),t[e.group].pushed||(t[e.group].pushed=!0,n.push(t[e.group].data))):n.push(e)}),n},pr=(e,t)=>{let n=(e??``).trim().toLowerCase();if(!n)return t;let r=[[],[]];return dr(t).forEach(e=>{e.label?.toLowerCase().includes(n)?r[0].push(e):(e.description?.toLowerCase().includes(n)||lr(e.keywords).includes(n))&&r[1].push(e)}),fr(r.flat())},mr=(e,t)=>{if(!Array.isArray(e))return[];let n=0;return e.reduce((e,r)=>{if(n>=t)return e;if(ur(r)){let i=mr(r.actions,t-n);e.push({group:r.group,actions:i}),n+=i.length}else e.push(r),n+=1;return e},[])},hr=({searchProps:r,actions:i,filter:a=pr,nothingFound:o,highlightQuery:s=!1,limit:c=1/0,query:l,onQueryChange:u,store:d=Hn,...f})=>{let p=e.b(),[m,h]=(0,t.useState)(``),g=typeof l==`string`,_=(g?l:m)??``,v=(0,t.useCallback)(e=>{g||h(e),u?.(e)},[g,u]),y=(0,t.useMemo)(()=>mr(a(_,i),c),[_,i,a,c]),b=o??p.nothingFound,x=(0,t.useMemo)(()=>y.map(e=>{if(ur(e)){let t=e.actions.map(({id:e,...t})=>(0,n.jsx)(ir,{highlightQuery:s,...t},e));return(0,n.jsx)(ar,{label:e.group,children:t},e.group)}return(0,n.jsx)(ir,{highlightQuery:s,...e},e.id)}),[y,s]);return(0,n.jsxs)($n,{...f,store:d,query:_,onQueryChange:v,children:[(0,n.jsx)(nr,{...r}),x.length>0&&(0,n.jsx)(or,{children:x}),x.length===0&&b&&(0,n.jsx)(sr,{children:b})]})};hr.Root=$n,hr.Search=nr,hr.Action=ir,hr.ActionsGroup=ar,hr.ActionsList=or,hr.Empty=sr,hr.Footer=cr;var gr=(0,t.createContext)(null),_r=gr.Provider,vr=()=>{let e=(0,t.useContext)(gr);if(!e)throw Error(`useDropzoneContext must be used within a <Dropzone> component`);return e};function yr(e){let t=({children:t})=>vr()[e]?(0,n.jsx)(n.Fragment,{children:t}):null;return t.displayName=`Dropzone${e.charAt(0).toUpperCase()+e.slice(1)}`,t}var br=yr(`accept`),xr=yr(`reject`),Sr=yr(`idle`),Cr=(e=`outline`,t)=>{let n=t??i.tokens.borderRadiusMedium;return{root:(0,l.css)({position:`relative`,display:`flex`,alignItems:`center`,justifyContent:`center`,border:e===`outline`?`2px dashed ${i.tokens.colorNeutralStroke2}`:`none`,borderRadius:n,backgroundColor:e===`filled`?i.tokens.colorNeutralBackground3:i.tokens.colorNeutralBackground1,padding:i.tokens.spacingVerticalL+` `+i.tokens.spacingHorizontalL,cursor:`pointer`,userSelect:`none`,transition:`background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease`,outline:`none`,"&:hover":{borderColor:e===`outline`?i.tokens.colorBrandStroke1:void 0,backgroundColor:e===`filled`?i.tokens.colorNeutralBackground3Hover:i.tokens.colorNeutralBackground1Hover},"&:focus-visible":{borderColor:i.tokens.colorBrandStroke1,boxShadow:`0 0 0 2px ${i.tokens.colorStrokeFocus2}`}}),rootAccept:(0,l.css)({borderColor:i.tokens.colorPaletteGreenBorder1,backgroundColor:i.tokens.colorPaletteGreenBackground1,"&:hover":{borderColor:i.tokens.colorPaletteGreenBorder1,backgroundColor:i.tokens.colorPaletteGreenBackground1}}),rootReject:(0,l.css)({borderColor:i.tokens.colorPaletteRedBorder1,backgroundColor:i.tokens.colorPaletteRedBackground1,"&:hover":{borderColor:i.tokens.colorPaletteRedBorder1,backgroundColor:i.tokens.colorPaletteRedBackground1}}),rootDisabled:(0,l.css)({opacity:.5,cursor:`default`,pointerEvents:`none`}),inner:(0,l.css)({display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,width:`100%`,pointerEvents:`none`}),loadingOverlay:(0,l.css)({position:`absolute`,inset:0,display:`flex`,alignItems:`center`,justifyContent:`center`,backgroundColor:i.tokens.colorNeutralBackgroundAlpha,borderRadius:n,zIndex:1}),fullScreen:(0,l.css)({position:`fixed`,inset:0,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:i.tokens.spacingVerticalXXXL+` `+i.tokens.spacingHorizontalXXXL,backgroundColor:i.tokens.colorNeutralBackgroundAlpha})}},wr=(e,t)=>{typeof e==`function`?e(t):e&&typeof e==`object`&&`current`in e&&(e.current=t)},Tr=Object.assign(t.forwardRef((t,r)=>{let{onDrop:a,onDropAny:o,onReject:s,accept:c,multiple:l=!0,maxSize:u=1/0,maxFiles:d,name:f,disabled:p=!1,loading:m=!1,openRef:h,activateOnClick:g=!0,activateOnDrag:_=!0,activateOnKeyboard:v=!0,dragEventsBubbling:b=!0,onDragEnter:x,onDragLeave:S,onDragOver:C,onFileDialogCancel:w,onFileDialogOpen:T,preventDropOnDocument:E=!0,useFsAccessApi:D=!0,getFilesFromEvent:O,validator:k,enablePointerEvents:A=!1,spinnerProps:j,inputProps:M,appearance:N=`outline`,borderRadius:P,className:F,styles:I,children:L,"aria-label":R,...z}=t,ee=e.l(),te=Cr(N,P),ne=Array.isArray(c)?c.reduce((e,t)=>(e[t]=[],e),{}):c,{getRootProps:re,getInputProps:B,isDragActive:ie,isDragAccept:ae,isDragReject:oe,open:se}=(0,y.useDropzone)({onDrop:o,onDropAccepted:a,onDropRejected:s,disabled:p||m,accept:ne,multiple:l,maxSize:u,maxFiles:d,noClick:!g,noDrag:!_,noDragEventsBubbling:!b,noKeyboard:!v,onDragEnter:x,onDragLeave:S,onDragOver:C,onFileDialogCancel:w,onFileDialogOpen:T,preventDropOnDocument:E,useFsAccessApi:D,validator:k,...O?{getFilesFromEvent:O}:null});wr(h,se);let ce=ie&&ae,le=ie&&oe,ue=!ce&&!le,de=(0,i.mergeClasses)(te.root,ce&&te.rootAccept,le&&te.rootReject,(p||m)&&te.rootDisabled,F),{verticalSpacing:fe,horizontalSpacing:pe,paddingLeft:me,paddingRight:he,paddingTop:ge,paddingBottom:_e,padding:ve,margin:ye,marginLeft:be,marginRight:xe,marginTop:Se,marginBottom:Ce,background:we,width:Te,height:Ee,maxWidth:De,maxHeight:Oe,...ke}=z;return(0,n.jsx)(_r,{value:{accept:ce,reject:le,idle:ue},children:(0,n.jsxs)(`div`,{...re({ref:r,className:de,style:I,role:`button`,tabIndex:0,"aria-label":R??ee.dropHere,"aria-disabled":p||m||void 0,...ke}),children:[m&&(0,n.jsx)(`div`,{className:te.loadingOverlay,children:(0,n.jsx)(i.Spinner,{size:`medium`,label:ee.loading,...j})}),(0,n.jsx)(`input`,{...B(M),name:f}),(0,n.jsx)(`div`,{className:te.inner,style:A?{pointerEvents:`auto`}:void 0,children:L})]})})}),{Accept:br,Reject:xr,Idle:Sr,displayName:`Dropzone`}),Er=t.forwardRef((e,r)=>{let{active:a=!0,zIndex:o=9999,onDrop:s,onReject:c,children:u,className:d,...f}=e,[p,m]=t.useState(0),[h,g]=t.useState(!1);t.useEffect(()=>{p===0&&g(!1)},[p]),t.useEffect(()=>{if(!a)return;let e=e=>{e.dataTransfer?.types.includes(`Files`)&&(e.preventDefault(),m(e=>e+1),g(!0))},t=()=>{m(e=>e-1)},n=e=>{e.dataTransfer?.types.includes(`Files`)&&e.preventDefault()},r=e=>{e.preventDefault(),m(0),g(!1)};return document.addEventListener(`dragenter`,e,!1),document.addEventListener(`dragleave`,t,!1),document.addEventListener(`dragover`,n,!1),document.addEventListener(`drop`,r,!1),()=>{document.removeEventListener(`dragenter`,e,!1),document.removeEventListener(`dragleave`,t,!1),document.removeEventListener(`dragover`,n,!1),document.removeEventListener(`drop`,r,!1)}},[a]);let _=t.useCallback(e=>{s?.(e),g(!1),m(0)},[s]),v=t.useCallback(e=>{c?.(e),g(!1),m(0)},[c]);if(!h)return null;let y=(0,l.css)({position:`fixed`,inset:0,display:h?`flex`:`none`,alignItems:`center`,justifyContent:`center`,padding:i.tokens.spacingVerticalXXXL+` `+i.tokens.spacingHorizontalXXXL,backgroundColor:i.tokens.colorBackgroundOverlay,zIndex:o}),b=(0,l.css)({width:`100%`,maxWidth:`600px`,minHeight:`200px`});return(0,n.jsx)(i.Portal,{children:(0,n.jsx)(`div`,{ref:r,className:y,children:(0,n.jsx)(Tr,{...f,activateOnClick:!1,onDrop:_,onReject:v,className:b,children:u})})})});Er.displayName=`DropzoneFullScreen`;var Dr={png:`image/png`,gif:`image/gif`,jpeg:`image/jpeg`,svg:`image/svg+xml`,webp:`image/webp`,avif:`image/avif`,heic:`image/heic`,heif:`image/heif`,mp4:`video/mp4`,zip:`application/zip`,rar:`application/x-rar`,"7z":`application/x-7z-compressed`,csv:`text/csv`,pdf:`application/pdf`,doc:`application/msword`,docx:`application/vnd.openxmlformats-officedocument.wordprocessingml.document`,xls:`application/vnd.ms-excel`,xlsx:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,ppt:`application/vnd.ms-powerpoint`,pptx:`application/vnd.openxmlformats-officedocument.presentationml.presentation`,exe:`application/vnd.microsoft.portable-executable`},Or=[Dr.png,Dr.gif,Dr.jpeg,Dr.svg,Dr.webp,Dr.avif,Dr.heic,Dr.heif],kr=[Dr.pdf],Ar=[Dr.doc,Dr.docx],jr=[Dr.xls,Dr.xlsx],Mr=[Dr.ppt,Dr.pptx],Nr=[Dr.exe],Pr=(0,t.createContext)(null),Fr=Pr.Provider;function Ir(){let e=(0,t.useContext)(Pr);if(!e)throw Error(`RichTextEditor component was not found in tree`);return e}var Lr=(e=`default`)=>{let t=e===`subtle`,n=t?`32px`:`26px`,r=t?`32px`:`26px`,a=t?`20px`:`16px`;return{root:(0,l.css)({position:`relative`,border:`1px solid ${i.tokens.colorNeutralStroke2}`,borderRadius:i.tokens.borderRadiusMedium}),toolbar:(0,l.css)({display:`flex`,alignItems:`center`,flexWrap:`wrap`,gap:i.tokens.spacingHorizontalS,backgroundColor:i.tokens.colorNeutralBackground1,zIndex:1,borderTopLeftRadius:i.tokens.borderRadiusMedium,borderTopRightRadius:i.tokens.borderRadiusMedium,borderBottom:`1px solid ${i.tokens.colorNeutralStroke2}`,padding:t?`4px`:`${i.tokens.spacingVerticalXS} ${i.tokens.spacingHorizontalM}`,...t&&{rowGap:0}}),toolbarSticky:(0,l.css)({position:`sticky`,zIndex:2}),controlsGroup:(0,l.css)({display:`flex`,backgroundColor:i.tokens.colorNeutralBackground1,...!t&&{"& > button":{borderRadius:0,"&:not(:last-of-type)":{borderInlineEndWidth:0},"&:last-of-type":{borderStartEndRadius:i.tokens.borderRadiusMedium,borderEndEndRadius:i.tokens.borderRadiusMedium},"&:first-of-type":{borderStartStartRadius:i.tokens.borderRadiusMedium,borderEndStartRadius:i.tokens.borderRadiusMedium}}}}),control:(0,l.css)({display:`flex`,justifyContent:`center`,alignItems:`center`,borderRadius:i.tokens.borderRadiusMedium,cursor:`default`,border:t?`none`:`1px solid ${i.tokens.colorNeutralStroke2}`,minWidth:n,height:r,backgroundColor:t?i.tokens.colorNeutralBackground3:i.tokens.colorNeutralBackground1,color:i.tokens.colorNeutralForeground2,padding:0,outline:`none`,fontFamily:`inherit`,fontSize:`inherit`,lineHeight:1,transition:`background-color 100ms ease, color 100ms ease`,"&[data-interactive]:not([data-disabled])":{cursor:`pointer`,"&:hover":{color:i.tokens.colorNeutralForeground1,backgroundColor:t?i.tokens.colorNeutralBackground3Hover:i.tokens.colorNeutralBackground1Hover}},"&:focus-visible":{outlineOffset:`2px`,outline:`2px solid ${i.tokens.colorStrokeFocus2}`}}),controlActive:(0,l.css)({backgroundColor:i.tokens.colorBrandBackground2,color:i.tokens.colorBrandForeground1,"&:hover":{backgroundColor:i.tokens.colorBrandBackground2Hover}}),controlDisabled:(0,l.css)({cursor:`not-allowed`,color:i.tokens.colorNeutralForegroundDisabled,backgroundColor:i.tokens.colorNeutralBackgroundDisabled}),controlIcon:(0,l.css)({width:a,height:a}),content:(0,l.css)({backgroundColor:i.tokens.colorNeutralBackground1,borderBottomLeftRadius:i.tokens.borderRadiusMedium,borderBottomRightRadius:i.tokens.borderRadiusMedium,"& .ProseMirror":{outline:0,padding:i.tokens.spacingVerticalM+` `+i.tokens.spacingHorizontalM,fontFamily:i.tokens.fontFamilyBase,fontSize:i.tokens.fontSizeBase300,fontWeight:i.tokens.fontWeightRegular,lineHeight:i.tokens.lineHeightBase300,color:i.tokens.colorNeutralForeground1},"& .ProseMirror > *:last-child":{marginBottom:0},"& .ProseMirror a":{color:i.tokens.colorBrandForeground1,textDecorationLine:`underline`,textDecorationColor:i.tokens.colorBrandStroke1,cursor:`pointer`,transition:`color 100ms ease, text-decoration-color 100ms ease`,"&:hover":{color:i.tokens.colorBrandForeground2Hover,textDecorationColor:i.tokens.colorBrandForeground2Hover},"&:active":{color:i.tokens.colorBrandForeground2Pressed},"&:visited":{color:i.tokens.colorBrandForeground1}},"& .ProseMirror p.is-editor-empty:first-of-type::before":{content:`attr(data-placeholder)`,pointerEvents:`none`,userSelect:`none`,float:`left`,height:0,color:i.tokens.colorNeutralForeground4},"& div:not(.ProseMirror)":{zIndex:2},"& pre":{fontFamily:i.tokens.fontFamilyMonospace,borderRadius:i.tokens.borderRadiusMedium,padding:`${i.tokens.spacingVerticalS} ${i.tokens.spacingHorizontalM}`,backgroundColor:i.tokens.colorNeutralBackground3,color:i.tokens.colorNeutralForeground1,"& code":{background:`none !important`,color:`inherit`,fontSize:i.tokens.fontSizeBase300,padding:0}}}),typography:(0,l.css)({padding:0,margin:0,"& li > p":{margin:0},"& ul li, & ol li":{marginTop:`2px`},"& p":{marginBottom:`7px`,fontSize:i.tokens.fontSizeBase300,lineHeight:i.tokens.lineHeightBase300},"& h1, & h2, & h3, & h4, & h5, & h6, & p":{marginTop:0},"& h1":{fontFamily:i.tokens.fontFamilyBase,fontSize:i.tokens.fontSizeHero800,fontWeight:i.tokens.fontWeightBold,lineHeight:i.tokens.lineHeightHero800},"& h2":{fontFamily:i.tokens.fontFamilyBase,fontSize:i.tokens.fontSizeHero700,fontWeight:i.tokens.fontWeightSemibold,lineHeight:i.tokens.lineHeightHero700},"& h3":{fontFamily:i.tokens.fontFamilyBase,fontSize:i.tokens.fontSizeBase600,fontWeight:i.tokens.fontWeightSemibold,lineHeight:i.tokens.lineHeightBase600},"& h4":{fontFamily:i.tokens.fontFamilyBase,fontSize:i.tokens.fontSizeBase500,fontWeight:i.tokens.fontWeightSemibold,lineHeight:i.tokens.lineHeightBase500},"& h5":{fontFamily:i.tokens.fontFamilyBase,fontSize:i.tokens.fontSizeBase400,fontWeight:i.tokens.fontWeightSemibold,lineHeight:i.tokens.lineHeightBase400},"& h6":{fontFamily:i.tokens.fontFamilyBase,fontSize:i.tokens.fontSizeBase300,fontWeight:i.tokens.fontWeightSemibold,lineHeight:i.tokens.lineHeightBase300},"& blockquote":{fontFamily:i.tokens.fontFamilyBase,fontStyle:`italic`,color:i.tokens.colorNeutralForeground2,borderInlineStart:`3px solid ${i.tokens.colorBrandStroke1}`,paddingInlineStart:i.tokens.spacingHorizontalM,margin:`${i.tokens.spacingVerticalS} 0`},"& code":{fontFamily:i.tokens.fontFamilyMonospace,fontSize:i.tokens.fontSizeBase200,backgroundColor:i.tokens.colorNeutralBackground3,borderRadius:i.tokens.borderRadiusSmall,padding:`1px ${i.tokens.spacingHorizontalXS}`}}),linkEditorDropdown:(0,l.css)({backgroundColor:i.tokens.colorNeutralBackground1}),linkEditor:(0,l.css)({display:`flex`,gap:0}),linkEditorInput:(0,l.css)({borderStartEndRadius:0,borderEndEndRadius:0,borderInlineEnd:0,flex:1}),linkEditorExternalControl:(0,l.css)({border:`1px solid ${i.tokens.colorNeutralStroke2}`,color:i.tokens.colorNeutralForeground1,height:`24px`,width:`24px`,display:`flex`,justifyContent:`center`,alignItems:`center`,borderRadius:i.tokens.borderRadiusMedium,backgroundColor:i.tokens.colorNeutralBackground1,cursor:`pointer`,padding:0,outline:`none`}),linkEditorExternalControlActive:(0,l.css)({backgroundColor:i.tokens.colorBrandBackground2,color:i.tokens.colorBrandForeground1,"&:hover":{backgroundColor:i.tokens.colorBrandBackground2Hover}}),linkEditorSave:(0,l.css)({borderStartStartRadius:0,borderEndStartRadius:0}),colorSwatch:(0,l.css)({width:`26px`,height:`26px`,borderRadius:i.tokens.borderRadiusSmall,border:`1px solid ${i.tokens.colorNeutralStroke2}`,cursor:`pointer`,padding:0,outline:`none`,transition:`transform 100ms ease`,"&:hover":{transform:`scale(1.1)`},"&:focus-visible":{outlineOffset:`2px`,outline:`2px solid ${i.tokens.colorStrokeFocus2}`}}),colorSwatchGrid:(0,l.css)({display:`grid`,gridTemplateColumns:`repeat(7, 1fr)`,gap:`2px`}),colorPickerActions:(0,l.css)({display:`flex`,justifyContent:`flex-end`,gap:i.tokens.spacingHorizontalXS,marginTop:i.tokens.spacingVerticalS}),taskList:(0,l.css)({listStyleType:`none`,padding:0,paddingInlineStart:0,"& li":{margin:0,padding:0,display:`flex`},"& li[data-checked] > div":{flex:`1 1 auto`,minWidth:0},"& ul":{marginTop:`5px`},"& p":{margin:0,padding:0},"& label":{display:`inline-block`},"& input":{cursor:`pointer`,appearance:`none`,width:`18px`,height:`18px`,border:`1px solid ${i.tokens.colorNeutralStroke2}`,borderRadius:i.tokens.borderRadiusSmall,verticalAlign:`middle`,position:`relative`,backgroundColor:i.tokens.colorNeutralBackground1,"&:checked":{backgroundColor:i.tokens.colorBrandBackground,borderColor:i.tokens.colorBrandBackground,"&::before":{position:`absolute`,content:`''`,inset:0,backgroundImage:`url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCAxMCA3Ij48cGF0aCBmaWxsPSIjZmZmIiBkPSJNNCA0LjU4NkwxLjcwNyAyLjI5M0ExIDEgMCAxMC4yOTMgMy43MDdsMyAzYS45OTcuOTk3IDAgMDAxLjQxNCAwbDUtNUExIDEgMCAxMDguMjkzLjI5M0w0IDQuNTg2eiIvPjwvc3ZnPg==')`,backgroundRepeat:`no-repeat`,backgroundSize:`10px`,backgroundPosition:`center`}}},"& li > label":{marginInlineEnd:i.tokens.spacingHorizontalS}}),fontFamilyList:(0,l.css)({listStyleType:`none`,margin:0,padding:`${i.tokens.spacingVerticalXS} 0`,maxHeight:`280px`,overflowY:`auto`,minWidth:`200px`}),fontFamilyItem:(0,l.css)({display:`flex`,alignItems:`center`,width:`100%`,padding:`${i.tokens.spacingVerticalXS} ${i.tokens.spacingHorizontalM}`,border:`none`,backgroundColor:`transparent`,color:i.tokens.colorNeutralForeground1,fontSize:i.tokens.fontSizeBase300,cursor:`pointer`,outline:`none`,textAlign:`start`,transition:`background-color 100ms ease`,"&:hover":{backgroundColor:i.tokens.colorNeutralBackground1Hover},"&:focus-visible":{outlineOffset:`-2px`,outline:`2px solid ${i.tokens.colorStrokeFocus2}`}}),fontFamilyItemActive:(0,l.css)({backgroundColor:i.tokens.colorBrandBackground2,color:i.tokens.colorBrandForeground1,fontWeight:i.tokens.fontWeightSemibold,"&:hover":{backgroundColor:i.tokens.colorBrandBackground2Hover}})}},Rr=({sticky:e=!1,stickyOffset:t=0,children:r,className:i,style:a})=>{let{variant:o}=Ir(),s=Lr(o);return(0,n.jsx)(`div`,{className:(0,l.cx)(s.toolbar,e&&s.toolbarSticky,i),style:e?{...a,top:t}:a,role:`toolbar`,"aria-label":`Text formatting`,children:r})};Rr.displayName=`RichTextEditorToolbar`;var zr=({className:e,style:r})=>{let{editor:i,withTypographyStyles:a,variant:o,onContentChange:s,onFocus:c,onBlur:u,onCreate:d,onSelectionChange:f,fontFamily:p}=Ir(),m=Lr(o),h=t.useRef(s),g=t.useRef(c),_=t.useRef(u),v=t.useRef(d),y=t.useRef(f);return t.useEffect(()=>{h.current=s},[s]),t.useEffect(()=>{g.current=c},[c]),t.useEffect(()=>{_.current=u},[u]),t.useEffect(()=>{v.current=d},[d]),t.useEffect(()=>{y.current=f},[f]),t.useEffect(()=>{if(!i)return;let e=()=>{h.current?.(i.getHTML(),i.getJSON())},t=({event:e})=>{g.current?.(e)},n=({event:e})=>{_.current?.(e)},r=()=>{v.current?.()},a=()=>{y.current?.()};return i.on(`update`,e),i.on(`focus`,t),i.on(`blur`,n),i.on(`create`,r),i.on(`selectionUpdate`,a),()=>{i.off(`update`,e),i.off(`focus`,t),i.off(`blur`,n),i.off(`create`,r),i.off(`selectionUpdate`,a)}},[i]),(0,n.jsx)(`div`,{className:(0,l.cx)(m.content,a&&m.typography,e),style:{...r,...p?{fontFamily:p}:{}},children:(0,n.jsx)(b.EditorContent,{editor:i})})};zr.displayName=`RichTextEditorContent`;var Br=({children:e,className:t,style:r})=>{let{variant:i}=Ir();return(0,n.jsx)(`div`,{className:(0,l.cx)(Lr(i).controlsGroup,t),style:r,role:`group`,children:e})};Br.displayName=`RichTextEditorControlsGroup`;var Vr=t.forwardRef((e,t)=>{let{interactive:r=!0,active:a,disabled:o,onClick:s,onMouseDown:c,children:l,className:u,style:d,...f}=e,{variant:p}=Ir(),m=Lr(p);return(0,n.jsx)(`button`,{ref:t,type:`button`,...f,className:(0,i.mergeClasses)(m.control,a&&m.controlActive,o&&m.controlDisabled,u),style:d,disabled:o,tabIndex:r?0:-1,"data-interactive":r||void 0,"data-disabled":o||void 0,"data-active":a||void 0,"aria-pressed":a&&r?!0:void 0,"aria-hidden":!r||void 0,onMouseDown:e=>{e.preventDefault(),c?.(e)},onClick:s,children:l})});Vr.displayName=`RichTextEditorControl`;var Hr=t.forwardRef(({icon:e,className:t,...r},i)=>{let{variant:a}=Ir(),o=Lr(a),s=a===`subtle`?`16px`:`20px`;return(0,n.jsx)(Vr,{ref:i,className:t,...r,children:(0,n.jsx)(`span`,{className:o.controlIcon,children:(0,n.jsx)(e,{style:{width:s,height:s}})})})});Hr.displayName=`RichTextEditorControlBase`;function q({label:e,isActive:t,operation:r,icon:i,isDisabled:a}){let o=o=>{let{editor:s,labels:c}=Ir(),l=c[e],u=typeof l==`function`?``:l;return(0,n.jsx)(Hr,{"aria-label":u,title:u,active:t?.name?s?.isActive(t.name,t.attributes):!1,icon:o.icon||i,disabled:a?.(s)||!1,...o,onClick:()=>s?.chain().focus()[r.name](r.attributes).run()})};return o.displayName=`RichTextEditorControl_${e}`,o}function J(e){return(0,n.jsx)(`svg`,{...e,xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,strokeWidth:`1.5`,stroke:`currentColor`,fill:`none`,strokeLinecap:`round`,strokeLinejoin:`round`})}function Ur(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M7 5h6a3.5 3.5 0 0 1 0 7h-6z`}),(0,n.jsx)(`path`,{d:`M13 12h1a3.5 3.5 0 0 1 0 7h-7v-7`})]})}function Wr(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M11 5l6 0`}),(0,n.jsx)(`path`,{d:`M7 19l6 0`}),(0,n.jsx)(`path`,{d:`M14 5l-4 14`})]})}function Gr(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M7 5v5a5 5 0 0 0 10 0v-5`}),(0,n.jsx)(`path`,{d:`M5 19h14`})]})}function Kr(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M5 12l14 0`}),(0,n.jsx)(`path`,{d:`M16 6.5a4 2 0 0 0 -4 -1.5h-1a3.5 3.5 0 0 0 0 7h2a3.5 3.5 0 0 1 0 7h-1.5a4 2 0 0 1 -4 -1.5`})]})}function qr(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M17 15l4 4m0 -4l-4 4`}),(0,n.jsx)(`path`,{d:`M7 6v-1h11v1`}),(0,n.jsx)(`path`,{d:`M7 19l4 0`}),(0,n.jsx)(`path`,{d:`M13 5l-4 14`})]})}function Jr(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M19 18v-8l-2 2`}),(0,n.jsx)(`path`,{d:`M4 6v12`}),(0,n.jsx)(`path`,{d:`M12 6v12`}),(0,n.jsx)(`path`,{d:`M11 18h2`}),(0,n.jsx)(`path`,{d:`M3 18h2`}),(0,n.jsx)(`path`,{d:`M4 12h8`}),(0,n.jsx)(`path`,{d:`M3 6h2`}),(0,n.jsx)(`path`,{d:`M11 6h2`})]})}function Yr(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M17 12a2 2 0 1 1 4 0c0 .591 -.417 1.318 -.816 1.858l-3.184 4.143l4 0`}),(0,n.jsx)(`path`,{d:`M4 6v12`}),(0,n.jsx)(`path`,{d:`M12 6v12`}),(0,n.jsx)(`path`,{d:`M11 18h2`}),(0,n.jsx)(`path`,{d:`M3 18h2`}),(0,n.jsx)(`path`,{d:`M4 12h8`}),(0,n.jsx)(`path`,{d:`M3 6h2`}),(0,n.jsx)(`path`,{d:`M11 6h2`})]})}function Xr(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M19 14a2 2 0 1 0 -2 -2`}),(0,n.jsx)(`path`,{d:`M17 16a2 2 0 1 0 2 -2`}),(0,n.jsx)(`path`,{d:`M4 6v12`}),(0,n.jsx)(`path`,{d:`M12 6v12`}),(0,n.jsx)(`path`,{d:`M11 18h2`}),(0,n.jsx)(`path`,{d:`M3 18h2`}),(0,n.jsx)(`path`,{d:`M4 12h8`}),(0,n.jsx)(`path`,{d:`M3 6h2`}),(0,n.jsx)(`path`,{d:`M11 6h2`})]})}function Zr(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M20 18v-8l-4 6h5`}),(0,n.jsx)(`path`,{d:`M4 6v12`}),(0,n.jsx)(`path`,{d:`M12 6v12`}),(0,n.jsx)(`path`,{d:`M11 18h2`}),(0,n.jsx)(`path`,{d:`M3 18h2`}),(0,n.jsx)(`path`,{d:`M4 12h8`}),(0,n.jsx)(`path`,{d:`M3 6h2`}),(0,n.jsx)(`path`,{d:`M11 6h2`})]})}function Qr(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M17 18h2a2 2 0 1 0 0 -4h-2v-4h4`}),(0,n.jsx)(`path`,{d:`M4 6v12`}),(0,n.jsx)(`path`,{d:`M12 6v12`}),(0,n.jsx)(`path`,{d:`M11 18h2`}),(0,n.jsx)(`path`,{d:`M3 18h2`}),(0,n.jsx)(`path`,{d:`M4 12h8`}),(0,n.jsx)(`path`,{d:`M3 6h2`}),(0,n.jsx)(`path`,{d:`M11 6h2`})]})}function $r(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M19 14a2 2 0 1 0 0 4a2 2 0 0 0 0 -4z`}),(0,n.jsx)(`path`,{d:`M21 12a2 2 0 1 0 -4 0v4`}),(0,n.jsx)(`path`,{d:`M4 6v12`}),(0,n.jsx)(`path`,{d:`M12 6v12`}),(0,n.jsx)(`path`,{d:`M11 18h2`}),(0,n.jsx)(`path`,{d:`M3 18h2`}),(0,n.jsx)(`path`,{d:`M4 12h8`}),(0,n.jsx)(`path`,{d:`M3 6h2`}),(0,n.jsx)(`path`,{d:`M11 6h2`})]})}function ei(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M9 6l11 0`}),(0,n.jsx)(`path`,{d:`M9 12l11 0`}),(0,n.jsx)(`path`,{d:`M9 18l11 0`}),(0,n.jsx)(`path`,{d:`M5 6l0 .01`}),(0,n.jsx)(`path`,{d:`M5 12l0 .01`}),(0,n.jsx)(`path`,{d:`M5 18l0 .01`})]})}function ti(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M11 6h9`}),(0,n.jsx)(`path`,{d:`M11 12h9`}),(0,n.jsx)(`path`,{d:`M12 18h8`}),(0,n.jsx)(`path`,{d:`M4 16a2 2 0 1 1 4 0c0 .591 -.5 1 -1 1.5l-3 2.5h4`}),(0,n.jsx)(`path`,{d:`M6 10v-6l-2 2`})]})}function ni(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M17 22v-2`}),(0,n.jsx)(`path`,{d:`M9 15l6 -6`}),(0,n.jsx)(`path`,{d:`M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464`}),(0,n.jsx)(`path`,{d:`M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463`}),(0,n.jsx)(`path`,{d:`M20 17h2`}),(0,n.jsx)(`path`,{d:`M2 7h2`}),(0,n.jsx)(`path`,{d:`M7 2v2`})]})}function ri(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M6 15h15`}),(0,n.jsx)(`path`,{d:`M21 19h-15`}),(0,n.jsx)(`path`,{d:`M15 11h6`}),(0,n.jsx)(`path`,{d:`M21 7h-6`}),(0,n.jsx)(`path`,{d:`M9 9h1a1 1 0 1 1 -1 1v-2.5a2 2 0 0 1 2 -2`}),(0,n.jsx)(`path`,{d:`M3 9h1a1 1 0 1 1 -1 1v-2.5a2 2 0 0 1 2 -2`})]})}function ii(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M4 6l16 0`}),(0,n.jsx)(`path`,{d:`M4 12l10 0`}),(0,n.jsx)(`path`,{d:`M4 18l14 0`})]})}function ai(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M4 6l16 0`}),(0,n.jsx)(`path`,{d:`M10 12l10 0`}),(0,n.jsx)(`path`,{d:`M6 18l14 0`})]})}function oi(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M4 6l16 0`}),(0,n.jsx)(`path`,{d:`M8 12l8 0`}),(0,n.jsx)(`path`,{d:`M6 18l12 0`})]})}function si(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M4 6l16 0`}),(0,n.jsx)(`path`,{d:`M4 12l16 0`}),(0,n.jsx)(`path`,{d:`M4 18l12 0`})]})}function ci(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M5 7l8 10m-8 0l8 -10`}),(0,n.jsx)(`path`,{d:`M21 20h-4l3.5 -4a1.73 1.73 0 0 0 -3.5 -2`})]})}function li(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M5 7l8 10m-8 0l8 -10`}),(0,n.jsx)(`path`,{d:`M21 11h-4l3.5 -4a1.73 1.73 0 0 0 -3.5 -2`})]})}function ui(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M7 8l-4 4l4 4`}),(0,n.jsx)(`path`,{d:`M17 8l4 4l-4 4`}),(0,n.jsx)(`path`,{d:`M14 4l-4 16`})]})}function di(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M3 19h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4`}),(0,n.jsx)(`path`,{d:`M12.5 5.5l4 4`}),(0,n.jsx)(`path`,{d:`M4.5 13.5l4 4`}),(0,n.jsx)(`path`,{d:`M21 15v4h-8l4 -4z`})]})}function fi(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M5 12h2`}),(0,n.jsx)(`path`,{d:`M17 12h2`}),(0,n.jsx)(`path`,{d:`M11 12h2`})]})}function pi(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M20.042 16.045a9 9 0 0 0 -12.087 -12.087m-2.318 1.677a9 9 0 1 0 12.725 12.73`}),(0,n.jsx)(`path`,{d:`M3 3l18 18`})]})}function mi(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M11 7l6 6`}),(0,n.jsx)(`path`,{d:`M4 16l11.7 -11.7a1 1 0 0 1 1.4 0l2.6 2.6a1 1 0 0 1 0 1.4l-11.7 11.7h-4v-4z`})]})}function hi(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M18 6l-12 12`}),(0,n.jsx)(`path`,{d:`M6 6l12 12`})]})}function gi(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M12 21a9 9 0 0 1 0 -18c4.97 0 9 3.582 9 8c0 1.06 -.474 2.078 -1.318 2.828c-.844 .75 -1.989 1.172 -3.182 1.172h-2.5a2 2 0 0 0 -1 3.75a1.3 1.3 0 0 1 -1 2.25`}),(0,n.jsx)(`path`,{d:`M8.5 10.5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`}),(0,n.jsx)(`path`,{d:`M12.5 7.5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`}),(0,n.jsx)(`path`,{d:`M16.5 10.5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`})]})}function _i(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M5 12l5 5l10 -10`})]})}function vi(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M9 15l6 -6`}),(0,n.jsx)(`path`,{d:`M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464`}),(0,n.jsx)(`path`,{d:`M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463`})]})}function yi(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M12 6h-6a2 2 0 0 0 -2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-6`}),(0,n.jsx)(`path`,{d:`M11 13l9 -9`}),(0,n.jsx)(`path`,{d:`M15 4h5v5`})]})}function bi(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M9 14l-4 -4l4 -4`}),(0,n.jsx)(`path`,{d:`M5 10h11a4 4 0 1 1 0 8h-1`})]})}function xi(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M15 14l4 -4l-4 -4`}),(0,n.jsx)(`path`,{d:`M19 10h-11a4 4 0 1 0 0 8h1`})]})}function Si(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M3.5 5.5l1.5 1.5l2.5 -2.5`}),(0,n.jsx)(`path`,{d:`M3.5 11.5l1.5 1.5l2.5 -2.5`}),(0,n.jsx)(`path`,{d:`M3.5 17.5l1.5 1.5l2.5 -2.5`}),(0,n.jsx)(`path`,{d:`M11 6l9 0`}),(0,n.jsx)(`path`,{d:`M11 12l9 0`}),(0,n.jsx)(`path`,{d:`M11 18l9 0`})]})}function Ci(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M20 6l-11 0`}),(0,n.jsx)(`path`,{d:`M20 12l-7 0`}),(0,n.jsx)(`path`,{d:`M20 18l-11 0`}),(0,n.jsx)(`path`,{d:`M4 8l4 4l-4 4`})]})}function wi(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M20 6l-7 0`}),(0,n.jsx)(`path`,{d:`M20 12l-9 0`}),(0,n.jsx)(`path`,{d:`M20 18l-7 0`}),(0,n.jsx)(`path`,{d:`M8 8l-4 4l4 4`})]})}function Ti(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M19 3v16a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V7.914a1 1 0 0 1 .293-.707l3.914-3.914A1 1 0 0 1 9.914 3H18a1 1 0 0 1 1 1Z`}),(0,n.jsx)(`path`,{d:`M10 11l-2 2 2 2`}),(0,n.jsx)(`path`,{d:`M14 11l2 2-2 2`})]})}function Ei(e){return(0,n.jsxs)(J,{...e,children:[(0,n.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,n.jsx)(`path`,{d:`M4 20l3 0`}),(0,n.jsx)(`path`,{d:`M14 20l7 0`}),(0,n.jsx)(`path`,{d:`M6.9 15l6.9 0`}),(0,n.jsx)(`path`,{d:`M10.2 6.3l5.8 13.7`}),(0,n.jsx)(`path`,{d:`M5 20l6 -16l2 0l7 16`})]})}var Di=({disableTooltips:e=!1,initialExternal:r=!1,className:a,style:o,...s})=>{let{editor:c,labels:u,variant:d}=Ir(),f=Lr(d),[p,m]=t.useState(``),[h,g]=t.useState(r),[_,v]=t.useState(!1),y=t.useCallback(()=>{v(!0);let e=c?.getAttributes(`link`);m(e?.href||``),g(typeof e?.target==`string`?e.target===`_blank`:r)},[c,r]),b=t.useCallback(()=>{v(!1),m(``),g(r)},[r]),x=t.useCallback(()=>{b(),(c?.chain().focus().extendMarkRange(`link`)).setLink({href:p,target:h?`_blank`:null}).run()},[c,p,h,b]),S=t.useCallback(e=>{e.key===`Enter`&&(e.preventDefault(),x())},[x]);return t.useEffect(()=>{let e=()=>y();return window.addEventListener(`edit-link`,e),()=>window.removeEventListener(`edit-link`,e)},[y]),(0,n.jsxs)(i.Popover,{open:_,onOpenChange:(e,t)=>{t.open||b()},positioning:`below`,trapFocus:!0,children:[(0,n.jsx)(i.PopoverTrigger,{disableButtonEnhancement:!0,children:(0,n.jsx)(Hr,{icon:e=>(0,n.jsx)(vi,{...e}),"aria-label":u.linkControlLabel,title:u.linkControlLabel,active:c?.isActive(`link`),onClick:y,className:a,style:o,...s})}),(0,n.jsx)(i.PopoverSurface,{className:f.linkEditorDropdown,children:(0,n.jsxs)(`div`,{className:f.linkEditor,children:[(0,n.jsx)(i.Input,{placeholder:u.linkEditorInputPlaceholder,"aria-label":u.linkEditorInputLabel,type:`url`,value:p,onChange:(e,t)=>m(t.value),onKeyDown:S,className:f.linkEditorInput,size:`small`}),e?(0,n.jsx)(i.Button,{appearance:`subtle`,size:`small`,className:(0,l.cx)(f.linkEditorExternalControl,h&&f.linkEditorExternalControlActive),onClick:()=>g(e=>!e),"aria-label":h?u.linkEditorExternalLink:u.linkEditorInternalLink,icon:(0,n.jsx)(yi,{style:{width:14,height:14}})}):(0,n.jsx)(i.Tooltip,{content:h?u.linkEditorExternalLink:u.linkEditorInternalLink,relationship:`label`,children:(0,n.jsx)(i.Button,{appearance:`subtle`,size:`small`,className:(0,l.cx)(f.linkEditorExternalControl,h&&f.linkEditorExternalControlActive),onClick:()=>g(e=>!e),icon:(0,n.jsx)(yi,{style:{width:14,height:14}})})}),(0,n.jsx)(i.Button,{size:`small`,appearance:`primary`,className:f.linkEditorSave,onClick:x,children:u.linkEditorSave})]})})]})};Di.displayName=`RichTextEditorLinkControl`;var Oi=({color:e,className:t,style:r})=>{let{editor:i,labels:a,variant:o}=Ir(),s=Lr(o),c=typeof a.colorControlLabel==`function`?a.colorControlLabel(e):`${a.colorControlLabel} ${e}`;return(0,n.jsx)(`button`,{type:`button`,className:(0,l.cx)(s.control,t),style:r,"aria-label":c,title:c,onClick:()=>(i?.chain().focus()).setColor(e).run(),children:(0,n.jsx)(`span`,{className:s.colorSwatch,style:{backgroundColor:e}})})};Oi.displayName=`RichTextEditorColorControl`;var ki=({colors:e,className:r,style:a})=>{let{editor:o,labels:s,variant:c}=Ir(),l=Lr(c),[u,d]=t.useState(!1),[f,p]=t.useState(`palette`),[m,h]=t.useState(``),g=t.useRef(null),_=t.useCallback(()=>{d(!1)},[]),v=t.useCallback(()=>{(o?.chain().focus()).setColor(m).run(),_()},[o,m,_]),y=t.useCallback(()=>{(o?.chain().focus()).unsetColor().run(),_()},[o,_]),b=t.useCallback(e=>{(o?.chain().focus()).setColor(e).run(),_()},[o,_]);return(0,n.jsxs)(i.Popover,{open:u,onOpenChange:(e,t)=>{t.open?(d(!0),p(`palette`),h(``)):_()},positioning:`below`,trapFocus:!0,children:[(0,n.jsx)(i.PopoverTrigger,{disableButtonEnhancement:!0,children:(0,n.jsx)(Hr,{icon:e=>(0,n.jsx)(mi,{...e}),"aria-label":s.colorPickerControlLabel,title:s.colorPickerControlLabel,className:r,style:a})}),(0,n.jsxs)(i.PopoverSurface,{className:l.linkEditorDropdown,children:[f===`palette`?(0,n.jsx)(`div`,{className:l.colorSwatchGrid,children:e.map(e=>{let t=typeof s.colorPickerColorLabel==`function`?s.colorPickerColorLabel(e):`${s.colorPickerColorLabel} ${e}`;return(0,n.jsx)(`button`,{type:`button`,className:l.colorSwatch,style:{backgroundColor:e},"aria-label":t,title:t,onClick:()=>b(e)},e)})}):(0,n.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`,padding:8},children:(0,n.jsx)(`input`,{ref:g,type:`color`,value:m||`#000000`,onChange:e=>h(e.target.value),style:{width:200,height:40,border:`none`,cursor:`pointer`},"aria-label":s.colorPickerColorPicker})}),(0,n.jsxs)(`div`,{className:l.colorPickerActions,children:[(0,n.jsx)(i.Button,{size:`small`,appearance:`subtle`,icon:(0,n.jsx)(hi,{style:{width:14,height:14}}),onClick:_,title:s.colorPickerCancel,"aria-label":s.colorPickerCancel}),(0,n.jsx)(i.Button,{size:`small`,appearance:`subtle`,icon:(0,n.jsx)(pi,{style:{width:14,height:14}}),onClick:y,title:s.colorPickerClear,"aria-label":s.colorPickerClear}),(0,n.jsx)(i.Button,{size:`small`,appearance:`subtle`,icon:f===`palette`?(0,n.jsx)(mi,{style:{width:14,height:14}}):(0,n.jsx)(gi,{style:{width:14,height:14}}),onClick:()=>p(e=>e===`palette`?`colorPicker`:`palette`),title:f===`palette`?s.colorPickerColorPicker:s.colorPickerPalette,"aria-label":f===`palette`?s.colorPickerColorPicker:s.colorPickerPalette}),f===`colorPicker`&&(0,n.jsx)(i.Button,{size:`small`,appearance:`subtle`,icon:(0,n.jsx)(_i,{style:{width:14,height:14}}),onClick:v,title:s.colorPickerSave,"aria-label":s.colorPickerSave})]})]})]})};ki.displayName=`RichTextEditorColorPickerControl`;var Ai=({className:e,style:r})=>{let{labels:i,editor:a}=Ir(),o=t.useCallback(()=>{if(!a)return;let e=a.getHTML(),t=a.storage;t?.sourceCode?.active?(a.commands.setContent(a.getText()),t.sourceCode={active:!1}):(a.commands.setContent(`<pre><code>${e}</code></pre>`),t.sourceCode={active:!0})},[a]);return(0,n.jsx)(Hr,{icon:e=>(0,n.jsx)(Ti,{...e}),"aria-label":i.sourceCodeControlLabel,title:i.sourceCodeControlLabel,onClick:o,className:e,style:r})};Ai.displayName=`RichTextEditorSourceCodeControl`;var ji=[`Arial`,`Verdana`,`Tahoma`,`Trebuchet MS`,`Georgia`,`Times New Roman`,`Courier New`,`Segoe UI`],Mi=({fontFamilies:e,className:r,style:a})=>{let{editor:o,labels:s,variant:c,fontFamilies:u}=Ir(),d=Lr(c),[f,p]=t.useState(!1),m=e??u??ji,h=t.useMemo(()=>{let e=new Set;return m.filter(t=>{let n=t.toLowerCase();return e.has(n)?!1:(e.add(n),!0)})},[m]),g=o?.getAttributes(`textStyle`)?.fontFamily,_=t.useCallback(e=>{(o?.chain().focus()).setFontFamily(e).run(),p(!1)},[o]),v=t.useCallback(()=>{(o?.chain().focus()).unsetFontFamily().run(),p(!1)},[o]);return(0,n.jsxs)(i.Popover,{open:f,onOpenChange:(e,t)=>p(t.open),positioning:`below`,trapFocus:!0,children:[(0,n.jsx)(i.PopoverTrigger,{disableButtonEnhancement:!0,children:(0,n.jsx)(Hr,{icon:e=>(0,n.jsx)(Ei,{...e}),"aria-label":s.fontFamilyControlLabel,title:s.fontFamilyControlLabel,className:r,style:a})}),(0,n.jsx)(i.PopoverSurface,{className:d.linkEditorDropdown,children:(0,n.jsxs)(`div`,{className:d.fontFamilyList,role:`menu`,"aria-label":s.fontFamilyControlLabel,children:[(0,n.jsx)(`button`,{type:`button`,role:`menuitem`,className:(0,l.cx)(d.fontFamilyItem,!g&&d.fontFamilyItemActive),onClick:v,children:`Default`}),h.map(e=>{let t=e.split(`,`)[0].replace(/['"]/g,``).trim(),r=g===e;return(0,n.jsx)(`button`,{type:`button`,role:`menuitem`,className:(0,l.cx)(d.fontFamilyItem,r&&d.fontFamilyItemActive),style:{fontFamily:e},onClick:()=>_(e),children:t},e)})]})})]})};Mi.displayName=`RichTextEditorFontFamilyControl`;var Ni=q({label:`boldControlLabel`,icon:e=>(0,n.jsx)(Ur,{...e}),isActive:{name:`bold`},operation:{name:`toggleBold`}}),Pi=q({label:`italicControlLabel`,icon:e=>(0,n.jsx)(Wr,{...e}),isActive:{name:`italic`},operation:{name:`toggleItalic`}}),Fi=q({label:`underlineControlLabel`,icon:e=>(0,n.jsx)(Gr,{...e}),isActive:{name:`underline`},operation:{name:`toggleUnderline`}}),Ii=q({label:`strikeControlLabel`,icon:e=>(0,n.jsx)(Kr,{...e}),isActive:{name:`strike`},operation:{name:`toggleStrike`}}),Li=q({label:`clearFormattingControlLabel`,icon:e=>(0,n.jsx)(qr,{...e}),operation:{name:`unsetAllMarks`}}),Ri=q({label:`unlinkControlLabel`,icon:e=>(0,n.jsx)(ni,{...e}),operation:{name:`unsetLink`}}),zi=q({label:`bulletListControlLabel`,icon:e=>(0,n.jsx)(ei,{...e}),isActive:{name:`bulletList`},operation:{name:`toggleBulletList`}}),Bi=q({label:`orderedListControlLabel`,icon:e=>(0,n.jsx)(ti,{...e}),isActive:{name:`orderedList`},operation:{name:`toggleOrderedList`}}),Vi=q({label:`h1ControlLabel`,icon:e=>(0,n.jsx)(Jr,{...e}),isActive:{name:`heading`,attributes:{level:1}},operation:{name:`toggleHeading`,attributes:{level:1}}}),Hi=q({label:`h2ControlLabel`,icon:e=>(0,n.jsx)(Yr,{...e}),isActive:{name:`heading`,attributes:{level:2}},operation:{name:`toggleHeading`,attributes:{level:2}}}),Ui=q({label:`h3ControlLabel`,icon:e=>(0,n.jsx)(Xr,{...e}),isActive:{name:`heading`,attributes:{level:3}},operation:{name:`toggleHeading`,attributes:{level:3}}}),Wi=q({label:`h4ControlLabel`,icon:e=>(0,n.jsx)(Zr,{...e}),isActive:{name:`heading`,attributes:{level:4}},operation:{name:`toggleHeading`,attributes:{level:4}}}),Gi=q({label:`h5ControlLabel`,icon:e=>(0,n.jsx)(Qr,{...e}),isActive:{name:`heading`,attributes:{level:5}},operation:{name:`toggleHeading`,attributes:{level:5}}}),Ki=q({label:`h6ControlLabel`,icon:e=>(0,n.jsx)($r,{...e}),isActive:{name:`heading`,attributes:{level:6}},operation:{name:`toggleHeading`,attributes:{level:6}}}),qi=q({label:`blockquoteControlLabel`,icon:e=>(0,n.jsx)(ri,{...e}),isActive:{name:`blockquote`},operation:{name:`toggleBlockquote`}}),Ji=q({label:`alignLeftControlLabel`,icon:e=>(0,n.jsx)(ii,{...e}),operation:{name:`setTextAlign`,attributes:`left`}}),Yi=q({label:`alignRightControlLabel`,icon:e=>(0,n.jsx)(ai,{...e}),operation:{name:`setTextAlign`,attributes:`right`}}),Xi=q({label:`alignCenterControlLabel`,icon:e=>(0,n.jsx)(oi,{...e}),operation:{name:`setTextAlign`,attributes:`center`}}),Zi=q({label:`alignJustifyControlLabel`,icon:e=>(0,n.jsx)(si,{...e}),operation:{name:`setTextAlign`,attributes:`justify`}}),Qi=q({label:`subscriptControlLabel`,icon:e=>(0,n.jsx)(ci,{...e}),isActive:{name:`subscript`},operation:{name:`toggleSubscript`}}),$i=q({label:`superscriptControlLabel`,icon:e=>(0,n.jsx)(li,{...e}),isActive:{name:`superscript`},operation:{name:`toggleSuperscript`}}),ea=q({label:`codeControlLabel`,icon:e=>(0,n.jsx)(ui,{...e}),isActive:{name:`code`},operation:{name:`toggleCode`}}),ta=q({label:`codeBlockControlLabel`,icon:e=>(0,n.jsx)(ui,{...e}),isActive:{name:`codeBlock`},operation:{name:`toggleCodeBlock`}}),na=q({label:`highlightControlLabel`,icon:e=>(0,n.jsx)(di,{...e}),isActive:{name:`highlight`},operation:{name:`toggleHighlight`}}),ra=q({label:`hrControlLabel`,icon:e=>(0,n.jsx)(fi,{...e}),operation:{name:`setHorizontalRule`}}),ia=q({label:`unsetColorControlLabel`,icon:e=>(0,n.jsx)(pi,{...e}),operation:{name:`unsetColor`}}),aa=q({label:`undoControlLabel`,icon:e=>(0,n.jsx)(bi,{...e}),operation:{name:`undo`}}),oa=q({label:`redoControlLabel`,icon:e=>(0,n.jsx)(xi,{...e}),operation:{name:`redo`}}),sa=q({label:`tasksControlLabel`,icon:e=>(0,n.jsx)(Si,{...e}),isActive:{name:`taskList`},operation:{name:`toggleTaskList`}}),ca=q({label:`tasksSinkLabel`,icon:e=>(0,n.jsx)(Ci,{...e}),operation:{name:`sinkListItem`,attributes:`taskItem`},isDisabled:e=>!e?.can().sinkListItem(`taskItem`)}),la=q({label:`tasksLiftLabel`,icon:e=>(0,n.jsx)(wi,{...e}),operation:{name:`liftListItem`,attributes:`taskItem`},isDisabled:e=>!e?.can().liftListItem(`taskItem`)}),ua={boldControlLabel:`Bold`,italicControlLabel:`Italic`,underlineControlLabel:`Underline`,strikeControlLabel:`Strikethrough`,clearFormattingControlLabel:`Clear formatting`,linkControlLabel:`Link`,unlinkControlLabel:`Unlink`,bulletListControlLabel:`Bullet list`,orderedListControlLabel:`Ordered list`,h1ControlLabel:`Heading 1`,h2ControlLabel:`Heading 2`,h3ControlLabel:`Heading 3`,h4ControlLabel:`Heading 4`,h5ControlLabel:`Heading 5`,h6ControlLabel:`Heading 6`,blockquoteControlLabel:`Blockquote`,alignLeftControlLabel:`Align left`,alignCenterControlLabel:`Align center`,alignRightControlLabel:`Align right`,alignJustifyControlLabel:`Align justify`,codeControlLabel:`Code`,codeBlockControlLabel:`Code block`,subscriptControlLabel:`Subscript`,superscriptControlLabel:`Superscript`,colorPickerControlLabel:`Text color`,unsetColorControlLabel:`Unset color`,highlightControlLabel:`Highlight`,hrControlLabel:`Horizontal rule`,undoControlLabel:`Undo`,redoControlLabel:`Redo`,colorControlLabel:e=>`Set text color ${e}`,sourceCodeControlLabel:`Source code`,linkEditorInputLabel:`Enter URL`,linkEditorInputPlaceholder:`https://example.com`,linkEditorExternalLink:`Open link in a new tab`,linkEditorInternalLink:`Open link in the same tab`,linkEditorSave:`Save`,colorPickerCancel:`Cancel`,colorPickerClear:`Clear color`,colorPickerColorPicker:`Color picker`,colorPickerPalette:`Color palette`,colorPickerSave:`Save`,colorPickerColorLabel:e=>`Set text color ${e}`,tasksControlLabel:`Task list`,tasksSinkLabel:`Increase indent`,tasksLiftLabel:`Decrease indent`,fontFamilyControlLabel:`Font family`},da=({editor:e,withCodeHighlightStyles:r=!0,withTypographyStyles:i=!0,labels:a,variant:o=`default`,onSourceCodeTextSwitch:s,onContentChange:c,onFocus:u,onBlur:d,onCreate:f,onSelectionChange:p,fontFamily:m,fontFamilies:h,children:g,className:_,style:v})=>{let y=Lr(o),b=t.useMemo(()=>({...ua,...a}),[a]);return(0,n.jsx)(Fr,{value:t.useMemo(()=>({editor:e,labels:b,withCodeHighlightStyles:r,withTypographyStyles:i,variant:o,onSourceCodeTextSwitch:s,onContentChange:c,onFocus:u,onBlur:d,onCreate:f,onSelectionChange:p,fontFamily:m,fontFamilies:h}),[e,b,r,i,o,s,c,u,d,f,p,m,h]),children:(0,n.jsx)(`div`,{className:(0,l.cx)(y.root,_),style:v,children:g})})};da.displayName=`RichTextEditor`;var fa=Object.assign(da,{Toolbar:Rr,Content:zr,ControlsGroup:Br,Control:Vr,ControlBase:Hr,Bold:Ni,Italic:Pi,Underline:Fi,Strikethrough:Ii,ClearFormatting:Li,H1:Vi,H2:Hi,H3:Ui,H4:Wi,H5:Gi,H6:Ki,BulletList:zi,OrderedList:Bi,Blockquote:qi,Link:Di,Unlink:Ri,AlignLeft:Ji,AlignRight:Yi,AlignCenter:Xi,AlignJustify:Zi,Code:ea,CodeBlock:ta,Subscript:Qi,Superscript:$i,Color:Oi,ColorPicker:ki,Highlight:na,UnsetColor:ia,Hr:ra,Undo:aa,Redo:oa,TaskList:sa,TaskListSink:ca,TaskListLift:la,SourceCode:Ai,FontFamily:Mi}),pa=x.default.extend({addKeyboardShortcuts(){return{"Mod-k":()=>(window.dispatchEvent(new Event(`edit-link`)),!0)}}});function ma(e){return e.extend({addKeyboardShortcuts(){return{"Mod-]":()=>this.editor.commands.sinkListItem?.(`taskItem`)??!1,"Mod-[":()=>this.editor.commands.liftListItem?.(`taskItem`)??!1}}})}var ha=()=>({dropdownRoot:(0,l.css)({border:`1px solid ${i.tokens.colorNeutralStroke2} !important`,borderBottom:`1px solid ${i.tokens.colorNeutralStroke2} !important`,borderRadius:`50px !important`,backgroundColor:`${i.tokens.colorNeutralBackground1} !important`,padding:`0px 10px !important`,boxShadow:`none !important`,transition:`all 0.2s ease`,"&::after":{display:`none !important`,borderWidth:`0 !important`,content:`"none !important"`},"&:hover":{borderColor:`${i.tokens.colorBrandStroke1} !important`},"&:focus-within":{borderColor:`${i.tokens.colorBrandStroke1} !important`,boxShadow:`0 0 0 2px ${i.tokens.colorBrandBackground2} !important`}})}),ga=({options:e,onChange:r,renderItem:a,validate:o,label:s,placeholder:c,defaultValue:l,message:u,messageType:f,required:p,size:m,hint:h})=>{let g=l?e.find(e=>e.value===l):void 0,[_,v]=(0,t.useState)(l||``),[y,b]=(0,t.useState)(g?.text||``),[x,S]=(0,t.useState)(``),C=ha(),w=(e,t)=>{let n=t.optionValue||``,i=t.optionText||``;v(n),b(i);let a=o?o(n):``;S(a),!a&&r&&r(n)},T=t.useMemo(()=>x?`error`:f===`warning`?`warning`:f===`info`?`success`:`none`,[x,f]);return(0,n.jsx)(i.Field,{label:s,required:p,validationMessage:t.useMemo(()=>x||u,[x,u]),validationMessageIcon:t.useCallback(()=>{switch(T){case`error`:return(0,n.jsx)(d.ErrorCircle12Filled,{});case`warning`:return(0,n.jsx)(d.Warning12Filled,{});case`success`:return(0,n.jsx)(d.CheckmarkCircle12Filled,{});default:return null}},[T])(),size:m,hint:h,validationState:T,children:(0,n.jsx)(i.Dropdown,{placeholder:c,onOptionSelect:w,value:y,selectedOptions:_?[_]:[],className:C.dropdownRoot,children:e.map(e=>{let t=e.icon??e.checkIcon;return(0,n.jsx)(i.Option,{value:e.value,disabled:e.disabled,as:e.as,text:e.text||``,children:a?a(e):(0,n.jsxs)(n.Fragment,{children:[t&&(0,n.jsx)(`span`,{style:{marginRight:4,display:`inline-flex`,alignItems:`center`},children:t}),e.text]})},e.value)})})})},_a=()=>({inputRoot:(0,l.css)({border:`1px solid ${i.tokens.colorNeutralStroke2} !important`,borderBottom:`1px solid ${i.tokens.colorNeutralStroke2} !important`,borderRadius:`50px !important`,backgroundColor:`${i.tokens.colorNeutralBackground1} !important`,padding:`0px 10px !important`,boxShadow:`none !important`,transition:`all 0.2s ease`,"&::after":{display:`none !important`,borderWidth:`0 !important`,content:`"none !important"`},"&:hover":{borderColor:`${i.tokens.colorBrandStroke1} !important`},"&:focus-within":{borderColor:`${i.tokens.colorBrandStroke1} !important`,boxShadow:`0 0 0 2px ${i.tokens.colorBrandBackground2} !important`}})}),va=({value:r,type:a=`text`,shape:o=`normal`,onChange:s,validate:c,label:l,placeholder:u,message:f,messageType:p,required:m,size:h,hint:g,disabled:_,readOnly:v,min:y,max:b,step:x,contentBefore:S,contentAfter:C})=>{let[w,T]=(0,t.useState)(r===void 0?``:String(r)),[E,D]=(0,t.useState)(``),O=_a(),k=e.u(),A=r!==void 0,j=A?String(r):w,M=(0,t.useCallback)(e=>{if(m&&e.trim()===``)return a===`number`?k.numberRequired:k.fieldRequired;if(a===`number`&&e.trim()!==``){let t=Number(e);if(isNaN(t))return k.invalidNumber;if(y!==void 0&&t<y)return k.valueMustBeAtLeast.replace(`{0}`,String(y));if(b!==void 0&&t>b)return k.valueMustBeAtMost.replace(`{0}`,String(b))}return c?c(a===`number`&&e.trim()!==``?Number(e):e):``},[m,a,c,y,b,k]),N=(0,t.useCallback)((e,t)=>{let n=t.value;if(a===`number`&&n!==``&&!/^-?\d*\.?\d*$/.test(n))return;A||T(n);let r=M(n);D(r),!r&&s&&s(a===`number`&&n.trim()!==``?Number(n):n)},[a,A,M,s]),P=(0,t.useCallback)(()=>{D(M(j))},[M,j]),F=(0,t.useMemo)(()=>E?`error`:p===`warning`?`warning`:p===`info`?`success`:`none`,[E,p]),I=(0,t.useMemo)(()=>E||f,[E,f]),L=(0,t.useCallback)(()=>{switch(F){case`error`:return(0,n.jsx)(d.ErrorCircle12Filled,{});case`warning`:return(0,n.jsx)(d.Warning12Filled,{});case`success`:return(0,n.jsx)(d.CheckmarkCircle12Filled,{});default:return null}},[F]),R=o===`circular`?O.inputRoot:void 0;return(0,n.jsx)(i.Field,{label:l,required:m,validationMessage:I,validationMessageIcon:L(),size:h,hint:g,validationState:F,children:(0,n.jsx)(i.Input,{value:j,placeholder:u,onChange:N,onBlur:P,disabled:_,readOnly:v,type:`text`,inputMode:a===`number`?`decimal`:`text`,step:a===`number`?x:void 0,className:R,contentBefore:S,contentAfter:C})})},ya=({onChange:e,defaultKey:r,label:a,options:o=[],minWidth:s,styles:c})=>{let[l,u]=(0,t.useState)(()=>o.map(e=>({...e,selected:e.key===(r??`status`)})));(0,t.useEffect)(()=>{let t=l.find(e=>e.selected);t&&e(t.key)},[]);let d=t.default.useCallback(t=>{u(l.map(e=>({...e,selected:e.key===t.key}))),e(t.key)},[l,e]);return(0,n.jsxs)(U,{gap:`s`,children:[a&&(0,n.jsx)(i.Label,{children:a}),(0,n.jsx)(Ot,{options:l,onSelected:d,styles:s?{minWidth:s}:c??{}})]})},ba=()=>({menuButton:(0,l.css)({minWidth:200}),popover:(0,l.css)({padding:i.tokens.spacingVerticalS,minWidth:200}),timePicker:(0,l.css)({width:`100%`})}),xa=()=>({root:(0,l.css)({maxHeight:280,overflowY:`auto`,padding:`${i.tokens.spacingVerticalXS} 0`}),item:(0,l.css)({cursor:`pointer`})}),Sa=`time`,Ca=(e,t,n)=>{let r=new Date(e);return r.setHours(t,n,0,0),r},wa=(e,t,n)=>{let r={hour:`numeric`,minute:`2-digit`,...n&&{second:`2-digit`},...t&&{hourCycle:t}};return new Intl.DateTimeFormat(void 0,r).format(e)},Ta=e=>`${String(e.getHours()).padStart(2,`0`)}:${String(e.getMinutes()).padStart(2,`0`)}`,Ea=(e,t,n,r)=>{let i=[],a=e*60,o=t*60;for(let e=a;e<o;e+=n){let t=Math.floor(e/60),n=e%60;i.push(Ca(r,t,n))}return i},Da=t.memo(e=>{let{onTimeSelect:r,hourCycle:a,showSeconds:o=!1,startHour:s=0,endHour:c=24,increment:l=30,dateAnchor:u}=e,f=xa(),p=t.useMemo(()=>u??new Date,[u]),m=t.useMemo(()=>Ea(s,c,l,p),[s,c,l,p]),h=t.useCallback((e,t)=>()=>{r(e,t)},[r]);return(0,n.jsx)(`div`,{className:f.root,children:m.map(e=>{let t=wa(e,a,o),r=Ta(e);return(0,n.jsx)(i.MenuItemRadio,{name:Sa,value:r,onClick:h(e,t),icon:(0,n.jsx)(d.ClockRegular,{}),className:f.item,children:t},r)})})}),Oa=(e,t)=>{let n=t?new Date(t):new Date,r=n.getHours()*60+n.getMinutes(),i=Math.ceil(r/e)*e,a=new Date(n);return a.setHours(Math.floor(i/60),i%60,0,0),a},ka=t.memo(e=>{let{onSelected:r,value:a,placeholder:o=`Select a time`,hourCycle:s,showSeconds:c=!1,startHour:l,endHour:u,increment:f=30,dateAnchor:p}=e,m=ba(),h=t.useMemo(()=>Oa(f,p),[f,p]),g=a??h,[_,v]=t.useState(g),[y,b]=t.useState(()=>wa(g,s,c)),[x,S]=t.useState(!1);t.useEffect(()=>{a&&(v(a),b(wa(a,s,c)))},[a,s,c]);let C=t.useCallback((e,t)=>{S(t.open)},[]),w=t.useMemo(()=>(0,d.bundleIcon)(d.ClockFilled,d.ClockRegular),[]),T=t.useMemo(()=>_?{[Sa]:[Ta(_)]}:{[Sa]:[]},[_]),E=t.useCallback((e,t)=>{v(e),b(t),r(e),S(!1)},[r]);return(0,n.jsxs)(i.Menu,{open:x,onOpenChange:C,checkedValues:T,onCheckedValueChange:t.useCallback((e,t)=>{},[]),children:[(0,n.jsx)(i.MenuTrigger,{disableButtonEnhancement:!0,children:(0,n.jsx)(i.MenuButton,{shape:`circular`,icon:(0,n.jsx)(w,{}),className:m.menuButton,"aria-label":`Select time: ${y||o}`,children:y||o})}),(0,n.jsx)(i.MenuPopover,{className:m.popover,children:(0,n.jsx)(i.MenuList,{children:(0,n.jsx)(Da,{value:_,onTimeSelect:E,hourCycle:s,showSeconds:c,startHour:l,endHour:u,increment:f,dateAnchor:p})})})]})}),Aa=()=>({container:(0,l.css)({display:`flex`,flexDirection:`column`,gap:i.tokens.spacingVerticalS,position:`relative`}),pickerList:(0,l.css)({maxHeight:300,overflowY:`auto`,backgroundColor:i.tokens.colorNeutralBackground1,border:`1px solid ${i.tokens.colorNeutralStroke2}`,borderRadius:i.tokens.borderRadiusMedium,boxShadow:i.tokens.shadow16,scrollbarColor:`${i.tokens.colorBrandForeground1} ${i.tokens.colorNeutralBackground1}`,scrollbarWidth:`thin`,"&::-webkit-scrollbar-track":{borderRadius:10,borderWidth:1},"&::-webkit-scrollbar-thumb":{borderRadius:10,borderWidth:1},"&::-webkit-scrollbar":{height:7,width:7}}),optionContent:(0,l.css)({display:`flex`,flexDirection:`column`,gap:i.tokens.spacingVerticalXXS}),optionSecondary:(0,l.css)({fontSize:i.tokens.fontSizeBase200,color:i.tokens.colorNeutralForeground3,fontWeight:i.tokens.fontWeightRegular}),tagPickerControl:(0,l.css)({}),tagPickerInput:(0,l.css)({backgroundColor:`transparent`,border:`none`,outline:`none`,fontSize:i.tokens.fontSizeBase300,"&::placeholder":{color:i.tokens.colorNeutralForeground4},"&:focus":{outline:`none`}})}),ja=({options:r,selectedOptions:a=[],onSelectionChange:o,onSearchChange:s,onLoadMore:c,pagingInfo:l,placeholder:u,disabled:d=!1,maxSelectedOptions:f,width:p,className:m,noResultsMessage:h,loadingMessage:g,loadingMoreMessage:_,searchDebounceMs:v=300})=>{let y=Aa(),b=e.d(),x=u||b.placeholder,S=h||b.noResultsFound,C=g||b.searching,w=_||b.loadingMore,[T,E]=(0,t.useState)(``),D=(0,t.useRef)(null),O=(0,t.useRef)(null),k=a.map(e=>e.value),A=l?.isLoading??!1,j=l?.isLoadingMore??!1,M=l?.hasMore??!1,N=r.filter(e=>!k.includes(e.value)),P=(0,t.useCallback)(e=>{E(e),D.current&&clearTimeout(D.current),D.current=setTimeout(()=>{s?.(e)},v)},[s,v]),F=(0,t.useCallback)(e=>{if(!M||j)return;let{scrollTop:t,scrollHeight:n,clientHeight:r}=e.currentTarget;t+r>=n-100&&c?.()},[M,j,c]),I=(0,t.useCallback)((e,t)=>{if(t.value===`no-options`||t.value===`loading`||t.value===`loading-more`)return;let n=t.selectedOptions,i=a.filter(e=>n.includes(e.value));if(n.length>k.length){let e=n.find(e=>!k.includes(e));if(e){let t=r.find(t=>t.value===e);if(t){if(f&&a.length>=f)return;i.push(t)}}E(``),s?.(``)}o?.(i)},[r,a,k,o,s,f]);return(0,t.useEffect)(()=>()=>{D.current&&clearTimeout(D.current)},[]),(0,n.jsx)(`div`,{className:`${y.container} ${m||``}`,...p&&{style:{width:p}},children:(0,n.jsxs)(i.TagPicker,{onOptionSelect:I,selectedOptions:k,disabled:d,children:[(0,n.jsxs)(i.TagPickerControl,{className:y.tagPickerControl,children:[(0,n.jsx)(i.TagPickerGroup,{"aria-label":b.selectedItems,children:a.map(e=>(0,n.jsx)(i.Tag,{shape:`circular`,media:e.tagMedia??e.media,value:e.value,dismissible:!0,disabled:d,style:{minHeight:30},children:e.text},e.value))}),(0,n.jsx)(i.TagPickerInput,{className:y.tagPickerInput,"aria-label":b.searchItems,placeholder:x,value:T,onChange:e=>P(e.target.value),disabled:d})]}),(0,n.jsx)(i.TagPickerList,{ref:O,onScroll:F,className:y.pickerList,children:A?(0,n.jsx)(i.TagPickerOption,{value:`loading`,children:C}):N.length>0?(0,n.jsxs)(n.Fragment,{children:[N.map(e=>(0,n.jsx)(i.TagPickerOption,{value:e.value,text:e.text,media:e.media,children:(0,n.jsxs)(`div`,{className:y.optionContent,children:[(0,n.jsx)(i.Text,{weight:`semibold`,children:e.text}),e.secondaryText&&(0,n.jsx)(i.Text,{size:200,className:y.optionSecondary,children:e.secondaryText})]})},e.value)),j&&(0,n.jsx)(i.TagPickerOption,{value:`loading-more`,children:w})]}):(0,n.jsx)(i.TagPickerOption,{value:`no-options`,children:S})})]})})},Ma=(e,t=0,n=10**t)=>Math.round(n*e)/n,Na=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Pa=({h:e,s:t,v:n,a:r})=>{let i=e/360*6,a=t/100,o=n/100,s=Math.floor(i),c=o*(1-a),l=o*(1-(i-s)*a),u=o*(1-(1-i+s)*a),d=s%6,f=[o,l,c,c,u,o][d],p=[u,o,o,l,c,c][d],m=[c,c,u,o,o,l][d];return{r:Ma(f*255),g:Ma(p*255),b:Ma(m*255),a:Ma(r,2)}},Fa=({r:e,g:t,b:n,a:r})=>{let i=Math.max(e,t,n),a=i-Math.min(e,t,n),o=a?i===e?(t-n)/a:i===t?2+(n-e)/a:4+(e-t)/a:0;return{h:Ma(60*(o<0?o+6:o)),s:Ma(i?a/i*100:0),v:Ma(i/255*100),a:r}},Ia=({h:e,s:t,v:n,a:r})=>{let i=(200-t)*n/100;return{h:Ma(e),s:Ma(i>0&&i<200?t*n/100/(i<=100?i:200-i)*100:0),l:Ma(i/2),a:Ma(r,2)}},La=({h:e,s:t,l:n,a:r})=>(t*=(n<50?n:100-n)/100,{h:e,s:t>0?2*t/(n+t)*100:0,v:n+t,a:r}),Ra=e=>Fa(Va(e)),za=e=>Ha(Pa(e)),Ba=e=>{let t=Math.round(e.a*255).toString(16).padStart(2,`0`);return`${za(e)}${t}`},Va=e=>{let t=e.startsWith(`#`)?e.slice(1):e;return t.length<=4?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:t.length===4?Ma(parseInt(t[3]+t[3],16)/255,2):1}:{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16),a:t.length>=8?Ma(parseInt(t.slice(6,8),16)/255,2):1}},Ha=({r:e,g:t,b:n})=>`#${[e,t,n].map(e=>e.toString(16).padStart(2,`0`)).join(``)}`,Ua=({r:e,g:t,b:n,a:r})=>{let i=Math.round(r*255).toString(16).padStart(2,`0`);return`#${[e,t,n].map(e=>e.toString(16).padStart(2,`0`)).join(``)}${i}`},Wa=e=>{let{h:t,s:n,l:r}=Ia(e);return`hsl(${t}, ${n}%, ${r}%)`},Ga=e=>{let{h:t,s:n,l:r,a:i}=Ia(e);return`hsla(${t}, ${n}%, ${r}%, ${i})`},Ka=e=>{let{r:t,g:n,b:r}=Pa(e);return`rgb(${t}, ${n}, ${r})`},qa=e=>{let{r:t,g:n,b:r,a:i}=Pa(e);return`rgba(${t}, ${n}, ${r}, ${i})`},Ja=(e,t=`deg`)=>Number(e.replace(RegExp(`${t}$`),``)),Ya=e=>{let t=e.match(/hsla?\(?\s*(-?\d*\.?\d+)(deg|rad|grad|turn)?\s*[,/ ]?\s*(-?\d*\.?\d+)%?\s*[,/ ]?\s*(-?\d*\.?\d+)%?\s*[,/ ]?\s*(-?\d*\.?\d+)?\s*\)?/i);return t?La({h:Ja(t[1],t[2]),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])}):{h:0,s:0,v:0,a:1}},Xa=e=>{let t=e.match(/rgba?\(?\s*(-?\d*\.?\d+)(%?)?\s*[,/ ]?\s*(-?\d*\.?\d+)(%?)?\s*[,/ ]?\s*(-?\d*\.?\d+)(%?)?\s*[,/ ]?\s*(-?\d*\.?\d+)?\s*\)?/i);return t?Fa({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])}):{h:0,s:0,v:0,a:1}},Za={aliceblue:`#f0f8ff`,antiquewhite:`#faebd7`,aqua:`#00ffff`,aquamarine:`#7fffd4`,azure:`#f0ffff`,beige:`#f5f5dc`,bisque:`#ffe4c4`,black:`#000000`,blanchedalmond:`#ffebcd`,blue:`#0000ff`,blueviolet:`#8a2be2`,brown:`#a52a2a`,burlywood:`#deb887`,cadetblue:`#5f9ea0`,chartreuse:`#7fff00`,chocolate:`#d2691e`,coral:`#ff7f50`,cornflowerblue:`#6495ed`,cornsilk:`#fff8dc`,crimson:`#dc143c`,cyan:`#00ffff`,darkblue:`#00008b`,darkcyan:`#008b8b`,darkgoldenrod:`#b8860b`,darkgray:`#a9a9a9`,darkgreen:`#006400`,darkgrey:`#a9a9a9`,darkkhaki:`#bdb76b`,darkmagenta:`#8b008b`,darkolivegreen:`#556b2f`,darkorange:`#ff8c00`,darkorchid:`#9932cc`,darkred:`#8b0000`,darksalmon:`#e9967a`,darkseagreen:`#8fbc8f`,darkslateblue:`#483d8b`,darkslategray:`#2f4f4f`,darkslategrey:`#2f4f4f`,darkturquoise:`#00ced1`,darkviolet:`#9400d3`,deeppink:`#ff1493`,deepskyblue:`#00bfff`,dimgray:`#696969`,dimgrey:`#696969`,dodgerblue:`#1e90ff`,firebrick:`#b22222`,floralwhite:`#fffaf0`,forestgreen:`#228b22`,fuchsia:`#ff00ff`,gainsboro:`#dcdcdc`,ghostwhite:`#f8f8ff`,gold:`#ffd700`,goldenrod:`#daa520`,gray:`#808080`,green:`#008000`,greenyellow:`#adff2f`,grey:`#808080`,honeydew:`#f0fff0`,hotpink:`#ff69b4`,indianred:`#cd5c5c`,indigo:`#4b0082`,ivory:`#fffff0`,khaki:`#f0e68c`,lavender:`#e6e6fa`,lavenderblush:`#fff0f5`,lawngreen:`#7cfc00`,lemonchiffon:`#fffacd`,lightblue:`#add8e6`,lightcoral:`#f08080`,lightcyan:`#e0ffff`,lightgoldenrodyellow:`#fafad2`,lightgray:`#d3d3d3`,lightgreen:`#90ee90`,lightgrey:`#d3d3d3`,lightpink:`#ffb6c1`,lightsalmon:`#ffa07a`,lightseagreen:`#20b2aa`,lightskyblue:`#87cefa`,lightslategray:`#778899`,lightslategrey:`#778899`,lightsteelblue:`#b0c4de`,lightyellow:`#ffffe0`,lime:`#00ff00`,limegreen:`#32cd32`,linen:`#faf0e6`,magenta:`#ff00ff`,maroon:`#800000`,mediumaquamarine:`#66cdaa`,mediumblue:`#0000cd`,mediumorchid:`#ba55d3`,mediumpurple:`#9370db`,mediumseagreen:`#3cb371`,mediumslateblue:`#7b68ee`,mediumspringgreen:`#00fa9a`,mediumturquoise:`#48d1cc`,mediumvioletred:`#c71585`,midnightblue:`#191970`,mintcream:`#f5fffa`,mistyrose:`#ffe4e1`,moccasin:`#ffe4b5`,navajowhite:`#ffdead`,navy:`#000080`,oldlace:`#fdf5e6`,olive:`#808000`,olivedrab:`#6b8e23`,orange:`#ffa500`,orangered:`#ff4500`,orchid:`#da70d6`,palegoldenrod:`#eee8aa`,palegreen:`#98fb98`,paleturquoise:`#afeeee`,palevioletred:`#db7093`,papayawhip:`#ffefd5`,peachpuff:`#ffdab9`,peru:`#cd853f`,pink:`#ffc0cb`,plum:`#dda0dd`,powderblue:`#b0e0e6`,purple:`#800080`,rebeccapurple:`#663399`,red:`#ff0000`,rosybrown:`#bc8f8f`,royalblue:`#4169e1`,saddlebrown:`#8b4513`,salmon:`#fa8072`,sandybrown:`#f4a460`,seagreen:`#2e8b57`,seashell:`#fff5ee`,sienna:`#a0522d`,silver:`#c0c0c0`,skyblue:`#87ceeb`,slateblue:`#6a5acd`,slategray:`#708090`,slategrey:`#708090`,snow:`#fffafa`,springgreen:`#00ff7f`,steelblue:`#4682b4`,tan:`#d2b48c`,teal:`#008080`,thistle:`#d8bfd8`,tomato:`#ff6347`,turquoise:`#40e0d0`,violet:`#ee82ee`,wheat:`#f5deb3`,white:`#ffffff`,whitesmoke:`#f5f5f5`,yellow:`#ffff00`,yellowgreen:`#9acd32`},Y=e=>{let t;if(typeof e!=`string`)t=e;else{let n=e.trim().toLowerCase();t=n in Za?Ra(Za[n]):n.startsWith(`#`)?Ra(n):n.startsWith(`rgb`)?Xa(n):n.startsWith(`hsl`)?Ya(n):Ra(n)}let n=Pa(t),r=Ia(t);return{hsva:t,hsla:r,rgba:n,hex:Ha(n),hexa:Ua(n)}},Qa=e=>/^#?([0-9A-Fa-f]{3}|[0-9A-Fa-f]{4}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/.test(e),$a=e=>{let{r:t,g:n,b:r}=Pa(typeof e==`string`?Y(e).hsva:e);return(.299*t+.587*n+.114*r)/255>.5?`#000000`:`#ffffff`},eo=(e,t)=>e.h===t.h&&e.s===t.s&&e.v===t.v&&e.a===t.a,to=(e,t)=>{if(e===t)return!0;let n=e=>e.replace(`#`,``).toLowerCase();return n(e)===n(t)},no=e=>({h:Na(e.h,0,360),s:Na(e.s,0,100),v:Na(e.v,0,100),a:Na(e.a,0,1)}),X=()=>({pointer:(0,l.css)({position:`absolute`,width:12,height:12,borderRadius:`50%`,border:`2px solid ${i.tokens.colorNeutralBackground1}`,boxShadow:i.tokens.shadow4,transform:`translate(-50%, -50%)`,pointerEvents:`none`,boxSizing:`border-box`}),interactiveContainer:(0,l.css)({position:`relative`,touchAction:`none`,userSelect:`none`,outline:`none`,cursor:`crosshair`,"&:focus-visible":{outline:`2px solid ${i.tokens.colorBrandStroke1}`,outlineOffset:2}}),saturation:(0,l.css)({position:`relative`,width:`100%`,borderRadius:i.tokens.borderRadiusMedium,overflow:`hidden`,cursor:`crosshair`}),bar:(0,l.css)({position:`relative`,borderRadius:i.tokens.borderRadiusMedium,overflow:`hidden`,cursor:`crosshair`}),checkerboard:(0,l.css)({backgroundImage:`url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAADFJREFUOE9jZGBgEGHAD97gk2YcNYBhmIQBgWSAP52AwoaFBQJouucRlsGnBCgGDAYAAIpGBAWLkEGCAAAAAElFTkSuQmCC")`,backgroundSize:`8px 8px`,backgroundPosition:`0 0, 4px 4px`,position:`absolute`,inset:0,borderRadius:`inherit`}),swatchContainer:(0,l.css)({display:`flex`,flexWrap:`wrap`,gap:i.tokens.spacingHorizontalXS}),swatch:(0,l.css)({position:`relative`,borderRadius:i.tokens.borderRadiusSmall,cursor:`pointer`,border:`1px solid ${i.tokens.colorNeutralStroke2}`,boxSizing:`border-box`,transition:`transform 120ms ease, box-shadow 120ms ease`,outline:`none`,"&:hover":{transform:`scale(1.2)`,zIndex:1,boxShadow:`0 0 0 2px rgba(255,255,255,0.8), 0 2px 6px rgba(0,0,0,0.3)`},"&:focus-visible":{outline:`2px solid ${i.tokens.colorBrandStroke1}`,outlineOffset:2}}),swatchSelected:(0,l.css)({transform:`scale(1.2)`,zIndex:1,boxShadow:`0 0 0 1px ${i.tokens.colorBrandStroke1}`}),editableInputContainer:(0,l.css)({display:`flex`,flexDirection:`column`,alignItems:`center`,gap:i.tokens.spacingVerticalXXS,flex:1,minWidth:36,overflow:`hidden`}),editableInputLabel:(0,l.css)({fontSize:i.tokens.fontSizeBase200,color:i.tokens.colorNeutralForeground3,lineHeight:i.tokens.lineHeightBase200,textTransform:`uppercase`}),sketchContainer:(0,l.css)({padding:i.tokens.spacingHorizontalM,borderRadius:i.tokens.borderRadiusMedium,backgroundColor:i.tokens.colorNeutralBackground1,boxShadow:i.tokens.shadow8,boxSizing:`border-box`}),chromeContainer:(0,l.css)({padding:i.tokens.spacingHorizontalM,borderRadius:i.tokens.borderRadiusMedium,backgroundColor:i.tokens.colorNeutralBackground1,boxShadow:i.tokens.shadow8,boxSizing:`border-box`}),chromePreview:(0,l.css)({width:28,height:28,borderRadius:`50%`,border:`1px solid ${i.tokens.colorNeutralStroke2}`,boxSizing:`border-box`,flexShrink:0}),colorfulContainer:(0,l.css)({borderRadius:i.tokens.borderRadiusMedium,overflow:`hidden`}),wheelContainer:(0,l.css)({position:`relative`,borderRadius:`50%`,overflow:`hidden`}),circleContainer:(0,l.css)({display:`flex`,flexWrap:`wrap`,gap:i.tokens.spacingHorizontalS,justifyContent:`center`}),circlePoint:(0,l.css)({borderRadius:`50%`,cursor:`pointer`,border:`2px solid transparent`,transition:`border-color ${i.tokens.durationNormal} ${i.tokens.curveEasyEase}`,outline:`none`,"&:hover":{opacity:.85},"&:focus-visible":{outline:`2px solid ${i.tokens.colorBrandStroke1}`,outlineOffset:2}}),circlePointSelected:(0,l.css)({borderColor:i.tokens.colorNeutralBackground1,boxShadow:`0 0 0 2px ${i.tokens.colorNeutralStroke1}`}),compactContainer:(0,l.css)({padding:i.tokens.spacingHorizontalS,borderRadius:i.tokens.borderRadiusMedium,backgroundColor:i.tokens.colorNeutralBackground1,boxShadow:i.tokens.shadow4,boxSizing:`border-box`,width:`fit-content`}),blockContainer:(0,l.css)({borderRadius:i.tokens.borderRadiusMedium,backgroundColor:i.tokens.colorNeutralBackground1,boxShadow:i.tokens.shadow8,overflow:`hidden`,boxSizing:`border-box`}),blockHeader:(0,l.css)({display:`flex`,alignItems:`center`,justifyContent:`center`,height:110,position:`relative`,fontSize:i.tokens.fontSizeHero800,fontWeight:i.tokens.fontWeightBold}),blockTriangle:(0,l.css)({position:`absolute`,bottom:-6,left:`50%`,transform:`translateX(-50%)`,width:0,height:0,borderLeft:`6px solid transparent`,borderRight:`6px solid transparent`}),materialContainer:(0,l.css)({width:98,padding:i.tokens.spacingHorizontalM,borderRadius:i.tokens.borderRadiusMedium,backgroundColor:i.tokens.colorNeutralBackground1,boxShadow:i.tokens.shadow8,boxSizing:`border-box`}),materialInputUnderline:(0,l.css)({width:`100%`,height:2,marginTop:i.tokens.spacingVerticalXXS,borderRadius:i.tokens.borderRadiusSmall}),githubContainer:(0,l.css)({padding:i.tokens.spacingHorizontalM,borderRadius:i.tokens.borderRadiusMedium,backgroundColor:i.tokens.colorNeutralBackground1,boxShadow:i.tokens.shadow8,boxSizing:`border-box`,position:`relative`}),githubArrow:(0,l.css)({position:`absolute`,width:0,height:0}),sliderContainer:(0,l.css)({display:`flex`,flexDirection:`column`,gap:i.tokens.spacingVerticalXS})}),ro=(e,t,n)=>{let r=e.getBoundingClientRect();return{left:Math.max(0,Math.min(1,(t-r.left)/r.width)),top:Math.max(0,Math.min(1,(n-r.top)/r.height))}},io=({onMove:e,onDown:r,className:a,style:o,children:s})=>{let c=(0,t.useRef)(null),l=(0,t.useRef)(!1),u=X(),d=(0,t.useCallback)((t,n)=>{c.current&&e?.(ro(c.current,t,n))},[e]),f=(0,t.useCallback)(()=>{let e=e=>d(e.clientX,e.clientY),t=()=>{document.removeEventListener(`mousemove`,e),document.removeEventListener(`mouseup`,t)};return{onMouseMove:e,onMouseUp:t}},[d]),p=(0,t.useCallback)(t=>{if(l.current){l.current=!1;return}if(t.preventDefault(),!c.current)return;let n=ro(c.current,t.clientX,t.clientY);r?.(n),e?.(n);let{onMouseMove:i,onMouseUp:a}=f();document.addEventListener(`mousemove`,i),document.addEventListener(`mouseup`,a)},[r,e,f]),m=(0,t.useCallback)(t=>{if(l.current=!0,!c.current||!t.touches[0])return;let n=ro(c.current,t.touches[0].clientX,t.touches[0].clientY);r?.(n),e?.(n)},[r,e]),h=(0,t.useCallback)(e=>{e.touches[0]&&d(e.touches[0].clientX,e.touches[0].clientY)},[d]);return(0,n.jsx)(`div`,{ref:c,className:(0,i.mergeClasses)(u.interactiveContainer,a),style:o,onMouseDown:p,onTouchStart:m,onTouchMove:h,role:`none`,children:s})},ao=({color:e,left:t,top:r})=>(0,n.jsx)(`div`,{className:X().pointer,style:{left:`${(t??0)*100}%`,top:`${(r??0)*100}%`,backgroundColor:e}}),oo=({hsva:e,onChange:r,pointer:a=ao,radius:o=6,className:s,style:c})=>{let u=X(),d=(0,t.useCallback)(t=>{let n=no({h:e.h,s:t.left*100,v:(1-t.top)*100,a:e.a});r?.(Y(n))},[e.h,e.a,r]),f=(0,t.useCallback)(t=>{let{s:n,v:i}=e,a=t.shiftKey?10:1;switch(t.key){case`ArrowRight`:n=Math.min(100,n+a);break;case`ArrowLeft`:n=Math.max(0,n-a);break;case`ArrowUp`:i=Math.min(100,i+a);break;case`ArrowDown`:i=Math.max(0,i-a);break;default:return}t.preventDefault(),r?.(Y(no({...e,s:n,v:i})))},[e,r]),p=(0,t.useMemo)(()=>(0,l.css)({height:typeof c?.height==`number`?c.height:150,...c,backgroundImage:`linear-gradient(0deg, #000, transparent), linear-gradient(90deg, #fff, transparent)`,backgroundColor:`hsl(${e.h}, 100%, 50%)`}),[e.h,c]);return(0,n.jsx)(io,{onMove:d,className:(0,i.mergeClasses)(u.saturation,s),children:(0,n.jsx)(`div`,{className:p,onKeyDown:f,tabIndex:0,role:`slider`,"aria-label":`Saturation and brightness`,"aria-valuetext":`Saturation ${Math.round(e.s)}%, Brightness ${Math.round(e.v)}%`,style:{borderRadius:o},children:(0,n.jsx)(a,{color:Y(e).hex,left:e.s/100,top:1-e.v/100})})})},so=`linear-gradient(to right, #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000)`,co=`linear-gradient(to bottom, #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000)`,lo=({color:e,left:t,top:r})=>(0,n.jsx)(`div`,{className:X().pointer,style:{left:`${(t??0)*100}%`,top:`${(r??0)*100}%`,backgroundColor:e}}),uo=({hsva:e,onChange:r,width:a=`100%`,height:o=12,direction:s=`horizontal`,pointer:c=lo,radius:u=6,className:d,style:f})=>{let p=X(),m=s===`horizontal`,h=(0,t.useCallback)(t=>{let n=m?t.left:t.top,i=no({...e,h:n*360});r?.(Y(i))},[e,r,m]),g=(0,t.useCallback)(t=>{let{h:n}=e,i=t.shiftKey?10:1,a=m?`ArrowRight`:`ArrowDown`,o=m?`ArrowLeft`:`ArrowUp`;if(t.key===a)n=(n+i)%360;else if(t.key===o)n=(n-i+360)%360;else return;t.preventDefault(),r?.(Y(no({...e,h:n})))},[e,r,m]),_=(0,t.useMemo)(()=>(0,l.css)({width:a,height:o,backgroundImage:m?so:co,borderRadius:u,...f}),[a,o,m,u,f]),v=e.h/360;return(0,n.jsx)(io,{onMove:h,className:(0,i.mergeClasses)(p.bar,d),children:(0,n.jsx)(`div`,{className:_,onKeyDown:g,tabIndex:0,role:`slider`,"aria-label":`Hue`,"aria-valuemin":0,"aria-valuemax":360,"aria-valuenow":Math.round(e.h),children:(0,n.jsx)(c,{color:`hsl(${e.h}, 100%, 50%)`,left:m?v:.5,top:m?.5:v})})})},fo=({color:e,left:t,top:r})=>(0,n.jsx)(`div`,{className:X().pointer,style:{left:`${(t??0)*100}%`,top:`${(r??0)*100}%`,backgroundColor:e}}),po=({hsva:e,onChange:r,width:a=`100%`,height:o=12,direction:s=`horizontal`,pointer:c=fo,radius:u=6,className:d,style:f})=>{let p=X(),m=s===`horizontal`,h=(0,t.useCallback)(t=>{let n=m?t.left:t.top,i=no({...e,a:Math.round(n*100)/100});r?.(Y(i))},[e,r,m]),g=(0,t.useCallback)(t=>{let{a:n}=e,i=t.shiftKey?.1:.01,a=m?`ArrowRight`:`ArrowDown`,o=m?`ArrowLeft`:`ArrowUp`;if(t.key===a)n=Math.min(1,n+i);else if(t.key===o)n=Math.max(0,n-i);else return;t.preventDefault(),r?.(Y(no({...e,a:Math.round(n*100)/100})))},[e,r,m]),_=qa({...e,a:0}),v=qa({...e,a:1}),y=m?`linear-gradient(to right, ${_}, ${v})`:`linear-gradient(to bottom, ${_}, ${v})`,b=(0,t.useMemo)(()=>(0,l.css)({width:a,height:o,position:`relative`,borderRadius:u,...f}),[a,o,u,f]),x=(0,t.useMemo)(()=>(0,l.css)({position:`absolute`,inset:0,backgroundImage:y,borderRadius:`inherit`}),[y]),S=e.a;return(0,n.jsx)(io,{onMove:h,className:(0,i.mergeClasses)(p.bar,d),children:(0,n.jsxs)(`div`,{className:b,onKeyDown:g,tabIndex:0,role:`slider`,"aria-label":`Alpha`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(e.a*100),children:[(0,n.jsx)(`div`,{className:p.checkerboard}),(0,n.jsx)(`div`,{className:x,children:(0,n.jsx)(c,{color:qa(e),left:m?S:.5,top:m?.5:S})})]})})},mo=({color:e,left:t})=>(0,n.jsx)(`div`,{className:X().pointer,style:{left:`${(t??0)*100}%`,top:`50%`,backgroundColor:e}}),ho=({hsva:e,onChange:r,width:a=`100%`,height:o=12,pointer:s=mo,radius:c=6,className:u,style:d})=>{let f=X(),p=(0,t.useCallback)(t=>{let n=(1-t.left)*100,i=no({...e,v:n});r?.(Y(i))},[e,r]),m=(0,t.useCallback)(t=>{let{v:n}=e,i=t.shiftKey?10:1;if(t.key===`ArrowRight`)n=Math.max(0,n-i);else if(t.key===`ArrowLeft`)n=Math.min(100,n+i);else return;t.preventDefault(),r?.(Y(no({...e,v:n})))},[e,r]),{h,s:g}=Ia(e),_=`linear-gradient(to right, hsl(${h}, ${g}%, 50%), hsl(${h}, ${g}%, 0%))`,v=(0,t.useMemo)(()=>(0,l.css)({width:a,height:o,backgroundImage:_,borderRadius:c,position:`relative`,...d}),[a,o,_,c,d]),y=1-e.v/100;return(0,n.jsx)(io,{onMove:p,className:(0,i.mergeClasses)(f.bar,u),children:(0,n.jsx)(`div`,{className:v,onKeyDown:m,tabIndex:0,role:`slider`,"aria-label":`Shade`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(e.v),children:(0,n.jsx)(s,{color:Y(e).hex,left:y})})})},go=e=>typeof e==`string`?{color:e}:e,_o=({color:e,title:r,checked:a,disabled:o,size:s=24,radius:c=4,onClick:u,rectRender:d,addonBefore:f,addonAfter:p,colors:m=[],className:h,style:g})=>{let _=X(),v=(0,t.useCallback)(e=>{o||u?.(e)},[o,u]);if(m.length===0&&e){let t=a??!1,o=(0,l.css)({width:s,height:s,borderRadius:c,backgroundColor:e}),u=d?d({className:(0,i.mergeClasses)(_.swatch,t?_.swatchSelected:!1,o,h),style:g,onClick:()=>v(e),role:`button`,"aria-pressed":t?`true`:`false`,tabIndex:0}):(0,n.jsx)(`div`,{className:(0,i.mergeClasses)(_.swatch,t?_.swatchSelected:!1,o,h),style:g,onClick:()=>v(e),role:`button`,"aria-pressed":t?`true`:`false`,"aria-label":r??e,tabIndex:0,onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),v(e))}});return r?(0,n.jsx)(i.Tooltip,{content:r,relationship:`label`,children:u}):u}let y=(0,t.useMemo)(()=>new Map(m.map(e=>{let{color:t}=go(e);return[t,za(Y(t).hsva)]})),[m]);return(0,n.jsxs)(U,{direction:`vertical`,gap:`xs`,children:[f,(0,n.jsx)(`div`,{className:_.swatchContainer,role:`listbox`,"aria-label":`Color swatches`,children:m.map((t,r)=>{let{color:a,title:o}=go(t),u=y.get(a)||a,d=e?to(u,e):!1,f=(0,l.css)({width:s,height:s,borderRadius:c,backgroundColor:a}),p=(0,n.jsx)(`div`,{className:(0,i.mergeClasses)(_.swatch,d?_.swatchSelected:`false`,f),onClick:()=>v(a),role:`option`,"aria-selected":d?`true`:`false`,"aria-label":o??a,tabIndex:0,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),v(a))},children:d&&(0,n.jsx)(`svg`,{viewBox:`0 0 16 16`,width:s*.6,height:s*.6,style:{position:`absolute`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,fill:$a(Ra(a))},children:(0,n.jsx)(`path`,{d:`M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z`})})},`${a}-${r}`);return o?(0,n.jsx)(i.Tooltip,{content:o,relationship:`label`,children:p},`${a}-${r}`):p})}),p]})},vo={width:`100%`,minWidth:0,textAlign:`center`},yo=({label:e,value:r,onChange:a,placeholder:o,className:s,style:c})=>{let l=X(),[u,d]=(0,t.useState)(String(r??``));(0,t.useEffect)(()=>{d(String(r??``))},[r]);let f=(0,t.useCallback)((e,t)=>{d(t.value)},[]),p=(0,t.useCallback)(()=>{a?.(u)},[u,a]),m=(0,t.useCallback)(e=>{e.key===`Enter`&&a?.(u)},[u,a]);return(0,n.jsxs)(`div`,{className:l.editableInputContainer,style:c,children:[(0,n.jsx)(i.Input,{size:`small`,value:u,onChange:f,onBlur:p,onKeyDown:m,placeholder:o,className:s,"aria-label":e,style:vo}),e&&(0,n.jsx)(`span`,{className:l.editableInputLabel,children:e})]})},bo=({hsva:e,onChange:r,showAlpha:i=!0,className:a,style:o})=>{let s=Pa(e),c=(0,t.useCallback)((e,t)=>{let n=Number(t);if(isNaN(n))return;let i={...s};e===`a`?i.a=Math.max(0,Math.min(1,n/100)):i[e]=Math.max(0,Math.min(255,Math.round(n)));let a=Fa(i);r?.(Y(a))},[s,r]);return(0,n.jsxs)(U,{direction:`horizontal`,gap:`xs`,className:a,style:(0,t.useMemo)(()=>({flex:3,minWidth:0,...o}),[o]),children:[(0,n.jsx)(yo,{label:`R`,value:s.r,onChange:e=>c(`r`,e)}),(0,n.jsx)(yo,{label:`G`,value:s.g,onChange:e=>c(`g`,e)}),(0,n.jsx)(yo,{label:`B`,value:s.b,onChange:e=>c(`b`,e)}),i&&(0,n.jsx)(yo,{label:`A`,value:Math.round(s.a*100),onChange:e=>c(`a`,e)})]})},xo=({hsva:e,onChange:r,showAlpha:i=!0,className:a,style:o})=>{let s=Ia(e),c=(0,t.useCallback)((e,t)=>{let n=Number(t);if(isNaN(n))return;let i={...s};e===`a`?i.a=Math.max(0,Math.min(1,n/100)):e===`h`?i.h=Math.max(0,Math.min(360,Math.round(n))):i[e]=Math.max(0,Math.min(100,Math.round(n)));let a=La(i);r?.(Y(a))},[s,r]);return(0,n.jsxs)(U,{direction:`horizontal`,gap:`xs`,className:a,style:(0,t.useMemo)(()=>({flex:3,minWidth:0,...o}),[o]),children:[(0,n.jsx)(yo,{label:`H`,value:Math.round(s.h),onChange:e=>c(`h`,e)}),(0,n.jsx)(yo,{label:`S`,value:Math.round(s.s),onChange:e=>c(`s`,e)}),(0,n.jsx)(yo,{label:`L`,value:Math.round(s.l),onChange:e=>c(`l`,e)}),i&&(0,n.jsx)(yo,{label:`A`,value:Math.round(s.a*100),onChange:e=>c(`a`,e)})]})},So=[`#D0021B`,`#F5A623`,`#F8E71C`,`#8B572A`,`#7ED321`,`#417505`,`#BD10E0`,`#9013FE`,`#4A90D9`,`#50E3C2`,`#B8E986`,`#000000`,`#4A4A4A`,`#9B9B9B`,`#FFFFFF`],Co=({color:e,onChange:r,width:a=320,presetColors:o=So,editableDisable:s=!1,disableAlpha:c=!1,className:l,style:u})=>{let d=X(),f=e=>e?typeof e==`string`?Y(e).hsva:e:{h:0,s:0,v:100,a:1},[p,m]=(0,t.useState)(()=>f(e));(0,t.useEffect)(()=>{e!==void 0&&m(f(e))},[e]);let h=(0,t.useCallback)(e=>{m(e.hsva),r?.(e)},[r]),g=(0,t.useCallback)(e=>{let t=e.startsWith(`#`)?e:`#${e}`;if(Qa(t)){let e=Y(t);m(e.hsva),r?.(e)}},[r]),_=(0,t.useCallback)(e=>{let t=Y(e);m(t.hsva),r?.(t)},[r]),v=za(p),y=(0,t.useMemo)(()=>({width:a,...u}),[a,u]);return(0,n.jsxs)(U,{direction:`vertical`,gap:`m`,className:(0,i.mergeClasses)(d.sketchContainer,l),style:y,children:[(0,n.jsx)(oo,{hsva:p,onChange:h}),(0,n.jsxs)(U,{direction:`vertical`,gap:`s`,children:[(0,n.jsx)(uo,{hsva:p,onChange:h}),!c&&(0,n.jsx)(po,{hsva:p,onChange:h})]}),!s&&(0,n.jsxs)(U,{direction:`horizontal`,gap:`xs`,alignItems:`flex-end`,children:[(0,n.jsx)(yo,{label:`Hex`,value:v.replace(`#`,``),onChange:g}),(0,n.jsx)(bo,{hsva:p,onChange:h,showAlpha:!c})]}),o.length>0&&(0,n.jsx)(_o,{colors:o,color:v,onClick:_,size:16,radius:3})]})},wo=function(e){return e.HEXA=`hexa`,e.RGBA=`rgba`,e.HSLA=`hsla`,e}({}),To={flex:1},Eo={flex:`none`},Do={minWidth:28,width:28,padding:0},Oo=[wo.HEXA,wo.RGBA,wo.HSLA],ko=({color:e,onChange:r,width:a=320,showAlpha:o=!0,showColorPreview:s=!0,showEditableInput:c=!0,showEyeDropper:l=!0,inputType:u=wo.HEXA,className:d,style:f})=>{let p=X(),m=e=>e?typeof e==`string`?Y(e).hsva:e:{h:0,s:68,v:100,a:1},[h,g]=(0,t.useState)(()=>m(e)),[_,v]=(0,t.useState)(u);(0,t.useEffect)(()=>{e!==void 0&&g(m(e))},[e]);let y=(0,t.useCallback)(e=>{g(e.hsva),r?.(e)},[r]),b=(0,t.useCallback)(e=>{let t=e.startsWith(`#`)?e:`#${e}`;if(Qa(t)){let e=Y(t);g(e.hsva),r?.(e)}},[r]),x=(0,t.useCallback)(()=>{v(e=>Oo[(Oo.indexOf(e)+1)%Oo.length])},[]),S=(0,t.useCallback)(async()=>{if(`EyeDropper`in window)try{let e=await new window.EyeDropper().open();if(e?.sRGBHex){let t=Y(e.sRGBHex);g(t.hsva),r?.(t)}}catch{}},[r]),C=za(h),w=Ba(h),T=(0,t.useMemo)(()=>({width:a,...f}),[a,f]);return(0,n.jsxs)(U,{direction:`vertical`,gap:`m`,className:(0,i.mergeClasses)(p.chromeContainer,d),style:T,children:[(0,n.jsx)(oo,{hsva:h,onChange:y}),(0,n.jsxs)(U,{direction:`horizontal`,gap:`m`,alignItems:`center`,children:[s&&(0,n.jsx)(`div`,{className:p.chromePreview,style:{backgroundColor:qa(h)},"aria-label":`Selected color: ${C}`}),(0,n.jsxs)(U,{direction:`vertical`,gap:`xs`,style:To,children:[(0,n.jsx)(uo,{hsva:h,onChange:y}),o&&(0,n.jsx)(po,{hsva:h,onChange:y})]})]}),c&&(0,n.jsxs)(U,{direction:`horizontal`,gap:`xs`,alignItems:`flex-start`,children:[_===wo.HEXA&&(0,n.jsx)(yo,{label:`HEX`,value:o?w.replace(`#`,``):C.replace(`#`,``),onChange:b}),_===wo.RGBA&&(0,n.jsx)(bo,{hsva:h,onChange:y,showAlpha:o}),_===wo.HSLA&&(0,n.jsx)(xo,{hsva:h,onChange:y,showAlpha:o}),(0,n.jsxs)(U,{direction:`horizontal`,gap:`xs`,style:Eo,children:[(0,n.jsx)(i.Button,{appearance:`subtle`,size:`small`,icon:(0,n.jsx)(`span`,{children:`⇅`}),onClick:x,"aria-label":`Toggle color format`,style:Do}),l&&`EyeDropper`in window&&(0,n.jsx)(i.Button,{appearance:`subtle`,size:`small`,icon:(0,n.jsx)(`span`,{children:`💧`}),onClick:S,"aria-label":`Pick color from screen`,style:Do})]})]})]})},Ao=({color:e,onChange:r,disableAlpha:a=!1,className:o,style:s})=>{let c=X(),l=e=>e?typeof e==`string`?Y(e).hsva:e:{h:0,s:100,v:100,a:1},[u,d]=(0,t.useState)(()=>l(e));(0,t.useEffect)(()=>{e!==void 0&&d(l(e))},[e]);let f=(0,t.useCallback)(e=>{d(e.hsva),r?.(e)},[r]);return(0,n.jsxs)(U,{direction:`vertical`,gap:`m`,className:(0,i.mergeClasses)(c.colorfulContainer,o),style:s,children:[(0,n.jsx)(oo,{hsva:u,onChange:f}),(0,n.jsx)(uo,{hsva:u,onChange:f}),!a&&(0,n.jsx)(po,{hsva:u,onChange:f})]})},jo=({color:e,left:t,top:r})=>(0,n.jsx)(`div`,{className:X().pointer,style:{left:`${(t??0)*100}%`,top:`${(r??0)*100}%`,backgroundColor:e}}),Mo=(e,t)=>{let n=t/2,r=n*(e.s/100),i=e.h*Math.PI/180;return{x:n+r*Math.cos(i),y:n+r*Math.sin(i)}},No=(e,t,n)=>{let r=n/2,i=e-r,a=t-r,o=Math.atan2(a,i)*180/Math.PI;o<0&&(o+=360);let s=Math.min(Math.sqrt(i*i+a*a),r);return{h:o,s:s/r*100}},Po=({color:e,onChange:r,width:a=200,height:o,pointer:s=jo,className:c,style:u})=>{let d=X(),f=o??a,p=(0,t.useRef)(null),m=e=>e?typeof e==`string`?Y(e).hsva:e:{h:0,s:100,v:100,a:1},[h,g]=(0,t.useState)(()=>m(e));(0,t.useEffect)(()=>{e!==void 0&&g(m(e))},[e]);let _=(0,t.useCallback)(e=>{let{h:t,s:n}=No(e.left*a,e.top*f,Math.min(a,f)),i=Y({h:t,s:n,v:h.v,a:h.a});g(i.hsva),r?.(i)},[a,f,h.v,h.a,r]),v=Mo(h,Math.min(a,f)),y=(0,t.useMemo)(()=>(0,l.css)({width:a,height:f,background:`conic-gradient(
|
|
145
145
|
from 90deg,
|
|
146
146
|
hsl(0, 100%, 50%),
|
|
147
147
|
hsl(30, 100%, 50%),
|
package/dist/index.js
CHANGED
|
@@ -2774,7 +2774,7 @@ var No = /* @__PURE__ */ function(e) {
|
|
|
2774
2774
|
})
|
|
2775
2775
|
});
|
|
2776
2776
|
}, Rs = (e) => {
|
|
2777
|
-
let { day: t, currentMonth: n, events: r, date: i, columnHeight: a, onDayClick: o } = e, { styles: s } = Is(), c = /* @__PURE__ */ new Date(), [l, u] = D.useState(!1), d = D.useMemo(() => hn(i, c), [i, c]),
|
|
2777
|
+
let { day: t, currentMonth: n, events: r, date: i, columnHeight: a, onDayClick: o } = e, { styles: s } = Is(), c = /* @__PURE__ */ new Date(), [l, u] = D.useState(!1), d = i.getDay() === 0 || i.getDay() === 6, f = D.useMemo(() => hn(i, c), [i, c]), p = D.useMemo(() => /* @__PURE__ */ R(Qo, {
|
|
2778
2778
|
horizontal: !0,
|
|
2779
2779
|
horizontalAlign: "start",
|
|
2780
2780
|
verticalAlign: "center",
|
|
@@ -2782,23 +2782,32 @@ var No = /* @__PURE__ */ function(e) {
|
|
|
2782
2782
|
paddingRight: "m",
|
|
2783
2783
|
children: /* @__PURE__ */ z(_e, {
|
|
2784
2784
|
className: s.currentDayLabel,
|
|
2785
|
+
style: { color: d ? `${U.colorPaletteRedForeground1} !important` : "" },
|
|
2785
2786
|
children: [
|
|
2786
2787
|
t,
|
|
2787
2788
|
" ",
|
|
2788
2789
|
c.toLocaleString("default", { month: "short" })
|
|
2789
2790
|
]
|
|
2790
2791
|
})
|
|
2791
|
-
}), [
|
|
2792
|
+
}), [
|
|
2793
|
+
t,
|
|
2794
|
+
d,
|
|
2795
|
+
c,
|
|
2796
|
+
s.currentDayLabel
|
|
2797
|
+
]), m = D.useCallback((e) => {
|
|
2792
2798
|
u(e);
|
|
2793
2799
|
}, []);
|
|
2794
2800
|
return /* @__PURE__ */ R(L, { children: /* @__PURE__ */ R(Ho, {
|
|
2795
2801
|
onClick: o ? () => o(i) : void 0,
|
|
2796
|
-
className: H(s.cardDay, n ? "" : s.otherMonthDay,
|
|
2797
|
-
cardHeader:
|
|
2802
|
+
className: H(s.cardDay, n ? "" : s.otherMonthDay, f ? s.currentDay : "", l ? "" : s.cardDayOnHover),
|
|
2803
|
+
cardHeader: f ? p : /* @__PURE__ */ R(Qo, {
|
|
2798
2804
|
horizontal: !0,
|
|
2799
2805
|
paddingLeft: "m",
|
|
2800
2806
|
paddingRight: "m",
|
|
2801
|
-
children: /* @__PURE__ */ R(_e, {
|
|
2807
|
+
children: /* @__PURE__ */ R(_e, {
|
|
2808
|
+
style: { color: d ? `${U.colorPaletteRedForeground1} !important` : "" },
|
|
2809
|
+
children: t
|
|
2810
|
+
})
|
|
2802
2811
|
}),
|
|
2803
2812
|
paddingTop: "m",
|
|
2804
2813
|
paddingBottom: "m",
|
|
@@ -2807,7 +2816,7 @@ var No = /* @__PURE__ */ function(e) {
|
|
|
2807
2816
|
cardBody: /* @__PURE__ */ R(Ls, {
|
|
2808
2817
|
events: r,
|
|
2809
2818
|
date: i,
|
|
2810
|
-
onCardHoverChange:
|
|
2819
|
+
onCardHoverChange: m,
|
|
2811
2820
|
columnHeight: a - 60
|
|
2812
2821
|
})
|
|
2813
2822
|
}) });
|
|
@@ -4005,7 +4014,10 @@ var No = /* @__PURE__ */ function(e) {
|
|
|
4005
4014
|
header: G({ borderBottom: `1px solid ${U.colorNeutralStroke2}` }),
|
|
4006
4015
|
headerBackButton: G({ fontSize: "clamp(6px, 3.5cqw, 22px)" }),
|
|
4007
4016
|
headerLabel: G({ textTransform: "capitalize" }),
|
|
4008
|
-
calendar: G({
|
|
4017
|
+
calendar: G({
|
|
4018
|
+
borderBottom: `1px solid ${U.colorNeutralStroke2}`,
|
|
4019
|
+
backgroundColor: U.colorNeutralBackground2
|
|
4020
|
+
}),
|
|
4009
4021
|
weekdaysCorner: G({ flex: "0 0 32px" }),
|
|
4010
4022
|
weekday: G({
|
|
4011
4023
|
flex: "1 1 calc(100% / 7)",
|
|
@@ -8356,18 +8368,18 @@ var dd = () => ({ dropdownRoot: G({
|
|
|
8356
8368
|
borderRadius: a,
|
|
8357
8369
|
backgroundColor: e
|
|
8358
8370
|
}), c = s ? s({
|
|
8359
|
-
className: H(p.swatch, r ? p.swatchSelected :
|
|
8371
|
+
className: H(p.swatch, r ? p.swatchSelected : !1, o, d),
|
|
8360
8372
|
style: f,
|
|
8361
8373
|
onClick: () => m(e),
|
|
8362
8374
|
role: "button",
|
|
8363
|
-
"aria-pressed": r,
|
|
8375
|
+
"aria-pressed": r ? "true" : "false",
|
|
8364
8376
|
tabIndex: 0
|
|
8365
8377
|
}) : /* @__PURE__ */ R("div", {
|
|
8366
|
-
className: H(p.swatch, r ? p.swatchSelected :
|
|
8378
|
+
className: H(p.swatch, r ? p.swatchSelected : !1, o, d),
|
|
8367
8379
|
style: f,
|
|
8368
8380
|
onClick: () => m(e),
|
|
8369
8381
|
role: "button",
|
|
8370
|
-
"aria-pressed": r ? "true" :
|
|
8382
|
+
"aria-pressed": r ? "true" : "false",
|
|
8371
8383
|
"aria-label": t ?? e,
|
|
8372
8384
|
tabIndex: 0,
|
|
8373
8385
|
onKeyDown: (t) => {
|
|
@@ -8400,10 +8412,10 @@ var dd = () => ({ dropdownRoot: G({
|
|
|
8400
8412
|
borderRadius: a,
|
|
8401
8413
|
backgroundColor: r
|
|
8402
8414
|
}), u = /* @__PURE__ */ R("div", {
|
|
8403
|
-
className: H(p.swatch, c ? p.swatchSelected :
|
|
8415
|
+
className: H(p.swatch, c ? p.swatchSelected : "false", l),
|
|
8404
8416
|
onClick: () => m(r),
|
|
8405
8417
|
role: "option",
|
|
8406
|
-
"aria-selected": c ? "true" :
|
|
8418
|
+
"aria-selected": c ? "true" : "false",
|
|
8407
8419
|
"aria-label": o ?? r,
|
|
8408
8420
|
tabIndex: 0,
|
|
8409
8421
|
onKeyDown: (e) => {
|