@anyemp/ui-kit 1.4.0 → 1.4.2
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/ui-kit.css +1 -1
- package/dist/ui-kit.es.js +1713 -1678
- package/dist/ui-kit.es.js.map +1 -1
- package/dist/ui-kit.umd.js +2 -2
- package/dist/ui-kit.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/ui-kit.umd.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
(function(ne,
|
|
1
|
+
(function(ne,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],o):(ne=typeof globalThis<"u"?globalThis:ne||self,o(ne.UIKit={},ne.React,ne.ReactDOM))})(this,(function(ne,o,Mt){"use strict";var Sn={exports:{}},sn={};var Aa;function pr(){if(Aa)return sn;Aa=1;var t=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function s(a,i,r){var l=null;if(r!==void 0&&(l=""+r),i.key!==void 0&&(l=""+i.key),"key"in i){r={};for(var c in i)c!=="key"&&(r[c]=i[c])}else r=i;return i=r.ref,{$$typeof:t,type:a,key:l,ref:i!==void 0?i:null,props:r}}return sn.Fragment=n,sn.jsx=s,sn.jsxs=s,sn}var rn={};var Ia;function mr(){return Ia||(Ia=1,process.env.NODE_ENV!=="production"&&(function(){function t(b){if(b==null)return null;if(typeof b=="function")return b.$$typeof===ee?null:b.displayName||b.name||null;if(typeof b=="string")return b;switch(b){case _:return"Fragment";case N:return"Profiler";case y:return"StrictMode";case P:return"Suspense";case q:return"SuspenseList";case T:return"Activity"}if(typeof b=="object")switch(typeof b.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),b.$$typeof){case g:return"Portal";case $:return b.displayName||"Context";case k:return(b._context.displayName||"Context")+".Consumer";case S:var I=b.render;return b=b.displayName,b||(b=I.displayName||I.name||"",b=b!==""?"ForwardRef("+b+")":"ForwardRef"),b;case X:return I=b.displayName||null,I!==null?I:t(b.type)||"Memo";case D:I=b._payload,b=b._init;try{return t(b(I))}catch{}}return null}function n(b){return""+b}function s(b){try{n(b);var I=!1}catch{I=!0}if(I){I=console;var z=I.error,W=typeof Symbol=="function"&&Symbol.toStringTag&&b[Symbol.toStringTag]||b.constructor.name||"Object";return z.call(I,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",W),n(b)}}function a(b){if(b===_)return"<>";if(typeof b=="object"&&b!==null&&b.$$typeof===D)return"<...>";try{var I=t(b);return I?"<"+I+">":"<...>"}catch{return"<...>"}}function i(){var b=O.A;return b===null?null:b.getOwner()}function r(){return Error("react-stack-top-frame")}function l(b){if(ge.call(b,"key")){var I=Object.getOwnPropertyDescriptor(b,"key").get;if(I&&I.isReactWarning)return!1}return b.key!==void 0}function c(b,I){function z(){re||(re=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",I))}z.isReactWarning=!0,Object.defineProperty(b,"key",{get:z,configurable:!0})}function d(){var b=t(this.type);return ye[b]||(ye[b]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),b=this.props.ref,b!==void 0?b:null}function u(b,I,z,W,V,be){var w=z.ref;return b={$$typeof:v,type:b,key:I,props:z,_owner:W},(w!==void 0?w:null)!==null?Object.defineProperty(b,"ref",{enumerable:!1,get:d}):Object.defineProperty(b,"ref",{enumerable:!1,value:null}),b._store={},Object.defineProperty(b._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(b,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(b,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:V}),Object.defineProperty(b,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:be}),Object.freeze&&(Object.freeze(b.props),Object.freeze(b)),b}function p(b,I,z,W,V,be){var w=I.children;if(w!==void 0)if(W)if(ue(w)){for(W=0;W<w.length;W++)f(w[W]);Object.freeze&&Object.freeze(w)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else f(w);if(ge.call(I,"key")){w=t(b);var te=Object.keys(I).filter(function(he){return he!=="key"});W=0<te.length?"{key: someKey, "+te.join(": ..., ")+": ...}":"{key: someKey}",Z[w+W]||(te=0<te.length?"{"+te.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
2
2
|
let props = %s;
|
|
3
3
|
<%s {...props} />
|
|
4
4
|
React keys must be passed directly to JSX without using spread:
|
|
5
5
|
let props = %s;
|
|
6
|
-
<%s key={someKey} {...props} />`,W,w,te,w),X[w+W]=!0)}if(w=null,H!==void 0&&(s(H),w=""+H),o(I)&&(s(I.key),w=""+I.key),"key"in I){H={};for(var ie in I)ie!=="key"&&(H[ie]=I[ie])}else H=I;return w&&c(H,typeof b=="function"?b.displayName||b.name||"Unknown":b),u(b,w,H,r(),V,ve)}function f(b){h(b)?b._store&&(b._store.validated=1):typeof b=="object"&&b!==null&&b.$$typeof===D&&(b._payload.status==="fulfilled"?h(b._payload.value)&&b._payload.value._store&&(b._payload.value._store.validated=1):b._store&&(b._store.validated=1))}function h(b){return typeof b=="object"&&b!==null&&b.$$typeof===v}var m=l,v=Symbol.for("react.transitional.element"),g=Symbol.for("react.portal"),_=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),N=Symbol.for("react.profiler"),k=Symbol.for("react.consumer"),$=Symbol.for("react.context"),S=Symbol.for("react.forward_ref"),P=Symbol.for("react.suspense"),q=Symbol.for("react.suspense_list"),Z=Symbol.for("react.memo"),D=Symbol.for("react.lazy"),T=Symbol.for("react.activity"),ee=Symbol.for("react.client.reference"),O=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Ne=Object.prototype.hasOwnProperty,ue=Array.isArray,Q=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(b){return b()}};var re,je={},ye=m.react_stack_bottom_frame.bind(m,i)(),R=Q(a(i)),X={};rn.Fragment=_,rn.jsx=function(b,I,H){var W=1e4>O.recentlyCreatedOwnerStacks++;return p(b,I,H,!1,W?Error("react-stack-top-frame"):ye,W?Q(a(b)):R)},rn.jsxs=function(b,I,H){var W=1e4>O.recentlyCreatedOwnerStacks++;return p(b,I,H,!0,W?Error("react-stack-top-frame"):ye,W?Q(a(b)):R)}})()),rn}var Pa;function mr(){return Pa||(Pa=1,process.env.NODE_ENV==="production"?Sn.exports=hr():Sn.exports=pr()),Sn.exports}var e=mr();function Un(t){return typeof t=="object"&&"from"in t&&"to"in t}function Gn(t){return typeof t=="string"?`ui-gradient--${t}`:null}function qn(t){return t.startsWith("#")?t:`var(${t.includes("-")?`--palette-${t}`:t})`}function Xn(t){const n=t.direction||"diagonal",s={horizontal:"90deg",vertical:"180deg",diagonal:"135deg",radial:"circle"},a=qn(t.from),r=qn(t.to),i=t.via?qn(t.via):null,c=n==="radial"?"radial-gradient":"linear-gradient",d=s[n];return i?`${c}(${d}, ${a} 0%, ${i} 50%, ${r} 100%)`:`${c}(${d}, ${a} 0%, ${r} 100%)`}const Xe=({variant:t="filled",color:n="primary",gradient:s,size:a="medium",disabled:r=!1,children:i,sx:o,style:c,...d})=>{const u=!!s,p=`ui-button ui-button--${t} ui-button--${a}`,h=c?.background||c?.backgroundColor||c?.color?"":u?typeof s=="string"?Gn(s):"ui-button--custom-gradient":`ui-button--${n}`,v=`${p} ${h} ${r?"ui-button--disabled":""}`.trim(),g=o?`${v} ${o}`.trim():v,y={...u&&Un(s)&&t==="filled"?{background:Xn(s)}:void 0,...c};return e.jsx("button",{className:g,disabled:r,style:y,...d,children:i})},fr="ui-kit-portal-root";function En(t){const{containerId:n=fr,containerElement:s}=t||{},[a,r]=l.useState(null);return l.useEffect(()=>{if(typeof document>"u")return;if(s){r(s);return}let i=document.getElementById(n);return i||(i=document.createElement("div"),i.id=n,i.setAttribute("data-ui-kit-portal","true"),document.body.appendChild(i)),r(i),()=>{i&&i.id===n&&i.childNodes.length===0&&i.parentNode&&i.parentNode.removeChild(i)}},[n,s]),a}const Ha=150,za=48,_r=t=>{const[n,s]=t.split("-");return{side:n,align:s??"center"}};function Ba(t){const{triggerRef:n,floatingRef:s,open:a,placement:r="bottom-start",gap:i=8,maxHeight:o=320,matchWidth:c=!1,zIndex:d}=t,{side:u,align:p}=_r(r),[f,h]=l.useState({}),[m,v]=l.useState(u),[g,_]=l.useState(!1),y=l.useRef(null);return l.useLayoutEffect(()=>{if(!a){_(!1);return}const N=()=>{y.current=null;const P=n.current;if(!P)return;const q=P.getBoundingClientRect(),Z=s.current?.offsetHeight??0,D=s.current?.offsetWidth??0,T=Math.min(Z||o,o),ee=window.innerWidth,O=window.innerHeight,Ne=O-q.bottom-i,ue=q.top-i;let Q=u;if(u==="bottom"){const X=Ne<Ha,b=T>Ne&&ue>Ne+za;(X?ue>Ne:b)&&(Q="top")}else{const X=ue<Ha,b=T>ue&&Ne>ue+za;(X?Ne>ue:b)&&(Q="bottom")}const re=8,je=c?q.width:D;let ye;c||p==="start"?ye=q.left:p==="end"?ye=q.right-(je||0):ye=q.left+q.width/2-(je||0)/2,je&&(ye=Math.max(re,Math.min(ye,ee-je-re)));const R={position:"fixed",left:ye,zIndex:d??"var(--z-index-dropdown, 1000)"};c&&(R.width=je),Q==="bottom"?(R.top=q.bottom+i,R.maxHeight=Math.min(o,Math.max(0,Ne))):(R.bottom=O-q.top+i,R.maxHeight=Math.min(o,Math.max(0,ue))),v(Q),h(R),_(!0)},k=()=>{y.current===null&&(y.current=requestAnimationFrame(N))};N(),window.addEventListener("scroll",k,!0),window.addEventListener("resize",k);const $=n.current,S=typeof ResizeObserver<"u"?new ResizeObserver(k):null;return $&&S&&S.observe($),s.current&&S&&S.observe(s.current),()=>{window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k),y.current!==null&&cancelAnimationFrame(y.current),y.current=null,S?.disconnect()}},[a,r,i,o,c,d]),{style:f,side:m,ready:g}}const bt=l.createContext(null),ln=10,Oa=20,Fa=1050,Va=l.createContext({variant:"menu"}),Zn=({children:t,disabled:n,selected:s,onClick:a,sx:r,style:i})=>{const{variant:o}=l.useContext(Va),c=o==="menu"&&!n,d=u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),a?.())};return e.jsx("div",{className:`ui-dropdown__item${n?" ui-dropdown__item--disabled":""}${s?" ui-dropdown__item--selected":""}${r?` ${r}`:""}`,style:i,role:"menuitem","aria-disabled":n,"aria-selected":s,tabIndex:c?0:-1,onClick:c?a:void 0,onKeyDown:c?d:void 0,children:t})};Zn.displayName="DropdownItem";const Jn=({trigger:t,children:n,placement:s="bottom-end",divider:a=!1,variant:r="menu",portal:i=!1,sx:o,style:c})=>{const[d,u]=l.useState(!1),p=l.useRef(null),f=l.useRef(null),h=En(),m=l.useContext(bt),v=m?m.baseZ+ln:void 0,g=Ba({triggerRef:p,floatingRef:f,open:i&&d,placement:s,gap:8,zIndex:v,maxHeight:400}),_=l.useCallback(()=>{u(!1)},[]);l.useEffect(()=>{if(!d)return;const P=Z=>{const D=Z.target;!p.current?.contains(D)&&!f.current?.contains(D)&&_()};r==="menu"&&f.current?.querySelector('[role="menuitem"]:not([aria-disabled="true"])')?.focus();const q=setTimeout(()=>document.addEventListener("click",P),0);return()=>{clearTimeout(q),document.removeEventListener("click",P)}},[d,r,_]);const y=P=>{P.preventDefault(),P.stopPropagation(),u(q=>!q)},N=P=>{if(P.key==="Escape"){_();return}if(P.key==="Tab"){_();return}if(!d||r!=="menu")return;const q=f.current?.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"])');if(!q?.length)return;const Z=Array.from(q),D=Z.indexOf(document.activeElement);if(P.key==="ArrowDown"){P.preventDefault();const T=D<Z.length-1?D+1:0;Z[T].focus()}else if(P.key==="ArrowUp"){P.preventDefault();const T=D>0?D-1:Z.length-1;Z[T].focus()}},k=()=>{_()},$=["ui-dropdown__menu",!a&&"ui-dropdown__menu--no-divider",r==="info"&&"ui-dropdown__menu--info",i&&"ui-dropdown__menu--portal",o?.menu].filter(Boolean).join(" "),S=e.jsx("div",{ref:f,className:$,style:i?{...g.style,...c?.menu}:c?.menu,onClick:k,onKeyDown:N,"data-placement":i?`${g.side}-${s.split("-")[1]??"center"}`:void 0,children:n});return e.jsxs(Va.Provider,{value:{variant:r},children:[e.jsxs("div",{ref:p,className:`ui-dropdown ui-dropdown--${s}${d?" ui-dropdown--open":""}${i?" ui-dropdown--portal":""}${o?.root?` ${o.root}`:""}`,style:c?.root,onKeyDown:N,children:[e.jsx("span",{style:{display:"contents"},onClick:y,children:t}),!i&&S]}),i&&d&&h&&Mt.createPortal(S,h)]})};Jn.displayName="Dropdown";const Ft=l.forwardRef(({label:t,helperText:n,error:s=!1,multiline:a=!1,rows:r=3,startAdornment:i,endAdornment:o,fullWidth:c=!1,size:d="normal",disabled:u=!1,placeholder:p,sx:f,id:h,...m},v)=>{const g=l.useId(),_=h||g,y=n?`${_}-helper-text`:void 0,N=(...q)=>q.filter(Boolean).join(" "),k=N("ui-textfield",c&&"ui-textfield--full-width",f?.root),$=N("ui-textfield__wrapper",`ui-textfield__wrapper--${d}`,s&&"ui-textfield__wrapper--error",u&&"ui-textfield__wrapper--disabled",!!i&&"ui-textfield__wrapper--with-start-adornment",!!o&&"ui-textfield__wrapper--with-end-adornment",f?.wrapper),S=N("ui-textfield__input",`ui-textfield__input--${d}`,a&&"ui-textfield__input--textarea",f?.input),P=a?"textarea":"input";return e.jsxs("div",{className:k,children:[t&&e.jsxs("label",{htmlFor:_,className:N("ui-textfield__label",s&&"ui-textfield__label--error",f?.label),children:[t,m.required&&e.jsx("span",{className:"ui-textfield__label-required",children:"*"})]}),e.jsxs("div",{className:$,children:[i&&e.jsx("span",{className:"ui-textfield__adornment ui-textfield__adornment--start",children:i}),e.jsx(P,{ref:v,id:_,className:S,disabled:u,rows:a?r:void 0,placeholder:p,"aria-label":t?void 0:p,"aria-invalid":s,"aria-describedby":y,...m}),o&&e.jsx("span",{className:"ui-textfield__adornment ui-textfield__adornment--end",children:o})]}),n&&e.jsx("p",{id:y,className:N("ui-textfield__helper-text",s&&"ui-textfield__helper-text--error",f?.helperText),children:n})]})});Ft.displayName="TextField";const mt=({label:t,leadingIcon:n,trailingIcon:s,variant:a="filled",color:r="neutral",size:i="medium",selected:o=!1,disabled:c=!1,onClick:d,onDelete:u,sx:p,style:f})=>{const h=!!d&&!c,m=["ui-chip",`ui-chip--${a}`,`ui-chip--${r}`,`ui-chip--${i}`,o&&"ui-chip--selected",c&&"ui-chip--disabled",h&&"ui-chip--clickable",p].filter(Boolean).join(" "),v=_=>{c||d?.(_)},g=_=>{_.stopPropagation(),!c&&u?.(_)};return e.jsxs("div",{className:m,style:f,role:h?"button":void 0,tabIndex:h?0:void 0,"aria-pressed":h&&o?!0:void 0,"aria-disabled":c?!0:void 0,onClick:v,onKeyDown:h?_=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),d?.(_))}:void 0,children:[n&&e.jsx("span",{className:"ui-chip__icon ui-chip__icon--leading","aria-hidden":"true",children:n}),e.jsx("span",{className:"ui-chip__label",children:t}),!u&&s&&e.jsx("span",{className:"ui-chip__icon ui-chip__icon--trailing","aria-hidden":"true",children:s}),u&&e.jsx("button",{type:"button",className:"ui-chip__delete","aria-label":`Remove ${t}`,disabled:c,onClick:g,tabIndex:c?-1:0,children:e.jsx("svg",{className:"ui-chip__delete-icon",viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:e.jsx("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})})})]})};mt.displayName="Chip";const on=8,$n=320,gr=150,xr=48,Ya=(t,n)=>{const s=window.innerHeight-t.bottom-on,a=t.top-on,r=Math.min(n,$n);return(s<gr?a>s:r>s&&a>s+xr)?{bottom:window.innerHeight-t.top+on,left:t.left,width:t.width,maxHeight:Math.min($n,a)}:{top:t.bottom+on,left:t.left,width:t.width,maxHeight:Math.min($n,s)}},Dt=(...t)=>t.filter(Boolean).join(" "),Ln=l.forwardRef(({options:t,label:n,placeholder:s="Select...",multiple:a=!1,disabled:r=!1,size:i="normal",sx:o,id:c,value:d,defaultValue:u,onChange:p,error:f=!1,helperText:h,fullWidth:m=!1,clearable:v=!1,chipDisplay:g="inside",chipProps:_,required:y=!1,...N},k)=>{const $=l.useId(),S=c||$,P=n?`${S}-label`:void 0,q=`${S}-listbox`,Z=h?`${S}-helper-text`:void 0,D=l.useRef(null),T=l.useRef(null),ee=l.useRef(null),O=l.useRef(null),Ne=l.useContext(bt),ue=Ne?Ne.baseZ+ln:void 0,[Q,re]=l.useState(!1),[je,ye]=l.useState(null),[R,X]=l.useState(!1),[b,I]=l.useState(u!==void 0?a?Array.isArray(u)?u:[u]:u:a?[]:null),[H,W]=l.useState(-1),V=["small","normal","large"].includes(i)?i:"normal";process.env.NODE_ENV!=="production"&&i!==V&&console.warn(`Select: Invalid size "${i}". Using "normal" instead.`);const ve=d!==void 0,w=ve?d:b,te=t.length>0&&"options"in t[0],ie=te?t.flatMap(j=>j.options):t,he=ie.filter(j=>!j.disabled),z=l.useCallback(()=>{re(!1),W(-1)},[]);l.useEffect(()=>{const j=D.current;if(!j)return;if(!Q){ye(null),X(!1);return}const B=j.getBoundingClientRect();ye({top:B.bottom+on,left:B.left,width:B.width,maxHeight:$n}),X(!1);const U=ke=>{!T.current?.contains(ke.target)&&!ee.current?.contains(ke.target)&&z()};setTimeout(()=>document.addEventListener("click",U),0);const J=()=>{!ee.current||!D.current||ye(Ya(D.current.getBoundingClientRect(),ee.current.offsetHeight))};return window.addEventListener("scroll",J,!0),window.addEventListener("resize",J),()=>{window.removeEventListener("scroll",J,!0),window.removeEventListener("resize",J),document.removeEventListener("click",U)}},[Q,z]),l.useLayoutEffect(()=>{if(!Q||R||!ee.current||!D.current)return;const j=D.current.getBoundingClientRect();ye(Ya(j,ee.current.offsetHeight)),X(!0)},[Q,je,R]),l.useEffect(()=>{if(H<0||!O.current)return;O.current.querySelectorAll('[role="option"]')[H]?.scrollIntoView({block:"nearest"})},[H]);const le=j=>{ve||I(j),p?.(j),!a&&j!==null&&z()},$e=j=>{if(a){const B=Array.isArray(w)?w:[],U=B.includes(j)?B.filter(J=>J!==j):[...B,j];le(U.length>0?U:[])}else le(j),D.current?.focus()},Pe=(j,B)=>{j.preventDefault(),j.stopPropagation();const J=(Array.isArray(w)?w:[]).filter(ke=>ke!==B);le(J.length>0?J:[])},pe=j=>{j.preventDefault(),j.stopPropagation(),le(a?[]:null),D.current?.focus()},Ce=j=>{if(he.length===0)return;let B=-1;if(H>=0&&H<ie.length){const J=ie[H];B=he.findIndex(ke=>ke.value===J?.value)}const U=j==="next"?(B+1)%he.length:B<=0?he.length-1:B-1;W(ie.findIndex(J=>J.value===he[U].value))},_e=(j,B)=>{if(!(r&&!B))switch(j.key){case"Enter":case" ":{if(j.preventDefault(),B&&H>=0&&H<ie.length){const U=ie[H];U.disabled||$e(U.value)}else re(!Q),Q||W(-1);break}case"ArrowDown":{j.preventDefault(),!Q&&!B?(re(!0),W(-1)):Ce("next");break}case"ArrowUp":{j.preventDefault(),Q&&Ce("prev");break}case"Escape":{j.preventDefault(),z(),B||D.current?.focus();break}case"Tab":{z();break}}},He=a&&Array.isArray(w)?w:[],M=j=>j.map(B=>{const U=ie.find(J=>J.value===B);return e.jsx(mt,{label:U?.label??B,variant:_?.variant??"filled",color:_?.color??"neutral",size:_?.size??"small",leadingIcon:_?.leadingIcon,sx:_?.sx,disabled:r,onDelete:r?void 0:J=>Pe(J,B)},B)}),G=()=>{if(a)return g==="outside"?He.length?null:e.jsx("span",{className:"ui-select__placeholder",children:s}):He.length?e.jsx(e.Fragment,{children:M(He)}):e.jsx("span",{className:"ui-select__placeholder",children:s});if(!w||w==="")return e.jsx("span",{className:"ui-select__placeholder",children:s});const j=ie.find(B=>B.value===w);return j?e.jsx("span",{className:"ui-select__value",children:j.label}):e.jsx("span",{className:"ui-select__placeholder",children:s})},ae=a?Array.isArray(w)&&w.length>0:w!==null&&w!=="";return e.jsxs("div",{ref:T,className:Dt("ui-select",a&&"ui-select--multiple",m&&"ui-select--full-width",o?.root),style:{position:"relative"},children:[n&&e.jsxs("label",{id:P,htmlFor:S,className:Dt("ui-select__label",f&&"ui-select__label--error",o?.label),children:[n,y&&e.jsx("span",{className:"ui-select__label-required",children:"*"})]}),a&&g==="outside"&&He.length>0&&e.jsx("div",{className:"ui-select__chips-outside",children:M(He)}),e.jsxs("button",{...N,ref:j=>{typeof k=="function"?k(j):k&&(k.current=j),D.current=j},id:S,"aria-labelledby":P,"aria-haspopup":"listbox","aria-expanded":Q,"aria-controls":q,"aria-disabled":r,"aria-invalid":f,"aria-describedby":Z,disabled:r,onClick:j=>{if(j.preventDefault(),j.stopPropagation(),!r){const B=!Q;re(B),B&&W(-1)}},onBlur:j=>{const B=j.relatedTarget;!T.current?.contains(B)&&!ee.current?.contains(B)&&z()},onKeyDown:j=>_e(j,!1),className:Dt("ui-select__trigger",`ui-select__trigger--${V}`,a&&"ui-select__trigger--multi",a&&g==="inside"&&He.length>0&&"ui-select__trigger--has-chips",r&&"ui-select__trigger--disabled",f&&"ui-select__trigger--error",Q&&"base--expanded",o?.trigger),"aria-label":n||s,type:"button",children:[G(),v&&ae&&e.jsx("span",{role:"button",className:"ui-select__clear",onClick:pe,onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),pe({preventDefault:()=>{},stopPropagation:()=>{}}))},"aria-label":"Clear selection",tabIndex:0,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),Q&&je&&Mt.createPortal(e.jsx("div",{ref:ee,className:Dt("ui-select__popup",o?.popup),style:{position:"fixed",top:je.top,bottom:je.bottom,left:je.left,width:je.width,visibility:R?"visible":"hidden",...ue!==void 0?{zIndex:ue}:null},onClick:j=>j.stopPropagation(),children:e.jsx("ul",{ref:O,id:q,role:"listbox","aria-multiselectable":a,"aria-labelledby":P,onKeyDown:j=>_e(j,!0),className:Dt("ui-select__listbox",`ui-select__listbox--${V}`,a&&"ui-select__listbox--multiple",r&&"base--disabled",o?.listbox),style:{maxHeight:je?.maxHeight},children:ie.length===0?e.jsx("li",{className:"ui-select__empty",role:"presentation",children:"No options found"}):te?t.map(j=>e.jsxs(l.Fragment,{children:[e.jsx("li",{role:"presentation",className:"ui-select__group-label",children:j.label}),j.options.map(B=>{const U=ie.findIndex(ke=>ke.value===B.value),J=a?Array.isArray(w)&&w.includes(B.value):w===B.value;return e.jsx("li",{role:"option","aria-selected":J,"aria-disabled":B.disabled,"aria-posinset":U+1,"aria-setsize":ie.length,onClick:ke=>{ke.preventDefault(),ke.stopPropagation(),B.disabled||$e(B.value)},onMouseDown:ke=>{ke.preventDefault(),ke.stopPropagation()},onMouseEnter:()=>W(U),className:Dt("ui-select__option",a?"ui-select__option--multi":"ui-select__option--single",J&&"base--selected",H===U&&"base--highlighted",B.disabled&&"base--disabled",o?.option),style:{cursor:B.disabled?"not-allowed":"pointer"},children:e.jsxs("span",{className:"ui-select__option-body",children:[e.jsx("span",{className:"ui-select__option-label",children:B.label}),B.description&&e.jsx("span",{className:"ui-select__option-description",children:B.description})]})},B.value)})]},j.label)):ie.map((j,B)=>{const U=a?Array.isArray(w)&&w.includes(j.value):w===j.value;return e.jsx("li",{role:"option","aria-selected":U,"aria-disabled":j.disabled,"aria-posinset":B+1,"aria-setsize":ie.length,onClick:J=>{J.preventDefault(),J.stopPropagation(),j.disabled||$e(j.value)},onMouseDown:J=>{J.preventDefault(),J.stopPropagation()},onMouseEnter:()=>W(B),className:Dt("ui-select__option",a?"ui-select__option--multi":"ui-select__option--single",U&&"base--selected",H===B&&"base--highlighted",j.disabled&&"base--disabled",o?.option),style:{cursor:j.disabled?"not-allowed":"pointer"},children:e.jsxs("span",{className:"ui-select__option-body",children:[e.jsx("span",{className:"ui-select__option-label",children:j.label}),j.description&&e.jsx("span",{className:"ui-select__option-description",children:j.description})]})},j.value)})})}),document.body),h&&e.jsx("p",{id:Z,className:Dt("ui-select__helper-text",f&&"ui-select__helper-text--error",o?.helperText),children:h})]})});Ln.displayName="Select";const cn=8,Tn=320,vr=150,br=48,Wa=(t,n)=>{const s=window.innerHeight-t.bottom-cn,a=t.top-cn,r=Math.min(n,Tn);return(s<vr?a>s:r>s&&a>s+br)?{bottom:window.innerHeight-t.top+cn,left:t.left,width:t.width,maxHeight:Math.min(Tn,a)}:{top:t.bottom+cn,left:t.left,width:t.width,maxHeight:Math.min(Tn,s)}},jr=(t,n)=>{const s=n.toLowerCase();return t.filter(a=>a.label.toLowerCase().includes(s)||a.description?.toLowerCase().includes(s))},Vt=(...t)=>t.filter(Boolean).join(" "),Qn=({options:t,label:n,placeholder:s="Search...",multiple:a=!1,disabled:r=!1,size:i="normal",sx:o,id:c,value:d,defaultValue:u,onChange:p,onSearchChange:f,filterOptions:h,error:m=!1,helperText:v,fullWidth:g=!1,clearable:_=!1,noOptionsText:y="No options found",required:N=!1,chipProps:k})=>{const $=l.useId(),S=c||$,P=n?`${S}-label`:void 0,q=`${S}-listbox`,Z=v?`${S}-helper-text`:void 0,D=l.useRef(null),T=l.useRef(null),ee=l.useRef(null),O=l.useRef(null),Ne=l.useContext(bt),ue=Ne?Ne.baseZ+ln:void 0,Q=l.useRef(null),[re,je]=l.useState(!1),[ye,R]=l.useState(null),[X,b]=l.useState(!1),[I,H]=l.useState(u!==void 0?a?Array.isArray(u)?u:[u]:u:a?[]:null),[W,V]=l.useState(-1),[ve,w]=l.useState(""),[te,ie]=l.useState(!1),he=d!==void 0,z=he?d:I,le=t.length>0&&"options"in t[0],$e=le?t.flatMap(F=>F.options):t,Pe=h??jr,pe=ve.trim()?Pe($e,ve):$e,Ce=pe.filter(F=>!F.disabled),_e=a||!z||z===""?"":$e.find(oe=>oe.value===z)?.label??(typeof z=="string"?z:""),He=a||te?ve:_e,M=l.useCallback(()=>{je(!1),V(-1),w(""),ie(!1)},[]),G=l.useCallback(()=>{M()},[M]);l.useEffect(()=>{const F=T.current;if(!F)return;if(!re){R(null),b(!1);return}const oe=F.getBoundingClientRect();R({top:oe.bottom+cn,left:oe.left,width:oe.width,maxHeight:Tn}),b(!1);const ge=Ae=>{!D.current?.contains(Ae.target)&&!O.current?.contains(Ae.target)&&G()};setTimeout(()=>document.addEventListener("click",ge),0);const be=()=>{!O.current||!T.current||R(Wa(T.current.getBoundingClientRect(),O.current.offsetHeight))};return window.addEventListener("scroll",be,!0),window.addEventListener("resize",be),()=>{window.removeEventListener("scroll",be,!0),window.removeEventListener("resize",be),document.removeEventListener("click",ge)}},[re,G]),l.useLayoutEffect(()=>{if(!re||X||!O.current||!T.current)return;const F=T.current.getBoundingClientRect();R(Wa(F,O.current.offsetHeight)),b(!0)},[re,ye,X]),l.useEffect(()=>{if(W<0||!Q.current)return;Q.current.querySelectorAll('[role="option"]')[W]?.scrollIntoView({block:"nearest"})},[W]);const ae=F=>{he||H(F),p?.(F)},j=F=>{if(a){const oe=Array.isArray(z)?z:[],ge=oe.includes(F)?oe.filter(be=>be!==F):[...oe,F];ae(ge.length>0?ge:[]),w(""),f?.(""),V(-1),ee.current?.focus()}else ae(F),w(""),ie(!1),je(!1),V(-1)},B=(F,oe)=>{F.preventDefault(),F.stopPropagation();const ge=Array.isArray(z)?z:[];ae(ge.filter(be=>be!==oe))},U=F=>{F.preventDefault(),F.stopPropagation(),ae(a?[]:null),w(""),ie(!1),ee.current?.focus()},J=F=>{if(Ce.length===0)return;let oe=-1;if(W>=0&&W<pe.length){const be=pe[W];oe=Ce.findIndex(Ae=>Ae.value===be?.value)}const ge=F==="next"?(oe+1)%Ce.length:oe<=0?Ce.length-1:oe-1;V(pe.findIndex(be=>be.value===Ce[ge].value))},ke=F=>{if(!r)switch(F.key){case"ArrowDown":{F.preventDefault(),re?J("next"):(je(!0),V(-1));break}case"ArrowUp":{F.preventDefault(),re&&J("prev");break}case"Enter":{if(F.preventDefault(),re&&W>=0&&W<pe.length){const oe=pe[W];oe.disabled||j(oe.value)}break}case"Escape":{F.preventDefault(),G();break}case"Backspace":{if(a&&ve===""){const oe=Array.isArray(z)?z:[];oe.length>0&&ae(oe.slice(0,-1))}break}case"Tab":{G();break}}},C=a&&Array.isArray(z)?z:[],de=a?C.length>0:z!==null&&z!==""&&z!==void 0,fe=()=>C.map(F=>{const oe=$e.find(ge=>ge.value===F);return e.jsx(mt,{label:oe?.label??F,variant:k?.variant??"filled",color:k?.color??"neutral",size:k?.size??"small",leadingIcon:k?.leadingIcon,sx:k?.sx,disabled:r,onDelete:r?void 0:ge=>B(ge,F)},F)}),Se=()=>pe.length===0?e.jsx("li",{className:"ui-ac__empty",role:"presentation",children:y}):le&&!ve.trim()?t.map(F=>{const oe=F.options.filter(ge=>pe.some(be=>be.value===ge.value));return oe.length===0?null:e.jsxs(l.Fragment,{children:[e.jsx("li",{role:"presentation",className:"ui-ac__group-label",children:F.label}),oe.map(ge=>we(ge,pe.findIndex(be=>be.value===ge.value)))]},F.label)}):pe.map((F,oe)=>we(F,oe)),we=(F,oe)=>{const ge=a?Array.isArray(z)&&z.includes(F.value):z===F.value;return e.jsx("li",{role:"option","aria-selected":ge,"aria-disabled":F.disabled,"aria-posinset":oe+1,"aria-setsize":pe.length,onMouseDown:be=>{be.preventDefault(),be.stopPropagation()},onClick:be=>{be.preventDefault(),be.stopPropagation(),F.disabled||j(F.value)},onMouseEnter:()=>V(oe),className:Vt("ui-ac__option",ge&&"base--selected",W===oe&&"base--highlighted",F.disabled&&"base--disabled",o?.option),style:{cursor:F.disabled?"not-allowed":"pointer"},children:e.jsxs("span",{className:"ui-ac__option-body",children:[e.jsx("span",{className:"ui-ac__option-label",children:F.label}),F.description&&e.jsx("span",{className:"ui-ac__option-description",children:F.description})]})},F.value)};return e.jsxs("div",{ref:D,className:Vt("ui-ac",g&&"ui-ac--full-width",o?.root),children:[n&&e.jsxs("label",{id:P,htmlFor:`${S}-input`,className:Vt("ui-ac__label",m&&"ui-ac__label--error",o?.label),children:[n,N&&e.jsx("span",{className:"ui-ac__label-required",children:"*"})]}),e.jsxs("div",{ref:T,role:"combobox","aria-expanded":re,"aria-haspopup":"listbox","aria-owns":q,className:Vt("ui-ac__trigger",`ui-ac__trigger--${i}`,a&&"ui-ac__trigger--multi",r&&"ui-ac__trigger--disabled",m&&"ui-ac__trigger--error",re&&"base--expanded",o?.trigger),onClick:()=>{r||ee.current?.focus()},children:[a&&fe(),e.jsx("input",{ref:ee,id:`${S}-input`,type:"text",role:"combobox","aria-autocomplete":"list","aria-controls":q,"aria-expanded":re,"aria-labelledby":P,"aria-describedby":Z,"aria-invalid":m,disabled:r,placeholder:a?C.length===0?s:"":s,value:He,className:"ui-ac__input",autoComplete:"off",onFocus:()=>{r||(a||ie(!0),je(!0),V(-1))},onBlur:F=>{const oe=F.relatedTarget;!D.current?.contains(oe)&&!O.current?.contains(oe)&&G()},onChange:F=>{const oe=F.target.value;w(oe),f?.(oe),V(-1),re||je(!0)},onKeyDown:ke,onPaste:F=>{if(!a||r)return;const oe=F.clipboardData.getData("text");if(!/[\r\n\t]/.test(oe))return;F.preventDefault();const ge=oe.split(/[\r\n\t]+/).map(Ke=>Ke.trim()).filter(Boolean),be=Array.isArray(z)?z:[],Ae=[],We=[];ge.forEach(Ke=>{const ct=Ke.toLowerCase(),Qe=$e.find(gt=>!gt.disabled&&(gt.label.toLowerCase()===ct||gt.value.toLowerCase()===ct));Qe&&!be.includes(Qe.value)&&!Ae.includes(Qe.value)?Ae.push(Qe.value):Qe||We.push(Ke)}),Ae.length>0&&ae([...be,...Ae]);const ht=We.length>0?We[We.length-1]:"";w(ht),f?.(ht),V(-1),re||je(!0),ee.current?.focus()}}),_&&de&&!r&&e.jsx("button",{type:"button",className:"ui-ac__clear",onMouseDown:F=>{F.preventDefault(),U(F)},"aria-label":"Clear selection",tabIndex:-1,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),e.jsx("span",{className:"ui-ac__arrow","aria-hidden":!0})]}),re&&ye&&Mt.createPortal(e.jsx("div",{ref:O,className:"ui-ac__popup",style:{position:"fixed",top:ye.top,bottom:ye.bottom,left:ye.left,width:ye.width,visibility:X?"visible":"hidden",...ue!==void 0?{zIndex:ue}:null},onMouseDown:F=>F.preventDefault(),onClick:F=>F.stopPropagation(),children:e.jsx("ul",{ref:Q,id:q,role:"listbox","aria-multiselectable":a,"aria-labelledby":P,className:Vt("ui-ac__listbox",`ui-ac__listbox--${i}`,o?.listbox),style:{maxHeight:ye?.maxHeight},children:Se()})}),document.body),v&&e.jsx("p",{id:Z,className:Vt("ui-ac__helper-text",m&&"ui-ac__helper-text--error",o?.helperText),children:v})]})};Qn.displayName="Autocomplete";const Ka=({tags:t,size:n="medium",sx:s})=>e.jsx("div",{className:`ui-tags ui-tags--${n} ${s||""}`.trim(),children:t.map((a,r)=>{const i=a.department?`ui-tags__tag--${a.department}`:"ui-tags__tag--custom";return e.jsx("span",{className:`ui-tags__tag ${i}`,children:a.label},r)})}),yr=({thumbnailUrl:t,title:n,author:s,description:a,tags:r,duration:i,views:o,publishedAt:c,isInPlaylist:d=!1,onClick:u,sx:p})=>{const f=`ui-video-card ${p||""}`.trim();return e.jsxs("div",{className:f,onClick:u,children:[e.jsxs("div",{className:"ui-video-card__thumbnail",children:[t?e.jsx("img",{src:t,alt:n,className:"ui-video-card__thumbnail-image"}):e.jsx("div",{className:"ui-video-card__thumbnail-placeholder",children:e.jsx("span",{children:"Video"})}),d?e.jsx("div",{className:"ui-video-card__playlist-icon",children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z"}),e.jsx("path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12"}),e.jsx("path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17"})]})}):i&&e.jsx("span",{className:"ui-video-card__duration",children:i})]}),e.jsxs("div",{className:"ui-video-card__content",children:[e.jsxs("div",{className:"ui-video-card__header",children:[e.jsx("div",{className:"ui-video-card__avatar","data-department":s.department||"default",children:s.initials}),e.jsxs("div",{className:"ui-video-card__title-section",children:[e.jsx("h3",{className:"ui-video-card__title",children:n}),e.jsx("p",{className:"ui-video-card__author",children:s.name})]})]}),e.jsx("p",{className:"ui-video-card__description",children:a}),e.jsx(Ka,{tags:r}),(o||c)&&e.jsxs("div",{className:"ui-video-card__meta",children:[o&&e.jsxs("span",{className:"ui-video-card__views",children:[o," views"]}),o&&c&&e.jsx("span",{className:"ui-video-card__separator",children:"•"}),c&&e.jsx("span",{className:"ui-video-card__published",children:c})]})]})]})},St=({label:t,icon:n,variant:s="filled",color:a="neutral",gradient:r,size:i="medium",sx:o,style:c})=>{const d=!!r,u=`ui-badge ui-badge--${s} ui-badge--${i}`,f=c?.background||c?.backgroundColor||c?.color?"":d?typeof r=="string"?Gn(r):"ui-badge--custom-gradient":`ui-badge--${a}`,h=`${u} ${f}`.trim(),m=o?`${h} ${o}`.trim():h,g={...d&&Un(r)&&s==="filled"?{background:Xn(r)}:void 0,...c};return e.jsxs("span",{className:m,role:"status",style:g,children:[n&&e.jsx("span",{className:"ui-badge__icon","aria-hidden":"true",children:n}),e.jsx("span",{className:"ui-badge__label",children:t})]})};St.displayName="Badge";var Ua={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Ga=l.createContext&&l.createContext(Ua),kr=["attr","size","title"];function wr(t,n){if(t==null)return{};var s=Nr(t,n),a,r;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)a=i[r],!(n.indexOf(a)>=0)&&Object.prototype.propertyIsEnumerable.call(t,a)&&(s[a]=t[a])}return s}function Nr(t,n){if(t==null)return{};var s={};for(var a in t)if(Object.prototype.hasOwnProperty.call(t,a)){if(n.indexOf(a)>=0)continue;s[a]=t[a]}return s}function An(){return An=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var s=arguments[n];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(t[a]=s[a])}return t},An.apply(this,arguments)}function qa(t,n){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);n&&(a=a.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),s.push.apply(s,a)}return s}function In(t){for(var n=1;n<arguments.length;n++){var s=arguments[n]!=null?arguments[n]:{};n%2?qa(Object(s),!0).forEach(function(a){Cr(t,a,s[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):qa(Object(s)).forEach(function(a){Object.defineProperty(t,a,Object.getOwnPropertyDescriptor(s,a))})}return t}function Cr(t,n,s){return n=Mr(n),n in t?Object.defineProperty(t,n,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[n]=s,t}function Mr(t){var n=Dr(t,"string");return typeof n=="symbol"?n:n+""}function Dr(t,n){if(typeof t!="object"||!t)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var a=s.call(t,n);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(t)}function Xa(t){return t&&t.map((n,s)=>l.createElement(n.tag,In({key:s},n.attr),Xa(n.child)))}function Ee(t){return n=>l.createElement(Sr,An({attr:In({},t.attr)},n),Xa(t.child))}function Sr(t){var n=s=>{var{attr:a,size:r,title:i}=t,o=wr(t,kr),c=r||s.size||"1em",d;return s.className&&(d=s.className),t.className&&(d=(d?d+" ":"")+t.className),l.createElement("svg",An({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},s.attr,a,o,{className:d,style:In(In({color:t.color||s.color},s.style),t.style),height:c,width:c,xmlns:"http://www.w3.org/2000/svg"}),i&&l.createElement("title",null,i),t.children)};return Ga!==void 0?l.createElement(Ga.Consumer,null,s=>n(s)):n(Ua)}function Er(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"},child:[]}]})(t)}function $r(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"},child:[]}]})(t)}function Lr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"},child:[]}]})(t)}function Tr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M11 7 9.6 8.4l2.6 2.6H2v2h10.2l-2.6 2.6L11 17l5-5-5-5zm9 12h-8v2h8c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2h-8v2h8v14z"},child:[]}]})(t)}function Ar(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"m17 7-1.41 1.41L18.17 11H8v2h10.17l-2.58 2.58L17 17l5-5zM4 5h8V3H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h8v-2H4V5z"},child:[]}]})(t)}function Ir(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"},child:[]}]})(t)}function Pr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M7 18c-1.1 0-1.99.9-1.99 2S5.9 22 7 22s2-.9 2-2-.9-2-2-2zM1 2v2h2l3.6 7.59-1.35 2.45c-.16.28-.25.61-.25.96 0 1.1.9 2 2 2h12v-2H7.42c-.14 0-.25-.11-.25-.25l.03-.12.9-1.63h7.45c.75 0 1.41-.41 1.75-1.03l3.58-6.49A1.003 1.003 0 0 0 20 4H5.21l-.94-2H1zm16 16c-1.1 0-1.99.9-1.99 2s.89 2 1.99 2 2-.9 2-2-.9-2-2-2z"},child:[]}]})(t)}function Hr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"},child:[]}]})(t)}function zr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"},child:[]}]})(t)}function Za(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M12 14c1.66 0 2.99-1.34 2.99-3L15 5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3zm5.3-3c0 3-2.54 5.1-5.3 5.1S6.7 14 6.7 11H5c0 3.41 2.72 6.23 6 6.72V21h2v-3.28c3.28-.48 6-3.3 6-6.72h-1.7z"},child:[]}]})(t)}function Br(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{fillRule:"evenodd",d:"M16 9V4h1c.55 0 1-.45 1-1s-.45-1-1-1H7c-.55 0-1 .45-1 1s.45 1 1 1h1v5c0 1.66-1.34 3-3 3v2h5.97v7l1 1 1-1v-7H19v-2c-1.66 0-3-1.34-3-3z"},child:[]}]})(t)}function Or(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M2.01 21 23 12 2.01 3 2 10l15 2-15 2z"},child:[]}]})(t)}function Fr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M12 3a9 9 0 1 0 9 9c0-.46-.04-.92-.1-1.36a5.389 5.389 0 0 1-4.4 2.26 5.403 5.403 0 0 1-3.14-9.8c-.44-.06-.9-.1-1.36-.1z"},child:[]}]})(t)}function Vr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zM2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1zm18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1zM11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1zm0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1zM5.99 4.58a.996.996 0 0 0-1.41 0 .996.996 0 0 0 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41L5.99 4.58zm12.37 12.37a.996.996 0 0 0-1.41 0 .996.996 0 0 0 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0a.996.996 0 0 0 0-1.41l-1.06-1.06zm1.06-10.96a.996.996 0 0 0 0-1.41.996.996 0 0 0-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06zM7.05 18.36a.996.996 0 0 0 0-1.41.996.996 0 0 0-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06z"},child:[]}]})(t)}function Yr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"},child:[]}]})(t)}function Wr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M7.41 15.41 12 10.83l4.59 4.58L18 14l-6-6-6 6z"},child:[]}]})(t)}function Kr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M3 17v2h6v-2H3zM3 5v2h10V5H3zm10 16v-2h8v-2h-8v-2h-2v6h2zM7 9v2H3v2h4v2h2V9H7zm14 4v-2H11v2h10zm-6-4h2V7h4V5h-4V3h-2v6z"},child:[]}]})(t)}function Ur(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"},child:[]}]})(t)}function Gr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"m20 12-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z"},child:[]}]})(t)}function qr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"m4 12 1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z"},child:[]}]})(t)}function Xr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"},child:[]}]})(t)}function Pn(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z"},child:[]}]})(t)}function Hn(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"},child:[]}]})(t)}function jt(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"},child:[]}]})(t)}function Rn(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"},child:[]}]})(t)}function Zr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M18.41 16.59 13.82 12l4.59-4.59L17 6l-6 6 6 6zM6 6h2v12H6z"},child:[]},{tag:"path",attr:{fill:"none",d:"M24 24H0V0h24v24z"},child:[]}]})(t)}function Jr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M5.59 7.41 10.18 12l-4.59 4.59L7 18l6-6-6-6zM16 6h2v12h-2z"},child:[]}]})(t)}function Qr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"},child:[]}]})(t)}function Ja(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"},child:[]}]})(t)}function Rr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M17.65 6.35A7.958 7.958 0 0 0 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08A5.99 5.99 0 0 1 12 18c-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"},child:[]}]})(t)}function ei(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M12 5.83 15.17 9l1.41-1.41L12 3 7.41 7.59 8.83 9 12 5.83zm0 12.34L8.83 15l-1.41 1.41L12 21l4.59-4.59L15.17 15 12 18.17z"},child:[]}]})(t)}function ti(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"},child:[]}]})(t)}function Qa(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7s-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81 1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3c0 .24.04.47.09.7L8.04 9.81C7.5 9.31 6.79 9 6 9c-1.66 0-3 1.34-3 3s1.34 3 3 3c.79 0 1.5-.31 2.04-.81l7.12 4.16c-.05.21-.08.43-.08.65 0 1.61 1.31 2.92 2.92 2.92 1.61 0 2.92-1.31 2.92-2.92s-1.31-2.92-2.92-2.92z"},child:[]}]})(t)}function ni(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M14 4v5c0 1.12.37 2.16 1 3H9c.65-.86 1-1.9 1-3V4h4m3-2H7c-.55 0-1 .45-1 1s.45 1 1 1h1v5c0 1.66-1.34 3-3 3v2h5.97v7l1 1 1-1v-7H19v-2c-1.66 0-3-1.34-3-3V4h1c.55 0 1-.45 1-1s-.45-1-1-1z"},child:[]}]})(t)}const dn=({children:t,containerId:n,containerElement:s})=>{const a=En({containerId:n,containerElement:s});return a?Mt.createPortal(t,a):null},Ie=({icon:t,size:n="medium",color:s="primary",variant:a="filled","aria-label":r,sx:i,style:o,disabled:c=!1,badge:d,badgeColor:u="error",...p})=>{const f=`ui-icon-button ui-icon-button--${a} ui-icon-button--${n}`,m=o?.background||o?.backgroundColor||o?.color?"":`ui-icon-button--${s}`,g=`${f} ${m} ${c?"ui-icon-button--disabled":""}`.trim(),_=i?`${g} ${i}`.trim():g,y=d!=null&&d!=="",N=typeof d=="number"&&d>99?"99+":d,k=e.jsx("button",{type:"button",className:_,style:o,disabled:c,"aria-label":r,...p,children:t});return y?e.jsxs("span",{className:"ui-icon-button-wrapper",children:[k,e.jsx("span",{className:`ui-icon-button-badge ui-icon-button-badge--${u} ui-icon-button-badge--${n}`,children:N})]}):k},Ra="ui-kit-theme";function ai(){if(typeof window>"u")return"light";const t=localStorage.getItem(Ra);return t==="light"||t==="dark"?t:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function si(){const[t,n]=l.useState(ai);return l.useEffect(()=>{document.documentElement.dataset.theme=t,localStorage.setItem(Ra,t)},[t]),{theme:t,isDark:t==="dark",toggleTheme:()=>n(r=>r==="dark"?"light":"dark"),setTheme:r=>n(r)}}const ri='a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';function ea({enabled:t,containerRef:n,initialFocusRef:s,returnFocusOnCleanup:a=!0}){const r=l.useRef(null);l.useEffect(()=>{if(!t||!n.current)return;const i=n.current;r.current=document.activeElement;const o=()=>Array.from(i.querySelectorAll(ri)),c=o();c.length>0&&(s?.current?s.current.focus():c[0].focus());const d=u=>{if(u.key!=="Tab")return;const p=o();if(p.length===0)return;const f=p[0],h=p[p.length-1],m=document.activeElement;u.shiftKey?(m===f||!i.contains(m))&&(u.preventDefault(),h.focus()):(m===h||!i.contains(m))&&(u.preventDefault(),f.focus())};return i.addEventListener("keydown",d),()=>{i.removeEventListener("keydown",d),a&&r.current&&r.current.focus()}},[t,n,s,a])}function At({enabled:t,onEscape:n}){l.useEffect(()=>{if(!t)return;const s=a=>{a.key==="Escape"&&n()};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[t,n])}function zn({enabled:t,mediaQuery:n}){l.useEffect(()=>{const s=i=>{t&&i?(document.body.style.overflow="hidden",document.documentElement.style.overflow="hidden"):(document.body.style.overflow="",document.documentElement.style.overflow="")};if(!n)return s(t),()=>s(!1);const a=window.matchMedia(n);s(a.matches);const r=i=>s(i.matches);return a.addEventListener("change",r),()=>{a.removeEventListener("change",r),s(!1)}},[t,n])}const ta=({open:t,onClose:n,closeOnBackdropClick:s=!0,closeOnEscape:a=!0,showCloseButton:r=!0,size:i="medium",children:o,sx:c,style:d,backdropStyle:u,portalContainerId:p,initialFocusRef:f,returnFocusOnClose:h=!0,trapFocus:m=!0})=>{const v=l.useRef(null),g=l.useContext(bt),_=g?g.baseZ+Oa:Fa,y=l.useMemo(()=>({baseZ:_}),[_]);At({enabled:t&&a&&!!n,onEscape:n||(()=>{})}),zn({enabled:t}),ea({enabled:t&&m,containerRef:v,initialFocusRef:f,returnFocusOnCleanup:h});const N=S=>{s&&n&&S.target===S.currentTarget&&n()};if(!t)return null;const k=`ui-modal__content ui-modal__content--${i}`,$=c?`${k} ${c}`.trim():k;return e.jsx(dn,{containerId:p,children:e.jsx(bt.Provider,{value:y,children:e.jsx("div",{className:"ui-modal",style:{zIndex:_},children:e.jsx("div",{className:"ui-modal__backdrop",onClick:N,style:u,role:"presentation",children:e.jsxs("div",{ref:v,className:$,style:d,role:"dialog","aria-modal":"true",children:[r&&n&&e.jsx(Ie,{icon:e.jsx(jt,{}),onClick:n,"aria-label":"Close modal",sx:"ui-modal__close-button",variant:"ghost",color:"neutral",size:"medium"}),o]})})})})})},es=({open:t,onClose:n,closeOnBackdropClick:s=!0,closeOnEscape:a=!0,showCloseButton:r=!0,anchor:i="right",width:o="320px",height:c="100%",children:d,sx:u,style:p,backdropStyle:f,hideBackdrop:h=!1,portalContainerId:m,initialFocusRef:v,returnFocusOnClose:g=!0,trapFocus:_=!0,title:y})=>{const N=l.useRef(null),k=l.useContext(bt),$=k?k.baseZ+Oa:Fa,S=l.useMemo(()=>({baseZ:$}),[$]),[P,q]=l.useState(t),[Z,D]=l.useState(!1);l.useEffect(()=>{if(t)q(!0),D(!1);else if(P){D(!0);const re=setTimeout(()=>{q(!1),D(!1)},300);return()=>clearTimeout(re)}},[t]),At({enabled:t&&a&&!!n,onEscape:n||(()=>{})}),zn({enabled:t}),ea({enabled:t&&_,containerRef:N,initialFocusRef:v,returnFocusOnCleanup:g});const T=re=>{s&&n&&re.target===re.currentTarget&&n()};if(!P)return null;const ee={};i==="left"||i==="right"?ee.width=o:ee.height=c;const O=["ui-drawer__content",`ui-drawer__content--${i}`,Z&&`ui-drawer__content--exiting-${i}`].filter(Boolean).join(" "),Ne=u?`${O} ${u}`.trim():O,ue=y?"ui-drawer-title":void 0,Q=r&&n&&e.jsx(Ie,{icon:e.jsx(jt,{}),onClick:n,"aria-label":"Close drawer",sx:"ui-drawer__close-button",variant:"ghost",color:"neutral",size:"medium"});return e.jsx(dn,{containerId:m,children:e.jsx(bt.Provider,{value:S,children:e.jsx("div",{className:"ui-drawer",style:{zIndex:$},children:e.jsx("div",{className:"ui-drawer__backdrop",onClick:T,style:h?{...f,background:"transparent"}:f,role:"presentation",children:e.jsxs("div",{ref:N,className:Ne,style:{...ee,...p},role:"dialog","aria-modal":"true","aria-labelledby":ue,children:[y?e.jsxs("div",{className:"ui-drawer__header",children:[e.jsx("h2",{id:ue,className:"ui-drawer__title",children:y}),Q]}):Q,d]})})})})})},Ze=({title:t,placement:n="top",arrow:s=!1,children:a,sx:r})=>{if(!t)return a;const i=["ui-tooltip",`ui-tooltip--${n}`,r].filter(Boolean).join(" ");return e.jsxs("span",{className:i,children:[a,e.jsxs("span",{className:"ui-tooltip__content",role:"tooltip",children:[t,s&&e.jsx("span",{className:"ui-tooltip__arrow","aria-hidden":"true"})]})]})};Ze.displayName="Tooltip";function ii(){return e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5","aria-hidden":"true",children:e.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})}function li(){return e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5","aria-hidden":"true",children:e.jsx("path",{d:"M6 9l6 6 6-6"})})}function oi(){return e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("path",{d:"M21 21l-4.35-4.35"})]})}function ci({section:t,pending:n,onToggle:s}){const[a,r]=l.useState(t.initiallyOpen??!1),[i,o]=l.useState(""),[c,d]=l.useState(!1),u=t.showMoreLimit??8,p=i?t.options.filter(v=>v.label.toLowerCase().includes(i.toLowerCase())):t.options,f=!i&&p.length>u,h=f&&!c?p.slice(0,u):p,m=p.length-u;return e.jsxs("div",{className:`fp-collapsible${a?" fp-collapsible--open":""}`,children:[e.jsxs("button",{type:"button",className:"fp-collapsible__header",onClick:()=>r(v=>!v),"aria-expanded":a,children:[e.jsxs("span",{className:"fp-collapsible__title",children:[t.icon&&e.jsx("span",{className:"fp-collapsible__icon",children:t.icon}),t.title]}),e.jsxs("span",{className:"fp-collapsible__right",children:[n.length>0&&e.jsx("span",{className:"fp-collapsible__count",children:n.length}),e.jsx("span",{className:"fp-collapsible__arrow",children:e.jsx(li,{})})]})]}),e.jsxs("div",{className:"fp-collapsible__content",children:[t.showSearch&&e.jsx(Ft,{size:"small",fullWidth:!0,startAdornment:e.jsx(oi,{}),placeholder:`Search ${t.title.toLowerCase()}…`,value:i,onChange:v=>{const g=v.target.value;o(g),t.onSearch?.(g)},sx:{root:"fp-mini-search",wrapper:"fp-mini-search__wrapper"}}),e.jsx("div",{className:["fp-pill-grid",t.columns===3?"fp-pill-grid--cols3":"fp-pill-grid--cols2"].join(" "),children:h.map(v=>{const g=n.includes(v.value);return e.jsx(mt,{label:v.label,variant:"outlined",color:g?"primary":"neutral",size:"small",selected:g,onClick:()=>s(v.value),leadingIcon:v.icon?e.jsx("img",{src:v.icon,alt:"",className:"fp-pill__icon","aria-hidden":"true"}):void 0,sx:"fp-pill-chip"},v.value)})}),f&&e.jsx(Xe,{variant:"outlined",color:"neutral",size:"small",style:{width:"100%",marginTop:"0.35rem",border:"1px solid var(--palette-divider)"},onClick:()=>d(v=>!v),children:c?"Show less":`Show ${m} more…`})]})]})}function di({section:t,pending:n,onToggle:s}){return e.jsxs("div",{className:"fp-group",children:[e.jsx("div",{className:"fp-group__label",children:t.title}),e.jsx("div",{className:"fp-cards",children:t.options.map(a=>{const r=n.includes(a.value),i=a.color??"#94a3b8";return e.jsxs("button",{type:"button",className:`fp-card${r?" fp-card--active":""}`,style:{"--fp-card-color":i},onClick:()=>s(a.value),children:[e.jsx("span",{className:"fp-card__icon","aria-hidden":"true",children:a.icon?e.jsx("img",{src:a.icon,alt:""}):e.jsx("span",{className:"fp-card__icon-letter",children:a.label.charAt(0)})}),e.jsx("span",{className:"fp-card__label",children:a.label})]},a.value)})})]})}function ui({section:t,pending:n,onToggle:s}){return e.jsxs("div",{className:"fp-group",children:[e.jsx("div",{className:"fp-group__label",children:t.title}),e.jsx("div",{className:"fp-tiles",children:t.options.map(a=>{const r=n.includes(a.value);return e.jsxs("button",{type:"button",className:`fp-tile${r?" fp-tile--active":""}`,onClick:()=>s(a.value),children:[(a.iconNode??a.icon)&&e.jsx("span",{className:"fp-tile__icon","aria-hidden":"true",children:a.iconNode??a.icon}),e.jsx("span",{className:"fp-tile__label",children:a.label}),a.sublabel&&e.jsx("span",{className:"fp-tile__sublabel",children:a.sublabel})]},a.value)})})]})}function hi({sections:t,value:n,onChange:s,resultCount:a,isOpen:r,onClose:i,onReset:o}){zn({enabled:r,mediaQuery:"(max-width: 767px)"});const[c,d]=l.useState({});l.useEffect(()=>{if(!r)return;const _={};t.forEach(y=>{_[y.id]=[...n[y.id]??[]]}),d(_)},[r]);const u=l.useCallback((_,y)=>{d(N=>{const k=N[_]??[],$=k.includes(y)?k.filter(S=>S!==y):[...k,y];return{...N,[_]:$}})},[]),p=l.useCallback((_,y)=>{d(N=>({...N,[_]:(N[_]??[]).filter(k=>k!==y)}))},[]),f=()=>{s(c),i()},h=()=>{if(o)o();else{const _={};t.forEach(y=>{_[y.id]=[]}),d(_)}},m=()=>{const _={};t.forEach(y=>{_[y.id]=[...n[y.id]??[]]}),d(_),i()},v=t.flatMap(_=>_.disabled?[]:(c[_.id]??[]).map(y=>({sectionId:_.id,value:y,label:_.options.find(N=>N.value===y)?.label??y}))),g=v.length>0;return e.jsxs("aside",{className:`fp-panel${r?" fp-panel--open":""}`,"aria-label":"Filter panel","aria-hidden":!r,children:[e.jsxs("div",{className:"fp-header",children:[e.jsxs("div",{className:"fp-header__info",children:[e.jsx("span",{className:"fp-header__title",children:"Filters"}),a!==void 0&&e.jsxs("span",{className:"fp-header__count",children:[a," employees found"]})]}),e.jsx(Ie,{variant:"ghost",color:"neutral",size:"small",icon:e.jsx(ii,{}),"aria-label":"Close filters",onClick:m})]}),g&&e.jsx("div",{className:"fp-chips",children:v.map(_=>e.jsx(mt,{label:_.label,variant:"outlined",color:"primary",size:"small",onDelete:()=>p(_.sectionId,_.value)},`${_.sectionId}-${_.value}`))}),e.jsx("div",{className:"fp-content",children:t.map(_=>_.type==="cards"?e.jsx(di,{section:_,pending:c[_.id]??[],onToggle:y=>u(_.id,y)},_.id):_.type==="tiles"?e.jsx(ui,{section:_,pending:c[_.id]??[],onToggle:y=>u(_.id,y)},_.id):e.jsx(ci,{section:_,pending:c[_.id]??[],onToggle:y=>u(_.id,y)},_.id))}),e.jsxs("div",{className:"fp-footer",children:[e.jsx(Xe,{variant:"ghost",color:"neutral",onClick:h,disabled:!g,children:"Reset all"}),e.jsx(Xe,{variant:"filled",color:"primary",style:{flex:1},onClick:f,children:"Apply"})]})]})}function ot(t){return t.hour*60+t.minute}function Yt(t){const n=Math.max(0,Math.min(1439,t));return{hour:Math.floor(n/60),minute:n%60}}function yt(){return{min:{hour:0,minute:0},max:{hour:23,minute:59}}}function Et(t){if(t===null)return null;const n=yt(),s=t??{},a=s.min??n.min,r=s.max??n.max;return ot(a)>ot(r)?null:{min:a,max:r}}function un(t,n,s){const a=Math.max(1,Math.floor(s));if(t>n)return null;if(a===1)return t;let r=Math.floor(t/a)*a;return r<t&&(r+=a),r>n?null:r}function Wt(t,n,s,a){const r=ot(s.min),i=ot(s.max);let o=t*60+n;o=Math.max(r,Math.min(i,o));const c=Math.max(1,Math.floor(a));if(c===1)return Yt(o);const d=un(r,i,c);if(d===null)return Yt(r);if(o<=d)return Yt(d);const u=o-d,p=Math.ceil(u/c);let f=d+p*c;const h=Math.floor((i-d)/c),m=d+h*c;return f>i&&(f=m),Yt(Math.min(f,m))}function ts(t,n){const s=ot(t.min),a=ot(t.max),r=un(s,a,n);return r===null?null:Yt(r)}function ns(t,n){const s=ot(t.min),a=ot(t.max),r=Math.max(1,Math.floor(n)),i=new Set;if(r===1){for(let c=t.min.hour;c<=t.max.hour;c++)i.add(c);return[...i].sort((c,d)=>c-d)}const o=un(s,a,r);if(o===null)return[];for(let c=o;c<=a;c+=r)i.add(Math.floor(c/60));return[...i].sort((c,d)=>c-d)}function It(t,n,s){const a=ot(n.min),r=ot(n.max),i=Math.max(1,Math.floor(s)),o=[];if(i===1){const d=t===n.min.hour?n.min.minute:0,u=t===n.max.hour?n.max.minute:59;for(let p=d;p<=u;p++)o.push(p);return o}const c=un(a,r,i);if(c===null)return[];for(let d=c;d<=r;d+=i){const u=Yt(d);u.hour===t&&o.push(u.minute)}return o}function Bn(t,n,s,a){const r=t*60+n,i=ot(s.min),o=ot(s.max);if(r<i||r>o)return!1;const c=Math.max(1,Math.floor(a));if(c===1)return!0;const d=un(i,o,c);return d===null||r<d?!1:(r-d)%c===0}const hn=8,as="DD.MM.YYYY";function ss(t,n){return!n||t.includes("HH")&&t.includes("mm")?t:`${t} HH:mm`}const na=["January","February","March","April","May","June","July","August","September","October","November","December"],pi=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],mi=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],qe=(...t)=>t.filter(Boolean).join(" ");function Kt(t,n){return t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()&&t.getDate()===n.getDate()}function fi(t,n,s){const[a,r]=n<=s?[n,s]:[s,n];return t.getTime()>a.getTime()&&t.getTime()<r.getTime()}function pn(t,n){return new Date(t.getFullYear(),t.getMonth()+n,1)}function _i(t,n){const a=(new Date(t,n,1).getDay()+6)%7,r=[];for(let c=a;c>0;c--)r.push(new Date(t,n,1-c));const i=new Date(t,n+1,0).getDate();for(let c=1;c<=i;c++)r.push(new Date(t,n,c));let o=1;for(;r.length<42;)r.push(new Date(t,n+1,o++));return r}function Je(t,n=as){const s=String(t.getDate()).padStart(2,"0"),a=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getFullYear());return n.replace("DD",s).replace("MM",a).replace("YYYY",r)}function On(t,n){const s=String(t.getDate()).padStart(2,"0"),a=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getFullYear()),i=String(t.getHours()).padStart(2,"0"),o=String(t.getMinutes()).padStart(2,"0");return n.replace("YYYY",r).replace("DD",s).replace("MM",a).replace("HH",i).replace("mm",o)}function aa(t,n){if(t.length!==n.length)return null;const s=n.indexOf("DD"),a=n.indexOf("MM"),r=n.indexOf("YYYY");if(s<0||a<0||r<0)return null;const i=parseInt(t.slice(s,s+2),10),o=parseInt(t.slice(a,a+2),10)-1,c=parseInt(t.slice(r,r+4),10);if(isNaN(i)||isNaN(o)||isNaN(c))return null;const d=new Date(c,o,i);return d.getDate()!==i||d.getMonth()!==o||d.getFullYear()!==c?null:d}function gi(t,n){if(t.length!==n.length)return null;const s=n.indexOf("DD"),a=n.indexOf("MM"),r=n.indexOf("YYYY");if(s<0||a<0||r<0)return null;const i=parseInt(t.slice(s,s+2),10),o=parseInt(t.slice(a,a+2),10)-1,c=parseInt(t.slice(r,r+4),10);if(isNaN(i)||isNaN(o)||isNaN(c))return null;let d=0,u=0;const p=n.indexOf("HH"),f=n.indexOf("mm");if(p>=0&&f>=0&&(d=parseInt(t.slice(p,p+2),10),u=parseInt(t.slice(f,f+2),10),isNaN(d)||isNaN(u)||d<0||d>23||u<0||u>59))return null;const h=new Date(c,o,i,d,u,0,0);return h.getDate()!==i||h.getMonth()!==o||h.getFullYear()!==c?null:h}function sa(t,n){const s=t.replace(/\D/g,"").slice(0,8);if(!s.length)return"";let a="",r=0;for(let i=0;i<n.length;i++){const o=n[i];if(/[DMY]/.test(o)){if(r>=s.length)break;a+=s[r++]}else if(r<s.length)a+=o;else break}return a}function xi(t,n){const s=t.replace(/\D/g,"").slice(0,12);if(!s.length)return"";let a=0,r="",i=0;for(;i<n.length;)if(n.startsWith("YYYY",i)){for(let o=0;o<4&&a<s.length;o++)r+=s[a++];i+=4}else if(n.startsWith("DD",i)){if(a>=s.length||(r+=s[a++],a>=s.length))break;r+=s[a++],i+=2}else if(n.startsWith("MM",i)){if(a>=s.length||(r+=s[a++],a>=s.length))break;r+=s[a++],i+=2}else if(n.startsWith("HH",i)){if(a>=s.length||(r+=s[a++],a>=s.length))break;r+=s[a++],i+=2}else if(n.startsWith("mm",i)){if(a>=s.length||(r+=s[a++],a>=s.length))break;r+=s[a++],i+=2}else{if(a<s.length)r+=n[i];else break;i+=1}return r}const rs=(t,n,s)=>{const a=window.innerHeight-t.bottom-hn,r=t.top-hn,i=s>a&&r>a;let o=t.left;return o+n>window.innerWidth-8&&(o=Math.max(8,window.innerWidth-8-n)),i?{bottom:window.innerHeight-t.top+hn,left:o,maxHeight:Math.min(640,r)}:{top:t.bottom+hn,left:o,maxHeight:Math.min(640,a)}};function vi(t){return t==="single"?[{label:"Today",getValue:()=>new Date},{label:"Yesterday",getValue:()=>{const n=new Date;return n.setDate(n.getDate()-1),n}}]:[{label:"Today",getValue:()=>{const n=new Date;return{start:n,end:n}}},{label:"Yesterday",getValue:()=>{const n=new Date;return n.setDate(n.getDate()-1),{start:new Date(n),end:new Date(n)}}},{label:"This week",getValue:()=>{const n=new Date,s=(n.getDay()+6)%7,a=new Date(n.getFullYear(),n.getMonth(),n.getDate()-s),r=new Date(a.getFullYear(),a.getMonth(),a.getDate()+6);return{start:a,end:r}}},{label:"Last week",getValue:()=>{const n=new Date,s=(n.getDay()+6)%7,a=new Date(n.getFullYear(),n.getMonth(),n.getDate()-s-7),r=new Date(a.getFullYear(),a.getMonth(),a.getDate()+6);return{start:a,end:r}}},{label:"This month",getValue:()=>{const n=new Date,s=new Date(n.getFullYear(),n.getMonth(),1),a=new Date(n.getFullYear(),n.getMonth()+1,0);return{start:s,end:a}}},{label:"Last month",getValue:()=>{const n=new Date,s=new Date(n.getFullYear(),n.getMonth()-1,1),a=new Date(n.getFullYear(),n.getMonth(),0);return{start:s,end:a}}}]}function is(){return e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[e.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),e.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),e.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),e.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]})}function ra(){return e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:e.jsx("path",{d:"m15 18-6-6 6-6"})})}function ia(){return e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:e.jsx("path",{d:"m9 18 6-6-6-6"})})}const la=l.forwardRef(({mode:t="single",value:n,onChange:s,rangeValue:a,onRangeChange:r,triggerVariant:i="input",format:o=as,placeholder:c,minDate:d,maxDate:u,disabledDates:p,disabledDaysOfWeek:f,isDateDisabled:h,showTime:m=!1,timeStep:v=1,getTimeBounds:g,presets:_,showPresets:y=!1,multiMonth:N,label:k,helperText:$,error:S=!1,disabled:P=!1,required:q=!1,size:Z="normal",fullWidth:D=!1,startAdornment:T,endAdornment:ee,sx:O,style:Ne,id:ue,onFocus:Q,onBlur:re,...je},ye)=>{const R=l.useId(),X=ue||`${R}-input`,b=new Date;b.setHours(0,0,0,0);const I=N??t==="range",H=y?_??vi(t):[],W=ss(o,!!(m&&t==="single")),V=n!==void 0,ve=a!==void 0,[w,te]=l.useState(null),[ie,he]=l.useState({start:null,end:null}),z=V?n??null:w,le=ve?a??ie:ie,$e=z?.getTime()??null,Pe=Math.max(1,Math.floor(v)),pe=l.useMemo(()=>{if(!m||t!=="single")return;if(!z)return"no-date";const E=new Date(z.getFullYear(),z.getMonth(),z.getDate());return g?Et(g(E)):"full"},[m,t,z,g]),Ce=l.useMemo(()=>{if(pe===void 0||pe==="no-date")return[];const E=pe==="full"?yt():pe;return E?ns(E,Pe):[]},[pe,Pe]),[_e,He]=l.useState(!1),[M,G]=l.useState(null),[ae,j]=l.useState(!1),B=()=>t==="single"&&z?new Date(z.getFullYear(),z.getMonth(),1):t==="range"&&le.start?new Date(le.start.getFullYear(),le.start.getMonth(),1):new Date(b.getFullYear(),b.getMonth(),1),[U,J]=l.useState(B),[ke,C]=l.useState("days"),[de,fe]=l.useState(()=>b.getFullYear()-4),[Se,we]=l.useState(null),[F,oe]=l.useState(null),[ge,be]=l.useState(()=>t==="single"&&z?z.getHours():0),[Ae,We]=l.useState(()=>t==="single"&&z?z.getMinutes():0),ht=l.useMemo(()=>{if(pe===void 0||pe==="no-date")return[];const E=pe==="full"?yt():pe;return E?It(ge,E,Pe):[]},[pe,Pe,ge]),Ke=l.useRef(!1),[ct,Qe]=l.useState(()=>t==="single"&&z?m?On(z,ss(o,m)):Je(z,o):""),[gt,xt]=l.useState(()=>le.start?Je(le.start,o):""),[Re,tt]=l.useState(()=>le.end?Je(le.end,o):""),at=l.useRef(null),Fe=l.useRef(null),et=l.useRef(null),Xt=l.useContext(bt),nt=Xt?Xt.baseZ+ln:void 0,st=l.useRef(null),Be=l.useCallback(E=>{if(d){const A=new Date(d.getFullYear(),d.getMonth(),d.getDate());if(E<A)return!0}if(u){const A=new Date(u.getFullYear(),u.getMonth(),u.getDate());if(E>A)return!0}if(f?.includes(E.getDay())||p?.some(A=>Kt(A,E))||h?.(E))return!0;if(m&&g){const A=new Date(E.getFullYear(),E.getMonth(),E.getDate());if(Et(g(A))===null)return!0}return!1},[d,u,f,p,h,m,g]),Ye=l.useCallback(()=>{He(!1),we(null),oe(null),C("days")},[]),kt=l.useCallback(()=>{P||(t==="single"&&z?J(new Date(z.getFullYear(),z.getMonth(),1)):t==="range"&&le.start&&J(new Date(le.start.getFullYear(),le.start.getMonth(),1)),He(!0))},[P,t,z,le]);At({enabled:_e,onEscape:Ye}),l.useEffect(()=>{if(!_e){G(null),j(!1);return}const E=at.current;if(!E)return;const A=E.getBoundingClientRect();G({top:A.bottom+hn,left:A.left,maxHeight:640}),j(!1);const me=Oe=>{!at.current?.contains(Oe.target)&&!Fe.current?.contains(Oe.target)&&Ye()};setTimeout(()=>document.addEventListener("mousedown",me),0);const ce=()=>{if(!Fe.current||!at.current)return;const Oe=at.current.getBoundingClientRect();G(rs(Oe,Fe.current.offsetWidth,Fe.current.offsetHeight))};return window.addEventListener("scroll",ce,!0),window.addEventListener("resize",ce),()=>{window.removeEventListener("scroll",ce,!0),window.removeEventListener("resize",ce),document.removeEventListener("mousedown",me)}},[_e,Ye]),l.useEffect(()=>{if(t!=="single"||!m||$e==null)return;const E=new Date($e),A=new Date(E.getFullYear(),E.getMonth(),E.getDate()),me=g?Et(g(A)):yt();if(!me)return;const ce=Wt(E.getHours(),E.getMinutes(),me,Pe);be(ce.hour),We(ce.minute)},[t,m,$e,g,Pe]),l.useLayoutEffect(()=>{if(!_e||!ae)return;const E=et.current?.querySelector(`[data-time-value="${ge}"]`),A=st.current?.querySelector(`[data-time-value="${Ae}"]`);E?.scrollIntoView({block:"nearest"}),A?.scrollIntoView({block:"nearest"})},[ge,Ae,_e,ae]),l.useLayoutEffect(()=>{if(!_e||ae||!Fe.current||!at.current)return;const E=at.current.getBoundingClientRect();G(rs(E,Fe.current.offsetWidth,Fe.current.offsetHeight)),j(!0)},[_e,M,ae]),l.useEffect(()=>{Ke.current||t==="single"&&Qe(z?m?On(z,W):Je(z,o):"")},[z,o,W,m,t]),l.useEffect(()=>{Ke.current||(xt(le.start?Je(le.start,o):""),tt(le.end?Je(le.end,o):""))},[le.start,le.end,o]);const xn=l.useCallback(E=>{if(!Be(E))if(Ke.current=!1,t==="single")if(m){const A=new Date(E.getFullYear(),E.getMonth(),E.getDate()),me=g?Et(g(A)):yt();if(!me)return;const ce=ts(me,Pe);if(!ce)return;const Oe=new Date(A.getFullYear(),A.getMonth(),A.getDate(),ce.hour,ce.minute);be(ce.hour),We(ce.minute),V||te(Oe),s?.(Oe)}else{const A=new Date(E.getFullYear(),E.getMonth(),E.getDate());V||te(A),s?.(A),Ye()}else if(!Se)we(new Date(E.getFullYear(),E.getMonth(),E.getDate()));else{const A=Se,me=new Date(E.getFullYear(),E.getMonth(),E.getDate()),ce=A<=me?{start:A,end:me}:{start:me,end:A};ve||he(ce),r?.(ce),we(null),Ye()}},[t,m,Pe,g,Se,V,ve,s,r,Ye,Be]),Ht=l.useCallback(E=>{const A=E.getValue();if(A instanceof Date){let me=A;if(m&&g){const ce=new Date(me.getFullYear(),me.getMonth(),me.getDate()),Oe=Et(g(ce));if(Oe){const dt=Wt(me.getHours(),me.getMinutes(),Oe,Pe);me=new Date(ce.getFullYear(),ce.getMonth(),ce.getDate(),dt.hour,dt.minute)}}V||te(me),s?.(me)}else{const me=A;ve||he(me),r?.(me),me.start&&J(new Date(me.start.getFullYear(),me.start.getMonth(),1))}Ye()},[V,ve,s,r,Ye,m,g,Pe]),Zt=l.useCallback(E=>{if(E.stopPropagation(),Ke.current=!1,t==="single")Qe(""),V||te(null),s?.(null);else{xt(""),tt("");const A={start:null,end:null};ve||he(A),r?.(A),we(null)}},[t,V,ve,s,r]),vn=l.useCallback(E=>{const A=m?xi(E.target.value,W):sa(E.target.value,o);Qe(A);const me=m?W.length:o.length;if(A.length===me){const ce=m?gi(A,W):aa(A,o);if(ce&&!Be(ce)){if(m){const Oe=new Date(ce.getFullYear(),ce.getMonth(),ce.getDate()),dt=g?Et(g(Oe)):yt();if(!dt||!Bn(ce.getHours(),ce.getMinutes(),dt,Pe))return;be(ce.getHours()),We(ce.getMinutes())}V||te(ce),s?.(ce),J(new Date(ce.getFullYear(),ce.getMonth(),1))}}else A.length===0&&(V||te(null),s?.(null))},[o,W,m,Pe,g,V,s,Be]),Jt=l.useCallback(E=>{const A=sa(E.target.value,o);if(xt(A),A.length===o.length){const me=aa(A,o);if(me&&!Be(me)){const ce={start:me,end:le.end};ve||he(ce),r?.(ce),J(new Date(me.getFullYear(),me.getMonth(),1))}}},[o,le.end,ve,r,Be]),bn=l.useCallback(E=>{const A=sa(E.target.value,o);if(tt(A),A.length===o.length){const me=aa(A,o);if(me&&!Be(me)){const ce={start:le.start,end:me};ve||he(ce),r?.(ce)}}},[o,le.start,ve,r,Be]),pt=l.useCallback(E=>{const A=E.relatedTarget;Fe.current?.contains(A)||at.current?.contains(A)||(Ke.current=!1,Qe(z?m?On(z,W):Je(z,o):""),xt(le.start?Je(le.start,o):""),tt(le.end?Je(le.end,o):""))},[z,le.start,le.end,o,m,W]),Qt=l.useCallback(()=>{if(t==="single"&&z){const E=new Date(z.getFullYear(),z.getMonth(),z.getDate()),A=g?Et(g(E)):yt();if(!A){Ye();return}const me=Wt(ge,Ae,A,Pe),ce=new Date(z.getFullYear(),z.getMonth(),z.getDate(),me.hour,me.minute);V||te(ce),s?.(ce)}Ye()},[t,z,ge,Ae,V,s,Ye,g,Pe]),jn=(()=>{if(t==="single")return z?m?On(z,W):Je(z,o):"";const{start:E,end:A}=le;return E&&A?`${Je(E,o)} – ${Je(A,o)}`:E?`${Je(E,o)} – ...`:""})(),yn=t==="single"?!!z:!!(le.start||le.end),kn=(E,A)=>{const me=Be(E),ce=E.getMonth()!==A,Oe=Kt(E,b);let dt=!1,Ge=!1,Bt=!1,Mn=!1;if(t==="single"&&z&&(dt=Kt(E,z)),t==="range"){const x=Se??le.start,L=Se?F??null:le.end;x&&Kt(E,x)&&(Ge=!0),L&&Kt(E,L)&&(Bt=!0),x&&L&&fi(E,x,L)&&(Mn=!0)}return qe("ui-datepicker__day",ce&&"ui-datepicker__day--outside",Oe&&"ui-datepicker__day--today",me&&"ui-datepicker__day--disabled",dt&&"ui-datepicker__day--selected",(Ge||Bt)&&"ui-datepicker__day--range-cap",Ge&&"ui-datepicker__day--range-start",Bt&&"ui-datepicker__day--range-end",Mn&&"ui-datepicker__day--in-range")},Ue=(E,A,me)=>{const ce=E.getFullYear(),Oe=E.getMonth(),dt=_i(ce,Oe);return e.jsxs("div",{className:"ui-datepicker__calendar",children:[e.jsxs("div",{className:"ui-datepicker__nav",children:[e.jsx("button",{type:"button",className:qe("ui-datepicker__nav-btn",!A&&"ui-datepicker__nav-btn--hidden"),onClick:()=>{J(pn(U,-1)),C("days")},disabled:!A,"aria-label":"Previous month",children:e.jsx(ra,{})}),e.jsxs("button",{type:"button",className:"ui-datepicker__nav-title",onClick:()=>C(ke==="days"?"months":"days"),"aria-label":`${na[Oe]} ${ce}. Click to choose month`,children:[na[Oe]," ",ce]}),e.jsx("button",{type:"button",className:qe("ui-datepicker__nav-btn",!me&&"ui-datepicker__nav-btn--hidden"),onClick:()=>{J(pn(U,1)),C("days")},disabled:!me,"aria-label":"Next month",children:e.jsx(ia,{})})]}),e.jsx("div",{className:"ui-datepicker__weekdays","aria-hidden":"true",children:mi.map(Ge=>e.jsx("span",{className:"ui-datepicker__weekday",children:Ge},Ge))}),e.jsx("div",{className:"ui-datepicker__grid",role:"grid","aria-label":`${na[Oe]} ${ce}`,children:dt.map((Ge,Bt)=>e.jsx("button",{type:"button",role:"gridcell",className:kn(Ge,Oe),disabled:Be(Ge),"aria-label":Je(Ge),"aria-pressed":t==="single"&&z?Kt(Ge,z):void 0,onClick:()=>xn(Ge),onMouseEnter:()=>{t==="range"&&Se&&oe(new Date(Ge.getFullYear(),Ge.getMonth(),Ge.getDate()))},onMouseLeave:()=>{t==="range"&&Se&&oe(null)},tabIndex:-1,children:Ge.getDate()},Bt))})]},`${ce}-${Oe}`)},wn=()=>e.jsxs("div",{className:"ui-datepicker__calendar ui-datepicker__calendar--picker",children:[e.jsxs("div",{className:"ui-datepicker__nav",children:[e.jsx("button",{type:"button",className:"ui-datepicker__nav-btn",onClick:()=>J(pn(U,-12)),"aria-label":"Previous year",children:e.jsx(ra,{})}),e.jsx("button",{type:"button",className:"ui-datepicker__nav-title",onClick:()=>C("years"),"aria-label":`${U.getFullYear()}. Click to choose year`,children:U.getFullYear()}),e.jsx("button",{type:"button",className:"ui-datepicker__nav-btn",onClick:()=>J(pn(U,12)),"aria-label":"Next year",children:e.jsx(ia,{})})]}),e.jsx("div",{className:"ui-datepicker__month-grid",children:pi.map((E,A)=>e.jsx("button",{type:"button",className:qe("ui-datepicker__month-cell",U.getMonth()===A&&"ui-datepicker__month-cell--active",b.getFullYear()===U.getFullYear()&&b.getMonth()===A&&"ui-datepicker__month-cell--today"),onClick:()=>{J(new Date(U.getFullYear(),A,1)),C("days")},children:E},A))})]}),Nn=()=>{const E=Array.from({length:12},(A,me)=>de+me);return e.jsxs("div",{className:"ui-datepicker__calendar ui-datepicker__calendar--picker",children:[e.jsxs("div",{className:"ui-datepicker__nav",children:[e.jsx("button",{type:"button",className:"ui-datepicker__nav-btn",onClick:()=>fe(A=>A-12),"aria-label":"Previous years",children:e.jsx(ra,{})}),e.jsxs("span",{className:"ui-datepicker__nav-title ui-datepicker__nav-title--static",children:[de," – ",de+11]}),e.jsx("button",{type:"button",className:"ui-datepicker__nav-btn",onClick:()=>fe(A=>A+12),"aria-label":"Next years",children:e.jsx(ia,{})})]}),e.jsx("div",{className:"ui-datepicker__year-grid",children:E.map(A=>e.jsx("button",{type:"button",className:qe("ui-datepicker__year-cell",U.getFullYear()===A&&"ui-datepicker__year-cell--active",b.getFullYear()===A&&"ui-datepicker__year-cell--today"),onClick:()=>{J(new Date(A,U.getMonth(),1)),fe(A-4),C("months")},children:A},A))})]})},Cn=()=>{const E=A=>{if(pe===void 0||pe==="no-date")return;const me=pe==="full"?yt():pe;if(!me)return;const ce=It(A,me,Pe);be(A),We(Oe=>ce.includes(Oe)?Oe:ce[0]??0)};return pe==="no-date"?e.jsxs("aside",{className:"ui-datepicker__time-sidebar","aria-label":"Time",children:[e.jsx("p",{className:"ui-datepicker__time-empty",children:"Select a date"}),e.jsx("button",{type:"button",className:"ui-datepicker__apply-btn",disabled:!0,children:"Apply"})]}):pe===null||Ce.length===0?e.jsxs("aside",{className:"ui-datepicker__time-sidebar","aria-label":"Time",children:[e.jsx("p",{className:"ui-datepicker__time-empty",children:"No available times"}),e.jsx("button",{type:"button",className:"ui-datepicker__apply-btn",disabled:!0,children:"Apply"})]}):e.jsxs("aside",{className:"ui-datepicker__time-sidebar","aria-label":"Time",children:[e.jsxs("div",{className:"ui-datepicker__time-columns",children:[e.jsxs("div",{className:"ui-datepicker__time-scroll-col",children:[e.jsx("span",{className:"ui-datepicker__time-scroll-head",id:`${R}-hour-col`,children:"Hr"}),e.jsx("div",{ref:et,className:"ui-datepicker__time-scroll-list",role:"listbox","aria-labelledby":`${R}-hour-col`,children:Ce.map(A=>e.jsx("button",{type:"button",className:qe("ui-datepicker__time-scroll-item",ge===A&&"ui-datepicker__time-scroll-item--selected"),"data-time-value":A,role:"option","aria-selected":ge===A,tabIndex:-1,onClick:()=>E(A),children:String(A).padStart(2,"0")},A))})]}),e.jsxs("div",{className:"ui-datepicker__time-scroll-col",children:[e.jsx("span",{className:"ui-datepicker__time-scroll-head",id:`${R}-min-col`,children:"Min"}),e.jsx("div",{ref:st,className:"ui-datepicker__time-scroll-list",role:"listbox","aria-labelledby":`${R}-min-col`,children:ht.map(A=>e.jsx("button",{type:"button",className:qe("ui-datepicker__time-scroll-item",Ae===A&&"ui-datepicker__time-scroll-item--selected"),"data-time-value":A,role:"option","aria-selected":Ae===A,tabIndex:-1,onClick:()=>We(A),children:String(A).padStart(2,"0")},A))})]})]}),e.jsx("button",{type:"button",className:"ui-datepicker__apply-btn",onClick:Qt,children:"Apply"})]})},zt=pn(U,1),Rt=()=>e.jsx("div",{ref:Fe,className:qe("ui-datepicker__popup",O?.popup),style:{position:"fixed",top:M?.top,bottom:M?.bottom,left:M?.left,maxHeight:M?.maxHeight,visibility:ae?"visible":"hidden",...nt!==void 0?{zIndex:nt}:null},onClick:E=>E.stopPropagation(),onMouseDown:E=>E.stopPropagation(),role:"dialog","aria-label":"Choose date","aria-modal":"true",children:e.jsxs("div",{className:"ui-datepicker__popup-inner",children:[H.length>0&&e.jsx("div",{className:"ui-datepicker__presets",children:H.map((E,A)=>e.jsx("button",{type:"button",className:"ui-datepicker__preset-btn",onClick:()=>Ht(E),children:E.label},A))}),e.jsxs("div",{className:qe("ui-datepicker__body",m&&t==="single"&&ke==="days"&&"ui-datepicker__body--with-time"),children:[ke==="days"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"ui-datepicker__calendars-block",children:[e.jsxs("div",{className:qe("ui-datepicker__calendars",I&&"ui-datepicker__calendars--two"),children:[Ue(U,!0,!I),I&&Ue(zt,!1,!0)]}),t==="range"&&e.jsx("p",{className:"ui-datepicker__range-hint",children:Se?"Select end date":le.start&&le.end?`${Je(le.start,o)} – ${Je(le.end,o)}`:"Select start date"})]}),m&&t==="single"&&Cn()]}),ke==="months"&&wn(),ke==="years"&&Nn()]})]})}),wt=yn&&!P&&e.jsx("button",{type:"button",className:"ui-datepicker__clear-btn",onClick:Zt,onMouseDown:E=>E.preventDefault(),"aria-label":"Clear date",tabIndex:-1,children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round","aria-hidden":"true",focusable:"false",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),en=e.jsx("button",{type:"button",className:qe("ui-datepicker__input-icon-btn",_e&&"ui-datepicker__input-icon-btn--open"),tabIndex:-1,disabled:P,onMouseDown:E=>E.preventDefault(),onClick:_e?Ye:kt,"aria-label":"Open calendar",children:e.jsx(is,{})}),tn=E=>{Ke.current=!0,kt(),Q?.(E)},Y=E=>{pt(E),re?.(E)},xe=qe("ui-datepicker__input",`ui-datepicker__input--${Z}`,O?.input),Me=qe("ui-datepicker__input","ui-datepicker__input--range",`ui-datepicker__input--${Z}`,O?.input),De={disabled:P,required:q,"aria-expanded":_e,"aria-haspopup":"dialog","aria-invalid":S,onFocus:tn,onBlur:Y},Le=()=>e.jsxs(e.Fragment,{children:[k&&e.jsxs("label",{htmlFor:X,className:qe("ui-datepicker__label",S&&"ui-datepicker__label--error",O?.label),children:[k,q&&e.jsx("span",{className:"ui-datepicker__label-required",children:"*"})]}),e.jsxs("div",{className:qe("ui-datepicker__input-wrapper",`ui-datepicker__input-wrapper--${Z}`,t==="range"&&"ui-datepicker__input-wrapper--range",S&&"ui-datepicker__input-wrapper--error",P&&"ui-datepicker__input-wrapper--disabled",_e&&"ui-datepicker__input-wrapper--open",!!T&&"ui-datepicker__input-wrapper--with-start-adornment",!!ee&&"ui-datepicker__input-wrapper--with-end-adornment",O?.wrapper),children:[T&&e.jsx("span",{className:"ui-datepicker__adornment ui-datepicker__adornment--start",children:T}),t==="single"?e.jsx("input",{...je,ref:ye,id:X,type:"text",inputMode:"numeric",className:xe,value:ct,placeholder:c??(m?W:o),"aria-label":k??c??"Select date",onChange:vn,...De}):e.jsxs(e.Fragment,{children:[e.jsx("input",{...je,ref:ye,id:X,type:"text",inputMode:"numeric",className:Me,value:gt,placeholder:o,"aria-label":"Start date",onChange:Jt,...De}),e.jsx("span",{className:"ui-datepicker__range-sep","aria-hidden":"true",children:"–"}),e.jsx("input",{type:"text",inputMode:"numeric",className:Me,value:Re,placeholder:o,"aria-label":"End date",onChange:bn,...De})]}),ee&&e.jsx("span",{className:"ui-datepicker__adornment ui-datepicker__adornment--end",children:ee}),wt,en]})]}),nn=()=>e.jsx("button",{type:"button",className:qe("ui-datepicker__icon-trigger",_e&&"ui-datepicker__icon-trigger--open",P&&"ui-datepicker__icon-trigger--disabled"),disabled:P,onClick:_e?Ye:kt,"aria-label":jn||"Select date","aria-expanded":_e,"aria-haspopup":"dialog",children:e.jsx(is,{})});return e.jsxs("div",{ref:at,className:qe("ui-datepicker",D&&"ui-datepicker--full-width",O?.root),style:Ne,children:[i==="input"?Le():nn(),$&&i==="input"&&e.jsx("p",{className:qe("ui-datepicker__helper-text",S&&"ui-datepicker__helper-text--error",O?.helperText),children:$}),_e&&M&&Mt.createPortal(Rt(),document.body)]})});la.displayName="DatePicker";const mn=8,bi="HH:mm",ft=(...t)=>t.filter(Boolean).join(" ");function ut(t,n,s){const a=t??new Date;return new Date(a.getFullYear(),a.getMonth(),a.getDate(),n,s,0,0)}function it(t,n){const s=String(t.getHours()).padStart(2,"0"),a=String(t.getMinutes()).padStart(2,"0");return n.replace("HH",s).replace("mm",a)}function oa(t,n){if(t.length!==n.length)return null;const s=n.indexOf("HH"),a=n.indexOf("mm");if(s<0||a<0)return null;const r=parseInt(t.slice(s,s+2),10),i=parseInt(t.slice(a,a+2),10);return isNaN(r)||isNaN(i)||r<0||r>23||i<0||i>59?null:{hour:r,minute:i}}function ca(t,n){const s=t.replace(/\D/g,"").slice(0,4);if(!s.length)return"";let a=0,r="",i=0;for(;i<n.length;)if(n.startsWith("HH",i)||n.startsWith("mm",i)){if(a>=s.length||(r+=s[a++],a>=s.length))break;r+=s[a++],i+=2}else{if(a<s.length)r+=n[i];else break;i+=1}return r}const ls=(t,n,s)=>{const a=window.innerHeight-t.bottom-mn,r=t.top-mn,i=s>a&&r>a;let o=t.left;return o+n>window.innerWidth-8&&(o=Math.max(8,window.innerWidth-8-n)),i?{bottom:window.innerHeight-t.top+mn,left:o,maxHeight:Math.min(420,r)}:{top:t.bottom+mn,left:o,maxHeight:Math.min(420,a)}};function os(){return e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}),e.jsx("polyline",{points:"12 7 12 12 15.5 14"})]})}const cs=l.forwardRef(({mode:t="single",value:n,onChange:s,rangeValue:a,onRangeChange:r,triggerVariant:i="input",format:o=bi,placeholder:c,timeStep:d=1,bounds:u,label:p,helperText:f,error:h=!1,disabled:m=!1,required:v=!1,size:g="normal",fullWidth:_=!1,startAdornment:y,endAdornment:N,sx:k,style:$,id:S,onFocus:P,onBlur:q,...Z},D)=>{const T=l.useId(),ee=S||`${T}-input`,O=Math.max(1,Math.floor(d)),Ne=n!==void 0,ue=a!==void 0,[Q,re]=l.useState(null),[je,ye]=l.useState({start:null,end:null}),R=Ne?n??null:Q,X=ue?a??je:je,b=l.useMemo(()=>Et(u),[u]),I=u===null||b===null,H=b??yt(),W=l.useMemo(()=>I?[]:ns(H,O),[I,H,O]),[V,ve]=l.useState(!1),[w,te]=l.useState(null),[ie,he]=l.useState(!1),z=R?.getHours()??W[0]??0,le=R?.getMinutes()??0,[$e,Pe]=l.useState(z),[pe,Ce]=l.useState(le),_e=l.useMemo(()=>I?[]:It($e,H,O),[I,H,O,$e]),[He,M]=l.useState(X.start?.getHours()??W[0]??0),[G,ae]=l.useState(X.start?.getMinutes()??0),[j,B]=l.useState(X.end?.getHours()??W[W.length-1]??0),[U,J]=l.useState(X.end?.getMinutes()??0),ke=l.useMemo(()=>I?[]:It(He,H,O),[I,H,O,He]),C=l.useMemo(()=>I?[]:It(j,H,O),[I,H,O,j]),de=l.useRef(!1),[fe,Se]=l.useState(()=>R?it(R,o):""),[we,F]=l.useState(()=>X.start?it(X.start,o):""),[oe,ge]=l.useState(()=>X.end?it(X.end,o):""),be=l.useRef(null),Ae=l.useRef(null),We=l.useContext(bt),ht=We?We.baseZ+ln:void 0,Ke=l.useRef(null),ct=l.useRef(null),Qe=l.useRef(null),gt=l.useRef(null),xt=l.useRef(null),Re=l.useRef(null),tt=l.useCallback(()=>{ve(!1)},[]),at=l.useCallback(()=>{m||ve(!0)},[m]);At({enabled:V,onEscape:tt}),l.useEffect(()=>{if(!V){te(null),he(!1);return}const Y=be.current;if(!Y)return;const xe=Y.getBoundingClientRect();te({top:xe.bottom+mn,left:xe.left,maxHeight:420}),he(!1);const Me=Le=>{!be.current?.contains(Le.target)&&!Ae.current?.contains(Le.target)&&tt()};setTimeout(()=>document.addEventListener("mousedown",Me),0);const De=()=>{if(!Ae.current||!be.current)return;const Le=be.current.getBoundingClientRect();te(ls(Le,Ae.current.offsetWidth,Ae.current.offsetHeight))};return window.addEventListener("scroll",De,!0),window.addEventListener("resize",De),()=>{window.removeEventListener("scroll",De,!0),window.removeEventListener("resize",De),document.removeEventListener("mousedown",Me)}},[V,tt]),l.useLayoutEffect(()=>{if(!V||ie||!Ae.current||!be.current)return;const Y=be.current.getBoundingClientRect();te(ls(Y,Ae.current.offsetWidth,Ae.current.offsetHeight)),he(!0)},[V,w,ie]),l.useLayoutEffect(()=>{if(!V||!ie)return;const Y=xe=>xe?.scrollIntoView({block:"center"});t==="single"?(Y(Ke.current?.querySelector(`[data-time-value="${$e}"]`)),Y(ct.current?.querySelector(`[data-time-value="${pe}"]`))):(Y(Qe.current?.querySelector(`[data-time-value="${He}"]`)),Y(gt.current?.querySelector(`[data-time-value="${G}"]`)),Y(xt.current?.querySelector(`[data-time-value="${j}"]`)),Y(Re.current?.querySelector(`[data-time-value="${U}"]`)))},[V,ie,t,$e,pe,He,G,j,U]),l.useEffect(()=>{if(t!=="single"||!R||I)return;const Y=Wt(R.getHours(),R.getMinutes(),H,O);Pe(Y.hour),Ce(Y.minute)},[t,R,I,H,O]),l.useEffect(()=>{if(t==="range"&&!I){if(X.start){const Y=Wt(X.start.getHours(),X.start.getMinutes(),H,O);M(Y.hour),ae(Y.minute)}if(X.end){const Y=Wt(X.end.getHours(),X.end.getMinutes(),H,O);B(Y.hour),J(Y.minute)}}},[t,X.start,X.end,I,H,O]),l.useEffect(()=>{de.current||t==="single"&&Se(R?it(R,o):"")},[R,o,t]),l.useEffect(()=>{de.current||t==="range"&&(F(X.start?it(X.start,o):""),ge(X.end?it(X.end,o):""))},[t,X.start,X.end,o]);const Fe=l.useCallback(Y=>{Ne||re(Y),s?.(Y)},[Ne,s]),et=l.useCallback(Y=>{ue||ye(Y),r?.(Y)},[ue,r]),Xt=Y=>{if(I)return;de.current=!1;const xe=It(Y,H,O),Me=xe.includes(pe)?pe:xe[0]??0;Pe(Y),Ce(Me),Fe(ut(R,Y,Me))},nt=Y=>{I||(de.current=!1,Ce(Y),Fe(ut(R,$e,Y)))},st=(Y,xe)=>{if(I)return;de.current=!1;const Me=It(xe,H,O);if(Y==="start"){const De=Me.includes(G)?G:Me[0]??0;M(xe),ae(De),Ye("start",xe,De)}else{const De=Me.includes(U)?U:Me[0]??0;B(xe),J(De),Ye("end",xe,De)}},Be=(Y,xe)=>{I||(de.current=!1,Y==="start"?(ae(xe),Ye("start",He,xe)):(J(xe),Ye("end",j,xe)))},Ye=(Y,xe,Me)=>{if(Y==="start"){const De=ut(X.start,xe,Me);let Le=X.end;Le&&Le.getTime()<De.getTime()&&(Le=ut(Le,xe,Me),B(xe),J(Me)),et({start:De,end:Le})}else{const De=X.start;let Le=ut(X.end??X.start,xe,Me);De&&Le.getTime()<De.getTime()&&(Le=ut(Le,De.getHours(),De.getMinutes()),B(De.getHours()),J(De.getMinutes())),et({start:De,end:Le})}},kt=l.useCallback(Y=>{Y.stopPropagation(),de.current=!1,t==="single"?(Se(""),Fe(null)):(F(""),ge(""),et({start:null,end:null}))},[t,Fe,et]),xn=l.useCallback(Y=>{const xe=ca(Y.target.value,o);if(Se(xe),xe.length===o.length){const Me=oa(xe,o);if(!Me||!I&&!Bn(Me.hour,Me.minute,H,O))return;Fe(ut(R,Me.hour,Me.minute))}else xe.length===0&&Fe(null)},[o,I,H,O,Fe,R]),Ht=l.useCallback(Y=>{const xe=ca(Y.target.value,o);if(F(xe),xe.length===o.length){const Me=oa(xe,o);if(!Me||!I&&!Bn(Me.hour,Me.minute,H,O))return;const De=ut(X.start,Me.hour,Me.minute);let Le=X.end;Le&&Le.getTime()<De.getTime()&&(Le=ut(Le,De.getHours(),De.getMinutes())),et({start:De,end:Le})}},[o,I,H,O,X.start,X.end,et]),Zt=l.useCallback(Y=>{const xe=ca(Y.target.value,o);if(ge(xe),xe.length===o.length){const Me=oa(xe,o);if(!Me||!I&&!Bn(Me.hour,Me.minute,H,O))return;let De=ut(X.end??X.start,Me.hour,Me.minute);const Le=X.start;Le&&De.getTime()<Le.getTime()&&(De=ut(De,Le.getHours(),Le.getMinutes())),et({start:X.start,end:De})}},[o,I,H,O,X.start,X.end,et]),vn=l.useCallback(Y=>{const xe=Y.relatedTarget;Ae.current?.contains(xe)||be.current?.contains(xe)||(de.current=!1,Se(R?it(R,o):""),F(X.start?it(X.start,o):""),ge(X.end?it(X.end,o):""))},[R,X.start,X.end,o]),Jt=(()=>{if(t==="single")return R?it(R,o):"";const{start:Y,end:xe}=X;return Y&&xe?`${it(Y,o)} – ${it(xe,o)}`:Y?`${it(Y,o)} – ...`:""})(),bn=t==="single"?!!R:!!(X.start||X.end),pt=(Y,xe,Me,De,Le,nn)=>e.jsxs("div",{className:"ui-timepicker__col",children:[e.jsx("span",{className:"ui-timepicker__col-head",id:Y,children:xe}),e.jsx("div",{ref:nn,className:"ui-timepicker__col-list",role:"listbox","aria-labelledby":Y,children:Me.map(E=>e.jsx("button",{type:"button",className:ft("ui-timepicker__col-item",De===E&&"ui-timepicker__col-item--selected"),"data-time-value":E,role:"option","aria-selected":De===E,tabIndex:-1,onClick:()=>Le(E),children:String(E).padStart(2,"0")},E))})]}),Qt=()=>e.jsx("div",{className:"ui-timepicker__empty",children:e.jsx("p",{children:"No available times"})}),jn=()=>I||W.length===0?Qt():e.jsx("div",{className:"ui-timepicker__body",children:e.jsx("div",{className:"ui-timepicker__group",children:e.jsxs("div",{className:"ui-timepicker__columns",children:[pt(`${T}-hr`,"Hour",W,$e,Xt,Ke),pt(`${T}-min`,"Minute",_e,pe,nt,ct)]})})}),yn=()=>I||W.length===0?Qt():e.jsxs("div",{className:"ui-timepicker__body ui-timepicker__body--range",children:[e.jsxs("div",{className:"ui-timepicker__group",children:[e.jsx("span",{className:"ui-timepicker__group-label",children:"From"}),e.jsxs("div",{className:"ui-timepicker__columns",children:[pt(`${T}-shr`,"Hour",W,He,Y=>st("start",Y),Qe),pt(`${T}-smin`,"Minute",ke,G,Y=>Be("start",Y),gt)]})]}),e.jsxs("div",{className:"ui-timepicker__group",children:[e.jsx("span",{className:"ui-timepicker__group-label",children:"To"}),e.jsxs("div",{className:"ui-timepicker__columns",children:[pt(`${T}-ehr`,"Hour",W,j,Y=>st("end",Y),xt),pt(`${T}-emin`,"Minute",C,U,Y=>Be("end",Y),Re)]})]})]}),kn=()=>e.jsx("div",{ref:Ae,className:ft("ui-timepicker__popup",k?.popup),style:{position:"fixed",top:w?.top,bottom:w?.bottom,left:w?.left,maxHeight:w?.maxHeight,visibility:ie?"visible":"hidden",...ht!==void 0?{zIndex:ht}:null},onClick:Y=>Y.stopPropagation(),onMouseDown:Y=>Y.stopPropagation(),role:"dialog","aria-label":"Choose time","aria-modal":"true",children:e.jsx("div",{className:"ui-timepicker__popup-inner",children:t==="single"?jn():yn()})}),Ue=bn&&!m&&e.jsx("button",{type:"button",className:"ui-timepicker__clear-btn",onClick:kt,onMouseDown:Y=>Y.preventDefault(),"aria-label":"Clear time",tabIndex:-1,children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round","aria-hidden":"true",focusable:"false",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),wn=e.jsx("button",{type:"button",className:ft("ui-timepicker__icon-btn",V&&"ui-timepicker__icon-btn--open"),tabIndex:-1,disabled:m,onMouseDown:Y=>Y.preventDefault(),onClick:V?tt:at,"aria-label":"Open time picker",children:e.jsx(os,{})}),Nn=Y=>{de.current=!0,at(),P?.(Y)},Cn=Y=>{vn(Y),q?.(Y)},zt=ft("ui-timepicker__input",`ui-timepicker__input--${g}`,k?.input),Rt=ft("ui-timepicker__input","ui-timepicker__input--range",`ui-timepicker__input--${g}`,k?.input),wt={disabled:m,required:v,"aria-expanded":V,"aria-haspopup":"dialog","aria-invalid":h,onFocus:Nn,onBlur:Cn},en=()=>e.jsxs(e.Fragment,{children:[p&&e.jsxs("label",{htmlFor:ee,className:ft("ui-timepicker__label",h&&"ui-timepicker__label--error",k?.label),children:[p,v&&e.jsx("span",{className:"ui-timepicker__label-required",children:"*"})]}),e.jsxs("div",{className:ft("ui-timepicker__input-wrapper",`ui-timepicker__input-wrapper--${g}`,t==="range"&&"ui-timepicker__input-wrapper--range",h&&"ui-timepicker__input-wrapper--error",m&&"ui-timepicker__input-wrapper--disabled",V&&"ui-timepicker__input-wrapper--open",!!y&&"ui-timepicker__input-wrapper--with-start-adornment",!!N&&"ui-timepicker__input-wrapper--with-end-adornment",k?.wrapper),children:[y&&e.jsx("span",{className:"ui-timepicker__adornment ui-timepicker__adornment--start",children:y}),t==="single"?e.jsx("input",{...Z,ref:D,id:ee,type:"text",inputMode:"numeric",className:zt,value:fe,placeholder:c??o,"aria-label":p??c??"Select time",onChange:xn,...wt}):e.jsxs(e.Fragment,{children:[e.jsx("input",{...Z,ref:D,id:ee,type:"text",inputMode:"numeric",className:Rt,value:we,placeholder:o,"aria-label":"Start time",onChange:Ht,...wt}),e.jsx("span",{className:"ui-timepicker__range-sep","aria-hidden":"true",children:"–"}),e.jsx("input",{type:"text",inputMode:"numeric",className:Rt,value:oe,placeholder:o,"aria-label":"End time",onChange:Zt,...wt})]}),N&&e.jsx("span",{className:"ui-timepicker__adornment ui-timepicker__adornment--end",children:N}),Ue,wn]})]}),tn=()=>e.jsx("button",{type:"button",className:ft("ui-timepicker__icon-trigger",V&&"ui-timepicker__icon-trigger--open",m&&"ui-timepicker__icon-trigger--disabled"),disabled:m,onClick:V?tt:at,"aria-label":Jt||"Select time","aria-expanded":V,"aria-haspopup":"dialog",children:e.jsx(os,{})});return l.useEffect(()=>{if(!V||t!=="single"||R||I)return;const Y=ts(H,O);Y&&(Pe(Y.hour),Ce(Y.minute))},[V,t,R,I,H,O]),e.jsxs("div",{ref:be,className:ft("ui-timepicker",_&&"ui-timepicker--full-width",k?.root),style:$,children:[i==="input"?en():tn(),f&&i==="input"&&e.jsx("p",{className:ft("ui-timepicker__helper-text",h&&"ui-timepicker__helper-text--error",k?.helperText),children:f}),V&&w&&Mt.createPortal(kn(),document.body)]})});cs.displayName="TimePicker";const da=({checked:t,defaultChecked:n,onChange:s,label:a,color:r="primary",size:i="medium",isIndeterminate:o=!1,isDisabled:c=!1,name:d,value:u,id:p,sx:f,style:h})=>{const m=l.useRef(null);l.useEffect(()=>{m.current&&(m.current.indeterminate=o)},[o]);const v=["ui-checkbox",`ui-checkbox--${r}`,`ui-checkbox--${i}`,c&&"ui-checkbox--disabled",f].filter(Boolean).join(" "),g=_=>{c||s?.(_.target.checked,_)};return e.jsxs("label",{className:v,style:h,children:[e.jsx("input",{ref:m,type:"checkbox",className:"ui-checkbox__input",checked:t,defaultChecked:n,disabled:c,name:d,value:u,id:p,onChange:g,"aria-checked":o?"mixed":t}),e.jsx("span",{className:"ui-checkbox__box","aria-hidden":"true",children:o?e.jsx("svg",{className:"ui-checkbox__mark",viewBox:"0 0 12 12",focusable:"false",children:e.jsx("line",{x1:"2",y1:"6",x2:"10",y2:"6",strokeWidth:"2",strokeLinecap:"round"})}):e.jsx("svg",{className:"ui-checkbox__mark",viewBox:"0 0 12 12",focusable:"false",children:e.jsx("polyline",{points:"1.5,6 4.5,9 10.5,3",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})})}),a!=null&&e.jsx("span",{className:"ui-checkbox__label",children:a})]})};da.displayName="Checkbox";const ds=l.createContext(null),us=l.createContext(null),hs=()=>{const t=l.useContext(ds);if(!t)throw new Error("AccordionTrigger/AccordionContent must be inside AccordionRoot");return t},ps=()=>{const t=l.useContext(us);if(!t)throw new Error("AccordionTrigger/AccordionContent must be inside AccordionItem");return t},ua=({children:t,variant:n="outlined",size:s="medium",allowMultiple:a=!1,defaultOpenIds:r=[],onToggle:i,divider:o=!0,sx:c,style:d})=>{const[u,p]=l.useState(new Set(r)),f=l.useCallback(m=>{p(v=>{const g=new Set(v),_=g.has(m);return _?g.delete(m):(a||g.clear(),g.add(m)),i?.(m,!_),g})},[a,i]),h=["ui-accordion",`ui-accordion--${n}`,`ui-accordion--${s}`,o&&"ui-accordion--divider",c].filter(Boolean).join(" ");return e.jsx(ds.Provider,{value:{openIds:u,toggle:f},children:e.jsx("div",{className:h,style:d,children:t})})};ua.displayName="AccordionRoot";const ha=({id:t,children:n,isDisabled:s=!1,sx:a,style:r})=>{const{openIds:i}=hs(),o=i.has(t),c=["ui-accordion__item",o&&"ui-accordion__item--open",s&&"ui-accordion__item--disabled",a].filter(Boolean).join(" ");return e.jsx(us.Provider,{value:{itemId:t,isOpen:o,isDisabled:s},children:e.jsx("div",{className:c,style:r,children:n})})};ha.displayName="AccordionItem";const pa=({children:t,showChevron:n=!0,startAdornment:s,endAdornment:a,sx:r,style:i})=>{const{toggle:o}=hs(),{itemId:c,isOpen:d,isDisabled:u}=ps(),p=["ui-accordion__trigger",r].filter(Boolean).join(" "),f=!!(s||a),h=n&&e.jsx("span",{className:["ui-accordion__chevron",d&&"ui-accordion__chevron--open"].filter(Boolean).join(" "),"aria-hidden":"true",children:e.jsx(Rn,{})}),m=e.jsxs("button",{className:p,type:"button","aria-expanded":d,"aria-controls":`accordion-content-${c}`,id:`accordion-header-${c}`,disabled:u,onClick:()=>o(c),style:i,children:[t,!f&&h]});if(!f)return m;const v=g=>g.stopPropagation();return e.jsxs("div",{className:"ui-accordion__header",children:[s&&e.jsx("div",{className:"ui-accordion__adornment ui-accordion__adornment--start",onClick:v,children:s}),m,a&&e.jsx("div",{className:"ui-accordion__adornment ui-accordion__adornment--end",onClick:v,children:a}),h&&e.jsx("span",{className:"ui-accordion__chevron-wrap",onClick:()=>!u&&o(c),"aria-hidden":"true",children:h})]})};pa.displayName="AccordionTrigger";const ma=({children:t,sx:n,style:s})=>{const{itemId:a}=ps(),r=["ui-accordion__content-inner",n].filter(Boolean).join(" ");return e.jsx("div",{id:`accordion-content-${a}`,role:"region","aria-labelledby":`accordion-header-${a}`,className:"ui-accordion__content",children:e.jsx("div",{className:r,style:s,children:t})})};ma.displayName="AccordionContent";const ms=({items:t,...n})=>e.jsx(ua,{...n,children:t.map(s=>e.jsxs(ha,{id:s.id,isDisabled:s.isDisabled,children:[e.jsxs(pa,{children:[s.icon&&e.jsx("span",{className:"ui-accordion__item-icon",children:s.icon}),e.jsx("span",{className:"ui-accordion__title",children:s.title})]}),e.jsx(ma,{children:s.content})]},s.id))});ms.displayName="Accordion";function ji(t,n){return n}function yi(t,n){const s=t[n];return s==null||s===""?"-":s}function fn(t){if(t!==void 0)return typeof t=="number"?`${t}px`:t}function ki({row:t,rowIndex:n,visibleCols:s,tdClasses:a,stickyStyles:r,onRowClick:i,onKeyDown:o}){return e.jsx("tr",{className:"ui-table__tr",tabIndex:i?0:void 0,role:i?"button":void 0,onClick:i?()=>i(t,n):void 0,onKeyDown:o?c=>o(c,t,n):void 0,children:s.map((c,d)=>e.jsx("td",{className:a[d],style:r[d],children:c.render?c.render(t,n):yi(t,c.key)},c.key))})}const wi=l.memo(ki),ze=4,fs=80,Ni=({x:t,anchorTop:n,anchorBottom:s,items:a,onClose:r,portalNode:i,boundsRect:o})=>{const c=l.useRef(null),[d,u]=l.useState({left:t,top:s}),[p,f]=l.useState(()=>a.findIndex(v=>!v.disabled));At({enabled:!0,onEscape:r}),l.useLayoutEffect(()=>{const v=c.current;if(!v)return;v.style.maxHeight="";const g=v.getBoundingClientRect();let _=t-g.width,y=s,N;o&&g.width<=o.width?(_+g.width>o.right-ze&&(_=o.right-g.width-ze),_<o.left+ze&&(_=o.left+ze)):(_+g.width>window.innerWidth-ze&&(_=window.innerWidth-g.width-ze),_<ze&&(_=ze));const k=window.innerHeight-s-ze,$=n-ze;g.height<=k?y=s:g.height<=$?y=n-g.height:k>=$?(y=s,N=Math.max(fs,k)):(N=Math.max(fs,$),y=n-N),u({left:_,top:y,maxHeight:N})},[t,n,s,o]),l.useEffect(()=>{const v=_=>{c.current&&!c.current.contains(_.target)&&r()},g=()=>r();return document.addEventListener("pointerdown",v,!0),window.addEventListener("scroll",g,!0),window.addEventListener("resize",g),()=>{document.removeEventListener("pointerdown",v,!0),window.removeEventListener("scroll",g,!0),window.removeEventListener("resize",g)}},[r]),l.useEffect(()=>{c.current?.focus()},[]);const h=v=>{if(a.length===0)return;let g=p;for(let _=0;_<a.length;_+=1)if(g=(g+v+a.length)%a.length,!a[g].disabled){f(g);return}},m=v=>{if(v.key==="ArrowDown")v.preventDefault(),h(1);else if(v.key==="ArrowUp")v.preventDefault(),h(-1);else if(v.key==="Enter"||v.key===" "){v.preventDefault();const g=a[p];g&&!g.disabled&&(g.onSelect(),r())}};return i?Mt.createPortal(e.jsx("div",{ref:c,className:"ui-table__ctxmenu",role:"menu",tabIndex:-1,style:{left:d.left,top:d.top,maxHeight:d.maxHeight,overflowY:d.maxHeight?"auto":void 0},onKeyDown:m,onContextMenu:v=>v.preventDefault(),children:a.map((v,g)=>e.jsx("div",{role:"menuitem","aria-disabled":v.disabled||void 0,className:["ui-table__ctxmenu-item",v.disabled&&"ui-table__ctxmenu-item--disabled",g===p&&!v.disabled&&"ui-table__ctxmenu-item--focused"].filter(Boolean).join(" "),onMouseEnter:()=>!v.disabled&&f(g),onClick:v.disabled?void 0:()=>{v.onSelect(),r()},children:v.label},v.key))}),i):null},_s=120,gs=36,Ci=8,Mi=({x:t,anchorTop:n,anchorBottom:s,columns:a,pinnedKeys:r,hiddenKeys:i,visibleCount:o,canPin:c,canHide:d,canReorder:u,onTogglePin:p,onToggleHide:f,onUnpinAll:h,onShowAll:m,onReset:v,onReorder:g,hasUnpinnablePinned:_,hasHiddenColumns:y,labels:N,onClose:k,portalNode:$,boundsRect:S})=>{const P=l.useRef(null),q=l.useRef(null),[Z,D]=l.useState({left:t,top:s}),[T,ee]=l.useState(null),[O,Ne]=l.useState(!1),ue=l.useRef(null);At({enabled:!0,onEscape:k}),l.useLayoutEffect(()=>{const M=P.current;if(!M)return;M.style.maxHeight="";const G=M.getBoundingClientRect();let ae=t-G.width,j=s,B;S&&G.width<=S.width?(ae+G.width>S.right-ze&&(ae=S.right-G.width-ze),ae<S.left+ze&&(ae=S.left+ze)):(ae+G.width>window.innerWidth-ze&&(ae=window.innerWidth-G.width-ze),ae<ze&&(ae=ze));const U=window.innerHeight-s-ze,J=n-ze;G.height<=U?j=s:G.height<=J?j=n-G.height:U>=J?(j=s,B=Math.max(_s,U)):(B=Math.max(_s,J),j=n-B),D({left:ae,top:j,maxHeight:B})},[t,n,s,S]);const Q=l.useCallback((M,G)=>{const ae=P.current,j=ae?.offsetWidth??0,B=ae?.offsetHeight??0,U=Math.max(ze,window.innerWidth-j-ze),J=Math.max(ze,window.innerHeight-B-ze);return{left:Math.min(Math.max(ze,M),U),top:Math.min(Math.max(ze,G),J)}},[]);l.useEffect(()=>{const M=j=>{P.current&&!P.current.contains(j.target)&&k()},G=j=>{const B=P.current;B&&B.contains(j.target)||k()},ae=()=>{if(T){ee(j=>j&&Q(j.left,j.top));return}k()};return document.addEventListener("pointerdown",M,!0),window.addEventListener("scroll",G,!0),window.addEventListener("resize",ae),()=>{document.removeEventListener("pointerdown",M,!0),window.removeEventListener("scroll",G,!0),window.removeEventListener("resize",ae)}},[k,T,Q]);const re=l.useCallback(M=>{if(M.button!==0||M.target.closest('button, a, input, [role="button"]'))return;const ae=P.current;if(!ae)return;const j=ae.getBoundingClientRect();ue.current={pointerX:M.clientX,pointerY:M.clientY,left:j.left,top:j.top},M.currentTarget.setPointerCapture(M.pointerId),Ne(!0),ee({left:j.left,top:j.top})},[]),je=l.useCallback(M=>{const G=ue.current;if(!G)return;const ae=Q(G.left+(M.clientX-G.pointerX),G.top+(M.clientY-G.pointerY));ee(j=>j&&j.left===ae.left&&j.top===ae.top?j:ae)},[Q]),ye=l.useCallback(M=>{if(ue.current){ue.current=null;try{M.currentTarget.releasePointerCapture(M.pointerId)}catch{}Ne(!1)}},[]),R=l.useMemo(()=>new Set(r),[r]),X=l.useMemo(()=>new Set(i),[i]),[b,I]=l.useState(null),[H,W]=l.useState(null),[V,ve]=l.useState(null),w=l.useRef(0),te=l.useRef(0),ie=l.useCallback(()=>{if(te.current)return;const M=()=>{const G=w.current,ae=q.current;if(!G||!ae){te.current=0;return}ae.scrollTop+=G*Ci,te.current=requestAnimationFrame(M)};te.current=requestAnimationFrame(M)},[]),he=l.useCallback(()=>{w.current=0,te.current&&(cancelAnimationFrame(te.current),te.current=0)},[]);l.useEffect(()=>()=>he(),[he]);const z=l.useCallback((M,G)=>R.has(M)===R.has(G),[R]),le=l.useCallback((M,G)=>{M.dataTransfer.effectAllowed="move";try{M.dataTransfer.setData("text/plain",G)}catch{}I(G)},[]),$e=l.useCallback((M,G,ae)=>{if(!b||b===G||ae.alwaysPinned)return;const j=q.current;if(j){const ke=j.getBoundingClientRect();M.clientY<ke.top+gs?(w.current=-1,ie()):M.clientY>ke.bottom-gs?(w.current=1,ie()):w.current=0}if(!z(b,G)){M.preventDefault(),M.dataTransfer.dropEffect="none",W({key:G,position:"before"});return}M.preventDefault(),M.dataTransfer.dropEffect="move";const B=M.currentTarget.getBoundingClientRect(),U=B.top+B.height/2,J=M.clientY<U?"before":"after";W(ke=>ke&&ke.key===G&&ke.position===J?ke:{key:G,position:J})},[b,z,ie]),Pe=l.useCallback(M=>{M.preventDefault(),b&&H&&z(b,H.key)&&b!==H.key&&g(b,H.key,H.position),I(null),W(null),he()},[b,H,z,g,he]),pe=l.useCallback(()=>{I(null),W(null),he()},[he]),Ce=l.useCallback((M,G)=>{if(M.key===" "||M.key==="Enter"){M.preventDefault(),ve(B=>B===G?null:G);return}if(M.key==="Escape"){V===G&&(M.preventDefault(),ve(null));return}if(V!==G||M.key!=="ArrowUp"&&M.key!=="ArrowDown")return;M.preventDefault();const ae=M.key==="ArrowUp"?-1:1,j=a.findIndex(B=>B.key===G);if(j!==-1)for(let B=j+ae;B>=0&&B<a.length;B+=ae){const U=a[B];if(!U.alwaysPinned&&z(G,U.key)){g(G,U.key,ae===-1?"before":"after");return}}},[a,V,z,g]);if(!$)return null;const _e=T?T.left:Z.left,He=T?T.top:Z.top;return Mt.createPortal(e.jsxs("div",{ref:P,className:["ui-table__manage",O&&"ui-table__manage--dragging"].filter(Boolean).join(" "),role:"dialog","aria-label":N.manageTitle,style:{left:_e,top:He,...Z.maxHeight!==void 0&&!T?{maxHeight:Z.maxHeight}:null},children:[e.jsxs("div",{className:"ui-table__manage-header",onPointerDown:re,onPointerMove:je,onPointerUp:ye,onPointerCancel:ye,children:[e.jsx("span",{className:"ui-table__manage-title",children:N.manageTitle}),e.jsx(Ie,{sx:"ui-table__manage-close",icon:e.jsx(jt,{}),size:"small",variant:"ghost",color:"neutral",onClick:k,"aria-label":N.close,title:N.close})]}),e.jsx("div",{ref:q,className:"ui-table__manage-list",role:"group","aria-label":N.manageTitle,onDragLeave:M=>{M.currentTarget===M.target&&W(null)},children:a.map(M=>{const G=typeof M.label=="string"?M.label:M.key,ae=X.has(M.key),j=!ae,B=R.has(M.key),U=B?Br:ni,J=u&&!M.alwaysPinned,ke=b===M.key,C=V===M.key,de=H?.key===M.key,fe=de&&b!==null&&!z(b,M.key),Se=!c||!!M.alwaysPinned||ae,we=!d||!!M.alwaysVisible||j&&o<=1,F=M.alwaysPinned?N.lockedHint:ae?N.pin:B?N.unpin:N.pin,oe=["ui-table__manage-item",!J&&"ui-table__manage-item--locked",ke&&"ui-table__manage-item--dragging",C&&"ui-table__manage-item--lifted",de&&!fe&&H?.position==="before"&&"ui-table__manage-item--drop-before",de&&!fe&&H?.position==="after"&&"ui-table__manage-item--drop-after",de&&fe&&"ui-table__manage-item--drop-forbidden"].filter(Boolean).join(" ");return e.jsxs("div",{className:oe,onDragOver:b?ge=>$e(ge,M.key,M):void 0,onDrop:b?Pe:void 0,children:[u&&e.jsx("button",{type:"button",className:"ui-table__manage-handle","aria-label":N.dragHandle,title:M.alwaysPinned?N.lockedHint:N.dragHandle,disabled:!J,"aria-pressed":C||void 0,draggable:J,onDragStart:J?ge=>le(ge,M.key):void 0,onDragEnd:pe,onKeyDown:J?ge=>Ce(ge,M.key):void 0,children:e.jsx($r,{"aria-hidden":"true"})}),e.jsx("div",{className:"ui-table__manage-item-main",children:e.jsx(da,{size:"small",checked:j,isDisabled:we,onChange:()=>f(M.key),label:G})}),c&&e.jsx(Ie,{sx:["ui-table__manage-pin",Se&&"ui-table__manage-pin--locked"].filter(Boolean).join(" "),icon:e.jsx(U,{}),size:"small",variant:"ghost",color:B?"primary":"neutral",onClick:()=>p(M.key),disabled:Se,"aria-pressed":B,"aria-label":F,title:F})]},M.key)})}),e.jsxs("div",{className:"ui-table__manage-footer",children:[(_||y)&&e.jsxs("div",{className:"ui-table__manage-footer-row",children:[_&&e.jsx(Xe,{variant:"outlined",size:"small",color:"neutral",onClick:h,children:N.unpinAll}),y&&e.jsx(Xe,{variant:"outlined",size:"small",color:"neutral",onClick:m,children:N.showAll})]}),e.jsx(Xe,{variant:"text",size:"small",color:"primary",onClick:v,sx:"ui-table__manage-reset",children:N.reset})]})]}),$)},Di=120;function xs(t,n=Di){let s=null,a=0;const r=o=>{s=o,a&&window.clearTimeout(a),o?a=window.setTimeout(()=>{s=null,a=0},n):a=0},i=[];for(const o of t){const c=()=>{if(s&&s!==o)return;r(o);const d=o.scrollLeft;for(const u of t)u!==o&&u.scrollLeft!==d&&(u.scrollLeft=d)};o.addEventListener("scroll",c,{passive:!0}),i.push({src:o,handler:c})}return{lockTo:o=>r(o),dispose:()=>{a&&window.clearTimeout(a);for(const{src:o,handler:c}of i)o.removeEventListener("scroll",c)}}}function Si(t,n,s){const a=t.filter(i=>i!==n);let r=0;for(let i=0;i<a.length;i+=1)s.has(a[i])&&(r=i+1);return a.splice(r,0,n),a}function fa(t,n,s,a,r){const i=t.filter(d=>d!==n),o=s.indexOf(n);let c=i.length;for(let d=0;d<i.length;d+=1){const u=i[d];if(a.has(u)===r&&s.indexOf(u)>o){c=d;break}}return i.splice(c,0,n),i}function Ei(t,n,s,a,r){if(n===s||r(n)!==r(s))return null;const i=t.indexOf(n);if(i===-1)return null;const o=t.slice();o.splice(i,1);let c=o.indexOf(s);return c===-1?null:(a==="after"&&(c+=1),o.splice(c,0,n),o)}function $i(t){if(!t)return window;let n=t.parentElement;for(;n&&n!==document.body&&n!==document.documentElement;){const a=getComputedStyle(n).overflowY;if((a==="auto"||a==="scroll"||a==="overlay")&&n.scrollHeight>n.clientHeight)return n;n=n.parentElement}return window}function Li(t,n){const s=t!==void 0?t:n;return s===!1||s===void 0?{enabled:!1,pin:!1,hide:!1,reorder:!1,manage:!1}:s===!0?{enabled:!0,pin:!0,hide:!0,reorder:!0,manage:!0}:{enabled:!0,pin:s.pin!==!1,hide:s.hide!==!1,reorder:s.reorder!==!1,manage:s.manage!==!1}}function vs({columns:t,data:n,isLoading:s=!1,hasBorder:a=!0,hasRowDividers:r=!0,hasColumnDividers:i=!1,isStriped:o=!1,size:c="medium",variant:d="filled",color:u="default",radius:p="md",visibleColumns:f,stickyColumns:h,columnMenu:m,enableColumnMenu:v,defaultStickyColumns:g,defaultHiddenColumns:_,columnOrder:y,defaultColumnOrder:N,onStickyColumnsChange:k,onHiddenColumnsChange:$,onColumnOrderChange:S,columnMenuLabels:P,columnMenuDefaults:q,sorting:Z,onSort:D,footer:T,onRowClick:ee,rowKey:O=ji,minWidth:Ne,height:ue,maxHeight:Q,stickyHeaderOffset:re,stickyFooterOffset:je,emptyState:ye="No data to display",loadingState:R="Loading…",sx:X,style:b}){const I=re!==void 0,H=je!==void 0&&T!==void 0&&T!==null,W=I||H,V=l.useMemo(()=>Li(m,v),[m,v]),ve=h!==void 0,w=f!==void 0,te=y!==void 0,[ie,he]=l.useState(()=>g??[]),[z,le]=l.useState(()=>new Set(_??[])),[$e,Pe]=l.useState(()=>N??[]),pe=l.useMemo(()=>{if(w){const x=new Set;for(const[L,K]of Object.entries(f))K===!1&&x.add(L);return x}return z},[w,f,z]),Ce=l.useMemo(()=>{const x=new Set,L=[];for(const K of t)K.alwaysPinned&&!x.has(K.key)&&(x.add(K.key),L.push(K.key));if(ve)for(const K of h){const se=t[K];se&&!x.has(se.key)&&(x.add(se.key),L.push(se.key))}else for(const K of ie)x.has(K)||(x.add(K),L.push(K));return L},[ve,h,t,ie]),_e=l.useMemo(()=>new Set(Ce),[Ce]),He=l.useMemo(()=>{const x=new Set;for(const L of t)L.alwaysVisible&&x.add(L.key);return x},[t]),M=l.useMemo(()=>{const x=new Set;for(const L of t)L.alwaysPinned&&x.add(L.key);return x},[t]),G=l.useMemo(()=>t.map(x=>x.key),[t]),ae=l.useCallback(x=>He.has(x)?!1:pe.has(x),[He,pe]),j=l.useMemo(()=>{const x=te?y:$e,L=[],K=new Set;for(const se of x)M.has(se)||G.includes(se)&&(K.has(se)||(K.add(se),L.push(se)));for(const se of t)se.alwaysPinned||K.has(se.key)||(K.add(se.key),L.push(se.key));return L},[te,y,$e,t,M,G]),B=l.useMemo(()=>{const x=new Map;for(const K of t)x.set(K.key,K);const L=[];for(const K of t)K.alwaysPinned&&L.push(K);for(const K of j){const se=x.get(K);se&&!se.alwaysPinned&&L.push(se)}return L},[t,j]),U=l.useMemo(()=>{const x=B.filter(se=>!ae(se.key));if(Ce.length===0)return x;const L=[],K=[];for(const se of x)_e.has(se.key)?L.push(se):K.push(se);return[...L,...K]},[B,ae,Ce,_e]),J=l.useMemo(()=>{const x=[];return U.forEach((L,K)=>{_e.has(L.key)&&x.push(K)}),x},[U,_e]),ke=l.useMemo(()=>new Set(J),[J]),C=J.length>0?J[J.length-1]:-1,de=l.useRef(null),fe=l.useRef(null),Se=l.useRef(null),we=l.useRef(null),F=l.useRef(null),oe=l.useRef(null),ge=l.useRef(null),be=l.useRef([]),Ae=l.useRef(null),[We,ht]=l.useState(new Map),[Ke,ct]=l.useState(!1),[Qe,gt]=l.useState(0),xt=En(),[Re,tt]=l.useState(null),at=l.useCallback(()=>tt(null),[]),[Fe,et]=l.useState(null),Xt=l.useCallback(()=>et(null),[]),nt=l.useCallback(x=>{ve||he(x),k?.(x)},[ve,k]),st=l.useCallback(x=>{w||le(x),$?.(Array.from(x))},[w,$]),Be=l.useCallback(x=>{te||Pe(x),S?.(x)},[te,S]),Ye=l.useCallback(x=>{if(_e.has(x))return;const L=[...Ce,x],K=new Set(L);nt(L),Be(Si(j,x,K))},[Ce,_e,j,nt,Be]),kt=l.useCallback(x=>{if(!_e.has(x)||M.has(x))return;const L=Ce.filter(se=>se!==x),K=new Set(L);nt(L),Be(fa(j,x,G,K,!1))},[Ce,_e,M,j,G,nt,Be]),xn=l.useCallback(()=>{if(Ce.length===0)return;const x=Ce.filter(L=>M.has(L));x.length!==Ce.length&&nt(x)},[Ce,M,nt]),Ht=l.useCallback(x=>{if(He.has(x)||pe.has(x))return;let L=0;for(const se of t)if(se.key!==x&&!pe.has(se.key)&&(L+=1,L>0))break;if(L===0)return;const K=new Set(pe);if(K.add(x),_e.has(x)&&!M.has(x)){const se=Ce.filter(Ot=>Ot!==x),Te=new Set(se);nt(se),Be(fa(j,x,G,Te,!1))}st(K)},[t,He,M,pe,_e,Ce,j,G,nt,st,Be]),Zt=l.useCallback(x=>{if(!pe.has(x))return;const L=new Set(pe);L.delete(x);const K=_e.has(x);Be(fa(j,x,G,_e,K)),st(L)},[pe,_e,j,G,st,Be]),vn=l.useCallback(()=>{st(new Set)},[st]),Jt=l.useMemo(()=>{const x=[];for(const L of t)ae(L.key)&&x.push(L.key);return x},[t,ae]),bn=Jt.length,pt=l.useCallback((x,L)=>{if(!V.enabled)return;x.preventDefault(),x.stopPropagation();const K=x.currentTarget.getBoundingClientRect(),se=de.current?.getBoundingClientRect()??null;et(null),tt(Te=>Te?.colKey===L.key?null:{colKey:L.key,x:K.right,anchorTop:K.top,anchorBottom:K.bottom,boundsRect:se})},[V.enabled]),Qt=l.useCallback(x=>{_e.has(x)?kt(x):Ye(x)},[_e,kt,Ye]),jn=l.useCallback(x=>{ae(x)?Zt(x):Ht(x)},[ae,Zt,Ht]),yn=l.useCallback(()=>{const x=q?.pinned??g??[],L=q?.hidden??_??[],K=q?.order??N??[];nt(x),st(new Set(L)),Be(K)},[q,g,_,N,nt,st,Be]),kn=l.useCallback((x,L,K)=>{if(M.has(x)||M.has(L))return;const se=Ei(j,x,L,K,Te=>_e.has(Te)&&!M.has(Te));se&&Be(se)},[j,_e,M,Be]),Ue=l.useMemo(()=>({pin:"Pin column",unpin:"Unpin column",hide:"Hide column",manage:"Manage columns",manageTitle:"Manage columns",unpinAll:"Unpin all",showAll:"Show all columns",reset:"Reset",lockedHint:"Locked",dragHandle:"Reorder",close:"Close",...P}),[P]),wn=l.useMemo(()=>({manageTitle:Ue.manageTitle,unpinAll:Ue.unpinAll,showAll:Ue.showAll,reset:Ue.reset,lockedHint:Ue.lockedHint,pin:Ue.pin,unpin:Ue.unpin,dragHandle:Ue.dragHandle,close:Ue.close}),[Ue]),Nn=l.useMemo(()=>Ce.some(x=>!M.has(x)),[Ce,M]),Cn=l.useCallback((x,L)=>{if(!V.enabled||!(x.key==="F10"&&x.shiftKey||x.key==="ContextMenu"))return;x.preventDefault();const se=x.currentTarget.getBoundingClientRect(),Te=de.current?.getBoundingClientRect()??null;et(null),tt({colKey:L.key,x:se.right,anchorTop:se.top,anchorBottom:se.bottom,boundsRect:Te})},[V.enabled]);be.current.length>U.length&&(be.current.length=U.length);const zt=l.useRef(null);l.useLayoutEffect(()=>{const x=fe.current,L=Se.current,K=F.current;if(!x||!L||!K)return;const se=()=>{const Ot=L.scrollWidth,vt=x.clientWidth;gt(Ot),ct(Ot-vt>1);const Nt=Ae.current;if(Nt){const Ve=Nt.firstElementChild;Ve&&(Ve.style.width=`${vt}px`)}const an=K.querySelectorAll("th"),Ct=[];for(let Ve=0;Ve<an.length;Ve+=1)Ct.push(an[Ve].getBoundingClientRect().width);const Tt=be.current;for(let Ve=0;Ve<Ct.length;Ve+=1){const rt=Tt[Ve];rt&&(rt.style.width=`${Ct[Ve]}px`)}if(J.length===0)ht(Ve=>Ve.size===0?Ve:new Map);else{const Ve=new Map;let rt=0;for(const lt of J)Ve.set(lt,rt),rt+=Ct[lt]??0;ht(lt=>{if(lt.size!==Ve.size)return Ve;for(const[Sa,Ea]of Ve)if(lt.get(Sa)!==Ea)return Ve;return lt})}};zt.current=se,se();const Te=new ResizeObserver(se);return Te.observe(L),Te.observe(x),Te.observe(K),()=>{Te.disconnect(),zt.current=null}},[U,J,I]),l.useLayoutEffect(()=>{zt.current?.()},[s,n.length]);const Rt=l.useRef({prevDisplay:"",prevTop:NaN,prevLeft:NaN,prevWidth:NaN,wasVisible:!1}),wt=l.useRef(null);l.useEffect(()=>{if(!I&&!H)return;const x=oe.current,L=fe.current;if(!L||I&&!x)return;const K=I&&x?xs([L,x]):null,se=Rt.current;let Te=0;const Ot=()=>{Te=0;const Tt=de.current,Ve=F.current;if(!Tt)return;const rt=Tt.getBoundingClientRect(),lt=wt.current,Sa=lt&<!==window?lt.getBoundingClientRect().top:0,Ea=lt&<!==window?lt.getBoundingClientRect().bottom:window.innerHeight;if(I&&x&&Ve){const $a=L.getBoundingClientRect(),cr=Ve.offsetHeight,Dn=Sa+re,Kn=$a.top<=Dn&&rt.bottom>Dn+cr,Ta=Kn?"block":"none";if(Ta!==se.prevDisplay&&(x.style.display=Ta,se.prevDisplay=Ta),Dn!==se.prevTop&&(x.style.top=`${Dn}px`,se.prevTop=Dn),rt.left!==se.prevLeft&&(x.style.left=`${rt.left}px`,se.prevLeft=rt.left),rt.width!==se.prevWidth&&(x.style.width=`${rt.width}px`,se.prevWidth=rt.width),Kn&&!se.wasVisible){const ur=L.scrollLeft;x.scrollLeft!==ur&&(K?.lockTo(L),x.scrollLeft=ur)}se.wasVisible=Kn;const dr=Kn?"true":"false";Tt.dataset.headerStuck!==dr&&(Tt.dataset.headerStuck=dr)}if(H){const $a=je??0,La=rt.bottom>Ea-$a?"true":"false";Tt.dataset.footerStuck!==La&&(Tt.dataset.footerStuck=La)}},vt=()=>{Te||(Te=requestAnimationFrame(Ot))};wt.current=$i(de.current);const Nt=wt.current;Ot(),window.addEventListener("scroll",vt,{passive:!0}),window.addEventListener("resize",vt),Nt&&Nt!==window&&Nt.addEventListener("scroll",vt,{passive:!0});const an=de.current,Ct=an?new ResizeObserver(vt):null;return Ct&&an&&Ct.observe(an),()=>{Te&&cancelAnimationFrame(Te),window.removeEventListener("scroll",vt),window.removeEventListener("resize",vt),Nt&&Nt!==window&&Nt.removeEventListener("scroll",vt),K?.dispose(),Ct&&Ct.disconnect()}},[I,re,H,je]),l.useEffect(()=>{const x=fe.current,L=we.current;if(!x||!L||!Ke)return;const K=xs([x,L]);return()=>K.dispose()},[Ke]);const en=fn(Ne),tn=fn(ue),Y=fn(Q),xe=["ui-table",`ui-table--${c}`,d!=="filled"&&`ui-table--variant-${d}`,u!=="default"&&`ui-table--color-${u}`,p!=="md"&&`ui-table--radius-${p}`,a&&"ui-table--bordered",!r&&"ui-table--no-row-dividers",i&&"ui-table--col-dividers",o&&"ui-table--striped",ee&&"ui-table--clickable-rows",X].filter(Boolean).join(" "),Me=l.useMemo(()=>U.map((x,L)=>{const K=ke.has(L);return["ui-table__th",x.align&&`ui-table__th--align-${x.align}`,K&&"ui-table__th--sticky",K&&L===C&&"ui-table__th--sticky-last"].filter(Boolean).join(" ")}),[U,ke,C]),De=l.useMemo(()=>U.map((x,L)=>{const K=ke.has(L);return["ui-table__td",x.align&&`ui-table__td--align-${x.align}`,x.wrap&&"ui-table__td--wrap",K&&"ui-table__td--sticky",K&&L===C&&"ui-table__td--sticky-last"].filter(Boolean).join(" ")}),[U,ke,C]),Le=l.useMemo(()=>U.map((x,L)=>{if(ke.has(L))return{left:`${We.get(L)??0}px`}}),[U,ke,We]),nn=x=>{if(!x.sortable||!D)return null;const L=Z?.sort_by===x.key,K=L?Z?.sort_order==="ASC"?qr:Gr:ei;return e.jsx("span",{className:["ui-table__sort-icon",L&&"ui-table__sort-icon--active"].filter(Boolean).join(" "),"aria-hidden":"true",children:e.jsx(K,{})})},E=x=>{!x.sortable||!D||D(x.key)},A=(x,L)=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),E(L))},me=l.useCallback((x,L,K)=>{ee&&(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),ee(L,K))},[ee]),ce=U.length||1,Oe=()=>e.jsx("colgroup",{children:U.map(x=>e.jsx("col",{style:x.width!==void 0?{width:fn(x.width)}:void 0},x.key))}),dt=W?{overflowX:"auto",overflowY:"visible",maxHeight:"none",height:"auto"}:{height:tn,maxHeight:tn?void 0:Y},Ge={...b};W&&(Ge.overflow="visible");const Bt=H?{position:"sticky",bottom:je,zIndex:5}:void 0,Mn=(x,L,K)=>!L&&!K?x:[x,L&&"ui-table__th--sortable",K&&"ui-table__th--sorted"].filter(Boolean).join(" ");return e.jsxs("div",{ref:de,className:[xe,W&&"ui-table--page-sticky"].filter(Boolean).join(" "),style:Ge,children:[Ke&&e.jsx("div",{ref:we,className:"ui-table__top-scroll","aria-hidden":"true",children:e.jsx("div",{className:"ui-table__top-scroll-inner",style:{width:`${Qe}px`}})}),e.jsx("div",{ref:fe,className:"ui-table__viewport",style:dt,children:e.jsxs("table",{ref:Se,className:"ui-table__table",style:{minWidth:en},role:"table",children:[Oe(),e.jsx("thead",{className:"ui-table__thead",children:e.jsx("tr",{ref:F,className:"ui-table__tr",children:U.map((x,L)=>{const K=!!x.sortable&&!!D,se=Z?.sort_by===x.key;return e.jsx("th",{scope:"col","aria-label":x.ariaLabel,"aria-sort":se?Z?.sort_order==="ASC"?"ascending":"descending":K?"none":void 0,className:Mn(Me[L],K,se),style:Le[L],tabIndex:K?0:void 0,"aria-haspopup":V.enabled?"menu":void 0,onClick:K?()=>E(x):void 0,onKeyDown:Te=>{K&&A(Te,x),V.enabled&&Cn(Te,x)},children:e.jsxs("span",{className:"ui-table__th-inner",children:[V.enabled&&x.align==="center"&&e.jsx("span",{className:"ui-table__th-menu-spacer","aria-hidden":"true"}),e.jsxs("span",{className:"ui-table__th-content",children:[e.jsx("span",{className:"ui-table__th-label",children:x.label}),nn(x)]}),V.enabled&&e.jsx(Ie,{sx:"ui-table__th-menu-btn",icon:e.jsx(Ja,{}),size:"small",variant:"ghost",color:"neutral","aria-label":"Column options","aria-haspopup":"menu","aria-expanded":Re?.colKey===x.key,onClick:Te=>pt(Te,x)})]})},x.key)})})}),e.jsx("tbody",{className:"ui-table__tbody",children:s?e.jsx("tr",{className:"ui-table__tr ui-table__tr--state",children:e.jsx("td",{ref:Ae,className:"ui-table__td ui-table__td--state",colSpan:ce,children:e.jsx("div",{className:"ui-table__state-content",children:R})})}):n.length===0?e.jsx("tr",{className:"ui-table__tr ui-table__tr--state",children:e.jsx("td",{ref:Ae,className:"ui-table__td ui-table__td--state",colSpan:ce,children:e.jsx("div",{className:"ui-table__state-content",children:ye})})}):n.map((x,L)=>e.jsx(wi,{row:x,rowIndex:L,visibleCols:U,tdClasses:De,stickyStyles:Le,onRowClick:ee,onKeyDown:ee?me:void 0},O(x,L)))})]})}),T&&!s&&e.jsx("div",{className:"ui-table__footer",style:Bt,children:T}),I&&e.jsx("div",{ref:oe,className:"ui-table__overlay-header","aria-hidden":"true",style:{display:"none",position:"fixed",top:re,left:0,width:0,overflowX:Ke?"auto":"hidden",overflowY:"hidden",zIndex:40},children:e.jsxs("table",{ref:ge,className:"ui-table__table",style:{minWidth:en,width:Qe||void 0,tableLayout:"fixed"},role:"presentation",children:[e.jsx("colgroup",{children:U.map((x,L)=>e.jsx("col",{ref:K=>{be.current[L]=K},style:x.width!==void 0?{width:fn(x.width)}:void 0},x.key))}),e.jsx("thead",{className:"ui-table__thead",children:e.jsx("tr",{className:"ui-table__tr",children:U.map((x,L)=>{const K=!!x.sortable&&!!D,se=Z?.sort_by===x.key;return e.jsx("th",{scope:"col",className:Mn(Me[L],K,se),style:Le[L],onClick:K?()=>E(x):void 0,children:e.jsxs("span",{className:"ui-table__th-inner",children:[V.enabled&&x.align==="center"&&e.jsx("span",{className:"ui-table__th-menu-spacer","aria-hidden":"true"}),e.jsxs("span",{className:"ui-table__th-content",children:[e.jsx("span",{className:"ui-table__th-label",children:x.label}),nn(x)]}),V.enabled&&e.jsx(Ie,{sx:"ui-table__th-menu-btn",icon:e.jsx(Ja,{}),size:"small",variant:"ghost",color:"neutral","aria-label":"Column options","aria-haspopup":"menu",onClick:Te=>pt(Te,x)})]})},x.key)})})})]})}),V.enabled&&Re&&(()=>{const x=Re.colKey,L=_e.has(x),K=M.has(x),se=He.has(x),Te=[];return V.pin&&(L?Te.push({key:"unpin",label:Ue.unpin,onSelect:()=>kt(x),disabled:K}):Te.push({key:"pin",label:Ue.pin,onSelect:()=>Ye(x)})),V.hide&&Te.push({key:"hide",label:Ue.hide,onSelect:()=>Ht(x),disabled:se||U.length<=1}),V.manage&&Te.push({key:"manage",label:Ue.manage,onSelect:()=>{tt(null),et({x:Re.x,anchorTop:Re.anchorTop,anchorBottom:Re.anchorBottom,boundsRect:Re.boundsRect})}}),Te.length===0?null:e.jsx(Ni,{x:Re.x,anchorTop:Re.anchorTop,anchorBottom:Re.anchorBottom,items:Te,onClose:at,portalNode:xt,boundsRect:Re.boundsRect})})(),V.enabled&&V.manage&&Fe&&e.jsx(Mi,{x:Fe.x,anchorTop:Fe.anchorTop,anchorBottom:Fe.anchorBottom,columns:B,pinnedKeys:Ce,hiddenKeys:Jt,visibleCount:U.length,canPin:V.pin,canHide:V.hide,canReorder:V.reorder,onTogglePin:Qt,onToggleHide:jn,onUnpinAll:xn,onShowAll:vn,onReset:yn,onReorder:kn,hasUnpinnablePinned:Nn,hasHiddenColumns:bn>0,labels:wn,onClose:Xt,portalNode:xt,boundsRect:Fe.boundsRect})]})}vs.displayName="Table";const _a=({open:t,title:n,message:s,confirmLabel:a="Confirm",cancelLabel:r="Cancel",confirmColor:i="primary",onConfirm:o,onCancel:c,hideCancel:d=!1,closeOnBackdropClick:u=!0,closeOnEscape:p=!0,returnFocusOnClose:f=!1})=>e.jsx(ta,{open:t,onClose:c,size:"small",closeOnBackdropClick:u,closeOnEscape:p,returnFocusOnClose:f,children:e.jsxs("div",{className:"ui-confirm",children:[n&&e.jsx("h2",{className:"ui-confirm__title",children:n}),s&&e.jsx("div",{className:"ui-confirm__message",children:s}),e.jsxs("div",{className:"ui-confirm__actions",children:[!d&&e.jsx(Xe,{variant:"outlined",color:"neutral",onClick:c,children:r}),e.jsx(Xe,{variant:"filled",color:i,onClick:o,autoFocus:!0,children:a})]})]})});_a.displayName="ConfirmDialog";const bs=l.createContext(null),js=({children:t})=>{const[n,s]=l.useState(null),a=l.useRef(null);a.current=n;const r=l.useCallback(c=>new Promise(d=>{const u=a.current;u&&u.resolve(!1),s({...c,resolve:d})}),[]),i=l.useCallback(c=>{const d=a.current;d&&(d.resolve(c),s(null))},[]),o=l.useMemo(()=>({confirm:r}),[r]);return e.jsxs(bs.Provider,{value:o,children:[t,e.jsx(_a,{open:n!==null,title:n?.title,message:n?.message,confirmLabel:n?.confirmLabel,cancelLabel:n?.cancelLabel,confirmColor:n?.confirmColor,hideCancel:n?.hideCancel,closeOnBackdropClick:n?.closeOnBackdropClick,closeOnEscape:n?.closeOnEscape,onConfirm:()=>i(!0),onCancel:()=>i(!1)})]})};js.displayName="ConfirmProvider";const Ti=()=>{const t=l.useContext(bs);if(!t)throw new Error("useConfirm must be used within a <ConfirmProvider>");return t},ys=({checked:t,defaultChecked:n,onChange:s,label:a,labelPosition:r="end",color:i="primary",size:o="medium",isDisabled:c=!1,name:d,value:u,id:p,sx:f,style:h})=>{const m=l.useId(),v=p??m,g=["ui-toggle",`ui-toggle--${i}`,`ui-toggle--${o}`,`ui-toggle--label-${r}`,c&&"ui-toggle--disabled",f].filter(Boolean).join(" "),_=y=>{c||s?.(y.target.checked,y)};return e.jsxs("label",{className:g,style:h,htmlFor:v,children:[a!=null&&r==="start"&&e.jsx("span",{className:"ui-toggle__label",children:a}),e.jsxs("span",{className:"ui-toggle__switch",children:[e.jsx("input",{id:v,type:"checkbox",className:"ui-toggle__input",role:"switch",checked:t,defaultChecked:n,disabled:c,name:d,value:u,onChange:_}),e.jsx("span",{className:"ui-toggle__track","aria-hidden":"true",children:e.jsx("span",{className:"ui-toggle__thumb"})})]}),a!=null&&r==="end"&&e.jsx("span",{className:"ui-toggle__label",children:a})]})};ys.displayName="Toggle";const ks=l.createContext(null),ga=t=>{const n=l.useContext(ks);if(!n)throw new Error(`<${t}> must be rendered inside <Tabs>`);return n},ws=({value:t,defaultValue:n,onChange:s,variant:a="underline",size:r="medium",color:i="primary",isDisabled:o=!1,children:c,sx:d,style:u})=>{const f=`ui-tabs-${l.useId().replace(/:/g,"")}`,[h,m]=l.useState(n??""),v=t!==void 0,g=v?t:h,_=l.useRef(new Map),y=l.useCallback(P=>{v||m(P),s?.(P)},[v,s]),N=l.useCallback((P,q)=>{q&&_.current.set(P,q)},[]),k=l.useCallback(P=>{_.current.delete(P)},[]),$=l.useMemo(()=>({value:g,setValue:y,baseId:f,registerTab:N,unregisterTab:k,variant:a,size:r,color:i,isDisabled:o}),[g,y,f,N,k,a,r,i,o]),S=["ui-tabs",`ui-tabs--${a}`,`ui-tabs--${r}`,d].filter(Boolean).join(" ");return e.jsx(ks.Provider,{value:$,children:e.jsx("div",{className:S,style:u,children:c})})};ws.displayName="Tabs";const Ns=({"aria-label":t,"aria-labelledby":n,children:s,sx:a,style:r})=>{const{variant:i,size:o,color:c}=ga("TabList"),d=l.useMemo(()=>{const p=[];return l.Children.forEach(s,f=>{l.isValidElement(f)&&f.type===xa&&p.push(f.props.value)}),p},[s]),u=["ui-tabs__list",`ui-tabs__list--${i}`,`ui-tabs__list--${o}`,`ui-tabs__list--${c}`,a].filter(Boolean).join(" ");return e.jsx("div",{role:"tablist","aria-label":t,"aria-labelledby":n,className:u,style:r,"data-tab-order":d.join(","),children:s})};Ns.displayName="TabList";const xa=({value:t,isDisabled:n=!1,icon:s,badge:a,children:r,sx:i,style:o})=>{const c=ga("Tab"),d=l.useRef(null),u=l.useCallback(_=>{d.current=_,c.registerTab(t,_)},[c,t]);l.useEffect(()=>()=>c.unregisterTab(t),[c,t]);const p=c.value===t,f=c.isDisabled||n,h=()=>{f||c.setValue(t)},m=_=>{const y=d.current?.parentElement;if(!y)return;const N=(y.dataset.tabOrder??"").split(",").filter(Boolean);if(N.length===0)return;const k=N.filter(q=>{const Z=y.querySelector(`[data-tab-value="${q}"]`);return Z&&!Z.disabled});if(k.length===0)return;let $;const S=k.indexOf(t);switch(_){case"first":$=k[0];break;case"last":$=k[k.length-1];break;case"next":$=k[(S+1)%k.length];break;case"prev":$=k[(S-1+k.length)%k.length];break}y.querySelector(`[data-tab-value="${$}"]`)?.focus(),c.setValue($)},v=_=>{if(!f)switch(_.key){case"ArrowRight":case"ArrowDown":_.preventDefault(),m("next");break;case"ArrowLeft":case"ArrowUp":_.preventDefault(),m("prev");break;case"Home":_.preventDefault(),m("first");break;case"End":_.preventDefault(),m("last");break}},g=["ui-tabs__tab",`ui-tabs__tab--${c.variant}`,`ui-tabs__tab--${c.size}`,`ui-tabs__tab--${c.color}`,p&&"ui-tabs__tab--active",f&&"ui-tabs__tab--disabled",i].filter(Boolean).join(" ");return e.jsxs("button",{ref:u,type:"button",role:"tab",id:`${c.baseId}-tab-${t}`,"aria-selected":p,"aria-controls":`${c.baseId}-panel-${t}`,"aria-disabled":f||void 0,tabIndex:p?0:-1,disabled:f,"data-tab-value":t,className:g,style:o,onClick:h,onKeyDown:v,children:[s&&e.jsx("span",{className:"ui-tabs__tab-icon","aria-hidden":"true",children:s}),e.jsx("span",{className:"ui-tabs__tab-label",children:r}),a!=null&&e.jsx("span",{className:"ui-tabs__tab-badge",children:a})]})};xa.displayName="Tab";const Cs=({value:t,keepMounted:n=!1,children:s,sx:a,style:r})=>{const i=ga("TabPanel"),o=i.value===t;if(!o&&!n)return null;const c=["ui-tabs__panel",a].filter(Boolean).join(" ");return e.jsx("div",{role:"tabpanel",id:`${i.baseId}-panel-${t}`,"aria-labelledby":`${i.baseId}-tab-${t}`,tabIndex:0,hidden:!o,className:c,style:r,children:s})};Cs.displayName="TabPanel";const Ai=t=>{const n=t.trim().split(/\s+/).filter(Boolean);return n.length===0?"":n.length===1?n[0].slice(0,2).toUpperCase():(n[0][0]+n[n.length-1][0]).toUpperCase()},Ut=({name:t="",src:n,alt:s,size:a="medium",shape:r="circle",color:i="neutral",fallback:o,crossOrigin:c,referrerPolicy:d,loading:u,sx:p,style:f})=>{const[h,m]=l.useState(!1);l.useEffect(()=>{m(!1)},[n]);const v=!!n&&!h,g=Ai(t),_=!!(f?.background||f?.backgroundColor),y=["ui-avatar",`ui-avatar--${a}`,`ui-avatar--${r}`,!v&&!_&&`ui-avatar--${i}`,p].filter(Boolean).join(" "),N=()=>g?e.jsx("span",{className:"ui-avatar__initials","aria-hidden":"true",children:g}):o!=null?e.jsx("span",{className:"ui-avatar__fallback","aria-hidden":"true",children:o}):e.jsx("span",{className:"ui-avatar__initials","aria-hidden":"true",children:"?"});return e.jsx("span",{className:y,style:f,role:"img","aria-label":s??t??"avatar",children:v?e.jsx("img",{className:"ui-avatar__image",src:n,alt:s??t,crossOrigin:c,referrerPolicy:d,loading:u,onError:()=>m(!0)}):N()})};Ut.displayName="Avatar";const Ii={small:-4,medium:-8},va=({children:t,max:n=5,total:s,spacing:a="medium",size:r,shape:i,surplusColor:o="neutral",renderSurplus:c,sx:d,style:u})=>{const p=l.Children.toArray(t),f=s??p.length,h=f>n,m=h?Math.max(0,n-1):Math.min(p.length,n),v=p.slice(0,m),g=h?f-m:0,_=typeof a=="number"?a:Ii[a],y=["ui-avatar-group",d].filter(Boolean).join(" "),N=(k,$,S)=>{const P={marginLeft:S};if(l.isValidElement(k)&&k.type===Ut){const q={};return r&&!k.props.size&&(q.size=r),i&&!k.props.shape&&(q.shape=i),e.jsx("span",{className:"ui-avatar-group__item",style:P,children:l.cloneElement(k,q)},$)}return e.jsx("span",{className:"ui-avatar-group__item",style:P,children:k},$)};return e.jsxs("div",{className:y,style:u,children:[v.map((k,$)=>N(k,$,$===0?0:_)),g>0&&e.jsx("span",{className:"ui-avatar-group__item ui-avatar-group__item--surplus",style:{marginLeft:_},children:c?c(g):e.jsx(Ut,{size:r,shape:i,color:o,fallback:e.jsxs("span",{className:"ui-avatar-group__surplus-text",children:["+",g]})})},"surplus")]})};va.displayName="AvatarGroup";const Pi={success:e.jsx(Er,{}),error:e.jsx(Hr,{}),warning:e.jsx(zr,{}),info:e.jsx(Lr,{})},ba=({type:t="info",message:n,title:s,icon:a,onClose:r,duration:i,sx:o,style:c})=>{const d=typeof i=="number"&&i>0,u=["ui-toast",`ui-toast--${t}`,o].filter(Boolean).join(" ");return e.jsxs("div",{className:u,style:c,role:t==="error"||t==="warning"?"alert":"status","aria-live":t==="error"||t==="warning"?"assertive":"polite",children:[e.jsx("span",{className:"ui-toast__icon","aria-hidden":"true",children:a??Pi[t]}),e.jsxs("div",{className:"ui-toast__body",children:[s&&e.jsx("div",{className:"ui-toast__title",children:s}),e.jsx("div",{className:"ui-toast__message",children:n})]}),r&&e.jsx(Ie,{icon:e.jsx(jt,{}),onClick:r,"aria-label":"Dismiss notification",variant:"ghost",color:"neutral",size:"small",sx:"ui-toast__close"}),d&&e.jsx("span",{className:"ui-toast__progress","aria-hidden":"true",style:{animationDuration:`${i}ms`}})]})};ba.displayName="Toast";const Ms=l.createContext(null),Ds=({children:t,position:n="top-right",defaultDuration:s=5e3,portalContainerId:a})=>{const[r,i]=l.useState([]),o=l.useRef(new Map),c=l.useCallback(h=>{const m=o.current.get(h);m&&(clearTimeout(m),o.current.delete(h))},[]),d=l.useCallback(h=>{c(h),i(m=>m.filter(v=>v.id!==h))},[c]),u=l.useCallback(()=>{o.current.forEach(h=>clearTimeout(h)),o.current.clear(),i([])},[]),p=l.useCallback(h=>{const m=`toast-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,v=h.duration??s;if(i(g=>[...g,{...h,id:m,duration:v}]),v>0){const g=setTimeout(()=>d(m),v);o.current.set(m,g)}return m},[s,d]);l.useEffect(()=>{const h=o.current;return()=>{h.forEach(m=>clearTimeout(m)),h.clear()}},[]);const f=l.useMemo(()=>({showToast:p,dismissToast:d,dismissAll:u}),[p,d,u]);return e.jsxs(Ms.Provider,{value:f,children:[t,e.jsx(dn,{containerId:a,children:e.jsx("div",{className:`ui-toast-container ui-toast-container--${n}`,children:r.map(h=>e.jsx(ba,{type:h.type,title:h.title,message:h.message,icon:h.icon,duration:h.duration,onClose:()=>d(h.id)},h.id))})})]})};Ds.displayName="ToastProvider";const Hi=()=>{const t=l.useContext(Ms);if(!t)throw new Error("useToast must be used within a <ToastProvider>");return t},Ss=({size:t="medium",color:n="primary",variant:s="inline",label:a="Loading",sx:r,style:i})=>{const o=["ui-spinner",`ui-spinner--${t}`,n!=="inherit"&&`ui-spinner--${n}`,r].filter(Boolean).join(" "),c=e.jsx("span",{className:o,style:i,role:"status","aria-label":a,children:e.jsx("span",{className:"ui-spinner__visually-hidden",children:a})});return s==="page"?e.jsx(dn,{children:e.jsx("div",{className:"ui-spinner-overlay",children:e.jsx("span",{className:["ui-spinner","ui-spinner--large",n!=="inherit"&&`ui-spinner--${n}`].filter(Boolean).join(" "),role:"status","aria-label":a,children:e.jsx("span",{className:"ui-spinner__visually-hidden",children:a})})})}):c};Ss.displayName="Spinner";function zi(t,n,s){if(n<=1)return n===1?[1]:[];const a=Math.max(2,t-s),r=Math.min(n-1,t+s),i=t-s>3,o=t+s<n-2,c=[1];if(i)c.push("ellipsis-left");else for(let d=2;d<a;d++)c.push(d);for(let d=a;d<=r;d++)c.push(d);if(o)c.push("ellipsis-right");else for(let d=r+1;d<n;d++)c.push(d);return c.push(n),c}const Es=({currentPage:t,totalPages:n,totalItems:s,itemsPerPage:a,onPageChange:r,hasFirstLast:i=!0,hasGoToPage:o=!1,showResults:c="none",showOnSinglePage:d=!1,perPageOptions:u,perPage:p,onPerPageChange:f,siblingCount:h=1,size:m="medium",sx:v,style:g})=>{const _=!!u&&!!f&&p!==void 0,y=l.useMemo(()=>u?.map(T=>({value:String(T.value),label:T.label}))??[],[u]),N=c!=="none"&&s!==void 0,k=n>1;if(!k&&(!d||s===0))return null;const S=k?zi(t,n,h):[],P=t<=1,q=t>=n,Z=T=>{T<1||T>n||T===t||r(T)},D=["ui-pagination",`ui-pagination--${m}`,v].filter(Boolean).join(" ");return e.jsxs("div",{className:D,style:g,role:"navigation","aria-label":"Pagination",children:[e.jsx("div",{className:"ui-pagination__group ui-pagination__group--start",children:N&&e.jsx(Bi,{mode:c,currentPage:t,totalItems:s,itemsPerPage:a})}),e.jsxs("div",{className:"ui-pagination__group ui-pagination__group--end",children:[_&&e.jsxs("label",{className:"ui-pagination__per-page",children:[e.jsx("span",{className:"ui-pagination__per-page-label",children:"Per page"}),e.jsx(Ln,{size:"small",value:String(p),options:y,onChange:T=>{typeof T=="string"&&f(Number(T))},"aria-label":`Items per page: ${p}`})]}),k&&o&&e.jsx(Oi,{totalPages:n,onGo:Z}),k&&e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"ui-pagination__compact-status","aria-hidden":"true",children:["Page ",e.jsx("strong",{children:t})," of ",n]}),e.jsxs("div",{className:"ui-pagination__pages",children:[i&&e.jsx("button",{type:"button",className:"ui-pagination__btn ui-pagination__btn--icon",onClick:()=>Z(1),disabled:P,"aria-label":"First page",children:e.jsx(Zr,{})}),e.jsx("button",{type:"button",className:"ui-pagination__btn ui-pagination__btn--icon",onClick:()=>Z(t-1),disabled:P,"aria-label":"Previous page",children:e.jsx(Pn,{})}),S.map(T=>T==="ellipsis-left"||T==="ellipsis-right"?e.jsx("span",{className:"ui-pagination__ellipsis","aria-hidden":"true",children:"…"},T):e.jsx("button",{type:"button",className:["ui-pagination__btn","ui-pagination__btn--num",T===t&&"ui-pagination__btn--active"].filter(Boolean).join(" "),onClick:()=>Z(T),"aria-current":T===t?"page":void 0,"aria-label":`Page ${T}`,children:T},T)),e.jsx("button",{type:"button",className:"ui-pagination__btn ui-pagination__btn--icon",onClick:()=>Z(t+1),disabled:q,"aria-label":"Next page",children:e.jsx(Hn,{})}),i&&e.jsx("button",{type:"button",className:"ui-pagination__btn ui-pagination__btn--icon",onClick:()=>Z(n),disabled:q,"aria-label":"Last page",children:e.jsx(Jr,{})})]})]})]})]})};Es.displayName="Pagination";const Bi=({mode:t,currentPage:n,totalItems:s,itemsPerPage:a})=>{if(t==="none"||s===void 0)return null;if(t==="total")return e.jsxs("span",{className:"ui-pagination__summary",children:[e.jsx("strong",{children:s})," ",s===1?"result":"results"]});const r=a??s,i=s===0?0:(n-1)*r+1,o=Math.min(n*r,s);return e.jsxs("span",{className:"ui-pagination__summary",children:["Showing ",e.jsx("strong",{children:i}),"–",e.jsx("strong",{children:o})," of ",e.jsx("strong",{children:s})]})},Oi=({totalPages:t,onGo:n})=>{const[s,a]=l.useState(""),r=l.useRef(null),i=()=>{const d=Number(s);if(!Number.isFinite(d)||d<1||d>t){a("");return}n(Math.floor(d)),a(""),r.current?.blur()},o=d=>{const u=Number(s)||0,p=Math.min(t,Math.max(1,u+d));a(String(p))},c=e.jsxs("span",{className:"ui-pagination__goto-spinner","aria-hidden":"true",children:[e.jsx("button",{type:"button",tabIndex:-1,className:"ui-pagination__goto-spinner-btn",onMouseDown:d=>{d.preventDefault(),o(1)},children:e.jsx(Wr,{})}),e.jsx("button",{type:"button",tabIndex:-1,className:"ui-pagination__goto-spinner-btn",onMouseDown:d=>{d.preventDefault(),o(-1)},children:e.jsx(Yr,{})})]});return e.jsxs("label",{className:"ui-pagination__goto",children:[e.jsx("span",{className:"ui-pagination__goto-label",children:"Go to"}),e.jsx(Ft,{ref:r,type:"number",size:"small",min:1,max:t,step:1,value:s,onChange:d=>a(d.target.value),onKeyDown:d=>{d.key==="Enter"&&(d.preventDefault(),i())},onBlur:i,"aria-label":`Go to page (1–${t})`,endAdornment:c,sx:{root:"ui-pagination__goto-field",input:"ui-pagination__goto-input"}})]})},Fi={primary:"--palette-primary-main",secondary:"--palette-secondary-main",success:"--palette-success-main",tertiary:"--palette-tertiary-main",warning:"--palette-warning-main",error:"--palette-error-main",info:"--palette-info-main",neutral:"--palette-text-secondary"},Pt=12,$s=3,ja=30,Vi=["Mon","","Wed","","Fri","",""],Yi=[0,22,45,70,100];function Wi(t,n){if(!t||t<=0||n<=0)return 0;const s=t/n;return s<=.25?1:s<=.5?2:s<=.75?3:4}function Ls(t,n){return t<=0?{backgroundColor:"var(--palette-action-hover)"}:{backgroundColor:`color-mix(in srgb, var(${n}) ${Yi[t]}%, transparent)`}}const ya=t=>t.toISOString().slice(0,10),Ts=({data:t=[],endDate:n,weeks:s=52,color:a="success",maxValue:r,formatTooltip:i,isLoading:o=!1})=>{const c=Fi[a],{grid:d,months:u,byDate:p,max:f}=l.useMemo(()=>{const g=new Date((n||ya(new Date))+"T00:00:00"),_=(g.getDay()+6)%7,y=new Date(g);y.setDate(y.getDate()+(6-_));const N=new Date(y);N.setDate(N.getDate()-(s*7-1));const k=[],$=[];let S=-1;for(let Z=0;Z<s;Z++){const D=[];for(let ee=0;ee<7;ee++){const O=new Date(N);O.setDate(O.getDate()+Z*7+ee),D.push({iso:ya(O)})}k.push(D);const T=new Date(N);T.setDate(T.getDate()+Z*7),T.getMonth()!==S&&($.push({col:Z,label:T.toLocaleDateString("en",{month:"short"})}),S=T.getMonth())}const P=new Map;let q=0;for(const Z of t){const D=String(Z.date).slice(0,10);P.set(D,Z);const T=Number(Z.value)||0;T>q&&(q=T)}return{grid:k,months:$,byDate:P,max:r!=null&&r>0?r:q}},[t,n,s,r]),h=ya(new Date);if(o)return e.jsx("div",{className:"ui-activity-heatmap__skeleton"});const m=s*Pt+(s-1)*$s,v=`${ja}px repeat(${s}, ${Pt}px)`;return e.jsx("div",{className:"ui-activity-heatmap",children:e.jsxs("div",{style:{minWidth:ja+m},children:[e.jsxs("div",{className:"ui-activity-heatmap__months",style:{gridTemplateColumns:v,columnGap:`${$s}px`},children:[e.jsx("div",{}),Array.from({length:s}).map((g,_)=>e.jsx("div",{className:"ui-activity-heatmap__month-label",children:u.find(y=>y.col===_)?.label||""},_))]}),e.jsxs("div",{className:"ui-activity-heatmap__grid",children:[e.jsx("div",{className:"ui-activity-heatmap__day-labels",style:{width:ja},children:Vi.map((g,_)=>e.jsx("div",{className:"ui-activity-heatmap__day-label",style:{height:Pt},children:g},_))}),d.map((g,_)=>e.jsx("div",{className:"ui-activity-heatmap__week",children:g.map(({iso:y})=>{const N=p.get(y),k=y>h,$=k?-1:Wi(N?.value||0,f),S=k?y:i?i(y,N?.value||0,N?.meta):`${y}: ${N?.value??0}`;return e.jsx("div",{className:k?"ui-activity-heatmap__cell ui-activity-heatmap__cell--future":"ui-activity-heatmap__cell",title:S,style:{width:Pt,height:Pt,...k?void 0:Ls($,c)}},y)})},_))]}),e.jsxs("div",{className:"ui-activity-heatmap__legend",children:[e.jsx("span",{children:"Less"}),[0,1,2,3,4].map(g=>e.jsx("div",{className:"ui-activity-heatmap__legend-cell",style:{width:Pt,height:Pt,...Ls(g,c)}},g)),e.jsx("span",{children:"More"})]})]})})};Ts.displayName="ActivityHeatmap";const Fn=4,Vn=3,As=20;function Ki(t){return t.find(s=>s.iso2==="gb"||s.iso2==="en"||s.name.toLowerCase()==="english")??t[0]??null}function Is(t,n){return t.icon?t.icon:`https://flagcdn.com/${n}/${t.iso2}.png`}const Ps=({page:t,totalPages:n,onPrev:s,onNext:a})=>{const r=o=>c=>{c.stopPropagation(),c.preventDefault(),o()},i=o=>{o.stopPropagation(),o.preventDefault()};return e.jsxs("div",{className:"ui-employee-card__carousel-nav",onClick:i,children:[e.jsx(Ie,{icon:e.jsx(Pn,{size:14}),size:"small",variant:"ghost",color:"neutral",sx:"ui-employee-card__carousel-btn",onClick:r(s),disabled:t===0,"aria-label":"Previous"}),e.jsx(Ie,{icon:e.jsx(Hn,{size:14}),size:"small",variant:"ghost",color:"neutral",sx:"ui-employee-card__carousel-btn",onClick:r(a),disabled:t>=n-1,"aria-label":"Next"})]})},Hs=({employee:t,profileUrl:n,onClick:s,talkMode:a,selectedToolIds:r,onToolToggle:i,isInCart:o,onCartToggle:c,selectedTierValue:d,onTierChange:u,share:p,onShare:f,sx:h})=>{const[m,v]=l.useState(!1),[g,_]=l.useState(0),[y,N]=l.useState(0),[k,$]=l.useState(!1),S=parseFloat(t.rate?.value??"0"),P=C=>parseFloat(C)<=S,q=t.pricingTiers?.filter(C=>P(C.value)).sort((C,de)=>parseFloat(de.value)-parseFloat(C.value))[0]?.value??t.pricingTiers?.[0]?.value??null,[Z,D]=l.useState(()=>q),T=d??Z,ee=t.pricingTiers?.find(C=>C.value===T)??null,O=C=>{u?u(C):D(C)},[Ne,ue]=l.useState(""),Q=l.useRef(null),re=l.useRef(null),je=t.shortName||"Unknown",ye=t.department?.color||"#9e9e9e",R=t.currency||"$",X=C=>{const de=parseFloat(C||"0");return de?`${R}${de}/hour`:"—"},b=C=>t.prices_discounted?.find(de=>de.value===C)?.price,I=b(T??"")??ee?.price,H=I?X(I):"—",W=t.tools||[],V=Math.ceil(W.length/Fn)||1,ve=g*Fn,w=W.slice(ve,ve+Fn),te=Math.ceil(W.length/Vn)||1,ie=y*Vn,he=W.slice(ie,ie+Vn),z=t.languages||[],le=Ki(z),$e=a?a.isConnected||a.isConnecting:!1;l.useEffect(()=>{$e||ue("")},[$e]),l.useEffect(()=>{re.current&&(re.current.scrollTop=re.current.scrollHeight)},[a?.messages]);const Pe=["ui-employee-card",m&&"ui-employee-card--flipped",t.is_pinned&&"ui-employee-card--hot",$e&&"ui-employee-card--talk-active",h?.root].filter(Boolean).join(" "),pe=`ui-employee-card__header ${h?.header||""}`.trim(),Ce=`ui-employee-card__content ${h?.content||""}`.trim(),_e={"--department-color":ye},He=C=>{if(C.target.closest('button, input, [role="button"], .ui-icon-button-wrapper, .ui-dropdown, .ui-employee-card__content--talk')){C.preventDefault();return}s&&(C.preventDefault(),s())},M=C=>{C.stopPropagation(),C.preventDefault(),v(de=>!de)},G=(C,de)=>{C.stopPropagation(),C.preventDefault(),i?.(de)},ae=C=>{C.stopPropagation(),C.preventDefault(),c?.()},j=C=>{C.stopPropagation(),C.preventDefault(),n&&navigator.share?navigator.share({title:t.profession??t.shortName??void 0,text:`${t.shortName} — ${t.profession??"AnyEmp profile"}`,url:n}).then(()=>f?.()).catch(()=>{}):n?navigator.clipboard.writeText(n).then(()=>{$(!0),Q.current&&clearTimeout(Q.current),Q.current=setTimeout(()=>$(!1),1500),f?.()}):f?.()},B=!a?.isMicMuted,U=()=>{!Ne.trim()||!a?.onSendMessage||(a.onSendMessage(Ne.trim()),ue(""))},J=n?"a":"article",ke=n?{href:n,onClick:He}:{onClick:He,role:s?"button":void 0,tabIndex:s?0:void 0};return e.jsxs("div",{className:Pe,style:{"--department-color":ye},children:[e.jsxs("div",{className:"ui-employee-card__card-side",children:[e.jsxs("div",{className:"ui-employee-card__inner",children:[e.jsxs(J,{...ke,className:"ui-employee-card__front",children:[e.jsx("div",{className:"ui-employee-card__header-section"}),e.jsxs("div",{className:pe,style:_e,children:[e.jsxs("div",{className:"ui-employee-card__avatar-wrapper",children:[e.jsx("div",{className:"ui-employee-card__avatar-gradient"}),t.avatarUrl?e.jsx("img",{src:t.avatarUrl,alt:`${je} avatar`,className:"ui-employee-card__avatar"}):e.jsx("div",{className:"ui-employee-card__avatar ui-employee-card__avatar--placeholder",children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),e.jsx("circle",{cx:"12",cy:"7",r:"4"})]})})]}),e.jsx("div",{className:"ui-employee-card__header-info",children:e.jsxs("div",{className:"ui-employee-card__header-text",children:[t.profession&&e.jsx("h3",{className:"ui-employee-card__profession",children:t.profession}),e.jsx("p",{className:"ui-employee-card__name",children:je})]})}),e.jsx("div",{className:"ui-employee-card__id-badge-wrapper",children:e.jsxs("div",{className:"ui-employee-card__id-badge",children:[e.jsx("span",{className:"ui-employee-card__id-label",children:"ID:"}),e.jsx("span",{className:"ui-employee-card__id-value",children:t.talentId})]})})]}),e.jsxs("div",{className:"ui-employee-card__body-section",children:[e.jsxs("div",{className:`${Ce} ui-employee-card__content--normal ${$e?"ui-employee-card__content--hidden":""}`,children:[t.summary&&e.jsx("div",{style:{marginBottom:"1rem"},children:e.jsx("p",{className:"ui-employee-card__summary",children:t.summary})}),W.length>0&&e.jsxs("div",{className:"ui-employee-card__skills-section",children:[e.jsxs("div",{className:"ui-employee-card__carousel-header",children:[e.jsx("h4",{className:"ui-employee-card__section-title",children:"Tools"}),W.length>Fn&&e.jsx(Ps,{page:g,totalPages:V,onPrev:()=>_(C=>Math.max(0,C-1)),onNext:()=>_(C=>Math.min(V-1,C+1))})]}),e.jsx("div",{className:"ui-employee-card__tools",children:w.map(C=>{const fe=["ui-employee-card__tool",(r?.includes(C.id)??!1)&&"ui-employee-card__tool--selected"].filter(Boolean).join(" ");return e.jsx(Ze,{title:C.name,placement:"top",children:e.jsx("div",{className:fe,onClick:i?Se=>G(Se,C.id):void 0,children:C.icon?e.jsx("img",{src:C.icon,alt:C.name,className:"ui-employee-card__tool-icon"}):e.jsx("span",{className:"ui-employee-card__tool-placeholder",children:C.name.charAt(0).toUpperCase()})})},C.id)})})]}),a&&e.jsx("div",{className:"ui-employee-card__audio-section",children:e.jsxs("div",{className:"ui-employee-card__audio-controls",role:"button",tabIndex:a.isConnecting?-1:0,onClick:C=>{C.stopPropagation(),C.preventDefault(),a.isConnecting||a.onStart()},children:[e.jsx("div",{className:"ui-employee-card__audio-mic-circle",children:e.jsx(Za,{})}),e.jsx("div",{className:"ui-employee-card__audio-wave",children:[...Array(5)].map((C,de)=>e.jsx("div",{className:"ui-employee-card__audio-wave-bar"},de))}),e.jsxs("div",{className:"ui-employee-card__audio-text",children:[e.jsx("span",{className:"ui-employee-card__audio-label",children:"Talk with AI Employee"}),t.slogan&&e.jsx("span",{className:"ui-employee-card__audio-slogan",children:t.slogan})]})]})})]}),a&&e.jsx("div",{className:`${Ce} ui-employee-card__content--talk ${$e?"":"ui-employee-card__content--hidden"}`,children:e.jsx("div",{className:"ui-employee-card__talk-view",children:t.pricingTiers&&t.pricingTiers.length>0&&t.rate?(()=>{const C=b(T??""),de=parseFloat((C??ee?.price)||"0"),fe=de&&ee?`${R}${(de*ee.hours*As).toLocaleString()}/mo`:"—",Se=we=>{const F=parseFloat(we);return F>=1?"var(--palette-primary-main)":F>=.5?"var(--palette-warning-main)":"var(--palette-text-primary)"};return e.jsxs("div",{className:"ui-employee-card__cpv",children:[e.jsx("span",{className:"ui-employee-card__cpv-label",children:"Pricing"}),e.jsx("div",{className:"ui-employee-card__cpv-tiers",children:t.pricingTiers.map(we=>{const F=b(we.value),oe=parseFloat((F??we.price)||"0"),ge=F?parseFloat(we.price||"0"):null,be=oe?`${R}${(oe*we.hours*As).toLocaleString()}/mo`:"—",Ae=oe?`${R}${oe}/h`:"—",We=P(we.value),Ke=["ui-employee-card__cpv-tier",We&&we.value===T&&"ui-employee-card__cpv-tier--selected",!We&&"ui-employee-card__cpv-tier--disabled",We&&c&&"ui-employee-card__cpv-tier--clickable"].filter(Boolean).join(" ");return e.jsxs("div",{className:Ke,style:{"--tc":Se(we.value)},onClick:We&&c?ct=>{ct.stopPropagation(),ct.preventDefault(),O(we.value)}:void 0,children:[e.jsxs("div",{className:"ui-employee-card__cpv-tier-left",children:[e.jsx("span",{className:"ui-employee-card__cpv-tier-label",children:we.name}),e.jsxs("span",{className:"ui-employee-card__cpv-tier-hours",children:[we.hours," h/day"]})]}),e.jsxs("div",{className:"ui-employee-card__cpv-tier-right",children:[ge&&e.jsxs("span",{className:"ui-employee-card__cpv-tier-rate ui-employee-card__cpv-tier-rate--original",children:[R,ge,"/h"]}),e.jsx("span",{className:"ui-employee-card__cpv-tier-rate",children:Ae}),e.jsx("span",{className:"ui-employee-card__cpv-tier-monthly",children:be})]})]},we.value)})}),e.jsxs("div",{className:"ui-employee-card__cpv-summary",children:[e.jsx("span",{className:"ui-employee-card__cpv-summary-label",children:"In Total"}),e.jsxs("span",{className:"ui-employee-card__cpv-summary-value",children:[t.rate?.name," · ",fe]})]})]})})():null})})]}),t.pricingTiers&&t.pricingTiers.length>0&&t.rate&&e.jsx(Jn,{placement:"bottom-end",variant:"info",divider:!0,sx:{root:"ui-employee-card__price-dropdown"},trigger:e.jsxs(Xe,{variant:"outlined",color:"neutral",size:"small",sx:"ui-employee-card__price-trigger rounded-full",children:[e.jsx("span",{children:H}),t.discount&&e.jsxs("span",{className:"ui-employee-card__discount-badge",children:["-",parseFloat(t.discount).toFixed(0),"%"]}),e.jsx("svg",{className:"ui-dropdown__arrow",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),children:t.pricingTiers.map(C=>{const de=b(C.value);return e.jsxs(Zn,{sx:"ui-employee-card__price-item",disabled:!P(C.value),children:[e.jsx("span",{className:"ui-employee-card__price-label",children:C.name}),de?e.jsxs("span",{className:"ui-employee-card__price-value-group",children:[e.jsx("span",{className:"ui-employee-card__price-value ui-employee-card__price-value--original",children:X(C.price)}),e.jsx("span",{className:"ui-employee-card__price-value ui-employee-card__price-value--discounted",children:X(de)})]}):e.jsx("span",{className:"ui-employee-card__price-value",children:X(C.price)})]},C.value)})}),e.jsxs("div",{className:"ui-employee-card__avatar-actions",children:[le&&e.jsx(Ze,{placement:"right",title:e.jsxs("span",{className:"ui-employee-card__lang-tooltip-item",children:[e.jsx("span",{children:le.name}),e.jsx("span",{className:"ui-employee-card__lang-level",children:le.level})]}),children:e.jsx("div",{className:"ui-employee-card__language-badge",children:e.jsx("img",{src:Is(le,"24x18"),alt:le.name})})}),c&&e.jsx(Ie,{icon:o?e.jsx(Xr,{}):e.jsx(Pr,{}),size:"small",variant:"outlined",color:o?"warning":"neutral",sx:"ui-employee-card__action-btn",onClick:ae,"aria-label":o?"Remove from cart":"Add to cart"}),(p||f)&&e.jsxs("div",{className:"ui-employee-card__share-wrapper",children:[e.jsx(Ie,{icon:e.jsx(Qa,{}),size:"small",variant:"outlined",color:"neutral",sx:"ui-employee-card__action-btn",onClick:j,"aria-label":"Share profile"}),k&&e.jsx("div",{className:"ui-employee-card__share-copied",children:"Copied!"})]})]})]}),e.jsx("div",{className:"ui-employee-card__back",children:e.jsxs("div",{className:"ui-employee-card__back-content",children:[e.jsx("div",{className:"ui-employee-card__back-header",children:e.jsxs("div",{className:"ui-employee-card__back-header-row",children:[t.profession&&e.jsx("p",{className:"ui-employee-card__back-role",style:{color:ye},children:t.profession}),e.jsxs("span",{className:"ui-employee-card__back-id",children:["ID: ",t.talentId]})]})}),z.length>0&&e.jsx("div",{className:"ui-employee-card__back-section",children:e.jsx("div",{className:"ui-employee-card__back-languages",children:z.map(C=>e.jsx(Ze,{title:C.name,placement:"top",children:e.jsxs("div",{className:"ui-employee-card__back-language-item",children:[e.jsxs("div",{className:"ui-employee-card__back-language-left",children:[e.jsx("img",{src:Is(C,"20x15"),alt:C.name,className:"ui-employee-card__back-language-flag"}),e.jsx("span",{className:"ui-employee-card__back-language-iso",children:C.iso2.toUpperCase()})]}),e.jsx("span",{className:"ui-employee-card__back-language-level",children:C.level})]})},C.name))})}),W.length>0&&e.jsxs("div",{className:"ui-employee-card__back-section ui-employee-card__back-section--tools",children:[e.jsxs("div",{className:"ui-employee-card__carousel-header",children:[e.jsx("h4",{className:"ui-employee-card__back-section-title",children:"I Can Work With"}),W.length>Vn&&e.jsx(Ps,{page:y,totalPages:te,onPrev:()=>N(C=>Math.max(0,C-1)),onNext:()=>N(C=>Math.min(te-1,C+1))})]}),e.jsx("div",{className:"ui-employee-card__back-tools",children:he.map(C=>e.jsxs("div",{className:"ui-employee-card__back-tool",children:[C.icon?e.jsx("img",{src:C.icon,alt:C.name,className:"ui-employee-card__back-tool-icon"}):e.jsx("span",{className:"ui-employee-card__back-tool-placeholder",children:C.name.charAt(0).toUpperCase()}),e.jsx("span",{className:"ui-employee-card__back-tool-name",children:C.name})]},C.id))})]}),t.tasks&&t.tasks.length>0&&e.jsxs("div",{className:"ui-employee-card__back-section",children:[e.jsx("h4",{className:"ui-employee-card__back-section-title",children:"Recent Tasks"}),e.jsx("div",{className:"ui-employee-card__back-tasks",children:t.tasks.map((C,de)=>e.jsx("div",{className:"ui-employee-card__back-task",children:e.jsx("span",{children:C.text})},C.id??de))})]})]})})]}),e.jsx(Ie,{icon:e.jsx(Rr,{}),size:"medium",variant:"ghost",color:"primary",sx:"ui-employee-card__flip-btn",onClick:M,"aria-label":m?"Show front side":"Show back side"})]}),$e&&e.jsx("div",{className:"ui-employee-card__panel-clip",children:e.jsx("div",{className:"ui-employee-card__side-panel",children:a?.chatSlot??e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"ui-employee-card__side-panel-actions",children:[a?.onShareChat&&e.jsx(Ie,{icon:e.jsx(Qa,{}),size:"small",variant:"ghost",color:"neutral",sx:"ui-employee-card__side-panel-share",onClick:()=>a.onShareChat(),"aria-label":"Share chat"}),e.jsx(Ie,{icon:e.jsx(jt,{}),size:"small",variant:"ghost",color:"neutral",sx:"ui-employee-card__side-panel-close",onClick:()=>a?.onEnd(),"aria-label":"Close"})]}),e.jsxs("div",{className:"ui-employee-card__panel-voice-bar",children:[e.jsx("div",{className:"ui-employee-card__panel-mic-col",children:e.jsx(Ie,{icon:e.jsx(Za,{}),size:"medium",variant:"filled",color:B?"error":"primary",sx:`ui-employee-card__panel-mic-btn${B?" active-pulse":""}`,"aria-label":B?"Mute microphone":"Unmute microphone",onClick:a?.onMicToggle})}),e.jsx("div",{className:"ui-employee-card__talk-waveform",children:[...Array(7)].map((C,de)=>e.jsx("div",{className:"ui-employee-card__waveform-bar"},de))})]}),a?.faqChips&&a.faqChips.length>0&&e.jsxs("div",{className:"ui-employee-card__panel-faq",children:[e.jsx("span",{className:"ui-employee-card__panel-faq-label",children:"Quick questions"}),e.jsx("div",{className:"ui-employee-card__panel-faq-chips",children:a.faqChips.map((C,de)=>e.jsx(mt,{label:C,variant:"outlined",color:"neutral",size:"small",onClick:()=>a.onSendMessage?.(C)},de))})]}),e.jsx("div",{className:"ui-employee-card__panel-messages-scroll",ref:re,children:e.jsx("div",{className:"ui-employee-card__panel-messages",children:(a?.messages??[]).map((C,de)=>e.jsx("div",{className:`ui-employee-card__panel-bubble ui-employee-card__panel-bubble--${C.role}`,children:e.jsx("div",{className:"ui-employee-card__panel-bubble-text",children:C.text})},de))})}),a?.onSendMessage&&e.jsx("div",{className:"ui-employee-card__panel-input-bar",children:e.jsx(Ft,{fullWidth:!0,size:"small",value:Ne,onChange:C=>ue(C.target.value),onKeyDown:C=>{C.key==="Enter"&&U()},placeholder:"Ask anything...",endAdornment:e.jsx(Ie,{icon:e.jsx(Or,{}),size:"small",variant:"ghost",color:"primary","aria-label":"Send",onClick:U})})})]})})})]})};Hs.displayName="EmployeeCard";const ka=({src:t="/logo.png",alt:n="Any Employee Logo",text:s="Any Employee",onClick:a,size:r="medium",className:i=""})=>{const o=`ui-anyemp-logo ui-anyemp-logo--${r} ${i}`.trim(),c=d=>{a&&(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),a())};return e.jsxs("div",{className:o,onClick:a,role:a?"button":void 0,tabIndex:a?0:void 0,onKeyDown:c,children:[e.jsx("div",{className:"ui-anyemp-logo__image-wrapper",children:e.jsx("img",{src:t,alt:n,className:"ui-anyemp-logo__image"})}),s&&e.jsx("span",{className:"ui-anyemp-logo__text",children:s})]})};ka.displayName="Logo";const Ui=[{label:"ABOUT US",href:"#about"},{label:"FAQ",href:"#faq"},{label:"REVIEWS",href:"#reviews"},{label:"CONTACT US",href:"#contact"}],zs=({navItems:t=Ui,logoText:n="Any Employee",logoSrc:s,logoAlt:a,onLogoClick:r,sx:i})=>{const o=`ui-anyemp-header ${i?.root||""}`.trim(),c=`ui-anyemp-header__nav ${i?.nav||""}`.trim(),d=`ui-anyemp-header__nav-item ${i?.navItem||""}`.trim(),u=t.slice(0,Math.ceil(t.length/2)),p=t.slice(Math.ceil(t.length/2)),f=(h,m)=>{h.onClick&&(m.preventDefault(),h.onClick())};return e.jsx("header",{className:o,children:e.jsxs("nav",{className:c,children:[e.jsx("div",{className:"ui-anyemp-header__nav-group",children:u.map((h,m)=>e.jsx("a",{href:h.href||"#",className:d,onClick:v=>f(h,v),children:h.label},`left-${m}`))}),e.jsx(ka,{src:s,alt:a,text:n,onClick:r,className:i?.logo}),e.jsx("div",{className:"ui-anyemp-header__nav-group",children:p.map((h,m)=>e.jsx("a",{href:h.href||"#",className:d,onClick:v=>f(h,v),children:h.label},`right-${m}`))})]})})};zs.displayName="Header";function Gi(t,n){let s,a,r=-1;const i=o=>{for(const c of o)c.path&&(c.path===n?s=c.id:n.startsWith(c.path==="/"?"/":c.path+"/")&&c.path.length>r&&(a=c.id,r=c.path.length)),c.children&&i(c.children)};return i(t),s??a}const Bs=({item:t,isCollapsed:n,isActive:s,isExpanded:a,expandedIds:r,parentItemBehavior:i,depth:o,onToggleExpand:c,onItemClick:d,activeItemId:u,onMouseEnter:p,onMouseLeave:f})=>{const h=!!t.children?.length,m=l.useRef(null),v=l.useRef(null),g=["ui-sidebar__item",s&&"ui-sidebar__item--active",h&&"ui-sidebar__item--has-children",h&&a&&"ui-sidebar__item--open"].filter(Boolean).join(" "),_=D=>{if(t.external)return;const T=D.button===0&&!D.metaKey&&!D.ctrlKey&&!D.shiftKey&&!D.altKey;if(!(t.path&&!T)){if(!h){d&&t.path&&D.preventDefault(),d?.(t);return}if(i==="accordion"){t.path&&D.preventDefault(),c(t.id);return}d&&t.path&&D.preventDefault(),d?.(t)}},y=D=>{!h||i!=="navigate"||(D.key==="ArrowRight"&&!a||D.key==="ArrowLeft"&&a)&&(D.preventDefault(),c(t.id))},N=D=>{D.preventDefault(),D.stopPropagation(),c(t.id)},k=D=>{p?.(t.id,D.currentTarget)},$=e.jsxs(e.Fragment,{children:[t.icon&&e.jsx("span",{className:"ui-sidebar__item-icon",children:t.icon}),e.jsx("span",{className:"ui-sidebar__item-label",children:t.label}),t.badge!==void 0&&e.jsx("span",{className:"ui-sidebar__item-badge",children:t.badge}),h&&(i==="accordion"?e.jsx(Rn,{className:"ui-sidebar__item-chevron","aria-hidden":"true"}):e.jsx("button",{type:"button",className:"ui-sidebar__item-toggle",onClick:N,"aria-label":a?"Collapse section":"Expand section","aria-expanded":a,tabIndex:-1,children:e.jsx(Rn,{className:"ui-sidebar__item-chevron","aria-hidden":"true"})}))]}),S={"--ui-sidebar-depth":o},P=e.jsx("a",{ref:v,href:t.path,className:g,style:S,"aria-current":s?"page":void 0,target:t.external?"_blank":void 0,rel:t.external?"noopener noreferrer":void 0,onClick:_,onKeyDown:y,onMouseEnter:k,onMouseLeave:f,children:$}),q=e.jsx("button",{ref:m,type:"button",className:g,style:S,onClick:_,onKeyDown:y,"aria-expanded":h&&i!=="navigate"?a:void 0,"aria-haspopup":h?!0:void 0,onMouseEnter:k,onMouseLeave:f,children:$}),Z=t.path&&(!h||i!=="accordion")?P:q;return e.jsxs("li",{children:[Z,h&&e.jsx("div",{className:["ui-sidebar__children",a&&"ui-sidebar__children--open"].filter(Boolean).join(" "),children:e.jsx("ul",{role:"list",style:{listStyle:"none",margin:0,padding:0},children:t.children.map(D=>e.jsx(Bs,{item:D,isCollapsed:n,isActive:D.id===u,isExpanded:r.includes(D.id),expandedIds:r,parentItemBehavior:i,depth:o+1,onToggleExpand:c,onItemClick:d,activeItemId:u},D.id))})})]})},qi=({user:t,onLogout:n,onLogin:s,theme:a,onThemeToggle:r,isCollapsed:i})=>{const o=a==="dark",[c,d]=l.useState(null),u=l.useRef(null),p=()=>{u.current!==null&&(clearTimeout(u.current),u.current=null)},f=(v,g)=>{if(!i)return;p();const _=v.getBoundingClientRect();d({kind:"label",label:g,top:_.top+_.height/2})},h=v=>{if(!i)return;p();const g=v.getBoundingClientRect();d({kind:"user",top:g.top+g.height/2})},m=()=>{p(),u.current=window.setTimeout(()=>d(null),200)};return l.useEffect(()=>()=>{u.current!==null&&clearTimeout(u.current)},[]),l.useEffect(()=>{i||d(null)},[i]),e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"ui-sidebar__builtin-footer",children:[r&&e.jsxs(Xe,{variant:"ghost",color:"neutral",size:"small",onClick:r,"aria-label":o?"Switch to light mode":"Switch to dark mode",sx:"ui-sidebar__theme-btn",onMouseEnter:v=>f(v.currentTarget,o?"Light mode":"Dark mode"),onMouseLeave:m,children:[e.jsx("span",{className:"ui-sidebar__footer-icon",children:o?e.jsx(Vr,{size:20}):e.jsx(Fr,{size:20})}),e.jsx("span",{className:"ui-sidebar__footer-label",children:o?"Light mode":"Dark mode"})]}),t&&e.jsxs("div",{className:"ui-sidebar__user",onMouseEnter:v=>h(v.currentTarget),onMouseLeave:m,children:[e.jsx(Ut,{name:t.name??t.email??"",src:t.avatar,alt:t.name??"User",size:"small",fallback:e.jsx(ti,{}),sx:"ui-sidebar__user-avatar",crossOrigin:"anonymous",referrerPolicy:"no-referrer"}),!i&&e.jsxs("div",{className:"ui-sidebar__user-info",children:[t.name&&e.jsx("span",{className:"ui-sidebar__user-name",children:t.name}),t.email&&e.jsx("span",{className:"ui-sidebar__user-email",children:t.email}),t.roles&&t.roles.length>0&&e.jsx("span",{className:"ui-sidebar__user-roles",children:t.roles.join(", ")})]})]}),n&&e.jsxs(Xe,{variant:"ghost",color:"error",size:"small",onClick:n,"aria-label":"Log out",sx:"ui-sidebar__logout-btn",onMouseEnter:v=>f(v.currentTarget,"Log out"),onMouseLeave:m,children:[e.jsx("span",{className:"ui-sidebar__footer-icon",children:e.jsx(Ar,{size:20})}),e.jsx("span",{className:"ui-sidebar__footer-label",children:"Log out"})]}),!t&&s&&e.jsxs(Xe,{variant:"ghost",color:"primary",size:"small",onClick:s,"aria-label":"Log in",sx:"ui-sidebar__login-btn",onMouseEnter:v=>f(v.currentTarget,"Log in"),onMouseLeave:m,children:[e.jsx("span",{className:"ui-sidebar__footer-icon",children:e.jsx(Tr,{size:20})}),e.jsx("span",{className:"ui-sidebar__footer-label",children:"Log in"})]})]}),i&&c&&e.jsx("div",{className:["ui-sidebar__popover",c.kind==="user"?"ui-sidebar__popover--user":"ui-sidebar__popover--label"].join(" "),style:{top:c.top,transform:"translateY(-50%)"},onMouseEnter:p,onMouseLeave:m,children:c.kind==="label"?e.jsx("span",{children:c.label}):e.jsxs(e.Fragment,{children:[t?.name&&e.jsx("span",{className:"ui-sidebar__user-name",children:t.name}),t?.email&&e.jsx("span",{className:"ui-sidebar__user-email",children:t.email}),t?.roles&&t.roles.length>0&&e.jsx("span",{className:"ui-sidebar__user-roles",children:t.roles.join(", ")})]})})]})},Xi=200,Zi=240,wa=({items:t,collapsed:n,defaultCollapsed:s=!1,onCollapsedChange:a,mobileOpen:r=!1,onMobileClose:i,logo:o,logoIcon:c,logoTitle:d,footer:u,user:p,onLogout:f,onLogin:h,theme:m,onThemeToggle:v,activeItemId:g,activePath:_,onItemClick:y,parentItemBehavior:N="accordion",sx:k,style:$})=>{const S=g??(_!==void 0?Gi(t,_):void 0),P=n!==void 0,[q,Z]=l.useState(s),D=P?n:q,T=()=>{const w=!D;P||Z(w),a?.(w)},[ee,O]=l.useState(()=>{if(!S)return[];const w=[],te=ie=>{for(const he of ie){if(he.id===S)return!0;if(he.children&&te(he.children))return w.push(he.id),!0}return!1};return te(t),w});l.useEffect(()=>{if(!S)return;const w=[],te=ie=>{for(const he of ie){if(he.id===S)return!0;if(he.children&&te(he.children))return w.push(he.id),!0}return!1};te(t),w.length!==0&&O(ie=>{const he=new Set(ie);for(const z of w)he.add(z);return Array.from(he)})},[S,t]);const Ne=w=>{O(te=>te.includes(w)?te.filter(ie=>ie!==w):[...te,w])},[ue,Q]=l.useState(null),re=l.useRef(0),je=l.useRef(0),ye=l.useRef(null),R=l.useCallback(()=>{ye.current!==null&&(clearTimeout(ye.current),ye.current=null)},[]),X=l.useCallback((w,te)=>{if(!D)return;R();const ie=te.getBoundingClientRect();re.current=Math.min(ie.top,window.innerHeight-Zi),je.current=ie.top+ie.height/2,Q(w)},[D,R]),b=l.useCallback(()=>{D&&(R(),ye.current=window.setTimeout(()=>Q(null),Xi))},[D,R]),I=w=>{R(),Q(w)};l.useEffect(()=>{if(!D||!ue)return;const w=te=>{te.key==="Escape"&&Q(null)};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[D,ue]),l.useEffect(()=>()=>R(),[R]),l.useEffect(()=>{D||Q(null)},[D]);const H=ue?t.find(w=>w.id===ue):null,W=!u&&(p||f||h||v),V=["ui-sidebar",D&&"ui-sidebar--collapsed",k].filter(Boolean).join(" "),ve=(w=!1)=>e.jsxs(e.Fragment,{children:[w?e.jsxs("div",{className:"ui-sidebar__mobile-header",children:[e.jsx("div",{className:"ui-sidebar__mobile-header-logo",children:o}),e.jsx(Ie,{icon:e.jsx(jt,{}),"aria-label":"Close navigation",variant:"ghost",color:"neutral",size:"medium",onClick:i})]}):(o||c||d)&&e.jsx("div",{className:"ui-sidebar__header",children:o??e.jsxs(e.Fragment,{children:[c&&e.jsx("div",{className:"ui-sidebar__logo-icon",children:c}),d&&e.jsx("span",{className:"ui-sidebar__logo-title",children:d})]})}),e.jsx("nav",{className:"ui-sidebar__nav","aria-label":"Main navigation",children:e.jsx("ul",{role:"list",style:{listStyle:"none",margin:0,padding:0},children:t.map(te=>e.jsx(Bs,{item:te,isCollapsed:w?!1:D,isActive:te.id===S,isExpanded:ee.includes(te.id),expandedIds:ee,parentItemBehavior:N,depth:0,onToggleExpand:Ne,onItemClick:y,activeItemId:S,onMouseEnter:w?void 0:X,onMouseLeave:w?void 0:b},te.id))})}),u&&e.jsx("div",{className:"ui-sidebar__footer",children:u}),W&&e.jsx(qi,{user:p,onLogout:f,onLogin:h,theme:m,onThemeToggle:v,isCollapsed:w?!1:D})]});return e.jsxs(e.Fragment,{children:[e.jsxs("aside",{className:V,style:$,children:[e.jsx(Ie,{icon:D?e.jsx(Hn,{}):e.jsx(Pn,{}),"aria-label":D?"Expand sidebar":"Collapse sidebar",size:"small",variant:"outlined",color:"neutral",onClick:T,sx:"ui-sidebar__toggle-btn"}),e.jsx("div",{className:"ui-sidebar__inner",children:ve(!1)}),D&&H&&e.jsx("div",{className:["ui-sidebar__popover",!H.children?.length&&"ui-sidebar__popover--label"].filter(Boolean).join(" "),style:H.children?.length?{top:re.current}:{top:je.current,transform:"translateY(-50%)"},onMouseEnter:()=>I(H.id),onMouseLeave:b,role:H.children?.length?"menu":void 0,children:H.children?.length?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"ui-sidebar__popover-header",children:H.label}),H.children.map(w=>{const te=w.id===S,ie=["ui-sidebar__popover-item",te&&"ui-sidebar__popover-item--active"].filter(Boolean).join(" ");return w.path?e.jsxs("a",{href:w.path,className:ie,"aria-current":te?"page":void 0,role:"menuitem",onClick:he=>{he.button===0&&!he.metaKey&&!he.ctrlKey&&!he.shiftKey&&!he.altKey&&(y&&he.preventDefault(),y?.(w),Q(null))},children:[w.icon&&e.jsx("span",{className:"ui-sidebar__item-icon",children:w.icon}),w.label]},w.id):e.jsxs("button",{type:"button",className:ie,role:"menuitem",onClick:()=>{y?.(w),Q(null)},children:[w.icon&&e.jsx("span",{className:"ui-sidebar__item-icon",children:w.icon}),w.label]},w.id)})]}):e.jsx("span",{children:H.label})})]}),e.jsx(es,{open:r,onClose:i,anchor:"left",width:"100vw",showCloseButton:!1,closeOnEscape:!0,closeOnBackdropClick:!0,trapFocus:!0,sx:"ui-sidebar__mobile-drawer",hideBackdrop:!0,children:e.jsx("div",{className:"ui-sidebar__mobile-inner",children:ve(!0)})})]})};wa.displayName="Sidebar";const Os=({children:t,variant:n="sidebar",sidebar:s,header:a,sx:r,style:i})=>{const[o,c]=l.useState(s?.defaultCollapsed??!1),[d,u]=l.useState(!1),p=s?.mobileOpen??d,f=s?.onMobileClose??(()=>u(!1)),h=g=>{c(g),s?.onCollapsedChange?.(g)},m=["ui-layout",`ui-layout--${n}`,r].filter(Boolean).join(" ");if(n==="centered")return e.jsxs("div",{className:m,style:i,children:[a&&e.jsx("header",{className:"ui-layout__centered-header",children:a}),e.jsx("div",{className:"ui-layout__content",children:e.jsx("div",{className:"ui-layout__centered-card",children:t})})]});const v=s?.collapsed!==void 0?s.collapsed:o;return e.jsxs("div",{className:m,style:i,children:[e.jsx("div",{className:["ui-layout__sidebar-area",v&&"ui-layout__sidebar-area--collapsed"].filter(Boolean).join(" "),"aria-hidden":"true"}),s&&e.jsx(wa,{...s,collapsed:s.collapsed!==void 0?s.collapsed:o,onCollapsedChange:h,mobileOpen:p,onMobileClose:f}),e.jsxs("div",{className:"ui-layout__content",children:[e.jsx("div",{className:"ui-layout__mobile-header",children:e.jsx(Ie,{icon:e.jsx(Qr,{}),"aria-label":"Open navigation","aria-expanded":p,variant:"ghost",color:"neutral",size:"medium",onClick:()=>u(!0)})}),e.jsx("main",{className:"ui-layout__main",children:t})]})]})};Os.displayName="Layout";const Na=2;function Ji(t){const n=Math.floor(t/60),s=t%60;return n>0&&s>0?`${n}h ${s}m`:n>0?`${n}h`:`${s} min`}const Qi=()=>e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("polyline",{points:"12 6 12 12 16 14"})]}),Fs=()=>e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M4 19.5A2.5 2.5 0 0 1 6.5 17H20"}),e.jsx("path",{d:"M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"})]}),Ri=()=>e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),e.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),el=()=>e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("polygon",{points:"10 8 16 12 10 16 10 8",fill:"currentColor",stroke:"none"})]}),tl=()=>e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),e.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),e.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]}),nl=()=>e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"})}),al=()=>e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"})}),sl=()=>e.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})}),rl=({isBookmarked:t,onToggle:n})=>{const[s,a]=l.useState(0),r=i=>{i.preventDefault(),i.stopPropagation(),n&&(a(o=>o+1),n(!t))};return e.jsx("span",{className:`ui-course-card__badge--bookmark-wrap${s>0?" ui-course-card__badge--bookmark-pop":""}`,children:e.jsx(Ie,{icon:t?e.jsx(nl,{}):e.jsx(al,{}),"aria-label":t?"Remove bookmark":"Add bookmark",size:"small",variant:"ghost",sx:"rounded-full",style:{background:"rgba(255, 255, 255, 0.9)",color:"var(--palette-warning-main)",backdropFilter:"blur(4px)",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.2)"},onClick:n?r:void 0,disabled:!n})},s)},il=({title:t,description:n,imageUrl:s,difficulty:a,durationMinutes:r,lessonCount:i,testCount:o,videoCount:c,presentationCount:d,professions:u,progress:p,rating:f,author:h,isCompleted:m,isDraft:v,isRecommended:g,badgeSlot:_,isBookmarked:y,onBookmarkToggle:N,href:k,target:$,onClick:S,sx:P})=>{const q=["ui-course-card",v?"ui-course-card--draft":"",P||""].filter(Boolean).join(" "),Z=u?.length||0,D=Math.max(0,Z-Na),T=a&&D>0?Na-1:Na,ee=Math.max(0,Z-T),O=ee>0?(u||[]).slice(T).map(Q=>Q.name).join(", "):void 0,Ne=r!=null&&r>0||i!=null||o!=null||c!=null&&c>0||d!=null&&d>0;console.log("professions",u),console.log("maxVisible",T),console.log("hiddenCount",ee),console.log("hiddenProfessionNames",O),console.log("author",h),console.log("isCompleted",m),console.log("isDraft",v),console.log("isRecommended",g),console.log("badgeSlot",_);const ue=e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"ui-course-card__image-wrap",children:[s?e.jsx("img",{className:"ui-course-card__image",src:s,alt:t}):e.jsx("div",{className:"ui-course-card__image-placeholder",children:e.jsx(Fs,{})}),n&&e.jsx("div",{className:"ui-course-card__image-overlay",children:e.jsx("p",{className:"ui-course-card__image-overlay-text",children:n})}),(v||m||g||_)&&e.jsxs("div",{className:"ui-course-card__badge-wrap ui-course-card__badge-wrap--top-left",children:[v&&e.jsx(St,{label:"Draft",color:"warning",variant:"filled",size:"small"}),m&&e.jsx(St,{label:"✓ Done",color:"success",variant:"filled",size:"small"}),g&&e.jsx(St,{label:"★ Recommended",color:"info",variant:"filled",size:"small"}),_]}),e.jsx(rl,{isBookmarked:!!y,onToggle:N})]}),e.jsxs("div",{className:"ui-course-card__body",children:[e.jsx("h3",{className:"ui-course-card__title",children:t}),(a||u&&u.length>0)&&e.jsxs("div",{className:"ui-course-card__professions",children:[a&&e.jsxs("span",{className:"ui-course-card__difficulty-tag","data-difficulty":a,children:[e.jsxs("span",{className:"ui-course-card__level-bars","aria-hidden":"true",children:[e.jsx("span",{className:"ui-course-card__level-bar"}),e.jsx("span",{className:"ui-course-card__level-bar"}),e.jsx("span",{className:"ui-course-card__level-bar"})]}),a.charAt(0).toUpperCase()+a.slice(1)]}),(u||[]).slice(0,T).map((Q,re)=>e.jsx("span",{className:"ui-course-card__profession-tag",style:Q.color?{"--tag-color":Q.color}:void 0,children:Q.name},re)),ee>0&&e.jsx(Ze,{title:O,placement:"top",children:e.jsxs("span",{className:"ui-course-card__profession-tag ui-course-card__profession-tag--more",children:["+",ee]})})]}),typeof p=="number"&&e.jsxs("div",{className:"ui-course-card__progress",children:[e.jsx("div",{className:"ui-course-card__progress-track",children:e.jsx("div",{className:"ui-course-card__progress-fill",style:{width:`${Math.min(100,Math.max(0,p))}%`}})}),e.jsxs("span",{className:"ui-course-card__progress-value",children:[Math.round(p),"%"]})]}),(f!=null||h||Ne)&&e.jsxs("div",{className:"ui-course-card__footer",children:[e.jsxs("div",{className:"ui-course-card__footer-left",children:[f!=null&&e.jsxs("span",{className:"ui-course-card__rating",children:[e.jsx(sl,{}),f.toFixed(1)]}),h&&e.jsxs("span",{className:"ui-course-card__author",children:[h.avatarUrl?e.jsx("img",{className:"ui-course-card__author-avatar",src:h.avatarUrl,alt:h.username}):e.jsx("span",{className:"ui-course-card__author-avatar ui-course-card__author-avatar--placeholder",children:h.username.charAt(0).toUpperCase()}),e.jsx("span",{className:"ui-course-card__author-username",children:h.username})]})]}),e.jsxs("div",{className:"ui-course-card__footer-right",children:[r!=null&&r>0&&e.jsx(Ze,{title:"Duration",placement:"top",children:e.jsxs("span",{className:"ui-course-card__stat-item",children:[e.jsx(Qi,{}),Ji(r)]})}),c!=null&&c>0&&e.jsx(Ze,{title:`${c} video lesson${c!==1?"s":""}`,placement:"top",children:e.jsxs("span",{className:"ui-course-card__stat-item",children:[e.jsx(el,{}),c]})}),d!=null&&d>0&&e.jsx(Ze,{title:`${d} presentation${d!==1?"s":""}`,placement:"top",children:e.jsxs("span",{className:"ui-course-card__stat-item",children:[e.jsx(tl,{}),d]})}),i!=null&&e.jsx(Ze,{title:`${i} lesson${i!==1?"s":""}`,placement:"top",children:e.jsxs("span",{className:"ui-course-card__stat-item",children:[e.jsx(Fs,{}),i]})}),o!=null&&e.jsx(Ze,{title:`${o} test${o!==1?"s":""}`,placement:"top",children:e.jsxs("span",{className:"ui-course-card__stat-item",children:[e.jsx(Ri,{}),o]})})]})]})]})]});return k?e.jsx("a",{className:q,href:k,target:$,rel:$==="_blank"?"noopener noreferrer":void 0,onClick:S,"data-difficulty":a,children:ue}):e.jsx("div",{className:q,"data-difficulty":a,onClick:S,role:S?"button":void 0,tabIndex:S?0:void 0,children:ue})},Gt=2;function ll(t){const n=Math.floor(t/60),s=t%60;return n>0&&s>0?`${n}h ${s}m`:n>0?`${n}h`:`${s} min`}const ol=()=>e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("polyline",{points:"12 6 12 12 16 14"})]}),cl=()=>e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),e.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),dl=()=>e.jsxs("svg",{width:"36",height:"36",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M4 19.5A2.5 2.5 0 0 1 6.5 17H20"}),e.jsx("path",{d:"M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"})]}),ul=()=>e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"})}),hl=()=>e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"})}),pl=()=>e.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})}),ml=({isBookmarked:t,onToggle:n})=>{const[s,a]=l.useState(0),r=i=>{i.preventDefault(),i.stopPropagation(),n&&(a(o=>o+1),n(!t))};return e.jsx("span",{className:`ui-lesson-card__badge--bookmark-wrap${s>0?" ui-lesson-card__badge--bookmark-pop":""}`,children:e.jsx(Ie,{icon:t?e.jsx(ul,{}):e.jsx(hl,{}),"aria-label":t?"Remove bookmark":"Add bookmark",size:"small",variant:"ghost",sx:"rounded-full",style:{background:"rgba(255, 255, 255, 0.9)",color:"var(--palette-warning-main)",backdropFilter:"blur(4px)",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.2)"},onClick:n?r:void 0,disabled:!n})},s)},fl=({title:t,description:n,imageUrl:s,type:a,contentType:r,durationMinutes:i,author:o,module:c,course:d,skills:u,professions:p,testCount:f,rating:h,isBookmarked:m,onBookmarkToggle:v,isCompleted:g,isDraft:_,isRecommended:y,badgeSlot:N,href:k,target:$,onClick:S,customButtons:P,sx:q})=>{const Z=["ui-lesson-card",_?"ui-lesson-card--draft":"",q||""].filter(Boolean).join(" "),D=(p?.length||0)-Gt,T=D>0?(p||[]).slice(Gt).map(Q=>Q.name).join(", "):void 0,ee=(u?.length||0)-Gt,O=ee>0?(u||[]).slice(Gt).join(", "):void 0,Ne=i!=null&&i>0||f!=null||!!o,ue=e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"ui-lesson-card__image-wrap",children:[s?e.jsx("img",{className:"ui-lesson-card__image",src:s,alt:t}):e.jsx("div",{className:"ui-lesson-card__image-placeholder",children:e.jsx(dl,{})}),n&&e.jsx("div",{className:"ui-lesson-card__image-overlay",children:e.jsx("p",{className:"ui-lesson-card__image-overlay-text",children:n})}),(_||g||y||N)&&e.jsxs("div",{className:"ui-lesson-card__badge-wrap ui-lesson-card__badge-wrap--top-left",children:[_&&e.jsx(St,{label:"Draft",color:"warning",variant:"filled",size:"small"}),g&&e.jsx(St,{label:"✓ Done",color:"success",variant:"filled",size:"small"}),y&&e.jsx(St,{label:"★ Recommended",color:"info",variant:"filled",size:"small"}),N]}),e.jsx(ml,{isBookmarked:!!m,onToggle:v})]}),e.jsxs("div",{className:"ui-lesson-card__body",children:[e.jsx("h3",{className:"ui-lesson-card__title",children:t}),(a||r&&r!=="standard"||p&&p.length>0||u&&u.length>0)&&e.jsxs("div",{className:"ui-lesson-card__chips-row",children:[a&&e.jsx("span",{className:"ui-lesson-card__type-chip","data-type":a.toLowerCase(),children:a}),r&&r!=="standard"&&e.jsx("span",{className:"ui-lesson-card__type-chip ui-lesson-card__type-chip--content",children:r}),(p||[]).slice(0,Gt).map((Q,re)=>e.jsx("span",{className:"ui-lesson-card__profession-chip",style:Q.color?{"--chip-accent":Q.color}:void 0,children:Q.name},re)),D>0&&e.jsx(Ze,{title:T,placement:"top",children:e.jsxs("span",{className:"ui-lesson-card__profession-chip ui-lesson-card__profession-chip--more",children:["+",D]})}),(u||[]).slice(0,Gt).map((Q,re)=>e.jsx("span",{className:"ui-lesson-card__skill-chip",children:Q},re)),ee>0&&e.jsx(Ze,{title:O,placement:"top",children:e.jsxs("span",{className:"ui-lesson-card__skill-chip ui-lesson-card__skill-chip--more",children:["+",ee]})})]}),(h!=null||o||Ne||P)&&e.jsxs("div",{className:"ui-lesson-card__footer",children:[e.jsxs("div",{className:"ui-lesson-card__footer-left",children:[h!=null&&e.jsxs("span",{className:"ui-lesson-card__rating",children:[e.jsx(pl,{}),h.toFixed(1)]}),o&&e.jsxs("span",{className:"ui-lesson-card__author",children:[o.avatarUrl?e.jsx("img",{className:"ui-lesson-card__author-avatar",src:o.avatarUrl,alt:o.username}):e.jsx("span",{className:"ui-lesson-card__author-avatar ui-lesson-card__author-avatar--placeholder",children:o.username.charAt(0).toUpperCase()}),e.jsx("span",{className:"ui-lesson-card__author-username",children:o.username})]})]}),e.jsxs("div",{className:"ui-lesson-card__footer-right",children:[i!=null&&i>0&&e.jsx(Ze,{title:"Duration",placement:"top",children:e.jsxs("span",{className:"ui-lesson-card__stat-item",children:[e.jsx(ol,{}),ll(i)]})}),f!=null&&e.jsx(Ze,{title:`${f} test${f!==1?"s":""}`,placement:"top",children:e.jsxs("span",{className:"ui-lesson-card__stat-item",children:[e.jsx(cl,{}),f]})}),P&&e.jsx("span",{onClick:Q=>Q.stopPropagation(),children:P})]})]}),(c||d)&&e.jsxs("div",{className:"ui-lesson-card__context",children:[c&&e.jsx(Ze,{title:"Module",placement:"top",children:e.jsx("span",{className:"ui-lesson-card__context-item",children:c})}),d&&e.jsx(Ze,{title:"Course",placement:"top",children:e.jsx("span",{className:"ui-lesson-card__context-item",children:d})})]})]})]});return k?e.jsx("a",{className:Z,href:k,target:$,rel:$==="_blank"?"noopener noreferrer":void 0,onClick:S,children:ue}):e.jsx("div",{className:Z,onClick:S,role:S?"button":void 0,tabIndex:S?0:void 0,children:ue})},_l="#6366f1",gl="done",xl=t=>{const n=t instanceof Date?t:new Date(t);if(Number.isNaN(n.getTime()))return"";const s=String(n.getDate()).padStart(2,"0"),a=String(n.getMonth()+1).padStart(2,"0");return`${s}.${a}`},vl=()=>e.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),e.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),bl=()=>e.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[e.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),jl=()=>e.jsx("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:e.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}),yl=()=>e.jsx("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:e.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"})}),kl=()=>e.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[e.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),e.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),e.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),e.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),wl=()=>e.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[e.jsx("polyline",{points:"9 11 12 14 22 4"}),e.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]}),Nl=()=>e.jsx("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:e.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),Cl=()=>e.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[e.jsx("path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"}),e.jsx("line",{x1:"4",y1:"22",x2:"4",y2:"15"})]}),Ml=t=>t.user?.fullName||t.user?.name||String(t.user_id),Vs=(t,{role:n,shape:s,color:a})=>e.jsx(va,{max:4,total:t.length,size:"small",spacing:"small",shape:s,surplusColor:"primary",children:t.map(r=>{const i=Ml(r);return e.jsx(Ut,{name:i,src:r.user?.avatar,alt:`${n}: ${i}`,color:a??"primary",referrerPolicy:"no-referrer"},r.user_id)})}),Ys=({task:t,onClick:n,statusInfo:s,formatDate:a,isDragging:r=!1,dragHandleProps:i,sx:o})=>{const c=!!t._pending,d=t.priority||"low",u=a??xl,p=t.is_done??t.status===gl,f=(()=>{if(!t.due_date||p)return!1;const O=new Date(t.due_date);return O.setHours(23,59,59,999),O<new Date})(),h=t.labels||[],m=t.assignees||[],v=t.controllers||[],g=m.length>0||v.length>0,_=t._commentCount??0,y=t._attachmentCount??0,N=t._activeSessions??0,k=t._subtaskCount??0,$=t._completedSubtaskCount,S=k>0&&$===k,P=!!t.start_date||!!t.due_date,q=P||N>0||k>0||_>0||y>0,Z=["ui-task-card",c&&"ui-task-card--pending",r&&"ui-task-card--dragging",o].filter(Boolean).join(" "),D=()=>{c||r||n?.()},T=c?void 0:i?.attributes,ee=c?void 0:i?.listeners;return e.jsxs("div",{ref:i?.ref,role:n?"button":void 0,tabIndex:n&&!c?0:void 0,"aria-busy":c||void 0,"data-priority":d,className:Z,onClick:D,...T,...ee,children:[e.jsxs("div",{className:"ui-task-card__title-row",children:[e.jsx("p",{className:"ui-task-card__title",children:t.title}),s&&e.jsx(mt,{size:"small",label:s.label,sx:"ui-task-card__status",style:{backgroundColor:s.color||"#6B7280",color:"#fff",borderColor:"transparent"}})]}),(t.project?.name||t.milestone?.name)&&e.jsxs("div",{className:"ui-task-card__row ui-task-card__context",title:[t.project?.name,t.milestone?.name].filter(Boolean).join(" · "),children:[t.project?.name&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"ui-task-card__project-dot",style:{backgroundColor:t.project.color||"currentColor"},"aria-hidden":"true"}),e.jsx("span",{className:"ui-task-card__context-project",children:t.project.name})]}),t.project?.name&&t.milestone?.name&&e.jsx("span",{className:"ui-task-card__context-sep","aria-hidden":"true",children:"·"}),t.milestone?.name&&e.jsxs(e.Fragment,{children:[!t.project?.name&&e.jsx("span",{className:"ui-task-card__row-icon","aria-hidden":"true",children:e.jsx(Cl,{})}),e.jsx("span",{className:"ui-task-card__context-milestone",children:t.milestone.name})]})]}),g&&e.jsxs("div",{className:"ui-task-card__people",children:[m.length>0&&Vs(m,{role:"Assignee",color:"primary"}),v.length>0&&e.jsxs("span",{className:"ui-task-card__controllers",title:"Controllers",children:[e.jsx("span",{className:"ui-task-card__row-icon",children:e.jsx(bl,{})}),Vs(v,{role:"Controller",shape:"square",color:"warning"})]})]}),h.length>0&&e.jsx("div",{className:"ui-task-card__labels",children:h.map(O=>e.jsx(mt,{size:"small",label:O.name,style:{backgroundColor:O.color||_l,color:"#fff",borderColor:"transparent"}},O.id))}),q&&e.jsxs("div",{className:"ui-task-card__footer",children:[e.jsx("div",{className:"ui-task-card__footer-left",children:P&&e.jsxs("span",{className:f?"ui-task-card__due ui-task-card__due--overdue":"ui-task-card__due",title:[t.start_date&&`Start: ${u(t.start_date)}`,t.due_date&&`Due: ${u(t.due_date)}`].filter(Boolean).join(" · "),children:[e.jsx("span",{className:"ui-task-card__row-icon",children:f?e.jsx(vl,{}):e.jsx(kl,{})}),t.start_date&&t.due_date?e.jsxs(e.Fragment,{children:[u(t.start_date),e.jsx("span",{className:"ui-task-card__due-arrow","aria-hidden":"true",children:"→"}),u(t.due_date)]}):t.due_date?u(t.due_date):t.start_date?e.jsxs(e.Fragment,{children:[u(t.start_date),e.jsx("span",{className:"ui-task-card__due-arrow","aria-hidden":"true",children:"→"})]}):null]})}),e.jsxs("div",{className:"ui-task-card__footer-right",children:[N>0&&e.jsxs("span",{className:"ui-task-card__active",title:N===1?"1 person is working on this now":`${N} people are working on this now`,children:[e.jsx("span",{className:"ui-task-card__row-icon ui-task-card__active-icon",children:e.jsx(Nl,{})}),N>1&&N]}),k>0&&e.jsxs("span",{className:S?"ui-task-card__count ui-task-card__count--done":"ui-task-card__count",title:$!==void 0?`${$} of ${k} subtasks done`:`${k} subtask${k===1?"":"s"}`,children:[e.jsx("span",{className:"ui-task-card__row-icon",children:e.jsx(wl,{})}),$!==void 0?`${$}/${k}`:k]}),_>0&&e.jsxs("span",{className:"ui-task-card__count",children:[e.jsx("span",{className:"ui-task-card__row-icon",children:e.jsx(jl,{})}),_]}),y>0&&e.jsxs("span",{className:"ui-task-card__count",children:[e.jsx("span",{className:"ui-task-card__row-icon",children:e.jsx(yl,{})}),y]})]})]})]})};Ys.displayName="TaskCard";function _t(t){return!!t.endDate&&t.endDate>t.date}function Ws(t,n){const s=t.endDate&&t.endDate>t.date?t.endDate:t.date;return t.date<=n&&n<=s}const Dl={label:"",short:"",icon:"📅",color:"#718096",bg:"rgba(113,128,150,0.10)"};function $t(t,n){return n[t]??{...Dl,label:t,short:t}}function _n(t,n){return t.title?t.title:$t(t.category,n??{}).label||t.category}function Lt(t){const n=t.getFullYear(),s=String(t.getMonth()+1).padStart(2,"0"),a=String(t.getDate()).padStart(2,"0");return`${n}-${s}-${a}`}function Sl(t){const[n,s,a]=t.split("-").map(Number);return new Date(n,s-1,a)}function Ks(t){const n=t.getDay(),s=n===0?-6:1-n,a=new Date(t);return a.setDate(t.getDate()+s),a.setHours(0,0,0,0),a}const Us=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],qt=["January","February","March","April","May","June","July","August","September","October","November","December"];function Gs(t){return t.type==="daterange"?{start:null,end:null}:t.type==="select"&&!t.multiple?null:[]}function El(t,n){if(!t.type||t.type==="pills")return Array.isArray(n)?n.length:0;if(t.type==="select")return Array.isArray(n)?n.length:n!==null&&n!==""?1:0;if(t.type==="daterange"){const s=n;return s?.start||s?.end?1:0}return 0}const qs=({isOpen:t,onClose:n,sections:s,value:a,onChange:r,onReset:i,renderBody:o})=>{function c(h,m){r({...a,[h]:m})}function d(h,m){const v=a[h]??[],g=v.includes(m)?v.filter(_=>_!==m):[...v,m];r({...a,[h]:g})}function u(){i()}const p=o?0:s.reduce((h,m)=>h+El(m,a[m.id]??Gs(m)),0),f=`ui-calendar__filter${t?" ui-calendar__filter--open":""}`;return e.jsx("aside",{className:f,"aria-label":"Filters","aria-hidden":!t,children:e.jsxs("div",{className:"ui-cal-filter",children:[e.jsxs("div",{className:"ui-cal-filter__header",children:[e.jsxs("span",{className:"ui-cal-filter__title",children:["Filters",p>0?e.jsx("span",{className:"ui-cal-filter__count",children:p}):null]}),e.jsx(Ie,{icon:e.jsx(jt,{}),"aria-label":"Close filters",onClick:n,variant:"ghost",color:"neutral",size:"small",style:{borderRadius:"var(--radius-sm)"}})]}),e.jsx("div",{className:"ui-cal-filter__body",children:o?o():s.map(h=>e.jsxs("div",{className:"ui-cal-filter__section",children:[e.jsx("div",{className:"ui-cal-filter__section-title",children:h.title}),$l(h,a[h.id]??Gs(h),d,c)]},h.id))}),e.jsx("div",{className:"ui-cal-filter__footer",children:e.jsx(Xe,{variant:"outlined",color:"neutral",size:"small",style:{flex:1},onClick:u,children:"Reset all"})})]})})};qs.displayName="CalendarFilterPanel";function $l(t,n,s,a){if(t.type==="select")return t.searchable?e.jsx(Qn,{options:t.options,value:n,onChange:i=>a(t.id,i),multiple:t.multiple,placeholder:t.placeholder,clearable:t.clearable,fullWidth:!0}):e.jsx(Ln,{options:t.options,value:n,onChange:i=>a(t.id,i),multiple:t.multiple,placeholder:t.placeholder,clearable:t.clearable,fullWidth:!0});if(t.type==="daterange")return e.jsx(la,{mode:"range",rangeValue:n,onRangeChange:i=>a(t.id,i),minDate:t.minDate,maxDate:t.maxDate,triggerVariant:"input",multiMonth:!1});const r=n??[];return e.jsx("div",{className:"ui-cal-filter__pills",children:t.options.map(i=>e.jsx(mt,{label:i.label,variant:"outlined",color:"neutral",size:"small",selected:r.includes(i.value),onClick:()=>{t.multiple===!1?a(t.id,r.includes(i.value)?[]:[i.value]):s(t.id,i.value)}},i.value))})}const Ll=[{id:"month",label:"Month"},{id:"week",label:"Week"},{id:"day",label:"Day"}],Yn={borderRadius:"var(--radius-sm)"};function Tl(t,n,s,a,r){if(t==="month")return`${qt[s]} ${n}`;if(t==="week"&&a){const i=new Date(a);return i.setDate(a.getDate()+6),a.getMonth()===i.getMonth()?`${qt[a.getMonth()]} ${a.getDate()}–${i.getDate()}, ${a.getFullYear()}`:`${qt[a.getMonth()]} ${a.getDate()} – ${qt[i.getMonth()]} ${i.getDate()}, ${i.getFullYear()}`}if(t==="day"&&r){const[i,o,c]=r.split("-").map(Number);return new Date(i,o-1,c).toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric"})}return`${qt[s]} ${n}`}const Xs=({view:t,year:n,month:s,weekStart:a,dayDate:r,onViewChange:i,onPrev:o,onNext:c,onToday:d,onSearch:u,onFilter:p,onAdd:f,showSearch:h,showFilters:m,showAdd:v,filterOpen:g})=>{const _=Tl(t,n,s,a,r);return e.jsxs("div",{className:"ui-calendar__header",children:[e.jsxs("div",{className:"ui-calendar__nav",children:[e.jsx(Ie,{icon:e.jsx(Pn,{}),"aria-label":"Previous",onClick:o,variant:"outlined",color:"neutral",size:"small",style:Yn}),e.jsx("button",{className:"ui-calendar__today-btn",onClick:d,children:"Today"}),e.jsx(Ie,{icon:e.jsx(Hn,{}),"aria-label":"Next",onClick:c,variant:"outlined",color:"neutral",size:"small",style:Yn})]}),e.jsx("div",{className:"ui-calendar__title",children:_}),e.jsx("div",{className:"ui-calendar__view-switcher",role:"group","aria-label":"Calendar view",children:Ll.map(({id:y,label:N})=>e.jsx("button",{className:`ui-calendar__view-btn${t===y?" ui-calendar__view-btn--active":""}`,onClick:()=>i(y),"aria-pressed":t===y,children:N},y))}),e.jsxs("div",{className:"ui-calendar__actions",children:[h&&e.jsx(Ie,{icon:e.jsx(Ir,{}),"aria-label":"Search (Ctrl+K)",onClick:u,variant:"outlined",color:"neutral",size:"small",style:Yn,title:"Search (Ctrl+K)"}),m&&e.jsx(Ie,{icon:e.jsx(Kr,{}),"aria-label":"Filters",onClick:p,variant:g?"filled":"outlined",color:"neutral",size:"small",style:Yn,"aria-pressed":g}),v&&e.jsx(Xe,{variant:"filled",color:"primary",size:"small",onClick:f,"aria-label":"Add event",children:"+ New"})]})]})};Xs.displayName="CalendarHeader";const gn=({event:t,compact:n=!1,categoryMeta:s,onClick:a})=>{const r=$t(t.category,s),i=r.variant==="icon",o=_n(t,s),c={"--cal-event-color":r.color,"--cal-event-bg":r.bg},d=["ui-calendar-event",i?"ui-calendar-event--celebration":"",t.urgent?"ui-calendar-event--urgent":""].filter(Boolean).join(" ");return e.jsxs("div",{className:d,style:c,onClick:u=>{u.stopPropagation(),a(t)},role:"button",tabIndex:0,onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),a(t))},title:o,children:[i?e.jsx("span",{className:"ui-calendar-event__icon",children:r.icon}):e.jsx("span",{className:"ui-calendar-event__bar"}),e.jsxs("div",{className:"ui-calendar-event__content",children:[e.jsx("div",{className:"ui-calendar-event__name",children:o}),!n&&t.time&&e.jsxs("div",{className:"ui-calendar-event__meta",children:[t.time,t.duration?` · ${t.duration}m`:""]})]})]})};gn.displayName="CalendarEventCard";const Wn=({event:t,categoryMeta:n,continuesLeft:s,continuesRight:a,onClick:r})=>{const i=$t(t.category,n),o=_n(t,n),c={"--cal-event-color":i.color,"--cal-event-bg":i.bg},d=["ui-calendar-range",s?"ui-calendar-range--continues-left":"",a?"ui-calendar-range--continues-right":"",t.urgent?"ui-calendar-range--urgent":""].filter(Boolean).join(" ");return e.jsxs("div",{className:d,style:c,onClick:u=>{u.stopPropagation(),r(t)},role:"button",tabIndex:0,onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),r(t))},title:o,children:[s&&e.jsx("span",{className:"ui-calendar-range__chevron ui-calendar-range__chevron--left","aria-hidden":!0,children:"‹"}),e.jsx("span",{className:"ui-calendar-range__title",children:o}),a&&e.jsx("span",{className:"ui-calendar-range__chevron ui-calendar-range__chevron--right","aria-hidden":!0,children:"›"})]})};Wn.displayName="CalendarRangeBar";function Zs(t,n){if(n.length!==7)return{bars:[],laneCount:0};const s=Lt(n[0]),a=Lt(n[6]),i=t.filter(d=>_t(d)?d.date<=a&&d.endDate>=s:!1).slice().sort((d,u)=>{if(d.date!==u.date)return d.date<u.date?-1:1;const p=Qs(d.date,d.endDate),f=Qs(u.date,u.endDate);return p!==f?f-p:d.id<u.id?-1:d.id>u.id?1:0}),o=[],c=[];for(const d of i){const u=d.date<s?0:Js(d.date,n),p=d.endDate>a?6:Js(d.endDate,n);if(u<0||p<0||p<u)continue;let f=o.findIndex(h=>h.every(m=>m.endCol<u));f===-1&&(f=o.length,o.push([])),o[f].push({endCol:p}),c.push({event:d,startCol:u,endCol:p,lane:f,continuesLeft:d.date<s,continuesRight:d.endDate>a})}return{bars:c,laneCount:o.length}}function Js(t,n){for(let s=0;s<n.length;s++)if(Lt(n[s])===t)return s;return-1}function Qs(t,n){const[s,a,r]=t.split("-").map(Number),[i,o,c]=n.split("-").map(Number),d=new Date(s,a-1,r).getTime(),u=new Date(i,o-1,c).getTime();return Math.round((u-d)/864e5)+1}const Al=3,Ca=3,Rs=({events:t,year:n,month:s,today:a,categoryMeta:r,renderEvent:i,onEventClick:o,onDayClick:c})=>{const d=Il(n,s),u=l.useMemo(()=>{const p={};for(const f of t)_t(f)||(p[f.date]||(p[f.date]=[]),p[f.date].push(f));return p},[t]);return e.jsxs("div",{className:"ui-calendar-month",children:[e.jsx("div",{className:"ui-calendar-month__weekdays",children:Us.map(p=>e.jsx("div",{className:"ui-calendar-month__weekday",children:p},p))}),e.jsx("div",{className:"ui-calendar-month__grid",children:d.map((p,f)=>{const{bars:h,laneCount:m}=Zs(t,p.map($=>$.date)),v=h.filter($=>$.lane<Ca),g=h.filter($=>$.lane>=Ca),_=Math.min(m,Ca),y=_*er,N=Math.max(1,Al-_),k=Array(7).fill(0);for(const $ of g)for(let S=$.startCol;S<=$.endCol;S++)k[S]+=1;return e.jsxs("div",{className:"ui-calendar-month__row",children:[p.map(($,S)=>{const P=Lt($.date),q=P===a,Z=$.date.getDay()===0||$.date.getDay()===6,D=u[P]??[],T=k[S],O=D.length>N||T>0?Math.max(0,N-1):N,Ne=D.slice(0,O),ue=D.length-Ne.length+T,Q=["ui-calendar-month__cell",$.outside?"ui-calendar-month__cell--outside":"",q?"ui-calendar-month__cell--today":"",Z?"ui-calendar-month__cell--weekend":""].filter(Boolean).join(" ");return e.jsxs("div",{className:Q,onClick:()=>c(P),children:[e.jsx("div",{className:"ui-calendar-month__date",children:$.date.getDate()}),e.jsx("div",{className:"ui-calendar-month__events",style:y?{marginTop:y+4}:void 0,children:Ne.map(re=>e.jsx(l.Fragment,{children:i?i(re,!0):e.jsx(gn,{event:re,compact:!0,categoryMeta:r,onClick:o})},re.id))}),ue>0&&e.jsxs("button",{type:"button",className:"ui-calendar-month__more",onClick:re=>{re.stopPropagation(),c(P)},children:["+",ue]})]},P)}),v.length>0&&e.jsx("div",{className:"ui-calendar-month__ranges",style:{height:y},children:v.map($=>{const S=$.startCol/7*100,P=($.endCol-$.startCol+1)/7*100;return e.jsx("div",{className:"ui-calendar-month__range-slot",style:{left:`${S}%`,width:`${P}%`,top:$.lane*er},children:e.jsx(Wn,{event:$.event,categoryMeta:r,continuesLeft:$.continuesLeft,continuesRight:$.continuesRight,onClick:o})},$.event.id)})})]},f)})})]})};Rs.displayName="MonthView";const er=20;function Il(t,n){const s=new Date(t,n,1),a=s.getDay(),r=a===0?6:a-1,i=new Date(s);i.setDate(1-r);const o=[];for(let c=0;c<6;c++){const d=[];for(let u=0;u<7;u++){const p=new Date(i);p.setDate(i.getDate()+c*7+u),d.push({date:p,outside:p.getMonth()!==n})}o.push(d)}return o}const tr=22,nr=({events:t,weekStart:n,today:s,categoryMeta:a,renderEvent:r,onEventClick:i,onDayClick:o})=>{const c=Pl(n),d=l.useMemo(()=>{const f={};for(const h of t)_t(h)||(f[h.date]||(f[h.date]=[]),f[h.date].push(h));return f},[t]),{bars:u,laneCount:p}=l.useMemo(()=>Zs(t,c),[t,c]);return e.jsxs("div",{className:"ui-calendar-week",children:[e.jsx("div",{className:"ui-calendar-week__header",children:c.map((f,h)=>{const m=Lt(f)===s,v=f.getDay()===0||f.getDay()===6,g=["ui-calendar-week__day-header",m?"ui-calendar-week__day-header--today":"",v?"ui-calendar-week__day-header--weekend":""].filter(Boolean).join(" ");return e.jsxs("div",{className:g,children:[e.jsx("div",{className:"ui-calendar-week__day-name",children:Us[h]}),e.jsx("div",{className:"ui-calendar-week__day-num",children:f.getDate()})]},h)})}),u.length>0&&e.jsx("div",{className:"ui-calendar-week__allday",style:{height:p*tr+8},children:u.map(f=>{const h=f.startCol/7*100,m=(f.endCol-f.startCol+1)/7*100;return e.jsx("div",{className:"ui-calendar-week__range-slot",style:{left:`calc(${h}% + 4px)`,width:`calc(${m}% - 8px)`,top:4+f.lane*tr},children:e.jsx(Wn,{event:f.event,categoryMeta:a,continuesLeft:f.continuesLeft,continuesRight:f.continuesRight,onClick:i})},f.event.id)})}),e.jsx("div",{className:"ui-calendar-week__columns",children:c.map((f,h)=>{const m=Lt(f),v=f.getDay()===0||f.getDay()===6,g=d[m]??[],_=["ui-calendar-week__col",v?"ui-calendar-week__col--weekend":""].filter(Boolean).join(" ");return e.jsx("div",{className:_,onClick:()=>o(m),children:g.map(y=>e.jsx(l.Fragment,{children:r?r(y,!1):e.jsx(gn,{event:y,categoryMeta:a,onClick:i})},y.id))},h)})})]})};nr.displayName="WeekView";function Pl(t){return Array.from({length:7},(n,s)=>{const a=new Date(t);return a.setDate(t.getDate()+s),a})}const Ma=7,ar=Array.from({length:21-Ma},(t,n)=>Ma+n),Hl=60,sr=({events:t,date:n,categoryMeta:s,renderEvent:a,onEventClick:r})=>{const i=t.filter(p=>_t(p)&&Ws(p,n)),o=t.filter(p=>!_t(p)&&p.date===n),c=o.filter(p=>p.time),d=o.filter(p=>!p.time),u=i.length>0||d.length>0;return e.jsxs("div",{className:"ui-calendar-day",children:[u&&e.jsxs("div",{className:"ui-calendar-day__allday",children:[e.jsx("span",{className:"ui-calendar-day__allday-label",children:"All day"}),i.map(p=>e.jsx("div",{className:"ui-calendar-day__range-slot",children:e.jsx(Wn,{event:p,categoryMeta:s,continuesLeft:p.date<n,continuesRight:p.endDate>n,onClick:r})},p.id)),d.map(p=>e.jsx(l.Fragment,{children:a?a(p,!0):e.jsx(gn,{event:p,compact:!0,categoryMeta:s,onClick:r})},p.id))]}),e.jsxs("div",{className:"ui-calendar-day__time-grid",children:[e.jsx("div",{className:"ui-calendar-day__hours",children:ar.map(p=>e.jsxs("div",{className:"ui-calendar-day__hour-label",children:[String(p).padStart(2,"0"),":00"]},p))}),e.jsxs("div",{className:"ui-calendar-day__slots",style:{position:"relative"},children:[ar.map(p=>e.jsx("div",{className:"ui-calendar-day__slot"},p)),e.jsx("div",{className:"ui-calendar-day__events",children:c.map(p=>{const{top:f,height:h}=zl(p,Ma,Hl),m=$t(p.category,s);return e.jsx("div",{className:"ui-calendar-day__timed-event",style:{top:f,minHeight:Math.max(h,32),"--cal-event-color":m.color,"--cal-event-bg":m.bg},onClick:()=>r(p),children:a?a(p,!1):e.jsx(gn,{event:p,categoryMeta:s,onClick:r})},p.id)})})]})]})]})};sr.displayName="DayView";function zl(t,n,s){const[a,r]=(t.time??"08:00").split(":").map(Number),o=((a-n)*60+r)/60*s,d=(t.duration??60)/60*s;return{top:o,height:d}}function Bl(t,n){const[s,a,r]=t.split("-").map(Number),o=new Date(s,a-1,r).toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"});return n?`${o} at ${n}`:o}function Ol(t,n){const[s,a,r]=t.split("-").map(Number),[i,o,c]=n.split("-").map(Number),d=new Date(s,a-1,r),u=new Date(i,o-1,c),p=s===i,f=d.toLocaleDateString("en-US",{month:"short",day:"numeric",year:p?void 0:"numeric"}),h=u.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return`${f} – ${h}`}function Fl(t,n){const s=_t(t),a=_t(n);if(s!==a)return s?-1:1;if(s&&a)return t.date!==n.date?t.date<n.date?-1:1:t.endDate!==n.endDate?t.endDate>n.endDate?-1:1:t.id<n.id?-1:t.id>n.id?1:0;const r=(t.time??"").localeCompare(n.time??"");return r!==0?r:t.id<n.id?-1:t.id>n.id?1:0}function Vl(t,n){const[s,a,r]=t.split("-").map(Number),[i,o,c]=n.split("-").map(Number),d=new Date(s,a-1,r).getTime(),u=new Date(i,o-1,c).getTime();return Math.round((u-d)/864e5)+1}function Yl(t){const[n,s,a]=t.split("-").map(Number);return`${new Date(n,s-1,a).toLocaleDateString("en-US",{weekday:"long"})}, ${qt[s-1]} ${a}`}const rr=({event:t,dayDate:n,dayEvents:s,isOpen:a,categoryMeta:r,renderSidebarDetail:i,renderSidebarItem:o,onClose:c,onBack:d,onEventClick:u,onEdit:p,onDelete:f})=>{const h=`ui-calendar__sidebar${a?" ui-calendar__sidebar--open":""}`,m=()=>t?e.jsx(Kl,{event:t,categoryMeta:r,renderSidebarDetail:i,onClose:c,onBack:d,onEdit:p,onDelete:f}):n?e.jsx(Wl,{dayDate:n,events:s,categoryMeta:r,renderSidebarItem:o,onClose:c,onEventClick:u}):e.jsxs("div",{className:"ui-calendar__sidebar-body",style:{alignItems:"center",justifyContent:"center",color:"var(--cal-text2)"},children:[e.jsx("span",{style:{fontSize:32},children:"📋"}),e.jsx("span",{style:{fontSize:13},children:"Select an event to see details"})]});return e.jsx("aside",{className:h,"aria-label":"Event details",children:e.jsx("div",{className:"ui-calendar__sidebar-inner",children:m()})})};rr.displayName="CalendarSidebar";const Wl=({dayDate:t,events:n,categoryMeta:s,renderSidebarItem:a,onClose:r,onEventClick:i})=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"ui-calendar__sidebar-header",children:[e.jsxs("div",{className:"ui-calendar__sidebar-meta",style:{flex:1},children:[e.jsx("div",{className:"ui-calendar__sidebar-title",children:Yl(t)}),e.jsx("div",{className:"ui-calendar__sidebar-subtitle",style:{color:"var(--cal-text2)"},children:n.length===0?"No events":`${n.length} event${n.length>1?"s":""}`})]}),e.jsx(Ie,{icon:e.jsx(jt,{}),"aria-label":"Close sidebar",onClick:r,variant:"ghost",color:"neutral",size:"small",style:{borderRadius:"var(--radius-sm)"}})]}),e.jsx("div",{className:"ui-calendar__sidebar-body",children:n.length===0?e.jsxs("div",{className:"ui-calendar__sidebar-empty",children:[e.jsx("span",{style:{fontSize:28},children:"📅"}),e.jsx("span",{children:"No events this day"})]}):e.jsx("div",{className:"ui-calendar__sidebar-day-list",children:n.slice().sort(Fl).map(o=>{const c=$t(o.category,s);return e.jsx("button",{className:"ui-calendar__sidebar-day-item",style:{"--cal-event-color":c.color,"--cal-event-bg":c.bg},onClick:()=>i(o),children:a?a(o):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"ui-calendar__sidebar-day-item-bar"}),e.jsxs("div",{className:"ui-calendar__sidebar-day-item-body",children:[e.jsx("span",{className:"ui-calendar__sidebar-day-item-title",children:_n(o,s)}),e.jsxs("span",{className:"ui-calendar__sidebar-day-item-meta",children:[e.jsx("span",{style:{color:c.color},children:c.label}),o.time&&e.jsxs("span",{children:[" · ",o.time,o.duration?` (${o.duration} min)`:""]})]})]}),e.jsx("span",{className:"ui-calendar__sidebar-day-item-arrow",children:"›"})]})},o.id)})})})]}),Kl=({event:t,categoryMeta:n,renderSidebarDetail:s,onClose:a,onBack:r,onEdit:i,onDelete:o})=>{const c=$t(t.category,n),d=c.variant==="icon",u=_n(t,n),p=c.icon??c.label[0]?.toUpperCase()??"?";return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"ui-calendar__sidebar-header",children:[e.jsx("div",{className:"ui-calendar__sidebar-avatar",style:d?{background:c.bg,fontSize:20}:{background:c.bg,color:c.color},children:p}),e.jsxs("div",{className:"ui-calendar__sidebar-meta",children:[e.jsx("div",{className:"ui-calendar__sidebar-title",title:u,children:u}),e.jsx("div",{className:"ui-calendar__sidebar-subtitle",children:e.jsx("span",{style:{color:c.color},children:c.label})})]}),e.jsxs("div",{style:{display:"flex",gap:2},children:[r&&e.jsx(Ie,{icon:e.jsx(Ur,{}),"aria-label":"Back to day list",title:"Back to events",onClick:r,variant:"ghost",color:"neutral",size:"small",style:{borderRadius:"var(--radius-sm)"}}),e.jsx(Ie,{icon:e.jsx(jt,{}),"aria-label":"Close sidebar",onClick:a,variant:"ghost",color:"neutral",size:"small",style:{borderRadius:"var(--radius-sm)"}})]})]}),e.jsx("div",{className:"ui-calendar__sidebar-body",children:s?s(t):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"ui-calendar__sidebar-section",children:[e.jsx("div",{className:"ui-calendar__sidebar-section-title",children:"When & Where"}),_t(t)?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"ui-calendar__sidebar-row",children:[e.jsx("span",{className:"ui-calendar__sidebar-row-label",children:"Dates"}),e.jsx("span",{className:"ui-calendar__sidebar-row-value",children:Ol(t.date,t.endDate)})]}),e.jsxs("div",{className:"ui-calendar__sidebar-row",children:[e.jsx("span",{className:"ui-calendar__sidebar-row-label",children:"Length"}),e.jsxs("span",{className:"ui-calendar__sidebar-row-value",children:[Vl(t.date,t.endDate)," days"]})]})]}):e.jsxs("div",{className:"ui-calendar__sidebar-row",children:[e.jsx("span",{className:"ui-calendar__sidebar-row-label",children:"Date"}),e.jsx("span",{className:"ui-calendar__sidebar-row-value",children:Bl(t.date,t.time)})]}),!_t(t)&&t.duration&&e.jsxs("div",{className:"ui-calendar__sidebar-row",children:[e.jsx("span",{className:"ui-calendar__sidebar-row-label",children:"Duration"}),e.jsxs("span",{className:"ui-calendar__sidebar-row-value",children:[t.duration," min"]})]}),t.platform&&e.jsxs("div",{className:"ui-calendar__sidebar-row",children:[e.jsx("span",{className:"ui-calendar__sidebar-row-label",children:"Platform"}),e.jsx("span",{className:"ui-calendar__sidebar-row-value",children:t.platform})]}),t.meetLink&&e.jsx("a",{className:"ui-calendar__sidebar-link",href:t.meetLink,target:"_blank",rel:"noopener noreferrer",children:"🔗 Join meeting"})]}),t.notes&&e.jsxs("div",{className:"ui-calendar__sidebar-section",children:[e.jsx("div",{className:"ui-calendar__sidebar-section-title",children:"Notes"}),e.jsx("div",{className:"ui-calendar__sidebar-notes",children:t.notes})]})]})}),(i||o)&&e.jsxs("div",{className:"ui-calendar__sidebar-actions",children:[o&&e.jsx(Xe,{variant:"outlined",color:"error",size:"small",style:{flex:1},onClick:()=>o(t.id),children:"Delete"}),i&&e.jsx(Xe,{variant:"filled",color:"primary",size:"small",style:{flex:1},onClick:()=>i(t),children:"Edit"})]})]})};function Ul(t,n,s){const a=n.toLowerCase(),r=t.data?Object.values(t.data).map(String):[];return[t.title,t.notes,$t(t.category,s).label,...r].some(i=>i?.toLowerCase().includes(a))}function Da(t){const[n,s,a]=t.split("-").map(Number);return new Date(n,s-1,a).toLocaleDateString("en-US",{month:"short",day:"numeric"})}function Gl(t){return _t(t)?`${Da(t.date)} – ${Da(t.endDate)}`:Da(t.date)}const ir=({open:t,events:n,categoryMeta:s,onClose:a,onSelect:r})=>{const[i,o]=l.useState(""),[c,d]=l.useState(0),u=l.useRef(null);l.useEffect(()=>{t&&(o(""),d(0),setTimeout(()=>u.current?.focus(),50))},[t]);const p=l.useMemo(()=>i.trim()?n.filter(h=>Ul(h,i,s)).slice(0,20):[],[i,n,s]);l.useEffect(()=>{d(0)},[p.length]);const f=h=>{h.key==="ArrowDown"&&(h.preventDefault(),d(m=>Math.min(m+1,p.length-1))),h.key==="ArrowUp"&&(h.preventDefault(),d(m=>Math.max(m-1,0))),h.key==="Enter"&&p[c]&&(r(p[c]),a())};return e.jsx(ta,{open:t,onClose:a,closeOnBackdropClick:!0,closeOnEscape:!0,showCloseButton:!1,size:"medium",style:{padding:0,overflow:"hidden",borderRadius:12},children:e.jsxs("div",{className:"ui-calendar-search",onKeyDown:f,children:[e.jsx("div",{className:"ui-calendar-search__input-wrap",children:e.jsx(Ft,{ref:u,fullWidth:!0,placeholder:"Search events…",value:i,onChange:h=>o(h.target.value),autoComplete:"off",startAdornment:e.jsx("span",{children:"⌕"}),endAdornment:e.jsx("kbd",{className:"ui-calendar-search__kbd",children:"Esc"}),sx:{root:"ui-calendar-search__textfield"}})}),e.jsxs("div",{className:"ui-calendar-search__results",children:[i.trim()&&p.length===0&&e.jsxs("div",{className:"ui-calendar-search__empty",children:['No events found for "',i,'"']}),!i.trim()&&e.jsx("div",{className:"ui-calendar-search__empty",children:"Type to search events…"}),p.map((h,m)=>{const v=$t(h.category,s),g=_n(h,s);return e.jsxs("div",{className:`ui-calendar-search__result${m===c?" ui-calendar-search__result--active":""}`,onClick:()=>{r(h),a()},onMouseEnter:()=>d(m),children:[e.jsx("div",{className:"ui-calendar-search__result-icon",style:{background:v.bg,color:v.color},children:v.icon}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{className:"ui-calendar-search__result-name",children:g}),e.jsxs("div",{className:"ui-calendar-search__result-meta",children:[v.label,h.date?` · ${h.date}`:""]})]}),e.jsx("div",{className:"ui-calendar-search__result-date",children:Gl(h)})]},h.id)})]})]})})};ir.displayName="CalendarSearch";function ql(t,n){if(t==="month"){const a=n.getFullYear(),r=n.getMonth(),o=(new Date(a,r,1).getDay()+6)%7,c=new Date(a,r,1-o),d=new Date(c);return d.setDate(c.getDate()+41),{start:c,end:d}}if(t==="week"){const a=Ks(n),r=new Date(a);return r.setDate(a.getDate()+6),{start:a,end:r}}const s=new Date(n.getFullYear(),n.getMonth(),n.getDate());return{start:s,end:s}}const lr=({events:t=[],defaultView:n="month",initialDate:s,categoryMeta:a,filterSections:r,filterValues:i,onFilterValuesChange:o,renderEvent:c,renderKPI:d,renderSidebarDetail:u,renderSidebarItem:p,renderFilterPanel:f,renderFilterPanelBody:h,onAddClick:m,onEditClick:v,onEventCreate:g,onEventDelete:_,onFilterChange:y,onNavigate:N,showSearch:k=!0,showFilters:$=!0,showSidebar:S=!0,pageMode:P=!1,sx:q,style:Z})=>{const D=i!==void 0,T=Lt(new Date),ee=l.useMemo(()=>a??{},[a]),[O,Ne]=l.useState(n),[ue,Q]=l.useState(s??new Date),re=ue.getFullYear(),je=ue.getMonth(),ye=Ks(ue),R=Lt(ue),[X,b]=l.useState(null),[I,H]=l.useState(null),[W,V]=l.useState(null),[ve,w]=l.useState(!1),[te,ie]=l.useState(!1),[he,z]=l.useState(!1),le=l.useMemo(()=>r??[],[r]),[$e,Pe]=l.useState({}),pe=D?i:$e,Ce=l.useCallback(fe=>{if(D){const Se=typeof fe=="function"?fe(i):fe;o?.(Se)}else Pe(fe)},[D,i,o]);l.useEffect(()=>{N&&N(ql(O,ue))},[O,ue,N]),l.useEffect(()=>{y?.(pe)},[pe,y]);const _e=l.useCallback(fe=>{Q(Se=>{const we=new Date(Se);return O==="month"&&we.setMonth(Se.getMonth()+fe),O==="week"&&we.setDate(Se.getDate()+fe*7),O==="day"&&we.setDate(Se.getDate()+fe),we})},[O]),He=l.useCallback(()=>Q(new Date),[]),M=l.useCallback(()=>{Ce(Object.fromEntries(le.map(fe=>fe.type==="daterange"?[fe.id,{start:null,end:null}]:fe.type==="select"&&!fe.multiple?[fe.id,null]:[fe.id,[]])))},[le,Ce]);l.useEffect(()=>{const fe=!!(m||g),Se=we=>{if(!(["INPUT","TEXTAREA","SELECT"].includes(we.target?.tagName)&&we.key!=="Escape")){if((we.ctrlKey||we.metaKey)&&we.key==="k"&&k){we.preventDefault(),ie(!0);return}if(we.key==="Escape"){if(te){ie(!1);return}if(ve){w(!1),b(null),H(null);return}return}if(we.key==="]"&&S){w(oe=>!oe);return}if(we.key==="ArrowLeft"&&!te){_e(-1);return}if(we.key==="ArrowRight"&&!te){_e(1);return}we.key==="n"&&!te&&fe&&m&&m(void 0)}};return window.addEventListener("keydown",Se),()=>window.removeEventListener("keydown",Se)},[te,ve,_e,k,S,m,g]);const G=l.useCallback(fe=>{V(I),b(fe),H(null),S&&w(!0)},[S,I]),ae=l.useCallback(fe=>{H(fe),b(null),S&&w(!0)},[S]),j=l.useCallback(fe=>{V(null),b(fe),Q(Sl(fe.date)),S&&w(!0),ie(!1)},[S]),B=l.useCallback(fe=>{_?.(fe),b(null),V(null),w(!1)},[_]),U=l.useCallback(()=>{b(null),H(W),V(null)},[W]),J=l.useCallback(fe=>{v?.(fe)},[v]),ke=l.useMemo(()=>I?t.filter(fe=>Ws(fe,I)):[],[t,I]),C=!!(m||g),de=["ui-calendar",P&&"ui-calendar--page",q].filter(Boolean).join(" ");return e.jsxs("div",{className:de,style:Z,children:[e.jsx(Xs,{view:O,year:re,month:je,weekStart:ye,dayDate:R,onViewChange:Ne,onPrev:()=>_e(-1),onNext:()=>_e(1),onToday:He,onSearch:k?()=>ie(!0):void 0,onFilter:$?()=>z(fe=>!fe):void 0,onAdd:C?()=>{m&&m(void 0)}:void 0,showSearch:k,showFilters:$,showAdd:C,filterOpen:he}),d&&d(),e.jsxs("div",{className:"ui-calendar__body",children:[$&&(f?f({isOpen:he,onClose:()=>z(!1)}):e.jsx(qs,{isOpen:he,onClose:()=>z(!1),sections:le,value:pe,onChange:Ce,onReset:M,renderBody:h})),e.jsx("div",{className:"ui-calendar__main",children:e.jsxs("div",{className:"ui-calendar__grid",children:[O==="month"&&e.jsx(Rs,{events:t,year:re,month:je,today:T,categoryMeta:ee,renderEvent:c,onEventClick:G,onDayClick:ae}),O==="week"&&e.jsx(nr,{events:t,weekStart:ye,today:T,categoryMeta:ee,renderEvent:c,onEventClick:G,onDayClick:ae}),O==="day"&&e.jsx(sr,{events:t,date:R,categoryMeta:ee,renderEvent:c,onEventClick:G})]})}),S&&e.jsx(rr,{event:X,dayDate:I,dayEvents:ke,isOpen:ve,categoryMeta:ee,renderSidebarDetail:u,renderSidebarItem:p,onClose:()=>{w(!1),b(null),H(null),V(null)},onBack:W?U:void 0,onEventClick:G,onEdit:v?J:void 0,onDelete:_?B:void 0})]}),k&&e.jsx(ir,{open:te,events:t,categoryMeta:ee,onClose:()=>ie(!1),onSelect:j})]})};lr.displayName="Calendar";const Xl={primary:"var(--palette-primary-main, #4299e1)",success:"var(--palette-success-main, #38a169)",warning:"var(--palette-warning-main, #f97316)",error:"var(--palette-error-main, #d32f2f)",info:"var(--palette-info-main, #0ea5e9)"};function Zl(t){if(t)return Xl[t]??t}const or=({metrics:t})=>t.length===0?null:e.jsx("div",{className:"ui-calendar__kpi",role:"list","aria-label":"KPI metrics",children:t.map((n,s)=>{const a=Zl(n.color);return e.jsxs("div",{className:`ui-calendar__kpi-item${n.onClick?" ui-calendar__kpi-item--clickable":""}`,onClick:n.onClick,role:n.onClick?"button":"listitem",tabIndex:n.onClick?0:void 0,onKeyDown:n.onClick?r=>{r.key==="Enter"&&n.onClick()}:void 0,children:[a&&e.jsx("span",{className:"ui-calendar__kpi-dot",style:{background:a}}),e.jsx("span",{className:"ui-calendar__kpi-value",children:n.value}),e.jsx("span",{className:"ui-calendar__kpi-label",children:n.label})]},s)})});or.displayName="CalendarKPIStrip";const Jl={palette:["--palette-primary-main","--palette-primary-light","--palette-primary-dark","--palette-primary-contrast-text","--palette-secondary-main","--palette-secondary-light","--palette-secondary-dark","--palette-secondary-contrast-text","--palette-success-main","--palette-success-light","--palette-success-dark","--palette-success-contrast-text","--palette-tertiary-main","--palette-tertiary-light","--palette-tertiary-dark","--palette-tertiary-contrast-text","--palette-warning-main","--palette-warning-light","--palette-warning-dark","--palette-warning-contrast-text","--palette-error-main","--palette-error-light","--palette-error-dark","--palette-error-contrast-text","--palette-info-main","--palette-info-light","--palette-info-dark","--palette-info-contrast-text","--palette-common-white","--palette-common-black","--palette-background-default","--palette-background-paper","--palette-text-primary","--palette-text-secondary","--palette-divider","--palette-action-hover","--palette-action-selected","--palette-action-disabled","--palette-action-disabledBackground","--palette-overlay-subtle","--palette-overlay-subtle-hover","--palette-badge-bg","--palette-primary-shadow","--palette-primary-shadow-strong","--palette-primary-overlay","--palette-primary-border","--palette-overlay-on-dark"],department:["--department-all-default","--department-all-hover","--department-all-active","--department-design-default","--department-design-hover","--department-design-active","--department-development-default","--department-development-hover","--department-development-active","--department-management-default","--department-management-hover","--department-management-active","--department-marketing-default","--department-marketing-hover","--department-marketing-active","--department-video-default","--department-video-hover","--department-video-active"],layout:["--layout-columns","--layout-gutter","--layout-max-width"],spacing:["--space-xs","--space-sm","--space-md","--space-lg","--space-xl","--space-2xl","--space-3xl"],fluidSpacing:["--space-fluid-xs","--space-fluid-sm","--space-fluid-md","--space-fluid-lg","--space-fluid-xl","--space-fluid-2xl","--space-fluid-3xl"],breakpoint:["--breakpoint-mobile-min","--breakpoint-mobile-max","--breakpoint-tablet-min","--breakpoint-tablet-max","--breakpoint-desktop-min","--breakpoint-desktop-max","--breakpoint-large-desktop-min","--breakpoint-large-desktop-max","--breakpoint-extra-large-min"],typography:["--font-family-base","--font-weight-regular","--font-weight-medium","--font-weight-semibold","--h1-font-size","--h1-font-line-height","--h2-font-size","--h2-font-line-height","--h3-font-size","--h3-font-line-height","--h4-font-size","--h4-font-line-height","--h5-font-size","--h5-font-line-height","--body-regular-font-size","--body-regular-font-line-height","--body-medium-font-size","--body-medium-font-line-height","--body-small-font-size","--body-small-font-line-height","--caption-font-size","--caption-font-line-height"],zIndex:["--z-index-dropdown","--z-index-sticky","--z-index-fixed","--z-index-backdrop","--z-index-modal","--z-index-popover","--z-index-tooltip"],motion:["--motion-fast","--motion-normal","--motion-slow","--motion-easing"],shadow:["--shadow-light","--shadow-card","--shadow-card-elevated","--shadow-card-hover","--shadow-medium","--shadow-heavy","--shadow-avatar","--shadow-badge","--shadow-primary-glow","--shadow-primary-glow-strong"],radius:["--radius-xs","--radius-sm","--radius-md","--radius-lg","--radius-xl","--radius-2xl","--radius-3xl","--radius-full"],gradient:["--gradient-primary-start","--gradient-primary-end","--gradient-primary-horizontal","--gradient-primary-vertical","--gradient-primary-diagonal","--gradient-primary-radial","--gradient-secondary-start","--gradient-secondary-end","--gradient-secondary-horizontal","--gradient-secondary-vertical","--gradient-secondary-diagonal","--gradient-secondary-radial","--gradient-success-horizontal","--gradient-success-diagonal","--gradient-tertiary-horizontal","--gradient-tertiary-diagonal","--gradient-warning-horizontal","--gradient-error-horizontal","--gradient-info-horizontal","--gradient-primary-secondary-horizontal","--gradient-primary-secondary-diagonal","--gradient-primary-tertiary-horizontal","--gradient-primary-success-horizontal","--gradient-success-tertiary-horizontal"],component:["--button-padding-x","--button-padding-y","--button-border-width","--button-border-radius","--textfield-border-color","--textfield-border-radius","--textfield-padding-x","--textfield-padding-y"]};ne.Accordion=ms,ne.AccordionContent=ma,ne.AccordionItem=ha,ne.AccordionRoot=ua,ne.AccordionTrigger=pa,ne.ActivityHeatmap=Ts,ne.Autocomplete=Qn,ne.Avatar=Ut,ne.AvatarGroup=va,ne.Badge=St,ne.Button=Xe,ne.Calendar=lr,ne.CalendarKPIStrip=or,ne.Checkbox=da,ne.Chip=mt,ne.ConfirmDialog=_a,ne.ConfirmProvider=js,ne.CourseCard=il,ne.DatePicker=la,ne.Drawer=es,ne.Dropdown=Jn,ne.DropdownItem=Zn,ne.EmployeeCard=Hs,ne.FilterPanel=hi,ne.Header=zs,ne.IconButton=Ie,ne.Layout=Os,ne.LessonCard=fl,ne.Logo=ka,ne.Modal=ta,ne.Pagination=Es,ne.Portal=dn,ne.Select=Ln,ne.Sidebar=wa,ne.Spinner=Ss,ne.TOKEN_CATEGORIES=Jl,ne.Tab=xa,ne.TabList=Ns,ne.TabPanel=Cs,ne.Table=vs,ne.Tabs=ws,ne.Tags=Ka,ne.TaskCard=Ys,ne.TextField=Ft,ne.TimePicker=cs,ne.Toast=ba,ne.ToastProvider=Ds,ne.Toggle=ys,ne.Tooltip=Ze,ne.VideoCard=yr,ne.getGradientClassName=Gn,ne.getGradientStyle=Xn,ne.isCustomGradient=Un,ne.useConfirm=Ti,ne.useEscapeKey=At,ne.useFloatingPosition=Ba,ne.useFocusTrap=ea,ne.useLockScroll=zn,ne.usePortal=En,ne.useTheme=si,ne.useToast=Hi,Object.defineProperty(ne,Symbol.toStringTag,{value:"Module"})}));
|
|
6
|
+
<%s key={someKey} {...props} />`,W,w,te,w),Z[w+W]=!0)}if(w=null,z!==void 0&&(s(z),w=""+z),l(I)&&(s(I.key),w=""+I.key),"key"in I){z={};for(var ie in I)ie!=="key"&&(z[ie]=I[ie])}else z=I;return w&&c(z,typeof b=="function"?b.displayName||b.name||"Unknown":b),u(b,w,z,i(),V,be)}function f(b){h(b)?b._store&&(b._store.validated=1):typeof b=="object"&&b!==null&&b.$$typeof===D&&(b._payload.status==="fulfilled"?h(b._payload.value)&&b._payload.value._store&&(b._payload.value._store.validated=1):b._store&&(b._store.validated=1))}function h(b){return typeof b=="object"&&b!==null&&b.$$typeof===v}var m=o,v=Symbol.for("react.transitional.element"),g=Symbol.for("react.portal"),_=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),N=Symbol.for("react.profiler"),k=Symbol.for("react.consumer"),$=Symbol.for("react.context"),S=Symbol.for("react.forward_ref"),P=Symbol.for("react.suspense"),q=Symbol.for("react.suspense_list"),X=Symbol.for("react.memo"),D=Symbol.for("react.lazy"),T=Symbol.for("react.activity"),ee=Symbol.for("react.client.reference"),O=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ge=Object.prototype.hasOwnProperty,ue=Array.isArray,Q=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(b){return b()}};var re,ye={},ke=m.react_stack_bottom_frame.bind(m,r)(),R=Q(a(r)),Z={};rn.Fragment=_,rn.jsx=function(b,I,z){var W=1e4>O.recentlyCreatedOwnerStacks++;return p(b,I,z,!1,W?Error("react-stack-top-frame"):ke,W?Q(a(b)):R)},rn.jsxs=function(b,I,z){var W=1e4>O.recentlyCreatedOwnerStacks++;return p(b,I,z,!0,W?Error("react-stack-top-frame"):ke,W?Q(a(b)):R)}})()),rn}var Pa;function fr(){return Pa||(Pa=1,process.env.NODE_ENV==="production"?Sn.exports=pr():Sn.exports=mr()),Sn.exports}var e=fr();function Un(t){return typeof t=="object"&&"from"in t&&"to"in t}function Gn(t){return typeof t=="string"?`ui-gradient--${t}`:null}function qn(t){return t.startsWith("#")?t:`var(${t.includes("-")?`--palette-${t}`:t})`}function Xn(t){const n=t.direction||"diagonal",s={horizontal:"90deg",vertical:"180deg",diagonal:"135deg",radial:"circle"},a=qn(t.from),i=qn(t.to),r=t.via?qn(t.via):null,c=n==="radial"?"radial-gradient":"linear-gradient",d=s[n];return r?`${c}(${d}, ${a} 0%, ${r} 50%, ${i} 100%)`:`${c}(${d}, ${a} 0%, ${i} 100%)`}const Ze=({variant:t="filled",color:n="primary",gradient:s,size:a="medium",disabled:i=!1,children:r,sx:l,style:c,...d})=>{const u=!!s,p=`ui-button ui-button--${t} ui-button--${a}`,h=c?.background||c?.backgroundColor||c?.color?"":u?typeof s=="string"?Gn(s):"ui-button--custom-gradient":`ui-button--${n}`,v=`${p} ${h} ${i?"ui-button--disabled":""}`.trim(),g=l?`${v} ${l}`.trim():v,y={...u&&Un(s)&&t==="filled"?{background:Xn(s)}:void 0,...c};return e.jsx("button",{className:g,disabled:i,style:y,...d,children:r})},_r="ui-kit-portal-root";function En(t){const{containerId:n=_r,containerElement:s}=t||{},[a,i]=o.useState(null);return o.useEffect(()=>{if(typeof document>"u")return;if(s){i(s);return}let r=document.getElementById(n);return r||(r=document.createElement("div"),r.id=n,r.setAttribute("data-ui-kit-portal","true"),document.body.appendChild(r)),i(r),()=>{r&&r.id===n&&r.childNodes.length===0&&r.parentNode&&r.parentNode.removeChild(r)}},[n,s]),a}const za=150,Ha=48,gr=t=>{const[n,s]=t.split("-");return{side:n,align:s??"center"}};function Ba(t){const{triggerRef:n,floatingRef:s,open:a,placement:i="bottom-start",gap:r=8,maxHeight:l=320,matchWidth:c=!1,zIndex:d}=t,{side:u,align:p}=gr(i),[f,h]=o.useState({}),[m,v]=o.useState(u),[g,_]=o.useState(!1),y=o.useRef(null);return o.useLayoutEffect(()=>{if(!a){_(!1);return}const N=()=>{y.current=null;const P=n.current;if(!P)return;const q=P.getBoundingClientRect(),X=s.current?.offsetHeight??0,D=s.current?.offsetWidth??0,T=Math.min(X||l,l),ee=window.innerWidth,O=window.innerHeight,ge=O-q.bottom-r,ue=q.top-r;let Q=u;if(u==="bottom"){const Z=ge<za,b=T>ge&&ue>ge+Ha;(Z?ue>ge:b)&&(Q="top")}else{const Z=ue<za,b=T>ue&&ge>ue+Ha;(Z?ge>ue:b)&&(Q="bottom")}const re=8,ye=c?q.width:D;let ke;c||p==="start"?ke=q.left:p==="end"?ke=q.right-(ye||0):ke=q.left+q.width/2-(ye||0)/2,ye&&(ke=Math.max(re,Math.min(ke,ee-ye-re)));const R={position:"fixed",left:ke,zIndex:d??"var(--z-index-dropdown, 1000)"};c&&(R.width=ye),Q==="bottom"?(R.top=q.bottom+r,R.maxHeight=Math.min(l,Math.max(0,ge))):(R.bottom=O-q.top+r,R.maxHeight=Math.min(l,Math.max(0,ue))),v(Q),h(R),_(!0)},k=()=>{y.current===null&&(y.current=requestAnimationFrame(N))};N(),window.addEventListener("scroll",k,!0),window.addEventListener("resize",k);const $=n.current,S=typeof ResizeObserver<"u"?new ResizeObserver(k):null;return $&&S&&S.observe($),s.current&&S&&S.observe(s.current),()=>{window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k),y.current!==null&&cancelAnimationFrame(y.current),y.current=null,S?.disconnect()}},[a,i,r,l,c,d]),{style:f,side:m,ready:g}}const bt=o.createContext(null),ln=10,Oa=20,Fa=1050,Va=o.createContext({variant:"menu"}),Zn=({children:t,disabled:n,selected:s,onClick:a,sx:i,style:r})=>{const{variant:l}=o.useContext(Va),c=l==="menu"&&!n,d=u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),a?.())};return e.jsx("div",{className:`ui-dropdown__item${n?" ui-dropdown__item--disabled":""}${s?" ui-dropdown__item--selected":""}${i?` ${i}`:""}`,style:r,role:"menuitem","aria-disabled":n,"aria-selected":s,tabIndex:c?0:-1,onClick:c?a:void 0,onKeyDown:c?d:void 0,children:t})};Zn.displayName="DropdownItem";const Jn=({trigger:t,children:n,placement:s="bottom-end",divider:a=!1,variant:i="menu",portal:r=!1,sx:l,style:c})=>{const[d,u]=o.useState(!1),p=o.useRef(null),f=o.useRef(null),h=En(),m=o.useContext(bt),v=m?m.baseZ+ln:void 0,g=Ba({triggerRef:p,floatingRef:f,open:r&&d,placement:s,gap:8,zIndex:v,maxHeight:400}),_=o.useCallback(()=>{u(!1)},[]);o.useEffect(()=>{if(!d)return;const P=X=>{const D=X.target;!p.current?.contains(D)&&!f.current?.contains(D)&&_()};i==="menu"&&f.current?.querySelector('[role="menuitem"]:not([aria-disabled="true"])')?.focus();const q=setTimeout(()=>document.addEventListener("click",P),0);return()=>{clearTimeout(q),document.removeEventListener("click",P)}},[d,i,_]);const y=P=>{P.preventDefault(),P.stopPropagation(),u(q=>!q)},N=P=>{if(P.key==="Escape"){_();return}if(P.key==="Tab"){_();return}if(!d||i!=="menu")return;const q=f.current?.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"])');if(!q?.length)return;const X=Array.from(q),D=X.indexOf(document.activeElement);if(P.key==="ArrowDown"){P.preventDefault();const T=D<X.length-1?D+1:0;X[T].focus()}else if(P.key==="ArrowUp"){P.preventDefault();const T=D>0?D-1:X.length-1;X[T].focus()}},k=()=>{_()},$=["ui-dropdown__menu",!a&&"ui-dropdown__menu--no-divider",i==="info"&&"ui-dropdown__menu--info",r&&"ui-dropdown__menu--portal",l?.menu].filter(Boolean).join(" "),S=e.jsx("div",{ref:f,className:$,style:r?{...g.style,...c?.menu}:c?.menu,onClick:k,onKeyDown:N,"data-placement":r?`${g.side}-${s.split("-")[1]??"center"}`:void 0,children:n});return e.jsxs(Va.Provider,{value:{variant:i},children:[e.jsxs("div",{ref:p,className:`ui-dropdown ui-dropdown--${s}${d?" ui-dropdown--open":""}${r?" ui-dropdown--portal":""}${l?.root?` ${l.root}`:""}`,style:c?.root,onKeyDown:N,children:[e.jsx("span",{style:{display:"contents"},onClick:y,children:t}),!r&&S]}),r&&d&&h&&Mt.createPortal(S,h)]})};Jn.displayName="Dropdown";const Vt=o.forwardRef(({label:t,helperText:n,error:s=!1,multiline:a=!1,rows:i=3,startAdornment:r,endAdornment:l,fullWidth:c=!1,size:d="normal",disabled:u=!1,placeholder:p,sx:f,id:h,...m},v)=>{const g=o.useId(),_=h||g,y=n?`${_}-helper-text`:void 0,N=(...q)=>q.filter(Boolean).join(" "),k=N("ui-textfield",c&&"ui-textfield--full-width",f?.root),$=N("ui-textfield__wrapper",`ui-textfield__wrapper--${d}`,s&&"ui-textfield__wrapper--error",u&&"ui-textfield__wrapper--disabled",!!r&&"ui-textfield__wrapper--with-start-adornment",!!l&&"ui-textfield__wrapper--with-end-adornment",f?.wrapper),S=N("ui-textfield__input",`ui-textfield__input--${d}`,a&&"ui-textfield__input--textarea",f?.input),P=a?"textarea":"input";return e.jsxs("div",{className:k,children:[t&&e.jsxs("label",{htmlFor:_,className:N("ui-textfield__label",s&&"ui-textfield__label--error",f?.label),children:[t,m.required&&e.jsx("span",{className:"ui-textfield__label-required",children:"*"})]}),e.jsxs("div",{className:$,children:[r&&e.jsx("span",{className:"ui-textfield__adornment ui-textfield__adornment--start",children:r}),e.jsx(P,{ref:v,id:_,className:S,disabled:u,rows:a?i:void 0,placeholder:p,"aria-label":t?void 0:p,"aria-invalid":s,"aria-describedby":y,...m}),l&&e.jsx("span",{className:"ui-textfield__adornment ui-textfield__adornment--end",children:l})]}),n&&e.jsx("p",{id:y,className:N("ui-textfield__helper-text",s&&"ui-textfield__helper-text--error",f?.helperText),children:n})]})});Vt.displayName="TextField";const mt=({label:t,leadingIcon:n,trailingIcon:s,variant:a="filled",color:i="neutral",size:r="medium",selected:l=!1,disabled:c=!1,onClick:d,onDelete:u,sx:p,style:f})=>{const h=!!d&&!c,m=["ui-chip",`ui-chip--${a}`,`ui-chip--${i}`,`ui-chip--${r}`,l&&"ui-chip--selected",c&&"ui-chip--disabled",h&&"ui-chip--clickable",p].filter(Boolean).join(" "),v=_=>{c||d?.(_)},g=_=>{_.stopPropagation(),!c&&u?.(_)};return e.jsxs("div",{className:m,style:f,role:h?"button":void 0,tabIndex:h?0:void 0,"aria-pressed":h&&l?!0:void 0,"aria-disabled":c?!0:void 0,onClick:v,onKeyDown:h?_=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),d?.(_))}:void 0,children:[n&&e.jsx("span",{className:"ui-chip__icon ui-chip__icon--leading","aria-hidden":"true",children:n}),e.jsx("span",{className:"ui-chip__label",children:t}),!u&&s&&e.jsx("span",{className:"ui-chip__icon ui-chip__icon--trailing","aria-hidden":"true",children:s}),u&&e.jsx("button",{type:"button",className:"ui-chip__delete","aria-label":`Remove ${t}`,disabled:c,onClick:g,tabIndex:c?-1:0,children:e.jsx("svg",{className:"ui-chip__delete-icon",viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:e.jsx("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})})})]})};mt.displayName="Chip";const on=8,$n=320,xr=150,vr=48,Ya=(t,n)=>{const s=window.innerHeight-t.bottom-on,a=t.top-on,i=Math.min(n,$n);return(s<xr?a>s:i>s&&a>s+vr)?{bottom:window.innerHeight-t.top+on,left:t.left,width:t.width,maxHeight:Math.min($n,a)}:{top:t.bottom+on,left:t.left,width:t.width,maxHeight:Math.min($n,s)}},Dt=(...t)=>t.filter(Boolean).join(" "),Ln=o.forwardRef(({options:t,label:n,placeholder:s="Select...",multiple:a=!1,disabled:i=!1,size:r="normal",sx:l,id:c,value:d,defaultValue:u,onChange:p,error:f=!1,helperText:h,fullWidth:m=!1,clearable:v=!1,chipDisplay:g="inside",chipProps:_,required:y=!1,...N},k)=>{const $=o.useId(),S=c||$,P=n?`${S}-label`:void 0,q=`${S}-listbox`,X=h?`${S}-helper-text`:void 0,D=o.useRef(null),T=o.useRef(null),ee=o.useRef(null),O=o.useRef(null),ge=o.useContext(bt),ue=ge?ge.baseZ+ln:void 0,[Q,re]=o.useState(!1),[ye,ke]=o.useState(null),[R,Z]=o.useState(!1),[b,I]=o.useState(u!==void 0?a?Array.isArray(u)?u:[u]:u:a?[]:null),[z,W]=o.useState(-1),V=["small","normal","large"].includes(r)?r:"normal";process.env.NODE_ENV!=="production"&&r!==V&&console.warn(`Select: Invalid size "${r}". Using "normal" instead.`);const be=d!==void 0,w=be?d:b,te=t.length>0&&"options"in t[0],ie=te?t.flatMap(j=>j.options):t,he=ie.filter(j=>!j.disabled),H=o.useCallback(()=>{re(!1),W(-1)},[]);o.useEffect(()=>{const j=D.current;if(!j)return;if(!Q){ke(null),Z(!1);return}const B=j.getBoundingClientRect();ke({top:B.bottom+on,left:B.left,width:B.width,maxHeight:$n}),Z(!1);const U=we=>{!T.current?.contains(we.target)&&!ee.current?.contains(we.target)&&H()};setTimeout(()=>document.addEventListener("click",U),0);const J=()=>{!ee.current||!D.current||ke(Ya(D.current.getBoundingClientRect(),ee.current.offsetHeight))};return window.addEventListener("scroll",J,!0),window.addEventListener("resize",J),()=>{window.removeEventListener("scroll",J,!0),window.removeEventListener("resize",J),document.removeEventListener("click",U)}},[Q,H]),o.useLayoutEffect(()=>{if(!Q||R||!ee.current||!D.current)return;const j=D.current.getBoundingClientRect();ke(Ya(j,ee.current.offsetHeight)),Z(!0)},[Q,ye,R]),o.useEffect(()=>{if(z<0||!O.current)return;O.current.querySelectorAll('[role="option"]')[z]?.scrollIntoView({block:"nearest"})},[z]);const le=j=>{be||I(j),p?.(j),!a&&j!==null&&H()},$e=j=>{if(a){const B=Array.isArray(w)?w:[],U=B.includes(j)?B.filter(J=>J!==j):[...B,j];le(U.length>0?U:[])}else le(j),D.current?.focus()},Pe=(j,B)=>{j.preventDefault(),j.stopPropagation();const J=(Array.isArray(w)?w:[]).filter(we=>we!==B);le(J.length>0?J:[])},pe=j=>{j.preventDefault(),j.stopPropagation(),le(a?[]:null),D.current?.focus()},Ce=j=>{if(he.length===0)return;let B=-1;if(z>=0&&z<ie.length){const J=ie[z];B=he.findIndex(we=>we.value===J?.value)}const U=j==="next"?(B+1)%he.length:B<=0?he.length-1:B-1;W(ie.findIndex(J=>J.value===he[U].value))},_e=(j,B)=>{if(!(i&&!B))switch(j.key){case"Enter":case" ":{if(j.preventDefault(),B&&z>=0&&z<ie.length){const U=ie[z];U.disabled||$e(U.value)}else re(!Q),Q||W(-1);break}case"ArrowDown":{j.preventDefault(),!Q&&!B?(re(!0),W(-1)):Ce("next");break}case"ArrowUp":{j.preventDefault(),Q&&Ce("prev");break}case"Escape":{j.preventDefault(),H(),B||D.current?.focus();break}case"Tab":{H();break}}},ze=a&&Array.isArray(w)?w:[],M=j=>j.map(B=>{const U=ie.find(J=>J.value===B);return e.jsx(mt,{label:U?.label??B,variant:_?.variant??"filled",color:_?.color??"neutral",size:_?.size??"small",leadingIcon:_?.leadingIcon,sx:_?.sx,disabled:i,onDelete:i?void 0:J=>Pe(J,B)},B)}),G=()=>{if(a)return g==="outside"?ze.length?null:e.jsx("span",{className:"ui-select__placeholder",children:s}):ze.length?e.jsx(e.Fragment,{children:M(ze)}):e.jsx("span",{className:"ui-select__placeholder",children:s});if(!w||w==="")return e.jsx("span",{className:"ui-select__placeholder",children:s});const j=ie.find(B=>B.value===w);return j?e.jsx("span",{className:"ui-select__value",children:j.label}):e.jsx("span",{className:"ui-select__placeholder",children:s})},ae=a?Array.isArray(w)&&w.length>0:w!==null&&w!=="";return e.jsxs("div",{ref:T,className:Dt("ui-select",a&&"ui-select--multiple",m&&"ui-select--full-width",l?.root),style:{position:"relative"},children:[n&&e.jsxs("label",{id:P,htmlFor:S,className:Dt("ui-select__label",f&&"ui-select__label--error",l?.label),children:[n,y&&e.jsx("span",{className:"ui-select__label-required",children:"*"})]}),a&&g==="outside"&&ze.length>0&&e.jsx("div",{className:"ui-select__chips-outside",children:M(ze)}),e.jsxs("button",{...N,ref:j=>{typeof k=="function"?k(j):k&&(k.current=j),D.current=j},id:S,"aria-labelledby":P,"aria-haspopup":"listbox","aria-expanded":Q,"aria-controls":q,"aria-disabled":i,"aria-invalid":f,"aria-describedby":X,disabled:i,onClick:j=>{if(j.preventDefault(),j.stopPropagation(),!i){const B=!Q;re(B),B&&W(-1)}},onBlur:j=>{const B=j.relatedTarget;!T.current?.contains(B)&&!ee.current?.contains(B)&&H()},onKeyDown:j=>_e(j,!1),className:Dt("ui-select__trigger",`ui-select__trigger--${V}`,a&&"ui-select__trigger--multi",a&&g==="inside"&&ze.length>0&&"ui-select__trigger--has-chips",i&&"ui-select__trigger--disabled",f&&"ui-select__trigger--error",Q&&"base--expanded",l?.trigger),"aria-label":n||s,type:"button",children:[G(),v&&ae&&e.jsx("span",{role:"button",className:"ui-select__clear",onClick:pe,onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),pe({preventDefault:()=>{},stopPropagation:()=>{}}))},"aria-label":"Clear selection",tabIndex:0,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),Q&&ye&&Mt.createPortal(e.jsx("div",{ref:ee,className:Dt("ui-select__popup",l?.popup),style:{position:"fixed",top:ye.top,bottom:ye.bottom,left:ye.left,width:ye.width,visibility:R?"visible":"hidden",...ue!==void 0?{zIndex:ue}:null},onClick:j=>j.stopPropagation(),children:e.jsx("ul",{ref:O,id:q,role:"listbox","aria-multiselectable":a,"aria-labelledby":P,onKeyDown:j=>_e(j,!0),className:Dt("ui-select__listbox",`ui-select__listbox--${V}`,a&&"ui-select__listbox--multiple",i&&"base--disabled",l?.listbox),style:{maxHeight:ye?.maxHeight},children:ie.length===0?e.jsx("li",{className:"ui-select__empty",role:"presentation",children:"No options found"}):te?t.map(j=>e.jsxs(o.Fragment,{children:[e.jsx("li",{role:"presentation",className:"ui-select__group-label",children:j.label}),j.options.map(B=>{const U=ie.findIndex(we=>we.value===B.value),J=a?Array.isArray(w)&&w.includes(B.value):w===B.value;return e.jsx("li",{role:"option","aria-selected":J,"aria-disabled":B.disabled,"aria-posinset":U+1,"aria-setsize":ie.length,onClick:we=>{we.preventDefault(),we.stopPropagation(),B.disabled||$e(B.value)},onMouseDown:we=>{we.preventDefault(),we.stopPropagation()},onMouseEnter:()=>W(U),className:Dt("ui-select__option",a?"ui-select__option--multi":"ui-select__option--single",J&&"base--selected",z===U&&"base--highlighted",B.disabled&&"base--disabled",l?.option),style:{cursor:B.disabled?"not-allowed":"pointer"},children:e.jsxs("span",{className:"ui-select__option-body",children:[e.jsx("span",{className:"ui-select__option-label",children:B.label}),B.description&&e.jsx("span",{className:"ui-select__option-description",children:B.description})]})},B.value)})]},j.label)):ie.map((j,B)=>{const U=a?Array.isArray(w)&&w.includes(j.value):w===j.value;return e.jsx("li",{role:"option","aria-selected":U,"aria-disabled":j.disabled,"aria-posinset":B+1,"aria-setsize":ie.length,onClick:J=>{J.preventDefault(),J.stopPropagation(),j.disabled||$e(j.value)},onMouseDown:J=>{J.preventDefault(),J.stopPropagation()},onMouseEnter:()=>W(B),className:Dt("ui-select__option",a?"ui-select__option--multi":"ui-select__option--single",U&&"base--selected",z===B&&"base--highlighted",j.disabled&&"base--disabled",l?.option),style:{cursor:j.disabled?"not-allowed":"pointer"},children:e.jsxs("span",{className:"ui-select__option-body",children:[e.jsx("span",{className:"ui-select__option-label",children:j.label}),j.description&&e.jsx("span",{className:"ui-select__option-description",children:j.description})]})},j.value)})})}),document.body),h&&e.jsx("p",{id:X,className:Dt("ui-select__helper-text",f&&"ui-select__helper-text--error",l?.helperText),children:h})]})});Ln.displayName="Select";const cn=8,Tn=320,br=150,jr=48,Wa=(t,n)=>{const s=window.innerHeight-t.bottom-cn,a=t.top-cn,i=Math.min(n,Tn);return(s<br?a>s:i>s&&a>s+jr)?{bottom:window.innerHeight-t.top+cn,left:t.left,width:t.width,maxHeight:Math.min(Tn,a)}:{top:t.bottom+cn,left:t.left,width:t.width,maxHeight:Math.min(Tn,s)}},yr=(t,n)=>{const s=n.toLowerCase();return t.filter(a=>a.label.toLowerCase().includes(s)||a.description?.toLowerCase().includes(s))},Yt=(...t)=>t.filter(Boolean).join(" "),Qn=({options:t,label:n,placeholder:s="Search...",multiple:a=!1,disabled:i=!1,size:r="normal",sx:l,id:c,value:d,defaultValue:u,onChange:p,onSearchChange:f,filterOptions:h,error:m=!1,helperText:v,fullWidth:g=!1,clearable:_=!1,noOptionsText:y="No options found",required:N=!1,chipProps:k})=>{const $=o.useId(),S=c||$,P=n?`${S}-label`:void 0,q=`${S}-listbox`,X=v?`${S}-helper-text`:void 0,D=o.useRef(null),T=o.useRef(null),ee=o.useRef(null),O=o.useRef(null),ge=o.useContext(bt),ue=ge?ge.baseZ+ln:void 0,Q=o.useRef(null),[re,ye]=o.useState(!1),[ke,R]=o.useState(null),[Z,b]=o.useState(!1),[I,z]=o.useState(u!==void 0?a?Array.isArray(u)?u:[u]:u:a?[]:null),[W,V]=o.useState(-1),[be,w]=o.useState(""),[te,ie]=o.useState(!1),he=d!==void 0,H=he?d:I,le=t.length>0&&"options"in t[0],$e=le?t.flatMap(F=>F.options):t,Pe=h??yr,pe=be.trim()?Pe($e,be):$e,Ce=pe.filter(F=>!F.disabled),_e=a||!H||H===""?"":$e.find(oe=>oe.value===H)?.label??(typeof H=="string"?H:""),ze=a||te?be:_e,M=o.useCallback(()=>{ye(!1),V(-1),w(""),ie(!1)},[]),G=o.useCallback(()=>{M()},[M]);o.useEffect(()=>{const F=T.current;if(!F)return;if(!re){R(null),b(!1);return}const oe=F.getBoundingClientRect();R({top:oe.bottom+cn,left:oe.left,width:oe.width,maxHeight:Tn}),b(!1);const xe=Ae=>{!D.current?.contains(Ae.target)&&!O.current?.contains(Ae.target)&&G()};setTimeout(()=>document.addEventListener("click",xe),0);const je=()=>{!O.current||!T.current||R(Wa(T.current.getBoundingClientRect(),O.current.offsetHeight))};return window.addEventListener("scroll",je,!0),window.addEventListener("resize",je),()=>{window.removeEventListener("scroll",je,!0),window.removeEventListener("resize",je),document.removeEventListener("click",xe)}},[re,G]),o.useLayoutEffect(()=>{if(!re||Z||!O.current||!T.current)return;const F=T.current.getBoundingClientRect();R(Wa(F,O.current.offsetHeight)),b(!0)},[re,ke,Z]),o.useEffect(()=>{if(W<0||!Q.current)return;Q.current.querySelectorAll('[role="option"]')[W]?.scrollIntoView({block:"nearest"})},[W]);const ae=F=>{he||z(F),p?.(F)},j=F=>{if(a){const oe=Array.isArray(H)?H:[],xe=oe.includes(F)?oe.filter(je=>je!==F):[...oe,F];ae(xe.length>0?xe:[]),w(""),f?.(""),V(-1),ee.current?.focus()}else ae(F),w(""),ie(!1),ye(!1),V(-1)},B=(F,oe)=>{F.preventDefault(),F.stopPropagation();const xe=Array.isArray(H)?H:[];ae(xe.filter(je=>je!==oe))},U=F=>{F.preventDefault(),F.stopPropagation(),ae(a?[]:null),w(""),ie(!1),ee.current?.focus()},J=F=>{if(Ce.length===0)return;let oe=-1;if(W>=0&&W<pe.length){const je=pe[W];oe=Ce.findIndex(Ae=>Ae.value===je?.value)}const xe=F==="next"?(oe+1)%Ce.length:oe<=0?Ce.length-1:oe-1;V(pe.findIndex(je=>je.value===Ce[xe].value))},we=F=>{if(!i)switch(F.key){case"ArrowDown":{F.preventDefault(),re?J("next"):(ye(!0),V(-1));break}case"ArrowUp":{F.preventDefault(),re&&J("prev");break}case"Enter":{if(F.preventDefault(),re&&W>=0&&W<pe.length){const oe=pe[W];oe.disabled||j(oe.value)}break}case"Escape":{F.preventDefault(),G();break}case"Backspace":{if(a&&be===""){const oe=Array.isArray(H)?H:[];oe.length>0&&ae(oe.slice(0,-1))}break}case"Tab":{G();break}}},C=a&&Array.isArray(H)?H:[],de=a?C.length>0:H!==null&&H!==""&&H!==void 0,fe=()=>C.map(F=>{const oe=$e.find(xe=>xe.value===F);return e.jsx(mt,{label:oe?.label??F,variant:k?.variant??"filled",color:k?.color??"neutral",size:k?.size??"small",leadingIcon:k?.leadingIcon,sx:k?.sx,disabled:i,onDelete:i?void 0:xe=>B(xe,F)},F)}),Se=()=>pe.length===0?e.jsx("li",{className:"ui-ac__empty",role:"presentation",children:y}):le&&!be.trim()?t.map(F=>{const oe=F.options.filter(xe=>pe.some(je=>je.value===xe.value));return oe.length===0?null:e.jsxs(o.Fragment,{children:[e.jsx("li",{role:"presentation",className:"ui-ac__group-label",children:F.label}),oe.map(xe=>Ne(xe,pe.findIndex(je=>je.value===xe.value)))]},F.label)}):pe.map((F,oe)=>Ne(F,oe)),Ne=(F,oe)=>{const xe=a?Array.isArray(H)&&H.includes(F.value):H===F.value;return e.jsx("li",{role:"option","aria-selected":xe,"aria-disabled":F.disabled,"aria-posinset":oe+1,"aria-setsize":pe.length,onMouseDown:je=>{je.preventDefault(),je.stopPropagation()},onClick:je=>{je.preventDefault(),je.stopPropagation(),F.disabled||j(F.value)},onMouseEnter:()=>V(oe),className:Yt("ui-ac__option",xe&&"base--selected",W===oe&&"base--highlighted",F.disabled&&"base--disabled",l?.option),style:{cursor:F.disabled?"not-allowed":"pointer"},children:e.jsxs("span",{className:"ui-ac__option-body",children:[e.jsx("span",{className:"ui-ac__option-label",children:F.label}),F.description&&e.jsx("span",{className:"ui-ac__option-description",children:F.description})]})},F.value)};return e.jsxs("div",{ref:D,className:Yt("ui-ac",g&&"ui-ac--full-width",l?.root),children:[n&&e.jsxs("label",{id:P,htmlFor:`${S}-input`,className:Yt("ui-ac__label",m&&"ui-ac__label--error",l?.label),children:[n,N&&e.jsx("span",{className:"ui-ac__label-required",children:"*"})]}),e.jsxs("div",{ref:T,role:"combobox","aria-expanded":re,"aria-haspopup":"listbox","aria-owns":q,className:Yt("ui-ac__trigger",`ui-ac__trigger--${r}`,a&&"ui-ac__trigger--multi",i&&"ui-ac__trigger--disabled",m&&"ui-ac__trigger--error",re&&"base--expanded",l?.trigger),onClick:()=>{i||ee.current?.focus()},children:[a&&fe(),e.jsx("input",{ref:ee,id:`${S}-input`,type:"text",role:"combobox","aria-autocomplete":"list","aria-controls":q,"aria-expanded":re,"aria-labelledby":P,"aria-describedby":X,"aria-invalid":m,disabled:i,placeholder:a?C.length===0?s:"":s,value:ze,className:"ui-ac__input",autoComplete:"off",onFocus:()=>{i||(a||ie(!0),ye(!0),V(-1))},onBlur:F=>{const oe=F.relatedTarget;!D.current?.contains(oe)&&!O.current?.contains(oe)&&G()},onChange:F=>{const oe=F.target.value;w(oe),f?.(oe),V(-1),re||ye(!0)},onKeyDown:we,onPaste:F=>{if(!a||i)return;const oe=F.clipboardData.getData("text");if(!/[\r\n\t]/.test(oe))return;F.preventDefault();const xe=oe.split(/[\r\n\t]+/).map(Ke=>Ke.trim()).filter(Boolean),je=Array.isArray(H)?H:[],Ae=[],We=[];xe.forEach(Ke=>{const ct=Ke.toLowerCase(),Qe=$e.find(gt=>!gt.disabled&&(gt.label.toLowerCase()===ct||gt.value.toLowerCase()===ct));Qe&&!je.includes(Qe.value)&&!Ae.includes(Qe.value)?Ae.push(Qe.value):Qe||We.push(Ke)}),Ae.length>0&&ae([...je,...Ae]);const ht=We.length>0?We[We.length-1]:"";w(ht),f?.(ht),V(-1),re||ye(!0),ee.current?.focus()}}),_&&de&&!i&&e.jsx("button",{type:"button",className:"ui-ac__clear",onMouseDown:F=>{F.preventDefault(),U(F)},"aria-label":"Clear selection",tabIndex:-1,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),e.jsx("span",{className:"ui-ac__arrow","aria-hidden":!0})]}),re&&ke&&Mt.createPortal(e.jsx("div",{ref:O,className:"ui-ac__popup",style:{position:"fixed",top:ke.top,bottom:ke.bottom,left:ke.left,width:ke.width,visibility:Z?"visible":"hidden",...ue!==void 0?{zIndex:ue}:null},onMouseDown:F=>F.preventDefault(),onClick:F=>F.stopPropagation(),children:e.jsx("ul",{ref:Q,id:q,role:"listbox","aria-multiselectable":a,"aria-labelledby":P,className:Yt("ui-ac__listbox",`ui-ac__listbox--${r}`,l?.listbox),style:{maxHeight:ke?.maxHeight},children:Se()})}),document.body),v&&e.jsx("p",{id:X,className:Yt("ui-ac__helper-text",m&&"ui-ac__helper-text--error",l?.helperText),children:v})]})};Qn.displayName="Autocomplete";const Ka=({tags:t,size:n="medium",sx:s})=>e.jsx("div",{className:`ui-tags ui-tags--${n} ${s||""}`.trim(),children:t.map((a,i)=>{const r=a.department?`ui-tags__tag--${a.department}`:"ui-tags__tag--custom";return e.jsx("span",{className:`ui-tags__tag ${r}`,children:a.label},i)})}),kr=({thumbnailUrl:t,title:n,author:s,description:a,tags:i,duration:r,views:l,publishedAt:c,isInPlaylist:d=!1,onClick:u,sx:p})=>{const f=`ui-video-card ${p||""}`.trim();return e.jsxs("div",{className:f,onClick:u,children:[e.jsxs("div",{className:"ui-video-card__thumbnail",children:[t?e.jsx("img",{src:t,alt:n,className:"ui-video-card__thumbnail-image"}):e.jsx("div",{className:"ui-video-card__thumbnail-placeholder",children:e.jsx("span",{children:"Video"})}),d?e.jsx("div",{className:"ui-video-card__playlist-icon",children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z"}),e.jsx("path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12"}),e.jsx("path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17"})]})}):r&&e.jsx("span",{className:"ui-video-card__duration",children:r})]}),e.jsxs("div",{className:"ui-video-card__content",children:[e.jsxs("div",{className:"ui-video-card__header",children:[e.jsx("div",{className:"ui-video-card__avatar","data-department":s.department||"default",children:s.initials}),e.jsxs("div",{className:"ui-video-card__title-section",children:[e.jsx("h3",{className:"ui-video-card__title",children:n}),e.jsx("p",{className:"ui-video-card__author",children:s.name})]})]}),e.jsx("p",{className:"ui-video-card__description",children:a}),e.jsx(Ka,{tags:i}),(l||c)&&e.jsxs("div",{className:"ui-video-card__meta",children:[l&&e.jsxs("span",{className:"ui-video-card__views",children:[l," views"]}),l&&c&&e.jsx("span",{className:"ui-video-card__separator",children:"•"}),c&&e.jsx("span",{className:"ui-video-card__published",children:c})]})]})]})},St=({label:t,icon:n,variant:s="filled",color:a="neutral",gradient:i,size:r="medium",sx:l,style:c})=>{const d=!!i,u=`ui-badge ui-badge--${s} ui-badge--${r}`,f=c?.background||c?.backgroundColor||c?.color?"":d?typeof i=="string"?Gn(i):"ui-badge--custom-gradient":`ui-badge--${a}`,h=`${u} ${f}`.trim(),m=l?`${h} ${l}`.trim():h,g={...d&&Un(i)&&s==="filled"?{background:Xn(i)}:void 0,...c};return e.jsxs("span",{className:m,role:"status",style:g,children:[n&&e.jsx("span",{className:"ui-badge__icon","aria-hidden":"true",children:n}),e.jsx("span",{className:"ui-badge__label",children:t})]})};St.displayName="Badge";var Ua={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Ga=o.createContext&&o.createContext(Ua),wr=["attr","size","title"];function Nr(t,n){if(t==null)return{};var s=Cr(t,n),a,i;if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(i=0;i<r.length;i++)a=r[i],!(n.indexOf(a)>=0)&&Object.prototype.propertyIsEnumerable.call(t,a)&&(s[a]=t[a])}return s}function Cr(t,n){if(t==null)return{};var s={};for(var a in t)if(Object.prototype.hasOwnProperty.call(t,a)){if(n.indexOf(a)>=0)continue;s[a]=t[a]}return s}function An(){return An=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var s=arguments[n];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(t[a]=s[a])}return t},An.apply(this,arguments)}function qa(t,n){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);n&&(a=a.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),s.push.apply(s,a)}return s}function In(t){for(var n=1;n<arguments.length;n++){var s=arguments[n]!=null?arguments[n]:{};n%2?qa(Object(s),!0).forEach(function(a){Mr(t,a,s[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):qa(Object(s)).forEach(function(a){Object.defineProperty(t,a,Object.getOwnPropertyDescriptor(s,a))})}return t}function Mr(t,n,s){return n=Dr(n),n in t?Object.defineProperty(t,n,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[n]=s,t}function Dr(t){var n=Sr(t,"string");return typeof n=="symbol"?n:n+""}function Sr(t,n){if(typeof t!="object"||!t)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var a=s.call(t,n);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(t)}function Xa(t){return t&&t.map((n,s)=>o.createElement(n.tag,In({key:s},n.attr),Xa(n.child)))}function Ee(t){return n=>o.createElement(Er,An({attr:In({},t.attr)},n),Xa(t.child))}function Er(t){var n=s=>{var{attr:a,size:i,title:r}=t,l=Nr(t,wr),c=i||s.size||"1em",d;return s.className&&(d=s.className),t.className&&(d=(d?d+" ":"")+t.className),o.createElement("svg",An({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},s.attr,a,l,{className:d,style:In(In({color:t.color||s.color},s.style),t.style),height:c,width:c,xmlns:"http://www.w3.org/2000/svg"}),r&&o.createElement("title",null,r),t.children)};return Ga!==void 0?o.createElement(Ga.Consumer,null,s=>n(s)):n(Ua)}function $r(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"},child:[]}]})(t)}function Lr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"},child:[]}]})(t)}function Tr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"},child:[]}]})(t)}function Ar(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M11 7 9.6 8.4l2.6 2.6H2v2h10.2l-2.6 2.6L11 17l5-5-5-5zm9 12h-8v2h8c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2h-8v2h8v14z"},child:[]}]})(t)}function Ir(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"m17 7-1.41 1.41L18.17 11H8v2h10.17l-2.58 2.58L17 17l5-5zM4 5h8V3H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h8v-2H4V5z"},child:[]}]})(t)}function Pr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"},child:[]}]})(t)}function zr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M7 18c-1.1 0-1.99.9-1.99 2S5.9 22 7 22s2-.9 2-2-.9-2-2-2zM1 2v2h2l3.6 7.59-1.35 2.45c-.16.28-.25.61-.25.96 0 1.1.9 2 2 2h12v-2H7.42c-.14 0-.25-.11-.25-.25l.03-.12.9-1.63h7.45c.75 0 1.41-.41 1.75-1.03l3.58-6.49A1.003 1.003 0 0 0 20 4H5.21l-.94-2H1zm16 16c-1.1 0-1.99.9-1.99 2s.89 2 1.99 2 2-.9 2-2-.9-2-2-2z"},child:[]}]})(t)}function Hr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"},child:[]}]})(t)}function Br(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"},child:[]}]})(t)}function Za(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M12 14c1.66 0 2.99-1.34 2.99-3L15 5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3zm5.3-3c0 3-2.54 5.1-5.3 5.1S6.7 14 6.7 11H5c0 3.41 2.72 6.23 6 6.72V21h2v-3.28c3.28-.48 6-3.3 6-6.72h-1.7z"},child:[]}]})(t)}function Or(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{fillRule:"evenodd",d:"M16 9V4h1c.55 0 1-.45 1-1s-.45-1-1-1H7c-.55 0-1 .45-1 1s.45 1 1 1h1v5c0 1.66-1.34 3-3 3v2h5.97v7l1 1 1-1v-7H19v-2c-1.66 0-3-1.34-3-3z"},child:[]}]})(t)}function Fr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M2.01 21 23 12 2.01 3 2 10l15 2-15 2z"},child:[]}]})(t)}function Vr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M12 3a9 9 0 1 0 9 9c0-.46-.04-.92-.1-1.36a5.389 5.389 0 0 1-4.4 2.26 5.403 5.403 0 0 1-3.14-9.8c-.44-.06-.9-.1-1.36-.1z"},child:[]}]})(t)}function Yr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zM2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1zm18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1zM11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1zm0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1zM5.99 4.58a.996.996 0 0 0-1.41 0 .996.996 0 0 0 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41L5.99 4.58zm12.37 12.37a.996.996 0 0 0-1.41 0 .996.996 0 0 0 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0a.996.996 0 0 0 0-1.41l-1.06-1.06zm1.06-10.96a.996.996 0 0 0 0-1.41.996.996 0 0 0-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06zM7.05 18.36a.996.996 0 0 0 0-1.41.996.996 0 0 0-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06z"},child:[]}]})(t)}function Wr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"},child:[]}]})(t)}function Kr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M7.41 15.41 12 10.83l4.59 4.58L18 14l-6-6-6 6z"},child:[]}]})(t)}function Ur(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M3 17v2h6v-2H3zM3 5v2h10V5H3zm10 16v-2h8v-2h-8v-2h-2v6h2zM7 9v2H3v2h4v2h2V9H7zm14 4v-2H11v2h10zm-6-4h2V7h4V5h-4V3h-2v6z"},child:[]}]})(t)}function Gr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"},child:[]}]})(t)}function qr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"m20 12-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z"},child:[]}]})(t)}function Xr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"m4 12 1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z"},child:[]}]})(t)}function Zr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"},child:[]}]})(t)}function Pn(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z"},child:[]}]})(t)}function zn(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"},child:[]}]})(t)}function jt(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"},child:[]}]})(t)}function Rn(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"},child:[]}]})(t)}function Jr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M18.41 16.59 13.82 12l4.59-4.59L17 6l-6 6 6 6zM6 6h2v12H6z"},child:[]},{tag:"path",attr:{fill:"none",d:"M24 24H0V0h24v24z"},child:[]}]})(t)}function Qr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M5.59 7.41 10.18 12l-4.59 4.59L7 18l6-6-6-6zM16 6h2v12h-2z"},child:[]}]})(t)}function Rr(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"},child:[]}]})(t)}function Ja(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"},child:[]}]})(t)}function ei(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M17.65 6.35A7.958 7.958 0 0 0 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08A5.99 5.99 0 0 1 12 18c-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"},child:[]}]})(t)}function ti(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M12 5.83 15.17 9l1.41-1.41L12 3 7.41 7.59 8.83 9 12 5.83zm0 12.34L8.83 15l-1.41 1.41L12 21l4.59-4.59L15.17 15 12 18.17z"},child:[]}]})(t)}function ni(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"},child:[]}]})(t)}function Qa(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7s-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81 1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3c0 .24.04.47.09.7L8.04 9.81C7.5 9.31 6.79 9 6 9c-1.66 0-3 1.34-3 3s1.34 3 3 3c.79 0 1.5-.31 2.04-.81l7.12 4.16c-.05.21-.08.43-.08.65 0 1.61 1.31 2.92 2.92 2.92 1.61 0 2.92-1.31 2.92-2.92s-1.31-2.92-2.92-2.92z"},child:[]}]})(t)}function ai(t){return Ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M14 4v5c0 1.12.37 2.16 1 3H9c.65-.86 1-1.9 1-3V4h4m3-2H7c-.55 0-1 .45-1 1s.45 1 1 1h1v5c0 1.66-1.34 3-3 3v2h5.97v7l1 1 1-1v-7H19v-2c-1.66 0-3-1.34-3-3V4h1c.55 0 1-.45 1-1s-.45-1-1-1z"},child:[]}]})(t)}const dn=({children:t,containerId:n,containerElement:s})=>{const a=En({containerId:n,containerElement:s});return a?Mt.createPortal(t,a):null},Ie=({icon:t,size:n="medium",color:s="primary",variant:a="filled","aria-label":i,sx:r,style:l,disabled:c=!1,badge:d,badgeColor:u="error",...p})=>{const f=`ui-icon-button ui-icon-button--${a} ui-icon-button--${n}`,m=l?.background||l?.backgroundColor||l?.color?"":`ui-icon-button--${s}`,g=`${f} ${m} ${c?"ui-icon-button--disabled":""}`.trim(),_=r?`${g} ${r}`.trim():g,y=d!=null&&d!=="",N=typeof d=="number"&&d>99?"99+":d,k=e.jsx("button",{type:"button",className:_,style:l,disabled:c,"aria-label":i,...p,children:t});return y?e.jsxs("span",{className:"ui-icon-button-wrapper",children:[k,e.jsx("span",{className:`ui-icon-button-badge ui-icon-button-badge--${u} ui-icon-button-badge--${n}`,children:N})]}):k},Ra="ui-kit-theme";function si(){if(typeof window>"u")return"light";const t=localStorage.getItem(Ra);return t==="light"||t==="dark"?t:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function ri(){const[t,n]=o.useState(si);return o.useEffect(()=>{document.documentElement.dataset.theme=t,localStorage.setItem(Ra,t)},[t]),{theme:t,isDark:t==="dark",toggleTheme:()=>n(i=>i==="dark"?"light":"dark"),setTheme:i=>n(i)}}const ii='a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';function ea({enabled:t,containerRef:n,initialFocusRef:s,returnFocusOnCleanup:a=!0}){const i=o.useRef(null);o.useEffect(()=>{if(!t||!n.current)return;const r=n.current;i.current=document.activeElement;const l=()=>Array.from(r.querySelectorAll(ii)),c=l();c.length>0&&(s?.current?s.current.focus():c[0].focus());const d=u=>{if(u.key!=="Tab")return;const p=l();if(p.length===0)return;const f=p[0],h=p[p.length-1],m=document.activeElement;u.shiftKey?(m===f||!r.contains(m))&&(u.preventDefault(),h.focus()):(m===h||!r.contains(m))&&(u.preventDefault(),f.focus())};return r.addEventListener("keydown",d),()=>{r.removeEventListener("keydown",d),a&&i.current&&i.current.focus()}},[t,n,s,a])}function At({enabled:t,onEscape:n}){o.useEffect(()=>{if(!t)return;const s=a=>{a.key==="Escape"&&n()};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[t,n])}function Hn({enabled:t,mediaQuery:n}){o.useEffect(()=>{const s=r=>{t&&r?(document.body.style.overflow="hidden",document.documentElement.style.overflow="hidden"):(document.body.style.overflow="",document.documentElement.style.overflow="")};if(!n)return s(t),()=>s(!1);const a=window.matchMedia(n);s(a.matches);const i=r=>s(r.matches);return a.addEventListener("change",i),()=>{a.removeEventListener("change",i),s(!1)}},[t,n])}const ta=({open:t,onClose:n,closeOnBackdropClick:s=!0,closeOnEscape:a=!0,showCloseButton:i=!0,size:r="medium",children:l,sx:c,style:d,backdropStyle:u,portalContainerId:p,initialFocusRef:f,returnFocusOnClose:h=!0,trapFocus:m=!0})=>{const v=o.useRef(null),g=o.useContext(bt),_=g?g.baseZ+Oa:Fa,y=o.useMemo(()=>({baseZ:_}),[_]);At({enabled:t&&a&&!!n,onEscape:n||(()=>{})}),Hn({enabled:t}),ea({enabled:t&&m,containerRef:v,initialFocusRef:f,returnFocusOnCleanup:h});const N=S=>{s&&n&&S.target===S.currentTarget&&n()};if(!t)return null;const k=`ui-modal__content ui-modal__content--${r}`,$=c?`${k} ${c}`.trim():k;return e.jsx(dn,{containerId:p,children:e.jsx(bt.Provider,{value:y,children:e.jsx("div",{className:"ui-modal",style:{zIndex:_},children:e.jsx("div",{className:"ui-modal__backdrop",onClick:N,style:u,role:"presentation",children:e.jsxs("div",{ref:v,className:$,style:d,role:"dialog","aria-modal":"true",children:[i&&n&&e.jsx(Ie,{icon:e.jsx(jt,{}),onClick:n,"aria-label":"Close modal",sx:"ui-modal__close-button",variant:"ghost",color:"neutral",size:"medium"}),l]})})})})})},es=({open:t,onClose:n,closeOnBackdropClick:s=!0,closeOnEscape:a=!0,showCloseButton:i=!0,anchor:r="right",width:l="320px",height:c="100%",children:d,sx:u,style:p,backdropStyle:f,hideBackdrop:h=!1,portalContainerId:m,initialFocusRef:v,returnFocusOnClose:g=!0,trapFocus:_=!0,title:y})=>{const N=o.useRef(null),k=o.useContext(bt),$=k?k.baseZ+Oa:Fa,S=o.useMemo(()=>({baseZ:$}),[$]),[P,q]=o.useState(t),[X,D]=o.useState(!1);o.useEffect(()=>{if(t)q(!0),D(!1);else if(P){D(!0);const re=setTimeout(()=>{q(!1),D(!1)},300);return()=>clearTimeout(re)}},[t]),At({enabled:t&&a&&!!n,onEscape:n||(()=>{})}),Hn({enabled:t}),ea({enabled:t&&_,containerRef:N,initialFocusRef:v,returnFocusOnCleanup:g});const T=re=>{s&&n&&re.target===re.currentTarget&&n()};if(!P)return null;const ee={};r==="left"||r==="right"?ee.width=l:ee.height=c;const O=["ui-drawer__content",`ui-drawer__content--${r}`,X&&`ui-drawer__content--exiting-${r}`].filter(Boolean).join(" "),ge=u?`${O} ${u}`.trim():O,ue=y?"ui-drawer-title":void 0,Q=i&&n&&e.jsx(Ie,{icon:e.jsx(jt,{}),onClick:n,"aria-label":"Close drawer",sx:"ui-drawer__close-button",variant:"ghost",color:"neutral",size:"medium"});return e.jsx(dn,{containerId:m,children:e.jsx(bt.Provider,{value:S,children:e.jsx("div",{className:"ui-drawer",style:{zIndex:$},children:e.jsx("div",{className:"ui-drawer__backdrop",onClick:T,style:h?{...f,background:"transparent"}:f,role:"presentation",children:e.jsxs("div",{ref:N,className:ge,style:{...ee,...p},role:"dialog","aria-modal":"true","aria-labelledby":ue,children:[y?e.jsxs("div",{className:"ui-drawer__header",children:[e.jsx("h2",{id:ue,className:"ui-drawer__title",children:y}),Q]}):Q,d]})})})})})},Ue=({title:t,placement:n="top",arrow:s=!1,children:a,sx:i})=>{if(!t)return a;const r=["ui-tooltip",`ui-tooltip--${n}`,i].filter(Boolean).join(" ");return e.jsxs("span",{className:r,children:[a,e.jsxs("span",{className:"ui-tooltip__content",role:"tooltip",children:[t,s&&e.jsx("span",{className:"ui-tooltip__arrow","aria-hidden":"true"})]})]})};Ue.displayName="Tooltip";function li(){return e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5","aria-hidden":"true",children:e.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})}function oi(){return e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5","aria-hidden":"true",children:e.jsx("path",{d:"M6 9l6 6 6-6"})})}function ci(){return e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("path",{d:"M21 21l-4.35-4.35"})]})}function di({section:t,pending:n,onToggle:s}){const[a,i]=o.useState(t.initiallyOpen??!1),[r,l]=o.useState(""),[c,d]=o.useState(!1),u=t.showMoreLimit??8,p=r?t.options.filter(v=>v.label.toLowerCase().includes(r.toLowerCase())):t.options,f=!r&&p.length>u,h=f&&!c?p.slice(0,u):p,m=p.length-u;return e.jsxs("div",{className:`fp-collapsible${a?" fp-collapsible--open":""}`,children:[e.jsxs("button",{type:"button",className:"fp-collapsible__header",onClick:()=>i(v=>!v),"aria-expanded":a,children:[e.jsxs("span",{className:"fp-collapsible__title",children:[t.icon&&e.jsx("span",{className:"fp-collapsible__icon",children:t.icon}),t.title]}),e.jsxs("span",{className:"fp-collapsible__right",children:[n.length>0&&e.jsx("span",{className:"fp-collapsible__count",children:n.length}),e.jsx("span",{className:"fp-collapsible__arrow",children:e.jsx(oi,{})})]})]}),e.jsxs("div",{className:"fp-collapsible__content",children:[t.showSearch&&e.jsx(Vt,{size:"small",fullWidth:!0,startAdornment:e.jsx(ci,{}),placeholder:`Search ${t.title.toLowerCase()}…`,value:r,onChange:v=>{const g=v.target.value;l(g),t.onSearch?.(g)},sx:{root:"fp-mini-search",wrapper:"fp-mini-search__wrapper"}}),e.jsx("div",{className:["fp-pill-grid",t.columns===3?"fp-pill-grid--cols3":"fp-pill-grid--cols2"].join(" "),children:h.map(v=>{const g=n.includes(v.value);return e.jsx(mt,{label:v.label,variant:"outlined",color:g?"primary":"neutral",size:"small",selected:g,onClick:()=>s(v.value),leadingIcon:v.icon?e.jsx("img",{src:v.icon,alt:"",className:"fp-pill__icon","aria-hidden":"true"}):void 0,sx:"fp-pill-chip"},v.value)})}),f&&e.jsx(Ze,{variant:"outlined",color:"neutral",size:"small",style:{width:"100%",marginTop:"0.35rem",border:"1px solid var(--palette-divider)"},onClick:()=>d(v=>!v),children:c?"Show less":`Show ${m} more…`})]})]})}function ui({section:t,pending:n,onToggle:s}){return e.jsxs("div",{className:"fp-group",children:[e.jsx("div",{className:"fp-group__label",children:t.title}),e.jsx("div",{className:"fp-cards",children:t.options.map(a=>{const i=n.includes(a.value),r=a.color??"#94a3b8";return e.jsxs("button",{type:"button",className:`fp-card${i?" fp-card--active":""}`,style:{"--fp-card-color":r},onClick:()=>s(a.value),children:[e.jsx("span",{className:"fp-card__icon","aria-hidden":"true",children:a.icon?e.jsx("img",{src:a.icon,alt:""}):e.jsx("span",{className:"fp-card__icon-letter",children:a.label.charAt(0)})}),e.jsx("span",{className:"fp-card__label",children:a.label})]},a.value)})})]})}function hi({section:t,pending:n,onToggle:s}){return e.jsxs("div",{className:"fp-group",children:[e.jsx("div",{className:"fp-group__label",children:t.title}),e.jsx("div",{className:"fp-tiles",children:t.options.map(a=>{const i=n.includes(a.value);return e.jsxs("button",{type:"button",className:`fp-tile${i?" fp-tile--active":""}`,onClick:()=>s(a.value),children:[(a.iconNode??a.icon)&&e.jsx("span",{className:"fp-tile__icon","aria-hidden":"true",children:a.iconNode??a.icon}),e.jsx("span",{className:"fp-tile__label",children:a.label}),a.sublabel&&e.jsx("span",{className:"fp-tile__sublabel",children:a.sublabel})]},a.value)})})]})}function pi({sections:t,value:n,onChange:s,resultCount:a,isOpen:i,onClose:r,onReset:l}){Hn({enabled:i,mediaQuery:"(max-width: 767px)"});const[c,d]=o.useState({});o.useEffect(()=>{if(!i)return;const _={};t.forEach(y=>{_[y.id]=[...n[y.id]??[]]}),d(_)},[i]);const u=o.useCallback((_,y)=>{d(N=>{const k=N[_]??[],$=k.includes(y)?k.filter(S=>S!==y):[...k,y];return{...N,[_]:$}})},[]),p=o.useCallback((_,y)=>{d(N=>({...N,[_]:(N[_]??[]).filter(k=>k!==y)}))},[]),f=()=>{s(c),r()},h=()=>{if(l)l();else{const _={};t.forEach(y=>{_[y.id]=[]}),d(_)}},m=()=>{const _={};t.forEach(y=>{_[y.id]=[...n[y.id]??[]]}),d(_),r()},v=t.flatMap(_=>_.disabled?[]:(c[_.id]??[]).map(y=>({sectionId:_.id,value:y,label:_.options.find(N=>N.value===y)?.label??y}))),g=v.length>0;return e.jsxs("aside",{className:`fp-panel${i?" fp-panel--open":""}`,"aria-label":"Filter panel","aria-hidden":!i,children:[e.jsxs("div",{className:"fp-header",children:[e.jsxs("div",{className:"fp-header__info",children:[e.jsx("span",{className:"fp-header__title",children:"Filters"}),a!==void 0&&e.jsxs("span",{className:"fp-header__count",children:[a," employees found"]})]}),e.jsx(Ie,{variant:"ghost",color:"neutral",size:"small",icon:e.jsx(li,{}),"aria-label":"Close filters",onClick:m})]}),g&&e.jsx("div",{className:"fp-chips",children:v.map(_=>e.jsx(mt,{label:_.label,variant:"outlined",color:"primary",size:"small",onDelete:()=>p(_.sectionId,_.value)},`${_.sectionId}-${_.value}`))}),e.jsx("div",{className:"fp-content",children:t.map(_=>_.type==="cards"?e.jsx(ui,{section:_,pending:c[_.id]??[],onToggle:y=>u(_.id,y)},_.id):_.type==="tiles"?e.jsx(hi,{section:_,pending:c[_.id]??[],onToggle:y=>u(_.id,y)},_.id):e.jsx(di,{section:_,pending:c[_.id]??[],onToggle:y=>u(_.id,y)},_.id))}),e.jsxs("div",{className:"fp-footer",children:[e.jsx(Ze,{variant:"ghost",color:"neutral",onClick:h,disabled:!g,children:"Reset all"}),e.jsx(Ze,{variant:"filled",color:"primary",style:{flex:1},onClick:f,children:"Apply"})]})]})}function ot(t){return t.hour*60+t.minute}function Wt(t){const n=Math.max(0,Math.min(1439,t));return{hour:Math.floor(n/60),minute:n%60}}function yt(){return{min:{hour:0,minute:0},max:{hour:23,minute:59}}}function Et(t){if(t===null)return null;const n=yt(),s=t??{},a=s.min??n.min,i=s.max??n.max;return ot(a)>ot(i)?null:{min:a,max:i}}function un(t,n,s){const a=Math.max(1,Math.floor(s));if(t>n)return null;if(a===1)return t;let i=Math.floor(t/a)*a;return i<t&&(i+=a),i>n?null:i}function Kt(t,n,s,a){const i=ot(s.min),r=ot(s.max);let l=t*60+n;l=Math.max(i,Math.min(r,l));const c=Math.max(1,Math.floor(a));if(c===1)return Wt(l);const d=un(i,r,c);if(d===null)return Wt(i);if(l<=d)return Wt(d);const u=l-d,p=Math.ceil(u/c);let f=d+p*c;const h=Math.floor((r-d)/c),m=d+h*c;return f>r&&(f=m),Wt(Math.min(f,m))}function ts(t,n){const s=ot(t.min),a=ot(t.max),i=un(s,a,n);return i===null?null:Wt(i)}function ns(t,n){const s=ot(t.min),a=ot(t.max),i=Math.max(1,Math.floor(n)),r=new Set;if(i===1){for(let c=t.min.hour;c<=t.max.hour;c++)r.add(c);return[...r].sort((c,d)=>c-d)}const l=un(s,a,i);if(l===null)return[];for(let c=l;c<=a;c+=i)r.add(Math.floor(c/60));return[...r].sort((c,d)=>c-d)}function It(t,n,s){const a=ot(n.min),i=ot(n.max),r=Math.max(1,Math.floor(s)),l=[];if(r===1){const d=t===n.min.hour?n.min.minute:0,u=t===n.max.hour?n.max.minute:59;for(let p=d;p<=u;p++)l.push(p);return l}const c=un(a,i,r);if(c===null)return[];for(let d=c;d<=i;d+=r){const u=Wt(d);u.hour===t&&l.push(u.minute)}return l}function Bn(t,n,s,a){const i=t*60+n,r=ot(s.min),l=ot(s.max);if(i<r||i>l)return!1;const c=Math.max(1,Math.floor(a));if(c===1)return!0;const d=un(r,l,c);return d===null||i<d?!1:(i-d)%c===0}const hn=8,as="DD.MM.YYYY";function ss(t,n){return!n||t.includes("HH")&&t.includes("mm")?t:`${t} HH:mm`}const na=["January","February","March","April","May","June","July","August","September","October","November","December"],mi=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],fi=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Xe=(...t)=>t.filter(Boolean).join(" ");function Ut(t,n){return t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()&&t.getDate()===n.getDate()}function _i(t,n,s){const[a,i]=n<=s?[n,s]:[s,n];return t.getTime()>a.getTime()&&t.getTime()<i.getTime()}function pn(t,n){return new Date(t.getFullYear(),t.getMonth()+n,1)}function gi(t,n){const a=(new Date(t,n,1).getDay()+6)%7,i=[];for(let c=a;c>0;c--)i.push(new Date(t,n,1-c));const r=new Date(t,n+1,0).getDate();for(let c=1;c<=r;c++)i.push(new Date(t,n,c));let l=1;for(;i.length<42;)i.push(new Date(t,n+1,l++));return i}function Je(t,n=as){const s=String(t.getDate()).padStart(2,"0"),a=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getFullYear());return n.replace("DD",s).replace("MM",a).replace("YYYY",i)}function On(t,n){const s=String(t.getDate()).padStart(2,"0"),a=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getFullYear()),r=String(t.getHours()).padStart(2,"0"),l=String(t.getMinutes()).padStart(2,"0");return n.replace("YYYY",i).replace("DD",s).replace("MM",a).replace("HH",r).replace("mm",l)}function aa(t,n){if(t.length!==n.length)return null;const s=n.indexOf("DD"),a=n.indexOf("MM"),i=n.indexOf("YYYY");if(s<0||a<0||i<0)return null;const r=parseInt(t.slice(s,s+2),10),l=parseInt(t.slice(a,a+2),10)-1,c=parseInt(t.slice(i,i+4),10);if(isNaN(r)||isNaN(l)||isNaN(c))return null;const d=new Date(c,l,r);return d.getDate()!==r||d.getMonth()!==l||d.getFullYear()!==c?null:d}function xi(t,n){if(t.length!==n.length)return null;const s=n.indexOf("DD"),a=n.indexOf("MM"),i=n.indexOf("YYYY");if(s<0||a<0||i<0)return null;const r=parseInt(t.slice(s,s+2),10),l=parseInt(t.slice(a,a+2),10)-1,c=parseInt(t.slice(i,i+4),10);if(isNaN(r)||isNaN(l)||isNaN(c))return null;let d=0,u=0;const p=n.indexOf("HH"),f=n.indexOf("mm");if(p>=0&&f>=0&&(d=parseInt(t.slice(p,p+2),10),u=parseInt(t.slice(f,f+2),10),isNaN(d)||isNaN(u)||d<0||d>23||u<0||u>59))return null;const h=new Date(c,l,r,d,u,0,0);return h.getDate()!==r||h.getMonth()!==l||h.getFullYear()!==c?null:h}function sa(t,n){const s=t.replace(/\D/g,"").slice(0,8);if(!s.length)return"";let a="",i=0;for(let r=0;r<n.length;r++){const l=n[r];if(/[DMY]/.test(l)){if(i>=s.length)break;a+=s[i++]}else if(i<s.length)a+=l;else break}return a}function vi(t,n){const s=t.replace(/\D/g,"").slice(0,12);if(!s.length)return"";let a=0,i="",r=0;for(;r<n.length;)if(n.startsWith("YYYY",r)){for(let l=0;l<4&&a<s.length;l++)i+=s[a++];r+=4}else if(n.startsWith("DD",r)){if(a>=s.length||(i+=s[a++],a>=s.length))break;i+=s[a++],r+=2}else if(n.startsWith("MM",r)){if(a>=s.length||(i+=s[a++],a>=s.length))break;i+=s[a++],r+=2}else if(n.startsWith("HH",r)){if(a>=s.length||(i+=s[a++],a>=s.length))break;i+=s[a++],r+=2}else if(n.startsWith("mm",r)){if(a>=s.length||(i+=s[a++],a>=s.length))break;i+=s[a++],r+=2}else{if(a<s.length)i+=n[r];else break;r+=1}return i}const rs=(t,n,s)=>{const a=window.innerHeight-t.bottom-hn,i=t.top-hn,r=s>a&&i>a;let l=t.left;return l+n>window.innerWidth-8&&(l=Math.max(8,window.innerWidth-8-n)),r?{bottom:window.innerHeight-t.top+hn,left:l,maxHeight:Math.min(640,i)}:{top:t.bottom+hn,left:l,maxHeight:Math.min(640,a)}};function bi(t){return t==="single"?[{label:"Today",getValue:()=>new Date},{label:"Yesterday",getValue:()=>{const n=new Date;return n.setDate(n.getDate()-1),n}}]:[{label:"Today",getValue:()=>{const n=new Date;return{start:n,end:n}}},{label:"Yesterday",getValue:()=>{const n=new Date;return n.setDate(n.getDate()-1),{start:new Date(n),end:new Date(n)}}},{label:"This week",getValue:()=>{const n=new Date,s=(n.getDay()+6)%7,a=new Date(n.getFullYear(),n.getMonth(),n.getDate()-s),i=new Date(a.getFullYear(),a.getMonth(),a.getDate()+6);return{start:a,end:i}}},{label:"Last week",getValue:()=>{const n=new Date,s=(n.getDay()+6)%7,a=new Date(n.getFullYear(),n.getMonth(),n.getDate()-s-7),i=new Date(a.getFullYear(),a.getMonth(),a.getDate()+6);return{start:a,end:i}}},{label:"This month",getValue:()=>{const n=new Date,s=new Date(n.getFullYear(),n.getMonth(),1),a=new Date(n.getFullYear(),n.getMonth()+1,0);return{start:s,end:a}}},{label:"Last month",getValue:()=>{const n=new Date,s=new Date(n.getFullYear(),n.getMonth()-1,1),a=new Date(n.getFullYear(),n.getMonth(),0);return{start:s,end:a}}}]}function is(){return e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[e.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),e.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),e.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),e.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]})}function ra(){return e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:e.jsx("path",{d:"m15 18-6-6 6-6"})})}function ia(){return e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:e.jsx("path",{d:"m9 18 6-6-6-6"})})}const la=o.forwardRef(({mode:t="single",value:n,onChange:s,rangeValue:a,onRangeChange:i,triggerVariant:r="input",format:l=as,placeholder:c,minDate:d,maxDate:u,disabledDates:p,disabledDaysOfWeek:f,isDateDisabled:h,showTime:m=!1,timeStep:v=1,getTimeBounds:g,presets:_,showPresets:y=!1,multiMonth:N,label:k,helperText:$,error:S=!1,disabled:P=!1,required:q=!1,size:X="normal",fullWidth:D=!1,startAdornment:T,endAdornment:ee,sx:O,style:ge,id:ue,onFocus:Q,onBlur:re,...ye},ke)=>{const R=o.useId(),Z=ue||`${R}-input`,b=new Date;b.setHours(0,0,0,0);const I=N??t==="range",z=y?_??bi(t):[],W=ss(l,!!(m&&t==="single")),V=n!==void 0,be=a!==void 0,[w,te]=o.useState(null),[ie,he]=o.useState({start:null,end:null}),H=V?n??null:w,le=be?a??ie:ie,$e=H?.getTime()??null,Pe=Math.max(1,Math.floor(v)),pe=o.useMemo(()=>{if(!m||t!=="single")return;if(!H)return"no-date";const E=new Date(H.getFullYear(),H.getMonth(),H.getDate());return g?Et(g(E)):"full"},[m,t,H,g]),Ce=o.useMemo(()=>{if(pe===void 0||pe==="no-date")return[];const E=pe==="full"?yt():pe;return E?ns(E,Pe):[]},[pe,Pe]),[_e,ze]=o.useState(!1),[M,G]=o.useState(null),[ae,j]=o.useState(!1),B=()=>t==="single"&&H?new Date(H.getFullYear(),H.getMonth(),1):t==="range"&&le.start?new Date(le.start.getFullYear(),le.start.getMonth(),1):new Date(b.getFullYear(),b.getMonth(),1),[U,J]=o.useState(B),[we,C]=o.useState("days"),[de,fe]=o.useState(()=>b.getFullYear()-4),[Se,Ne]=o.useState(null),[F,oe]=o.useState(null),[xe,je]=o.useState(()=>t==="single"&&H?H.getHours():0),[Ae,We]=o.useState(()=>t==="single"&&H?H.getMinutes():0),ht=o.useMemo(()=>{if(pe===void 0||pe==="no-date")return[];const E=pe==="full"?yt():pe;return E?It(xe,E,Pe):[]},[pe,Pe,xe]),Ke=o.useRef(!1),[ct,Qe]=o.useState(()=>t==="single"&&H?m?On(H,ss(l,m)):Je(H,l):""),[gt,xt]=o.useState(()=>le.start?Je(le.start,l):""),[Re,tt]=o.useState(()=>le.end?Je(le.end,l):""),at=o.useRef(null),Fe=o.useRef(null),et=o.useRef(null),Xt=o.useContext(bt),nt=Xt?Xt.baseZ+ln:void 0,st=o.useRef(null),Be=o.useCallback(E=>{if(d){const A=new Date(d.getFullYear(),d.getMonth(),d.getDate());if(E<A)return!0}if(u){const A=new Date(u.getFullYear(),u.getMonth(),u.getDate());if(E>A)return!0}if(f?.includes(E.getDay())||p?.some(A=>Ut(A,E))||h?.(E))return!0;if(m&&g){const A=new Date(E.getFullYear(),E.getMonth(),E.getDate());if(Et(g(A))===null)return!0}return!1},[d,u,f,p,h,m,g]),Ye=o.useCallback(()=>{ze(!1),Ne(null),oe(null),C("days")},[]),kt=o.useCallback(()=>{P||(t==="single"&&H?J(new Date(H.getFullYear(),H.getMonth(),1)):t==="range"&&le.start&&J(new Date(le.start.getFullYear(),le.start.getMonth(),1)),ze(!0))},[P,t,H,le]);At({enabled:_e,onEscape:Ye}),o.useEffect(()=>{if(!_e){G(null),j(!1);return}const E=at.current;if(!E)return;const A=E.getBoundingClientRect();G({top:A.bottom+hn,left:A.left,maxHeight:640}),j(!1);const me=Oe=>{!at.current?.contains(Oe.target)&&!Fe.current?.contains(Oe.target)&&Ye()};setTimeout(()=>document.addEventListener("mousedown",me),0);const ce=()=>{if(!Fe.current||!at.current)return;const Oe=at.current.getBoundingClientRect();G(rs(Oe,Fe.current.offsetWidth,Fe.current.offsetHeight))};return window.addEventListener("scroll",ce,!0),window.addEventListener("resize",ce),()=>{window.removeEventListener("scroll",ce,!0),window.removeEventListener("resize",ce),document.removeEventListener("mousedown",me)}},[_e,Ye]),o.useEffect(()=>{if(t!=="single"||!m||$e==null)return;const E=new Date($e),A=new Date(E.getFullYear(),E.getMonth(),E.getDate()),me=g?Et(g(A)):yt();if(!me)return;const ce=Kt(E.getHours(),E.getMinutes(),me,Pe);je(ce.hour),We(ce.minute)},[t,m,$e,g,Pe]),o.useLayoutEffect(()=>{if(!_e||!ae)return;const E=et.current?.querySelector(`[data-time-value="${xe}"]`),A=st.current?.querySelector(`[data-time-value="${Ae}"]`);E?.scrollIntoView({block:"nearest"}),A?.scrollIntoView({block:"nearest"})},[xe,Ae,_e,ae]),o.useLayoutEffect(()=>{if(!_e||ae||!Fe.current||!at.current)return;const E=at.current.getBoundingClientRect();G(rs(E,Fe.current.offsetWidth,Fe.current.offsetHeight)),j(!0)},[_e,M,ae]),o.useEffect(()=>{Ke.current||t==="single"&&Qe(H?m?On(H,W):Je(H,l):"")},[H,l,W,m,t]),o.useEffect(()=>{Ke.current||(xt(le.start?Je(le.start,l):""),tt(le.end?Je(le.end,l):""))},[le.start,le.end,l]);const xn=o.useCallback(E=>{if(!Be(E))if(Ke.current=!1,t==="single")if(m){const A=new Date(E.getFullYear(),E.getMonth(),E.getDate()),me=g?Et(g(A)):yt();if(!me)return;const ce=ts(me,Pe);if(!ce)return;const Oe=new Date(A.getFullYear(),A.getMonth(),A.getDate(),ce.hour,ce.minute);je(ce.hour),We(ce.minute),V||te(Oe),s?.(Oe)}else{const A=new Date(E.getFullYear(),E.getMonth(),E.getDate());V||te(A),s?.(A),Ye()}else if(!Se)Ne(new Date(E.getFullYear(),E.getMonth(),E.getDate()));else{const A=Se,me=new Date(E.getFullYear(),E.getMonth(),E.getDate()),ce=A<=me?{start:A,end:me}:{start:me,end:A};be||he(ce),i?.(ce),Ne(null),Ye()}},[t,m,Pe,g,Se,V,be,s,i,Ye,Be]),Ht=o.useCallback(E=>{const A=E.getValue();if(A instanceof Date){let me=A;if(m&&g){const ce=new Date(me.getFullYear(),me.getMonth(),me.getDate()),Oe=Et(g(ce));if(Oe){const dt=Kt(me.getHours(),me.getMinutes(),Oe,Pe);me=new Date(ce.getFullYear(),ce.getMonth(),ce.getDate(),dt.hour,dt.minute)}}V||te(me),s?.(me)}else{const me=A;be||he(me),i?.(me),me.start&&J(new Date(me.start.getFullYear(),me.start.getMonth(),1))}Ye()},[V,be,s,i,Ye,m,g,Pe]),Zt=o.useCallback(E=>{if(E.stopPropagation(),Ke.current=!1,t==="single")Qe(""),V||te(null),s?.(null);else{xt(""),tt("");const A={start:null,end:null};be||he(A),i?.(A),Ne(null)}},[t,V,be,s,i]),vn=o.useCallback(E=>{const A=m?vi(E.target.value,W):sa(E.target.value,l);Qe(A);const me=m?W.length:l.length;if(A.length===me){const ce=m?xi(A,W):aa(A,l);if(ce&&!Be(ce)){if(m){const Oe=new Date(ce.getFullYear(),ce.getMonth(),ce.getDate()),dt=g?Et(g(Oe)):yt();if(!dt||!Bn(ce.getHours(),ce.getMinutes(),dt,Pe))return;je(ce.getHours()),We(ce.getMinutes())}V||te(ce),s?.(ce),J(new Date(ce.getFullYear(),ce.getMonth(),1))}}else A.length===0&&(V||te(null),s?.(null))},[l,W,m,Pe,g,V,s,Be]),Jt=o.useCallback(E=>{const A=sa(E.target.value,l);if(xt(A),A.length===l.length){const me=aa(A,l);if(me&&!Be(me)){const ce={start:me,end:le.end};be||he(ce),i?.(ce),J(new Date(me.getFullYear(),me.getMonth(),1))}}},[l,le.end,be,i,Be]),bn=o.useCallback(E=>{const A=sa(E.target.value,l);if(tt(A),A.length===l.length){const me=aa(A,l);if(me&&!Be(me)){const ce={start:le.start,end:me};be||he(ce),i?.(ce)}}},[l,le.start,be,i,Be]),pt=o.useCallback(E=>{const A=E.relatedTarget;Fe.current?.contains(A)||at.current?.contains(A)||(Ke.current=!1,Qe(H?m?On(H,W):Je(H,l):""),xt(le.start?Je(le.start,l):""),tt(le.end?Je(le.end,l):""))},[H,le.start,le.end,l,m,W]),Qt=o.useCallback(()=>{if(t==="single"&&H){const E=new Date(H.getFullYear(),H.getMonth(),H.getDate()),A=g?Et(g(E)):yt();if(!A){Ye();return}const me=Kt(xe,Ae,A,Pe),ce=new Date(H.getFullYear(),H.getMonth(),H.getDate(),me.hour,me.minute);V||te(ce),s?.(ce)}Ye()},[t,H,xe,Ae,V,s,Ye,g,Pe]),jn=(()=>{if(t==="single")return H?m?On(H,W):Je(H,l):"";const{start:E,end:A}=le;return E&&A?`${Je(E,l)} – ${Je(A,l)}`:E?`${Je(E,l)} – ...`:""})(),yn=t==="single"?!!H:!!(le.start||le.end),kn=(E,A)=>{const me=Be(E),ce=E.getMonth()!==A,Oe=Ut(E,b);let dt=!1,qe=!1,Ot=!1,Mn=!1;if(t==="single"&&H&&(dt=Ut(E,H)),t==="range"){const x=Se??le.start,L=Se?F??null:le.end;x&&Ut(E,x)&&(qe=!0),L&&Ut(E,L)&&(Ot=!0),x&&L&&_i(E,x,L)&&(Mn=!0)}return Xe("ui-datepicker__day",ce&&"ui-datepicker__day--outside",Oe&&"ui-datepicker__day--today",me&&"ui-datepicker__day--disabled",dt&&"ui-datepicker__day--selected",(qe||Ot)&&"ui-datepicker__day--range-cap",qe&&"ui-datepicker__day--range-start",Ot&&"ui-datepicker__day--range-end",Mn&&"ui-datepicker__day--in-range")},Ge=(E,A,me)=>{const ce=E.getFullYear(),Oe=E.getMonth(),dt=gi(ce,Oe);return e.jsxs("div",{className:"ui-datepicker__calendar",children:[e.jsxs("div",{className:"ui-datepicker__nav",children:[e.jsx("button",{type:"button",className:Xe("ui-datepicker__nav-btn",!A&&"ui-datepicker__nav-btn--hidden"),onClick:()=>{J(pn(U,-1)),C("days")},disabled:!A,"aria-label":"Previous month",children:e.jsx(ra,{})}),e.jsxs("button",{type:"button",className:"ui-datepicker__nav-title",onClick:()=>C(we==="days"?"months":"days"),"aria-label":`${na[Oe]} ${ce}. Click to choose month`,children:[na[Oe]," ",ce]}),e.jsx("button",{type:"button",className:Xe("ui-datepicker__nav-btn",!me&&"ui-datepicker__nav-btn--hidden"),onClick:()=>{J(pn(U,1)),C("days")},disabled:!me,"aria-label":"Next month",children:e.jsx(ia,{})})]}),e.jsx("div",{className:"ui-datepicker__weekdays","aria-hidden":"true",children:fi.map(qe=>e.jsx("span",{className:"ui-datepicker__weekday",children:qe},qe))}),e.jsx("div",{className:"ui-datepicker__grid",role:"grid","aria-label":`${na[Oe]} ${ce}`,children:dt.map((qe,Ot)=>e.jsx("button",{type:"button",role:"gridcell",className:kn(qe,Oe),disabled:Be(qe),"aria-label":Je(qe),"aria-pressed":t==="single"&&H?Ut(qe,H):void 0,onClick:()=>xn(qe),onMouseEnter:()=>{t==="range"&&Se&&oe(new Date(qe.getFullYear(),qe.getMonth(),qe.getDate()))},onMouseLeave:()=>{t==="range"&&Se&&oe(null)},tabIndex:-1,children:qe.getDate()},Ot))})]},`${ce}-${Oe}`)},wn=()=>e.jsxs("div",{className:"ui-datepicker__calendar ui-datepicker__calendar--picker",children:[e.jsxs("div",{className:"ui-datepicker__nav",children:[e.jsx("button",{type:"button",className:"ui-datepicker__nav-btn",onClick:()=>J(pn(U,-12)),"aria-label":"Previous year",children:e.jsx(ra,{})}),e.jsx("button",{type:"button",className:"ui-datepicker__nav-title",onClick:()=>C("years"),"aria-label":`${U.getFullYear()}. Click to choose year`,children:U.getFullYear()}),e.jsx("button",{type:"button",className:"ui-datepicker__nav-btn",onClick:()=>J(pn(U,12)),"aria-label":"Next year",children:e.jsx(ia,{})})]}),e.jsx("div",{className:"ui-datepicker__month-grid",children:mi.map((E,A)=>e.jsx("button",{type:"button",className:Xe("ui-datepicker__month-cell",U.getMonth()===A&&"ui-datepicker__month-cell--active",b.getFullYear()===U.getFullYear()&&b.getMonth()===A&&"ui-datepicker__month-cell--today"),onClick:()=>{J(new Date(U.getFullYear(),A,1)),C("days")},children:E},A))})]}),Nn=()=>{const E=Array.from({length:12},(A,me)=>de+me);return e.jsxs("div",{className:"ui-datepicker__calendar ui-datepicker__calendar--picker",children:[e.jsxs("div",{className:"ui-datepicker__nav",children:[e.jsx("button",{type:"button",className:"ui-datepicker__nav-btn",onClick:()=>fe(A=>A-12),"aria-label":"Previous years",children:e.jsx(ra,{})}),e.jsxs("span",{className:"ui-datepicker__nav-title ui-datepicker__nav-title--static",children:[de," – ",de+11]}),e.jsx("button",{type:"button",className:"ui-datepicker__nav-btn",onClick:()=>fe(A=>A+12),"aria-label":"Next years",children:e.jsx(ia,{})})]}),e.jsx("div",{className:"ui-datepicker__year-grid",children:E.map(A=>e.jsx("button",{type:"button",className:Xe("ui-datepicker__year-cell",U.getFullYear()===A&&"ui-datepicker__year-cell--active",b.getFullYear()===A&&"ui-datepicker__year-cell--today"),onClick:()=>{J(new Date(A,U.getMonth(),1)),fe(A-4),C("months")},children:A},A))})]})},Cn=()=>{const E=A=>{if(pe===void 0||pe==="no-date")return;const me=pe==="full"?yt():pe;if(!me)return;const ce=It(A,me,Pe);je(A),We(Oe=>ce.includes(Oe)?Oe:ce[0]??0)};return pe==="no-date"?e.jsxs("aside",{className:"ui-datepicker__time-sidebar","aria-label":"Time",children:[e.jsx("p",{className:"ui-datepicker__time-empty",children:"Select a date"}),e.jsx("button",{type:"button",className:"ui-datepicker__apply-btn",disabled:!0,children:"Apply"})]}):pe===null||Ce.length===0?e.jsxs("aside",{className:"ui-datepicker__time-sidebar","aria-label":"Time",children:[e.jsx("p",{className:"ui-datepicker__time-empty",children:"No available times"}),e.jsx("button",{type:"button",className:"ui-datepicker__apply-btn",disabled:!0,children:"Apply"})]}):e.jsxs("aside",{className:"ui-datepicker__time-sidebar","aria-label":"Time",children:[e.jsxs("div",{className:"ui-datepicker__time-columns",children:[e.jsxs("div",{className:"ui-datepicker__time-scroll-col",children:[e.jsx("span",{className:"ui-datepicker__time-scroll-head",id:`${R}-hour-col`,children:"Hr"}),e.jsx("div",{ref:et,className:"ui-datepicker__time-scroll-list",role:"listbox","aria-labelledby":`${R}-hour-col`,children:Ce.map(A=>e.jsx("button",{type:"button",className:Xe("ui-datepicker__time-scroll-item",xe===A&&"ui-datepicker__time-scroll-item--selected"),"data-time-value":A,role:"option","aria-selected":xe===A,tabIndex:-1,onClick:()=>E(A),children:String(A).padStart(2,"0")},A))})]}),e.jsxs("div",{className:"ui-datepicker__time-scroll-col",children:[e.jsx("span",{className:"ui-datepicker__time-scroll-head",id:`${R}-min-col`,children:"Min"}),e.jsx("div",{ref:st,className:"ui-datepicker__time-scroll-list",role:"listbox","aria-labelledby":`${R}-min-col`,children:ht.map(A=>e.jsx("button",{type:"button",className:Xe("ui-datepicker__time-scroll-item",Ae===A&&"ui-datepicker__time-scroll-item--selected"),"data-time-value":A,role:"option","aria-selected":Ae===A,tabIndex:-1,onClick:()=>We(A),children:String(A).padStart(2,"0")},A))})]})]}),e.jsx("button",{type:"button",className:"ui-datepicker__apply-btn",onClick:Qt,children:"Apply"})]})},Bt=pn(U,1),Rt=()=>e.jsx("div",{ref:Fe,className:Xe("ui-datepicker__popup",O?.popup),style:{position:"fixed",top:M?.top,bottom:M?.bottom,left:M?.left,maxHeight:M?.maxHeight,visibility:ae?"visible":"hidden",...nt!==void 0?{zIndex:nt}:null},onClick:E=>E.stopPropagation(),onMouseDown:E=>E.stopPropagation(),role:"dialog","aria-label":"Choose date","aria-modal":"true",children:e.jsxs("div",{className:"ui-datepicker__popup-inner",children:[z.length>0&&e.jsx("div",{className:"ui-datepicker__presets",children:z.map((E,A)=>e.jsx("button",{type:"button",className:"ui-datepicker__preset-btn",onClick:()=>Ht(E),children:E.label},A))}),e.jsxs("div",{className:Xe("ui-datepicker__body",m&&t==="single"&&we==="days"&&"ui-datepicker__body--with-time"),children:[we==="days"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"ui-datepicker__calendars-block",children:[e.jsxs("div",{className:Xe("ui-datepicker__calendars",I&&"ui-datepicker__calendars--two"),children:[Ge(U,!0,!I),I&&Ge(Bt,!1,!0)]}),t==="range"&&e.jsx("p",{className:"ui-datepicker__range-hint",children:Se?"Select end date":le.start&&le.end?`${Je(le.start,l)} – ${Je(le.end,l)}`:"Select start date"})]}),m&&t==="single"&&Cn()]}),we==="months"&&wn(),we==="years"&&Nn()]})]})}),wt=yn&&!P&&e.jsx("button",{type:"button",className:"ui-datepicker__clear-btn",onClick:Zt,onMouseDown:E=>E.preventDefault(),"aria-label":"Clear date",tabIndex:-1,children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round","aria-hidden":"true",focusable:"false",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),en=e.jsx("button",{type:"button",className:Xe("ui-datepicker__input-icon-btn",_e&&"ui-datepicker__input-icon-btn--open"),tabIndex:-1,disabled:P,onMouseDown:E=>E.preventDefault(),onClick:_e?Ye:kt,"aria-label":"Open calendar",children:e.jsx(is,{})}),tn=E=>{Ke.current=!0,kt(),Q?.(E)},Y=E=>{pt(E),re?.(E)},ve=Xe("ui-datepicker__input",`ui-datepicker__input--${X}`,O?.input),Me=Xe("ui-datepicker__input","ui-datepicker__input--range",`ui-datepicker__input--${X}`,O?.input),De={disabled:P,required:q,"aria-expanded":_e,"aria-haspopup":"dialog","aria-invalid":S,onFocus:tn,onBlur:Y},Le=()=>e.jsxs(e.Fragment,{children:[k&&e.jsxs("label",{htmlFor:Z,className:Xe("ui-datepicker__label",S&&"ui-datepicker__label--error",O?.label),children:[k,q&&e.jsx("span",{className:"ui-datepicker__label-required",children:"*"})]}),e.jsxs("div",{className:Xe("ui-datepicker__input-wrapper",`ui-datepicker__input-wrapper--${X}`,t==="range"&&"ui-datepicker__input-wrapper--range",S&&"ui-datepicker__input-wrapper--error",P&&"ui-datepicker__input-wrapper--disabled",_e&&"ui-datepicker__input-wrapper--open",!!T&&"ui-datepicker__input-wrapper--with-start-adornment",!!ee&&"ui-datepicker__input-wrapper--with-end-adornment",O?.wrapper),children:[T&&e.jsx("span",{className:"ui-datepicker__adornment ui-datepicker__adornment--start",children:T}),t==="single"?e.jsx("input",{...ye,ref:ke,id:Z,type:"text",inputMode:"numeric",className:ve,value:ct,placeholder:c??(m?W:l),"aria-label":k??c??"Select date",onChange:vn,...De}):e.jsxs(e.Fragment,{children:[e.jsx("input",{...ye,ref:ke,id:Z,type:"text",inputMode:"numeric",className:Me,value:gt,placeholder:l,"aria-label":"Start date",onChange:Jt,...De}),e.jsx("span",{className:"ui-datepicker__range-sep","aria-hidden":"true",children:"–"}),e.jsx("input",{type:"text",inputMode:"numeric",className:Me,value:Re,placeholder:l,"aria-label":"End date",onChange:bn,...De})]}),ee&&e.jsx("span",{className:"ui-datepicker__adornment ui-datepicker__adornment--end",children:ee}),wt,en]})]}),nn=()=>e.jsx("button",{type:"button",className:Xe("ui-datepicker__icon-trigger",_e&&"ui-datepicker__icon-trigger--open",P&&"ui-datepicker__icon-trigger--disabled"),disabled:P,onClick:_e?Ye:kt,"aria-label":jn||"Select date","aria-expanded":_e,"aria-haspopup":"dialog",children:e.jsx(is,{})});return e.jsxs("div",{ref:at,className:Xe("ui-datepicker",D&&"ui-datepicker--full-width",O?.root),style:ge,children:[r==="input"?Le():nn(),$&&r==="input"&&e.jsx("p",{className:Xe("ui-datepicker__helper-text",S&&"ui-datepicker__helper-text--error",O?.helperText),children:$}),_e&&M&&Mt.createPortal(Rt(),document.body)]})});la.displayName="DatePicker";const mn=8,ji="HH:mm",ft=(...t)=>t.filter(Boolean).join(" ");function ut(t,n,s){const a=t??new Date;return new Date(a.getFullYear(),a.getMonth(),a.getDate(),n,s,0,0)}function it(t,n){const s=String(t.getHours()).padStart(2,"0"),a=String(t.getMinutes()).padStart(2,"0");return n.replace("HH",s).replace("mm",a)}function oa(t,n){if(t.length!==n.length)return null;const s=n.indexOf("HH"),a=n.indexOf("mm");if(s<0||a<0)return null;const i=parseInt(t.slice(s,s+2),10),r=parseInt(t.slice(a,a+2),10);return isNaN(i)||isNaN(r)||i<0||i>23||r<0||r>59?null:{hour:i,minute:r}}function ca(t,n){const s=t.replace(/\D/g,"").slice(0,4);if(!s.length)return"";let a=0,i="",r=0;for(;r<n.length;)if(n.startsWith("HH",r)||n.startsWith("mm",r)){if(a>=s.length||(i+=s[a++],a>=s.length))break;i+=s[a++],r+=2}else{if(a<s.length)i+=n[r];else break;r+=1}return i}const ls=(t,n,s)=>{const a=window.innerHeight-t.bottom-mn,i=t.top-mn,r=s>a&&i>a;let l=t.left;return l+n>window.innerWidth-8&&(l=Math.max(8,window.innerWidth-8-n)),r?{bottom:window.innerHeight-t.top+mn,left:l,maxHeight:Math.min(420,i)}:{top:t.bottom+mn,left:l,maxHeight:Math.min(420,a)}};function os(){return e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}),e.jsx("polyline",{points:"12 7 12 12 15.5 14"})]})}const cs=o.forwardRef(({mode:t="single",value:n,onChange:s,rangeValue:a,onRangeChange:i,triggerVariant:r="input",format:l=ji,placeholder:c,timeStep:d=1,bounds:u,label:p,helperText:f,error:h=!1,disabled:m=!1,required:v=!1,size:g="normal",fullWidth:_=!1,startAdornment:y,endAdornment:N,sx:k,style:$,id:S,onFocus:P,onBlur:q,...X},D)=>{const T=o.useId(),ee=S||`${T}-input`,O=Math.max(1,Math.floor(d)),ge=n!==void 0,ue=a!==void 0,[Q,re]=o.useState(null),[ye,ke]=o.useState({start:null,end:null}),R=ge?n??null:Q,Z=ue?a??ye:ye,b=o.useMemo(()=>Et(u),[u]),I=u===null||b===null,z=b??yt(),W=o.useMemo(()=>I?[]:ns(z,O),[I,z,O]),[V,be]=o.useState(!1),[w,te]=o.useState(null),[ie,he]=o.useState(!1),H=R?.getHours()??W[0]??0,le=R?.getMinutes()??0,[$e,Pe]=o.useState(H),[pe,Ce]=o.useState(le),_e=o.useMemo(()=>I?[]:It($e,z,O),[I,z,O,$e]),[ze,M]=o.useState(Z.start?.getHours()??W[0]??0),[G,ae]=o.useState(Z.start?.getMinutes()??0),[j,B]=o.useState(Z.end?.getHours()??W[W.length-1]??0),[U,J]=o.useState(Z.end?.getMinutes()??0),we=o.useMemo(()=>I?[]:It(ze,z,O),[I,z,O,ze]),C=o.useMemo(()=>I?[]:It(j,z,O),[I,z,O,j]),de=o.useRef(!1),[fe,Se]=o.useState(()=>R?it(R,l):""),[Ne,F]=o.useState(()=>Z.start?it(Z.start,l):""),[oe,xe]=o.useState(()=>Z.end?it(Z.end,l):""),je=o.useRef(null),Ae=o.useRef(null),We=o.useContext(bt),ht=We?We.baseZ+ln:void 0,Ke=o.useRef(null),ct=o.useRef(null),Qe=o.useRef(null),gt=o.useRef(null),xt=o.useRef(null),Re=o.useRef(null),tt=o.useCallback(()=>{be(!1)},[]),at=o.useCallback(()=>{m||be(!0)},[m]);At({enabled:V,onEscape:tt}),o.useEffect(()=>{if(!V){te(null),he(!1);return}const Y=je.current;if(!Y)return;const ve=Y.getBoundingClientRect();te({top:ve.bottom+mn,left:ve.left,maxHeight:420}),he(!1);const Me=Le=>{!je.current?.contains(Le.target)&&!Ae.current?.contains(Le.target)&&tt()};setTimeout(()=>document.addEventListener("mousedown",Me),0);const De=()=>{if(!Ae.current||!je.current)return;const Le=je.current.getBoundingClientRect();te(ls(Le,Ae.current.offsetWidth,Ae.current.offsetHeight))};return window.addEventListener("scroll",De,!0),window.addEventListener("resize",De),()=>{window.removeEventListener("scroll",De,!0),window.removeEventListener("resize",De),document.removeEventListener("mousedown",Me)}},[V,tt]),o.useLayoutEffect(()=>{if(!V||ie||!Ae.current||!je.current)return;const Y=je.current.getBoundingClientRect();te(ls(Y,Ae.current.offsetWidth,Ae.current.offsetHeight)),he(!0)},[V,w,ie]),o.useLayoutEffect(()=>{if(!V||!ie)return;const Y=ve=>ve?.scrollIntoView({block:"center"});t==="single"?(Y(Ke.current?.querySelector(`[data-time-value="${$e}"]`)),Y(ct.current?.querySelector(`[data-time-value="${pe}"]`))):(Y(Qe.current?.querySelector(`[data-time-value="${ze}"]`)),Y(gt.current?.querySelector(`[data-time-value="${G}"]`)),Y(xt.current?.querySelector(`[data-time-value="${j}"]`)),Y(Re.current?.querySelector(`[data-time-value="${U}"]`)))},[V,ie,t,$e,pe,ze,G,j,U]),o.useEffect(()=>{if(t!=="single"||!R||I)return;const Y=Kt(R.getHours(),R.getMinutes(),z,O);Pe(Y.hour),Ce(Y.minute)},[t,R,I,z,O]),o.useEffect(()=>{if(t==="range"&&!I){if(Z.start){const Y=Kt(Z.start.getHours(),Z.start.getMinutes(),z,O);M(Y.hour),ae(Y.minute)}if(Z.end){const Y=Kt(Z.end.getHours(),Z.end.getMinutes(),z,O);B(Y.hour),J(Y.minute)}}},[t,Z.start,Z.end,I,z,O]),o.useEffect(()=>{de.current||t==="single"&&Se(R?it(R,l):"")},[R,l,t]),o.useEffect(()=>{de.current||t==="range"&&(F(Z.start?it(Z.start,l):""),xe(Z.end?it(Z.end,l):""))},[t,Z.start,Z.end,l]);const Fe=o.useCallback(Y=>{ge||re(Y),s?.(Y)},[ge,s]),et=o.useCallback(Y=>{ue||ke(Y),i?.(Y)},[ue,i]),Xt=Y=>{if(I)return;de.current=!1;const ve=It(Y,z,O),Me=ve.includes(pe)?pe:ve[0]??0;Pe(Y),Ce(Me),Fe(ut(R,Y,Me))},nt=Y=>{I||(de.current=!1,Ce(Y),Fe(ut(R,$e,Y)))},st=(Y,ve)=>{if(I)return;de.current=!1;const Me=It(ve,z,O);if(Y==="start"){const De=Me.includes(G)?G:Me[0]??0;M(ve),ae(De),Ye("start",ve,De)}else{const De=Me.includes(U)?U:Me[0]??0;B(ve),J(De),Ye("end",ve,De)}},Be=(Y,ve)=>{I||(de.current=!1,Y==="start"?(ae(ve),Ye("start",ze,ve)):(J(ve),Ye("end",j,ve)))},Ye=(Y,ve,Me)=>{if(Y==="start"){const De=ut(Z.start,ve,Me);let Le=Z.end;Le&&Le.getTime()<De.getTime()&&(Le=ut(Le,ve,Me),B(ve),J(Me)),et({start:De,end:Le})}else{const De=Z.start;let Le=ut(Z.end??Z.start,ve,Me);De&&Le.getTime()<De.getTime()&&(Le=ut(Le,De.getHours(),De.getMinutes()),B(De.getHours()),J(De.getMinutes())),et({start:De,end:Le})}},kt=o.useCallback(Y=>{Y.stopPropagation(),de.current=!1,t==="single"?(Se(""),Fe(null)):(F(""),xe(""),et({start:null,end:null}))},[t,Fe,et]),xn=o.useCallback(Y=>{const ve=ca(Y.target.value,l);if(Se(ve),ve.length===l.length){const Me=oa(ve,l);if(!Me||!I&&!Bn(Me.hour,Me.minute,z,O))return;Fe(ut(R,Me.hour,Me.minute))}else ve.length===0&&Fe(null)},[l,I,z,O,Fe,R]),Ht=o.useCallback(Y=>{const ve=ca(Y.target.value,l);if(F(ve),ve.length===l.length){const Me=oa(ve,l);if(!Me||!I&&!Bn(Me.hour,Me.minute,z,O))return;const De=ut(Z.start,Me.hour,Me.minute);let Le=Z.end;Le&&Le.getTime()<De.getTime()&&(Le=ut(Le,De.getHours(),De.getMinutes())),et({start:De,end:Le})}},[l,I,z,O,Z.start,Z.end,et]),Zt=o.useCallback(Y=>{const ve=ca(Y.target.value,l);if(xe(ve),ve.length===l.length){const Me=oa(ve,l);if(!Me||!I&&!Bn(Me.hour,Me.minute,z,O))return;let De=ut(Z.end??Z.start,Me.hour,Me.minute);const Le=Z.start;Le&&De.getTime()<Le.getTime()&&(De=ut(De,Le.getHours(),Le.getMinutes())),et({start:Z.start,end:De})}},[l,I,z,O,Z.start,Z.end,et]),vn=o.useCallback(Y=>{const ve=Y.relatedTarget;Ae.current?.contains(ve)||je.current?.contains(ve)||(de.current=!1,Se(R?it(R,l):""),F(Z.start?it(Z.start,l):""),xe(Z.end?it(Z.end,l):""))},[R,Z.start,Z.end,l]),Jt=(()=>{if(t==="single")return R?it(R,l):"";const{start:Y,end:ve}=Z;return Y&&ve?`${it(Y,l)} – ${it(ve,l)}`:Y?`${it(Y,l)} – ...`:""})(),bn=t==="single"?!!R:!!(Z.start||Z.end),pt=(Y,ve,Me,De,Le,nn)=>e.jsxs("div",{className:"ui-timepicker__col",children:[e.jsx("span",{className:"ui-timepicker__col-head",id:Y,children:ve}),e.jsx("div",{ref:nn,className:"ui-timepicker__col-list",role:"listbox","aria-labelledby":Y,children:Me.map(E=>e.jsx("button",{type:"button",className:ft("ui-timepicker__col-item",De===E&&"ui-timepicker__col-item--selected"),"data-time-value":E,role:"option","aria-selected":De===E,tabIndex:-1,onClick:()=>Le(E),children:String(E).padStart(2,"0")},E))})]}),Qt=()=>e.jsx("div",{className:"ui-timepicker__empty",children:e.jsx("p",{children:"No available times"})}),jn=()=>I||W.length===0?Qt():e.jsx("div",{className:"ui-timepicker__body",children:e.jsx("div",{className:"ui-timepicker__group",children:e.jsxs("div",{className:"ui-timepicker__columns",children:[pt(`${T}-hr`,"Hour",W,$e,Xt,Ke),pt(`${T}-min`,"Minute",_e,pe,nt,ct)]})})}),yn=()=>I||W.length===0?Qt():e.jsxs("div",{className:"ui-timepicker__body ui-timepicker__body--range",children:[e.jsxs("div",{className:"ui-timepicker__group",children:[e.jsx("span",{className:"ui-timepicker__group-label",children:"From"}),e.jsxs("div",{className:"ui-timepicker__columns",children:[pt(`${T}-shr`,"Hour",W,ze,Y=>st("start",Y),Qe),pt(`${T}-smin`,"Minute",we,G,Y=>Be("start",Y),gt)]})]}),e.jsxs("div",{className:"ui-timepicker__group",children:[e.jsx("span",{className:"ui-timepicker__group-label",children:"To"}),e.jsxs("div",{className:"ui-timepicker__columns",children:[pt(`${T}-ehr`,"Hour",W,j,Y=>st("end",Y),xt),pt(`${T}-emin`,"Minute",C,U,Y=>Be("end",Y),Re)]})]})]}),kn=()=>e.jsx("div",{ref:Ae,className:ft("ui-timepicker__popup",k?.popup),style:{position:"fixed",top:w?.top,bottom:w?.bottom,left:w?.left,maxHeight:w?.maxHeight,visibility:ie?"visible":"hidden",...ht!==void 0?{zIndex:ht}:null},onClick:Y=>Y.stopPropagation(),onMouseDown:Y=>Y.stopPropagation(),role:"dialog","aria-label":"Choose time","aria-modal":"true",children:e.jsx("div",{className:"ui-timepicker__popup-inner",children:t==="single"?jn():yn()})}),Ge=bn&&!m&&e.jsx("button",{type:"button",className:"ui-timepicker__clear-btn",onClick:kt,onMouseDown:Y=>Y.preventDefault(),"aria-label":"Clear time",tabIndex:-1,children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round","aria-hidden":"true",focusable:"false",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),wn=e.jsx("button",{type:"button",className:ft("ui-timepicker__icon-btn",V&&"ui-timepicker__icon-btn--open"),tabIndex:-1,disabled:m,onMouseDown:Y=>Y.preventDefault(),onClick:V?tt:at,"aria-label":"Open time picker",children:e.jsx(os,{})}),Nn=Y=>{de.current=!0,at(),P?.(Y)},Cn=Y=>{vn(Y),q?.(Y)},Bt=ft("ui-timepicker__input",`ui-timepicker__input--${g}`,k?.input),Rt=ft("ui-timepicker__input","ui-timepicker__input--range",`ui-timepicker__input--${g}`,k?.input),wt={disabled:m,required:v,"aria-expanded":V,"aria-haspopup":"dialog","aria-invalid":h,onFocus:Nn,onBlur:Cn},en=()=>e.jsxs(e.Fragment,{children:[p&&e.jsxs("label",{htmlFor:ee,className:ft("ui-timepicker__label",h&&"ui-timepicker__label--error",k?.label),children:[p,v&&e.jsx("span",{className:"ui-timepicker__label-required",children:"*"})]}),e.jsxs("div",{className:ft("ui-timepicker__input-wrapper",`ui-timepicker__input-wrapper--${g}`,t==="range"&&"ui-timepicker__input-wrapper--range",h&&"ui-timepicker__input-wrapper--error",m&&"ui-timepicker__input-wrapper--disabled",V&&"ui-timepicker__input-wrapper--open",!!y&&"ui-timepicker__input-wrapper--with-start-adornment",!!N&&"ui-timepicker__input-wrapper--with-end-adornment",k?.wrapper),children:[y&&e.jsx("span",{className:"ui-timepicker__adornment ui-timepicker__adornment--start",children:y}),t==="single"?e.jsx("input",{...X,ref:D,id:ee,type:"text",inputMode:"numeric",className:Bt,value:fe,placeholder:c??l,"aria-label":p??c??"Select time",onChange:xn,...wt}):e.jsxs(e.Fragment,{children:[e.jsx("input",{...X,ref:D,id:ee,type:"text",inputMode:"numeric",className:Rt,value:Ne,placeholder:l,"aria-label":"Start time",onChange:Ht,...wt}),e.jsx("span",{className:"ui-timepicker__range-sep","aria-hidden":"true",children:"–"}),e.jsx("input",{type:"text",inputMode:"numeric",className:Rt,value:oe,placeholder:l,"aria-label":"End time",onChange:Zt,...wt})]}),N&&e.jsx("span",{className:"ui-timepicker__adornment ui-timepicker__adornment--end",children:N}),Ge,wn]})]}),tn=()=>e.jsx("button",{type:"button",className:ft("ui-timepicker__icon-trigger",V&&"ui-timepicker__icon-trigger--open",m&&"ui-timepicker__icon-trigger--disabled"),disabled:m,onClick:V?tt:at,"aria-label":Jt||"Select time","aria-expanded":V,"aria-haspopup":"dialog",children:e.jsx(os,{})});return o.useEffect(()=>{if(!V||t!=="single"||R||I)return;const Y=ts(z,O);Y&&(Pe(Y.hour),Ce(Y.minute))},[V,t,R,I,z,O]),e.jsxs("div",{ref:je,className:ft("ui-timepicker",_&&"ui-timepicker--full-width",k?.root),style:$,children:[r==="input"?en():tn(),f&&r==="input"&&e.jsx("p",{className:ft("ui-timepicker__helper-text",h&&"ui-timepicker__helper-text--error",k?.helperText),children:f}),V&&w&&Mt.createPortal(kn(),document.body)]})});cs.displayName="TimePicker";const da=({checked:t,defaultChecked:n,onChange:s,label:a,color:i="primary",size:r="medium",isIndeterminate:l=!1,isDisabled:c=!1,name:d,value:u,id:p,sx:f,style:h})=>{const m=o.useRef(null);o.useEffect(()=>{m.current&&(m.current.indeterminate=l)},[l]);const v=["ui-checkbox",`ui-checkbox--${i}`,`ui-checkbox--${r}`,c&&"ui-checkbox--disabled",f].filter(Boolean).join(" "),g=_=>{c||s?.(_.target.checked,_)};return e.jsxs("label",{className:v,style:h,children:[e.jsx("input",{ref:m,type:"checkbox",className:"ui-checkbox__input",checked:t,defaultChecked:n,disabled:c,name:d,value:u,id:p,onChange:g,"aria-checked":l?"mixed":t}),e.jsx("span",{className:"ui-checkbox__box","aria-hidden":"true",children:l?e.jsx("svg",{className:"ui-checkbox__mark",viewBox:"0 0 12 12",focusable:"false",children:e.jsx("line",{x1:"2",y1:"6",x2:"10",y2:"6",strokeWidth:"2",strokeLinecap:"round"})}):e.jsx("svg",{className:"ui-checkbox__mark",viewBox:"0 0 12 12",focusable:"false",children:e.jsx("polyline",{points:"1.5,6 4.5,9 10.5,3",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})})}),a!=null&&e.jsx("span",{className:"ui-checkbox__label",children:a})]})};da.displayName="Checkbox";const ds=o.createContext(null),us=o.createContext(null),hs=()=>{const t=o.useContext(ds);if(!t)throw new Error("AccordionTrigger/AccordionContent must be inside AccordionRoot");return t},ps=()=>{const t=o.useContext(us);if(!t)throw new Error("AccordionTrigger/AccordionContent must be inside AccordionItem");return t},ua=({children:t,variant:n="outlined",size:s="medium",allowMultiple:a=!1,defaultOpenIds:i=[],onToggle:r,divider:l=!0,sx:c,style:d})=>{const[u,p]=o.useState(new Set(i)),f=o.useCallback(m=>{p(v=>{const g=new Set(v),_=g.has(m);return _?g.delete(m):(a||g.clear(),g.add(m)),r?.(m,!_),g})},[a,r]),h=["ui-accordion",`ui-accordion--${n}`,`ui-accordion--${s}`,l&&"ui-accordion--divider",c].filter(Boolean).join(" ");return e.jsx(ds.Provider,{value:{openIds:u,toggle:f},children:e.jsx("div",{className:h,style:d,children:t})})};ua.displayName="AccordionRoot";const ha=({id:t,children:n,isDisabled:s=!1,sx:a,style:i})=>{const{openIds:r}=hs(),l=r.has(t),c=["ui-accordion__item",l&&"ui-accordion__item--open",s&&"ui-accordion__item--disabled",a].filter(Boolean).join(" ");return e.jsx(us.Provider,{value:{itemId:t,isOpen:l,isDisabled:s},children:e.jsx("div",{className:c,style:i,children:n})})};ha.displayName="AccordionItem";const pa=({children:t,showChevron:n=!0,startAdornment:s,endAdornment:a,sx:i,style:r})=>{const{toggle:l}=hs(),{itemId:c,isOpen:d,isDisabled:u}=ps(),p=["ui-accordion__trigger",i].filter(Boolean).join(" "),f=!!(s||a),h=n&&e.jsx("span",{className:["ui-accordion__chevron",d&&"ui-accordion__chevron--open"].filter(Boolean).join(" "),"aria-hidden":"true",children:e.jsx(Rn,{})}),m=e.jsxs("button",{className:p,type:"button","aria-expanded":d,"aria-controls":`accordion-content-${c}`,id:`accordion-header-${c}`,disabled:u,onClick:()=>l(c),style:r,children:[t,!f&&h]});if(!f)return m;const v=g=>g.stopPropagation();return e.jsxs("div",{className:"ui-accordion__header",children:[s&&e.jsx("div",{className:"ui-accordion__adornment ui-accordion__adornment--start",onClick:v,children:s}),m,a&&e.jsx("div",{className:"ui-accordion__adornment ui-accordion__adornment--end",onClick:v,children:a}),h&&e.jsx("span",{className:"ui-accordion__chevron-wrap",onClick:()=>!u&&l(c),"aria-hidden":"true",children:h})]})};pa.displayName="AccordionTrigger";const ma=({children:t,sx:n,style:s})=>{const{itemId:a}=ps(),i=["ui-accordion__content-inner",n].filter(Boolean).join(" ");return e.jsx("div",{id:`accordion-content-${a}`,role:"region","aria-labelledby":`accordion-header-${a}`,className:"ui-accordion__content",children:e.jsx("div",{className:i,style:s,children:t})})};ma.displayName="AccordionContent";const ms=({items:t,...n})=>e.jsx(ua,{...n,children:t.map(s=>e.jsxs(ha,{id:s.id,isDisabled:s.isDisabled,children:[e.jsxs(pa,{children:[s.icon&&e.jsx("span",{className:"ui-accordion__item-icon",children:s.icon}),e.jsx("span",{className:"ui-accordion__title",children:s.title})]}),e.jsx(ma,{children:s.content})]},s.id))});ms.displayName="Accordion";function yi(t,n){return n}function ki(t,n){const s=t[n];return s==null||s===""?"-":s}function fn(t){if(t!==void 0)return typeof t=="number"?`${t}px`:t}function wi({row:t,rowIndex:n,visibleCols:s,tdClasses:a,stickyStyles:i,onRowClick:r,onKeyDown:l}){return e.jsx("tr",{className:"ui-table__tr",tabIndex:r?0:void 0,role:r?"button":void 0,onClick:r?()=>r(t,n):void 0,onKeyDown:l?c=>l(c,t,n):void 0,children:s.map((c,d)=>e.jsx("td",{className:a[d],style:i[d],children:c.render?c.render(t,n):ki(t,c.key)},c.key))})}const Ni=o.memo(wi),He=4,fs=80,Ci=({x:t,anchorTop:n,anchorBottom:s,items:a,onClose:i,portalNode:r,boundsRect:l})=>{const c=o.useRef(null),[d,u]=o.useState({left:t,top:s}),[p,f]=o.useState(()=>a.findIndex(v=>!v.disabled));At({enabled:!0,onEscape:i}),o.useLayoutEffect(()=>{const v=c.current;if(!v)return;v.style.maxHeight="";const g=v.getBoundingClientRect();let _=t-g.width,y=s,N;l&&g.width<=l.width?(_+g.width>l.right-He&&(_=l.right-g.width-He),_<l.left+He&&(_=l.left+He)):(_+g.width>window.innerWidth-He&&(_=window.innerWidth-g.width-He),_<He&&(_=He));const k=window.innerHeight-s-He,$=n-He;g.height<=k?y=s:g.height<=$?y=n-g.height:k>=$?(y=s,N=Math.max(fs,k)):(N=Math.max(fs,$),y=n-N),u({left:_,top:y,maxHeight:N})},[t,n,s,l]),o.useEffect(()=>{const v=_=>{c.current&&!c.current.contains(_.target)&&i()},g=()=>i();return document.addEventListener("pointerdown",v,!0),window.addEventListener("scroll",g,!0),window.addEventListener("resize",g),()=>{document.removeEventListener("pointerdown",v,!0),window.removeEventListener("scroll",g,!0),window.removeEventListener("resize",g)}},[i]),o.useEffect(()=>{c.current?.focus()},[]);const h=v=>{if(a.length===0)return;let g=p;for(let _=0;_<a.length;_+=1)if(g=(g+v+a.length)%a.length,!a[g].disabled){f(g);return}},m=v=>{if(v.key==="ArrowDown")v.preventDefault(),h(1);else if(v.key==="ArrowUp")v.preventDefault(),h(-1);else if(v.key==="Enter"||v.key===" "){v.preventDefault();const g=a[p];g&&!g.disabled&&(g.onSelect(),i())}};return r?Mt.createPortal(e.jsx("div",{ref:c,className:"ui-table__ctxmenu",role:"menu",tabIndex:-1,style:{left:d.left,top:d.top,maxHeight:d.maxHeight,overflowY:d.maxHeight?"auto":void 0},onKeyDown:m,onContextMenu:v=>v.preventDefault(),children:a.map((v,g)=>e.jsx("div",{role:"menuitem","aria-disabled":v.disabled||void 0,className:["ui-table__ctxmenu-item",v.disabled&&"ui-table__ctxmenu-item--disabled",g===p&&!v.disabled&&"ui-table__ctxmenu-item--focused"].filter(Boolean).join(" "),onMouseEnter:()=>!v.disabled&&f(g),onClick:v.disabled?void 0:()=>{v.onSelect(),i()},children:v.label},v.key))}),r):null},_s=120,gs=36,Mi=8,Di=({x:t,anchorTop:n,anchorBottom:s,columns:a,pinnedKeys:i,hiddenKeys:r,visibleCount:l,canPin:c,canHide:d,canReorder:u,onTogglePin:p,onToggleHide:f,onUnpinAll:h,onShowAll:m,onReset:v,onReorder:g,hasUnpinnablePinned:_,hasHiddenColumns:y,labels:N,onClose:k,portalNode:$,boundsRect:S})=>{const P=o.useRef(null),q=o.useRef(null),[X,D]=o.useState({left:t,top:s}),[T,ee]=o.useState(null),[O,ge]=o.useState(!1),ue=o.useRef(null);At({enabled:!0,onEscape:k}),o.useLayoutEffect(()=>{const M=P.current;if(!M)return;M.style.maxHeight="";const G=M.getBoundingClientRect();let ae=t-G.width,j=s,B;S&&G.width<=S.width?(ae+G.width>S.right-He&&(ae=S.right-G.width-He),ae<S.left+He&&(ae=S.left+He)):(ae+G.width>window.innerWidth-He&&(ae=window.innerWidth-G.width-He),ae<He&&(ae=He));const U=window.innerHeight-s-He,J=n-He;G.height<=U?j=s:G.height<=J?j=n-G.height:U>=J?(j=s,B=Math.max(_s,U)):(B=Math.max(_s,J),j=n-B),D({left:ae,top:j,maxHeight:B})},[t,n,s,S]);const Q=o.useCallback((M,G)=>{const ae=P.current,j=ae?.offsetWidth??0,B=ae?.offsetHeight??0,U=Math.max(He,window.innerWidth-j-He),J=Math.max(He,window.innerHeight-B-He);return{left:Math.min(Math.max(He,M),U),top:Math.min(Math.max(He,G),J)}},[]);o.useEffect(()=>{const M=j=>{P.current&&!P.current.contains(j.target)&&k()},G=j=>{const B=P.current;B&&B.contains(j.target)||k()},ae=()=>{if(T){ee(j=>j&&Q(j.left,j.top));return}k()};return document.addEventListener("pointerdown",M,!0),window.addEventListener("scroll",G,!0),window.addEventListener("resize",ae),()=>{document.removeEventListener("pointerdown",M,!0),window.removeEventListener("scroll",G,!0),window.removeEventListener("resize",ae)}},[k,T,Q]);const re=o.useCallback(M=>{if(M.button!==0||M.target.closest('button, a, input, [role="button"]'))return;const ae=P.current;if(!ae)return;const j=ae.getBoundingClientRect();ue.current={pointerX:M.clientX,pointerY:M.clientY,left:j.left,top:j.top},M.currentTarget.setPointerCapture(M.pointerId),ge(!0),ee({left:j.left,top:j.top})},[]),ye=o.useCallback(M=>{const G=ue.current;if(!G)return;const ae=Q(G.left+(M.clientX-G.pointerX),G.top+(M.clientY-G.pointerY));ee(j=>j&&j.left===ae.left&&j.top===ae.top?j:ae)},[Q]),ke=o.useCallback(M=>{if(ue.current){ue.current=null;try{M.currentTarget.releasePointerCapture(M.pointerId)}catch{}ge(!1)}},[]),R=o.useMemo(()=>new Set(i),[i]),Z=o.useMemo(()=>new Set(r),[r]),[b,I]=o.useState(null),[z,W]=o.useState(null),[V,be]=o.useState(null),w=o.useRef(0),te=o.useRef(0),ie=o.useCallback(()=>{if(te.current)return;const M=()=>{const G=w.current,ae=q.current;if(!G||!ae){te.current=0;return}ae.scrollTop+=G*Mi,te.current=requestAnimationFrame(M)};te.current=requestAnimationFrame(M)},[]),he=o.useCallback(()=>{w.current=0,te.current&&(cancelAnimationFrame(te.current),te.current=0)},[]);o.useEffect(()=>()=>he(),[he]);const H=o.useCallback((M,G)=>R.has(M)===R.has(G),[R]),le=o.useCallback((M,G)=>{M.dataTransfer.effectAllowed="move";try{M.dataTransfer.setData("text/plain",G)}catch{}I(G)},[]),$e=o.useCallback((M,G,ae)=>{if(!b||b===G||ae.alwaysPinned)return;const j=q.current;if(j){const we=j.getBoundingClientRect();M.clientY<we.top+gs?(w.current=-1,ie()):M.clientY>we.bottom-gs?(w.current=1,ie()):w.current=0}if(!H(b,G)){M.preventDefault(),M.dataTransfer.dropEffect="none",W({key:G,position:"before"});return}M.preventDefault(),M.dataTransfer.dropEffect="move";const B=M.currentTarget.getBoundingClientRect(),U=B.top+B.height/2,J=M.clientY<U?"before":"after";W(we=>we&&we.key===G&&we.position===J?we:{key:G,position:J})},[b,H,ie]),Pe=o.useCallback(M=>{M.preventDefault(),b&&z&&H(b,z.key)&&b!==z.key&&g(b,z.key,z.position),I(null),W(null),he()},[b,z,H,g,he]),pe=o.useCallback(()=>{I(null),W(null),he()},[he]),Ce=o.useCallback((M,G)=>{if(M.key===" "||M.key==="Enter"){M.preventDefault(),be(B=>B===G?null:G);return}if(M.key==="Escape"){V===G&&(M.preventDefault(),be(null));return}if(V!==G||M.key!=="ArrowUp"&&M.key!=="ArrowDown")return;M.preventDefault();const ae=M.key==="ArrowUp"?-1:1,j=a.findIndex(B=>B.key===G);if(j!==-1)for(let B=j+ae;B>=0&&B<a.length;B+=ae){const U=a[B];if(!U.alwaysPinned&&H(G,U.key)){g(G,U.key,ae===-1?"before":"after");return}}},[a,V,H,g]);if(!$)return null;const _e=T?T.left:X.left,ze=T?T.top:X.top;return Mt.createPortal(e.jsxs("div",{ref:P,className:["ui-table__manage",O&&"ui-table__manage--dragging"].filter(Boolean).join(" "),role:"dialog","aria-label":N.manageTitle,style:{left:_e,top:ze,...X.maxHeight!==void 0&&!T?{maxHeight:X.maxHeight}:null},children:[e.jsxs("div",{className:"ui-table__manage-header",onPointerDown:re,onPointerMove:ye,onPointerUp:ke,onPointerCancel:ke,children:[e.jsx("span",{className:"ui-table__manage-title",children:N.manageTitle}),e.jsx(Ie,{sx:"ui-table__manage-close",icon:e.jsx(jt,{}),size:"small",variant:"ghost",color:"neutral",onClick:k,"aria-label":N.close,title:N.close})]}),e.jsx("div",{ref:q,className:"ui-table__manage-list",role:"group","aria-label":N.manageTitle,onDragLeave:M=>{M.currentTarget===M.target&&W(null)},children:a.map(M=>{const G=typeof M.label=="string"?M.label:M.key,ae=Z.has(M.key),j=!ae,B=R.has(M.key),U=B?Or:ai,J=u&&!M.alwaysPinned,we=b===M.key,C=V===M.key,de=z?.key===M.key,fe=de&&b!==null&&!H(b,M.key),Se=!c||!!M.alwaysPinned||ae,Ne=!d||!!M.alwaysVisible||j&&l<=1,F=M.alwaysPinned?N.lockedHint:ae?N.pin:B?N.unpin:N.pin,oe=["ui-table__manage-item",!J&&"ui-table__manage-item--locked",we&&"ui-table__manage-item--dragging",C&&"ui-table__manage-item--lifted",de&&!fe&&z?.position==="before"&&"ui-table__manage-item--drop-before",de&&!fe&&z?.position==="after"&&"ui-table__manage-item--drop-after",de&&fe&&"ui-table__manage-item--drop-forbidden"].filter(Boolean).join(" ");return e.jsxs("div",{className:oe,onDragOver:b?xe=>$e(xe,M.key,M):void 0,onDrop:b?Pe:void 0,children:[u&&e.jsx("button",{type:"button",className:"ui-table__manage-handle","aria-label":N.dragHandle,title:M.alwaysPinned?N.lockedHint:N.dragHandle,disabled:!J,"aria-pressed":C||void 0,draggable:J,onDragStart:J?xe=>le(xe,M.key):void 0,onDragEnd:pe,onKeyDown:J?xe=>Ce(xe,M.key):void 0,children:e.jsx(Lr,{"aria-hidden":"true"})}),e.jsx("div",{className:"ui-table__manage-item-main",children:e.jsx(da,{size:"small",checked:j,isDisabled:Ne,onChange:()=>f(M.key),label:G})}),c&&e.jsx(Ie,{sx:["ui-table__manage-pin",Se&&"ui-table__manage-pin--locked"].filter(Boolean).join(" "),icon:e.jsx(U,{}),size:"small",variant:"ghost",color:B?"primary":"neutral",onClick:()=>p(M.key),disabled:Se,"aria-pressed":B,"aria-label":F,title:F})]},M.key)})}),e.jsxs("div",{className:"ui-table__manage-footer",children:[(_||y)&&e.jsxs("div",{className:"ui-table__manage-footer-row",children:[_&&e.jsx(Ze,{variant:"outlined",size:"small",color:"neutral",onClick:h,children:N.unpinAll}),y&&e.jsx(Ze,{variant:"outlined",size:"small",color:"neutral",onClick:m,children:N.showAll})]}),e.jsx(Ze,{variant:"text",size:"small",color:"primary",onClick:v,sx:"ui-table__manage-reset",children:N.reset})]})]}),$)},Si=120;function xs(t,n=Si){let s=null,a=0;const i=l=>{s=l,a&&window.clearTimeout(a),l?a=window.setTimeout(()=>{s=null,a=0},n):a=0},r=[];for(const l of t){const c=()=>{if(s&&s!==l)return;i(l);const d=l.scrollLeft;for(const u of t)u!==l&&u.scrollLeft!==d&&(u.scrollLeft=d)};l.addEventListener("scroll",c,{passive:!0}),r.push({src:l,handler:c})}return{lockTo:l=>i(l),dispose:()=>{a&&window.clearTimeout(a);for(const{src:l,handler:c}of r)l.removeEventListener("scroll",c)}}}function Ei(t,n,s){const a=t.filter(r=>r!==n);let i=0;for(let r=0;r<a.length;r+=1)s.has(a[r])&&(i=r+1);return a.splice(i,0,n),a}function fa(t,n,s,a,i){const r=t.filter(d=>d!==n),l=s.indexOf(n);let c=r.length;for(let d=0;d<r.length;d+=1){const u=r[d];if(a.has(u)===i&&s.indexOf(u)>l){c=d;break}}return r.splice(c,0,n),r}function $i(t,n,s,a,i){if(n===s||i(n)!==i(s))return null;const r=t.indexOf(n);if(r===-1)return null;const l=t.slice();l.splice(r,1);let c=l.indexOf(s);return c===-1?null:(a==="after"&&(c+=1),l.splice(c,0,n),l)}function Li(t){if(!t)return window;let n=t.parentElement;for(;n&&n!==document.body&&n!==document.documentElement;){const a=getComputedStyle(n).overflowY;if((a==="auto"||a==="scroll"||a==="overlay")&&n.scrollHeight>n.clientHeight)return n;n=n.parentElement}return window}function Ti(t,n){const s=t!==void 0?t:n;return s===!1||s===void 0?{enabled:!1,pin:!1,hide:!1,reorder:!1,manage:!1}:s===!0?{enabled:!0,pin:!0,hide:!0,reorder:!0,manage:!0}:{enabled:!0,pin:s.pin!==!1,hide:s.hide!==!1,reorder:s.reorder!==!1,manage:s.manage!==!1}}function vs({columns:t,data:n,isLoading:s=!1,hasBorder:a=!0,hasRowDividers:i=!0,hasColumnDividers:r=!1,isStriped:l=!1,size:c="medium",variant:d="filled",color:u="default",radius:p="md",visibleColumns:f,stickyColumns:h,columnMenu:m,enableColumnMenu:v,defaultStickyColumns:g,defaultHiddenColumns:_,columnOrder:y,defaultColumnOrder:N,onStickyColumnsChange:k,onHiddenColumnsChange:$,onColumnOrderChange:S,columnMenuLabels:P,columnMenuDefaults:q,sorting:X,onSort:D,footer:T,onRowClick:ee,rowKey:O=yi,minWidth:ge,height:ue,maxHeight:Q,stickyHeaderOffset:re,stickyFooterOffset:ye,emptyState:ke="No data to display",loadingState:R="Loading…",sx:Z,style:b}){const I=re!==void 0,z=ye!==void 0&&T!==void 0&&T!==null,W=I||z,V=o.useMemo(()=>Ti(m,v),[m,v]),be=h!==void 0,w=f!==void 0,te=y!==void 0,[ie,he]=o.useState(()=>g??[]),[H,le]=o.useState(()=>new Set(_??[])),[$e,Pe]=o.useState(()=>N??[]),pe=o.useMemo(()=>{if(w){const x=new Set;for(const[L,K]of Object.entries(f))K===!1&&x.add(L);return x}return H},[w,f,H]),Ce=o.useMemo(()=>{const x=new Set,L=[];for(const K of t)K.alwaysPinned&&!x.has(K.key)&&(x.add(K.key),L.push(K.key));if(be)for(const K of h){const se=t[K];se&&!x.has(se.key)&&(x.add(se.key),L.push(se.key))}else for(const K of ie)x.has(K)||(x.add(K),L.push(K));return L},[be,h,t,ie]),_e=o.useMemo(()=>new Set(Ce),[Ce]),ze=o.useMemo(()=>{const x=new Set;for(const L of t)L.alwaysVisible&&x.add(L.key);return x},[t]),M=o.useMemo(()=>{const x=new Set;for(const L of t)L.alwaysPinned&&x.add(L.key);return x},[t]),G=o.useMemo(()=>t.map(x=>x.key),[t]),ae=o.useCallback(x=>ze.has(x)?!1:pe.has(x),[ze,pe]),j=o.useMemo(()=>{const x=te?y:$e,L=[],K=new Set;for(const se of x)M.has(se)||G.includes(se)&&(K.has(se)||(K.add(se),L.push(se)));for(const se of t)se.alwaysPinned||K.has(se.key)||(K.add(se.key),L.push(se.key));return L},[te,y,$e,t,M,G]),B=o.useMemo(()=>{const x=new Map;for(const K of t)x.set(K.key,K);const L=[];for(const K of t)K.alwaysPinned&&L.push(K);for(const K of j){const se=x.get(K);se&&!se.alwaysPinned&&L.push(se)}return L},[t,j]),U=o.useMemo(()=>{const x=B.filter(se=>!ae(se.key));if(Ce.length===0)return x;const L=[],K=[];for(const se of x)_e.has(se.key)?L.push(se):K.push(se);return[...L,...K]},[B,ae,Ce,_e]),J=o.useMemo(()=>{const x=[];return U.forEach((L,K)=>{_e.has(L.key)&&x.push(K)}),x},[U,_e]),we=o.useMemo(()=>new Set(J),[J]),C=J.length>0?J[J.length-1]:-1,de=o.useRef(null),fe=o.useRef(null),Se=o.useRef(null),Ne=o.useRef(null),F=o.useRef(null),oe=o.useRef(null),xe=o.useRef(null),je=o.useRef([]),Ae=o.useRef(null),[We,ht]=o.useState(new Map),[Ke,ct]=o.useState(!1),[Qe,gt]=o.useState(0),xt=En(),[Re,tt]=o.useState(null),at=o.useCallback(()=>tt(null),[]),[Fe,et]=o.useState(null),Xt=o.useCallback(()=>et(null),[]),nt=o.useCallback(x=>{be||he(x),k?.(x)},[be,k]),st=o.useCallback(x=>{w||le(x),$?.(Array.from(x))},[w,$]),Be=o.useCallback(x=>{te||Pe(x),S?.(x)},[te,S]),Ye=o.useCallback(x=>{if(_e.has(x))return;const L=[...Ce,x],K=new Set(L);nt(L),Be(Ei(j,x,K))},[Ce,_e,j,nt,Be]),kt=o.useCallback(x=>{if(!_e.has(x)||M.has(x))return;const L=Ce.filter(se=>se!==x),K=new Set(L);nt(L),Be(fa(j,x,G,K,!1))},[Ce,_e,M,j,G,nt,Be]),xn=o.useCallback(()=>{if(Ce.length===0)return;const x=Ce.filter(L=>M.has(L));x.length!==Ce.length&&nt(x)},[Ce,M,nt]),Ht=o.useCallback(x=>{if(ze.has(x)||pe.has(x))return;let L=0;for(const se of t)if(se.key!==x&&!pe.has(se.key)&&(L+=1,L>0))break;if(L===0)return;const K=new Set(pe);if(K.add(x),_e.has(x)&&!M.has(x)){const se=Ce.filter(Ft=>Ft!==x),Te=new Set(se);nt(se),Be(fa(j,x,G,Te,!1))}st(K)},[t,ze,M,pe,_e,Ce,j,G,nt,st,Be]),Zt=o.useCallback(x=>{if(!pe.has(x))return;const L=new Set(pe);L.delete(x);const K=_e.has(x);Be(fa(j,x,G,_e,K)),st(L)},[pe,_e,j,G,st,Be]),vn=o.useCallback(()=>{st(new Set)},[st]),Jt=o.useMemo(()=>{const x=[];for(const L of t)ae(L.key)&&x.push(L.key);return x},[t,ae]),bn=Jt.length,pt=o.useCallback((x,L)=>{if(!V.enabled)return;x.preventDefault(),x.stopPropagation();const K=x.currentTarget.getBoundingClientRect(),se=de.current?.getBoundingClientRect()??null;et(null),tt(Te=>Te?.colKey===L.key?null:{colKey:L.key,x:K.right,anchorTop:K.top,anchorBottom:K.bottom,boundsRect:se})},[V.enabled]),Qt=o.useCallback(x=>{_e.has(x)?kt(x):Ye(x)},[_e,kt,Ye]),jn=o.useCallback(x=>{ae(x)?Zt(x):Ht(x)},[ae,Zt,Ht]),yn=o.useCallback(()=>{const x=q?.pinned??g??[],L=q?.hidden??_??[],K=q?.order??N??[];nt(x),st(new Set(L)),Be(K)},[q,g,_,N,nt,st,Be]),kn=o.useCallback((x,L,K)=>{if(M.has(x)||M.has(L))return;const se=$i(j,x,L,K,Te=>_e.has(Te)&&!M.has(Te));se&&Be(se)},[j,_e,M,Be]),Ge=o.useMemo(()=>({pin:"Pin column",unpin:"Unpin column",hide:"Hide column",manage:"Manage columns",manageTitle:"Manage columns",unpinAll:"Unpin all",showAll:"Show all columns",reset:"Reset",lockedHint:"Locked",dragHandle:"Reorder",close:"Close",...P}),[P]),wn=o.useMemo(()=>({manageTitle:Ge.manageTitle,unpinAll:Ge.unpinAll,showAll:Ge.showAll,reset:Ge.reset,lockedHint:Ge.lockedHint,pin:Ge.pin,unpin:Ge.unpin,dragHandle:Ge.dragHandle,close:Ge.close}),[Ge]),Nn=o.useMemo(()=>Ce.some(x=>!M.has(x)),[Ce,M]),Cn=o.useCallback((x,L)=>{if(!V.enabled||!(x.key==="F10"&&x.shiftKey||x.key==="ContextMenu"))return;x.preventDefault();const se=x.currentTarget.getBoundingClientRect(),Te=de.current?.getBoundingClientRect()??null;et(null),tt({colKey:L.key,x:se.right,anchorTop:se.top,anchorBottom:se.bottom,boundsRect:Te})},[V.enabled]);je.current.length>U.length&&(je.current.length=U.length);const Bt=o.useRef(null);o.useLayoutEffect(()=>{const x=fe.current,L=Se.current,K=F.current;if(!x||!L||!K)return;const se=()=>{const Ft=L.scrollWidth,vt=x.clientWidth;gt(Ft),ct(Ft-vt>1);const Nt=Ae.current;if(Nt){const Ve=Nt.firstElementChild;Ve&&(Ve.style.width=`${vt}px`)}const an=K.querySelectorAll("th"),Ct=[];for(let Ve=0;Ve<an.length;Ve+=1)Ct.push(an[Ve].getBoundingClientRect().width);const Tt=je.current;for(let Ve=0;Ve<Ct.length;Ve+=1){const rt=Tt[Ve];rt&&(rt.style.width=`${Ct[Ve]}px`)}if(J.length===0)ht(Ve=>Ve.size===0?Ve:new Map);else{const Ve=new Map;let rt=0;for(const lt of J)Ve.set(lt,rt),rt+=Ct[lt]??0;ht(lt=>{if(lt.size!==Ve.size)return Ve;for(const[Sa,Ea]of Ve)if(lt.get(Sa)!==Ea)return Ve;return lt})}};Bt.current=se,se();const Te=new ResizeObserver(se);return Te.observe(L),Te.observe(x),Te.observe(K),()=>{Te.disconnect(),Bt.current=null}},[U,J,I]),o.useLayoutEffect(()=>{Bt.current?.()},[s,n.length]);const Rt=o.useRef({prevDisplay:"",prevTop:NaN,prevLeft:NaN,prevWidth:NaN,wasVisible:!1}),wt=o.useRef(null);o.useEffect(()=>{if(!I&&!z)return;const x=oe.current,L=fe.current;if(!L||I&&!x)return;const K=I&&x?xs([L,x]):null,se=Rt.current;let Te=0;const Ft=()=>{Te=0;const Tt=de.current,Ve=F.current;if(!Tt)return;const rt=Tt.getBoundingClientRect(),lt=wt.current,Sa=lt&<!==window?lt.getBoundingClientRect().top:0,Ea=lt&<!==window?lt.getBoundingClientRect().bottom:window.innerHeight;if(I&&x&&Ve){const $a=L.getBoundingClientRect(),dr=Ve.offsetHeight,Dn=Sa+re,Kn=$a.top<=Dn&&rt.bottom>Dn+dr,Ta=Kn?"block":"none";if(Ta!==se.prevDisplay&&(x.style.display=Ta,se.prevDisplay=Ta),Dn!==se.prevTop&&(x.style.top=`${Dn}px`,se.prevTop=Dn),rt.left!==se.prevLeft&&(x.style.left=`${rt.left}px`,se.prevLeft=rt.left),rt.width!==se.prevWidth&&(x.style.width=`${rt.width}px`,se.prevWidth=rt.width),Kn&&!se.wasVisible){const hr=L.scrollLeft;x.scrollLeft!==hr&&(K?.lockTo(L),x.scrollLeft=hr)}se.wasVisible=Kn;const ur=Kn?"true":"false";Tt.dataset.headerStuck!==ur&&(Tt.dataset.headerStuck=ur)}if(z){const $a=ye??0,La=rt.bottom>Ea-$a?"true":"false";Tt.dataset.footerStuck!==La&&(Tt.dataset.footerStuck=La)}},vt=()=>{Te||(Te=requestAnimationFrame(Ft))};wt.current=Li(de.current);const Nt=wt.current;Ft(),window.addEventListener("scroll",vt,{passive:!0}),window.addEventListener("resize",vt),Nt&&Nt!==window&&Nt.addEventListener("scroll",vt,{passive:!0});const an=de.current,Ct=an?new ResizeObserver(vt):null;return Ct&&an&&Ct.observe(an),()=>{Te&&cancelAnimationFrame(Te),window.removeEventListener("scroll",vt),window.removeEventListener("resize",vt),Nt&&Nt!==window&&Nt.removeEventListener("scroll",vt),K?.dispose(),Ct&&Ct.disconnect()}},[I,re,z,ye]),o.useEffect(()=>{const x=fe.current,L=Ne.current;if(!x||!L||!Ke)return;const K=xs([x,L]);return()=>K.dispose()},[Ke]);const en=fn(ge),tn=fn(ue),Y=fn(Q),ve=["ui-table",`ui-table--${c}`,d!=="filled"&&`ui-table--variant-${d}`,u!=="default"&&`ui-table--color-${u}`,p!=="md"&&`ui-table--radius-${p}`,a&&"ui-table--bordered",!i&&"ui-table--no-row-dividers",r&&"ui-table--col-dividers",l&&"ui-table--striped",ee&&"ui-table--clickable-rows",Z].filter(Boolean).join(" "),Me=o.useMemo(()=>U.map((x,L)=>{const K=we.has(L);return["ui-table__th",x.align&&`ui-table__th--align-${x.align}`,K&&"ui-table__th--sticky",K&&L===C&&"ui-table__th--sticky-last"].filter(Boolean).join(" ")}),[U,we,C]),De=o.useMemo(()=>U.map((x,L)=>{const K=we.has(L);return["ui-table__td",x.align&&`ui-table__td--align-${x.align}`,x.wrap&&"ui-table__td--wrap",K&&"ui-table__td--sticky",K&&L===C&&"ui-table__td--sticky-last"].filter(Boolean).join(" ")}),[U,we,C]),Le=o.useMemo(()=>U.map((x,L)=>{if(we.has(L))return{left:`${We.get(L)??0}px`}}),[U,we,We]),nn=x=>{if(!x.sortable||!D)return null;const L=X?.sort_by===x.key,K=L?X?.sort_order==="ASC"?Xr:qr:ti;return e.jsx("span",{className:["ui-table__sort-icon",L&&"ui-table__sort-icon--active"].filter(Boolean).join(" "),"aria-hidden":"true",children:e.jsx(K,{})})},E=x=>{!x.sortable||!D||D(x.key)},A=(x,L)=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),E(L))},me=o.useCallback((x,L,K)=>{ee&&(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),ee(L,K))},[ee]),ce=U.length||1,Oe=()=>e.jsx("colgroup",{children:U.map(x=>e.jsx("col",{style:x.width!==void 0?{width:fn(x.width)}:void 0},x.key))}),dt=W?{overflowX:"auto",overflowY:"visible",maxHeight:"none",height:"auto"}:{height:tn,maxHeight:tn?void 0:Y},qe={...b};W&&(qe.overflow="visible");const Ot=z?{position:"sticky",bottom:ye,zIndex:5}:void 0,Mn=(x,L,K)=>!L&&!K?x:[x,L&&"ui-table__th--sortable",K&&"ui-table__th--sorted"].filter(Boolean).join(" ");return e.jsxs("div",{ref:de,className:[ve,W&&"ui-table--page-sticky"].filter(Boolean).join(" "),style:qe,children:[Ke&&e.jsx("div",{ref:Ne,className:"ui-table__top-scroll","aria-hidden":"true",children:e.jsx("div",{className:"ui-table__top-scroll-inner",style:{width:`${Qe}px`}})}),e.jsx("div",{ref:fe,className:"ui-table__viewport",style:dt,children:e.jsxs("table",{ref:Se,className:"ui-table__table",style:{minWidth:en},role:"table",children:[Oe(),e.jsx("thead",{className:"ui-table__thead",children:e.jsx("tr",{ref:F,className:"ui-table__tr",children:U.map((x,L)=>{const K=!!x.sortable&&!!D,se=X?.sort_by===x.key;return e.jsx("th",{scope:"col","aria-label":x.ariaLabel,"aria-sort":se?X?.sort_order==="ASC"?"ascending":"descending":K?"none":void 0,className:Mn(Me[L],K,se),style:Le[L],tabIndex:K?0:void 0,"aria-haspopup":V.enabled?"menu":void 0,onClick:K?()=>E(x):void 0,onKeyDown:Te=>{K&&A(Te,x),V.enabled&&Cn(Te,x)},children:e.jsxs("span",{className:"ui-table__th-inner",children:[V.enabled&&x.align==="center"&&e.jsx("span",{className:"ui-table__th-menu-spacer","aria-hidden":"true"}),e.jsxs("span",{className:"ui-table__th-content",children:[e.jsx("span",{className:"ui-table__th-label",children:x.label}),nn(x)]}),V.enabled&&e.jsx(Ie,{sx:"ui-table__th-menu-btn",icon:e.jsx(Ja,{}),size:"small",variant:"ghost",color:"neutral","aria-label":"Column options","aria-haspopup":"menu","aria-expanded":Re?.colKey===x.key,onClick:Te=>pt(Te,x)})]})},x.key)})})}),e.jsx("tbody",{className:"ui-table__tbody",children:s?e.jsx("tr",{className:"ui-table__tr ui-table__tr--state",children:e.jsx("td",{ref:Ae,className:"ui-table__td ui-table__td--state",colSpan:ce,children:e.jsx("div",{className:"ui-table__state-content",children:R})})}):n.length===0?e.jsx("tr",{className:"ui-table__tr ui-table__tr--state",children:e.jsx("td",{ref:Ae,className:"ui-table__td ui-table__td--state",colSpan:ce,children:e.jsx("div",{className:"ui-table__state-content",children:ke})})}):n.map((x,L)=>e.jsx(Ni,{row:x,rowIndex:L,visibleCols:U,tdClasses:De,stickyStyles:Le,onRowClick:ee,onKeyDown:ee?me:void 0},O(x,L)))})]})}),T&&!s&&e.jsx("div",{className:"ui-table__footer",style:Ot,children:T}),I&&e.jsx("div",{ref:oe,className:"ui-table__overlay-header","aria-hidden":"true",style:{display:"none",position:"fixed",top:re,left:0,width:0,overflowX:Ke?"auto":"hidden",overflowY:"hidden",zIndex:40},children:e.jsxs("table",{ref:xe,className:"ui-table__table",style:{minWidth:en,width:Qe||void 0,tableLayout:"fixed"},role:"presentation",children:[e.jsx("colgroup",{children:U.map((x,L)=>e.jsx("col",{ref:K=>{je.current[L]=K},style:x.width!==void 0?{width:fn(x.width)}:void 0},x.key))}),e.jsx("thead",{className:"ui-table__thead",children:e.jsx("tr",{className:"ui-table__tr",children:U.map((x,L)=>{const K=!!x.sortable&&!!D,se=X?.sort_by===x.key;return e.jsx("th",{scope:"col",className:Mn(Me[L],K,se),style:Le[L],onClick:K?()=>E(x):void 0,children:e.jsxs("span",{className:"ui-table__th-inner",children:[V.enabled&&x.align==="center"&&e.jsx("span",{className:"ui-table__th-menu-spacer","aria-hidden":"true"}),e.jsxs("span",{className:"ui-table__th-content",children:[e.jsx("span",{className:"ui-table__th-label",children:x.label}),nn(x)]}),V.enabled&&e.jsx(Ie,{sx:"ui-table__th-menu-btn",icon:e.jsx(Ja,{}),size:"small",variant:"ghost",color:"neutral","aria-label":"Column options","aria-haspopup":"menu",onClick:Te=>pt(Te,x)})]})},x.key)})})})]})}),V.enabled&&Re&&(()=>{const x=Re.colKey,L=_e.has(x),K=M.has(x),se=ze.has(x),Te=[];return V.pin&&(L?Te.push({key:"unpin",label:Ge.unpin,onSelect:()=>kt(x),disabled:K}):Te.push({key:"pin",label:Ge.pin,onSelect:()=>Ye(x)})),V.hide&&Te.push({key:"hide",label:Ge.hide,onSelect:()=>Ht(x),disabled:se||U.length<=1}),V.manage&&Te.push({key:"manage",label:Ge.manage,onSelect:()=>{tt(null),et({x:Re.x,anchorTop:Re.anchorTop,anchorBottom:Re.anchorBottom,boundsRect:Re.boundsRect})}}),Te.length===0?null:e.jsx(Ci,{x:Re.x,anchorTop:Re.anchorTop,anchorBottom:Re.anchorBottom,items:Te,onClose:at,portalNode:xt,boundsRect:Re.boundsRect})})(),V.enabled&&V.manage&&Fe&&e.jsx(Di,{x:Fe.x,anchorTop:Fe.anchorTop,anchorBottom:Fe.anchorBottom,columns:B,pinnedKeys:Ce,hiddenKeys:Jt,visibleCount:U.length,canPin:V.pin,canHide:V.hide,canReorder:V.reorder,onTogglePin:Qt,onToggleHide:jn,onUnpinAll:xn,onShowAll:vn,onReset:yn,onReorder:kn,hasUnpinnablePinned:Nn,hasHiddenColumns:bn>0,labels:wn,onClose:Xt,portalNode:xt,boundsRect:Fe.boundsRect})]})}vs.displayName="Table";const _a=({open:t,title:n,message:s,confirmLabel:a="Confirm",cancelLabel:i="Cancel",confirmColor:r="primary",onConfirm:l,onCancel:c,hideCancel:d=!1,closeOnBackdropClick:u=!0,closeOnEscape:p=!0,returnFocusOnClose:f=!1})=>e.jsx(ta,{open:t,onClose:c,size:"small",closeOnBackdropClick:u,closeOnEscape:p,returnFocusOnClose:f,children:e.jsxs("div",{className:"ui-confirm",children:[n&&e.jsx("h2",{className:"ui-confirm__title",children:n}),s&&e.jsx("div",{className:"ui-confirm__message",children:s}),e.jsxs("div",{className:"ui-confirm__actions",children:[!d&&e.jsx(Ze,{variant:"outlined",color:"neutral",onClick:c,children:i}),e.jsx(Ze,{variant:"filled",color:r,onClick:l,autoFocus:!0,children:a})]})]})});_a.displayName="ConfirmDialog";const bs=o.createContext(null),js=({children:t})=>{const[n,s]=o.useState(null),a=o.useRef(null);a.current=n;const i=o.useCallback(c=>new Promise(d=>{const u=a.current;u&&u.resolve(!1),s({...c,resolve:d})}),[]),r=o.useCallback(c=>{const d=a.current;d&&(d.resolve(c),s(null))},[]),l=o.useMemo(()=>({confirm:i}),[i]);return e.jsxs(bs.Provider,{value:l,children:[t,e.jsx(_a,{open:n!==null,title:n?.title,message:n?.message,confirmLabel:n?.confirmLabel,cancelLabel:n?.cancelLabel,confirmColor:n?.confirmColor,hideCancel:n?.hideCancel,closeOnBackdropClick:n?.closeOnBackdropClick,closeOnEscape:n?.closeOnEscape,onConfirm:()=>r(!0),onCancel:()=>r(!1)})]})};js.displayName="ConfirmProvider";const Ai=()=>{const t=o.useContext(bs);if(!t)throw new Error("useConfirm must be used within a <ConfirmProvider>");return t},ys=({checked:t,defaultChecked:n,onChange:s,label:a,labelPosition:i="end",color:r="primary",size:l="medium",isDisabled:c=!1,name:d,value:u,id:p,sx:f,style:h})=>{const m=o.useId(),v=p??m,g=["ui-toggle",`ui-toggle--${r}`,`ui-toggle--${l}`,`ui-toggle--label-${i}`,c&&"ui-toggle--disabled",f].filter(Boolean).join(" "),_=y=>{c||s?.(y.target.checked,y)};return e.jsxs("label",{className:g,style:h,htmlFor:v,children:[a!=null&&i==="start"&&e.jsx("span",{className:"ui-toggle__label",children:a}),e.jsxs("span",{className:"ui-toggle__switch",children:[e.jsx("input",{id:v,type:"checkbox",className:"ui-toggle__input",role:"switch",checked:t,defaultChecked:n,disabled:c,name:d,value:u,onChange:_}),e.jsx("span",{className:"ui-toggle__track","aria-hidden":"true",children:e.jsx("span",{className:"ui-toggle__thumb"})})]}),a!=null&&i==="end"&&e.jsx("span",{className:"ui-toggle__label",children:a})]})};ys.displayName="Toggle";const ks=o.createContext(null),ga=t=>{const n=o.useContext(ks);if(!n)throw new Error(`<${t}> must be rendered inside <Tabs>`);return n},ws=({value:t,defaultValue:n,onChange:s,variant:a="underline",size:i="medium",color:r="primary",isDisabled:l=!1,children:c,sx:d,style:u})=>{const f=`ui-tabs-${o.useId().replace(/:/g,"")}`,[h,m]=o.useState(n??""),v=t!==void 0,g=v?t:h,_=o.useRef(new Map),y=o.useCallback(P=>{v||m(P),s?.(P)},[v,s]),N=o.useCallback((P,q)=>{q&&_.current.set(P,q)},[]),k=o.useCallback(P=>{_.current.delete(P)},[]),$=o.useMemo(()=>({value:g,setValue:y,baseId:f,registerTab:N,unregisterTab:k,variant:a,size:i,color:r,isDisabled:l}),[g,y,f,N,k,a,i,r,l]),S=["ui-tabs",`ui-tabs--${a}`,`ui-tabs--${i}`,d].filter(Boolean).join(" ");return e.jsx(ks.Provider,{value:$,children:e.jsx("div",{className:S,style:u,children:c})})};ws.displayName="Tabs";const Ns=({"aria-label":t,"aria-labelledby":n,children:s,sx:a,style:i})=>{const{variant:r,size:l,color:c}=ga("TabList"),d=o.useMemo(()=>{const p=[];return o.Children.forEach(s,f=>{o.isValidElement(f)&&f.type===xa&&p.push(f.props.value)}),p},[s]),u=["ui-tabs__list",`ui-tabs__list--${r}`,`ui-tabs__list--${l}`,`ui-tabs__list--${c}`,a].filter(Boolean).join(" ");return e.jsx("div",{role:"tablist","aria-label":t,"aria-labelledby":n,className:u,style:i,"data-tab-order":d.join(","),children:s})};Ns.displayName="TabList";const xa=({value:t,isDisabled:n=!1,icon:s,badge:a,children:i,sx:r,style:l})=>{const c=ga("Tab"),d=o.useRef(null),u=o.useCallback(_=>{d.current=_,c.registerTab(t,_)},[c,t]);o.useEffect(()=>()=>c.unregisterTab(t),[c,t]);const p=c.value===t,f=c.isDisabled||n,h=()=>{f||c.setValue(t)},m=_=>{const y=d.current?.parentElement;if(!y)return;const N=(y.dataset.tabOrder??"").split(",").filter(Boolean);if(N.length===0)return;const k=N.filter(q=>{const X=y.querySelector(`[data-tab-value="${q}"]`);return X&&!X.disabled});if(k.length===0)return;let $;const S=k.indexOf(t);switch(_){case"first":$=k[0];break;case"last":$=k[k.length-1];break;case"next":$=k[(S+1)%k.length];break;case"prev":$=k[(S-1+k.length)%k.length];break}y.querySelector(`[data-tab-value="${$}"]`)?.focus(),c.setValue($)},v=_=>{if(!f)switch(_.key){case"ArrowRight":case"ArrowDown":_.preventDefault(),m("next");break;case"ArrowLeft":case"ArrowUp":_.preventDefault(),m("prev");break;case"Home":_.preventDefault(),m("first");break;case"End":_.preventDefault(),m("last");break}},g=["ui-tabs__tab",`ui-tabs__tab--${c.variant}`,`ui-tabs__tab--${c.size}`,`ui-tabs__tab--${c.color}`,p&&"ui-tabs__tab--active",f&&"ui-tabs__tab--disabled",r].filter(Boolean).join(" ");return e.jsxs("button",{ref:u,type:"button",role:"tab",id:`${c.baseId}-tab-${t}`,"aria-selected":p,"aria-controls":`${c.baseId}-panel-${t}`,"aria-disabled":f||void 0,tabIndex:p?0:-1,disabled:f,"data-tab-value":t,className:g,style:l,onClick:h,onKeyDown:v,children:[s&&e.jsx("span",{className:"ui-tabs__tab-icon","aria-hidden":"true",children:s}),e.jsx("span",{className:"ui-tabs__tab-label",children:i}),a!=null&&e.jsx("span",{className:"ui-tabs__tab-badge",children:a})]})};xa.displayName="Tab";const Cs=({value:t,keepMounted:n=!1,children:s,sx:a,style:i})=>{const r=ga("TabPanel"),l=r.value===t;if(!l&&!n)return null;const c=["ui-tabs__panel",a].filter(Boolean).join(" ");return e.jsx("div",{role:"tabpanel",id:`${r.baseId}-panel-${t}`,"aria-labelledby":`${r.baseId}-tab-${t}`,tabIndex:0,hidden:!l,className:c,style:i,children:s})};Cs.displayName="TabPanel";const Ii=t=>{const n=t.trim().split(/\s+/).filter(Boolean);return n.length===0?"":n.length===1?n[0].slice(0,2).toUpperCase():(n[0][0]+n[n.length-1][0]).toUpperCase()},Pt=({name:t="",src:n,alt:s,size:a="medium",shape:i="circle",color:r="neutral",fallback:l,crossOrigin:c,referrerPolicy:d,loading:u,sx:p,style:f})=>{const[h,m]=o.useState(!1);o.useEffect(()=>{m(!1)},[n]);const v=!!n&&!h,g=Ii(t),_=!!(f?.background||f?.backgroundColor),y=["ui-avatar",`ui-avatar--${a}`,`ui-avatar--${i}`,!v&&!_&&`ui-avatar--${r}`,p].filter(Boolean).join(" "),N=()=>g?e.jsx("span",{className:"ui-avatar__initials","aria-hidden":"true",children:g}):l!=null?e.jsx("span",{className:"ui-avatar__fallback","aria-hidden":"true",children:l}):e.jsx("span",{className:"ui-avatar__initials","aria-hidden":"true",children:"?"});return e.jsx("span",{className:y,style:f,role:"img","aria-label":s??t??"avatar",children:v?e.jsx("img",{className:"ui-avatar__image",src:n,alt:s??t,crossOrigin:c,referrerPolicy:d,loading:u,onError:()=>m(!0)}):N()})};Pt.displayName="Avatar";const Pi={small:-4,medium:-8},va=({children:t,max:n=5,total:s,spacing:a="medium",size:i,shape:r,surplusColor:l="neutral",renderSurplus:c,sx:d,style:u})=>{const p=o.Children.toArray(t),f=s??p.length,h=f>n,m=h?Math.max(0,n-1):Math.min(p.length,n),v=p.slice(0,m),g=h?f-m:0,_=typeof a=="number"?a:Pi[a],y=["ui-avatar-group",d].filter(Boolean).join(" "),N=(k,$,S)=>{const P={marginLeft:S};if(o.isValidElement(k)&&k.type===Pt){const q={};return i&&!k.props.size&&(q.size=i),r&&!k.props.shape&&(q.shape=r),e.jsx("span",{className:"ui-avatar-group__item",style:P,children:o.cloneElement(k,q)},$)}return e.jsx("span",{className:"ui-avatar-group__item",style:P,children:k},$)};return e.jsxs("div",{className:y,style:u,children:[v.map((k,$)=>N(k,$,$===0?0:_)),g>0&&e.jsx("span",{className:"ui-avatar-group__item ui-avatar-group__item--surplus",style:{marginLeft:_},children:c?c(g):e.jsx(Pt,{size:i,shape:r,color:l,fallback:e.jsxs("span",{className:"ui-avatar-group__surplus-text",children:["+",g]})})},"surplus")]})};va.displayName="AvatarGroup";const zi={success:e.jsx($r,{}),error:e.jsx(Hr,{}),warning:e.jsx(Br,{}),info:e.jsx(Tr,{})},ba=({type:t="info",message:n,title:s,icon:a,onClose:i,duration:r,sx:l,style:c})=>{const d=typeof r=="number"&&r>0,u=["ui-toast",`ui-toast--${t}`,l].filter(Boolean).join(" ");return e.jsxs("div",{className:u,style:c,role:t==="error"||t==="warning"?"alert":"status","aria-live":t==="error"||t==="warning"?"assertive":"polite",children:[e.jsx("span",{className:"ui-toast__icon","aria-hidden":"true",children:a??zi[t]}),e.jsxs("div",{className:"ui-toast__body",children:[s&&e.jsx("div",{className:"ui-toast__title",children:s}),e.jsx("div",{className:"ui-toast__message",children:n})]}),i&&e.jsx(Ie,{icon:e.jsx(jt,{}),onClick:i,"aria-label":"Dismiss notification",variant:"ghost",color:"neutral",size:"small",sx:"ui-toast__close"}),d&&e.jsx("span",{className:"ui-toast__progress","aria-hidden":"true",style:{animationDuration:`${r}ms`}})]})};ba.displayName="Toast";const Ms=o.createContext(null),Ds=({children:t,position:n="top-right",defaultDuration:s=5e3,portalContainerId:a})=>{const[i,r]=o.useState([]),l=o.useRef(new Map),c=o.useCallback(h=>{const m=l.current.get(h);m&&(clearTimeout(m),l.current.delete(h))},[]),d=o.useCallback(h=>{c(h),r(m=>m.filter(v=>v.id!==h))},[c]),u=o.useCallback(()=>{l.current.forEach(h=>clearTimeout(h)),l.current.clear(),r([])},[]),p=o.useCallback(h=>{const m=`toast-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,v=h.duration??s;if(r(g=>[...g,{...h,id:m,duration:v}]),v>0){const g=setTimeout(()=>d(m),v);l.current.set(m,g)}return m},[s,d]);o.useEffect(()=>{const h=l.current;return()=>{h.forEach(m=>clearTimeout(m)),h.clear()}},[]);const f=o.useMemo(()=>({showToast:p,dismissToast:d,dismissAll:u}),[p,d,u]);return e.jsxs(Ms.Provider,{value:f,children:[t,e.jsx(dn,{containerId:a,children:e.jsx("div",{className:`ui-toast-container ui-toast-container--${n}`,children:i.map(h=>e.jsx(ba,{type:h.type,title:h.title,message:h.message,icon:h.icon,duration:h.duration,onClose:()=>d(h.id)},h.id))})})]})};Ds.displayName="ToastProvider";const Hi=()=>{const t=o.useContext(Ms);if(!t)throw new Error("useToast must be used within a <ToastProvider>");return t},Ss=({size:t="medium",color:n="primary",variant:s="inline",label:a="Loading",sx:i,style:r})=>{const l=["ui-spinner",`ui-spinner--${t}`,n!=="inherit"&&`ui-spinner--${n}`,i].filter(Boolean).join(" "),c=e.jsx("span",{className:l,style:r,role:"status","aria-label":a,children:e.jsx("span",{className:"ui-spinner__visually-hidden",children:a})});return s==="page"?e.jsx(dn,{children:e.jsx("div",{className:"ui-spinner-overlay",children:e.jsx("span",{className:["ui-spinner","ui-spinner--large",n!=="inherit"&&`ui-spinner--${n}`].filter(Boolean).join(" "),role:"status","aria-label":a,children:e.jsx("span",{className:"ui-spinner__visually-hidden",children:a})})})}):c};Ss.displayName="Spinner";function Bi(t,n,s){if(n<=1)return n===1?[1]:[];const a=Math.max(2,t-s),i=Math.min(n-1,t+s),r=t-s>3,l=t+s<n-2,c=[1];if(r)c.push("ellipsis-left");else for(let d=2;d<a;d++)c.push(d);for(let d=a;d<=i;d++)c.push(d);if(l)c.push("ellipsis-right");else for(let d=i+1;d<n;d++)c.push(d);return c.push(n),c}const Es=({currentPage:t,totalPages:n,totalItems:s,itemsPerPage:a,onPageChange:i,hasFirstLast:r=!0,hasGoToPage:l=!1,showResults:c="none",showOnSinglePage:d=!1,perPageOptions:u,perPage:p,onPerPageChange:f,siblingCount:h=1,size:m="medium",sx:v,style:g})=>{const _=!!u&&!!f&&p!==void 0,y=o.useMemo(()=>u?.map(T=>({value:String(T.value),label:T.label}))??[],[u]),N=c!=="none"&&s!==void 0,k=n>1;if(!k&&(!d||s===0))return null;const S=k?Bi(t,n,h):[],P=t<=1,q=t>=n,X=T=>{T<1||T>n||T===t||i(T)},D=["ui-pagination",`ui-pagination--${m}`,v].filter(Boolean).join(" ");return e.jsxs("div",{className:D,style:g,role:"navigation","aria-label":"Pagination",children:[e.jsx("div",{className:"ui-pagination__group ui-pagination__group--start",children:N&&e.jsx(Oi,{mode:c,currentPage:t,totalItems:s,itemsPerPage:a})}),e.jsxs("div",{className:"ui-pagination__group ui-pagination__group--end",children:[_&&e.jsxs("label",{className:"ui-pagination__per-page",children:[e.jsx("span",{className:"ui-pagination__per-page-label",children:"Per page"}),e.jsx(Ln,{size:"small",value:String(p),options:y,onChange:T=>{typeof T=="string"&&f(Number(T))},"aria-label":`Items per page: ${p}`})]}),k&&l&&e.jsx(Fi,{totalPages:n,onGo:X}),k&&e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"ui-pagination__compact-status","aria-hidden":"true",children:["Page ",e.jsx("strong",{children:t})," of ",n]}),e.jsxs("div",{className:"ui-pagination__pages",children:[r&&e.jsx("button",{type:"button",className:"ui-pagination__btn ui-pagination__btn--icon",onClick:()=>X(1),disabled:P,"aria-label":"First page",children:e.jsx(Jr,{})}),e.jsx("button",{type:"button",className:"ui-pagination__btn ui-pagination__btn--icon",onClick:()=>X(t-1),disabled:P,"aria-label":"Previous page",children:e.jsx(Pn,{})}),S.map(T=>T==="ellipsis-left"||T==="ellipsis-right"?e.jsx("span",{className:"ui-pagination__ellipsis","aria-hidden":"true",children:"…"},T):e.jsx("button",{type:"button",className:["ui-pagination__btn","ui-pagination__btn--num",T===t&&"ui-pagination__btn--active"].filter(Boolean).join(" "),onClick:()=>X(T),"aria-current":T===t?"page":void 0,"aria-label":`Page ${T}`,children:T},T)),e.jsx("button",{type:"button",className:"ui-pagination__btn ui-pagination__btn--icon",onClick:()=>X(t+1),disabled:q,"aria-label":"Next page",children:e.jsx(zn,{})}),r&&e.jsx("button",{type:"button",className:"ui-pagination__btn ui-pagination__btn--icon",onClick:()=>X(n),disabled:q,"aria-label":"Last page",children:e.jsx(Qr,{})})]})]})]})]})};Es.displayName="Pagination";const Oi=({mode:t,currentPage:n,totalItems:s,itemsPerPage:a})=>{if(t==="none"||s===void 0)return null;if(t==="total")return e.jsxs("span",{className:"ui-pagination__summary",children:[e.jsx("strong",{children:s})," ",s===1?"result":"results"]});const i=a??s,r=s===0?0:(n-1)*i+1,l=Math.min(n*i,s);return e.jsxs("span",{className:"ui-pagination__summary",children:["Showing ",e.jsx("strong",{children:r}),"–",e.jsx("strong",{children:l})," of ",e.jsx("strong",{children:s})]})},Fi=({totalPages:t,onGo:n})=>{const[s,a]=o.useState(""),i=o.useRef(null),r=()=>{const d=Number(s);if(!Number.isFinite(d)||d<1||d>t){a("");return}n(Math.floor(d)),a(""),i.current?.blur()},l=d=>{const u=Number(s)||0,p=Math.min(t,Math.max(1,u+d));a(String(p))},c=e.jsxs("span",{className:"ui-pagination__goto-spinner","aria-hidden":"true",children:[e.jsx("button",{type:"button",tabIndex:-1,className:"ui-pagination__goto-spinner-btn",onMouseDown:d=>{d.preventDefault(),l(1)},children:e.jsx(Kr,{})}),e.jsx("button",{type:"button",tabIndex:-1,className:"ui-pagination__goto-spinner-btn",onMouseDown:d=>{d.preventDefault(),l(-1)},children:e.jsx(Wr,{})})]});return e.jsxs("label",{className:"ui-pagination__goto",children:[e.jsx("span",{className:"ui-pagination__goto-label",children:"Go to"}),e.jsx(Vt,{ref:i,type:"number",size:"small",min:1,max:t,step:1,value:s,onChange:d=>a(d.target.value),onKeyDown:d=>{d.key==="Enter"&&(d.preventDefault(),r())},onBlur:r,"aria-label":`Go to page (1–${t})`,endAdornment:c,sx:{root:"ui-pagination__goto-field",input:"ui-pagination__goto-input"}})]})},Vi={primary:"--palette-primary-main",secondary:"--palette-secondary-main",success:"--palette-success-main",tertiary:"--palette-tertiary-main",warning:"--palette-warning-main",error:"--palette-error-main",info:"--palette-info-main",neutral:"--palette-text-secondary"},zt=12,$s=3,ja=30,Yi=["Mon","","Wed","","Fri","",""],Wi=[0,22,45,70,100];function Ki(t,n){if(!t||t<=0||n<=0)return 0;const s=t/n;return s<=.25?1:s<=.5?2:s<=.75?3:4}function Ls(t,n){return t<=0?{backgroundColor:"var(--palette-action-hover)"}:{backgroundColor:`color-mix(in srgb, var(${n}) ${Wi[t]}%, transparent)`}}const ya=t=>t.toISOString().slice(0,10),Ts=({data:t=[],endDate:n,weeks:s=52,color:a="success",maxValue:i,formatTooltip:r,isLoading:l=!1})=>{const c=Vi[a],{grid:d,months:u,byDate:p,max:f}=o.useMemo(()=>{const g=new Date((n||ya(new Date))+"T00:00:00"),_=(g.getDay()+6)%7,y=new Date(g);y.setDate(y.getDate()+(6-_));const N=new Date(y);N.setDate(N.getDate()-(s*7-1));const k=[],$=[];let S=-1;for(let X=0;X<s;X++){const D=[];for(let O=0;O<7;O++){const ge=new Date(N);ge.setDate(ge.getDate()+X*7+O),D.push({iso:ya(ge)})}k.push(D);const T=new Date(N);T.setDate(T.getDate()+X*7);const ee=T.getMonth();if(ee!==S){if($.length===0){const O=new Date(N);O.setDate(O.getDate()+(X+2)*7),O.getMonth()===ee&&$.push({col:X,label:T.toLocaleDateString("en",{month:"short"})})}else $.push({col:X,label:T.toLocaleDateString("en",{month:"short"})});S=ee}}const P=new Map;let q=0;for(const X of t){const D=String(X.date).slice(0,10);P.set(D,X);const T=Number(X.value)||0;T>q&&(q=T)}return{grid:k,months:$,byDate:P,max:i!=null&&i>0?i:q}},[t,n,s,i]),h=ya(new Date);if(l)return e.jsx("div",{className:"ui-activity-heatmap__skeleton"});const m=s*zt+(s-1)*$s,v=`${ja}px repeat(${s}, ${zt}px)`;return e.jsx("div",{className:"ui-activity-heatmap",children:e.jsxs("div",{style:{minWidth:ja+m},children:[e.jsxs("div",{className:"ui-activity-heatmap__months",style:{gridTemplateColumns:v,columnGap:`${$s}px`},children:[e.jsx("div",{}),Array.from({length:s}).map((g,_)=>e.jsx("div",{className:"ui-activity-heatmap__month-label",children:u.find(y=>y.col===_)?.label||""},_))]}),e.jsxs("div",{className:"ui-activity-heatmap__grid",children:[e.jsx("div",{className:"ui-activity-heatmap__day-labels",style:{width:ja},children:Yi.map((g,_)=>e.jsx("div",{className:"ui-activity-heatmap__day-label",style:{height:zt},children:g},_))}),d.map((g,_)=>e.jsx("div",{className:"ui-activity-heatmap__week",children:g.map(({iso:y})=>{const N=p.get(y),k=y>h,$=k?-1:Ki(N?.value||0,f),S=k?y:r?r(y,N?.value||0,N?.meta):`${y}: ${N?.value??0}`;return e.jsx("div",{className:k?"ui-activity-heatmap__cell ui-activity-heatmap__cell--future":"ui-activity-heatmap__cell",title:S,style:{width:zt,height:zt,...k?void 0:Ls($,c)}},y)})},_))]}),e.jsxs("div",{className:"ui-activity-heatmap__legend",children:[e.jsx("span",{children:"Less"}),[0,1,2,3,4].map(g=>e.jsx("div",{className:"ui-activity-heatmap__legend-cell",style:{width:zt,height:zt,...Ls(g,c)}},g)),e.jsx("span",{children:"More"})]})]})})};Ts.displayName="ActivityHeatmap";const Fn=4,Vn=3,As=20;function Ui(t){return t.find(s=>s.iso2==="gb"||s.iso2==="en"||s.name.toLowerCase()==="english")??t[0]??null}function Is(t,n){return t.icon?t.icon:`https://flagcdn.com/${n}/${t.iso2}.png`}const Ps=({page:t,totalPages:n,onPrev:s,onNext:a})=>{const i=l=>c=>{c.stopPropagation(),c.preventDefault(),l()},r=l=>{l.stopPropagation(),l.preventDefault()};return e.jsxs("div",{className:"ui-employee-card__carousel-nav",onClick:r,children:[e.jsx(Ie,{icon:e.jsx(Pn,{size:14}),size:"small",variant:"ghost",color:"neutral",sx:"ui-employee-card__carousel-btn",onClick:i(s),disabled:t===0,"aria-label":"Previous"}),e.jsx(Ie,{icon:e.jsx(zn,{size:14}),size:"small",variant:"ghost",color:"neutral",sx:"ui-employee-card__carousel-btn",onClick:i(a),disabled:t>=n-1,"aria-label":"Next"})]})},zs=({employee:t,profileUrl:n,onClick:s,talkMode:a,selectedToolIds:i,onToolToggle:r,isInCart:l,onCartToggle:c,selectedTierValue:d,onTierChange:u,share:p,onShare:f,sx:h})=>{const[m,v]=o.useState(!1),[g,_]=o.useState(0),[y,N]=o.useState(0),[k,$]=o.useState(!1),S=parseFloat(t.rate?.value??"0"),P=C=>parseFloat(C)<=S,q=t.pricingTiers?.filter(C=>P(C.value)).sort((C,de)=>parseFloat(de.value)-parseFloat(C.value))[0]?.value??t.pricingTiers?.[0]?.value??null,[X,D]=o.useState(()=>q),T=d??X,ee=t.pricingTiers?.find(C=>C.value===T)??null,O=C=>{u?u(C):D(C)},[ge,ue]=o.useState(""),Q=o.useRef(null),re=o.useRef(null),ye=t.shortName||"Unknown",ke=t.department?.color||"#9e9e9e",R=t.currency||"$",Z=C=>{const de=parseFloat(C||"0");return de?`${R}${de}/hour`:"—"},b=C=>t.prices_discounted?.find(de=>de.value===C)?.price,I=b(T??"")??ee?.price,z=I?Z(I):"—",W=t.tools||[],V=Math.ceil(W.length/Fn)||1,be=g*Fn,w=W.slice(be,be+Fn),te=Math.ceil(W.length/Vn)||1,ie=y*Vn,he=W.slice(ie,ie+Vn),H=t.languages||[],le=Ui(H),$e=a?a.isConnected||a.isConnecting:!1;o.useEffect(()=>{$e||ue("")},[$e]),o.useEffect(()=>{re.current&&(re.current.scrollTop=re.current.scrollHeight)},[a?.messages]);const Pe=["ui-employee-card",m&&"ui-employee-card--flipped",t.is_pinned&&"ui-employee-card--hot",$e&&"ui-employee-card--talk-active",h?.root].filter(Boolean).join(" "),pe=`ui-employee-card__header ${h?.header||""}`.trim(),Ce=`ui-employee-card__content ${h?.content||""}`.trim(),_e={"--department-color":ke},ze=C=>{if(C.target.closest('button, input, [role="button"], .ui-icon-button-wrapper, .ui-dropdown, .ui-employee-card__content--talk')){C.preventDefault();return}s&&(C.preventDefault(),s())},M=C=>{C.stopPropagation(),C.preventDefault(),v(de=>!de)},G=(C,de)=>{C.stopPropagation(),C.preventDefault(),r?.(de)},ae=C=>{C.stopPropagation(),C.preventDefault(),c?.()},j=C=>{C.stopPropagation(),C.preventDefault(),n&&navigator.share?navigator.share({title:t.profession??t.shortName??void 0,text:`${t.shortName} — ${t.profession??"AnyEmp profile"}`,url:n}).then(()=>f?.()).catch(()=>{}):n?navigator.clipboard.writeText(n).then(()=>{$(!0),Q.current&&clearTimeout(Q.current),Q.current=setTimeout(()=>$(!1),1500),f?.()}):f?.()},B=!a?.isMicMuted,U=()=>{!ge.trim()||!a?.onSendMessage||(a.onSendMessage(ge.trim()),ue(""))},J=n?"a":"article",we=n?{href:n,onClick:ze}:{onClick:ze,role:s?"button":void 0,tabIndex:s?0:void 0};return e.jsxs("div",{className:Pe,style:{"--department-color":ke},children:[e.jsxs("div",{className:"ui-employee-card__card-side",children:[e.jsxs("div",{className:"ui-employee-card__inner",children:[e.jsxs(J,{...we,className:"ui-employee-card__front",children:[e.jsx("div",{className:"ui-employee-card__header-section"}),e.jsxs("div",{className:pe,style:_e,children:[e.jsxs("div",{className:"ui-employee-card__avatar-wrapper",children:[e.jsx("div",{className:"ui-employee-card__avatar-gradient"}),t.avatarUrl?e.jsx("img",{src:t.avatarUrl,alt:`${ye} avatar`,className:"ui-employee-card__avatar"}):e.jsx("div",{className:"ui-employee-card__avatar ui-employee-card__avatar--placeholder",children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),e.jsx("circle",{cx:"12",cy:"7",r:"4"})]})})]}),e.jsx("div",{className:"ui-employee-card__header-info",children:e.jsxs("div",{className:"ui-employee-card__header-text",children:[t.profession&&e.jsx("h3",{className:"ui-employee-card__profession",children:t.profession}),e.jsx("p",{className:"ui-employee-card__name",children:ye})]})}),e.jsx("div",{className:"ui-employee-card__id-badge-wrapper",children:e.jsxs("div",{className:"ui-employee-card__id-badge",children:[e.jsx("span",{className:"ui-employee-card__id-label",children:"ID:"}),e.jsx("span",{className:"ui-employee-card__id-value",children:t.talentId})]})})]}),e.jsxs("div",{className:"ui-employee-card__body-section",children:[e.jsxs("div",{className:`${Ce} ui-employee-card__content--normal ${$e?"ui-employee-card__content--hidden":""}`,children:[t.summary&&e.jsx("div",{style:{marginBottom:"1rem"},children:e.jsx("p",{className:"ui-employee-card__summary",children:t.summary})}),W.length>0&&e.jsxs("div",{className:"ui-employee-card__skills-section",children:[e.jsxs("div",{className:"ui-employee-card__carousel-header",children:[e.jsx("h4",{className:"ui-employee-card__section-title",children:"Tools"}),W.length>Fn&&e.jsx(Ps,{page:g,totalPages:V,onPrev:()=>_(C=>Math.max(0,C-1)),onNext:()=>_(C=>Math.min(V-1,C+1))})]}),e.jsx("div",{className:"ui-employee-card__tools",children:w.map(C=>{const fe=["ui-employee-card__tool",(i?.includes(C.id)??!1)&&"ui-employee-card__tool--selected"].filter(Boolean).join(" ");return e.jsx(Ue,{title:C.name,placement:"top",children:e.jsx("div",{className:fe,onClick:r?Se=>G(Se,C.id):void 0,children:C.icon?e.jsx("img",{src:C.icon,alt:C.name,className:"ui-employee-card__tool-icon"}):e.jsx("span",{className:"ui-employee-card__tool-placeholder",children:C.name.charAt(0).toUpperCase()})})},C.id)})})]}),a&&e.jsx("div",{className:"ui-employee-card__audio-section",children:e.jsxs("div",{className:"ui-employee-card__audio-controls",role:"button",tabIndex:a.isConnecting?-1:0,onClick:C=>{C.stopPropagation(),C.preventDefault(),a.isConnecting||a.onStart()},children:[e.jsx("div",{className:"ui-employee-card__audio-mic-circle",children:e.jsx(Za,{})}),e.jsx("div",{className:"ui-employee-card__audio-wave",children:[...Array(5)].map((C,de)=>e.jsx("div",{className:"ui-employee-card__audio-wave-bar"},de))}),e.jsxs("div",{className:"ui-employee-card__audio-text",children:[e.jsx("span",{className:"ui-employee-card__audio-label",children:"Talk with AI Employee"}),t.slogan&&e.jsx("span",{className:"ui-employee-card__audio-slogan",children:t.slogan})]})]})})]}),a&&e.jsx("div",{className:`${Ce} ui-employee-card__content--talk ${$e?"":"ui-employee-card__content--hidden"}`,children:e.jsx("div",{className:"ui-employee-card__talk-view",children:t.pricingTiers&&t.pricingTiers.length>0&&t.rate?(()=>{const C=b(T??""),de=parseFloat((C??ee?.price)||"0"),fe=de&&ee?`${R}${(de*ee.hours*As).toLocaleString()}/mo`:"—",Se=Ne=>{const F=parseFloat(Ne);return F>=1?"var(--palette-primary-main)":F>=.5?"var(--palette-warning-main)":"var(--palette-text-primary)"};return e.jsxs("div",{className:"ui-employee-card__cpv",children:[e.jsx("span",{className:"ui-employee-card__cpv-label",children:"Pricing"}),e.jsx("div",{className:"ui-employee-card__cpv-tiers",children:t.pricingTiers.map(Ne=>{const F=b(Ne.value),oe=parseFloat((F??Ne.price)||"0"),xe=F?parseFloat(Ne.price||"0"):null,je=oe?`${R}${(oe*Ne.hours*As).toLocaleString()}/mo`:"—",Ae=oe?`${R}${oe}/h`:"—",We=P(Ne.value),Ke=["ui-employee-card__cpv-tier",We&&Ne.value===T&&"ui-employee-card__cpv-tier--selected",!We&&"ui-employee-card__cpv-tier--disabled",We&&c&&"ui-employee-card__cpv-tier--clickable"].filter(Boolean).join(" ");return e.jsxs("div",{className:Ke,style:{"--tc":Se(Ne.value)},onClick:We&&c?ct=>{ct.stopPropagation(),ct.preventDefault(),O(Ne.value)}:void 0,children:[e.jsxs("div",{className:"ui-employee-card__cpv-tier-left",children:[e.jsx("span",{className:"ui-employee-card__cpv-tier-label",children:Ne.name}),e.jsxs("span",{className:"ui-employee-card__cpv-tier-hours",children:[Ne.hours," h/day"]})]}),e.jsxs("div",{className:"ui-employee-card__cpv-tier-right",children:[xe&&e.jsxs("span",{className:"ui-employee-card__cpv-tier-rate ui-employee-card__cpv-tier-rate--original",children:[R,xe,"/h"]}),e.jsx("span",{className:"ui-employee-card__cpv-tier-rate",children:Ae}),e.jsx("span",{className:"ui-employee-card__cpv-tier-monthly",children:je})]})]},Ne.value)})}),e.jsxs("div",{className:"ui-employee-card__cpv-summary",children:[e.jsx("span",{className:"ui-employee-card__cpv-summary-label",children:"In Total"}),e.jsxs("span",{className:"ui-employee-card__cpv-summary-value",children:[t.rate?.name," · ",fe]})]})]})})():null})})]}),t.pricingTiers&&t.pricingTiers.length>0&&t.rate&&e.jsx(Jn,{placement:"bottom-end",variant:"info",divider:!0,sx:{root:"ui-employee-card__price-dropdown"},trigger:e.jsxs(Ze,{variant:"outlined",color:"neutral",size:"small",sx:"ui-employee-card__price-trigger rounded-full",children:[e.jsx("span",{children:z}),t.discount&&e.jsxs("span",{className:"ui-employee-card__discount-badge",children:["-",parseFloat(t.discount).toFixed(0),"%"]}),e.jsx("svg",{className:"ui-dropdown__arrow",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),children:t.pricingTiers.map(C=>{const de=b(C.value);return e.jsxs(Zn,{sx:"ui-employee-card__price-item",disabled:!P(C.value),children:[e.jsx("span",{className:"ui-employee-card__price-label",children:C.name}),de?e.jsxs("span",{className:"ui-employee-card__price-value-group",children:[e.jsx("span",{className:"ui-employee-card__price-value ui-employee-card__price-value--original",children:Z(C.price)}),e.jsx("span",{className:"ui-employee-card__price-value ui-employee-card__price-value--discounted",children:Z(de)})]}):e.jsx("span",{className:"ui-employee-card__price-value",children:Z(C.price)})]},C.value)})}),e.jsxs("div",{className:"ui-employee-card__avatar-actions",children:[le&&e.jsx(Ue,{placement:"right",title:e.jsxs("span",{className:"ui-employee-card__lang-tooltip-item",children:[e.jsx("span",{children:le.name}),e.jsx("span",{className:"ui-employee-card__lang-level",children:le.level})]}),children:e.jsx("div",{className:"ui-employee-card__language-badge",children:e.jsx("img",{src:Is(le,"24x18"),alt:le.name})})}),c&&e.jsx(Ie,{icon:l?e.jsx(Zr,{}):e.jsx(zr,{}),size:"small",variant:"outlined",color:l?"warning":"neutral",sx:"ui-employee-card__action-btn",onClick:ae,"aria-label":l?"Remove from cart":"Add to cart"}),(p||f)&&e.jsxs("div",{className:"ui-employee-card__share-wrapper",children:[e.jsx(Ie,{icon:e.jsx(Qa,{}),size:"small",variant:"outlined",color:"neutral",sx:"ui-employee-card__action-btn",onClick:j,"aria-label":"Share profile"}),k&&e.jsx("div",{className:"ui-employee-card__share-copied",children:"Copied!"})]})]})]}),e.jsx("div",{className:"ui-employee-card__back",children:e.jsxs("div",{className:"ui-employee-card__back-content",children:[e.jsx("div",{className:"ui-employee-card__back-header",children:e.jsxs("div",{className:"ui-employee-card__back-header-row",children:[t.profession&&e.jsx("p",{className:"ui-employee-card__back-role",style:{color:ke},children:t.profession}),e.jsxs("span",{className:"ui-employee-card__back-id",children:["ID: ",t.talentId]})]})}),H.length>0&&e.jsx("div",{className:"ui-employee-card__back-section",children:e.jsx("div",{className:"ui-employee-card__back-languages",children:H.map(C=>e.jsx(Ue,{title:C.name,placement:"top",children:e.jsxs("div",{className:"ui-employee-card__back-language-item",children:[e.jsxs("div",{className:"ui-employee-card__back-language-left",children:[e.jsx("img",{src:Is(C,"20x15"),alt:C.name,className:"ui-employee-card__back-language-flag"}),e.jsx("span",{className:"ui-employee-card__back-language-iso",children:C.iso2.toUpperCase()})]}),e.jsx("span",{className:"ui-employee-card__back-language-level",children:C.level})]})},C.name))})}),W.length>0&&e.jsxs("div",{className:"ui-employee-card__back-section ui-employee-card__back-section--tools",children:[e.jsxs("div",{className:"ui-employee-card__carousel-header",children:[e.jsx("h4",{className:"ui-employee-card__back-section-title",children:"I Can Work With"}),W.length>Vn&&e.jsx(Ps,{page:y,totalPages:te,onPrev:()=>N(C=>Math.max(0,C-1)),onNext:()=>N(C=>Math.min(te-1,C+1))})]}),e.jsx("div",{className:"ui-employee-card__back-tools",children:he.map(C=>e.jsxs("div",{className:"ui-employee-card__back-tool",children:[C.icon?e.jsx("img",{src:C.icon,alt:C.name,className:"ui-employee-card__back-tool-icon"}):e.jsx("span",{className:"ui-employee-card__back-tool-placeholder",children:C.name.charAt(0).toUpperCase()}),e.jsx("span",{className:"ui-employee-card__back-tool-name",children:C.name})]},C.id))})]}),t.tasks&&t.tasks.length>0&&e.jsxs("div",{className:"ui-employee-card__back-section",children:[e.jsx("h4",{className:"ui-employee-card__back-section-title",children:"Recent Tasks"}),e.jsx("div",{className:"ui-employee-card__back-tasks",children:t.tasks.map((C,de)=>e.jsx("div",{className:"ui-employee-card__back-task",children:e.jsx("span",{children:C.text})},C.id??de))})]})]})})]}),e.jsx(Ie,{icon:e.jsx(ei,{}),size:"medium",variant:"ghost",color:"primary",sx:"ui-employee-card__flip-btn",onClick:M,"aria-label":m?"Show front side":"Show back side"})]}),$e&&e.jsx("div",{className:"ui-employee-card__panel-clip",children:e.jsx("div",{className:"ui-employee-card__side-panel",children:a?.chatSlot??e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"ui-employee-card__side-panel-actions",children:[a?.onShareChat&&e.jsx(Ie,{icon:e.jsx(Qa,{}),size:"small",variant:"ghost",color:"neutral",sx:"ui-employee-card__side-panel-share",onClick:()=>a.onShareChat(),"aria-label":"Share chat"}),e.jsx(Ie,{icon:e.jsx(jt,{}),size:"small",variant:"ghost",color:"neutral",sx:"ui-employee-card__side-panel-close",onClick:()=>a?.onEnd(),"aria-label":"Close"})]}),e.jsxs("div",{className:"ui-employee-card__panel-voice-bar",children:[e.jsx("div",{className:"ui-employee-card__panel-mic-col",children:e.jsx(Ie,{icon:e.jsx(Za,{}),size:"medium",variant:"filled",color:B?"error":"primary",sx:`ui-employee-card__panel-mic-btn${B?" active-pulse":""}`,"aria-label":B?"Mute microphone":"Unmute microphone",onClick:a?.onMicToggle})}),e.jsx("div",{className:"ui-employee-card__talk-waveform",children:[...Array(7)].map((C,de)=>e.jsx("div",{className:"ui-employee-card__waveform-bar"},de))})]}),a?.faqChips&&a.faqChips.length>0&&e.jsxs("div",{className:"ui-employee-card__panel-faq",children:[e.jsx("span",{className:"ui-employee-card__panel-faq-label",children:"Quick questions"}),e.jsx("div",{className:"ui-employee-card__panel-faq-chips",children:a.faqChips.map((C,de)=>e.jsx(mt,{label:C,variant:"outlined",color:"neutral",size:"small",onClick:()=>a.onSendMessage?.(C)},de))})]}),e.jsx("div",{className:"ui-employee-card__panel-messages-scroll",ref:re,children:e.jsx("div",{className:"ui-employee-card__panel-messages",children:(a?.messages??[]).map((C,de)=>e.jsx("div",{className:`ui-employee-card__panel-bubble ui-employee-card__panel-bubble--${C.role}`,children:e.jsx("div",{className:"ui-employee-card__panel-bubble-text",children:C.text})},de))})}),a?.onSendMessage&&e.jsx("div",{className:"ui-employee-card__panel-input-bar",children:e.jsx(Vt,{fullWidth:!0,size:"small",value:ge,onChange:C=>ue(C.target.value),onKeyDown:C=>{C.key==="Enter"&&U()},placeholder:"Ask anything...",endAdornment:e.jsx(Ie,{icon:e.jsx(Fr,{}),size:"small",variant:"ghost",color:"primary","aria-label":"Send",onClick:U})})})]})})})]})};zs.displayName="EmployeeCard";const ka=({src:t="/logo.png",alt:n="Any Employee Logo",text:s="Any Employee",onClick:a,size:i="medium",className:r=""})=>{const l=`ui-anyemp-logo ui-anyemp-logo--${i} ${r}`.trim(),c=d=>{a&&(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),a())};return e.jsxs("div",{className:l,onClick:a,role:a?"button":void 0,tabIndex:a?0:void 0,onKeyDown:c,children:[e.jsx("div",{className:"ui-anyemp-logo__image-wrapper",children:e.jsx("img",{src:t,alt:n,className:"ui-anyemp-logo__image"})}),s&&e.jsx("span",{className:"ui-anyemp-logo__text",children:s})]})};ka.displayName="Logo";const Gi=[{label:"ABOUT US",href:"#about"},{label:"FAQ",href:"#faq"},{label:"REVIEWS",href:"#reviews"},{label:"CONTACT US",href:"#contact"}],Hs=({navItems:t=Gi,logoText:n="Any Employee",logoSrc:s,logoAlt:a,onLogoClick:i,sx:r})=>{const l=`ui-anyemp-header ${r?.root||""}`.trim(),c=`ui-anyemp-header__nav ${r?.nav||""}`.trim(),d=`ui-anyemp-header__nav-item ${r?.navItem||""}`.trim(),u=t.slice(0,Math.ceil(t.length/2)),p=t.slice(Math.ceil(t.length/2)),f=(h,m)=>{h.onClick&&(m.preventDefault(),h.onClick())};return e.jsx("header",{className:l,children:e.jsxs("nav",{className:c,children:[e.jsx("div",{className:"ui-anyemp-header__nav-group",children:u.map((h,m)=>e.jsx("a",{href:h.href||"#",className:d,onClick:v=>f(h,v),children:h.label},`left-${m}`))}),e.jsx(ka,{src:s,alt:a,text:n,onClick:i,className:r?.logo}),e.jsx("div",{className:"ui-anyemp-header__nav-group",children:p.map((h,m)=>e.jsx("a",{href:h.href||"#",className:d,onClick:v=>f(h,v),children:h.label},`right-${m}`))})]})})};Hs.displayName="Header";function qi(t,n){let s,a,i=-1;const r=l=>{for(const c of l)c.path&&(c.path===n?s=c.id:n.startsWith(c.path==="/"?"/":c.path+"/")&&c.path.length>i&&(a=c.id,i=c.path.length)),c.children&&r(c.children)};return r(t),s??a}const Bs=({item:t,isCollapsed:n,isActive:s,isExpanded:a,expandedIds:i,parentItemBehavior:r,depth:l,onToggleExpand:c,onItemClick:d,activeItemId:u,onMouseEnter:p,onMouseLeave:f})=>{const h=!!t.children?.length,m=o.useRef(null),v=o.useRef(null),g=["ui-sidebar__item",s&&"ui-sidebar__item--active",h&&"ui-sidebar__item--has-children",h&&a&&"ui-sidebar__item--open"].filter(Boolean).join(" "),_=D=>{if(t.external)return;const T=D.button===0&&!D.metaKey&&!D.ctrlKey&&!D.shiftKey&&!D.altKey;if(!(t.path&&!T)){if(!h){d&&t.path&&D.preventDefault(),d?.(t);return}if(r==="accordion"){t.path&&D.preventDefault(),c(t.id);return}d&&t.path&&D.preventDefault(),d?.(t)}},y=D=>{!h||r!=="navigate"||(D.key==="ArrowRight"&&!a||D.key==="ArrowLeft"&&a)&&(D.preventDefault(),c(t.id))},N=D=>{D.preventDefault(),D.stopPropagation(),c(t.id)},k=D=>{p?.(t.id,D.currentTarget)},$=e.jsxs(e.Fragment,{children:[t.icon&&e.jsx("span",{className:"ui-sidebar__item-icon",children:t.icon}),e.jsx("span",{className:"ui-sidebar__item-label",children:t.label}),t.badge!==void 0&&e.jsx("span",{className:"ui-sidebar__item-badge",children:t.badge}),h&&(r==="accordion"?e.jsx(Rn,{className:"ui-sidebar__item-chevron","aria-hidden":"true"}):e.jsx("button",{type:"button",className:"ui-sidebar__item-toggle",onClick:N,"aria-label":a?"Collapse section":"Expand section","aria-expanded":a,tabIndex:-1,children:e.jsx(Rn,{className:"ui-sidebar__item-chevron","aria-hidden":"true"})}))]}),S={"--ui-sidebar-depth":l},P=e.jsx("a",{ref:v,href:t.path,className:g,style:S,"aria-current":s?"page":void 0,target:t.external?"_blank":void 0,rel:t.external?"noopener noreferrer":void 0,onClick:_,onKeyDown:y,onMouseEnter:k,onMouseLeave:f,children:$}),q=e.jsx("button",{ref:m,type:"button",className:g,style:S,onClick:_,onKeyDown:y,"aria-expanded":h&&r!=="navigate"?a:void 0,"aria-haspopup":h?!0:void 0,onMouseEnter:k,onMouseLeave:f,children:$}),X=t.path&&(!h||r!=="accordion")?P:q;return e.jsxs("li",{children:[X,h&&e.jsx("div",{className:["ui-sidebar__children",a&&"ui-sidebar__children--open"].filter(Boolean).join(" "),children:e.jsx("ul",{role:"list",style:{listStyle:"none",margin:0,padding:0},children:t.children.map(D=>e.jsx(Bs,{item:D,isCollapsed:n,isActive:D.id===u,isExpanded:i.includes(D.id),expandedIds:i,parentItemBehavior:r,depth:l+1,onToggleExpand:c,onItemClick:d,activeItemId:u},D.id))})})]})},Xi=({user:t,onLogout:n,onLogin:s,theme:a,onThemeToggle:i,isCollapsed:r})=>{const l=a==="dark",[c,d]=o.useState(null),u=o.useRef(null),p=()=>{u.current!==null&&(clearTimeout(u.current),u.current=null)},f=(v,g)=>{if(!r)return;p();const _=v.getBoundingClientRect();d({kind:"label",label:g,top:_.top+_.height/2})},h=v=>{if(!r)return;p();const g=v.getBoundingClientRect();d({kind:"user",top:g.top+g.height/2})},m=()=>{p(),u.current=window.setTimeout(()=>d(null),200)};return o.useEffect(()=>()=>{u.current!==null&&clearTimeout(u.current)},[]),o.useEffect(()=>{r||d(null)},[r]),e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"ui-sidebar__builtin-footer",children:[i&&e.jsxs(Ze,{variant:"ghost",color:"neutral",size:"small",onClick:i,"aria-label":l?"Switch to light mode":"Switch to dark mode",sx:"ui-sidebar__theme-btn",onMouseEnter:v=>f(v.currentTarget,l?"Light mode":"Dark mode"),onMouseLeave:m,children:[e.jsx("span",{className:"ui-sidebar__footer-icon",children:l?e.jsx(Yr,{size:20}):e.jsx(Vr,{size:20})}),e.jsx("span",{className:"ui-sidebar__footer-label",children:l?"Light mode":"Dark mode"})]}),t&&e.jsxs("div",{className:"ui-sidebar__user",onMouseEnter:v=>h(v.currentTarget),onMouseLeave:m,children:[e.jsx(Pt,{name:t.name??t.email??"",src:t.avatar,alt:t.name??"User",size:"small",fallback:e.jsx(ni,{}),sx:"ui-sidebar__user-avatar",crossOrigin:"anonymous",referrerPolicy:"no-referrer"}),!r&&e.jsxs("div",{className:"ui-sidebar__user-info",children:[t.name&&e.jsx("span",{className:"ui-sidebar__user-name",children:t.name}),t.email&&e.jsx("span",{className:"ui-sidebar__user-email",children:t.email}),t.roles&&t.roles.length>0&&e.jsx("span",{className:"ui-sidebar__user-roles",children:t.roles.join(", ")})]})]}),n&&e.jsxs(Ze,{variant:"ghost",color:"error",size:"small",onClick:n,"aria-label":"Log out",sx:"ui-sidebar__logout-btn",onMouseEnter:v=>f(v.currentTarget,"Log out"),onMouseLeave:m,children:[e.jsx("span",{className:"ui-sidebar__footer-icon",children:e.jsx(Ir,{size:20})}),e.jsx("span",{className:"ui-sidebar__footer-label",children:"Log out"})]}),!t&&s&&e.jsxs(Ze,{variant:"ghost",color:"primary",size:"small",onClick:s,"aria-label":"Log in",sx:"ui-sidebar__login-btn",onMouseEnter:v=>f(v.currentTarget,"Log in"),onMouseLeave:m,children:[e.jsx("span",{className:"ui-sidebar__footer-icon",children:e.jsx(Ar,{size:20})}),e.jsx("span",{className:"ui-sidebar__footer-label",children:"Log in"})]})]}),r&&c&&e.jsx("div",{className:["ui-sidebar__popover",c.kind==="user"?"ui-sidebar__popover--user":"ui-sidebar__popover--label"].join(" "),style:{top:c.top,transform:"translateY(-50%)"},onMouseEnter:p,onMouseLeave:m,children:c.kind==="label"?e.jsx("span",{children:c.label}):e.jsxs(e.Fragment,{children:[t?.name&&e.jsx("span",{className:"ui-sidebar__user-name",children:t.name}),t?.email&&e.jsx("span",{className:"ui-sidebar__user-email",children:t.email}),t?.roles&&t.roles.length>0&&e.jsx("span",{className:"ui-sidebar__user-roles",children:t.roles.join(", ")})]})})]})},Zi=200,Ji=240,wa=({items:t,collapsed:n,defaultCollapsed:s=!1,onCollapsedChange:a,mobileOpen:i=!1,onMobileClose:r,logo:l,logoIcon:c,logoTitle:d,footer:u,user:p,onLogout:f,onLogin:h,theme:m,onThemeToggle:v,activeItemId:g,activePath:_,onItemClick:y,parentItemBehavior:N="accordion",sx:k,style:$})=>{const S=g??(_!==void 0?qi(t,_):void 0),P=n!==void 0,[q,X]=o.useState(s),D=P?n:q,T=()=>{const w=!D;P||X(w),a?.(w)},[ee,O]=o.useState(()=>{if(!S)return[];const w=[],te=ie=>{for(const he of ie){if(he.id===S)return!0;if(he.children&&te(he.children))return w.push(he.id),!0}return!1};return te(t),w});o.useEffect(()=>{if(!S)return;const w=[],te=ie=>{for(const he of ie){if(he.id===S)return!0;if(he.children&&te(he.children))return w.push(he.id),!0}return!1};te(t),w.length!==0&&O(ie=>{const he=new Set(ie);for(const H of w)he.add(H);return Array.from(he)})},[S,t]);const ge=w=>{O(te=>te.includes(w)?te.filter(ie=>ie!==w):[...te,w])},[ue,Q]=o.useState(null),re=o.useRef(0),ye=o.useRef(0),ke=o.useRef(null),R=o.useCallback(()=>{ke.current!==null&&(clearTimeout(ke.current),ke.current=null)},[]),Z=o.useCallback((w,te)=>{if(!D)return;R();const ie=te.getBoundingClientRect();re.current=Math.min(ie.top,window.innerHeight-Ji),ye.current=ie.top+ie.height/2,Q(w)},[D,R]),b=o.useCallback(()=>{D&&(R(),ke.current=window.setTimeout(()=>Q(null),Zi))},[D,R]),I=w=>{R(),Q(w)};o.useEffect(()=>{if(!D||!ue)return;const w=te=>{te.key==="Escape"&&Q(null)};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[D,ue]),o.useEffect(()=>()=>R(),[R]),o.useEffect(()=>{D||Q(null)},[D]);const z=ue?t.find(w=>w.id===ue):null,W=!u&&(p||f||h||v),V=["ui-sidebar",D&&"ui-sidebar--collapsed",k].filter(Boolean).join(" "),be=(w=!1)=>e.jsxs(e.Fragment,{children:[w?e.jsxs("div",{className:"ui-sidebar__mobile-header",children:[e.jsx("div",{className:"ui-sidebar__mobile-header-logo",children:l}),e.jsx(Ie,{icon:e.jsx(jt,{}),"aria-label":"Close navigation",variant:"ghost",color:"neutral",size:"medium",onClick:r})]}):(l||c||d)&&e.jsx("div",{className:"ui-sidebar__header",children:l??e.jsxs(e.Fragment,{children:[c&&e.jsx("div",{className:"ui-sidebar__logo-icon",children:c}),d&&e.jsx("span",{className:"ui-sidebar__logo-title",children:d})]})}),e.jsx("nav",{className:"ui-sidebar__nav","aria-label":"Main navigation",children:e.jsx("ul",{role:"list",style:{listStyle:"none",margin:0,padding:0},children:t.map(te=>e.jsx(Bs,{item:te,isCollapsed:w?!1:D,isActive:te.id===S,isExpanded:ee.includes(te.id),expandedIds:ee,parentItemBehavior:N,depth:0,onToggleExpand:ge,onItemClick:y,activeItemId:S,onMouseEnter:w?void 0:Z,onMouseLeave:w?void 0:b},te.id))})}),u&&e.jsx("div",{className:"ui-sidebar__footer",children:u}),W&&e.jsx(Xi,{user:p,onLogout:f,onLogin:h,theme:m,onThemeToggle:v,isCollapsed:w?!1:D})]});return e.jsxs(e.Fragment,{children:[e.jsxs("aside",{className:V,style:$,children:[e.jsx(Ie,{icon:D?e.jsx(zn,{}):e.jsx(Pn,{}),"aria-label":D?"Expand sidebar":"Collapse sidebar",size:"small",variant:"outlined",color:"neutral",onClick:T,sx:"ui-sidebar__toggle-btn"}),e.jsx("div",{className:"ui-sidebar__inner",children:be(!1)}),D&&z&&e.jsx("div",{className:["ui-sidebar__popover",!z.children?.length&&"ui-sidebar__popover--label"].filter(Boolean).join(" "),style:z.children?.length?{top:re.current}:{top:ye.current,transform:"translateY(-50%)"},onMouseEnter:()=>I(z.id),onMouseLeave:b,role:z.children?.length?"menu":void 0,children:z.children?.length?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"ui-sidebar__popover-header",children:z.label}),z.children.map(w=>{const te=w.id===S,ie=["ui-sidebar__popover-item",te&&"ui-sidebar__popover-item--active"].filter(Boolean).join(" ");return w.path?e.jsxs("a",{href:w.path,className:ie,"aria-current":te?"page":void 0,role:"menuitem",onClick:he=>{he.button===0&&!he.metaKey&&!he.ctrlKey&&!he.shiftKey&&!he.altKey&&(y&&he.preventDefault(),y?.(w),Q(null))},children:[w.icon&&e.jsx("span",{className:"ui-sidebar__item-icon",children:w.icon}),w.label]},w.id):e.jsxs("button",{type:"button",className:ie,role:"menuitem",onClick:()=>{y?.(w),Q(null)},children:[w.icon&&e.jsx("span",{className:"ui-sidebar__item-icon",children:w.icon}),w.label]},w.id)})]}):e.jsx("span",{children:z.label})})]}),e.jsx(es,{open:i,onClose:r,anchor:"left",width:"100vw",showCloseButton:!1,closeOnEscape:!0,closeOnBackdropClick:!0,trapFocus:!0,sx:"ui-sidebar__mobile-drawer",hideBackdrop:!0,children:e.jsx("div",{className:"ui-sidebar__mobile-inner",children:be(!0)})})]})};wa.displayName="Sidebar";const Os=({children:t,variant:n="sidebar",sidebar:s,header:a,sx:i,style:r})=>{const[l,c]=o.useState(s?.defaultCollapsed??!1),[d,u]=o.useState(!1),p=s?.mobileOpen??d,f=s?.onMobileClose??(()=>u(!1)),h=g=>{c(g),s?.onCollapsedChange?.(g)},m=["ui-layout",`ui-layout--${n}`,i].filter(Boolean).join(" ");if(n==="centered")return e.jsxs("div",{className:m,style:r,children:[a&&e.jsx("header",{className:"ui-layout__centered-header",children:a}),e.jsx("div",{className:"ui-layout__content",children:e.jsx("div",{className:"ui-layout__centered-card",children:t})})]});const v=s?.collapsed!==void 0?s.collapsed:l;return e.jsxs("div",{className:m,style:r,children:[e.jsx("div",{className:["ui-layout__sidebar-area",v&&"ui-layout__sidebar-area--collapsed"].filter(Boolean).join(" "),"aria-hidden":"true"}),s&&e.jsx(wa,{...s,collapsed:s.collapsed!==void 0?s.collapsed:l,onCollapsedChange:h,mobileOpen:p,onMobileClose:f}),e.jsxs("div",{className:"ui-layout__content",children:[e.jsx("div",{className:"ui-layout__mobile-header",children:e.jsx(Ie,{icon:e.jsx(Rr,{}),"aria-label":"Open navigation","aria-expanded":p,variant:"ghost",color:"neutral",size:"medium",onClick:()=>u(!0)})}),e.jsx("main",{className:"ui-layout__main",children:t})]})]})};Os.displayName="Layout";const Na=2;function Qi(t){const n=Math.floor(t/60),s=t%60;return n>0&&s>0?`${n}h ${s}m`:n>0?`${n}h`:`${s} min`}const Ri=()=>e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("polyline",{points:"12 6 12 12 16 14"})]}),Fs=()=>e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M4 19.5A2.5 2.5 0 0 1 6.5 17H20"}),e.jsx("path",{d:"M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"})]}),el=()=>e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),e.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),tl=()=>e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("polygon",{points:"10 8 16 12 10 16 10 8",fill:"currentColor",stroke:"none"})]}),nl=()=>e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),e.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),e.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]}),al=()=>e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"})}),sl=()=>e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"})}),rl=()=>e.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})}),il=({isBookmarked:t,onToggle:n})=>{const[s,a]=o.useState(0),i=r=>{r.preventDefault(),r.stopPropagation(),n&&(a(l=>l+1),n(!t))};return e.jsx("span",{className:`ui-course-card__badge--bookmark-wrap${s>0?" ui-course-card__badge--bookmark-pop":""}`,children:e.jsx(Ie,{icon:t?e.jsx(al,{}):e.jsx(sl,{}),"aria-label":t?"Remove bookmark":"Add bookmark",size:"small",variant:"ghost",sx:"rounded-full",style:{background:"rgba(255, 255, 255, 0.9)",color:"var(--palette-warning-main)",backdropFilter:"blur(4px)",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.2)"},onClick:n?i:void 0,disabled:!n})},s)},ll=({title:t,description:n,imageUrl:s,difficulty:a,durationMinutes:i,lessonCount:r,testCount:l,videoCount:c,presentationCount:d,professions:u,progress:p,rating:f,author:h,isCompleted:m,isDraft:v,isRecommended:g,badgeSlot:_,isBookmarked:y,onBookmarkToggle:N,href:k,target:$,onClick:S,sx:P})=>{const q=["ui-course-card",v?"ui-course-card--draft":"",P||""].filter(Boolean).join(" "),X=u?.length||0,D=Math.max(0,X-Na),T=a&&D>0?Na-1:Na,ee=Math.max(0,X-T),O=ee>0?(u||[]).slice(T).map(Q=>Q.name).join(", "):void 0,ge=i!=null&&i>0||r!=null||l!=null||c!=null&&c>0||d!=null&&d>0;console.log("professions",u),console.log("maxVisible",T),console.log("hiddenCount",ee),console.log("hiddenProfessionNames",O),console.log("author",h),console.log("isCompleted",m),console.log("isDraft",v),console.log("isRecommended",g),console.log("badgeSlot",_);const ue=e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"ui-course-card__image-wrap",children:[s?e.jsx("img",{className:"ui-course-card__image",src:s,alt:t}):e.jsx("div",{className:"ui-course-card__image-placeholder",children:e.jsx(Fs,{})}),n&&e.jsx("div",{className:"ui-course-card__image-overlay",children:e.jsx("p",{className:"ui-course-card__image-overlay-text",children:n})}),(v||m||g||_)&&e.jsxs("div",{className:"ui-course-card__badge-wrap ui-course-card__badge-wrap--top-left",children:[v&&e.jsx(St,{label:"Draft",color:"warning",variant:"filled",size:"small"}),m&&e.jsx(St,{label:"✓ Done",color:"success",variant:"filled",size:"small"}),g&&e.jsx(St,{label:"★ Recommended",color:"info",variant:"filled",size:"small"}),_]}),e.jsx(il,{isBookmarked:!!y,onToggle:N})]}),e.jsxs("div",{className:"ui-course-card__body",children:[e.jsx("h3",{className:"ui-course-card__title",children:t}),(a||u&&u.length>0)&&e.jsxs("div",{className:"ui-course-card__professions",children:[a&&e.jsxs("span",{className:"ui-course-card__difficulty-tag","data-difficulty":a,children:[e.jsxs("span",{className:"ui-course-card__level-bars","aria-hidden":"true",children:[e.jsx("span",{className:"ui-course-card__level-bar"}),e.jsx("span",{className:"ui-course-card__level-bar"}),e.jsx("span",{className:"ui-course-card__level-bar"})]}),a.charAt(0).toUpperCase()+a.slice(1)]}),(u||[]).slice(0,T).map((Q,re)=>e.jsx("span",{className:"ui-course-card__profession-tag",style:Q.color?{"--tag-color":Q.color}:void 0,children:Q.name},re)),ee>0&&e.jsx(Ue,{title:O,placement:"top",children:e.jsxs("span",{className:"ui-course-card__profession-tag ui-course-card__profession-tag--more",children:["+",ee]})})]}),typeof p=="number"&&e.jsxs("div",{className:"ui-course-card__progress",children:[e.jsx("div",{className:"ui-course-card__progress-track",children:e.jsx("div",{className:"ui-course-card__progress-fill",style:{width:`${Math.min(100,Math.max(0,p))}%`}})}),e.jsxs("span",{className:"ui-course-card__progress-value",children:[Math.round(p),"%"]})]}),(f!=null||h||ge)&&e.jsxs("div",{className:"ui-course-card__footer",children:[e.jsxs("div",{className:"ui-course-card__footer-left",children:[f!=null&&e.jsxs("span",{className:"ui-course-card__rating",children:[e.jsx(rl,{}),f.toFixed(1)]}),h&&e.jsxs("span",{className:"ui-course-card__author",children:[h.avatarUrl?e.jsx("img",{className:"ui-course-card__author-avatar",src:h.avatarUrl,alt:h.username}):e.jsx("span",{className:"ui-course-card__author-avatar ui-course-card__author-avatar--placeholder",children:h.username.charAt(0).toUpperCase()}),e.jsx("span",{className:"ui-course-card__author-username",children:h.username})]})]}),e.jsxs("div",{className:"ui-course-card__footer-right",children:[i!=null&&i>0&&e.jsx(Ue,{title:"Duration",placement:"top",children:e.jsxs("span",{className:"ui-course-card__stat-item",children:[e.jsx(Ri,{}),Qi(i)]})}),c!=null&&c>0&&e.jsx(Ue,{title:`${c} video lesson${c!==1?"s":""}`,placement:"top",children:e.jsxs("span",{className:"ui-course-card__stat-item",children:[e.jsx(tl,{}),c]})}),d!=null&&d>0&&e.jsx(Ue,{title:`${d} presentation${d!==1?"s":""}`,placement:"top",children:e.jsxs("span",{className:"ui-course-card__stat-item",children:[e.jsx(nl,{}),d]})}),r!=null&&e.jsx(Ue,{title:`${r} lesson${r!==1?"s":""}`,placement:"top",children:e.jsxs("span",{className:"ui-course-card__stat-item",children:[e.jsx(Fs,{}),r]})}),l!=null&&e.jsx(Ue,{title:`${l} test${l!==1?"s":""}`,placement:"top",children:e.jsxs("span",{className:"ui-course-card__stat-item",children:[e.jsx(el,{}),l]})})]})]})]})]});return k?e.jsx("a",{className:q,href:k,target:$,rel:$==="_blank"?"noopener noreferrer":void 0,onClick:S,"data-difficulty":a,children:ue}):e.jsx("div",{className:q,"data-difficulty":a,onClick:S,role:S?"button":void 0,tabIndex:S?0:void 0,children:ue})},Gt=2;function ol(t){const n=Math.floor(t/60),s=t%60;return n>0&&s>0?`${n}h ${s}m`:n>0?`${n}h`:`${s} min`}const cl=()=>e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("polyline",{points:"12 6 12 12 16 14"})]}),dl=()=>e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),e.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),ul=()=>e.jsxs("svg",{width:"36",height:"36",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M4 19.5A2.5 2.5 0 0 1 6.5 17H20"}),e.jsx("path",{d:"M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"})]}),hl=()=>e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"})}),pl=()=>e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"})}),ml=()=>e.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})}),fl=({isBookmarked:t,onToggle:n})=>{const[s,a]=o.useState(0),i=r=>{r.preventDefault(),r.stopPropagation(),n&&(a(l=>l+1),n(!t))};return e.jsx("span",{className:`ui-lesson-card__badge--bookmark-wrap${s>0?" ui-lesson-card__badge--bookmark-pop":""}`,children:e.jsx(Ie,{icon:t?e.jsx(hl,{}):e.jsx(pl,{}),"aria-label":t?"Remove bookmark":"Add bookmark",size:"small",variant:"ghost",sx:"rounded-full",style:{background:"rgba(255, 255, 255, 0.9)",color:"var(--palette-warning-main)",backdropFilter:"blur(4px)",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.2)"},onClick:n?i:void 0,disabled:!n})},s)},_l=({title:t,description:n,imageUrl:s,type:a,contentType:i,durationMinutes:r,author:l,module:c,course:d,skills:u,professions:p,testCount:f,rating:h,isBookmarked:m,onBookmarkToggle:v,isCompleted:g,isDraft:_,isRecommended:y,badgeSlot:N,href:k,target:$,onClick:S,customButtons:P,sx:q})=>{const X=["ui-lesson-card",_?"ui-lesson-card--draft":"",q||""].filter(Boolean).join(" "),D=(p?.length||0)-Gt,T=D>0?(p||[]).slice(Gt).map(Q=>Q.name).join(", "):void 0,ee=(u?.length||0)-Gt,O=ee>0?(u||[]).slice(Gt).join(", "):void 0,ge=r!=null&&r>0||f!=null||!!l,ue=e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"ui-lesson-card__image-wrap",children:[s?e.jsx("img",{className:"ui-lesson-card__image",src:s,alt:t}):e.jsx("div",{className:"ui-lesson-card__image-placeholder",children:e.jsx(ul,{})}),n&&e.jsx("div",{className:"ui-lesson-card__image-overlay",children:e.jsx("p",{className:"ui-lesson-card__image-overlay-text",children:n})}),(_||g||y||N)&&e.jsxs("div",{className:"ui-lesson-card__badge-wrap ui-lesson-card__badge-wrap--top-left",children:[_&&e.jsx(St,{label:"Draft",color:"warning",variant:"filled",size:"small"}),g&&e.jsx(St,{label:"✓ Done",color:"success",variant:"filled",size:"small"}),y&&e.jsx(St,{label:"★ Recommended",color:"info",variant:"filled",size:"small"}),N]}),e.jsx(fl,{isBookmarked:!!m,onToggle:v})]}),e.jsxs("div",{className:"ui-lesson-card__body",children:[e.jsx("h3",{className:"ui-lesson-card__title",children:t}),(a||i&&i!=="standard"||p&&p.length>0||u&&u.length>0)&&e.jsxs("div",{className:"ui-lesson-card__chips-row",children:[a&&e.jsx("span",{className:"ui-lesson-card__type-chip","data-type":a.toLowerCase(),children:a}),i&&i!=="standard"&&e.jsx("span",{className:"ui-lesson-card__type-chip ui-lesson-card__type-chip--content",children:i}),(p||[]).slice(0,Gt).map((Q,re)=>e.jsx("span",{className:"ui-lesson-card__profession-chip",style:Q.color?{"--chip-accent":Q.color}:void 0,children:Q.name},re)),D>0&&e.jsx(Ue,{title:T,placement:"top",children:e.jsxs("span",{className:"ui-lesson-card__profession-chip ui-lesson-card__profession-chip--more",children:["+",D]})}),(u||[]).slice(0,Gt).map((Q,re)=>e.jsx("span",{className:"ui-lesson-card__skill-chip",children:Q},re)),ee>0&&e.jsx(Ue,{title:O,placement:"top",children:e.jsxs("span",{className:"ui-lesson-card__skill-chip ui-lesson-card__skill-chip--more",children:["+",ee]})})]}),(h!=null||l||ge||P)&&e.jsxs("div",{className:"ui-lesson-card__footer",children:[e.jsxs("div",{className:"ui-lesson-card__footer-left",children:[h!=null&&e.jsxs("span",{className:"ui-lesson-card__rating",children:[e.jsx(ml,{}),h.toFixed(1)]}),l&&e.jsxs("span",{className:"ui-lesson-card__author",children:[l.avatarUrl?e.jsx("img",{className:"ui-lesson-card__author-avatar",src:l.avatarUrl,alt:l.username}):e.jsx("span",{className:"ui-lesson-card__author-avatar ui-lesson-card__author-avatar--placeholder",children:l.username.charAt(0).toUpperCase()}),e.jsx("span",{className:"ui-lesson-card__author-username",children:l.username})]})]}),e.jsxs("div",{className:"ui-lesson-card__footer-right",children:[r!=null&&r>0&&e.jsx(Ue,{title:"Duration",placement:"top",children:e.jsxs("span",{className:"ui-lesson-card__stat-item",children:[e.jsx(cl,{}),ol(r)]})}),f!=null&&e.jsx(Ue,{title:`${f} test${f!==1?"s":""}`,placement:"top",children:e.jsxs("span",{className:"ui-lesson-card__stat-item",children:[e.jsx(dl,{}),f]})}),P&&e.jsx("span",{onClick:Q=>Q.stopPropagation(),children:P})]})]}),(c||d)&&e.jsxs("div",{className:"ui-lesson-card__context",children:[c&&e.jsx(Ue,{title:"Module",placement:"top",children:e.jsx("span",{className:"ui-lesson-card__context-item",children:c})}),d&&e.jsx(Ue,{title:"Course",placement:"top",children:e.jsx("span",{className:"ui-lesson-card__context-item",children:d})})]})]})]});return k?e.jsx("a",{className:X,href:k,target:$,rel:$==="_blank"?"noopener noreferrer":void 0,onClick:S,children:ue}):e.jsx("div",{className:X,onClick:S,role:S?"button":void 0,tabIndex:S?0:void 0,children:ue})},gl="#6366f1",xl="done",vl=t=>{const n=t instanceof Date?t:new Date(t);if(Number.isNaN(n.getTime()))return"";const s=String(n.getDate()).padStart(2,"0"),a=String(n.getMonth()+1).padStart(2,"0");return`${s}.${a}`},bl=()=>e.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),e.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),jl=()=>e.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[e.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),yl=()=>e.jsx("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:e.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}),kl=()=>e.jsx("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:e.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"})}),wl=()=>e.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[e.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),e.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),e.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),e.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),Nl=()=>e.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[e.jsx("polyline",{points:"9 11 12 14 22 4"}),e.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]}),Cl=()=>e.jsx("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:e.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),Ml=()=>e.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[e.jsx("path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"}),e.jsx("line",{x1:"4",y1:"22",x2:"4",y2:"15"})]}),Vs=t=>t.user?.name||t.user?.fullName||String(t.user_id),Ys=(t,{role:n,shape:s,color:a})=>{const i=t.slice(3).map(Vs);return e.jsx(va,{max:4,total:t.length,size:"small",spacing:"small",shape:s,surplusColor:"primary",renderSurplus:r=>e.jsx(Ue,{title:i.join(", "),placement:"top",children:e.jsx(Pt,{size:"small",shape:s,color:"primary",fallback:e.jsxs("span",{className:"ui-avatar-group__surplus-text",children:["+",r]})})}),children:t.map(r=>{const l=Vs(r);return e.jsx(Ue,{title:l,placement:"top",children:e.jsx(Pt,{name:l,size:"small",src:r.user?.avatar,alt:`${n}: ${l}`,color:a??"primary",referrerPolicy:"no-referrer"})},r.user_id)})})},Ws=({task:t,onClick:n,statusInfo:s,formatDate:a,isDragging:i=!1,dragHandleProps:r,sx:l})=>{const c=!!t._pending,d=t.priority||"low",u=a??vl,p=t.is_done??t.status===xl,f=(()=>{if(!t.due_date||p)return!1;const O=new Date(t.due_date);return O.setHours(23,59,59,999),O<new Date})(),h=t.labels||[],m=t.assignees||[],v=t.controllers||[],g=m.length>0||v.length>0,_=t._commentCount??0,y=t._attachmentCount??0,N=t._activeSessions??0,k=t._subtaskCount??0,$=t._completedSubtaskCount,S=k>0&&$===k,P=!!t.start_date||!!t.due_date,q=P||N>0||k>0||_>0||y>0,X=["ui-task-card",c&&"ui-task-card--pending",i&&"ui-task-card--dragging",l].filter(Boolean).join(" "),D=()=>{c||i||n?.()},T=c?void 0:r?.attributes,ee=c?void 0:r?.listeners;return e.jsxs("div",{ref:r?.ref,role:n?"button":void 0,tabIndex:n&&!c?0:void 0,"aria-busy":c||void 0,"data-priority":d,className:X,onClick:D,...T,...ee,children:[e.jsxs("div",{className:"ui-task-card__title-row",children:[e.jsx("p",{className:"ui-task-card__title",children:t.title}),s&&e.jsx(mt,{size:"small",label:s.label,sx:"ui-task-card__status",style:{backgroundColor:s.color||"#6B7280",color:"#fff",borderColor:"transparent"}})]}),(t.project?.name||t.milestone?.name)&&e.jsxs("div",{className:"ui-task-card__row ui-task-card__context",title:[t.project?.name,t.milestone?.name].filter(Boolean).join(" · "),children:[t.project?.name&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"ui-task-card__project-dot",style:{backgroundColor:t.project.color||"currentColor"},"aria-hidden":"true"}),e.jsx("span",{className:"ui-task-card__context-project",children:t.project.name})]}),t.project?.name&&t.milestone?.name&&e.jsx("span",{className:"ui-task-card__context-sep","aria-hidden":"true",children:"·"}),t.milestone?.name&&e.jsxs(e.Fragment,{children:[!t.project?.name&&e.jsx("span",{className:"ui-task-card__row-icon","aria-hidden":"true",children:e.jsx(Ml,{})}),e.jsx("span",{className:"ui-task-card__context-milestone",children:t.milestone.name})]})]}),g&&e.jsxs("div",{className:"ui-task-card__people",children:[m.length>0&&Ys(m,{role:"Assignee",color:"primary"}),v.length>0&&e.jsxs("span",{className:"ui-task-card__controllers",title:"Controllers",children:[e.jsx("span",{className:"ui-task-card__row-icon",children:e.jsx(jl,{})}),Ys(v,{role:"Controller",shape:"square",color:"warning"})]})]}),h.length>0&&e.jsx("div",{className:"ui-task-card__labels",children:h.map(O=>e.jsx(mt,{size:"small",label:O.name,style:{backgroundColor:O.color||gl,color:"#fff",borderColor:"transparent"}},O.id))}),q&&e.jsxs("div",{className:"ui-task-card__footer",children:[e.jsx("div",{className:"ui-task-card__footer-left",children:P&&e.jsxs("span",{className:f?"ui-task-card__due ui-task-card__due--overdue":"ui-task-card__due",title:[t.start_date&&`Start: ${u(t.start_date)}`,t.due_date&&`Due: ${u(t.due_date)}`].filter(Boolean).join(" · "),children:[e.jsx("span",{className:"ui-task-card__row-icon",children:f?e.jsx(bl,{}):e.jsx(wl,{})}),t.start_date&&t.due_date?e.jsxs(e.Fragment,{children:[u(t.start_date),e.jsx("span",{className:"ui-task-card__due-arrow","aria-hidden":"true",children:"→"}),u(t.due_date)]}):t.due_date?u(t.due_date):t.start_date?e.jsxs(e.Fragment,{children:[u(t.start_date),e.jsx("span",{className:"ui-task-card__due-arrow","aria-hidden":"true",children:"→"})]}):null]})}),e.jsxs("div",{className:"ui-task-card__footer-right",children:[N>0&&e.jsxs("span",{className:"ui-task-card__active",title:N===1?"1 person is working on this now":`${N} people are working on this now`,children:[e.jsx("span",{className:"ui-task-card__row-icon ui-task-card__active-icon",children:e.jsx(Cl,{})}),N>1&&N]}),k>0&&e.jsxs("span",{className:S?"ui-task-card__count ui-task-card__count--done":"ui-task-card__count",title:$!==void 0?`${$} of ${k} subtasks done`:`${k} subtask${k===1?"":"s"}`,children:[e.jsx("span",{className:"ui-task-card__row-icon",children:e.jsx(Nl,{})}),$!==void 0?`${$}/${k}`:k]}),_>0&&e.jsxs("span",{className:"ui-task-card__count",children:[e.jsx("span",{className:"ui-task-card__row-icon",children:e.jsx(yl,{})}),_]}),y>0&&e.jsxs("span",{className:"ui-task-card__count",children:[e.jsx("span",{className:"ui-task-card__row-icon",children:e.jsx(kl,{})}),y]})]})]})]})};Ws.displayName="TaskCard";function _t(t){return!!t.endDate&&t.endDate>t.date}function Ks(t,n){const s=t.endDate&&t.endDate>t.date?t.endDate:t.date;return t.date<=n&&n<=s}const Dl={label:"",short:"",icon:"📅",color:"#718096",bg:"rgba(113,128,150,0.10)"};function $t(t,n){return n[t]??{...Dl,label:t,short:t}}function _n(t,n){return t.title?t.title:$t(t.category,n??{}).label||t.category}function Lt(t){const n=t.getFullYear(),s=String(t.getMonth()+1).padStart(2,"0"),a=String(t.getDate()).padStart(2,"0");return`${n}-${s}-${a}`}function Sl(t){const[n,s,a]=t.split("-").map(Number);return new Date(n,s-1,a)}function Us(t){const n=t.getDay(),s=n===0?-6:1-n,a=new Date(t);return a.setDate(t.getDate()+s),a.setHours(0,0,0,0),a}const Gs=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],qt=["January","February","March","April","May","June","July","August","September","October","November","December"];function qs(t){return t.type==="daterange"?{start:null,end:null}:t.type==="select"&&!t.multiple?null:[]}function El(t,n){if(!t.type||t.type==="pills")return Array.isArray(n)?n.length:0;if(t.type==="select")return Array.isArray(n)?n.length:n!==null&&n!==""?1:0;if(t.type==="daterange"){const s=n;return s?.start||s?.end?1:0}return 0}const Xs=({isOpen:t,onClose:n,sections:s,value:a,onChange:i,onReset:r,renderBody:l})=>{function c(h,m){i({...a,[h]:m})}function d(h,m){const v=a[h]??[],g=v.includes(m)?v.filter(_=>_!==m):[...v,m];i({...a,[h]:g})}function u(){r()}const p=l?0:s.reduce((h,m)=>h+El(m,a[m.id]??qs(m)),0),f=`ui-calendar__filter${t?" ui-calendar__filter--open":""}`;return e.jsx("aside",{className:f,"aria-label":"Filters","aria-hidden":!t,children:e.jsxs("div",{className:"ui-cal-filter",children:[e.jsxs("div",{className:"ui-cal-filter__header",children:[e.jsxs("span",{className:"ui-cal-filter__title",children:["Filters",p>0?e.jsx("span",{className:"ui-cal-filter__count",children:p}):null]}),e.jsx(Ie,{icon:e.jsx(jt,{}),"aria-label":"Close filters",onClick:n,variant:"ghost",color:"neutral",size:"small",style:{borderRadius:"var(--radius-sm)"}})]}),e.jsx("div",{className:"ui-cal-filter__body",children:l?l():s.map(h=>e.jsxs("div",{className:"ui-cal-filter__section",children:[e.jsx("div",{className:"ui-cal-filter__section-title",children:h.title}),$l(h,a[h.id]??qs(h),d,c)]},h.id))}),e.jsx("div",{className:"ui-cal-filter__footer",children:e.jsx(Ze,{variant:"outlined",color:"neutral",size:"small",style:{flex:1},onClick:u,children:"Reset all"})})]})})};Xs.displayName="CalendarFilterPanel";function $l(t,n,s,a){if(t.type==="select")return t.searchable?e.jsx(Qn,{options:t.options,value:n,onChange:r=>a(t.id,r),multiple:t.multiple,placeholder:t.placeholder,clearable:t.clearable,fullWidth:!0}):e.jsx(Ln,{options:t.options,value:n,onChange:r=>a(t.id,r),multiple:t.multiple,placeholder:t.placeholder,clearable:t.clearable,fullWidth:!0});if(t.type==="daterange")return e.jsx(la,{mode:"range",rangeValue:n,onRangeChange:r=>a(t.id,r),minDate:t.minDate,maxDate:t.maxDate,triggerVariant:"input",multiMonth:!1});const i=n??[];return e.jsx("div",{className:"ui-cal-filter__pills",children:t.options.map(r=>e.jsx(mt,{label:r.label,variant:"outlined",color:"neutral",size:"small",selected:i.includes(r.value),onClick:()=>{t.multiple===!1?a(t.id,i.includes(r.value)?[]:[r.value]):s(t.id,r.value)}},r.value))})}const Ll=[{id:"month",label:"Month"},{id:"week",label:"Week"},{id:"day",label:"Day"}],Yn={borderRadius:"var(--radius-sm)"};function Tl(t,n,s,a,i){if(t==="month")return`${qt[s]} ${n}`;if(t==="week"&&a){const r=new Date(a);return r.setDate(a.getDate()+6),a.getMonth()===r.getMonth()?`${qt[a.getMonth()]} ${a.getDate()}–${r.getDate()}, ${a.getFullYear()}`:`${qt[a.getMonth()]} ${a.getDate()} – ${qt[r.getMonth()]} ${r.getDate()}, ${r.getFullYear()}`}if(t==="day"&&i){const[r,l,c]=i.split("-").map(Number);return new Date(r,l-1,c).toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric"})}return`${qt[s]} ${n}`}const Zs=({view:t,year:n,month:s,weekStart:a,dayDate:i,onViewChange:r,onPrev:l,onNext:c,onToday:d,onSearch:u,onFilter:p,onAdd:f,showSearch:h,showFilters:m,showAdd:v,filterOpen:g})=>{const _=Tl(t,n,s,a,i);return e.jsxs("div",{className:"ui-calendar__header",children:[e.jsxs("div",{className:"ui-calendar__nav",children:[e.jsx(Ie,{icon:e.jsx(Pn,{}),"aria-label":"Previous",onClick:l,variant:"outlined",color:"neutral",size:"small",style:Yn}),e.jsx("button",{className:"ui-calendar__today-btn",onClick:d,children:"Today"}),e.jsx(Ie,{icon:e.jsx(zn,{}),"aria-label":"Next",onClick:c,variant:"outlined",color:"neutral",size:"small",style:Yn})]}),e.jsx("div",{className:"ui-calendar__title",children:_}),e.jsx("div",{className:"ui-calendar__view-switcher",role:"group","aria-label":"Calendar view",children:Ll.map(({id:y,label:N})=>e.jsx("button",{className:`ui-calendar__view-btn${t===y?" ui-calendar__view-btn--active":""}`,onClick:()=>r(y),"aria-pressed":t===y,children:N},y))}),e.jsxs("div",{className:"ui-calendar__actions",children:[h&&e.jsx(Ie,{icon:e.jsx(Pr,{}),"aria-label":"Search (Ctrl+K)",onClick:u,variant:"outlined",color:"neutral",size:"small",style:Yn,title:"Search (Ctrl+K)"}),m&&e.jsx(Ie,{icon:e.jsx(Ur,{}),"aria-label":"Filters",onClick:p,variant:g?"filled":"outlined",color:"neutral",size:"small",style:Yn,"aria-pressed":g}),v&&e.jsx(Ze,{variant:"filled",color:"primary",size:"small",onClick:f,"aria-label":"Add event",children:"+ New"})]})]})};Zs.displayName="CalendarHeader";const gn=({event:t,compact:n=!1,categoryMeta:s,onClick:a})=>{const i=$t(t.category,s),r=i.variant==="icon",l=_n(t,s),c={"--cal-event-color":i.color,"--cal-event-bg":i.bg},d=["ui-calendar-event",r?"ui-calendar-event--celebration":"",t.urgent?"ui-calendar-event--urgent":""].filter(Boolean).join(" ");return e.jsxs("div",{className:d,style:c,onClick:u=>{u.stopPropagation(),a(t)},role:"button",tabIndex:0,onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),a(t))},title:l,children:[r?e.jsx("span",{className:"ui-calendar-event__icon",children:i.icon}):e.jsx("span",{className:"ui-calendar-event__bar"}),e.jsxs("div",{className:"ui-calendar-event__content",children:[e.jsx("div",{className:"ui-calendar-event__name",children:l}),!n&&t.time&&e.jsxs("div",{className:"ui-calendar-event__meta",children:[t.time,t.duration?` · ${t.duration}m`:""]})]})]})};gn.displayName="CalendarEventCard";const Wn=({event:t,categoryMeta:n,continuesLeft:s,continuesRight:a,onClick:i})=>{const r=$t(t.category,n),l=_n(t,n),c={"--cal-event-color":r.color,"--cal-event-bg":r.bg},d=["ui-calendar-range",s?"ui-calendar-range--continues-left":"",a?"ui-calendar-range--continues-right":"",t.urgent?"ui-calendar-range--urgent":""].filter(Boolean).join(" ");return e.jsxs("div",{className:d,style:c,onClick:u=>{u.stopPropagation(),i(t)},role:"button",tabIndex:0,onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),i(t))},title:l,children:[s&&e.jsx("span",{className:"ui-calendar-range__chevron ui-calendar-range__chevron--left","aria-hidden":!0,children:"‹"}),e.jsx("span",{className:"ui-calendar-range__title",children:l}),a&&e.jsx("span",{className:"ui-calendar-range__chevron ui-calendar-range__chevron--right","aria-hidden":!0,children:"›"})]})};Wn.displayName="CalendarRangeBar";function Js(t,n){if(n.length!==7)return{bars:[],laneCount:0};const s=Lt(n[0]),a=Lt(n[6]),r=t.filter(d=>_t(d)?d.date<=a&&d.endDate>=s:!1).slice().sort((d,u)=>{if(d.date!==u.date)return d.date<u.date?-1:1;const p=Rs(d.date,d.endDate),f=Rs(u.date,u.endDate);return p!==f?f-p:d.id<u.id?-1:d.id>u.id?1:0}),l=[],c=[];for(const d of r){const u=d.date<s?0:Qs(d.date,n),p=d.endDate>a?6:Qs(d.endDate,n);if(u<0||p<0||p<u)continue;let f=l.findIndex(h=>h.every(m=>m.endCol<u));f===-1&&(f=l.length,l.push([])),l[f].push({endCol:p}),c.push({event:d,startCol:u,endCol:p,lane:f,continuesLeft:d.date<s,continuesRight:d.endDate>a})}return{bars:c,laneCount:l.length}}function Qs(t,n){for(let s=0;s<n.length;s++)if(Lt(n[s])===t)return s;return-1}function Rs(t,n){const[s,a,i]=t.split("-").map(Number),[r,l,c]=n.split("-").map(Number),d=new Date(s,a-1,i).getTime(),u=new Date(r,l-1,c).getTime();return Math.round((u-d)/864e5)+1}const Al=3,Ca=3,er=({events:t,year:n,month:s,today:a,categoryMeta:i,renderEvent:r,onEventClick:l,onDayClick:c})=>{const d=Il(n,s),u=o.useMemo(()=>{const p={};for(const f of t)_t(f)||(p[f.date]||(p[f.date]=[]),p[f.date].push(f));return p},[t]);return e.jsxs("div",{className:"ui-calendar-month",children:[e.jsx("div",{className:"ui-calendar-month__weekdays",children:Gs.map(p=>e.jsx("div",{className:"ui-calendar-month__weekday",children:p},p))}),e.jsx("div",{className:"ui-calendar-month__grid",children:d.map((p,f)=>{const{bars:h,laneCount:m}=Js(t,p.map($=>$.date)),v=h.filter($=>$.lane<Ca),g=h.filter($=>$.lane>=Ca),_=Math.min(m,Ca),y=_*tr,N=Math.max(1,Al-_),k=Array(7).fill(0);for(const $ of g)for(let S=$.startCol;S<=$.endCol;S++)k[S]+=1;return e.jsxs("div",{className:"ui-calendar-month__row",children:[p.map(($,S)=>{const P=Lt($.date),q=P===a,X=$.date.getDay()===0||$.date.getDay()===6,D=u[P]??[],T=k[S],O=D.length>N||T>0?Math.max(0,N-1):N,ge=D.slice(0,O),ue=D.length-ge.length+T,Q=["ui-calendar-month__cell",$.outside?"ui-calendar-month__cell--outside":"",q?"ui-calendar-month__cell--today":"",X?"ui-calendar-month__cell--weekend":""].filter(Boolean).join(" ");return e.jsxs("div",{className:Q,onClick:()=>c(P),children:[e.jsx("div",{className:"ui-calendar-month__date",children:$.date.getDate()}),e.jsx("div",{className:"ui-calendar-month__events",style:y?{marginTop:y+4}:void 0,children:ge.map(re=>e.jsx(o.Fragment,{children:r?r(re,!0):e.jsx(gn,{event:re,compact:!0,categoryMeta:i,onClick:l})},re.id))}),ue>0&&e.jsxs("button",{type:"button",className:"ui-calendar-month__more",onClick:re=>{re.stopPropagation(),c(P)},children:["+",ue]})]},P)}),v.length>0&&e.jsx("div",{className:"ui-calendar-month__ranges",style:{height:y},children:v.map($=>{const S=$.startCol/7*100,P=($.endCol-$.startCol+1)/7*100;return e.jsx("div",{className:"ui-calendar-month__range-slot",style:{left:`${S}%`,width:`${P}%`,top:$.lane*tr},children:e.jsx(Wn,{event:$.event,categoryMeta:i,continuesLeft:$.continuesLeft,continuesRight:$.continuesRight,onClick:l})},$.event.id)})})]},f)})})]})};er.displayName="MonthView";const tr=20;function Il(t,n){const s=new Date(t,n,1),a=s.getDay(),i=a===0?6:a-1,r=new Date(s);r.setDate(1-i);const l=[];for(let c=0;c<6;c++){const d=[];for(let u=0;u<7;u++){const p=new Date(r);p.setDate(r.getDate()+c*7+u),d.push({date:p,outside:p.getMonth()!==n})}l.push(d)}return l}const nr=22,ar=({events:t,weekStart:n,today:s,categoryMeta:a,renderEvent:i,onEventClick:r,onDayClick:l})=>{const c=Pl(n),d=o.useMemo(()=>{const f={};for(const h of t)_t(h)||(f[h.date]||(f[h.date]=[]),f[h.date].push(h));return f},[t]),{bars:u,laneCount:p}=o.useMemo(()=>Js(t,c),[t,c]);return e.jsxs("div",{className:"ui-calendar-week",children:[e.jsx("div",{className:"ui-calendar-week__header",children:c.map((f,h)=>{const m=Lt(f)===s,v=f.getDay()===0||f.getDay()===6,g=["ui-calendar-week__day-header",m?"ui-calendar-week__day-header--today":"",v?"ui-calendar-week__day-header--weekend":""].filter(Boolean).join(" ");return e.jsxs("div",{className:g,children:[e.jsx("div",{className:"ui-calendar-week__day-name",children:Gs[h]}),e.jsx("div",{className:"ui-calendar-week__day-num",children:f.getDate()})]},h)})}),u.length>0&&e.jsx("div",{className:"ui-calendar-week__allday",style:{height:p*nr+8},children:u.map(f=>{const h=f.startCol/7*100,m=(f.endCol-f.startCol+1)/7*100;return e.jsx("div",{className:"ui-calendar-week__range-slot",style:{left:`calc(${h}% + 4px)`,width:`calc(${m}% - 8px)`,top:4+f.lane*nr},children:e.jsx(Wn,{event:f.event,categoryMeta:a,continuesLeft:f.continuesLeft,continuesRight:f.continuesRight,onClick:r})},f.event.id)})}),e.jsx("div",{className:"ui-calendar-week__columns",children:c.map((f,h)=>{const m=Lt(f),v=f.getDay()===0||f.getDay()===6,g=d[m]??[],_=["ui-calendar-week__col",v?"ui-calendar-week__col--weekend":""].filter(Boolean).join(" ");return e.jsx("div",{className:_,onClick:()=>l(m),children:g.map(y=>e.jsx(o.Fragment,{children:i?i(y,!1):e.jsx(gn,{event:y,categoryMeta:a,onClick:r})},y.id))},h)})})]})};ar.displayName="WeekView";function Pl(t){return Array.from({length:7},(n,s)=>{const a=new Date(t);return a.setDate(t.getDate()+s),a})}const Ma=7,sr=Array.from({length:21-Ma},(t,n)=>Ma+n),zl=60,rr=({events:t,date:n,categoryMeta:s,renderEvent:a,onEventClick:i})=>{const r=t.filter(p=>_t(p)&&Ks(p,n)),l=t.filter(p=>!_t(p)&&p.date===n),c=l.filter(p=>p.time),d=l.filter(p=>!p.time),u=r.length>0||d.length>0;return e.jsxs("div",{className:"ui-calendar-day",children:[u&&e.jsxs("div",{className:"ui-calendar-day__allday",children:[e.jsx("span",{className:"ui-calendar-day__allday-label",children:"All day"}),r.map(p=>e.jsx("div",{className:"ui-calendar-day__range-slot",children:e.jsx(Wn,{event:p,categoryMeta:s,continuesLeft:p.date<n,continuesRight:p.endDate>n,onClick:i})},p.id)),d.map(p=>e.jsx(o.Fragment,{children:a?a(p,!0):e.jsx(gn,{event:p,compact:!0,categoryMeta:s,onClick:i})},p.id))]}),e.jsxs("div",{className:"ui-calendar-day__time-grid",children:[e.jsx("div",{className:"ui-calendar-day__hours",children:sr.map(p=>e.jsxs("div",{className:"ui-calendar-day__hour-label",children:[String(p).padStart(2,"0"),":00"]},p))}),e.jsxs("div",{className:"ui-calendar-day__slots",style:{position:"relative"},children:[sr.map(p=>e.jsx("div",{className:"ui-calendar-day__slot"},p)),e.jsx("div",{className:"ui-calendar-day__events",children:c.map(p=>{const{top:f,height:h}=Hl(p,Ma,zl),m=$t(p.category,s);return e.jsx("div",{className:"ui-calendar-day__timed-event",style:{top:f,minHeight:Math.max(h,32),"--cal-event-color":m.color,"--cal-event-bg":m.bg},onClick:()=>i(p),children:a?a(p,!1):e.jsx(gn,{event:p,categoryMeta:s,onClick:i})},p.id)})})]})]})]})};rr.displayName="DayView";function Hl(t,n,s){const[a,i]=(t.time??"08:00").split(":").map(Number),l=((a-n)*60+i)/60*s,d=(t.duration??60)/60*s;return{top:l,height:d}}function Bl(t,n){const[s,a,i]=t.split("-").map(Number),l=new Date(s,a-1,i).toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"});return n?`${l} at ${n}`:l}function Ol(t,n){const[s,a,i]=t.split("-").map(Number),[r,l,c]=n.split("-").map(Number),d=new Date(s,a-1,i),u=new Date(r,l-1,c),p=s===r,f=d.toLocaleDateString("en-US",{month:"short",day:"numeric",year:p?void 0:"numeric"}),h=u.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return`${f} – ${h}`}function Fl(t,n){const s=_t(t),a=_t(n);if(s!==a)return s?-1:1;if(s&&a)return t.date!==n.date?t.date<n.date?-1:1:t.endDate!==n.endDate?t.endDate>n.endDate?-1:1:t.id<n.id?-1:t.id>n.id?1:0;const i=(t.time??"").localeCompare(n.time??"");return i!==0?i:t.id<n.id?-1:t.id>n.id?1:0}function Vl(t,n){const[s,a,i]=t.split("-").map(Number),[r,l,c]=n.split("-").map(Number),d=new Date(s,a-1,i).getTime(),u=new Date(r,l-1,c).getTime();return Math.round((u-d)/864e5)+1}function Yl(t){const[n,s,a]=t.split("-").map(Number);return`${new Date(n,s-1,a).toLocaleDateString("en-US",{weekday:"long"})}, ${qt[s-1]} ${a}`}const ir=({event:t,dayDate:n,dayEvents:s,isOpen:a,categoryMeta:i,renderSidebarDetail:r,renderSidebarItem:l,onClose:c,onBack:d,onEventClick:u,onEdit:p,onDelete:f})=>{const h=`ui-calendar__sidebar${a?" ui-calendar__sidebar--open":""}`,m=()=>t?e.jsx(Kl,{event:t,categoryMeta:i,renderSidebarDetail:r,onClose:c,onBack:d,onEdit:p,onDelete:f}):n?e.jsx(Wl,{dayDate:n,events:s,categoryMeta:i,renderSidebarItem:l,onClose:c,onEventClick:u}):e.jsxs("div",{className:"ui-calendar__sidebar-body",style:{alignItems:"center",justifyContent:"center",color:"var(--cal-text2)"},children:[e.jsx("span",{style:{fontSize:32},children:"📋"}),e.jsx("span",{style:{fontSize:13},children:"Select an event to see details"})]});return e.jsx("aside",{className:h,"aria-label":"Event details",children:e.jsx("div",{className:"ui-calendar__sidebar-inner",children:m()})})};ir.displayName="CalendarSidebar";const Wl=({dayDate:t,events:n,categoryMeta:s,renderSidebarItem:a,onClose:i,onEventClick:r})=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"ui-calendar__sidebar-header",children:[e.jsxs("div",{className:"ui-calendar__sidebar-meta",style:{flex:1},children:[e.jsx("div",{className:"ui-calendar__sidebar-title",children:Yl(t)}),e.jsx("div",{className:"ui-calendar__sidebar-subtitle",style:{color:"var(--cal-text2)"},children:n.length===0?"No events":`${n.length} event${n.length>1?"s":""}`})]}),e.jsx(Ie,{icon:e.jsx(jt,{}),"aria-label":"Close sidebar",onClick:i,variant:"ghost",color:"neutral",size:"small",style:{borderRadius:"var(--radius-sm)"}})]}),e.jsx("div",{className:"ui-calendar__sidebar-body",children:n.length===0?e.jsxs("div",{className:"ui-calendar__sidebar-empty",children:[e.jsx("span",{style:{fontSize:28},children:"📅"}),e.jsx("span",{children:"No events this day"})]}):e.jsx("div",{className:"ui-calendar__sidebar-day-list",children:n.slice().sort(Fl).map(l=>{const c=$t(l.category,s);return e.jsx("button",{className:"ui-calendar__sidebar-day-item",style:{"--cal-event-color":c.color,"--cal-event-bg":c.bg},onClick:()=>r(l),children:a?a(l):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"ui-calendar__sidebar-day-item-bar"}),e.jsxs("div",{className:"ui-calendar__sidebar-day-item-body",children:[e.jsx("span",{className:"ui-calendar__sidebar-day-item-title",children:_n(l,s)}),e.jsxs("span",{className:"ui-calendar__sidebar-day-item-meta",children:[e.jsx("span",{style:{color:c.color},children:c.label}),l.time&&e.jsxs("span",{children:[" · ",l.time,l.duration?` (${l.duration} min)`:""]})]})]}),e.jsx("span",{className:"ui-calendar__sidebar-day-item-arrow",children:"›"})]})},l.id)})})})]}),Kl=({event:t,categoryMeta:n,renderSidebarDetail:s,onClose:a,onBack:i,onEdit:r,onDelete:l})=>{const c=$t(t.category,n),d=c.variant==="icon",u=_n(t,n),p=c.icon??c.label[0]?.toUpperCase()??"?";return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"ui-calendar__sidebar-header",children:[e.jsx("div",{className:"ui-calendar__sidebar-avatar",style:d?{background:c.bg,fontSize:20}:{background:c.bg,color:c.color},children:p}),e.jsxs("div",{className:"ui-calendar__sidebar-meta",children:[e.jsx("div",{className:"ui-calendar__sidebar-title",title:u,children:u}),e.jsx("div",{className:"ui-calendar__sidebar-subtitle",children:e.jsx("span",{style:{color:c.color},children:c.label})})]}),e.jsxs("div",{style:{display:"flex",gap:2},children:[i&&e.jsx(Ie,{icon:e.jsx(Gr,{}),"aria-label":"Back to day list",title:"Back to events",onClick:i,variant:"ghost",color:"neutral",size:"small",style:{borderRadius:"var(--radius-sm)"}}),e.jsx(Ie,{icon:e.jsx(jt,{}),"aria-label":"Close sidebar",onClick:a,variant:"ghost",color:"neutral",size:"small",style:{borderRadius:"var(--radius-sm)"}})]})]}),e.jsx("div",{className:"ui-calendar__sidebar-body",children:s?s(t):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"ui-calendar__sidebar-section",children:[e.jsx("div",{className:"ui-calendar__sidebar-section-title",children:"When & Where"}),_t(t)?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"ui-calendar__sidebar-row",children:[e.jsx("span",{className:"ui-calendar__sidebar-row-label",children:"Dates"}),e.jsx("span",{className:"ui-calendar__sidebar-row-value",children:Ol(t.date,t.endDate)})]}),e.jsxs("div",{className:"ui-calendar__sidebar-row",children:[e.jsx("span",{className:"ui-calendar__sidebar-row-label",children:"Length"}),e.jsxs("span",{className:"ui-calendar__sidebar-row-value",children:[Vl(t.date,t.endDate)," days"]})]})]}):e.jsxs("div",{className:"ui-calendar__sidebar-row",children:[e.jsx("span",{className:"ui-calendar__sidebar-row-label",children:"Date"}),e.jsx("span",{className:"ui-calendar__sidebar-row-value",children:Bl(t.date,t.time)})]}),!_t(t)&&t.duration&&e.jsxs("div",{className:"ui-calendar__sidebar-row",children:[e.jsx("span",{className:"ui-calendar__sidebar-row-label",children:"Duration"}),e.jsxs("span",{className:"ui-calendar__sidebar-row-value",children:[t.duration," min"]})]}),t.platform&&e.jsxs("div",{className:"ui-calendar__sidebar-row",children:[e.jsx("span",{className:"ui-calendar__sidebar-row-label",children:"Platform"}),e.jsx("span",{className:"ui-calendar__sidebar-row-value",children:t.platform})]}),t.meetLink&&e.jsx("a",{className:"ui-calendar__sidebar-link",href:t.meetLink,target:"_blank",rel:"noopener noreferrer",children:"🔗 Join meeting"})]}),t.notes&&e.jsxs("div",{className:"ui-calendar__sidebar-section",children:[e.jsx("div",{className:"ui-calendar__sidebar-section-title",children:"Notes"}),e.jsx("div",{className:"ui-calendar__sidebar-notes",children:t.notes})]})]})}),(r||l)&&e.jsxs("div",{className:"ui-calendar__sidebar-actions",children:[l&&e.jsx(Ze,{variant:"outlined",color:"error",size:"small",style:{flex:1},onClick:()=>l(t.id),children:"Delete"}),r&&e.jsx(Ze,{variant:"filled",color:"primary",size:"small",style:{flex:1},onClick:()=>r(t),children:"Edit"})]})]})};function Ul(t,n,s){const a=n.toLowerCase(),i=t.data?Object.values(t.data).map(String):[];return[t.title,t.notes,$t(t.category,s).label,...i].some(r=>r?.toLowerCase().includes(a))}function Da(t){const[n,s,a]=t.split("-").map(Number);return new Date(n,s-1,a).toLocaleDateString("en-US",{month:"short",day:"numeric"})}function Gl(t){return _t(t)?`${Da(t.date)} – ${Da(t.endDate)}`:Da(t.date)}const lr=({open:t,events:n,categoryMeta:s,onClose:a,onSelect:i})=>{const[r,l]=o.useState(""),[c,d]=o.useState(0),u=o.useRef(null);o.useEffect(()=>{t&&(l(""),d(0),setTimeout(()=>u.current?.focus(),50))},[t]);const p=o.useMemo(()=>r.trim()?n.filter(h=>Ul(h,r,s)).slice(0,20):[],[r,n,s]);o.useEffect(()=>{d(0)},[p.length]);const f=h=>{h.key==="ArrowDown"&&(h.preventDefault(),d(m=>Math.min(m+1,p.length-1))),h.key==="ArrowUp"&&(h.preventDefault(),d(m=>Math.max(m-1,0))),h.key==="Enter"&&p[c]&&(i(p[c]),a())};return e.jsx(ta,{open:t,onClose:a,closeOnBackdropClick:!0,closeOnEscape:!0,showCloseButton:!1,size:"medium",style:{padding:0,overflow:"hidden",borderRadius:12},children:e.jsxs("div",{className:"ui-calendar-search",onKeyDown:f,children:[e.jsx("div",{className:"ui-calendar-search__input-wrap",children:e.jsx(Vt,{ref:u,fullWidth:!0,placeholder:"Search events…",value:r,onChange:h=>l(h.target.value),autoComplete:"off",startAdornment:e.jsx("span",{children:"⌕"}),endAdornment:e.jsx("kbd",{className:"ui-calendar-search__kbd",children:"Esc"}),sx:{root:"ui-calendar-search__textfield"}})}),e.jsxs("div",{className:"ui-calendar-search__results",children:[r.trim()&&p.length===0&&e.jsxs("div",{className:"ui-calendar-search__empty",children:['No events found for "',r,'"']}),!r.trim()&&e.jsx("div",{className:"ui-calendar-search__empty",children:"Type to search events…"}),p.map((h,m)=>{const v=$t(h.category,s),g=_n(h,s);return e.jsxs("div",{className:`ui-calendar-search__result${m===c?" ui-calendar-search__result--active":""}`,onClick:()=>{i(h),a()},onMouseEnter:()=>d(m),children:[e.jsx("div",{className:"ui-calendar-search__result-icon",style:{background:v.bg,color:v.color},children:v.icon}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{className:"ui-calendar-search__result-name",children:g}),e.jsxs("div",{className:"ui-calendar-search__result-meta",children:[v.label,h.date?` · ${h.date}`:""]})]}),e.jsx("div",{className:"ui-calendar-search__result-date",children:Gl(h)})]},h.id)})]})]})})};lr.displayName="CalendarSearch";function ql(t,n){if(t==="month"){const a=n.getFullYear(),i=n.getMonth(),l=(new Date(a,i,1).getDay()+6)%7,c=new Date(a,i,1-l),d=new Date(c);return d.setDate(c.getDate()+41),{start:c,end:d}}if(t==="week"){const a=Us(n),i=new Date(a);return i.setDate(a.getDate()+6),{start:a,end:i}}const s=new Date(n.getFullYear(),n.getMonth(),n.getDate());return{start:s,end:s}}const or=({events:t=[],defaultView:n="month",initialDate:s,categoryMeta:a,filterSections:i,filterValues:r,onFilterValuesChange:l,renderEvent:c,renderKPI:d,renderSidebarDetail:u,renderSidebarItem:p,renderFilterPanel:f,renderFilterPanelBody:h,onAddClick:m,onEditClick:v,onEventCreate:g,onEventDelete:_,onFilterChange:y,onNavigate:N,showSearch:k=!0,showFilters:$=!0,showSidebar:S=!0,pageMode:P=!1,sx:q,style:X})=>{const D=r!==void 0,T=Lt(new Date),ee=o.useMemo(()=>a??{},[a]),[O,ge]=o.useState(n),[ue,Q]=o.useState(s??new Date),re=ue.getFullYear(),ye=ue.getMonth(),ke=Us(ue),R=Lt(ue),[Z,b]=o.useState(null),[I,z]=o.useState(null),[W,V]=o.useState(null),[be,w]=o.useState(!1),[te,ie]=o.useState(!1),[he,H]=o.useState(!1),le=o.useMemo(()=>i??[],[i]),[$e,Pe]=o.useState({}),pe=D?r:$e,Ce=o.useCallback(fe=>{if(D){const Se=typeof fe=="function"?fe(r):fe;l?.(Se)}else Pe(fe)},[D,r,l]);o.useEffect(()=>{N&&N(ql(O,ue))},[O,ue,N]),o.useEffect(()=>{y?.(pe)},[pe,y]);const _e=o.useCallback(fe=>{Q(Se=>{const Ne=new Date(Se);return O==="month"&&Ne.setMonth(Se.getMonth()+fe),O==="week"&&Ne.setDate(Se.getDate()+fe*7),O==="day"&&Ne.setDate(Se.getDate()+fe),Ne})},[O]),ze=o.useCallback(()=>Q(new Date),[]),M=o.useCallback(()=>{Ce(Object.fromEntries(le.map(fe=>fe.type==="daterange"?[fe.id,{start:null,end:null}]:fe.type==="select"&&!fe.multiple?[fe.id,null]:[fe.id,[]])))},[le,Ce]);o.useEffect(()=>{const fe=!!(m||g),Se=Ne=>{if(!(["INPUT","TEXTAREA","SELECT"].includes(Ne.target?.tagName)&&Ne.key!=="Escape")){if((Ne.ctrlKey||Ne.metaKey)&&Ne.key==="k"&&k){Ne.preventDefault(),ie(!0);return}if(Ne.key==="Escape"){if(te){ie(!1);return}if(be){w(!1),b(null),z(null);return}return}if(Ne.key==="]"&&S){w(oe=>!oe);return}if(Ne.key==="ArrowLeft"&&!te){_e(-1);return}if(Ne.key==="ArrowRight"&&!te){_e(1);return}Ne.key==="n"&&!te&&fe&&m&&m(void 0)}};return window.addEventListener("keydown",Se),()=>window.removeEventListener("keydown",Se)},[te,be,_e,k,S,m,g]);const G=o.useCallback(fe=>{V(I),b(fe),z(null),S&&w(!0)},[S,I]),ae=o.useCallback(fe=>{z(fe),b(null),S&&w(!0)},[S]),j=o.useCallback(fe=>{V(null),b(fe),Q(Sl(fe.date)),S&&w(!0),ie(!1)},[S]),B=o.useCallback(fe=>{_?.(fe),b(null),V(null),w(!1)},[_]),U=o.useCallback(()=>{b(null),z(W),V(null)},[W]),J=o.useCallback(fe=>{v?.(fe)},[v]),we=o.useMemo(()=>I?t.filter(fe=>Ks(fe,I)):[],[t,I]),C=!!(m||g),de=["ui-calendar",P&&"ui-calendar--page",q].filter(Boolean).join(" ");return e.jsxs("div",{className:de,style:X,children:[e.jsx(Zs,{view:O,year:re,month:ye,weekStart:ke,dayDate:R,onViewChange:ge,onPrev:()=>_e(-1),onNext:()=>_e(1),onToday:ze,onSearch:k?()=>ie(!0):void 0,onFilter:$?()=>H(fe=>!fe):void 0,onAdd:C?()=>{m&&m(void 0)}:void 0,showSearch:k,showFilters:$,showAdd:C,filterOpen:he}),d&&d(),e.jsxs("div",{className:"ui-calendar__body",children:[$&&(f?f({isOpen:he,onClose:()=>H(!1)}):e.jsx(Xs,{isOpen:he,onClose:()=>H(!1),sections:le,value:pe,onChange:Ce,onReset:M,renderBody:h})),e.jsx("div",{className:"ui-calendar__main",children:e.jsxs("div",{className:"ui-calendar__grid",children:[O==="month"&&e.jsx(er,{events:t,year:re,month:ye,today:T,categoryMeta:ee,renderEvent:c,onEventClick:G,onDayClick:ae}),O==="week"&&e.jsx(ar,{events:t,weekStart:ke,today:T,categoryMeta:ee,renderEvent:c,onEventClick:G,onDayClick:ae}),O==="day"&&e.jsx(rr,{events:t,date:R,categoryMeta:ee,renderEvent:c,onEventClick:G})]})}),S&&e.jsx(ir,{event:Z,dayDate:I,dayEvents:we,isOpen:be,categoryMeta:ee,renderSidebarDetail:u,renderSidebarItem:p,onClose:()=>{w(!1),b(null),z(null),V(null)},onBack:W?U:void 0,onEventClick:G,onEdit:v?J:void 0,onDelete:_?B:void 0})]}),k&&e.jsx(lr,{open:te,events:t,categoryMeta:ee,onClose:()=>ie(!1),onSelect:j})]})};or.displayName="Calendar";const Xl={primary:"var(--palette-primary-main, #4299e1)",success:"var(--palette-success-main, #38a169)",warning:"var(--palette-warning-main, #f97316)",error:"var(--palette-error-main, #d32f2f)",info:"var(--palette-info-main, #0ea5e9)"};function Zl(t){if(t)return Xl[t]??t}const cr=({metrics:t})=>t.length===0?null:e.jsx("div",{className:"ui-calendar__kpi",role:"list","aria-label":"KPI metrics",children:t.map((n,s)=>{const a=Zl(n.color);return e.jsxs("div",{className:`ui-calendar__kpi-item${n.onClick?" ui-calendar__kpi-item--clickable":""}`,onClick:n.onClick,role:n.onClick?"button":"listitem",tabIndex:n.onClick?0:void 0,onKeyDown:n.onClick?i=>{i.key==="Enter"&&n.onClick()}:void 0,children:[a&&e.jsx("span",{className:"ui-calendar__kpi-dot",style:{background:a}}),e.jsx("span",{className:"ui-calendar__kpi-value",children:n.value}),e.jsx("span",{className:"ui-calendar__kpi-label",children:n.label})]},s)})});cr.displayName="CalendarKPIStrip";const Jl={palette:["--palette-primary-main","--palette-primary-light","--palette-primary-dark","--palette-primary-contrast-text","--palette-secondary-main","--palette-secondary-light","--palette-secondary-dark","--palette-secondary-contrast-text","--palette-success-main","--palette-success-light","--palette-success-dark","--palette-success-contrast-text","--palette-tertiary-main","--palette-tertiary-light","--palette-tertiary-dark","--palette-tertiary-contrast-text","--palette-warning-main","--palette-warning-light","--palette-warning-dark","--palette-warning-contrast-text","--palette-error-main","--palette-error-light","--palette-error-dark","--palette-error-contrast-text","--palette-info-main","--palette-info-light","--palette-info-dark","--palette-info-contrast-text","--palette-common-white","--palette-common-black","--palette-background-default","--palette-background-paper","--palette-text-primary","--palette-text-secondary","--palette-divider","--palette-action-hover","--palette-action-selected","--palette-action-disabled","--palette-action-disabledBackground","--palette-overlay-subtle","--palette-overlay-subtle-hover","--palette-badge-bg","--palette-primary-shadow","--palette-primary-shadow-strong","--palette-primary-overlay","--palette-primary-border","--palette-overlay-on-dark"],department:["--department-all-default","--department-all-hover","--department-all-active","--department-design-default","--department-design-hover","--department-design-active","--department-development-default","--department-development-hover","--department-development-active","--department-management-default","--department-management-hover","--department-management-active","--department-marketing-default","--department-marketing-hover","--department-marketing-active","--department-video-default","--department-video-hover","--department-video-active"],layout:["--layout-columns","--layout-gutter","--layout-max-width"],spacing:["--space-xs","--space-sm","--space-md","--space-lg","--space-xl","--space-2xl","--space-3xl"],fluidSpacing:["--space-fluid-xs","--space-fluid-sm","--space-fluid-md","--space-fluid-lg","--space-fluid-xl","--space-fluid-2xl","--space-fluid-3xl"],breakpoint:["--breakpoint-mobile-min","--breakpoint-mobile-max","--breakpoint-tablet-min","--breakpoint-tablet-max","--breakpoint-desktop-min","--breakpoint-desktop-max","--breakpoint-large-desktop-min","--breakpoint-large-desktop-max","--breakpoint-extra-large-min"],typography:["--font-family-base","--font-weight-regular","--font-weight-medium","--font-weight-semibold","--h1-font-size","--h1-font-line-height","--h2-font-size","--h2-font-line-height","--h3-font-size","--h3-font-line-height","--h4-font-size","--h4-font-line-height","--h5-font-size","--h5-font-line-height","--body-regular-font-size","--body-regular-font-line-height","--body-medium-font-size","--body-medium-font-line-height","--body-small-font-size","--body-small-font-line-height","--caption-font-size","--caption-font-line-height"],zIndex:["--z-index-dropdown","--z-index-sticky","--z-index-fixed","--z-index-backdrop","--z-index-modal","--z-index-popover","--z-index-tooltip"],motion:["--motion-fast","--motion-normal","--motion-slow","--motion-easing"],shadow:["--shadow-light","--shadow-card","--shadow-card-elevated","--shadow-card-hover","--shadow-medium","--shadow-heavy","--shadow-avatar","--shadow-badge","--shadow-primary-glow","--shadow-primary-glow-strong"],radius:["--radius-xs","--radius-sm","--radius-md","--radius-lg","--radius-xl","--radius-2xl","--radius-3xl","--radius-full"],gradient:["--gradient-primary-start","--gradient-primary-end","--gradient-primary-horizontal","--gradient-primary-vertical","--gradient-primary-diagonal","--gradient-primary-radial","--gradient-secondary-start","--gradient-secondary-end","--gradient-secondary-horizontal","--gradient-secondary-vertical","--gradient-secondary-diagonal","--gradient-secondary-radial","--gradient-success-horizontal","--gradient-success-diagonal","--gradient-tertiary-horizontal","--gradient-tertiary-diagonal","--gradient-warning-horizontal","--gradient-error-horizontal","--gradient-info-horizontal","--gradient-primary-secondary-horizontal","--gradient-primary-secondary-diagonal","--gradient-primary-tertiary-horizontal","--gradient-primary-success-horizontal","--gradient-success-tertiary-horizontal"],component:["--button-padding-x","--button-padding-y","--button-border-width","--button-border-radius","--textfield-border-color","--textfield-border-radius","--textfield-padding-x","--textfield-padding-y"]};ne.Accordion=ms,ne.AccordionContent=ma,ne.AccordionItem=ha,ne.AccordionRoot=ua,ne.AccordionTrigger=pa,ne.ActivityHeatmap=Ts,ne.Autocomplete=Qn,ne.Avatar=Pt,ne.AvatarGroup=va,ne.Badge=St,ne.Button=Ze,ne.Calendar=or,ne.CalendarKPIStrip=cr,ne.Checkbox=da,ne.Chip=mt,ne.ConfirmDialog=_a,ne.ConfirmProvider=js,ne.CourseCard=ll,ne.DatePicker=la,ne.Drawer=es,ne.Dropdown=Jn,ne.DropdownItem=Zn,ne.EmployeeCard=zs,ne.FilterPanel=pi,ne.Header=Hs,ne.IconButton=Ie,ne.Layout=Os,ne.LessonCard=_l,ne.Logo=ka,ne.Modal=ta,ne.Pagination=Es,ne.Portal=dn,ne.Select=Ln,ne.Sidebar=wa,ne.Spinner=Ss,ne.TOKEN_CATEGORIES=Jl,ne.Tab=xa,ne.TabList=Ns,ne.TabPanel=Cs,ne.Table=vs,ne.Tabs=ws,ne.Tags=Ka,ne.TaskCard=Ws,ne.TextField=Vt,ne.TimePicker=cs,ne.Toast=ba,ne.ToastProvider=Ds,ne.Toggle=ys,ne.Tooltip=Ue,ne.VideoCard=kr,ne.getGradientClassName=Gn,ne.getGradientStyle=Xn,ne.isCustomGradient=Un,ne.useConfirm=Ai,ne.useEscapeKey=At,ne.useFloatingPosition=Ba,ne.useFocusTrap=ea,ne.useLockScroll=Hn,ne.usePortal=En,ne.useTheme=ri,ne.useToast=Hi,Object.defineProperty(ne,Symbol.toStringTag,{value:"Module"})}));
|
|
7
7
|
//# sourceMappingURL=ui-kit.umd.js.map
|