@starasia/admin 14.58.0 → 14.59.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/AppLayout/index.d.ts +15 -1
- package/dist/index.cjs.js +18 -18
- package/dist/index.es.js +3361 -3188
- package/dist/index.umd.js +16 -16
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const En=require("@starasia/alert"),fr=require("@starasia/avatar"),it=require("@starasia/badges"),x=require("@starasia/box"),It=require("@starasia/breadcrumb"),H=require("@starasia/button"),Yr=require("@starasia/card"),vt=require("@starasia/date"),Oe=require("@starasia/dialog"),mr=require("@starasia/drawer"),Lt=require("@starasia/dropdown"),ke=require("@starasia/hooks"),Tt=require("@starasia/http"),mt=require("@starasia/input"),A=require("@starasia/menu"),Vt=require("@starasia/pagination"),Nt=require("@starasia/storage"),Z=require("@starasia/table"),Fn=require("@starasia/tabs"),Xr=require("@starasia/textarea"),Mt=require("@starasia/theme"),In=require("@starasia/toast"),Rt=require("@starasia/toggle"),Le=require("@starasia/tooltip"),ft=require("@starasia/checkbox"),Jr=require("@starasia/radio"),w=require("@starasia/text"),E=require("@starasia/icon"),de=require("@starasia/flex"),Mn=require("@starasia/grid"),Ln=require("@starasia/progress"),Tn=require("@starasia/stepper"),Rn=require("@starasia/accordion"),On=require("@starasia/story-record"),rt=require("@starasia/skeleton"),An=require("@starasia/progress-stepper"),e=require("react/jsx-runtime"),u=require("react"),br=require("react-dom"),zs=require("react-easy-crop"),Hs={menus:[],menuBottom:void 0,logo:"",appName:"Workspace",userData:null,setUserData:()=>{}},cn=u.createContext(Hs),an=()=>u.useContext(cn),yo=t=>{const[r,n]=u.useState((t==null?void 0:t.initialUserData)||null);return{userData:r,setUserData:n}},bo=u.createContext({badges:{},setBadge:()=>{},setBadges:()=>{},clearBadge:()=>{}}),jo=({children:t})=>{const[r,n]=u.useState({}),s=u.useCallback(c=>{n(a=>typeof c=="function"?c(a):c)},[]),o=u.useCallback((c,a)=>{n(d=>{const h=typeof a=="function"?a(d[c]):a;return{...d,[c]:h}})},[]),i=u.useCallback(c=>{n(a=>{if(!(c in a))return a;const d={...a};return delete d[c],d})},[]),l=u.useMemo(()=>({badges:r,setBadge:o,setBadges:s,clearBadge:i}),[r,o,s,i]);return e.jsx(bo.Provider,{value:l,children:t})},vo=()=>u.useContext(bo),xr=(t,r)=>{const n=r!==void 0?r:t;return n==null?null:typeof n=="string"||typeof n=="number"?{value:n}:n},dn=240,un=200,xn=480,Ps="sa-sidebar-width",$r=(t,r,n)=>Math.min(Math.max(t,r),n),_s=(t,r,n,s)=>{if(typeof window>"u")return r;try{const o=window.localStorage.getItem(t);if(!o)return r;const i=parseInt(o,10);return Number.isFinite(i)?$r(i,n,s):r}catch{return r}},Wn=(t,r)=>{if(!(typeof window>"u"))try{window.localStorage.setItem(t,String(r))}catch{}},Co=u.createContext({collapsed:!1,setCollapsed:()=>{},toggle:()=>{},collapse:()=>{},expand:()=>{},width:dn,setWidth:()=>{},resetWidth:()=>{},minWidth:un,maxWidth:xn,mobileOpen:!1,setMobileOpen:()=>{},openMobile:()=>{},closeMobile:()=>{},toggleMobile:()=>{}}),wo=({children:t,defaultCollapsed:r=!1,defaultWidth:n=dn,minWidth:s=un,maxWidth:o=xn,widthStorageKey:i=Ps})=>{const[l,c]=u.useState(r),[a,d]=u.useState(!1),[h,g]=u.useState(()=>_s(i,n,s,o)),m=u.useCallback(S=>{c(T=>typeof S=="function"?S(T):S)},[]),y=u.useCallback(()=>c(S=>!S),[]),b=u.useCallback(()=>c(!0),[]),C=u.useCallback(()=>c(!1),[]),O=u.useCallback(S=>{g(T=>{const P=typeof S=="function"?S(T):S,X=$r(Math.round(P),s,o);return Wn(i,X),X})},[s,o,i]),M=u.useCallback(()=>{const S=$r(n,s,o);Wn(i,S),g(S)},[n,s,o,i]),L=u.useCallback(S=>{d(T=>typeof S=="function"?S(T):S)},[]),j=u.useCallback(()=>d(!0),[]),D=u.useCallback(()=>d(!1),[]),R=u.useCallback(()=>d(S=>!S),[]),B=u.useMemo(()=>({collapsed:l,setCollapsed:m,toggle:y,collapse:b,expand:C,width:h,setWidth:O,resetWidth:M,minWidth:s,maxWidth:o,mobileOpen:a,setMobileOpen:L,openMobile:j,closeMobile:D,toggleMobile:R}),[l,m,y,b,C,h,O,M,s,o,a,L,j,D,R]);return e.jsx(Co.Provider,{value:B,children:t})},Do=()=>u.useContext(Co),So=u.createContext(null),ko=({adapter:t,children:r})=>e.jsx(So.Provider,{value:t,children:r}),at=()=>{const t=u.useContext(So);if(!t)throw new Error("[@starasia/admin] Router adapter belum dipasang. Bungkus aplikasi dengan <App routerAdapter={...} /> atau <StarasiaRouterProvider adapter={...}>. Import adapter dari '@starasia/admin/adapters/react-router' atau '@starasia/admin/adapters/tanstack'.");return t},Bo=({router:t,routerAdapter:r,menus:n=[],menuBottom:s,logo:o,appName:i="Workspace",initialUserData:l,theme:c})=>{const a=yo({initialUserData:l}),{theme:d}=Mt.useTheme();return e.jsx(ko,{adapter:r,children:e.jsx(cn.Provider,{value:{logo:o,appName:i,menus:n,userData:a.userData,setUserData:a.setUserData,menuBottom:s},children:e.jsx(jo,{children:e.jsx(wo,{children:c?e.jsx(Mt.ThemeProvider,{value:c,children:t}):d?e.jsx(Mt.ThemeProvider,{value:d,children:t}):t})})})})},Ns=u.memo(Bo);function Eo({collapsed:t=!1,children:r}){if(!r)return null;const n=typeof r=="function",s=n?r({collapsed:t}):r;return s==null||s===!1?null:e.jsx("div",{style:{position:"sticky",top:"var(--app-header-height, 4rem)",zIndex:1,borderBottom:"1px solid var(--sa-border-subtle, #0b120e24)",paddingLeft:t?"calc((var(--app-header-height, 4rem) - 2rem) / 2)":"0.5rem",paddingRight:t?"calc((var(--app-header-height, 4rem) - 2rem) / 2)":"0.5rem",paddingTop:"0.5rem",paddingBottom:"0.5rem",boxSizing:"border-box"},children:n?s:e.jsx("div",{style:{opacity:t?0:1,transition:"opacity 0.3s",visibility:t?"hidden":"visible"},children:s})})}const hn=u.createContext(null);function Fo({children:t}){const[r,n]=u.useState(null),[s,o]=u.useState(null),[i,l]=u.useState(null),[c,a]=u.useState(0),d=u.useCallback(()=>(a(h=>h+1),()=>a(h=>h-1)),[]);return e.jsx(hn.Provider,{value:{prependNode:r,appendNode:s,replaceNode:i,setPrependNode:n,setAppendNode:o,setReplaceNode:l,replaceCount:c,registerReplace:d},children:t})}function Io({children:t}){const r=u.useContext(hn);return r?e.jsxs(e.Fragment,{children:[e.jsx("div",{ref:r.setPrependNode,style:{display:"contents"}}),r.replaceCount>0?e.jsx("div",{ref:r.setReplaceNode,style:{display:"contents"}}):t,e.jsx("div",{ref:r.setAppendNode,style:{display:"contents"}})]}):e.jsx(e.Fragment,{children:t})}function Vs({children:t,mode:r="append"}){const n=u.useContext(hn);if(u.useEffect(()=>{if(!(r!=="replace"||!n))return n.registerReplace()},[r,n]),!n)return process.env.NODE_ENV!=="production"&&console.warn("[HeaderLeftSlot] used outside AppLayout — content not rendered"),null;const s=r==="prepend"?n.prependNode:r==="replace"?n.replaceNode:n.appendNode;return s?br.createPortal(t,s):null}const fn=u.createContext(null);function Mo({children:t}){const[r,n]=u.useState({}),[s,o]=u.useState({}),i=u.useCallback((a,d)=>{n(h=>h[a]===d?h:{...h,[a]:d})},[]),l=u.useCallback(a=>(o(d=>({...d,[a]:(d[a]??0)+1})),()=>o(d=>({...d,[a]:Math.max(0,(d[a]??0)-1)}))),[]),c=u.useMemo(()=>({outletNodes:r,setOutletNode:i,slotCounts:s,registerSlot:l}),[r,i,s,l]);return e.jsx(fn.Provider,{value:c,children:t})}function Kr({slotKey:t,fallback:r}){const n=u.useContext(fn),s=n?(n.slotCounts[t]??0)>0:!1,o=u.useRef(n==null?void 0:n.setOutletNode);o.current=n==null?void 0:n.setOutletNode;const i=u.useCallback(l=>{var c;return(c=o.current)==null?void 0:c.call(o,t,l)},[t]);return e.jsx(e.Fragment,{children:s?e.jsx("div",{ref:i,style:{display:"contents"}}):r})}function qs({slotKey:t,children:r}){const n=u.useContext(fn),s=u.useRef(n==null?void 0:n.registerSlot);if(s.current=n==null?void 0:n.registerSlot,u.useEffect(()=>{var i;return(i=s.current)==null?void 0:i.call(s,t)},[t]),!n)return process.env.NODE_ENV!=="production"&&console.warn("[SidebarGroupSlot] used outside AppLayout — content not rendered"),null;const o=n.outletNodes[t];return o?br.createPortal(r,o):null}const gr="moduleSwitcherGroupId",en="sa-module-switcher-change";function zn(){if(typeof window>"u")return null;const t=window.localStorage.getItem(gr);if(t===null)return null;const r=Number(t);return Number.isFinite(r)?r:null}function Lo(t){typeof window>"u"||(t===null?window.localStorage.removeItem(gr):window.localStorage.setItem(gr,String(t)),window.dispatchEvent(new CustomEvent(en,{detail:t})))}function Zs(){Lo(null)}function mn(){const[t,r]=u.useState(()=>zn());return u.useEffect(()=>{const s=()=>{r(zn())},o=i=>{i.key===gr&&s()};return window.addEventListener(en,s),window.addEventListener("storage",o),()=>{window.removeEventListener(en,s),window.removeEventListener("storage",o)}},[]),{selectedGroupId:t,setSelectedGroupId:s=>{Lo(s),r(s)}}}const tn="var(--sa-app-sidebar-bg, var(--sa-background-primary-inverse))",Gs="_row_134el_37",Qs="_rowIcon_134el_62",Us="_chevron_134el_73",Ys="_label_134el_82",Xs="_popoverLabel_134el_87",Js="_badgeDotRing_134el_92",$s="_indicator_134el_99",Ks="_submenu_134el_125",ei="_submenuInner_134el_146",ti="_submenuLine_134el_151",ri="_childRow_134el_160",ni="_groupLabel_134el_180",oi="_railButton_134el_198",si="_railIcon_134el_208",ii="_railBadge_134el_239",li="_railLabel_134el_244",ci="_railTabs_134el_252",ai="_railTab_134el_252",di="_railTabLabel_134el_287",Se={row:Gs,rowIcon:Qs,chevron:Us,label:Ys,popoverLabel:Xs,badgeDotRing:Js,indicator:$s,submenu:Ks,submenuInner:ei,submenuLine:ti,childRow:ri,groupLabel:ni,railButton:oi,railIcon:si,railBadge:ii,railLabel:li,railTabs:ci,railTab:ai,railTabLabel:di},ui="4.5rem",xi="var(--app-header-height, 4rem)",To=t=>t?ui:xi;function Hn({icon:t,label:r,tooltip:n=r,selected:s,location:o=!1,badge:i,showLabel:l=!0,onClick:c}){const a=s===!0;return e.jsx(Le.Tooltip,{fluid:!0,label:n,position:"right",children:e.jsxs(x.Box,{as:"button",position:"relative",onClick:c,"aria-label":n,"aria-pressed":s,className:Se.railButton,"data-active":a||void 0,"data-location":o||void 0,fullWidth:!0,direction:"column",align:"center",gap:"spacing-2",paddingBlock:"xs",children:[e.jsxs(x.Box,{position:"relative",display:"inline-flex",align:"center",justify:"center",width:"width-32",height:"height-32",borderRadius:a?"rounded-sm":"rounded-md",className:Se.railIcon,children:[e.jsx(E.Icon,{name:t,size:"sm"}),i&&!l&&e.jsx(x.Box,{"aria-hidden":"true",position:"absolute",top:"top-n2",right:"right-n2",display:"inline-flex",borderRadius:"rounded-full",className:Se.badgeDotRing,children:e.jsx(it.BadgeDot,{tone:"error",variant:"solid",size:"xs"})}),i&&l&&e.jsx(x.Box,{position:"absolute",display:"inline-flex",className:Se.railBadge,children:e.jsx(it.Badge,{text:String(i.value),variant:i.variant??"info",size:"xs",border:!0})})]}),l&&e.jsx(w.Text,{as:"span",fontSize:"xs",fontWeight:a?"medium":"normal",textAlign:"center",truncate:!0,className:Se.railLabel,children:r})]})})}function hi({items:t,bottomItems:r,activeKey:n,locationKey:s,onSelect:o,onAction:i,logo:l,panelCollapsed:c,onExpandPanel:a,showLabels:d=!0,theme:h}){const[g,m]=u.useState(!1),y=c&&g;return e.jsxs(x.Box,{as:"nav","aria-label":"Primary navigation","data-slot":"app-rail","data-theme":h,bg:"surface-inverse",borderWidth:"border-r",borderStyle:"border-solid-r",borderColor:"border-base",flexShrink:"0",style:{width:To(d),height:"100%",backgroundColor:tn},children:[e.jsxs(x.Box,{onMouseEnter:()=>m(!0),onMouseLeave:()=>m(!1),position:"relative",align:"center",justify:"center",borderWidth:"border-b",borderStyle:"border-solid-b",borderColor:"border-base",flexShrink:"0",style:{height:"var(--app-header-height, 4rem)"},children:[e.jsx("img",{src:l,alt:"Logo",style:{width:"1.5rem",height:"1.5rem",transition:"opacity 0.2s",opacity:y?0:1}}),c&&e.jsx(x.Box,{as:"button",onClick:a,"aria-label":"Expand sidebar",position:"absolute",display:"inline-flex",align:"center",justify:"center",width:"width-32",height:"height-32",bg:"white",borderWidth:"border",borderStyle:"border-solid",borderColor:"border-base",borderRadius:"rounded-sm",style:{top:"50%",left:"50%",transform:"translate(-50%, -50%)",color:"var(--sa-text-primary, #292a2e)",opacity:y?1:0,pointerEvents:y?"auto":"none",transition:"opacity 0.2s"},children:e.jsx(E.Icon,{name:"LayoutLeft",size:"sm"})})]}),e.jsx(x.Box,{flex:"1",overflow:"overflow-y-auto",paddingBlock:"md",paddingInline:"xs",gap:"xs",children:t.map(b=>e.jsx(Hn,{icon:b.icon,label:b.label,tooltip:b.tooltip,badge:b.badge,showLabel:d,selected:b.key===n,location:b.key===s,onClick:()=>o(b.key)},b.key))}),r&&r.length>0&&e.jsx(x.Box,{borderWidth:"border-t",borderStyle:"border-solid-t",borderColor:"border-base",paddingBlock:"md",paddingInline:"xs",gap:"xs",flexShrink:"0",children:r.map(b=>e.jsx(Hn,{icon:b.icon,label:b.label,tooltip:b.tooltip,badge:b.badge,showLabel:d,onClick:()=>i(b)},b.key))})]})}function fi({items:t,activeKey:r,locationKey:n,onSelect:s}){return e.jsx(x.Box,{role:"tablist","aria-label":"Primary navigation",direction:"row",gap:"xs",paddingInline:"md",paddingBlock:"sm",borderWidth:"border-b",borderStyle:"border-solid-b",borderColor:"border-base",flexShrink:"0",className:Se.railTabs,children:t.map(o=>{const i=o.key===r,l=o.key===n;return e.jsxs(x.Box,{as:"button",role:"tab","aria-selected":i,className:Se.railTab,"data-active":i||void 0,"data-location":l||void 0,onClick:()=>s(o.key),position:"relative",direction:"row",align:"center",gap:"spacing-4",paddingInline:"sm",height:"height-32",flexShrink:"0",borderRadius:i?"rounded-sm":"rounded-md",hover:i?void 0:{bg:"neutral"},children:[e.jsx(E.Icon,{name:o.icon,size:"sm"}),e.jsx(w.Text,{as:"span",fontSize:"sm",fontWeight:i?"medium":"normal",className:Se.railTabLabel,children:o.label})]},o.key)})})}const rn=(t,r)=>!t.groupIds||t.groupIds.includes(r.id)||r.parentGroupId!==void 0&&t.groupIds.includes(r.parentGroupId),Pn=(t,r)=>t.find(n=>n.groupIds&&rn(n,r))??t.find(n=>!n.groupIds);let or=0,wt=!1,_n=new Set;const Nn=new Set;function mi(t,r){const[n,s]=u.useState(!1),o=u.useRef(null),i=u.useRef(null);return u.useLayoutEffect(()=>{const l=o.current;if(!l)return;let c=0;const a=()=>{c=0;const h=i.current;if(!h)return;const g=h.scrollWidth>l.clientWidth;s(m=>m===g?m:g)},d=new ResizeObserver(()=>{c||(c=requestAnimationFrame(a))});return d.observe(l),a(),()=>{c&&cancelAnimationFrame(c),d.disconnect()}},[t,r]),{containerRef:o,textRef:i,truncated:n}}function Vn({text:t,emphasis:r}){const{containerRef:n,textRef:s,truncated:o}=mi(t,r),i=e.jsx(w.Text,{ref:s,as:"span",fontSize:"md",fontWeight:r==="location"?"semibold":r==="trail"?"medium":"normal",truncate:!0,className:Se.label,children:t});return e.jsx(x.Box,{ref:n,display:"block",flex:"1",minWidth:"width-0",children:o?e.jsx(Le.Tooltip,{fluid:!0,label:t,position:"top",children:i}):i})}const gi=200,nn="var(--app-header-height, 4rem)",qn="44px",Or=`calc((${nn} - 2rem) / 2)`,Zn=16;function pi({children:t,headerLeftSlot:r,profile:n,isLoadingProfile:s,onLogout:o,isLoggingOut:i,loadingComponent:l,sidebarHeaderContent:c,headerActions:a,profileRole:d,profileMenuButtons:h,profileMenuItems:g,logoutButton:m,resizableSidebar:y=!0,rail:b,sidebarTheme:C}){var At,Bt,Kt;const{useSearchParams:O,useNavigate:M,useLocation:L,Outlet:j}=at(),[D]=O(),R=D.get("embed")==="true",B=an(),{badges:S}=vo(),T=M(),P=L(),I=!ke.useMediaQuery("md"),[N,Y]=u.useState(!1),{collapsed:G,setCollapsed:J,width:$,setWidth:le,resetWidth:q,minWidth:K,maxWidth:ae,mobileOpen:ge,setMobileOpen:Ie}=Do(),[Ee,ye]=u.useState(!1),[fe,Ne]=u.useState(()=>new Set(_n)),[Te,Ve]=u.useState(null),{selectedGroupId:oe,setSelectedGroupId:we}=mn(),be=!!(b&&b.items.length>0),re=G&&!I&&!be,Be=G&&!I&&be;u.useEffect(()=>{_n=fe},[fe]);const Je=u.useRef(null),et=u.useRef(null),W=u.useRef(null),[Q,U]=u.useState(!1),[ue,Fe]=u.useState(null),me=y&&!I&&!G,Ae=k=>Math.min(Math.max(k,K),ae),$e=ue??$,Ge=k=>{var Pe,Ue,Ye;if(!me)return;k.preventDefault();const z=k.clientX,V=((Pe=W.current)==null?void 0:Pe.getBoundingClientRect().width)??$;(Ye=(Ue=k.currentTarget).setPointerCapture)==null||Ye.call(Ue,k.pointerId),U(!0),document.body.style.userSelect="none",document.body.style.cursor="col-resize";let ie=0,he=V;const je=ut=>{he=V+(ut.clientX-z),ie||(ie=requestAnimationFrame(()=>{ie=0,Fe(Ae(he))}))},Me=()=>{ie&&cancelAnimationFrame(ie),window.removeEventListener("pointermove",je),window.removeEventListener("pointerup",Me),document.body.style.userSelect="",document.body.style.cursor="",Fe(null),U(!1),he<gi?J(!0):le(Ae(he))};window.addEventListener("pointermove",je),window.addEventListener("pointerup",Me)},We=k=>{me&&(k.key==="ArrowLeft"?(k.preventDefault(),le(z=>z-Zn)):k.key==="ArrowRight"?(k.preventDefault(),le(z=>z+Zn)):k.key==="Home"?(k.preventDefault(),le(K)):k.key==="End"&&(k.preventDefault(),le(ae)))};u.useEffect(()=>{const k=Je.current;if(!k)return;const z=()=>{wt||(or=k.scrollTop)};return k.addEventListener("scroll",z),()=>k.removeEventListener("scroll",z)},[]);const Qe=()=>{const k=Je.current;k&&or>0&&(wt=!0,k.scrollTop=or,requestAnimationFrame(()=>{wt=!1}))};u.useLayoutEffect(()=>{wt=!0,Qe();const k=setTimeout(()=>{wt=!1},300);return()=>clearTimeout(k)},[]),u.useLayoutEffect(()=>{B.menus.length>0&&(or>0?Qe():requestAnimationFrame(()=>{var z;const k=(z=Je.current)==null?void 0:z.querySelector("[data-menu-active='true']");k&&k.scrollIntoView({block:"center",behavior:"instant"})}))},[B.menus]),u.useEffect(()=>{wt=!0,Qe();const k=setTimeout(Qe,0),z=setTimeout(Qe,50),V=setTimeout(Qe,100),ie=setTimeout(Qe,200),he=setTimeout(()=>{wt=!1},300),je=setTimeout(()=>{const Me=Je.current,Pe=Me==null?void 0:Me.querySelector("[data-menu-active='true']");if(Me&&Pe){const Ue=Me.getBoundingClientRect(),Ye=Pe.getBoundingClientRect();Ye.top>=Ue.top&&Ye.bottom<=Ue.bottom||Pe.scrollIntoView({block:"center",behavior:"smooth"})}},250);return()=>{clearTimeout(k),clearTimeout(z),clearTimeout(V),clearTimeout(ie),clearTimeout(he),clearTimeout(je)}},[P.pathname]),u.useEffect(()=>{et.current&&(et.current.scrollTop=0)},[P.pathname]),u.useEffect(()=>{I&&Ie(!1)},[P.pathname,I]),u.useEffect(()=>{I&&J(!0)},[I]),u.useEffect(()=>{const k=document.documentElement;return k.style.setProperty("--app-header-height",qn),()=>{k.style.removeProperty("--app-header-height")}},[]);const gt=()=>{Y(!0)},De=()=>{Y(!1)},ze=()=>{Y(!1),o()},dt=k=>{const z=k.slotKey?[]:[k.to];return k.children&&z.push(...k.children.map(V=>V.to)),z},Dt=[...B.menus.flatMap(k=>k.items.flatMap(dt)),...((At=B.menuBottom)==null?void 0:At.flatMap(dt))??[]],tt=k=>{if(!P.pathname.startsWith(k))return!1;const z=Dt.filter(V=>P.pathname.startsWith(V)).sort((V,ie)=>ie.length-V.length)[0];return k===z},jt=u.useRef(b);jt.current=b;const pt=()=>B.menus.find(k=>k.items.some(z=>dt(z).some(tt))),He=k=>{const z=jt.current;if(!z||z.items.length===0)return null;const V=z.defaultKey??z.items[0].key,ie=z.items.find(Me=>Me.key===k),he=pt();if(!he)return ie?ie.key:V;if(ie&&rn(ie,he))return ie.key;const je=Pn(z.items,he);return(je==null?void 0:je.key)??(ie==null?void 0:ie.key)??V},[Ut,Yt]=u.useState(()=>He(null));u.useEffect(()=>{Yt(k=>He(k))},[P.pathname,B.menus]);const qe=be?b.items.find(k=>k.key===Ut)??b.items[0]:void 0,Xt=be?pt():void 0,Jt=Xt?(Bt=Pn(b.items,Xt))==null?void 0:Bt.key:void 0,St=k=>{Yt(k),Be&&J(!1)},Br=k=>{k.onClick?k.onClick():k.to&&T(k.to)};u.useEffect(()=>{var z;const k=V=>{var he;const ie=V.defaultExpanded&&!Nn.has(V.id);ie&&Nn.add(V.id),(ie||(he=V.children)!=null&&he.some(je=>P.pathname.startsWith(je.to)))&&Ne(je=>{const Me=new Set(je);return Me.add(V.id),Me})};B.menus.forEach(V=>{V.items.forEach(k)}),(z=B.menuBottom)==null||z.forEach(k)},[P.pathname,B.menus,B.menuBottom]);const Ct=k=>{Ne(z=>{const V=new Set(z);return V.has(k)?V.delete(k):V.add(k),V})};u.useEffect(()=>{B.menus.length!==0&&oe!==null&&!B.menus.some(k=>k.id===oe)&&we(null)},[B.menus,oe,we]);const $t=u.useMemo(()=>{if(qe!=null&&qe.groupIds)return B.menus.filter(he=>rn(qe,he));const k=B.menus,z=be?null:oe;if(z!==null)return k.filter(he=>he.id===z||he.parentGroupId===z);const V=k.filter(he=>he.parentGroupId===void 0),ie=k.filter(he=>he.parentGroupId!==void 0).flatMap(he=>he.items);return ie.length===0?V:[...V,{id:18,name:"Pengaturan",items:ie,parentGroupId:void 0}]},[B.menus,oe,qe,be]);if(R)return e.jsx(x.Box,{as:"main",overflow:"overflow-y-auto",bg:"surface-inverse",style:{height:"100vh"},children:t||e.jsx(j,{})});const kt=k=>{const z=k.children&&k.children.length>0,V=!!k.slotKey,ie=z||V,he=fe.has(k.id),je=z?k.children.some(ut=>tt(ut.to)):V?!1:tt(k.to),Me=je&&z&&he&&!re,Pe=je&&!Me,Ue=xr(k.badge,S[k.id]),Ye=!!Ue&&re;return e.jsxs(x.Box,{display:"block","data-menu-active":je||void 0,children:[e.jsxs(x.Box,{as:"button",position:"relative",onClick:ut=>{if(V&&re)T(k.to);else if(ie)if(re){const yt=ut.currentTarget.getBoundingClientRect();Ve({item:k,top:yt.top,left:yt.right+8})}else Ct(k.id);else T(k.to)},fullWidth:!0,direction:"row",align:"center",justify:re?"center":void 0,gap:"sm",paddingInline:re?void 0:"sm",paddingBlock:"xs",height:"height-32",borderRadius:Pe?"rounded-sm":"rounded-md",borderWidth:"border",borderStyle:"border-solid",hover:Pe?void 0:{bg:"neutral"},title:re?k.title:void 0,className:`${Se.row} ${Se.indicator}`,"data-active":je||void 0,"data-location":Pe||void 0,"data-trail":Me||void 0,"data-compact":re||void 0,"aria-current":Pe&&!z?"page":void 0,"aria-expanded":ie&&!re?he:void 0,children:[e.jsxs(x.Box,{position:"relative",display:"inline-flex",align:"center",flexShrink:"0",children:[e.jsx(E.Icon,{name:k.icon,size:"sm",className:Se.rowIcon}),Ye&&e.jsx(x.Box,{"aria-hidden":"true",position:"absolute",top:"top-n2",right:"right-n2",display:"inline-flex",borderRadius:"rounded-full",className:Se.badgeDotRing,children:e.jsx(it.BadgeDot,{tone:"error",variant:"solid",size:"xs"})})]}),!re&&e.jsxs(e.Fragment,{children:[e.jsx(Vn,{text:k.title,emphasis:Pe?"location":Me?"trail":void 0}),Ue&&e.jsx(it.Badge,{text:String(Ue.value),variant:Ue.variant??"info",size:"xs",border:!0}),ie&&e.jsx(E.Icon,{name:"ChevronDown",size:"sm",className:Se.chevron})]})]}),ie&&!re&&(()=>{const yt=(k.children??[]).map(xt=>{const Wt=xr(xt.badge,S[xt.id]),ht=tt(xt.to);return e.jsxs(x.Box,{as:"button",onClick:()=>T(xt.to),position:"relative",fullWidth:!0,direction:"row",align:"center",gap:"sm",paddingLeft:"sm",paddingRight:"sm",paddingBlock:"xs",height:"height-32",borderRadius:ht?"rounded-sm":"rounded-md",borderWidth:"border",borderStyle:"border-solid",hover:ht?void 0:{bg:"neutral"},className:`${Se.row} ${Se.childRow}`,"data-active":ht||void 0,"data-location":ht||void 0,"aria-current":ht?"page":void 0,children:[e.jsx(E.Icon,{name:xt.icon,size:"sm",className:Se.rowIcon}),e.jsx(Vn,{text:xt.title,emphasis:ht?"location":void 0}),Wt&&e.jsx(it.Badge,{text:String(Wt.value),variant:Wt.variant??"info",size:"xs",border:!0})]},xt.id)});return e.jsx(x.Box,{className:Se.submenu,"data-open":he||void 0,children:e.jsxs(x.Box,{position:"relative",overflow:"overflow-hidden",className:Se.submenuInner,children:[e.jsx(x.Box,{"aria-hidden":"true",position:"absolute",left:"left-0",top:"top-0",fullHeight:!0,className:Se.submenuLine}),V?e.jsx(Kr,{slotKey:k.slotKey,fallback:yt}):yt]})})})()]},k.id)};return e.jsx(Mo,{children:e.jsxs(Fo,{children:[e.jsxs(x.Box,{direction:"row",position:"relative",style:{height:"100vh","--app-header-height":qn,"--app-sidebar-width":I?"0px":be?`calc(${To(b.showLabels??!0)} + ${Be?"0px":`${$e}px`})`:G?nn:`${$e}px`,"--app-footer-zindex":I&&ge?"40":"998"},children:[I&&e.jsx(x.Box,{position:"fixed",zIndex:"40",bg:"black-alpha-a50",style:{inset:0,opacity:ge?.5:0,pointerEvents:ge?"auto":"none",transition:"opacity 0.3s"},onClick:()=>Ie(!1)}),be&&!I&&e.jsx(hi,{items:b.items,bottomItems:b.bottomItems,activeKey:qe.key,locationKey:Jt,onSelect:St,onAction:Br,logo:B.logo,panelCollapsed:Be,onExpandPanel:()=>J(!1),showLabels:b.showLabels??!0,theme:C}),e.jsxs(x.Box,{as:"aside",ref:W,"aria-hidden":Be||void 0,"data-slot":"app-sidebar","data-theme":C,bg:"surface-inverse",borderWidth:"border-r",borderStyle:"border-solid-r",borderColor:"border-base",flexShrink:I?void 0:"0",style:{width:I?"16.375rem":Be?"0px":G?nn:`${$e}px`,...Be&&{borderRightWidth:0,overflow:"hidden",visibility:"hidden"},position:I?"fixed":"relative",...I&&{inset:0,zIndex:50,transform:ge?"translateX(0)":"translateX(-100%)"},transition:Q?"none":"all 0.3s ease-in-out",minWidth:0,backgroundColor:tn},children:[e.jsx(x.Box,{onMouseEnter:()=>ye(!0),onMouseLeave:()=>ye(!1),direction:"row",align:"center",justify:"space-between",paddingInline:re?void 0:"lg",borderWidth:"border-b",borderStyle:"border-solid-b",borderColor:"border-base",position:"relative",style:{height:"var(--app-header-height, 4rem)",...re?{paddingInline:Or}:null},children:(()=>{const k=be&&!I,z=qe!=null&&qe.groupIds?qe.tooltip??qe.label:B.appName,V=!I&&G&&!ge&&!be,ie=V&&Ee;return e.jsxs(e.Fragment,{children:[e.jsxs(x.Box,{direction:"row",align:"center",gap:"sm",flex:V?"1":void 0,justify:V?"center":void 0,style:{transition:"opacity 0.2s",opacity:ie?0:1,pointerEvents:ie?"none":"auto"},children:[!k&&e.jsx("img",{src:B.logo,alt:"Logo",style:{width:"1.5rem",height:"1.5rem",flexShrink:0}}),(!G||ge)&&e.jsx(w.Text,{as:"span",fontSize:"md",fontWeight:"semibold",color:"primary",truncate:!0,style:{transition:"opacity 0.3s"},children:k?z:B.appName})]}),!I&&!G&&e.jsx(x.Box,{as:"button",onClick:()=>J(!0),"aria-label":"Collapse sidebar",display:"inline-flex",align:"center",justify:"center",flexShrink:"0",style:{color:"var(--sa-text-subtle, #8c8f97)"},children:e.jsx(E.Icon,{name:"LayoutLeft",size:"sm"})}),V&&e.jsx(x.Box,{as:"button",onClick:()=>J(!1),"aria-label":"Expand sidebar",position:"absolute",display:"inline-flex",align:"center",justify:"center",width:"width-32",height:"height-32",bg:"white",borderWidth:"border",borderStyle:"border-solid",borderColor:"border-base",borderRadius:"rounded-sm",style:{top:"50%",left:"50%",transform:"translate(-50%, -50%)",color:"var(--sa-text-primary, #292a2e)",opacity:ie?1:0,pointerEvents:ie?"auto":"none",transition:"opacity 0.2s"},children:e.jsx(E.Icon,{name:"LayoutLeft",size:"sm"})}),I&&e.jsx(x.Box,{as:"button",onClick:()=>Ie(!1),"aria-label":"Close menu",align:"center",justify:"center",borderRadius:"rounded-md",style:{padding:"0.375rem",color:"var(--sa-text-subtle, #8c8f97)"},children:e.jsx(E.Icon,{name:"Cross",size:"md"})})]})})()}),c&&e.jsx(Eo,{collapsed:I||be?!1:G,children:c}),be&&I&&e.jsx(fi,{items:b.items,activeKey:qe.key,locationKey:Jt,onSelect:St}),e.jsx(x.Box,{ref:Je,flex:"1",overflow:"overflow-y-auto",paddingBlock:"lg",children:$t.map(k=>{const z=k.items.some(V=>dt(V).some(tt));return e.jsxs(x.Box,{marginBottom:"lg",children:[re?k.name&&e.jsx(x.Box,{"aria-label":k.name,direction:"row",align:"center",justify:"center",paddingBlock:"md",children:e.jsx(x.Box,{width:"width-16",style:{height:"2px",borderRadius:"min(1px, var(--sa-radii-xs, 4px))",backgroundColor:k.color??"var(--sa-background-brand, #04254f)"}})}):k.name&&e.jsx(w.Text,{fontSize:"sm",fontWeight:"semibold",color:"subtlest",textTransform:"uppercase",truncate:!0,className:Se.groupLabel,"data-active":z||void 0,children:k.name}),e.jsx(x.Box,{paddingInline:re?void 0:"md",gap:"xs",style:re?{paddingInline:Or}:void 0,children:k.slotKey?e.jsx(Kr,{slotKey:k.slotKey,fallback:k.items.map(V=>kt(V))}):k.items.map(V=>kt(V))})]},k.id)})}),B.menuBottom&&B.menuBottom.length>0&&e.jsx(x.Box,{borderWidth:"border-t",borderStyle:"border-solid-t",borderColor:"border-base",paddingBlock:"md",paddingInline:re?void 0:"md",bg:"surface-inverse",gap:"xs",flexShrink:"0",style:{backgroundColor:tn,...re?{paddingInline:Or}:null},children:B.menuBottom.map(k=>kt(k))}),me&&e.jsx(x.Box,{role:"separator","aria-orientation":"vertical","aria-label":"Resize sidebar","aria-valuenow":$,"aria-valuemin":K,"aria-valuemax":ae,tabIndex:0,onPointerDown:Ge,onKeyDown:We,onDoubleClick:q,title:"Drag to resize · double-click to reset",position:"absolute",top:"top-0",right:"right-0",fullHeight:!0,style:{width:"6px",transform:"translateX(50%)",cursor:"col-resize",zIndex:5,touchAction:"none",background:Q?"var(--sa-background-brand, #04254f)":"transparent",transition:"background 0.15s"},onMouseEnter:k=>{Q||(k.currentTarget.style.background="var(--sa-border-bold, #0b120e40)")},onMouseLeave:k=>{Q||(k.currentTarget.style.background="transparent")}})]}),e.jsxs(x.Box,{flex:"1",overflow:"overflow-hidden",children:[e.jsxs(x.Box,{as:"header",bg:"white",borderWidth:"border-b",borderStyle:"border-solid-b",borderColor:"border-base",direction:"row",align:"center",justify:"space-between",paddingInline:"lg",flexShrink:"0",style:{height:"var(--app-header-height, 4rem)"},children:[e.jsxs(x.Box,{direction:"row",align:"center",gap:I?"lg":void 0,children:[I&&e.jsx(x.Box,{as:"button",onClick:()=>Ie(!0),align:"center",justify:"center",borderRadius:"rounded-md",style:{padding:"0.375rem",color:"var(--sa-text-subtle, #8c8f97)"},children:e.jsx(E.Icon,{name:"MenuBurger",size:"lg"})}),e.jsx(Io,{children:r})]}),e.jsxs(x.Box,{direction:"row",align:"center",gap:"md",children:[a,e.jsxs(A.Menu,{position:"bottom-right",children:[e.jsx(A.MenuButton,{children:e.jsxs(x.Box,{direction:"row",align:"center",gap:"sm",cursor:"pointer",children:[!I&&e.jsxs(x.Box,{display:"block",textAlign:"right",customMaxWidth:"12.5rem",children:[e.jsx(w.Text,{fontSize:"sm",fontWeight:"medium",color:"subtle",textAlign:"right",truncate:!0,lineHeight:"leading-none",children:s?"Loading...":(n==null?void 0:n.name)||"unknown"}),e.jsx(w.Text,{fontSize:"sm",color:"subtle",textAlign:"right",truncate:!0,children:s?"":(n==null?void 0:n.email)||"unknown"})]}),e.jsx(fr.Avatar,{size:"sm",src:(n==null?void 0:n.avatar)||void 0,name:n==null?void 0:n.name,initials:((n==null?void 0:n.name)||"U")[0].toUpperCase(),bg:"var(--sa-background-brand, #04254f)",color:"var(--sa-background-primary, #ffffff)"}),e.jsx(E.Icon,{name:"ChevronDown",size:"xs",color:"subtle"})]})}),e.jsxs(A.MenuLists,{width:280,style:{paddingBlock:"12px",paddingInline:"12px",gap:"8px",marginTop:"16px"},children:[e.jsx(A.MenuHeading,{children:e.jsxs(x.Box,{align:"center",textAlign:"center",paddingBlock:"sm",fullWidth:!0,children:[e.jsx(fr.Avatar,{customSize:64,src:(n==null?void 0:n.avatar)||void 0,name:n==null?void 0:n.name,initials:((n==null?void 0:n.name)||"U")[0].toUpperCase(),bg:"var(--sa-background-brand, #04254f)",color:"var(--sa-background-primary, #ffffff)",style:{fontSize:"1.25rem",marginBottom:"0.75rem",boxShadow:"var(--sa-shadow-sm, 0 1px 2px 0 #0000000d)"}}),e.jsx(w.Text,{fontSize:"md",fontWeight:"semibold",color:"primary",textAlign:"center",truncate:!0,style:{maxWidth:"100%"},children:(n==null?void 0:n.name)||"unknown"}),e.jsx(w.Text,{fontSize:"sm",color:"subtle",textAlign:"center",truncate:!0,style:{maxWidth:"100%"},children:(n==null?void 0:n.email)||"unknown"}),d&&e.jsx(w.Text,{fontSize:"sm",color:"subtle",textAlign:"center",truncate:!0,style:{maxWidth:"100%"},children:d})]})}),(h&&h.length>0||g)&&e.jsxs(A.MenuBody,{children:[h==null?void 0:h.map((k,z)=>e.jsx(A.MenuItem,{onClick:k.onClick,startIcon:e.jsx(E.Icon,{name:k.icon,size:"md"}),children:k.label},`${k.label}-${z}`)),g]}),m??e.jsx(A.MenuFooter,{children:e.jsx(A.MenuItem,{intent:"danger",onClick:gt,startIcon:e.jsx(E.Icon,{name:"Logout",size:"md"}),children:"Logout"})})]})]})]})]}),e.jsx(x.Box,{as:"main",ref:et,flex:"1",overflow:"overflow-y-auto",children:t||e.jsx(j,{})})]})]}),i&&l&&e.jsx(x.Box,{position:"fixed",align:"center",justify:"center",bg:"black-alpha-a70",style:{inset:0,zIndex:9999},children:l}),e.jsxs(Oe.Dialog,{isShow:N,onHide:De,children:[e.jsx(Oe.DialogTitle,{children:"Confirmation Logout"}),e.jsx(Oe.DialogBody,{children:"Are you sure you want to end the session and exit the page?"}),e.jsx(Oe.DialogFooter,{children:e.jsx(x.Box,{direction:"column",display:"flex",align:"flex-end",justify:"center",children:e.jsxs(de.Flex,{direction:"row",gap:"sm",align:"center",children:[e.jsx(x.Box,{direction:"column",children:e.jsx(H.Button,{secondary:!0,onClick:De,children:"Cancel"})}),e.jsx(x.Box,{direction:"column",children:e.jsx(H.Button,{primary:!0,onClick:ze,children:"Yes, Sure"})})]})})})]}),Te&&e.jsxs(e.Fragment,{children:[e.jsx(x.Box,{onClick:()=>Ve(null),position:"fixed",style:{inset:0,zIndex:60}}),e.jsxs(x.Box,{role:"dialog","aria-label":Te.item.title,position:"fixed",bg:"white",borderWidth:"border",borderStyle:"border-solid",borderColor:"border-base",borderRadius:"rounded-md",shadow:"shadow-lg",padding:"sm",gap:"spacing-2",style:{top:Te.top,left:Te.left,zIndex:61,minWidth:"13rem",maxWidth:"16rem"},children:[e.jsx(w.Text,{fontSize:"sm",fontWeight:"semibold",color:"gray-500",textTransform:"uppercase",style:{padding:"0.25rem 0.5rem 0.5rem",letterSpacing:"0.05em"},children:Te.item.title}),(Kt=Te.item.children)==null?void 0:Kt.map(k=>{const z=tt(k.to),V=xr(k.badge,S[k.id]);return e.jsxs(x.Box,{as:"button",onClick:()=>{T(k.to),Ve(null)},fullWidth:!0,direction:"row",align:"center",gap:"md",paddingBlock:"sm",paddingInline:"md",borderRadius:"rounded-md",borderWidth:"border",borderStyle:"border-solid",hover:z?void 0:{bg:"primary-inverse"},className:Se.row,"data-active":z||void 0,"data-location":z||void 0,"aria-current":z?"page":void 0,children:[k.icon&&e.jsx(E.Icon,{name:k.icon,size:"sm",className:Se.rowIcon}),e.jsx(w.Text,{as:"span",fontSize:"md",fontWeight:z?"semibold":"normal",whiteSpace:"nowrap",className:Se.popoverLabel,children:k.title}),V&&e.jsx(it.Badge,{text:String(V.value),variant:V.variant??"info",size:"xs",border:!0})]},k.id)})]})]})]})})}const Zt=u.forwardRef(({children:t,...r},n)=>e.jsx(x.Box,{ref:n,role:"button",cursor:"pointer","aria-pressed":"true",display:"inline-block",tabIndex:0,...r,children:t})),Gn=({title:t,iconName:r,textColor:n,iconColor:s,hoverTextColor:o,hoverIconColor:i})=>{const[l,c]=u.useState(!1),a=s??"var(--sa-text-subtle, #8c8f97)",d=n??"var(--sa-text-subtle, #8c8f97)",h=i??"var(--sa-text-subtle, #8c8f97)",g=o??"var(--sa-text-primary, #292a2e)";return e.jsxs(x.Box,{direction:"row",gap:"xs",align:"center",onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),style:{cursor:"pointer"},children:[e.jsx(E.Icon,{name:r||"ChevronLeft",size:"xs",style:{color:l?h:a,transition:"color 0.15s ease"}}),e.jsx(w.Text,{variant:"sub-h3",style:{color:l?g:d,transition:"color 0.15s ease"},children:t||"Back"})]})},yi=({items:t,separator:r="/",iconName:n,iconColor:s,hoverIconColor:o})=>{const{Link:i}=at(),[l,c]=u.useState(!1),a=s??"var(--sa-text-subtle, #8c8f97)",d=o??"var(--sa-text-subtle, #8c8f97)",h=t.length>1?t[0]:void 0,g=!!(h!=null&&h.to||h!=null&&h.onClick),m=e.jsx(E.Icon,{name:n||"ChevronLeft",size:"xs",onMouseEnter:g?()=>c(!0):void 0,onMouseLeave:g?()=>c(!1):void 0,style:{color:g&&l?d:a,transition:"color 0.15s ease",cursor:g?"pointer":void 0}}),y=h!=null&&h.to?e.jsx(i,{to:h.to,replace:!0,style:{textDecoration:"none"},children:m}):h!=null&&h.onClick?e.jsx(Zt,{onClick:h.onClick,children:m}):m;return e.jsxs(x.Box,{direction:"row",gap:"xs",align:"center",children:[y,e.jsx(It.Breadcrumb,{separator:r,size:"md",children:t.map((b,C)=>{const O=C===t.length-1;return b.to&&!O?e.jsx(It.BreadcrumbItem,{children:e.jsx(i,{to:b.to,children:b.label})},C):e.jsx(It.BreadcrumbItem,{currentPage:O,children:e.jsx(It.BreadcrumbLink,{onClick:O?void 0:b.onClick,children:b.label})},C)})})]})},bi=t=>{const{Link:r}=at(),{items:n,separator:s,onClick:o,navigateTo:i,...l}=t;return n&&n.length>0?e.jsx(yi,{items:n,separator:s,iconName:l.iconName,iconColor:l.iconColor,hoverIconColor:l.hoverIconColor}):i?e.jsx(x.Box,{direction:"row",children:e.jsx(r,{to:i,replace:!0,style:{textDecoration:"none"},children:e.jsx(Gn,{...l})})}):e.jsx(x.Box,{direction:"row",children:e.jsx(Zt,{onClick:o,children:e.jsx(Gn,{...l})})})},Ar=[{icon:"var(--sa-color-brand-400, #3366b7)",activeBg:"var(--sa-color-brand-50, #e6edf6)",activeBorder:"var(--sa-color-brand-300, #668cc9)",activeShadow:"rgba(51, 102, 183, 0.25)"},{icon:"var(--sa-color-warning-400, #ed9f30)",activeBg:"var(--sa-color-warning-50, #fef2e6)",activeBorder:"var(--sa-color-warning-300, #f1b259)",activeShadow:"rgba(237, 159, 48, 0.25)"},{icon:"var(--sa-color-secondary-300, #5468e1)",activeBg:"var(--sa-color-secondary-50, #e6e9fb)",activeBorder:"var(--sa-color-secondary-200, #8a98ea)",activeShadow:"rgba(84, 104, 225, 0.25)"},{icon:"var(--sa-color-info-500, #00abeb)",activeBg:"var(--sa-color-info-50, #effaff)",activeBorder:"var(--sa-color-info-300, #75dbff)",activeShadow:"rgba(0, 171, 235, 0.25)"},{icon:"var(--sa-color-success-500, #30ce84)",activeBg:"var(--sa-color-success-50, #ecfff6)",activeBorder:"var(--sa-color-success-300, #75dead)",activeShadow:"rgba(48, 206, 132, 0.25)"},{icon:"var(--sa-color-error-400, #ff758f)",activeBg:"var(--sa-color-error-50, #fff0f3)",activeBorder:"var(--sa-color-error-300, #ff8fa3)",activeShadow:"rgba(255, 117, 143, 0.25)"}];function Qn(t,r,n){return{display:"flex",alignItems:"center",justifyContent:"center",width:"64px",height:"64px",borderRadius:"var(--sa-radii-sm, 6px)",border:t?`2px solid ${n.activeBorder}`:"2px solid var(--sa-color-gray-200, #f0f1f2)",backgroundColor:t?n.activeBg:"var(--sa-color-gray-50, #ffffff)",boxShadow:t?r?`0 8px 20px ${n.activeShadow.replace("0.25","0.35")}`:`0 2px 8px ${n.activeShadow}`:r?"0 8px 20px rgba(0, 0, 0, 0.14)":"0 1px 4px rgba(0, 0, 0, 0.08)",transform:r?"translateY(-3px) scale(1.05)":"translateY(0) scale(1)",transition:"box-shadow 0.2s ease, transform 0.2s ease, background-color 0.15s ease, border-color 0.15s ease"}}const Un={fontSize:"11px",fontWeight:500,textAlign:"center",overflowWrap:"normal",wordBreak:"normal",color:"var(--sa-text-primary, #292a2e)",lineHeight:"1.3",maxWidth:"80px"},Yn={display:"flex",flexDirection:"column",alignItems:"center",gap:"8px",background:"none",border:"none",cursor:"pointer",padding:0};function Ro({isShow:t,onHide:r,menus:n,selectedGroupId:s,onSelect:o}){const[i,l]=u.useState(void 0),c=d=>{o(d),r()},a=Ar[0];return e.jsx(Oe.Dialog,{isShow:t,onHide:r,style:{width:560,background:"transparent",boxShadow:"none",border:"none"},children:e.jsx(Oe.DialogBody,{children:e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(5, 1fr)",gap:"16px"},children:[e.jsxs("button",{onClick:()=>c(null),onMouseEnter:()=>l("all"),onMouseLeave:()=>l(void 0),style:Yn,children:[e.jsx("div",{style:Qn(s===null,i==="all",a),children:e.jsx("div",{style:{color:a.icon,display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(E.Icon,{name:"Grid",size:"lg",style:{width:32,height:32}})})}),e.jsx("span",{style:Un,children:"Semua"})]}),n.map((d,h)=>{var C;const g=s===d.id,m=i===d.id,y=((C=d.items[0])==null?void 0:C.icon)??"Grid",b=Ar[(h+1)%Ar.length];return e.jsxs("button",{onClick:()=>c(d.id),onMouseEnter:()=>l(d.id),onMouseLeave:()=>l(void 0),style:Yn,children:[e.jsx("div",{style:Qn(g,m,b),children:e.jsx("div",{style:{color:b.icon,display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(E.Icon,{name:y,size:"lg",style:{width:32,height:32}})})}),e.jsx("span",{style:Un,children:d.name})]},d.id)})]})})})}function ji({onSelect:t,"aria-label":r="Pilih module"}={}){const n=an(),{useNavigate:s}=at(),o=s(),{selectedGroupId:i,setSelectedGroupId:l}=mn(),[c,a]=u.useState(!1),d=h=>{var g;if(l(h),h!==null){const m=n.menus.find(b=>b.id===h),y=(g=m==null?void 0:m.items[0])==null?void 0:g.to;y&&o(y)}t==null||t(h)};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{position:"relative"},children:[e.jsx("button",{onClick:()=>a(!0),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"2.25rem",height:"2.25rem",borderRadius:"var(--sa-radii-sm, 0.25rem)",border:"1px solid var(--sa-border-subtle, #0b120e24)",color:"var(--sa-text-subtle, #8c8f97)",backgroundColor:"transparent",cursor:"pointer"},"aria-label":r,onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--sa-background-primary-inverse, #f8f8f8)"},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent"},children:e.jsx(E.Icon,{name:"GridApplication",size:"sm"})}),i!==null&&e.jsx("span",{style:{position:"absolute",top:"0.25rem",right:"0.25rem",width:"0.5rem",height:"0.5rem",borderRadius:"9999px",backgroundColor:"var(--sa-color-brand-500, #1a4fa0)"},"aria-hidden":"true"})]}),e.jsx(Ro,{isShow:c,onHide:()=>a(!1),menus:n.menus.filter(h=>h.parentGroupId===void 0),selectedGroupId:i,onSelect:d})]})}const vi=(t,r)=>{const n=[];if(r===0)return n.push(t),n;for(let s=0;s<t.length;s+=r){const o=t.slice(s,s+r);n.push(o)}return n},Ci=u.memo(({value:t,label:r,separator:n,labelWidth:s,lastIndex:o,labelAlign:i="top"})=>{const l=u.useMemo(()=>({padding:0,paddingBottom:o?0:12,verticalAlign:i}),[o,i]),c=u.useMemo(()=>({padding:0,paddingRight:12,paddingLeft:12,paddingBottom:o?0:12,verticalAlign:i}),[o,i]),a=()=>typeof r=="string"?e.jsx(w.Text,{fontWeight:"medium",color:"subtlest",children:r}):r,d=()=>typeof t=="string"||typeof t=="number"?e.jsx(w.Text,{color:"primary",fontWeight:"medium",children:t}):t,h=()=>typeof n=="string"||typeof n=="number"?e.jsx(w.Text,{fontWeight:"medium",color:"subtlest",children:n}):n;return e.jsxs(Z.Tr,{children:[e.jsx(Z.Td,{style:l,width:s,children:a()}),n?e.jsx(Z.Td,{style:c,width:24,children:h()}):null,e.jsx(Z.Td,{style:l,children:d()})]})}),wi=u.memo(({fields:t,separator:r,labelWidth:n})=>e.jsx(Z.Table,{withColumnBorder:!1,withRowBorder:!1,children:t.map((s,o)=>e.jsx(Ci,{separator:r,labelWidth:n,lastIndex:o===t.length-1,...s},`field-group-field-${o}`))})),Di=u.memo(({maxRow:t=0,maxColumn:r=2,separator:n=":",fields:s=[],labelWidth:o=150,bordered:i=!1})=>{const l=u.useMemo(()=>vi(s,t),[s,t]),c=l.length>2,a=()=>{switch(r){case 1:return"width-full";case 2:return"width-1-2";case 3:return"width-1-3";case 4:return"width-1-4";default:return"width-1-2"}};return e.jsx(x.Box,{gap:c?void 0:"lg",direction:"row",flexWrap:"wrap",borderRadius:"rounded-sm",padding:"lg",paddingBottom:c?"xs":"lg",bg:"accent-dark-tertiary",borderWidth:i?"border":void 0,borderStyle:i?"border-solid":void 0,borderColor:i?"border-subtle":void 0,children:l.map((d,h)=>e.jsx(x.Box,{direction:"column",flex:c?void 0:"1",width:c?a():void 0,marginBottom:c?"lg":void 0,children:e.jsx(wi,{labelWidth:o,fields:d,separator:n})},h))})}),Si=({backButton:t})=>{const[r,n]=u.useState(!1),s=(t==null?void 0:t.iconColor)??"var(--sa-text-subtle, #8c8f97)",o=(t==null?void 0:t.textColor)??"var(--sa-text-subtle, #8c8f97)",i=(t==null?void 0:t.hoverIconColor)??"var(--sa-text-subtle, #8c8f97)",l=(t==null?void 0:t.hoverTextColor)??"var(--sa-text-primary, #292a2e)";return e.jsxs(x.Box,{direction:"row",gap:"xs",align:"center",onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),style:{cursor:"pointer"},children:[e.jsx(E.Icon,{name:(t==null?void 0:t.iconName)||"ChevronLeft",size:"xs",style:{color:r?i:s,transition:"color 0.15s ease"}}),e.jsx(w.Text,{variant:"sub-h3",style:{color:r?l:o,textDecoration:r?"underline":"none",transition:"color 0.15s ease"},children:(t==null?void 0:t.title)||"Back"})]})},Oo=({backButton:t,title:r,titleIcon:n,titleTag:s,children:o,header:i=!0,headerBorder:l=!1,disableAnimation:c=!1,scrollable:a=!1,stickyHeader:d=!1,subHeaders:h,action:g,titleTagProps:m,containerProps:y,headerProps:b})=>{const C=ke.useMediaQuery("md"),{Link:O,useNavigate:M}=at(),L=M(),j=t==null?void 0:t.show,D=()=>{if(typeof(t==null?void 0:t.onClick)=="function"){t.onClick();return}L(-1,{replace:!0})},R=()=>{if(!g)return null;if(u.isValidElement(g))return g;const I=g.filter(N=>N&&(N.title||N.icon));return I.length===0?null:C?e.jsx(x.Box,{direction:"row",gap:"md",children:I.map(({title:N,icon:Y,buttonProps:G,onClick:J},$)=>e.jsx(H.Button,{iconLeft:Y?e.jsx(E.Icon,{name:Y,size:"md"}):void 0,onClick:J,...G,children:N},`action-${$}`))}):e.jsxs(A.Menu,{position:"bottom-right",children:[e.jsx(A.MenuButton,{children:e.jsx(H.Button,{variant:"tertiary",size:"sm",iconLeft:e.jsx(E.Icon,{name:"MenuBurger"}),"aria-label":"Actions"})}),e.jsx(A.MenuLists,{children:e.jsx(A.MenuBody,{style:{minWidth:200},children:I.map(({title:N,icon:Y,buttonProps:G,onClick:J},$)=>{const le=(G==null?void 0:G.tone)==="error"||(G==null?void 0:G.danger)===!0;return e.jsx(A.MenuItem,{intent:le?"danger":void 0,disabled:G==null?void 0:G.disabled,startIcon:Y?e.jsx(E.Icon,{name:Y}):void 0,onClick:J,children:N},`action-${$}`)})})})]})},B=()=>{const I=e.jsx(Si,{backButton:t});return t!=null&&t.navigateTo?e.jsx(x.Box,{direction:"row",children:e.jsx(O,{to:t.navigateTo,replace:!0,style:{textDecoration:"none"},children:I})}):e.jsx(x.Box,{direction:"row",children:e.jsx(Zt,{onClick:D,children:I})})},S=()=>{const I=!!r,N=Array.isArray(g)&&g.length>0,Y=u.isValidElement(g)?!0:N;if(!I&&!Y&&!j)return null;const J=C||!C&&N;return e.jsxs(x.Box,{direction:"column",gap:"xs",paddingBlock:(b==null?void 0:b.paddingBlock)??"sm",paddingInline:(b==null?void 0:b.paddingInline)??"md",...b,style:{...l?{boxShadow:"inset 0 -1px 0 0 var(--sa-border-subtle, #0b120e24)"}:{},...b==null?void 0:b.style},children:[j&&B(),(I||Y)&&e.jsxs(x.Box,{direction:J?"row":"column",gap:"sm",justify:"space-between",align:J?"center":"flex-start",children:[I?typeof r=="string"?e.jsxs(x.Box,{direction:"row",gap:"lg",align:"center",children:[e.jsxs(x.Box,{direction:"row",gap:"sm",align:"center",children:[n&&e.jsx(E.Icon,{name:n,size:"md",color:"primary"}),e.jsx(w.Text,{variant:"h3",fontWeight:"semibold",children:r})]}),s&&e.jsx(it.Badge,{border:!0,size:"lg",text:s,...m})]}):r:null,R()]})]})},T=()=>{if(!h||h.length===0)return null;const I=h.filter(G=>G.show!==!1);if(I.length===0)return null;let N=0,Y=-1/0;return I.forEach((G,J)=>{const $=G.order??0;$>=Y&&(Y=$,N=J)}),I.map(({content:G,order:J,borderBottom:$=!0,keepBottomPadding:le=!1,paddingInline:q=!0,paddingBlock:K=!0},ae)=>e.jsx(x.Box,{direction:"column",paddingTop:K?"sm":"spacing-0",paddingBottom:K&&($||le||ae===N)?"sm":"spacing-0",paddingInline:q?"md":"spacing-0",style:{...$?{boxShadow:"inset 0 -1px 0 0 var(--sa-border-subtle, #0b120e24)"}:{},...J!==void 0?{order:J}:{}},children:G},`sub-header-${ae}`))},P=()=>{const I=i?S():null,N=T();return!I&&!N?null:e.jsxs(x.Box,{direction:"column",style:{...a?{position:"sticky",left:0,...d?{top:0}:{},zIndex:2,background:"var(--sa-background-primary, #ffffff)"}:{},marginBottom:N?"var(--sa-spacing-0)":"var(--sa-spacing-md)"},children:[I,N]})},X=()=>o;return e.jsxs(x.Box,{direction:"column",as:"main",...y,style:{...a?{height:"100%",minHeight:0,overflow:"auto"}:{},...(y==null?void 0:y.style)??{},...c?{}:{animation:"pageLayoutEnter 320ms cubic-bezier(0.16, 1, 0.3, 1) backwards"}},children:[P(),X()]})},ki=t=>{const{useLocation:r}=at(),n=r();return e.jsx(Oo,{...t},n.pathname)},Bi=t=>t.remountOnRouteChange?e.jsx(ki,{...t}):e.jsx(Oo,{...t}),Ei=u.memo(Bi),Fi={icon:"Cross",title:""},Ii=320,Xn=16,Jn=4,Mi=8,Ao=u.forwardRef(({onHide:t,show:r,withBlur:n=!1,style:s,children:o,closeButton:i=Fi,paddingHorizontal:l=!0,width:c,minWidth:a,maxWidth:d,hideBackdrop:h=!1,title:g,headerAction:m,header:y=!0,widthPresets:b,resizable:C=!0,resizeMin:O=Ii,resizeMax:M,onWidthChange:L},j)=>{const R=!ke.useMediaQuery("md"),B=c??d??a??"357px",S=b??[],T=S.length>1,[P,X]=u.useState(()=>{const oe=S.indexOf(B);return oe>=0?oe:0}),[I,N]=u.useState(null),[Y,G]=u.useState(!1),[J,$]=u.useState(!1),le=u.useRef(null),q=oe=>{le.current=oe,typeof j=="function"?j(oe):j&&(j.current=oe)},K=T?S[P]:B,ae=I!=null?`${I}px`:K,ge=C&&!R,Ie=P===S.length-1,Ee=()=>{const oe=(P+1)%S.length;N(null),X(oe),L==null||L(S[oe])},ye=u.useCallback(oe=>{const we=M??window.innerWidth;return Math.min(Math.max(oe,O),we)},[O,M]),fe=u.useRef(null),Ne=oe=>{if(!ge)return;oe.preventDefault();const we=oe.currentTarget;we.setPointerCapture(oe.pointerId),G(!0);const be=document.body.style.cursor,re=document.body.style.userSelect;document.body.style.cursor="col-resize",document.body.style.userSelect="none";let Be=null;const Je=W=>{const Q=ye(window.innerWidth-W.clientX);fe.current=Q,Be==null&&(Be=window.requestAnimationFrame(()=>{Be=null,fe.current!=null&&N(fe.current)}))},et=W=>{Be!=null&&window.cancelAnimationFrame(Be),fe.current!=null&&N(fe.current),we.releasePointerCapture(W.pointerId),we.removeEventListener("pointermove",Je),we.removeEventListener("pointerup",et),we.removeEventListener("pointercancel",et),document.body.style.cursor=be,document.body.style.userSelect=re,G(!1),fe.current!=null&&(L==null||L(`${fe.current}px`))};we.addEventListener("pointermove",Je),we.addEventListener("pointerup",et),we.addEventListener("pointercancel",et)},Te=oe=>{var Be;if(!ge||oe.key!=="ArrowLeft"&&oe.key!=="ArrowRight")return;oe.preventDefault();const we=oe.key==="ArrowLeft"?Xn:-Xn,be=I??((Be=le.current)==null?void 0:Be.offsetWidth)??O,re=ye(be+we);N(re),L==null||L(`${re}px`)},Ve=()=>{ge&&(N(null),L==null||L(K))};return e.jsx(mr.Drawer,{blur:n,isShow:r,position:"right",onHide:t,ref:q,size:ae,style:s,flush:!0,radius:"none",hideBackdrop:h,children:e.jsxs(x.Box,{direction:"column",height:"height-full",children:[ge?e.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":"Ubah lebar panel",tabIndex:0,onPointerDown:Ne,onKeyDown:Te,onDoubleClick:Ve,title:"Tarik untuk mengubah lebar — klik dua kali untuk reset",onPointerEnter:()=>$(!0),onPointerLeave:()=>$(!1),style:{position:"absolute",left:0,top:0,bottom:0,width:Mi,cursor:"col-resize",zIndex:1,background:Y||J?`linear-gradient(to right, var(--sa-border-brand, var(--sa-border-subtle)) 0 ${Jn}px, transparent ${Jn}px)`:"transparent",transition:"background 0.15s",touchAction:"none"}}):null,y?e.jsxs(x.Box,{direction:"row",align:"center",justify:"space-between",gap:"sm",paddingInline:"md",borderWidth:"border-b",borderStyle:"border-solid-b",borderColor:"border-base",customHeight:"var(--app-header-height, 44px)",flexShrink:"0",children:[e.jsx(x.Box,{direction:"row",align:"center",gap:"sm",overflow:"overflow-hidden",children:typeof g=="string"?e.jsx(w.Text,{fontSize:"md",fontWeight:"bold",children:g}):g}),e.jsxs(x.Box,{direction:"row",align:"center",gap:"sm",flexShrink:"0",children:[m,T?e.jsx(H.Button,{variant:"tertiary",tone:"neutral",size:"xs",onClick:Ee,"aria-label":Ie?"Kecilkan panel":"Lebarkan panel",iconRight:e.jsx(E.Icon,{name:Ie?"ChevronRight":"ChevronLeft"})}):null,i?e.jsx(H.Button,{variant:"tertiary",tone:"neutral",size:"xs",onClick:t,"aria-label":i.title||"Tutup",iconRight:e.jsx(E.Icon,{name:i.icon}),children:i.title||void 0}):null]})]}):null,e.jsx(x.Box,{direction:"column",paddingBlock:"md",paddingInline:l?"md":"spacing-0",overflow:"overflow-y-auto",style:{flex:1,minHeight:0},children:o})]})})}),gn=u.memo(({children:t,borderBottom:r=!0,padding:n=!0})=>{const s=ke.useMediaQuery("lg");return e.jsx(x.Box,{direction:"column",padding:n?"md":"spacing-0",paddingLeft:n?"md":"spacing-0",paddingRight:n?"md":"spacing-0",style:r?{borderBottom:"1px solid var(--sa-border-subtle, #0b120e24)"}:void 0,children:t})}),pn=u.memo(({children:t,borderTop:r=!0,padding:n=!0})=>{const s=ke.useMediaQuery("lg");return e.jsx(x.Box,{direction:"column",padding:n?"md":"spacing-0",paddingLeft:n?"md":"spacing-0",paddingRight:n?"md":"spacing-0",style:r?{borderTop:"1px solid var(--sa-border-subtle, #0b120e24)"}:void 0,children:t})}),Li=u.memo(({children:t,...r})=>e.jsx(x.Box,{direction:"column",padding:"md",paddingLeft:"md",paddingRight:"md",gap:"md",...r,children:t})),Ti=u.memo(({children:t,title:r,titleTag:n,action:s,header:o,footer:i,actionContainer:l,containerProps:c,bodyProps:a,headerProps:d={borderBottom:!0},footerProps:h={borderTop:!0},variantTag:g="info"})=>{const m=ke.useMediaQuery("lg"),y=()=>n?e.jsxs(x.Box,{direction:"row",gap:"sm",align:"center",children:[e.jsx(w.Text,{fontWeight:"medium",children:r}),e.jsx(it.Badges,{border:!0,text:n,variant:g})]}):e.jsx(w.Text,{fontWeight:"medium",children:r}),b=()=>o||e.jsxs(x.Box,{direction:"row",justify:"space-between",align:"flex-start",gap:"md",children:[e.jsx(x.Box,{direction:"column",children:r?y():null}),e.jsx(x.Box,{direction:"column",style:m?{width:"100%",maxWidth:"19.313rem"}:{flex:1},...l,children:s??null})]}),C=!!(o||r||s);return e.jsxs(x.Box,{direction:"column",bg:"white",borderRadius:"rounded-xs",as:"section",borderWidth:"border",borderStyle:"border-solid",borderColor:"border-base",...c,style:{backgroundColor:"var(--sa-background-primary, #ffffff)",...(c==null?void 0:c.style)??{}},children:[o!==null&&C?e.jsx(gn,{...d,children:b()}):null,e.jsx(Li,{...a,children:t}),i?e.jsx(pn,{...h,children:i}):null]})}),Ri=t=>e.jsx(w.Text,{variant:"h1",children:t.children,...t.props}),Oi=t=>e.jsx(w.Text,{variant:"h2",children:t.children,...t.props}),Ai=t=>e.jsx(w.Text,{variant:"h3",children:t.children,...t.props}),Wi=t=>e.jsx(w.Text,{variant:"h4",children:t.children,...t.props}),zi=t=>e.jsx(w.Text,{variant:"h5",children:t.children,...t.props}),Hi=t=>e.jsx(w.Text,{variant:"h6",children:t.children,...t.props}),Pi=t=>e.jsx(w.Text,{variant:"sub-h1",children:t.children,...t.props}),_i=t=>e.jsx(w.Text,{variant:"sub-h2",children:t.children,...t.props}),Ni=t=>e.jsx(w.Text,{variant:"sub-h3",children:t.children,...t.props}),Vi=t=>e.jsx(w.Text,{variant:"body-1",children:t.children,...t.props}),qi=t=>e.jsx(w.Text,{variant:"body-2",children:t.children,...t.props}),Zi=t=>e.jsx(w.Text,{variant:"body-3",children:t.children,...t.props}),nt={H1:Ri,H2:Oi,H3:Ai,H4:Wi,H5:zi,H6:Hi,SubH1:Pi,SubH2:_i,SubH3:Ni,Body1:Vi,Body2:qi,Body3:Zi},Ze=()=>{const{useSearchParams:t,useParams:r,useLocation:n}=at(),[s,o]=t(),i=Tt.searchParamsToObject(s.toString()),l=r(),c=n(),a=l.id;return{setSearchParams:o,searchParams:s,searchQueries:i,isHasQuery:(y,b)=>s.has(y)&&s.get(y)===b,getQueryParam:y=>s.get(y),getRouteParam:y=>l[y],params:l,location:c,id:a,hasId:!!a}},Wo=t=>JSON.stringify(t),zo=t=>JSON.stringify(t),Ho=t=>JSON.stringify(t),Po=t=>JSON.stringify(t),Gi=t=>t,Qi=t=>JSON.stringify(t),ct=t=>{if(typeof t!="string"||t==="")return{};try{const r=JSON.parse(t);return!r||typeof r!="object"||Array.isArray(r)?{}:r}catch{return{}}},lt=t=>{if(!(typeof t!="string"||t===""))try{return JSON.parse(t)}catch{return}},qt=({value:t,name:r,type:n,withSearchParam:s=!0,setSearchParams:o,searchQueries:i,dropdownSearchKey:l,filterKey:c="filter",pageKey:a="page"})=>{if(s){let d;switch(n){case"search":d=Gi(t);break;case"dropdown":case"dropdown-multiple":d=Wo(t);break;case"radio":d=zo(t);break;case"date-range":d=Ho(t);break;case"advanced-date-range":d=Qi(t);break;case"date":d=Po(t);break;default:d=t;break}if(typeof d<"u"){const h={...ct(i[c]),[r]:d},g={...i};l&&typeof l=="string"&&delete g[l],delete g[a];const m={...g,[c]:JSON.stringify(h)},y=new URLSearchParams(i).toString(),b=new URLSearchParams(m).toString();if(y===b)return;o(m)}}},hr=({name:t,filterKey:r="filter",searchParams:n,get:s})=>{var c,a,d,h;const o=n.get(r)||void 0,i=o&&typeof o=="string"?ct(o):void 0,l=i?i[t]:void 0;return s==="label"&&l?(a=(c=lt(l))==null?void 0:c[0])==null?void 0:a.label:s==="value"&&l?(h=(d=lt(l))==null?void 0:d[0])==null?void 0:h.value:l},_o=({name:t,filterKey:r="filter",searchParams:n,get:s})=>{var c,a;const o=n.get(r)||void 0,i=o&&typeof o=="string"?ct(o):void 0,l=i?i[t]:void 0;return s==="label"&&l?(c=lt(l))==null?void 0:c.map(d=>d.label):s==="value"&&l?(a=lt(l))==null?void 0:a.map(d=>d.value):s==="array"&&l?lt(l):l},Ui=({name:t,filterKey:r="filter",searchParams:n,get:s})=>{var c,a,d;const o=n.get(r)||void 0,i=o&&typeof o=="string"?ct(o):void 0,l=i?i[t]:void 0;return s==="id"&&l?(c=lt(l))==null?void 0:c.id:s==="label"&&l?(a=lt(l))==null?void 0:a.label:s==="value"&&l?(d=lt(l))==null?void 0:d.value:l},jr=(t,r,n)=>{const s=r.get(n||"filter")||void 0,o=s&&typeof s=="string"?ct(s):void 0;return o?o[t]:void 0},Yi=({name:t,filterKey:r="filter",searchParams:n})=>{var l,c;const s=n.get(r||"filter")||void 0,o=s&&typeof s=="string"?ct(s):void 0,i=o?o[t]:void 0;return{start:i?(l=lt(i))==null?void 0:l.from:void 0,end:i?(c=lt(i))==null?void 0:c.to:void 0}},No=({name:t,filterKey:r="filter",searchParams:n})=>{const s=n.get(r||"filter")||void 0,o=s&&typeof s=="string"?ct(s):void 0,i=o?o[t]:void 0;return i?lt(i):void 0},Xi=(t,{filterKey:r="filter",perPageKey:n="perPage",pageKey:s="page"})=>{const o=t.get(r)||void 0,i=t.get(n)||void 0,l=t.get(s)||void 0;return!!o||!!i||!!l},Vo=({isOpen:t,onClose:r,filterKey:n,pageKey:s,filters:o})=>{const{searchParams:i,setSearchParams:l,searchQueries:c}=Ze(),[a,d]=u.useState({}),h=()=>{i.delete(n||"filter"),l(i)},g=(m,y)=>{switch(m.type){case"radio":{const{show:b=!0}=m;return b&&e.jsx(x.Box,{direction:"column",children:e.jsx(x.Box,{direction:"column",children:m.title})},y)}case"dropdown":{const{show:b=!0}=m;return b&&e.jsx(x.Box,{direction:"column",children:e.jsx(x.Box,{direction:"column",children:m.title})},y)}case"date-range":return e.jsx(x.Box,{direction:"column",children:e.jsx(x.Box,{direction:"column",children:m.title})},y);case"date":return e.jsx(x.Box,{direction:"column",children:e.jsx(x.Box,{direction:"column",children:m.title})},y);case"dropdown-multiple":{const{show:b=!0}=m;return b&&e.jsx(x.Box,{direction:"column",children:e.jsx(x.Box,{direction:"column",children:m.title})},y)}default:return null}};return e.jsx(Ao,{onHide:r,show:t||!1,children:e.jsxs(x.Box,{direction:"column",gap:"md",children:[e.jsxs(de.Flex,{direction:"row",justify:"space-between",align:"center",children:[e.jsx(x.Box,{direction:"column",children:"Filter"}),e.jsx(x.Box,{direction:"column",style:{cursor:"pointer"},onClick:h,children:"Reset"})]}),o==null?void 0:o.map((m,y)=>g(m,y))]})})},qo=({searchKey:t="q",statusKey:r="status",searchPlaceholder:n="Search",searchHighlightPlaceholder:s,extendedFilter:o,showSearchFilter:i=!0,showStatusFilter:l=!0,filterKey:c="filter",pageKey:a="page",customWidthSearch:d,handleOnReset:h,filterConfigs:g,buttonToggleProps:m,position:y="right",titleSearchLabel:b="Work Order",withTitleLabels:C=!1})=>{const M=(m==null?void 0:m.isShowLabel)??!0,[L,j]=u.useState(!1),[D,R]=u.useState(0),B=()=>{R(q=>q+1)},{searchParams:S,setSearchParams:T,getQueryParam:P}=Ze(),X=Tt.searchParamsToObject(S.toString()),I=jr(t,S,c)||"",[N,Y]=u.useState(I),G=P(c),$=!!(G&&!(()=>{if(G)try{const q=JSON.parse(G);return Object.keys(q).length===1&&q[t]===""}catch(q){console.error("Filter parameter is not a valid JSON:",q)}return!1})()),le=ke.useMediaQuery("md");return u.useEffect(()=>{Y(I)},[I]),u.useEffect(()=>{if(N===I)return;const q=window.setTimeout(()=>{qt({value:N,name:t,type:"search",searchQueries:X,setSearchParams:T,filterKey:c,pageKey:a})},350);return()=>{window.clearTimeout(q)}},[N,I,t,X,T,c,a]),e.jsxs(de.Flex,{gap:"md",style:{flexDirection:le&&y==="left"?"row":le&&y==="right"?"row-reverse":"column"},align:"flex-end",children:[$&&e.jsx(x.Box,{direction:"column",justify:"flex-end",children:e.jsx(H.Button,{onClick:()=>{const q=new URLSearchParams(S);q.delete(c),T(q),Y(""),B(),h&&h()},variant:"outline",tone:"neutral",children:e.jsx(w.Text,{color:"error",fontWeight:"semibold",children:"Reset"})})}),o==null?void 0:o.map(({minWidth:q,content:K,title:ae,onClickContainer:ge},Ie)=>e.jsxs(x.Box,{direction:"column",gap:"sm",onClick:ge,style:{minWidth:q},children:[ae&&e.jsx(nt.SubH3,{children:ae}),K]},`extended-filter-${Ie}-${D}`)),!!(g!=null&&g.length)&&e.jsx(H.Button,{primary:$,secondary:!$,iconLeft:e.jsx(E.Icon,{size:"sm",name:(m==null?void 0:m.icon)||"FilterHorizontal",style:{color:G?"var(--sa-background-brand, #04254f)":"var(--sa-text-primary, #292a2e)"}}),fullWidth:!le,onClick:()=>j(!0),children:M?"Filter":void 0}),l&&e.jsxs(x.Box,{direction:"column",gap:"sm",style:{minWidth:"126px"},children:[C&&e.jsx(nt.SubH3,{children:"Status"}),e.jsx(Lt.Dropdown,{dropdownLists:[{label:"Active",value:"active"},{label:"InActive",value:"inactive"}],defaultValue:hr({get:"value",name:r,searchParams:S,filterKey:c})?[{label:hr({get:"value",name:r,searchParams:S,filterKey:c})==="active"?"Active":"InActive",value:hr({get:"value",name:r,searchParams:S,filterKey:c})}]:[],onChange:q=>qt({value:q,name:r,type:"dropdown",searchQueries:X,setSearchParams:T,filterKey:c}),placeholder:C?"All":"All Status"},D)]}),i&&e.jsxs(x.Box,{direction:"column",gap:"sm",style:{width:d&&le?d:le?"310px":""},children:[C&&e.jsxs(nt.SubH3,{children:["Search for ",b]}),e.jsx(mt.Input,{placeholder:n,leftIcon:e.jsx(E.Icon,{name:"Search",width:20,height:20}),onChange:q=>Y(q.target.value),value:N,fullWidth:!0},D+1+c)]}),e.jsx(Vo,{isOpen:L,onClose:()=>j(!1),filterKey:c,filters:g,pageKey:a})]})},Ji=t=>t==="checkbox-multiple"?"dropdown-multiple":t==="radio"?"dropdown":t==="date-compact"?"date":t==="text"?"search":t;function yn({configs:t,filterKey:r="filter",activeFilterKey:n="filters",pageKey:s="page",searchKey:o="q"}){const{searchParams:i,setSearchParams:l,searchQueries:c}=Ze(),a=u.useMemo(()=>Object.fromEntries(t.map(D=>[D.key,D])),[t]),d=u.useMemo(()=>{const D=(i.get(n)||"").split(",").map(B=>B.trim()).filter(Boolean),R=Object.keys(ct(i.get(r))).filter(B=>B!==o);return t.map(B=>B.key).filter(B=>{const S=a[B];return(S==null?void 0:S.locked)||D.includes(B)||R.includes(B)})},[i,n,r,o,t,a]),h=u.useCallback(D=>ct(D[r]),[r]),g=u.useCallback(D=>{const R={...c};D.length?R[n]=D.join(","):delete R[n],l(R)},[c,n,l]),m=u.useCallback(D=>{d.includes(D)||g([...d,D])},[d,g]),y=u.useCallback(D=>{var T;if((T=a[D])!=null&&T.locked)return;const R={...c},B=d.filter(P=>P!==D);B.length?R[n]=B.join(","):delete R[n];const S=h(R);D in S&&(delete S[D],Object.keys(S).length?R[r]=JSON.stringify(S):delete R[r]),delete R[s],l(R)},[c,d,n,r,s,h,l,a]),b=u.useCallback(D=>d.includes(D)?y(D):m(D),[d,m,y]),C=u.useCallback(D=>{switch(D.type){case"dropdown":case"dropdown-multiple":case"checkbox-multiple":case"radio":return _o({name:D.key,get:"array",searchParams:i,filterKey:r})||[];case"date":{const R=No({name:D.key,searchParams:i,filterKey:r});return R?new Date(R):void 0}case"date-compact":{const B=h(Object.fromEntries(i.entries()))[D.key];return B&&typeof B=="object"?B:void 0}case"text":{const B=h(Object.fromEntries(i.entries()))[D.key];return typeof B=="string"?B:void 0}default:return}},[i,r,h]),O=u.useCallback((D,R)=>{if(D.type==="date-compact"||D.type==="text"){const B={...c},S=h(B);R==null||R===""?delete S[D.key]:S[D.key]=R,Object.keys(S).length?B[r]=JSON.stringify(S):delete B[r],delete B[s],l(B);return}qt({value:R,name:D.key,type:Ji(D.type),searchQueries:c,setSearchParams:l,filterKey:r,pageKey:s})},[c,l,r,s,h]),M=u.useCallback(D=>{const R={...c},B=h(R);D in B&&(delete B[D],Object.keys(B).length?R[r]=JSON.stringify(B):delete R[r]),delete R[s],l(R)},[c,r,s,h,l]),L=u.useCallback(()=>{const D={...c};delete D[r],delete D[n],delete D[s],l(D)},[c,r,n,s,l]),j=d.length>0;return{activeKeys:d,configByKey:a,hasActiveFilter:j,addFilter:m,removeFilter:y,toggleFilter:b,getValue:C,setValue:O,clearValue:M,clearAll:L}}const bn={get(t){return Nt.storage.get(t)??null},set(t,r){Nt.storage.save(t,r)},remove(t){Nt.storage.delete(t)}},Ot={columns:t=>`filterbar:colprefs:${t}`,savedViews:t=>`filterbar:views:${t}`,lastState:t=>`filterbar:last:${t}`,perPage:t=>`filterbar:perpage:${t}`,tableSort:t=>`tablelayout:sort:${t}`},sr=(t,r)=>{const n=new Set(r.map(i=>i.key)),s=t.order.filter(i=>n.has(i));for(const i of r)s.includes(i.key)||s.push(i.key);const o=t.hidden.filter(i=>n.has(i));return{order:s,hidden:o}};function $i({columns:t,scopeId:r,storage:n,onColumnsChange:s,value:o}){const i=u.useMemo(()=>({order:t.map(S=>S.key),hidden:[]}),[t]),l=r?Ot.columns(r):void 0,c=(S,T)=>sr({order:S.order??T,hidden:S.hidden??[]},t),[a,d]=u.useState(()=>{if(o&&(o.order||o.hidden))return c(o,t.map(S=>S.key));if(l){const S=n.get(l);if(S&&Array.isArray(S.order))return sr(S,t)}return i}),h=t.map(S=>S.key).join("|");u.useEffect(()=>d(S=>sr(S,t)),[h]);const g=u.useRef(a);g.current=a;const m=o?`${(o.order??[]).join("|")}~${(o.hidden??[]).join("|")}`:null,y=u.useRef(m);u.useEffect(()=>{if(m==null||y.current===m)return;y.current=m;const S=g.current,T=c(o,S.order);T.order.join("|")===S.order.join("|")&&T.hidden.join("|")===S.hidden.join("|")||(d(T),l&&n.set(l,T))},[m,h]);const b=u.useRef(!1);u.useEffect(()=>{b.current||(b.current=!0,s==null||s(a))},[]);const C=u.useCallback(S=>{d(S),l&&n.set(l,S),s==null||s(S)},[l,n,s]),O=u.useMemo(()=>{const S=new Map(t.map(T=>[T.key,T]));return a.order.filter(T=>S.has(T)).map(T=>({...S.get(T),visible:!a.hidden.includes(T)}))},[a,t]),M=u.useCallback(S=>{const T=a.hidden.includes(S)?a.hidden.filter(P=>P!==S):[...a.hidden,S];C({...a,hidden:T})},[a,C]),L=u.useCallback((S,T)=>{if(S===T)return;const P=[...a.order],[X]=P.splice(S,1);P.splice(T,0,X),C({...a,order:P})},[a,C]),j=u.useCallback(S=>{C({...a,hidden:S?t.filter(T=>!T.locked).map(T=>T.key):[]})},[a,t,C]),D=u.useCallback(()=>C(i),[C,i]),R=u.useCallback(S=>C(sr(S,t)),[C,t]),B=a.hidden.length===0;return{state:a,orderedColumns:O,allVisible:B,toggleVisibility:M,reorder:L,setAllHidden:j,reset:D,applyState:R}}function Ki({scopeId:t,storage:r,snapshotKeys:n,pageKey:s="page",getColumns:o,applyColumns:i}){const{searchParams:l,setSearchParams:c}=Ze(),a=t?Ot.savedViews(t):void 0,[d,h]=u.useState(()=>a?r.get(a)||[]:[]),g=u.useCallback(C=>{h(C),a&&r.set(a,C)},[a]),m=u.useCallback(C=>{const O=C.trim();if(!O)return;const M={};n.forEach(j=>{const D=l.get(j);D!=null&&(M[j]=D)});const L={id:`${Date.now()}`,name:O,query:M,columns:o==null?void 0:o(),createdAt:Date.now()};g([...d,L])},[n,l,o,g,d]),y=u.useCallback(C=>g(d.filter(O=>O.id!==C)),[g,d]),b=u.useCallback(C=>{const O=Object.fromEntries(l.entries());n.forEach(M=>delete O[M]),Object.assign(O,C.query),delete O[s],c(O),C.columns&&(i==null||i(C.columns))},[l,n,s,c,i]);return{enabled:!!a,views:d,saveView:m,deleteView:y,applyView:b}}function el(t,r){const n=ct(t);return delete n[r],Object.keys(n).length>0?JSON.stringify(n):void 0}function $n(t,r,n){const s=t[r];if(s==null)return;const o=el(s,n);o===void 0?delete t[r]:t[r]=o}function tl({scopeId:t,storage:r,snapshotKeys:n,enabled:s=!0,filterKey:o="filter",searchKey:i="q",persistSearch:l=!0}){const{searchParams:c}=Ze(),a=t&&s?Ot.lastState(t):void 0,d=u.useRef(a),h=u.useRef(!1);u.useEffect(()=>{if(!a){d.current=a;return}if(d.current!==a){d.current=a,h.current=!1;return}const y={};if(n.forEach(b=>{const C=c.get(b);C!=null&&(y[b]=C)}),l||$n(y,o,i),Object.keys(y).length===0){h.current&&r.remove(a);return}h.current=!0,r.set(a,y)},[c,a,n,r,l,o,i]);const g=u.useCallback(()=>{if(!a)return null;const y=r.get(a);if(!y||typeof y!="object"||Array.isArray(y)||Object.keys(y).length===0)return null;const b=y[o];return b!=null&&Object.keys(ct(b)).length===0&&delete y[o],l||$n(y,o,i),Object.keys(y).length>0?y:null},[a,r,l,o,i]),m=u.useCallback(()=>{a&&r.remove(a)},[a,r]);return{enabled:!!a,read:g,clear:m}}function rl({scopeId:t,storage:r,perPageKey:n,pageSizeOptions:s,enabled:o=!0}){const{searchParams:i}=Ze(),l=t&&o?Ot.perPage(t):void 0,c=i.toString(),a=u.useRef(l);u.useEffect(()=>{if(!l){a.current=l;return}if(a.current!==l){a.current=l;return}const g=i.get(n);if(!g)return;const m=Number(g);!Number.isFinite(m)||m<=0||r.set(l,m)},[c,l,n,r]);const d=u.useCallback(()=>{if(!l)return null;const g=r.get(l);if(g==null)return null;const m=Number(g);return!Number.isFinite(m)||m<=0||s&&!s.includes(m)?null:String(m)},[l,r,s]),h=u.useCallback(()=>{l&&r.remove(l)},[l,r]);return{enabled:!!l,read:d,clear:h}}let Wr={},zr=!1,Hr=null;const nl=(t,r)=>{Object.assign(Wr,t),Hr=r,!zr&&(zr=!0,queueMicrotask(()=>{const n=Wr,s=Hr;Wr={},zr=!1,Hr=null,!(!s||Object.keys(n).length===0)&&s(o=>{const i=new URLSearchParams(o);return Object.entries(n).forEach(([l,c])=>i.set(l,c)),i},{replace:!0})}))};function ol({enabled:t,snapshotKeys:r,perPageKey:n,readSnapshot:s,readPerPage:o}){const{searchParams:i,setSearchParams:l,location:c}=Ze(),a=u.useRef(null);u.useEffect(()=>{if(!t||a.current===c.pathname)return;a.current=c.pathname;const d={};if(!i.has(n)){const h=o();h&&(d[n]=h)}if(!r.some(h=>i.has(h))){const h=s();h&&Object.assign(d,h)}Object.keys(d).length!==0&&nl(d,l)},[c.pathname,t])}const sl=({configs:t,activeKeys:r,onToggle:n,hasActiveFilter:s,onReset:o})=>t.length?e.jsxs(A.Menu,{position:"bottom-left",children:[e.jsx(A.MenuButton,{children:e.jsx(H.Button,{variant:s?"secondary":"outline",tone:"neutral",size:"sm",iconLeft:e.jsx(E.Icon,{name:"FilterHorizontal"}),"aria-label":"Add filter"})}),e.jsx(A.MenuLists,{children:e.jsx(A.MenuBody,{style:{minWidth:260},title:e.jsxs(x.Box,{display:"flex",direction:"row",align:"center",justify:"space-between",fullWidth:!0,children:[e.jsx(w.Text,{fontSize:"sm",fontWeight:"medium",color:"subtlest",children:"Add Filter"}),s&&o&&e.jsx(H.Button,{variant:"link",tone:"brand",size:"xs",onClick:o,children:"Reset"})]}),children:t.map(i=>e.jsx(A.MenuItem,{selected:i.locked||r.includes(i.key),disabled:i.locked,closeOnSelect:!1,startIcon:i.icon??void 0,onClick:()=>{i.locked||n(i.key)},children:i.label},i.key))})})]}):null,Gt=({onClear:t,onRemove:r})=>e.jsxs(A.Menu,{position:"bottom-right",children:[e.jsx(A.MenuButton,{children:e.jsx(H.Button,{variant:"link",tone:"neutral",size:"xs",iconLeft:e.jsx(E.Icon,{name:"MenuHorizontal"}),"aria-label":"Filter actions"})}),e.jsx(A.MenuLists,{children:e.jsxs(A.MenuBody,{style:{width:180},children:[e.jsx(A.MenuItem,{startIcon:e.jsx(E.Icon,{name:"CrossCircle"}),onClick:t,children:"Clear value"}),r&&e.jsx(A.MenuItem,{intent:"danger",startIcon:e.jsx(E.Icon,{name:"Trash1"}),onClick:r,children:"Remove filter"})]})})]}),il=t=>{const r=new Date(t);return r.setHours(0,0,0,0),r},Kn=(t,r,n)=>{const s=new Date(t);return n==="day"?s.setDate(s.getDate()+r):n==="week"?s.setDate(s.getDate()+r*7):n==="month"?s.setMonth(s.getMonth()+r):s.setFullYear(s.getFullYear()+r),s},Zo=t=>{const r=il(new Date);if(t.direction==="this"){const s=new Date(r),o=new Date(r);return t.period==="week"?(s.setDate(r.getDate()-r.getDay()),o.setDate(s.getDate()+6)):t.period==="month"?(s.setDate(1),o.setMonth(o.getMonth()+1,0)):t.period==="year"&&(s.setMonth(0,1),o.setMonth(11,31)),{from:s,to:o}}const n=t.count??1;return t.direction==="past"?{from:Kn(r,-n,t.period),to:r}:{from:r,to:Kn(r,n,t.period)}},eo=24,Go=t=>t.length>eo?`${t.slice(0,eo)}...`:t,Qo=t=>t.toLocaleDateString(void 0,{day:"2-digit",month:"short",year:"numeric"}),Pr=(t,r="days")=>r==="months"?t.toLocaleDateString(void 0,{month:"short",year:"numeric"}):r==="years"?String(t.getFullYear()):Qo(t),pr={is:"Is","is-before":"Is before","is-after":"Is after","is-on-or-before":"Is on or before","is-on-or-after":"Is on or after","is-between":"Is between","is-relative-to-today":"Is relative to today","is-empty":"Is empty","is-not-empty":"Is not empty"},Uo=["is","is-before","is-after","is-on-or-before","is-on-or-after","is-between","is-relative-to-today","is-empty","is-not-empty"],on={past:"Past",next:"Next",this:"This"},ll=["day","week","month","year"],cl=["past","next","this"],al=t=>t.field.type==="date-compact"?e.jsx(xl,{field:t.field,value:t.value,onChange:t.onChange,onClear:t.onClear,onRemove:t.onRemove}):e.jsx(dl,{field:t.field,value:t.value,onChange:t.onChange,onClear:t.onClear,onRemove:t.onRemove}),dl=({field:t,value:r,onChange:n,onClear:s,onRemove:o})=>{const i=r?Qo(new Date(r)):null,l=!!i,c=l?e.jsxs(e.Fragment,{children:[e.jsxs("span",{style:{fontWeight:500},children:[t.label,":"]})," ",e.jsx("span",{style:{fontWeight:400},children:Go(i)})]}):t.label;return e.jsxs(A.Menu,{position:"bottom-left",children:[e.jsx(A.MenuButton,{children:e.jsx(H.Button,{variant:l?"secondary":"outline",tone:"neutral",size:"sm",iconLeft:l?e.jsx(E.Icon,{name:"Calendar",size:"sm"}):void 0,iconRight:e.jsx(E.Icon,{name:"ChevronSmallDown"}),children:c})}),e.jsx(A.MenuLists,{children:e.jsx(A.MenuBody,{style:{width:260},title:e.jsxs(x.Box,{display:"flex",direction:"row",align:"center",justify:"space-between",fullWidth:!0,children:[e.jsx(w.Text,{fontSize:"sm",fontWeight:"medium",color:"subtlest",children:t.label}),e.jsx(Gt,{onClear:s,onRemove:o})]}),children:e.jsx(vt.StarasiaDate,{size:"sm",input:!1,clearable:!0,filter:t.mode,value:r,onChange:a=>a==null?s():n(a),withPadding:!1})})})]})},ul=(t,r="days")=>{switch(t.op){case"is":case"is-before":case"is-after":case"is-on-or-before":case"is-on-or-after":return t.date?`${pr[t.op]} ${Pr(new Date(t.date),r)}`:null;case"is-between":return t.from&&t.to?`${Pr(new Date(t.from),r)} - ${Pr(new Date(t.to),r)}`:null;case"is-relative-to-today":{const n=t.relative;if(!n)return null;if(n.direction==="this")return`This ${n.period}`;const s=n.count??1,o=s===1?n.period:`${n.period}s`;return`${on[n.direction]} ${s} ${o}`}case"is-empty":case"is-not-empty":return pr[t.op];default:return null}},xl=({field:t,value:r,onChange:n,onClear:s,onRemove:o})=>{const i=t.ops&&t.ops.length>0?t.ops:Uo,l=t.defaultOp&&i.includes(t.defaultOp)?t.defaultOp:i[0],c=t.mode??"days",a=(r==null?void 0:r.op)??l,d=r?ul(r,c):null,h=!!d,g=h?e.jsxs(e.Fragment,{children:[e.jsxs("span",{style:{fontWeight:500},children:[t.label,":"]})," ",e.jsx("span",{style:{fontWeight:400},children:Go(d)})]}):t.label,m=y=>{if(y!==a){if(y==="is-empty"||y==="is-not-empty"){n({op:y});return}if(y==="is-relative-to-today"){n({op:y,relative:(r==null?void 0:r.relative)??{direction:"past",count:1,period:"week"}});return}if(y==="is-between"){n({op:y,from:r==null?void 0:r.from,to:r==null?void 0:r.to});return}n({op:y,date:r==null?void 0:r.date})}};return e.jsxs(A.Menu,{position:"bottom-left",children:[e.jsx(A.MenuButton,{children:e.jsx(H.Button,{variant:h?"secondary":"outline",tone:"neutral",size:"sm",iconLeft:h?e.jsx(E.Icon,{name:"Calendar",size:"sm"}):void 0,iconRight:e.jsx(E.Icon,{name:"ChevronSmallDown"}),children:g})}),e.jsxs(A.MenuLists,{children:[e.jsx(A.MenuBody,{style:{width:320},title:e.jsxs(x.Box,{display:"flex",direction:"row",align:"center",justify:"space-between",gap:"xs",fullWidth:!0,children:[e.jsxs(x.Box,{display:"flex",direction:"row",align:"center",gap:"xs",style:{minWidth:0},children:[e.jsx(w.Text,{fontSize:"sm",fontWeight:"medium",color:"subtlest",children:t.label}),e.jsx(Yo,{op:a,ops:i,onChange:m})]}),e.jsx(Gt,{onClear:s,onRemove:o})]}),children:e.jsx(Xo,{value:r,op:a,mode:c,onChange:n})}),a==="is-relative-to-today"&&e.jsx(A.MenuFooter,{children:e.jsx(w.Text,{fontSize:"xs",color:"subtlest",children:"Filter will update with the current date"})})]})]})},Yo=({op:t,ops:r,onChange:n})=>e.jsxs(A.Menu,{position:"bottom-left",children:[e.jsx(A.MenuButton,{children:e.jsx(H.Button,{variant:"link",tone:"neutral",size:"xs",iconRight:e.jsx(E.Icon,{name:"ChevronSmallDown"}),children:pr[t]})}),e.jsx(A.MenuLists,{children:e.jsx(A.MenuBody,{style:{width:200},children:r.map(s=>e.jsx(A.MenuItem,{selected:t===s,onClick:()=>n(s),endIcon:t===s?e.jsx(E.Icon,{name:"Check"}):void 0,children:pr[s]},s))})})]}),Xo=({value:t,op:r,mode:n="days",onChange:s})=>{if(r==="is-empty"||r==="is-not-empty")return e.jsx(x.Box,{paddingBlock:"sm",paddingInline:"sm",children:e.jsx(w.Text,{fontSize:"xs",color:"subtlest",children:"No further input required."})});if(r==="is-between"){const o=t!=null&&t.from||t!=null&&t.to?{from:t!=null&&t.from?new Date(t.from):null,to:t!=null&&t.to?new Date(t.to):null}:void 0;return e.jsx(vt.StarasiaDate,{size:"sm",input:!1,clearable:!0,rangedDate:!0,filter:n,value:o,onChange:i=>{if(i==null){s({op:r});return}if(typeof i=="object"&&i!==null&&"from"in i&&"to"in i){let{from:l,to:c}=i;if(!l&&c&&(l=c,c=null),!l&&!c){s({op:r});return}s({op:r,from:l?l.toISOString():void 0,to:c?c.toISOString():void 0})}},withPadding:!1},`range-${n}`)}return r==="is-relative-to-today"?e.jsx(hl,{value:t==null?void 0:t.relative,onChange:o=>s({op:r,relative:o})}):e.jsx(vt.StarasiaDate,{size:"sm",input:!1,clearable:!0,filter:n,value:t!=null&&t.date?new Date(t.date):void 0,onChange:o=>{if(o==null){s({op:r});return}o instanceof Date&&s({op:r,date:o.toISOString()})},withPadding:!1},`single-${n}`)},hl=({value:t,onChange:r})=>{const n=(t==null?void 0:t.direction)??"past",s=(t==null?void 0:t.count)??1,o=(t==null?void 0:t.period)??"week",i=n!=="this",l=Zo({direction:n,count:s,period:o});return e.jsxs(x.Box,{direction:"column",display:"flex",gap:"sm",children:[e.jsxs(x.Box,{direction:"row",display:"flex",align:"center",gap:"xs",children:[e.jsxs(A.Menu,{position:"bottom-left",children:[e.jsx(A.MenuButton,{children:e.jsx(H.Button,{variant:"outline",tone:"neutral",size:"sm",iconRight:e.jsx(E.Icon,{name:"ChevronSmallDown"}),children:on[n]})}),e.jsx(A.MenuLists,{children:e.jsx(A.MenuBody,{style:{width:140},children:cl.map(c=>e.jsx(A.MenuItem,{selected:n===c,endIcon:n===c?e.jsx(E.Icon,{name:"Check"}):void 0,onClick:()=>r(c==="this"?{direction:c,period:o}:{direction:c,count:s,period:o}),children:on[c]},c))})})]}),i&&e.jsx(mt.Input,{type:"number",size:"sm",min:1,clearable:!1,value:s,onChange:c=>{const a=Number(c.target.value);r({direction:n,count:Number.isFinite(a)&&a>0?a:1,period:o})},style:{width:72}}),e.jsxs(A.Menu,{position:"bottom-left",children:[e.jsx(A.MenuButton,{children:e.jsx(H.Button,{variant:"outline",tone:"neutral",size:"sm",iconRight:e.jsx(E.Icon,{name:"ChevronSmallDown"}),children:o})}),e.jsx(A.MenuLists,{children:e.jsx(A.MenuBody,{style:{width:140},children:ll.map(c=>e.jsx(A.MenuItem,{selected:o===c,endIcon:o===c?e.jsx(E.Icon,{name:"Check"}):void 0,onClick:()=>r(n==="this"?{direction:n,period:c}:{direction:n,count:s,period:c}),children:c},c))})})]})]}),e.jsx(vt.StarasiaDate,{size:"sm",input:!1,disabled:!0,rangedDate:!0,value:l,onChange:()=>{},withPadding:!1},"relative-preview")]})},to=18,fl=t=>t.length>to?`${t.slice(0,to)}...`:t,ml=({field:t,value:r,onChange:n,onClear:s,onRemove:o})=>{const i=t.type==="dropdown-multiple",l=r.length,c=t.searchable!==!1,[a,d]=u.useState(""),h=t.options,g=typeof t.onSearch=="function",m=(()=>{if(g)return h;const M=a.trim().toLowerCase();return M?h.filter(L=>L.label.toLowerCase().includes(M)):h})(),y=M=>r.some(L=>L.value===M.value),b=M=>{if(!i){n([{label:M.label,value:M.value}]),d("");return}n(y(M)?r.filter(L=>L.value!==M.value):[...r,{label:M.label,value:M.value}])},C=M=>{var L;d(M),(L=t.onSearch)==null||L.call(t,M)},O=l===0?t.label:e.jsxs(e.Fragment,{children:[e.jsxs("span",{style:{fontWeight:500},children:[t.label,":"]})," ",e.jsx("span",{style:{fontWeight:400},children:l===1?fl(r[0].label):`${l} Selected`})]});return e.jsxs(A.Menu,{position:"bottom-left",children:[e.jsx(A.MenuButton,{children:e.jsx(H.Button,{variant:l>0?"secondary":"outline",tone:"neutral",size:"sm",iconLeft:l>0?e.jsx(E.Icon,{name:"Tag",size:"sm"}):void 0,iconRight:e.jsx(E.Icon,{name:"ChevronSmallDown"}),children:O})}),e.jsx(A.MenuLists,{children:e.jsx(A.MenuBody,{style:{width:260},title:e.jsxs(x.Box,{display:"flex",direction:"row",align:"center",justify:"space-between",fullWidth:!0,children:[e.jsx(w.Text,{fontSize:"sm",fontWeight:"medium",color:"subtlest",children:t.label}),e.jsx(Gt,{onClear:s,onRemove:o})]}),children:e.jsxs(x.Box,{direction:"column",gap:"sm",children:[c&&e.jsx(Lt.Dropdown,{size:"sm",triggerInput:!0,fullWidth:!0,hideChevronIcon:!0,clearable:!0,multiSelect:i,searchAble:!0,searchValue:a,onSearch:C,value:r,onChange:n,placeholder:`Search ${t.label.toLowerCase()}…`}),e.jsx(x.Box,{direction:"column",overflow:"overflow-y-auto",customMaxHeight:"240px",children:t.isLoading?e.jsx(x.Box,{paddingBlock:"sm",paddingInline:"sm",children:e.jsx(w.Text,{fontSize:"xs",color:"subtlest",children:"Loading…"})}):m.length===0?e.jsx(x.Box,{paddingBlock:"sm",paddingInline:"sm",children:e.jsx(w.Text,{fontSize:"xs",color:"subtlest",children:"No results"})}):m.map(M=>e.jsx(A.MenuItem,{closeOnSelect:!i,selected:y(M),startIcon:M.avatar,endIcon:y(M)?e.jsx(E.Icon,{name:"Check"}):void 0,description:M.description,onClick:()=>b(M),children:M.label},M.value))})]})})})]})},ro=18,gl=t=>t.length>ro?`${t.slice(0,ro)}...`:t,no=({checked:t,indeterminate:r})=>e.jsx("span",{style:{pointerEvents:"none",display:"inline-flex"},children:e.jsx(ft.Checkbox,{size:"sm",checked:t,readOnly:!0,onChange:()=>{},variant:r?"indeterminate":"select"})}),pl=({field:t,value:r,onChange:n,onClear:s,onRemove:o})=>{const i=new Set(r.map(m=>m.value)),l=r.length,c=t.options.length>0&&t.options.every(m=>i.has(m.value)),a=l>0&&!c,d=m=>{n(i.has(m.value)?r.filter(y=>y.value!==m.value):[...r,{label:m.label,value:m.value}])},h=()=>{n(c?[]:t.options.map(m=>({label:m.label,value:m.value})))},g=l===0?t.label:e.jsxs(e.Fragment,{children:[e.jsxs(w.Text,{as:"span",fontWeight:"semibold",children:[t.label,":"]})," ",e.jsx(w.Text,{as:"span",children:l===1?gl(r[0].label):`${l} Selected`})]});return e.jsxs(A.Menu,{position:"bottom-left",children:[e.jsx(A.MenuButton,{children:e.jsx(H.Button,{variant:l>0?"secondary":"outline",tone:"neutral",size:"sm",iconLeft:l>0?e.jsx(E.Icon,{name:"Tag",size:"sm"}):void 0,iconRight:e.jsx(E.Icon,{name:"ChevronSmallDown"}),children:g})}),e.jsx(A.MenuLists,{children:e.jsxs(A.MenuBody,{style:{width:240},title:e.jsxs(x.Box,{display:"flex",direction:"row",align:"center",justify:"space-between",fullWidth:!0,children:[e.jsx(w.Text,{fontSize:"sm",fontWeight:"medium",color:"subtlest",children:t.label}),e.jsx(Gt,{onClear:s,onRemove:o})]}),children:[e.jsx(A.MenuItem,{closeOnSelect:!1,selected:c,onClick:h,startIcon:e.jsx(no,{checked:c||a,indeterminate:a}),children:"Select All"}),t.options.map(m=>e.jsx(A.MenuItem,{closeOnSelect:!1,selected:i.has(m.value),onClick:()=>d(m),startIcon:e.jsx(no,{checked:i.has(m.value)}),children:m.label},m.value))]})})]})},oo=18,yl=t=>t.length>oo?`${t.slice(0,oo)}...`:t,bl=({field:t,value:r,onChange:n,onClear:s,onRemove:o})=>{const[i,l]=u.useState(r??""),c=ke.useDebounce(i,t.debounceMs??300);u.useEffect(()=>{c!==(r??"")&&n(c)},[c]),u.useEffect(()=>{l(r??"")},[r]);const a=!!r,d=a?e.jsxs(e.Fragment,{children:[e.jsxs("span",{style:{fontWeight:500},children:[t.label,":"]})," ",e.jsx("span",{style:{fontWeight:400},children:yl(r)})]}):t.label;return e.jsxs(A.Menu,{position:"bottom-left",children:[e.jsx(A.MenuButton,{children:e.jsx(H.Button,{variant:a?"secondary":"outline",tone:"neutral",size:"sm",iconLeft:a?e.jsx(E.Icon,{name:"Search",size:"sm"}):void 0,iconRight:e.jsx(E.Icon,{name:"ChevronSmallDown"}),children:d})}),e.jsx(A.MenuLists,{children:e.jsx(A.MenuBody,{style:{width:260},title:e.jsxs(x.Box,{display:"flex",direction:"row",align:"center",justify:"space-between",fullWidth:!0,children:[e.jsx(w.Text,{fontSize:"sm",fontWeight:"medium",color:"subtlest",children:t.label}),e.jsx(Gt,{onClear:s,onRemove:o})]}),children:e.jsx(mt.Input,{size:"sm",fullWidth:!0,value:i,placeholder:t.placeholder??"Cari…",leftIcon:e.jsx(E.Icon,{name:"Search",width:16,height:16}),onChange:h=>l(h.target.value)})})})]})},Jo=({activeKeys:t,configByKey:r,getValue:n,setValue:s,clearValue:o,removeFilter:i})=>e.jsx(e.Fragment,{children:t.map(l=>{const c=r[l];if(!c)return null;const a=n(c),d=c.locked?void 0:()=>i(l);return c.type==="date"||c.type==="date-compact"?e.jsx(al,{field:c,value:a,onChange:h=>s(c,h),onClear:()=>o(l),onRemove:d},l):c.type==="text"?e.jsx(bl,{field:c,value:a||"",onChange:h=>s(c,h),onClear:()=>o(l),onRemove:d},l):c.type==="checkbox-multiple"?e.jsx(pl,{field:c,value:a||[],onChange:h=>s(c,h),onClear:()=>o(l),onRemove:d},l):e.jsx(ml,{field:c,value:a||[],onChange:h=>s(c,h),onClear:()=>o(l),onRemove:d},l)})}),so=t=>`${t} Rows`,jl=({pagination:t,pageKey:r="page",perPageKey:n="perPage",pageSizeOptions:s=[10,25,50,100],defaultPerPage:o=10,showResultCount:i=!0,showPageSize:l=!0,showPagination:c=!0})=>{var M;const{searchQueries:a,setSearchParams:d,searchParams:h}=Ze(),g=h.get(n),m=g?Number(g):o,y=L=>{d({...a,[r]:String(L)})},b=L=>{d({...a,[n]:L,[r]:"1"})},C=(t==null?void 0:t.rangeStart)??(((t==null?void 0:t.currentPage)||0)>1?(((t==null?void 0:t.currentPage)||0)-1)*((t==null?void 0:t.perPage)||0)+1:1),O=(t==null?void 0:t.rangeEnd)??((t==null?void 0:t.totalCurrentPage)!==(t==null?void 0:t.perPage)?t==null?void 0:t.totalData:((t==null?void 0:t.currentPage)||1)*((t==null?void 0:t.totalCurrentPage)||0));return e.jsxs(e.Fragment,{children:[i&&e.jsx(w.Text,{fontSize:"sm",fontWeight:"medium",color:"primary",truncate:!0,children:`${C}-${O} of ${((M=t==null?void 0:t.totalData)==null?void 0:M.toLocaleString())||0}`}),l&&e.jsxs(A.Menu,{position:"bottom-left",children:[e.jsx(A.MenuButton,{children:e.jsx(H.Button,{variant:"outline",tone:"neutral",size:"sm",iconRight:e.jsx(E.Icon,{name:"ChevronSmallDown"}),"aria-label":"Rows per page",children:so(m)})}),e.jsx(A.MenuLists,{children:e.jsx(A.MenuBody,{children:s.map(L=>e.jsx(A.MenuItem,{selected:L===m,onClick:()=>b(String(L)),children:so(L)},L))})})]}),c&&((t==null?void 0:t.totalPage)??0)>1&&e.jsx(x.Box,{direction:"column",display:"flex",align:"center",gap:"sm",paddingRight:"sm",style:{borderRight:"1px solid var(--sa-border-subtle, rgba(11, 18, 14, 0.14))"},children:e.jsx(Vt.Pagination,{size:"sm",variant:"neutral",siblingCount:0,currentPage:t!=null&&t.currentPage?Number(t.currentPage):1,totalPages:Number(t==null?void 0:t.totalPage),onPageChange:y})})]})};function vl(t,r,n=!0){u.useEffect(()=>{if(!n)return;const s=o=>{var c;if(o.metaKey||o.ctrlKey||o.altKey||o.key!==t||Oe.isOverlayOpen())return;const i=o.target,l=(c=i==null?void 0:i.tagName)==null?void 0:c.toLowerCase();l==="input"||l==="textarea"||i!=null&&i.isContentEditable||(o.preventDefault(),r())};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[t,r,n])}const Cl=240,$o=({searchKey:t="q",filterKey:r="filter",pageKey:n="page",placeholder:s="Search",shortcut:o="/",collapsible:i=!0})=>{const{searchParams:l,setSearchParams:c,searchQueries:a}=Ze(),d=jr(t,l,r)||"",[h,g]=u.useState(!i||!!d),[m,y]=u.useState(i&&!d),[b,C]=u.useState(d),O=ke.useDebounce(b,350),M=u.useRef(null);u.useEffect(()=>{C(d),d&&g(!0)},[d]),u.useEffect(()=>{h&&y(!1)},[h]),u.useEffect(()=>{O!==d&&qt({value:O,name:t,type:"search",searchQueries:a,setSearchParams:c,filterKey:r,pageKey:n})},[O]);const L=u.useCallback(()=>{g(!0),requestAnimationFrame(()=>{var B;return(B=M.current)==null?void 0:B.focus()})},[]);vl(o,L);const j=()=>{i&&!b&&g(!1)},D=B=>{var S;i&&B.key==="Escape"&&!b&&(g(!1),(S=M.current)==null||S.blur())},R=()=>{h||y(!0)};return e.jsxs(x.Box,{display:"flex",direction:"row",align:"center",gap:"spacing-0",children:[m&&e.jsx(H.Button,{variant:"outline",tone:"neutral",size:"sm",iconLeft:e.jsx(E.Icon,{name:"Search",size:"sm"}),"aria-label":"Search","aria-expanded":!1,onClick:L}),e.jsxs(x.Box,{onTransitionEnd:R,style:{position:"relative",width:h?Cl:0,overflow:"hidden",transition:"width 220ms ease"},children:[e.jsx(mt.Input,{ref:M,size:"sm",fullWidth:!0,value:b,placeholder:s,leftIcon:e.jsx(E.Icon,{name:"Search",width:16,height:16}),onChange:B=>C(B.target.value),onKeyDown:D,onBlur:j,tabIndex:h?0:-1}),h&&!b&&e.jsx(x.Box,{align:"center",justify:"center",borderColor:"border-subtle",borderWidth:"border",borderStyle:"border-solid",borderRadius:"rounded-xs",paddingInline:"spacing-1",customBackgroundColor:"var(--sa-background-hover, #f0f1f2)",style:{position:"absolute",right:8,top:"50%",transform:"translateY(-50%)",pointerEvents:"none",minWidth:18,height:18,display:"inline-flex"},children:e.jsx(w.Text,{fontSize:"xs",color:"subtle",children:o})})]})]})},Ko=({columns:t,allVisible:r,onToggle:n,onReorder:s,onSetAllHidden:o})=>{const[i,l]=u.useState(null),[c,a]=u.useState(null),d=()=>{i!==null&&c!==null&&i!==c&&s(i,c),l(null),a(null)},h=(g,m)=>{const y=g+m;y<0||y>=t.length||s(g,y)};return e.jsxs(A.Menu,{position:"bottom-right",children:[e.jsx(A.MenuButton,{children:e.jsx(H.Button,{variant:r?"outline":"secondary",tone:"neutral",size:"sm",iconLeft:e.jsx(E.Icon,{name:"Grid",size:"sm"}),"aria-label":"Customize columns"})}),e.jsx(A.MenuLists,{children:e.jsx(A.MenuBody,{children:e.jsxs(x.Box,{padding:"sm",direction:"column",customWidth:"296px",customMaxHeight:"60vh",overflow:"overflow-hidden",children:[e.jsx(w.Text,{fontWeight:"semibold",color:"primary",children:"Customize Column Table"}),e.jsxs(x.Box,{direction:"row",display:"flex",align:"center",justify:"space-between",paddingBlock:"md",children:[e.jsx(w.Text,{fontSize:"sm",fontWeight:"medium",color:"subtle",children:"Show in table"}),e.jsx(H.Button,{variant:"link",tone:"info",size:"xs",onClick:()=>o(r),children:r?"Hide All":"Show All"})]}),e.jsx(x.Box,{direction:"column",overflow:"overflow-y-auto",children:t.map((g,m)=>{const y=!g.locked,b=c===m&&i!==null&&i!==m;return e.jsxs(x.Box,{direction:"row",display:"flex",align:"center",gap:"sm",paddingBlock:"xs",draggable:y,onDragStart:()=>y&&l(m),onDragOver:C=>{C.preventDefault(),a(m)},onDrop:d,onDragEnd:d,style:{minHeight:32,boxShadow:b?"inset 0 2px 0 0 var(--sa-background-brand, #04254f)":void 0},children:[e.jsx(x.Box,{direction:"column",as:"div",align:"center",justify:"center",role:"button",tabIndex:y?0:-1,"aria-label":`Reorder ${g.title}`,"aria-disabled":!y||void 0,color:"icon-subtlest",onKeyDown:C=>{y&&(C.key==="ArrowUp"?(C.preventDefault(),h(m,-1)):C.key==="ArrowDown"&&(C.preventDefault(),h(m,1)))},style:{display:"inline-flex",cursor:y?"grab":"default",opacity:y?1:.4},children:e.jsx(E.Icon,{name:"DragVertical",width:16,height:16})}),g.icon&&e.jsx(x.Box,{direction:"column",align:"center",color:"icon-subtle",style:{display:"inline-flex"},children:g.icon}),e.jsx(w.Text,{fontSize:"sm",fontWeight:"medium",color:"primary",truncate:!0,children:g.title}),e.jsx(x.Box,{direction:"column",style:{marginLeft:"auto"},children:e.jsx(Rt.Toggle,{size:"sm",checked:g.visible,disabled:g.locked,onChange:()=>n(g.key),"aria-label":`Toggle ${g.title} column`})})]},g.key)})})]})})})]})},es=({views:t,onApply:r,onDelete:n,onSave:s})=>{const[o,i]=u.useState(""),l=()=>{const c=o.trim();c&&(s(c),i(""))};return e.jsxs(A.Menu,{position:"bottom-right",children:[e.jsx(A.MenuButton,{children:e.jsx(H.Button,{variant:t.length>0?"secondary":"outline",tone:(t.length>0,"neutral"),size:"sm",iconLeft:e.jsx(E.Icon,{name:"Bookmark",size:"sm"}),"aria-label":"Saved views"})}),e.jsxs(A.MenuLists,{style:{width:"260px"},children:[e.jsx(A.MenuBody,{children:e.jsxs(x.Box,{direction:"column",padding:"xs",gap:"sm",children:[e.jsx(w.Text,{fontWeight:"semibold",color:"primary",children:"Saved Views"}),e.jsx(x.Box,{direction:"column",overflow:"overflow-y-auto",children:t.length===0?e.jsx(x.Box,{direction:"column",paddingBlock:"sm",children:e.jsx(w.Text,{fontSize:"sm",color:"subtlest",children:"No saved views yet"})}):t.map(c=>e.jsx(A.MenuItem,{startIcon:e.jsx(E.Icon,{name:"Bookmark"}),onClick:()=>r(c),endIcon:e.jsx(H.Button,{variant:"link",tone:"error",size:"sm",iconLeft:e.jsx(E.Icon,{name:"Trash2"}),"aria-label":`Delete ${c.name}`,onClick:a=>{a.stopPropagation(),n(c.id)}}),children:c.name},c.id))})]})}),e.jsx(A.MenuFooter,{children:e.jsxs(x.Box,{direction:"row",gap:"xs",children:[e.jsx(x.Box,{direction:"column",style:{flex:"1 0 0",minWidth:0},children:e.jsx(mt.Input,{size:"sm",fullWidth:!0,placeholder:"Save current view as…",value:o,onChange:c=>i(c.target.value),onKeyDown:c=>{c.key==="Enter"&&l()}})}),e.jsx(H.Button,{variant:"primary",tone:"brand",size:"sm",disabled:!o.trim(),onClick:l,children:"Save"})]})})]})]})},wl=({isOpen:t,onClose:r,configs:n,activeKeys:s,configByKey:o,hasActiveFilter:i,onToggle:l,onReset:c,getValue:a,setValue:d,clearValue:h,removeFilter:g})=>{const m=s.length;return e.jsx(mr.Drawer,{position:"bottom",isShow:t,onHide:r,children:e.jsxs(x.Box,{direction:"column",customMaxHeight:"85vh",style:{minHeight:280},children:[e.jsxs(x.Box,{direction:"row",display:"flex",align:"center",justify:"space-between",paddingInline:"md",paddingBlock:"sm",style:{borderBottom:"1px solid var(--sa-border-subtle, rgba(11, 18, 14, 0.14))"},children:[e.jsxs(x.Box,{direction:"row",display:"flex",align:"center",gap:"xs",children:[e.jsx(w.Text,{fontWeight:"semibold",color:"primary",children:"Filter"}),m>0&&e.jsxs(w.Text,{fontSize:"sm",color:"subtle",children:["(",m,")"]})]}),e.jsx(H.Button,{variant:"link",tone:"neutral",size:"sm",iconLeft:e.jsx(E.Icon,{name:"Cross"}),"aria-label":"Close filter",onClick:r})]}),e.jsxs(x.Box,{direction:"column",gap:"lg",padding:"md",overflow:"overflow-y-auto",style:{flex:"1 1 auto",minHeight:0},children:[m>0&&e.jsxs(x.Box,{direction:"column",gap:"sm",children:[e.jsx(w.Text,{fontSize:"xs",fontWeight:"medium",color:"subtlest",children:"Filter aktif"}),e.jsx(x.Box,{direction:"row",display:"flex",wrap:"wrap",gap:"sm",align:"center",children:e.jsx(Jo,{activeKeys:s,configByKey:o,getValue:a,setValue:d,clearValue:h,removeFilter:g})})]}),n.length>0&&e.jsxs(x.Box,{direction:"column",gap:"sm",children:[e.jsx(w.Text,{fontSize:"xs",fontWeight:"medium",color:"subtlest",children:"Tambah filter"}),e.jsx(x.Box,{direction:"column",children:n.map(y=>{const b=s.includes(y.key),C=!!y.locked;return e.jsxs(x.Box,{direction:"row",display:"flex",align:"center",justify:"space-between",gap:"sm",paddingBlock:"sm",style:{opacity:C?.5:1,borderTop:"1px solid var(--sa-border-subtle, rgba(11, 18, 14, 0.08))"},children:[e.jsxs(x.Box,{direction:"row",display:"flex",align:"center",gap:"sm",style:{minWidth:0},children:[y.icon&&e.jsx(x.Box,{direction:"column",align:"center",color:"icon-subtle",style:{display:"inline-flex"},children:y.icon}),e.jsx(w.Text,{fontSize:"sm",color:"primary",truncate:!0,children:y.label})]}),e.jsx(Rt.Toggle,{size:"sm",checked:b||C,disabled:C,onChange:()=>l(y.key),"aria-label":`Toggle ${y.label}`})]},y.key)})})]})]}),e.jsxs(x.Box,{direction:"row",display:"flex",gap:"sm",paddingInline:"md",paddingBlock:"sm",style:{borderTop:"1px solid var(--sa-border-subtle, rgba(11, 18, 14, 0.14))"},children:[e.jsx(x.Box,{direction:"column",style:{flex:"1 1 0"},children:e.jsx(H.Button,{variant:"outline",tone:"neutral",size:"md",fullWidth:!0,disabled:!i,onClick:c,children:"Reset"})}),e.jsx(x.Box,{direction:"column",style:{flex:"1 1 0"},children:e.jsx(H.Button,{variant:"primary",tone:"brand",size:"md",fullWidth:!0,onClick:r,children:"Selesai"})})]})]})})},Dl=t=>`${t} Rows`,Sl=({perPageKey:t,pageKey:r,pageSizeOptions:n,defaultPerPage:s=10,showPageSize:o})=>{const{searchQueries:i,setSearchParams:l,searchParams:c}=Ze(),a=c.get(t),d=a?Number(a):s,h=g=>{l({...i,[t]:g,[r]:"1"})};return o?e.jsxs(A.Menu,{position:"bottom-right",children:[e.jsx(A.MenuButton,{children:e.jsx(H.Button,{variant:"outline",tone:"neutral",size:"sm",iconLeft:e.jsx(E.Icon,{name:"MenuVertical",size:"sm"}),"aria-label":"More options"})}),e.jsx(A.MenuLists,{children:e.jsxs(A.MenuBody,{style:{minWidth:200},children:[e.jsx(x.Box,{paddingInline:"sm",paddingBlock:"xs",children:e.jsx(w.Text,{fontSize:"xs",fontWeight:"medium",color:"subtlest",children:"Rows per page"})}),n.map(g=>e.jsx(A.MenuItem,{selected:g===d,endIcon:g===d?e.jsx(E.Icon,{name:"Check"}):void 0,onClick:()=>h(String(g)),children:Dl(g)},g))]})})]}):null},kl=t=>{var re;const{withPadding:r,configs:n,activeKeys:s,configByKey:o,hasActiveFilter:i,toggleFilter:l,removeFilter:c,getValue:a,setValue:d,clearValue:h,onReset:g,searchable:m,searchKey:y,filterKey:b,pageKey:C,searchPlaceholder:O,searchShortcut:M,searchCollapsible:L,pagination:j,perPageKey:D,pageSizeOptions:R,defaultPerPage:B,showPagination:S,showResultCount:T,showPageSize:P,hasColumns:X,orderedColumns:I,allVisible:N,onToggleVisibility:Y,onReorder:G,onSetAllHidden:J,showSavedViews:$,savedViews:le,onApplyView:q,onDeleteView:K,onSaveView:ae,leadingActions:ge,trailingActions:Ie}=t,[Ee,ye]=u.useState(!1),{searchQueries:fe,setSearchParams:Ne}=Ze(),Te=(j==null?void 0:j.rangeStart)??(((j==null?void 0:j.currentPage)||0)>1?(((j==null?void 0:j.currentPage)||0)-1)*((j==null?void 0:j.perPage)||0)+1:1),Ve=(j==null?void 0:j.rangeEnd)??((j==null?void 0:j.totalCurrentPage)!==(j==null?void 0:j.perPage)?j==null?void 0:j.totalData:((j==null?void 0:j.currentPage)||1)*((j==null?void 0:j.totalCurrentPage)||0)),oe=Be=>{Ne({...fe,[C]:String(Be)})},we=T||S&&!!(j!=null&&j.totalPage),be=()=>{g(),ye(!1)};return e.jsxs(x.Box,{direction:"column",gap:"sm",fullWidth:!0,paddingTop:r?"sm":void 0,paddingBottom:r?"sm":void 0,paddingLeft:r?"md":void 0,paddingRight:r?"md":void 0,role:"toolbar","aria-label":"Filter bar",children:[e.jsxs(x.Box,{direction:"row",display:"flex",align:"center",wrap:"wrap",gap:"sm",fullWidth:!0,overflow:"overflow-auto",children:[m&&e.jsx($o,{searchKey:y,filterKey:b,pageKey:C,placeholder:O,shortcut:M,collapsible:L}),e.jsx(H.Button,{variant:i?"secondary":"outline",tone:"neutral",size:"sm",iconLeft:e.jsx(E.Icon,{name:"FilterHorizontal"}),onClick:()=>ye(!0),"aria-label":"Open filters",children:i?`Filter: ${s.length}`:null}),e.jsxs(x.Box,{direction:"row",display:"flex",align:"center",gap:"sm",style:{marginLeft:"auto"},children:[ge,$&&e.jsx(es,{views:le,onApply:q,onDelete:K,onSave:ae}),X&&e.jsx(Ko,{columns:I,allVisible:N,onToggle:Y,onReorder:G,onSetAllHidden:J}),e.jsx(Sl,{perPageKey:D,pageKey:C,pageSizeOptions:R,defaultPerPage:B,showPageSize:P}),Ie]})]}),we&&e.jsxs(x.Box,{direction:"row",display:"flex",align:"center",justify:"space-between",gap:"sm",fullWidth:!0,children:[T?e.jsx(w.Text,{fontSize:"sm",fontWeight:"medium",color:"primary",truncate:!0,children:`${Te}-${Ve} of ${((re=j==null?void 0:j.totalData)==null?void 0:re.toLocaleString())||0}`}):e.jsx(x.Box,{direction:"column"}),S&&!!(j!=null&&j.totalPage)&&e.jsx(Vt.Pagination,{size:"xs",variant:"neutral",siblingCount:0,currentPage:j!=null&&j.currentPage?Number(j.currentPage):1,totalPages:Number(j.totalPage),onPageChange:oe})]}),e.jsx(wl,{isOpen:Ee,onClose:()=>ye(!1),configs:n,activeKeys:s,configByKey:o,hasActiveFilter:i,onToggle:l,onReset:be,getValue:a,setValue:d,clearValue:h,removeFilter:c})]})},Bl=({withPadding:t=!1,filterConfigs:r=[],filterKey:n="filter",activeFilterKey:s="filters",pageKey:o="page",perPageKey:i="perPage",pageSizeOptions:l=[25,50,100],defaultPerPage:c,showPagination:a=!0,showResultCount:d=!0,showPageSize:h=!0,searchable:g=!1,searchKey:m="q",searchPlaceholder:y="Search",searchShortcut:b="/",searchPosition:C="right",searchCollapsible:O=!0,pagination:M,columns:L=[],onColumnsChange:j,columnsState:D,scopeId:R,savedViews:B,persistLastState:S=!0,persistSearch:T=!0,storage:P=bn,onReset:X,leadingActions:I,trailingActions:N})=>{const Y=R??(B==null?void 0:B.scopeId),{activeKeys:G,configByKey:J,hasActiveFilter:$,toggleFilter:le,removeFilter:q,getValue:K,setValue:ae,clearValue:ge,clearAll:Ie}=yn({configs:r,filterKey:n,activeFilterKey:s,pageKey:o,searchKey:m}),Ee=$i({columns:L,scopeId:Y,storage:P,onColumnsChange:j,value:D}),ye=Ki({scopeId:Y,storage:P,snapshotKeys:[s,n,i],pageKey:o,getColumns:()=>Ee.state,applyColumns:Ee.applyState}),fe=tl({scopeId:Y,storage:P,snapshotKeys:[s,n,o],enabled:S,filterKey:n,searchKey:m,persistSearch:T}),Ne=rl({scopeId:Y,storage:P,perPageKey:i,pageSizeOptions:l,enabled:S});ol({enabled:S&&!!Y,snapshotKeys:[s,n,o],perPageKey:i,readSnapshot:fe.read,readPerPage:Ne.read});const Te=c??l[0]??25,Ve=!!(B!=null&&B.enabled)&&ye.enabled,oe=()=>{Ie(),fe.clear(),X==null||X()},we=ke.useMediaQuery("md"),be=g?e.jsx($o,{searchKey:m,filterKey:n,pageKey:o,placeholder:y,shortcut:b,collapsible:O}):null;return we?e.jsxs(x.Box,{display:"flex",direction:"row",align:"center",gap:"sm",wrap:"wrap",fullWidth:!0,paddingTop:t?"sm":void 0,paddingBottom:t?"sm":void 0,paddingLeft:t?"md":void 0,paddingRight:t?"md":void 0,role:"toolbar","aria-label":"Filter bar",children:[e.jsxs(x.Box,{direction:"row",display:"flex",align:"center",gap:"sm",style:{flex:"1 1 0",minWidth:0},children:[e.jsx(sl,{configs:r,activeKeys:G,onToggle:le,hasActiveFilter:$,onReset:oe}),C==="left"&&be,e.jsxs(x.Box,{direction:"row",display:"flex",align:"center",gap:"sm",overflow:"overflow-x-auto",style:{flex:"1 1 0",minWidth:0},children:[e.jsx(Jo,{activeKeys:G,configByKey:J,getValue:K,setValue:ae,clearValue:ge,removeFilter:q}),$&&e.jsx(H.Button,{variant:"link",tone:"brand",size:"sm",onClick:oe,children:"Reset"})]})]}),e.jsxs(x.Box,{direction:"row",display:"flex",align:"center",gap:"sm",children:[I,e.jsx(jl,{pagination:M,pageKey:o,perPageKey:i,pageSizeOptions:l,defaultPerPage:Te,showPagination:a,showResultCount:d,showPageSize:h}),C==="right"&&be,Ve&&e.jsx(es,{views:ye.views,onApply:ye.applyView,onDelete:ye.deleteView,onSave:ye.saveView}),L.length>0&&e.jsx(Ko,{columns:Ee.orderedColumns,allVisible:Ee.allVisible,onToggle:Ee.toggleVisibility,onReorder:Ee.reorder,onSetAllHidden:Ee.setAllHidden}),N]})]}):e.jsx(kl,{withPadding:t,configs:r,activeKeys:G,configByKey:J,hasActiveFilter:$,toggleFilter:le,removeFilter:q,getValue:K,setValue:ae,clearValue:ge,onReset:oe,searchable:g,searchKey:m,filterKey:n,pageKey:o,searchPlaceholder:y,searchShortcut:b,searchCollapsible:O,pagination:M,perPageKey:i,pageSizeOptions:l,defaultPerPage:Te,showPagination:a,showResultCount:d,showPageSize:h,hasColumns:L.length>0,orderedColumns:Ee.orderedColumns,allVisible:Ee.allVisible,onToggleVisibility:Ee.toggleVisibility,onReorder:Ee.reorder,onSetAllHidden:Ee.setAllHidden,showSavedViews:Ve,savedViews:ye.views,onApplyView:ye.applyView,onDeleteView:ye.deleteView,onSaveView:ye.saveView,leadingActions:I,trailingActions:N})},El=t=>{if(!Array.isArray(t)||t.length===0)return;const r=t[0];return(r==null?void 0:r.value)!=null?String(r.value):void 0},Fl=t=>{if(!Array.isArray(t)||t.length===0)return;const r=t.map(n=>(n==null?void 0:n.value)!=null?String(n.value):null).filter(n=>n!=null);return r.length?r:void 0},Il=(t,r)=>{switch(t.type){case"dropdown":case"radio":return El(r);case"dropdown-multiple":case"checkbox-multiple":return Fl(r);case"date":return r instanceof Date?r.toISOString():void 0;case"date-compact":return r;case"text":return typeof r=="string"&&r?r:void 0;default:return}},io=(t,r)=>{if(t==null||t==="")return r;const n=Number(t);return Number.isFinite(n)&&n>0?n:r},Ml=t=>{const{filterConfigs:r,filterKey:n="filter",activeFilterKey:s="filters",pageKey:o="page",perPageKey:i="perPage",searchKey:l="q",defaultPage:c=1,defaultPerPage:a=10,paramKeys:d,serialize:h}=t,{activeKeys:g,configByKey:m,hasActiveFilter:y,getValue:b}=yn({configs:r,filterKey:n,activeFilterKey:s,pageKey:o,searchKey:l}),{searchParams:C}=Ze(),O=C.toString();return u.useMemo(()=>{const L={},j={},D=io(C.get(o),c),R=io(C.get(i),a);L[(d==null?void 0:d.page)??"page"]=D,L[(d==null?void 0:d.perPage)??"perPage"]=R;const B=jr(l,C,n)||"";B&&(L[(d==null?void 0:d.search)??"search"]=B);let S=!1;for(const T of g){const P=m[T];if(!P)continue;const X=b(P);j[T]=X;const I=h==null?void 0:h[T],N=I?I(X):Il(P,X);if(N==null||Array.isArray(N)&&N.length===0)continue;const Y=(d==null?void 0:d[T])??T;L[Y]=N,S=!0}return{params:L,raw:j,hasActiveFilter:y||!!B||S}},[O,g.join("|"),n,s,o,i,l,c,a,d,h,m])},Ll=["dropdown","dropdown-multiple","checkbox-multiple","radio"],Tl=({filterConfigs:t,filterKey:r,activeFilterKey:n,pageKey:s,searchKey:o})=>{const{configByKey:i,getValue:l,setValue:c,removeFilter:a,clearAll:d,hasActiveFilter:h}=yn({configs:t,filterKey:r,activeFilterKey:n,pageKey:s,searchKey:o}),g=(j,D)=>{var B;const R=j.options;return((B=R==null?void 0:R.find(S=>S.value===D))==null?void 0:B.label)??D},m=u.useCallback(j=>{const D=i[j];if(!D)return[];const R=l(D);return Array.isArray(R)?R.map(B=>String(B.value)):[]},[i,l]),y=u.useCallback((j,D)=>{const R=i[j];if(!R||!Ll.includes(R.type))return;const B=Array.isArray(D)?D:[D];if(B.length===0){a(j);return}c(R,B.map(S=>({label:g(R,S),value:S})))},[i,c,a]),b=u.useCallback((j,D)=>{const R=m(j);y(j,R.includes(D)?R.filter(B=>B!==D):[...R,D])},[m,y]),C=u.useCallback((j,D)=>m(j).includes(D),[m]),O=u.useCallback(j=>a(j),[a]),M=u.useCallback(j=>{const D=i[j];return D?l(D):void 0},[i,l]),L=u.useCallback((j,D)=>{const R=i[j];if(R){if(D==null){a(j);return}c(R,D)}},[i,c,a]);return{set:y,toggle:b,clear:O,clearAll:d,isActive:C,values:m,getRaw:M,setRaw:L,hasActiveFilter:h}},_r="var(--sa-background-brand, #04254f)",Rl="var(--sa-text-brand, #031f43)",Ol={padding:"6px 8px",border:"1px solid var(--sa-border-subtle, #0b120e24)",borderRadius:"var(--sa-radii-xs, 4px)",font:"inherit",fontSize:13,outline:"none",width:"100%",boxSizing:"border-box"},jn={padding:"4px 8px",border:"none",background:"none",cursor:"pointer",font:"inherit",textAlign:"left",fontSize:13,color:Rl},ts=(t,r)=>{if(t.type==="text"||t.type==="date")return!!r.getRaw(t.key);if(t.type==="date-compact"){const n=r.getRaw(t.key);return!!(n&&(n.date||n.from||n.to||n.relative||n.op==="is-empty"||n.op==="is-not-empty"))}return r.values(t.key).length>0},Al=({field:t,controls:r})=>{const[n,s]=u.useState(""),o=t.type==="dropdown"||t.type==="radio",i=t.type==="checkbox-multiple"?!1:t.searchable!==!1,l=r.values(t.key),c=i&&n.trim()?t.options.filter(d=>d.label.toLowerCase().includes(n.toLowerCase())):t.options,a=d=>{o?r.set(t.key,l.includes(d)?[]:d):r.toggle(t.key,d)};return e.jsxs(x.Box,{style:{display:"flex",flexDirection:"column",gap:4,minWidth:200},children:[i&&e.jsx("input",{value:n,onChange:d=>{var h;s(d.target.value),(h=t.onSearch)==null||h.call(t,d.target.value)},placeholder:"Cari…",style:Ol}),e.jsxs(x.Box,{style:{display:"flex",flexDirection:"column",gap:2,maxHeight:220,overflowY:"auto"},children:[c.map(d=>{const h=l.includes(d.value);return e.jsxs("button",{type:"button",onClick:()=>a(d.value),style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"6px 8px",border:"none",background:"none",cursor:"pointer",font:"inherit",textAlign:"left",borderRadius:"var(--sa-radii-xs, 4px)"},children:[e.jsx("span",{style:{width:16,height:16,flexShrink:0,borderRadius:o?"50%":"var(--sa-radii-xs, 4px)",display:"inline-flex",alignItems:"center",justifyContent:"center",border:`1px solid ${h?_r:"var(--sa-border-subtle, #0b120e24)"}`,background:h&&!o?_r:"transparent"},children:h&&(o?e.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:_r}}):e.jsx(E.Icon,{name:"Check",size:"xs",style:{color:"#fff"}}))}),e.jsx(w.Text,{as:"span",style:{fontSize:14},children:d.label})]},d.value)}),c.length===0&&e.jsx(w.Text,{as:"span",style:{fontSize:13,color:"var(--sa-text-subtlest, #8c8f97)",padding:"6px 8px"},children:"Tak ada hasil"})]}),l.length>0&&e.jsx("button",{type:"button",onClick:()=>r.clear(t.key),style:jn,children:"Clear"})]})},Wl=({field:t,controls:r})=>{const n=r.getRaw(t.key);return e.jsx(x.Box,{style:{minWidth:240},children:e.jsx(vt.StarasiaDate,{size:"sm",input:!1,clearable:!0,filter:t.mode,value:n,onChange:s=>r.setRaw(t.key,s??null),withPadding:!1})})},zl=({field:t,controls:r})=>{const n=r.getRaw(t.key),s=t.ops&&t.ops.length>0?t.ops:Uo,o=t.defaultOp&&s.includes(t.defaultOp)?t.defaultOp:s[0],i=t.mode??"days",l=(n==null?void 0:n.op)??o,c=d=>r.setRaw(t.key,d),a=d=>{if(d!==l)return c(d==="is-empty"||d==="is-not-empty"?{op:d}:d==="is-relative-to-today"?{op:d,relative:(n==null?void 0:n.relative)??{direction:"past",count:1,period:"week"}}:d==="is-between"?{op:d,from:n==null?void 0:n.from,to:n==null?void 0:n.to}:{op:d,date:n==null?void 0:n.date})};return e.jsxs(x.Box,{style:{display:"flex",flexDirection:"column",gap:6,minWidth:280},children:[e.jsxs(x.Box,{display:"flex",direction:"row",align:"center",gap:"xs",children:[e.jsx(w.Text,{fontSize:"sm",fontWeight:"medium",color:"subtlest",children:t.label}),e.jsx(Yo,{op:l,ops:s,onChange:a})]}),e.jsx(Xo,{value:n,op:l,mode:i,onChange:c}),ts(t,r)&&e.jsx("button",{type:"button",onClick:()=>r.setRaw(t.key,null),style:jn,children:"Clear"})]})},Hl=({field:t,controls:r})=>{const n=r.getRaw(t.key)??"",[s,o]=u.useState(n),i=ke.useDebounce(s,t.debounceMs??300);return u.useEffect(()=>{const l=r.getRaw(t.key)??"";i!==l&&r.setRaw(t.key,i||null)},[i]),e.jsxs(x.Box,{style:{display:"flex",flexDirection:"column",gap:6,minWidth:220},children:[e.jsx(mt.Input,{size:"sm",fullWidth:!0,value:s,placeholder:t.placeholder??"Cari…",leftIcon:e.jsx(E.Icon,{name:"Search",width:16,height:16}),onChange:l=>o(l.target.value)}),s&&e.jsx("button",{type:"button",onClick:()=>{o(""),r.setRaw(t.key,null)},style:jn,children:"Clear"})]})},Pl=({field:t,controls:r})=>t.type==="text"?e.jsx(Hl,{field:t,controls:r}):t.type==="date"?e.jsx(Wl,{field:t,controls:r}):t.type==="date-compact"?e.jsx(zl,{field:t,controls:r}):e.jsx(Al,{field:t,controls:r}),_l=(t,r)=>{if(!t)return{};const{fromKey:n,toKey:s,opKey:o}=r,i={};switch(t.op){case"is":case"is-before":case"is-after":case"is-on-or-before":case"is-on-or-after":return t.date&&(i[n]=new Date(t.date).toISOString()),o&&(i[o]=t.op),i;case"is-between":return t.from&&(i[n]=new Date(t.from).toISOString()),t.to&&(i[s]=new Date(t.to).toISOString()),i;case"is-relative-to-today":{if(!t.relative)return i;const{from:l,to:c}=Zo(t.relative);return i[n]=l.toISOString(),i[s]=c.toISOString(),i}case"is-empty":case"is-not-empty":return o&&(i[o]=t.op==="is-empty"?"empty":"not-empty"),i;default:return i}},rs=({children:t,borderRadius:r,height:n})=>{const s=u.useRef(null),[o,i]=u.useState("100vh");return u.useEffect(()=>{if(n)return;const l=()=>{if(s.current){const c=s.current.getBoundingClientRect().top;i(`calc(100vh - ${c}px)`)}};return l(),window.addEventListener("resize",l),()=>window.removeEventListener("resize",l)},[n]),e.jsx(x.Box,{ref:s,fullWidth:!0,borderStyle:"border-solid",borderWidth:"border",borderColor:"border-base",borderRadius:r||"rounded-xs",style:{height:n??o,display:"flex",flexDirection:"column"},children:t})},ns=({action:t,rightContent:r,leftContent:n,headerSlot:s,advanceFilter:o,showFilter:i=!0})=>{const l=ke.useMediaQuery("md"),c=i?e.jsx(qo,{...o}):null,a=()=>t?u.isValidElement(t)?t:e.jsx(x.Box,{style:{display:"flex",flexDirection:l?"row":"column",gap:"8px",width:l?"auto":"100%",textWrap:"nowrap"},children:t.map(({title:d,icon:h,buttonProps:g,onClick:m},y)=>!d&&!h?null:e.jsx(H.Button,{fullWidth:!l,iconLeft:h?e.jsx(E.Icon,{name:h}):void 0,onClick:m,...g,children:d},`action-${y}`))}):null;return e.jsx(x.Box,{style:{display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center",paddingLeft:"8px",paddingRight:"8px",paddingTop:"8px",paddingBottom:"8px",borderBottom:"1px solid var(--sa-border-subtle, #0b120e24)",flexShrink:0,position:"relative",zIndex:10,flexDirection:l?"row":"column-reverse",gap:"16px"},children:s?s({filter:c}):e.jsxs(e.Fragment,{children:[e.jsxs(x.Box,{style:{display:"flex",gap:"8px",flexDirection:"row",alignItems:"center",flex:1,minWidth:0},children:[c,n]}),e.jsxs(x.Box,{style:{display:"flex",gap:"8px",flexDirection:"row",alignItems:"center",flexShrink:0},children:[r,a()]})]})})},Nl=({totalData:t,withMarginBottom:r=!0,withMarginTop:n=!0})=>e.jsxs(x.Box,{style:{display:"flex",gap:"4px",flexDirection:"row",alignItems:"center",marginBottom:r?"16px":void 0,marginTop:n?"16px":void 0},children:[e.jsxs(nt.Body1,{props:{color:"gray-500"},children:["Total data:"," "]}),e.jsx(nt.Body1,{children:t||0})]}),os=({pagination:t,pageKey:r="page",perPageKey:n="perPage",defaultPerPage:s=10,showPagination:o=!0,totalData:i})=>{const{searchQueries:l,setSearchParams:c,searchParams:a}=Ze(),d=a.get(n),h=b=>{c({...l,[r]:String(b)})},g=b=>{c({...l,[n]:b,[r]:"1"})},m=(t==null?void 0:t.rangeStart)??(((t==null?void 0:t.currentPage)||0)>1?(((t==null?void 0:t.currentPage)||0)-1)*((t==null?void 0:t.perPage)||0)+1:1),y=(t==null?void 0:t.rangeEnd)??((t==null?void 0:t.totalCurrentPage)!==(t==null?void 0:t.perPage)?t==null?void 0:t.totalData:((t==null?void 0:t.currentPage)||1)*((t==null?void 0:t.totalCurrentPage)||0));return e.jsx(x.Box,{style:{display:"flex",width:"100%",flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingLeft:"16px",paddingRight:"16px",paddingTop:"8px",paddingBottom:"8px",borderTop:"1px solid var(--sa-border-subtle, #0b120e24)",flexShrink:0},children:o?e.jsxs(e.Fragment,{children:[e.jsxs(x.Box,{style:{display:"flex",flexDirection:"row",gap:"8px",alignItems:"center",textWrap:"nowrap"},children:[e.jsx(w.Text,{children:"Rows Per Page: "}),e.jsx(Lt.Dropdown,{dropdownLists:[{label:"5",value:"5"},{label:"10",value:"10"},{label:"25",value:"25"},{label:"50",value:"50"},{label:"100",value:"100"}],onChange:b=>{g(b[0].value)},value:d?[{label:`${d} per row`,value:d}]:[{label:`${s} per row`,value:`${s}`}],defaultValue:d?[{label:`${d} per row`,value:d}]:[{label:`${s} per row`,value:`${s}`}]}),e.jsx(w.Text,{children:`${m}-${y} of ${(t==null?void 0:t.totalData)||0}`})]}),e.jsx(Vt.Pagination,{currentPage:t!=null&&t.currentPage?Number(t==null?void 0:t.currentPage):1,totalPages:t!=null&&t.totalPage?Number(t==null?void 0:t.totalPage):1,onPageChange:h})]}):e.jsx(Nl,{totalData:i,withMarginBottom:!1,withMarginTop:!1})})},ss=({filter:t,columnTitle:r})=>{const[n,s]=u.useState(!1),o=u.useRef(null),i=u.useRef(null),l=u.useRef(null),[c,a]=u.useState(""),[d,h]=u.useState({top:0,left:0}),g=t.selectedValues,m=u.useMemo(()=>c?t.options.filter(C=>C.label.toLowerCase().includes(c.toLowerCase())):t.options,[t.options,c]);u.useEffect(()=>{if(n&&i.current){const C=i.current.getBoundingClientRect(),O=280,M={top:C.bottom+8};t.position==="left"||C.left+O>window.innerWidth?M.right=window.innerWidth-C.right:M.left=C.left,h(M)}},[n,t.position]),u.useEffect(()=>{n&&l.current?setTimeout(()=>{var C;return(C=l.current)==null?void 0:C.focus()},50):a("")},[n]),u.useEffect(()=>{const C=O=>{o.current&&!o.current.contains(O.target)&&i.current&&!i.current.contains(O.target)&&s(!1)};return n&&document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[n]);const y=C=>{const O=g.includes(C)?g.filter(M=>M!==C):[...g,C];t.onFilterChange(O)},b=()=>t.onFilterChange([]);return e.jsxs(x.Box,{direction:"column",style:{position:"relative"},children:[e.jsx(x.Box,{ref:i,style:{display:"flex",flexDirection:"row",alignItems:"center",cursor:"pointer"},onClick:C=>{var O;C.stopPropagation(),n||(O=t.onOpen)==null||O.call(t),s(M=>!M)},children:e.jsx(E.Icon,{name:n?"ChevronUp":"ChevronDown",size:"sm",style:{color:g.length>0?"var(--sa-color-brand-500, #1a4fa0)":"var(--sa-text-subtle, #8c8f97)"}})}),n&&e.jsxs(x.Box,{ref:o,style:{position:"fixed",top:`${d.top}px`,...d.left!==void 0?{left:`${d.left}px`}:{right:`${d.right}px`},backgroundColor:"white",borderRadius:"var(--sa-radii-xs, 4px)",minWidth:"280px",maxHeight:"400px",display:"flex",flexDirection:"column",zIndex:9999,animation:"fadeInDropdown 0.15s ease-out",border:"1px solid var(--sa-border-subtle, #0b120e24)"},children:[e.jsxs(x.Box,{style:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingTop:"12px",paddingBottom:"12px",paddingLeft:"16px",paddingRight:"16px",borderBottom:"1px solid var(--sa-border-subtle, #0b120e24)"},children:[e.jsxs(w.Text,{fontSize:"sm",fontWeight:"semibold",color:"gray-700",children:["Filter ",r]}),g.length>0&&e.jsx(x.Box,{direction:"column",style:{cursor:"pointer"},children:e.jsx(w.Text,{fontSize:"xs",color:"primary",fontWeight:"semibold",onClick:C=>{C.stopPropagation(),b()},children:"CLEAR"})})]}),!t.hideSearch&&e.jsx(x.Box,{direction:"column",style:{paddingLeft:"16px",paddingRight:"16px",paddingTop:"8px",paddingBottom:"8px"},children:e.jsx(mt.Input,{ref:l,placeholder:`Search ${r.toLowerCase()}...`,leftIcon:e.jsx(E.Icon,{name:"Search",size:"sm"}),value:c,onChange:C=>a(C.target.value),style:{fontSize:"14px"}})}),e.jsx(x.Box,{direction:"column",className:"ts-filter-dropdown-options",style:{overflowY:"auto",maxHeight:"250px",paddingLeft:"8px",paddingRight:"8px"},children:t.isLoadingOptions?e.jsxs(x.Box,{style:{paddingTop:"40px",paddingBottom:"40px",display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:[e.jsx(E.Icon,{name:"Loading",size:"lg",style:{color:"var(--sa-background-brand, #04254f)",animation:"spin 1s linear infinite"}}),e.jsx(w.Text,{fontSize:"sm",color:"gray-500",style:{textAlign:"center",marginTop:"8px"},children:"Loading options..."})]}):m.length>0?e.jsx(x.Box,{direction:"column",style:{gap:"2px",paddingTop:"4px",paddingBottom:"4px"},children:m.map(C=>e.jsxs(x.Box,{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",paddingTop:"8px",paddingBottom:"8px",paddingLeft:"8px",paddingRight:"8px",cursor:"pointer",borderRadius:"var(--sa-radii-md, 8px)",transition:"all 0.2s ease",backgroundColor:g.includes(C.value)?"var(--sa-color-brand-50, #e6edf6)":"transparent"},onClick:O=>{O.stopPropagation(),y(C.value)},onMouseEnter:O=>{g.includes(C.value)||(O.currentTarget.style.backgroundColor="var(--sa-background-primary, #ffffff)"),O.currentTarget.style.transform="translateX(2px)"},onMouseLeave:O=>{O.currentTarget.style.backgroundColor=g.includes(C.value)?"var(--sa-color-brand-50, #e6edf6)":"transparent",O.currentTarget.style.transform="translateX(0)"},children:[e.jsx(ft.Checkbox,{checked:g.includes(C.value),onChange:()=>{}}),e.jsx(w.Text,{fontSize:"sm",fontWeight:g.includes(C.value)?"medium":"normal",color:g.includes(C.value)?"primary":"gray-700",children:C.label})]},C.value))}):e.jsxs(x.Box,{style:{paddingTop:"40px",paddingBottom:"40px",display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:[e.jsx(E.Icon,{name:"Search",size:"lg",style:{color:"var(--sa-text-subtle, #8c8f97)"}}),e.jsx(w.Text,{fontSize:"sm",color:"gray-500",style:{textAlign:"center",marginTop:"8px"},children:"No results found"})]})}),g.length>0&&e.jsx(x.Box,{direction:"column",style:{paddingTop:"8px",paddingBottom:"8px",paddingLeft:"16px",paddingRight:"16px",borderTop:"1px solid var(--sa-border-subtle, #0b120e24)",backgroundColor:"var(--sa-color-brand-50, #e6edf6)",marginTop:"auto"},children:e.jsxs(x.Box,{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsx(x.Box,{direction:"column",style:{backgroundColor:"var(--sa-background-brand, #04254f)",borderRadius:"var(--sa-radii-lg, 12px)",padding:"2px 8px",fontSize:"11px",fontWeight:600,color:"white"},children:g.length}),e.jsxs(w.Text,{fontSize:"xs",color:"primary",fontWeight:"medium",children:["item",g.length>1?"s":""," selected"]})]})})]})]})},Vl=({direction:t})=>{const r="var(--sa-text-primary, #292a2e)",n="var(--sa-text-subtle, #8c8f97)",s=t==="asc"?r:n,o=t==="desc"?r:n,i=t==="asc"?1:.45,l=t==="desc"?1:.45;return e.jsxs("span",{style:{display:"inline-flex",flexDirection:"column",alignItems:"center",justifyContent:"center",flexShrink:0,lineHeight:0},"aria-hidden":!0,children:[e.jsx("svg",{width:"8",height:"5",viewBox:"0 0 8 5",style:{color:s,opacity:i,marginBottom:1},children:e.jsx("path",{d:"M4 0 L8 5 L0 5 Z",fill:"currentColor"})}),e.jsx("svg",{width:"8",height:"5",viewBox:"0 0 8 5",style:{color:o,opacity:l},children:e.jsx("path",{d:"M0 0 L8 0 L4 5 Z",fill:"currentColor"})})]})},ql=({frozen:t})=>e.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:t?"currentColor":"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),e.jsx("path",{d:t?"M7 11V7a5 5 0 0 1 10 0v4":"M7 11V7a5 5 0 0 1 9.9-1"})]}),Nr="var(--sa-background-primary, #ffffff)",lo="var(--sa-background-primary-inverse, #f8f8f8)",is=({columns:t,records:r,handleDetail:n,handleUpdate:s,handleDelete:o,isLoading:i,visibleHandleDelete:l,visibleHandleUpdate:c,visibleHandleDetail:a,showHeadBorder:d=!1,scrollParentRef:h,frozenCount:g=0,onFrozenCountChange:m,customActions:y,actionsOrder:b=["detail","update","delete","custom"],customEmptyState:C,enableColumnResize:O=!1,defaultColumnWidths:M,onColumnWidthsChange:L,defaultMinColumnWidth:j=60,sort:D,defaultSort:R,onSortChange:B,showActionDivider:S=!1})=>{const T=D!==void 0,[P,X]=u.useState(R??null),I=T?D??null:P,N=W=>{if(W.sortKey)return W.sortKey;if(typeof W.accessor=="string")return W.accessor},Y=W=>{const Q=N(W);if(!Q)return;let U;!I||I.key!==Q?U={key:Q,direction:"asc"}:I.direction==="asc"?U={key:Q,direction:"desc"}:U=null,T||X(U),B==null||B(U)},J=[n,s,o].filter(W=>W!==void 0).length,$=!!y,le=!!n||!!s||!!o||$,q="var(--sa-border-subtle, #0b120e24)",K=`1px solid ${q}`,ae=`inset 1px 0 0 ${q}`,ge=`inset -1px 0 0 ${q}`,Ie=J===3?$?"178px":"140px":J===2?$?"140px":"102px":J===1?$?"112px":"74px":$?"74px":"",Ee=(W,Q)=>{if(!Q)return W;if(typeof Q=="function")return Q(W);if(typeof Q=="string")return W[Q]},[ye,fe]=u.useState(!1);u.useEffect(()=>{if(!(h!=null&&h.current))return;const W=h.current;fe(W.scrollHeight>W.clientHeight)},[r,h]);const Ne=u.useRef(null),[Te,Ve]=u.useState([]),[oe,we]=u.useState(()=>M??{}),be=u.useRef(null);u.useLayoutEffect(()=>{if(!g||!Ne.current){Ve([]);return}const W=Array.from(Ne.current.querySelectorAll("thead tr th")),Q=[];let U=0;W.forEach((ue,Fe)=>{Q[Fe]=U,Fe<g&&(U+=ue.offsetWidth)}),Ve(Q)},[g,t,r,oe]);const re=W=>{m&&m(W<g?W:W+1)},Be=(W,Q)=>{const U=oe[W];if(U!==void 0){const ue=`${U}px`;return{width:ue,minWidth:ue,maxWidth:ue}}return Q?{width:Q}:{}},Je=W=>O&&(W.resizable??!0),et=(W,Q)=>{W.preventDefault(),W.stopPropagation();const U=W.currentTarget.closest("th");if(!U)return;const ue=Math.round(U.getBoundingClientRect().width);be.current={colIndex:Q,startX:W.clientX,startWidth:ue};const Fe=document.body.style.userSelect,me=document.body.style.cursor;document.body.style.userSelect="none",document.body.style.cursor="col-resize";const Ae=Ge=>{var De;const We=be.current;if(!We)return;const Qe=((De=t[We.colIndex])==null?void 0:De.minWidth)??j,gt=Math.max(Qe,We.startWidth+(Ge.clientX-We.startX));we(ze=>ze[We.colIndex]===gt?ze:{...ze,[We.colIndex]:gt})},$e=()=>{document.removeEventListener("mousemove",Ae),document.removeEventListener("mouseup",$e),document.body.style.userSelect=Fe,document.body.style.cursor=me,be.current=null,L&&we(Ge=>(L(Ge),Ge))};document.addEventListener("mousemove",Ae),document.addEventListener("mouseup",$e)};return e.jsx("div",{ref:Ne,children:e.jsxs(Z.Table,{fullWidth:!0,children:[e.jsx(Z.Thead,{style:{height:"40px",whiteSpace:"nowrap"},children:e.jsxs(Z.Tr,{children:[t.map((W,Q)=>{var dt,Dt;const U=g>0&&Q<g,ue=Te[Q]??0,Fe=Je(W),Ae=Q===t.length-1&&le&&S,$e=N(W),Ge=!!W.sortable&&!!$e,We=Ge&&(I==null?void 0:I.key)===$e?I.direction:null,Qe=W.title||((dt=W.accessor)==null?void 0:dt.toString())||"",gt=(Dt=W.headerTooltip)!=null&&Dt.showIcon?e.jsx(E.Icon,{name:"InfoCircle",size:"xs",style:{flexShrink:0,color:"var(--sa-icon-subtle, #8c8f97)",opacity:.75}}):null,De=e.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Qe}),ze=Ge?e.jsxs("button",{type:"button",onClick:()=>Y(W),title:We==="asc"?"Sorted ascending — click to sort descending":We==="desc"?"Sorted descending — click to clear":"Click to sort ascending",style:{flex:1,minWidth:0,display:"flex",alignItems:"center",gap:4,background:"none",border:"none",padding:0,margin:0,font:"inherit",color:"inherit",cursor:"pointer",textAlign:W.textAlign==="text-right"?"right":W.textAlign==="text-center"?"center":"left"},children:[De,gt,e.jsx(Vl,{direction:We})]}):e.jsxs("span",{style:{flex:1,minWidth:0,display:"flex",alignItems:"center",gap:4},children:[De,gt]});return e.jsxs(Z.Th,{style:{position:"sticky",top:0,left:U?ue:void 0,zIndex:U?4:2,paddingLeft:Q===0?"12px":"",borderRight:d&&!Ae&&!U?K:void 0,borderBottom:d?K:void 0,boxShadow:d&&U?ge:void 0,backgroundColor:"var(--sa-background-primary-inverse, #f8f8f8)",textAlign:W.textAlign==="text-right"?"right":W.textAlign==="text-center"?"center":"left",...Be(Q,W.width)},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",justifyContent:"space-between",minWidth:0},children:[W.headerTooltip?e.jsx(Le.Tooltip,{label:W.headerTooltip.content,position:"bottom",children:ze}):ze,W.filter&&e.jsx(ss,{filter:W.filter,columnTitle:W.title}),m&&e.jsx("button",{onClick:()=>re(Q),title:U?"Unfreeze column":"Freeze column",style:{background:"none",border:"none",cursor:"pointer",padding:"2px",display:"flex",alignItems:"center",flexShrink:0,color:U?"var(--sa-background-brand, #04254f)":"var(--sa-text-subtle, #8c8f97)",opacity:U?1:.45,transition:"opacity 0.15s"},children:e.jsx(ql,{frozen:U})})]}),Fe&&e.jsx("div",{onMouseDown:tt=>et(tt,Q),onClick:tt=>tt.stopPropagation(),role:"separator","aria-orientation":"vertical",title:"Drag to resize",style:{position:"absolute",top:0,right:-3,width:6,height:"100%",cursor:"col-resize",userSelect:"none",zIndex:5,touchAction:"none"}})]},`table-head-${Q}`)}),le?e.jsx(Z.Th,{style:{backgroundColor:"var(--sa-background-primary-inverse, #f8f8f8)",position:"sticky",top:0,right:0,zIndex:3,borderBottom:d?K:void 0,boxShadow:d&&S?ae:void 0}}):null]})}),e.jsx(Z.Tbody,{children:i?e.jsx(Z.Tr,{children:e.jsx(Z.Td,{colSpan:t.length+1,children:e.jsxs(x.Box,{direction:"column",style:{gap:"16px"},children:[e.jsx(rt.Skeleton,{variant:"list"}),e.jsx(rt.Skeleton,{variant:"list"}),e.jsx(rt.Skeleton,{variant:"list"}),e.jsx(rt.Skeleton,{variant:"list"}),e.jsx(rt.Skeleton,{variant:"list"})]})})}):!(r!=null&&r.length)&&C?e.jsx(Z.Tr,{children:e.jsx(Z.Td,{colSpan:t.length+1,children:C})}):r==null?void 0:r.map((W,Q)=>e.jsxs(Z.Tr,{style:{transition:"background-color 0.3s ease",padding:0,borderBottom:Q===r.length-1&&ye?void 0:"1px solid var(--sa-border-subtle, #0b120e24)"},onMouseEnter:U=>{const ue=U.currentTarget;ue.style.backgroundColor=lo,Array.from(ue.querySelectorAll("td")).forEach(Fe=>{Fe.style.position==="sticky"&&(Fe.style.backgroundColor=lo)})},onMouseLeave:U=>{const ue=U.currentTarget;ue.style.backgroundColor="",Array.from(ue.querySelectorAll("td")).forEach(Fe=>{Fe.style.position==="sticky"&&(Fe.style.backgroundColor=Nr)})},children:[t.map((U,ue)=>{const Fe=U.render?U.render(W,Q,r):Ee(W,U.accessor),me=g>0&&ue<g,Ae=Te[ue]??0,$e=oe[ue]!==void 0,Ge=me&&ue===g-1;return e.jsx(Z.Td,{style:{position:me?"sticky":void 0,left:me?Ae:void 0,zIndex:me?1:void 0,backgroundColor:me?Nr:void 0,transition:me?"background-color 0.3s ease":void 0,paddingLeft:ue===0?"12px":"",whiteSpace:"nowrap",overflow:$e?"hidden":void 0,borderLeft:U.showBorderLeft?K:void 0,borderRight:U.showBorderRight?K:void 0,boxShadow:Ge?ge:void 0,textAlign:U.textAlign==="text-right"?"right":U.textAlign==="text-center"?"center":"left",...Be(ue,U.width)},children:typeof Fe=="string"?e.jsx(w.Text,{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",textAlign:U.textAlign==="text-right"?"right":U.textAlign==="text-center"?"center":"left"},children:Fe}):Fe},`row-${Q}-col-${ue}`)}),le?e.jsx(Z.Td,{style:{width:Ie,position:"sticky",right:0,zIndex:1,backgroundColor:Nr,boxShadow:S?ae:void 0,transition:"background-color 0.3s ease"},children:e.jsx(de.Flex,{direction:"row",align:"center",justify:"center",gap:"sm",children:b.map(U=>{const ue=Q===r.length-1?"top":"bottom";return U==="detail"&&n&&(a==null?void 0:a(W))!==!1?e.jsx(Le.Tooltip,{label:"Detail",position:ue,children:e.jsx(H.Button,{size:"xs",variant:"outline",tone:"neutral",onClick:()=>n(W.id,W),iconLeft:e.jsx(E.Icon,{name:"DocumentClean",size:"sm",style:{color:"var(--sa-text-subtle, #8c8f97)"}})})},"detail"):U==="update"&&s&&(c==null?void 0:c(W))!==!1?e.jsx(Le.Tooltip,{label:"Update",position:ue,children:e.jsx(H.Button,{size:"xs",variant:"outline",tone:"neutral",onClick:()=>s(W),iconLeft:e.jsx(E.Icon,{name:"Edit1",size:"sm",style:{color:"var(--sa-text-subtle, #8c8f97)"}})})},"update"):U==="delete"&&o&&(l==null?void 0:l(W))!==!1?e.jsx(Le.Tooltip,{label:"Delete",position:ue,children:e.jsx(H.Button,{size:"xs",variant:"outline",tone:"neutral",onClick:()=>o(W.id,W),iconLeft:e.jsx(E.Icon,{name:"Trash1",size:"sm",style:{color:"var(--sa-color-error-600, #c9184a)"}})})},"delete"):U==="custom"?e.jsx(u.Fragment,{children:y==null?void 0:y(W)},"custom"):null})})}):null]},`${W}${Q}`))})]})})};let co=!1;const Zl=({wrapperProps:t,dataTableProps:r,headerProps:n,footerProps:s})=>{var g;process.env.NODE_ENV!=="production"&&!co&&(co=!0,console.warn("[@starasia/admin] `TableSection` deprecated — pakai `<FilterBar>` + `<TableLayout>`. Lihat skill `starasia-list-page-pattern`. Akan dihapus di salah satu major berikutnya."));const o=u.useRef(null),[i,l]=u.useState((r==null?void 0:r.defaultFrozenCount)??0),c=(n==null?void 0:n.show)??!0,a=u.useRef(null),d=(g=r==null?void 0:r.pagination)==null?void 0:g.totalData;typeof d=="number"&&(a.current=d);const h=(s==null?void 0:s.showFooter)??(d===void 0?a.current!==0:d!==0);return e.jsxs(rs,{...t,children:[c&&e.jsx(ns,{...n}),e.jsx(x.Box,{direction:"column",ref:o,style:{flex:1,overflowY:"auto",overflowX:"auto"},children:r?e.jsx(is,{...r,scrollParentRef:o,frozenCount:r!=null&&r.enableFreezeColumns?i:0,onFrozenCountChange:r!=null&&r.enableFreezeColumns?l:void 0}):null}),h&&e.jsx(os,{pagination:r==null?void 0:r.pagination,pageKey:r==null?void 0:r.pageKey,perPageKey:r==null?void 0:r.perPageKey,defaultPerPage:r==null?void 0:r.defaultPerPage,showPagination:r==null?void 0:r.showPagination,totalData:s==null?void 0:s.totalData})]})};function Gl(t){return u.memo(t)}const Ql=Gl(Zl),ls="(any-pointer: coarse)",Ul=t=>{if(typeof window>"u"||!window.matchMedia)return()=>{};const r=window.matchMedia(ls);return r.addEventListener("change",t),()=>r.removeEventListener("change",t)},Yl=()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia(ls).matches,Xl=()=>!1;function cs(){return u.useSyncExternalStore(Ul,Yl,Xl)}const ao=200,ir="1px solid var(--sa-border-subtle, #0b120e24)",Jl=({sortDir:t,frozen:r,filterActive:n})=>t==="asc"?e.jsx(E.Icon,{name:"ChevronSmallUp"}):t==="desc"?e.jsx(E.Icon,{name:"ChevronSmallDown"}):r?e.jsx(E.Icon,{name:"LockOn",size:"xs"}):e.jsx(E.Icon,{name:"Filter",size:"xs",style:n?{color:"var(--sa-text-brand, #031f43)"}:void 0}),lr=({icon:t,label:r,active:n,danger:s,onClick:o})=>{const i=s?"var(--sa-text-error, #a4133c)":"var(--sa-text-primary, #292a2e)";return e.jsxs("button",{type:"button",onClick:o,style:{display:"flex",alignItems:"center",gap:12,width:"100%",padding:"8px 12px",background:n?"var(--sa-background-brand-subtlest, #e6edf6)":"none",border:"none",cursor:"pointer",font:"inherit",color:i,textAlign:"left"},onMouseEnter:l=>{n||(l.currentTarget.style.background="var(--sa-background-primary-inverse, #f8f8f8)")},onMouseLeave:l=>{l.currentTarget.style.background=n?"var(--sa-background-brand-subtlest, #e6edf6)":"none"},children:[e.jsx(E.Icon,{name:t,size:"sm",style:{color:i,flexShrink:0}}),e.jsx(w.Text,{as:"span",style:{color:i},children:r})]})},$l=t=>{let r=(t==null?void 0:t.parentElement)??null;for(;r;){const n=getComputedStyle(r).overflowX;if((n==="auto"||n==="scroll")&&r.scrollWidth>r.clientWidth)return r;r=r.parentElement}return null},as=({active:t,canSort:r,canHide:n,sortDir:s,frozen:o,onSort:i,onClearSort:l,onToggleFreeze:c,onHide:a,filterSlot:d,filterActive:h})=>{const[g,m]=u.useState(!1),y=u.useRef(null),b=u.useRef(null),[C,O]=u.useState({top:0,left:0}),M=u.useCallback(()=>{var I;const j=y.current;if(!j)return;const D=j.getBoundingClientRect(),R=j.closest(".sa-tl-scroll")??$l(j),B=R==null?void 0:R.getBoundingClientRect();if(B&&(D.left<B.left||D.left>B.right)){m(!1);return}const S=Math.min(window.innerWidth-8,B?B.right:window.innerWidth),T=((I=b.current)==null?void 0:I.offsetWidth)||ao,P=B?B.left:8,X=Math.max(P,Math.min(D.left,S-T));O({top:D.bottom+6,left:X})},[]);u.useEffect(()=>{if(!g)return;M();const j=()=>M();return window.addEventListener("scroll",j,!0),window.addEventListener("resize",j),()=>{window.removeEventListener("scroll",j,!0),window.removeEventListener("resize",j)}},[g,M]),u.useEffect(()=>{if(!g)return;const j=D=>{b.current&&!b.current.contains(D.target)&&y.current&&!y.current.contains(D.target)&&m(!1)};return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[g]);const L=j=>{j(),m(!1)};return e.jsxs(e.Fragment,{children:[e.jsx("button",{ref:y,type:"button",className:"sa-tl-menu-trigger","data-active":t||g?"true":"false",onClick:j=>{j.stopPropagation(),m(D=>!D)},title:"Column options",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:22,height:22,borderRadius:"var(--sa-radii-sm, 6px)",border:ir,background:"var(--sa-background-primary, #ffffff)",cursor:"pointer",color:"var(--sa-text-subtle, #8c8f97)",flexShrink:0},children:e.jsx(Jl,{sortDir:s,frozen:o,filterActive:h})}),g&&e.jsxs(x.Box,{ref:b,onClick:j=>j.stopPropagation(),style:{position:"fixed",top:`${C.top}px`,...C.left!==void 0?{left:`${C.left}px`}:{right:`${C.right}px`},minWidth:ao,backgroundColor:"var(--sa-background-primary, #ffffff)",border:ir,borderRadius:"var(--sa-radii-sm, 6px)",boxShadow:"var(--sa-shadow-xl, 0 20px 25px -5px #0000001a, 0 8px 10px -6px #0000001a)",zIndex:9999,padding:"4px",display:"flex",flexDirection:"column"},children:[d!=null&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{padding:"6px 12px 2px"},children:e.jsx(w.Text,{as:"span",style:{fontSize:12,fontWeight:500,color:"var(--sa-text-subtlest, #8c8f97)"},children:"Filter"})}),e.jsx("div",{style:{padding:"2px 8px 4px"},children:d}),e.jsx("div",{style:{borderTop:ir,margin:"4px 0"}})]}),r&&e.jsxs(e.Fragment,{children:[e.jsx(lr,{icon:"ChevronUp",label:"Ascending",active:s==="asc",onClick:()=>L(()=>s==="asc"?l():i("asc"))}),e.jsx(lr,{icon:"ChevronDown",label:"Descending",active:s==="desc",onClick:()=>L(()=>s==="desc"?l():i("desc"))}),e.jsx("div",{style:{borderTop:ir,margin:"4px 0"}})]}),e.jsx(lr,{icon:"Pin1",label:o?"Unfreeze":"Freeze",active:o,onClick:()=>L(c)}),n&&e.jsx(lr,{icon:"EyeClosed",label:"Hide column",danger:!0,onClick:()=>L(a)})]})]})},Kl=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),ec={background:"var(--sa-background-warning-subtlest, #fef2e6)",color:"inherit",padding:0,borderRadius:"min(2px, var(--sa-radii-xs, 4px))"},ds=({text:t,query:r,markStyle:n})=>{const s=r==null?void 0:r.trim();if(!s||!t)return e.jsx(e.Fragment,{children:t});const o=s.split(/\s+/).filter(Boolean);if(!o.length)return e.jsx(e.Fragment,{children:t});const i=new Set(o.map(a=>a.toLowerCase())),l=new RegExp(`(${o.map(Kl).join("|")})`,"gi"),c=t.split(l);return e.jsx(e.Fragment,{children:c.map((a,d)=>a&&i.has(a.toLowerCase())?e.jsx("mark",{style:{...ec,...n},children:a},d):e.jsx(u.Fragment,{children:a},d))})},Ht="1px solid var(--sa-border-subtle, #0b120e24)",tc="var(--sa-text-subtle, #8c8f97)",Ft="var(--sa-background-neutral, #f0f1f2)",uo="2px 0 4px -2px var(--sa-border-subtle, #0b120e24)",Pt=40,Vr=5,rc=28,qr=4,cr=16,Zr="var(--sa-background-brand-subtlest)",ar={display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},xo="sa-table-layout-styles",nc=()=>{if(typeof document>"u"||document.getElementById(xo))return;const t=document.createElement("style");t.id=xo,t.textContent=`@layer starasia.components {
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const An=require("@starasia/alert"),Sr=require("@starasia/avatar"),ot=require("@starasia/badges"),x=require("@starasia/box"),Pt=require("@starasia/breadcrumb"),P=require("@starasia/button"),on=require("@starasia/card"),Dt=require("@starasia/date"),Ae=require("@starasia/dialog"),kr=require("@starasia/drawer"),Vt=require("@starasia/dropdown"),ke=require("@starasia/hooks"),qt=require("@starasia/http"),gt=require("@starasia/input"),A=require("@starasia/menu"),sr=require("@starasia/pagination"),or=require("@starasia/storage"),Q=require("@starasia/table"),On=require("@starasia/tabs"),sn=require("@starasia/textarea"),Nt=require("@starasia/theme"),Wn=require("@starasia/toast"),Zt=require("@starasia/toggle"),Te=require("@starasia/tooltip"),mt=require("@starasia/checkbox"),ln=require("@starasia/radio"),S=require("@starasia/text"),B=require("@starasia/icon"),fe=require("@starasia/flex"),zn=require("@starasia/grid"),Hn=require("@starasia/progress"),_n=require("@starasia/stepper"),Pn=require("@starasia/accordion"),Nn=require("@starasia/story-record"),st=require("@starasia/skeleton"),Vn=require("@starasia/progress-stepper"),e=require("react/jsx-runtime"),u=require("react"),Ir=require("react-dom"),Hs=require("react-easy-crop"),_s={menus:[],menuBottom:void 0,logo:"",appName:"Workspace",userData:null,setUserData:()=>{}},pn=u.createContext(_s),yn=()=>u.useContext(pn),Bo=t=>{const[r,n]=u.useState((t==null?void 0:t.initialUserData)||null);return{userData:r,setUserData:n}},Eo=u.createContext({badges:{},setBadge:()=>{},setBadges:()=>{},clearBadge:()=>{}}),Fo=({children:t})=>{const[r,n]=u.useState({}),s=u.useCallback(c=>{n(a=>typeof c=="function"?c(a):c)},[]),o=u.useCallback((c,a)=>{n(d=>{const h=typeof a=="function"?a(d[c]):a;return{...d,[c]:h}})},[]),i=u.useCallback(c=>{n(a=>{if(!(c in a))return a;const d={...a};return delete d[c],d})},[]),l=u.useMemo(()=>({badges:r,setBadge:o,setBadges:s,clearBadge:i}),[r,o,s,i]);return e.jsx(Eo.Provider,{value:l,children:t})},Io=()=>u.useContext(Eo),nr=(t,r)=>{const n=r!==void 0?r:t;return n==null?null:typeof n=="string"||typeof n=="number"?{value:n}:n},bn=240,jn=200,vn=480,Ps="sa-sidebar-width",cn=(t,r,n)=>Math.min(Math.max(t,r),n),Ns=(t,r,n,s)=>{if(typeof window>"u")return r;try{const o=window.localStorage.getItem(t);if(!o)return r;const i=parseInt(o,10);return Number.isFinite(i)?cn(i,n,s):r}catch{return r}},qn=(t,r)=>{if(!(typeof window>"u"))try{window.localStorage.setItem(t,String(r))}catch{}},Mo=u.createContext({collapsed:!1,setCollapsed:()=>{},toggle:()=>{},collapse:()=>{},expand:()=>{},width:bn,setWidth:()=>{},resetWidth:()=>{},minWidth:jn,maxWidth:vn,mobileOpen:!1,setMobileOpen:()=>{},openMobile:()=>{},closeMobile:()=>{},toggleMobile:()=>{}}),To=({children:t,defaultCollapsed:r=!1,defaultWidth:n=bn,minWidth:s=jn,maxWidth:o=vn,widthStorageKey:i=Ps})=>{const[l,c]=u.useState(r),[a,d]=u.useState(!1),[h,g]=u.useState(()=>Ns(i,n,s,o)),m=u.useCallback(v=>{c(L=>typeof v=="function"?v(L):v)},[]),y=u.useCallback(()=>c(v=>!v),[]),D=u.useCallback(()=>c(!0),[]),j=u.useCallback(()=>c(!1),[]),R=u.useCallback(v=>{g(L=>{const N=typeof v=="function"?v(L):v,q=cn(Math.round(N),s,o);return qn(i,q),q})},[s,o,i]),I=u.useCallback(()=>{const v=cn(n,s,o);qn(i,v),g(v)},[n,s,o,i]),M=u.useCallback(v=>{d(L=>typeof v=="function"?v(L):v)},[]),C=u.useCallback(()=>d(!0),[]),k=u.useCallback(()=>d(!1),[]),T=u.useCallback(()=>d(v=>!v),[]),F=u.useMemo(()=>({collapsed:l,setCollapsed:m,toggle:y,collapse:D,expand:j,width:h,setWidth:R,resetWidth:I,minWidth:s,maxWidth:o,mobileOpen:a,setMobileOpen:M,openMobile:C,closeMobile:k,toggleMobile:T}),[l,m,y,D,j,h,R,I,s,o,a,M,C,k,T]);return e.jsx(Mo.Provider,{value:F,children:t})},Lo=()=>u.useContext(Mo),Ro=u.createContext(null),Ao=({adapter:t,children:r})=>e.jsx(Ro.Provider,{value:t,children:r}),xt=()=>{const t=u.useContext(Ro);if(!t)throw new Error("[@starasia/admin] Router adapter belum dipasang. Bungkus aplikasi dengan <App routerAdapter={...} /> atau <StarasiaRouterProvider adapter={...}>. Import adapter dari '@starasia/admin/adapters/react-router' atau '@starasia/admin/adapters/tanstack'.");return t},Oo=({router:t,routerAdapter:r,menus:n=[],menuBottom:s,logo:o,appName:i="Workspace",initialUserData:l,theme:c})=>{const a=Bo({initialUserData:l}),{theme:d}=Nt.useTheme();return e.jsx(Ao,{adapter:r,children:e.jsx(pn.Provider,{value:{logo:o,appName:i,menus:n,userData:a.userData,setUserData:a.setUserData,menuBottom:s},children:e.jsx(Fo,{children:e.jsx(To,{children:c?e.jsx(Nt.ThemeProvider,{value:c,children:t}):d?e.jsx(Nt.ThemeProvider,{value:d,children:t}):t})})})})},Vs=u.memo(Oo);function Wo({collapsed:t=!1,children:r}){if(!r)return null;const n=typeof r=="function",s=n?r({collapsed:t}):r;return s==null||s===!1?null:e.jsx("div",{style:{position:"sticky",top:"var(--app-header-height, 4rem)",zIndex:1,borderBottom:"1px solid var(--sa-border-subtle, #0b120e24)",paddingLeft:t?"calc((var(--app-header-height, 4rem) - 2rem) / 2)":"0.5rem",paddingRight:t?"calc((var(--app-header-height, 4rem) - 2rem) / 2)":"0.5rem",paddingTop:"0.5rem",paddingBottom:"0.5rem",boxSizing:"border-box"},children:n?s:e.jsx("div",{style:{opacity:t?0:1,transition:"opacity 0.3s",visibility:t?"hidden":"visible"},children:s})})}const Cn=u.createContext(null);function zo({children:t}){const[r,n]=u.useState(null),[s,o]=u.useState(null),[i,l]=u.useState(null),[c,a]=u.useState(0),d=u.useCallback(()=>(a(h=>h+1),()=>a(h=>h-1)),[]);return e.jsx(Cn.Provider,{value:{prependNode:r,appendNode:s,replaceNode:i,setPrependNode:n,setAppendNode:o,setReplaceNode:l,replaceCount:c,registerReplace:d},children:t})}function Ho({children:t}){const r=u.useContext(Cn);return r?e.jsxs(e.Fragment,{children:[e.jsx("div",{ref:r.setPrependNode,style:{display:"contents"}}),r.replaceCount>0?e.jsx("div",{ref:r.setReplaceNode,style:{display:"contents"}}):t,e.jsx("div",{ref:r.setAppendNode,style:{display:"contents"}})]}):e.jsx(e.Fragment,{children:t})}function qs({children:t,mode:r="append"}){const n=u.useContext(Cn);if(u.useEffect(()=>{if(!(r!=="replace"||!n))return n.registerReplace()},[r,n]),!n)return process.env.NODE_ENV!=="production"&&console.warn("[HeaderLeftSlot] used outside AppLayout — content not rendered"),null;const s=r==="prepend"?n.prependNode:r==="replace"?n.replaceNode:n.appendNode;return s?Ir.createPortal(t,s):null}const wn=u.createContext(null);function _o({children:t}){const[r,n]=u.useState({}),[s,o]=u.useState({}),i=u.useCallback((a,d)=>{n(h=>h[a]===d?h:{...h,[a]:d})},[]),l=u.useCallback(a=>(o(d=>({...d,[a]:(d[a]??0)+1})),()=>o(d=>({...d,[a]:Math.max(0,(d[a]??0)-1)}))),[]),c=u.useMemo(()=>({outletNodes:r,setOutletNode:i,slotCounts:s,registerSlot:l}),[r,i,s,l]);return e.jsx(wn.Provider,{value:c,children:t})}function an({slotKey:t,fallback:r}){const n=u.useContext(wn),s=n?(n.slotCounts[t]??0)>0:!1,o=u.useRef(n==null?void 0:n.setOutletNode);o.current=n==null?void 0:n.setOutletNode;const i=u.useCallback(l=>{var c;return(c=o.current)==null?void 0:c.call(o,t,l)},[t]);return e.jsx(e.Fragment,{children:s?e.jsx("div",{ref:i,style:{display:"contents"}}):r})}function Zs({slotKey:t,children:r}){const n=u.useContext(wn),s=u.useRef(n==null?void 0:n.registerSlot);if(s.current=n==null?void 0:n.registerSlot,u.useEffect(()=>{var i;return(i=s.current)==null?void 0:i.call(s,t)},[t]),!n)return process.env.NODE_ENV!=="production"&&console.warn("[SidebarGroupSlot] used outside AppLayout — content not rendered"),null;const o=n.outletNodes[t];return o?Ir.createPortal(r,o):null}const Br="moduleSwitcherGroupId",dn="sa-module-switcher-change";function Zn(){if(typeof window>"u")return null;const t=window.localStorage.getItem(Br);if(t===null)return null;const r=Number(t);return Number.isFinite(r)?r:null}function Po(t){typeof window>"u"||(t===null?window.localStorage.removeItem(Br):window.localStorage.setItem(Br,String(t)),window.dispatchEvent(new CustomEvent(dn,{detail:t})))}function Gs(){Po(null)}function Dn(){const[t,r]=u.useState(()=>Zn());return u.useEffect(()=>{const s=()=>{r(Zn())},o=i=>{i.key===Br&&s()};return window.addEventListener(dn,s),window.addEventListener("storage",o),()=>{window.removeEventListener(dn,s),window.removeEventListener("storage",o)}},[]),{selectedGroupId:t,setSelectedGroupId:s=>{Po(s),r(s)}}}const un="var(--sa-app-sidebar-bg, var(--sa-background-primary-inverse))",Qs="_row_1ctk8_37",Us="_rowIcon_1ctk8_62",Ys="_chevron_1ctk8_73",Xs="_label_1ctk8_82",$s="_popoverLabel_1ctk8_87",Js="_badgeDotRing_1ctk8_92",Ks="_indicator_1ctk8_99",ei="_submenu_1ctk8_125",ti="_submenuInner_1ctk8_146",ri="_submenuLine_1ctk8_159",ni="_childRow_1ctk8_168",oi="_groupHeader_1ctk8_188",si="_groupLabel_1ctk8_201",ii="_groupToggle_1ctk8_218",li="_groupChevron_1ctk8_241",ci="_groupBody_1ctk8_270",ai="_groupItems_1ctk8_284",di="_menuArea_1ctk8_306",ui="_locationPill_1ctk8_314",xi="_locationPillIcon_1ctk8_338",hi="_locationPillText_1ctk8_346",fi="_railButton_1ctk8_374",mi="_railIcon_1ctk8_384",gi="_railBadge_1ctk8_415",pi="_railLabel_1ctk8_420",yi="_railTabs_1ctk8_428",bi="_railTab_1ctk8_428",ji="_railTabLabel_1ctk8_463",he={row:Qs,rowIcon:Us,chevron:Ys,label:Xs,popoverLabel:$s,badgeDotRing:Js,indicator:Ks,submenu:ei,submenuInner:ti,submenuLine:ri,childRow:ni,groupHeader:oi,groupLabel:si,groupToggle:ii,groupChevron:li,groupBody:ci,groupItems:ai,menuArea:di,locationPill:ui,locationPillIcon:xi,locationPillText:hi,railButton:fi,railIcon:mi,railBadge:gi,railLabel:pi,railTabs:yi,railTab:bi,railTabLabel:ji},vi="4.5rem",Ci="var(--app-header-height, 4rem)",No=t=>t?vi:Ci;function Gn({icon:t,label:r,tooltip:n=r,selected:s,location:o=!1,badge:i,showLabel:l=!0,onClick:c}){const a=s===!0;return e.jsx(Te.Tooltip,{fluid:!0,label:n,position:"right",children:e.jsxs(x.Box,{as:"button",position:"relative",onClick:c,"aria-label":n,"aria-pressed":s,className:he.railButton,"data-active":a||void 0,"data-location":o||void 0,fullWidth:!0,direction:"column",align:"center",gap:"spacing-2",paddingBlock:"xs",children:[e.jsxs(x.Box,{position:"relative",display:"inline-flex",align:"center",justify:"center",width:"width-32",height:"height-32",borderRadius:a?"rounded-sm":"rounded-md",className:he.railIcon,children:[e.jsx(B.Icon,{name:t,size:"sm"}),i&&!l&&e.jsx(x.Box,{"aria-hidden":"true",position:"absolute",top:"top-n2",right:"right-n2",display:"inline-flex",borderRadius:"rounded-full",className:he.badgeDotRing,children:e.jsx(ot.BadgeDot,{tone:"error",variant:"solid",size:"xs"})}),i&&l&&e.jsx(x.Box,{position:"absolute",display:"inline-flex",className:he.railBadge,children:e.jsx(ot.Badge,{text:String(i.value),variant:i.variant??"info",size:"xs",border:!0})})]}),l&&e.jsx(S.Text,{as:"span",fontSize:"xs",fontWeight:a?"medium":"normal",textAlign:"center",truncate:!0,className:he.railLabel,children:r})]})})}function wi({items:t,bottomItems:r,activeKey:n,locationKey:s,onSelect:o,onAction:i,logo:l,panelCollapsed:c,onExpandPanel:a,showLabels:d=!0,theme:h}){const[g,m]=u.useState(!1),y=c&&g;return e.jsxs(x.Box,{as:"nav","aria-label":"Primary navigation","data-slot":"app-rail","data-theme":h,bg:"surface-inverse",borderWidth:"border-r",borderStyle:"border-solid-r",borderColor:"border-base",flexShrink:"0",style:{width:No(d),height:"100%",backgroundColor:un},children:[e.jsxs(x.Box,{onMouseEnter:()=>m(!0),onMouseLeave:()=>m(!1),position:"relative",align:"center",justify:"center",borderWidth:"border-b",borderStyle:"border-solid-b",borderColor:"border-base",flexShrink:"0",style:{height:"var(--app-header-height, 4rem)"},children:[e.jsx("img",{src:l,alt:"Logo",style:{width:"1.5rem",height:"1.5rem",transition:"opacity 0.2s",opacity:y?0:1}}),c&&e.jsx(x.Box,{as:"button",onClick:a,"aria-label":"Expand sidebar",position:"absolute",display:"inline-flex",align:"center",justify:"center",width:"width-32",height:"height-32",bg:"white",borderWidth:"border",borderStyle:"border-solid",borderColor:"border-base",borderRadius:"rounded-sm",style:{top:"50%",left:"50%",transform:"translate(-50%, -50%)",color:"var(--sa-text-primary, #292a2e)",opacity:y?1:0,pointerEvents:y?"auto":"none",transition:"opacity 0.2s"},children:e.jsx(B.Icon,{name:"LayoutLeft",size:"sm"})})]}),e.jsx(x.Box,{flex:"1",overflow:"overflow-y-auto",paddingBlock:"md",paddingInline:"xs",gap:"xs",children:t.map(D=>e.jsx(Gn,{icon:D.icon,label:D.label,tooltip:D.tooltip,badge:D.badge,showLabel:d,selected:D.key===n,location:D.key===s,onClick:()=>o(D.key)},D.key))}),r&&r.length>0&&e.jsx(x.Box,{borderWidth:"border-t",borderStyle:"border-solid-t",borderColor:"border-base",paddingBlock:"md",paddingInline:"xs",gap:"xs",flexShrink:"0",children:r.map(D=>e.jsx(Gn,{icon:D.icon,label:D.label,tooltip:D.tooltip,badge:D.badge,showLabel:d,onClick:()=>i(D)},D.key))})]})}function Di({items:t,activeKey:r,locationKey:n,onSelect:s}){return e.jsx(x.Box,{role:"tablist","aria-label":"Primary navigation",direction:"row",gap:"xs",paddingInline:"md",paddingBlock:"sm",borderWidth:"border-b",borderStyle:"border-solid-b",borderColor:"border-base",flexShrink:"0",className:he.railTabs,children:t.map(o=>{const i=o.key===r,l=o.key===n;return e.jsxs(x.Box,{as:"button",role:"tab","aria-selected":i,className:he.railTab,"data-active":i||void 0,"data-location":l||void 0,onClick:()=>s(o.key),position:"relative",direction:"row",align:"center",gap:"spacing-4",paddingInline:"sm",height:"height-32",flexShrink:"0",borderRadius:i?"rounded-sm":"rounded-md",hover:i?void 0:{bg:"neutral"},children:[e.jsx(B.Icon,{name:o.icon,size:"sm"}),e.jsx(S.Text,{as:"span",fontSize:"sm",fontWeight:i?"medium":"normal",className:he.railTabLabel,children:o.label})]},o.key)})})}const xn=(t,r)=>!t.groupIds||t.groupIds.includes(r.id)||r.parentGroupId!==void 0&&t.groupIds.includes(r.parentGroupId),Qn=(t,r)=>t.find(n=>n.groupIds&&xn(n,r))??t.find(n=>!n.groupIds);let gr=0,Mt=!1,Un=new Set;const Si=t=>{try{const r=JSON.parse(localStorage.getItem(t)??"[]");return new Set(Array.isArray(r)?r.filter(n=>typeof n=="number"):[])}catch{return new Set}},Yn={error:4,warning:3,info:2,success:1,neutral:0},ki=t=>t==="danger"||t==="error"?"error":t==="warning"?"warning":t==="success"?"success":t==="neutral"?"neutral":"info",Bi=(t,r)=>{try{localStorage.setItem(t,JSON.stringify([...r]))}catch{}},Xn=new Set;function Ei(t,r){const[n,s]=u.useState(!1),o=u.useRef(null),i=u.useRef(null);return u.useLayoutEffect(()=>{const l=o.current;if(!l)return;let c=0;const a=()=>{c=0;const h=i.current;if(!h)return;const g=h.scrollWidth>l.clientWidth;s(m=>m===g?m:g)},d=new ResizeObserver(()=>{c||(c=requestAnimationFrame(a))});return d.observe(l),a(),()=>{c&&cancelAnimationFrame(c),d.disconnect()}},[t,r]),{containerRef:o,textRef:i,truncated:n}}function $n({text:t,emphasis:r}){const{containerRef:n,textRef:s,truncated:o}=Ei(t,r),i=e.jsx(S.Text,{ref:s,as:"span",fontSize:"md",fontWeight:r==="location"?"semibold":r==="trail"?"medium":"normal",truncate:!0,className:he.label,children:t});return e.jsx(x.Box,{ref:n,display:"block",flex:"1",minWidth:"width-0",children:o?e.jsx(Te.Tooltip,{fluid:!0,label:t,position:"top",children:i}):i})}const Fi=200,hn="var(--app-header-height, 4rem)",Jn="44px",Kn=`calc((${hn} - 2rem) / 2)`,eo=16;function Ii({children:t,headerLeftSlot:r,profile:n,isLoadingProfile:s,onLogout:o,isLoggingOut:i,loadingComponent:l,sidebarHeaderContent:c,headerActions:a,profileRole:d,profileMenuButtons:h,profileMenuItems:g,logoutButton:m,resizableSidebar:y=!0,collapsibleGroups:D=!1,rail:j,sidebarTheme:R}){var Wt,yt,$t,zt;const{useSearchParams:I,useNavigate:M,useLocation:C,Outlet:k}=xt(),[T]=I(),F=T.get("embed")==="true",v=yn(),{badges:L}=Io(),N=M(),q=C(),O=!ke.useMediaQuery("md"),[J,K]=u.useState(!1),{collapsed:X,setCollapsed:$,width:ae,setWidth:Z,resetWidth:ne,minWidth:de,maxWidth:ve,mobileOpen:Be,setMobileOpen:Ce}=Lo(),[je,ge]=u.useState(!1),[Oe,$e]=u.useState(()=>new Set(Un)),[Le,le]=u.useState(null),{selectedGroupId:be,setSelectedGroupId:We}=Dn(),ue=!!(j&&j.items.length>0),se=X&&!O&&!ue,Pe=X&&!O&&ue;u.useEffect(()=>{Un=Oe},[Oe]);const Ne=u.useRef(null),z=u.useRef(null),Y=u.useRef(null),[G,xe]=u.useState(!1),[Ie,pe]=u.useState(null),ze=y&&!O&&!X,rt=b=>Math.min(Math.max(b,de),ve),Ve=Ie??ae,qe=b=>{var Me,_e,Ye;if(!ze)return;b.preventDefault();const H=b.clientX,_=((Me=Y.current)==null?void 0:Me.getBoundingClientRect().width)??ae;(Ye=(_e=b.currentTarget).setPointerCapture)==null||Ye.call(_e,b.pointerId),xe(!0),document.body.style.userSelect="none",document.body.style.cursor="col-resize";let U=0,ee=_;const we=nt=>{ee=_+(nt.clientX-H),U||(U=requestAnimationFrame(()=>{U=0,pe(rt(ee))}))},Fe=()=>{U&&cancelAnimationFrame(U),window.removeEventListener("pointermove",we),window.removeEventListener("pointerup",Fe),document.body.style.userSelect="",document.body.style.cursor="",pe(null),xe(!1),ee<Fi?$(!0):Z(rt(ee))};window.addEventListener("pointermove",we),window.addEventListener("pointerup",Fe)},Ct=b=>{ze&&(b.key==="ArrowLeft"?(b.preventDefault(),Z(H=>H-eo)):b.key==="ArrowRight"?(b.preventDefault(),Z(H=>H+eo)):b.key==="Home"?(b.preventDefault(),Z(de)):b.key==="End"&&(b.preventDefault(),Z(ve)))};u.useEffect(()=>{const b=Ne.current;if(!b)return;const H=()=>{Mt||(gr=b.scrollTop)};return b.addEventListener("scroll",H),()=>b.removeEventListener("scroll",H)},[]);const Qe=()=>{const b=Ne.current;b&&gr>0&&(Mt=!0,b.scrollTop=gr,requestAnimationFrame(()=>{Mt=!1}))};u.useLayoutEffect(()=>{Mt=!0,Qe();const b=setTimeout(()=>{Mt=!1},300);return()=>clearTimeout(b)},[]),u.useLayoutEffect(()=>{v.menus.length>0&&(gr>0?Qe():requestAnimationFrame(()=>{var H;const b=(H=Ne.current)==null?void 0:H.querySelector("[data-menu-active='true']");b&&b.scrollIntoView({block:"center",behavior:"instant"})}))},[v.menus]),u.useEffect(()=>{Mt=!0,Qe();const b=setTimeout(Qe,0),H=setTimeout(Qe,50),_=setTimeout(Qe,100),U=setTimeout(Qe,200),ee=setTimeout(()=>{Mt=!1},300),we=setTimeout(()=>{const Fe=Ne.current,Me=Fe==null?void 0:Fe.querySelector("[data-menu-active='true']");if(Fe&&Me){const _e=Fe.getBoundingClientRect(),Ye=Me.getBoundingClientRect();Ye.top>=_e.top&&Ye.bottom<=_e.bottom||Me.scrollIntoView({block:"center",behavior:"smooth"})}},250);return()=>{clearTimeout(b),clearTimeout(H),clearTimeout(_),clearTimeout(U),clearTimeout(ee),clearTimeout(we)}},[q.pathname]),u.useEffect(()=>{z.current&&(z.current.scrollTop=0)},[q.pathname]),u.useEffect(()=>{O&&Ce(!1)},[q.pathname,O]),u.useEffect(()=>{O&&$(!0)},[O]),u.useEffect(()=>{const b=document.documentElement;return b.style.setProperty("--app-header-height",Jn),()=>{b.style.removeProperty("--app-header-height")}},[]);const Ee=()=>{K(!0)},He=()=>{K(!1)},St=()=>{K(!1),o()},ht=b=>{const H=b.slotKey?[]:[b.to];return b.children&&H.push(...b.children.map(_=>_.to)),H},kt=[...v.menus.flatMap(b=>b.items.flatMap(ht)),...((Wt=v.menuBottom)==null?void 0:Wt.flatMap(ht))??[]],Ue=b=>{if(!q.pathname.startsWith(b))return!1;const H=kt.filter(_=>q.pathname.startsWith(_)).sort((_,U)=>U.length-_.length)[0];return b===H},pt=u.useRef(j);pt.current=j;const Ze=()=>v.menus.find(b=>b.items.some(H=>ht(H).some(Ue))),Qt=b=>{const H=pt.current;if(!H||H.items.length===0)return null;const _=H.defaultKey??H.items[0].key,U=H.items.find(Fe=>Fe.key===b),ee=Ze();if(!ee)return U?U.key:_;if(U&&xn(U,ee))return U.key;const we=Qn(H.items,ee);return(we==null?void 0:we.key)??(U==null?void 0:U.key)??_},[zr,Ut]=u.useState(()=>Qt(null));u.useEffect(()=>{Ut(b=>Qt(b))},[q.pathname,v.menus]);const Je=ue?j.items.find(b=>b.key===zr)??j.items[0]:void 0,dr=ue?Ze():void 0,Tt=dr?(yt=Qn(j.items,dr))==null?void 0:yt.key:void 0,ur=b=>{Ut(b),Pe&&$(!1)},Bt=b=>{b.onClick?b.onClick():b.to&&N(b.to)};u.useEffect(()=>{var H;const b=_=>{var ee;const U=_.defaultExpanded&&!Xn.has(_.id);U&&Xn.add(_.id),(U||(ee=_.children)!=null&&ee.some(we=>q.pathname.startsWith(we.to)))&&$e(we=>{const Fe=new Set(we);return Fe.add(_.id),Fe})};v.menus.forEach(_=>{_.items.forEach(b)}),(H=v.menuBottom)==null||H.forEach(b)},[q.pathname,v.menus,v.menuBottom]);const xr=b=>{$e(H=>{const _=new Set(H);return _.has(b)?_.delete(b):_.add(b),_})};u.useEffect(()=>{v.menus.length!==0&&be!==null&&!v.menus.some(b=>b.id===be)&&We(null)},[v.menus,be,We]);const wt=u.useMemo(()=>{if(Je!=null&&Je.groupIds)return v.menus.filter(ee=>xn(Je,ee));const b=v.menus,H=ue?null:be;if(H!==null)return b.filter(ee=>ee.id===H||ee.parentGroupId===H);const _=b.filter(ee=>ee.parentGroupId===void 0),U=b.filter(ee=>ee.parentGroupId!==void 0).flatMap(ee=>ee.items);return U.length===0?_:[..._,{id:18,name:"Pengaturan",items:U,parentGroupId:void 0}]},[v.menus,be,Je,ue]),Lt=D&&!se&&wt.length>1,Et=`sa-sidebar-open-groups:${v.appName??"app"}`,[Rt,hr]=u.useState(()=>Si(Et));u.useEffect(()=>{Bi(Et,Rt)},[Et,Rt]);const Ke=($t=wt.find(b=>b.items.some(H=>ht(H).some(Ue))))==null?void 0:$t.id;u.useEffect(()=>{!D||Ke===void 0||hr(b=>b.has(Ke)?b:new Set(b).add(Ke))},[D,Ke,q.pathname]);const Yt=b=>hr(H=>{const _=new Set(H);return _.has(b)?_.delete(b):_.add(b),_}),[At,Xt]=u.useState(null);u.useEffect(()=>{const b=Ne.current,H=b==null?void 0:b.querySelector("[data-location-anchor]");if(!b||!H||se||Pe){Xt(null);return}const _=new IntersectionObserver(([U])=>{var we;if(U.intersectionRatio>=.6){Xt(null);return}const ee=((we=U.rootBounds)==null?void 0:we.top)??b.getBoundingClientRect().top;Xt(U.boundingClientRect.top<ee?"up":"down")},{root:b,rootMargin:"-32px 0px 0px 0px",threshold:[0,.6,1]});return _.observe(H),()=>_.disconnect()},[q.pathname,Rt,Oe,wt,se,Pe]);const lt=()=>{var b,H;(H=(b=Ne.current)==null?void 0:b.querySelector("[data-location-anchor]"))==null||H.scrollIntoView({block:"center",behavior:"smooth"})},Ot=(()=>{var b;for(const H of wt)for(const _ of H.items)if((b=_.children)!=null&&b.length){const U=_.children.find(ee=>Ue(ee.to));if(U)return`${H.name} · ${U.title}`}else if(!_.slotKey&&Ue(_.to))return`${H.name} · ${_.title}`;return null})();if(F)return e.jsx(x.Box,{as:"main",overflow:"overflow-y-auto",bg:"surface-inverse",style:{height:"100vh"},children:t||e.jsx(k,{})});const Ft=(b,H=!1)=>{const _=b.children&&b.children.length>0,U=!!b.slotKey,ee=_||U,we=Oe.has(b.id),Fe=_?b.children.some(It=>Ue(It.to)):U?!1:Ue(b.to),Me=Fe&&_&&we&&!se,_e=Fe&&!Me,Ye=nr(b.badge,L[b.id]),nt=!!Ye&&se;return e.jsxs(x.Box,{display:"block","data-menu-active":Fe||void 0,children:[e.jsxs(x.Box,{as:"button",position:"relative",onClick:It=>{if(U&&se)N(b.to);else if(ee)if(se){const ft=It.currentTarget.getBoundingClientRect();le({item:b,top:ft.top,left:ft.right+8})}else xr(b.id);else N(b.to)},fullWidth:!0,direction:"row",align:"center",justify:se?"center":void 0,gap:"sm",paddingInline:se?void 0:"sm",paddingBlock:"xs",height:"height-32",borderRadius:_e?"rounded-sm":"rounded-md",borderWidth:"border",borderStyle:"border-solid",hover:_e?void 0:{bg:"neutral"},title:se?b.title:void 0,className:`${he.row} ${he.indicator}`,"data-active":Fe||void 0,"data-location":_e||void 0,"data-trail":Me||void 0,"data-compact":se||void 0,"aria-current":_e&&!_?"page":void 0,"aria-expanded":ee&&!se?we:void 0,"data-location-anchor":_e&&!H||void 0,children:[e.jsxs(x.Box,{position:"relative",display:"inline-flex",align:"center",flexShrink:"0",children:[e.jsx(B.Icon,{name:b.icon,size:"sm",className:he.rowIcon}),nt&&e.jsx(x.Box,{"aria-hidden":"true",position:"absolute",top:"top-n2",right:"right-n2",display:"inline-flex",borderRadius:"rounded-full",className:he.badgeDotRing,children:e.jsx(ot.BadgeDot,{tone:"error",variant:"solid",size:"xs"})})]}),!se&&e.jsxs(e.Fragment,{children:[e.jsx($n,{text:b.title,emphasis:_e?"location":Me?"trail":void 0}),Ye&&e.jsx(ot.Badge,{text:String(Ye.value),variant:Ye.variant??"info",size:"xs",border:!0}),ee&&e.jsx(B.Icon,{name:"ChevronDown",size:"sm",className:he.chevron})]})]}),ee&&!se&&(()=>{const ft=(b.children??[]).map(bt=>{const Jt=nr(bt.badge,L[bt.id]),jt=Ue(bt.to);return e.jsxs(x.Box,{as:"button",onClick:()=>N(bt.to),position:"relative",fullWidth:!0,direction:"row",align:"center",gap:"sm",paddingLeft:"sm",paddingRight:"sm",paddingBlock:"xs",height:"height-32",borderRadius:jt?"rounded-sm":"rounded-md",borderWidth:"border",borderStyle:"border-solid",hover:jt?void 0:{bg:"neutral"},className:`${he.row} ${he.childRow}`,"data-active":jt||void 0,"data-location":jt||void 0,"data-location-anchor":jt&&we&&!H||void 0,"aria-current":jt?"page":void 0,children:[e.jsx(B.Icon,{name:bt.icon,size:"sm",className:he.rowIcon}),e.jsx($n,{text:bt.title,emphasis:jt?"location":void 0}),Jt&&e.jsx(ot.Badge,{text:String(Jt.value),variant:Jt.variant??"info",size:"xs",border:!0})]},bt.id)});return e.jsx(x.Box,{className:he.submenu,"data-open":we||void 0,children:e.jsxs(x.Box,{position:"relative",overflow:"overflow-hidden",className:he.submenuInner,children:[e.jsx(x.Box,{"aria-hidden":"true",position:"absolute",left:"left-0",top:"top-0",fullHeight:!0,className:he.submenuLine}),U?e.jsx(an,{slotKey:b.slotKey,fallback:ft}):ft]})})})()]},b.id)};return e.jsx(_o,{children:e.jsxs(zo,{children:[e.jsxs(x.Box,{direction:"row",position:"relative",style:{height:"100vh","--app-header-height":Jn,"--app-sidebar-width":O?"0px":ue?`calc(${No(j.showLabels??!0)} + ${Pe?"0px":`${Ve}px`})`:X?hn:`${Ve}px`,"--app-footer-zindex":O&&Be?"40":"998"},children:[O&&e.jsx(x.Box,{position:"fixed",zIndex:"40",bg:"black-alpha-a50",style:{inset:0,opacity:Be?.5:0,pointerEvents:Be?"auto":"none",transition:"opacity 0.3s"},onClick:()=>Ce(!1)}),ue&&!O&&e.jsx(wi,{items:j.items,bottomItems:j.bottomItems,activeKey:Je.key,locationKey:Tt,onSelect:ur,onAction:Bt,logo:v.logo,panelCollapsed:Pe,onExpandPanel:()=>$(!1),showLabels:j.showLabels??!0,theme:R}),e.jsxs(x.Box,{as:"aside",ref:Y,"aria-hidden":Pe||void 0,"data-slot":"app-sidebar","data-theme":R,bg:"surface-inverse",borderWidth:"border-r",borderStyle:"border-solid-r",borderColor:"border-base",flexShrink:O?void 0:"0",style:{width:O?"16.375rem":Pe?"0px":X?hn:`${Ve}px`,...Pe&&{borderRightWidth:0,overflow:"hidden",visibility:"hidden"},position:O?"fixed":"relative",...O&&{inset:0,zIndex:50,transform:Be?"translateX(0)":"translateX(-100%)"},transition:G?"none":"all 0.3s ease-in-out",minWidth:0,backgroundColor:un},children:[e.jsx(x.Box,{onMouseEnter:()=>ge(!0),onMouseLeave:()=>ge(!1),direction:"row",align:"center",justify:"space-between",paddingInline:se?void 0:"lg",borderWidth:"border-b",borderStyle:"border-solid-b",borderColor:"border-base",position:"relative",style:{height:"var(--app-header-height, 4rem)",...se?{paddingInline:Kn}:null},children:(()=>{const b=ue&&!O,H=Je!=null&&Je.groupIds?Je.tooltip??Je.label:v.appName,_=!O&&X&&!Be&&!ue,U=_&&je;return e.jsxs(e.Fragment,{children:[e.jsxs(x.Box,{direction:"row",align:"center",gap:"sm",flex:_?"1":void 0,justify:_?"center":void 0,style:{transition:"opacity 0.2s",opacity:U?0:1,pointerEvents:U?"none":"auto"},children:[!b&&e.jsx("img",{src:v.logo,alt:"Logo",style:{width:"1.5rem",height:"1.5rem",flexShrink:0}}),(!X||Be)&&e.jsx(S.Text,{as:"span",fontSize:"md",fontWeight:"semibold",color:"primary",truncate:!0,style:{transition:"opacity 0.3s"},children:b?H:v.appName})]}),!O&&!X&&e.jsx(x.Box,{as:"button",onClick:()=>$(!0),"aria-label":"Collapse sidebar",display:"inline-flex",align:"center",justify:"center",flexShrink:"0",style:{color:"var(--sa-text-subtle, #8c8f97)"},children:e.jsx(B.Icon,{name:"LayoutLeft",size:"sm"})}),_&&e.jsx(x.Box,{as:"button",onClick:()=>$(!1),"aria-label":"Expand sidebar",position:"absolute",display:"inline-flex",align:"center",justify:"center",width:"width-32",height:"height-32",bg:"white",borderWidth:"border",borderStyle:"border-solid",borderColor:"border-base",borderRadius:"rounded-sm",style:{top:"50%",left:"50%",transform:"translate(-50%, -50%)",color:"var(--sa-text-primary, #292a2e)",opacity:U?1:0,pointerEvents:U?"auto":"none",transition:"opacity 0.2s"},children:e.jsx(B.Icon,{name:"LayoutLeft",size:"sm"})}),O&&e.jsx(x.Box,{as:"button",onClick:()=>Ce(!1),"aria-label":"Close menu",align:"center",justify:"center",borderRadius:"rounded-md",style:{padding:"0.375rem",color:"var(--sa-text-subtle, #8c8f97)"},children:e.jsx(B.Icon,{name:"Cross",size:"md"})})]})})()}),c&&e.jsx(Wo,{collapsed:O||ue?!1:X,children:c}),ue&&O&&e.jsx(Di,{items:j.items,activeKey:Je.key,locationKey:Tt,onSelect:ur}),e.jsxs(x.Box,{className:he.menuArea,children:[e.jsx(x.Box,{ref:Ne,flex:"1",overflow:"overflow-y-auto",paddingBlock:"lg",children:wt.map(b=>{const H=b.items.some(Me=>ht(Me).some(Ue)),_=Lt&&!Rt.has(b.id),U=_&&H;let ee=null;if(_)for(const Me of b.items)for(const _e of[Me,...Me.children??[]]){const Ye=nr(_e.badge,L[_e.id]);if(!Ye)continue;const nt=ki(Ye.variant);(!ee||Yn[nt]>Yn[ee])&&(ee=nt)}const we=`sa-sidebar-group-${b.id}`,Fe=e.jsx(S.Text,{fontSize:"sm",fontWeight:"semibold",color:"subtlest",textTransform:"uppercase",truncate:!0,className:he.groupLabel,"data-active":H||void 0,children:b.name});return e.jsxs(x.Box,{marginBottom:_?"xs":"lg",children:[se?b.name&&e.jsx(x.Box,{"aria-label":b.name,direction:"row",align:"center",justify:"center",paddingBlock:"md",children:e.jsx(x.Box,{width:"width-16",style:{height:"2px",borderRadius:"min(1px, var(--sa-radii-xs, 4px))",backgroundColor:b.color??"var(--sa-background-brand, #04254f)"}})}):b.name&&e.jsx(x.Box,{className:he.groupHeader,children:Lt?e.jsxs(x.Box,{as:"button",type:"button",fullWidth:!0,direction:"row",align:"center",gap:"sm",onClick:()=>Yt(b.id),className:he.groupToggle,"aria-expanded":!_,"aria-controls":we,"data-active":H||void 0,"data-location":U||void 0,"data-location-anchor":U||void 0,children:[Fe,ee&&e.jsx(ot.BadgeDot,{tone:ee,variant:"solid",size:"xs"}),e.jsx(B.Icon,{name:"ChevronDown",size:"sm",className:he.groupChevron})]}):Fe}),e.jsx(x.Box,{id:we,className:he.groupBody,"data-collapsible":Lt||void 0,"data-open":!_||void 0,children:e.jsx(x.Box,{paddingInline:se?void 0:"md",gap:"xs",className:he.groupItems,"data-compact":se||void 0,children:b.slotKey?e.jsx(an,{slotKey:b.slotKey,fallback:b.items.map(Me=>Ft(Me,_))}):b.items.map(Me=>Ft(Me,_))})})]},b.id)})}),At&&Ot&&e.jsxs(x.Box,{as:"button",type:"button",onClick:lt,direction:"row",align:"center",gap:"xs",className:he.locationPill,"data-dir":At,"aria-label":`Ke menu aktif: ${Ot}`,children:[e.jsx(B.Icon,{name:At==="up"?"ArrowUp":"ArrowDown",size:"xs",className:he.locationPillIcon}),e.jsx(S.Text,{as:"span",fontSize:"xs",fontWeight:"medium",truncate:!0,className:he.locationPillText,children:Ot})]})]}),v.menuBottom&&v.menuBottom.length>0&&e.jsx(x.Box,{borderWidth:"border-t",borderStyle:"border-solid-t",borderColor:"border-base",paddingBlock:"md",paddingInline:se?void 0:"md",bg:"surface-inverse",gap:"xs",flexShrink:"0",style:{backgroundColor:un,...se?{paddingInline:Kn}:null},children:v.menuBottom.map(b=>Ft(b))}),ze&&e.jsx(x.Box,{role:"separator","aria-orientation":"vertical","aria-label":"Resize sidebar","aria-valuenow":ae,"aria-valuemin":de,"aria-valuemax":ve,tabIndex:0,onPointerDown:qe,onKeyDown:Ct,onDoubleClick:ne,title:"Drag to resize · double-click to reset",position:"absolute",top:"top-0",right:"right-0",fullHeight:!0,style:{width:"6px",transform:"translateX(50%)",cursor:"col-resize",zIndex:5,touchAction:"none",background:G?"var(--sa-background-brand, #04254f)":"transparent",transition:"background 0.15s"},onMouseEnter:b=>{G||(b.currentTarget.style.background="var(--sa-border-bold, #0b120e40)")},onMouseLeave:b=>{G||(b.currentTarget.style.background="transparent")}})]}),e.jsxs(x.Box,{flex:"1",overflow:"overflow-hidden",children:[e.jsxs(x.Box,{as:"header",bg:"white",borderWidth:"border-b",borderStyle:"border-solid-b",borderColor:"border-base",direction:"row",align:"center",justify:"space-between",paddingInline:"lg",flexShrink:"0",style:{height:"var(--app-header-height, 4rem)"},children:[e.jsxs(x.Box,{direction:"row",align:"center",gap:O?"lg":void 0,children:[O&&e.jsx(x.Box,{as:"button",onClick:()=>Ce(!0),align:"center",justify:"center",borderRadius:"rounded-md",style:{padding:"0.375rem",color:"var(--sa-text-subtle, #8c8f97)"},children:e.jsx(B.Icon,{name:"MenuBurger",size:"lg"})}),e.jsx(Ho,{children:r})]}),e.jsxs(x.Box,{direction:"row",align:"center",gap:"md",children:[a,e.jsxs(A.Menu,{position:"bottom-right",children:[e.jsx(A.MenuButton,{children:e.jsxs(x.Box,{direction:"row",align:"center",gap:"sm",cursor:"pointer",children:[!O&&e.jsxs(x.Box,{display:"block",textAlign:"right",customMaxWidth:"12.5rem",children:[e.jsx(S.Text,{fontSize:"sm",fontWeight:"medium",color:"subtle",textAlign:"right",truncate:!0,lineHeight:"leading-none",children:s?"Loading...":(n==null?void 0:n.name)||"unknown"}),e.jsx(S.Text,{fontSize:"sm",color:"subtle",textAlign:"right",truncate:!0,children:s?"":(n==null?void 0:n.email)||"unknown"})]}),e.jsx(Sr.Avatar,{size:"sm",src:(n==null?void 0:n.avatar)||void 0,name:n==null?void 0:n.name,initials:((n==null?void 0:n.name)||"U")[0].toUpperCase(),bg:"var(--sa-background-brand, #04254f)",color:"var(--sa-background-primary, #ffffff)"}),e.jsx(B.Icon,{name:"ChevronDown",size:"xs",color:"subtle"})]})}),e.jsxs(A.MenuLists,{width:280,style:{paddingBlock:"12px",paddingInline:"12px",gap:"8px",marginTop:"16px"},children:[e.jsx(A.MenuHeading,{children:e.jsxs(x.Box,{align:"center",textAlign:"center",paddingBlock:"sm",fullWidth:!0,children:[e.jsx(Sr.Avatar,{customSize:64,src:(n==null?void 0:n.avatar)||void 0,name:n==null?void 0:n.name,initials:((n==null?void 0:n.name)||"U")[0].toUpperCase(),bg:"var(--sa-background-brand, #04254f)",color:"var(--sa-background-primary, #ffffff)",style:{fontSize:"1.25rem",marginBottom:"0.75rem",boxShadow:"var(--sa-shadow-sm, 0 1px 2px 0 #0000000d)"}}),e.jsx(S.Text,{fontSize:"md",fontWeight:"semibold",color:"primary",textAlign:"center",truncate:!0,style:{maxWidth:"100%"},children:(n==null?void 0:n.name)||"unknown"}),e.jsx(S.Text,{fontSize:"sm",color:"subtle",textAlign:"center",truncate:!0,style:{maxWidth:"100%"},children:(n==null?void 0:n.email)||"unknown"}),d&&e.jsx(S.Text,{fontSize:"sm",color:"subtle",textAlign:"center",truncate:!0,style:{maxWidth:"100%"},children:d})]})}),(h&&h.length>0||g)&&e.jsxs(A.MenuBody,{children:[h==null?void 0:h.map((b,H)=>e.jsx(A.MenuItem,{onClick:b.onClick,startIcon:e.jsx(B.Icon,{name:b.icon,size:"md"}),children:b.label},`${b.label}-${H}`)),g]}),m??e.jsx(A.MenuFooter,{children:e.jsx(A.MenuItem,{intent:"danger",onClick:Ee,startIcon:e.jsx(B.Icon,{name:"Logout",size:"md"}),children:"Logout"})})]})]})]})]}),e.jsx(x.Box,{as:"main",ref:z,flex:"1",overflow:"overflow-y-auto",children:t||e.jsx(k,{})})]})]}),i&&l&&e.jsx(x.Box,{position:"fixed",align:"center",justify:"center",bg:"black-alpha-a70",style:{inset:0,zIndex:9999},children:l}),e.jsxs(Ae.Dialog,{isShow:J,onHide:He,children:[e.jsx(Ae.DialogTitle,{children:"Confirmation Logout"}),e.jsx(Ae.DialogBody,{children:"Are you sure you want to end the session and exit the page?"}),e.jsx(Ae.DialogFooter,{children:e.jsx(x.Box,{direction:"column",display:"flex",align:"flex-end",justify:"center",children:e.jsxs(fe.Flex,{direction:"row",gap:"sm",align:"center",children:[e.jsx(x.Box,{direction:"column",children:e.jsx(P.Button,{secondary:!0,onClick:He,children:"Cancel"})}),e.jsx(x.Box,{direction:"column",children:e.jsx(P.Button,{primary:!0,onClick:St,children:"Yes, Sure"})})]})})})]}),Le&&e.jsxs(e.Fragment,{children:[e.jsx(x.Box,{onClick:()=>le(null),position:"fixed",style:{inset:0,zIndex:60}}),e.jsxs(x.Box,{role:"dialog","aria-label":Le.item.title,position:"fixed",bg:"white",borderWidth:"border",borderStyle:"border-solid",borderColor:"border-base",borderRadius:"rounded-md",shadow:"shadow-lg",padding:"sm",gap:"spacing-2",style:{top:Le.top,left:Le.left,zIndex:61,minWidth:"13rem",maxWidth:"16rem"},children:[e.jsx(S.Text,{fontSize:"sm",fontWeight:"semibold",color:"gray-500",textTransform:"uppercase",style:{padding:"0.25rem 0.5rem 0.5rem",letterSpacing:"0.05em"},children:Le.item.title}),(zt=Le.item.children)==null?void 0:zt.map(b=>{const H=Ue(b.to),_=nr(b.badge,L[b.id]);return e.jsxs(x.Box,{as:"button",onClick:()=>{N(b.to),le(null)},fullWidth:!0,direction:"row",align:"center",gap:"md",paddingBlock:"sm",paddingInline:"md",borderRadius:"rounded-md",borderWidth:"border",borderStyle:"border-solid",hover:H?void 0:{bg:"primary-inverse"},className:he.row,"data-active":H||void 0,"data-location":H||void 0,"aria-current":H?"page":void 0,children:[b.icon&&e.jsx(B.Icon,{name:b.icon,size:"sm",className:he.rowIcon}),e.jsx(S.Text,{as:"span",fontSize:"md",fontWeight:H?"semibold":"normal",whiteSpace:"nowrap",className:he.popoverLabel,children:b.title}),_&&e.jsx(ot.Badge,{text:String(_.value),variant:_.variant??"info",size:"xs",border:!0})]},b.id)})]})]})]})})}const lr=u.forwardRef(({children:t,...r},n)=>e.jsx(x.Box,{ref:n,role:"button",cursor:"pointer","aria-pressed":"true",display:"inline-block",tabIndex:0,...r,children:t})),to=({title:t,iconName:r,textColor:n,iconColor:s,hoverTextColor:o,hoverIconColor:i})=>{const[l,c]=u.useState(!1),a=s??"var(--sa-text-subtle, #8c8f97)",d=n??"var(--sa-text-subtle, #8c8f97)",h=i??"var(--sa-text-subtle, #8c8f97)",g=o??"var(--sa-text-primary, #292a2e)";return e.jsxs(x.Box,{direction:"row",gap:"xs",align:"center",onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),style:{cursor:"pointer"},children:[e.jsx(B.Icon,{name:r||"ChevronLeft",size:"xs",style:{color:l?h:a,transition:"color 0.15s ease"}}),e.jsx(S.Text,{variant:"sub-h3",style:{color:l?g:d,transition:"color 0.15s ease"},children:t||"Back"})]})},Mi=({items:t,separator:r="/",iconName:n,iconColor:s,hoverIconColor:o})=>{const{Link:i}=xt(),[l,c]=u.useState(!1),a=s??"var(--sa-text-subtle, #8c8f97)",d=o??"var(--sa-text-subtle, #8c8f97)",h=t.length>1?t[0]:void 0,g=!!(h!=null&&h.to||h!=null&&h.onClick),m=e.jsx(B.Icon,{name:n||"ChevronLeft",size:"xs",onMouseEnter:g?()=>c(!0):void 0,onMouseLeave:g?()=>c(!1):void 0,style:{color:g&&l?d:a,transition:"color 0.15s ease",cursor:g?"pointer":void 0}}),y=h!=null&&h.to?e.jsx(i,{to:h.to,replace:!0,style:{textDecoration:"none"},children:m}):h!=null&&h.onClick?e.jsx(lr,{onClick:h.onClick,children:m}):m;return e.jsxs(x.Box,{direction:"row",gap:"xs",align:"center",children:[y,e.jsx(Pt.Breadcrumb,{separator:r,size:"md",children:t.map((D,j)=>{const R=j===t.length-1;return D.to&&!R?e.jsx(Pt.BreadcrumbItem,{children:e.jsx(i,{to:D.to,children:D.label})},j):e.jsx(Pt.BreadcrumbItem,{currentPage:R,children:e.jsx(Pt.BreadcrumbLink,{onClick:R?void 0:D.onClick,children:D.label})},j)})})]})},Ti=t=>{const{Link:r}=xt(),{items:n,separator:s,onClick:o,navigateTo:i,...l}=t;return n&&n.length>0?e.jsx(Mi,{items:n,separator:s,iconName:l.iconName,iconColor:l.iconColor,hoverIconColor:l.hoverIconColor}):i?e.jsx(x.Box,{direction:"row",children:e.jsx(r,{to:i,replace:!0,style:{textDecoration:"none"},children:e.jsx(to,{...l})})}):e.jsx(x.Box,{direction:"row",children:e.jsx(lr,{onClick:o,children:e.jsx(to,{...l})})})},Zr=[{icon:"var(--sa-color-brand-400, #3366b7)",activeBg:"var(--sa-color-brand-50, #e6edf6)",activeBorder:"var(--sa-color-brand-300, #668cc9)",activeShadow:"rgba(51, 102, 183, 0.25)"},{icon:"var(--sa-color-warning-400, #ed9f30)",activeBg:"var(--sa-color-warning-50, #fef2e6)",activeBorder:"var(--sa-color-warning-300, #f1b259)",activeShadow:"rgba(237, 159, 48, 0.25)"},{icon:"var(--sa-color-secondary-300, #5468e1)",activeBg:"var(--sa-color-secondary-50, #e6e9fb)",activeBorder:"var(--sa-color-secondary-200, #8a98ea)",activeShadow:"rgba(84, 104, 225, 0.25)"},{icon:"var(--sa-color-info-500, #00abeb)",activeBg:"var(--sa-color-info-50, #effaff)",activeBorder:"var(--sa-color-info-300, #75dbff)",activeShadow:"rgba(0, 171, 235, 0.25)"},{icon:"var(--sa-color-success-500, #30ce84)",activeBg:"var(--sa-color-success-50, #ecfff6)",activeBorder:"var(--sa-color-success-300, #75dead)",activeShadow:"rgba(48, 206, 132, 0.25)"},{icon:"var(--sa-color-error-400, #ff758f)",activeBg:"var(--sa-color-error-50, #fff0f3)",activeBorder:"var(--sa-color-error-300, #ff8fa3)",activeShadow:"rgba(255, 117, 143, 0.25)"}];function ro(t,r,n){return{display:"flex",alignItems:"center",justifyContent:"center",width:"64px",height:"64px",borderRadius:"var(--sa-radii-sm, 6px)",border:t?`2px solid ${n.activeBorder}`:"2px solid var(--sa-color-gray-200, #f0f1f2)",backgroundColor:t?n.activeBg:"var(--sa-color-gray-50, #ffffff)",boxShadow:t?r?`0 8px 20px ${n.activeShadow.replace("0.25","0.35")}`:`0 2px 8px ${n.activeShadow}`:r?"0 8px 20px rgba(0, 0, 0, 0.14)":"0 1px 4px rgba(0, 0, 0, 0.08)",transform:r?"translateY(-3px) scale(1.05)":"translateY(0) scale(1)",transition:"box-shadow 0.2s ease, transform 0.2s ease, background-color 0.15s ease, border-color 0.15s ease"}}const no={fontSize:"11px",fontWeight:500,textAlign:"center",overflowWrap:"normal",wordBreak:"normal",color:"var(--sa-text-primary, #292a2e)",lineHeight:"1.3",maxWidth:"80px"},oo={display:"flex",flexDirection:"column",alignItems:"center",gap:"8px",background:"none",border:"none",cursor:"pointer",padding:0};function Vo({isShow:t,onHide:r,menus:n,selectedGroupId:s,onSelect:o}){const[i,l]=u.useState(void 0),c=d=>{o(d),r()},a=Zr[0];return e.jsx(Ae.Dialog,{isShow:t,onHide:r,style:{width:560,background:"transparent",boxShadow:"none",border:"none"},children:e.jsx(Ae.DialogBody,{children:e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(5, 1fr)",gap:"16px"},children:[e.jsxs("button",{onClick:()=>c(null),onMouseEnter:()=>l("all"),onMouseLeave:()=>l(void 0),style:oo,children:[e.jsx("div",{style:ro(s===null,i==="all",a),children:e.jsx("div",{style:{color:a.icon,display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(B.Icon,{name:"Grid",size:"lg",style:{width:32,height:32}})})}),e.jsx("span",{style:no,children:"Semua"})]}),n.map((d,h)=>{var j;const g=s===d.id,m=i===d.id,y=((j=d.items[0])==null?void 0:j.icon)??"Grid",D=Zr[(h+1)%Zr.length];return e.jsxs("button",{onClick:()=>c(d.id),onMouseEnter:()=>l(d.id),onMouseLeave:()=>l(void 0),style:oo,children:[e.jsx("div",{style:ro(g,m,D),children:e.jsx("div",{style:{color:D.icon,display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(B.Icon,{name:y,size:"lg",style:{width:32,height:32}})})}),e.jsx("span",{style:no,children:d.name})]},d.id)})]})})})}function Li({onSelect:t,"aria-label":r="Pilih module"}={}){const n=yn(),{useNavigate:s}=xt(),o=s(),{selectedGroupId:i,setSelectedGroupId:l}=Dn(),[c,a]=u.useState(!1),d=h=>{var g;if(l(h),h!==null){const m=n.menus.find(D=>D.id===h),y=(g=m==null?void 0:m.items[0])==null?void 0:g.to;y&&o(y)}t==null||t(h)};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{position:"relative"},children:[e.jsx("button",{onClick:()=>a(!0),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"2.25rem",height:"2.25rem",borderRadius:"var(--sa-radii-sm, 0.25rem)",border:"1px solid var(--sa-border-subtle, #0b120e24)",color:"var(--sa-text-subtle, #8c8f97)",backgroundColor:"transparent",cursor:"pointer"},"aria-label":r,onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--sa-background-primary-inverse, #f8f8f8)"},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent"},children:e.jsx(B.Icon,{name:"GridApplication",size:"sm"})}),i!==null&&e.jsx("span",{style:{position:"absolute",top:"0.25rem",right:"0.25rem",width:"0.5rem",height:"0.5rem",borderRadius:"9999px",backgroundColor:"var(--sa-color-brand-500, #1a4fa0)"},"aria-hidden":"true"})]}),e.jsx(Vo,{isShow:c,onHide:()=>a(!1),menus:n.menus.filter(h=>h.parentGroupId===void 0),selectedGroupId:i,onSelect:d})]})}const Ri=(t,r)=>{const n=[];if(r===0)return n.push(t),n;for(let s=0;s<t.length;s+=r){const o=t.slice(s,s+r);n.push(o)}return n},Ai=u.memo(({value:t,label:r,separator:n,labelWidth:s,lastIndex:o,labelAlign:i="top"})=>{const l=u.useMemo(()=>({padding:0,paddingBottom:o?0:12,verticalAlign:i}),[o,i]),c=u.useMemo(()=>({padding:0,paddingRight:12,paddingLeft:12,paddingBottom:o?0:12,verticalAlign:i}),[o,i]),a=()=>typeof r=="string"?e.jsx(S.Text,{fontWeight:"medium",color:"subtlest",children:r}):r,d=()=>typeof t=="string"||typeof t=="number"?e.jsx(S.Text,{color:"primary",fontWeight:"medium",children:t}):t,h=()=>typeof n=="string"||typeof n=="number"?e.jsx(S.Text,{fontWeight:"medium",color:"subtlest",children:n}):n;return e.jsxs(Q.Tr,{children:[e.jsx(Q.Td,{style:l,width:s,children:a()}),n?e.jsx(Q.Td,{style:c,width:24,children:h()}):null,e.jsx(Q.Td,{style:l,children:d()})]})}),Oi=u.memo(({fields:t,separator:r,labelWidth:n})=>e.jsx(Q.Table,{withColumnBorder:!1,withRowBorder:!1,children:t.map((s,o)=>e.jsx(Ai,{separator:r,labelWidth:n,lastIndex:o===t.length-1,...s},`field-group-field-${o}`))})),Wi=u.memo(({maxRow:t=0,maxColumn:r=2,separator:n=":",fields:s=[],labelWidth:o=150,bordered:i=!1})=>{const l=u.useMemo(()=>Ri(s,t),[s,t]),c=l.length>2,a=()=>{switch(r){case 1:return"width-full";case 2:return"width-1-2";case 3:return"width-1-3";case 4:return"width-1-4";default:return"width-1-2"}};return e.jsx(x.Box,{gap:c?void 0:"lg",direction:"row",flexWrap:"wrap",borderRadius:"rounded-sm",padding:"lg",paddingBottom:c?"xs":"lg",bg:"accent-dark-tertiary",borderWidth:i?"border":void 0,borderStyle:i?"border-solid":void 0,borderColor:i?"border-subtle":void 0,children:l.map((d,h)=>e.jsx(x.Box,{direction:"column",flex:c?void 0:"1",width:c?a():void 0,marginBottom:c?"lg":void 0,children:e.jsx(Oi,{labelWidth:o,fields:d,separator:n})},h))})}),zi=({backButton:t})=>{const[r,n]=u.useState(!1),s=(t==null?void 0:t.iconColor)??"var(--sa-text-subtle, #8c8f97)",o=(t==null?void 0:t.textColor)??"var(--sa-text-subtle, #8c8f97)",i=(t==null?void 0:t.hoverIconColor)??"var(--sa-text-subtle, #8c8f97)",l=(t==null?void 0:t.hoverTextColor)??"var(--sa-text-primary, #292a2e)";return e.jsxs(x.Box,{direction:"row",gap:"xs",align:"center",onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),style:{cursor:"pointer"},children:[e.jsx(B.Icon,{name:(t==null?void 0:t.iconName)||"ChevronLeft",size:"xs",style:{color:r?i:s,transition:"color 0.15s ease"}}),e.jsx(S.Text,{variant:"sub-h3",style:{color:r?l:o,textDecoration:r?"underline":"none",transition:"color 0.15s ease"},children:(t==null?void 0:t.title)||"Back"})]})},qo=({backButton:t,title:r,titleIcon:n,titleTag:s,children:o,header:i=!0,headerBorder:l=!1,disableAnimation:c=!1,scrollable:a=!1,stickyHeader:d=!1,subHeaders:h,action:g,titleTagProps:m,containerProps:y,headerProps:D})=>{const j=ke.useMediaQuery("md"),{Link:R,useNavigate:I}=xt(),M=I(),C=t==null?void 0:t.show,k=()=>{if(typeof(t==null?void 0:t.onClick)=="function"){t.onClick();return}M(-1,{replace:!0})},T=()=>{if(!g)return null;if(u.isValidElement(g))return g;const W=g.filter(O=>O&&(O.title||O.icon));return W.length===0?null:j?e.jsx(x.Box,{direction:"row",gap:"md",children:W.map(({title:O,icon:J,buttonProps:K,onClick:X},$)=>e.jsx(P.Button,{iconLeft:J?e.jsx(B.Icon,{name:J,size:"md"}):void 0,onClick:X,...K,children:O},`action-${$}`))}):e.jsxs(A.Menu,{position:"bottom-right",children:[e.jsx(A.MenuButton,{children:e.jsx(P.Button,{variant:"tertiary",size:"sm",iconLeft:e.jsx(B.Icon,{name:"MenuBurger"}),"aria-label":"Actions"})}),e.jsx(A.MenuLists,{children:e.jsx(A.MenuBody,{style:{minWidth:200},children:W.map(({title:O,icon:J,buttonProps:K,onClick:X},$)=>{const ae=(K==null?void 0:K.tone)==="error"||(K==null?void 0:K.danger)===!0;return e.jsx(A.MenuItem,{intent:ae?"danger":void 0,disabled:K==null?void 0:K.disabled,startIcon:J?e.jsx(B.Icon,{name:J}):void 0,onClick:X,children:O},`action-${$}`)})})})]})},F=()=>{const W=e.jsx(zi,{backButton:t});return t!=null&&t.navigateTo?e.jsx(x.Box,{direction:"row",children:e.jsx(R,{to:t.navigateTo,replace:!0,style:{textDecoration:"none"},children:W})}):e.jsx(x.Box,{direction:"row",children:e.jsx(lr,{onClick:k,children:W})})},v=()=>{const W=!!r,O=Array.isArray(g)&&g.length>0,J=u.isValidElement(g)?!0:O;if(!W&&!J&&!C)return null;const X=j||!j&&O;return e.jsxs(x.Box,{direction:"column",gap:"xs",paddingBlock:(D==null?void 0:D.paddingBlock)??"sm",paddingInline:(D==null?void 0:D.paddingInline)??"md",...D,style:{...l?{boxShadow:"inset 0 -1px 0 0 var(--sa-border-subtle, #0b120e24)"}:{},...D==null?void 0:D.style},children:[C&&F(),(W||J)&&e.jsxs(x.Box,{direction:X?"row":"column",gap:"sm",justify:"space-between",align:X?"center":"flex-start",children:[W?typeof r=="string"?e.jsxs(x.Box,{direction:"row",gap:"lg",align:"center",children:[e.jsxs(x.Box,{direction:"row",gap:"sm",align:"center",children:[n&&e.jsx(B.Icon,{name:n,size:"md",color:"primary"}),e.jsx(S.Text,{variant:"h3",fontWeight:"semibold",children:r})]}),s&&e.jsx(ot.Badge,{border:!0,size:"lg",text:s,...m})]}):r:null,T()]})]})},L=()=>{if(!h||h.length===0)return null;const W=h.filter(K=>K.show!==!1);if(W.length===0)return null;let O=0,J=-1/0;return W.forEach((K,X)=>{const $=K.order??0;$>=J&&(J=$,O=X)}),W.map(({content:K,order:X,borderBottom:$=!0,keepBottomPadding:ae=!1,paddingInline:Z=!0,paddingBlock:ne=!0},de)=>e.jsx(x.Box,{direction:"column",paddingTop:ne?"sm":"spacing-0",paddingBottom:ne&&($||ae||de===O)?"sm":"spacing-0",paddingInline:Z?"md":"spacing-0",style:{...$?{boxShadow:"inset 0 -1px 0 0 var(--sa-border-subtle, #0b120e24)"}:{},...X!==void 0?{order:X}:{}},children:K},`sub-header-${de}`))},N=()=>{const W=i?v():null,O=L();return!W&&!O?null:e.jsxs(x.Box,{direction:"column",style:{...a?{position:"sticky",left:0,...d?{top:0}:{},zIndex:2,background:"var(--sa-background-primary, #ffffff)"}:{},marginBottom:O?"var(--sa-spacing-0)":"var(--sa-spacing-md)"},children:[W,O]})},q=()=>o;return e.jsxs(x.Box,{direction:"column",as:"main",...y,style:{...a?{height:"100%",minHeight:0,overflow:"auto"}:{},...(y==null?void 0:y.style)??{},...c?{}:{animation:"pageLayoutEnter 320ms cubic-bezier(0.16, 1, 0.3, 1) backwards"}},children:[N(),q()]})},Hi=t=>{const{useLocation:r}=xt(),n=r();return e.jsx(qo,{...t},n.pathname)},_i=t=>t.remountOnRouteChange?e.jsx(Hi,{...t}):e.jsx(qo,{...t}),Pi=u.memo(_i),Ni={icon:"Cross",title:""},Vi=320,so=16,io=4,qi=8,Zo=u.forwardRef(({onHide:t,show:r,withBlur:n=!1,style:s,children:o,closeButton:i=Ni,paddingHorizontal:l=!0,width:c,minWidth:a,maxWidth:d,hideBackdrop:h=!1,title:g,headerAction:m,header:y=!0,widthPresets:D,resizable:j=!0,resizeMin:R=Vi,resizeMax:I,onWidthChange:M},C)=>{const T=!ke.useMediaQuery("md"),F=c??d??a??"357px",v=D??[],L=v.length>1,[N,q]=u.useState(()=>{const le=v.indexOf(F);return le>=0?le:0}),[W,O]=u.useState(null),[J,K]=u.useState(!1),[X,$]=u.useState(!1),ae=u.useRef(null),Z=le=>{ae.current=le,typeof C=="function"?C(le):C&&(C.current=le)},ne=L?v[N]:F,de=W!=null?`${W}px`:ne,ve=j&&!T,Be=N===v.length-1,Ce=()=>{const le=(N+1)%v.length;O(null),q(le),M==null||M(v[le])},je=u.useCallback(le=>{const be=I??window.innerWidth;return Math.min(Math.max(le,R),be)},[R,I]),ge=u.useRef(null),Oe=le=>{if(!ve)return;le.preventDefault();const be=le.currentTarget;be.setPointerCapture(le.pointerId),K(!0);const We=document.body.style.cursor,ue=document.body.style.userSelect;document.body.style.cursor="col-resize",document.body.style.userSelect="none";let se=null;const Pe=z=>{const Y=je(window.innerWidth-z.clientX);ge.current=Y,se==null&&(se=window.requestAnimationFrame(()=>{se=null,ge.current!=null&&O(ge.current)}))},Ne=z=>{se!=null&&window.cancelAnimationFrame(se),ge.current!=null&&O(ge.current),be.releasePointerCapture(z.pointerId),be.removeEventListener("pointermove",Pe),be.removeEventListener("pointerup",Ne),be.removeEventListener("pointercancel",Ne),document.body.style.cursor=We,document.body.style.userSelect=ue,K(!1),ge.current!=null&&(M==null||M(`${ge.current}px`))};be.addEventListener("pointermove",Pe),be.addEventListener("pointerup",Ne),be.addEventListener("pointercancel",Ne)},$e=le=>{var se;if(!ve||le.key!=="ArrowLeft"&&le.key!=="ArrowRight")return;le.preventDefault();const be=le.key==="ArrowLeft"?so:-so,We=W??((se=ae.current)==null?void 0:se.offsetWidth)??R,ue=je(We+be);O(ue),M==null||M(`${ue}px`)},Le=()=>{ve&&(O(null),M==null||M(ne))};return e.jsx(kr.Drawer,{blur:n,isShow:r,position:"right",onHide:t,ref:Z,size:de,style:s,flush:!0,radius:"none",hideBackdrop:h,children:e.jsxs(x.Box,{direction:"column",height:"height-full",children:[ve?e.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":"Ubah lebar panel",tabIndex:0,onPointerDown:Oe,onKeyDown:$e,onDoubleClick:Le,title:"Tarik untuk mengubah lebar — klik dua kali untuk reset",onPointerEnter:()=>$(!0),onPointerLeave:()=>$(!1),style:{position:"absolute",left:0,top:0,bottom:0,width:qi,cursor:"col-resize",zIndex:1,background:J||X?`linear-gradient(to right, var(--sa-border-brand, var(--sa-border-subtle)) 0 ${io}px, transparent ${io}px)`:"transparent",transition:"background 0.15s",touchAction:"none"}}):null,y?e.jsxs(x.Box,{direction:"row",align:"center",justify:"space-between",gap:"sm",paddingInline:"md",borderWidth:"border-b",borderStyle:"border-solid-b",borderColor:"border-base",customHeight:"var(--app-header-height, 44px)",flexShrink:"0",children:[e.jsx(x.Box,{direction:"row",align:"center",gap:"sm",overflow:"overflow-hidden",children:typeof g=="string"?e.jsx(S.Text,{fontSize:"md",fontWeight:"bold",children:g}):g}),e.jsxs(x.Box,{direction:"row",align:"center",gap:"sm",flexShrink:"0",children:[m,L?e.jsx(P.Button,{variant:"tertiary",tone:"neutral",size:"xs",onClick:Ce,"aria-label":Be?"Kecilkan panel":"Lebarkan panel",iconRight:e.jsx(B.Icon,{name:Be?"ChevronRight":"ChevronLeft"})}):null,i?e.jsx(P.Button,{variant:"tertiary",tone:"neutral",size:"xs",onClick:t,"aria-label":i.title||"Tutup",iconRight:e.jsx(B.Icon,{name:i.icon}),children:i.title||void 0}):null]})]}):null,e.jsx(x.Box,{direction:"column",paddingBlock:"md",paddingInline:l?"md":"spacing-0",overflow:"overflow-y-auto",style:{flex:1,minHeight:0},children:o})]})})}),Sn=u.memo(({children:t,borderBottom:r=!0,padding:n=!0})=>{const s=ke.useMediaQuery("lg");return e.jsx(x.Box,{direction:"column",padding:n?"md":"spacing-0",paddingLeft:n?"md":"spacing-0",paddingRight:n?"md":"spacing-0",style:r?{borderBottom:"1px solid var(--sa-border-subtle, #0b120e24)"}:void 0,children:t})}),kn=u.memo(({children:t,borderTop:r=!0,padding:n=!0})=>{const s=ke.useMediaQuery("lg");return e.jsx(x.Box,{direction:"column",padding:n?"md":"spacing-0",paddingLeft:n?"md":"spacing-0",paddingRight:n?"md":"spacing-0",style:r?{borderTop:"1px solid var(--sa-border-subtle, #0b120e24)"}:void 0,children:t})}),Zi=u.memo(({children:t,...r})=>e.jsx(x.Box,{direction:"column",padding:"md",paddingLeft:"md",paddingRight:"md",gap:"md",...r,children:t})),Gi=u.memo(({children:t,title:r,titleTag:n,action:s,header:o,footer:i,actionContainer:l,containerProps:c,bodyProps:a,headerProps:d={borderBottom:!0},footerProps:h={borderTop:!0},variantTag:g="info"})=>{const m=ke.useMediaQuery("lg"),y=()=>n?e.jsxs(x.Box,{direction:"row",gap:"sm",align:"center",children:[e.jsx(S.Text,{fontWeight:"medium",children:r}),e.jsx(ot.Badges,{border:!0,text:n,variant:g})]}):e.jsx(S.Text,{fontWeight:"medium",children:r}),D=()=>o||e.jsxs(x.Box,{direction:"row",justify:"space-between",align:"flex-start",gap:"md",children:[e.jsx(x.Box,{direction:"column",children:r?y():null}),e.jsx(x.Box,{direction:"column",style:m?{width:"100%",maxWidth:"19.313rem"}:{flex:1},...l,children:s??null})]}),j=!!(o||r||s);return e.jsxs(x.Box,{direction:"column",bg:"white",borderRadius:"rounded-xs",as:"section",borderWidth:"border",borderStyle:"border-solid",borderColor:"border-base",...c,style:{backgroundColor:"var(--sa-background-primary, #ffffff)",...(c==null?void 0:c.style)??{}},children:[o!==null&&j?e.jsx(Sn,{...d,children:D()}):null,e.jsx(Zi,{...a,children:t}),i?e.jsx(kn,{...h,children:i}):null]})}),Qi=t=>e.jsx(S.Text,{variant:"h1",children:t.children,...t.props}),Ui=t=>e.jsx(S.Text,{variant:"h2",children:t.children,...t.props}),Yi=t=>e.jsx(S.Text,{variant:"h3",children:t.children,...t.props}),Xi=t=>e.jsx(S.Text,{variant:"h4",children:t.children,...t.props}),$i=t=>e.jsx(S.Text,{variant:"h5",children:t.children,...t.props}),Ji=t=>e.jsx(S.Text,{variant:"h6",children:t.children,...t.props}),Ki=t=>e.jsx(S.Text,{variant:"sub-h1",children:t.children,...t.props}),el=t=>e.jsx(S.Text,{variant:"sub-h2",children:t.children,...t.props}),tl=t=>e.jsx(S.Text,{variant:"sub-h3",children:t.children,...t.props}),rl=t=>e.jsx(S.Text,{variant:"body-1",children:t.children,...t.props}),nl=t=>e.jsx(S.Text,{variant:"body-2",children:t.children,...t.props}),ol=t=>e.jsx(S.Text,{variant:"body-3",children:t.children,...t.props}),it={H1:Qi,H2:Ui,H3:Yi,H4:Xi,H5:$i,H6:Ji,SubH1:Ki,SubH2:el,SubH3:tl,Body1:rl,Body2:nl,Body3:ol},Xe=()=>{const{useSearchParams:t,useParams:r,useLocation:n}=xt(),[s,o]=t(),i=qt.searchParamsToObject(s.toString()),l=r(),c=n(),a=l.id;return{setSearchParams:o,searchParams:s,searchQueries:i,isHasQuery:(y,D)=>s.has(y)&&s.get(y)===D,getQueryParam:y=>s.get(y),getRouteParam:y=>l[y],params:l,location:c,id:a,hasId:!!a}},Go=t=>JSON.stringify(t),Qo=t=>JSON.stringify(t),Uo=t=>JSON.stringify(t),Yo=t=>JSON.stringify(t),sl=t=>t,il=t=>JSON.stringify(t),ut=t=>{if(typeof t!="string"||t==="")return{};try{const r=JSON.parse(t);return!r||typeof r!="object"||Array.isArray(r)?{}:r}catch{return{}}},dt=t=>{if(!(typeof t!="string"||t===""))try{return JSON.parse(t)}catch{return}},ir=({value:t,name:r,type:n,withSearchParam:s=!0,setSearchParams:o,searchQueries:i,dropdownSearchKey:l,filterKey:c="filter",pageKey:a="page"})=>{if(s){let d;switch(n){case"search":d=sl(t);break;case"dropdown":case"dropdown-multiple":d=Go(t);break;case"radio":d=Qo(t);break;case"date-range":d=Uo(t);break;case"advanced-date-range":d=il(t);break;case"date":d=Yo(t);break;default:d=t;break}if(typeof d<"u"){const h={...ut(i[c]),[r]:d},g={...i};l&&typeof l=="string"&&delete g[l],delete g[a];const m={...g,[c]:JSON.stringify(h)},y=new URLSearchParams(i).toString(),D=new URLSearchParams(m).toString();if(y===D)return;o(m)}}},Dr=({name:t,filterKey:r="filter",searchParams:n,get:s})=>{var c,a,d,h;const o=n.get(r)||void 0,i=o&&typeof o=="string"?ut(o):void 0,l=i?i[t]:void 0;return s==="label"&&l?(a=(c=dt(l))==null?void 0:c[0])==null?void 0:a.label:s==="value"&&l?(h=(d=dt(l))==null?void 0:d[0])==null?void 0:h.value:l},Xo=({name:t,filterKey:r="filter",searchParams:n,get:s})=>{var c,a;const o=n.get(r)||void 0,i=o&&typeof o=="string"?ut(o):void 0,l=i?i[t]:void 0;return s==="label"&&l?(c=dt(l))==null?void 0:c.map(d=>d.label):s==="value"&&l?(a=dt(l))==null?void 0:a.map(d=>d.value):s==="array"&&l?dt(l):l},ll=({name:t,filterKey:r="filter",searchParams:n,get:s})=>{var c,a,d;const o=n.get(r)||void 0,i=o&&typeof o=="string"?ut(o):void 0,l=i?i[t]:void 0;return s==="id"&&l?(c=dt(l))==null?void 0:c.id:s==="label"&&l?(a=dt(l))==null?void 0:a.label:s==="value"&&l?(d=dt(l))==null?void 0:d.value:l},Mr=(t,r,n)=>{const s=r.get(n||"filter")||void 0,o=s&&typeof s=="string"?ut(s):void 0;return o?o[t]:void 0},cl=({name:t,filterKey:r="filter",searchParams:n})=>{var l,c;const s=n.get(r||"filter")||void 0,o=s&&typeof s=="string"?ut(s):void 0,i=o?o[t]:void 0;return{start:i?(l=dt(i))==null?void 0:l.from:void 0,end:i?(c=dt(i))==null?void 0:c.to:void 0}},$o=({name:t,filterKey:r="filter",searchParams:n})=>{const s=n.get(r||"filter")||void 0,o=s&&typeof s=="string"?ut(s):void 0,i=o?o[t]:void 0;return i?dt(i):void 0},al=(t,{filterKey:r="filter",perPageKey:n="perPage",pageKey:s="page"})=>{const o=t.get(r)||void 0,i=t.get(n)||void 0,l=t.get(s)||void 0;return!!o||!!i||!!l},Jo=({isOpen:t,onClose:r,filterKey:n,pageKey:s,filters:o})=>{const{searchParams:i,setSearchParams:l,searchQueries:c}=Xe(),[a,d]=u.useState({}),h=()=>{i.delete(n||"filter"),l(i)},g=(m,y)=>{switch(m.type){case"radio":{const{show:D=!0}=m;return D&&e.jsx(x.Box,{direction:"column",children:e.jsx(x.Box,{direction:"column",children:m.title})},y)}case"dropdown":{const{show:D=!0}=m;return D&&e.jsx(x.Box,{direction:"column",children:e.jsx(x.Box,{direction:"column",children:m.title})},y)}case"date-range":return e.jsx(x.Box,{direction:"column",children:e.jsx(x.Box,{direction:"column",children:m.title})},y);case"date":return e.jsx(x.Box,{direction:"column",children:e.jsx(x.Box,{direction:"column",children:m.title})},y);case"dropdown-multiple":{const{show:D=!0}=m;return D&&e.jsx(x.Box,{direction:"column",children:e.jsx(x.Box,{direction:"column",children:m.title})},y)}default:return null}};return e.jsx(Zo,{onHide:r,show:t||!1,children:e.jsxs(x.Box,{direction:"column",gap:"md",children:[e.jsxs(fe.Flex,{direction:"row",justify:"space-between",align:"center",children:[e.jsx(x.Box,{direction:"column",children:"Filter"}),e.jsx(x.Box,{direction:"column",style:{cursor:"pointer"},onClick:h,children:"Reset"})]}),o==null?void 0:o.map((m,y)=>g(m,y))]})})},Ko=({searchKey:t="q",statusKey:r="status",searchPlaceholder:n="Search",searchHighlightPlaceholder:s,extendedFilter:o,showSearchFilter:i=!0,showStatusFilter:l=!0,filterKey:c="filter",pageKey:a="page",customWidthSearch:d,handleOnReset:h,filterConfigs:g,buttonToggleProps:m,position:y="right",titleSearchLabel:D="Work Order",withTitleLabels:j=!1})=>{const I=(m==null?void 0:m.isShowLabel)??!0,[M,C]=u.useState(!1),[k,T]=u.useState(0),F=()=>{T(Z=>Z+1)},{searchParams:v,setSearchParams:L,getQueryParam:N}=Xe(),q=qt.searchParamsToObject(v.toString()),W=Mr(t,v,c)||"",[O,J]=u.useState(W),K=N(c),$=!!(K&&!(()=>{if(K)try{const Z=JSON.parse(K);return Object.keys(Z).length===1&&Z[t]===""}catch(Z){console.error("Filter parameter is not a valid JSON:",Z)}return!1})()),ae=ke.useMediaQuery("md");return u.useEffect(()=>{J(W)},[W]),u.useEffect(()=>{if(O===W)return;const Z=window.setTimeout(()=>{ir({value:O,name:t,type:"search",searchQueries:q,setSearchParams:L,filterKey:c,pageKey:a})},350);return()=>{window.clearTimeout(Z)}},[O,W,t,q,L,c,a]),e.jsxs(fe.Flex,{gap:"md",style:{flexDirection:ae&&y==="left"?"row":ae&&y==="right"?"row-reverse":"column"},align:"flex-end",children:[$&&e.jsx(x.Box,{direction:"column",justify:"flex-end",children:e.jsx(P.Button,{onClick:()=>{const Z=new URLSearchParams(v);Z.delete(c),L(Z),J(""),F(),h&&h()},variant:"outline",tone:"neutral",children:e.jsx(S.Text,{color:"error",fontWeight:"semibold",children:"Reset"})})}),o==null?void 0:o.map(({minWidth:Z,content:ne,title:de,onClickContainer:ve},Be)=>e.jsxs(x.Box,{direction:"column",gap:"sm",onClick:ve,style:{minWidth:Z},children:[de&&e.jsx(it.SubH3,{children:de}),ne]},`extended-filter-${Be}-${k}`)),!!(g!=null&&g.length)&&e.jsx(P.Button,{primary:$,secondary:!$,iconLeft:e.jsx(B.Icon,{size:"sm",name:(m==null?void 0:m.icon)||"FilterHorizontal",style:{color:K?"var(--sa-background-brand, #04254f)":"var(--sa-text-primary, #292a2e)"}}),fullWidth:!ae,onClick:()=>C(!0),children:I?"Filter":void 0}),l&&e.jsxs(x.Box,{direction:"column",gap:"sm",style:{minWidth:"126px"},children:[j&&e.jsx(it.SubH3,{children:"Status"}),e.jsx(Vt.Dropdown,{dropdownLists:[{label:"Active",value:"active"},{label:"InActive",value:"inactive"}],defaultValue:Dr({get:"value",name:r,searchParams:v,filterKey:c})?[{label:Dr({get:"value",name:r,searchParams:v,filterKey:c})==="active"?"Active":"InActive",value:Dr({get:"value",name:r,searchParams:v,filterKey:c})}]:[],onChange:Z=>ir({value:Z,name:r,type:"dropdown",searchQueries:q,setSearchParams:L,filterKey:c}),placeholder:j?"All":"All Status"},k)]}),i&&e.jsxs(x.Box,{direction:"column",gap:"sm",style:{width:d&&ae?d:ae?"310px":""},children:[j&&e.jsxs(it.SubH3,{children:["Search for ",D]}),e.jsx(gt.Input,{placeholder:n,leftIcon:e.jsx(B.Icon,{name:"Search",width:20,height:20}),onChange:Z=>J(Z.target.value),value:O,fullWidth:!0},k+1+c)]}),e.jsx(Jo,{isOpen:M,onClose:()=>C(!1),filterKey:c,filters:g,pageKey:a})]})},dl=t=>t==="checkbox-multiple"?"dropdown-multiple":t==="radio"?"dropdown":t==="date-compact"?"date":t==="text"?"search":t;function Bn({configs:t,filterKey:r="filter",activeFilterKey:n="filters",pageKey:s="page",searchKey:o="q"}){const{searchParams:i,setSearchParams:l,searchQueries:c}=Xe(),a=u.useMemo(()=>Object.fromEntries(t.map(k=>[k.key,k])),[t]),d=u.useMemo(()=>{const k=(i.get(n)||"").split(",").map(F=>F.trim()).filter(Boolean),T=Object.keys(ut(i.get(r))).filter(F=>F!==o);return t.map(F=>F.key).filter(F=>{const v=a[F];return(v==null?void 0:v.locked)||k.includes(F)||T.includes(F)})},[i,n,r,o,t,a]),h=u.useCallback(k=>ut(k[r]),[r]),g=u.useCallback(k=>{const T={...c};k.length?T[n]=k.join(","):delete T[n],l(T)},[c,n,l]),m=u.useCallback(k=>{d.includes(k)||g([...d,k])},[d,g]),y=u.useCallback(k=>{var L;if((L=a[k])!=null&&L.locked)return;const T={...c},F=d.filter(N=>N!==k);F.length?T[n]=F.join(","):delete T[n];const v=h(T);k in v&&(delete v[k],Object.keys(v).length?T[r]=JSON.stringify(v):delete T[r]),delete T[s],l(T)},[c,d,n,r,s,h,l,a]),D=u.useCallback(k=>d.includes(k)?y(k):m(k),[d,m,y]),j=u.useCallback(k=>{switch(k.type){case"dropdown":case"dropdown-multiple":case"checkbox-multiple":case"radio":return Xo({name:k.key,get:"array",searchParams:i,filterKey:r})||[];case"date":{const T=$o({name:k.key,searchParams:i,filterKey:r});return T?new Date(T):void 0}case"date-compact":{const F=h(Object.fromEntries(i.entries()))[k.key];return F&&typeof F=="object"?F:void 0}case"text":{const F=h(Object.fromEntries(i.entries()))[k.key];return typeof F=="string"?F:void 0}default:return}},[i,r,h]),R=u.useCallback((k,T)=>{if(k.type==="date-compact"||k.type==="text"){const F={...c},v=h(F);T==null||T===""?delete v[k.key]:v[k.key]=T,Object.keys(v).length?F[r]=JSON.stringify(v):delete F[r],delete F[s],l(F);return}ir({value:T,name:k.key,type:dl(k.type),searchQueries:c,setSearchParams:l,filterKey:r,pageKey:s})},[c,l,r,s,h]),I=u.useCallback(k=>{const T={...c},F=h(T);k in F&&(delete F[k],Object.keys(F).length?T[r]=JSON.stringify(F):delete T[r]),delete T[s],l(T)},[c,r,s,h,l]),M=u.useCallback(()=>{const k={...c};delete k[r],delete k[n],delete k[s],l(k)},[c,r,n,s,l]),C=d.length>0;return{activeKeys:d,configByKey:a,hasActiveFilter:C,addFilter:m,removeFilter:y,toggleFilter:D,getValue:j,setValue:R,clearValue:I,clearAll:M}}const En={get(t){return or.storage.get(t)??null},set(t,r){or.storage.save(t,r)},remove(t){or.storage.delete(t)}},Gt={columns:t=>`filterbar:colprefs:${t}`,savedViews:t=>`filterbar:views:${t}`,lastState:t=>`filterbar:last:${t}`,perPage:t=>`filterbar:perpage:${t}`,tableSort:t=>`tablelayout:sort:${t}`},pr=(t,r)=>{const n=new Set(r.map(i=>i.key)),s=t.order.filter(i=>n.has(i));for(const i of r)s.includes(i.key)||s.push(i.key);const o=t.hidden.filter(i=>n.has(i));return{order:s,hidden:o}};function ul({columns:t,scopeId:r,storage:n,onColumnsChange:s,value:o}){const i=u.useMemo(()=>({order:t.map(v=>v.key),hidden:[]}),[t]),l=r?Gt.columns(r):void 0,c=(v,L)=>pr({order:v.order??L,hidden:v.hidden??[]},t),[a,d]=u.useState(()=>{if(o&&(o.order||o.hidden))return c(o,t.map(v=>v.key));if(l){const v=n.get(l);if(v&&Array.isArray(v.order))return pr(v,t)}return i}),h=t.map(v=>v.key).join("|");u.useEffect(()=>d(v=>pr(v,t)),[h]);const g=u.useRef(a);g.current=a;const m=o?`${(o.order??[]).join("|")}~${(o.hidden??[]).join("|")}`:null,y=u.useRef(m);u.useEffect(()=>{if(m==null||y.current===m)return;y.current=m;const v=g.current,L=c(o,v.order);L.order.join("|")===v.order.join("|")&&L.hidden.join("|")===v.hidden.join("|")||(d(L),l&&n.set(l,L))},[m,h]);const D=u.useRef(!1);u.useEffect(()=>{D.current||(D.current=!0,s==null||s(a))},[]);const j=u.useCallback(v=>{d(v),l&&n.set(l,v),s==null||s(v)},[l,n,s]),R=u.useMemo(()=>{const v=new Map(t.map(L=>[L.key,L]));return a.order.filter(L=>v.has(L)).map(L=>({...v.get(L),visible:!a.hidden.includes(L)}))},[a,t]),I=u.useCallback(v=>{const L=a.hidden.includes(v)?a.hidden.filter(N=>N!==v):[...a.hidden,v];j({...a,hidden:L})},[a,j]),M=u.useCallback((v,L)=>{if(v===L)return;const N=[...a.order],[q]=N.splice(v,1);N.splice(L,0,q),j({...a,order:N})},[a,j]),C=u.useCallback(v=>{j({...a,hidden:v?t.filter(L=>!L.locked).map(L=>L.key):[]})},[a,t,j]),k=u.useCallback(()=>j(i),[j,i]),T=u.useCallback(v=>j(pr(v,t)),[j,t]),F=a.hidden.length===0;return{state:a,orderedColumns:R,allVisible:F,toggleVisibility:I,reorder:M,setAllHidden:C,reset:k,applyState:T}}function xl({scopeId:t,storage:r,snapshotKeys:n,pageKey:s="page",getColumns:o,applyColumns:i}){const{searchParams:l,setSearchParams:c}=Xe(),a=t?Gt.savedViews(t):void 0,[d,h]=u.useState(()=>a?r.get(a)||[]:[]),g=u.useCallback(j=>{h(j),a&&r.set(a,j)},[a]),m=u.useCallback(j=>{const R=j.trim();if(!R)return;const I={};n.forEach(C=>{const k=l.get(C);k!=null&&(I[C]=k)});const M={id:`${Date.now()}`,name:R,query:I,columns:o==null?void 0:o(),createdAt:Date.now()};g([...d,M])},[n,l,o,g,d]),y=u.useCallback(j=>g(d.filter(R=>R.id!==j)),[g,d]),D=u.useCallback(j=>{const R=Object.fromEntries(l.entries());n.forEach(I=>delete R[I]),Object.assign(R,j.query),delete R[s],c(R),j.columns&&(i==null||i(j.columns))},[l,n,s,c,i]);return{enabled:!!a,views:d,saveView:m,deleteView:y,applyView:D}}function hl(t,r){const n=ut(t);return delete n[r],Object.keys(n).length>0?JSON.stringify(n):void 0}function lo(t,r,n){const s=t[r];if(s==null)return;const o=hl(s,n);o===void 0?delete t[r]:t[r]=o}function fl({scopeId:t,storage:r,snapshotKeys:n,enabled:s=!0,filterKey:o="filter",searchKey:i="q",persistSearch:l=!0}){const{searchParams:c}=Xe(),a=t&&s?Gt.lastState(t):void 0,d=u.useRef(a),h=u.useRef(!1);u.useEffect(()=>{if(!a){d.current=a;return}if(d.current!==a){d.current=a,h.current=!1;return}const y={};if(n.forEach(D=>{const j=c.get(D);j!=null&&(y[D]=j)}),l||lo(y,o,i),Object.keys(y).length===0){h.current&&r.remove(a);return}h.current=!0,r.set(a,y)},[c,a,n,r,l,o,i]);const g=u.useCallback(()=>{if(!a)return null;const y=r.get(a);if(!y||typeof y!="object"||Array.isArray(y)||Object.keys(y).length===0)return null;const D=y[o];return D!=null&&Object.keys(ut(D)).length===0&&delete y[o],l||lo(y,o,i),Object.keys(y).length>0?y:null},[a,r,l,o,i]),m=u.useCallback(()=>{a&&r.remove(a)},[a,r]);return{enabled:!!a,read:g,clear:m}}function ml({scopeId:t,storage:r,perPageKey:n,pageSizeOptions:s,enabled:o=!0}){const{searchParams:i}=Xe(),l=t&&o?Gt.perPage(t):void 0,c=i.toString(),a=u.useRef(l);u.useEffect(()=>{if(!l){a.current=l;return}if(a.current!==l){a.current=l;return}const g=i.get(n);if(!g)return;const m=Number(g);!Number.isFinite(m)||m<=0||r.set(l,m)},[c,l,n,r]);const d=u.useCallback(()=>{if(!l)return null;const g=r.get(l);if(g==null)return null;const m=Number(g);return!Number.isFinite(m)||m<=0||s&&!s.includes(m)?null:String(m)},[l,r,s]),h=u.useCallback(()=>{l&&r.remove(l)},[l,r]);return{enabled:!!l,read:d,clear:h}}let Gr={},Qr=!1,Ur=null;const gl=(t,r)=>{Object.assign(Gr,t),Ur=r,!Qr&&(Qr=!0,queueMicrotask(()=>{const n=Gr,s=Ur;Gr={},Qr=!1,Ur=null,!(!s||Object.keys(n).length===0)&&s(o=>{const i=new URLSearchParams(o);return Object.entries(n).forEach(([l,c])=>i.set(l,c)),i},{replace:!0})}))};function pl({enabled:t,snapshotKeys:r,perPageKey:n,readSnapshot:s,readPerPage:o}){const{searchParams:i,setSearchParams:l,location:c}=Xe(),a=u.useRef(null);u.useEffect(()=>{if(!t||a.current===c.pathname)return;a.current=c.pathname;const d={};if(!i.has(n)){const h=o();h&&(d[n]=h)}if(!r.some(h=>i.has(h))){const h=s();h&&Object.assign(d,h)}Object.keys(d).length!==0&&gl(d,l)},[c.pathname,t])}const yl=({configs:t,activeKeys:r,onToggle:n,hasActiveFilter:s,onReset:o})=>t.length?e.jsxs(A.Menu,{position:"bottom-left",children:[e.jsx(A.MenuButton,{children:e.jsx(P.Button,{variant:s?"secondary":"outline",tone:"neutral",size:"sm",iconLeft:e.jsx(B.Icon,{name:"FilterHorizontal"}),"aria-label":"Add filter"})}),e.jsx(A.MenuLists,{children:e.jsx(A.MenuBody,{style:{minWidth:260},title:e.jsxs(x.Box,{display:"flex",direction:"row",align:"center",justify:"space-between",fullWidth:!0,children:[e.jsx(S.Text,{fontSize:"sm",fontWeight:"medium",color:"subtlest",children:"Add Filter"}),s&&o&&e.jsx(P.Button,{variant:"link",tone:"brand",size:"xs",onClick:o,children:"Reset"})]}),children:t.map(i=>e.jsx(A.MenuItem,{selected:i.locked||r.includes(i.key),disabled:i.locked,closeOnSelect:!1,startIcon:i.icon??void 0,onClick:()=>{i.locked||n(i.key)},children:i.label},i.key))})})]}):null,cr=({onClear:t,onRemove:r})=>e.jsxs(A.Menu,{position:"bottom-right",children:[e.jsx(A.MenuButton,{children:e.jsx(P.Button,{variant:"link",tone:"neutral",size:"xs",iconLeft:e.jsx(B.Icon,{name:"MenuHorizontal"}),"aria-label":"Filter actions"})}),e.jsx(A.MenuLists,{children:e.jsxs(A.MenuBody,{style:{width:180},children:[e.jsx(A.MenuItem,{startIcon:e.jsx(B.Icon,{name:"CrossCircle"}),onClick:t,children:"Clear value"}),r&&e.jsx(A.MenuItem,{intent:"danger",startIcon:e.jsx(B.Icon,{name:"Trash1"}),onClick:r,children:"Remove filter"})]})})]}),bl=t=>{const r=new Date(t);return r.setHours(0,0,0,0),r},co=(t,r,n)=>{const s=new Date(t);return n==="day"?s.setDate(s.getDate()+r):n==="week"?s.setDate(s.getDate()+r*7):n==="month"?s.setMonth(s.getMonth()+r):s.setFullYear(s.getFullYear()+r),s},es=t=>{const r=bl(new Date);if(t.direction==="this"){const s=new Date(r),o=new Date(r);return t.period==="week"?(s.setDate(r.getDate()-r.getDay()),o.setDate(s.getDate()+6)):t.period==="month"?(s.setDate(1),o.setMonth(o.getMonth()+1,0)):t.period==="year"&&(s.setMonth(0,1),o.setMonth(11,31)),{from:s,to:o}}const n=t.count??1;return t.direction==="past"?{from:co(r,-n,t.period),to:r}:{from:r,to:co(r,n,t.period)}},ao=24,ts=t=>t.length>ao?`${t.slice(0,ao)}...`:t,rs=t=>t.toLocaleDateString(void 0,{day:"2-digit",month:"short",year:"numeric"}),Yr=(t,r="days")=>r==="months"?t.toLocaleDateString(void 0,{month:"short",year:"numeric"}):r==="years"?String(t.getFullYear()):rs(t),Er={is:"Is","is-before":"Is before","is-after":"Is after","is-on-or-before":"Is on or before","is-on-or-after":"Is on or after","is-between":"Is between","is-relative-to-today":"Is relative to today","is-empty":"Is empty","is-not-empty":"Is not empty"},ns=["is","is-before","is-after","is-on-or-before","is-on-or-after","is-between","is-relative-to-today","is-empty","is-not-empty"],fn={past:"Past",next:"Next",this:"This"},jl=["day","week","month","year"],vl=["past","next","this"],Cl=t=>t.field.type==="date-compact"?e.jsx(Sl,{field:t.field,value:t.value,onChange:t.onChange,onClear:t.onClear,onRemove:t.onRemove}):e.jsx(wl,{field:t.field,value:t.value,onChange:t.onChange,onClear:t.onClear,onRemove:t.onRemove}),wl=({field:t,value:r,onChange:n,onClear:s,onRemove:o})=>{const i=r?rs(new Date(r)):null,l=!!i,c=l?e.jsxs(e.Fragment,{children:[e.jsxs("span",{style:{fontWeight:500},children:[t.label,":"]})," ",e.jsx("span",{style:{fontWeight:400},children:ts(i)})]}):t.label;return e.jsxs(A.Menu,{position:"bottom-left",children:[e.jsx(A.MenuButton,{children:e.jsx(P.Button,{variant:l?"secondary":"outline",tone:"neutral",size:"sm",iconLeft:l?e.jsx(B.Icon,{name:"Calendar",size:"sm"}):void 0,iconRight:e.jsx(B.Icon,{name:"ChevronSmallDown"}),children:c})}),e.jsx(A.MenuLists,{children:e.jsx(A.MenuBody,{style:{width:260},title:e.jsxs(x.Box,{display:"flex",direction:"row",align:"center",justify:"space-between",fullWidth:!0,children:[e.jsx(S.Text,{fontSize:"sm",fontWeight:"medium",color:"subtlest",children:t.label}),e.jsx(cr,{onClear:s,onRemove:o})]}),children:e.jsx(Dt.StarasiaDate,{size:"sm",input:!1,clearable:!0,filter:t.mode,value:r,onChange:a=>a==null?s():n(a),withPadding:!1})})})]})},Dl=(t,r="days")=>{switch(t.op){case"is":case"is-before":case"is-after":case"is-on-or-before":case"is-on-or-after":return t.date?`${Er[t.op]} ${Yr(new Date(t.date),r)}`:null;case"is-between":return t.from&&t.to?`${Yr(new Date(t.from),r)} - ${Yr(new Date(t.to),r)}`:null;case"is-relative-to-today":{const n=t.relative;if(!n)return null;if(n.direction==="this")return`This ${n.period}`;const s=n.count??1,o=s===1?n.period:`${n.period}s`;return`${fn[n.direction]} ${s} ${o}`}case"is-empty":case"is-not-empty":return Er[t.op];default:return null}},Sl=({field:t,value:r,onChange:n,onClear:s,onRemove:o})=>{const i=t.ops&&t.ops.length>0?t.ops:ns,l=t.defaultOp&&i.includes(t.defaultOp)?t.defaultOp:i[0],c=t.mode??"days",a=(r==null?void 0:r.op)??l,d=r?Dl(r,c):null,h=!!d,g=h?e.jsxs(e.Fragment,{children:[e.jsxs("span",{style:{fontWeight:500},children:[t.label,":"]})," ",e.jsx("span",{style:{fontWeight:400},children:ts(d)})]}):t.label,m=y=>{if(y!==a){if(y==="is-empty"||y==="is-not-empty"){n({op:y});return}if(y==="is-relative-to-today"){n({op:y,relative:(r==null?void 0:r.relative)??{direction:"past",count:1,period:"week"}});return}if(y==="is-between"){n({op:y,from:r==null?void 0:r.from,to:r==null?void 0:r.to});return}n({op:y,date:r==null?void 0:r.date})}};return e.jsxs(A.Menu,{position:"bottom-left",children:[e.jsx(A.MenuButton,{children:e.jsx(P.Button,{variant:h?"secondary":"outline",tone:"neutral",size:"sm",iconLeft:h?e.jsx(B.Icon,{name:"Calendar",size:"sm"}):void 0,iconRight:e.jsx(B.Icon,{name:"ChevronSmallDown"}),children:g})}),e.jsxs(A.MenuLists,{children:[e.jsx(A.MenuBody,{style:{width:320},title:e.jsxs(x.Box,{display:"flex",direction:"row",align:"center",justify:"space-between",gap:"xs",fullWidth:!0,children:[e.jsxs(x.Box,{display:"flex",direction:"row",align:"center",gap:"xs",style:{minWidth:0},children:[e.jsx(S.Text,{fontSize:"sm",fontWeight:"medium",color:"subtlest",children:t.label}),e.jsx(os,{op:a,ops:i,onChange:m})]}),e.jsx(cr,{onClear:s,onRemove:o})]}),children:e.jsx(ss,{value:r,op:a,mode:c,onChange:n})}),a==="is-relative-to-today"&&e.jsx(A.MenuFooter,{children:e.jsx(S.Text,{fontSize:"xs",color:"subtlest",children:"Filter will update with the current date"})})]})]})},os=({op:t,ops:r,onChange:n})=>e.jsxs(A.Menu,{position:"bottom-left",children:[e.jsx(A.MenuButton,{children:e.jsx(P.Button,{variant:"link",tone:"neutral",size:"xs",iconRight:e.jsx(B.Icon,{name:"ChevronSmallDown"}),children:Er[t]})}),e.jsx(A.MenuLists,{children:e.jsx(A.MenuBody,{style:{width:200},children:r.map(s=>e.jsx(A.MenuItem,{selected:t===s,onClick:()=>n(s),endIcon:t===s?e.jsx(B.Icon,{name:"Check"}):void 0,children:Er[s]},s))})})]}),ss=({value:t,op:r,mode:n="days",onChange:s})=>{if(r==="is-empty"||r==="is-not-empty")return e.jsx(x.Box,{paddingBlock:"sm",paddingInline:"sm",children:e.jsx(S.Text,{fontSize:"xs",color:"subtlest",children:"No further input required."})});if(r==="is-between"){const o=t!=null&&t.from||t!=null&&t.to?{from:t!=null&&t.from?new Date(t.from):null,to:t!=null&&t.to?new Date(t.to):null}:void 0;return e.jsx(Dt.StarasiaDate,{size:"sm",input:!1,clearable:!0,rangedDate:!0,filter:n,value:o,onChange:i=>{if(i==null){s({op:r});return}if(typeof i=="object"&&i!==null&&"from"in i&&"to"in i){let{from:l,to:c}=i;if(!l&&c&&(l=c,c=null),!l&&!c){s({op:r});return}s({op:r,from:l?l.toISOString():void 0,to:c?c.toISOString():void 0})}},withPadding:!1},`range-${n}`)}return r==="is-relative-to-today"?e.jsx(kl,{value:t==null?void 0:t.relative,onChange:o=>s({op:r,relative:o})}):e.jsx(Dt.StarasiaDate,{size:"sm",input:!1,clearable:!0,filter:n,value:t!=null&&t.date?new Date(t.date):void 0,onChange:o=>{if(o==null){s({op:r});return}o instanceof Date&&s({op:r,date:o.toISOString()})},withPadding:!1},`single-${n}`)},kl=({value:t,onChange:r})=>{const n=(t==null?void 0:t.direction)??"past",s=(t==null?void 0:t.count)??1,o=(t==null?void 0:t.period)??"week",i=n!=="this",l=es({direction:n,count:s,period:o});return e.jsxs(x.Box,{direction:"column",display:"flex",gap:"sm",children:[e.jsxs(x.Box,{direction:"row",display:"flex",align:"center",gap:"xs",children:[e.jsxs(A.Menu,{position:"bottom-left",children:[e.jsx(A.MenuButton,{children:e.jsx(P.Button,{variant:"outline",tone:"neutral",size:"sm",iconRight:e.jsx(B.Icon,{name:"ChevronSmallDown"}),children:fn[n]})}),e.jsx(A.MenuLists,{children:e.jsx(A.MenuBody,{style:{width:140},children:vl.map(c=>e.jsx(A.MenuItem,{selected:n===c,endIcon:n===c?e.jsx(B.Icon,{name:"Check"}):void 0,onClick:()=>r(c==="this"?{direction:c,period:o}:{direction:c,count:s,period:o}),children:fn[c]},c))})})]}),i&&e.jsx(gt.Input,{type:"number",size:"sm",min:1,clearable:!1,value:s,onChange:c=>{const a=Number(c.target.value);r({direction:n,count:Number.isFinite(a)&&a>0?a:1,period:o})},style:{width:72}}),e.jsxs(A.Menu,{position:"bottom-left",children:[e.jsx(A.MenuButton,{children:e.jsx(P.Button,{variant:"outline",tone:"neutral",size:"sm",iconRight:e.jsx(B.Icon,{name:"ChevronSmallDown"}),children:o})}),e.jsx(A.MenuLists,{children:e.jsx(A.MenuBody,{style:{width:140},children:jl.map(c=>e.jsx(A.MenuItem,{selected:o===c,endIcon:o===c?e.jsx(B.Icon,{name:"Check"}):void 0,onClick:()=>r(n==="this"?{direction:n,period:c}:{direction:n,count:s,period:c}),children:c},c))})})]})]}),e.jsx(Dt.StarasiaDate,{size:"sm",input:!1,disabled:!0,rangedDate:!0,value:l,onChange:()=>{},withPadding:!1},"relative-preview")]})},uo=18,Bl=t=>t.length>uo?`${t.slice(0,uo)}...`:t,El=({field:t,value:r,onChange:n,onClear:s,onRemove:o})=>{const i=t.type==="dropdown-multiple",l=r.length,c=t.searchable!==!1,[a,d]=u.useState(""),h=t.options,g=typeof t.onSearch=="function",m=(()=>{if(g)return h;const I=a.trim().toLowerCase();return I?h.filter(M=>M.label.toLowerCase().includes(I)):h})(),y=I=>r.some(M=>M.value===I.value),D=I=>{if(!i){n([{label:I.label,value:I.value}]),d("");return}n(y(I)?r.filter(M=>M.value!==I.value):[...r,{label:I.label,value:I.value}])},j=I=>{var M;d(I),(M=t.onSearch)==null||M.call(t,I)},R=l===0?t.label:e.jsxs(e.Fragment,{children:[e.jsxs("span",{style:{fontWeight:500},children:[t.label,":"]})," ",e.jsx("span",{style:{fontWeight:400},children:l===1?Bl(r[0].label):`${l} Selected`})]});return e.jsxs(A.Menu,{position:"bottom-left",children:[e.jsx(A.MenuButton,{children:e.jsx(P.Button,{variant:l>0?"secondary":"outline",tone:"neutral",size:"sm",iconLeft:l>0?e.jsx(B.Icon,{name:"Tag",size:"sm"}):void 0,iconRight:e.jsx(B.Icon,{name:"ChevronSmallDown"}),children:R})}),e.jsx(A.MenuLists,{children:e.jsx(A.MenuBody,{style:{width:260},title:e.jsxs(x.Box,{display:"flex",direction:"row",align:"center",justify:"space-between",fullWidth:!0,children:[e.jsx(S.Text,{fontSize:"sm",fontWeight:"medium",color:"subtlest",children:t.label}),e.jsx(cr,{onClear:s,onRemove:o})]}),children:e.jsxs(x.Box,{direction:"column",gap:"sm",children:[c&&e.jsx(Vt.Dropdown,{size:"sm",triggerInput:!0,fullWidth:!0,hideChevronIcon:!0,clearable:!0,multiSelect:i,searchAble:!0,searchValue:a,onSearch:j,value:r,onChange:n,placeholder:`Search ${t.label.toLowerCase()}…`}),e.jsx(x.Box,{direction:"column",overflow:"overflow-y-auto",customMaxHeight:"240px",children:t.isLoading?e.jsx(x.Box,{paddingBlock:"sm",paddingInline:"sm",children:e.jsx(S.Text,{fontSize:"xs",color:"subtlest",children:"Loading…"})}):m.length===0?e.jsx(x.Box,{paddingBlock:"sm",paddingInline:"sm",children:e.jsx(S.Text,{fontSize:"xs",color:"subtlest",children:"No results"})}):m.map(I=>e.jsx(A.MenuItem,{closeOnSelect:!i,selected:y(I),startIcon:I.avatar,endIcon:y(I)?e.jsx(B.Icon,{name:"Check"}):void 0,description:I.description,onClick:()=>D(I),children:I.label},I.value))})]})})})]})},xo=18,Fl=t=>t.length>xo?`${t.slice(0,xo)}...`:t,ho=({checked:t,indeterminate:r})=>e.jsx("span",{style:{pointerEvents:"none",display:"inline-flex"},children:e.jsx(mt.Checkbox,{size:"sm",checked:t,readOnly:!0,onChange:()=>{},variant:r?"indeterminate":"select"})}),Il=({field:t,value:r,onChange:n,onClear:s,onRemove:o})=>{const i=new Set(r.map(m=>m.value)),l=r.length,c=t.options.length>0&&t.options.every(m=>i.has(m.value)),a=l>0&&!c,d=m=>{n(i.has(m.value)?r.filter(y=>y.value!==m.value):[...r,{label:m.label,value:m.value}])},h=()=>{n(c?[]:t.options.map(m=>({label:m.label,value:m.value})))},g=l===0?t.label:e.jsxs(e.Fragment,{children:[e.jsxs(S.Text,{as:"span",fontWeight:"semibold",children:[t.label,":"]})," ",e.jsx(S.Text,{as:"span",children:l===1?Fl(r[0].label):`${l} Selected`})]});return e.jsxs(A.Menu,{position:"bottom-left",children:[e.jsx(A.MenuButton,{children:e.jsx(P.Button,{variant:l>0?"secondary":"outline",tone:"neutral",size:"sm",iconLeft:l>0?e.jsx(B.Icon,{name:"Tag",size:"sm"}):void 0,iconRight:e.jsx(B.Icon,{name:"ChevronSmallDown"}),children:g})}),e.jsx(A.MenuLists,{children:e.jsxs(A.MenuBody,{style:{width:240},title:e.jsxs(x.Box,{display:"flex",direction:"row",align:"center",justify:"space-between",fullWidth:!0,children:[e.jsx(S.Text,{fontSize:"sm",fontWeight:"medium",color:"subtlest",children:t.label}),e.jsx(cr,{onClear:s,onRemove:o})]}),children:[e.jsx(A.MenuItem,{closeOnSelect:!1,selected:c,onClick:h,startIcon:e.jsx(ho,{checked:c||a,indeterminate:a}),children:"Select All"}),t.options.map(m=>e.jsx(A.MenuItem,{closeOnSelect:!1,selected:i.has(m.value),onClick:()=>d(m),startIcon:e.jsx(ho,{checked:i.has(m.value)}),children:m.label},m.value))]})})]})},fo=18,Ml=t=>t.length>fo?`${t.slice(0,fo)}...`:t,Tl=({field:t,value:r,onChange:n,onClear:s,onRemove:o})=>{const[i,l]=u.useState(r??""),c=ke.useDebounce(i,t.debounceMs??300);u.useEffect(()=>{c!==(r??"")&&n(c)},[c]),u.useEffect(()=>{l(r??"")},[r]);const a=!!r,d=a?e.jsxs(e.Fragment,{children:[e.jsxs("span",{style:{fontWeight:500},children:[t.label,":"]})," ",e.jsx("span",{style:{fontWeight:400},children:Ml(r)})]}):t.label;return e.jsxs(A.Menu,{position:"bottom-left",children:[e.jsx(A.MenuButton,{children:e.jsx(P.Button,{variant:a?"secondary":"outline",tone:"neutral",size:"sm",iconLeft:a?e.jsx(B.Icon,{name:"Search",size:"sm"}):void 0,iconRight:e.jsx(B.Icon,{name:"ChevronSmallDown"}),children:d})}),e.jsx(A.MenuLists,{children:e.jsx(A.MenuBody,{style:{width:260},title:e.jsxs(x.Box,{display:"flex",direction:"row",align:"center",justify:"space-between",fullWidth:!0,children:[e.jsx(S.Text,{fontSize:"sm",fontWeight:"medium",color:"subtlest",children:t.label}),e.jsx(cr,{onClear:s,onRemove:o})]}),children:e.jsx(gt.Input,{size:"sm",fullWidth:!0,value:i,placeholder:t.placeholder??"Cari…",leftIcon:e.jsx(B.Icon,{name:"Search",width:16,height:16}),onChange:h=>l(h.target.value)})})})]})},is=({activeKeys:t,configByKey:r,getValue:n,setValue:s,clearValue:o,removeFilter:i})=>e.jsx(e.Fragment,{children:t.map(l=>{const c=r[l];if(!c)return null;const a=n(c),d=c.locked?void 0:()=>i(l);return c.type==="date"||c.type==="date-compact"?e.jsx(Cl,{field:c,value:a,onChange:h=>s(c,h),onClear:()=>o(l),onRemove:d},l):c.type==="text"?e.jsx(Tl,{field:c,value:a||"",onChange:h=>s(c,h),onClear:()=>o(l),onRemove:d},l):c.type==="checkbox-multiple"?e.jsx(Il,{field:c,value:a||[],onChange:h=>s(c,h),onClear:()=>o(l),onRemove:d},l):e.jsx(El,{field:c,value:a||[],onChange:h=>s(c,h),onClear:()=>o(l),onRemove:d},l)})}),mo=t=>`${t} Rows`,Ll=({pagination:t,pageKey:r="page",perPageKey:n="perPage",pageSizeOptions:s=[10,25,50,100],defaultPerPage:o=10,showResultCount:i=!0,showPageSize:l=!0,showPagination:c=!0})=>{var I;const{searchQueries:a,setSearchParams:d,searchParams:h}=Xe(),g=h.get(n),m=g?Number(g):o,y=M=>{d({...a,[r]:String(M)})},D=M=>{d({...a,[n]:M,[r]:"1"})},j=(t==null?void 0:t.rangeStart)??(((t==null?void 0:t.currentPage)||0)>1?(((t==null?void 0:t.currentPage)||0)-1)*((t==null?void 0:t.perPage)||0)+1:1),R=(t==null?void 0:t.rangeEnd)??((t==null?void 0:t.totalCurrentPage)!==(t==null?void 0:t.perPage)?t==null?void 0:t.totalData:((t==null?void 0:t.currentPage)||1)*((t==null?void 0:t.totalCurrentPage)||0));return e.jsxs(e.Fragment,{children:[i&&e.jsx(S.Text,{fontSize:"sm",fontWeight:"medium",color:"primary",truncate:!0,children:`${j}-${R} of ${((I=t==null?void 0:t.totalData)==null?void 0:I.toLocaleString())||0}`}),l&&e.jsxs(A.Menu,{position:"bottom-left",children:[e.jsx(A.MenuButton,{children:e.jsx(P.Button,{variant:"outline",tone:"neutral",size:"sm",iconRight:e.jsx(B.Icon,{name:"ChevronSmallDown"}),"aria-label":"Rows per page",children:mo(m)})}),e.jsx(A.MenuLists,{children:e.jsx(A.MenuBody,{children:s.map(M=>e.jsx(A.MenuItem,{selected:M===m,onClick:()=>D(String(M)),children:mo(M)},M))})})]}),c&&((t==null?void 0:t.totalPage)??0)>1&&e.jsx(x.Box,{direction:"column",display:"flex",align:"center",gap:"sm",paddingRight:"sm",style:{borderRight:"1px solid var(--sa-border-subtle, rgba(11, 18, 14, 0.14))"},children:e.jsx(sr.Pagination,{size:"sm",variant:"neutral",siblingCount:0,currentPage:t!=null&&t.currentPage?Number(t.currentPage):1,totalPages:Number(t==null?void 0:t.totalPage),onPageChange:y})})]})};function Rl(t,r,n=!0){u.useEffect(()=>{if(!n)return;const s=o=>{var c;if(o.metaKey||o.ctrlKey||o.altKey||o.key!==t||Ae.isOverlayOpen())return;const i=o.target,l=(c=i==null?void 0:i.tagName)==null?void 0:c.toLowerCase();l==="input"||l==="textarea"||i!=null&&i.isContentEditable||(o.preventDefault(),r())};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[t,r,n])}const Al=240,ls=({searchKey:t="q",filterKey:r="filter",pageKey:n="page",placeholder:s="Search",shortcut:o="/",collapsible:i=!0})=>{const{searchParams:l,setSearchParams:c,searchQueries:a}=Xe(),d=Mr(t,l,r)||"",[h,g]=u.useState(!i||!!d),[m,y]=u.useState(i&&!d),[D,j]=u.useState(d),R=ke.useDebounce(D,350),I=u.useRef(null);u.useEffect(()=>{j(d),d&&g(!0)},[d]),u.useEffect(()=>{h&&y(!1)},[h]),u.useEffect(()=>{R!==d&&ir({value:R,name:t,type:"search",searchQueries:a,setSearchParams:c,filterKey:r,pageKey:n})},[R]);const M=u.useCallback(()=>{g(!0),requestAnimationFrame(()=>{var F;return(F=I.current)==null?void 0:F.focus()})},[]);Rl(o,M);const C=()=>{i&&!D&&g(!1)},k=F=>{var v;i&&F.key==="Escape"&&!D&&(g(!1),(v=I.current)==null||v.blur())},T=()=>{h||y(!0)};return e.jsxs(x.Box,{display:"flex",direction:"row",align:"center",gap:"spacing-0",children:[m&&e.jsx(P.Button,{variant:"outline",tone:"neutral",size:"sm",iconLeft:e.jsx(B.Icon,{name:"Search",size:"sm"}),"aria-label":"Search","aria-expanded":!1,onClick:M}),e.jsxs(x.Box,{onTransitionEnd:T,style:{position:"relative",width:h?Al:0,overflow:"hidden",transition:"width 220ms ease"},children:[e.jsx(gt.Input,{ref:I,size:"sm",fullWidth:!0,value:D,placeholder:s,leftIcon:e.jsx(B.Icon,{name:"Search",width:16,height:16}),onChange:F=>j(F.target.value),onKeyDown:k,onBlur:C,tabIndex:h?0:-1}),h&&!D&&e.jsx(x.Box,{align:"center",justify:"center",borderColor:"border-subtle",borderWidth:"border",borderStyle:"border-solid",borderRadius:"rounded-xs",paddingInline:"spacing-1",customBackgroundColor:"var(--sa-background-hover, #f0f1f2)",style:{position:"absolute",right:8,top:"50%",transform:"translateY(-50%)",pointerEvents:"none",minWidth:18,height:18,display:"inline-flex"},children:e.jsx(S.Text,{fontSize:"xs",color:"subtle",children:o})})]})]})},cs=({columns:t,allVisible:r,onToggle:n,onReorder:s,onSetAllHidden:o})=>{const[i,l]=u.useState(null),[c,a]=u.useState(null),d=()=>{i!==null&&c!==null&&i!==c&&s(i,c),l(null),a(null)},h=(g,m)=>{const y=g+m;y<0||y>=t.length||s(g,y)};return e.jsxs(A.Menu,{position:"bottom-right",children:[e.jsx(A.MenuButton,{children:e.jsx(P.Button,{variant:r?"outline":"secondary",tone:"neutral",size:"sm",iconLeft:e.jsx(B.Icon,{name:"Grid",size:"sm"}),"aria-label":"Customize columns"})}),e.jsx(A.MenuLists,{children:e.jsx(A.MenuBody,{children:e.jsxs(x.Box,{padding:"sm",direction:"column",customWidth:"296px",customMaxHeight:"60vh",overflow:"overflow-hidden",children:[e.jsx(S.Text,{fontWeight:"semibold",color:"primary",children:"Customize Column Table"}),e.jsxs(x.Box,{direction:"row",display:"flex",align:"center",justify:"space-between",paddingBlock:"md",children:[e.jsx(S.Text,{fontSize:"sm",fontWeight:"medium",color:"subtle",children:"Show in table"}),e.jsx(P.Button,{variant:"link",tone:"info",size:"xs",onClick:()=>o(r),children:r?"Hide All":"Show All"})]}),e.jsx(x.Box,{direction:"column",overflow:"overflow-y-auto",children:t.map((g,m)=>{const y=!g.locked,D=c===m&&i!==null&&i!==m;return e.jsxs(x.Box,{direction:"row",display:"flex",align:"center",gap:"sm",paddingBlock:"xs",draggable:y,onDragStart:()=>y&&l(m),onDragOver:j=>{j.preventDefault(),a(m)},onDrop:d,onDragEnd:d,style:{minHeight:32,boxShadow:D?"inset 0 2px 0 0 var(--sa-background-brand, #04254f)":void 0},children:[e.jsx(x.Box,{direction:"column",as:"div",align:"center",justify:"center",role:"button",tabIndex:y?0:-1,"aria-label":`Reorder ${g.title}`,"aria-disabled":!y||void 0,color:"icon-subtlest",onKeyDown:j=>{y&&(j.key==="ArrowUp"?(j.preventDefault(),h(m,-1)):j.key==="ArrowDown"&&(j.preventDefault(),h(m,1)))},style:{display:"inline-flex",cursor:y?"grab":"default",opacity:y?1:.4},children:e.jsx(B.Icon,{name:"DragVertical",width:16,height:16})}),g.icon&&e.jsx(x.Box,{direction:"column",align:"center",color:"icon-subtle",style:{display:"inline-flex"},children:g.icon}),e.jsx(S.Text,{fontSize:"sm",fontWeight:"medium",color:"primary",truncate:!0,children:g.title}),e.jsx(x.Box,{direction:"column",style:{marginLeft:"auto"},children:e.jsx(Zt.Toggle,{size:"sm",checked:g.visible,disabled:g.locked,onChange:()=>n(g.key),"aria-label":`Toggle ${g.title} column`})})]},g.key)})})]})})})]})},as=({views:t,onApply:r,onDelete:n,onSave:s})=>{const[o,i]=u.useState(""),l=()=>{const c=o.trim();c&&(s(c),i(""))};return e.jsxs(A.Menu,{position:"bottom-right",children:[e.jsx(A.MenuButton,{children:e.jsx(P.Button,{variant:t.length>0?"secondary":"outline",tone:(t.length>0,"neutral"),size:"sm",iconLeft:e.jsx(B.Icon,{name:"Bookmark",size:"sm"}),"aria-label":"Saved views"})}),e.jsxs(A.MenuLists,{style:{width:"260px"},children:[e.jsx(A.MenuBody,{children:e.jsxs(x.Box,{direction:"column",padding:"xs",gap:"sm",children:[e.jsx(S.Text,{fontWeight:"semibold",color:"primary",children:"Saved Views"}),e.jsx(x.Box,{direction:"column",overflow:"overflow-y-auto",children:t.length===0?e.jsx(x.Box,{direction:"column",paddingBlock:"sm",children:e.jsx(S.Text,{fontSize:"sm",color:"subtlest",children:"No saved views yet"})}):t.map(c=>e.jsx(A.MenuItem,{startIcon:e.jsx(B.Icon,{name:"Bookmark"}),onClick:()=>r(c),endIcon:e.jsx(P.Button,{variant:"link",tone:"error",size:"sm",iconLeft:e.jsx(B.Icon,{name:"Trash2"}),"aria-label":`Delete ${c.name}`,onClick:a=>{a.stopPropagation(),n(c.id)}}),children:c.name},c.id))})]})}),e.jsx(A.MenuFooter,{children:e.jsxs(x.Box,{direction:"row",gap:"xs",children:[e.jsx(x.Box,{direction:"column",style:{flex:"1 0 0",minWidth:0},children:e.jsx(gt.Input,{size:"sm",fullWidth:!0,placeholder:"Save current view as…",value:o,onChange:c=>i(c.target.value),onKeyDown:c=>{c.key==="Enter"&&l()}})}),e.jsx(P.Button,{variant:"primary",tone:"brand",size:"sm",disabled:!o.trim(),onClick:l,children:"Save"})]})})]})]})},Ol=({isOpen:t,onClose:r,configs:n,activeKeys:s,configByKey:o,hasActiveFilter:i,onToggle:l,onReset:c,getValue:a,setValue:d,clearValue:h,removeFilter:g})=>{const m=s.length;return e.jsx(kr.Drawer,{position:"bottom",isShow:t,onHide:r,children:e.jsxs(x.Box,{direction:"column",customMaxHeight:"85vh",style:{minHeight:280},children:[e.jsxs(x.Box,{direction:"row",display:"flex",align:"center",justify:"space-between",paddingInline:"md",paddingBlock:"sm",style:{borderBottom:"1px solid var(--sa-border-subtle, rgba(11, 18, 14, 0.14))"},children:[e.jsxs(x.Box,{direction:"row",display:"flex",align:"center",gap:"xs",children:[e.jsx(S.Text,{fontWeight:"semibold",color:"primary",children:"Filter"}),m>0&&e.jsxs(S.Text,{fontSize:"sm",color:"subtle",children:["(",m,")"]})]}),e.jsx(P.Button,{variant:"link",tone:"neutral",size:"sm",iconLeft:e.jsx(B.Icon,{name:"Cross"}),"aria-label":"Close filter",onClick:r})]}),e.jsxs(x.Box,{direction:"column",gap:"lg",padding:"md",overflow:"overflow-y-auto",style:{flex:"1 1 auto",minHeight:0},children:[m>0&&e.jsxs(x.Box,{direction:"column",gap:"sm",children:[e.jsx(S.Text,{fontSize:"xs",fontWeight:"medium",color:"subtlest",children:"Filter aktif"}),e.jsx(x.Box,{direction:"row",display:"flex",wrap:"wrap",gap:"sm",align:"center",children:e.jsx(is,{activeKeys:s,configByKey:o,getValue:a,setValue:d,clearValue:h,removeFilter:g})})]}),n.length>0&&e.jsxs(x.Box,{direction:"column",gap:"sm",children:[e.jsx(S.Text,{fontSize:"xs",fontWeight:"medium",color:"subtlest",children:"Tambah filter"}),e.jsx(x.Box,{direction:"column",children:n.map(y=>{const D=s.includes(y.key),j=!!y.locked;return e.jsxs(x.Box,{direction:"row",display:"flex",align:"center",justify:"space-between",gap:"sm",paddingBlock:"sm",style:{opacity:j?.5:1,borderTop:"1px solid var(--sa-border-subtle, rgba(11, 18, 14, 0.08))"},children:[e.jsxs(x.Box,{direction:"row",display:"flex",align:"center",gap:"sm",style:{minWidth:0},children:[y.icon&&e.jsx(x.Box,{direction:"column",align:"center",color:"icon-subtle",style:{display:"inline-flex"},children:y.icon}),e.jsx(S.Text,{fontSize:"sm",color:"primary",truncate:!0,children:y.label})]}),e.jsx(Zt.Toggle,{size:"sm",checked:D||j,disabled:j,onChange:()=>l(y.key),"aria-label":`Toggle ${y.label}`})]},y.key)})})]})]}),e.jsxs(x.Box,{direction:"row",display:"flex",gap:"sm",paddingInline:"md",paddingBlock:"sm",style:{borderTop:"1px solid var(--sa-border-subtle, rgba(11, 18, 14, 0.14))"},children:[e.jsx(x.Box,{direction:"column",style:{flex:"1 1 0"},children:e.jsx(P.Button,{variant:"outline",tone:"neutral",size:"md",fullWidth:!0,disabled:!i,onClick:c,children:"Reset"})}),e.jsx(x.Box,{direction:"column",style:{flex:"1 1 0"},children:e.jsx(P.Button,{variant:"primary",tone:"brand",size:"md",fullWidth:!0,onClick:r,children:"Selesai"})})]})]})})},Wl=t=>`${t} Rows`,zl=({perPageKey:t,pageKey:r,pageSizeOptions:n,defaultPerPage:s=10,showPageSize:o})=>{const{searchQueries:i,setSearchParams:l,searchParams:c}=Xe(),a=c.get(t),d=a?Number(a):s,h=g=>{l({...i,[t]:g,[r]:"1"})};return o?e.jsxs(A.Menu,{position:"bottom-right",children:[e.jsx(A.MenuButton,{children:e.jsx(P.Button,{variant:"outline",tone:"neutral",size:"sm",iconLeft:e.jsx(B.Icon,{name:"MenuVertical",size:"sm"}),"aria-label":"More options"})}),e.jsx(A.MenuLists,{children:e.jsxs(A.MenuBody,{style:{minWidth:200},children:[e.jsx(x.Box,{paddingInline:"sm",paddingBlock:"xs",children:e.jsx(S.Text,{fontSize:"xs",fontWeight:"medium",color:"subtlest",children:"Rows per page"})}),n.map(g=>e.jsx(A.MenuItem,{selected:g===d,endIcon:g===d?e.jsx(B.Icon,{name:"Check"}):void 0,onClick:()=>h(String(g)),children:Wl(g)},g))]})})]}):null},Hl=t=>{var ue;const{withPadding:r,configs:n,activeKeys:s,configByKey:o,hasActiveFilter:i,toggleFilter:l,removeFilter:c,getValue:a,setValue:d,clearValue:h,onReset:g,searchable:m,searchKey:y,filterKey:D,pageKey:j,searchPlaceholder:R,searchShortcut:I,searchCollapsible:M,pagination:C,perPageKey:k,pageSizeOptions:T,defaultPerPage:F,showPagination:v,showResultCount:L,showPageSize:N,hasColumns:q,orderedColumns:W,allVisible:O,onToggleVisibility:J,onReorder:K,onSetAllHidden:X,showSavedViews:$,savedViews:ae,onApplyView:Z,onDeleteView:ne,onSaveView:de,leadingActions:ve,trailingActions:Be}=t,[Ce,je]=u.useState(!1),{searchQueries:ge,setSearchParams:Oe}=Xe(),$e=(C==null?void 0:C.rangeStart)??(((C==null?void 0:C.currentPage)||0)>1?(((C==null?void 0:C.currentPage)||0)-1)*((C==null?void 0:C.perPage)||0)+1:1),Le=(C==null?void 0:C.rangeEnd)??((C==null?void 0:C.totalCurrentPage)!==(C==null?void 0:C.perPage)?C==null?void 0:C.totalData:((C==null?void 0:C.currentPage)||1)*((C==null?void 0:C.totalCurrentPage)||0)),le=se=>{Oe({...ge,[j]:String(se)})},be=L||v&&!!(C!=null&&C.totalPage),We=()=>{g(),je(!1)};return e.jsxs(x.Box,{direction:"column",gap:"sm",fullWidth:!0,paddingTop:r?"sm":void 0,paddingBottom:r?"sm":void 0,paddingLeft:r?"md":void 0,paddingRight:r?"md":void 0,role:"toolbar","aria-label":"Filter bar",children:[e.jsxs(x.Box,{direction:"row",display:"flex",align:"center",wrap:"wrap",gap:"sm",fullWidth:!0,overflow:"overflow-auto",children:[m&&e.jsx(ls,{searchKey:y,filterKey:D,pageKey:j,placeholder:R,shortcut:I,collapsible:M}),e.jsx(P.Button,{variant:i?"secondary":"outline",tone:"neutral",size:"sm",iconLeft:e.jsx(B.Icon,{name:"FilterHorizontal"}),onClick:()=>je(!0),"aria-label":"Open filters",children:i?`Filter: ${s.length}`:null}),e.jsxs(x.Box,{direction:"row",display:"flex",align:"center",gap:"sm",style:{marginLeft:"auto"},children:[ve,$&&e.jsx(as,{views:ae,onApply:Z,onDelete:ne,onSave:de}),q&&e.jsx(cs,{columns:W,allVisible:O,onToggle:J,onReorder:K,onSetAllHidden:X}),e.jsx(zl,{perPageKey:k,pageKey:j,pageSizeOptions:T,defaultPerPage:F,showPageSize:N}),Be]})]}),be&&e.jsxs(x.Box,{direction:"row",display:"flex",align:"center",justify:"space-between",gap:"sm",fullWidth:!0,children:[L?e.jsx(S.Text,{fontSize:"sm",fontWeight:"medium",color:"primary",truncate:!0,children:`${$e}-${Le} of ${((ue=C==null?void 0:C.totalData)==null?void 0:ue.toLocaleString())||0}`}):e.jsx(x.Box,{direction:"column"}),v&&!!(C!=null&&C.totalPage)&&e.jsx(sr.Pagination,{size:"xs",variant:"neutral",siblingCount:0,currentPage:C!=null&&C.currentPage?Number(C.currentPage):1,totalPages:Number(C.totalPage),onPageChange:le})]}),e.jsx(Ol,{isOpen:Ce,onClose:()=>je(!1),configs:n,activeKeys:s,configByKey:o,hasActiveFilter:i,onToggle:l,onReset:We,getValue:a,setValue:d,clearValue:h,removeFilter:c})]})},_l=({withPadding:t=!1,filterConfigs:r=[],filterKey:n="filter",activeFilterKey:s="filters",pageKey:o="page",perPageKey:i="perPage",pageSizeOptions:l=[25,50,100],defaultPerPage:c,showPagination:a=!0,showResultCount:d=!0,showPageSize:h=!0,searchable:g=!1,searchKey:m="q",searchPlaceholder:y="Search",searchShortcut:D="/",searchPosition:j="right",searchCollapsible:R=!0,pagination:I,columns:M=[],onColumnsChange:C,columnsState:k,scopeId:T,savedViews:F,persistLastState:v=!0,persistSearch:L=!0,storage:N=En,onReset:q,leadingActions:W,trailingActions:O})=>{const J=T??(F==null?void 0:F.scopeId),{activeKeys:K,configByKey:X,hasActiveFilter:$,toggleFilter:ae,removeFilter:Z,getValue:ne,setValue:de,clearValue:ve,clearAll:Be}=Bn({configs:r,filterKey:n,activeFilterKey:s,pageKey:o,searchKey:m}),Ce=ul({columns:M,scopeId:J,storage:N,onColumnsChange:C,value:k}),je=xl({scopeId:J,storage:N,snapshotKeys:[s,n,i],pageKey:o,getColumns:()=>Ce.state,applyColumns:Ce.applyState}),ge=fl({scopeId:J,storage:N,snapshotKeys:[s,n,o],enabled:v,filterKey:n,searchKey:m,persistSearch:L}),Oe=ml({scopeId:J,storage:N,perPageKey:i,pageSizeOptions:l,enabled:v});pl({enabled:v&&!!J,snapshotKeys:[s,n,o],perPageKey:i,readSnapshot:ge.read,readPerPage:Oe.read});const $e=c??l[0]??25,Le=!!(F!=null&&F.enabled)&&je.enabled,le=()=>{Be(),ge.clear(),q==null||q()},be=ke.useMediaQuery("md"),We=g?e.jsx(ls,{searchKey:m,filterKey:n,pageKey:o,placeholder:y,shortcut:D,collapsible:R}):null;return be?e.jsxs(x.Box,{display:"flex",direction:"row",align:"center",gap:"sm",wrap:"wrap",fullWidth:!0,paddingTop:t?"sm":void 0,paddingBottom:t?"sm":void 0,paddingLeft:t?"md":void 0,paddingRight:t?"md":void 0,role:"toolbar","aria-label":"Filter bar",children:[e.jsxs(x.Box,{direction:"row",display:"flex",align:"center",gap:"sm",style:{flex:"1 1 0",minWidth:0},children:[e.jsx(yl,{configs:r,activeKeys:K,onToggle:ae,hasActiveFilter:$,onReset:le}),j==="left"&&We,e.jsxs(x.Box,{direction:"row",display:"flex",align:"center",gap:"sm",overflow:"overflow-x-auto",style:{flex:"1 1 0",minWidth:0},children:[e.jsx(is,{activeKeys:K,configByKey:X,getValue:ne,setValue:de,clearValue:ve,removeFilter:Z}),$&&e.jsx(P.Button,{variant:"link",tone:"brand",size:"sm",onClick:le,children:"Reset"})]})]}),e.jsxs(x.Box,{direction:"row",display:"flex",align:"center",gap:"sm",children:[W,e.jsx(Ll,{pagination:I,pageKey:o,perPageKey:i,pageSizeOptions:l,defaultPerPage:$e,showPagination:a,showResultCount:d,showPageSize:h}),j==="right"&&We,Le&&e.jsx(as,{views:je.views,onApply:je.applyView,onDelete:je.deleteView,onSave:je.saveView}),M.length>0&&e.jsx(cs,{columns:Ce.orderedColumns,allVisible:Ce.allVisible,onToggle:Ce.toggleVisibility,onReorder:Ce.reorder,onSetAllHidden:Ce.setAllHidden}),O]})]}):e.jsx(Hl,{withPadding:t,configs:r,activeKeys:K,configByKey:X,hasActiveFilter:$,toggleFilter:ae,removeFilter:Z,getValue:ne,setValue:de,clearValue:ve,onReset:le,searchable:g,searchKey:m,filterKey:n,pageKey:o,searchPlaceholder:y,searchShortcut:D,searchCollapsible:R,pagination:I,perPageKey:i,pageSizeOptions:l,defaultPerPage:$e,showPagination:a,showResultCount:d,showPageSize:h,hasColumns:M.length>0,orderedColumns:Ce.orderedColumns,allVisible:Ce.allVisible,onToggleVisibility:Ce.toggleVisibility,onReorder:Ce.reorder,onSetAllHidden:Ce.setAllHidden,showSavedViews:Le,savedViews:je.views,onApplyView:je.applyView,onDeleteView:je.deleteView,onSaveView:je.saveView,leadingActions:W,trailingActions:O})},Pl=t=>{if(!Array.isArray(t)||t.length===0)return;const r=t[0];return(r==null?void 0:r.value)!=null?String(r.value):void 0},Nl=t=>{if(!Array.isArray(t)||t.length===0)return;const r=t.map(n=>(n==null?void 0:n.value)!=null?String(n.value):null).filter(n=>n!=null);return r.length?r:void 0},Vl=(t,r)=>{switch(t.type){case"dropdown":case"radio":return Pl(r);case"dropdown-multiple":case"checkbox-multiple":return Nl(r);case"date":return r instanceof Date?r.toISOString():void 0;case"date-compact":return r;case"text":return typeof r=="string"&&r?r:void 0;default:return}},go=(t,r)=>{if(t==null||t==="")return r;const n=Number(t);return Number.isFinite(n)&&n>0?n:r},ql=t=>{const{filterConfigs:r,filterKey:n="filter",activeFilterKey:s="filters",pageKey:o="page",perPageKey:i="perPage",searchKey:l="q",defaultPage:c=1,defaultPerPage:a=10,paramKeys:d,serialize:h}=t,{activeKeys:g,configByKey:m,hasActiveFilter:y,getValue:D}=Bn({configs:r,filterKey:n,activeFilterKey:s,pageKey:o,searchKey:l}),{searchParams:j}=Xe(),R=j.toString();return u.useMemo(()=>{const M={},C={},k=go(j.get(o),c),T=go(j.get(i),a);M[(d==null?void 0:d.page)??"page"]=k,M[(d==null?void 0:d.perPage)??"perPage"]=T;const F=Mr(l,j,n)||"";F&&(M[(d==null?void 0:d.search)??"search"]=F);let v=!1;for(const L of g){const N=m[L];if(!N)continue;const q=D(N);C[L]=q;const W=h==null?void 0:h[L],O=W?W(q):Vl(N,q);if(O==null||Array.isArray(O)&&O.length===0)continue;const J=(d==null?void 0:d[L])??L;M[J]=O,v=!0}return{params:M,raw:C,hasActiveFilter:y||!!F||v}},[R,g.join("|"),n,s,o,i,l,c,a,d,h,m])},Zl=["dropdown","dropdown-multiple","checkbox-multiple","radio"],Gl=({filterConfigs:t,filterKey:r,activeFilterKey:n,pageKey:s,searchKey:o})=>{const{configByKey:i,getValue:l,setValue:c,removeFilter:a,clearAll:d,hasActiveFilter:h}=Bn({configs:t,filterKey:r,activeFilterKey:n,pageKey:s,searchKey:o}),g=(C,k)=>{var F;const T=C.options;return((F=T==null?void 0:T.find(v=>v.value===k))==null?void 0:F.label)??k},m=u.useCallback(C=>{const k=i[C];if(!k)return[];const T=l(k);return Array.isArray(T)?T.map(F=>String(F.value)):[]},[i,l]),y=u.useCallback((C,k)=>{const T=i[C];if(!T||!Zl.includes(T.type))return;const F=Array.isArray(k)?k:[k];if(F.length===0){a(C);return}c(T,F.map(v=>({label:g(T,v),value:v})))},[i,c,a]),D=u.useCallback((C,k)=>{const T=m(C);y(C,T.includes(k)?T.filter(F=>F!==k):[...T,k])},[m,y]),j=u.useCallback((C,k)=>m(C).includes(k),[m]),R=u.useCallback(C=>a(C),[a]),I=u.useCallback(C=>{const k=i[C];return k?l(k):void 0},[i,l]),M=u.useCallback((C,k)=>{const T=i[C];if(T){if(k==null){a(C);return}c(T,k)}},[i,c,a]);return{set:y,toggle:D,clear:R,clearAll:d,isActive:j,values:m,getRaw:I,setRaw:M,hasActiveFilter:h}},Xr="var(--sa-background-brand, #04254f)",Ql="var(--sa-text-brand, #031f43)",Ul={padding:"6px 8px",border:"1px solid var(--sa-border-subtle, #0b120e24)",borderRadius:"var(--sa-radii-xs, 4px)",font:"inherit",fontSize:13,outline:"none",width:"100%",boxSizing:"border-box"},Fn={padding:"4px 8px",border:"none",background:"none",cursor:"pointer",font:"inherit",textAlign:"left",fontSize:13,color:Ql},ds=(t,r)=>{if(t.type==="text"||t.type==="date")return!!r.getRaw(t.key);if(t.type==="date-compact"){const n=r.getRaw(t.key);return!!(n&&(n.date||n.from||n.to||n.relative||n.op==="is-empty"||n.op==="is-not-empty"))}return r.values(t.key).length>0},Yl=({field:t,controls:r})=>{const[n,s]=u.useState(""),o=t.type==="dropdown"||t.type==="radio",i=t.type==="checkbox-multiple"?!1:t.searchable!==!1,l=r.values(t.key),c=i&&n.trim()?t.options.filter(d=>d.label.toLowerCase().includes(n.toLowerCase())):t.options,a=d=>{o?r.set(t.key,l.includes(d)?[]:d):r.toggle(t.key,d)};return e.jsxs(x.Box,{style:{display:"flex",flexDirection:"column",gap:4,minWidth:200},children:[i&&e.jsx("input",{value:n,onChange:d=>{var h;s(d.target.value),(h=t.onSearch)==null||h.call(t,d.target.value)},placeholder:"Cari…",style:Ul}),e.jsxs(x.Box,{style:{display:"flex",flexDirection:"column",gap:2,maxHeight:220,overflowY:"auto"},children:[c.map(d=>{const h=l.includes(d.value);return e.jsxs("button",{type:"button",onClick:()=>a(d.value),style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"6px 8px",border:"none",background:"none",cursor:"pointer",font:"inherit",textAlign:"left",borderRadius:"var(--sa-radii-xs, 4px)"},children:[e.jsx("span",{style:{width:16,height:16,flexShrink:0,borderRadius:o?"50%":"var(--sa-radii-xs, 4px)",display:"inline-flex",alignItems:"center",justifyContent:"center",border:`1px solid ${h?Xr:"var(--sa-border-subtle, #0b120e24)"}`,background:h&&!o?Xr:"transparent"},children:h&&(o?e.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:Xr}}):e.jsx(B.Icon,{name:"Check",size:"xs",style:{color:"#fff"}}))}),e.jsx(S.Text,{as:"span",style:{fontSize:14},children:d.label})]},d.value)}),c.length===0&&e.jsx(S.Text,{as:"span",style:{fontSize:13,color:"var(--sa-text-subtlest, #8c8f97)",padding:"6px 8px"},children:"Tak ada hasil"})]}),l.length>0&&e.jsx("button",{type:"button",onClick:()=>r.clear(t.key),style:Fn,children:"Clear"})]})},Xl=({field:t,controls:r})=>{const n=r.getRaw(t.key);return e.jsx(x.Box,{style:{minWidth:240},children:e.jsx(Dt.StarasiaDate,{size:"sm",input:!1,clearable:!0,filter:t.mode,value:n,onChange:s=>r.setRaw(t.key,s??null),withPadding:!1})})},$l=({field:t,controls:r})=>{const n=r.getRaw(t.key),s=t.ops&&t.ops.length>0?t.ops:ns,o=t.defaultOp&&s.includes(t.defaultOp)?t.defaultOp:s[0],i=t.mode??"days",l=(n==null?void 0:n.op)??o,c=d=>r.setRaw(t.key,d),a=d=>{if(d!==l)return c(d==="is-empty"||d==="is-not-empty"?{op:d}:d==="is-relative-to-today"?{op:d,relative:(n==null?void 0:n.relative)??{direction:"past",count:1,period:"week"}}:d==="is-between"?{op:d,from:n==null?void 0:n.from,to:n==null?void 0:n.to}:{op:d,date:n==null?void 0:n.date})};return e.jsxs(x.Box,{style:{display:"flex",flexDirection:"column",gap:6,minWidth:280},children:[e.jsxs(x.Box,{display:"flex",direction:"row",align:"center",gap:"xs",children:[e.jsx(S.Text,{fontSize:"sm",fontWeight:"medium",color:"subtlest",children:t.label}),e.jsx(os,{op:l,ops:s,onChange:a})]}),e.jsx(ss,{value:n,op:l,mode:i,onChange:c}),ds(t,r)&&e.jsx("button",{type:"button",onClick:()=>r.setRaw(t.key,null),style:Fn,children:"Clear"})]})},Jl=({field:t,controls:r})=>{const n=r.getRaw(t.key)??"",[s,o]=u.useState(n),i=ke.useDebounce(s,t.debounceMs??300);return u.useEffect(()=>{const l=r.getRaw(t.key)??"";i!==l&&r.setRaw(t.key,i||null)},[i]),e.jsxs(x.Box,{style:{display:"flex",flexDirection:"column",gap:6,minWidth:220},children:[e.jsx(gt.Input,{size:"sm",fullWidth:!0,value:s,placeholder:t.placeholder??"Cari…",leftIcon:e.jsx(B.Icon,{name:"Search",width:16,height:16}),onChange:l=>o(l.target.value)}),s&&e.jsx("button",{type:"button",onClick:()=>{o(""),r.setRaw(t.key,null)},style:Fn,children:"Clear"})]})},Kl=({field:t,controls:r})=>t.type==="text"?e.jsx(Jl,{field:t,controls:r}):t.type==="date"?e.jsx(Xl,{field:t,controls:r}):t.type==="date-compact"?e.jsx($l,{field:t,controls:r}):e.jsx(Yl,{field:t,controls:r}),ec=(t,r)=>{if(!t)return{};const{fromKey:n,toKey:s,opKey:o}=r,i={};switch(t.op){case"is":case"is-before":case"is-after":case"is-on-or-before":case"is-on-or-after":return t.date&&(i[n]=new Date(t.date).toISOString()),o&&(i[o]=t.op),i;case"is-between":return t.from&&(i[n]=new Date(t.from).toISOString()),t.to&&(i[s]=new Date(t.to).toISOString()),i;case"is-relative-to-today":{if(!t.relative)return i;const{from:l,to:c}=es(t.relative);return i[n]=l.toISOString(),i[s]=c.toISOString(),i}case"is-empty":case"is-not-empty":return o&&(i[o]=t.op==="is-empty"?"empty":"not-empty"),i;default:return i}},us=({children:t,borderRadius:r,height:n})=>{const s=u.useRef(null),[o,i]=u.useState("100vh");return u.useEffect(()=>{if(n)return;const l=()=>{if(s.current){const c=s.current.getBoundingClientRect().top;i(`calc(100vh - ${c}px)`)}};return l(),window.addEventListener("resize",l),()=>window.removeEventListener("resize",l)},[n]),e.jsx(x.Box,{ref:s,fullWidth:!0,borderStyle:"border-solid",borderWidth:"border",borderColor:"border-base",borderRadius:r||"rounded-xs",style:{height:n??o,display:"flex",flexDirection:"column"},children:t})},xs=({action:t,rightContent:r,leftContent:n,headerSlot:s,advanceFilter:o,showFilter:i=!0})=>{const l=ke.useMediaQuery("md"),c=i?e.jsx(Ko,{...o}):null,a=()=>t?u.isValidElement(t)?t:e.jsx(x.Box,{style:{display:"flex",flexDirection:l?"row":"column",gap:"8px",width:l?"auto":"100%",textWrap:"nowrap"},children:t.map(({title:d,icon:h,buttonProps:g,onClick:m},y)=>!d&&!h?null:e.jsx(P.Button,{fullWidth:!l,iconLeft:h?e.jsx(B.Icon,{name:h}):void 0,onClick:m,...g,children:d},`action-${y}`))}):null;return e.jsx(x.Box,{style:{display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center",paddingLeft:"8px",paddingRight:"8px",paddingTop:"8px",paddingBottom:"8px",borderBottom:"1px solid var(--sa-border-subtle, #0b120e24)",flexShrink:0,position:"relative",zIndex:10,flexDirection:l?"row":"column-reverse",gap:"16px"},children:s?s({filter:c}):e.jsxs(e.Fragment,{children:[e.jsxs(x.Box,{style:{display:"flex",gap:"8px",flexDirection:"row",alignItems:"center",flex:1,minWidth:0},children:[c,n]}),e.jsxs(x.Box,{style:{display:"flex",gap:"8px",flexDirection:"row",alignItems:"center",flexShrink:0},children:[r,a()]})]})})},tc=({totalData:t,withMarginBottom:r=!0,withMarginTop:n=!0})=>e.jsxs(x.Box,{style:{display:"flex",gap:"4px",flexDirection:"row",alignItems:"center",marginBottom:r?"16px":void 0,marginTop:n?"16px":void 0},children:[e.jsxs(it.Body1,{props:{color:"gray-500"},children:["Total data:"," "]}),e.jsx(it.Body1,{children:t||0})]}),hs=({pagination:t,pageKey:r="page",perPageKey:n="perPage",defaultPerPage:s=10,showPagination:o=!0,totalData:i})=>{const{searchQueries:l,setSearchParams:c,searchParams:a}=Xe(),d=a.get(n),h=D=>{c({...l,[r]:String(D)})},g=D=>{c({...l,[n]:D,[r]:"1"})},m=(t==null?void 0:t.rangeStart)??(((t==null?void 0:t.currentPage)||0)>1?(((t==null?void 0:t.currentPage)||0)-1)*((t==null?void 0:t.perPage)||0)+1:1),y=(t==null?void 0:t.rangeEnd)??((t==null?void 0:t.totalCurrentPage)!==(t==null?void 0:t.perPage)?t==null?void 0:t.totalData:((t==null?void 0:t.currentPage)||1)*((t==null?void 0:t.totalCurrentPage)||0));return e.jsx(x.Box,{style:{display:"flex",width:"100%",flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingLeft:"16px",paddingRight:"16px",paddingTop:"8px",paddingBottom:"8px",borderTop:"1px solid var(--sa-border-subtle, #0b120e24)",flexShrink:0},children:o?e.jsxs(e.Fragment,{children:[e.jsxs(x.Box,{style:{display:"flex",flexDirection:"row",gap:"8px",alignItems:"center",textWrap:"nowrap"},children:[e.jsx(S.Text,{children:"Rows Per Page: "}),e.jsx(Vt.Dropdown,{dropdownLists:[{label:"5",value:"5"},{label:"10",value:"10"},{label:"25",value:"25"},{label:"50",value:"50"},{label:"100",value:"100"}],onChange:D=>{g(D[0].value)},value:d?[{label:`${d} per row`,value:d}]:[{label:`${s} per row`,value:`${s}`}],defaultValue:d?[{label:`${d} per row`,value:d}]:[{label:`${s} per row`,value:`${s}`}]}),e.jsx(S.Text,{children:`${m}-${y} of ${(t==null?void 0:t.totalData)||0}`})]}),e.jsx(sr.Pagination,{currentPage:t!=null&&t.currentPage?Number(t==null?void 0:t.currentPage):1,totalPages:t!=null&&t.totalPage?Number(t==null?void 0:t.totalPage):1,onPageChange:h})]}):e.jsx(tc,{totalData:i,withMarginBottom:!1,withMarginTop:!1})})},fs=({filter:t,columnTitle:r})=>{const[n,s]=u.useState(!1),o=u.useRef(null),i=u.useRef(null),l=u.useRef(null),[c,a]=u.useState(""),[d,h]=u.useState({top:0,left:0}),g=t.selectedValues,m=u.useMemo(()=>c?t.options.filter(j=>j.label.toLowerCase().includes(c.toLowerCase())):t.options,[t.options,c]);u.useEffect(()=>{if(n&&i.current){const j=i.current.getBoundingClientRect(),R=280,I={top:j.bottom+8};t.position==="left"||j.left+R>window.innerWidth?I.right=window.innerWidth-j.right:I.left=j.left,h(I)}},[n,t.position]),u.useEffect(()=>{n&&l.current?setTimeout(()=>{var j;return(j=l.current)==null?void 0:j.focus()},50):a("")},[n]),u.useEffect(()=>{const j=R=>{o.current&&!o.current.contains(R.target)&&i.current&&!i.current.contains(R.target)&&s(!1)};return n&&document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[n]);const y=j=>{const R=g.includes(j)?g.filter(I=>I!==j):[...g,j];t.onFilterChange(R)},D=()=>t.onFilterChange([]);return e.jsxs(x.Box,{direction:"column",style:{position:"relative"},children:[e.jsx(x.Box,{ref:i,style:{display:"flex",flexDirection:"row",alignItems:"center",cursor:"pointer"},onClick:j=>{var R;j.stopPropagation(),n||(R=t.onOpen)==null||R.call(t),s(I=>!I)},children:e.jsx(B.Icon,{name:n?"ChevronUp":"ChevronDown",size:"sm",style:{color:g.length>0?"var(--sa-color-brand-500, #1a4fa0)":"var(--sa-text-subtle, #8c8f97)"}})}),n&&e.jsxs(x.Box,{ref:o,style:{position:"fixed",top:`${d.top}px`,...d.left!==void 0?{left:`${d.left}px`}:{right:`${d.right}px`},backgroundColor:"white",borderRadius:"var(--sa-radii-xs, 4px)",minWidth:"280px",maxHeight:"400px",display:"flex",flexDirection:"column",zIndex:9999,animation:"fadeInDropdown 0.15s ease-out",border:"1px solid var(--sa-border-subtle, #0b120e24)"},children:[e.jsxs(x.Box,{style:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingTop:"12px",paddingBottom:"12px",paddingLeft:"16px",paddingRight:"16px",borderBottom:"1px solid var(--sa-border-subtle, #0b120e24)"},children:[e.jsxs(S.Text,{fontSize:"sm",fontWeight:"semibold",color:"gray-700",children:["Filter ",r]}),g.length>0&&e.jsx(x.Box,{direction:"column",style:{cursor:"pointer"},children:e.jsx(S.Text,{fontSize:"xs",color:"primary",fontWeight:"semibold",onClick:j=>{j.stopPropagation(),D()},children:"CLEAR"})})]}),!t.hideSearch&&e.jsx(x.Box,{direction:"column",style:{paddingLeft:"16px",paddingRight:"16px",paddingTop:"8px",paddingBottom:"8px"},children:e.jsx(gt.Input,{ref:l,placeholder:`Search ${r.toLowerCase()}...`,leftIcon:e.jsx(B.Icon,{name:"Search",size:"sm"}),value:c,onChange:j=>a(j.target.value),style:{fontSize:"14px"}})}),e.jsx(x.Box,{direction:"column",className:"ts-filter-dropdown-options",style:{overflowY:"auto",maxHeight:"250px",paddingLeft:"8px",paddingRight:"8px"},children:t.isLoadingOptions?e.jsxs(x.Box,{style:{paddingTop:"40px",paddingBottom:"40px",display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:[e.jsx(B.Icon,{name:"Loading",size:"lg",style:{color:"var(--sa-background-brand, #04254f)",animation:"spin 1s linear infinite"}}),e.jsx(S.Text,{fontSize:"sm",color:"gray-500",style:{textAlign:"center",marginTop:"8px"},children:"Loading options..."})]}):m.length>0?e.jsx(x.Box,{direction:"column",style:{gap:"2px",paddingTop:"4px",paddingBottom:"4px"},children:m.map(j=>e.jsxs(x.Box,{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",paddingTop:"8px",paddingBottom:"8px",paddingLeft:"8px",paddingRight:"8px",cursor:"pointer",borderRadius:"var(--sa-radii-md, 8px)",transition:"all 0.2s ease",backgroundColor:g.includes(j.value)?"var(--sa-color-brand-50, #e6edf6)":"transparent"},onClick:R=>{R.stopPropagation(),y(j.value)},onMouseEnter:R=>{g.includes(j.value)||(R.currentTarget.style.backgroundColor="var(--sa-background-primary, #ffffff)"),R.currentTarget.style.transform="translateX(2px)"},onMouseLeave:R=>{R.currentTarget.style.backgroundColor=g.includes(j.value)?"var(--sa-color-brand-50, #e6edf6)":"transparent",R.currentTarget.style.transform="translateX(0)"},children:[e.jsx(mt.Checkbox,{checked:g.includes(j.value),onChange:()=>{}}),e.jsx(S.Text,{fontSize:"sm",fontWeight:g.includes(j.value)?"medium":"normal",color:g.includes(j.value)?"primary":"gray-700",children:j.label})]},j.value))}):e.jsxs(x.Box,{style:{paddingTop:"40px",paddingBottom:"40px",display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:[e.jsx(B.Icon,{name:"Search",size:"lg",style:{color:"var(--sa-text-subtle, #8c8f97)"}}),e.jsx(S.Text,{fontSize:"sm",color:"gray-500",style:{textAlign:"center",marginTop:"8px"},children:"No results found"})]})}),g.length>0&&e.jsx(x.Box,{direction:"column",style:{paddingTop:"8px",paddingBottom:"8px",paddingLeft:"16px",paddingRight:"16px",borderTop:"1px solid var(--sa-border-subtle, #0b120e24)",backgroundColor:"var(--sa-color-brand-50, #e6edf6)",marginTop:"auto"},children:e.jsxs(x.Box,{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsx(x.Box,{direction:"column",style:{backgroundColor:"var(--sa-background-brand, #04254f)",borderRadius:"var(--sa-radii-lg, 12px)",padding:"2px 8px",fontSize:"11px",fontWeight:600,color:"white"},children:g.length}),e.jsxs(S.Text,{fontSize:"xs",color:"primary",fontWeight:"medium",children:["item",g.length>1?"s":""," selected"]})]})})]})]})},rc=({direction:t})=>{const r="var(--sa-text-primary, #292a2e)",n="var(--sa-text-subtle, #8c8f97)",s=t==="asc"?r:n,o=t==="desc"?r:n,i=t==="asc"?1:.45,l=t==="desc"?1:.45;return e.jsxs("span",{style:{display:"inline-flex",flexDirection:"column",alignItems:"center",justifyContent:"center",flexShrink:0,lineHeight:0},"aria-hidden":!0,children:[e.jsx("svg",{width:"8",height:"5",viewBox:"0 0 8 5",style:{color:s,opacity:i,marginBottom:1},children:e.jsx("path",{d:"M4 0 L8 5 L0 5 Z",fill:"currentColor"})}),e.jsx("svg",{width:"8",height:"5",viewBox:"0 0 8 5",style:{color:o,opacity:l},children:e.jsx("path",{d:"M0 0 L8 0 L4 5 Z",fill:"currentColor"})})]})},nc=({frozen:t})=>e.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:t?"currentColor":"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),e.jsx("path",{d:t?"M7 11V7a5 5 0 0 1 10 0v4":"M7 11V7a5 5 0 0 1 9.9-1"})]}),$r="var(--sa-background-primary, #ffffff)",po="var(--sa-background-primary-inverse, #f8f8f8)",ms=({columns:t,records:r,handleDetail:n,handleUpdate:s,handleDelete:o,isLoading:i,visibleHandleDelete:l,visibleHandleUpdate:c,visibleHandleDetail:a,showHeadBorder:d=!1,scrollParentRef:h,frozenCount:g=0,onFrozenCountChange:m,customActions:y,actionsOrder:D=["detail","update","delete","custom"],customEmptyState:j,enableColumnResize:R=!1,defaultColumnWidths:I,onColumnWidthsChange:M,defaultMinColumnWidth:C=60,sort:k,defaultSort:T,onSortChange:F,showActionDivider:v=!1})=>{const L=k!==void 0,[N,q]=u.useState(T??null),W=L?k??null:N,O=z=>{if(z.sortKey)return z.sortKey;if(typeof z.accessor=="string")return z.accessor},J=z=>{const Y=O(z);if(!Y)return;let G;!W||W.key!==Y?G={key:Y,direction:"asc"}:W.direction==="asc"?G={key:Y,direction:"desc"}:G=null,L||q(G),F==null||F(G)},X=[n,s,o].filter(z=>z!==void 0).length,$=!!y,ae=!!n||!!s||!!o||$,Z="var(--sa-border-subtle, #0b120e24)",ne=`1px solid ${Z}`,de=`inset 1px 0 0 ${Z}`,ve=`inset -1px 0 0 ${Z}`,Be=X===3?$?"178px":"140px":X===2?$?"140px":"102px":X===1?$?"112px":"74px":$?"74px":"",Ce=(z,Y)=>{if(!Y)return z;if(typeof Y=="function")return Y(z);if(typeof Y=="string")return z[Y]},[je,ge]=u.useState(!1);u.useEffect(()=>{if(!(h!=null&&h.current))return;const z=h.current;ge(z.scrollHeight>z.clientHeight)},[r,h]);const Oe=u.useRef(null),[$e,Le]=u.useState([]),[le,be]=u.useState(()=>I??{}),We=u.useRef(null);u.useLayoutEffect(()=>{if(!g||!Oe.current){Le([]);return}const z=Array.from(Oe.current.querySelectorAll("thead tr th")),Y=[];let G=0;z.forEach((xe,Ie)=>{Y[Ie]=G,Ie<g&&(G+=xe.offsetWidth)}),Le(Y)},[g,t,r,le]);const ue=z=>{m&&m(z<g?z:z+1)},se=(z,Y)=>{const G=le[z];if(G!==void 0){const xe=`${G}px`;return{width:xe,minWidth:xe,maxWidth:xe}}return Y?{width:Y}:{}},Pe=z=>R&&(z.resizable??!0),Ne=(z,Y)=>{z.preventDefault(),z.stopPropagation();const G=z.currentTarget.closest("th");if(!G)return;const xe=Math.round(G.getBoundingClientRect().width);We.current={colIndex:Y,startX:z.clientX,startWidth:xe};const Ie=document.body.style.userSelect,pe=document.body.style.cursor;document.body.style.userSelect="none",document.body.style.cursor="col-resize";const ze=Ve=>{var Ee;const qe=We.current;if(!qe)return;const Ct=((Ee=t[qe.colIndex])==null?void 0:Ee.minWidth)??C,Qe=Math.max(Ct,qe.startWidth+(Ve.clientX-qe.startX));be(He=>He[qe.colIndex]===Qe?He:{...He,[qe.colIndex]:Qe})},rt=()=>{document.removeEventListener("mousemove",ze),document.removeEventListener("mouseup",rt),document.body.style.userSelect=Ie,document.body.style.cursor=pe,We.current=null,M&&be(Ve=>(M(Ve),Ve))};document.addEventListener("mousemove",ze),document.addEventListener("mouseup",rt)};return e.jsx("div",{ref:Oe,children:e.jsxs(Q.Table,{fullWidth:!0,children:[e.jsx(Q.Thead,{style:{height:"40px",whiteSpace:"nowrap"},children:e.jsxs(Q.Tr,{children:[t.map((z,Y)=>{var St,ht;const G=g>0&&Y<g,xe=$e[Y]??0,Ie=Pe(z),ze=Y===t.length-1&&ae&&v,rt=O(z),Ve=!!z.sortable&&!!rt,qe=Ve&&(W==null?void 0:W.key)===rt?W.direction:null,Ct=z.title||((St=z.accessor)==null?void 0:St.toString())||"",Qe=(ht=z.headerTooltip)!=null&&ht.showIcon?e.jsx(B.Icon,{name:"InfoCircle",size:"xs",style:{flexShrink:0,color:"var(--sa-icon-subtle, #8c8f97)",opacity:.75}}):null,Ee=e.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Ct}),He=Ve?e.jsxs("button",{type:"button",onClick:()=>J(z),title:qe==="asc"?"Sorted ascending — click to sort descending":qe==="desc"?"Sorted descending — click to clear":"Click to sort ascending",style:{flex:1,minWidth:0,display:"flex",alignItems:"center",gap:4,background:"none",border:"none",padding:0,margin:0,font:"inherit",color:"inherit",cursor:"pointer",textAlign:z.textAlign==="text-right"?"right":z.textAlign==="text-center"?"center":"left"},children:[Ee,Qe,e.jsx(rc,{direction:qe})]}):e.jsxs("span",{style:{flex:1,minWidth:0,display:"flex",alignItems:"center",gap:4},children:[Ee,Qe]});return e.jsxs(Q.Th,{style:{position:"sticky",top:0,left:G?xe:void 0,zIndex:G?4:2,paddingLeft:Y===0?"12px":"",borderRight:d&&!ze&&!G?ne:void 0,borderBottom:d?ne:void 0,boxShadow:d&&G?ve:void 0,backgroundColor:"var(--sa-background-primary-inverse, #f8f8f8)",textAlign:z.textAlign==="text-right"?"right":z.textAlign==="text-center"?"center":"left",...se(Y,z.width)},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",justifyContent:"space-between",minWidth:0},children:[z.headerTooltip?e.jsx(Te.Tooltip,{label:z.headerTooltip.content,position:"bottom",children:He}):He,z.filter&&e.jsx(fs,{filter:z.filter,columnTitle:z.title}),m&&e.jsx("button",{onClick:()=>ue(Y),title:G?"Unfreeze column":"Freeze column",style:{background:"none",border:"none",cursor:"pointer",padding:"2px",display:"flex",alignItems:"center",flexShrink:0,color:G?"var(--sa-background-brand, #04254f)":"var(--sa-text-subtle, #8c8f97)",opacity:G?1:.45,transition:"opacity 0.15s"},children:e.jsx(nc,{frozen:G})})]}),Ie&&e.jsx("div",{onMouseDown:kt=>Ne(kt,Y),onClick:kt=>kt.stopPropagation(),role:"separator","aria-orientation":"vertical",title:"Drag to resize",style:{position:"absolute",top:0,right:-3,width:6,height:"100%",cursor:"col-resize",userSelect:"none",zIndex:5,touchAction:"none"}})]},`table-head-${Y}`)}),ae?e.jsx(Q.Th,{style:{backgroundColor:"var(--sa-background-primary-inverse, #f8f8f8)",position:"sticky",top:0,right:0,zIndex:3,borderBottom:d?ne:void 0,boxShadow:d&&v?de:void 0}}):null]})}),e.jsx(Q.Tbody,{children:i?e.jsx(Q.Tr,{children:e.jsx(Q.Td,{colSpan:t.length+1,children:e.jsxs(x.Box,{direction:"column",style:{gap:"16px"},children:[e.jsx(st.Skeleton,{variant:"list"}),e.jsx(st.Skeleton,{variant:"list"}),e.jsx(st.Skeleton,{variant:"list"}),e.jsx(st.Skeleton,{variant:"list"}),e.jsx(st.Skeleton,{variant:"list"})]})})}):!(r!=null&&r.length)&&j?e.jsx(Q.Tr,{children:e.jsx(Q.Td,{colSpan:t.length+1,children:j})}):r==null?void 0:r.map((z,Y)=>e.jsxs(Q.Tr,{style:{transition:"background-color 0.3s ease",padding:0,borderBottom:Y===r.length-1&&je?void 0:"1px solid var(--sa-border-subtle, #0b120e24)"},onMouseEnter:G=>{const xe=G.currentTarget;xe.style.backgroundColor=po,Array.from(xe.querySelectorAll("td")).forEach(Ie=>{Ie.style.position==="sticky"&&(Ie.style.backgroundColor=po)})},onMouseLeave:G=>{const xe=G.currentTarget;xe.style.backgroundColor="",Array.from(xe.querySelectorAll("td")).forEach(Ie=>{Ie.style.position==="sticky"&&(Ie.style.backgroundColor=$r)})},children:[t.map((G,xe)=>{const Ie=G.render?G.render(z,Y,r):Ce(z,G.accessor),pe=g>0&&xe<g,ze=$e[xe]??0,rt=le[xe]!==void 0,Ve=pe&&xe===g-1;return e.jsx(Q.Td,{style:{position:pe?"sticky":void 0,left:pe?ze:void 0,zIndex:pe?1:void 0,backgroundColor:pe?$r:void 0,transition:pe?"background-color 0.3s ease":void 0,paddingLeft:xe===0?"12px":"",whiteSpace:"nowrap",overflow:rt?"hidden":void 0,borderLeft:G.showBorderLeft?ne:void 0,borderRight:G.showBorderRight?ne:void 0,boxShadow:Ve?ve:void 0,textAlign:G.textAlign==="text-right"?"right":G.textAlign==="text-center"?"center":"left",...se(xe,G.width)},children:typeof Ie=="string"?e.jsx(S.Text,{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",textAlign:G.textAlign==="text-right"?"right":G.textAlign==="text-center"?"center":"left"},children:Ie}):Ie},`row-${Y}-col-${xe}`)}),ae?e.jsx(Q.Td,{style:{width:Be,position:"sticky",right:0,zIndex:1,backgroundColor:$r,boxShadow:v?de:void 0,transition:"background-color 0.3s ease"},children:e.jsx(fe.Flex,{direction:"row",align:"center",justify:"center",gap:"sm",children:D.map(G=>{const xe=Y===r.length-1?"top":"bottom";return G==="detail"&&n&&(a==null?void 0:a(z))!==!1?e.jsx(Te.Tooltip,{label:"Detail",position:xe,children:e.jsx(P.Button,{size:"xs",variant:"outline",tone:"neutral",onClick:()=>n(z.id,z),iconLeft:e.jsx(B.Icon,{name:"DocumentClean",size:"sm",style:{color:"var(--sa-text-subtle, #8c8f97)"}})})},"detail"):G==="update"&&s&&(c==null?void 0:c(z))!==!1?e.jsx(Te.Tooltip,{label:"Update",position:xe,children:e.jsx(P.Button,{size:"xs",variant:"outline",tone:"neutral",onClick:()=>s(z),iconLeft:e.jsx(B.Icon,{name:"Edit1",size:"sm",style:{color:"var(--sa-text-subtle, #8c8f97)"}})})},"update"):G==="delete"&&o&&(l==null?void 0:l(z))!==!1?e.jsx(Te.Tooltip,{label:"Delete",position:xe,children:e.jsx(P.Button,{size:"xs",variant:"outline",tone:"neutral",onClick:()=>o(z.id,z),iconLeft:e.jsx(B.Icon,{name:"Trash1",size:"sm",style:{color:"var(--sa-color-error-600, #c9184a)"}})})},"delete"):G==="custom"?e.jsx(u.Fragment,{children:y==null?void 0:y(z)},"custom"):null})})}):null]},`${z}${Y}`))})]})})};let yo=!1;const oc=({wrapperProps:t,dataTableProps:r,headerProps:n,footerProps:s})=>{var g;process.env.NODE_ENV!=="production"&&!yo&&(yo=!0,console.warn("[@starasia/admin] `TableSection` deprecated — pakai `<FilterBar>` + `<TableLayout>`. Lihat skill `starasia-list-page-pattern`. Akan dihapus di salah satu major berikutnya."));const o=u.useRef(null),[i,l]=u.useState((r==null?void 0:r.defaultFrozenCount)??0),c=(n==null?void 0:n.show)??!0,a=u.useRef(null),d=(g=r==null?void 0:r.pagination)==null?void 0:g.totalData;typeof d=="number"&&(a.current=d);const h=(s==null?void 0:s.showFooter)??(d===void 0?a.current!==0:d!==0);return e.jsxs(us,{...t,children:[c&&e.jsx(xs,{...n}),e.jsx(x.Box,{direction:"column",ref:o,style:{flex:1,overflowY:"auto",overflowX:"auto"},children:r?e.jsx(ms,{...r,scrollParentRef:o,frozenCount:r!=null&&r.enableFreezeColumns?i:0,onFrozenCountChange:r!=null&&r.enableFreezeColumns?l:void 0}):null}),h&&e.jsx(hs,{pagination:r==null?void 0:r.pagination,pageKey:r==null?void 0:r.pageKey,perPageKey:r==null?void 0:r.perPageKey,defaultPerPage:r==null?void 0:r.defaultPerPage,showPagination:r==null?void 0:r.showPagination,totalData:s==null?void 0:s.totalData})]})};function sc(t){return u.memo(t)}const ic=sc(oc),gs="(any-pointer: coarse)",lc=t=>{if(typeof window>"u"||!window.matchMedia)return()=>{};const r=window.matchMedia(gs);return r.addEventListener("change",t),()=>r.removeEventListener("change",t)},cc=()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia(gs).matches,ac=()=>!1;function ps(){return u.useSyncExternalStore(lc,cc,ac)}const bo=200,yr="1px solid var(--sa-border-subtle, #0b120e24)",dc=({sortDir:t,frozen:r,filterActive:n})=>t==="asc"?e.jsx(B.Icon,{name:"ChevronSmallUp"}):t==="desc"?e.jsx(B.Icon,{name:"ChevronSmallDown"}):r?e.jsx(B.Icon,{name:"LockOn",size:"xs"}):e.jsx(B.Icon,{name:"Filter",size:"xs",style:n?{color:"var(--sa-text-brand, #031f43)"}:void 0}),br=({icon:t,label:r,active:n,danger:s,onClick:o})=>{const i=s?"var(--sa-text-error, #a4133c)":"var(--sa-text-primary, #292a2e)";return e.jsxs("button",{type:"button",onClick:o,style:{display:"flex",alignItems:"center",gap:12,width:"100%",padding:"8px 12px",background:n?"var(--sa-background-brand-subtlest, #e6edf6)":"none",border:"none",cursor:"pointer",font:"inherit",color:i,textAlign:"left"},onMouseEnter:l=>{n||(l.currentTarget.style.background="var(--sa-background-primary-inverse, #f8f8f8)")},onMouseLeave:l=>{l.currentTarget.style.background=n?"var(--sa-background-brand-subtlest, #e6edf6)":"none"},children:[e.jsx(B.Icon,{name:t,size:"sm",style:{color:i,flexShrink:0}}),e.jsx(S.Text,{as:"span",style:{color:i},children:r})]})},uc=t=>{let r=(t==null?void 0:t.parentElement)??null;for(;r;){const n=getComputedStyle(r).overflowX;if((n==="auto"||n==="scroll")&&r.scrollWidth>r.clientWidth)return r;r=r.parentElement}return null},ys=({active:t,canSort:r,canHide:n,sortDir:s,frozen:o,onSort:i,onClearSort:l,onToggleFreeze:c,onHide:a,filterSlot:d,filterActive:h})=>{const[g,m]=u.useState(!1),y=u.useRef(null),D=u.useRef(null),[j,R]=u.useState({top:0,left:0}),I=u.useCallback(()=>{var W;const C=y.current;if(!C)return;const k=C.getBoundingClientRect(),T=C.closest(".sa-tl-scroll")??uc(C),F=T==null?void 0:T.getBoundingClientRect();if(F&&(k.left<F.left||k.left>F.right)){m(!1);return}const v=Math.min(window.innerWidth-8,F?F.right:window.innerWidth),L=((W=D.current)==null?void 0:W.offsetWidth)||bo,N=F?F.left:8,q=Math.max(N,Math.min(k.left,v-L));R({top:k.bottom+6,left:q})},[]);u.useEffect(()=>{if(!g)return;I();const C=()=>I();return window.addEventListener("scroll",C,!0),window.addEventListener("resize",C),()=>{window.removeEventListener("scroll",C,!0),window.removeEventListener("resize",C)}},[g,I]),u.useEffect(()=>{if(!g)return;const C=k=>{D.current&&!D.current.contains(k.target)&&y.current&&!y.current.contains(k.target)&&m(!1)};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[g]);const M=C=>{C(),m(!1)};return e.jsxs(e.Fragment,{children:[e.jsx("button",{ref:y,type:"button",className:"sa-tl-menu-trigger","data-active":t||g?"true":"false",onClick:C=>{C.stopPropagation(),m(k=>!k)},title:"Column options",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:22,height:22,borderRadius:"var(--sa-radii-sm, 6px)",border:yr,background:"var(--sa-background-primary, #ffffff)",cursor:"pointer",color:"var(--sa-text-subtle, #8c8f97)",flexShrink:0},children:e.jsx(dc,{sortDir:s,frozen:o,filterActive:h})}),g&&e.jsxs(x.Box,{ref:D,onClick:C=>C.stopPropagation(),style:{position:"fixed",top:`${j.top}px`,...j.left!==void 0?{left:`${j.left}px`}:{right:`${j.right}px`},minWidth:bo,backgroundColor:"var(--sa-background-primary, #ffffff)",border:yr,borderRadius:"var(--sa-radii-sm, 6px)",boxShadow:"var(--sa-shadow-xl, 0 20px 25px -5px #0000001a, 0 8px 10px -6px #0000001a)",zIndex:9999,padding:"4px",display:"flex",flexDirection:"column"},children:[d!=null&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{padding:"6px 12px 2px"},children:e.jsx(S.Text,{as:"span",style:{fontSize:12,fontWeight:500,color:"var(--sa-text-subtlest, #8c8f97)"},children:"Filter"})}),e.jsx("div",{style:{padding:"2px 8px 4px"},children:d}),e.jsx("div",{style:{borderTop:yr,margin:"4px 0"}})]}),r&&e.jsxs(e.Fragment,{children:[e.jsx(br,{icon:"ChevronUp",label:"Ascending",active:s==="asc",onClick:()=>M(()=>s==="asc"?l():i("asc"))}),e.jsx(br,{icon:"ChevronDown",label:"Descending",active:s==="desc",onClick:()=>M(()=>s==="desc"?l():i("desc"))}),e.jsx("div",{style:{borderTop:yr,margin:"4px 0"}})]}),e.jsx(br,{icon:"Pin1",label:o?"Unfreeze":"Freeze",active:o,onClick:()=>M(c)}),n&&e.jsx(br,{icon:"EyeClosed",label:"Hide column",danger:!0,onClick:()=>M(a)})]})]})},xc=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),hc={background:"var(--sa-background-warning-subtlest, #fef2e6)",color:"inherit",padding:0,borderRadius:"min(2px, var(--sa-radii-xs, 4px))"},bs=({text:t,query:r,markStyle:n})=>{const s=r==null?void 0:r.trim();if(!s||!t)return e.jsx(e.Fragment,{children:t});const o=s.split(/\s+/).filter(Boolean);if(!o.length)return e.jsx(e.Fragment,{children:t});const i=new Set(o.map(a=>a.toLowerCase())),l=new RegExp(`(${o.map(xc).join("|")})`,"gi"),c=t.split(l);return e.jsx(e.Fragment,{children:c.map((a,d)=>a&&i.has(a.toLowerCase())?e.jsx("mark",{style:{...hc,...n},children:a},d):e.jsx(u.Fragment,{children:a},d))})},er="1px solid var(--sa-border-subtle, #0b120e24)",fc="var(--sa-text-subtle, #8c8f97)",_t="var(--sa-background-neutral, #f0f1f2)",jo="2px 0 4px -2px var(--sa-border-subtle, #0b120e24)",tr=40,Jr=5,mc=28,Kr=4,jr=16,en="var(--sa-background-brand-subtlest)",vr={display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},vo="sa-table-layout-styles",gc=()=>{if(typeof document>"u"||document.getElementById(vo))return;const t=document.createElement("style");t.id=vo,t.textContent=`@layer starasia.components {
|
|
2
2
|
.sa-table-layout tbody td {
|
|
3
3
|
transition: background-color 0.15s ease;
|
|
4
4
|
background-color: var(--sa-tl-bg, transparent);
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
.sa-table-layout tfoot.sa-tl-sticky-foot > tr:first-child > th {
|
|
50
50
|
box-shadow: 0 -2px 4px -2px var(--sa-border-subtle, #0b120e24);
|
|
51
51
|
}
|
|
52
|
-
}`,document.head.appendChild(t)},_t=t=>t==="right"?"right":t==="center"?"center":"left",oc=/^(#|rgb|hsl|var\()/,dr=t=>t?oc.test(t)?t:`var(--sa-background-${t})`:void 0,sc=(t,r)=>{if(r)return t[r]},ic=(t,r)=>t==null&&r==null?0:t==null?-1:r==null?1:typeof t=="number"&&typeof r=="number"?t-r:String(t).localeCompare(String(r)),lc=({columns:t,data:r,getRowKey:n,rowBg:s,size:o="md",resizable:i=!1,layout:l="auto",widthStorageKey:c,columnState:a,onColumnStateChange:d,columnMenu:h=!1,highlight:g,sort:m,defaultSort:y,onSortChange:b,height:C,mobileLayout:O="cards",mobileBreakpoint:M="md",groupSeparator:L,summary:j,footer:D,stickyFooter:R=!1,emptyState:B,loading:S=!1,loadingRows:T=8,rowActions:P,rowActionsMode:X="auto",selectable:I=!1,selectedKeys:N,defaultSelectedKeys:Y,onSelectionChange:G,isRowSelectable:J})=>{nc();const le=!ke.useMediaQuery(M)&&O!=="scroll",q=!!(P!=null&&P.length),K=cs(),ae=q&&(X==="column"||X==="auto"&&K),ge=Math.min((P==null?void 0:P.length)??0,Vr+1),Ie=ge>Vr?1:ge,Ee=cr*2+Ie*rc+Math.max(0,Ie-1)*qr,ye=ae?Ee:1,[fe,Ne]=u.useState(null);u.useEffect(()=>{if(!fe)return;const p=()=>Ne(null),v=setTimeout(()=>document.addEventListener("click",p),0);return()=>{clearTimeout(v),document.removeEventListener("click",p)}},[fe]);const[Te,Ve]=u.useState(()=>new Set),oe=a!==void 0,[we,be]=u.useState({}),re=a??we,Be=p=>{d==null||d(p),oe||be(p)},Je=m!==void 0,[et,W]=u.useState(y??null),Q=Je?m??null:et,U=!b,ue=p=>{b==null||b(p),Je||W(p)},{headerGroups:Fe,leafColumns:me,hasGroups:Ae}=u.useMemo(()=>{var se;const p=new Set(re.hidden??[]),v=(ne,ve)=>ne.key??(typeof ne.accessor=="string"?ne.accessor:`col-${ve}`),F=t.map((ne,ve)=>{var Ke;if((Ke=ne.children)!=null&&Ke.length){const zt=ne.children.map((ot,Et)=>({col:ot,key:v(ot,`${ve}-${Et}`)})).filter(ot=>!p.has(ot.key));return{col:ne,key:ne.key??`group-${ve}`,isGroup:!0,leaves:zt}}const Ce={col:ne,key:v(ne,`${ve}`)};return{col:ne,key:Ce.key,isGroup:!1,leaves:p.has(Ce.key)?[]:[Ce]}}).filter(ne=>ne.leaves.length>0),_=F.some(ne=>ne.isGroup);let ee=F.flatMap(ne=>ne.leaves);if(!_&&((se=re.order)!=null&&se.length)){const ne=new Map(re.order.map((ve,Ce)=>[ve,Ce]));ee=[...ee].sort((ve,Ce)=>(ne.get(ve.key)??1/0)-(ne.get(Ce.key)??1/0))}return{headerGroups:F,leafColumns:ee,hasGroups:_}},[t,re]),$e=u.useMemo(()=>new Map(me.map((p,v)=>[p.key,v])),[me]),Ge=!Ae&&me.some(p=>(p.col.headerColSpan??1)>1),We=me.map(p=>p.key).join("|"),Qe=(p,v)=>{const F=p.sortKey??(typeof p.accessor=="string"?p.accessor:void 0);return F?v[F]:void 0},gt=p=>p.sortable??(!!p.sortKey||typeof p.accessor=="string"),De=u.useMemo(()=>{if(!U||!Q)return r;const p=me.find(F=>F.key===Q.key);if(!p)return r;const v=Q.direction==="asc"?1:-1;return[...r].sort((F,_)=>ic(Qe(p.col,F),Qe(p.col,_))*v)},[r,U,Q,me]),ze=!Ae&&!Ge,dt=!!c&&ze,[Dt,tt]=Z.useColumnWidths(c??""),jt=dt?Dt:void 0,pt=u.useRef(null),[He,Ut]=u.useState();u.useLayoutEffect(()=>{Ut(void 0)},[We]),u.useLayoutEffect(()=>{if(!ze||He||!pt.current)return;const p=pt.current.querySelectorAll("th.sa-tl-leaf");Ut(Array.from(p).map(v=>v.offsetWidth))},[He,ze]);const[Yt,qe]=u.useState(),[Xt,Jt]=u.useState(0);u.useLayoutEffect(()=>{if(!Ae||!pt.current)return;const p=pt.current.querySelector(":scope > tr");p&&Jt(p.offsetHeight)},[Ae,We]);const St=(p,v)=>{if((jt==null?void 0:jt[v])!=null)return jt[v];if(p.width!=null)return p.width;if((He==null?void 0:He[v])!=null)return He[v]},Br=(p,v)=>typeof p.width=="number"?p.width:He==null?void 0:He[v],Ct=re.frozenKey&&!Ae&&!Ge?me.findIndex(p=>p.key===re.frozenKey):-1,$t=p=>p<=Ct,kt=I?Pt:0,At=p=>{const v=Yt??He;if(!v)return kt;let F=kt;for(let _=0;_<p;_++)F+=v[_]??0;return F};u.useLayoutEffect(()=>{const p=pt.current;if(!p||Ct<0){qe(void 0);return}let v=0;const F=()=>{v=0;const ee=p.querySelectorAll("th.sa-tl-leaf"),se=Array.from(ee).map(ne=>ne.getBoundingClientRect().width);qe(ne=>ne&&ne.length===se.length&&ne.every((ve,Ce)=>Math.abs(ve-se[Ce])<.5)?ne:se)},_=new ResizeObserver(()=>{v||(v=requestAnimationFrame(F))});return _.observe(p),p.querySelectorAll("th.sa-tl-leaf").forEach(ee=>_.observe(ee)),F(),()=>{v&&cancelAnimationFrame(v),_.disconnect()}},[We,Ct,I,He,jt]);const Bt=u.useRef(null),[Kt,k]=u.useState("100vh");u.useLayoutEffect(()=>{if(C!==void 0)return;const p=()=>{if(Bt.current){const v=Bt.current.getBoundingClientRect().top;k(`calc(100vh - ${v}px - var(--sa-floating-footer-height, 0px) + 12px)`)}};return p(),window.addEventListener("resize",p),()=>window.removeEventListener("resize",p)},[C]);const z=(p,v)=>n?n(p,v):v,V=N!==void 0,[ie,he]=u.useState(()=>new Set(Y??[])),je=u.useMemo(()=>V?new Set(N):ie,[V,N,ie]);u.useEffect(()=>{I&&!n&&process.env.NODE_ENV!=="production"&&console.warn("[@starasia/admin] TableLayout: `selectable` tanpa `getRowKey` — key default (index) membuat seleksi menempel ke POSISI baris, bukan datanya. Beri `getRowKey` yang stabil (mis. r => r.id).")},[I,!n]);const Me=p=>{if(V||he(p),G){const v=De.filter((F,_)=>p.has(z(F,_)));G(Array.from(p),v)}},Pe=(p,v)=>I&&(J?J(p,v):!0),Ue=p=>{const v=new Set(je);v.has(p)?v.delete(p):v.add(p),Me(v)},Ye=u.useMemo(()=>I?De.map((p,v)=>({row:p,i:v,key:z(p,v)})).filter(({row:p,i:v})=>J?J(p,v):!0).map(({key:p})=>p):[],[I,De,J,n]),ut=Ye.filter(p=>je.has(p)),yt=Ye.length>0&&ut.length===Ye.length,xt=ut.length>0&&!yt,Wt=()=>{const p=new Set(je);yt?Ye.forEach(v=>p.delete(v)):Ye.forEach(v=>p.add(v)),Me(p)},ht=(p,v,F)=>{const _=p.render?p.render(v,F,De):sc(v,p.accessor);if(g&&!p.render&&typeof _=="string"){const ee=p.key??(typeof p.accessor=="string"?p.accessor:void 0),se=ee?g[ee]:void 0;if(se)return e.jsx(ds,{text:_,query:se})}return _},Er=me.length+(I?1:0)+(q?1:0),vn=["80%","55%","70%","45%","90%","60%"],vs=(p,v)=>vn[(p*7+v*3)%vn.length],Cs=(p,v)=>e.jsx(rt.Skeleton,{height:14,width:vs(p,v),borderRadius:"rounded-sm"}),ws=Array.from({length:T},(p,v)=>e.jsxs(Z.Tr,{children:[I&&e.jsx(Z.Td,{style:{width:Pt,padding:0},children:e.jsx("div",{style:{display:"flex",justifyContent:"center"},children:e.jsx(rt.Skeleton,{height:14,width:14,borderRadius:"rounded-sm"})})}),me.map(({col:F,key:_},ee)=>e.jsx(Z.Td,{style:{textAlign:_t(F.align)},children:Cs(v,ee)},`sa-tl-sk-${v}-${_}`)),q&&e.jsx(Z.Td,{style:{width:ye,padding:0,border:"none"}})]},`sa-tl-sk-${v}`)),Ds=(p,v)=>{v||Be({...re,hidden:[...re.hidden??[],p]})},Ss=p=>Be({...re,frozenKey:re.frozenKey===p?void 0:p}),er=p=>(P??[]).filter(v=>{var F;return!((F=v.hidden)!=null&&F.call(v,p))}),Cn=ae?{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:qr,paddingLeft:cr,paddingRight:cr,height:"100%"}:{position:"absolute",right:0,top:0,bottom:0,display:"flex",alignItems:"center",gap:qr,paddingRight:cr,paddingLeft:40,background:"linear-gradient(to right, transparent, var(--sa-background-primary-inverse, #f8f8f8) 40px)"},tr=(p,v,F,_)=>{var Ke;const ee=(Ke=p.disabled)==null?void 0:Ke.call(p,v),se=(_==null?void 0:_.showLabel)??p.showLabel,ne=(_==null?void 0:_.size)??"xs",ve=e.jsx(H.Button,{size:ne,variant:p.variant??"tertiary",tone:p.tone??"neutral",disabled:ee,onClick:()=>p.onClick(v,F),iconLeft:p.icon?e.jsx(E.Icon,{name:p.icon,size:"sm"}):void 0,children:se&&p.label}),Ce=p.tooltip;return Ce?e.jsx(Le.Tooltip,{label:Ce,position:"top-end",children:ve}):ve},ks=(p,v)=>{const F=er(p);if(!F.length)return null;if(F.length>Vr){const ee=z(p,v),se=(fe==null?void 0:fe.rowKey)===ee;return e.jsx("div",{className:"sa-tl-row-actions","data-mode":ae?"column":"overlay",style:Cn,onClick:ne=>ne.stopPropagation(),children:e.jsx(Le.Tooltip,{label:"Aksi lainnya",position:"top",children:e.jsx(H.Button,{size:"xs",variant:"tertiary",onClick:ne=>{const ve=ne.currentTarget.getBoundingClientRect();Ne(se?null:{rowKey:ee,top:ve.bottom+4,right:window.innerWidth-ve.right})},children:e.jsx(E.Icon,{name:"MenuVertical",size:"sm"})})})})}return e.jsx("div",{className:"sa-tl-row-actions","data-mode":ae?"column":"overlay",style:Cn,children:F.map(ee=>e.jsx(u.Fragment,{children:tr(ee,p,v)},ee.key))})},Bs=(p,v)=>{const F=er(p);return F.length?e.jsx("div",{style:{display:"flex",gap:6,flexWrap:"wrap",paddingTop:8,marginTop:8,borderTop:Ht},children:F.map(_=>e.jsx(u.Fragment,{children:tr(_,p,v,{showLabel:!0,size:"sm"})},_.key))}):null},Es=(p,v)=>{const F=er(p);return F.length?e.jsx("div",{style:{display:"flex",gap:4,paddingRight:8,flexShrink:0},children:F.map(_=>e.jsx(u.Fragment,{children:tr(_,p,v,{showLabel:!1})},_.key))}):null},Fr=(p,v)=>{var Et;const{col:F,key:_}=p,ee=$e.get(_)??0,se=$t(ee),ne=se&&ee===Ct,ve=(Q==null?void 0:Q.key)===_?Q.direction:null,Ce=h&&!F.disableMenu?e.jsx(as,{active:!!ve||se||!!F.filterActive,canSort:gt(F),canHide:!F.locked,sortDir:ve,frozen:se,onSort:nr=>ue({key:_,direction:nr}),onClearSort:()=>ue(null),onToggleFreeze:()=>Ss(_),onHide:()=>Ds(_,F.locked),filterSlot:(Et=F.renderFilter)==null?void 0:Et.call(F),filterActive:F.filterActive}):null,Ke=F.align==="right",zt=F.align==="right"?"flex-end":F.align==="center"?"center":"flex-start",ot=e.jsxs("span",{style:{flex:1,minWidth:0,display:"flex",alignItems:"center",gap:6,justifyContent:zt,overflow:"hidden"},children:[F.icon&&e.jsx(E.Icon,{name:F.icon,size:"sm",style:{flexShrink:0}}),e.jsx("span",{style:ar,children:F.title})]});return e.jsx(Z.Th,{className:`sa-tl-leaf${se?" sa-tl-frozen":""}`,rowSpan:v==null?void 0:v.rowSpan,colSpan:v==null?void 0:v.colSpan,minWidth:F.minWidth,numeric:F.numeric,resizable:ze?F.resizable:!1,defaultWidth:Br(F,ee),style:{textAlign:_t(F.align),width:St(F,ee),position:"sticky",top:(v==null?void 0:v.top)??0,left:se?At(ee):void 0,zIndex:se?3:2,backgroundColor:Ft,boxShadow:ne?uo:void 0},children:e.jsx("div",{style:{display:"flex",alignItems:"center",gap:6,width:"100%"},children:Ke?e.jsxs(e.Fragment,{children:[Ce,ot]}):e.jsxs(e.Fragment,{children:[ot,Ce]})})},`th-${_}`)},Fs=()=>{const p=[];for(let v=0;v<me.length;){const F=me[v],_=F.col.headerColSpan??1,ee=Math.max(1,Math.min(_,me.length-v));p.push(Fr(F,ee>1?{colSpan:ee}:void 0)),v+=ee}return p},wn=p=>e.jsx(Z.Th,{rowSpan:p==null?void 0:p.rowSpan,style:{width:Pt,position:"sticky",top:0,left:0,zIndex:4,backgroundColor:Ft,padding:0},children:e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},onClick:v=>v.stopPropagation(),children:e.jsx(ft.Checkbox,{size:"sm",variant:xt?"indeterminate":"select",checked:yt||xt,disabled:Ye.length===0,onChange:Wt,"aria-label":"Pilih semua baris di halaman ini"})})},"th-select"),Is=(p,v,F)=>{const _=z(p,v);return e.jsx(Z.Td,{className:"sa-tl-frozen",style:{width:Pt,padding:0,position:"sticky",left:0,zIndex:2,...F?{"--sa-tl-bg":F}:{}},children:Pe(p,v)&&e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},onClick:ee=>ee.stopPropagation(),children:e.jsx(ft.Checkbox,{size:"sm",checked:je.has(_),onChange:()=>Ue(_),"aria-label":"Pilih baris"})})},`tl-select-${v}`)},Ir=me.filter(p=>!p.col.hideOnMobile),Mr=Ir.find(p=>p.col.primary)??Ir[0],Ms=Ir.filter(p=>p!==Mr),Ls=p=>Ve(v=>{const F=new Set(v);return F.has(p)?F.delete(p):F.add(p),F}),Dn=(p,v)=>Ms.map(({col:F,key:_})=>{const ee=ht(F,p,v),se={minWidth:0,overflow:"hidden",textOverflow:"ellipsis",textAlign:"right",...F.numeric?{fontVariantNumeric:"tabular-nums"}:{}},ne=typeof ee=="string"||typeof ee=="number"?e.jsx(w.Text,{style:se,children:ee}):e.jsx("div",{style:se,children:ee});return e.jsxs("div",{style:{display:"flex",gap:12,justifyContent:"space-between",alignItems:"baseline"},children:[typeof F.title=="string"?e.jsx(w.Text,{color:"subtle",fontWeight:"medium",style:{color:tc,flexShrink:0},children:F.title}):e.jsx("div",{style:{flexShrink:0},children:F.title}),ne]},_)}),Lr=(p,v)=>{const F=Mr?ht(Mr.col,p,v):null;return typeof F=="string"||typeof F=="number"?e.jsx(w.Text,{as:"span",style:ar,children:F}):e.jsx("span",{style:ar,children:F})},Ts=e.jsx(x.Box,{style:{display:"flex",flexDirection:"column",gap:8,padding:8},children:Array.from({length:T},(p,v)=>e.jsxs(x.Box,{style:{border:Ht,borderRadius:"var(--sa-radii-sm, 6px)",padding:12,display:"flex",flexDirection:"column",gap:8},children:[e.jsx(rt.Skeleton,{height:16,width:"60%",borderRadius:"rounded-sm"}),e.jsx(rt.Skeleton,{height:12,width:"85%",borderRadius:"rounded-sm"}),e.jsx(rt.Skeleton,{height:12,width:"70%",borderRadius:"rounded-sm"})]},`sa-tl-sk-card-${v}`))}),Sn=e.jsx(x.Box,{fullWidth:!0,style:{minHeight:(B==null?void 0:B.minHeight)??320,display:"flex",alignItems:"center",justifyContent:"center",padding:16},children:B==null?void 0:B.content}),Rs=S?Ts:De.length===0?Sn:O==="expand"?e.jsx(x.Box,{style:{display:"flex",flexDirection:"column"},children:De.map((p,v)=>{const F=z(p,v),_=Te.has(F),se=I&&je.has(F)?Zr:dr(s==null?void 0:s(p,v));return e.jsxs("div",{style:{borderBottom:Ht,backgroundColor:se},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[Pe(p,v)&&e.jsx("div",{style:{display:"flex",alignItems:"center",paddingLeft:12,flexShrink:0},children:e.jsx(ft.Checkbox,{size:"sm",checked:je.has(F),onChange:()=>Ue(F),"aria-label":"Pilih baris"})}),e.jsxs("button",{type:"button",onClick:()=>Ls(F),style:{flex:1,minWidth:0,display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,padding:"10px 12px",background:"none",border:"none",font:"inherit",color:"inherit",cursor:"pointer",textAlign:"left"},children:[Lr(p,v),e.jsx(E.Icon,{name:_?"ChevronUp":"ChevronDown",size:"sm",style:{flexShrink:0}})]}),q&&Es(p,v)]}),_&&e.jsx("div",{style:{padding:"0 12px 12px",display:"flex",flexDirection:"column",gap:6},children:Dn(p,v)})]},F)})}):e.jsx(x.Box,{style:{display:"flex",flexDirection:"column",gap:8,padding:8},children:De.map((p,v)=>{const F=z(p,v),_=I&&je.has(F);return e.jsxs(x.Box,{style:{border:Ht,borderRadius:"var(--sa-radii-sm, 6px)",padding:12,display:"flex",flexDirection:"column",gap:6,backgroundColor:_?Zr:dr(s==null?void 0:s(p,v))},children:[Pe(p,v)?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(ft.Checkbox,{size:"sm",checked:je.has(F),onChange:()=>Ue(F),"aria-label":"Pilih baris"}),e.jsx("div",{style:{flex:1,minWidth:0},children:Lr(p,v)})]}):Lr(p,v),Dn(p,v),q&&Bs(p,v)]},F)})}),Os=i&&ze&&He!==void 0,kn=l==="fixed"&&!i&&(ze?He!==void 0:!0),As=kn&&!ze,rr=D&&D.length>0?D.map((p,v)=>e.jsx(Z.Tr,{children:p.cells.map((F,_)=>e.jsx(Z.Td,{colSpan:F.colSpan,rowSpan:F.rowSpan,numeric:F.numeric,style:{textAlign:_t(F.align)},children:F.content},`tl-foot-${v}-${_}`))},`tl-foot-${v}`)):null,Ws=e.jsxs(Z.Table,{className:"sa-table-layout",fullWidth:!0,size:o,resizable:Os,style:kn?{tableLayout:"fixed"}:void 0,onWidthsChange:dt?tt:void 0,children:[As&&e.jsxs("colgroup",{children:[I&&e.jsx("col",{style:{width:Pt}}),me.map(({col:p,key:v},F)=>e.jsx("col",{style:{width:St(p,F)}},`col-${v}`)),q&&e.jsx("col",{style:{width:ye}})]}),e.jsx(Z.Thead,{ref:pt,children:Ae?e.jsxs(e.Fragment,{children:[e.jsxs(Z.Tr,{children:[I&&wn({rowSpan:2}),Fe.map(p=>p.isGroup?e.jsx(Z.Th,{colSpan:p.leaves.length,style:{textAlign:"center",position:"sticky",top:0,zIndex:2,backgroundColor:Ft},children:e.jsx("span",{style:ar,children:p.col.title})},`grp-${p.key}`):Fr(p.leaves[0],{rowSpan:2})),q&&e.jsx(Z.Th,{rowSpan:2,style:{position:"sticky",top:0,right:0,zIndex:3,width:ye,padding:0,border:"none",backgroundColor:Ft}})]}),e.jsx(Z.Tr,{children:Fe.flatMap(p=>p.isGroup?p.leaves.map(v=>Fr(v,{top:Xt})):[])})]}):e.jsxs(Z.Tr,{children:[I&&wn(),Fs(),q&&e.jsx(Z.Th,{style:{position:"sticky",top:0,right:0,zIndex:3,width:ye,padding:0,border:"none",backgroundColor:Ft}})]})}),e.jsx(Z.Tbody,{children:S?ws:De.length===0?e.jsx(Z.Tr,{children:e.jsx(Z.Td,{colSpan:Er,children:Sn})}):e.jsxs(e.Fragment,{children:[De.map((p,v)=>{const F=L==null?void 0:L(p,v,v>0?De[v-1]:void 0),ee=I&&je.has(z(p,v))?Zr:dr(s==null?void 0:s(p,v));return e.jsxs(u.Fragment,{children:[F!=null&&F!==!1&&e.jsx(Z.Tr,{children:e.jsx(Z.Td,{colSpan:Er,style:{backgroundColor:Ft},children:F})}),e.jsxs(Z.Tr,{children:[I&&Is(p,v,ee),me.map(({col:se,key:ne},ve)=>{var Bn;const Ce=(Bn=se.cellProps)==null?void 0:Bn.call(se,p,v,De);if(Ce!=null&&Ce.hidden)return null;const Ke=$t(ve),zt=Ke&&ve===Ct,ot=ht(se,p,v),Et=typeof se.bg=="function"?se.bg(p,v,De):se.bg,nr=dr(Et)??ee;return e.jsx(Z.Td,{className:Ke?"sa-tl-frozen":void 0,colSpan:Ce==null?void 0:Ce.colSpan,rowSpan:Ce==null?void 0:Ce.rowSpan,numeric:se.numeric,style:{textAlign:_t(se.align),width:St(se,ve),minWidth:se.minWidth,position:Ke?"sticky":void 0,left:Ke?At(ve):void 0,zIndex:Ke?1:void 0,boxShadow:zt?uo:void 0,...nr?{"--sa-tl-bg":nr}:{}},children:typeof ot=="string"?e.jsx(w.Text,{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",textAlign:_t(se.align)},children:ot}):ot},`tl-cell-${v}-${ne}`)}),q&&e.jsx(Z.Td,{className:ae?"sa-tl-frozen":void 0,style:{position:"sticky",right:0,width:ye,padding:0,overflow:ae?void 0:"visible",zIndex:2,border:"none"},children:ks(p,v)})]})]},z(p,v))}),j!=null&&e.jsx(Z.Tr,{children:e.jsx(Z.Td,{colSpan:Er,children:j})})]})}),rr&&e.jsx(Z.Tfoot,{className:R?"sa-tl-sticky-foot":void 0,children:rr})]}),Tr=fe?De.findIndex((p,v)=>z(p,v)===fe.rowKey):-1,Rr=Tr>=0?De[Tr]:null;return e.jsxs(e.Fragment,{children:[e.jsx(x.Box,{ref:Bt,className:"sa-tl-scroll",fullWidth:!0,style:{overflow:"auto",height:C??Kt},children:le?e.jsxs(e.Fragment,{children:[Rs,rr&&!S&&De.length>0&&e.jsx(x.Box,{style:{borderTop:Ht},children:e.jsx(Z.Table,{fullWidth:!0,size:o,className:"sa-table-layout",children:e.jsx(Z.Tbody,{children:rr})})})]}):Ws}),fe&&Rr&&e.jsx("div",{className:"sa-tl-kebab-menu",style:{top:fe.top,right:fe.right},onClick:p=>p.stopPropagation(),children:er(Rr).map(p=>e.jsx("div",{style:{padding:"2px 4px"},children:tr(p,Rr,Tr,{showLabel:!0,size:"sm"})},p.key))})]})},Gr=t=>t==="asc"||t==="desc",cc=(t={})=>{const{sortKeyParam:r="sortBy",sortOrderParam:n="sortOrder",pageKey:s="page",defaultSort:o=null,paramKeys:i,scopeId:l,storage:c=bn}=t,{searchParams:a,setSearchParams:d,searchQueries:h}=Ze(),g=a.toString(),m=l?Ot.tableSort(l):void 0,y=u.useRef(!1);u.useEffect(()=>{if(y.current||(y.current=!0,!m)||a.has(r)||a.has(n))return;const j=c.get(m);!(j!=null&&j.key)||!Gr(j.direction)||d({...Object.fromEntries(a.entries()),[r]:j.key,[n]:j.direction},{replace:!0})},[]);const b=u.useMemo(()=>{const j=a.get(r),D=a.get(n);return j&&Gr(D)?{key:j,direction:D}:o},[g,r,n,o]);u.useEffect(()=>{if(!m)return;const j=a.get(r),D=a.get(n);j&&Gr(D)?c.set(m,{key:j,direction:D}):c.remove(m)},[g,m,r,n,c]);const C=(i==null?void 0:i.sortBy)??"sortBy",O=(i==null?void 0:i.sortOrder)??"sortOrder",M=u.useMemo(()=>b?{[C]:b.key,[O]:b.direction}:{},[b,C,O]),L=u.useCallback(j=>{const D={...h};j?(D[r]=j.key,D[n]=j.direction):(delete D[r],delete D[n]),delete D[s],d(D)},[h,r,n,s,d]);return{sort:b,setSort:L,params:M}},vr=({of:t,render:r})=>u.Children.toArray(t==null?void 0:t.map((n,s,o)=>r(n,s,o))),xe=({condition:t,fallback:r,children:n,loading:s,isLoading:o})=>e.jsx(e.Fragment,{children:o?s:t?n:r}),pe=t=>e.jsx(w.Text,{...t,fontSize:t.fontSize||"md",fontWeight:t.fontWeight||"medium",color:t.color||"gray-700",children:t.children}),bt=t=>e.jsx(w.Text,{color:"red-600",fontSize:"sm",children:t.message}),ac=({size:t="md",direction:r="vertical",requiredTitle:n="(Required)",fullWidth:s=!1,...o})=>{var c,a,d;const i=o.hideMessageError||!1,l=r==="horizontal"?t==="sm"?342:t==="lg"?400:342:void 0;return e.jsxs(x.Box,{gap:r==="horizontal"?"spacing-96":"sm",direction:r==="horizontal"?"row":"column",...o.containerProps,children:[o.title&&e.jsx(xe,{condition:!!o.inputProps.required,fallback:e.jsxs(x.Box,{direction:"column",customMaxWidth:l,fullWidth:s,children:[e.jsx(pe,{children:o.title}),e.jsx(w.Text,{fontSize:t,color:"gray-500",children:o.description})]}),children:e.jsxs(x.Box,{direction:"column",customMaxWidth:l,fullWidth:s,children:[e.jsxs(de.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(pe,{fontSize:t,children:o.title}),e.jsx(pe,{color:"error",fontSize:t,children:n}),e.jsx(xe,{condition:!!((c=o.tooltip)!=null&&c.label),children:e.jsx(Le.Tooltip,{label:(a=o.tooltip)==null?void 0:a.label,arrowPosition:(d=o.tooltip)==null?void 0:d.arrowPosition,focusable:!0,...o.tooltip,children:e.jsx(E.Icon,{name:"InfoCircle",size:t==="lg"?"sm":"xs",style:{color:"var(--sa-color-info-500, #00abeb)",marginTop:"6px"}})})})]}),e.jsx(xe,{condition:!!o.description,children:e.jsx(w.Text,{fontSize:t,color:"gray-500",children:o.description})})]})}),e.jsxs(x.Box,{direction:"column",gap:"xs",fullWidth:o.inputProps.fullWidth||!1,children:[e.jsx(mt.Input,{ref:o.inputRef,size:t,...o.inputProps,status:o.errorMessage?"error":"default",fullWidth:!0}),!i&&o.errorMessage&&e.jsx(bt,{message:o.errorMessage}),o.inputProps.extended&&o.inputProps.extended]})]})},dc=({size:t="md",direction:r="vertical",requiredTitle:n="(Required)",fullWidth:s=!1,...o})=>{var c,a,d;const i=o.hideMessageError||!1,l=r==="horizontal"?t==="sm"?342:t==="lg"?400:342:void 0;return e.jsxs(x.Box,{gap:r==="horizontal"?"spacing-96":"sm",direction:r==="horizontal"?"row":"column",onClick:o.onClickContainer,children:[o.title&&e.jsx(xe,{condition:!!o.inputProps.required,fallback:e.jsxs(x.Box,{direction:"column",customMaxWidth:l,fullWidth:s,children:[e.jsx(pe,{children:o.title}),e.jsx(w.Text,{fontSize:t,color:"gray-500",children:o.description})]}),children:e.jsxs(x.Box,{direction:"column",customMaxWidth:l,fullWidth:s,children:[e.jsxs(de.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(pe,{fontSize:t,children:o.title}),e.jsx(pe,{color:"error",fontSize:t,children:n}),e.jsx(xe,{condition:!!((c=o.tooltip)!=null&&c.label),children:e.jsx(Le.Tooltip,{label:(a=o.tooltip)==null?void 0:a.label,arrowPosition:(d=o.tooltip)==null?void 0:d.arrowPosition,focusable:!0,...o.tooltip,children:e.jsx(E.Icon,{name:"InfoCircle",size:t==="lg"?"sm":"xs",style:{color:"var(--sa-color-info-500, #00abeb)",marginTop:"6px"}})})})]}),e.jsx(xe,{condition:!!o.description,children:e.jsx(w.Text,{fontSize:t,color:"gray-500",children:o.description})})]})}),e.jsxs(x.Box,{direction:"column",gap:"xs",fullWidth:o.inputProps.fullWidth||!1,children:[e.jsx(x.Box,{direction:"column",style:{width:o.inputProps.fullWidth?"100%":r==="horizontal"&&o.customWidth?o.customWidth:r==="horizontal"?"343px":""},children:e.jsx(Lt.Dropdown,{size:t,...o.inputProps,error:!!o.errorMessage})}),!i&&o.errorMessage&&e.jsx(bt,{message:o.errorMessage}),o.inputProps.extended&&o.inputProps.extended]})]})},uc=(t,r)=>typeof t=="string"&&t||r==="error"?"var(--sa-border-danger)":"var(--sa-border-subtle)",xc=t=>{var c;const[r,n]=u.useState(!1),s=a=>{a.preventDefault(),a.stopPropagation()},o=a=>{a.preventDefault(),a.stopPropagation(),a.dataTransfer&&t.handleOnFileChange(a.dataTransfer.files.item(0))},i=a=>{a.preventDefault(),n(!0)},l=a=>{a.preventDefault(),n(!1)};return e.jsxs(x.Box,{width:"width-full",paddingInline:"md",direction:"row",gap:"sm",align:"center",onClick:t.handleOnClick,onDragOver:s,onDrop:o,onDragEnter:i,onDragLeave:l,paddingBlock:"md",borderRadius:"rounded-md",style:{border:r?"1px solid var(--sa-border-info)":`1px solid ${uc(t.errorMessage,t.status)}`},children:[e.jsx(E.Icon,{name:"Upload",size:"lg",style:{width:30,height:30}}),e.jsxs(de.Flex,{direction:"column",gap:"xs",children:[e.jsxs(de.Flex,{direction:"row",gap:"xs",children:[e.jsx(w.Text,{fontWeight:"medium",color:"gray-500",style:{textWrap:"nowrap"},fontSize:t.isDesktop?"md":"sm",children:"Click your upload"}),e.jsx(w.Text,{fontWeight:"medium",style:{textWrap:"nowrap"},fontSize:t.isDesktop?"md":"sm",children:"or Drag & Drop"})]}),e.jsx(w.Text,{fontSize:"sm",color:"gray-500",children:(c=t.fileSupports)==null?void 0:c.map(a=>a.toLocaleUpperCase()).join(", ")})]})]})};function hc(t){return t.split(" ").map(r=>r[0]).join("").slice(0,2).toUpperCase()}const us=t=>{const r={day:"2-digit",month:"short",year:"numeric"};return t.toLocaleDateString("id-ID",r)},fc=t=>{const r={Jan:0,Feb:1,Mar:2,Apr:3,Mei:4,Jun:5,Jul:6,Agu:7,Sep:8,Okt:9,Nov:10,Des:11},n=t.split(" ");if(n.length!==3)return null;const s=parseInt(n[0],10),o=r[n[1]],i=parseInt(n[2],10);return isNaN(s)||isNaN(o)||isNaN(i)?null:new Date(i,o,s)};function mc(t,r=!0){if(!t)return"Rp 0";const n=typeof t=="number"?t.toString():t;if(isNaN(Number(n)))return"Rp 0";const s=n.split("."),o=s[0].replace(/\B(?=(\d{3})+(?!\d))/g,"."),i=s.length===2?o+"."+s[1]:o;return r?"Rp"+i:i}String.prototype.toTitleCase=function(){return this.toLowerCase().split(" ").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")};String.prototype.toNumber=function(){return Number(this)};const gc=t=>{const r=t.split(" ");let n=r[0].charAt(0);return r.length>1&&(n+=""+r[1].charAt(0)),n.toUpperCase()};function pc(t){const r=typeof t=="string"?new Date(t):t;if(isNaN(r.getTime()))throw new Error("Invalid date format");const n=r.getFullYear(),s=String(r.getMonth()+1).padStart(2,"0"),o=String(r.getDate()).padStart(2,"0");return`${n}-${s}-${o}`}const yc="sa-admin",st=t=>`var(--${yc}-${t})`,bc={base:{borderColor:st("base-border-color"),textColor:st("base-text-color"),iconColor:st("base-icon-color"),placeholderColor:st("base-placeholder-color")},document:{bgColor:st("document-bg-color")},sidebar:{bgColor:st("sidebar-bg-color"),borderColor:st("sidebar-border-color"),maxWidth:st("sidebar-max-width"),width:st("sidebar-width"),collapseWidth:st("sidebar-collapse-width"),collapseV2Width:st("sidebar-v2-collapse-width")}},jc=24*60*60*1e3,vc=t=>{const r="14px poppins",s=document.createElement("canvas").getContext("2d");s.font=r;const o=s.measureText(t).width;return Number(Math.ceil(o))},Cc=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,wc=/--+/,Dc=/-$/;function Sc(t,r){return JSON.stringify(t)!==JSON.stringify(r)}function kc(t){return/^(?:\+62|62|0)8[1-9][0-9]{7,10}$/.test(t)}function Bc(t){return/^[A-Za-z\s]+$/.test(t)}const Ec=t=>{const r=/^[0-9]$/,n=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Backspace","Delete","Enter","Tab"];(t.ctrlKey||t.metaKey)&&(t.key==="a"||t.key==="c"||t.key==="v")||!r.test(t.key)&&!n.includes(t.key)&&t.preventDefault()},Fc=t=>{const r=/^[0-9]$/,n=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Backspace","Delete","Enter","Tab"];(t.ctrlKey||t.metaKey)&&t.key==="v"||r.test(t.key)&&!n.includes(t.key)&&t.preventDefault()},Ic=t=>{const r=/^[0-9.]$/,n=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Backspace","Delete","Enter","Tab"];(t.ctrlKey||t.metaKey)&&t.key==="v"||!r.test(t.key)&&!n.includes(t.key)&&t.preventDefault()},Mc=t=>Cc.test(t);function Lc(t){return!(wc.test(t)||Dc.test(t))}const Tc=t=>{const r=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Backspace","Delete","Enter","Tab","Home","End"];if((t.ctrlKey||t.metaKey)&&["a","c","v","x"].includes(t.key.toLowerCase()))return;const n=t.currentTarget.value;/^[0-9]$/.test(t.key)||t.key==="."&&!n.includes(".")||t.key==="-"&&n.length===0&&!n.includes("-")||r.includes(t.key)||t.preventDefault()},Rc=t=>{const r=document.getElementById(t);if(r){const n=r.getBoundingClientRect(),s=window.scrollY+n.top-80;window.scrollTo({top:s,behavior:"smooth"})}};function Oc(t){const r=t.toLowerCase();if(["kb","mb","gb"].find(i=>r.endsWith(i)))return t;const o=Number(t);if(isNaN(o))throw new Error("Invalid size format");return o>=1e6?`${(o/1e6).toFixed(2)}MB`:o>=1e3?`${(o/1e3).toFixed(2)}KB`:`${o}B`}function Ac(t){const r=t.split("/");return r[r.length-1]}const Wc=t=>{var r,n;return e.jsxs(x.Box,{width:"width-full",paddingInline:"md",height:"height-full",direction:"row",justify:"space-between",align:"center",onClick:t.handleOnClickFile,fullHeight:!0,paddingBlock:"md",id:"file-item",borderRadius:"rounded-md",style:{border:"1px solid var(--sa-border-subtle)",cursor:"pointer"},children:[e.jsxs(de.Flex,{direction:"row",align:"center",gap:"sm",style:{flex:1,minWidth:0},children:[e.jsx(E.Icon,{name:"DocumentFilled",size:"lg",style:{color:"var(--sa-icon-brand)",width:30,height:30,flexShrink:0}}),e.jsxs(de.Flex,{direction:"column",style:{minWidth:0,flex:1},children:[e.jsx(w.Text,{fontWeight:"bold",style:{textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden"},children:t.defaultFile?Ac(t.defaultFile.url):(r=t.fileSelected)==null?void 0:r.name}),t.defaultFile?(t.defaultFile.size||t.defaultFile.date)&&e.jsxs(de.Flex,{direction:"row",gap:"xs",align:"center",children:[t.defaultFile.size&&e.jsx(w.Text,{fontSize:"sm",fontWeight:"medium",children:t.defaultFile.size}),t.defaultFile.size&&t.defaultFile.date&&e.jsx(E.Icon,{name:"Dot",size:"xs"}),t.defaultFile.date&&e.jsx(w.Text,{fontSize:"sm",fontWeight:"medium",style:{textWrap:"nowrap"},children:t.defaultFile.date})]}):e.jsxs(de.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(w.Text,{fontSize:"sm",fontWeight:"medium",children:Oc(((n=t.fileSelected)==null?void 0:n.size.toString())||"100000")}),e.jsx(E.Icon,{name:"Dot",size:"xs"}),e.jsx(w.Text,{fontSize:"sm",fontWeight:"medium",style:{textWrap:"nowrap"},children:us(new Date)})]})]})]}),e.jsx(H.Button,{size:"xs",variant:"tertiary",tone:"error",type:"button",onClick:s=>{s.stopPropagation(),t.handleOnDeleteFile()},iconLeft:e.jsx(E.Icon,{name:"Trash1"})})]})},xs=({status:t="default",labelPosition:r="outside-top",...n})=>{var m;const s=u.useRef(null),o=()=>{if(n.defaultFile){window.open(n.defaultFile.url);return}s.current&&s.current.click()},i=ke.useMediaQuery("md"),l=t==="error"||typeof n.errorMessage=="string"&&!!n.errorMessage,c=n.label?e.jsxs(de.Flex,{direction:"row",align:"center",gap:"xs",children:[e.jsx(w.Text,{style:{fontSize:"14px",fontWeight:500,color:"var(--sa-text-primary)"},children:n.label}),n.optional&&e.jsx("span",{style:{background:"var(--sa-background-neutral)",border:"1px solid var(--sa-border-subtle)",borderRadius:"var(--sa-radii-xs, 4px)",padding:"0 8px",fontSize:"10px",fontWeight:500,lineHeight:"18px",color:"var(--sa-text-primary)",display:"inline-flex",alignItems:"center"},children:"Optional"}),n.required&&e.jsx("span",{style:{fontSize:"14px",fontWeight:500,color:"var(--sa-text-error)"},children:"*"})]}):null,a=n.description?e.jsx(w.Text,{style:{fontSize:"12px",fontWeight:400,color:"var(--sa-text-subtlest, #6b6e76)",lineHeight:"18px"},children:n.description}):null,d=e.jsxs(e.Fragment,{children:[n.helperText&&e.jsx(w.Text,{style:{fontSize:"12px",fontWeight:400,color:"var(--sa-text-subtlest, #6b6e76)",lineHeight:"18px"},children:n.helperText}),n.errorText&&t==="error"&&e.jsx(w.Text,{style:{fontSize:"12px",fontWeight:400,color:"var(--sa-text-error, #a4133c)",lineHeight:"18px"},children:n.errorText}),n.errorMessage&&!n.errorText&&e.jsx(w.Text,{style:{fontSize:"12px",fontWeight:400,color:"var(--sa-text-error, #a4133c)",lineHeight:"18px"},children:n.errorMessage})]}),h=e.jsx("input",{type:"file",style:{display:"none"},ref:s,onChange:y=>{var b;return n.handleOnChangeFile(((b=y.target.files)==null?void 0:b.item(0))||null)},accept:(m=n.fileSupportOption)==null?void 0:m.map(y=>"."+(y==null?void 0:y.toLowerCase())).join(", ")}),g=e.jsxs(x.Box,{direction:"column",fullWidth:!0,style:{minHeight:"69px"},borderRadius:"rounded-md",display:"flex",justify:"center",align:"center",cursor:"pointer",gap:"md",...n.containerProps,children:[h,(n.fileSelected||n.defaultFile)&&e.jsx(Wc,{fileSelected:n.fileSelected,defaultFile:n.defaultFile,handleOnDeleteFile:n.handleOnDeleteFile,handleOnClickFile:o}),!n.fileSelected&&!n.defaultFile&&e.jsx(xc,{fileSupports:n.fileSupportOption,isDesktop:i,errorMessage:l?n.errorText||n.errorMessage||" ":void 0,status:l?"error":"default",handleOnClick:o,handleOnFileChange:n.handleOnChangeFile})]});return r==="outside-left"?e.jsxs(de.Flex,{direction:"row",align:"flex-start",gap:"sm",style:{width:"100%"},children:[e.jsxs(de.Flex,{direction:"column",gap:"xs",style:{width:"40%",minWidth:"120px",paddingTop:"10px"},children:[c,a]}),e.jsxs(de.Flex,{direction:"column",gap:"sm",style:{flex:1,minWidth:0},children:[g,d]})]}):e.jsxs(de.Flex,{direction:"column",gap:"sm",style:{width:"100%"},children:[c,a,g,d]})},zc=({size:t="md",direction:r="vertical",requiredTitle:n="(Required)",fullWidth:s=!1,...o})=>{var c,a,d;const i=o.hideMessageError||!1,l=r==="horizontal"?t==="sm"?342:t==="lg"?400:342:void 0;return e.jsxs(x.Box,{gap:r==="horizontal"?"spacing-96":"sm",direction:r==="horizontal"?"row":"column",...o.containerProps,children:[o.title&&e.jsx(xe,{condition:!!o.inputProps.required,fallback:e.jsxs(x.Box,{direction:"column",customMaxWidth:l,fullWidth:s,children:[e.jsx(pe,{children:o.title}),e.jsx(w.Text,{fontSize:t,color:"gray-500",children:o.description})]}),children:e.jsxs(x.Box,{direction:"column",customMaxWidth:l,fullWidth:s,children:[e.jsxs(de.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(pe,{fontSize:t,children:o.title}),e.jsx(pe,{color:"error",fontSize:t,children:n}),e.jsx(xe,{condition:!!((c=o.tooltip)!=null&&c.label),children:e.jsx(Le.Tooltip,{label:(a=o.tooltip)==null?void 0:a.label,arrowPosition:(d=o.tooltip)==null?void 0:d.arrowPosition,focusable:!0,...o.tooltip,children:e.jsx(E.Icon,{name:"InfoCircle",size:t==="lg"?"sm":"xs",style:{color:"var(--sa-color-info-500, #00abeb)",marginTop:"6px"}})})})]}),e.jsx(xe,{condition:!!o.description,children:e.jsx(w.Text,{fontSize:t,color:"gray-500",children:o.description})})]})}),e.jsxs(de.Flex,{direction:"column",gap:"xs",children:[e.jsx(xs,{...o.inputProps,status:o.errorMessage?"error":"default"}),!i&&o.errorMessage&&e.jsx(bt,{message:o.errorMessage})]})]})},Hc=({size:t="md",direction:r="vertical",requiredTitle:n="(Required)",fullWidth:s=!1,required:o=!1,...i})=>{var a,d,h,g;const l=i.hideMessageError||!1,c=r==="horizontal"?t==="sm"?342:t==="lg"?400:342:void 0;return e.jsxs(x.Box,{gap:r==="horizontal"||r==="horizontal-inline"?"spacing-96":"sm",direction:r==="horizontal"||r==="horizontal-inline"?"row":"column",...i.containerProps,children:[i.title&&e.jsx(xe,{condition:!!o,fallback:e.jsxs(x.Box,{direction:"column",customMaxWidth:c,fullWidth:s,children:[e.jsx(pe,{children:i.title}),e.jsx(nt.Body3,{props:{color:"gray-500"},children:i.description})]}),children:e.jsxs(x.Box,{direction:"column",customMaxWidth:c,fullWidth:s,children:[e.jsxs(de.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(pe,{fontSize:t,children:i.title}),e.jsx(pe,{color:"error",fontSize:t,children:n}),e.jsx(xe,{condition:!!((a=i.tooltip)!=null&&a.label),children:e.jsx(Le.Tooltip,{label:(d=i.tooltip)==null?void 0:d.label,arrowPosition:(h=i.tooltip)==null?void 0:h.arrowPosition,focusable:!0,...i.tooltip,children:e.jsx(E.Icon,{name:"InfoCircle",size:t==="lg"?"sm":"xs",style:{color:"var(--sa-color-info-500, #00abeb)",marginTop:"6px"}})})})]}),e.jsx(xe,{condition:!!i.description,children:e.jsx(w.Text,{fontSize:t,color:"gray-500",children:i.description})})]})}),e.jsx(x.Box,{gap:r==="horizontal-inline"?"xl":"md",direction:r==="horizontal-inline"?"row":"column",align:"flex-start",children:e.jsx(vr,{of:(g=i.checkBoxesList)==null?void 0:g.map(m=>({...m,isChecked:i.checkBoxesAreChecked.includes(m.id)})),render:m=>m.renderBadge?e.jsxs(x.Box,{direction:"row",justify:"space-between",gap:"lg",...i.badgeContainerProps,children:[e.jsx(ft.Checkbox,{name:m.name,value:m.id,checked:m.isChecked,onChange:y=>i.onChecked(y.target.value,m),label:m.name,description:m.description}),m.renderBadge]}):e.jsx(ft.Checkbox,{name:m.name,value:m.id,checked:m.isChecked,onChange:y=>i.onChecked(y.target.value,m),label:m.name,description:m.description})})}),!l&&i.errorMessage&&e.jsx(bt,{message:i.errorMessage})]})},Pc=({position:t="vertical",size:r="md",fullWidth:n=!1,...s})=>{var i;const o=t==="horizontal-inline"||t==="horizontal-block"?r==="sm"?342:r==="lg"?400:342:void 0;return e.jsxs(x.Box,{gap:t==="horizontal-inline"||t==="horizontal-block"?"spacing-96":"sm",direction:t==="horizontal-inline"||t==="horizontal-block"?"row":"column",children:[e.jsx(xe,{condition:!!s.description||!!s.title,children:e.jsxs(x.Box,{direction:"column",customMaxWidth:o,fullWidth:n,children:[s.title&&e.jsx(pe,{children:s.title}),e.jsx(xe,{condition:!!s.description,children:e.jsx(w.Text,{color:"gray-500",children:s.description})})]})}),e.jsx(x.Box,{gap:"sm",direction:t==="horizontal"||t==="horizontal-inline"?"row":"column",align:"flex-start",flexWrap:"wrap",children:e.jsx(vr,{of:(i=s.radioList)==null?void 0:i.map(l=>({...l,isChecked:s.radioIsChecked===l.id})),render:({value:l,id:c,isChecked:a,subInput:d,label:h,description:g})=>e.jsxs(x.Box,{direction:"column",gap:"xs",customMaxWidth:o,children:[e.jsx(Jr.Radio,{id:`${c.toString()}-${l}`,name:s.groupName||h,label:h,value:l,checked:a,onChange:m=>s.onChecked({id:c,label:m.target.name,value:m.target.value}),disabled:s.disableAll},c),g&&e.jsx(w.Text,{color:"gray-500",style:{marginLeft:28},children:g}),d]})})}),s.errorMessage&&e.jsx(bt,{message:s.errorMessage})]})},_c=({size:t="md",direction:r="vertical",requiredTitle:n="(Required)",fullWidth:s=!1,...o})=>{var c,a,d;const i=o.hideMessageError||!1,l=r==="horizontal"?t==="sm"?342:t==="lg"?400:342:void 0;return e.jsxs(x.Box,{gap:r==="horizontal"?"spacing-96":"sm",direction:r==="horizontal"?"row":"column",...o.containerProps,children:[o.title&&e.jsx(xe,{condition:!!o.inputProps.required,fallback:e.jsxs(x.Box,{direction:"column",customMaxWidth:l,fullWidth:s,children:[e.jsx(pe,{children:o.title}),e.jsx(w.Text,{fontSize:t,color:"gray-500",children:o.description})]}),children:e.jsxs(x.Box,{direction:"column",customMaxWidth:l,fullWidth:s,children:[e.jsxs(de.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(pe,{fontSize:t,children:o.title}),e.jsx(pe,{color:"error",fontSize:t,children:n}),e.jsx(xe,{condition:!!((c=o.tooltip)!=null&&c.label),children:e.jsx(Le.Tooltip,{label:(a=o.tooltip)==null?void 0:a.label,arrowPosition:(d=o.tooltip)==null?void 0:d.arrowPosition,focusable:!0,...o.tooltip,children:e.jsx(E.Icon,{name:"InfoCircle",size:t==="lg"?"sm":"xs",style:{color:"var(--sa-color-info-500, #00abeb)",marginTop:"6px"}})})})]}),e.jsx(xe,{condition:!!o.description,children:e.jsx(w.Text,{fontSize:t,color:"gray-500",children:o.description})})]})}),e.jsxs(de.Flex,{direction:"column",gap:"xs",children:[e.jsx(Xr.Textarea,{ref:o.inputRef,size:t,...o.inputProps,status:o.errorMessage?"error":"default"}),!i&&o.errorMessage&&e.jsx(bt,{message:o.errorMessage})]})]})},Nc=({size:t="md",direction:r="vertical",requiredTitle:n="(Required)",required:s=!1,fullWidth:o=!1,...i})=>{var c,a,d;const l=r==="horizontal"?t==="sm"?342:t==="lg"?400:342:void 0;return e.jsxs(x.Box,{gap:r==="horizontal"?"spacing-96":"sm",direction:r==="horizontal"?"row":"column",...i.containerProps,children:[i.title&&e.jsx(xe,{condition:s,fallback:e.jsxs(x.Box,{direction:"column",customMaxWidth:l,fullWidth:o,children:[e.jsx(pe,{children:i.title}),e.jsx(w.Text,{fontSize:t,color:"gray-500",children:i.titleDescription})]}),children:e.jsxs(x.Box,{direction:"column",customMaxWidth:l,fullWidth:o,children:[e.jsxs(de.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(pe,{fontSize:t,children:i.title}),e.jsx(pe,{color:"error",fontSize:t,children:n}),e.jsx(xe,{condition:!!((c=i.tooltip)!=null&&c.label),children:e.jsx(Le.Tooltip,{label:(a=i.tooltip)==null?void 0:a.label,arrowPosition:(d=i.tooltip)==null?void 0:d.arrowPosition,focusable:!0,...i.tooltip,children:e.jsx(E.Icon,{name:"InfoCircle",size:t==="lg"?"sm":"xs",style:{color:"var(--sa-color-info-500, #00abeb)",marginTop:"6px"}})})})]}),e.jsx(xe,{condition:!!i.titleDescription,children:e.jsx(w.Text,{fontSize:t,color:"gray-500",children:i.titleDescription})})]})}),e.jsx(Rt.Toggle,{checked:i.checked,onChange:i.onChange,label:i.label,description:i.description}),i.errorMessage&&e.jsx(bt,{message:i.errorMessage})]})},Vc=({variant:t="primary",size:r="md",...n})=>{const s=Mt.useColor(),o=l=>{var a,d,h,g,m,y;if(!l)return;const c=n.disabled?"var(--sa-text-disable, #181a198f)":t==="secondary"?"var(--sa-text-subtle, #8c8f97)":t==="secondary-danger"?(d=(a=s==null?void 0:s.computed)==null?void 0:a.red)==null?void 0:d[600]:t==="secondary-primary"?(g=(h=s==null?void 0:s.computed)==null?void 0:h.blue)==null?void 0:g[700]:(y=(m=s==null?void 0:s.computed)==null?void 0:m.gray)==null?void 0:y[50];return e.jsx(E.Icon,{name:l,size:r,style:{color:c}})},i=()=>{var c,a,d,h;if(t!=="secondary-danger"&&t!=="secondary-primary")return n.title;const l={color:n.disabled?"var(--sa-text-disable, #181a198f)":t==="secondary-danger"?(a=(c=s==null?void 0:s.computed)==null?void 0:c.red)==null?void 0:a[600]:(h=(d=s==null?void 0:s.computed)==null?void 0:d.blue)==null?void 0:h[700]};switch(r){case"xs":return e.jsx(nt.Body2,{props:{style:l},children:n.title});case"sm":case"md":return e.jsx(nt.SubH3,{props:{style:l},children:n.title});case"lg":return e.jsx(nt.SubH2,{props:{style:l},children:n.title});default:return n.title}};return e.jsx(H.Button,{fullWidth:!0,disabled:n.disabled,primary:t==="primary",secondary:t==="secondary"||t==="secondary-danger"||t==="secondary-primary",success:t==="success",onClick:n.onClick,type:n.type,iconLeft:o(n.iconLeft),iconRight:o(n.iconRight),size:r,children:i()})},qc=t=>e.jsx(nt.H5,{props:{...t},children:t.title}),Zc=({size:t="md",direction:r="vertical",requiredTitle:n="(Required)",fullWidth:s=!1,...o})=>{var c,a,d;const i=o.hideMessageError||!1,l=r==="horizontal"?t==="sm"?342:t==="lg"?400:342:void 0;return e.jsxs(x.Box,{gap:r==="horizontal"?"spacing-96":"sm",direction:r==="horizontal"?"row":"column",onClick:o.onClickContainer,children:[o.title&&e.jsx(xe,{condition:!!o.inputProps.required,fallback:e.jsxs(x.Box,{direction:"column",customMaxWidth:l,fullWidth:s,children:[e.jsx(pe,{children:o.title}),e.jsx(w.Text,{fontSize:t,color:"gray-500",children:o.description})]}),children:e.jsxs(x.Box,{direction:"column",customMaxWidth:l,fullWidth:s,children:[e.jsxs(de.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(pe,{fontSize:t,children:o.title}),e.jsx(pe,{color:"error",fontSize:t,children:n}),e.jsx(xe,{condition:!!((c=o.tooltip)!=null&&c.label),children:e.jsx(Le.Tooltip,{label:(a=o.tooltip)==null?void 0:a.label,arrowPosition:(d=o.tooltip)==null?void 0:d.arrowPosition,focusable:!0,...o.tooltip,children:e.jsx(E.Icon,{name:"InfoCircle",size:t==="lg"?"sm":"xs",style:{color:"var(--sa-color-info-500, #00abeb)",marginTop:"6px"}})})})]}),e.jsx(xe,{condition:!!o.description,children:e.jsx(w.Text,{fontSize:t,color:"gray-500",children:o.description})})]})}),e.jsxs(de.Flex,{direction:"column",gap:"xs",children:[e.jsx(x.Box,{direction:"column",style:{width:r==="horizontal"&&o.customWidth?o.customWidth:r==="horizontal"?"343px":""},children:e.jsx(vt.StarasiaDate,{size:t,...o.inputProps,status:o.errorMessage?"error":void 0})}),!i&&o.errorMessage&&e.jsx(bt,{message:o.errorMessage})]})]})};async function Gc(t,r){const n=new Image;n.src=t,await new Promise((i,l)=>{n.onload=i,n.onerror=l});const s=document.createElement("canvas");s.width=r.width,s.height=r.height;const o=s.getContext("2d",{alpha:!0});if(!o)throw new Error("No 2D context");return o.drawImage(n,r.x,r.y,r.width,r.height,0,0,r.width,r.height),new Promise((i,l)=>{s.toBlob(c=>{if(!c)return l("Canvas is empty");const a=new File([c],"cropped.png",{type:"image/png"});i(a)},"image/png")})}const ho={"1:1":1,"4:3":4/3,"16:9":16/9,"3:4":3/4,"9:16":9/16,"2:3":2/3,"3:2":3/2,"32:9":32/9},hs=u.forwardRef(({handleUpload:t,urlImage:r,isUploading:n,croppedImage:s,setCroppedImage:o,size:i="96",aspect:l="1:1",containerProps:c,maxFileSize:a=2,onError:d},h)=>{const g=ke.useMediaQuery("md"),[m,y]=u.useState(!1),[b,C]=u.useState(null),[O,M]=u.useState(!1),[L,j]=u.useState({x:0,y:0}),[D,R]=u.useState(1),[B,S]=u.useState(null),[T,P]=u.useState(!1);u.useEffect(()=>{r===null&&o(null)},[r]);const X=u.useCallback((K,ae)=>{S(ae)},[]),I=K=>{var Ie;const ae=(Ie=K.target.files)==null?void 0:Ie[0];if(!ae)return;const ge=new FileReader;ge.onload=()=>{C(ge.result),M(!0)},ge.readAsDataURL(ae)},N=async()=>{if(!(!b||!B||T)){P(!0);try{const K=await Gc(b,B);if(a&&K.size>a*1024*1024){d==null||d(`Ukuran file maksimal ${a}MB`);return}t==null||t(K);const ae=URL.createObjectURL(K);o(ae,K),M(!1)}catch{d==null||d("Gagal memproses gambar")}finally{P(!1)}}},Y=u.useRef(null),G=()=>{Y.current&&Y.current.click()};u.useImperativeHandle(h,()=>({openFileDialog:()=>{var K;(K=Y.current)==null||K.click()}}));const J=parseInt(i,10),$=ho[l];let le,q;return $>=1?(q=J,le=J*$):(le=J,q=J/$),e.jsxs(x.Box,{direction:"column",display:"flex",position:"relative",bg:(c==null?void 0:c.bg)||"gray-200",borderStyle:(c==null?void 0:c.borderStyle)||"border-none",borderColor:(c==null?void 0:c.borderColor)||"gray-200",borderWidth:(c==null?void 0:c.borderWidth)||"border-2",borderRadius:(c==null?void 0:c.borderRadius)||"rounded-md",overflow:"overflow-hidden",align:"center",justify:"center",style:{width:c!=null&&c.fullWidth?"100%":`${le}px`,height:c!=null&&c.fullWidth?"auto":`${q}px`,aspectRatio:$,flexShrink:0},onMouseEnter:()=>y(!0),onMouseLeave:()=>y(!1),children:[s||r?e.jsx("img",{src:s||r||void 0,alt:"Profile",style:{objectFit:"cover",width:"100%",height:"100%"}}):e.jsx(x.Box,{display:"flex",direction:"column",align:"center",justify:"center",padding:"spacing-4",children:e.jsx(E.Icon,{name:"Image",style:{color:"var(--sa-text-subtle, #8c8f97)",width:Number(i)/2<40?Number(i)/2:40,height:Number(i)/2<40?Number(i)/2:40}})}),e.jsxs(x.Box,{direction:"column",position:"absolute",display:"flex",align:"center",justify:"center",cursor:"pointer",style:{inset:0,backgroundColor:"var(--sa-color-black-alpha-a30, #080f214c)",opacity:m?1:0,transition:"opacity 0.3s ease-in-out"},onClick:G,children:[e.jsx("input",{ref:Y,type:"file",accept:"image/*",onChange:I,disabled:n,style:{display:"none"}}),e.jsxs(x.Box,{display:"flex",align:"center",gap:"spacing-2",direction:"row",children:[e.jsx(E.Icon,{name:"Edit3",style:{color:"var(--sa-text-primary, #292a2e)"}}),e.jsx(xe,{condition:i.toNumber()>80,children:e.jsx(w.Text,{color:"gray-50",fontSize:i.toNumber()>80?"sm":"md",fontWeight:"medium",children:"Edit Image"})})]})]}),n&&e.jsx(x.Box,{direction:"column",position:"absolute",display:"flex",align:"center",justify:"center",style:{inset:0,zIndex:20,backgroundColor:"var(--sa-color-white-alpha-a80, #e5e9f6cc)"},children:e.jsx(x.Box,{direction:"column",borderRadius:"rounded-full",style:{animation:"spin 1s linear infinite",border:"2px solid transparent",height:"2rem",width:"2rem"},borderColor:"info-600"})}),O&&br.createPortal(e.jsx("div",{style:{position:"fixed",inset:0,zIndex:19999,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0,0,0,0.6)"},onClick:()=>{T||M(!1)},children:e.jsxs("div",{style:{backgroundColor:"var(--sa-background-primary)",borderRadius:"var(--sa-radii-md)",boxShadow:"0 20px 60px rgba(0,0,0,0.3)",overflow:"hidden",width:g?l==="1:1"?"min(90vw, 480px)":`min(90vw, ${le*2}px)`:"calc(100vw - 2rem)",display:"flex",flexDirection:"column"},onClick:K=>K.stopPropagation(),children:[e.jsx("div",{style:{position:"relative",width:"100%",height:"20rem",backgroundColor:"var(--sa-color-gray-100)"},children:b&&e.jsx(zs,{image:b,crop:L,zoom:D,aspect:l?ho[l]:void 0,onCropChange:j,onZoomChange:R,onCropComplete:X,objectFit:"contain",minZoom:.5,restrictPosition:!1})}),e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem",padding:"0.75rem 1rem",borderTop:"1px solid var(--sa-border-subtle)"},children:[e.jsx(H.Button,{size:"sm",secondary:!0,disabled:T,onClick:()=>M(!1),children:"Cancel"}),e.jsx(H.Button,{size:"sm",primary:!0,isLoading:T,onClick:N,children:"Crop"})]})]})}),document.body)]})}),Qc=({size:t="md",direction:r="vertical",requiredTitle:n="(Required)",fullWidth:s=!1,required:o=!1,...i})=>{var a,d,h;const l=i.hideMessageError||!1,c=r==="horizontal"?t==="sm"?342:t==="lg"?400:342:void 0;return e.jsxs(x.Box,{gap:r==="horizontal"?"spacing-96":"sm",direction:r==="horizontal"?"row":"column",...i.containerProps,children:[i.title&&e.jsx(xe,{condition:!!o,fallback:e.jsxs(x.Box,{direction:"column",customMaxWidth:c,fullWidth:s,children:[e.jsx(pe,{children:i.title}),e.jsx(w.Text,{fontSize:t,color:"gray-500",children:i.description})]}),children:e.jsxs(x.Box,{direction:"column",customMaxWidth:c,fullWidth:s,children:[e.jsxs(de.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(pe,{fontSize:t,children:i.title}),e.jsx(pe,{color:"error",fontSize:t,children:n}),e.jsx(xe,{condition:!!((a=i.tooltip)!=null&&a.label),children:e.jsx(Le.Tooltip,{label:(d=i.tooltip)==null?void 0:d.label,arrowPosition:(h=i.tooltip)==null?void 0:h.arrowPosition,focusable:!0,...i.tooltip,children:e.jsx(E.Icon,{name:"InfoCircle",size:t==="lg"?"sm":"xs",style:{color:"var(--sa-color-info-500, #00abeb)",marginTop:"6px"}})})})]}),e.jsx(xe,{condition:!!i.description,children:e.jsx(w.Text,{fontSize:t,color:"gray-500",children:i.description})})]})}),e.jsxs(de.Flex,{direction:"column",gap:"xs",children:[e.jsx(hs,{...i.inputProps}),!l&&i.errorMessage&&e.jsx(bt,{message:i.errorMessage})]})]})},Uc=({size:t="md",direction:r="vertical",requiredTitle:n="(Required)",fullWidth:s=!1,...o})=>{var l,c,a;const i=r==="horizontal"?t==="sm"?342:t==="lg"?400:342:void 0;return e.jsxs(x.Box,{gap:r==="horizontal"?"spacing-96":"sm",direction:r==="horizontal"?"row":"column",...o.containerProps,children:[o.title&&e.jsx(xe,{condition:!!o.inputProps.required,fallback:e.jsxs(x.Box,{direction:"column",customMaxWidth:i,fullWidth:s,children:[e.jsx(pe,{children:o.title}),e.jsx(w.Text,{fontSize:t,color:"gray-500",children:o.description})]}),children:e.jsxs(x.Box,{direction:"column",customMaxWidth:i,fullWidth:s,children:[e.jsxs(de.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(pe,{fontSize:t,children:o.title}),e.jsx(pe,{color:"error",fontSize:t,children:n}),e.jsx(xe,{condition:!!((l=o.tooltip)!=null&&l.label),children:e.jsx(Le.Tooltip,{label:(c=o.tooltip)==null?void 0:c.label,arrowPosition:(a=o.tooltip)==null?void 0:a.arrowPosition,focusable:!0,...o.tooltip,children:e.jsx(E.Icon,{name:"InfoCircle",size:t==="lg"?"sm":"xs",style:{color:"var(--sa-color-info-500, #00abeb)",marginTop:"6px"}})})})]}),e.jsx(xe,{condition:!!o.description,children:e.jsx(w.Text,{fontSize:t,color:"gray-500",children:o.description})})]})}),o.inputProps.extended&&o.inputProps.extended]})},Yc=({items:t,id:r,handleOnUpdate:n,width:s,toggleShow:o=!0,disabled:i=!1})=>{var h;const[l,c]=u.useState([]);u.useEffect(()=>{t&&c([...t.map(g=>({id:g.id,isActive:g.isActive}))])},[t]);const a=(h=l.find(g=>g.id===r))==null?void 0:h.isActive,d=u.useCallback(()=>{c(g=>g.map(m=>m.id===r?{...m,isActive:!m.isActive}:m)),n&&n(!a)},[r,n,a]);return e.jsx(x.Box,{direction:"row",gap:"md",style:{width:s},children:o&&e.jsx(Rt.Toggle,{disabled:i,checked:a,onChange:d,label:a?"Active":"Inactive"})})},Xc={InputText:ac,InputDropdown:dc,InputSingleFile:zc,CheckBoxOptions:Hc,RadioOptions:Pc,InputTextArea:_c,ToggleForm:Nc,ActionButton:Vc,FormTitle:qc,InputDate:Zc,InputImgFile:Qc,Custom:Uc},fs=({customBottom:t})=>{const[r,n]=u.useState(!1),s=()=>{window.scrollY>window.innerHeight?n(!0):n(!1)},o=()=>{window.scrollTo({top:0,behavior:"smooth"})};return u.useEffect(()=>(window.addEventListener("scroll",s),()=>{window.removeEventListener("scroll",s)}),[]),e.jsx(x.Box,{direction:"column",style:{position:"fixed",bottom:0,right:0},children:e.jsx(x.Box,{direction:"column",position:"absolute",style:{bottom:t||"1.6rem",right:"2rem",transform:r?"scale(1)":"scale(0)",transition:"transform 0.2s ease-in-out"},children:e.jsx(H.Button,{secondary:!0,size:"xs",onClick:o,type:"button",iconLeft:e.jsx(E.Icon,{width:16,size:"xs",name:"ArrowPullUp",style:{color:"var(--sa-background-brand, #04254f)"}})})})})},Xe="sa-sidepanel-item",fo="sa-sidepanel-item-styles",Jc="inset 3.5px 0 0 0 var(--sa-border-focused, #1a4fa0)",$c="inset -3.5px 0 0 0 var(--sa-border-focused, #1a4fa0)",Kc=`@layer starasia.components {
|
|
53
|
-
.${
|
|
52
|
+
}`,document.head.appendChild(t)},rr=t=>t==="right"?"right":t==="center"?"center":"left",pc=/^(#|rgb|hsl|var\()/,Cr=t=>t?pc.test(t)?t:`var(--sa-background-${t})`:void 0,yc=(t,r)=>{if(r)return t[r]},bc=(t,r)=>t==null&&r==null?0:t==null?-1:r==null?1:typeof t=="number"&&typeof r=="number"?t-r:String(t).localeCompare(String(r)),jc=({columns:t,data:r,getRowKey:n,rowBg:s,size:o="md",resizable:i=!1,layout:l="auto",widthStorageKey:c,columnState:a,onColumnStateChange:d,columnMenu:h=!1,highlight:g,sort:m,defaultSort:y,onSortChange:D,height:j,mobileLayout:R="cards",mobileBreakpoint:I="md",groupSeparator:M,summary:C,footer:k,stickyFooter:T=!1,emptyState:F,loading:v=!1,loadingRows:L=8,rowActions:N,rowActionsMode:q="auto",selectable:W=!1,selectedKeys:O,defaultSelectedKeys:J,onSelectionChange:K,isRowSelectable:X})=>{gc();const ae=!ke.useMediaQuery(I)&&R!=="scroll",Z=!!(N!=null&&N.length),ne=ps(),de=Z&&(q==="column"||q==="auto"&&ne),ve=Math.min((N==null?void 0:N.length)??0,Jr+1),Be=ve>Jr?1:ve,Ce=jr*2+Be*mc+Math.max(0,Be-1)*Kr,je=de?Ce:1,[ge,Oe]=u.useState(null);u.useEffect(()=>{if(!ge)return;const p=()=>Oe(null),w=setTimeout(()=>document.addEventListener("click",p),0);return()=>{clearTimeout(w),document.removeEventListener("click",p)}},[ge]);const[$e,Le]=u.useState(()=>new Set),le=a!==void 0,[be,We]=u.useState({}),ue=a??be,se=p=>{d==null||d(p),le||We(p)},Pe=m!==void 0,[Ne,z]=u.useState(y??null),Y=Pe?m??null:Ne,G=!D,xe=p=>{D==null||D(p),Pe||z(p)},{headerGroups:Ie,leafColumns:pe,hasGroups:ze}=u.useMemo(()=>{var ie;const p=new Set(ue.hidden??[]),w=(oe,De)=>oe.key??(typeof oe.accessor=="string"?oe.accessor:`col-${De}`),E=t.map((oe,De)=>{var tt;if((tt=oe.children)!=null&&tt.length){const Kt=oe.children.map((ct,Ht)=>({col:ct,key:w(ct,`${De}-${Ht}`)})).filter(ct=>!p.has(ct.key));return{col:oe,key:oe.key??`group-${De}`,isGroup:!0,leaves:Kt}}const Se={col:oe,key:w(oe,`${De}`)};return{col:oe,key:Se.key,isGroup:!1,leaves:p.has(Se.key)?[]:[Se]}}).filter(oe=>oe.leaves.length>0),V=E.some(oe=>oe.isGroup);let te=E.flatMap(oe=>oe.leaves);if(!V&&((ie=ue.order)!=null&&ie.length)){const oe=new Map(ue.order.map((De,Se)=>[De,Se]));te=[...te].sort((De,Se)=>(oe.get(De.key)??1/0)-(oe.get(Se.key)??1/0))}return{headerGroups:E,leafColumns:te,hasGroups:V}},[t,ue]),rt=u.useMemo(()=>new Map(pe.map((p,w)=>[p.key,w])),[pe]),Ve=!ze&&pe.some(p=>(p.col.headerColSpan??1)>1),qe=pe.map(p=>p.key).join("|"),Ct=(p,w)=>{const E=p.sortKey??(typeof p.accessor=="string"?p.accessor:void 0);return E?w[E]:void 0},Qe=p=>p.sortable??(!!p.sortKey||typeof p.accessor=="string"),Ee=u.useMemo(()=>{if(!G||!Y)return r;const p=pe.find(E=>E.key===Y.key);if(!p)return r;const w=Y.direction==="asc"?1:-1;return[...r].sort((E,V)=>bc(Ct(p.col,E),Ct(p.col,V))*w)},[r,G,Y,pe]),He=!ze&&!Ve,St=!!c&&He,[ht,kt]=Q.useColumnWidths(c??""),Ue=St?ht:void 0,pt=u.useRef(null),[Ze,Qt]=u.useState();u.useLayoutEffect(()=>{Qt(void 0)},[qe]),u.useLayoutEffect(()=>{if(!He||Ze||!pt.current)return;const p=pt.current.querySelectorAll("th.sa-tl-leaf");Qt(Array.from(p).map(w=>w.offsetWidth))},[Ze,He]);const[zr,Ut]=u.useState(),[Je,dr]=u.useState(0);u.useLayoutEffect(()=>{if(!ze||!pt.current)return;const p=pt.current.querySelector(":scope > tr");p&&dr(p.offsetHeight)},[ze,qe]);const Tt=(p,w)=>{if((Ue==null?void 0:Ue[w])!=null)return Ue[w];if(p.width!=null)return p.width;if((Ze==null?void 0:Ze[w])!=null)return Ze[w]},ur=(p,w)=>typeof p.width=="number"?p.width:Ze==null?void 0:Ze[w],Bt=ue.frozenKey&&!ze&&!Ve?pe.findIndex(p=>p.key===ue.frozenKey):-1,xr=p=>p<=Bt,wt=W?tr:0,Lt=p=>{const w=zr??Ze;if(!w)return wt;let E=wt;for(let V=0;V<p;V++)E+=w[V]??0;return E};u.useLayoutEffect(()=>{const p=pt.current;if(!p||Bt<0){Ut(void 0);return}let w=0;const E=()=>{w=0;const te=p.querySelectorAll("th.sa-tl-leaf"),ie=Array.from(te).map(oe=>oe.getBoundingClientRect().width);Ut(oe=>oe&&oe.length===ie.length&&oe.every((De,Se)=>Math.abs(De-ie[Se])<.5)?oe:ie)},V=new ResizeObserver(()=>{w||(w=requestAnimationFrame(E))});return V.observe(p),p.querySelectorAll("th.sa-tl-leaf").forEach(te=>V.observe(te)),E(),()=>{w&&cancelAnimationFrame(w),V.disconnect()}},[qe,Bt,W,Ze,Ue]);const Et=u.useRef(null),[Rt,hr]=u.useState("100vh");u.useLayoutEffect(()=>{if(j!==void 0)return;const p=()=>{if(Et.current){const w=Et.current.getBoundingClientRect().top;hr(`calc(100vh - ${w}px - var(--sa-floating-footer-height, 0px) + 12px)`)}};return p(),window.addEventListener("resize",p),()=>window.removeEventListener("resize",p)},[j]);const Ke=(p,w)=>n?n(p,w):w,Yt=O!==void 0,[At,Xt]=u.useState(()=>new Set(J??[])),lt=u.useMemo(()=>Yt?new Set(O):At,[Yt,O,At]);u.useEffect(()=>{W&&!n&&process.env.NODE_ENV!=="production"&&console.warn("[@starasia/admin] TableLayout: `selectable` tanpa `getRowKey` — key default (index) membuat seleksi menempel ke POSISI baris, bukan datanya. Beri `getRowKey` yang stabil (mis. r => r.id).")},[W,!n]);const Ot=p=>{if(Yt||Xt(p),K){const w=Ee.filter((E,V)=>p.has(Ke(E,V)));K(Array.from(p),w)}},Ft=(p,w)=>W&&(X?X(p,w):!0),Wt=p=>{const w=new Set(lt);w.has(p)?w.delete(p):w.add(p),Ot(w)},yt=u.useMemo(()=>W?Ee.map((p,w)=>({row:p,i:w,key:Ke(p,w)})).filter(({row:p,i:w})=>X?X(p,w):!0).map(({key:p})=>p):[],[W,Ee,X,n]),$t=yt.filter(p=>lt.has(p)),zt=yt.length>0&&$t.length===yt.length,b=$t.length>0&&!zt,H=()=>{const p=new Set(lt);zt?yt.forEach(w=>p.delete(w)):yt.forEach(w=>p.add(w)),Ot(p)},_=(p,w,E)=>{const V=p.render?p.render(w,E,Ee):yc(w,p.accessor);if(g&&!p.render&&typeof V=="string"){const te=p.key??(typeof p.accessor=="string"?p.accessor:void 0),ie=te?g[te]:void 0;if(ie)return e.jsx(bs,{text:V,query:ie})}return V},U=pe.length+(W?1:0)+(Z?1:0),ee=["80%","55%","70%","45%","90%","60%"],we=(p,w)=>ee[(p*7+w*3)%ee.length],Fe=(p,w)=>e.jsx(st.Skeleton,{height:14,width:we(p,w),borderRadius:"rounded-sm"}),Me=Array.from({length:L},(p,w)=>e.jsxs(Q.Tr,{children:[W&&e.jsx(Q.Td,{style:{width:tr,padding:0},children:e.jsx("div",{style:{display:"flex",justifyContent:"center"},children:e.jsx(st.Skeleton,{height:14,width:14,borderRadius:"rounded-sm"})})}),pe.map(({col:E,key:V},te)=>e.jsx(Q.Td,{style:{textAlign:rr(E.align)},children:Fe(w,te)},`sa-tl-sk-${w}-${V}`)),Z&&e.jsx(Q.Td,{style:{width:je,padding:0,border:"none"}})]},`sa-tl-sk-${w}`)),_e=(p,w)=>{w||se({...ue,hidden:[...ue.hidden??[],p]})},Ye=p=>se({...ue,frozenKey:ue.frozenKey===p?void 0:p}),nt=p=>(N??[]).filter(w=>{var E;return!((E=w.hidden)!=null&&E.call(w,p))}),It=de?{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:Kr,paddingLeft:jr,paddingRight:jr,height:"100%"}:{position:"absolute",right:0,top:0,bottom:0,display:"flex",alignItems:"center",gap:Kr,paddingRight:jr,paddingLeft:40,background:"linear-gradient(to right, transparent, var(--sa-background-primary-inverse, #f8f8f8) 40px)"},ft=(p,w,E,V)=>{var tt;const te=(tt=p.disabled)==null?void 0:tt.call(p,w),ie=(V==null?void 0:V.showLabel)??p.showLabel,oe=(V==null?void 0:V.size)??"xs",De=e.jsx(P.Button,{size:oe,variant:p.variant??"tertiary",tone:p.tone??"neutral",disabled:te,onClick:()=>p.onClick(w,E),iconLeft:p.icon?e.jsx(B.Icon,{name:p.icon,size:"sm"}):void 0,children:ie&&p.label}),Se=p.tooltip;return Se?e.jsx(Te.Tooltip,{label:Se,position:"top-end",children:De}):De},bt=(p,w)=>{const E=nt(p);if(!E.length)return null;if(E.length>Jr){const te=Ke(p,w),ie=(ge==null?void 0:ge.rowKey)===te;return e.jsx("div",{className:"sa-tl-row-actions","data-mode":de?"column":"overlay",style:It,onClick:oe=>oe.stopPropagation(),children:e.jsx(Te.Tooltip,{label:"Aksi lainnya",position:"top",children:e.jsx(P.Button,{size:"xs",variant:"tertiary",onClick:oe=>{const De=oe.currentTarget.getBoundingClientRect();Oe(ie?null:{rowKey:te,top:De.bottom+4,right:window.innerWidth-De.right})},children:e.jsx(B.Icon,{name:"MenuVertical",size:"sm"})})})})}return e.jsx("div",{className:"sa-tl-row-actions","data-mode":de?"column":"overlay",style:It,children:E.map(te=>e.jsx(u.Fragment,{children:ft(te,p,w)},te.key))})},Jt=(p,w)=>{const E=nt(p);return E.length?e.jsx("div",{style:{display:"flex",gap:6,flexWrap:"wrap",paddingTop:8,marginTop:8,borderTop:er},children:E.map(V=>e.jsx(u.Fragment,{children:ft(V,p,w,{showLabel:!0,size:"sm"})},V.key))}):null},jt=(p,w)=>{const E=nt(p);return E.length?e.jsx("div",{style:{display:"flex",gap:4,paddingRight:8,flexShrink:0},children:E.map(V=>e.jsx(u.Fragment,{children:ft(V,p,w,{showLabel:!1})},V.key))}):null},Hr=(p,w)=>{var Ht;const{col:E,key:V}=p,te=rt.get(V)??0,ie=xr(te),oe=ie&&te===Bt,De=(Y==null?void 0:Y.key)===V?Y.direction:null,Se=h&&!E.disableMenu?e.jsx(ys,{active:!!De||ie||!!E.filterActive,canSort:Qe(E),canHide:!E.locked,sortDir:De,frozen:ie,onSort:mr=>xe({key:V,direction:mr}),onClearSort:()=>xe(null),onToggleFreeze:()=>Ye(V),onHide:()=>_e(V,E.locked),filterSlot:(Ht=E.renderFilter)==null?void 0:Ht.call(E),filterActive:E.filterActive}):null,tt=E.align==="right",Kt=E.align==="right"?"flex-end":E.align==="center"?"center":"flex-start",ct=e.jsxs("span",{style:{flex:1,minWidth:0,display:"flex",alignItems:"center",gap:6,justifyContent:Kt,overflow:"hidden"},children:[E.icon&&e.jsx(B.Icon,{name:E.icon,size:"sm",style:{flexShrink:0}}),e.jsx("span",{style:vr,children:E.title})]});return e.jsx(Q.Th,{className:`sa-tl-leaf${ie?" sa-tl-frozen":""}`,rowSpan:w==null?void 0:w.rowSpan,colSpan:w==null?void 0:w.colSpan,minWidth:E.minWidth,numeric:E.numeric,resizable:He?E.resizable:!1,defaultWidth:ur(E,te),style:{textAlign:rr(E.align),width:Tt(E,te),position:"sticky",top:(w==null?void 0:w.top)??0,left:ie?Lt(te):void 0,zIndex:ie?3:2,backgroundColor:_t,boxShadow:oe?jo:void 0},children:e.jsx("div",{style:{display:"flex",alignItems:"center",gap:6,width:"100%"},children:tt?e.jsxs(e.Fragment,{children:[Se,ct]}):e.jsxs(e.Fragment,{children:[ct,Se]})})},`th-${V}`)},Is=()=>{const p=[];for(let w=0;w<pe.length;){const E=pe[w],V=E.col.headerColSpan??1,te=Math.max(1,Math.min(V,pe.length-w));p.push(Hr(E,te>1?{colSpan:te}:void 0)),w+=te}return p},In=p=>e.jsx(Q.Th,{rowSpan:p==null?void 0:p.rowSpan,style:{width:tr,position:"sticky",top:0,left:0,zIndex:4,backgroundColor:_t,padding:0},children:e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},onClick:w=>w.stopPropagation(),children:e.jsx(mt.Checkbox,{size:"sm",variant:b?"indeterminate":"select",checked:zt||b,disabled:yt.length===0,onChange:H,"aria-label":"Pilih semua baris di halaman ini"})})},"th-select"),Ms=(p,w,E)=>{const V=Ke(p,w);return e.jsx(Q.Td,{className:"sa-tl-frozen",style:{width:tr,padding:0,position:"sticky",left:0,zIndex:2,...E?{"--sa-tl-bg":E}:{}},children:Ft(p,w)&&e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},onClick:te=>te.stopPropagation(),children:e.jsx(mt.Checkbox,{size:"sm",checked:lt.has(V),onChange:()=>Wt(V),"aria-label":"Pilih baris"})})},`tl-select-${w}`)},_r=pe.filter(p=>!p.col.hideOnMobile),Pr=_r.find(p=>p.col.primary)??_r[0],Ts=_r.filter(p=>p!==Pr),Ls=p=>Le(w=>{const E=new Set(w);return E.has(p)?E.delete(p):E.add(p),E}),Mn=(p,w)=>Ts.map(({col:E,key:V})=>{const te=_(E,p,w),ie={minWidth:0,overflow:"hidden",textOverflow:"ellipsis",textAlign:"right",...E.numeric?{fontVariantNumeric:"tabular-nums"}:{}},oe=typeof te=="string"||typeof te=="number"?e.jsx(S.Text,{style:ie,children:te}):e.jsx("div",{style:ie,children:te});return e.jsxs("div",{style:{display:"flex",gap:12,justifyContent:"space-between",alignItems:"baseline"},children:[typeof E.title=="string"?e.jsx(S.Text,{color:"subtle",fontWeight:"medium",style:{color:fc,flexShrink:0},children:E.title}):e.jsx("div",{style:{flexShrink:0},children:E.title}),oe]},V)}),Nr=(p,w)=>{const E=Pr?_(Pr.col,p,w):null;return typeof E=="string"||typeof E=="number"?e.jsx(S.Text,{as:"span",style:vr,children:E}):e.jsx("span",{style:vr,children:E})},Rs=e.jsx(x.Box,{style:{display:"flex",flexDirection:"column",gap:8,padding:8},children:Array.from({length:L},(p,w)=>e.jsxs(x.Box,{style:{border:er,borderRadius:"var(--sa-radii-sm, 6px)",padding:12,display:"flex",flexDirection:"column",gap:8},children:[e.jsx(st.Skeleton,{height:16,width:"60%",borderRadius:"rounded-sm"}),e.jsx(st.Skeleton,{height:12,width:"85%",borderRadius:"rounded-sm"}),e.jsx(st.Skeleton,{height:12,width:"70%",borderRadius:"rounded-sm"})]},`sa-tl-sk-card-${w}`))}),Tn=e.jsx(x.Box,{fullWidth:!0,style:{minHeight:(F==null?void 0:F.minHeight)??320,display:"flex",alignItems:"center",justifyContent:"center",padding:16},children:F==null?void 0:F.content}),As=v?Rs:Ee.length===0?Tn:R==="expand"?e.jsx(x.Box,{style:{display:"flex",flexDirection:"column"},children:Ee.map((p,w)=>{const E=Ke(p,w),V=$e.has(E),ie=W&<.has(E)?en:Cr(s==null?void 0:s(p,w));return e.jsxs("div",{style:{borderBottom:er,backgroundColor:ie},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[Ft(p,w)&&e.jsx("div",{style:{display:"flex",alignItems:"center",paddingLeft:12,flexShrink:0},children:e.jsx(mt.Checkbox,{size:"sm",checked:lt.has(E),onChange:()=>Wt(E),"aria-label":"Pilih baris"})}),e.jsxs("button",{type:"button",onClick:()=>Ls(E),style:{flex:1,minWidth:0,display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,padding:"10px 12px",background:"none",border:"none",font:"inherit",color:"inherit",cursor:"pointer",textAlign:"left"},children:[Nr(p,w),e.jsx(B.Icon,{name:V?"ChevronUp":"ChevronDown",size:"sm",style:{flexShrink:0}})]}),Z&&jt(p,w)]}),V&&e.jsx("div",{style:{padding:"0 12px 12px",display:"flex",flexDirection:"column",gap:6},children:Mn(p,w)})]},E)})}):e.jsx(x.Box,{style:{display:"flex",flexDirection:"column",gap:8,padding:8},children:Ee.map((p,w)=>{const E=Ke(p,w),V=W&<.has(E);return e.jsxs(x.Box,{style:{border:er,borderRadius:"var(--sa-radii-sm, 6px)",padding:12,display:"flex",flexDirection:"column",gap:6,backgroundColor:V?en:Cr(s==null?void 0:s(p,w))},children:[Ft(p,w)?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(mt.Checkbox,{size:"sm",checked:lt.has(E),onChange:()=>Wt(E),"aria-label":"Pilih baris"}),e.jsx("div",{style:{flex:1,minWidth:0},children:Nr(p,w)})]}):Nr(p,w),Mn(p,w),Z&&Jt(p,w)]},E)})}),Os=i&&He&&Ze!==void 0,Ln=l==="fixed"&&!i&&(He?Ze!==void 0:!0),Ws=Ln&&!He,fr=k&&k.length>0?k.map((p,w)=>e.jsx(Q.Tr,{children:p.cells.map((E,V)=>e.jsx(Q.Td,{colSpan:E.colSpan,rowSpan:E.rowSpan,numeric:E.numeric,style:{textAlign:rr(E.align)},children:E.content},`tl-foot-${w}-${V}`))},`tl-foot-${w}`)):null,zs=e.jsxs(Q.Table,{className:"sa-table-layout",fullWidth:!0,size:o,resizable:Os,style:Ln?{tableLayout:"fixed"}:void 0,onWidthsChange:St?kt:void 0,children:[Ws&&e.jsxs("colgroup",{children:[W&&e.jsx("col",{style:{width:tr}}),pe.map(({col:p,key:w},E)=>e.jsx("col",{style:{width:Tt(p,E)}},`col-${w}`)),Z&&e.jsx("col",{style:{width:je}})]}),e.jsx(Q.Thead,{ref:pt,children:ze?e.jsxs(e.Fragment,{children:[e.jsxs(Q.Tr,{children:[W&&In({rowSpan:2}),Ie.map(p=>p.isGroup?e.jsx(Q.Th,{colSpan:p.leaves.length,style:{textAlign:"center",position:"sticky",top:0,zIndex:2,backgroundColor:_t},children:e.jsx("span",{style:vr,children:p.col.title})},`grp-${p.key}`):Hr(p.leaves[0],{rowSpan:2})),Z&&e.jsx(Q.Th,{rowSpan:2,style:{position:"sticky",top:0,right:0,zIndex:3,width:je,padding:0,border:"none",backgroundColor:_t}})]}),e.jsx(Q.Tr,{children:Ie.flatMap(p=>p.isGroup?p.leaves.map(w=>Hr(w,{top:Je})):[])})]}):e.jsxs(Q.Tr,{children:[W&&In(),Is(),Z&&e.jsx(Q.Th,{style:{position:"sticky",top:0,right:0,zIndex:3,width:je,padding:0,border:"none",backgroundColor:_t}})]})}),e.jsx(Q.Tbody,{children:v?Me:Ee.length===0?e.jsx(Q.Tr,{children:e.jsx(Q.Td,{colSpan:U,children:Tn})}):e.jsxs(e.Fragment,{children:[Ee.map((p,w)=>{const E=M==null?void 0:M(p,w,w>0?Ee[w-1]:void 0),te=W&<.has(Ke(p,w))?en:Cr(s==null?void 0:s(p,w));return e.jsxs(u.Fragment,{children:[E!=null&&E!==!1&&e.jsx(Q.Tr,{children:e.jsx(Q.Td,{colSpan:U,style:{backgroundColor:_t},children:E})}),e.jsxs(Q.Tr,{children:[W&&Ms(p,w,te),pe.map(({col:ie,key:oe},De)=>{var Rn;const Se=(Rn=ie.cellProps)==null?void 0:Rn.call(ie,p,w,Ee);if(Se!=null&&Se.hidden)return null;const tt=xr(De),Kt=tt&&De===Bt,ct=_(ie,p,w),Ht=typeof ie.bg=="function"?ie.bg(p,w,Ee):ie.bg,mr=Cr(Ht)??te;return e.jsx(Q.Td,{className:tt?"sa-tl-frozen":void 0,colSpan:Se==null?void 0:Se.colSpan,rowSpan:Se==null?void 0:Se.rowSpan,numeric:ie.numeric,style:{textAlign:rr(ie.align),width:Tt(ie,De),minWidth:ie.minWidth,position:tt?"sticky":void 0,left:tt?Lt(De):void 0,zIndex:tt?1:void 0,boxShadow:Kt?jo:void 0,...mr?{"--sa-tl-bg":mr}:{}},children:typeof ct=="string"?e.jsx(S.Text,{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",textAlign:rr(ie.align)},children:ct}):ct},`tl-cell-${w}-${oe}`)}),Z&&e.jsx(Q.Td,{className:de?"sa-tl-frozen":void 0,style:{position:"sticky",right:0,width:je,padding:0,overflow:de?void 0:"visible",zIndex:2,border:"none"},children:bt(p,w)})]})]},Ke(p,w))}),C!=null&&e.jsx(Q.Tr,{children:e.jsx(Q.Td,{colSpan:U,children:C})})]})}),fr&&e.jsx(Q.Tfoot,{className:T?"sa-tl-sticky-foot":void 0,children:fr})]}),Vr=ge?Ee.findIndex((p,w)=>Ke(p,w)===ge.rowKey):-1,qr=Vr>=0?Ee[Vr]:null;return e.jsxs(e.Fragment,{children:[e.jsx(x.Box,{ref:Et,className:"sa-tl-scroll",fullWidth:!0,style:{overflow:"auto",height:j??Rt},children:ae?e.jsxs(e.Fragment,{children:[As,fr&&!v&&Ee.length>0&&e.jsx(x.Box,{style:{borderTop:er},children:e.jsx(Q.Table,{fullWidth:!0,size:o,className:"sa-table-layout",children:e.jsx(Q.Tbody,{children:fr})})})]}):zs}),ge&&qr&&e.jsx("div",{className:"sa-tl-kebab-menu",style:{top:ge.top,right:ge.right},onClick:p=>p.stopPropagation(),children:nt(qr).map(p=>e.jsx("div",{style:{padding:"2px 4px"},children:ft(p,qr,Vr,{showLabel:!0,size:"sm"})},p.key))})]})},tn=t=>t==="asc"||t==="desc",vc=(t={})=>{const{sortKeyParam:r="sortBy",sortOrderParam:n="sortOrder",pageKey:s="page",defaultSort:o=null,paramKeys:i,scopeId:l,storage:c=En}=t,{searchParams:a,setSearchParams:d,searchQueries:h}=Xe(),g=a.toString(),m=l?Gt.tableSort(l):void 0,y=u.useRef(!1);u.useEffect(()=>{if(y.current||(y.current=!0,!m)||a.has(r)||a.has(n))return;const C=c.get(m);!(C!=null&&C.key)||!tn(C.direction)||d({...Object.fromEntries(a.entries()),[r]:C.key,[n]:C.direction},{replace:!0})},[]);const D=u.useMemo(()=>{const C=a.get(r),k=a.get(n);return C&&tn(k)?{key:C,direction:k}:o},[g,r,n,o]);u.useEffect(()=>{if(!m)return;const C=a.get(r),k=a.get(n);C&&tn(k)?c.set(m,{key:C,direction:k}):c.remove(m)},[g,m,r,n,c]);const j=(i==null?void 0:i.sortBy)??"sortBy",R=(i==null?void 0:i.sortOrder)??"sortOrder",I=u.useMemo(()=>D?{[j]:D.key,[R]:D.direction}:{},[D,j,R]),M=u.useCallback(C=>{const k={...h};C?(k[r]=C.key,k[n]=C.direction):(delete k[r],delete k[n]),delete k[s],d(k)},[h,r,n,s,d]);return{sort:D,setSort:M,params:I}},Tr=({of:t,render:r})=>u.Children.toArray(t==null?void 0:t.map((n,s,o)=>r(n,s,o))),me=({condition:t,fallback:r,children:n,loading:s,isLoading:o})=>e.jsx(e.Fragment,{children:o?s:t?n:r}),ye=t=>e.jsx(S.Text,{...t,fontSize:t.fontSize||"md",fontWeight:t.fontWeight||"medium",color:t.color||"gray-700",children:t.children}),vt=t=>e.jsx(S.Text,{color:"red-600",fontSize:"sm",children:t.message}),Cc=({size:t="md",direction:r="vertical",requiredTitle:n="(Required)",fullWidth:s=!1,...o})=>{var c,a,d;const i=o.hideMessageError||!1,l=r==="horizontal"?t==="sm"?342:t==="lg"?400:342:void 0;return e.jsxs(x.Box,{gap:r==="horizontal"?"spacing-96":"sm",direction:r==="horizontal"?"row":"column",...o.containerProps,children:[o.title&&e.jsx(me,{condition:!!o.inputProps.required,fallback:e.jsxs(x.Box,{direction:"column",customMaxWidth:l,fullWidth:s,children:[e.jsx(ye,{children:o.title}),e.jsx(S.Text,{fontSize:t,color:"gray-500",children:o.description})]}),children:e.jsxs(x.Box,{direction:"column",customMaxWidth:l,fullWidth:s,children:[e.jsxs(fe.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(ye,{fontSize:t,children:o.title}),e.jsx(ye,{color:"error",fontSize:t,children:n}),e.jsx(me,{condition:!!((c=o.tooltip)!=null&&c.label),children:e.jsx(Te.Tooltip,{label:(a=o.tooltip)==null?void 0:a.label,arrowPosition:(d=o.tooltip)==null?void 0:d.arrowPosition,focusable:!0,...o.tooltip,children:e.jsx(B.Icon,{name:"InfoCircle",size:t==="lg"?"sm":"xs",style:{color:"var(--sa-color-info-500, #00abeb)",marginTop:"6px"}})})})]}),e.jsx(me,{condition:!!o.description,children:e.jsx(S.Text,{fontSize:t,color:"gray-500",children:o.description})})]})}),e.jsxs(x.Box,{direction:"column",gap:"xs",fullWidth:o.inputProps.fullWidth||!1,children:[e.jsx(gt.Input,{ref:o.inputRef,size:t,...o.inputProps,status:o.errorMessage?"error":"default",fullWidth:!0}),!i&&o.errorMessage&&e.jsx(vt,{message:o.errorMessage}),o.inputProps.extended&&o.inputProps.extended]})]})},wc=({size:t="md",direction:r="vertical",requiredTitle:n="(Required)",fullWidth:s=!1,...o})=>{var c,a,d;const i=o.hideMessageError||!1,l=r==="horizontal"?t==="sm"?342:t==="lg"?400:342:void 0;return e.jsxs(x.Box,{gap:r==="horizontal"?"spacing-96":"sm",direction:r==="horizontal"?"row":"column",onClick:o.onClickContainer,children:[o.title&&e.jsx(me,{condition:!!o.inputProps.required,fallback:e.jsxs(x.Box,{direction:"column",customMaxWidth:l,fullWidth:s,children:[e.jsx(ye,{children:o.title}),e.jsx(S.Text,{fontSize:t,color:"gray-500",children:o.description})]}),children:e.jsxs(x.Box,{direction:"column",customMaxWidth:l,fullWidth:s,children:[e.jsxs(fe.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(ye,{fontSize:t,children:o.title}),e.jsx(ye,{color:"error",fontSize:t,children:n}),e.jsx(me,{condition:!!((c=o.tooltip)!=null&&c.label),children:e.jsx(Te.Tooltip,{label:(a=o.tooltip)==null?void 0:a.label,arrowPosition:(d=o.tooltip)==null?void 0:d.arrowPosition,focusable:!0,...o.tooltip,children:e.jsx(B.Icon,{name:"InfoCircle",size:t==="lg"?"sm":"xs",style:{color:"var(--sa-color-info-500, #00abeb)",marginTop:"6px"}})})})]}),e.jsx(me,{condition:!!o.description,children:e.jsx(S.Text,{fontSize:t,color:"gray-500",children:o.description})})]})}),e.jsxs(x.Box,{direction:"column",gap:"xs",fullWidth:o.inputProps.fullWidth||!1,children:[e.jsx(x.Box,{direction:"column",style:{width:o.inputProps.fullWidth?"100%":r==="horizontal"&&o.customWidth?o.customWidth:r==="horizontal"?"343px":""},children:e.jsx(Vt.Dropdown,{size:t,...o.inputProps,error:!!o.errorMessage})}),!i&&o.errorMessage&&e.jsx(vt,{message:o.errorMessage}),o.inputProps.extended&&o.inputProps.extended]})]})},Dc=(t,r)=>typeof t=="string"&&t||r==="error"?"var(--sa-border-danger)":"var(--sa-border-subtle)",Sc=t=>{var c;const[r,n]=u.useState(!1),s=a=>{a.preventDefault(),a.stopPropagation()},o=a=>{a.preventDefault(),a.stopPropagation(),a.dataTransfer&&t.handleOnFileChange(a.dataTransfer.files.item(0))},i=a=>{a.preventDefault(),n(!0)},l=a=>{a.preventDefault(),n(!1)};return e.jsxs(x.Box,{width:"width-full",paddingInline:"md",direction:"row",gap:"sm",align:"center",onClick:t.handleOnClick,onDragOver:s,onDrop:o,onDragEnter:i,onDragLeave:l,paddingBlock:"md",borderRadius:"rounded-md",style:{border:r?"1px solid var(--sa-border-info)":`1px solid ${Dc(t.errorMessage,t.status)}`},children:[e.jsx(B.Icon,{name:"Upload",size:"lg",style:{width:30,height:30}}),e.jsxs(fe.Flex,{direction:"column",gap:"xs",children:[e.jsxs(fe.Flex,{direction:"row",gap:"xs",children:[e.jsx(S.Text,{fontWeight:"medium",color:"gray-500",style:{textWrap:"nowrap"},fontSize:t.isDesktop?"md":"sm",children:"Click your upload"}),e.jsx(S.Text,{fontWeight:"medium",style:{textWrap:"nowrap"},fontSize:t.isDesktop?"md":"sm",children:"or Drag & Drop"})]}),e.jsx(S.Text,{fontSize:"sm",color:"gray-500",children:(c=t.fileSupports)==null?void 0:c.map(a=>a.toLocaleUpperCase()).join(", ")})]})]})};function kc(t){return t.split(" ").map(r=>r[0]).join("").slice(0,2).toUpperCase()}const js=t=>{const r={day:"2-digit",month:"short",year:"numeric"};return t.toLocaleDateString("id-ID",r)},Bc=t=>{const r={Jan:0,Feb:1,Mar:2,Apr:3,Mei:4,Jun:5,Jul:6,Agu:7,Sep:8,Okt:9,Nov:10,Des:11},n=t.split(" ");if(n.length!==3)return null;const s=parseInt(n[0],10),o=r[n[1]],i=parseInt(n[2],10);return isNaN(s)||isNaN(o)||isNaN(i)?null:new Date(i,o,s)};function Ec(t,r=!0){if(!t)return"Rp 0";const n=typeof t=="number"?t.toString():t;if(isNaN(Number(n)))return"Rp 0";const s=n.split("."),o=s[0].replace(/\B(?=(\d{3})+(?!\d))/g,"."),i=s.length===2?o+"."+s[1]:o;return r?"Rp"+i:i}String.prototype.toTitleCase=function(){return this.toLowerCase().split(" ").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")};String.prototype.toNumber=function(){return Number(this)};const Fc=t=>{const r=t.split(" ");let n=r[0].charAt(0);return r.length>1&&(n+=""+r[1].charAt(0)),n.toUpperCase()};function Ic(t){const r=typeof t=="string"?new Date(t):t;if(isNaN(r.getTime()))throw new Error("Invalid date format");const n=r.getFullYear(),s=String(r.getMonth()+1).padStart(2,"0"),o=String(r.getDate()).padStart(2,"0");return`${n}-${s}-${o}`}const Mc="sa-admin",at=t=>`var(--${Mc}-${t})`,Tc={base:{borderColor:at("base-border-color"),textColor:at("base-text-color"),iconColor:at("base-icon-color"),placeholderColor:at("base-placeholder-color")},document:{bgColor:at("document-bg-color")},sidebar:{bgColor:at("sidebar-bg-color"),borderColor:at("sidebar-border-color"),maxWidth:at("sidebar-max-width"),width:at("sidebar-width"),collapseWidth:at("sidebar-collapse-width"),collapseV2Width:at("sidebar-v2-collapse-width")}},Lc=24*60*60*1e3,Rc=t=>{const r="14px poppins",s=document.createElement("canvas").getContext("2d");s.font=r;const o=s.measureText(t).width;return Number(Math.ceil(o))},Ac=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,Oc=/--+/,Wc=/-$/;function zc(t,r){return JSON.stringify(t)!==JSON.stringify(r)}function Hc(t){return/^(?:\+62|62|0)8[1-9][0-9]{7,10}$/.test(t)}function _c(t){return/^[A-Za-z\s]+$/.test(t)}const Pc=t=>{const r=/^[0-9]$/,n=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Backspace","Delete","Enter","Tab"];(t.ctrlKey||t.metaKey)&&(t.key==="a"||t.key==="c"||t.key==="v")||!r.test(t.key)&&!n.includes(t.key)&&t.preventDefault()},Nc=t=>{const r=/^[0-9]$/,n=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Backspace","Delete","Enter","Tab"];(t.ctrlKey||t.metaKey)&&t.key==="v"||r.test(t.key)&&!n.includes(t.key)&&t.preventDefault()},Vc=t=>{const r=/^[0-9.]$/,n=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Backspace","Delete","Enter","Tab"];(t.ctrlKey||t.metaKey)&&t.key==="v"||!r.test(t.key)&&!n.includes(t.key)&&t.preventDefault()},qc=t=>Ac.test(t);function Zc(t){return!(Oc.test(t)||Wc.test(t))}const Gc=t=>{const r=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Backspace","Delete","Enter","Tab","Home","End"];if((t.ctrlKey||t.metaKey)&&["a","c","v","x"].includes(t.key.toLowerCase()))return;const n=t.currentTarget.value;/^[0-9]$/.test(t.key)||t.key==="."&&!n.includes(".")||t.key==="-"&&n.length===0&&!n.includes("-")||r.includes(t.key)||t.preventDefault()},Qc=t=>{const r=document.getElementById(t);if(r){const n=r.getBoundingClientRect(),s=window.scrollY+n.top-80;window.scrollTo({top:s,behavior:"smooth"})}};function Uc(t){const r=t.toLowerCase();if(["kb","mb","gb"].find(i=>r.endsWith(i)))return t;const o=Number(t);if(isNaN(o))throw new Error("Invalid size format");return o>=1e6?`${(o/1e6).toFixed(2)}MB`:o>=1e3?`${(o/1e3).toFixed(2)}KB`:`${o}B`}function Yc(t){const r=t.split("/");return r[r.length-1]}const Xc=t=>{var r,n;return e.jsxs(x.Box,{width:"width-full",paddingInline:"md",height:"height-full",direction:"row",justify:"space-between",align:"center",onClick:t.handleOnClickFile,fullHeight:!0,paddingBlock:"md",id:"file-item",borderRadius:"rounded-md",style:{border:"1px solid var(--sa-border-subtle)",cursor:"pointer"},children:[e.jsxs(fe.Flex,{direction:"row",align:"center",gap:"sm",style:{flex:1,minWidth:0},children:[e.jsx(B.Icon,{name:"DocumentFilled",size:"lg",style:{color:"var(--sa-icon-brand)",width:30,height:30,flexShrink:0}}),e.jsxs(fe.Flex,{direction:"column",style:{minWidth:0,flex:1},children:[e.jsx(S.Text,{fontWeight:"bold",style:{textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden"},children:t.defaultFile?Yc(t.defaultFile.url):(r=t.fileSelected)==null?void 0:r.name}),t.defaultFile?(t.defaultFile.size||t.defaultFile.date)&&e.jsxs(fe.Flex,{direction:"row",gap:"xs",align:"center",children:[t.defaultFile.size&&e.jsx(S.Text,{fontSize:"sm",fontWeight:"medium",children:t.defaultFile.size}),t.defaultFile.size&&t.defaultFile.date&&e.jsx(B.Icon,{name:"Dot",size:"xs"}),t.defaultFile.date&&e.jsx(S.Text,{fontSize:"sm",fontWeight:"medium",style:{textWrap:"nowrap"},children:t.defaultFile.date})]}):e.jsxs(fe.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(S.Text,{fontSize:"sm",fontWeight:"medium",children:Uc(((n=t.fileSelected)==null?void 0:n.size.toString())||"100000")}),e.jsx(B.Icon,{name:"Dot",size:"xs"}),e.jsx(S.Text,{fontSize:"sm",fontWeight:"medium",style:{textWrap:"nowrap"},children:js(new Date)})]})]})]}),e.jsx(P.Button,{size:"xs",variant:"tertiary",tone:"error",type:"button",onClick:s=>{s.stopPropagation(),t.handleOnDeleteFile()},iconLeft:e.jsx(B.Icon,{name:"Trash1"})})]})},vs=({status:t="default",labelPosition:r="outside-top",...n})=>{var m;const s=u.useRef(null),o=()=>{if(n.defaultFile){window.open(n.defaultFile.url);return}s.current&&s.current.click()},i=ke.useMediaQuery("md"),l=t==="error"||typeof n.errorMessage=="string"&&!!n.errorMessage,c=n.label?e.jsxs(fe.Flex,{direction:"row",align:"center",gap:"xs",children:[e.jsx(S.Text,{style:{fontSize:"14px",fontWeight:500,color:"var(--sa-text-primary)"},children:n.label}),n.optional&&e.jsx("span",{style:{background:"var(--sa-background-neutral)",border:"1px solid var(--sa-border-subtle)",borderRadius:"var(--sa-radii-xs, 4px)",padding:"0 8px",fontSize:"10px",fontWeight:500,lineHeight:"18px",color:"var(--sa-text-primary)",display:"inline-flex",alignItems:"center"},children:"Optional"}),n.required&&e.jsx("span",{style:{fontSize:"14px",fontWeight:500,color:"var(--sa-text-error)"},children:"*"})]}):null,a=n.description?e.jsx(S.Text,{style:{fontSize:"12px",fontWeight:400,color:"var(--sa-text-subtlest, #6b6e76)",lineHeight:"18px"},children:n.description}):null,d=e.jsxs(e.Fragment,{children:[n.helperText&&e.jsx(S.Text,{style:{fontSize:"12px",fontWeight:400,color:"var(--sa-text-subtlest, #6b6e76)",lineHeight:"18px"},children:n.helperText}),n.errorText&&t==="error"&&e.jsx(S.Text,{style:{fontSize:"12px",fontWeight:400,color:"var(--sa-text-error, #a4133c)",lineHeight:"18px"},children:n.errorText}),n.errorMessage&&!n.errorText&&e.jsx(S.Text,{style:{fontSize:"12px",fontWeight:400,color:"var(--sa-text-error, #a4133c)",lineHeight:"18px"},children:n.errorMessage})]}),h=e.jsx("input",{type:"file",style:{display:"none"},ref:s,onChange:y=>{var D;return n.handleOnChangeFile(((D=y.target.files)==null?void 0:D.item(0))||null)},accept:(m=n.fileSupportOption)==null?void 0:m.map(y=>"."+(y==null?void 0:y.toLowerCase())).join(", ")}),g=e.jsxs(x.Box,{direction:"column",fullWidth:!0,style:{minHeight:"69px"},borderRadius:"rounded-md",display:"flex",justify:"center",align:"center",cursor:"pointer",gap:"md",...n.containerProps,children:[h,(n.fileSelected||n.defaultFile)&&e.jsx(Xc,{fileSelected:n.fileSelected,defaultFile:n.defaultFile,handleOnDeleteFile:n.handleOnDeleteFile,handleOnClickFile:o}),!n.fileSelected&&!n.defaultFile&&e.jsx(Sc,{fileSupports:n.fileSupportOption,isDesktop:i,errorMessage:l?n.errorText||n.errorMessage||" ":void 0,status:l?"error":"default",handleOnClick:o,handleOnFileChange:n.handleOnChangeFile})]});return r==="outside-left"?e.jsxs(fe.Flex,{direction:"row",align:"flex-start",gap:"sm",style:{width:"100%"},children:[e.jsxs(fe.Flex,{direction:"column",gap:"xs",style:{width:"40%",minWidth:"120px",paddingTop:"10px"},children:[c,a]}),e.jsxs(fe.Flex,{direction:"column",gap:"sm",style:{flex:1,minWidth:0},children:[g,d]})]}):e.jsxs(fe.Flex,{direction:"column",gap:"sm",style:{width:"100%"},children:[c,a,g,d]})},$c=({size:t="md",direction:r="vertical",requiredTitle:n="(Required)",fullWidth:s=!1,...o})=>{var c,a,d;const i=o.hideMessageError||!1,l=r==="horizontal"?t==="sm"?342:t==="lg"?400:342:void 0;return e.jsxs(x.Box,{gap:r==="horizontal"?"spacing-96":"sm",direction:r==="horizontal"?"row":"column",...o.containerProps,children:[o.title&&e.jsx(me,{condition:!!o.inputProps.required,fallback:e.jsxs(x.Box,{direction:"column",customMaxWidth:l,fullWidth:s,children:[e.jsx(ye,{children:o.title}),e.jsx(S.Text,{fontSize:t,color:"gray-500",children:o.description})]}),children:e.jsxs(x.Box,{direction:"column",customMaxWidth:l,fullWidth:s,children:[e.jsxs(fe.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(ye,{fontSize:t,children:o.title}),e.jsx(ye,{color:"error",fontSize:t,children:n}),e.jsx(me,{condition:!!((c=o.tooltip)!=null&&c.label),children:e.jsx(Te.Tooltip,{label:(a=o.tooltip)==null?void 0:a.label,arrowPosition:(d=o.tooltip)==null?void 0:d.arrowPosition,focusable:!0,...o.tooltip,children:e.jsx(B.Icon,{name:"InfoCircle",size:t==="lg"?"sm":"xs",style:{color:"var(--sa-color-info-500, #00abeb)",marginTop:"6px"}})})})]}),e.jsx(me,{condition:!!o.description,children:e.jsx(S.Text,{fontSize:t,color:"gray-500",children:o.description})})]})}),e.jsxs(fe.Flex,{direction:"column",gap:"xs",children:[e.jsx(vs,{...o.inputProps,status:o.errorMessage?"error":"default"}),!i&&o.errorMessage&&e.jsx(vt,{message:o.errorMessage})]})]})},Jc=({size:t="md",direction:r="vertical",requiredTitle:n="(Required)",fullWidth:s=!1,required:o=!1,...i})=>{var a,d,h,g;const l=i.hideMessageError||!1,c=r==="horizontal"?t==="sm"?342:t==="lg"?400:342:void 0;return e.jsxs(x.Box,{gap:r==="horizontal"||r==="horizontal-inline"?"spacing-96":"sm",direction:r==="horizontal"||r==="horizontal-inline"?"row":"column",...i.containerProps,children:[i.title&&e.jsx(me,{condition:!!o,fallback:e.jsxs(x.Box,{direction:"column",customMaxWidth:c,fullWidth:s,children:[e.jsx(ye,{children:i.title}),e.jsx(it.Body3,{props:{color:"gray-500"},children:i.description})]}),children:e.jsxs(x.Box,{direction:"column",customMaxWidth:c,fullWidth:s,children:[e.jsxs(fe.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(ye,{fontSize:t,children:i.title}),e.jsx(ye,{color:"error",fontSize:t,children:n}),e.jsx(me,{condition:!!((a=i.tooltip)!=null&&a.label),children:e.jsx(Te.Tooltip,{label:(d=i.tooltip)==null?void 0:d.label,arrowPosition:(h=i.tooltip)==null?void 0:h.arrowPosition,focusable:!0,...i.tooltip,children:e.jsx(B.Icon,{name:"InfoCircle",size:t==="lg"?"sm":"xs",style:{color:"var(--sa-color-info-500, #00abeb)",marginTop:"6px"}})})})]}),e.jsx(me,{condition:!!i.description,children:e.jsx(S.Text,{fontSize:t,color:"gray-500",children:i.description})})]})}),e.jsx(x.Box,{gap:r==="horizontal-inline"?"xl":"md",direction:r==="horizontal-inline"?"row":"column",align:"flex-start",children:e.jsx(Tr,{of:(g=i.checkBoxesList)==null?void 0:g.map(m=>({...m,isChecked:i.checkBoxesAreChecked.includes(m.id)})),render:m=>m.renderBadge?e.jsxs(x.Box,{direction:"row",justify:"space-between",gap:"lg",...i.badgeContainerProps,children:[e.jsx(mt.Checkbox,{name:m.name,value:m.id,checked:m.isChecked,onChange:y=>i.onChecked(y.target.value,m),label:m.name,description:m.description}),m.renderBadge]}):e.jsx(mt.Checkbox,{name:m.name,value:m.id,checked:m.isChecked,onChange:y=>i.onChecked(y.target.value,m),label:m.name,description:m.description})})}),!l&&i.errorMessage&&e.jsx(vt,{message:i.errorMessage})]})},Kc=({position:t="vertical",size:r="md",fullWidth:n=!1,...s})=>{var i;const o=t==="horizontal-inline"||t==="horizontal-block"?r==="sm"?342:r==="lg"?400:342:void 0;return e.jsxs(x.Box,{gap:t==="horizontal-inline"||t==="horizontal-block"?"spacing-96":"sm",direction:t==="horizontal-inline"||t==="horizontal-block"?"row":"column",children:[e.jsx(me,{condition:!!s.description||!!s.title,children:e.jsxs(x.Box,{direction:"column",customMaxWidth:o,fullWidth:n,children:[s.title&&e.jsx(ye,{children:s.title}),e.jsx(me,{condition:!!s.description,children:e.jsx(S.Text,{color:"gray-500",children:s.description})})]})}),e.jsx(x.Box,{gap:"sm",direction:t==="horizontal"||t==="horizontal-inline"?"row":"column",align:"flex-start",flexWrap:"wrap",children:e.jsx(Tr,{of:(i=s.radioList)==null?void 0:i.map(l=>({...l,isChecked:s.radioIsChecked===l.id})),render:({value:l,id:c,isChecked:a,subInput:d,label:h,description:g})=>e.jsxs(x.Box,{direction:"column",gap:"xs",customMaxWidth:o,children:[e.jsx(ln.Radio,{id:`${c.toString()}-${l}`,name:s.groupName||h,label:h,value:l,checked:a,onChange:m=>s.onChecked({id:c,label:m.target.name,value:m.target.value}),disabled:s.disableAll},c),g&&e.jsx(S.Text,{color:"gray-500",style:{marginLeft:28},children:g}),d]})})}),s.errorMessage&&e.jsx(vt,{message:s.errorMessage})]})},ea=({size:t="md",direction:r="vertical",requiredTitle:n="(Required)",fullWidth:s=!1,...o})=>{var c,a,d;const i=o.hideMessageError||!1,l=r==="horizontal"?t==="sm"?342:t==="lg"?400:342:void 0;return e.jsxs(x.Box,{gap:r==="horizontal"?"spacing-96":"sm",direction:r==="horizontal"?"row":"column",...o.containerProps,children:[o.title&&e.jsx(me,{condition:!!o.inputProps.required,fallback:e.jsxs(x.Box,{direction:"column",customMaxWidth:l,fullWidth:s,children:[e.jsx(ye,{children:o.title}),e.jsx(S.Text,{fontSize:t,color:"gray-500",children:o.description})]}),children:e.jsxs(x.Box,{direction:"column",customMaxWidth:l,fullWidth:s,children:[e.jsxs(fe.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(ye,{fontSize:t,children:o.title}),e.jsx(ye,{color:"error",fontSize:t,children:n}),e.jsx(me,{condition:!!((c=o.tooltip)!=null&&c.label),children:e.jsx(Te.Tooltip,{label:(a=o.tooltip)==null?void 0:a.label,arrowPosition:(d=o.tooltip)==null?void 0:d.arrowPosition,focusable:!0,...o.tooltip,children:e.jsx(B.Icon,{name:"InfoCircle",size:t==="lg"?"sm":"xs",style:{color:"var(--sa-color-info-500, #00abeb)",marginTop:"6px"}})})})]}),e.jsx(me,{condition:!!o.description,children:e.jsx(S.Text,{fontSize:t,color:"gray-500",children:o.description})})]})}),e.jsxs(fe.Flex,{direction:"column",gap:"xs",children:[e.jsx(sn.Textarea,{ref:o.inputRef,size:t,...o.inputProps,status:o.errorMessage?"error":"default"}),!i&&o.errorMessage&&e.jsx(vt,{message:o.errorMessage})]})]})},ta=({size:t="md",direction:r="vertical",requiredTitle:n="(Required)",required:s=!1,fullWidth:o=!1,...i})=>{var c,a,d;const l=r==="horizontal"?t==="sm"?342:t==="lg"?400:342:void 0;return e.jsxs(x.Box,{gap:r==="horizontal"?"spacing-96":"sm",direction:r==="horizontal"?"row":"column",...i.containerProps,children:[i.title&&e.jsx(me,{condition:s,fallback:e.jsxs(x.Box,{direction:"column",customMaxWidth:l,fullWidth:o,children:[e.jsx(ye,{children:i.title}),e.jsx(S.Text,{fontSize:t,color:"gray-500",children:i.titleDescription})]}),children:e.jsxs(x.Box,{direction:"column",customMaxWidth:l,fullWidth:o,children:[e.jsxs(fe.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(ye,{fontSize:t,children:i.title}),e.jsx(ye,{color:"error",fontSize:t,children:n}),e.jsx(me,{condition:!!((c=i.tooltip)!=null&&c.label),children:e.jsx(Te.Tooltip,{label:(a=i.tooltip)==null?void 0:a.label,arrowPosition:(d=i.tooltip)==null?void 0:d.arrowPosition,focusable:!0,...i.tooltip,children:e.jsx(B.Icon,{name:"InfoCircle",size:t==="lg"?"sm":"xs",style:{color:"var(--sa-color-info-500, #00abeb)",marginTop:"6px"}})})})]}),e.jsx(me,{condition:!!i.titleDescription,children:e.jsx(S.Text,{fontSize:t,color:"gray-500",children:i.titleDescription})})]})}),e.jsx(Zt.Toggle,{checked:i.checked,onChange:i.onChange,label:i.label,description:i.description}),i.errorMessage&&e.jsx(vt,{message:i.errorMessage})]})},ra=({variant:t="primary",size:r="md",...n})=>{const s=Nt.useColor(),o=l=>{var a,d,h,g,m,y;if(!l)return;const c=n.disabled?"var(--sa-text-disable, #181a198f)":t==="secondary"?"var(--sa-text-subtle, #8c8f97)":t==="secondary-danger"?(d=(a=s==null?void 0:s.computed)==null?void 0:a.red)==null?void 0:d[600]:t==="secondary-primary"?(g=(h=s==null?void 0:s.computed)==null?void 0:h.blue)==null?void 0:g[700]:(y=(m=s==null?void 0:s.computed)==null?void 0:m.gray)==null?void 0:y[50];return e.jsx(B.Icon,{name:l,size:r,style:{color:c}})},i=()=>{var c,a,d,h;if(t!=="secondary-danger"&&t!=="secondary-primary")return n.title;const l={color:n.disabled?"var(--sa-text-disable, #181a198f)":t==="secondary-danger"?(a=(c=s==null?void 0:s.computed)==null?void 0:c.red)==null?void 0:a[600]:(h=(d=s==null?void 0:s.computed)==null?void 0:d.blue)==null?void 0:h[700]};switch(r){case"xs":return e.jsx(it.Body2,{props:{style:l},children:n.title});case"sm":case"md":return e.jsx(it.SubH3,{props:{style:l},children:n.title});case"lg":return e.jsx(it.SubH2,{props:{style:l},children:n.title});default:return n.title}};return e.jsx(P.Button,{fullWidth:!0,disabled:n.disabled,primary:t==="primary",secondary:t==="secondary"||t==="secondary-danger"||t==="secondary-primary",success:t==="success",onClick:n.onClick,type:n.type,iconLeft:o(n.iconLeft),iconRight:o(n.iconRight),size:r,children:i()})},na=t=>e.jsx(it.H5,{props:{...t},children:t.title}),oa=({size:t="md",direction:r="vertical",requiredTitle:n="(Required)",fullWidth:s=!1,...o})=>{var c,a,d;const i=o.hideMessageError||!1,l=r==="horizontal"?t==="sm"?342:t==="lg"?400:342:void 0;return e.jsxs(x.Box,{gap:r==="horizontal"?"spacing-96":"sm",direction:r==="horizontal"?"row":"column",onClick:o.onClickContainer,children:[o.title&&e.jsx(me,{condition:!!o.inputProps.required,fallback:e.jsxs(x.Box,{direction:"column",customMaxWidth:l,fullWidth:s,children:[e.jsx(ye,{children:o.title}),e.jsx(S.Text,{fontSize:t,color:"gray-500",children:o.description})]}),children:e.jsxs(x.Box,{direction:"column",customMaxWidth:l,fullWidth:s,children:[e.jsxs(fe.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(ye,{fontSize:t,children:o.title}),e.jsx(ye,{color:"error",fontSize:t,children:n}),e.jsx(me,{condition:!!((c=o.tooltip)!=null&&c.label),children:e.jsx(Te.Tooltip,{label:(a=o.tooltip)==null?void 0:a.label,arrowPosition:(d=o.tooltip)==null?void 0:d.arrowPosition,focusable:!0,...o.tooltip,children:e.jsx(B.Icon,{name:"InfoCircle",size:t==="lg"?"sm":"xs",style:{color:"var(--sa-color-info-500, #00abeb)",marginTop:"6px"}})})})]}),e.jsx(me,{condition:!!o.description,children:e.jsx(S.Text,{fontSize:t,color:"gray-500",children:o.description})})]})}),e.jsxs(fe.Flex,{direction:"column",gap:"xs",children:[e.jsx(x.Box,{direction:"column",style:{width:r==="horizontal"&&o.customWidth?o.customWidth:r==="horizontal"?"343px":""},children:e.jsx(Dt.StarasiaDate,{size:t,...o.inputProps,status:o.errorMessage?"error":void 0})}),!i&&o.errorMessage&&e.jsx(vt,{message:o.errorMessage})]})]})};async function sa(t,r){const n=new Image;n.src=t,await new Promise((i,l)=>{n.onload=i,n.onerror=l});const s=document.createElement("canvas");s.width=r.width,s.height=r.height;const o=s.getContext("2d",{alpha:!0});if(!o)throw new Error("No 2D context");return o.drawImage(n,r.x,r.y,r.width,r.height,0,0,r.width,r.height),new Promise((i,l)=>{s.toBlob(c=>{if(!c)return l("Canvas is empty");const a=new File([c],"cropped.png",{type:"image/png"});i(a)},"image/png")})}const Co={"1:1":1,"4:3":4/3,"16:9":16/9,"3:4":3/4,"9:16":9/16,"2:3":2/3,"3:2":3/2,"32:9":32/9},Cs=u.forwardRef(({handleUpload:t,urlImage:r,isUploading:n,croppedImage:s,setCroppedImage:o,size:i="96",aspect:l="1:1",containerProps:c,maxFileSize:a=2,onError:d},h)=>{const g=ke.useMediaQuery("md"),[m,y]=u.useState(!1),[D,j]=u.useState(null),[R,I]=u.useState(!1),[M,C]=u.useState({x:0,y:0}),[k,T]=u.useState(1),[F,v]=u.useState(null),[L,N]=u.useState(!1);u.useEffect(()=>{r===null&&o(null)},[r]);const q=u.useCallback((ne,de)=>{v(de)},[]),W=ne=>{var Be;const de=(Be=ne.target.files)==null?void 0:Be[0];if(!de)return;const ve=new FileReader;ve.onload=()=>{j(ve.result),I(!0)},ve.readAsDataURL(de)},O=async()=>{if(!(!D||!F||L)){N(!0);try{const ne=await sa(D,F);if(a&&ne.size>a*1024*1024){d==null||d(`Ukuran file maksimal ${a}MB`);return}t==null||t(ne);const de=URL.createObjectURL(ne);o(de,ne),I(!1)}catch{d==null||d("Gagal memproses gambar")}finally{N(!1)}}},J=u.useRef(null),K=()=>{J.current&&J.current.click()};u.useImperativeHandle(h,()=>({openFileDialog:()=>{var ne;(ne=J.current)==null||ne.click()}}));const X=parseInt(i,10),$=Co[l];let ae,Z;return $>=1?(Z=X,ae=X*$):(ae=X,Z=X/$),e.jsxs(x.Box,{direction:"column",display:"flex",position:"relative",bg:(c==null?void 0:c.bg)||"gray-200",borderStyle:(c==null?void 0:c.borderStyle)||"border-none",borderColor:(c==null?void 0:c.borderColor)||"gray-200",borderWidth:(c==null?void 0:c.borderWidth)||"border-2",borderRadius:(c==null?void 0:c.borderRadius)||"rounded-md",overflow:"overflow-hidden",align:"center",justify:"center",style:{width:c!=null&&c.fullWidth?"100%":`${ae}px`,height:c!=null&&c.fullWidth?"auto":`${Z}px`,aspectRatio:$,flexShrink:0},onMouseEnter:()=>y(!0),onMouseLeave:()=>y(!1),children:[s||r?e.jsx("img",{src:s||r||void 0,alt:"Profile",style:{objectFit:"cover",width:"100%",height:"100%"}}):e.jsx(x.Box,{display:"flex",direction:"column",align:"center",justify:"center",padding:"spacing-4",children:e.jsx(B.Icon,{name:"Image",style:{color:"var(--sa-text-subtle, #8c8f97)",width:Number(i)/2<40?Number(i)/2:40,height:Number(i)/2<40?Number(i)/2:40}})}),e.jsxs(x.Box,{direction:"column",position:"absolute",display:"flex",align:"center",justify:"center",cursor:"pointer",style:{inset:0,backgroundColor:"var(--sa-color-black-alpha-a30, #080f214c)",opacity:m?1:0,transition:"opacity 0.3s ease-in-out"},onClick:K,children:[e.jsx("input",{ref:J,type:"file",accept:"image/*",onChange:W,disabled:n,style:{display:"none"}}),e.jsxs(x.Box,{display:"flex",align:"center",gap:"spacing-2",direction:"row",children:[e.jsx(B.Icon,{name:"Edit3",style:{color:"var(--sa-text-primary, #292a2e)"}}),e.jsx(me,{condition:i.toNumber()>80,children:e.jsx(S.Text,{color:"gray-50",fontSize:i.toNumber()>80?"sm":"md",fontWeight:"medium",children:"Edit Image"})})]})]}),n&&e.jsx(x.Box,{direction:"column",position:"absolute",display:"flex",align:"center",justify:"center",style:{inset:0,zIndex:20,backgroundColor:"var(--sa-color-white-alpha-a80, #e5e9f6cc)"},children:e.jsx(x.Box,{direction:"column",borderRadius:"rounded-full",style:{animation:"spin 1s linear infinite",border:"2px solid transparent",height:"2rem",width:"2rem"},borderColor:"info-600"})}),R&&Ir.createPortal(e.jsx("div",{style:{position:"fixed",inset:0,zIndex:19999,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0,0,0,0.6)"},onClick:()=>{L||I(!1)},children:e.jsxs("div",{style:{backgroundColor:"var(--sa-background-primary)",borderRadius:"var(--sa-radii-md)",boxShadow:"0 20px 60px rgba(0,0,0,0.3)",overflow:"hidden",width:g?l==="1:1"?"min(90vw, 480px)":`min(90vw, ${ae*2}px)`:"calc(100vw - 2rem)",display:"flex",flexDirection:"column"},onClick:ne=>ne.stopPropagation(),children:[e.jsx("div",{style:{position:"relative",width:"100%",height:"20rem",backgroundColor:"var(--sa-color-gray-100)"},children:D&&e.jsx(Hs,{image:D,crop:M,zoom:k,aspect:l?Co[l]:void 0,onCropChange:C,onZoomChange:T,onCropComplete:q,objectFit:"contain",minZoom:.5,restrictPosition:!1})}),e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem",padding:"0.75rem 1rem",borderTop:"1px solid var(--sa-border-subtle)"},children:[e.jsx(P.Button,{size:"sm",secondary:!0,disabled:L,onClick:()=>I(!1),children:"Cancel"}),e.jsx(P.Button,{size:"sm",primary:!0,isLoading:L,onClick:O,children:"Crop"})]})]})}),document.body)]})}),ia=({size:t="md",direction:r="vertical",requiredTitle:n="(Required)",fullWidth:s=!1,required:o=!1,...i})=>{var a,d,h;const l=i.hideMessageError||!1,c=r==="horizontal"?t==="sm"?342:t==="lg"?400:342:void 0;return e.jsxs(x.Box,{gap:r==="horizontal"?"spacing-96":"sm",direction:r==="horizontal"?"row":"column",...i.containerProps,children:[i.title&&e.jsx(me,{condition:!!o,fallback:e.jsxs(x.Box,{direction:"column",customMaxWidth:c,fullWidth:s,children:[e.jsx(ye,{children:i.title}),e.jsx(S.Text,{fontSize:t,color:"gray-500",children:i.description})]}),children:e.jsxs(x.Box,{direction:"column",customMaxWidth:c,fullWidth:s,children:[e.jsxs(fe.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(ye,{fontSize:t,children:i.title}),e.jsx(ye,{color:"error",fontSize:t,children:n}),e.jsx(me,{condition:!!((a=i.tooltip)!=null&&a.label),children:e.jsx(Te.Tooltip,{label:(d=i.tooltip)==null?void 0:d.label,arrowPosition:(h=i.tooltip)==null?void 0:h.arrowPosition,focusable:!0,...i.tooltip,children:e.jsx(B.Icon,{name:"InfoCircle",size:t==="lg"?"sm":"xs",style:{color:"var(--sa-color-info-500, #00abeb)",marginTop:"6px"}})})})]}),e.jsx(me,{condition:!!i.description,children:e.jsx(S.Text,{fontSize:t,color:"gray-500",children:i.description})})]})}),e.jsxs(fe.Flex,{direction:"column",gap:"xs",children:[e.jsx(Cs,{...i.inputProps}),!l&&i.errorMessage&&e.jsx(vt,{message:i.errorMessage})]})]})},la=({size:t="md",direction:r="vertical",requiredTitle:n="(Required)",fullWidth:s=!1,...o})=>{var l,c,a;const i=r==="horizontal"?t==="sm"?342:t==="lg"?400:342:void 0;return e.jsxs(x.Box,{gap:r==="horizontal"?"spacing-96":"sm",direction:r==="horizontal"?"row":"column",...o.containerProps,children:[o.title&&e.jsx(me,{condition:!!o.inputProps.required,fallback:e.jsxs(x.Box,{direction:"column",customMaxWidth:i,fullWidth:s,children:[e.jsx(ye,{children:o.title}),e.jsx(S.Text,{fontSize:t,color:"gray-500",children:o.description})]}),children:e.jsxs(x.Box,{direction:"column",customMaxWidth:i,fullWidth:s,children:[e.jsxs(fe.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(ye,{fontSize:t,children:o.title}),e.jsx(ye,{color:"error",fontSize:t,children:n}),e.jsx(me,{condition:!!((l=o.tooltip)!=null&&l.label),children:e.jsx(Te.Tooltip,{label:(c=o.tooltip)==null?void 0:c.label,arrowPosition:(a=o.tooltip)==null?void 0:a.arrowPosition,focusable:!0,...o.tooltip,children:e.jsx(B.Icon,{name:"InfoCircle",size:t==="lg"?"sm":"xs",style:{color:"var(--sa-color-info-500, #00abeb)",marginTop:"6px"}})})})]}),e.jsx(me,{condition:!!o.description,children:e.jsx(S.Text,{fontSize:t,color:"gray-500",children:o.description})})]})}),o.inputProps.extended&&o.inputProps.extended]})},ca=({items:t,id:r,handleOnUpdate:n,width:s,toggleShow:o=!0,disabled:i=!1})=>{var h;const[l,c]=u.useState([]);u.useEffect(()=>{t&&c([...t.map(g=>({id:g.id,isActive:g.isActive}))])},[t]);const a=(h=l.find(g=>g.id===r))==null?void 0:h.isActive,d=u.useCallback(()=>{c(g=>g.map(m=>m.id===r?{...m,isActive:!m.isActive}:m)),n&&n(!a)},[r,n,a]);return e.jsx(x.Box,{direction:"row",gap:"md",style:{width:s},children:o&&e.jsx(Zt.Toggle,{disabled:i,checked:a,onChange:d,label:a?"Active":"Inactive"})})},aa={InputText:Cc,InputDropdown:wc,InputSingleFile:$c,CheckBoxOptions:Jc,RadioOptions:Kc,InputTextArea:ea,ToggleForm:ta,ActionButton:ra,FormTitle:na,InputDate:oa,InputImgFile:ia,Custom:la},ws=({customBottom:t})=>{const[r,n]=u.useState(!1),s=()=>{window.scrollY>window.innerHeight?n(!0):n(!1)},o=()=>{window.scrollTo({top:0,behavior:"smooth"})};return u.useEffect(()=>(window.addEventListener("scroll",s),()=>{window.removeEventListener("scroll",s)}),[]),e.jsx(x.Box,{direction:"column",style:{position:"fixed",bottom:0,right:0},children:e.jsx(x.Box,{direction:"column",position:"absolute",style:{bottom:t||"1.6rem",right:"2rem",transform:r?"scale(1)":"scale(0)",transition:"transform 0.2s ease-in-out"},children:e.jsx(P.Button,{secondary:!0,size:"xs",onClick:o,type:"button",iconLeft:e.jsx(B.Icon,{width:16,size:"xs",name:"ArrowPullUp",style:{color:"var(--sa-background-brand, #04254f)"}})})})})},et="sa-sidepanel-item",wo="sa-sidepanel-item-styles",da="inset 3.5px 0 0 0 var(--sa-border-focused, #1a4fa0)",ua="inset -3.5px 0 0 0 var(--sa-border-focused, #1a4fa0)",xa=`@layer starasia.components {
|
|
53
|
+
.${et} {
|
|
54
54
|
display: block;
|
|
55
55
|
box-sizing: border-box;
|
|
56
56
|
width: 100%;
|
|
@@ -65,39 +65,39 @@
|
|
|
65
65
|
outline: none;
|
|
66
66
|
transition: background-color 140ms ease, box-shadow 140ms ease;
|
|
67
67
|
}
|
|
68
|
-
.${
|
|
68
|
+
.${et}[data-divider="true"] {
|
|
69
69
|
border-bottom: 1px solid var(--sa-border-subtle, #0b120e24);
|
|
70
70
|
}
|
|
71
71
|
/* The first row also gets a top line so the list is bounded on its own,
|
|
72
72
|
without relying on a wrapping container's border. Adjacent rows still
|
|
73
73
|
share a single 1px line (only border-bottom), never a doubled 2px one. */
|
|
74
|
-
.${
|
|
74
|
+
.${et}[data-divider="true"]:first-child {
|
|
75
75
|
border-top: 1px solid var(--sa-border-subtle, #0b120e24);
|
|
76
76
|
}
|
|
77
|
-
.${
|
|
77
|
+
.${et}:hover {
|
|
78
78
|
background: var(--sa-background-neutral, #f0f1f2);
|
|
79
79
|
}
|
|
80
|
-
.${
|
|
81
|
-
.${
|
|
80
|
+
.${et}:focus-visible,
|
|
81
|
+
.${et}[data-active="true"] {
|
|
82
82
|
background: var(--sa-background-brand-subtlest, #e6edf6);
|
|
83
83
|
}
|
|
84
|
-
.${
|
|
84
|
+
.${et}:focus-visible {
|
|
85
85
|
background: var(--sa-background-neutral, #f0f1f2);
|
|
86
86
|
}
|
|
87
87
|
/* Accent bar — sign of the offset picks the edge it hugs. */
|
|
88
|
-
.${
|
|
89
|
-
.${
|
|
90
|
-
box-shadow: ${
|
|
88
|
+
.${et}[data-accent="left"]:focus-visible,
|
|
89
|
+
.${et}[data-accent="left"][data-active="true"] {
|
|
90
|
+
box-shadow: ${da};
|
|
91
91
|
}
|
|
92
|
-
.${
|
|
93
|
-
.${
|
|
94
|
-
box-shadow: ${
|
|
92
|
+
.${et}[data-accent="right"]:focus-visible,
|
|
93
|
+
.${et}[data-accent="right"][data-active="true"] {
|
|
94
|
+
box-shadow: ${ua};
|
|
95
95
|
}
|
|
96
|
-
.${
|
|
96
|
+
.${et}[data-active="true"]:hover {
|
|
97
97
|
background: var(--sa-background-brand-subtlest, #e6edf6);
|
|
98
98
|
}
|
|
99
|
-
.${
|
|
99
|
+
.${et}:disabled {
|
|
100
100
|
cursor: not-allowed;
|
|
101
101
|
opacity: 0.55;
|
|
102
102
|
}
|
|
103
|
-
}`;function ea(){if(typeof document>"u"||document.getElementById(fo))return;const t=document.createElement("style");t.id=fo,t.textContent=Kc,document.head.appendChild(t)}const ta=({active:t=!1,accentSide:r="left",onClick:n,title:s,badge:o,heading:i,meta:l,children:c,divider:a=!0,disabled:d,className:h,style:g,"aria-label":m})=>(u.useEffect(ea,[]),e.jsx("button",{type:"button",className:[Xe,h].filter(Boolean).join(" "),"data-active":t?"true":"false","data-accent":r,"data-divider":a?"true":"false","aria-current":t?"true":void 0,"aria-label":m,disabled:d,onClick:n,style:g,children:c??e.jsxs(x.Box,{display:"flex",direction:"column",gap:"spacing-4",fullWidth:!0,style:{minWidth:0},children:[(s||o)&&e.jsxs(de.Flex,{direction:"row",align:"center",justify:"space-between",gap:"sm",style:{minWidth:0},children:[s?e.jsx(w.Text,{fontSize:"sm",style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"var(--sa-text-primary, #292a2e)"},children:s}):e.jsx("span",{}),o?e.jsx(x.Box,{style:{flexShrink:0},children:o}):null]}),i?e.jsx(w.Text,{fontSize:"md",fontWeight:"semibold",style:{color:"var(--sa-text-primary, #292a2e)"},children:i}):null,l?e.jsx(w.Text,{fontSize:"sm",style:{color:"var(--sa-text-subtlest, #6b6e76)"},children:l}):null]})})),Qr=18,ra=40,mo="280ms cubic-bezier(0.4, 0, 0.2, 1)",ms="var(--sa-border-subtle, #0b120e24)",na=`1px solid ${ms}`,go="var(--sa-background-primary, #ffffff)",oa=({children:t,header:r,collapsed:n,defaultCollapsed:s=!1,onToggle:o,width:i=337,side:l="left",offsetTop:c="var(--app-header-height, 4rem)",height:a,showToggle:d=!0,togglePosition:h="top",toggleOffset:g=40,toggleLabel:m,style:y,bodyStyle:b,className:C,pageLayout:O,overlay:M="mobile",wrapperProps:L,contentProps:j})=>{const D=ke.useMediaQuery("md"),R=n!==void 0,[B,S]=u.useState(s),T=R?n:B,P=()=>{const K=!T;R||S(K),o==null||o(K)},X=l==="left",I=typeof c=="number"?`${c}px`:c,N=a!==void 0?typeof a=="number"?`${a}px`:a:`calc(100vh - ${I})`,Y=m??{collapse:"Collapse panel",expand:"Expand panel"},G=h==="center"?{top:"50%",transform:"translateY(-50%)"}:h==="bottom"?{bottom:g}:{top:g},J=T?X?"ChevronRight":"ChevronLeft":X?"ChevronLeft":"ChevronRight",$=O!==void 0&&(M==="mobile"?!D:M),le=$?{position:"absolute",top:0,bottom:0,width:i,transform:`translateX(${T?X?"-100%":"100%":"0"})`,transition:`transform ${mo}`,zIndex:50,...X?{left:0}:{right:0},...y}:{position:"sticky",top:I,alignSelf:"flex-start",width:T?0:i,flexShrink:0,height:N,transition:`width ${mo}`,...y},q=e.jsxs(x.Box,{className:C,style:le,children:[e.jsx(x.Box,{fullWidth:!0,fullHeight:!0,display:"flex",direction:"column",overflow:"overflow-hidden",borderStyle:T?void 0:X?"border-solid-r":"border-solid-l",borderWidth:T?void 0:X?"border-r":"border-l",style:{backgroundColor:go,borderColor:ms},children:e.jsxs(x.Box,{fullHeight:!0,display:"flex",direction:"column",customWidth:i,customMinWidth:i,style:X?void 0:{marginLeft:"auto"},children:[r?e.jsx(x.Box,{padding:"md",style:{flexShrink:0},children:r}):null,e.jsx(x.Box,{display:"block",overflow:"overflow-y-auto",style:{flex:"1 1 0",minHeight:0,...b},children:t})]})}),d&&e.jsx(Zt,{display:"inline-flex",align:"center",justify:"center",position:"absolute",onClick:P,"aria-label":T?Y.expand:Y.collapse,"aria-expanded":!T,"aria-pressed":T,customWidth:Qr,customHeight:ra,style:{...G,backgroundColor:go,border:na,zIndex:5,...X?{right:-Qr,borderLeft:"none",borderRadius:"0 var(--sa-radii-md, 8px) var(--sa-radii-md, 8px) 0"}:{left:-Qr,borderRight:"none",borderRadius:"var(--sa-radii-md, 8px) 0 0 var(--sa-radii-md, 8px)"}},children:e.jsx(E.Icon,{name:J,size:"sm"})})]});return O===void 0?q:e.jsxs(x.Box,{direction:"row",position:"relative",...L,style:{height:`calc(100vh - ${I})`,overflow:"hidden",...(L==null?void 0:L.style)??{}},children:[!$&&X?q:null,e.jsx(x.Box,{display:"block",...j,style:{flex:"1 1 0",minWidth:0,height:"100%",overflowY:"auto",...(j==null?void 0:j.style)??{}},children:O}),!$&&!X?q:null,$&&e.jsxs(e.Fragment,{children:[!T&&e.jsx("div",{onClick:P,"aria-hidden":"true",style:{position:"absolute",inset:0,backgroundColor:"rgba(0, 0, 0, 0.4)",zIndex:40}}),q]})]})},sn="--app-aside-width",sa=t=>typeof t=="number"?`${t}px`:t,ia=({pageLayout:t,children:r,wrapperProps:n,containerProps:s})=>{const o=ke.useMediaQuery("md"),i=(s==null?void 0:s.customWidth)??264;return u.useLayoutEffect(()=>{const l=document.documentElement;return l.style.setProperty(sn,o?sa(i):"0px"),()=>l.style.removeProperty(sn)},[o,i]),e.jsxs(x.Box,{display:"block",direction:"row",...n,style:{marginRight:o?i:24,...(n==null?void 0:n.style)??{}},children:[t,e.jsx(x.Box,{direction:"column",show:"desktop",as:"aside",position:"fixed",top:"top-0",bottom:"bottom-0",right:"right-0",customWidth:264,borderStyle:"border-solid-l",borderWidth:"border-l",...s,style:{marginTop:"var(--app-header-height, 4rem)",backgroundColor:"var(--sa-background-primary, #ffffff)",borderColor:"var(--sa-border-subtle, #0b120e24)",...(s==null?void 0:s.style)??{}},children:r})]})},ln="--sa-floating-footer-height",la=t=>typeof t=="number"?`${t}px`:t,ca=({children:t,withScrollToTopButton:r=!1,scrollToTopButtonProps:n,respectAside:s=!1,offsetRight:o,containerProps:i})=>{const l=u.useRef(null),c=o!=null?la(o):s?"var(--app-aside-width, 0px)":"0px";return u.useLayoutEffect(()=>{const a=document.documentElement,d=()=>{var m;const g=((m=l.current)==null?void 0:m.getBoundingClientRect().height)??0;a.style.setProperty(ln,`${g}px`)};d();const h=new ResizeObserver(d);return l.current&&h.observe(l.current),()=>{h.disconnect(),a.style.removeProperty(ln)}},[]),e.jsx(x.Box,{direction:"column",position:"absolute",width:"width-full",style:{zIndex:"var(--app-footer-zindex, 998)"},children:e.jsxs(x.Box,{ref:l,position:"fixed",bottom:"bottom-0",bg:"white",direction:"row",align:"center",display:"flex",paddingBlock:"sm",paddingInline:"md",borderColor:"border-subtle",style:{left:"var(--app-sidebar-width, 0px)",right:c,transition:"left 0.3s ease-in-out, right 0.3s ease-in-out"},justify:(i==null?void 0:i.justify)||"flex-end",borderStyle:"border-solid-t",borderWidth:"border-t",children:[r&&e.jsx(fs,{...n,customBottom:(n==null?void 0:n.customBottom)||"5.7rem"}),t]})})},aa=({fields:t})=>e.jsx(x.Box,{display:"flex",direction:"column",gap:"lg",children:e.jsx(vr,{of:t,render:(r,n)=>e.jsx(da,{...r},n)})}),da=({title:t,value:r,icon:n})=>e.jsxs(x.Box,{display:"flex",direction:"column",gap:"sm",children:[n?e.jsxs(x.Box,{display:"flex",direction:"row",align:"center",gap:"xs",children:[e.jsx(E.Icon,{name:n,color:"subtle"}),e.jsx(w.Text,{color:"gray-500",variant:"sub-h3",children:t})]}):e.jsx(w.Text,{color:"gray-500",variant:"sub-h3",children:t}),typeof r=="string"?e.jsx(w.Text,{variant:"sub-h3",children:r}):r]}),Re={silhouette:"#A7B0AC",accent:"#78867F"};function ua({width:t,height:r}){return e.jsx(e.Fragment,{children:e.jsxs("svg",{width:t||"100",height:r||"90",viewBox:"0 0 102 90",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("path",{d:"M51.0002 16.8145C36.0811 16.8145 24.8296 21.3801 24.8296 27.4328V76.5344C24.8296 82.573 36.0799 87.127 51.0002 87.127C65.9204 87.127 77.1707 82.573 77.1707 76.5344V27.4328C77.1707 21.3801 65.9204 16.8145 51.0002 16.8145ZM51.0002 19.1582C65.0602 19.1582 74.8582 23.5187 74.8582 27.4328C74.8582 30.1363 70.1615 32.9664 63.1708 34.4746C55.861 36.0543 46.1416 36.0543 38.8318 34.4746C31.8399 32.9664 27.1432 30.1363 27.1432 27.4328C27.1432 23.5187 36.9402 19.1582 51.0002 19.1582ZM74.8582 31.9199V43.784C74.8582 46.532 70.3142 49.2941 63.2737 50.8328C63.2391 50.8375 63.2032 50.8434 63.1697 50.8504C57.6867 52.0352 50.8498 52.3305 44.6893 51.7387C42.6358 51.5418 40.6575 51.2453 38.8306 50.8504C38.8029 50.8445 38.7682 50.8387 38.7347 50.8352C32.5707 49.4898 28.318 47.2047 27.3514 44.8141C27.2138 44.4719 27.1421 44.1285 27.1421 43.7852V31.9199C27.1999 31.9715 27.2693 32.0207 27.3294 32.0723C27.5052 32.2246 27.6902 32.3758 27.8844 32.5234C27.9954 32.609 28.1064 32.6934 28.2232 32.7766C28.4371 32.9301 28.6637 33.0801 28.8973 33.2289C29.0083 33.2992 29.1135 33.3719 29.2291 33.441C29.5702 33.6473 29.9275 33.8488 30.3044 34.0434C30.3195 34.0516 30.3333 34.0598 30.3484 34.068C30.7427 34.2707 31.1601 34.4652 31.5925 34.6551C31.7301 34.716 31.8758 34.7734 32.0168 34.832C32.3221 34.9598 32.6331 35.0852 32.9557 35.207C33.1303 35.2727 33.3095 35.3359 33.4887 35.4004C33.8032 35.5117 34.1247 35.6207 34.4542 35.7273C34.6404 35.7871 34.8254 35.8469 35.015 35.9043C35.3734 36.0133 35.7434 36.1164 36.1181 36.2184C36.2915 36.2652 36.4603 36.3145 36.6361 36.3602C37.1911 36.5031 37.7588 36.6402 38.3485 36.7668C42.1595 37.5906 46.5336 38.0254 50.999 38.0254C55.4644 38.0254 59.8397 37.5906 63.6495 36.768C64.2404 36.6402 64.8092 36.5031 65.3666 36.3602C65.5377 36.3156 65.7007 36.2688 65.8684 36.223C66.2499 36.1199 66.6246 36.0145 66.9888 35.9031C67.1749 35.8469 67.3553 35.7883 67.5368 35.7309C67.8745 35.623 68.2028 35.5105 68.5243 35.3969C68.6966 35.3359 68.8677 35.275 69.0353 35.2117C69.3672 35.0863 69.6852 34.9574 69.9985 34.8262C70.1326 34.7699 70.2725 34.7148 70.4032 34.6574C70.8379 34.4664 71.2576 34.2707 71.6542 34.0668C71.66 34.0633 71.6658 34.0609 71.6716 34.0574C72.0589 33.8582 72.4243 33.6508 72.7735 33.441C72.8868 33.3719 72.9909 33.3016 73.1007 33.2313C73.3354 33.0813 73.5632 32.9312 73.7794 32.7766C73.8951 32.6934 74.0049 32.609 74.1159 32.5258C74.3102 32.377 74.4963 32.2258 74.6732 32.0723C74.7322 32.0207 74.8027 31.9727 74.8594 31.9211L74.8582 31.9199ZM74.8582 48.2887V60.1598C74.8582 62.8773 70.3396 65.6359 63.335 67.2004C63.2737 67.2051 63.2136 67.2156 63.1547 67.2285C59.5021 68.016 55.2482 68.4109 50.9955 68.4098C48.8692 68.4098 46.7428 68.3113 44.6917 68.1145C42.6405 67.9176 40.6656 67.6211 38.8399 67.2273C38.7832 67.2133 38.7266 67.2051 38.6699 67.2004C31.663 65.6359 27.1432 62.8785 27.1432 60.1598V48.2887C27.2022 48.3426 27.2739 48.393 27.3352 48.4457C27.5075 48.5945 27.6878 48.7422 27.8763 48.8875C27.9908 48.9754 28.1052 49.0633 28.2255 49.15C28.4348 49.3 28.6568 49.4477 28.8834 49.593C28.999 49.6668 29.1089 49.7418 29.228 49.8145C29.5633 50.0172 29.9136 50.2152 30.2825 50.4074C30.3114 50.4227 30.338 50.4379 30.3669 50.452C30.7507 50.6488 31.1566 50.8398 31.5775 51.0262C31.722 51.0895 31.8746 51.1504 32.0226 51.2125C32.3198 51.3379 32.6227 51.4609 32.9372 51.5793C33.1164 51.6473 33.2991 51.7129 33.4841 51.7785C33.7917 51.8887 34.1073 51.9953 34.4299 52.0996C34.6196 52.1605 34.8092 52.2227 35.0046 52.2812C35.3584 52.3891 35.7238 52.4922 36.0938 52.593C36.2684 52.641 36.4395 52.6902 36.6176 52.7359C37.1714 52.8789 37.738 53.016 38.3253 53.1426C38.3554 53.1496 38.3889 53.1555 38.4236 53.159C42.2161 53.9723 46.5636 54.4023 51.0013 54.4023C55.439 54.4023 59.7784 53.9734 63.5697 53.1613C63.6056 53.1566 63.6414 53.1508 63.6773 53.1426C64.2647 53.0148 64.8312 52.8789 65.3851 52.7359C65.5643 52.6902 65.7342 52.6398 65.9088 52.593C66.2788 52.4922 66.6442 52.3891 66.998 52.2812C67.1934 52.2215 67.3831 52.1605 67.5727 52.0996C67.8953 51.9953 68.2109 51.8887 68.5185 51.7785C68.7023 51.7129 68.8862 51.6473 69.0654 51.5793C69.3799 51.4598 69.6817 51.3367 69.98 51.2125C70.128 51.1504 70.2806 51.0895 70.4252 51.0262C70.846 50.841 71.2507 50.65 71.6357 50.452C71.6646 50.4367 71.6912 50.4215 71.7201 50.4074C72.0901 50.2152 72.4405 50.0172 72.7747 49.8145C72.8949 49.7418 73.0036 49.6668 73.1192 49.593C73.347 49.4477 73.5678 49.3 73.7771 49.15C73.8974 49.0633 74.0118 48.9766 74.1263 48.8875C74.3148 48.7422 74.4952 48.5945 74.6674 48.4457C74.7287 48.393 74.7992 48.3426 74.8582 48.2887ZM74.8582 76.5355C74.8582 80.4367 65.0602 84.7844 51.0002 84.7844C36.9402 84.7844 27.1421 80.4367 27.1421 76.5355V64.6469C27.1987 64.6984 27.2693 64.7477 27.3282 64.7992C27.5028 64.9504 27.6844 65.0992 27.8763 65.2469C27.9873 65.3324 28.0995 65.418 28.2162 65.5023C28.4302 65.6559 28.6568 65.807 28.8892 65.9559C28.9979 66.0262 29.1019 66.0977 29.2152 66.1656C29.5691 66.3801 29.9367 66.591 30.3299 66.7937C30.331 66.7937 30.3322 66.7938 30.3333 66.7961C30.7253 66.9988 31.1404 67.1945 31.5694 67.3855C31.7058 67.4465 31.8515 67.5039 31.9914 67.5637C32.2955 67.6926 32.6054 67.8191 32.928 67.9422C33.1002 68.0078 33.2772 68.0711 33.4541 68.1355C33.7674 68.248 34.0888 68.3582 34.4184 68.466C34.6034 68.5258 34.7872 68.5867 34.9768 68.6453C35.3341 68.7555 35.703 68.8609 36.0764 68.9641C36.2476 69.0109 36.4141 69.0602 36.5887 69.1059C37.1413 69.2512 37.7079 69.3895 38.2941 69.5195C38.3462 69.5312 38.3993 69.5383 38.4514 69.543C42.2369 70.3516 46.5717 70.7793 50.999 70.7793C55.4263 70.7793 59.7599 70.3527 63.5478 69.543C63.5998 69.5383 63.653 69.5312 63.705 69.5195C64.2912 69.3906 64.8578 69.2512 65.4105 69.1059C65.5839 69.0602 65.7493 69.0121 65.9192 68.9652C66.295 68.8621 66.665 68.7555 67.0246 68.6453C67.2131 68.5879 67.3958 68.5281 67.5785 68.4684C67.9092 68.3605 68.2329 68.2492 68.5486 68.1355C68.7231 68.0723 68.8977 68.009 69.0689 67.9445C69.3938 67.8203 69.7071 67.6926 70.0135 67.5625C70.1511 67.5039 70.2933 67.4477 70.4275 67.3879C71.29 67.0047 72.0774 66.5969 72.7851 66.1668C72.8972 66.0988 73.0001 66.0273 73.1088 65.9582C73.3424 65.8082 73.5702 65.657 73.7852 65.5023C73.9008 65.4191 74.0118 65.3336 74.1217 65.2492C74.3148 65.1016 74.4975 64.9516 74.6732 64.7992C74.7322 64.7488 74.8016 64.6996 74.8582 64.648V76.5355Z",fill:Re.silhouette}),e.jsx("path",{d:"M33.2089 38.8535C31.3993 38.8535 29.9263 40.3453 29.9263 42.1805C29.9263 44.0156 31.3982 45.5062 33.2089 45.5062C35.0196 45.5062 36.4903 44.0145 36.4903 42.1805C36.4903 40.3465 35.0184 38.8535 33.2089 38.8535ZM33.2089 43.1625C32.6735 43.1625 32.2388 42.7219 32.2388 42.1805C32.2388 41.6391 32.6735 41.1973 33.2089 41.1973C33.7442 41.1973 34.1778 41.6379 34.1778 42.1805C34.1778 42.723 33.7431 43.1625 33.2089 43.1625Z",fill:Re.silhouette}),e.jsx("path",{d:"M33.2089 54.6777C31.3993 54.6777 29.9263 56.1695 29.9263 58.0047C29.9263 59.8398 31.3982 61.3316 33.2089 61.3316C35.0196 61.3316 36.4903 59.8398 36.4903 58.0047C36.4903 56.1695 35.0184 54.6777 33.2089 54.6777ZM33.2089 58.9879C32.6735 58.9879 32.2388 58.5473 32.2388 58.0047C32.2388 57.4621 32.6735 57.0215 33.2089 57.0215C33.7442 57.0215 34.1778 57.4621 34.1778 58.0047C34.1778 58.5473 33.7431 58.9879 33.2089 58.9879Z",fill:Re.silhouette}),e.jsx("path",{d:"M33.2089 70.5C31.3993 70.5 29.9263 71.9918 29.9263 73.827C29.9263 75.6621 31.3982 77.1539 33.2089 77.1539C35.0196 77.1539 36.4903 75.6621 36.4903 73.827C36.4903 71.9918 35.0184 70.5 33.2089 70.5ZM33.2089 74.8102C32.6735 74.8102 32.2388 74.3695 32.2388 73.827C32.2388 73.2844 32.6735 72.8438 33.2089 72.8438C33.7442 72.8438 34.1778 73.2844 34.1778 73.827C34.1778 74.3695 33.7431 74.8102 33.2089 74.8102Z",fill:Re.silhouette}),e.jsx("path",{d:"M70.0215 38.2852C69.3821 38.2852 68.8652 38.809 68.8652 39.457V44.3332C68.8652 44.9812 69.3821 45.5051 70.0215 45.5051C70.6609 45.5051 71.1777 44.9812 71.1777 44.3332V39.457C71.1777 38.809 70.6609 38.2852 70.0215 38.2852Z",fill:Re.silhouette}),e.jsx("path",{d:"M70.0215 54.3926C69.3821 54.3926 68.8652 54.9164 68.8652 55.5645V60.4406C68.8652 61.0887 69.3821 61.6125 70.0215 61.6125C70.6609 61.6125 71.1777 61.0887 71.1777 60.4406V55.5645C71.1777 54.9164 70.6609 54.3926 70.0215 54.3926Z",fill:Re.silhouette}),e.jsx("path",{d:"M70.0215 70.5C69.3821 70.5 68.8652 71.0238 68.8652 71.6719V76.5492C68.8652 77.1973 69.3821 77.7211 70.0215 77.7211C70.6609 77.7211 71.1777 77.1973 71.1777 76.5492V71.6719C71.1777 71.0238 70.6609 70.5 70.0215 70.5Z",fill:Re.silhouette}),e.jsx("path",{d:"M65.77 39.7617C65.1306 39.7617 64.6138 40.2855 64.6138 40.9336V45.8098C64.6138 46.4578 65.1306 46.9816 65.77 46.9816C66.4094 46.9816 66.9263 46.4578 66.9263 45.8098V40.9336C66.9263 40.2855 66.4094 39.7617 65.77 39.7617Z",fill:Re.silhouette}),e.jsx("path",{d:"M65.77 55.8691C65.1306 55.8691 64.6138 56.393 64.6138 57.041V61.9172C64.6138 62.5652 65.1306 63.0891 65.77 63.0891C66.4094 63.0891 66.9263 62.5652 66.9263 61.9172V57.041C66.9263 56.393 66.4094 55.8691 65.77 55.8691Z",fill:Re.silhouette}),e.jsx("path",{d:"M65.77 71.9766C65.1306 71.9766 64.6138 72.5004 64.6138 73.1484V78.0246C64.6138 78.6727 65.1306 79.1965 65.77 79.1965C66.4094 79.1965 66.9263 78.6727 66.9263 78.0246V73.1484C66.9263 72.5004 66.4094 71.9766 65.77 71.9766Z",fill:Re.silhouette}),e.jsx("path",{d:"M61.2939 40.7246C60.6545 40.7246 60.1377 41.2484 60.1377 41.8965V46.7727C60.1377 47.4207 60.6545 47.9445 61.2939 47.9445C61.9334 47.9445 62.4502 47.4207 62.4502 46.7727V41.8965C62.4502 41.2484 61.9334 40.7246 61.2939 40.7246Z",fill:Re.silhouette}),e.jsx("path",{d:"M61.2939 56.832C60.6545 56.832 60.1377 57.3559 60.1377 58.0039V62.8801C60.1377 63.5281 60.6545 64.052 61.2939 64.052C61.9334 64.052 62.4502 63.5281 62.4502 62.8801V58.0039C62.4502 57.3559 61.9334 56.832 61.2939 56.832Z",fill:Re.silhouette}),e.jsx("path",{d:"M61.2939 72.9395C60.6545 72.9395 60.1377 73.4633 60.1377 74.1113V78.9875C60.1377 79.6355 60.6545 80.1594 61.2939 80.1594C61.9334 80.1594 62.4502 79.6355 62.4502 78.9875V74.1113C62.4502 73.4633 61.9334 72.9395 61.2939 72.9395Z",fill:Re.silhouette}),e.jsx("path",{d:"M39.0489 24.4037C39.131 24.4037 39.2154 24.3944 39.2986 24.3768C42.7316 23.6127 46.6755 23.185 51.0207 23.11C51.659 23.0983 52.1677 22.5651 52.1561 21.917C52.1446 21.2701 51.652 20.7451 50.9791 20.7662C46.4813 20.8448 42.3835 21.2889 38.8015 22.0881C38.1782 22.2264 37.7828 22.8522 37.9204 23.4838C38.0395 24.0311 38.5182 24.4037 39.0489 24.4037Z",fill:Re.silhouette}),e.jsx("path",{d:"M32.5406 26.6215C32.7407 26.6215 32.9442 26.57 33.128 26.4586C33.1315 26.4563 33.5096 26.2336 34.2889 25.9055C34.8786 25.6582 35.1584 24.9727 34.9144 24.3739C34.6704 23.775 33.9917 23.4926 33.4032 23.7399C32.4632 24.1348 31.9926 24.4149 31.9417 24.4465C31.396 24.7782 31.219 25.4942 31.544 26.0485C31.7613 26.4164 32.1452 26.6204 32.5395 26.6204L32.5406 26.6215Z",fill:Re.silhouette}),e.jsx("path",{d:"M92.7251 26.7272L82.3845 29.3124C81.6929 29.4856 80.9911 29.0642 80.8179 28.3727C80.6447 27.6799 81.066 26.978 81.7576 26.8048L92.0982 24.2196C92.791 24.0464 93.4929 24.4678 93.6661 25.1593C93.8393 25.8521 93.4179 26.554 92.7251 26.7272Z",fill:Re.accent,fillOpacity:"0.65"}),e.jsx("path",{d:"M94.4649 11.0082L80.2465 21.3488C79.6701 21.7676 78.8609 21.6409 78.4408 21.0632C78.022 20.4867 78.1487 19.6775 78.7265 19.2574L92.9448 8.91682C93.5213 8.49803 94.3305 8.6247 94.7505 9.20248C95.1693 9.77897 95.0414 10.5881 94.4649 11.0082Z",fill:Re.accent,fillOpacity:"0.65"}),e.jsx("path",{d:"M78.0091 10.6269L74.1314 17.0898C73.7643 17.7025 72.9706 17.9002 72.358 17.5331C71.7466 17.1673 71.5475 16.3724 71.9146 15.7597L75.7923 9.29684C76.1594 8.68545 76.9544 8.48769 77.5657 8.85349C78.1784 9.22058 78.3762 10.0155 78.0091 10.6269Z",fill:Re.accent,fillOpacity:"0.65"})]})})}const xa=({title:t="create",children:r,onClickAction:n,variant:s="primary",variantTitle:o,leftIcon:i,showButton:l=!0,customHeight:c,childrenButton:a,customIcon:d})=>{const h=()=>{switch(s){case"primary":return e.jsx(e.Fragment,{children:i?e.jsx(H.Button,{primary:!0,iconLeft:i,onClick:n,children:a||t}):e.jsx(H.Button,{primary:!0,onClick:n,children:a||t})});case"secondary":return e.jsx(e.Fragment,{children:i?e.jsx(H.Button,{secondary:!0,iconLeft:i,onClick:n,children:o?e.jsx(w.Text,{fontSize:"md",fontWeight:"medium",style:{color:"var(--sa-background-success, #28ac6e)"},children:a||t}):t}):e.jsx(H.Button,{secondary:!0,onClick:n,children:a||t})});case"success":return e.jsx(e.Fragment,{children:i?e.jsx(H.Button,{success:!0,iconLeft:i,onClick:n,children:a||t}):e.jsx(H.Button,{success:!0,onClick:n,children:a||t})});default:return e.jsx(e.Fragment,{children:i?e.jsx(H.Button,{primary:!0,iconLeft:i,onClick:n,children:a||t}):e.jsx(H.Button,{primary:!0,onClick:n,children:a||t})})}};return e.jsxs(x.Box,{height:"height-full",display:"flex",direction:"column",gap:"sm",justify:"center",align:"center",marginBlock:"auto",customHeight:c,children:[d||e.jsx(ua,{}),e.jsx(x.Box,{direction:"column",children:r.map((g,m)=>e.jsx(nt.Body1,{props:{align:"center",textAlign:"center"},children:m>2?null:g},m))}),l?h():null]})},te={c001A72:"#001A72",c64B5F6:"#64B5F6",c98B4CB:"#98B4CB",cBBDEFB:"#BBDEFB",cD0E5F7:"#D0E5F7",cD6EBFD:"#D6EBFD",c000000:"#000000",cFFFFFF:"#FFFFFF"};function ha({width:t,height:r}){return e.jsx(e.Fragment,{children:e.jsxs("svg",{width:t,height:r,viewBox:"0 0 622 271",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("path",{d:"M32.4375 254.5H612.437",stroke:te.c64B5F6,strokeWidth:"5",strokeLinecap:"round"}),e.jsx("rect",{x:"216.562",y:"45.5605",width:"55",height:"20",fill:te.cD6EBFD}),e.jsx("rect",{x:"14.4375",y:"89.7803",width:"46",height:"20",fill:te.cD6EBFD}),e.jsx("rect",{x:"0.4375",y:"111.78",width:"46",height:"20",fill:te.cD6EBFD}),e.jsx("rect",{x:"0.4375",y:"67.7803",width:"46",height:"20",fill:te.cD6EBFD}),e.jsx("rect",{x:"344.312",y:"0.5",width:"55",height:"20",fill:te.cD6EBFD}),e.jsx("rect",{x:"549.562",y:"86.7803",width:"55",height:"20",fill:te.cD6EBFD}),e.jsx("rect",{x:"566.562",y:"64.7803",width:"55",height:"20",fill:te.cD6EBFD}),e.jsx("path",{d:"M233.438 165.217C233.438 132.764 239.035 107.198 250.231 88.5189C261.596 69.8396 279.832 60.5 304.938 60.5C330.043 60.5 348.194 69.8396 359.389 88.5189C370.755 107.198 376.438 132.764 376.438 165.217C376.438 198.047 370.755 223.802 359.389 242.481C348.194 261.16 330.043 270.5 304.938 270.5C279.832 270.5 261.596 261.16 250.231 242.481C239.035 223.802 233.438 198.047 233.438 165.217ZM333.69 165.217C333.69 146.16 331.824 131.538 328.092 121.349C324.36 110.972 316.642 105.783 304.938 105.783C293.233 105.783 285.515 110.972 281.783 121.349C278.051 131.538 276.185 146.16 276.185 165.217C276.185 178.047 276.863 188.708 278.22 197.198C279.577 205.5 282.292 212.292 286.363 217.575C290.604 222.67 296.795 225.217 304.938 225.217C313.08 225.217 319.187 222.67 323.258 217.575C327.499 212.292 330.298 205.5 331.655 197.198C333.012 188.708 333.69 178.047 333.69 165.217Z",fill:te.cD0E5F7}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M50.4375 235.124V194.28L138.96 60.5H192.466V191.32H215.438V235.124H192.466V249.5H144.563V235.124H50.4375ZM100.862 191.32L147.925 116.143V191.32H100.862Z",fill:te.cBBDEFB,fillOpacity:"0.6"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M394.438 235.124V194.28L482.96 60.5H536.466V191.32H559.438V235.124H536.466V249.5H488.563V235.124H394.438ZM444.862 191.32L491.925 116.143V191.32H444.862Z",fill:te.cBBDEFB,fillOpacity:"0.6"}),e.jsx("path",{d:"M349.472 171.5H261.64V186.396H349.472V171.5Z",fill:te.c98B4CB}),e.jsx("path",{d:"M261.64 171.5L244.719 186.396H261.64V171.5Z",fill:te.c98B4CB}),e.jsx("path",{d:"M363.574 186.396L349.472 171.5V186.396H363.574Z",fill:te.c98B4CB}),e.jsx("path",{d:"M244.719 200.89V264.5H363.574V200.89M244.719 200.89H233.438L244.719 186.396M244.719 200.89H363.574M363.574 200.89H372.437L363.574 186.396M244.719 186.396L261.64 171.5M244.719 186.396H261.64M363.574 186.396L349.472 171.5M363.574 186.396H349.472M261.64 171.5H349.472M261.64 171.5V186.396M349.472 171.5V186.396M349.472 186.396H261.64",stroke:te.c000000,strokeWidth:"2"}),e.jsx("rect",{x:"246.438",y:"202.5",width:"116",height:"60",fill:te.cFFFFFF}),e.jsx("path",{d:"M245.536 187.5H362.959L369.438 198.5H237.438L245.536 187.5Z",fill:te.cFFFFFF}),e.jsx("path",{d:"M332.438 129.846C332.438 141.175 329.183 152.403 323.949 160.772C318.699 169.168 311.592 174.5 303.938 174.5C296.283 174.5 289.176 169.168 283.926 160.772C278.692 152.403 275.438 141.175 275.438 129.846C275.438 118.458 277.838 109.628 282.543 103.663C287.216 97.7387 294.274 94.5 303.938 94.5C313.601 94.5 320.659 97.7387 325.332 103.663C330.037 109.628 332.438 118.458 332.438 129.846Z",fill:te.cFFFFFF,stroke:te.c000000,strokeWidth:"2"}),e.jsx("path",{d:"M281.438 145.5C284.032 154.136 285.762 158.682 290.951 164.591M292.681 166.409C293.624 167.647 295.708 169.591 297.438 170.5",stroke:te.c000000,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M304.438 175C299.54 176.339 297.208 177.876 293.938 182.5M304.438 175C301.183 178.041 299.537 178.883 299.438 182.5M304.438 175C308.173 177.107 309.635 178.834 311.438 182.5",stroke:te.c000000,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M304.936 175.5C303.438 180 302.529 181.628 304.936 186.5",stroke:te.c000000,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M288.178 120.981C289.969 120.93 290.921 121.313 292.167 122.754",stroke:te.c000000,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("circle",{cx:"291.724",cy:"118.765",r:"3.1027",fill:te.c000000}),e.jsx("path",{d:"M308.128 122.463C309.123 120.973 309.987 120.418 311.883 120.237",stroke:te.c000000,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("circle",{cx:"307.681",cy:"118.765",r:"3.1027",fill:te.c000000}),e.jsx("ellipse",{cx:"297.938",cy:"134.5",rx:"2.5",ry:"2",fill:te.c000000}),e.jsx("path",{d:"M340.437 97.5L333.438 104.5M333.438 97.5L340.438 104.5",stroke:te.c001A72,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M265.437 115.5L260.438 120.5M260.438 115.5L265.438 120.5",stroke:te.c001A72,strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M288.437 87.5L283.438 92.5M283.438 87.5L288.438 92.5",stroke:te.c001A72,strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M305.437 83.5L298.438 90.5M298.438 83.5L305.438 90.5",stroke:te.c001A72,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M342.437 145.5L337.438 150.5M337.438 145.5L342.438 150.5",stroke:te.c001A72,strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("circle",{cx:"339.938",cy:"111",r:"2.5",fill:te.c001A72}),e.jsx("circle",{cx:"336.438",cy:"94.5",r:"1",fill:te.c001A72}),e.jsx("circle",{cx:"347.438",cy:"99.5",r:"1",fill:te.c001A72}),e.jsx("circle",{cx:"267.438",cy:"109.5",r:"2",fill:te.c001A72}),e.jsx("circle",{cx:"293.438",cy:"85.5",r:"2",fill:te.c001A72}),e.jsx("circle",{cx:"339.438",cy:"138.5",r:"2",fill:te.c001A72}),e.jsx("circle",{cx:"267.438",cy:"150.5",r:"2",fill:te.c001A72}),e.jsx("circle",{cx:"268.438",cy:"118.5",r:"1",fill:te.c001A72}),e.jsx("circle",{cx:"260.438",cy:"124.5",r:"1",fill:te.c001A72})]})})}function fa({onClick:t}){const r=ke.useMediaQuery("md");return e.jsxs(x.Box,{direction:"column",height:"height-screen",fullWidth:!0,display:"flex",align:"center",justify:"center",gap:"md",children:[e.jsx(ha,{width:r?600:300}),e.jsx(w.Text,{fontWeight:"bold",fontSize:r?"3xl":"2xl",textAlign:"center",children:"Page Not Found"}),e.jsx(w.Text,{fontWeight:"semibold",fontSize:r?"lg":"md",textAlign:"center",children:"Sorry, we couldn't find the page you are looking for"}),t&&e.jsx(H.Button,{size:r?"md":"xs",onClick:t,children:"Go Back"})]})}const ce={c46F16B:"#46F16B",c48504C:"#48504C",c64B5F6:"#64B5F6",c67AEE6:"#67AEE6",c86512B:"#86512B",c956847:"#956847",cBBC3F5:"#BBC3F5",cBBDEFB:"#BBDEFB",cC0B2A2:"#C0B2A2",cC8CEF4:"#C8CEF4",cCABEB1:"#CABEB1",cD5C7BD:"#D5C7BD",cD6D6D6:"#D6D6D6",cD6EBFD:"#D6EBFD",cE5EE80:"#E5EE80",cEE8080:"#EE8080",cEFF3F8:"#EFF3F8",cF4F4F4:"#F4F4F4",cFFFFFF:"#FFFFFF"};function ma({width:t,height:r}){return e.jsx(e.Fragment,{children:e.jsxs("svg",{width:t,height:r,viewBox:"0 0 654 258",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("rect",{x:"228",y:"55.5",width:"55",height:"20",fill:ce.cD6EBFD}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M75 238.124V197.28L163.523 63.5H217.029V194.32H240V238.124H217.029V252.5H169.126V238.124H75ZM125.424 194.32L172.487 119.143V194.32H125.424Z",fill:ce.cBBDEFB,fillOpacity:"0.6"}),e.jsxs("g",{clipPath:"url(#clip0_2949_9690)",children:[e.jsx("path",{d:"M334.5 274.5C381.168 274.5 419 227.266 419 169C419 110.734 381.168 63.5 334.5 63.5C287.832 63.5 250 110.734 250 169C250 227.266 287.832 274.5 334.5 274.5Z",fill:ce.cEFF3F8,stroke:ce.c67AEE6,strokeWidth:"5"}),e.jsx("path",{d:"M413 197.5C411.397 211.835 402.919 230.898 389.361 246.49C375.596 262.32 356.651 274.5 334.496 274.5C311.331 274.5 292.389 261.672 278.878 245.52C265.592 229.638 257.606 210.603 256 197.5H413Z",fill:ce.cD5C7BD}),e.jsx("path",{d:"M278.887 211.766H391.104L392.583 222.856C392.687 223.635 392.08 224.328 391.294 224.328H277.961C277.14 224.328 276.525 223.577 276.686 222.773L278.887 211.766Z",fill:ce.cCABEB1}),e.jsx("path",{d:"M287.68 218.884L289.354 213.022H378.961L381.473 218.884H287.68Z",fill:ce.cC0B2A2}),e.jsx("path",{d:"M381.944 218.803L381.58 212.266H386.385L386.022 218.803H381.944Z",fill:ce.c956847,stroke:ce.c48504C}),e.jsx("path",{d:"M283.124 218.803L282.768 213.104H287.565L287.209 218.803H283.124Z",fill:ce.c956847,stroke:ce.c48504C}),e.jsx("path",{d:"M285.902 212.103L284.935 186.306H279.606C278.151 186.306 277.004 187.542 277.113 188.993L278.673 209.79C278.77 211.095 279.857 212.103 281.166 212.103H285.902Z",fill:ce.cC8CEF4,stroke:ce.c48504C}),e.jsx("path",{d:"M383.256 212.103L384.638 186.306H389.556C391.007 186.306 392.153 187.537 392.05 188.984L390.564 209.782C390.471 211.09 389.382 212.103 388.07 212.103H383.256Z",fill:ce.cC8CEF4,stroke:ce.c48504C}),e.jsx("path",{d:"M284.497 178.155C284.455 176.194 286.034 174.581 287.996 174.581H381.904C383.895 174.581 385.485 176.24 385.401 178.23L384.066 209.59C383.987 211.463 382.445 212.941 380.569 212.941H288.663C286.759 212.941 285.205 211.419 285.164 209.515L284.497 178.155Z",fill:ce.cC8CEF4,stroke:ce.c48504C}),e.jsx("path",{d:"M284.845 181.524C284.792 179.279 286.598 177.431 288.844 177.431H380.687C382.948 177.431 384.76 179.304 384.684 181.565L383.774 208.737C383.701 210.893 381.933 212.603 379.776 212.603H289.48C287.307 212.603 285.532 210.869 285.481 208.697L284.845 181.524Z",fill:ce.cBBC3F5}),e.jsx("mask",{id:"mask0_2949_9690",maskUnits:"userSpaceOnUse",x:"301",y:"144",width:"68",height:"17",style:{maskType:"luminance"},children:e.jsx("path",{d:"M301 146.5C301 145.395 301.887 144.5 302.98 144.5H367.02C368.114 144.5 369 145.395 369 146.5V160.411H301V146.5Z",fill:ce.cFFFFFF})}),e.jsxs("g",{mask:"url(#mask0_2949_9690)",children:[e.jsx("path",{d:"M301 146.191C301 145.257 301.748 144.5 302.671 144.5H356.701C357.624 144.5 358.372 145.257 358.372 146.191V157.949H301V146.191Z",fill:ce.cFFFFFF}),e.jsx("path",{d:"M301.336 146.607C301.336 145.673 302.08 144.916 302.999 144.916H367.01C367.929 144.916 368.673 145.673 368.673 146.607V152.523H301.336V146.607Z",fill:ce.cD6D6D6}),e.jsx("path",{d:"M368.673 152.523H301.336V174.5H368.673V152.523Z",fill:ce.cF4F4F4}),e.jsx("path",{d:"M307.685 150.417C308.607 150.417 309.356 149.66 309.356 148.726C309.356 147.793 308.607 147.036 307.685 147.036C306.762 147.036 306.014 147.793 306.014 148.726C306.014 149.66 306.762 150.417 307.685 150.417Z",fill:ce.cEE8080}),e.jsx("path",{d:"M313.532 150.417C314.455 150.417 315.203 149.66 315.203 148.726C315.203 147.793 314.455 147.036 313.532 147.036C312.609 147.036 311.861 147.793 311.861 148.726C311.861 149.66 312.609 150.417 313.532 150.417Z",fill:ce.cE5EE80}),e.jsx("path",{d:"M318.546 150.417C319.469 150.417 320.217 149.66 320.217 148.726C320.217 147.793 319.469 147.036 318.546 147.036C317.623 147.036 316.875 147.793 316.875 148.726C316.875 149.66 317.623 150.417 318.546 150.417Z",fill:ce.c46F16B})]}),e.jsx("path",{d:"M301.16 146C301.16 145.172 301.832 144.5 302.66 144.5H367.33C368.159 144.5 368.83 145.172 368.83 146V174.419H301.16V146Z",stroke:ce.c48504C}),e.jsx("path",{d:"M395.29 207.579H423.344M354.255 236.889H369.329M327.038 222.234H347.556M350.905 222.234H358.024M288.097 230.19H304.846M253.344 210.091H272.605M278.467 246.938H295.216M297.309 246.938H303.59M337.088 252.801H354.255",stroke:ce.c86512B,strokeWidth:"2",strokeLinecap:"round"})]}),e.jsx("path",{d:"M430.241 125.78C430.987 105.807 437.521 90.4065 449.841 79.5799C462.161 68.7532 478.867 63.3398 499.961 63.3398C513.961 63.3398 525.907 65.7665 535.801 70.6199C545.881 75.4732 553.441 82.0998 558.481 90.4998C563.707 98.8998 566.321 108.327 566.321 118.78C566.321 131.1 563.241 141.18 557.081 149.02C550.921 156.673 543.734 161.9 535.521 164.7V165.82C546.161 169.367 554.561 175.247 560.721 183.46C566.881 191.673 569.961 202.22 569.961 215.1C569.961 226.673 567.254 236.94 561.841 245.9C560.436 248.258 558.849 250.481 557.081 252.569L443.5 252.662C432.5 241 427.721 230.5 427.721 207.82H474.201C474.387 216.033 476.721 222.567 481.201 227.42C485.681 232.087 492.214 234.42 500.801 234.42C508.081 234.42 513.681 232.367 517.601 228.26C521.707 223.967 523.761 218.367 523.761 211.46C523.761 202.5 520.867 196.06 515.081 192.14C509.481 188.033 500.427 185.98 487.921 185.98H478.961V147.06H487.921C497.441 147.06 505.094 145.473 510.881 142.3C516.854 138.94 519.841 133.06 519.841 124.66C519.841 117.94 517.974 112.713 514.241 108.98C510.507 105.247 505.374 103.38 498.841 103.38C491.747 103.38 486.427 105.527 482.881 109.82C479.521 114.113 477.561 119.433 477.001 125.78H430.241Z",fill:ce.cBBDEFB,fillOpacity:"0.6"}),e.jsx("rect",{x:"43",y:"87.5",width:"46",height:"20",fill:ce.cD6EBFD}),e.jsx("rect",{x:"29",y:"109.5",width:"46",height:"20",fill:ce.cD6EBFD}),e.jsx("rect",{x:"29",y:"65.5",width:"46",height:"20",fill:ce.cD6EBFD}),e.jsx("rect",{x:"356",y:"0.5",width:"55",height:"20",fill:ce.cD6EBFD}),e.jsx("rect",{x:"572",y:"142.5",width:"55",height:"20",fill:ce.cD6EBFD}),e.jsx("rect",{x:"589",y:"120.5",width:"55",height:"20",fill:ce.cD6EBFD}),e.jsx("path",{d:"M3 255.5L651 255.5",stroke:ce.c64B5F6,strokeWidth:"5",strokeLinecap:"round"}),e.jsx("defs",{children:e.jsx("clipPath",{id:"clip0_2949_9690",children:e.jsx("rect",{width:"179",height:"192",fill:ce.cFFFFFF,transform:"translate(246 60.5)"})})})]})})}function ga({onClick:t}){const r=ke.useMediaQuery("md");return e.jsxs(x.Box,{direction:"column",height:"height-screen",fullWidth:!0,display:"flex",align:"center",justify:"center",gap:"md",children:[e.jsx(ma,{width:r?600:300}),e.jsx(w.Text,{fontWeight:"bold",fontSize:r?"3xl":"2xl",children:"We Are Sorry ..."}),t&&e.jsx(H.Button,{size:r?"md":"xs",onClick:t,children:"Go Back"})]})}const f={c000D58:"#000D58",c001174:"#001174",c28AC6E:"#28AC6E",c48504C:"#48504C",c64B5F6:"#64B5F6",c90CAF9:"#90CAF9",cC9184A:"#C9184A",cD6D6D6:"#D6D6D6",cD6EBFD:"#D6EBFD",cD9D9D9:"#D9D9D9",cDEECF8:"#DEECF8",cE7EAE9:"#E7EAE9",cF3F8FD:"#F3F8FD",cFFE18B:"#FFE18B",cFFFFFF:"#FFFFFF"};function pa({width:t,height:r}){return e.jsx(e.Fragment,{children:e.jsxs("svg",{width:t,height:r,viewBox:"0 0 622 287",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("path",{d:"M406.562 180.997C406.562 148.544 412.16 122.978 423.356 104.299C434.721 85.6199 452.957 76.2803 478.063 76.2803C503.168 76.2803 521.319 85.6199 532.514 104.299C543.88 122.978 549.562 148.544 549.562 180.997C549.562 213.827 543.88 239.582 532.514 258.261C521.319 276.941 503.168 286.28 478.063 286.28C452.957 286.28 434.721 276.941 423.356 258.261C412.16 239.582 406.562 213.827 406.562 180.997ZM506.815 180.997C506.815 161.941 504.949 147.318 501.217 137.129C497.485 126.752 489.767 121.563 478.063 121.563C466.358 121.563 458.64 126.752 454.908 137.129C451.176 147.318 449.31 161.941 449.31 180.997C449.31 193.827 449.988 204.488 451.345 212.978C452.703 221.28 455.417 228.073 459.488 233.356C463.729 238.45 469.92 240.997 478.063 240.997C486.205 240.997 492.312 238.45 496.383 233.356C500.624 228.073 503.423 221.28 504.78 212.978C506.137 204.488 506.815 193.827 506.815 180.997Z",fill:f.cD6EBFD}),e.jsx("path",{d:"M246.562 180.558C246.562 148.105 252.16 122.539 263.356 103.86C274.721 85.1804 292.957 75.8408 318.063 75.8408C343.168 75.8408 361.319 85.1804 372.514 103.86C383.88 122.539 389.562 148.105 389.562 180.558C389.562 213.388 383.88 239.143 372.514 257.822C361.319 276.501 343.168 285.841 318.063 285.841C292.957 285.841 274.721 276.501 263.356 257.822C252.16 239.143 246.562 213.388 246.562 180.558ZM346.815 180.558C346.815 161.501 344.949 146.879 341.217 136.69C337.485 126.313 329.767 121.124 318.063 121.124C306.358 121.124 298.64 126.313 294.908 136.69C291.176 146.879 289.31 161.501 289.31 180.558C289.31 193.388 289.988 204.048 291.345 212.539C292.702 220.841 295.417 227.633 299.488 232.916C303.729 238.011 309.92 240.558 318.063 240.558C326.205 240.558 332.312 238.011 336.383 232.916C340.624 227.633 343.423 220.841 344.78 212.539C346.137 204.048 346.815 193.388 346.815 180.558Z",fill:f.cD6EBFD}),e.jsx("path",{d:"M222.808 118.703H128.062V159.858C132.111 155.484 137.779 151.905 145.067 149.122C152.356 146.338 160.251 144.946 168.754 144.946C183.938 144.946 196.49 148.326 206.41 155.086C216.532 161.846 223.922 170.594 228.578 181.329C233.234 192.065 235.562 203.696 235.562 216.221C235.562 239.483 228.882 257.972 215.52 271.691C202.158 285.21 183.357 282.89 159.062 282.89C142.867 282.89 131.098 284.939 116.826 283.918C104.881 278.351 95.6695 270.697 89.1911 260.955C82.7127 251.213 79.1698 239.98 78.5625 227.256H129.276C130.491 233.419 133.426 238.588 138.083 242.763C142.739 246.739 149.116 248.728 157.214 248.728C166.729 248.728 173.815 245.745 178.472 239.781C183.128 233.817 185.456 225.864 185.456 215.923C185.456 206.181 183.027 198.726 178.168 193.557C173.309 188.387 166.223 185.803 156.911 185.803C150.027 185.803 144.359 187.493 139.905 190.873C135.451 194.054 132.515 198.328 131.098 203.696H80.9919V73.9697H222.808V118.703Z",fill:f.cD6EBFD}),e.jsx("rect",{x:"216.562",y:"45.7803",width:"55",height:"20",fill:f.cD6EBFD}),e.jsx("rect",{x:"14.4375",y:"90",width:"46",height:"20",fill:f.cD6EBFD}),e.jsx("rect",{x:"0.4375",y:"112",width:"46",height:"20",fill:f.cD6EBFD}),e.jsx("rect",{x:"0.4375",y:"68",width:"46",height:"20",fill:f.cD6EBFD}),e.jsx("rect",{x:"344.312",y:"0.719727",width:"55",height:"20",fill:f.cD6EBFD}),e.jsx("rect",{x:"549.562",y:"87",width:"55",height:"20",fill:f.cD6EBFD}),e.jsx("rect",{x:"566.562",y:"65",width:"55",height:"20",fill:f.cD6EBFD}),e.jsx("path",{d:"M25.8125 282.22H605.812",stroke:f.c64B5F6,strokeWidth:"5",strokeLinecap:"round"}),e.jsx("rect",{x:"263.012",y:"175.42",width:"104.6",height:"31.2833",rx:"3.3",fill:f.cFFFFFF,stroke:f.c001174,strokeWidth:"1.4"}),e.jsx("path",{d:"M269.878 200.539C269.878 200.263 270.101 200.039 270.377 200.039L305.476 199.955C305.753 199.955 305.978 200.179 305.978 200.455V206.461H269.878V200.539Z",stroke:f.c001174}),e.jsx("rect",{x:"263.012",y:"210.752",width:"104.6",height:"31.2833",rx:"3.3",fill:f.cFFFFFF,stroke:f.c001174,strokeWidth:"1.4"}),e.jsx("path",{d:"M269.878 235.871C269.878 235.595 270.101 235.372 270.377 235.371L305.476 235.288C305.753 235.287 305.978 235.511 305.978 235.788V241.794H269.878V235.871Z",stroke:f.c001174}),e.jsx("rect",{x:"263.012",y:"246.969",width:"104.6",height:"31.2833",rx:"3.3",fill:f.cFFFFFF,stroke:f.c001174,strokeWidth:"1.4"}),e.jsx("path",{d:"M269.878 272.088C269.878 271.812 270.101 271.589 270.377 271.588L305.476 271.505C305.753 271.504 305.978 271.728 305.978 272.005V278.011H269.878V272.088Z",stroke:f.c001174}),e.jsx("path",{d:"M279.095 176.348H364.373C365.459 176.348 366.125 176.992 366.986 178.252V202.985C366.986 202.985 366.986 203.869 366.545 204.752C366.103 205.635 365.661 206.077 365.661 206.077L306.478 206.163V199.452L279.095 199.518V176.348Z",fill:f.cF3F8FD}),e.jsx("path",{d:"M279.095 211.093H364.373C365.459 211.093 366.125 211.736 366.986 212.997V237.73C366.986 237.73 366.986 238.613 366.545 239.497C366.103 240.38 365.661 240.822 365.661 240.822L306.478 240.908V234.197L279.095 234.262V211.093Z",fill:f.cF3F8FD}),e.jsx("path",{d:"M279.095 248.008H364.373C365.459 248.008 366.125 248.652 366.986 249.912V274.646C366.986 274.646 366.986 275.529 366.545 276.412C366.103 277.296 365.661 277.737 365.661 277.737L306.478 277.824V271.112L279.095 271.178V248.008Z",fill:f.cF3F8FD}),e.jsx("circle",{cx:"270.258",cy:"179.136",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"270.258",cy:"181.786",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"281.561",cy:"179.136",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"281.561",cy:"181.786",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"273.085",cy:"179.136",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"273.085",cy:"181.786",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"284.388",cy:"179.136",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"284.388",cy:"181.786",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"275.91",cy:"179.136",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"275.91",cy:"181.786",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"287.214",cy:"179.136",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"287.214",cy:"181.786",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"278.737",cy:"179.136",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"278.737",cy:"181.786",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"290.04",cy:"179.136",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"290.04",cy:"181.786",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"344.462",cy:"179.136",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"344.462",cy:"181.786",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"355.765",cy:"179.136",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"355.765",cy:"181.786",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"347.29",cy:"179.136",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"347.29",cy:"181.786",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"358.592",cy:"179.136",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"358.592",cy:"181.786",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"350.114",cy:"179.136",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"350.114",cy:"181.786",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"361.418",cy:"179.136",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"361.418",cy:"181.786",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"352.941",cy:"179.136",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"352.941",cy:"181.786",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"364.244",cy:"179.136",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"364.244",cy:"181.786",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"344.462",cy:"200.336",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"344.462",cy:"202.986",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"355.765",cy:"200.336",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"355.765",cy:"202.986",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"347.29",cy:"200.336",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"347.29",cy:"202.986",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"358.592",cy:"200.336",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"358.592",cy:"202.986",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"350.114",cy:"200.336",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"350.114",cy:"202.986",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"361.418",cy:"200.336",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"361.418",cy:"202.986",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"352.941",cy:"200.336",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"352.941",cy:"202.986",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"364.244",cy:"200.336",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"364.244",cy:"202.986",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"359.918",cy:"191.061",r:"4.45833",stroke:f.c001174,strokeWidth:"0.8"}),e.jsx("circle",{cx:"359.918",cy:"191.061",r:"2.20833",fill:f.cE7EAE9}),e.jsx("rect",{x:"269.726",y:"186.553",width:"36.4",height:"9.01667",rx:"0.65",fill:f.cE7EAE9,stroke:f.c001174,strokeWidth:"0.7"}),e.jsx("rect",{x:"310.537",y:"186.553",width:"6.54333",height:"9.01667",rx:"0.65",fill:f.cE7EAE9,stroke:f.c001174,strokeWidth:"0.7"}),e.jsx("rect",{x:"321.312",y:"186.553",width:"6.54333",height:"9.01667",rx:"0.65",fill:f.cE7EAE9,stroke:f.c001174,strokeWidth:"0.7"}),e.jsx("rect",{x:"332.089",y:"186.553",width:"6.54333",height:"9.01667",rx:"0.65",fill:f.cE7EAE9,stroke:f.c001174,strokeWidth:"0.7"}),e.jsx("rect",{x:"342.864",y:"186.553",width:"6.54333",height:"9.01667",rx:"0.65",fill:f.cE7EAE9,stroke:f.c001174,strokeWidth:"0.7"}),e.jsx("circle",{cx:"270.258",cy:"214.468",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"270.258",cy:"217.118",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"281.561",cy:"214.468",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"281.561",cy:"217.118",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"273.085",cy:"214.468",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"273.085",cy:"217.118",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"284.388",cy:"214.468",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"284.388",cy:"217.118",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"275.91",cy:"214.468",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"275.91",cy:"217.118",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"287.214",cy:"214.468",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"287.214",cy:"217.118",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"278.737",cy:"214.468",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"278.737",cy:"217.118",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"290.04",cy:"214.468",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"290.04",cy:"217.118",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"344.462",cy:"214.468",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"344.462",cy:"217.118",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"355.765",cy:"214.468",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"355.765",cy:"217.118",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"347.29",cy:"214.468",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"347.29",cy:"217.118",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"358.592",cy:"214.468",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"358.592",cy:"217.118",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"350.114",cy:"214.468",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"350.114",cy:"217.118",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"361.418",cy:"214.468",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"361.418",cy:"217.118",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"352.941",cy:"214.468",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"352.941",cy:"217.118",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"364.244",cy:"214.468",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"364.244",cy:"217.118",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"344.462",cy:"235.668",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"344.462",cy:"238.318",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"355.765",cy:"235.668",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"355.765",cy:"238.318",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"347.29",cy:"235.668",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"347.29",cy:"238.318",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"358.592",cy:"235.668",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"358.592",cy:"238.318",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"350.114",cy:"235.668",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"350.114",cy:"238.318",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"361.418",cy:"235.668",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"361.418",cy:"238.318",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"352.941",cy:"235.668",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"352.941",cy:"238.318",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"364.244",cy:"235.668",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"364.244",cy:"238.318",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"359.918",cy:"226.393",r:"4.45833",stroke:f.c001174,strokeWidth:"0.8"}),e.jsx("circle",{cx:"359.918",cy:"226.393",r:"2.20833",fill:f.cE7EAE9}),e.jsx("rect",{x:"269.726",y:"221.885",width:"36.4",height:"9.01667",rx:"0.65",fill:f.cE7EAE9,stroke:f.c001174,strokeWidth:"0.7"}),e.jsx("rect",{x:"310.537",y:"221.885",width:"6.54333",height:"9.01667",rx:"0.65",fill:f.cE7EAE9,stroke:f.c001174,strokeWidth:"0.7"}),e.jsx("rect",{x:"321.312",y:"221.885",width:"6.54333",height:"9.01667",rx:"0.65",fill:f.cE7EAE9,stroke:f.c001174,strokeWidth:"0.7"}),e.jsx("rect",{x:"332.089",y:"221.885",width:"6.54333",height:"9.01667",rx:"0.65",fill:f.cE7EAE9,stroke:f.c001174,strokeWidth:"0.7"}),e.jsx("rect",{x:"342.864",y:"221.885",width:"6.54333",height:"9.01667",rx:"0.65",fill:f.cE7EAE9,stroke:f.c001174,strokeWidth:"0.7"}),e.jsx("circle",{cx:"270.258",cy:"250.685",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"270.258",cy:"253.335",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"281.561",cy:"250.685",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"281.561",cy:"253.335",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"273.085",cy:"250.685",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"273.085",cy:"253.335",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"284.388",cy:"250.685",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"284.388",cy:"253.335",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"275.91",cy:"250.685",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"275.91",cy:"253.335",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"287.214",cy:"250.685",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"287.214",cy:"253.335",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"278.737",cy:"250.685",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"278.737",cy:"253.335",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"290.04",cy:"250.685",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"290.04",cy:"253.335",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"344.462",cy:"250.685",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"344.462",cy:"253.335",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"355.765",cy:"250.685",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"355.765",cy:"253.335",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"347.29",cy:"250.685",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"347.29",cy:"253.335",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"358.592",cy:"250.685",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"358.592",cy:"253.335",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"350.114",cy:"250.685",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"350.114",cy:"253.335",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"361.418",cy:"250.685",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"361.418",cy:"253.335",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"352.941",cy:"250.685",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"352.941",cy:"253.335",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"364.244",cy:"250.685",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"364.244",cy:"253.335",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"344.462",cy:"271.885",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"344.462",cy:"274.535",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"355.765",cy:"271.885",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"355.765",cy:"274.535",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"347.29",cy:"271.885",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"347.29",cy:"274.535",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"358.592",cy:"271.885",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"358.592",cy:"274.535",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"350.114",cy:"271.885",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"350.114",cy:"274.535",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"361.418",cy:"271.885",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"361.418",cy:"274.535",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"352.941",cy:"271.885",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"352.941",cy:"274.535",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"364.244",cy:"271.885",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"364.244",cy:"274.535",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"359.918",cy:"262.61",r:"4.45833",stroke:f.c001174,strokeWidth:"0.8"}),e.jsx("circle",{cx:"359.918",cy:"262.61",r:"2.20833",fill:f.cE7EAE9}),e.jsx("rect",{x:"269.726",y:"258.102",width:"36.4",height:"9.01667",rx:"0.65",fill:f.cE7EAE9,stroke:f.c001174,strokeWidth:"0.7"}),e.jsx("rect",{x:"310.537",y:"258.102",width:"6.54333",height:"9.01667",rx:"0.65",fill:f.cE7EAE9,stroke:f.c001174,strokeWidth:"0.7"}),e.jsx("rect",{x:"321.312",y:"258.102",width:"6.54333",height:"9.01667",rx:"0.65",fill:f.cE7EAE9,stroke:f.c001174,strokeWidth:"0.7"}),e.jsx("rect",{x:"332.089",y:"258.102",width:"6.54333",height:"9.01667",rx:"0.65",fill:f.cE7EAE9,stroke:f.c001174,strokeWidth:"0.7"}),e.jsx("rect",{x:"342.864",y:"258.102",width:"6.54333",height:"9.01667",rx:"0.65",fill:f.cE7EAE9,stroke:f.c001174,strokeWidth:"0.7"}),e.jsx("rect",{x:"270.261",y:"200.336",width:"8.83333",height:"6.18333",fill:f.cFFFFFF}),e.jsx("rect",{x:"270.261",y:"235.668",width:"8.83333",height:"6.18333",fill:f.cFFFFFF}),e.jsx("rect",{x:"270.261",y:"271.885",width:"8.83333",height:"6.18333",fill:f.cFFFFFF}),e.jsx("rect",{x:"279.095",y:"200.336",width:"26.5",height:"6.18333",fill:f.cDEECF8}),e.jsx("rect",{x:"279.095",y:"235.668",width:"26.5",height:"6.18333",fill:f.cDEECF8}),e.jsx("rect",{x:"279.095",y:"271.885",width:"26.5",height:"6.18333",fill:f.cDEECF8}),e.jsx("path",{d:"M268.053 210.494C268.483 209.112 268.564 208.343 268.053 206.961H362.569C361.955 208.363 361.972 209.136 362.569 210.494H268.053Z",fill:f.c000D58,stroke:f.c001174}),e.jsx("path",{d:"M268.053 246.269C268.483 244.887 268.564 244.118 268.053 242.736H362.569C361.955 244.138 361.972 244.911 362.569 246.269H268.053Z",fill:f.c000D58,stroke:f.c001174}),e.jsx("path",{d:"M283.312 130.775C283.312 129.64 283.987 128.72 284.82 128.72H349.805C350.638 128.72 351.312 129.64 351.312 130.775V169.72H283.312V130.775Z",fill:f.cFFFFFF,stroke:f.c48504C,strokeWidth:"2"}),e.jsx("path",{d:"M279.574 171.847C279.381 171.283 279.267 170.624 279.33 169.72H355.195C355.423 170.925 355.287 171.695 355.063 172.241C354.834 172.802 354.506 173.186 354.101 173.66C354.084 173.68 354.067 173.7 354.05 173.72H280.503C280.468 173.658 280.434 173.598 280.4 173.539C280.051 172.922 279.774 172.434 279.574 171.847Z",stroke:f.c48504C,strokeWidth:"2"}),e.jsx("path",{d:"M350.312 133.72V129.726L284.812 129.72C284.312 129.726 284.312 129.726 284.312 130.125V133.72H350.312Z",fill:f.cD6D6D6}),e.jsx("circle",{cx:"287.212",cy:"131.62",r:"0.9",fill:f.c28AC6E}),e.jsx("circle",{cx:"289.812",cy:"131.62",r:"0.9",fill:f.cC9184A}),e.jsx("circle",{cx:"292.412",cy:"131.62",r:"0.9",fill:f.cFFE18B}),e.jsx("rect",{x:"315.312",y:"133.72",width:"35",height:"35",fill:f.c90CAF9}),e.jsx("path",{d:"M319.312 153.22H341.312",stroke:f.cFFFFFF,strokeWidth:"1.3",strokeLinecap:"round"}),e.jsx("path",{d:"M288.312 150.72H310.312",stroke:f.c001174,strokeWidth:"1.3",strokeLinecap:"round"}),e.jsx("path",{d:"M319.312 156.22H336.312",stroke:f.cFFFFFF,strokeWidth:"1.3",strokeLinecap:"round"}),e.jsx("path",{d:"M288.312 153.72H305.312",stroke:f.c001174,strokeWidth:"1.3",strokeLinecap:"round"}),e.jsx("path",{d:"M319.312 159.22H336.312",stroke:f.cFFFFFF,strokeWidth:"1.3",strokeLinecap:"round"}),e.jsx("path",{d:"M288.312 156.72H305.312",stroke:f.c001174,strokeWidth:"1.3",strokeLinecap:"round"}),e.jsx("path",{d:"M337.312 139.72L328.312 148.72M328.313 139.72L337.313 148.72",stroke:f.cFFFFFF,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})})}function ya({onClick:t}){const r=ke.useMediaQuery("md");return e.jsxs(x.Box,{direction:"column",height:"height-screen",fullWidth:!0,display:"flex",align:"center",justify:"center",gap:"md",overflow:"overflow-hidden",children:[e.jsx(pa,{width:r?600:300}),e.jsx(w.Text,{fontWeight:"bold",fontSize:r?"3xl":"2xl",textAlign:"center",children:"Server Problem"}),e.jsx(w.Text,{fontWeight:"semibold",fontSize:r?"lg":"md",textAlign:"center",children:"we are trying to fix the problem"}),t&&e.jsx(H.Button,{size:r?"md":"xs",onClick:t,children:"Go Back"})]})}const ba=t=>{var n,s,o,i,l;const r=ke.useMediaQuery("md");return e.jsxs(Oe.Dialog,{isShow:t.isShow,onHide:t.onHide,style:{...r?{minWidth:t.customMinWidth||"458px"}:{maxWidth:t.customMinWidth||"458px"}},children:[e.jsx(Oe.DialogTitle,{...t.dialogTitleProps,children:typeof t.title=="string"?e.jsx(w.Text,{fontSize:"lg",fontWeight:"medium",children:t.title}):t.title}),e.jsx(Oe.DialogBody,{children:typeof t.description=="string"?e.jsx(w.Text,{fontSize:"md",lineHeight:"leading-6",color:"brand",children:t.description}):t.description}),e.jsx(Oe.DialogFooter,{children:e.jsx(x.Box,{display:"flex",direction:((n=t.containerConfirmBtnProps)==null?void 0:n.direction)||"row",justify:((s=t.containerConfirmBtnProps)==null?void 0:s.justify)||"flex-end",...t.containerConfirmBtnProps,children:e.jsxs(x.Box,{display:"flex",direction:((o=t.wrapperConfirmBtnProps)==null?void 0:o.direction)||"row",justify:((i=t.wrapperConfirmBtnProps)==null?void 0:i.justify)||"flex-end",gap:((l=t.wrapperConfirmBtnProps)==null?void 0:l.gap)||"sm",...t.wrapperConfirmBtnProps,children:[t.onCancel&&e.jsx(H.Button,{secondary:!0,onClick:t.onCancel,size:"md",fullWidth:!0,children:t.titleCancelBtn||"Cancel"}),e.jsx(x.Box,{direction:"column",fullWidth:!0,style:{textWrap:"nowrap"},children:e.jsx(H.Button,{...t.buttonConfirmProps,onClick:t.onConfirm,size:"md",fullWidth:!0,children:t.titleConfirmBtn||"Ok"})})]})})})]},t.key)},ja=u.memo(({children:t,height:r,minHeight:n,customHeight:s,paddingInline:o="spacing-0",paddingBlock:i="spacing-0",header:l,footer:c,title:a,titleTag:d,action:h,actionContainer:g,containerProps:m,bodyProps:y,headerProps:b={borderBottom:!0},footerProps:C={borderTop:!0},variantTag:O="info"})=>{const M=u.useRef(null),[L,j]=u.useState("100vh");u.useEffect(()=>{const S=()=>{if(M.current){const T=M.current.getBoundingClientRect().top;j(`calc(100vh - ${T}px)`)}};return S(),window.addEventListener("resize",S),()=>window.removeEventListener("resize",S)},[]);const D=()=>d?e.jsxs(x.Box,{direction:"row",gap:"sm",align:"center",children:[e.jsx(w.Text,{fontWeight:"medium",children:a}),e.jsx(it.Badges,{border:!0,text:d,variant:O})]}):e.jsx(w.Text,{fontWeight:"medium",children:a}),R=()=>l||e.jsxs(x.Box,{direction:"row",justify:"space-between",align:"flex-start",gap:"md",children:[e.jsx(x.Box,{direction:"column",children:a?D():null}),e.jsx(x.Box,{direction:"column",...g,children:h??null})]}),B=!!(l||a||h);return e.jsxs(x.Box,{ref:M,height:r,customMinHeight:n,customHeight:s,paddingBlock:i,paddingInline:o,bg:"white",direction:"column",...m,style:{backgroundColor:"var(--sa-background-primary, #ffffff)",display:"flex",minHeight:L,...(m==null?void 0:m.style)??{}},children:[l!==null&&B?e.jsx(gn,{...b,children:R()}):null,e.jsx(x.Box,{direction:"column",padding:"spacing-0",...y,style:{flex:1,overflow:"auto",...(y==null?void 0:y.style)??{}},children:t}),c?e.jsx(pn,{...C,children:c}):null]})}),va=u.memo(({value:t,options:r=[],onChange:n,multiple:s})=>{const o=(t==null?void 0:t.map(c=>c.value))||[],i=(r==null?void 0:r.filter(c=>o.includes(c.value)))||[],l=c=>{const a=[...i];let d=[];s?d=o.includes(c.value)?a.filter(h=>h.value!==c.value):[...a,c]:d=[c],n==null||n(d)};return e.jsx(x.Box,{direction:"row",gap:"sm",flexWrap:"wrap",children:r==null?void 0:r.map((c,a)=>e.jsx(H.Button,{...o.includes(c.value)?{primary:!0}:{secondary:!0},onClick:()=>l(c),children:c.label},a))})});function Cr(t){return null}Cr.displayName="LayoutDialog.Header";function wr(t){return null}wr.displayName="LayoutDialog.Body";function Dr(t){return null}Dr.displayName="LayoutDialog.Aside";function Sr(t){return null}Sr.displayName="LayoutDialog.Footer";const _e={"lyd-root":"_lyd-root_jyp0m_6","lyd-backdrop":"_lyd-backdrop_jyp0m_43","lyd-panel":"_lyd-panel_jyp0m_52","lyd-modal":"_lyd-modal_jyp0m_63","lyd-fullscreen":"_lyd-fullscreen_jyp0m_77","lyd-sidebar":"_lyd-sidebar_jyp0m_85","lyd-header":"_lyd-header_jyp0m_115","lyd-header-content":"_lyd-header-content_jyp0m_126","lyd-header-actions":"_lyd-header-actions_jyp0m_134","lyd-main":"_lyd-main_jyp0m_141","lyd-body":"_lyd-body_jyp0m_148","lyd-aside":"_lyd-aside_jyp0m_154","lyd-footer":"_lyd-footer_jyp0m_170","lyd-vm-group":"_lyd-vm-group_jyp0m_183","lyd-vm-btn":"_lyd-vm-btn_jyp0m_191","lyd-close-btn":"_lyd-close-btn_jyp0m_214"},Ca=[{mode:"sidebar",label:"Sidebar",renderIcon:()=>e.jsx(Da,{})},{mode:"modal",label:"Modal",renderIcon:()=>e.jsx(E.Icon,{name:"Newscreen",size:"sm"})},{mode:"fullscreen",label:"Fullscreen",renderIcon:()=>e.jsx(E.Icon,{name:"Fullscreen",size:"sm"})}];function wa({value:t,onChange:r}){return e.jsx("div",{className:_e["lyd-vm-group"],role:"group","aria-label":"View mode",children:Ca.map(n=>e.jsx("button",{type:"button",className:_e["lyd-vm-btn"],"data-active":t===n.mode,"aria-label":`Switch to ${n.label} view`,"aria-pressed":t===n.mode,onClick:()=>r(n.mode),children:n.renderIcon()},n.mode))})}function Da(){return 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","aria-hidden":"true",children:[e.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),e.jsx("line",{x1:"15",y1:"4",x2:"15",y2:"20"})]})}const Ur={md:"768px",lg:"1024px",xl:"1200px","2xl":"1440px"};function Sa(t){return t?t in Ur?Ur[t]:t:Ur.xl}function ur(t,r){let n=null;return u.Children.forEach(t,s=>{u.isValidElement(s)&&s.type===r&&(n=s.props.children??null)}),n}function ka(t){const{isOpen:r,onClose:n,viewMode:s,defaultViewMode:o="modal",onViewModeChange:i,showViewModeToggle:l=!0,showCloseButton:c=!0,size:a,asideWidth:d,disableEscapeClose:h=!1,disableBackdropClose:g=!1,lockBodyScroll:m=!0,children:y}=t,[b,C]=u.useState(o),O=s??b,L=ke.useMediaQuery("md")?O:"fullscreen",j=u.useCallback(Y=>{s===void 0&&C(Y),i==null||i(Y)},[s,i]),D=u.useRef(null);u.useEffect(()=>{if(!(!r||!m))return D.current=document.body.style.overflow,document.body.style.overflow="hidden",()=>{document.body.style.overflow=D.current??""}},[r,m]);const R=u.useRef(n);R.current=n,u.useEffect(()=>{if(r)return Oe.registerOverlay({onEscape:h?void 0:()=>R.current()})},[r,h]);const B=u.useMemo(()=>ur(y,Cr),[y]),S=u.useMemo(()=>ur(y,wr),[y]),T=u.useMemo(()=>ur(y,Dr),[y]),P=u.useMemo(()=>ur(y,Sr),[y]);if(!r)return null;const X=[_e["lyd-panel"],L==="modal"&&_e["lyd-modal"],L==="fullscreen"&&_e["lyd-fullscreen"],L==="sidebar"&&_e["lyd-sidebar"]].filter(Boolean).join(" "),I={"--lyd-max-w":Sa(a),...d!==void 0&&{"--lyd-aside-w":d}},N=()=>{g||n()};return typeof document>"u"?null:br.createPortal(e.jsxs("div",{className:_e["lyd-root"],style:I,role:"dialog","aria-modal":"true",children:[e.jsx("div",{className:_e["lyd-backdrop"],onClick:N,"aria-hidden":"true"}),e.jsxs("div",{className:X,children:[e.jsxs("div",{className:_e["lyd-header"],children:[e.jsx("div",{className:_e["lyd-header-content"],children:B}),e.jsxs("div",{className:_e["lyd-header-actions"],children:[l&&e.jsx(wa,{value:O,onChange:j}),c&&e.jsx("button",{type:"button",className:_e["lyd-close-btn"],onClick:n,"aria-label":"Close dialog",children:e.jsx(E.Icon,{name:"Cross",size:"md"})})]})]}),e.jsxs("div",{className:_e["lyd-main"],children:[e.jsx("div",{className:_e["lyd-body"],children:S}),T&&e.jsx("aside",{className:_e["lyd-aside"],children:T})]}),P&&e.jsx("div",{className:_e["lyd-footer"],children:P})]})]}),document.body)}const Qt=ka;Qt.Header=Cr;Qt.Body=wr;Qt.Aside=Dr;Qt.Footer=Sr;function Ba({url:t,filename:r,onClose:n}){const s=u.useRef(n);return s.current=n,u.useEffect(()=>Oe.registerOverlay({onEscape:()=>s.current()}),[]),e.jsxs("div",{onClick:n,style:{position:"fixed",inset:0,zIndex:9999,backgroundColor:"rgba(0,0,0,0.85)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"12px"},children:[e.jsxs("div",{onClick:o=>o.stopPropagation(),style:{position:"absolute",top:"16px",right:"16px",display:"flex",gap:"8px"},children:[e.jsx("a",{href:t,download:r,style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"6px 12px",backgroundColor:"rgba(255,255,255,0.15)",color:"#fff",borderRadius:"var(--sa-radii-sm, 6px)",fontSize:"13px",textDecoration:"none",backdropFilter:"blur(4px)"},children:"Download"}),e.jsx("button",{onClick:n,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",backgroundColor:"rgba(255,255,255,0.15)",border:"none",borderRadius:"var(--sa-radii-sm, 6px)",color:"#fff",cursor:"pointer",backdropFilter:"blur(4px)"},"aria-label":"Close preview",children:"✕"})]}),e.jsx("img",{src:t,alt:r,onClick:o=>o.stopPropagation(),style:{maxWidth:"90vw",maxHeight:"85vh",objectFit:"contain",borderRadius:"var(--sa-radii-sm, 6px)",boxShadow:"var(--sa-shadow-lg, 0 25px 50px rgba(0,0,0,0.5))"}}),e.jsx("span",{style:{color:"rgba(255,255,255,0.6)",fontSize:"12px"},children:r})]})}const Ea=/\.(jpe?g|png|gif|webp|bmp|svg|avif)(\?|#|$)/i,Fa=/\.pdf(\?|#|$)/i,Ia=/\.(mp4|webm|ogv|mov|m4v)(\?|#|$)/i,Ma=/\.(mp3|wav|ogg|m4a|aac|flac)(\?|#|$)/i;function La(t,r){if(r)return r;const n=t.mimeType??"",s=o=>o.test(t.fileName??"")||o.test(t.fileUrl??"");return n.startsWith("image/")||s(Ea)?"image":n==="application/pdf"||s(Fa)?"pdf":n.startsWith("video/")||s(Ia)?"video":n.startsWith("audio/")||s(Ma)?"audio":"other"}const po={display:"block",maxWidth:"100%",maxHeight:"70vh",margin:"0 auto",objectFit:"contain",borderRadius:"var(--sa-radii-sm, 6px)"},Ta={width:"100%",height:"75vh",border:"none",borderRadius:"var(--sa-radii-sm, 6px)"};function Ra({kind:t,attachment:r,openLabel:n,unsupportedLabel:s}){const{fileUrl:o,fileName:i}=r;switch(t){case"image":return e.jsx("img",{src:o,alt:i,style:po});case"pdf":return e.jsx("iframe",{src:o,title:i,style:Ta});case"video":return e.jsx("video",{src:o,controls:!0,style:{...po,width:"100%"}});case"audio":return e.jsx(x.Box,{padding:"lg",align:"center",justify:"center",fullWidth:!0,children:e.jsx("audio",{src:o,controls:!0,style:{width:"100%"}})});default:return e.jsxs(x.Box,{direction:"column",align:"center",justify:"center",gap:"md",padding:"3xl",fullWidth:!0,children:[e.jsx(E.Icon,{name:"DocumentDetail",size:"lg"}),e.jsx(w.Text,{fontSize:"sm",color:"gray-500",children:s}),e.jsx(H.Button,{type:"button",variant:"link",iconLeft:e.jsx(E.Icon,{name:"SquareArrowExpand"}),onClick:()=>window.open(o,"_blank","noopener"),children:n})]})}}const Oa=({attachment:t,onClose:r,onDownload:n,isDownloading:s,kind:o,maxWidth:i,labels:l})=>{if(!t)return null;const c=La(t,o),a=i??(c==="pdf"?"min(80vw, 1100px)":"min(90vw, 900px)"),d={download:(l==null?void 0:l.download)??"Download",close:(l==null?void 0:l.close)??"Close",openInNewTab:(l==null?void 0:l.openInNewTab)??"Open in new tab",unsupported:(l==null?void 0:l.unsupported)??"This file type cannot be previewed."};return e.jsxs(Oe.Dialog,{isShow:!0,onHide:r,maxWidth:a,children:[e.jsx(Oe.DialogTitle,{children:e.jsxs(x.Box,{direction:"row",align:"center",justify:"space-between",gap:"sm",fullWidth:!0,children:[e.jsx(w.Text,{fontWeight:"semibold",truncate:!0,children:t.fileName}),e.jsxs(x.Box,{direction:"row",align:"center",gap:"sm",flexShrink:"0",children:[n?e.jsx(H.Button,{type:"button",variant:"outline",tone:"neutral",size:"sm",iconLeft:e.jsx(E.Icon,{name:"Download"}),disabled:s,isLoading:s,onClick:n,children:d.download}):null,e.jsx(H.Button,{type:"button",variant:"tertiary",tone:"neutral",size:"sm",iconLeft:e.jsx(E.Icon,{name:"Cross"}),"aria-label":d.close,onClick:r})]})]})}),e.jsx(Oe.DialogBody,{children:e.jsx(Ra,{kind:c,attachment:t,openLabel:d.openInNewTab,unsupportedLabel:d.unsupported})})]})},gs="var(--sa-border-subtle, #e5e7eb)",yr=()=>e.jsx(x.Box,{style:{width:1,height:22,backgroundColor:gs}}),Aa=t=>typeof t=="number"?`${t}px`:t;function ps({count:t,children:r,label:n,onClear:s,clearLabel:o="Clear selection",clearDisabled:i=!1,bottom:l=20,zIndex:c=50,style:a,className:d}){if(t===0)return null;const h=typeof n=="function"?n(t):n??`${t} selected`;return e.jsx(x.Box,{direction:"row",justify:"center",style:{position:"fixed",bottom:Aa(l),left:0,right:0,zIndex:c,pointerEvents:"none"},children:e.jsxs(x.Box,{direction:"row",align:"center",gap:"xs",padding:"spacing-8",className:d,style:{backgroundColor:"var(--sa-background-primary, #ffffff)",pointerEvents:"auto",borderRadius:"min(10px, var(--sa-radii-lg, 12px))",border:`1px solid ${gs}`,boxShadow:"var(--sa-shadow-xl, 0 10px 25px -5px rgb(0 0 0/0.15))",...a},children:[e.jsx(w.Text,{fontSize:"sm",fontWeight:"medium",whiteSpace:"nowrap",style:{paddingInline:6},children:h}),e.jsx(yr,{}),r,s&&e.jsxs(e.Fragment,{children:[e.jsx(yr,{}),e.jsx(Le.Tooltip,{label:o,position:"top",children:e.jsx(H.Button,{variant:"tertiary",tone:"neutral",size:"sm",iconLeft:e.jsx(E.Icon,{name:"Cross",size:"xs"}),"aria-label":o,onClick:s,disabled:i})})]})]})})}ps.Divider=yr;const kr=t=>{const{variant:r="outlined",overflow:n="hidden",style:s,children:o,...i}=t;return e.jsx(Yr.Card,{variant:r,overflow:n,style:{display:"flex",flexDirection:"column",...s},...i,children:o})},Wa=t=>t==null?void 0:typeof t=="number"?`${t}px`:t,ys=({src:t,alt:r="",height:n=140,bg:s="var(--sa-background-neutral, #f0f1f2)",avatar:o,children:i})=>e.jsxs(x.Box,{style:{position:"relative",marginBottom:o?24:void 0},children:[e.jsx(x.Box,{style:{height:Wa(n),background:t?void 0:s,overflow:"hidden"},children:t?e.jsx("img",{src:t,alt:r,style:{width:"100%",height:"100%",objectFit:"cover",display:"block"}}):null}),i?e.jsx(x.Box,{style:{position:"absolute",inset:0,pointerEvents:"none"},children:i}):null,o?e.jsx(x.Box,{style:{position:"absolute",left:16,bottom:0,transform:"translateY(50%)"},children:o}):null]}),bs=({avatar:t,title:r,subtitle:n,action:s,divided:o=!1,children:i})=>e.jsx(x.Box,{padding:"md",style:{borderBottom:o?"1px solid var(--sa-border-subtle, #0b120e24)":void 0},children:i??e.jsxs(de.Flex,{direction:"row",align:"center",gap:"sm",children:[t,e.jsxs(x.Box,{flex:"1",style:{minWidth:0},children:[r!=null&&e.jsx(w.Text,{fontWeight:"semibold",truncate:!0,children:r}),n!=null&&e.jsx(w.Text,{fontSize:"sm",color:"subtlest",truncate:!0,children:n})]}),s!=null&&e.jsx(x.Box,{style:{flexShrink:0},children:s})]})}),js=({left:t,right:r,divided:n=!0,children:s})=>e.jsx(x.Box,{padding:"md",style:{marginTop:"auto",borderTop:n?"1px solid var(--sa-border-subtle, #0b120e24)":void 0},children:s??e.jsxs(de.Flex,{direction:"row",align:"center",justify:"space-between",gap:"sm",children:[e.jsx(x.Box,{style:{minWidth:0},children:t}),e.jsx(x.Box,{style:{flexShrink:0},children:r})]})});kr.Media=ys;kr.Header=bs;kr.Footer=js;const za=t=>{const{defaultTab:r=0,paramKey:n="tab"}=t||{},{useSearchParams:s}=at(),[o,i]=s(),l=Tt.searchParamsToObject(o.toString());return{activeTab:l[n]?parseInt(l[n]):r,handleTabChange:d=>{i({...l,[n]:d.toString()})},searchQueries:l}};function Ha({appName:t,menuConfig:r,formatTitle:n}){const{useLocation:s}=at(),o=s();u.useEffect(()=>{let i=null,l=null;for(const d of r){const h=d.items.find(g=>g.to?g.to==="/"?o.pathname==="/":!!(g.to===o.pathname||o.pathname.startsWith(g.to+"/")):!1);if(h){i=h,l=d;break}}const c=[];i!=null&&i.title&&c.push(i.title),l!=null&&l.name&&c.push(l.name.toTitleCase());const a=(d,h)=>d.length>0?`${d.join(" - ")} | ${h}`:h;document.title=(n||a)(c,t)},[o.pathname])}const Pa=()=>{const{useSearchParams:t,useParams:r,useLocation:n}=at(),[s,o]=t(),i=Tt.searchParamsToObject(s.toString()),l=r(),c=n(),a=l.id;return{setSearchParams:o,searchParams:s,searchQueries:i,isHasQuery:(y,b)=>s.has(y)&&s.get(y)===b,getQueryParam:y=>s.get(y),getRouteParam:y=>l[y],params:l,location:c,id:a,hasId:!!a}};function _a(t){var s,o;const r=t.decodedAccessToken;return u.useMemo(()=>{var a,d;const i=((d=(a=r==null?void 0:r.access)==null?void 0:a.role)==null?void 0:d.code)??"",l=Object.keys(t.role).reduce((h,g)=>{const m=`is${g.toLowerCase().replace(/(^\w|_\w)/g,y=>y.replace("_","").toUpperCase())}`;return{...h,[m]:!1}},{});return{...Object.keys(t.role).reduce((h,g)=>{const m=`is${g.toLowerCase().replace(/(^\w|_\w)/g,y=>y.replace("_","").toUpperCase())}`;return{...h,[m]:i===t.role[g]}},l),hasRole:h=>i===t.role[h],getRoleKey:()=>i}},[(o=(s=r==null?void 0:r.access)==null?void 0:s.role)==null?void 0:o.code,t])}exports.ASIDE_WIDTH_VAR=sn;exports.AdvanceFilterBar=qo;exports.App=Ns;exports.AppComponent=Bo;exports.AppContext=cn;exports.AppLayout=pi;exports.AsideBar=ia;exports.AttachmentPreview=Oa;exports.BackButton=bi;exports.ColumnFilterDropdown=ss;exports.ColumnHeaderFilter=Pl;exports.ColumnMenu=as;exports.ConfirmationDialog=ba;exports.DataTable=is;exports.DecisionWrapper=xe;exports.EachUtils=vr;exports.EmptyStatePage=xa;exports.EntityCard=kr;exports.EntityCardFooter=js;exports.EntityCardHeader=bs;exports.EntityCardMedia=ys;exports.FLOATING_FOOTER_HEIGHT_VAR=ln;exports.FilterBar=Bl;exports.FilterDrawer=Vo;exports.FloatingFooter=ca;exports.ForbiddenPage=ga;exports.Form=Xc;exports.FullSection=ja;exports.HeaderLeftSlot=Vs;exports.HeaderLeftSlotOutlet=Io;exports.HeaderLeftSlotProvider=Fo;exports.Highlight=ds;exports.HorizontalField=Di;exports.ImagePreview=Ba;exports.InputFile=xs;exports.InputImage=hs;exports.LayoutDialog=Qt;exports.LayoutDialogAside=Dr;exports.LayoutDialogBody=wr;exports.LayoutDialogFooter=Sr;exports.LayoutDialogHeader=Cr;exports.ModuleSwitcher=ji;exports.ModuleSwitcherModal=Ro;exports.NotFoundPage=fa;exports.PageLayout=Ei;exports.Pressable=Zt;exports.RightDrawer=Ao;exports.SIDEBAR_DEFAULT_WIDTH=dn;exports.SIDEBAR_MAX_WIDTH=xn;exports.SIDEBAR_MIN_WIDTH=un;exports.ScrollToTopButton=fs;exports.Section=Ti;exports.SectionFooter=pn;exports.SectionHeader=gn;exports.SelectButton=va;exports.SelectionActionBar=ps;exports.SelectionActionBarDivider=yr;exports.ServerErrorPage=ya;exports.SidePanel=oa;exports.SidePanelItem=ta;exports.SidebarBadgesProvider=jo;exports.SidebarGroupSlot=qs;exports.SidebarGroupSlotOutlet=Kr;exports.SidebarGroupSlotProvider=Mo;exports.SidebarHeaderSlot=Eo;exports.SidebarProvider=wo;exports.StarasiaRouterProvider=ko;exports.TableFooter=os;exports.TableHeader=ns;exports.TableLayout=lc;exports.TableSection=Ql;exports.TableWrapper=rs;exports.ToggleStatus=Yc;exports.Typography=nt;exports.VerticalField=aa;exports.clearModuleSelection=Zs;exports.createInitialFromUserName=hc;exports.cssVars=bc;exports.expandDateCompact=_l;exports.formHasChanged=Sc;exports.formatDate=pc;exports.formatDateToIndonesian=us;exports.formatRupiah=mc;exports.getDateFilterValue=No;exports.getDateRangeFilterValue=Yi;exports.getInitials=gc;exports.getValueDropdownMultipleFilter=_o;exports.getValueRadioFilter=Ui;exports.getValueSearch=jr;exports.getValuesFilter=hr;exports.handleChangeFilter=qt;exports.handleOnScroll=Rc;exports.isColumnFilterActive=ts;exports.isEmail=Mc;exports.isFilterActive=Xi;exports.isOnlyLettersAndSpaces=Bc;exports.isPhoneNumber=kc;exports.isSlug=Lc;exports.localStorageAdapter=bn;exports.oneDayInMs=jc;exports.parseIndonesianDateToDate=fc;exports.preventNonCoordinateInput=Tc;exports.preventNonNumberAndDecimalInput=Ic;exports.preventNonNumberInput=Ec;exports.preventNumberInput=Fc;exports.resolveDateRangeValueToString=Ho;exports.resolveDateValueToString=Po;exports.resolveDropdownValueToString=Wo;exports.resolveRadioValueToString=zo;exports.resolveSidebarBadge=xr;exports.storageKeys=Ot;exports.textWidth=vc;exports.useApp=an;exports.useAppState=yo;exports.useAuthRole=_a;exports.useCoarsePointer=cs;exports.useDynamicTitle=Ha;exports.useFilterBarApiParams=Ml;exports.useFilterBarControls=Tl;exports.useModuleSelection=mn;exports.useRouteInfo=Ze;exports.useRouteParams=Pa;exports.useRouterAdapter=at;exports.useSidebar=Do;exports.useSidebarBadges=vo;exports.useTabState=za;exports.useTableSortApiParams=cc;Object.keys(En).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>En[t]})});Object.keys(fr).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>fr[t]})});Object.keys(it).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>it[t]})});Object.keys(x).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>x[t]})});Object.keys(It).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>It[t]})});Object.keys(H).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>H[t]})});Object.keys(Yr).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>Yr[t]})});Object.keys(vt).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>vt[t]})});Object.keys(Oe).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>Oe[t]})});Object.keys(mr).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>mr[t]})});Object.keys(Lt).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>Lt[t]})});Object.keys(ke).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>ke[t]})});Object.keys(Tt).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>Tt[t]})});Object.keys(mt).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>mt[t]})});Object.keys(A).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>A[t]})});Object.keys(Vt).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>Vt[t]})});Object.keys(Nt).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>Nt[t]})});Object.keys(Z).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>Z[t]})});Object.keys(Fn).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>Fn[t]})});Object.keys(Xr).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>Xr[t]})});Object.keys(Mt).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>Mt[t]})});Object.keys(In).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>In[t]})});Object.keys(Rt).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>Rt[t]})});Object.keys(Le).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>Le[t]})});Object.keys(ft).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>ft[t]})});Object.keys(Jr).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>Jr[t]})});Object.keys(w).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>w[t]})});Object.keys(E).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>E[t]})});Object.keys(de).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>de[t]})});Object.keys(Mn).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>Mn[t]})});Object.keys(Ln).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>Ln[t]})});Object.keys(Tn).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>Tn[t]})});Object.keys(Rn).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>Rn[t]})});Object.keys(On).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>On[t]})});Object.keys(rt).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>rt[t]})});Object.keys(An).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>An[t]})});
|
|
103
|
+
}`;function ha(){if(typeof document>"u"||document.getElementById(wo))return;const t=document.createElement("style");t.id=wo,t.textContent=xa,document.head.appendChild(t)}const fa=({active:t=!1,accentSide:r="left",onClick:n,title:s,badge:o,heading:i,meta:l,children:c,divider:a=!0,disabled:d,className:h,style:g,"aria-label":m})=>(u.useEffect(ha,[]),e.jsx("button",{type:"button",className:[et,h].filter(Boolean).join(" "),"data-active":t?"true":"false","data-accent":r,"data-divider":a?"true":"false","aria-current":t?"true":void 0,"aria-label":m,disabled:d,onClick:n,style:g,children:c??e.jsxs(x.Box,{display:"flex",direction:"column",gap:"spacing-4",fullWidth:!0,style:{minWidth:0},children:[(s||o)&&e.jsxs(fe.Flex,{direction:"row",align:"center",justify:"space-between",gap:"sm",style:{minWidth:0},children:[s?e.jsx(S.Text,{fontSize:"sm",style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"var(--sa-text-primary, #292a2e)"},children:s}):e.jsx("span",{}),o?e.jsx(x.Box,{style:{flexShrink:0},children:o}):null]}),i?e.jsx(S.Text,{fontSize:"md",fontWeight:"semibold",style:{color:"var(--sa-text-primary, #292a2e)"},children:i}):null,l?e.jsx(S.Text,{fontSize:"sm",style:{color:"var(--sa-text-subtlest, #6b6e76)"},children:l}):null]})})),rn=18,ma=40,Do="280ms cubic-bezier(0.4, 0, 0.2, 1)",Ds="var(--sa-border-subtle, #0b120e24)",ga=`1px solid ${Ds}`,So="var(--sa-background-primary, #ffffff)",pa=({children:t,header:r,collapsed:n,defaultCollapsed:s=!1,onToggle:o,width:i=337,side:l="left",offsetTop:c="var(--app-header-height, 4rem)",height:a,showToggle:d=!0,togglePosition:h="top",toggleOffset:g=40,toggleLabel:m,style:y,bodyStyle:D,className:j,pageLayout:R,overlay:I="mobile",wrapperProps:M,contentProps:C})=>{const k=ke.useMediaQuery("md"),T=n!==void 0,[F,v]=u.useState(s),L=T?n:F,N=()=>{const ne=!L;T||v(ne),o==null||o(ne)},q=l==="left",W=typeof c=="number"?`${c}px`:c,O=a!==void 0?typeof a=="number"?`${a}px`:a:`calc(100vh - ${W})`,J=m??{collapse:"Collapse panel",expand:"Expand panel"},K=h==="center"?{top:"50%",transform:"translateY(-50%)"}:h==="bottom"?{bottom:g}:{top:g},X=L?q?"ChevronRight":"ChevronLeft":q?"ChevronLeft":"ChevronRight",$=R!==void 0&&(I==="mobile"?!k:I),ae=$?{position:"absolute",top:0,bottom:0,width:i,transform:`translateX(${L?q?"-100%":"100%":"0"})`,transition:`transform ${Do}`,zIndex:50,...q?{left:0}:{right:0},...y}:{position:"sticky",top:W,alignSelf:"flex-start",width:L?0:i,flexShrink:0,height:O,transition:`width ${Do}`,...y},Z=e.jsxs(x.Box,{className:j,style:ae,children:[e.jsx(x.Box,{fullWidth:!0,fullHeight:!0,display:"flex",direction:"column",overflow:"overflow-hidden",borderStyle:L?void 0:q?"border-solid-r":"border-solid-l",borderWidth:L?void 0:q?"border-r":"border-l",style:{backgroundColor:So,borderColor:Ds},children:e.jsxs(x.Box,{fullHeight:!0,display:"flex",direction:"column",customWidth:i,customMinWidth:i,style:q?void 0:{marginLeft:"auto"},children:[r?e.jsx(x.Box,{padding:"md",style:{flexShrink:0},children:r}):null,e.jsx(x.Box,{display:"block",overflow:"overflow-y-auto",style:{flex:"1 1 0",minHeight:0,...D},children:t})]})}),d&&e.jsx(lr,{display:"inline-flex",align:"center",justify:"center",position:"absolute",onClick:N,"aria-label":L?J.expand:J.collapse,"aria-expanded":!L,"aria-pressed":L,customWidth:rn,customHeight:ma,style:{...K,backgroundColor:So,border:ga,zIndex:5,...q?{right:-rn,borderLeft:"none",borderRadius:"0 var(--sa-radii-md, 8px) var(--sa-radii-md, 8px) 0"}:{left:-rn,borderRight:"none",borderRadius:"var(--sa-radii-md, 8px) 0 0 var(--sa-radii-md, 8px)"}},children:e.jsx(B.Icon,{name:X,size:"sm"})})]});return R===void 0?Z:e.jsxs(x.Box,{direction:"row",position:"relative",...M,style:{height:`calc(100vh - ${W})`,overflow:"hidden",...(M==null?void 0:M.style)??{}},children:[!$&&q?Z:null,e.jsx(x.Box,{display:"block",...C,style:{flex:"1 1 0",minWidth:0,height:"100%",overflowY:"auto",...(C==null?void 0:C.style)??{}},children:R}),!$&&!q?Z:null,$&&e.jsxs(e.Fragment,{children:[!L&&e.jsx("div",{onClick:N,"aria-hidden":"true",style:{position:"absolute",inset:0,backgroundColor:"rgba(0, 0, 0, 0.4)",zIndex:40}}),Z]})]})},mn="--app-aside-width",ya=t=>typeof t=="number"?`${t}px`:t,ba=({pageLayout:t,children:r,wrapperProps:n,containerProps:s})=>{const o=ke.useMediaQuery("md"),i=(s==null?void 0:s.customWidth)??264;return u.useLayoutEffect(()=>{const l=document.documentElement;return l.style.setProperty(mn,o?ya(i):"0px"),()=>l.style.removeProperty(mn)},[o,i]),e.jsxs(x.Box,{display:"block",direction:"row",...n,style:{marginRight:o?i:24,...(n==null?void 0:n.style)??{}},children:[t,e.jsx(x.Box,{direction:"column",show:"desktop",as:"aside",position:"fixed",top:"top-0",bottom:"bottom-0",right:"right-0",customWidth:264,borderStyle:"border-solid-l",borderWidth:"border-l",...s,style:{marginTop:"var(--app-header-height, 4rem)",backgroundColor:"var(--sa-background-primary, #ffffff)",borderColor:"var(--sa-border-subtle, #0b120e24)",...(s==null?void 0:s.style)??{}},children:r})]})},gn="--sa-floating-footer-height",ja=t=>typeof t=="number"?`${t}px`:t,va=({children:t,withScrollToTopButton:r=!1,scrollToTopButtonProps:n,respectAside:s=!1,offsetRight:o,containerProps:i})=>{const l=u.useRef(null),c=o!=null?ja(o):s?"var(--app-aside-width, 0px)":"0px";return u.useLayoutEffect(()=>{const a=document.documentElement,d=()=>{var m;const g=((m=l.current)==null?void 0:m.getBoundingClientRect().height)??0;a.style.setProperty(gn,`${g}px`)};d();const h=new ResizeObserver(d);return l.current&&h.observe(l.current),()=>{h.disconnect(),a.style.removeProperty(gn)}},[]),e.jsx(x.Box,{direction:"column",position:"absolute",width:"width-full",style:{zIndex:"var(--app-footer-zindex, 998)"},children:e.jsxs(x.Box,{ref:l,position:"fixed",bottom:"bottom-0",bg:"white",direction:"row",align:"center",display:"flex",paddingBlock:"sm",paddingInline:"md",borderColor:"border-subtle",style:{left:"var(--app-sidebar-width, 0px)",right:c,transition:"left 0.3s ease-in-out, right 0.3s ease-in-out"},justify:(i==null?void 0:i.justify)||"flex-end",borderStyle:"border-solid-t",borderWidth:"border-t",children:[r&&e.jsx(ws,{...n,customBottom:(n==null?void 0:n.customBottom)||"5.7rem"}),t]})})},Ca=({fields:t})=>e.jsx(x.Box,{display:"flex",direction:"column",gap:"lg",children:e.jsx(Tr,{of:t,render:(r,n)=>e.jsx(wa,{...r},n)})}),wa=({title:t,value:r,icon:n})=>e.jsxs(x.Box,{display:"flex",direction:"column",gap:"sm",children:[n?e.jsxs(x.Box,{display:"flex",direction:"row",align:"center",gap:"xs",children:[e.jsx(B.Icon,{name:n,color:"subtle"}),e.jsx(S.Text,{color:"gray-500",variant:"sub-h3",children:t})]}):e.jsx(S.Text,{color:"gray-500",variant:"sub-h3",children:t}),typeof r=="string"?e.jsx(S.Text,{variant:"sub-h3",children:r}):r]}),Re={silhouette:"#A7B0AC",accent:"#78867F"};function Da({width:t,height:r}){return e.jsx(e.Fragment,{children:e.jsxs("svg",{width:t||"100",height:r||"90",viewBox:"0 0 102 90",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("path",{d:"M51.0002 16.8145C36.0811 16.8145 24.8296 21.3801 24.8296 27.4328V76.5344C24.8296 82.573 36.0799 87.127 51.0002 87.127C65.9204 87.127 77.1707 82.573 77.1707 76.5344V27.4328C77.1707 21.3801 65.9204 16.8145 51.0002 16.8145ZM51.0002 19.1582C65.0602 19.1582 74.8582 23.5187 74.8582 27.4328C74.8582 30.1363 70.1615 32.9664 63.1708 34.4746C55.861 36.0543 46.1416 36.0543 38.8318 34.4746C31.8399 32.9664 27.1432 30.1363 27.1432 27.4328C27.1432 23.5187 36.9402 19.1582 51.0002 19.1582ZM74.8582 31.9199V43.784C74.8582 46.532 70.3142 49.2941 63.2737 50.8328C63.2391 50.8375 63.2032 50.8434 63.1697 50.8504C57.6867 52.0352 50.8498 52.3305 44.6893 51.7387C42.6358 51.5418 40.6575 51.2453 38.8306 50.8504C38.8029 50.8445 38.7682 50.8387 38.7347 50.8352C32.5707 49.4898 28.318 47.2047 27.3514 44.8141C27.2138 44.4719 27.1421 44.1285 27.1421 43.7852V31.9199C27.1999 31.9715 27.2693 32.0207 27.3294 32.0723C27.5052 32.2246 27.6902 32.3758 27.8844 32.5234C27.9954 32.609 28.1064 32.6934 28.2232 32.7766C28.4371 32.9301 28.6637 33.0801 28.8973 33.2289C29.0083 33.2992 29.1135 33.3719 29.2291 33.441C29.5702 33.6473 29.9275 33.8488 30.3044 34.0434C30.3195 34.0516 30.3333 34.0598 30.3484 34.068C30.7427 34.2707 31.1601 34.4652 31.5925 34.6551C31.7301 34.716 31.8758 34.7734 32.0168 34.832C32.3221 34.9598 32.6331 35.0852 32.9557 35.207C33.1303 35.2727 33.3095 35.3359 33.4887 35.4004C33.8032 35.5117 34.1247 35.6207 34.4542 35.7273C34.6404 35.7871 34.8254 35.8469 35.015 35.9043C35.3734 36.0133 35.7434 36.1164 36.1181 36.2184C36.2915 36.2652 36.4603 36.3145 36.6361 36.3602C37.1911 36.5031 37.7588 36.6402 38.3485 36.7668C42.1595 37.5906 46.5336 38.0254 50.999 38.0254C55.4644 38.0254 59.8397 37.5906 63.6495 36.768C64.2404 36.6402 64.8092 36.5031 65.3666 36.3602C65.5377 36.3156 65.7007 36.2688 65.8684 36.223C66.2499 36.1199 66.6246 36.0145 66.9888 35.9031C67.1749 35.8469 67.3553 35.7883 67.5368 35.7309C67.8745 35.623 68.2028 35.5105 68.5243 35.3969C68.6966 35.3359 68.8677 35.275 69.0353 35.2117C69.3672 35.0863 69.6852 34.9574 69.9985 34.8262C70.1326 34.7699 70.2725 34.7148 70.4032 34.6574C70.8379 34.4664 71.2576 34.2707 71.6542 34.0668C71.66 34.0633 71.6658 34.0609 71.6716 34.0574C72.0589 33.8582 72.4243 33.6508 72.7735 33.441C72.8868 33.3719 72.9909 33.3016 73.1007 33.2313C73.3354 33.0813 73.5632 32.9312 73.7794 32.7766C73.8951 32.6934 74.0049 32.609 74.1159 32.5258C74.3102 32.377 74.4963 32.2258 74.6732 32.0723C74.7322 32.0207 74.8027 31.9727 74.8594 31.9211L74.8582 31.9199ZM74.8582 48.2887V60.1598C74.8582 62.8773 70.3396 65.6359 63.335 67.2004C63.2737 67.2051 63.2136 67.2156 63.1547 67.2285C59.5021 68.016 55.2482 68.4109 50.9955 68.4098C48.8692 68.4098 46.7428 68.3113 44.6917 68.1145C42.6405 67.9176 40.6656 67.6211 38.8399 67.2273C38.7832 67.2133 38.7266 67.2051 38.6699 67.2004C31.663 65.6359 27.1432 62.8785 27.1432 60.1598V48.2887C27.2022 48.3426 27.2739 48.393 27.3352 48.4457C27.5075 48.5945 27.6878 48.7422 27.8763 48.8875C27.9908 48.9754 28.1052 49.0633 28.2255 49.15C28.4348 49.3 28.6568 49.4477 28.8834 49.593C28.999 49.6668 29.1089 49.7418 29.228 49.8145C29.5633 50.0172 29.9136 50.2152 30.2825 50.4074C30.3114 50.4227 30.338 50.4379 30.3669 50.452C30.7507 50.6488 31.1566 50.8398 31.5775 51.0262C31.722 51.0895 31.8746 51.1504 32.0226 51.2125C32.3198 51.3379 32.6227 51.4609 32.9372 51.5793C33.1164 51.6473 33.2991 51.7129 33.4841 51.7785C33.7917 51.8887 34.1073 51.9953 34.4299 52.0996C34.6196 52.1605 34.8092 52.2227 35.0046 52.2812C35.3584 52.3891 35.7238 52.4922 36.0938 52.593C36.2684 52.641 36.4395 52.6902 36.6176 52.7359C37.1714 52.8789 37.738 53.016 38.3253 53.1426C38.3554 53.1496 38.3889 53.1555 38.4236 53.159C42.2161 53.9723 46.5636 54.4023 51.0013 54.4023C55.439 54.4023 59.7784 53.9734 63.5697 53.1613C63.6056 53.1566 63.6414 53.1508 63.6773 53.1426C64.2647 53.0148 64.8312 52.8789 65.3851 52.7359C65.5643 52.6902 65.7342 52.6398 65.9088 52.593C66.2788 52.4922 66.6442 52.3891 66.998 52.2812C67.1934 52.2215 67.3831 52.1605 67.5727 52.0996C67.8953 51.9953 68.2109 51.8887 68.5185 51.7785C68.7023 51.7129 68.8862 51.6473 69.0654 51.5793C69.3799 51.4598 69.6817 51.3367 69.98 51.2125C70.128 51.1504 70.2806 51.0895 70.4252 51.0262C70.846 50.841 71.2507 50.65 71.6357 50.452C71.6646 50.4367 71.6912 50.4215 71.7201 50.4074C72.0901 50.2152 72.4405 50.0172 72.7747 49.8145C72.8949 49.7418 73.0036 49.6668 73.1192 49.593C73.347 49.4477 73.5678 49.3 73.7771 49.15C73.8974 49.0633 74.0118 48.9766 74.1263 48.8875C74.3148 48.7422 74.4952 48.5945 74.6674 48.4457C74.7287 48.393 74.7992 48.3426 74.8582 48.2887ZM74.8582 76.5355C74.8582 80.4367 65.0602 84.7844 51.0002 84.7844C36.9402 84.7844 27.1421 80.4367 27.1421 76.5355V64.6469C27.1987 64.6984 27.2693 64.7477 27.3282 64.7992C27.5028 64.9504 27.6844 65.0992 27.8763 65.2469C27.9873 65.3324 28.0995 65.418 28.2162 65.5023C28.4302 65.6559 28.6568 65.807 28.8892 65.9559C28.9979 66.0262 29.1019 66.0977 29.2152 66.1656C29.5691 66.3801 29.9367 66.591 30.3299 66.7937C30.331 66.7937 30.3322 66.7938 30.3333 66.7961C30.7253 66.9988 31.1404 67.1945 31.5694 67.3855C31.7058 67.4465 31.8515 67.5039 31.9914 67.5637C32.2955 67.6926 32.6054 67.8191 32.928 67.9422C33.1002 68.0078 33.2772 68.0711 33.4541 68.1355C33.7674 68.248 34.0888 68.3582 34.4184 68.466C34.6034 68.5258 34.7872 68.5867 34.9768 68.6453C35.3341 68.7555 35.703 68.8609 36.0764 68.9641C36.2476 69.0109 36.4141 69.0602 36.5887 69.1059C37.1413 69.2512 37.7079 69.3895 38.2941 69.5195C38.3462 69.5312 38.3993 69.5383 38.4514 69.543C42.2369 70.3516 46.5717 70.7793 50.999 70.7793C55.4263 70.7793 59.7599 70.3527 63.5478 69.543C63.5998 69.5383 63.653 69.5312 63.705 69.5195C64.2912 69.3906 64.8578 69.2512 65.4105 69.1059C65.5839 69.0602 65.7493 69.0121 65.9192 68.9652C66.295 68.8621 66.665 68.7555 67.0246 68.6453C67.2131 68.5879 67.3958 68.5281 67.5785 68.4684C67.9092 68.3605 68.2329 68.2492 68.5486 68.1355C68.7231 68.0723 68.8977 68.009 69.0689 67.9445C69.3938 67.8203 69.7071 67.6926 70.0135 67.5625C70.1511 67.5039 70.2933 67.4477 70.4275 67.3879C71.29 67.0047 72.0774 66.5969 72.7851 66.1668C72.8972 66.0988 73.0001 66.0273 73.1088 65.9582C73.3424 65.8082 73.5702 65.657 73.7852 65.5023C73.9008 65.4191 74.0118 65.3336 74.1217 65.2492C74.3148 65.1016 74.4975 64.9516 74.6732 64.7992C74.7322 64.7488 74.8016 64.6996 74.8582 64.648V76.5355Z",fill:Re.silhouette}),e.jsx("path",{d:"M33.2089 38.8535C31.3993 38.8535 29.9263 40.3453 29.9263 42.1805C29.9263 44.0156 31.3982 45.5062 33.2089 45.5062C35.0196 45.5062 36.4903 44.0145 36.4903 42.1805C36.4903 40.3465 35.0184 38.8535 33.2089 38.8535ZM33.2089 43.1625C32.6735 43.1625 32.2388 42.7219 32.2388 42.1805C32.2388 41.6391 32.6735 41.1973 33.2089 41.1973C33.7442 41.1973 34.1778 41.6379 34.1778 42.1805C34.1778 42.723 33.7431 43.1625 33.2089 43.1625Z",fill:Re.silhouette}),e.jsx("path",{d:"M33.2089 54.6777C31.3993 54.6777 29.9263 56.1695 29.9263 58.0047C29.9263 59.8398 31.3982 61.3316 33.2089 61.3316C35.0196 61.3316 36.4903 59.8398 36.4903 58.0047C36.4903 56.1695 35.0184 54.6777 33.2089 54.6777ZM33.2089 58.9879C32.6735 58.9879 32.2388 58.5473 32.2388 58.0047C32.2388 57.4621 32.6735 57.0215 33.2089 57.0215C33.7442 57.0215 34.1778 57.4621 34.1778 58.0047C34.1778 58.5473 33.7431 58.9879 33.2089 58.9879Z",fill:Re.silhouette}),e.jsx("path",{d:"M33.2089 70.5C31.3993 70.5 29.9263 71.9918 29.9263 73.827C29.9263 75.6621 31.3982 77.1539 33.2089 77.1539C35.0196 77.1539 36.4903 75.6621 36.4903 73.827C36.4903 71.9918 35.0184 70.5 33.2089 70.5ZM33.2089 74.8102C32.6735 74.8102 32.2388 74.3695 32.2388 73.827C32.2388 73.2844 32.6735 72.8438 33.2089 72.8438C33.7442 72.8438 34.1778 73.2844 34.1778 73.827C34.1778 74.3695 33.7431 74.8102 33.2089 74.8102Z",fill:Re.silhouette}),e.jsx("path",{d:"M70.0215 38.2852C69.3821 38.2852 68.8652 38.809 68.8652 39.457V44.3332C68.8652 44.9812 69.3821 45.5051 70.0215 45.5051C70.6609 45.5051 71.1777 44.9812 71.1777 44.3332V39.457C71.1777 38.809 70.6609 38.2852 70.0215 38.2852Z",fill:Re.silhouette}),e.jsx("path",{d:"M70.0215 54.3926C69.3821 54.3926 68.8652 54.9164 68.8652 55.5645V60.4406C68.8652 61.0887 69.3821 61.6125 70.0215 61.6125C70.6609 61.6125 71.1777 61.0887 71.1777 60.4406V55.5645C71.1777 54.9164 70.6609 54.3926 70.0215 54.3926Z",fill:Re.silhouette}),e.jsx("path",{d:"M70.0215 70.5C69.3821 70.5 68.8652 71.0238 68.8652 71.6719V76.5492C68.8652 77.1973 69.3821 77.7211 70.0215 77.7211C70.6609 77.7211 71.1777 77.1973 71.1777 76.5492V71.6719C71.1777 71.0238 70.6609 70.5 70.0215 70.5Z",fill:Re.silhouette}),e.jsx("path",{d:"M65.77 39.7617C65.1306 39.7617 64.6138 40.2855 64.6138 40.9336V45.8098C64.6138 46.4578 65.1306 46.9816 65.77 46.9816C66.4094 46.9816 66.9263 46.4578 66.9263 45.8098V40.9336C66.9263 40.2855 66.4094 39.7617 65.77 39.7617Z",fill:Re.silhouette}),e.jsx("path",{d:"M65.77 55.8691C65.1306 55.8691 64.6138 56.393 64.6138 57.041V61.9172C64.6138 62.5652 65.1306 63.0891 65.77 63.0891C66.4094 63.0891 66.9263 62.5652 66.9263 61.9172V57.041C66.9263 56.393 66.4094 55.8691 65.77 55.8691Z",fill:Re.silhouette}),e.jsx("path",{d:"M65.77 71.9766C65.1306 71.9766 64.6138 72.5004 64.6138 73.1484V78.0246C64.6138 78.6727 65.1306 79.1965 65.77 79.1965C66.4094 79.1965 66.9263 78.6727 66.9263 78.0246V73.1484C66.9263 72.5004 66.4094 71.9766 65.77 71.9766Z",fill:Re.silhouette}),e.jsx("path",{d:"M61.2939 40.7246C60.6545 40.7246 60.1377 41.2484 60.1377 41.8965V46.7727C60.1377 47.4207 60.6545 47.9445 61.2939 47.9445C61.9334 47.9445 62.4502 47.4207 62.4502 46.7727V41.8965C62.4502 41.2484 61.9334 40.7246 61.2939 40.7246Z",fill:Re.silhouette}),e.jsx("path",{d:"M61.2939 56.832C60.6545 56.832 60.1377 57.3559 60.1377 58.0039V62.8801C60.1377 63.5281 60.6545 64.052 61.2939 64.052C61.9334 64.052 62.4502 63.5281 62.4502 62.8801V58.0039C62.4502 57.3559 61.9334 56.832 61.2939 56.832Z",fill:Re.silhouette}),e.jsx("path",{d:"M61.2939 72.9395C60.6545 72.9395 60.1377 73.4633 60.1377 74.1113V78.9875C60.1377 79.6355 60.6545 80.1594 61.2939 80.1594C61.9334 80.1594 62.4502 79.6355 62.4502 78.9875V74.1113C62.4502 73.4633 61.9334 72.9395 61.2939 72.9395Z",fill:Re.silhouette}),e.jsx("path",{d:"M39.0489 24.4037C39.131 24.4037 39.2154 24.3944 39.2986 24.3768C42.7316 23.6127 46.6755 23.185 51.0207 23.11C51.659 23.0983 52.1677 22.5651 52.1561 21.917C52.1446 21.2701 51.652 20.7451 50.9791 20.7662C46.4813 20.8448 42.3835 21.2889 38.8015 22.0881C38.1782 22.2264 37.7828 22.8522 37.9204 23.4838C38.0395 24.0311 38.5182 24.4037 39.0489 24.4037Z",fill:Re.silhouette}),e.jsx("path",{d:"M32.5406 26.6215C32.7407 26.6215 32.9442 26.57 33.128 26.4586C33.1315 26.4563 33.5096 26.2336 34.2889 25.9055C34.8786 25.6582 35.1584 24.9727 34.9144 24.3739C34.6704 23.775 33.9917 23.4926 33.4032 23.7399C32.4632 24.1348 31.9926 24.4149 31.9417 24.4465C31.396 24.7782 31.219 25.4942 31.544 26.0485C31.7613 26.4164 32.1452 26.6204 32.5395 26.6204L32.5406 26.6215Z",fill:Re.silhouette}),e.jsx("path",{d:"M92.7251 26.7272L82.3845 29.3124C81.6929 29.4856 80.9911 29.0642 80.8179 28.3727C80.6447 27.6799 81.066 26.978 81.7576 26.8048L92.0982 24.2196C92.791 24.0464 93.4929 24.4678 93.6661 25.1593C93.8393 25.8521 93.4179 26.554 92.7251 26.7272Z",fill:Re.accent,fillOpacity:"0.65"}),e.jsx("path",{d:"M94.4649 11.0082L80.2465 21.3488C79.6701 21.7676 78.8609 21.6409 78.4408 21.0632C78.022 20.4867 78.1487 19.6775 78.7265 19.2574L92.9448 8.91682C93.5213 8.49803 94.3305 8.6247 94.7505 9.20248C95.1693 9.77897 95.0414 10.5881 94.4649 11.0082Z",fill:Re.accent,fillOpacity:"0.65"}),e.jsx("path",{d:"M78.0091 10.6269L74.1314 17.0898C73.7643 17.7025 72.9706 17.9002 72.358 17.5331C71.7466 17.1673 71.5475 16.3724 71.9146 15.7597L75.7923 9.29684C76.1594 8.68545 76.9544 8.48769 77.5657 8.85349C78.1784 9.22058 78.3762 10.0155 78.0091 10.6269Z",fill:Re.accent,fillOpacity:"0.65"})]})})}const Sa=({title:t="create",children:r,onClickAction:n,variant:s="primary",variantTitle:o,leftIcon:i,showButton:l=!0,customHeight:c,childrenButton:a,customIcon:d})=>{const h=()=>{switch(s){case"primary":return e.jsx(e.Fragment,{children:i?e.jsx(P.Button,{primary:!0,iconLeft:i,onClick:n,children:a||t}):e.jsx(P.Button,{primary:!0,onClick:n,children:a||t})});case"secondary":return e.jsx(e.Fragment,{children:i?e.jsx(P.Button,{secondary:!0,iconLeft:i,onClick:n,children:o?e.jsx(S.Text,{fontSize:"md",fontWeight:"medium",style:{color:"var(--sa-background-success, #28ac6e)"},children:a||t}):t}):e.jsx(P.Button,{secondary:!0,onClick:n,children:a||t})});case"success":return e.jsx(e.Fragment,{children:i?e.jsx(P.Button,{success:!0,iconLeft:i,onClick:n,children:a||t}):e.jsx(P.Button,{success:!0,onClick:n,children:a||t})});default:return e.jsx(e.Fragment,{children:i?e.jsx(P.Button,{primary:!0,iconLeft:i,onClick:n,children:a||t}):e.jsx(P.Button,{primary:!0,onClick:n,children:a||t})})}};return e.jsxs(x.Box,{height:"height-full",display:"flex",direction:"column",gap:"sm",justify:"center",align:"center",marginBlock:"auto",customHeight:c,children:[d||e.jsx(Da,{}),e.jsx(x.Box,{direction:"column",children:r.map((g,m)=>e.jsx(it.Body1,{props:{align:"center",textAlign:"center"},children:m>2?null:g},m))}),l?h():null]})},re={c001A72:"#001A72",c64B5F6:"#64B5F6",c98B4CB:"#98B4CB",cBBDEFB:"#BBDEFB",cD0E5F7:"#D0E5F7",cD6EBFD:"#D6EBFD",c000000:"#000000",cFFFFFF:"#FFFFFF"};function ka({width:t,height:r}){return e.jsx(e.Fragment,{children:e.jsxs("svg",{width:t,height:r,viewBox:"0 0 622 271",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("path",{d:"M32.4375 254.5H612.437",stroke:re.c64B5F6,strokeWidth:"5",strokeLinecap:"round"}),e.jsx("rect",{x:"216.562",y:"45.5605",width:"55",height:"20",fill:re.cD6EBFD}),e.jsx("rect",{x:"14.4375",y:"89.7803",width:"46",height:"20",fill:re.cD6EBFD}),e.jsx("rect",{x:"0.4375",y:"111.78",width:"46",height:"20",fill:re.cD6EBFD}),e.jsx("rect",{x:"0.4375",y:"67.7803",width:"46",height:"20",fill:re.cD6EBFD}),e.jsx("rect",{x:"344.312",y:"0.5",width:"55",height:"20",fill:re.cD6EBFD}),e.jsx("rect",{x:"549.562",y:"86.7803",width:"55",height:"20",fill:re.cD6EBFD}),e.jsx("rect",{x:"566.562",y:"64.7803",width:"55",height:"20",fill:re.cD6EBFD}),e.jsx("path",{d:"M233.438 165.217C233.438 132.764 239.035 107.198 250.231 88.5189C261.596 69.8396 279.832 60.5 304.938 60.5C330.043 60.5 348.194 69.8396 359.389 88.5189C370.755 107.198 376.438 132.764 376.438 165.217C376.438 198.047 370.755 223.802 359.389 242.481C348.194 261.16 330.043 270.5 304.938 270.5C279.832 270.5 261.596 261.16 250.231 242.481C239.035 223.802 233.438 198.047 233.438 165.217ZM333.69 165.217C333.69 146.16 331.824 131.538 328.092 121.349C324.36 110.972 316.642 105.783 304.938 105.783C293.233 105.783 285.515 110.972 281.783 121.349C278.051 131.538 276.185 146.16 276.185 165.217C276.185 178.047 276.863 188.708 278.22 197.198C279.577 205.5 282.292 212.292 286.363 217.575C290.604 222.67 296.795 225.217 304.938 225.217C313.08 225.217 319.187 222.67 323.258 217.575C327.499 212.292 330.298 205.5 331.655 197.198C333.012 188.708 333.69 178.047 333.69 165.217Z",fill:re.cD0E5F7}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M50.4375 235.124V194.28L138.96 60.5H192.466V191.32H215.438V235.124H192.466V249.5H144.563V235.124H50.4375ZM100.862 191.32L147.925 116.143V191.32H100.862Z",fill:re.cBBDEFB,fillOpacity:"0.6"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M394.438 235.124V194.28L482.96 60.5H536.466V191.32H559.438V235.124H536.466V249.5H488.563V235.124H394.438ZM444.862 191.32L491.925 116.143V191.32H444.862Z",fill:re.cBBDEFB,fillOpacity:"0.6"}),e.jsx("path",{d:"M349.472 171.5H261.64V186.396H349.472V171.5Z",fill:re.c98B4CB}),e.jsx("path",{d:"M261.64 171.5L244.719 186.396H261.64V171.5Z",fill:re.c98B4CB}),e.jsx("path",{d:"M363.574 186.396L349.472 171.5V186.396H363.574Z",fill:re.c98B4CB}),e.jsx("path",{d:"M244.719 200.89V264.5H363.574V200.89M244.719 200.89H233.438L244.719 186.396M244.719 200.89H363.574M363.574 200.89H372.437L363.574 186.396M244.719 186.396L261.64 171.5M244.719 186.396H261.64M363.574 186.396L349.472 171.5M363.574 186.396H349.472M261.64 171.5H349.472M261.64 171.5V186.396M349.472 171.5V186.396M349.472 186.396H261.64",stroke:re.c000000,strokeWidth:"2"}),e.jsx("rect",{x:"246.438",y:"202.5",width:"116",height:"60",fill:re.cFFFFFF}),e.jsx("path",{d:"M245.536 187.5H362.959L369.438 198.5H237.438L245.536 187.5Z",fill:re.cFFFFFF}),e.jsx("path",{d:"M332.438 129.846C332.438 141.175 329.183 152.403 323.949 160.772C318.699 169.168 311.592 174.5 303.938 174.5C296.283 174.5 289.176 169.168 283.926 160.772C278.692 152.403 275.438 141.175 275.438 129.846C275.438 118.458 277.838 109.628 282.543 103.663C287.216 97.7387 294.274 94.5 303.938 94.5C313.601 94.5 320.659 97.7387 325.332 103.663C330.037 109.628 332.438 118.458 332.438 129.846Z",fill:re.cFFFFFF,stroke:re.c000000,strokeWidth:"2"}),e.jsx("path",{d:"M281.438 145.5C284.032 154.136 285.762 158.682 290.951 164.591M292.681 166.409C293.624 167.647 295.708 169.591 297.438 170.5",stroke:re.c000000,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M304.438 175C299.54 176.339 297.208 177.876 293.938 182.5M304.438 175C301.183 178.041 299.537 178.883 299.438 182.5M304.438 175C308.173 177.107 309.635 178.834 311.438 182.5",stroke:re.c000000,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M304.936 175.5C303.438 180 302.529 181.628 304.936 186.5",stroke:re.c000000,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M288.178 120.981C289.969 120.93 290.921 121.313 292.167 122.754",stroke:re.c000000,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("circle",{cx:"291.724",cy:"118.765",r:"3.1027",fill:re.c000000}),e.jsx("path",{d:"M308.128 122.463C309.123 120.973 309.987 120.418 311.883 120.237",stroke:re.c000000,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("circle",{cx:"307.681",cy:"118.765",r:"3.1027",fill:re.c000000}),e.jsx("ellipse",{cx:"297.938",cy:"134.5",rx:"2.5",ry:"2",fill:re.c000000}),e.jsx("path",{d:"M340.437 97.5L333.438 104.5M333.438 97.5L340.438 104.5",stroke:re.c001A72,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M265.437 115.5L260.438 120.5M260.438 115.5L265.438 120.5",stroke:re.c001A72,strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M288.437 87.5L283.438 92.5M283.438 87.5L288.438 92.5",stroke:re.c001A72,strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M305.437 83.5L298.438 90.5M298.438 83.5L305.438 90.5",stroke:re.c001A72,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M342.437 145.5L337.438 150.5M337.438 145.5L342.438 150.5",stroke:re.c001A72,strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("circle",{cx:"339.938",cy:"111",r:"2.5",fill:re.c001A72}),e.jsx("circle",{cx:"336.438",cy:"94.5",r:"1",fill:re.c001A72}),e.jsx("circle",{cx:"347.438",cy:"99.5",r:"1",fill:re.c001A72}),e.jsx("circle",{cx:"267.438",cy:"109.5",r:"2",fill:re.c001A72}),e.jsx("circle",{cx:"293.438",cy:"85.5",r:"2",fill:re.c001A72}),e.jsx("circle",{cx:"339.438",cy:"138.5",r:"2",fill:re.c001A72}),e.jsx("circle",{cx:"267.438",cy:"150.5",r:"2",fill:re.c001A72}),e.jsx("circle",{cx:"268.438",cy:"118.5",r:"1",fill:re.c001A72}),e.jsx("circle",{cx:"260.438",cy:"124.5",r:"1",fill:re.c001A72})]})})}function Ba({onClick:t}){const r=ke.useMediaQuery("md");return e.jsxs(x.Box,{direction:"column",height:"height-screen",fullWidth:!0,display:"flex",align:"center",justify:"center",gap:"md",children:[e.jsx(ka,{width:r?600:300}),e.jsx(S.Text,{fontWeight:"bold",fontSize:r?"3xl":"2xl",textAlign:"center",children:"Page Not Found"}),e.jsx(S.Text,{fontWeight:"semibold",fontSize:r?"lg":"md",textAlign:"center",children:"Sorry, we couldn't find the page you are looking for"}),t&&e.jsx(P.Button,{size:r?"md":"xs",onClick:t,children:"Go Back"})]})}const ce={c46F16B:"#46F16B",c48504C:"#48504C",c64B5F6:"#64B5F6",c67AEE6:"#67AEE6",c86512B:"#86512B",c956847:"#956847",cBBC3F5:"#BBC3F5",cBBDEFB:"#BBDEFB",cC0B2A2:"#C0B2A2",cC8CEF4:"#C8CEF4",cCABEB1:"#CABEB1",cD5C7BD:"#D5C7BD",cD6D6D6:"#D6D6D6",cD6EBFD:"#D6EBFD",cE5EE80:"#E5EE80",cEE8080:"#EE8080",cEFF3F8:"#EFF3F8",cF4F4F4:"#F4F4F4",cFFFFFF:"#FFFFFF"};function Ea({width:t,height:r}){return e.jsx(e.Fragment,{children:e.jsxs("svg",{width:t,height:r,viewBox:"0 0 654 258",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("rect",{x:"228",y:"55.5",width:"55",height:"20",fill:ce.cD6EBFD}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M75 238.124V197.28L163.523 63.5H217.029V194.32H240V238.124H217.029V252.5H169.126V238.124H75ZM125.424 194.32L172.487 119.143V194.32H125.424Z",fill:ce.cBBDEFB,fillOpacity:"0.6"}),e.jsxs("g",{clipPath:"url(#clip0_2949_9690)",children:[e.jsx("path",{d:"M334.5 274.5C381.168 274.5 419 227.266 419 169C419 110.734 381.168 63.5 334.5 63.5C287.832 63.5 250 110.734 250 169C250 227.266 287.832 274.5 334.5 274.5Z",fill:ce.cEFF3F8,stroke:ce.c67AEE6,strokeWidth:"5"}),e.jsx("path",{d:"M413 197.5C411.397 211.835 402.919 230.898 389.361 246.49C375.596 262.32 356.651 274.5 334.496 274.5C311.331 274.5 292.389 261.672 278.878 245.52C265.592 229.638 257.606 210.603 256 197.5H413Z",fill:ce.cD5C7BD}),e.jsx("path",{d:"M278.887 211.766H391.104L392.583 222.856C392.687 223.635 392.08 224.328 391.294 224.328H277.961C277.14 224.328 276.525 223.577 276.686 222.773L278.887 211.766Z",fill:ce.cCABEB1}),e.jsx("path",{d:"M287.68 218.884L289.354 213.022H378.961L381.473 218.884H287.68Z",fill:ce.cC0B2A2}),e.jsx("path",{d:"M381.944 218.803L381.58 212.266H386.385L386.022 218.803H381.944Z",fill:ce.c956847,stroke:ce.c48504C}),e.jsx("path",{d:"M283.124 218.803L282.768 213.104H287.565L287.209 218.803H283.124Z",fill:ce.c956847,stroke:ce.c48504C}),e.jsx("path",{d:"M285.902 212.103L284.935 186.306H279.606C278.151 186.306 277.004 187.542 277.113 188.993L278.673 209.79C278.77 211.095 279.857 212.103 281.166 212.103H285.902Z",fill:ce.cC8CEF4,stroke:ce.c48504C}),e.jsx("path",{d:"M383.256 212.103L384.638 186.306H389.556C391.007 186.306 392.153 187.537 392.05 188.984L390.564 209.782C390.471 211.09 389.382 212.103 388.07 212.103H383.256Z",fill:ce.cC8CEF4,stroke:ce.c48504C}),e.jsx("path",{d:"M284.497 178.155C284.455 176.194 286.034 174.581 287.996 174.581H381.904C383.895 174.581 385.485 176.24 385.401 178.23L384.066 209.59C383.987 211.463 382.445 212.941 380.569 212.941H288.663C286.759 212.941 285.205 211.419 285.164 209.515L284.497 178.155Z",fill:ce.cC8CEF4,stroke:ce.c48504C}),e.jsx("path",{d:"M284.845 181.524C284.792 179.279 286.598 177.431 288.844 177.431H380.687C382.948 177.431 384.76 179.304 384.684 181.565L383.774 208.737C383.701 210.893 381.933 212.603 379.776 212.603H289.48C287.307 212.603 285.532 210.869 285.481 208.697L284.845 181.524Z",fill:ce.cBBC3F5}),e.jsx("mask",{id:"mask0_2949_9690",maskUnits:"userSpaceOnUse",x:"301",y:"144",width:"68",height:"17",style:{maskType:"luminance"},children:e.jsx("path",{d:"M301 146.5C301 145.395 301.887 144.5 302.98 144.5H367.02C368.114 144.5 369 145.395 369 146.5V160.411H301V146.5Z",fill:ce.cFFFFFF})}),e.jsxs("g",{mask:"url(#mask0_2949_9690)",children:[e.jsx("path",{d:"M301 146.191C301 145.257 301.748 144.5 302.671 144.5H356.701C357.624 144.5 358.372 145.257 358.372 146.191V157.949H301V146.191Z",fill:ce.cFFFFFF}),e.jsx("path",{d:"M301.336 146.607C301.336 145.673 302.08 144.916 302.999 144.916H367.01C367.929 144.916 368.673 145.673 368.673 146.607V152.523H301.336V146.607Z",fill:ce.cD6D6D6}),e.jsx("path",{d:"M368.673 152.523H301.336V174.5H368.673V152.523Z",fill:ce.cF4F4F4}),e.jsx("path",{d:"M307.685 150.417C308.607 150.417 309.356 149.66 309.356 148.726C309.356 147.793 308.607 147.036 307.685 147.036C306.762 147.036 306.014 147.793 306.014 148.726C306.014 149.66 306.762 150.417 307.685 150.417Z",fill:ce.cEE8080}),e.jsx("path",{d:"M313.532 150.417C314.455 150.417 315.203 149.66 315.203 148.726C315.203 147.793 314.455 147.036 313.532 147.036C312.609 147.036 311.861 147.793 311.861 148.726C311.861 149.66 312.609 150.417 313.532 150.417Z",fill:ce.cE5EE80}),e.jsx("path",{d:"M318.546 150.417C319.469 150.417 320.217 149.66 320.217 148.726C320.217 147.793 319.469 147.036 318.546 147.036C317.623 147.036 316.875 147.793 316.875 148.726C316.875 149.66 317.623 150.417 318.546 150.417Z",fill:ce.c46F16B})]}),e.jsx("path",{d:"M301.16 146C301.16 145.172 301.832 144.5 302.66 144.5H367.33C368.159 144.5 368.83 145.172 368.83 146V174.419H301.16V146Z",stroke:ce.c48504C}),e.jsx("path",{d:"M395.29 207.579H423.344M354.255 236.889H369.329M327.038 222.234H347.556M350.905 222.234H358.024M288.097 230.19H304.846M253.344 210.091H272.605M278.467 246.938H295.216M297.309 246.938H303.59M337.088 252.801H354.255",stroke:ce.c86512B,strokeWidth:"2",strokeLinecap:"round"})]}),e.jsx("path",{d:"M430.241 125.78C430.987 105.807 437.521 90.4065 449.841 79.5799C462.161 68.7532 478.867 63.3398 499.961 63.3398C513.961 63.3398 525.907 65.7665 535.801 70.6199C545.881 75.4732 553.441 82.0998 558.481 90.4998C563.707 98.8998 566.321 108.327 566.321 118.78C566.321 131.1 563.241 141.18 557.081 149.02C550.921 156.673 543.734 161.9 535.521 164.7V165.82C546.161 169.367 554.561 175.247 560.721 183.46C566.881 191.673 569.961 202.22 569.961 215.1C569.961 226.673 567.254 236.94 561.841 245.9C560.436 248.258 558.849 250.481 557.081 252.569L443.5 252.662C432.5 241 427.721 230.5 427.721 207.82H474.201C474.387 216.033 476.721 222.567 481.201 227.42C485.681 232.087 492.214 234.42 500.801 234.42C508.081 234.42 513.681 232.367 517.601 228.26C521.707 223.967 523.761 218.367 523.761 211.46C523.761 202.5 520.867 196.06 515.081 192.14C509.481 188.033 500.427 185.98 487.921 185.98H478.961V147.06H487.921C497.441 147.06 505.094 145.473 510.881 142.3C516.854 138.94 519.841 133.06 519.841 124.66C519.841 117.94 517.974 112.713 514.241 108.98C510.507 105.247 505.374 103.38 498.841 103.38C491.747 103.38 486.427 105.527 482.881 109.82C479.521 114.113 477.561 119.433 477.001 125.78H430.241Z",fill:ce.cBBDEFB,fillOpacity:"0.6"}),e.jsx("rect",{x:"43",y:"87.5",width:"46",height:"20",fill:ce.cD6EBFD}),e.jsx("rect",{x:"29",y:"109.5",width:"46",height:"20",fill:ce.cD6EBFD}),e.jsx("rect",{x:"29",y:"65.5",width:"46",height:"20",fill:ce.cD6EBFD}),e.jsx("rect",{x:"356",y:"0.5",width:"55",height:"20",fill:ce.cD6EBFD}),e.jsx("rect",{x:"572",y:"142.5",width:"55",height:"20",fill:ce.cD6EBFD}),e.jsx("rect",{x:"589",y:"120.5",width:"55",height:"20",fill:ce.cD6EBFD}),e.jsx("path",{d:"M3 255.5L651 255.5",stroke:ce.c64B5F6,strokeWidth:"5",strokeLinecap:"round"}),e.jsx("defs",{children:e.jsx("clipPath",{id:"clip0_2949_9690",children:e.jsx("rect",{width:"179",height:"192",fill:ce.cFFFFFF,transform:"translate(246 60.5)"})})})]})})}function Fa({onClick:t}){const r=ke.useMediaQuery("md");return e.jsxs(x.Box,{direction:"column",height:"height-screen",fullWidth:!0,display:"flex",align:"center",justify:"center",gap:"md",children:[e.jsx(Ea,{width:r?600:300}),e.jsx(S.Text,{fontWeight:"bold",fontSize:r?"3xl":"2xl",children:"We Are Sorry ..."}),t&&e.jsx(P.Button,{size:r?"md":"xs",onClick:t,children:"Go Back"})]})}const f={c000D58:"#000D58",c001174:"#001174",c28AC6E:"#28AC6E",c48504C:"#48504C",c64B5F6:"#64B5F6",c90CAF9:"#90CAF9",cC9184A:"#C9184A",cD6D6D6:"#D6D6D6",cD6EBFD:"#D6EBFD",cD9D9D9:"#D9D9D9",cDEECF8:"#DEECF8",cE7EAE9:"#E7EAE9",cF3F8FD:"#F3F8FD",cFFE18B:"#FFE18B",cFFFFFF:"#FFFFFF"};function Ia({width:t,height:r}){return e.jsx(e.Fragment,{children:e.jsxs("svg",{width:t,height:r,viewBox:"0 0 622 287",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("path",{d:"M406.562 180.997C406.562 148.544 412.16 122.978 423.356 104.299C434.721 85.6199 452.957 76.2803 478.063 76.2803C503.168 76.2803 521.319 85.6199 532.514 104.299C543.88 122.978 549.562 148.544 549.562 180.997C549.562 213.827 543.88 239.582 532.514 258.261C521.319 276.941 503.168 286.28 478.063 286.28C452.957 286.28 434.721 276.941 423.356 258.261C412.16 239.582 406.562 213.827 406.562 180.997ZM506.815 180.997C506.815 161.941 504.949 147.318 501.217 137.129C497.485 126.752 489.767 121.563 478.063 121.563C466.358 121.563 458.64 126.752 454.908 137.129C451.176 147.318 449.31 161.941 449.31 180.997C449.31 193.827 449.988 204.488 451.345 212.978C452.703 221.28 455.417 228.073 459.488 233.356C463.729 238.45 469.92 240.997 478.063 240.997C486.205 240.997 492.312 238.45 496.383 233.356C500.624 228.073 503.423 221.28 504.78 212.978C506.137 204.488 506.815 193.827 506.815 180.997Z",fill:f.cD6EBFD}),e.jsx("path",{d:"M246.562 180.558C246.562 148.105 252.16 122.539 263.356 103.86C274.721 85.1804 292.957 75.8408 318.063 75.8408C343.168 75.8408 361.319 85.1804 372.514 103.86C383.88 122.539 389.562 148.105 389.562 180.558C389.562 213.388 383.88 239.143 372.514 257.822C361.319 276.501 343.168 285.841 318.063 285.841C292.957 285.841 274.721 276.501 263.356 257.822C252.16 239.143 246.562 213.388 246.562 180.558ZM346.815 180.558C346.815 161.501 344.949 146.879 341.217 136.69C337.485 126.313 329.767 121.124 318.063 121.124C306.358 121.124 298.64 126.313 294.908 136.69C291.176 146.879 289.31 161.501 289.31 180.558C289.31 193.388 289.988 204.048 291.345 212.539C292.702 220.841 295.417 227.633 299.488 232.916C303.729 238.011 309.92 240.558 318.063 240.558C326.205 240.558 332.312 238.011 336.383 232.916C340.624 227.633 343.423 220.841 344.78 212.539C346.137 204.048 346.815 193.388 346.815 180.558Z",fill:f.cD6EBFD}),e.jsx("path",{d:"M222.808 118.703H128.062V159.858C132.111 155.484 137.779 151.905 145.067 149.122C152.356 146.338 160.251 144.946 168.754 144.946C183.938 144.946 196.49 148.326 206.41 155.086C216.532 161.846 223.922 170.594 228.578 181.329C233.234 192.065 235.562 203.696 235.562 216.221C235.562 239.483 228.882 257.972 215.52 271.691C202.158 285.21 183.357 282.89 159.062 282.89C142.867 282.89 131.098 284.939 116.826 283.918C104.881 278.351 95.6695 270.697 89.1911 260.955C82.7127 251.213 79.1698 239.98 78.5625 227.256H129.276C130.491 233.419 133.426 238.588 138.083 242.763C142.739 246.739 149.116 248.728 157.214 248.728C166.729 248.728 173.815 245.745 178.472 239.781C183.128 233.817 185.456 225.864 185.456 215.923C185.456 206.181 183.027 198.726 178.168 193.557C173.309 188.387 166.223 185.803 156.911 185.803C150.027 185.803 144.359 187.493 139.905 190.873C135.451 194.054 132.515 198.328 131.098 203.696H80.9919V73.9697H222.808V118.703Z",fill:f.cD6EBFD}),e.jsx("rect",{x:"216.562",y:"45.7803",width:"55",height:"20",fill:f.cD6EBFD}),e.jsx("rect",{x:"14.4375",y:"90",width:"46",height:"20",fill:f.cD6EBFD}),e.jsx("rect",{x:"0.4375",y:"112",width:"46",height:"20",fill:f.cD6EBFD}),e.jsx("rect",{x:"0.4375",y:"68",width:"46",height:"20",fill:f.cD6EBFD}),e.jsx("rect",{x:"344.312",y:"0.719727",width:"55",height:"20",fill:f.cD6EBFD}),e.jsx("rect",{x:"549.562",y:"87",width:"55",height:"20",fill:f.cD6EBFD}),e.jsx("rect",{x:"566.562",y:"65",width:"55",height:"20",fill:f.cD6EBFD}),e.jsx("path",{d:"M25.8125 282.22H605.812",stroke:f.c64B5F6,strokeWidth:"5",strokeLinecap:"round"}),e.jsx("rect",{x:"263.012",y:"175.42",width:"104.6",height:"31.2833",rx:"3.3",fill:f.cFFFFFF,stroke:f.c001174,strokeWidth:"1.4"}),e.jsx("path",{d:"M269.878 200.539C269.878 200.263 270.101 200.039 270.377 200.039L305.476 199.955C305.753 199.955 305.978 200.179 305.978 200.455V206.461H269.878V200.539Z",stroke:f.c001174}),e.jsx("rect",{x:"263.012",y:"210.752",width:"104.6",height:"31.2833",rx:"3.3",fill:f.cFFFFFF,stroke:f.c001174,strokeWidth:"1.4"}),e.jsx("path",{d:"M269.878 235.871C269.878 235.595 270.101 235.372 270.377 235.371L305.476 235.288C305.753 235.287 305.978 235.511 305.978 235.788V241.794H269.878V235.871Z",stroke:f.c001174}),e.jsx("rect",{x:"263.012",y:"246.969",width:"104.6",height:"31.2833",rx:"3.3",fill:f.cFFFFFF,stroke:f.c001174,strokeWidth:"1.4"}),e.jsx("path",{d:"M269.878 272.088C269.878 271.812 270.101 271.589 270.377 271.588L305.476 271.505C305.753 271.504 305.978 271.728 305.978 272.005V278.011H269.878V272.088Z",stroke:f.c001174}),e.jsx("path",{d:"M279.095 176.348H364.373C365.459 176.348 366.125 176.992 366.986 178.252V202.985C366.986 202.985 366.986 203.869 366.545 204.752C366.103 205.635 365.661 206.077 365.661 206.077L306.478 206.163V199.452L279.095 199.518V176.348Z",fill:f.cF3F8FD}),e.jsx("path",{d:"M279.095 211.093H364.373C365.459 211.093 366.125 211.736 366.986 212.997V237.73C366.986 237.73 366.986 238.613 366.545 239.497C366.103 240.38 365.661 240.822 365.661 240.822L306.478 240.908V234.197L279.095 234.262V211.093Z",fill:f.cF3F8FD}),e.jsx("path",{d:"M279.095 248.008H364.373C365.459 248.008 366.125 248.652 366.986 249.912V274.646C366.986 274.646 366.986 275.529 366.545 276.412C366.103 277.296 365.661 277.737 365.661 277.737L306.478 277.824V271.112L279.095 271.178V248.008Z",fill:f.cF3F8FD}),e.jsx("circle",{cx:"270.258",cy:"179.136",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"270.258",cy:"181.786",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"281.561",cy:"179.136",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"281.561",cy:"181.786",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"273.085",cy:"179.136",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"273.085",cy:"181.786",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"284.388",cy:"179.136",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"284.388",cy:"181.786",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"275.91",cy:"179.136",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"275.91",cy:"181.786",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"287.214",cy:"179.136",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"287.214",cy:"181.786",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"278.737",cy:"179.136",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"278.737",cy:"181.786",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"290.04",cy:"179.136",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"290.04",cy:"181.786",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"344.462",cy:"179.136",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"344.462",cy:"181.786",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"355.765",cy:"179.136",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"355.765",cy:"181.786",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"347.29",cy:"179.136",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"347.29",cy:"181.786",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"358.592",cy:"179.136",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"358.592",cy:"181.786",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"350.114",cy:"179.136",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"350.114",cy:"181.786",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"361.418",cy:"179.136",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"361.418",cy:"181.786",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"352.941",cy:"179.136",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"352.941",cy:"181.786",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"364.244",cy:"179.136",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"364.244",cy:"181.786",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"344.462",cy:"200.336",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"344.462",cy:"202.986",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"355.765",cy:"200.336",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"355.765",cy:"202.986",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"347.29",cy:"200.336",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"347.29",cy:"202.986",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"358.592",cy:"200.336",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"358.592",cy:"202.986",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"350.114",cy:"200.336",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"350.114",cy:"202.986",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"361.418",cy:"200.336",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"361.418",cy:"202.986",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"352.941",cy:"200.336",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"352.941",cy:"202.986",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"364.244",cy:"200.336",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"364.244",cy:"202.986",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"359.918",cy:"191.061",r:"4.45833",stroke:f.c001174,strokeWidth:"0.8"}),e.jsx("circle",{cx:"359.918",cy:"191.061",r:"2.20833",fill:f.cE7EAE9}),e.jsx("rect",{x:"269.726",y:"186.553",width:"36.4",height:"9.01667",rx:"0.65",fill:f.cE7EAE9,stroke:f.c001174,strokeWidth:"0.7"}),e.jsx("rect",{x:"310.537",y:"186.553",width:"6.54333",height:"9.01667",rx:"0.65",fill:f.cE7EAE9,stroke:f.c001174,strokeWidth:"0.7"}),e.jsx("rect",{x:"321.312",y:"186.553",width:"6.54333",height:"9.01667",rx:"0.65",fill:f.cE7EAE9,stroke:f.c001174,strokeWidth:"0.7"}),e.jsx("rect",{x:"332.089",y:"186.553",width:"6.54333",height:"9.01667",rx:"0.65",fill:f.cE7EAE9,stroke:f.c001174,strokeWidth:"0.7"}),e.jsx("rect",{x:"342.864",y:"186.553",width:"6.54333",height:"9.01667",rx:"0.65",fill:f.cE7EAE9,stroke:f.c001174,strokeWidth:"0.7"}),e.jsx("circle",{cx:"270.258",cy:"214.468",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"270.258",cy:"217.118",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"281.561",cy:"214.468",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"281.561",cy:"217.118",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"273.085",cy:"214.468",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"273.085",cy:"217.118",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"284.388",cy:"214.468",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"284.388",cy:"217.118",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"275.91",cy:"214.468",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"275.91",cy:"217.118",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"287.214",cy:"214.468",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"287.214",cy:"217.118",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"278.737",cy:"214.468",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"278.737",cy:"217.118",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"290.04",cy:"214.468",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"290.04",cy:"217.118",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"344.462",cy:"214.468",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"344.462",cy:"217.118",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"355.765",cy:"214.468",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"355.765",cy:"217.118",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"347.29",cy:"214.468",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"347.29",cy:"217.118",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"358.592",cy:"214.468",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"358.592",cy:"217.118",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"350.114",cy:"214.468",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"350.114",cy:"217.118",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"361.418",cy:"214.468",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"361.418",cy:"217.118",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"352.941",cy:"214.468",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"352.941",cy:"217.118",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"364.244",cy:"214.468",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"364.244",cy:"217.118",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"344.462",cy:"235.668",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"344.462",cy:"238.318",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"355.765",cy:"235.668",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"355.765",cy:"238.318",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"347.29",cy:"235.668",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"347.29",cy:"238.318",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"358.592",cy:"235.668",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"358.592",cy:"238.318",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"350.114",cy:"235.668",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"350.114",cy:"238.318",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"361.418",cy:"235.668",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"361.418",cy:"238.318",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"352.941",cy:"235.668",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"352.941",cy:"238.318",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"364.244",cy:"235.668",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"364.244",cy:"238.318",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"359.918",cy:"226.393",r:"4.45833",stroke:f.c001174,strokeWidth:"0.8"}),e.jsx("circle",{cx:"359.918",cy:"226.393",r:"2.20833",fill:f.cE7EAE9}),e.jsx("rect",{x:"269.726",y:"221.885",width:"36.4",height:"9.01667",rx:"0.65",fill:f.cE7EAE9,stroke:f.c001174,strokeWidth:"0.7"}),e.jsx("rect",{x:"310.537",y:"221.885",width:"6.54333",height:"9.01667",rx:"0.65",fill:f.cE7EAE9,stroke:f.c001174,strokeWidth:"0.7"}),e.jsx("rect",{x:"321.312",y:"221.885",width:"6.54333",height:"9.01667",rx:"0.65",fill:f.cE7EAE9,stroke:f.c001174,strokeWidth:"0.7"}),e.jsx("rect",{x:"332.089",y:"221.885",width:"6.54333",height:"9.01667",rx:"0.65",fill:f.cE7EAE9,stroke:f.c001174,strokeWidth:"0.7"}),e.jsx("rect",{x:"342.864",y:"221.885",width:"6.54333",height:"9.01667",rx:"0.65",fill:f.cE7EAE9,stroke:f.c001174,strokeWidth:"0.7"}),e.jsx("circle",{cx:"270.258",cy:"250.685",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"270.258",cy:"253.335",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"281.561",cy:"250.685",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"281.561",cy:"253.335",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"273.085",cy:"250.685",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"273.085",cy:"253.335",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"284.388",cy:"250.685",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"284.388",cy:"253.335",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"275.91",cy:"250.685",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"275.91",cy:"253.335",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"287.214",cy:"250.685",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"287.214",cy:"253.335",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"278.737",cy:"250.685",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"278.737",cy:"253.335",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"290.04",cy:"250.685",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"290.04",cy:"253.335",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"344.462",cy:"250.685",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"344.462",cy:"253.335",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"355.765",cy:"250.685",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"355.765",cy:"253.335",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"347.29",cy:"250.685",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"347.29",cy:"253.335",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"358.592",cy:"250.685",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"358.592",cy:"253.335",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"350.114",cy:"250.685",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"350.114",cy:"253.335",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"361.418",cy:"250.685",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"361.418",cy:"253.335",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"352.941",cy:"250.685",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"352.941",cy:"253.335",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"364.244",cy:"250.685",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"364.244",cy:"253.335",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"344.462",cy:"271.885",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"344.462",cy:"274.535",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"355.765",cy:"271.885",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"355.765",cy:"274.535",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"347.29",cy:"271.885",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"347.29",cy:"274.535",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"358.592",cy:"271.885",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"358.592",cy:"274.535",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"350.114",cy:"271.885",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"350.114",cy:"274.535",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"361.418",cy:"271.885",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"361.418",cy:"274.535",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"352.941",cy:"271.885",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"352.941",cy:"274.535",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"364.244",cy:"271.885",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"364.244",cy:"274.535",r:"0.883333",fill:f.cD9D9D9}),e.jsx("circle",{cx:"359.918",cy:"262.61",r:"4.45833",stroke:f.c001174,strokeWidth:"0.8"}),e.jsx("circle",{cx:"359.918",cy:"262.61",r:"2.20833",fill:f.cE7EAE9}),e.jsx("rect",{x:"269.726",y:"258.102",width:"36.4",height:"9.01667",rx:"0.65",fill:f.cE7EAE9,stroke:f.c001174,strokeWidth:"0.7"}),e.jsx("rect",{x:"310.537",y:"258.102",width:"6.54333",height:"9.01667",rx:"0.65",fill:f.cE7EAE9,stroke:f.c001174,strokeWidth:"0.7"}),e.jsx("rect",{x:"321.312",y:"258.102",width:"6.54333",height:"9.01667",rx:"0.65",fill:f.cE7EAE9,stroke:f.c001174,strokeWidth:"0.7"}),e.jsx("rect",{x:"332.089",y:"258.102",width:"6.54333",height:"9.01667",rx:"0.65",fill:f.cE7EAE9,stroke:f.c001174,strokeWidth:"0.7"}),e.jsx("rect",{x:"342.864",y:"258.102",width:"6.54333",height:"9.01667",rx:"0.65",fill:f.cE7EAE9,stroke:f.c001174,strokeWidth:"0.7"}),e.jsx("rect",{x:"270.261",y:"200.336",width:"8.83333",height:"6.18333",fill:f.cFFFFFF}),e.jsx("rect",{x:"270.261",y:"235.668",width:"8.83333",height:"6.18333",fill:f.cFFFFFF}),e.jsx("rect",{x:"270.261",y:"271.885",width:"8.83333",height:"6.18333",fill:f.cFFFFFF}),e.jsx("rect",{x:"279.095",y:"200.336",width:"26.5",height:"6.18333",fill:f.cDEECF8}),e.jsx("rect",{x:"279.095",y:"235.668",width:"26.5",height:"6.18333",fill:f.cDEECF8}),e.jsx("rect",{x:"279.095",y:"271.885",width:"26.5",height:"6.18333",fill:f.cDEECF8}),e.jsx("path",{d:"M268.053 210.494C268.483 209.112 268.564 208.343 268.053 206.961H362.569C361.955 208.363 361.972 209.136 362.569 210.494H268.053Z",fill:f.c000D58,stroke:f.c001174}),e.jsx("path",{d:"M268.053 246.269C268.483 244.887 268.564 244.118 268.053 242.736H362.569C361.955 244.138 361.972 244.911 362.569 246.269H268.053Z",fill:f.c000D58,stroke:f.c001174}),e.jsx("path",{d:"M283.312 130.775C283.312 129.64 283.987 128.72 284.82 128.72H349.805C350.638 128.72 351.312 129.64 351.312 130.775V169.72H283.312V130.775Z",fill:f.cFFFFFF,stroke:f.c48504C,strokeWidth:"2"}),e.jsx("path",{d:"M279.574 171.847C279.381 171.283 279.267 170.624 279.33 169.72H355.195C355.423 170.925 355.287 171.695 355.063 172.241C354.834 172.802 354.506 173.186 354.101 173.66C354.084 173.68 354.067 173.7 354.05 173.72H280.503C280.468 173.658 280.434 173.598 280.4 173.539C280.051 172.922 279.774 172.434 279.574 171.847Z",stroke:f.c48504C,strokeWidth:"2"}),e.jsx("path",{d:"M350.312 133.72V129.726L284.812 129.72C284.312 129.726 284.312 129.726 284.312 130.125V133.72H350.312Z",fill:f.cD6D6D6}),e.jsx("circle",{cx:"287.212",cy:"131.62",r:"0.9",fill:f.c28AC6E}),e.jsx("circle",{cx:"289.812",cy:"131.62",r:"0.9",fill:f.cC9184A}),e.jsx("circle",{cx:"292.412",cy:"131.62",r:"0.9",fill:f.cFFE18B}),e.jsx("rect",{x:"315.312",y:"133.72",width:"35",height:"35",fill:f.c90CAF9}),e.jsx("path",{d:"M319.312 153.22H341.312",stroke:f.cFFFFFF,strokeWidth:"1.3",strokeLinecap:"round"}),e.jsx("path",{d:"M288.312 150.72H310.312",stroke:f.c001174,strokeWidth:"1.3",strokeLinecap:"round"}),e.jsx("path",{d:"M319.312 156.22H336.312",stroke:f.cFFFFFF,strokeWidth:"1.3",strokeLinecap:"round"}),e.jsx("path",{d:"M288.312 153.72H305.312",stroke:f.c001174,strokeWidth:"1.3",strokeLinecap:"round"}),e.jsx("path",{d:"M319.312 159.22H336.312",stroke:f.cFFFFFF,strokeWidth:"1.3",strokeLinecap:"round"}),e.jsx("path",{d:"M288.312 156.72H305.312",stroke:f.c001174,strokeWidth:"1.3",strokeLinecap:"round"}),e.jsx("path",{d:"M337.312 139.72L328.312 148.72M328.313 139.72L337.313 148.72",stroke:f.cFFFFFF,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})})}function Ma({onClick:t}){const r=ke.useMediaQuery("md");return e.jsxs(x.Box,{direction:"column",height:"height-screen",fullWidth:!0,display:"flex",align:"center",justify:"center",gap:"md",overflow:"overflow-hidden",children:[e.jsx(Ia,{width:r?600:300}),e.jsx(S.Text,{fontWeight:"bold",fontSize:r?"3xl":"2xl",textAlign:"center",children:"Server Problem"}),e.jsx(S.Text,{fontWeight:"semibold",fontSize:r?"lg":"md",textAlign:"center",children:"we are trying to fix the problem"}),t&&e.jsx(P.Button,{size:r?"md":"xs",onClick:t,children:"Go Back"})]})}const Ta=t=>{var n,s,o,i,l;const r=ke.useMediaQuery("md");return e.jsxs(Ae.Dialog,{isShow:t.isShow,onHide:t.onHide,style:{...r?{minWidth:t.customMinWidth||"458px"}:{maxWidth:t.customMinWidth||"458px"}},children:[e.jsx(Ae.DialogTitle,{...t.dialogTitleProps,children:typeof t.title=="string"?e.jsx(S.Text,{fontSize:"lg",fontWeight:"medium",children:t.title}):t.title}),e.jsx(Ae.DialogBody,{children:typeof t.description=="string"?e.jsx(S.Text,{fontSize:"md",lineHeight:"leading-6",color:"brand",children:t.description}):t.description}),e.jsx(Ae.DialogFooter,{children:e.jsx(x.Box,{display:"flex",direction:((n=t.containerConfirmBtnProps)==null?void 0:n.direction)||"row",justify:((s=t.containerConfirmBtnProps)==null?void 0:s.justify)||"flex-end",...t.containerConfirmBtnProps,children:e.jsxs(x.Box,{display:"flex",direction:((o=t.wrapperConfirmBtnProps)==null?void 0:o.direction)||"row",justify:((i=t.wrapperConfirmBtnProps)==null?void 0:i.justify)||"flex-end",gap:((l=t.wrapperConfirmBtnProps)==null?void 0:l.gap)||"sm",...t.wrapperConfirmBtnProps,children:[t.onCancel&&e.jsx(P.Button,{secondary:!0,onClick:t.onCancel,size:"md",fullWidth:!0,children:t.titleCancelBtn||"Cancel"}),e.jsx(x.Box,{direction:"column",fullWidth:!0,style:{textWrap:"nowrap"},children:e.jsx(P.Button,{...t.buttonConfirmProps,onClick:t.onConfirm,size:"md",fullWidth:!0,children:t.titleConfirmBtn||"Ok"})})]})})})]},t.key)},La=u.memo(({children:t,height:r,minHeight:n,customHeight:s,paddingInline:o="spacing-0",paddingBlock:i="spacing-0",header:l,footer:c,title:a,titleTag:d,action:h,actionContainer:g,containerProps:m,bodyProps:y,headerProps:D={borderBottom:!0},footerProps:j={borderTop:!0},variantTag:R="info"})=>{const I=u.useRef(null),[M,C]=u.useState("100vh");u.useEffect(()=>{const v=()=>{if(I.current){const L=I.current.getBoundingClientRect().top;C(`calc(100vh - ${L}px)`)}};return v(),window.addEventListener("resize",v),()=>window.removeEventListener("resize",v)},[]);const k=()=>d?e.jsxs(x.Box,{direction:"row",gap:"sm",align:"center",children:[e.jsx(S.Text,{fontWeight:"medium",children:a}),e.jsx(ot.Badges,{border:!0,text:d,variant:R})]}):e.jsx(S.Text,{fontWeight:"medium",children:a}),T=()=>l||e.jsxs(x.Box,{direction:"row",justify:"space-between",align:"flex-start",gap:"md",children:[e.jsx(x.Box,{direction:"column",children:a?k():null}),e.jsx(x.Box,{direction:"column",...g,children:h??null})]}),F=!!(l||a||h);return e.jsxs(x.Box,{ref:I,height:r,customMinHeight:n,customHeight:s,paddingBlock:i,paddingInline:o,bg:"white",direction:"column",...m,style:{backgroundColor:"var(--sa-background-primary, #ffffff)",display:"flex",minHeight:M,...(m==null?void 0:m.style)??{}},children:[l!==null&&F?e.jsx(Sn,{...D,children:T()}):null,e.jsx(x.Box,{direction:"column",padding:"spacing-0",...y,style:{flex:1,overflow:"auto",...(y==null?void 0:y.style)??{}},children:t}),c?e.jsx(kn,{...j,children:c}):null]})}),Ra=u.memo(({value:t,options:r=[],onChange:n,multiple:s})=>{const o=(t==null?void 0:t.map(c=>c.value))||[],i=(r==null?void 0:r.filter(c=>o.includes(c.value)))||[],l=c=>{const a=[...i];let d=[];s?d=o.includes(c.value)?a.filter(h=>h.value!==c.value):[...a,c]:d=[c],n==null||n(d)};return e.jsx(x.Box,{direction:"row",gap:"sm",flexWrap:"wrap",children:r==null?void 0:r.map((c,a)=>e.jsx(P.Button,{...o.includes(c.value)?{primary:!0}:{secondary:!0},onClick:()=>l(c),children:c.label},a))})});function Lr(t){return null}Lr.displayName="LayoutDialog.Header";function Rr(t){return null}Rr.displayName="LayoutDialog.Body";function Ar(t){return null}Ar.displayName="LayoutDialog.Aside";function Or(t){return null}Or.displayName="LayoutDialog.Footer";const Ge={"lyd-root":"_lyd-root_jyp0m_6","lyd-backdrop":"_lyd-backdrop_jyp0m_43","lyd-panel":"_lyd-panel_jyp0m_52","lyd-modal":"_lyd-modal_jyp0m_63","lyd-fullscreen":"_lyd-fullscreen_jyp0m_77","lyd-sidebar":"_lyd-sidebar_jyp0m_85","lyd-header":"_lyd-header_jyp0m_115","lyd-header-content":"_lyd-header-content_jyp0m_126","lyd-header-actions":"_lyd-header-actions_jyp0m_134","lyd-main":"_lyd-main_jyp0m_141","lyd-body":"_lyd-body_jyp0m_148","lyd-aside":"_lyd-aside_jyp0m_154","lyd-footer":"_lyd-footer_jyp0m_170","lyd-vm-group":"_lyd-vm-group_jyp0m_183","lyd-vm-btn":"_lyd-vm-btn_jyp0m_191","lyd-close-btn":"_lyd-close-btn_jyp0m_214"},Aa=[{mode:"sidebar",label:"Sidebar",renderIcon:()=>e.jsx(Wa,{})},{mode:"modal",label:"Modal",renderIcon:()=>e.jsx(B.Icon,{name:"Newscreen",size:"sm"})},{mode:"fullscreen",label:"Fullscreen",renderIcon:()=>e.jsx(B.Icon,{name:"Fullscreen",size:"sm"})}];function Oa({value:t,onChange:r}){return e.jsx("div",{className:Ge["lyd-vm-group"],role:"group","aria-label":"View mode",children:Aa.map(n=>e.jsx("button",{type:"button",className:Ge["lyd-vm-btn"],"data-active":t===n.mode,"aria-label":`Switch to ${n.label} view`,"aria-pressed":t===n.mode,onClick:()=>r(n.mode),children:n.renderIcon()},n.mode))})}function Wa(){return 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","aria-hidden":"true",children:[e.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),e.jsx("line",{x1:"15",y1:"4",x2:"15",y2:"20"})]})}const nn={md:"768px",lg:"1024px",xl:"1200px","2xl":"1440px"};function za(t){return t?t in nn?nn[t]:t:nn.xl}function wr(t,r){let n=null;return u.Children.forEach(t,s=>{u.isValidElement(s)&&s.type===r&&(n=s.props.children??null)}),n}function Ha(t){const{isOpen:r,onClose:n,viewMode:s,defaultViewMode:o="modal",onViewModeChange:i,showViewModeToggle:l=!0,showCloseButton:c=!0,size:a,asideWidth:d,disableEscapeClose:h=!1,disableBackdropClose:g=!1,lockBodyScroll:m=!0,children:y}=t,[D,j]=u.useState(o),R=s??D,M=ke.useMediaQuery("md")?R:"fullscreen",C=u.useCallback(J=>{s===void 0&&j(J),i==null||i(J)},[s,i]),k=u.useRef(null);u.useEffect(()=>{if(!(!r||!m))return k.current=document.body.style.overflow,document.body.style.overflow="hidden",()=>{document.body.style.overflow=k.current??""}},[r,m]);const T=u.useRef(n);T.current=n,u.useEffect(()=>{if(r)return Ae.registerOverlay({onEscape:h?void 0:()=>T.current()})},[r,h]);const F=u.useMemo(()=>wr(y,Lr),[y]),v=u.useMemo(()=>wr(y,Rr),[y]),L=u.useMemo(()=>wr(y,Ar),[y]),N=u.useMemo(()=>wr(y,Or),[y]);if(!r)return null;const q=[Ge["lyd-panel"],M==="modal"&&Ge["lyd-modal"],M==="fullscreen"&&Ge["lyd-fullscreen"],M==="sidebar"&&Ge["lyd-sidebar"]].filter(Boolean).join(" "),W={"--lyd-max-w":za(a),...d!==void 0&&{"--lyd-aside-w":d}},O=()=>{g||n()};return typeof document>"u"?null:Ir.createPortal(e.jsxs("div",{className:Ge["lyd-root"],style:W,role:"dialog","aria-modal":"true",children:[e.jsx("div",{className:Ge["lyd-backdrop"],onClick:O,"aria-hidden":"true"}),e.jsxs("div",{className:q,children:[e.jsxs("div",{className:Ge["lyd-header"],children:[e.jsx("div",{className:Ge["lyd-header-content"],children:F}),e.jsxs("div",{className:Ge["lyd-header-actions"],children:[l&&e.jsx(Oa,{value:R,onChange:C}),c&&e.jsx("button",{type:"button",className:Ge["lyd-close-btn"],onClick:n,"aria-label":"Close dialog",children:e.jsx(B.Icon,{name:"Cross",size:"md"})})]})]}),e.jsxs("div",{className:Ge["lyd-main"],children:[e.jsx("div",{className:Ge["lyd-body"],children:v}),L&&e.jsx("aside",{className:Ge["lyd-aside"],children:L})]}),N&&e.jsx("div",{className:Ge["lyd-footer"],children:N})]})]}),document.body)}const ar=Ha;ar.Header=Lr;ar.Body=Rr;ar.Aside=Ar;ar.Footer=Or;function _a({url:t,filename:r,onClose:n}){const s=u.useRef(n);return s.current=n,u.useEffect(()=>Ae.registerOverlay({onEscape:()=>s.current()}),[]),e.jsxs("div",{onClick:n,style:{position:"fixed",inset:0,zIndex:9999,backgroundColor:"rgba(0,0,0,0.85)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"12px"},children:[e.jsxs("div",{onClick:o=>o.stopPropagation(),style:{position:"absolute",top:"16px",right:"16px",display:"flex",gap:"8px"},children:[e.jsx("a",{href:t,download:r,style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"6px 12px",backgroundColor:"rgba(255,255,255,0.15)",color:"#fff",borderRadius:"var(--sa-radii-sm, 6px)",fontSize:"13px",textDecoration:"none",backdropFilter:"blur(4px)"},children:"Download"}),e.jsx("button",{onClick:n,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",backgroundColor:"rgba(255,255,255,0.15)",border:"none",borderRadius:"var(--sa-radii-sm, 6px)",color:"#fff",cursor:"pointer",backdropFilter:"blur(4px)"},"aria-label":"Close preview",children:"✕"})]}),e.jsx("img",{src:t,alt:r,onClick:o=>o.stopPropagation(),style:{maxWidth:"90vw",maxHeight:"85vh",objectFit:"contain",borderRadius:"var(--sa-radii-sm, 6px)",boxShadow:"var(--sa-shadow-lg, 0 25px 50px rgba(0,0,0,0.5))"}}),e.jsx("span",{style:{color:"rgba(255,255,255,0.6)",fontSize:"12px"},children:r})]})}const Pa=/\.(jpe?g|png|gif|webp|bmp|svg|avif)(\?|#|$)/i,Na=/\.pdf(\?|#|$)/i,Va=/\.(mp4|webm|ogv|mov|m4v)(\?|#|$)/i,qa=/\.(mp3|wav|ogg|m4a|aac|flac)(\?|#|$)/i;function Za(t,r){if(r)return r;const n=t.mimeType??"",s=o=>o.test(t.fileName??"")||o.test(t.fileUrl??"");return n.startsWith("image/")||s(Pa)?"image":n==="application/pdf"||s(Na)?"pdf":n.startsWith("video/")||s(Va)?"video":n.startsWith("audio/")||s(qa)?"audio":"other"}const ko={display:"block",maxWidth:"100%",maxHeight:"70vh",margin:"0 auto",objectFit:"contain",borderRadius:"var(--sa-radii-sm, 6px)"},Ga={width:"100%",height:"75vh",border:"none",borderRadius:"var(--sa-radii-sm, 6px)"};function Qa({kind:t,attachment:r,openLabel:n,unsupportedLabel:s}){const{fileUrl:o,fileName:i}=r;switch(t){case"image":return e.jsx("img",{src:o,alt:i,style:ko});case"pdf":return e.jsx("iframe",{src:o,title:i,style:Ga});case"video":return e.jsx("video",{src:o,controls:!0,style:{...ko,width:"100%"}});case"audio":return e.jsx(x.Box,{padding:"lg",align:"center",justify:"center",fullWidth:!0,children:e.jsx("audio",{src:o,controls:!0,style:{width:"100%"}})});default:return e.jsxs(x.Box,{direction:"column",align:"center",justify:"center",gap:"md",padding:"3xl",fullWidth:!0,children:[e.jsx(B.Icon,{name:"DocumentDetail",size:"lg"}),e.jsx(S.Text,{fontSize:"sm",color:"gray-500",children:s}),e.jsx(P.Button,{type:"button",variant:"link",iconLeft:e.jsx(B.Icon,{name:"SquareArrowExpand"}),onClick:()=>window.open(o,"_blank","noopener"),children:n})]})}}const Ua=({attachment:t,onClose:r,onDownload:n,isDownloading:s,kind:o,maxWidth:i,labels:l})=>{if(!t)return null;const c=Za(t,o),a=i??(c==="pdf"?"min(80vw, 1100px)":"min(90vw, 900px)"),d={download:(l==null?void 0:l.download)??"Download",close:(l==null?void 0:l.close)??"Close",openInNewTab:(l==null?void 0:l.openInNewTab)??"Open in new tab",unsupported:(l==null?void 0:l.unsupported)??"This file type cannot be previewed."};return e.jsxs(Ae.Dialog,{isShow:!0,onHide:r,maxWidth:a,children:[e.jsx(Ae.DialogTitle,{children:e.jsxs(x.Box,{direction:"row",align:"center",justify:"space-between",gap:"sm",fullWidth:!0,children:[e.jsx(S.Text,{fontWeight:"semibold",truncate:!0,children:t.fileName}),e.jsxs(x.Box,{direction:"row",align:"center",gap:"sm",flexShrink:"0",children:[n?e.jsx(P.Button,{type:"button",variant:"outline",tone:"neutral",size:"sm",iconLeft:e.jsx(B.Icon,{name:"Download"}),disabled:s,isLoading:s,onClick:n,children:d.download}):null,e.jsx(P.Button,{type:"button",variant:"tertiary",tone:"neutral",size:"sm",iconLeft:e.jsx(B.Icon,{name:"Cross"}),"aria-label":d.close,onClick:r})]})]})}),e.jsx(Ae.DialogBody,{children:e.jsx(Qa,{kind:c,attachment:t,openLabel:d.openInNewTab,unsupportedLabel:d.unsupported})})]})},Ss="var(--sa-border-subtle, #e5e7eb)",Fr=()=>e.jsx(x.Box,{style:{width:1,height:22,backgroundColor:Ss}}),Ya=t=>typeof t=="number"?`${t}px`:t;function ks({count:t,children:r,label:n,onClear:s,clearLabel:o="Clear selection",clearDisabled:i=!1,bottom:l=20,zIndex:c=50,style:a,className:d}){if(t===0)return null;const h=typeof n=="function"?n(t):n??`${t} selected`;return e.jsx(x.Box,{direction:"row",justify:"center",style:{position:"fixed",bottom:Ya(l),left:0,right:0,zIndex:c,pointerEvents:"none"},children:e.jsxs(x.Box,{direction:"row",align:"center",gap:"xs",padding:"spacing-8",className:d,style:{backgroundColor:"var(--sa-background-primary, #ffffff)",pointerEvents:"auto",borderRadius:"min(10px, var(--sa-radii-lg, 12px))",border:`1px solid ${Ss}`,boxShadow:"var(--sa-shadow-xl, 0 10px 25px -5px rgb(0 0 0/0.15))",...a},children:[e.jsx(S.Text,{fontSize:"sm",fontWeight:"medium",whiteSpace:"nowrap",style:{paddingInline:6},children:h}),e.jsx(Fr,{}),r,s&&e.jsxs(e.Fragment,{children:[e.jsx(Fr,{}),e.jsx(Te.Tooltip,{label:o,position:"top",children:e.jsx(P.Button,{variant:"tertiary",tone:"neutral",size:"sm",iconLeft:e.jsx(B.Icon,{name:"Cross",size:"xs"}),"aria-label":o,onClick:s,disabled:i})})]})]})})}ks.Divider=Fr;const Wr=t=>{const{variant:r="outlined",overflow:n="hidden",style:s,children:o,...i}=t;return e.jsx(on.Card,{variant:r,overflow:n,style:{display:"flex",flexDirection:"column",...s},...i,children:o})},Xa=t=>t==null?void 0:typeof t=="number"?`${t}px`:t,Bs=({src:t,alt:r="",height:n=140,bg:s="var(--sa-background-neutral, #f0f1f2)",avatar:o,children:i})=>e.jsxs(x.Box,{style:{position:"relative",marginBottom:o?24:void 0},children:[e.jsx(x.Box,{style:{height:Xa(n),background:t?void 0:s,overflow:"hidden"},children:t?e.jsx("img",{src:t,alt:r,style:{width:"100%",height:"100%",objectFit:"cover",display:"block"}}):null}),i?e.jsx(x.Box,{style:{position:"absolute",inset:0,pointerEvents:"none"},children:i}):null,o?e.jsx(x.Box,{style:{position:"absolute",left:16,bottom:0,transform:"translateY(50%)"},children:o}):null]}),Es=({avatar:t,title:r,subtitle:n,action:s,divided:o=!1,children:i})=>e.jsx(x.Box,{padding:"md",style:{borderBottom:o?"1px solid var(--sa-border-subtle, #0b120e24)":void 0},children:i??e.jsxs(fe.Flex,{direction:"row",align:"center",gap:"sm",children:[t,e.jsxs(x.Box,{flex:"1",style:{minWidth:0},children:[r!=null&&e.jsx(S.Text,{fontWeight:"semibold",truncate:!0,children:r}),n!=null&&e.jsx(S.Text,{fontSize:"sm",color:"subtlest",truncate:!0,children:n})]}),s!=null&&e.jsx(x.Box,{style:{flexShrink:0},children:s})]})}),Fs=({left:t,right:r,divided:n=!0,children:s})=>e.jsx(x.Box,{padding:"md",style:{marginTop:"auto",borderTop:n?"1px solid var(--sa-border-subtle, #0b120e24)":void 0},children:s??e.jsxs(fe.Flex,{direction:"row",align:"center",justify:"space-between",gap:"sm",children:[e.jsx(x.Box,{style:{minWidth:0},children:t}),e.jsx(x.Box,{style:{flexShrink:0},children:r})]})});Wr.Media=Bs;Wr.Header=Es;Wr.Footer=Fs;const $a=t=>{const{defaultTab:r=0,paramKey:n="tab"}=t||{},{useSearchParams:s}=xt(),[o,i]=s(),l=qt.searchParamsToObject(o.toString());return{activeTab:l[n]?parseInt(l[n]):r,handleTabChange:d=>{i({...l,[n]:d.toString()})},searchQueries:l}};function Ja({appName:t,menuConfig:r,formatTitle:n}){const{useLocation:s}=xt(),o=s();u.useEffect(()=>{let i=null,l=null;for(const d of r){const h=d.items.find(g=>g.to?g.to==="/"?o.pathname==="/":!!(g.to===o.pathname||o.pathname.startsWith(g.to+"/")):!1);if(h){i=h,l=d;break}}const c=[];i!=null&&i.title&&c.push(i.title),l!=null&&l.name&&c.push(l.name.toTitleCase());const a=(d,h)=>d.length>0?`${d.join(" - ")} | ${h}`:h;document.title=(n||a)(c,t)},[o.pathname])}const Ka=()=>{const{useSearchParams:t,useParams:r,useLocation:n}=xt(),[s,o]=t(),i=qt.searchParamsToObject(s.toString()),l=r(),c=n(),a=l.id;return{setSearchParams:o,searchParams:s,searchQueries:i,isHasQuery:(y,D)=>s.has(y)&&s.get(y)===D,getQueryParam:y=>s.get(y),getRouteParam:y=>l[y],params:l,location:c,id:a,hasId:!!a}};function ed(t){var s,o;const r=t.decodedAccessToken;return u.useMemo(()=>{var a,d;const i=((d=(a=r==null?void 0:r.access)==null?void 0:a.role)==null?void 0:d.code)??"",l=Object.keys(t.role).reduce((h,g)=>{const m=`is${g.toLowerCase().replace(/(^\w|_\w)/g,y=>y.replace("_","").toUpperCase())}`;return{...h,[m]:!1}},{});return{...Object.keys(t.role).reduce((h,g)=>{const m=`is${g.toLowerCase().replace(/(^\w|_\w)/g,y=>y.replace("_","").toUpperCase())}`;return{...h,[m]:i===t.role[g]}},l),hasRole:h=>i===t.role[h],getRoleKey:()=>i}},[(o=(s=r==null?void 0:r.access)==null?void 0:s.role)==null?void 0:o.code,t])}exports.ASIDE_WIDTH_VAR=mn;exports.AdvanceFilterBar=Ko;exports.App=Vs;exports.AppComponent=Oo;exports.AppContext=pn;exports.AppLayout=Ii;exports.AsideBar=ba;exports.AttachmentPreview=Ua;exports.BackButton=Ti;exports.ColumnFilterDropdown=fs;exports.ColumnHeaderFilter=Kl;exports.ColumnMenu=ys;exports.ConfirmationDialog=Ta;exports.DataTable=ms;exports.DecisionWrapper=me;exports.EachUtils=Tr;exports.EmptyStatePage=Sa;exports.EntityCard=Wr;exports.EntityCardFooter=Fs;exports.EntityCardHeader=Es;exports.EntityCardMedia=Bs;exports.FLOATING_FOOTER_HEIGHT_VAR=gn;exports.FilterBar=_l;exports.FilterDrawer=Jo;exports.FloatingFooter=va;exports.ForbiddenPage=Fa;exports.Form=aa;exports.FullSection=La;exports.HeaderLeftSlot=qs;exports.HeaderLeftSlotOutlet=Ho;exports.HeaderLeftSlotProvider=zo;exports.Highlight=bs;exports.HorizontalField=Wi;exports.ImagePreview=_a;exports.InputFile=vs;exports.InputImage=Cs;exports.LayoutDialog=ar;exports.LayoutDialogAside=Ar;exports.LayoutDialogBody=Rr;exports.LayoutDialogFooter=Or;exports.LayoutDialogHeader=Lr;exports.ModuleSwitcher=Li;exports.ModuleSwitcherModal=Vo;exports.NotFoundPage=Ba;exports.PageLayout=Pi;exports.Pressable=lr;exports.RightDrawer=Zo;exports.SIDEBAR_DEFAULT_WIDTH=bn;exports.SIDEBAR_MAX_WIDTH=vn;exports.SIDEBAR_MIN_WIDTH=jn;exports.ScrollToTopButton=ws;exports.Section=Gi;exports.SectionFooter=kn;exports.SectionHeader=Sn;exports.SelectButton=Ra;exports.SelectionActionBar=ks;exports.SelectionActionBarDivider=Fr;exports.ServerErrorPage=Ma;exports.SidePanel=pa;exports.SidePanelItem=fa;exports.SidebarBadgesProvider=Fo;exports.SidebarGroupSlot=Zs;exports.SidebarGroupSlotOutlet=an;exports.SidebarGroupSlotProvider=_o;exports.SidebarHeaderSlot=Wo;exports.SidebarProvider=To;exports.StarasiaRouterProvider=Ao;exports.TableFooter=hs;exports.TableHeader=xs;exports.TableLayout=jc;exports.TableSection=ic;exports.TableWrapper=us;exports.ToggleStatus=ca;exports.Typography=it;exports.VerticalField=Ca;exports.clearModuleSelection=Gs;exports.createInitialFromUserName=kc;exports.cssVars=Tc;exports.expandDateCompact=ec;exports.formHasChanged=zc;exports.formatDate=Ic;exports.formatDateToIndonesian=js;exports.formatRupiah=Ec;exports.getDateFilterValue=$o;exports.getDateRangeFilterValue=cl;exports.getInitials=Fc;exports.getValueDropdownMultipleFilter=Xo;exports.getValueRadioFilter=ll;exports.getValueSearch=Mr;exports.getValuesFilter=Dr;exports.handleChangeFilter=ir;exports.handleOnScroll=Qc;exports.isColumnFilterActive=ds;exports.isEmail=qc;exports.isFilterActive=al;exports.isOnlyLettersAndSpaces=_c;exports.isPhoneNumber=Hc;exports.isSlug=Zc;exports.localStorageAdapter=En;exports.oneDayInMs=Lc;exports.parseIndonesianDateToDate=Bc;exports.preventNonCoordinateInput=Gc;exports.preventNonNumberAndDecimalInput=Vc;exports.preventNonNumberInput=Pc;exports.preventNumberInput=Nc;exports.resolveDateRangeValueToString=Uo;exports.resolveDateValueToString=Yo;exports.resolveDropdownValueToString=Go;exports.resolveRadioValueToString=Qo;exports.resolveSidebarBadge=nr;exports.storageKeys=Gt;exports.textWidth=Rc;exports.useApp=yn;exports.useAppState=Bo;exports.useAuthRole=ed;exports.useCoarsePointer=ps;exports.useDynamicTitle=Ja;exports.useFilterBarApiParams=ql;exports.useFilterBarControls=Gl;exports.useModuleSelection=Dn;exports.useRouteInfo=Xe;exports.useRouteParams=Ka;exports.useRouterAdapter=xt;exports.useSidebar=Lo;exports.useSidebarBadges=Io;exports.useTabState=$a;exports.useTableSortApiParams=vc;Object.keys(An).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>An[t]})});Object.keys(Sr).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>Sr[t]})});Object.keys(ot).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>ot[t]})});Object.keys(x).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>x[t]})});Object.keys(Pt).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>Pt[t]})});Object.keys(P).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>P[t]})});Object.keys(on).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>on[t]})});Object.keys(Dt).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>Dt[t]})});Object.keys(Ae).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>Ae[t]})});Object.keys(kr).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>kr[t]})});Object.keys(Vt).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>Vt[t]})});Object.keys(ke).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>ke[t]})});Object.keys(qt).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>qt[t]})});Object.keys(gt).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>gt[t]})});Object.keys(A).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>A[t]})});Object.keys(sr).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>sr[t]})});Object.keys(or).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>or[t]})});Object.keys(Q).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>Q[t]})});Object.keys(On).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>On[t]})});Object.keys(sn).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>sn[t]})});Object.keys(Nt).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>Nt[t]})});Object.keys(Wn).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>Wn[t]})});Object.keys(Zt).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>Zt[t]})});Object.keys(Te).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>Te[t]})});Object.keys(mt).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>mt[t]})});Object.keys(ln).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>ln[t]})});Object.keys(S).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>S[t]})});Object.keys(B).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>B[t]})});Object.keys(fe).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>fe[t]})});Object.keys(zn).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>zn[t]})});Object.keys(Hn).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>Hn[t]})});Object.keys(_n).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>_n[t]})});Object.keys(Pn).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>Pn[t]})});Object.keys(Nn).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>Nn[t]})});Object.keys(st).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>st[t]})});Object.keys(Vn).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>Vn[t]})});
|