@starasia/admin 8.18.0 → 8.19.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/index.cjs.js +1 -1
- package/dist/index.es.js +2 -2
- package/dist/index.umd.js +1 -1
- package/package.json +3 -3
package/dist/index.cjs.js
CHANGED
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
box-shadow: 0 4px 12px rgba(0,0,0,0.12);
|
|
44
44
|
padding: 4px 0;
|
|
45
45
|
}
|
|
46
|
-
`,document.head.appendChild(t)},Dt=t=>t==="right"?"right":t==="center"?"center":"left",Rs=/^(#|rgb|hsl|var\()/,St=t=>t?Rs.test(t)?t:`var(--sa-background-${t})`:void 0,As=(t,r)=>{if(r)return t[r]},zs=(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)),Vs=({columns:t,data:r,getRowKey:n,rowBg:s,size:o="md",resizable:i=!1,layout:c="auto",widthStorageKey:l,columnState:a,onColumnStateChange:d,columnMenu:h=!1,sort:g,defaultSort:m,onSortChange:j,height:E,mobileLayout:y="cards",mobileBreakpoint:M="md",groupSeparator:k,summary:L,emptyState:C,loading:b=!1,loadingRows:A=8,rowActions:W})=>{Ws();const F=!ge.useMediaQuery(M)&&y!=="scroll",z=!!(W!=null&&W.length),[R,_]=u.useState(null);u.useEffect(()=>{if(!R)return;const p=()=>_(null),D=setTimeout(()=>document.addEventListener("click",p),0);return()=>{clearTimeout(D),document.removeEventListener("click",p)}},[R]);const[J,te]=u.useState(()=>new Set),xe=a!==void 0,[he,se]=u.useState({}),Z=a??he,Q=p=>{d==null||d(p),xe||se(p)},ae=g!==void 0,[ie,ue]=u.useState(m??null),me=ae?g??null:ie,Te=!j,Oe=p=>{j==null||j(p),ae||ue(p)},{headerGroups:Fe,leafColumns:de,hasGroups:fe}=u.useMemo(()=>{var ve;const p=new Set(Z.hidden??[]),D=(re,le)=>re.key??(typeof re.accessor=="string"?re.accessor:`col-${le}`),O=t.map((re,le)=>{var _e;if((_e=re.children)!=null&&_e.length){const Xe=re.children.map((qe,tt)=>({col:qe,key:D(qe,`${le}-${tt}`)})).filter(qe=>!p.has(qe.key));return{col:re,key:re.key??`group-${le}`,isGroup:!0,leaves:Xe}}const je={col:re,key:D(re,`${le}`)};return{col:re,key:je.key,isGroup:!1,leaves:p.has(je.key)?[]:[je]}}).filter(re=>re.leaves.length>0),$=O.some(re=>re.isGroup);let X=O.flatMap(re=>re.leaves);if(!$&&((ve=Z.order)!=null&&ve.length)){const re=new Map(Z.order.map((le,je)=>[le,je]));X=[...X].sort((le,je)=>(re.get(le.key)??1/0)-(re.get(je.key)??1/0))}return{headerGroups:O,leafColumns:X,hasGroups:$}},[t,Z]),We=u.useMemo(()=>new Map(de.map((p,D)=>[p.key,D])),[de]),Ve=!fe&&de.some(p=>(p.col.headerColSpan??1)>1),Ee=de.map(p=>p.key).join("|"),Re=(p,D)=>{const O=p.sortKey??(typeof p.accessor=="string"?p.accessor:void 0);return O?D[O]:void 0},et=p=>p.sortable??(!!p.sortKey||typeof p.accessor=="string"),S=u.useMemo(()=>{if(!Te||!me)return r;const p=de.find(O=>O.key===me.key);if(!p)return r;const D=me.direction==="asc"?1:-1;return[...r].sort((O,$)=>zs(Re(p.col,O),Re(p.col,$))*D)},[r,Te,me,de]),N=!fe&&!Ve,U=!!l&&N,[I,G]=Y.useColumnWidths(l??""),H=U?I:void 0,q=u.useRef(null),[P,pe]=u.useState();u.useLayoutEffect(()=>{pe(void 0)},[Ee]),u.useLayoutEffect(()=>{if(!N||P||!q.current)return;const p=q.current.querySelectorAll("th.sa-tl-leaf");pe(Array.from(p).map(D=>D.offsetWidth))},[P,N]);const[De,He]=u.useState(0);u.useLayoutEffect(()=>{if(!fe||!q.current)return;const p=q.current.querySelector(":scope > tr");p&&He(p.offsetHeight)},[fe,Ee]);const Be=(p,D)=>{if((H==null?void 0:H[D])!=null)return H[D];if(p.width!=null)return p.width;if((P==null?void 0:P[D])!=null)return P[D]},Me=(p,D)=>typeof p.width=="number"?p.width:P==null?void 0:P[D],Ye=Z.frozenKey&&!fe&&!Ve?de.findIndex(p=>p.key===Z.frozenKey):-1,Ge=p=>p<=Ye,Qe=p=>{if(!P)return 0;let D=0;for(let O=0;O<p;O++)D+=P[O]??0;return D},Pe=u.useRef(null),[mt,gt]=u.useState("100vh");u.useLayoutEffect(()=>{if(E!==void 0)return;const p=()=>{if(Pe.current){const D=Pe.current.getBoundingClientRect().top;gt(`calc(100vh - ${D}px)`)}};return p(),window.addEventListener("resize",p),()=>window.removeEventListener("resize",p)},[E]);const Ne=(p,D)=>n?n(p,D):D,Ht=(p,D,O)=>p.render?p.render(D,O,S):As(D,p.accessor),Pt=de.length+(z?1:0),gr=["80%","55%","70%","45%","90%","60%"],Nn=(p,D)=>gr[(p*7+D*3)%gr.length],_n=(p,D)=>e.jsx(ze.Skeleton,{height:14,width:Nn(p,D),borderRadius:"rounded-sm"}),qn=Array.from({length:A},(p,D)=>e.jsxs(Y.Tr,{children:[de.map(({col:O,key:$},X)=>e.jsx(Y.Td,{style:{textAlign:Dt(O.align)},children:_n(D,X)},`sa-tl-sk-${D}-${$}`)),z&&e.jsx(Y.Td,{style:{width:1,padding:0,border:"none"}})]},`sa-tl-sk-${D}`)),Zn=(p,D)=>{D||Q({...Z,hidden:[...Z.hidden??[],p]})},Gn=p=>Q({...Z,frozenKey:Z.frozenKey===p?void 0:p}),yt=p=>(W??[]).filter(D=>{var O;return!((O=D.hidden)!=null&&O.call(D,p))}),yr={position:"absolute",right:0,top:"50%",transform:"translateY(-50%)",display:"flex",alignItems:"center",gap:4,paddingRight:16,paddingLeft:40,background:"linear-gradient(to right, transparent, var(--sa-background-primary-inverse, #f8f8f8) 40px)"},pt=(p,D,O,$)=>{var _e;const X=(_e=p.disabled)==null?void 0:_e.call(p,D),ve=($==null?void 0:$.showLabel)??p.showLabel,re=($==null?void 0:$.size)??"xs",le=e.jsx(V.Button,{size:re,variant:p.variant??"tertiary",tone:p.tone??"neutral",disabled:X,onClick:()=>p.onClick(D,O),iconLeft:p.icon?e.jsx(B.Icon,{name:p.icon,size:"sm"}):void 0,children:ve&&p.label}),je=p.tooltip;return je?e.jsx(Ce.Tooltip,{label:je,position:"top-end",children:le}):le},Qn=(p,D)=>{const O=yt(p);if(!O.length)return null;if(O.length>5){const X=Ne(p,D),ve=(R==null?void 0:R.rowKey)===X;return e.jsx("div",{className:"sa-tl-row-actions",style:yr,onClick:re=>re.stopPropagation(),children:e.jsx(Ce.Tooltip,{label:"Aksi lainnya",position:"top",children:e.jsx(V.Button,{size:"xs",variant:"tertiary",onClick:re=>{const le=re.currentTarget.getBoundingClientRect();_(ve?null:{rowKey:X,top:le.bottom+4,right:window.innerWidth-le.right})},children:e.jsx(B.Icon,{name:"MenuVertical",size:"sm"})})})})}return e.jsx("div",{className:"sa-tl-row-actions",style:yr,children:O.map(X=>e.jsx(u.Fragment,{children:pt(X,p,D)},X.key))})},Un=(p,D)=>{const O=yt(p);return O.length?e.jsx("div",{style:{display:"flex",gap:6,flexWrap:"wrap",paddingTop:8,marginTop:8,borderTop:Ct},children:O.map($=>e.jsx(u.Fragment,{children:pt($,p,D,{showLabel:!0,size:"sm"})},$.key))}):null},Jn=(p,D)=>{const O=yt(p);return O.length?e.jsx("div",{style:{display:"flex",gap:4,paddingRight:8,flexShrink:0},children:O.map($=>e.jsx(u.Fragment,{children:pt($,p,D,{showLabel:!1})},$.key))}):null},Nt=(p,D)=>{const{col:O,key:$}=p,X=We.get($)??0,ve=Ge(X),re=ve&&X===Ye,le=(me==null?void 0:me.key)===$?me.direction:null,je=h&&!O.disableMenu?e.jsx(Rn,{active:!!le||ve,canSort:et(O),canHide:!O.locked,sortDir:le,frozen:ve,onSort:tt=>Oe({key:$,direction:tt}),onClearSort:()=>Oe(null),onToggleFreeze:()=>Gn($),onHide:()=>Zn($,O.locked)}):null,_e=O.align==="right",Xe=O.align==="right"?"flex-end":O.align==="center"?"center":"flex-start",qe=e.jsxs("span",{style:{flex:1,minWidth:0,display:"flex",alignItems:"center",gap:6,justifyContent:Xe,overflow:"hidden"},children:[O.icon&&e.jsx(B.Icon,{name:O.icon,size:"sm",style:{flexShrink:0}}),e.jsx("span",{style:wt,children:O.title})]});return e.jsx(Y.Th,{className:`sa-tl-leaf${ve?" sa-tl-frozen":""}`,rowSpan:D==null?void 0:D.rowSpan,colSpan:D==null?void 0:D.colSpan,minWidth:O.minWidth,resizable:N?O.resizable:!1,defaultWidth:Me(O,X),style:{textAlign:Dt(O.align),width:Be(O,X),position:"sticky",top:(D==null?void 0:D.top)??0,left:ve?Qe(X):void 0,zIndex:ve?3:2,backgroundColor:at,boxShadow:re?Xr:void 0},children:e.jsx("div",{style:{display:"flex",alignItems:"center",gap:6,width:"100%"},children:_e?e.jsxs(e.Fragment,{children:[je,qe]}):e.jsxs(e.Fragment,{children:[qe,je]})})},`th-${$}`)},Yn=()=>{const p=[];for(let D=0;D<de.length;){const O=de[D],$=O.col.headerColSpan??1,X=Math.max(1,Math.min($,de.length-D));p.push(Nt(O,X>1?{colSpan:X}:void 0)),D+=X}return p},_t=de.filter(p=>!p.col.hideOnMobile),qt=_t.find(p=>p.col.primary)??_t[0],Xn=_t.filter(p=>p!==qt),Kn=p=>te(D=>{const O=new Set(D);return O.has(p)?O.delete(p):O.add(p),O}),pr=(p,D)=>Xn.map(({col:O,key:$})=>{const X=Ht(O,p,D),ve=typeof X=="string"||typeof X=="number"?e.jsx(w.Text,{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",textAlign:"right"},children:X}):e.jsx("div",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",textAlign:"right"},children:X});return e.jsxs("div",{style:{display:"flex",gap:12,justifyContent:"space-between",alignItems:"baseline"},children:[typeof O.title=="string"?e.jsx(w.Text,{color:"subtle",fontWeight:"medium",style:{color:Os,flexShrink:0},children:O.title}):e.jsx("div",{style:{flexShrink:0},children:O.title}),ve]},$)}),jr=(p,D)=>{const O=qt?Ht(qt.col,p,D):null;return typeof O=="string"||typeof O=="number"?e.jsx(w.Text,{as:"span",style:wt,children:O}):e.jsx("span",{style:wt,children:O})},$n=e.jsx(f.Box,{style:{display:"flex",flexDirection:"column",gap:8,padding:8},children:Array.from({length:A},(p,D)=>e.jsxs(f.Box,{style:{border:Ct,borderRadius:"var(--sa-radii-sm, 6px)",padding:12,display:"flex",flexDirection:"column",gap:8},children:[e.jsx(ze.Skeleton,{height:16,width:"60%",borderRadius:"rounded-sm"}),e.jsx(ze.Skeleton,{height:12,width:"85%",borderRadius:"rounded-sm"}),e.jsx(ze.Skeleton,{height:12,width:"70%",borderRadius:"rounded-sm"})]},`sa-tl-sk-card-${D}`))}),br=e.jsx(f.Box,{fullWidth:!0,style:{minHeight:(C==null?void 0:C.minHeight)??320,display:"flex",alignItems:"center",justifyContent:"center",padding:16},children:C==null?void 0:C.content}),eo=b?$n:S.length===0?br:y==="expand"?e.jsx(f.Box,{style:{display:"flex",flexDirection:"column"},children:S.map((p,D)=>{const O=Ne(p,D),$=J.has(O),X=St(s==null?void 0:s(p,D));return e.jsxs("div",{style:{borderBottom:Ct,backgroundColor:X},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[e.jsxs("button",{type:"button",onClick:()=>Kn(O),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:[jr(p,D),e.jsx(B.Icon,{name:$?"ChevronUp":"ChevronDown",size:"sm",style:{flexShrink:0}})]}),z&&Jn(p,D)]}),$&&e.jsx("div",{style:{padding:"0 12px 12px",display:"flex",flexDirection:"column",gap:6},children:pr(p,D)})]},O)})}):e.jsx(f.Box,{style:{display:"flex",flexDirection:"column",gap:8,padding:8},children:S.map((p,D)=>e.jsxs(f.Box,{style:{border:Ct,borderRadius:"var(--sa-radii-sm, 6px)",padding:12,display:"flex",flexDirection:"column",gap:6,backgroundColor:St(s==null?void 0:s(p,D))},children:[jr(p,D),pr(p,D),z&&Un(p,D)]},Ne(p,D)))}),to=i&&N&&P!==void 0,vr=c==="fixed"&&!i&&(N?P!==void 0:!0),ro=vr&&!N,no=e.jsxs(Y.Table,{className:"sa-table-layout",fullWidth:!0,size:o,resizable:to,style:vr?{tableLayout:"fixed"}:void 0,onWidthsChange:U?G:void 0,children:[ro&&e.jsxs("colgroup",{children:[de.map(({col:p,key:D},O)=>e.jsx("col",{style:{width:Be(p,O)}},`col-${D}`)),z&&e.jsx("col",{style:{width:1}})]}),e.jsx(Y.Thead,{ref:q,children:fe?e.jsxs(e.Fragment,{children:[e.jsxs(Y.Tr,{children:[Fe.map(p=>p.isGroup?e.jsx(Y.Th,{colSpan:p.leaves.length,style:{textAlign:"center",position:"sticky",top:0,zIndex:2,backgroundColor:at},children:e.jsx("span",{style:wt,children:p.col.title})},`grp-${p.key}`):Nt(p.leaves[0],{rowSpan:2})),z&&e.jsx(Y.Th,{rowSpan:2,style:{position:"sticky",top:0,right:0,zIndex:3,width:1,padding:0,border:"none",backgroundColor:at}})]}),e.jsx(Y.Tr,{children:Fe.flatMap(p=>p.isGroup?p.leaves.map(D=>Nt(D,{top:De})):[])})]}):e.jsxs(Y.Tr,{children:[Yn(),z&&e.jsx(Y.Th,{style:{position:"sticky",top:0,right:0,zIndex:3,width:1,padding:0,border:"none",backgroundColor:at}})]})}),e.jsx(Y.Tbody,{children:b?qn:S.length===0?e.jsx(Y.Tr,{children:e.jsx(Y.Td,{colSpan:Pt,children:br})}):e.jsxs(e.Fragment,{children:[S.map((p,D)=>{const O=k==null?void 0:k(p,D,D>0?S[D-1]:void 0),$=St(s==null?void 0:s(p,D));return e.jsxs(u.Fragment,{children:[O!=null&&O!==!1&&e.jsx(Y.Tr,{children:e.jsx(Y.Td,{colSpan:Pt,style:{backgroundColor:at},children:O})}),e.jsxs(Y.Tr,{children:[de.map(({col:X,key:ve},re)=>{var Cr;const le=(Cr=X.cellProps)==null?void 0:Cr.call(X,p,D,S);if(le!=null&&le.hidden)return null;const je=Ge(re),_e=je&&re===Ye,Xe=Ht(X,p,D),qe=typeof X.bg=="function"?X.bg(p,D,S):X.bg,tt=St(qe)??$;return e.jsx(Y.Td,{className:je?"sa-tl-frozen":void 0,colSpan:le==null?void 0:le.colSpan,rowSpan:le==null?void 0:le.rowSpan,style:{textAlign:Dt(X.align),width:Be(X,re),minWidth:X.minWidth,position:je?"sticky":void 0,left:je?Qe(re):void 0,zIndex:je?1:void 0,boxShadow:_e?Xr:void 0,...tt?{"--sa-tl-bg":tt}:{}},children:typeof Xe=="string"?e.jsx(w.Text,{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",textAlign:Dt(X.align)},children:Xe}):Xe},`tl-cell-${D}-${ve}`)}),z&&e.jsx(Y.Td,{style:{position:"sticky",right:0,width:1,padding:0,overflow:"visible",zIndex:2,border:"none"},children:Qn(p,D)})]})]},Ne(p,D))}),L!=null&&e.jsx(Y.Tr,{children:e.jsx(Y.Td,{colSpan:Pt,children:L})})]})})]}),Zt=R?S.findIndex((p,D)=>Ne(p,D)===R.rowKey):-1,Gt=Zt>=0?S[Zt]:null;return e.jsxs(e.Fragment,{children:[e.jsx(f.Box,{ref:Pe,fullWidth:!0,style:{overflow:"auto",height:E??mt},children:F?eo:no}),R&&Gt&&e.jsx("div",{className:"sa-tl-kebab-menu",style:{top:R.top,right:R.right},onClick:p=>p.stopPropagation(),children:yt(Gt).map(p=>e.jsx("div",{style:{padding:"2px 4px"},children:pt(p,Gt,Zt,{showLabel:!0,size:"sm"})},p.key))})]})},$t=t=>t==="asc"||t==="desc",Hs=(t={})=>{const{sortKeyParam:r="sortBy",sortOrderParam:n="sortOrder",pageKey:s="page",defaultSort:o=null,paramKeys:i,scopeId:c,storage:l=mr}=t,{searchParams:a,setSearchParams:d,searchQueries:h}=Se(),g=a.toString(),m=c?ct.tableSort(c):void 0,j=u.useRef(!1);u.useEffect(()=>{if(j.current||(j.current=!0,!m)||a.has(r)||a.has(n))return;const C=l.get(m);!(C!=null&&C.key)||!$t(C.direction)||d({...Object.fromEntries(a.entries()),[r]:C.key,[n]:C.direction})},[]);const E=u.useMemo(()=>{const C=a.get(r),b=a.get(n);return C&&$t(b)?{key:C,direction:b}:o},[g,r,n,o]);u.useEffect(()=>{if(!m)return;const C=a.get(r),b=a.get(n);C&&$t(b)?l.set(m,{key:C,direction:b}):l.remove(m)},[g,m,r,n,l]);const y=(i==null?void 0:i.sortBy)??"sortBy",M=(i==null?void 0:i.sortOrder)??"sortOrder",k=u.useMemo(()=>E?{[y]:E.key,[M]:E.direction}:{},[E,y,M]),L=u.useCallback(C=>{const b={...h};C?(b[r]=C.key,b[n]=C.direction):(delete b[r],delete b[n]),delete b[s],d(b)},[h,r,n,s,d]);return{sort:E,setSort:L,params:k}},Wt=({of:t,render:r})=>u.Children.toArray(t==null?void 0:t.map((n,s,o)=>r(n,s,o))),oe=({condition:t,fallback:r,children:n,loading:s,isLoading:o})=>e.jsx(e.Fragment,{children:o?s:t?n:r}),ce=t=>e.jsx(w.Text,{...t,fontFamily:"Poppins",fontSize:t.fontSize||"md",fontWeight:t.fontWeight||"medium",color:t.color||"gray-700",children:t.children}),Ze=t=>e.jsx(w.Text,{color:"red-600",fontSize:"sm",children:t.message}),Ps=({size:t="md",direction:r="vertical",requiredTitle:n="(Required)",fullWidth:s=!1,...o})=>{var l,a,d;const i=o.hideMessageError||!1,c=r==="horizontal"?t==="sm"?342:t==="lg"?400:342:void 0;return e.jsxs(f.Box,{gap:r==="horizontal"?"spacing-96":"sm",direction:r==="horizontal"?"row":"column",...o.containerProps,children:[o.title&&e.jsx(oe,{condition:!!o.inputProps.required,fallback:e.jsxs(f.Box,{direction:"column",customMaxWidth:c,fullWidth:s,children:[e.jsx(ce,{children:o.title}),e.jsx(w.Text,{fontSize:t,color:"gray-500",children:o.description})]}),children:e.jsxs(f.Box,{direction:"column",customMaxWidth:c,fullWidth:s,children:[e.jsxs(ne.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(ce,{fontSize:t,children:o.title}),e.jsx(ce,{color:"error",fontSize:t,children:n}),e.jsx(oe,{condition:!!((l=o.tooltip)!=null&&l.label),children:e.jsx(Ce.Tooltip,{label:(a=o.tooltip)==null?void 0:a.label,arrowPosition:(d=o.tooltip)==null?void 0:d.arrowPosition,...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(oe,{condition:!!o.description,children:e.jsx(w.Text,{fontSize:t,color:"gray-500",children:o.description})})]})}),e.jsxs(f.Box,{direction:"column",gap:"xs",fullWidth:o.inputProps.fullWidth||!1,children:[e.jsx(Je.Input,{ref:o.inputRef,size:t,...o.inputProps,status:o.errorMessage?"error":"default",fullWidth:!0}),!i&&o.errorMessage&&e.jsx(Ze,{message:o.errorMessage}),o.inputProps.extended&&o.inputProps.extended]})]})},Ns=({size:t="md",direction:r="vertical",requiredTitle:n="(Required)",fullWidth:s=!1,...o})=>{var l,a,d;const i=o.hideMessageError||!1,c=r==="horizontal"?t==="sm"?342:t==="lg"?400:342:void 0;return e.jsxs(f.Box,{gap:r==="horizontal"?"spacing-96":"sm",direction:r==="horizontal"?"row":"column",onClick:o.onClickContainer,children:[o.title&&e.jsx(oe,{condition:!!o.inputProps.required,fallback:e.jsxs(f.Box,{direction:"column",customMaxWidth:c,fullWidth:s,children:[e.jsx(ce,{children:o.title}),e.jsx(w.Text,{fontSize:t,color:"gray-500",children:o.description})]}),children:e.jsxs(f.Box,{direction:"column",customMaxWidth:c,fullWidth:s,children:[e.jsxs(ne.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(ce,{fontSize:t,children:o.title}),e.jsx(ce,{color:"error",fontSize:t,children:n}),e.jsx(oe,{condition:!!((l=o.tooltip)!=null&&l.label),children:e.jsx(Ce.Tooltip,{label:(a=o.tooltip)==null?void 0:a.label,arrowPosition:(d=o.tooltip)==null?void 0:d.arrowPosition,...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(oe,{condition:!!o.description,children:e.jsx(w.Text,{fontSize:t,color:"gray-500",children:o.description})})]})}),e.jsxs(f.Box,{direction:"column",gap:"xs",fullWidth:o.inputProps.fullWidth||!1,children:[e.jsx(f.Box,{direction:"column",style:{width:o.inputProps.fullWidth?"100%":r==="horizontal"&&o.customWidth?o.customWidth:r==="horizontal"?"343px":""},children:e.jsx(ot.Dropdown,{size:t,...o.inputProps,error:!!o.errorMessage})}),!i&&o.errorMessage&&e.jsx(Ze,{message:o.errorMessage}),o.inputProps.extended&&o.inputProps.extended]})]})},_s=(t,r)=>typeof t=="string"&&t||r==="error"?"var(--sa-border-danger)":"var(--sa-border-subtle)",qs=t=>{var l;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)},c=a=>{a.preventDefault(),n(!1)};return e.jsxs(f.Box,{width:"width-full",paddingInline:"md",direction:"row",gap:"sm",align:"center",onClick:t.handleOnClick,onDragOver:s,onDrop:o,onDragEnter:i,onDragLeave:c,paddingBlock:"md",borderRadius:"rounded-md",style:{border:r?"1px solid var(--sa-border-info)":`1px solid ${_s(t.errorMessage,t.status)}`},children:[e.jsx(B.Icon,{name:"Upload",size:"lg",style:{width:30,height:30}}),e.jsxs(ne.Flex,{direction:"column",gap:"xs",children:[e.jsxs(ne.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:(l=t.fileSupports)==null?void 0:l.map(a=>a.toLocaleUpperCase()).join(", ")})]})]})};function Zs(t){return t.split(" ").map(r=>r[0]).join("").slice(0,2).toUpperCase()}const An=t=>{const r={day:"2-digit",month:"short",year:"numeric"};return t.toLocaleDateString("id-ID",r)},Gs=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 Qs(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 Us=t=>{const r=t.split(" ");let n=r[0].charAt(0);return r.length>1&&(n+=""+r[1].charAt(0)),n.toUpperCase()};function Js(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 Ys="sa-admin",Ae=t=>`var(--${Ys}-${t})`,Xs={base:{borderColor:Ae("base-border-color"),textColor:Ae("base-text-color"),iconColor:Ae("base-icon-color"),placeholderColor:Ae("base-placeholder-color")},document:{bgColor:Ae("document-bg-color")},sidebar:{bgColor:Ae("sidebar-bg-color"),borderColor:Ae("sidebar-border-color"),maxWidth:Ae("sidebar-max-width"),width:Ae("sidebar-width"),collapseWidth:Ae("sidebar-collapse-width"),collapseV2Width:Ae("sidebar-v2-collapse-width")}},Ks=24*60*60*1e3,$s=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))},ei=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,ti=/--+/,ri=/-$/;function ni(t,r){return JSON.stringify(t)!==JSON.stringify(r)}function oi(t){return/^(?:\+62|62|0)8[1-9][0-9]{7,10}$/.test(t)}function si(t){return/^[A-Za-z\s]+$/.test(t)}const ii=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()},li=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()},ci=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()},ai=t=>ei.test(t);function di(t){return!(ti.test(t)||ri.test(t))}const ui=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()},xi=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 hi(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 fi(t){const r=t.split("/");return r[r.length-1]}const mi=t=>{var r,n;return e.jsxs(f.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(ne.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(ne.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?fi(t.defaultFile.url):(r=t.fileSelected)==null?void 0:r.name}),t.defaultFile?(t.defaultFile.size||t.defaultFile.date)&&e.jsxs(ne.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(B.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(ne.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(w.Text,{fontSize:"sm",fontWeight:"medium",children:hi(((n=t.fileSelected)==null?void 0:n.size.toString())||"100000")}),e.jsx(B.Icon,{name:"Dot",size:"xs"}),e.jsx(w.Text,{fontSize:"sm",fontWeight:"medium",style:{textWrap:"nowrap"},children:An(new Date)})]})]})]}),e.jsx(V.Button,{size:"xs",variant:"tertiary",tone:"error",type:"button",onClick:s=>{s.stopPropagation(),t.handleOnDeleteFile()},iconLeft:e.jsx(B.Icon,{name:"Trash1"})})]})},zn=({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=ge.useMediaQuery("md"),c=t==="error"||typeof n.errorMessage=="string"&&!!n.errorMessage,l=n.label?e.jsxs(ne.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:"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:j=>{var E;return n.handleOnChangeFile(((E=j.target.files)==null?void 0:E.item(0))||null)},accept:(m=n.fileSupportOption)==null?void 0:m.map(j=>"."+(j==null?void 0:j.toLowerCase())).join(", ")}),g=e.jsxs(f.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(mi,{fileSelected:n.fileSelected,defaultFile:n.defaultFile,handleOnDeleteFile:n.handleOnDeleteFile,handleOnClickFile:o}),!n.fileSelected&&!n.defaultFile&&e.jsx(qs,{fileSupports:n.fileSupportOption,isDesktop:i,errorMessage:c?n.errorText||n.errorMessage||" ":void 0,status:c?"error":"default",handleOnClick:o,handleOnFileChange:n.handleOnChangeFile})]});return r==="outside-left"?e.jsxs(ne.Flex,{direction:"row",align:"flex-start",gap:"sm",style:{width:"100%"},children:[e.jsxs(ne.Flex,{direction:"column",gap:"xs",style:{width:"40%",minWidth:"120px",paddingTop:"10px"},children:[l,a]}),e.jsxs(ne.Flex,{direction:"column",gap:"sm",style:{flex:1,minWidth:0},children:[g,d]})]}):e.jsxs(ne.Flex,{direction:"column",gap:"sm",style:{width:"100%"},children:[l,a,g,d]})},gi=({size:t="md",direction:r="vertical",requiredTitle:n="(Required)",fullWidth:s=!1,...o})=>{var l,a,d;const i=o.hideMessageError||!1,c=r==="horizontal"?t==="sm"?342:t==="lg"?400:342:void 0;return e.jsxs(f.Box,{gap:r==="horizontal"?"spacing-96":"sm",direction:r==="horizontal"?"row":"column",...o.containerProps,children:[o.title&&e.jsx(oe,{condition:!!o.inputProps.required,fallback:e.jsxs(f.Box,{direction:"column",customMaxWidth:c,fullWidth:s,children:[e.jsx(ce,{children:o.title}),e.jsx(w.Text,{fontSize:t,color:"gray-500",children:o.description})]}),children:e.jsxs(f.Box,{direction:"column",customMaxWidth:c,fullWidth:s,children:[e.jsxs(ne.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(ce,{fontSize:t,children:o.title}),e.jsx(ce,{color:"error",fontSize:t,children:n}),e.jsx(oe,{condition:!!((l=o.tooltip)!=null&&l.label),children:e.jsx(Ce.Tooltip,{label:(a=o.tooltip)==null?void 0:a.label,arrowPosition:(d=o.tooltip)==null?void 0:d.arrowPosition,...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(oe,{condition:!!o.description,children:e.jsx(w.Text,{fontSize:t,color:"gray-500",children:o.description})})]})}),e.jsxs(ne.Flex,{direction:"column",gap:"xs",children:[e.jsx(zn,{...o.inputProps,status:o.errorMessage?"error":"default"}),!i&&o.errorMessage&&e.jsx(Ze,{message:o.errorMessage})]})]})},yi=({size:t="md",direction:r="vertical",requiredTitle:n="(Required)",fullWidth:s=!1,required:o=!1,...i})=>{var a,d,h,g;const c=i.hideMessageError||!1,l=r==="horizontal"?t==="sm"?342:t==="lg"?400:342:void 0;return e.jsxs(f.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(oe,{condition:!!o,fallback:e.jsxs(f.Box,{direction:"column",customMaxWidth:l,fullWidth:s,children:[e.jsx(ce,{children:i.title}),e.jsx(Ie.Body3,{props:{color:"gray-500"},children:i.description})]}),children:e.jsxs(f.Box,{direction:"column",customMaxWidth:l,fullWidth:s,children:[e.jsxs(ne.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(ce,{fontSize:t,children:i.title}),e.jsx(ce,{color:"error",fontSize:t,children:n}),e.jsx(oe,{condition:!!((a=i.tooltip)!=null&&a.label),children:e.jsx(Ce.Tooltip,{label:(d=i.tooltip)==null?void 0:d.label,arrowPosition:(h=i.tooltip)==null?void 0:h.arrowPosition,...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(oe,{condition:!!i.description,children:e.jsx(w.Text,{fontSize:t,color:"gray-500",children:i.description})})]})}),e.jsx(f.Box,{gap:r==="horizontal-inline"?"xl":"md",direction:r==="horizontal-inline"?"row":"column",align:"flex-start",children:e.jsx(Wt,{of:(g=i.checkBoxesList)==null?void 0:g.map(m=>({...m,isChecked:i.checkBoxesAreChecked.includes(m.id)})),render:m=>m.renderBadge?e.jsxs(f.Box,{direction:"row",justify:"space-between",gap:"lg",...i.badgeContainerProps,children:[e.jsx(lt.Checkbox,{name:m.name,value:m.id,checked:m.isChecked,onChange:j=>i.onChecked(j.target.value,m),label:m.name,description:m.description}),m.renderBadge]}):e.jsx(lt.Checkbox,{name:m.name,value:m.id,checked:m.isChecked,onChange:j=>i.onChecked(j.target.value,m),label:m.name,description:m.description})})}),!c&&i.errorMessage&&e.jsx(Ze,{message:i.errorMessage})]})},pi=({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(f.Box,{gap:t==="horizontal-inline"||t==="horizontal-block"?"spacing-96":"sm",direction:t==="horizontal-inline"||t==="horizontal-block"?"row":"column",children:[e.jsx(oe,{condition:!!s.description||!!s.title,children:e.jsxs(f.Box,{direction:"column",customMaxWidth:o,fullWidth:n,children:[s.title&&e.jsx(ce,{children:s.title}),e.jsx(oe,{condition:!!s.description,children:e.jsx(w.Text,{color:"gray-500",children:s.description})})]})}),e.jsx(f.Box,{gap:"sm",direction:t==="horizontal"||t==="horizontal-inline"?"row":"column",align:"flex-start",flexWrap:"wrap",children:e.jsx(Wt,{of:(i=s.radioList)==null?void 0:i.map(c=>({...c,isChecked:s.radioIsChecked===c.id})),render:({value:c,id:l,isChecked:a,subInput:d,label:h,description:g})=>e.jsxs(f.Box,{direction:"column",gap:"xs",customMaxWidth:o,children:[e.jsx(nr.Radio,{id:`${l.toString()}-${c}`,name:s.groupName||h,label:h,value:c,checked:a,onChange:m=>s.onChecked({id:l,label:m.target.name,value:m.target.value}),disabled:s.disableAll},l),g&&e.jsx(w.Text,{color:"gray-500",style:{marginLeft:28},children:g}),d]})})}),s.errorMessage&&e.jsx(Ze,{message:s.errorMessage})]})},ji=({size:t="md",direction:r="vertical",requiredTitle:n="(Required)",fullWidth:s=!1,...o})=>{var l,a,d;const i=o.hideMessageError||!1,c=r==="horizontal"?t==="sm"?342:t==="lg"?400:342:void 0;return e.jsxs(f.Box,{gap:r==="horizontal"?"spacing-96":"sm",direction:r==="horizontal"?"row":"column",...o.containerProps,children:[o.title&&e.jsx(oe,{condition:!!o.inputProps.required,fallback:e.jsxs(f.Box,{direction:"column",customMaxWidth:c,fullWidth:s,children:[e.jsx(ce,{children:o.title}),e.jsx(w.Text,{fontSize:t,color:"gray-500",children:o.description})]}),children:e.jsxs(f.Box,{direction:"column",customMaxWidth:c,fullWidth:s,children:[e.jsxs(ne.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(ce,{fontSize:t,children:o.title}),e.jsx(ce,{color:"error",fontSize:t,children:n}),e.jsx(oe,{condition:!!((l=o.tooltip)!=null&&l.label),children:e.jsx(Ce.Tooltip,{label:(a=o.tooltip)==null?void 0:a.label,arrowPosition:(d=o.tooltip)==null?void 0:d.arrowPosition,...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(oe,{condition:!!o.description,children:e.jsx(w.Text,{fontSize:t,color:"gray-500",children:o.description})})]})}),e.jsxs(ne.Flex,{direction:"column",gap:"xs",children:[e.jsx(rr.Textarea,{ref:o.inputRef,size:t,...o.inputProps,status:o.errorMessage?"error":"default"}),!i&&o.errorMessage&&e.jsx(Ze,{message:o.errorMessage})]})]})},bi=({size:t="md",direction:r="vertical",requiredTitle:n="(Required)",required:s=!1,fullWidth:o=!1,...i})=>{var l,a,d;const c=r==="horizontal"?t==="sm"?342:t==="lg"?400:342:void 0;return e.jsxs(f.Box,{gap:r==="horizontal"?"spacing-96":"sm",direction:r==="horizontal"?"row":"column",...i.containerProps,children:[i.title&&e.jsx(oe,{condition:s,fallback:e.jsxs(f.Box,{direction:"column",customMaxWidth:c,fullWidth:o,children:[e.jsx(ce,{children:i.title}),e.jsx(w.Text,{fontSize:t,color:"gray-500",children:i.titleDescription})]}),children:e.jsxs(f.Box,{direction:"column",customMaxWidth:c,fullWidth:o,children:[e.jsxs(ne.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(ce,{fontSize:t,children:i.title}),e.jsx(ce,{color:"error",fontSize:t,children:n}),e.jsx(oe,{condition:!!((l=i.tooltip)!=null&&l.label),children:e.jsx(Ce.Tooltip,{label:(a=i.tooltip)==null?void 0:a.label,arrowPosition:(d=i.tooltip)==null?void 0:d.arrowPosition,...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(oe,{condition:!!i.titleDescription,children:e.jsx(w.Text,{fontSize:t,color:"gray-500",children:i.titleDescription})})]})}),e.jsx(it.Toggle,{checked:i.checked,onChange:i.onChange,label:i.label,description:i.description}),i.errorMessage&&e.jsx(Ze,{message:i.errorMessage})]})},vi=({variant:t="primary",size:r="md",...n})=>{const s=nt.useColor(),o=c=>{var a,d,h,g,m,j;if(!c)return;const l=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]:(j=(m=s==null?void 0:s.computed)==null?void 0:m.gray)==null?void 0:j[50];return e.jsx(B.Icon,{name:c,size:r,style:{color:l}})},i=()=>{var l,a,d,h;if(t!=="secondary-danger"&&t!=="secondary-primary")return n.title;const c={color:n.disabled?"var(--sa-text-disable, #181a198f)":t==="secondary-danger"?(a=(l=s==null?void 0:s.computed)==null?void 0:l.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(Ie.Body2,{props:{style:c},children:n.title});case"sm":case"md":return e.jsx(Ie.SubH3,{props:{style:c},children:n.title});case"lg":return e.jsx(Ie.SubH2,{props:{style:c},children:n.title});default:return n.title}};return e.jsx(V.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()})},Ci=t=>e.jsx(Ie.H5,{props:{...t},children:t.title}),wi=({size:t="md",direction:r="vertical",requiredTitle:n="(Required)",fullWidth:s=!1,...o})=>{var l,a,d;const i=o.hideMessageError||!1,c=r==="horizontal"?t==="sm"?342:t==="lg"?400:342:void 0;return e.jsxs(f.Box,{gap:r==="horizontal"?"spacing-96":"sm",direction:r==="horizontal"?"row":"column",onClick:o.onClickContainer,children:[o.title&&e.jsx(oe,{condition:!!o.inputProps.required,fallback:e.jsxs(f.Box,{direction:"column",customMaxWidth:c,fullWidth:s,children:[e.jsx(ce,{children:o.title}),e.jsx(w.Text,{fontSize:t,color:"gray-500",children:o.description})]}),children:e.jsxs(f.Box,{direction:"column",customMaxWidth:c,fullWidth:s,children:[e.jsxs(ne.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(ce,{fontSize:t,children:o.title}),e.jsx(ce,{color:"error",fontSize:t,children:n}),e.jsx(oe,{condition:!!((l=o.tooltip)!=null&&l.label),children:e.jsx(Ce.Tooltip,{label:(a=o.tooltip)==null?void 0:a.label,arrowPosition:(d=o.tooltip)==null?void 0:d.arrowPosition,...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(oe,{condition:!!o.description,children:e.jsx(w.Text,{fontSize:t,color:"gray-500",children:o.description})})]})}),e.jsxs(ne.Flex,{direction:"column",gap:"xs",children:[e.jsx(f.Box,{direction:"column",style:{width:r==="horizontal"&&o.customWidth?o.customWidth:r==="horizontal"?"343px":""},children:e.jsx($e.StarasiaDate,{size:t,...o.inputProps,status:o.errorMessage?"error":void 0})}),!i&&o.errorMessage&&e.jsx(Ze,{message:o.errorMessage})]})]})};async function Di(t,r){const n=new Image;n.src=t,await new Promise((i,c)=>{n.onload=i,n.onerror=c});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,c)=>{s.toBlob(l=>{if(!l)return c("Canvas is empty");const a=new File([l],"cropped.png",{type:"image/png"});i(a)},"image/png")})}const $r={"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},Vn=u.forwardRef(({handleUpload:t,urlImage:r,isUploading:n,croppedImage:s,setCroppedImage:o,size:i="96",aspect:c="1:1",containerProps:l,maxFileSize:a=2,onError:d},h)=>{const g=ge.useMediaQuery("md"),[m,j]=u.useState(!1),[E,y]=u.useState(null),[M,k]=u.useState(!1),[L,C]=u.useState({x:0,y:0}),[b,A]=u.useState(1),[W,v]=u.useState(null);u.useEffect(()=>{r===null&&o(null)},[r]);const F=u.useCallback((Z,Q)=>{v(Q)},[]),z=Z=>{var ie;const Q=(ie=Z.target.files)==null?void 0:ie[0];if(!Q)return;const ae=new FileReader;ae.onload=()=>{y(ae.result),k(!0)},ae.readAsDataURL(Q)},R=async()=>{if(!(!E||!W))try{const Z=await Di(E,W);if(a&&Z.size>a*1024*1024){d==null||d(`Ukuran file maksimal ${a}MB`);return}t==null||t(Z);const Q=URL.createObjectURL(Z);o(Q,Z),k(!1)}catch{d==null||d("Gagal memproses gambar")}},_=u.useRef(null),J=()=>{_.current&&_.current.click()};u.useImperativeHandle(h,()=>({openFileDialog:()=>{var Z;(Z=_.current)==null||Z.click()}}));const te=parseInt(i,10),xe=$r[c];let he,se;return xe>=1?(se=te,he=te*xe):(he=te,se=te/xe),e.jsxs(f.Box,{direction:"column",display:"flex",position:"relative",bg:(l==null?void 0:l.bg)||"gray-200",borderStyle:(l==null?void 0:l.borderStyle)||"border-none",borderColor:(l==null?void 0:l.borderColor)||"gray-200",borderWidth:(l==null?void 0:l.borderWidth)||"border-2",borderRadius:(l==null?void 0:l.borderRadius)||"rounded-md",overflow:"overflow-hidden",align:"center",justify:"center",style:{width:l!=null&&l.fullWidth?"100%":`${he}px`,height:l!=null&&l.fullWidth?"auto":`${se}px`,aspectRatio:xe,flexShrink:0},onMouseEnter:()=>j(!0),onMouseLeave:()=>j(!1),children:[s||r?e.jsx("img",{src:s||r||void 0,alt:"Profile",style:{objectFit:"cover",width:"100%",height:"100%"}}):e.jsx(f.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(f.Box,{direction:"column",position:"absolute",display:"flex",align:"center",justify:"center",cursor:"pointer",style:{inset:0,backgroundColor:"var(--sa-color-black-alpha-a30, #080f214a)",opacity:m?1:0,transition:"opacity 0.3s ease-in-out"},onClick:J,children:[e.jsx("input",{ref:_,type:"file",accept:"image/*",onChange:z,disabled:n,style:{display:"none"}}),e.jsxs(f.Box,{display:"flex",align:"center",gap:"spacing-2",direction:"row",children:[e.jsx(B.Icon,{name:"Edit3",style:{color:"var(--sa-background-primary, #ffffff)"}}),e.jsx(oe,{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(f.Box,{direction:"column",position:"absolute",display:"flex",align:"center",justify:"center",style:{inset:0,zIndex:20,backgroundColor:"var(--sa-color-white-alpha-a80, #e5e9f640)"},children:e.jsx(f.Box,{direction:"column",borderRadius:"rounded-full",style:{animation:"spin 1s linear infinite",border:"2px solid transparent",height:"2rem",width:"2rem"},borderColor:"info-600"})}),M&&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:()=>k(!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?c==="1:1"?"min(90vw, 480px)":`min(90vw, ${he*2}px)`:"calc(100vw - 2rem)",display:"flex",flexDirection:"column"},onClick:Z=>Z.stopPropagation(),children:[e.jsx("div",{style:{position:"relative",width:"100%",height:"20rem",backgroundColor:"var(--sa-color-gray-100)"},children:E&&e.jsx(oo,{image:E,crop:L,zoom:b,aspect:c?$r[c]:void 0,onCropChange:C,onZoomChange:A,onCropComplete:F,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(V.Button,{size:"sm",secondary:!0,onClick:()=>k(!1),children:"Cancel"}),e.jsx(V.Button,{size:"sm",primary:!0,onClick:R,children:"Crop"})]})]})}),document.body)]})}),Si=({size:t="md",direction:r="vertical",requiredTitle:n="(Required)",fullWidth:s=!1,required:o=!1,...i})=>{var a,d,h;const c=i.hideMessageError||!1,l=r==="horizontal"?t==="sm"?342:t==="lg"?400:342:void 0;return e.jsxs(f.Box,{gap:r==="horizontal"?"spacing-96":"sm",direction:r==="horizontal"?"row":"column",...i.containerProps,children:[i.title&&e.jsx(oe,{condition:!!o,fallback:e.jsxs(f.Box,{direction:"column",customMaxWidth:l,fullWidth:s,children:[e.jsx(ce,{children:i.title}),e.jsx(w.Text,{fontSize:t,color:"gray-500",children:i.description})]}),children:e.jsxs(f.Box,{direction:"column",customMaxWidth:l,fullWidth:s,children:[e.jsxs(ne.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(ce,{fontSize:t,children:i.title}),e.jsx(ce,{color:"error",fontSize:t,children:n}),e.jsx(oe,{condition:!!((a=i.tooltip)!=null&&a.label),children:e.jsx(Ce.Tooltip,{label:(d=i.tooltip)==null?void 0:d.label,arrowPosition:(h=i.tooltip)==null?void 0:h.arrowPosition,...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(oe,{condition:!!i.description,children:e.jsx(w.Text,{fontSize:t,color:"gray-500",children:i.description})})]})}),e.jsxs(ne.Flex,{direction:"column",gap:"xs",children:[e.jsx(Vn,{...i.inputProps}),!c&&i.errorMessage&&e.jsx(Ze,{message:i.errorMessage})]})]})},ki=({size:t="md",direction:r="vertical",requiredTitle:n="(Required)",fullWidth:s=!1,...o})=>{var c,l,a;const i=r==="horizontal"?t==="sm"?342:t==="lg"?400:342:void 0;return e.jsxs(f.Box,{gap:r==="horizontal"?"spacing-96":"sm",direction:r==="horizontal"?"row":"column",...o.containerProps,children:[o.title&&e.jsx(oe,{condition:!!o.inputProps.required,fallback:e.jsxs(f.Box,{direction:"column",customMaxWidth:i,fullWidth:s,children:[e.jsx(ce,{children:o.title}),e.jsx(w.Text,{fontSize:t,color:"gray-500",children:o.description})]}),children:e.jsxs(f.Box,{direction:"column",customMaxWidth:i,fullWidth:s,children:[e.jsxs(ne.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(ce,{fontSize:t,children:o.title}),e.jsx(ce,{color:"error",fontSize:t,children:n}),e.jsx(oe,{condition:!!((c=o.tooltip)!=null&&c.label),children:e.jsx(Ce.Tooltip,{label:(l=o.tooltip)==null?void 0:l.label,arrowPosition:(a=o.tooltip)==null?void 0:a.arrowPosition,...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(oe,{condition:!!o.description,children:e.jsx(w.Text,{fontSize:t,color:"gray-500",children:o.description})})]})}),o.inputProps.extended&&o.inputProps.extended]})},Bi=({items:t,id:r,handleOnUpdate:n,width:s,toggleShow:o=!0,disabled:i=!1})=>{var h;const[c,l]=u.useState([]);u.useEffect(()=>{t&&l([...t.map(g=>({id:g.id,isActive:g.isActive}))])},[t]);const a=(h=c.find(g=>g.id===r))==null?void 0:h.isActive,d=u.useCallback(()=>{l(g=>g.map(m=>m.id===r?{...m,isActive:!m.isActive}:m)),n&&n(!a)},[r,n,a]);return e.jsx(f.Box,{direction:"row",gap:"md",style:{width:s},children:o&&e.jsx(it.Toggle,{disabled:i,checked:a,onChange:d,label:a?"Active":"Inactive"})})},Fi={InputText:Ps,InputDropdown:Ns,InputSingleFile:gi,CheckBoxOptions:yi,RadioOptions:pi,InputTextArea:ji,ToggleForm:bi,ActionButton:vi,FormTitle:Ci,InputDate:wi,InputImgFile:Si,Custom:ki},Hn=({customBottom:t})=>{const[r,n]=u.useState(!1),s=()=>{window.scrollY>window.screenY?n(!0):n(!1)},o=()=>{window.scrollTo({top:0,behavior:"smooth"})};return u.useEffect(()=>(window.addEventListener("scroll",s),()=>{window.removeEventListener("scroll",s)}),[]),e.jsx(f.Box,{direction:"column",style:{position:"fixed",bottom:0,right:0},children:e.jsx(f.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(V.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)"}})})})})},ke="sa-sidepanel-item",en="sa-sidepanel-item-styles",Ei="inset 3.5px 0 0 0 var(--sa-border-focused, #1a4fa0)",Mi="inset -3.5px 0 0 0 var(--sa-border-focused, #1a4fa0)",Li=`
|
|
46
|
+
`,document.head.appendChild(t)},Dt=t=>t==="right"?"right":t==="center"?"center":"left",Rs=/^(#|rgb|hsl|var\()/,St=t=>t?Rs.test(t)?t:`var(--sa-background-${t})`:void 0,As=(t,r)=>{if(r)return t[r]},zs=(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)),Vs=({columns:t,data:r,getRowKey:n,rowBg:s,size:o="md",resizable:i=!1,layout:c="auto",widthStorageKey:l,columnState:a,onColumnStateChange:d,columnMenu:h=!1,sort:g,defaultSort:m,onSortChange:j,height:E,mobileLayout:y="cards",mobileBreakpoint:M="md",groupSeparator:k,summary:L,emptyState:C,loading:b=!1,loadingRows:A=8,rowActions:W})=>{Ws();const F=!ge.useMediaQuery(M)&&y!=="scroll",z=!!(W!=null&&W.length),[R,_]=u.useState(null);u.useEffect(()=>{if(!R)return;const p=()=>_(null),D=setTimeout(()=>document.addEventListener("click",p),0);return()=>{clearTimeout(D),document.removeEventListener("click",p)}},[R]);const[J,te]=u.useState(()=>new Set),xe=a!==void 0,[he,se]=u.useState({}),Z=a??he,Q=p=>{d==null||d(p),xe||se(p)},ae=g!==void 0,[ie,ue]=u.useState(m??null),me=ae?g??null:ie,Te=!j,Oe=p=>{j==null||j(p),ae||ue(p)},{headerGroups:Fe,leafColumns:de,hasGroups:fe}=u.useMemo(()=>{var ve;const p=new Set(Z.hidden??[]),D=(re,le)=>re.key??(typeof re.accessor=="string"?re.accessor:`col-${le}`),O=t.map((re,le)=>{var _e;if((_e=re.children)!=null&&_e.length){const Xe=re.children.map((qe,tt)=>({col:qe,key:D(qe,`${le}-${tt}`)})).filter(qe=>!p.has(qe.key));return{col:re,key:re.key??`group-${le}`,isGroup:!0,leaves:Xe}}const je={col:re,key:D(re,`${le}`)};return{col:re,key:je.key,isGroup:!1,leaves:p.has(je.key)?[]:[je]}}).filter(re=>re.leaves.length>0),$=O.some(re=>re.isGroup);let X=O.flatMap(re=>re.leaves);if(!$&&((ve=Z.order)!=null&&ve.length)){const re=new Map(Z.order.map((le,je)=>[le,je]));X=[...X].sort((le,je)=>(re.get(le.key)??1/0)-(re.get(je.key)??1/0))}return{headerGroups:O,leafColumns:X,hasGroups:$}},[t,Z]),We=u.useMemo(()=>new Map(de.map((p,D)=>[p.key,D])),[de]),Ve=!fe&&de.some(p=>(p.col.headerColSpan??1)>1),Ee=de.map(p=>p.key).join("|"),Re=(p,D)=>{const O=p.sortKey??(typeof p.accessor=="string"?p.accessor:void 0);return O?D[O]:void 0},et=p=>p.sortable??(!!p.sortKey||typeof p.accessor=="string"),S=u.useMemo(()=>{if(!Te||!me)return r;const p=de.find(O=>O.key===me.key);if(!p)return r;const D=me.direction==="asc"?1:-1;return[...r].sort((O,$)=>zs(Re(p.col,O),Re(p.col,$))*D)},[r,Te,me,de]),N=!fe&&!Ve,U=!!l&&N,[I,G]=Y.useColumnWidths(l??""),H=U?I:void 0,q=u.useRef(null),[P,pe]=u.useState();u.useLayoutEffect(()=>{pe(void 0)},[Ee]),u.useLayoutEffect(()=>{if(!N||P||!q.current)return;const p=q.current.querySelectorAll("th.sa-tl-leaf");pe(Array.from(p).map(D=>D.offsetWidth))},[P,N]);const[De,He]=u.useState(0);u.useLayoutEffect(()=>{if(!fe||!q.current)return;const p=q.current.querySelector(":scope > tr");p&&He(p.offsetHeight)},[fe,Ee]);const Be=(p,D)=>{if((H==null?void 0:H[D])!=null)return H[D];if(p.width!=null)return p.width;if((P==null?void 0:P[D])!=null)return P[D]},Me=(p,D)=>typeof p.width=="number"?p.width:P==null?void 0:P[D],Ye=Z.frozenKey&&!fe&&!Ve?de.findIndex(p=>p.key===Z.frozenKey):-1,Ge=p=>p<=Ye,Qe=p=>{if(!P)return 0;let D=0;for(let O=0;O<p;O++)D+=P[O]??0;return D},Pe=u.useRef(null),[mt,gt]=u.useState("100vh");u.useLayoutEffect(()=>{if(E!==void 0)return;const p=()=>{if(Pe.current){const D=Pe.current.getBoundingClientRect().top;gt(`calc(100vh - ${D}px)`)}};return p(),window.addEventListener("resize",p),()=>window.removeEventListener("resize",p)},[E]);const Ne=(p,D)=>n?n(p,D):D,Ht=(p,D,O)=>p.render?p.render(D,O,S):As(D,p.accessor),Pt=de.length+(z?1:0),gr=["80%","55%","70%","45%","90%","60%"],Nn=(p,D)=>gr[(p*7+D*3)%gr.length],_n=(p,D)=>e.jsx(ze.Skeleton,{height:14,width:Nn(p,D),borderRadius:"rounded-sm"}),qn=Array.from({length:A},(p,D)=>e.jsxs(Y.Tr,{children:[de.map(({col:O,key:$},X)=>e.jsx(Y.Td,{style:{textAlign:Dt(O.align)},children:_n(D,X)},`sa-tl-sk-${D}-${$}`)),z&&e.jsx(Y.Td,{style:{width:1,padding:0,border:"none"}})]},`sa-tl-sk-${D}`)),Zn=(p,D)=>{D||Q({...Z,hidden:[...Z.hidden??[],p]})},Gn=p=>Q({...Z,frozenKey:Z.frozenKey===p?void 0:p}),yt=p=>(W??[]).filter(D=>{var O;return!((O=D.hidden)!=null&&O.call(D,p))}),yr={position:"absolute",right:0,top:0,bottom:0,display:"flex",alignItems:"center",gap:4,paddingRight:16,paddingLeft:40,background:"linear-gradient(to right, transparent, var(--sa-background-primary-inverse, #f8f8f8) 40px)"},pt=(p,D,O,$)=>{var _e;const X=(_e=p.disabled)==null?void 0:_e.call(p,D),ve=($==null?void 0:$.showLabel)??p.showLabel,re=($==null?void 0:$.size)??"xs",le=e.jsx(V.Button,{size:re,variant:p.variant??"tertiary",tone:p.tone??"neutral",disabled:X,onClick:()=>p.onClick(D,O),iconLeft:p.icon?e.jsx(B.Icon,{name:p.icon,size:"sm"}):void 0,children:ve&&p.label}),je=p.tooltip;return je?e.jsx(Ce.Tooltip,{label:je,position:"top-end",children:le}):le},Qn=(p,D)=>{const O=yt(p);if(!O.length)return null;if(O.length>5){const X=Ne(p,D),ve=(R==null?void 0:R.rowKey)===X;return e.jsx("div",{className:"sa-tl-row-actions",style:yr,onClick:re=>re.stopPropagation(),children:e.jsx(Ce.Tooltip,{label:"Aksi lainnya",position:"top",children:e.jsx(V.Button,{size:"xs",variant:"tertiary",onClick:re=>{const le=re.currentTarget.getBoundingClientRect();_(ve?null:{rowKey:X,top:le.bottom+4,right:window.innerWidth-le.right})},children:e.jsx(B.Icon,{name:"MenuVertical",size:"sm"})})})})}return e.jsx("div",{className:"sa-tl-row-actions",style:yr,children:O.map(X=>e.jsx(u.Fragment,{children:pt(X,p,D)},X.key))})},Un=(p,D)=>{const O=yt(p);return O.length?e.jsx("div",{style:{display:"flex",gap:6,flexWrap:"wrap",paddingTop:8,marginTop:8,borderTop:Ct},children:O.map($=>e.jsx(u.Fragment,{children:pt($,p,D,{showLabel:!0,size:"sm"})},$.key))}):null},Jn=(p,D)=>{const O=yt(p);return O.length?e.jsx("div",{style:{display:"flex",gap:4,paddingRight:8,flexShrink:0},children:O.map($=>e.jsx(u.Fragment,{children:pt($,p,D,{showLabel:!1})},$.key))}):null},Nt=(p,D)=>{const{col:O,key:$}=p,X=We.get($)??0,ve=Ge(X),re=ve&&X===Ye,le=(me==null?void 0:me.key)===$?me.direction:null,je=h&&!O.disableMenu?e.jsx(Rn,{active:!!le||ve,canSort:et(O),canHide:!O.locked,sortDir:le,frozen:ve,onSort:tt=>Oe({key:$,direction:tt}),onClearSort:()=>Oe(null),onToggleFreeze:()=>Gn($),onHide:()=>Zn($,O.locked)}):null,_e=O.align==="right",Xe=O.align==="right"?"flex-end":O.align==="center"?"center":"flex-start",qe=e.jsxs("span",{style:{flex:1,minWidth:0,display:"flex",alignItems:"center",gap:6,justifyContent:Xe,overflow:"hidden"},children:[O.icon&&e.jsx(B.Icon,{name:O.icon,size:"sm",style:{flexShrink:0}}),e.jsx("span",{style:wt,children:O.title})]});return e.jsx(Y.Th,{className:`sa-tl-leaf${ve?" sa-tl-frozen":""}`,rowSpan:D==null?void 0:D.rowSpan,colSpan:D==null?void 0:D.colSpan,minWidth:O.minWidth,resizable:N?O.resizable:!1,defaultWidth:Me(O,X),style:{textAlign:Dt(O.align),width:Be(O,X),position:"sticky",top:(D==null?void 0:D.top)??0,left:ve?Qe(X):void 0,zIndex:ve?3:2,backgroundColor:at,boxShadow:re?Xr:void 0},children:e.jsx("div",{style:{display:"flex",alignItems:"center",gap:6,width:"100%"},children:_e?e.jsxs(e.Fragment,{children:[je,qe]}):e.jsxs(e.Fragment,{children:[qe,je]})})},`th-${$}`)},Yn=()=>{const p=[];for(let D=0;D<de.length;){const O=de[D],$=O.col.headerColSpan??1,X=Math.max(1,Math.min($,de.length-D));p.push(Nt(O,X>1?{colSpan:X}:void 0)),D+=X}return p},_t=de.filter(p=>!p.col.hideOnMobile),qt=_t.find(p=>p.col.primary)??_t[0],Xn=_t.filter(p=>p!==qt),Kn=p=>te(D=>{const O=new Set(D);return O.has(p)?O.delete(p):O.add(p),O}),pr=(p,D)=>Xn.map(({col:O,key:$})=>{const X=Ht(O,p,D),ve=typeof X=="string"||typeof X=="number"?e.jsx(w.Text,{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",textAlign:"right"},children:X}):e.jsx("div",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",textAlign:"right"},children:X});return e.jsxs("div",{style:{display:"flex",gap:12,justifyContent:"space-between",alignItems:"baseline"},children:[typeof O.title=="string"?e.jsx(w.Text,{color:"subtle",fontWeight:"medium",style:{color:Os,flexShrink:0},children:O.title}):e.jsx("div",{style:{flexShrink:0},children:O.title}),ve]},$)}),jr=(p,D)=>{const O=qt?Ht(qt.col,p,D):null;return typeof O=="string"||typeof O=="number"?e.jsx(w.Text,{as:"span",style:wt,children:O}):e.jsx("span",{style:wt,children:O})},$n=e.jsx(f.Box,{style:{display:"flex",flexDirection:"column",gap:8,padding:8},children:Array.from({length:A},(p,D)=>e.jsxs(f.Box,{style:{border:Ct,borderRadius:"var(--sa-radii-sm, 6px)",padding:12,display:"flex",flexDirection:"column",gap:8},children:[e.jsx(ze.Skeleton,{height:16,width:"60%",borderRadius:"rounded-sm"}),e.jsx(ze.Skeleton,{height:12,width:"85%",borderRadius:"rounded-sm"}),e.jsx(ze.Skeleton,{height:12,width:"70%",borderRadius:"rounded-sm"})]},`sa-tl-sk-card-${D}`))}),br=e.jsx(f.Box,{fullWidth:!0,style:{minHeight:(C==null?void 0:C.minHeight)??320,display:"flex",alignItems:"center",justifyContent:"center",padding:16},children:C==null?void 0:C.content}),eo=b?$n:S.length===0?br:y==="expand"?e.jsx(f.Box,{style:{display:"flex",flexDirection:"column"},children:S.map((p,D)=>{const O=Ne(p,D),$=J.has(O),X=St(s==null?void 0:s(p,D));return e.jsxs("div",{style:{borderBottom:Ct,backgroundColor:X},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[e.jsxs("button",{type:"button",onClick:()=>Kn(O),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:[jr(p,D),e.jsx(B.Icon,{name:$?"ChevronUp":"ChevronDown",size:"sm",style:{flexShrink:0}})]}),z&&Jn(p,D)]}),$&&e.jsx("div",{style:{padding:"0 12px 12px",display:"flex",flexDirection:"column",gap:6},children:pr(p,D)})]},O)})}):e.jsx(f.Box,{style:{display:"flex",flexDirection:"column",gap:8,padding:8},children:S.map((p,D)=>e.jsxs(f.Box,{style:{border:Ct,borderRadius:"var(--sa-radii-sm, 6px)",padding:12,display:"flex",flexDirection:"column",gap:6,backgroundColor:St(s==null?void 0:s(p,D))},children:[jr(p,D),pr(p,D),z&&Un(p,D)]},Ne(p,D)))}),to=i&&N&&P!==void 0,vr=c==="fixed"&&!i&&(N?P!==void 0:!0),ro=vr&&!N,no=e.jsxs(Y.Table,{className:"sa-table-layout",fullWidth:!0,size:o,resizable:to,style:vr?{tableLayout:"fixed"}:void 0,onWidthsChange:U?G:void 0,children:[ro&&e.jsxs("colgroup",{children:[de.map(({col:p,key:D},O)=>e.jsx("col",{style:{width:Be(p,O)}},`col-${D}`)),z&&e.jsx("col",{style:{width:1}})]}),e.jsx(Y.Thead,{ref:q,children:fe?e.jsxs(e.Fragment,{children:[e.jsxs(Y.Tr,{children:[Fe.map(p=>p.isGroup?e.jsx(Y.Th,{colSpan:p.leaves.length,style:{textAlign:"center",position:"sticky",top:0,zIndex:2,backgroundColor:at},children:e.jsx("span",{style:wt,children:p.col.title})},`grp-${p.key}`):Nt(p.leaves[0],{rowSpan:2})),z&&e.jsx(Y.Th,{rowSpan:2,style:{position:"sticky",top:0,right:0,zIndex:3,width:1,padding:0,border:"none",backgroundColor:at}})]}),e.jsx(Y.Tr,{children:Fe.flatMap(p=>p.isGroup?p.leaves.map(D=>Nt(D,{top:De})):[])})]}):e.jsxs(Y.Tr,{children:[Yn(),z&&e.jsx(Y.Th,{style:{position:"sticky",top:0,right:0,zIndex:3,width:1,padding:0,border:"none",backgroundColor:at}})]})}),e.jsx(Y.Tbody,{children:b?qn:S.length===0?e.jsx(Y.Tr,{children:e.jsx(Y.Td,{colSpan:Pt,children:br})}):e.jsxs(e.Fragment,{children:[S.map((p,D)=>{const O=k==null?void 0:k(p,D,D>0?S[D-1]:void 0),$=St(s==null?void 0:s(p,D));return e.jsxs(u.Fragment,{children:[O!=null&&O!==!1&&e.jsx(Y.Tr,{children:e.jsx(Y.Td,{colSpan:Pt,style:{backgroundColor:at},children:O})}),e.jsxs(Y.Tr,{children:[de.map(({col:X,key:ve},re)=>{var Cr;const le=(Cr=X.cellProps)==null?void 0:Cr.call(X,p,D,S);if(le!=null&&le.hidden)return null;const je=Ge(re),_e=je&&re===Ye,Xe=Ht(X,p,D),qe=typeof X.bg=="function"?X.bg(p,D,S):X.bg,tt=St(qe)??$;return e.jsx(Y.Td,{className:je?"sa-tl-frozen":void 0,colSpan:le==null?void 0:le.colSpan,rowSpan:le==null?void 0:le.rowSpan,style:{textAlign:Dt(X.align),width:Be(X,re),minWidth:X.minWidth,position:je?"sticky":void 0,left:je?Qe(re):void 0,zIndex:je?1:void 0,boxShadow:_e?Xr:void 0,...tt?{"--sa-tl-bg":tt}:{}},children:typeof Xe=="string"?e.jsx(w.Text,{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",textAlign:Dt(X.align)},children:Xe}):Xe},`tl-cell-${D}-${ve}`)}),z&&e.jsx(Y.Td,{style:{position:"sticky",right:0,width:1,padding:0,overflow:"visible",zIndex:2,border:"none"},children:Qn(p,D)})]})]},Ne(p,D))}),L!=null&&e.jsx(Y.Tr,{children:e.jsx(Y.Td,{colSpan:Pt,children:L})})]})})]}),Zt=R?S.findIndex((p,D)=>Ne(p,D)===R.rowKey):-1,Gt=Zt>=0?S[Zt]:null;return e.jsxs(e.Fragment,{children:[e.jsx(f.Box,{ref:Pe,fullWidth:!0,style:{overflow:"auto",height:E??mt},children:F?eo:no}),R&&Gt&&e.jsx("div",{className:"sa-tl-kebab-menu",style:{top:R.top,right:R.right},onClick:p=>p.stopPropagation(),children:yt(Gt).map(p=>e.jsx("div",{style:{padding:"2px 4px"},children:pt(p,Gt,Zt,{showLabel:!0,size:"sm"})},p.key))})]})},$t=t=>t==="asc"||t==="desc",Hs=(t={})=>{const{sortKeyParam:r="sortBy",sortOrderParam:n="sortOrder",pageKey:s="page",defaultSort:o=null,paramKeys:i,scopeId:c,storage:l=mr}=t,{searchParams:a,setSearchParams:d,searchQueries:h}=Se(),g=a.toString(),m=c?ct.tableSort(c):void 0,j=u.useRef(!1);u.useEffect(()=>{if(j.current||(j.current=!0,!m)||a.has(r)||a.has(n))return;const C=l.get(m);!(C!=null&&C.key)||!$t(C.direction)||d({...Object.fromEntries(a.entries()),[r]:C.key,[n]:C.direction})},[]);const E=u.useMemo(()=>{const C=a.get(r),b=a.get(n);return C&&$t(b)?{key:C,direction:b}:o},[g,r,n,o]);u.useEffect(()=>{if(!m)return;const C=a.get(r),b=a.get(n);C&&$t(b)?l.set(m,{key:C,direction:b}):l.remove(m)},[g,m,r,n,l]);const y=(i==null?void 0:i.sortBy)??"sortBy",M=(i==null?void 0:i.sortOrder)??"sortOrder",k=u.useMemo(()=>E?{[y]:E.key,[M]:E.direction}:{},[E,y,M]),L=u.useCallback(C=>{const b={...h};C?(b[r]=C.key,b[n]=C.direction):(delete b[r],delete b[n]),delete b[s],d(b)},[h,r,n,s,d]);return{sort:E,setSort:L,params:k}},Wt=({of:t,render:r})=>u.Children.toArray(t==null?void 0:t.map((n,s,o)=>r(n,s,o))),oe=({condition:t,fallback:r,children:n,loading:s,isLoading:o})=>e.jsx(e.Fragment,{children:o?s:t?n:r}),ce=t=>e.jsx(w.Text,{...t,fontFamily:"Poppins",fontSize:t.fontSize||"md",fontWeight:t.fontWeight||"medium",color:t.color||"gray-700",children:t.children}),Ze=t=>e.jsx(w.Text,{color:"red-600",fontSize:"sm",children:t.message}),Ps=({size:t="md",direction:r="vertical",requiredTitle:n="(Required)",fullWidth:s=!1,...o})=>{var l,a,d;const i=o.hideMessageError||!1,c=r==="horizontal"?t==="sm"?342:t==="lg"?400:342:void 0;return e.jsxs(f.Box,{gap:r==="horizontal"?"spacing-96":"sm",direction:r==="horizontal"?"row":"column",...o.containerProps,children:[o.title&&e.jsx(oe,{condition:!!o.inputProps.required,fallback:e.jsxs(f.Box,{direction:"column",customMaxWidth:c,fullWidth:s,children:[e.jsx(ce,{children:o.title}),e.jsx(w.Text,{fontSize:t,color:"gray-500",children:o.description})]}),children:e.jsxs(f.Box,{direction:"column",customMaxWidth:c,fullWidth:s,children:[e.jsxs(ne.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(ce,{fontSize:t,children:o.title}),e.jsx(ce,{color:"error",fontSize:t,children:n}),e.jsx(oe,{condition:!!((l=o.tooltip)!=null&&l.label),children:e.jsx(Ce.Tooltip,{label:(a=o.tooltip)==null?void 0:a.label,arrowPosition:(d=o.tooltip)==null?void 0:d.arrowPosition,...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(oe,{condition:!!o.description,children:e.jsx(w.Text,{fontSize:t,color:"gray-500",children:o.description})})]})}),e.jsxs(f.Box,{direction:"column",gap:"xs",fullWidth:o.inputProps.fullWidth||!1,children:[e.jsx(Je.Input,{ref:o.inputRef,size:t,...o.inputProps,status:o.errorMessage?"error":"default",fullWidth:!0}),!i&&o.errorMessage&&e.jsx(Ze,{message:o.errorMessage}),o.inputProps.extended&&o.inputProps.extended]})]})},Ns=({size:t="md",direction:r="vertical",requiredTitle:n="(Required)",fullWidth:s=!1,...o})=>{var l,a,d;const i=o.hideMessageError||!1,c=r==="horizontal"?t==="sm"?342:t==="lg"?400:342:void 0;return e.jsxs(f.Box,{gap:r==="horizontal"?"spacing-96":"sm",direction:r==="horizontal"?"row":"column",onClick:o.onClickContainer,children:[o.title&&e.jsx(oe,{condition:!!o.inputProps.required,fallback:e.jsxs(f.Box,{direction:"column",customMaxWidth:c,fullWidth:s,children:[e.jsx(ce,{children:o.title}),e.jsx(w.Text,{fontSize:t,color:"gray-500",children:o.description})]}),children:e.jsxs(f.Box,{direction:"column",customMaxWidth:c,fullWidth:s,children:[e.jsxs(ne.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(ce,{fontSize:t,children:o.title}),e.jsx(ce,{color:"error",fontSize:t,children:n}),e.jsx(oe,{condition:!!((l=o.tooltip)!=null&&l.label),children:e.jsx(Ce.Tooltip,{label:(a=o.tooltip)==null?void 0:a.label,arrowPosition:(d=o.tooltip)==null?void 0:d.arrowPosition,...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(oe,{condition:!!o.description,children:e.jsx(w.Text,{fontSize:t,color:"gray-500",children:o.description})})]})}),e.jsxs(f.Box,{direction:"column",gap:"xs",fullWidth:o.inputProps.fullWidth||!1,children:[e.jsx(f.Box,{direction:"column",style:{width:o.inputProps.fullWidth?"100%":r==="horizontal"&&o.customWidth?o.customWidth:r==="horizontal"?"343px":""},children:e.jsx(ot.Dropdown,{size:t,...o.inputProps,error:!!o.errorMessage})}),!i&&o.errorMessage&&e.jsx(Ze,{message:o.errorMessage}),o.inputProps.extended&&o.inputProps.extended]})]})},_s=(t,r)=>typeof t=="string"&&t||r==="error"?"var(--sa-border-danger)":"var(--sa-border-subtle)",qs=t=>{var l;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)},c=a=>{a.preventDefault(),n(!1)};return e.jsxs(f.Box,{width:"width-full",paddingInline:"md",direction:"row",gap:"sm",align:"center",onClick:t.handleOnClick,onDragOver:s,onDrop:o,onDragEnter:i,onDragLeave:c,paddingBlock:"md",borderRadius:"rounded-md",style:{border:r?"1px solid var(--sa-border-info)":`1px solid ${_s(t.errorMessage,t.status)}`},children:[e.jsx(B.Icon,{name:"Upload",size:"lg",style:{width:30,height:30}}),e.jsxs(ne.Flex,{direction:"column",gap:"xs",children:[e.jsxs(ne.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:(l=t.fileSupports)==null?void 0:l.map(a=>a.toLocaleUpperCase()).join(", ")})]})]})};function Zs(t){return t.split(" ").map(r=>r[0]).join("").slice(0,2).toUpperCase()}const An=t=>{const r={day:"2-digit",month:"short",year:"numeric"};return t.toLocaleDateString("id-ID",r)},Gs=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 Qs(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 Us=t=>{const r=t.split(" ");let n=r[0].charAt(0);return r.length>1&&(n+=""+r[1].charAt(0)),n.toUpperCase()};function Js(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 Ys="sa-admin",Ae=t=>`var(--${Ys}-${t})`,Xs={base:{borderColor:Ae("base-border-color"),textColor:Ae("base-text-color"),iconColor:Ae("base-icon-color"),placeholderColor:Ae("base-placeholder-color")},document:{bgColor:Ae("document-bg-color")},sidebar:{bgColor:Ae("sidebar-bg-color"),borderColor:Ae("sidebar-border-color"),maxWidth:Ae("sidebar-max-width"),width:Ae("sidebar-width"),collapseWidth:Ae("sidebar-collapse-width"),collapseV2Width:Ae("sidebar-v2-collapse-width")}},Ks=24*60*60*1e3,$s=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))},ei=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,ti=/--+/,ri=/-$/;function ni(t,r){return JSON.stringify(t)!==JSON.stringify(r)}function oi(t){return/^(?:\+62|62|0)8[1-9][0-9]{7,10}$/.test(t)}function si(t){return/^[A-Za-z\s]+$/.test(t)}const ii=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()},li=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()},ci=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()},ai=t=>ei.test(t);function di(t){return!(ti.test(t)||ri.test(t))}const ui=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()},xi=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 hi(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 fi(t){const r=t.split("/");return r[r.length-1]}const mi=t=>{var r,n;return e.jsxs(f.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(ne.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(ne.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?fi(t.defaultFile.url):(r=t.fileSelected)==null?void 0:r.name}),t.defaultFile?(t.defaultFile.size||t.defaultFile.date)&&e.jsxs(ne.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(B.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(ne.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(w.Text,{fontSize:"sm",fontWeight:"medium",children:hi(((n=t.fileSelected)==null?void 0:n.size.toString())||"100000")}),e.jsx(B.Icon,{name:"Dot",size:"xs"}),e.jsx(w.Text,{fontSize:"sm",fontWeight:"medium",style:{textWrap:"nowrap"},children:An(new Date)})]})]})]}),e.jsx(V.Button,{size:"xs",variant:"tertiary",tone:"error",type:"button",onClick:s=>{s.stopPropagation(),t.handleOnDeleteFile()},iconLeft:e.jsx(B.Icon,{name:"Trash1"})})]})},zn=({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=ge.useMediaQuery("md"),c=t==="error"||typeof n.errorMessage=="string"&&!!n.errorMessage,l=n.label?e.jsxs(ne.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:"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:j=>{var E;return n.handleOnChangeFile(((E=j.target.files)==null?void 0:E.item(0))||null)},accept:(m=n.fileSupportOption)==null?void 0:m.map(j=>"."+(j==null?void 0:j.toLowerCase())).join(", ")}),g=e.jsxs(f.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(mi,{fileSelected:n.fileSelected,defaultFile:n.defaultFile,handleOnDeleteFile:n.handleOnDeleteFile,handleOnClickFile:o}),!n.fileSelected&&!n.defaultFile&&e.jsx(qs,{fileSupports:n.fileSupportOption,isDesktop:i,errorMessage:c?n.errorText||n.errorMessage||" ":void 0,status:c?"error":"default",handleOnClick:o,handleOnFileChange:n.handleOnChangeFile})]});return r==="outside-left"?e.jsxs(ne.Flex,{direction:"row",align:"flex-start",gap:"sm",style:{width:"100%"},children:[e.jsxs(ne.Flex,{direction:"column",gap:"xs",style:{width:"40%",minWidth:"120px",paddingTop:"10px"},children:[l,a]}),e.jsxs(ne.Flex,{direction:"column",gap:"sm",style:{flex:1,minWidth:0},children:[g,d]})]}):e.jsxs(ne.Flex,{direction:"column",gap:"sm",style:{width:"100%"},children:[l,a,g,d]})},gi=({size:t="md",direction:r="vertical",requiredTitle:n="(Required)",fullWidth:s=!1,...o})=>{var l,a,d;const i=o.hideMessageError||!1,c=r==="horizontal"?t==="sm"?342:t==="lg"?400:342:void 0;return e.jsxs(f.Box,{gap:r==="horizontal"?"spacing-96":"sm",direction:r==="horizontal"?"row":"column",...o.containerProps,children:[o.title&&e.jsx(oe,{condition:!!o.inputProps.required,fallback:e.jsxs(f.Box,{direction:"column",customMaxWidth:c,fullWidth:s,children:[e.jsx(ce,{children:o.title}),e.jsx(w.Text,{fontSize:t,color:"gray-500",children:o.description})]}),children:e.jsxs(f.Box,{direction:"column",customMaxWidth:c,fullWidth:s,children:[e.jsxs(ne.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(ce,{fontSize:t,children:o.title}),e.jsx(ce,{color:"error",fontSize:t,children:n}),e.jsx(oe,{condition:!!((l=o.tooltip)!=null&&l.label),children:e.jsx(Ce.Tooltip,{label:(a=o.tooltip)==null?void 0:a.label,arrowPosition:(d=o.tooltip)==null?void 0:d.arrowPosition,...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(oe,{condition:!!o.description,children:e.jsx(w.Text,{fontSize:t,color:"gray-500",children:o.description})})]})}),e.jsxs(ne.Flex,{direction:"column",gap:"xs",children:[e.jsx(zn,{...o.inputProps,status:o.errorMessage?"error":"default"}),!i&&o.errorMessage&&e.jsx(Ze,{message:o.errorMessage})]})]})},yi=({size:t="md",direction:r="vertical",requiredTitle:n="(Required)",fullWidth:s=!1,required:o=!1,...i})=>{var a,d,h,g;const c=i.hideMessageError||!1,l=r==="horizontal"?t==="sm"?342:t==="lg"?400:342:void 0;return e.jsxs(f.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(oe,{condition:!!o,fallback:e.jsxs(f.Box,{direction:"column",customMaxWidth:l,fullWidth:s,children:[e.jsx(ce,{children:i.title}),e.jsx(Ie.Body3,{props:{color:"gray-500"},children:i.description})]}),children:e.jsxs(f.Box,{direction:"column",customMaxWidth:l,fullWidth:s,children:[e.jsxs(ne.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(ce,{fontSize:t,children:i.title}),e.jsx(ce,{color:"error",fontSize:t,children:n}),e.jsx(oe,{condition:!!((a=i.tooltip)!=null&&a.label),children:e.jsx(Ce.Tooltip,{label:(d=i.tooltip)==null?void 0:d.label,arrowPosition:(h=i.tooltip)==null?void 0:h.arrowPosition,...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(oe,{condition:!!i.description,children:e.jsx(w.Text,{fontSize:t,color:"gray-500",children:i.description})})]})}),e.jsx(f.Box,{gap:r==="horizontal-inline"?"xl":"md",direction:r==="horizontal-inline"?"row":"column",align:"flex-start",children:e.jsx(Wt,{of:(g=i.checkBoxesList)==null?void 0:g.map(m=>({...m,isChecked:i.checkBoxesAreChecked.includes(m.id)})),render:m=>m.renderBadge?e.jsxs(f.Box,{direction:"row",justify:"space-between",gap:"lg",...i.badgeContainerProps,children:[e.jsx(lt.Checkbox,{name:m.name,value:m.id,checked:m.isChecked,onChange:j=>i.onChecked(j.target.value,m),label:m.name,description:m.description}),m.renderBadge]}):e.jsx(lt.Checkbox,{name:m.name,value:m.id,checked:m.isChecked,onChange:j=>i.onChecked(j.target.value,m),label:m.name,description:m.description})})}),!c&&i.errorMessage&&e.jsx(Ze,{message:i.errorMessage})]})},pi=({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(f.Box,{gap:t==="horizontal-inline"||t==="horizontal-block"?"spacing-96":"sm",direction:t==="horizontal-inline"||t==="horizontal-block"?"row":"column",children:[e.jsx(oe,{condition:!!s.description||!!s.title,children:e.jsxs(f.Box,{direction:"column",customMaxWidth:o,fullWidth:n,children:[s.title&&e.jsx(ce,{children:s.title}),e.jsx(oe,{condition:!!s.description,children:e.jsx(w.Text,{color:"gray-500",children:s.description})})]})}),e.jsx(f.Box,{gap:"sm",direction:t==="horizontal"||t==="horizontal-inline"?"row":"column",align:"flex-start",flexWrap:"wrap",children:e.jsx(Wt,{of:(i=s.radioList)==null?void 0:i.map(c=>({...c,isChecked:s.radioIsChecked===c.id})),render:({value:c,id:l,isChecked:a,subInput:d,label:h,description:g})=>e.jsxs(f.Box,{direction:"column",gap:"xs",customMaxWidth:o,children:[e.jsx(nr.Radio,{id:`${l.toString()}-${c}`,name:s.groupName||h,label:h,value:c,checked:a,onChange:m=>s.onChecked({id:l,label:m.target.name,value:m.target.value}),disabled:s.disableAll},l),g&&e.jsx(w.Text,{color:"gray-500",style:{marginLeft:28},children:g}),d]})})}),s.errorMessage&&e.jsx(Ze,{message:s.errorMessage})]})},ji=({size:t="md",direction:r="vertical",requiredTitle:n="(Required)",fullWidth:s=!1,...o})=>{var l,a,d;const i=o.hideMessageError||!1,c=r==="horizontal"?t==="sm"?342:t==="lg"?400:342:void 0;return e.jsxs(f.Box,{gap:r==="horizontal"?"spacing-96":"sm",direction:r==="horizontal"?"row":"column",...o.containerProps,children:[o.title&&e.jsx(oe,{condition:!!o.inputProps.required,fallback:e.jsxs(f.Box,{direction:"column",customMaxWidth:c,fullWidth:s,children:[e.jsx(ce,{children:o.title}),e.jsx(w.Text,{fontSize:t,color:"gray-500",children:o.description})]}),children:e.jsxs(f.Box,{direction:"column",customMaxWidth:c,fullWidth:s,children:[e.jsxs(ne.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(ce,{fontSize:t,children:o.title}),e.jsx(ce,{color:"error",fontSize:t,children:n}),e.jsx(oe,{condition:!!((l=o.tooltip)!=null&&l.label),children:e.jsx(Ce.Tooltip,{label:(a=o.tooltip)==null?void 0:a.label,arrowPosition:(d=o.tooltip)==null?void 0:d.arrowPosition,...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(oe,{condition:!!o.description,children:e.jsx(w.Text,{fontSize:t,color:"gray-500",children:o.description})})]})}),e.jsxs(ne.Flex,{direction:"column",gap:"xs",children:[e.jsx(rr.Textarea,{ref:o.inputRef,size:t,...o.inputProps,status:o.errorMessage?"error":"default"}),!i&&o.errorMessage&&e.jsx(Ze,{message:o.errorMessage})]})]})},bi=({size:t="md",direction:r="vertical",requiredTitle:n="(Required)",required:s=!1,fullWidth:o=!1,...i})=>{var l,a,d;const c=r==="horizontal"?t==="sm"?342:t==="lg"?400:342:void 0;return e.jsxs(f.Box,{gap:r==="horizontal"?"spacing-96":"sm",direction:r==="horizontal"?"row":"column",...i.containerProps,children:[i.title&&e.jsx(oe,{condition:s,fallback:e.jsxs(f.Box,{direction:"column",customMaxWidth:c,fullWidth:o,children:[e.jsx(ce,{children:i.title}),e.jsx(w.Text,{fontSize:t,color:"gray-500",children:i.titleDescription})]}),children:e.jsxs(f.Box,{direction:"column",customMaxWidth:c,fullWidth:o,children:[e.jsxs(ne.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(ce,{fontSize:t,children:i.title}),e.jsx(ce,{color:"error",fontSize:t,children:n}),e.jsx(oe,{condition:!!((l=i.tooltip)!=null&&l.label),children:e.jsx(Ce.Tooltip,{label:(a=i.tooltip)==null?void 0:a.label,arrowPosition:(d=i.tooltip)==null?void 0:d.arrowPosition,...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(oe,{condition:!!i.titleDescription,children:e.jsx(w.Text,{fontSize:t,color:"gray-500",children:i.titleDescription})})]})}),e.jsx(it.Toggle,{checked:i.checked,onChange:i.onChange,label:i.label,description:i.description}),i.errorMessage&&e.jsx(Ze,{message:i.errorMessage})]})},vi=({variant:t="primary",size:r="md",...n})=>{const s=nt.useColor(),o=c=>{var a,d,h,g,m,j;if(!c)return;const l=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]:(j=(m=s==null?void 0:s.computed)==null?void 0:m.gray)==null?void 0:j[50];return e.jsx(B.Icon,{name:c,size:r,style:{color:l}})},i=()=>{var l,a,d,h;if(t!=="secondary-danger"&&t!=="secondary-primary")return n.title;const c={color:n.disabled?"var(--sa-text-disable, #181a198f)":t==="secondary-danger"?(a=(l=s==null?void 0:s.computed)==null?void 0:l.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(Ie.Body2,{props:{style:c},children:n.title});case"sm":case"md":return e.jsx(Ie.SubH3,{props:{style:c},children:n.title});case"lg":return e.jsx(Ie.SubH2,{props:{style:c},children:n.title});default:return n.title}};return e.jsx(V.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()})},Ci=t=>e.jsx(Ie.H5,{props:{...t},children:t.title}),wi=({size:t="md",direction:r="vertical",requiredTitle:n="(Required)",fullWidth:s=!1,...o})=>{var l,a,d;const i=o.hideMessageError||!1,c=r==="horizontal"?t==="sm"?342:t==="lg"?400:342:void 0;return e.jsxs(f.Box,{gap:r==="horizontal"?"spacing-96":"sm",direction:r==="horizontal"?"row":"column",onClick:o.onClickContainer,children:[o.title&&e.jsx(oe,{condition:!!o.inputProps.required,fallback:e.jsxs(f.Box,{direction:"column",customMaxWidth:c,fullWidth:s,children:[e.jsx(ce,{children:o.title}),e.jsx(w.Text,{fontSize:t,color:"gray-500",children:o.description})]}),children:e.jsxs(f.Box,{direction:"column",customMaxWidth:c,fullWidth:s,children:[e.jsxs(ne.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(ce,{fontSize:t,children:o.title}),e.jsx(ce,{color:"error",fontSize:t,children:n}),e.jsx(oe,{condition:!!((l=o.tooltip)!=null&&l.label),children:e.jsx(Ce.Tooltip,{label:(a=o.tooltip)==null?void 0:a.label,arrowPosition:(d=o.tooltip)==null?void 0:d.arrowPosition,...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(oe,{condition:!!o.description,children:e.jsx(w.Text,{fontSize:t,color:"gray-500",children:o.description})})]})}),e.jsxs(ne.Flex,{direction:"column",gap:"xs",children:[e.jsx(f.Box,{direction:"column",style:{width:r==="horizontal"&&o.customWidth?o.customWidth:r==="horizontal"?"343px":""},children:e.jsx($e.StarasiaDate,{size:t,...o.inputProps,status:o.errorMessage?"error":void 0})}),!i&&o.errorMessage&&e.jsx(Ze,{message:o.errorMessage})]})]})};async function Di(t,r){const n=new Image;n.src=t,await new Promise((i,c)=>{n.onload=i,n.onerror=c});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,c)=>{s.toBlob(l=>{if(!l)return c("Canvas is empty");const a=new File([l],"cropped.png",{type:"image/png"});i(a)},"image/png")})}const $r={"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},Vn=u.forwardRef(({handleUpload:t,urlImage:r,isUploading:n,croppedImage:s,setCroppedImage:o,size:i="96",aspect:c="1:1",containerProps:l,maxFileSize:a=2,onError:d},h)=>{const g=ge.useMediaQuery("md"),[m,j]=u.useState(!1),[E,y]=u.useState(null),[M,k]=u.useState(!1),[L,C]=u.useState({x:0,y:0}),[b,A]=u.useState(1),[W,v]=u.useState(null);u.useEffect(()=>{r===null&&o(null)},[r]);const F=u.useCallback((Z,Q)=>{v(Q)},[]),z=Z=>{var ie;const Q=(ie=Z.target.files)==null?void 0:ie[0];if(!Q)return;const ae=new FileReader;ae.onload=()=>{y(ae.result),k(!0)},ae.readAsDataURL(Q)},R=async()=>{if(!(!E||!W))try{const Z=await Di(E,W);if(a&&Z.size>a*1024*1024){d==null||d(`Ukuran file maksimal ${a}MB`);return}t==null||t(Z);const Q=URL.createObjectURL(Z);o(Q,Z),k(!1)}catch{d==null||d("Gagal memproses gambar")}},_=u.useRef(null),J=()=>{_.current&&_.current.click()};u.useImperativeHandle(h,()=>({openFileDialog:()=>{var Z;(Z=_.current)==null||Z.click()}}));const te=parseInt(i,10),xe=$r[c];let he,se;return xe>=1?(se=te,he=te*xe):(he=te,se=te/xe),e.jsxs(f.Box,{direction:"column",display:"flex",position:"relative",bg:(l==null?void 0:l.bg)||"gray-200",borderStyle:(l==null?void 0:l.borderStyle)||"border-none",borderColor:(l==null?void 0:l.borderColor)||"gray-200",borderWidth:(l==null?void 0:l.borderWidth)||"border-2",borderRadius:(l==null?void 0:l.borderRadius)||"rounded-md",overflow:"overflow-hidden",align:"center",justify:"center",style:{width:l!=null&&l.fullWidth?"100%":`${he}px`,height:l!=null&&l.fullWidth?"auto":`${se}px`,aspectRatio:xe,flexShrink:0},onMouseEnter:()=>j(!0),onMouseLeave:()=>j(!1),children:[s||r?e.jsx("img",{src:s||r||void 0,alt:"Profile",style:{objectFit:"cover",width:"100%",height:"100%"}}):e.jsx(f.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(f.Box,{direction:"column",position:"absolute",display:"flex",align:"center",justify:"center",cursor:"pointer",style:{inset:0,backgroundColor:"var(--sa-color-black-alpha-a30, #080f214a)",opacity:m?1:0,transition:"opacity 0.3s ease-in-out"},onClick:J,children:[e.jsx("input",{ref:_,type:"file",accept:"image/*",onChange:z,disabled:n,style:{display:"none"}}),e.jsxs(f.Box,{display:"flex",align:"center",gap:"spacing-2",direction:"row",children:[e.jsx(B.Icon,{name:"Edit3",style:{color:"var(--sa-background-primary, #ffffff)"}}),e.jsx(oe,{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(f.Box,{direction:"column",position:"absolute",display:"flex",align:"center",justify:"center",style:{inset:0,zIndex:20,backgroundColor:"var(--sa-color-white-alpha-a80, #e5e9f640)"},children:e.jsx(f.Box,{direction:"column",borderRadius:"rounded-full",style:{animation:"spin 1s linear infinite",border:"2px solid transparent",height:"2rem",width:"2rem"},borderColor:"info-600"})}),M&&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:()=>k(!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?c==="1:1"?"min(90vw, 480px)":`min(90vw, ${he*2}px)`:"calc(100vw - 2rem)",display:"flex",flexDirection:"column"},onClick:Z=>Z.stopPropagation(),children:[e.jsx("div",{style:{position:"relative",width:"100%",height:"20rem",backgroundColor:"var(--sa-color-gray-100)"},children:E&&e.jsx(oo,{image:E,crop:L,zoom:b,aspect:c?$r[c]:void 0,onCropChange:C,onZoomChange:A,onCropComplete:F,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(V.Button,{size:"sm",secondary:!0,onClick:()=>k(!1),children:"Cancel"}),e.jsx(V.Button,{size:"sm",primary:!0,onClick:R,children:"Crop"})]})]})}),document.body)]})}),Si=({size:t="md",direction:r="vertical",requiredTitle:n="(Required)",fullWidth:s=!1,required:o=!1,...i})=>{var a,d,h;const c=i.hideMessageError||!1,l=r==="horizontal"?t==="sm"?342:t==="lg"?400:342:void 0;return e.jsxs(f.Box,{gap:r==="horizontal"?"spacing-96":"sm",direction:r==="horizontal"?"row":"column",...i.containerProps,children:[i.title&&e.jsx(oe,{condition:!!o,fallback:e.jsxs(f.Box,{direction:"column",customMaxWidth:l,fullWidth:s,children:[e.jsx(ce,{children:i.title}),e.jsx(w.Text,{fontSize:t,color:"gray-500",children:i.description})]}),children:e.jsxs(f.Box,{direction:"column",customMaxWidth:l,fullWidth:s,children:[e.jsxs(ne.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(ce,{fontSize:t,children:i.title}),e.jsx(ce,{color:"error",fontSize:t,children:n}),e.jsx(oe,{condition:!!((a=i.tooltip)!=null&&a.label),children:e.jsx(Ce.Tooltip,{label:(d=i.tooltip)==null?void 0:d.label,arrowPosition:(h=i.tooltip)==null?void 0:h.arrowPosition,...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(oe,{condition:!!i.description,children:e.jsx(w.Text,{fontSize:t,color:"gray-500",children:i.description})})]})}),e.jsxs(ne.Flex,{direction:"column",gap:"xs",children:[e.jsx(Vn,{...i.inputProps}),!c&&i.errorMessage&&e.jsx(Ze,{message:i.errorMessage})]})]})},ki=({size:t="md",direction:r="vertical",requiredTitle:n="(Required)",fullWidth:s=!1,...o})=>{var c,l,a;const i=r==="horizontal"?t==="sm"?342:t==="lg"?400:342:void 0;return e.jsxs(f.Box,{gap:r==="horizontal"?"spacing-96":"sm",direction:r==="horizontal"?"row":"column",...o.containerProps,children:[o.title&&e.jsx(oe,{condition:!!o.inputProps.required,fallback:e.jsxs(f.Box,{direction:"column",customMaxWidth:i,fullWidth:s,children:[e.jsx(ce,{children:o.title}),e.jsx(w.Text,{fontSize:t,color:"gray-500",children:o.description})]}),children:e.jsxs(f.Box,{direction:"column",customMaxWidth:i,fullWidth:s,children:[e.jsxs(ne.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(ce,{fontSize:t,children:o.title}),e.jsx(ce,{color:"error",fontSize:t,children:n}),e.jsx(oe,{condition:!!((c=o.tooltip)!=null&&c.label),children:e.jsx(Ce.Tooltip,{label:(l=o.tooltip)==null?void 0:l.label,arrowPosition:(a=o.tooltip)==null?void 0:a.arrowPosition,...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(oe,{condition:!!o.description,children:e.jsx(w.Text,{fontSize:t,color:"gray-500",children:o.description})})]})}),o.inputProps.extended&&o.inputProps.extended]})},Bi=({items:t,id:r,handleOnUpdate:n,width:s,toggleShow:o=!0,disabled:i=!1})=>{var h;const[c,l]=u.useState([]);u.useEffect(()=>{t&&l([...t.map(g=>({id:g.id,isActive:g.isActive}))])},[t]);const a=(h=c.find(g=>g.id===r))==null?void 0:h.isActive,d=u.useCallback(()=>{l(g=>g.map(m=>m.id===r?{...m,isActive:!m.isActive}:m)),n&&n(!a)},[r,n,a]);return e.jsx(f.Box,{direction:"row",gap:"md",style:{width:s},children:o&&e.jsx(it.Toggle,{disabled:i,checked:a,onChange:d,label:a?"Active":"Inactive"})})},Fi={InputText:Ps,InputDropdown:Ns,InputSingleFile:gi,CheckBoxOptions:yi,RadioOptions:pi,InputTextArea:ji,ToggleForm:bi,ActionButton:vi,FormTitle:Ci,InputDate:wi,InputImgFile:Si,Custom:ki},Hn=({customBottom:t})=>{const[r,n]=u.useState(!1),s=()=>{window.scrollY>window.screenY?n(!0):n(!1)},o=()=>{window.scrollTo({top:0,behavior:"smooth"})};return u.useEffect(()=>(window.addEventListener("scroll",s),()=>{window.removeEventListener("scroll",s)}),[]),e.jsx(f.Box,{direction:"column",style:{position:"fixed",bottom:0,right:0},children:e.jsx(f.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(V.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)"}})})})})},ke="sa-sidepanel-item",en="sa-sidepanel-item-styles",Ei="inset 3.5px 0 0 0 var(--sa-border-focused, #1a4fa0)",Mi="inset -3.5px 0 0 0 var(--sa-border-focused, #1a4fa0)",Li=`
|
|
47
47
|
.${ke} {
|
|
48
48
|
display: block;
|
|
49
49
|
box-sizing: border-box;
|
package/dist/index.es.js
CHANGED
|
@@ -6314,8 +6314,8 @@ const Wc = No(To), rn = 200, lr = "1px solid var(--sa-border-subtle, #0b120e24)"
|
|
|
6314
6314
|
}), Wr = {
|
|
6315
6315
|
position: "absolute",
|
|
6316
6316
|
right: 0,
|
|
6317
|
-
top:
|
|
6318
|
-
|
|
6317
|
+
top: 0,
|
|
6318
|
+
bottom: 0,
|
|
6319
6319
|
display: "flex",
|
|
6320
6320
|
alignItems: "center",
|
|
6321
6321
|
gap: 4,
|
package/dist/index.umd.js
CHANGED
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
box-shadow: 0 4px 12px rgba(0,0,0,0.12);
|
|
44
44
|
padding: 4px 0;
|
|
45
45
|
}
|
|
46
|
-
`,document.head.appendChild(r)},Lr=r=>r==="right"?"right":r==="center"?"center":"left",an=/^(#|rgb|hsl|var\()/,Tr=r=>r?an.test(r)?r:`var(--sa-background-${r})`:void 0,dn=(r,t)=>{if(t)return r[t]},hn=(r,t)=>r==null&&t==null?0:r==null?-1:t==null?1:typeof r=="number"&&typeof t=="number"?r-t:String(r).localeCompare(String(t)),fn=({columns:r,data:t,getRowKey:l,rowBg:n,size:o="md",resizable:c=!1,layout:s="auto",widthStorageKey:i,columnState:a,onColumnStateChange:d,columnMenu:y=!1,sort:b,defaultSort:p,onSortChange:x,height:L,mobileLayout:v="cards",mobileBreakpoint:T="md",groupSeparator:F,summary:I,emptyState:S,loading:w=!1,loadingRows:V=8,rowActions:z})=>{sn();const M=!pe.useMediaQuery(T)&&v!=="scroll",j=!!(z!=null&&z.length),[H,Z]=h.useState(null);h.useEffect(()=>{if(!H)return;const C=()=>Z(null),B=setTimeout(()=>document.addEventListener("click",C),0);return()=>{clearTimeout(B),document.removeEventListener("click",C)}},[H]);const[K,te]=h.useState(()=>new Set),ge=a!==void 0,[ue,ce]=h.useState({}),Q=a??ue,J=C=>{d==null||d(C),ge||ce(C)},de=b!==void 0,[ie,fe]=h.useState(p??null),be=de?b??null:ie,ze=!x,He=C=>{x==null||x(C),de||fe(C)},{headerGroups:Te,leafColumns:he,hasGroups:ye}=h.useMemo(()=>{var Se;const C=new Set(Q.hidden??[]),B=(le,ae)=>le.key??(typeof le.accessor=="string"?le.accessor:`col-${ae}`),A=r.map((le,ae)=>{var Ge;if((Ge=le.children)!=null&&Ge.length){const er=le.children.map((Qe,dr)=>({col:Qe,key:B(Qe,`${ae}-${dr}`)})).filter(Qe=>!C.has(Qe.key));return{col:le,key:le.key??`group-${ae}`,isGroup:!0,leaves:er}}const xe={col:le,key:B(le,`${ae}`)};return{col:le,key:xe.key,isGroup:!1,leaves:C.has(xe.key)?[]:[xe]}}).filter(le=>le.leaves.length>0),re=A.some(le=>le.isGroup);let $=A.flatMap(le=>le.leaves);if(!re&&((Se=Q.order)!=null&&Se.length)){const le=new Map(Q.order.map((ae,xe)=>[ae,xe]));$=[...$].sort((ae,xe)=>(le.get(ae.key)??1/0)-(le.get(xe.key)??1/0))}return{headerGroups:A,leafColumns:$,hasGroups:re}},[r,Q]),Ve=h.useMemo(()=>new Map(he.map((C,B)=>[C.key,B])),[he]),Pe=!ye&&he.some(C=>(C.col.headerColSpan??1)>1),Ie=he.map(C=>C.key).join("|"),je=(C,B)=>{const A=C.sortKey??(typeof C.accessor=="string"?C.accessor:void 0);return A?B[A]:void 0},ar=C=>C.sortable??(!!C.sortKey||typeof C.accessor=="string"),m=h.useMemo(()=>{if(!ze||!be)return t;const C=he.find(A=>A.key===be.key);if(!C)return t;const B=be.direction==="asc"?1:-1;return[...t].sort((A,re)=>hn(je(C.col,A),je(C.col,re))*B)},[t,ze,be,he]),q=!ye&&!Pe,Y=!!i&&q,[W,U]=X.useColumnWidths(i??""),N=Y?W:void 0,G=h.useRef(null),[_,Ce]=h.useState();h.useLayoutEffect(()=>{Ce(void 0)},[Ie]),h.useLayoutEffect(()=>{if(!q||_||!G.current)return;const C=G.current.querySelectorAll("th.sa-tl-leaf");Ce(Array.from(C).map(B=>B.offsetWidth))},[_,q]);const[me,Ne]=h.useState(0);h.useLayoutEffect(()=>{if(!ye||!G.current)return;const C=G.current.querySelector(":scope > tr");C&&Ne(C.offsetHeight)},[ye,Ie]);const Ee=(C,B)=>{if((N==null?void 0:N[B])!=null)return N[B];if(C.width!=null)return C.width;if((_==null?void 0:_[B])!=null)return _[B]},Oe=(C,B)=>typeof C.width=="number"?C.width:_==null?void 0:_[B],Re=Q.frozenKey&&!ye&&!Pe?he.findIndex(C=>C.key===Q.frozenKey):-1,Ye=C=>C<=Re,Xe=C=>{if(!_)return 0;let B=0;for(let A=0;A<C;A++)B+=_[A]??0;return B},_e=h.useRef(null),[Vr,jr]=h.useState("100vh");h.useLayoutEffect(()=>{if(L!==void 0)return;const C=()=>{if(_e.current){const B=_e.current.getBoundingClientRect().top;jr(`calc(100vh - ${B}px)`)}};return C(),window.addEventListener("resize",C),()=>window.removeEventListener("resize",C)},[L]);const Ze=(C,B)=>l?l(C,B):B,ht=(C,B,A)=>C.render?C.render(B,A,m):dn(B,C.accessor),ft=he.length+(j?1:0),Al=["80%","55%","70%","45%","90%","60%"],Oc=(C,B)=>Al[(C*7+B*3)%Al.length],Wc=(C,B)=>e.jsx(We.Skeleton,{height:14,width:Oc(C,B),borderRadius:"rounded-sm"}),Ac=Array.from({length:V},(C,B)=>e.jsxs(X.Tr,{children:[he.map(({col:A,key:re},$)=>e.jsx(X.Td,{style:{textAlign:Lr(A.align)},children:Wc(B,$)},`sa-tl-sk-${B}-${re}`)),j&&e.jsx(X.Td,{style:{width:1,padding:0,border:"none"}})]},`sa-tl-sk-${B}`)),zc=(C,B)=>{B||J({...Q,hidden:[...Q.hidden??[],C]})},Hc=C=>J({...Q,frozenKey:Q.frozenKey===C?void 0:C}),Pr=C=>(z??[]).filter(B=>{var A;return!((A=B.hidden)!=null&&A.call(B,C))}),zl={position:"absolute",right:0,top:"50%",transform:"translateY(-50%)",display:"flex",alignItems:"center",gap:4,paddingRight:16,paddingLeft:40,background:"linear-gradient(to right, transparent, var(--sa-background-primary-inverse, #f8f8f8) 40px)"},Nr=(C,B,A,re)=>{var Ge;const $=(Ge=C.disabled)==null?void 0:Ge.call(C,B),Se=(re==null?void 0:re.showLabel)??C.showLabel,le=(re==null?void 0:re.size)??"xs",ae=e.jsx(P.Button,{size:le,variant:C.variant??"tertiary",tone:C.tone??"neutral",disabled:$,onClick:()=>C.onClick(B,A),iconLeft:C.icon?e.jsx(E.Icon,{name:C.icon,size:"sm"}):void 0,children:Se&&C.label}),xe=C.tooltip;return xe?e.jsx(De.Tooltip,{label:xe,position:"top-end",children:ae}):ae},Vc=(C,B)=>{const A=Pr(C);if(!A.length)return null;if(A.length>5){const $=Ze(C,B),Se=(H==null?void 0:H.rowKey)===$;return e.jsx("div",{className:"sa-tl-row-actions",style:zl,onClick:le=>le.stopPropagation(),children:e.jsx(De.Tooltip,{label:"Aksi lainnya",position:"top",children:e.jsx(P.Button,{size:"xs",variant:"tertiary",onClick:le=>{const ae=le.currentTarget.getBoundingClientRect();Z(Se?null:{rowKey:$,top:ae.bottom+4,right:window.innerWidth-ae.right})},children:e.jsx(E.Icon,{name:"MenuVertical",size:"sm"})})})})}return e.jsx("div",{className:"sa-tl-row-actions",style:zl,children:A.map($=>e.jsx(h.Fragment,{children:Nr($,C,B)},$.key))})},jc=(C,B)=>{const A=Pr(C);return A.length?e.jsx("div",{style:{display:"flex",gap:6,flexWrap:"wrap",paddingTop:8,marginTop:8,borderTop:Er},children:A.map(re=>e.jsx(h.Fragment,{children:Nr(re,C,B,{showLabel:!0,size:"sm"})},re.key))}):null},Pc=(C,B)=>{const A=Pr(C);return A.length?e.jsx("div",{style:{display:"flex",gap:4,paddingRight:8,flexShrink:0},children:A.map(re=>e.jsx(h.Fragment,{children:Nr(re,C,B,{showLabel:!1})},re.key))}):null},gt=(C,B)=>{const{col:A,key:re}=C,$=Ve.get(re)??0,Se=Ye($),le=Se&&$===Re,ae=(be==null?void 0:be.key)===re?be.direction:null,xe=y&&!A.disableMenu?e.jsx(Sl,{active:!!ae||Se,canSort:ar(A),canHide:!A.locked,sortDir:ae,frozen:Se,onSort:dr=>He({key:re,direction:dr}),onClearSort:()=>He(null),onToggleFreeze:()=>Hc(re),onHide:()=>zc(re,A.locked)}):null,Ge=A.align==="right",er=A.align==="right"?"flex-end":A.align==="center"?"center":"flex-start",Qe=e.jsxs("span",{style:{flex:1,minWidth:0,display:"flex",alignItems:"center",gap:6,justifyContent:er,overflow:"hidden"},children:[A.icon&&e.jsx(E.Icon,{name:A.icon,size:"sm",style:{flexShrink:0}}),e.jsx("span",{style:Mr,children:A.title})]});return e.jsx(X.Th,{className:`sa-tl-leaf${Se?" sa-tl-frozen":""}`,rowSpan:B==null?void 0:B.rowSpan,colSpan:B==null?void 0:B.colSpan,minWidth:A.minWidth,resizable:q?A.resizable:!1,defaultWidth:Oe(A,$),style:{textAlign:Lr(A.align),width:Ee(A,$),position:"sticky",top:(B==null?void 0:B.top)??0,left:Se?Xe($):void 0,zIndex:Se?3:2,backgroundColor:yr,boxShadow:le?kl:void 0},children:e.jsx("div",{style:{display:"flex",alignItems:"center",gap:6,width:"100%"},children:Ge?e.jsxs(e.Fragment,{children:[xe,Qe]}):e.jsxs(e.Fragment,{children:[Qe,xe]})})},`th-${re}`)},Nc=()=>{const C=[];for(let B=0;B<he.length;){const A=he[B],re=A.col.headerColSpan??1,$=Math.max(1,Math.min(re,he.length-B));C.push(gt(A,$>1?{colSpan:$}:void 0)),B+=$}return C},ut=he.filter(C=>!C.col.hideOnMobile),yt=ut.find(C=>C.col.primary)??ut[0],_c=ut.filter(C=>C!==yt),qc=C=>te(B=>{const A=new Set(B);return A.has(C)?A.delete(C):A.add(C),A}),Hl=(C,B)=>_c.map(({col:A,key:re})=>{const $=ht(A,C,B),Se=typeof $=="string"||typeof $=="number"?e.jsx(k.Text,{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",textAlign:"right"},children:$}):e.jsx("div",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",textAlign:"right"},children:$});return e.jsxs("div",{style:{display:"flex",gap:12,justifyContent:"space-between",alignItems:"baseline"},children:[typeof A.title=="string"?e.jsx(k.Text,{color:"subtle",fontWeight:"medium",style:{color:cn,flexShrink:0},children:A.title}):e.jsx("div",{style:{flexShrink:0},children:A.title}),Se]},re)}),Vl=(C,B)=>{const A=yt?ht(yt.col,C,B):null;return typeof A=="string"||typeof A=="number"?e.jsx(k.Text,{as:"span",style:Mr,children:A}):e.jsx("span",{style:Mr,children:A})},Zc=e.jsx(u.Box,{style:{display:"flex",flexDirection:"column",gap:8,padding:8},children:Array.from({length:V},(C,B)=>e.jsxs(u.Box,{style:{border:Er,borderRadius:"var(--sa-radii-sm, 6px)",padding:12,display:"flex",flexDirection:"column",gap:8},children:[e.jsx(We.Skeleton,{height:16,width:"60%",borderRadius:"rounded-sm"}),e.jsx(We.Skeleton,{height:12,width:"85%",borderRadius:"rounded-sm"}),e.jsx(We.Skeleton,{height:12,width:"70%",borderRadius:"rounded-sm"})]},`sa-tl-sk-card-${B}`))}),jl=e.jsx(u.Box,{fullWidth:!0,style:{minHeight:(S==null?void 0:S.minHeight)??320,display:"flex",alignItems:"center",justifyContent:"center",padding:16},children:S==null?void 0:S.content}),Gc=w?Zc:m.length===0?jl:v==="expand"?e.jsx(u.Box,{style:{display:"flex",flexDirection:"column"},children:m.map((C,B)=>{const A=Ze(C,B),re=K.has(A),$=Tr(n==null?void 0:n(C,B));return e.jsxs("div",{style:{borderBottom:Er,backgroundColor:$},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[e.jsxs("button",{type:"button",onClick:()=>qc(A),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:[Vl(C,B),e.jsx(E.Icon,{name:re?"ChevronUp":"ChevronDown",size:"sm",style:{flexShrink:0}})]}),j&&Pc(C,B)]}),re&&e.jsx("div",{style:{padding:"0 12px 12px",display:"flex",flexDirection:"column",gap:6},children:Hl(C,B)})]},A)})}):e.jsx(u.Box,{style:{display:"flex",flexDirection:"column",gap:8,padding:8},children:m.map((C,B)=>e.jsxs(u.Box,{style:{border:Er,borderRadius:"var(--sa-radii-sm, 6px)",padding:12,display:"flex",flexDirection:"column",gap:6,backgroundColor:Tr(n==null?void 0:n(C,B))},children:[Vl(C,B),Hl(C,B),j&&jc(C,B)]},Ze(C,B)))}),Qc=c&&q&&_!==void 0,Pl=s==="fixed"&&!c&&(q?_!==void 0:!0),Uc=Pl&&!q,Jc=e.jsxs(X.Table,{className:"sa-table-layout",fullWidth:!0,size:o,resizable:Qc,style:Pl?{tableLayout:"fixed"}:void 0,onWidthsChange:Y?U:void 0,children:[Uc&&e.jsxs("colgroup",{children:[he.map(({col:C,key:B},A)=>e.jsx("col",{style:{width:Ee(C,A)}},`col-${B}`)),j&&e.jsx("col",{style:{width:1}})]}),e.jsx(X.Thead,{ref:G,children:ye?e.jsxs(e.Fragment,{children:[e.jsxs(X.Tr,{children:[Te.map(C=>C.isGroup?e.jsx(X.Th,{colSpan:C.leaves.length,style:{textAlign:"center",position:"sticky",top:0,zIndex:2,backgroundColor:yr},children:e.jsx("span",{style:Mr,children:C.col.title})},`grp-${C.key}`):gt(C.leaves[0],{rowSpan:2})),j&&e.jsx(X.Th,{rowSpan:2,style:{position:"sticky",top:0,right:0,zIndex:3,width:1,padding:0,border:"none",backgroundColor:yr}})]}),e.jsx(X.Tr,{children:Te.flatMap(C=>C.isGroup?C.leaves.map(B=>gt(B,{top:me})):[])})]}):e.jsxs(X.Tr,{children:[Nc(),j&&e.jsx(X.Th,{style:{position:"sticky",top:0,right:0,zIndex:3,width:1,padding:0,border:"none",backgroundColor:yr}})]})}),e.jsx(X.Tbody,{children:w?Ac:m.length===0?e.jsx(X.Tr,{children:e.jsx(X.Td,{colSpan:ft,children:jl})}):e.jsxs(e.Fragment,{children:[m.map((C,B)=>{const A=F==null?void 0:F(C,B,B>0?m[B-1]:void 0),re=Tr(n==null?void 0:n(C,B));return e.jsxs(h.Fragment,{children:[A!=null&&A!==!1&&e.jsx(X.Tr,{children:e.jsx(X.Td,{colSpan:ft,style:{backgroundColor:yr},children:A})}),e.jsxs(X.Tr,{children:[he.map(({col:$,key:Se},le)=>{var Nl;const ae=(Nl=$.cellProps)==null?void 0:Nl.call($,C,B,m);if(ae!=null&&ae.hidden)return null;const xe=Ye(le),Ge=xe&&le===Re,er=ht($,C,B),Qe=typeof $.bg=="function"?$.bg(C,B,m):$.bg,dr=Tr(Qe)??re;return e.jsx(X.Td,{className:xe?"sa-tl-frozen":void 0,colSpan:ae==null?void 0:ae.colSpan,rowSpan:ae==null?void 0:ae.rowSpan,style:{textAlign:Lr($.align),width:Ee($,le),minWidth:$.minWidth,position:xe?"sticky":void 0,left:xe?Xe(le):void 0,zIndex:xe?1:void 0,boxShadow:Ge?kl:void 0,...dr?{"--sa-tl-bg":dr}:{}},children:typeof er=="string"?e.jsx(k.Text,{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",textAlign:Lr($.align)},children:er}):er},`tl-cell-${B}-${Se}`)}),j&&e.jsx(X.Td,{style:{position:"sticky",right:0,width:1,padding:0,overflow:"visible",zIndex:2,border:"none"},children:Vc(C,B)})]})]},Ze(C,B))}),I!=null&&e.jsx(X.Tr,{children:e.jsx(X.Td,{colSpan:ft,children:I})})]})})]}),pt=H?m.findIndex((C,B)=>Ze(C,B)===H.rowKey):-1,bt=pt>=0?m[pt]:null;return e.jsxs(e.Fragment,{children:[e.jsx(u.Box,{ref:_e,fullWidth:!0,style:{overflow:"auto",height:L??Vr},children:M?Gc:Jc}),H&&bt&&e.jsx("div",{className:"sa-tl-kebab-menu",style:{top:H.top,right:H.right},onClick:C=>C.stopPropagation(),children:Pr(bt).map(C=>e.jsx("div",{style:{padding:"2px 4px"},children:Nr(C,bt,pt,{showLabel:!0,size:"sm"})},C.key))})]})},st=r=>r==="asc"||r==="desc",gn=(r={})=>{const{sortKeyParam:t="sortBy",sortOrderParam:l="sortOrder",pageKey:n="page",defaultSort:o=null,paramKeys:c,scopeId:s,storage:i=rt}=r,{searchParams:a,setSearchParams:d,searchQueries:y}=Be(),b=a.toString(),p=s?sr.tableSort(s):void 0,x=h.useRef(!1);h.useEffect(()=>{if(x.current||(x.current=!0,!p)||a.has(t)||a.has(l))return;const S=i.get(p);!(S!=null&&S.key)||!st(S.direction)||d({...Object.fromEntries(a.entries()),[t]:S.key,[l]:S.direction})},[]);const L=h.useMemo(()=>{const S=a.get(t),w=a.get(l);return S&&st(w)?{key:S,direction:w}:o},[b,t,l,o]);h.useEffect(()=>{if(!p)return;const S=a.get(t),w=a.get(l);S&&st(w)?i.set(p,{key:S,direction:w}):i.remove(p)},[b,p,t,l,i]);const v=(c==null?void 0:c.sortBy)??"sortBy",T=(c==null?void 0:c.sortOrder)??"sortOrder",F=h.useMemo(()=>L?{[v]:L.key,[T]:L.direction}:{},[L,v,T]),I=h.useCallback(S=>{const w={...y};S?(w[t]=S.key,w[l]=S.direction):(delete w[t],delete w[l]),delete w[n],d(w)},[y,t,l,n,d]);return{sort:L,setSort:I,params:F}},Ir=({of:r,render:t})=>h.Children.toArray(r==null?void 0:r.map((l,n,o)=>t(l,n,o))),ne=({condition:r,fallback:t,children:l,loading:n,isLoading:o})=>e.jsx(e.Fragment,{children:o?n:r?l:t}),se=r=>e.jsx(k.Text,{...r,fontFamily:"Poppins",fontSize:r.fontSize||"md",fontWeight:r.fontWeight||"medium",color:r.color||"gray-700",children:r.children}),qe=r=>e.jsx(k.Text,{color:"red-600",fontSize:"sm",children:r.message}),un=({size:r="md",direction:t="vertical",requiredTitle:l="(Required)",fullWidth:n=!1,...o})=>{var i,a,d;const c=o.hideMessageError||!1,s=t==="horizontal"?r==="sm"?342:r==="lg"?400:342:void 0;return e.jsxs(u.Box,{gap:t==="horizontal"?"spacing-96":"sm",direction:t==="horizontal"?"row":"column",...o.containerProps,children:[o.title&&e.jsx(ne,{condition:!!o.inputProps.required,fallback:e.jsxs(u.Box,{direction:"column",customMaxWidth:s,fullWidth:n,children:[e.jsx(se,{children:o.title}),e.jsx(k.Text,{fontSize:r,color:"gray-500",children:o.description})]}),children:e.jsxs(u.Box,{direction:"column",customMaxWidth:s,fullWidth:n,children:[e.jsxs(oe.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(se,{fontSize:r,children:o.title}),e.jsx(se,{color:"error",fontSize:r,children:l}),e.jsx(ne,{condition:!!((i=o.tooltip)!=null&&i.label),children:e.jsx(De.Tooltip,{label:(a=o.tooltip)==null?void 0:a.label,arrowPosition:(d=o.tooltip)==null?void 0:d.arrowPosition,...o.tooltip,children:e.jsx(E.Icon,{name:"InfoCircle",size:r==="lg"?"sm":"xs",style:{color:"var(--sa-color-info-500, #00abeb)",marginTop:"6px"}})})})]}),e.jsx(ne,{condition:!!o.description,children:e.jsx(k.Text,{fontSize:r,color:"gray-500",children:o.description})})]})}),e.jsxs(u.Box,{direction:"column",gap:"xs",fullWidth:o.inputProps.fullWidth||!1,children:[e.jsx(Je.Input,{ref:o.inputRef,size:r,...o.inputProps,status:o.errorMessage?"error":"default",fullWidth:!0}),!c&&o.errorMessage&&e.jsx(qe,{message:o.errorMessage}),o.inputProps.extended&&o.inputProps.extended]})]})},yn=({size:r="md",direction:t="vertical",requiredTitle:l="(Required)",fullWidth:n=!1,...o})=>{var i,a,d;const c=o.hideMessageError||!1,s=t==="horizontal"?r==="sm"?342:r==="lg"?400:342:void 0;return e.jsxs(u.Box,{gap:t==="horizontal"?"spacing-96":"sm",direction:t==="horizontal"?"row":"column",onClick:o.onClickContainer,children:[o.title&&e.jsx(ne,{condition:!!o.inputProps.required,fallback:e.jsxs(u.Box,{direction:"column",customMaxWidth:s,fullWidth:n,children:[e.jsx(se,{children:o.title}),e.jsx(k.Text,{fontSize:r,color:"gray-500",children:o.description})]}),children:e.jsxs(u.Box,{direction:"column",customMaxWidth:s,fullWidth:n,children:[e.jsxs(oe.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(se,{fontSize:r,children:o.title}),e.jsx(se,{color:"error",fontSize:r,children:l}),e.jsx(ne,{condition:!!((i=o.tooltip)!=null&&i.label),children:e.jsx(De.Tooltip,{label:(a=o.tooltip)==null?void 0:a.label,arrowPosition:(d=o.tooltip)==null?void 0:d.arrowPosition,...o.tooltip,children:e.jsx(E.Icon,{name:"InfoCircle",size:r==="lg"?"sm":"xs",style:{color:"var(--sa-color-info-500, #00abeb)",marginTop:"6px"}})})})]}),e.jsx(ne,{condition:!!o.description,children:e.jsx(k.Text,{fontSize:r,color:"gray-500",children:o.description})})]})}),e.jsxs(u.Box,{direction:"column",gap:"xs",fullWidth:o.inputProps.fullWidth||!1,children:[e.jsx(u.Box,{direction:"column",style:{width:o.inputProps.fullWidth?"100%":t==="horizontal"&&o.customWidth?o.customWidth:t==="horizontal"?"343px":""},children:e.jsx(lr.Dropdown,{size:r,...o.inputProps,error:!!o.errorMessage})}),!c&&o.errorMessage&&e.jsx(qe,{message:o.errorMessage}),o.inputProps.extended&&o.inputProps.extended]})]})},pn=(r,t)=>typeof r=="string"&&r||t==="error"?"var(--sa-border-danger)":"var(--sa-border-subtle)",bn=r=>{var i;const[t,l]=h.useState(!1),n=a=>{a.preventDefault(),a.stopPropagation()},o=a=>{a.preventDefault(),a.stopPropagation(),a.dataTransfer&&r.handleOnFileChange(a.dataTransfer.files.item(0))},c=a=>{a.preventDefault(),l(!0)},s=a=>{a.preventDefault(),l(!1)};return e.jsxs(u.Box,{width:"width-full",paddingInline:"md",direction:"row",gap:"sm",align:"center",onClick:r.handleOnClick,onDragOver:n,onDrop:o,onDragEnter:c,onDragLeave:s,paddingBlock:"md",borderRadius:"rounded-md",style:{border:t?"1px solid var(--sa-border-info)":`1px solid ${pn(r.errorMessage,r.status)}`},children:[e.jsx(E.Icon,{name:"Upload",size:"lg",style:{width:30,height:30}}),e.jsxs(oe.Flex,{direction:"column",gap:"xs",children:[e.jsxs(oe.Flex,{direction:"row",gap:"xs",children:[e.jsx(k.Text,{fontWeight:"medium",color:"gray-500",style:{textWrap:"nowrap"},fontSize:r.isDesktop?"md":"sm",children:"Click your upload"}),e.jsx(k.Text,{fontWeight:"medium",style:{textWrap:"nowrap"},fontSize:r.isDesktop?"md":"sm",children:"or Drag & Drop"})]}),e.jsx(k.Text,{fontSize:"sm",color:"gray-500",children:(i=r.fileSupports)==null?void 0:i.map(a=>a.toLocaleUpperCase()).join(", ")})]})]})};function vn(r){return r.split(" ").map(t=>t[0]).join("").slice(0,2).toUpperCase()}const ml=r=>{const t={day:"2-digit",month:"short",year:"numeric"};return r.toLocaleDateString("id-ID",t)},Cn=r=>{const t={Jan:0,Feb:1,Mar:2,Apr:3,Mei:4,Jun:5,Jul:6,Agu:7,Sep:8,Okt:9,Nov:10,Des:11},l=r.split(" ");if(l.length!==3)return null;const n=parseInt(l[0],10),o=t[l[1]],c=parseInt(l[2],10);return isNaN(n)||isNaN(o)||isNaN(c)?null:new Date(c,o,n)};function xn(r,t=!0){if(!r)return"Rp 0";const l=typeof r=="number"?r.toString():r;if(isNaN(Number(l)))return"Rp 0";const n=l.split("."),o=n[0].replace(/\B(?=(\d{3})+(?!\d))/g,"."),c=n.length===2?o+"."+n[1]:o;return t?"Rp"+c:c}String.prototype.toTitleCase=function(){return this.toLowerCase().split(" ").map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join(" ")},String.prototype.toNumber=function(){return Number(this)};const wn=r=>{const t=r.split(" ");let l=t[0].charAt(0);return t.length>1&&(l+=""+t[1].charAt(0)),l.toUpperCase()};function Dn(r){const t=typeof r=="string"?new Date(r):r;if(isNaN(t.getTime()))throw new Error("Invalid date format");const l=t.getFullYear(),n=String(t.getMonth()+1).padStart(2,"0"),o=String(t.getDate()).padStart(2,"0");return`${l}-${n}-${o}`}const Sn="sa-admin",Ae=r=>`var(--${Sn}-${r})`,kn={base:{borderColor:Ae("base-border-color"),textColor:Ae("base-text-color"),iconColor:Ae("base-icon-color"),placeholderColor:Ae("base-placeholder-color")},document:{bgColor:Ae("document-bg-color")},sidebar:{bgColor:Ae("sidebar-bg-color"),borderColor:Ae("sidebar-border-color"),maxWidth:Ae("sidebar-max-width"),width:Ae("sidebar-width"),collapseWidth:Ae("sidebar-collapse-width"),collapseV2Width:Ae("sidebar-v2-collapse-width")}},Bn=24*60*60*1e3,mn=r=>{const t="14px poppins",n=document.createElement("canvas").getContext("2d");n.font=t;const o=n.measureText(r).width;return Number(Math.ceil(o))},Fn=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,En=/--+/,Mn=/-$/;function Ln(r,t){return JSON.stringify(r)!==JSON.stringify(t)}function Tn(r){return/^(?:\+62|62|0)8[1-9][0-9]{7,10}$/.test(r)}function In(r){return/^[A-Za-z\s]+$/.test(r)}const On=r=>{const t=/^[0-9]$/,l=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Backspace","Delete","Enter","Tab"];(r.ctrlKey||r.metaKey)&&(r.key==="a"||r.key==="c"||r.key==="v")||!t.test(r.key)&&!l.includes(r.key)&&r.preventDefault()},Wn=r=>{const t=/^[0-9]$/,l=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Backspace","Delete","Enter","Tab"];(r.ctrlKey||r.metaKey)&&r.key==="v"||t.test(r.key)&&!l.includes(r.key)&&r.preventDefault()},An=r=>{const t=/^[0-9.]$/,l=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Backspace","Delete","Enter","Tab"];(r.ctrlKey||r.metaKey)&&r.key==="v"||!t.test(r.key)&&!l.includes(r.key)&&r.preventDefault()},zn=r=>Fn.test(r);function Hn(r){return!(En.test(r)||Mn.test(r))}const Vn=r=>{const t=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Backspace","Delete","Enter","Tab","Home","End"];if((r.ctrlKey||r.metaKey)&&["a","c","v","x"].includes(r.key.toLowerCase()))return;const l=r.currentTarget.value;/^[0-9]$/.test(r.key)||r.key==="."&&!l.includes(".")||r.key==="-"&&l.length===0&&!l.includes("-")||t.includes(r.key)||r.preventDefault()},jn=r=>{const t=document.getElementById(r);if(t){const l=t.getBoundingClientRect(),n=window.scrollY+l.top-80;window.scrollTo({top:n,behavior:"smooth"})}};function Pn(r){const t=r.toLowerCase();if(["kb","mb","gb"].find(c=>t.endsWith(c)))return r;const o=Number(r);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 Nn(r){const t=r.split("/");return t[t.length-1]}const _n=r=>{var t,l;return e.jsxs(u.Box,{width:"width-full",paddingInline:"md",height:"height-full",direction:"row",justify:"space-between",align:"center",onClick:r.handleOnClickFile,fullHeight:!0,paddingBlock:"md",id:"file-item",borderRadius:"rounded-md",style:{border:"1px solid var(--sa-border-subtle)",cursor:"pointer"},children:[e.jsxs(oe.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(oe.Flex,{direction:"column",style:{minWidth:0,flex:1},children:[e.jsx(k.Text,{fontWeight:"bold",style:{textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden"},children:r.defaultFile?Nn(r.defaultFile.url):(t=r.fileSelected)==null?void 0:t.name}),r.defaultFile?(r.defaultFile.size||r.defaultFile.date)&&e.jsxs(oe.Flex,{direction:"row",gap:"xs",align:"center",children:[r.defaultFile.size&&e.jsx(k.Text,{fontSize:"sm",fontWeight:"medium",children:r.defaultFile.size}),r.defaultFile.size&&r.defaultFile.date&&e.jsx(E.Icon,{name:"Dot",size:"xs"}),r.defaultFile.date&&e.jsx(k.Text,{fontSize:"sm",fontWeight:"medium",style:{textWrap:"nowrap"},children:r.defaultFile.date})]}):e.jsxs(oe.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(k.Text,{fontSize:"sm",fontWeight:"medium",children:Pn(((l=r.fileSelected)==null?void 0:l.size.toString())||"100000")}),e.jsx(E.Icon,{name:"Dot",size:"xs"}),e.jsx(k.Text,{fontSize:"sm",fontWeight:"medium",style:{textWrap:"nowrap"},children:ml(new Date)})]})]})]}),e.jsx(P.Button,{size:"xs",variant:"tertiary",tone:"error",type:"button",onClick:n=>{n.stopPropagation(),r.handleOnDeleteFile()},iconLeft:e.jsx(E.Icon,{name:"Trash1"})})]})},Fl=({status:r="default",labelPosition:t="outside-top",...l})=>{var p;const n=h.useRef(null),o=()=>{if(l.defaultFile){window.open(l.defaultFile.url);return}n.current&&n.current.click()},c=pe.useMediaQuery("md"),s=r==="error"||typeof l.errorMessage=="string"&&!!l.errorMessage,i=l.label?e.jsxs(oe.Flex,{direction:"row",align:"center",gap:"xs",children:[e.jsx(k.Text,{style:{fontSize:"14px",fontWeight:500,color:"var(--sa-text-primary)"},children:l.label}),l.optional&&e.jsx("span",{style:{background:"var(--sa-background-neutral)",border:"1px solid var(--sa-border-subtle)",borderRadius:"4px",padding:"0 8px",fontSize:"10px",fontWeight:500,lineHeight:"18px",color:"var(--sa-text-primary)",display:"inline-flex",alignItems:"center"},children:"Optional"}),l.required&&e.jsx("span",{style:{fontSize:"14px",fontWeight:500,color:"var(--sa-text-error)"},children:"*"})]}):null,a=l.description?e.jsx(k.Text,{style:{fontSize:"12px",fontWeight:400,color:"var(--sa-text-subtlest, #6b6e76)",lineHeight:"18px"},children:l.description}):null,d=e.jsxs(e.Fragment,{children:[l.helperText&&e.jsx(k.Text,{style:{fontSize:"12px",fontWeight:400,color:"var(--sa-text-subtlest, #6b6e76)",lineHeight:"18px"},children:l.helperText}),l.errorText&&r==="error"&&e.jsx(k.Text,{style:{fontSize:"12px",fontWeight:400,color:"var(--sa-text-error, #a4133c)",lineHeight:"18px"},children:l.errorText}),l.errorMessage&&!l.errorText&&e.jsx(k.Text,{style:{fontSize:"12px",fontWeight:400,color:"var(--sa-text-error, #a4133c)",lineHeight:"18px"},children:l.errorMessage})]}),y=e.jsx("input",{type:"file",style:{display:"none"},ref:n,onChange:x=>{var L;return l.handleOnChangeFile(((L=x.target.files)==null?void 0:L.item(0))||null)},accept:(p=l.fileSupportOption)==null?void 0:p.map(x=>"."+(x==null?void 0:x.toLowerCase())).join(", ")}),b=e.jsxs(u.Box,{direction:"column",fullWidth:!0,style:{minHeight:"69px"},borderRadius:"rounded-md",display:"flex",justify:"center",align:"center",cursor:"pointer",gap:"md",...l.containerProps,children:[y,(l.fileSelected||l.defaultFile)&&e.jsx(_n,{fileSelected:l.fileSelected,defaultFile:l.defaultFile,handleOnDeleteFile:l.handleOnDeleteFile,handleOnClickFile:o}),!l.fileSelected&&!l.defaultFile&&e.jsx(bn,{fileSupports:l.fileSupportOption,isDesktop:c,errorMessage:s?l.errorText||l.errorMessage||" ":void 0,status:s?"error":"default",handleOnClick:o,handleOnFileChange:l.handleOnChangeFile})]});return t==="outside-left"?e.jsxs(oe.Flex,{direction:"row",align:"flex-start",gap:"sm",style:{width:"100%"},children:[e.jsxs(oe.Flex,{direction:"column",gap:"xs",style:{width:"40%",minWidth:"120px",paddingTop:"10px"},children:[i,a]}),e.jsxs(oe.Flex,{direction:"column",gap:"sm",style:{flex:1,minWidth:0},children:[b,d]})]}):e.jsxs(oe.Flex,{direction:"column",gap:"sm",style:{width:"100%"},children:[i,a,b,d]})},qn=({size:r="md",direction:t="vertical",requiredTitle:l="(Required)",fullWidth:n=!1,...o})=>{var i,a,d;const c=o.hideMessageError||!1,s=t==="horizontal"?r==="sm"?342:r==="lg"?400:342:void 0;return e.jsxs(u.Box,{gap:t==="horizontal"?"spacing-96":"sm",direction:t==="horizontal"?"row":"column",...o.containerProps,children:[o.title&&e.jsx(ne,{condition:!!o.inputProps.required,fallback:e.jsxs(u.Box,{direction:"column",customMaxWidth:s,fullWidth:n,children:[e.jsx(se,{children:o.title}),e.jsx(k.Text,{fontSize:r,color:"gray-500",children:o.description})]}),children:e.jsxs(u.Box,{direction:"column",customMaxWidth:s,fullWidth:n,children:[e.jsxs(oe.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(se,{fontSize:r,children:o.title}),e.jsx(se,{color:"error",fontSize:r,children:l}),e.jsx(ne,{condition:!!((i=o.tooltip)!=null&&i.label),children:e.jsx(De.Tooltip,{label:(a=o.tooltip)==null?void 0:a.label,arrowPosition:(d=o.tooltip)==null?void 0:d.arrowPosition,...o.tooltip,children:e.jsx(E.Icon,{name:"InfoCircle",size:r==="lg"?"sm":"xs",style:{color:"var(--sa-color-info-500, #00abeb)",marginTop:"6px"}})})})]}),e.jsx(ne,{condition:!!o.description,children:e.jsx(k.Text,{fontSize:r,color:"gray-500",children:o.description})})]})}),e.jsxs(oe.Flex,{direction:"column",gap:"xs",children:[e.jsx(Fl,{...o.inputProps,status:o.errorMessage?"error":"default"}),!c&&o.errorMessage&&e.jsx(qe,{message:o.errorMessage})]})]})},Zn=({size:r="md",direction:t="vertical",requiredTitle:l="(Required)",fullWidth:n=!1,required:o=!1,...c})=>{var a,d,y,b;const s=c.hideMessageError||!1,i=t==="horizontal"?r==="sm"?342:r==="lg"?400:342:void 0;return e.jsxs(u.Box,{gap:t==="horizontal"||t==="horizontal-inline"?"spacing-96":"sm",direction:t==="horizontal"||t==="horizontal-inline"?"row":"column",...c.containerProps,children:[c.title&&e.jsx(ne,{condition:!!o,fallback:e.jsxs(u.Box,{direction:"column",customMaxWidth:i,fullWidth:n,children:[e.jsx(se,{children:c.title}),e.jsx(Le.Body3,{props:{color:"gray-500"},children:c.description})]}),children:e.jsxs(u.Box,{direction:"column",customMaxWidth:i,fullWidth:n,children:[e.jsxs(oe.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(se,{fontSize:r,children:c.title}),e.jsx(se,{color:"error",fontSize:r,children:l}),e.jsx(ne,{condition:!!((a=c.tooltip)!=null&&a.label),children:e.jsx(De.Tooltip,{label:(d=c.tooltip)==null?void 0:d.label,arrowPosition:(y=c.tooltip)==null?void 0:y.arrowPosition,...c.tooltip,children:e.jsx(E.Icon,{name:"InfoCircle",size:r==="lg"?"sm":"xs",style:{color:"var(--sa-color-info-500, #00abeb)",marginTop:"6px"}})})})]}),e.jsx(ne,{condition:!!c.description,children:e.jsx(k.Text,{fontSize:r,color:"gray-500",children:c.description})})]})}),e.jsx(u.Box,{gap:t==="horizontal-inline"?"xl":"md",direction:t==="horizontal-inline"?"row":"column",align:"flex-start",children:e.jsx(Ir,{of:(b=c.checkBoxesList)==null?void 0:b.map(p=>({...p,isChecked:c.checkBoxesAreChecked.includes(p.id)})),render:p=>p.renderBadge?e.jsxs(u.Box,{direction:"row",justify:"space-between",gap:"lg",...c.badgeContainerProps,children:[e.jsx(ir.Checkbox,{name:p.name,value:p.id,checked:p.isChecked,onChange:x=>c.onChecked(x.target.value,p),label:p.name,description:p.description}),p.renderBadge]}):e.jsx(ir.Checkbox,{name:p.name,value:p.id,checked:p.isChecked,onChange:x=>c.onChecked(x.target.value,p),label:p.name,description:p.description})})}),!s&&c.errorMessage&&e.jsx(qe,{message:c.errorMessage})]})},Gn=({position:r="vertical",size:t="md",fullWidth:l=!1,...n})=>{var c;const o=r==="horizontal-inline"||r==="horizontal-block"?t==="sm"?342:t==="lg"?400:342:void 0;return e.jsxs(u.Box,{gap:r==="horizontal-inline"||r==="horizontal-block"?"spacing-96":"sm",direction:r==="horizontal-inline"||r==="horizontal-block"?"row":"column",children:[e.jsx(ne,{condition:!!n.description||!!n.title,children:e.jsxs(u.Box,{direction:"column",customMaxWidth:o,fullWidth:l,children:[n.title&&e.jsx(se,{children:n.title}),e.jsx(ne,{condition:!!n.description,children:e.jsx(k.Text,{color:"gray-500",children:n.description})})]})}),e.jsx(u.Box,{gap:"sm",direction:r==="horizontal"||r==="horizontal-inline"?"row":"column",align:"flex-start",flexWrap:"wrap",children:e.jsx(Ir,{of:(c=n.radioList)==null?void 0:c.map(s=>({...s,isChecked:n.radioIsChecked===s.id})),render:({value:s,id:i,isChecked:a,subInput:d,label:y,description:b})=>e.jsxs(u.Box,{direction:"column",gap:"xs",customMaxWidth:o,children:[e.jsx(qr.Radio,{id:`${i.toString()}-${s}`,name:n.groupName||y,label:y,value:s,checked:a,onChange:p=>n.onChecked({id:i,label:p.target.name,value:p.target.value}),disabled:n.disableAll},i),b&&e.jsx(k.Text,{color:"gray-500",style:{marginLeft:28},children:b}),d]})})}),n.errorMessage&&e.jsx(qe,{message:n.errorMessage})]})},Qn=({size:r="md",direction:t="vertical",requiredTitle:l="(Required)",fullWidth:n=!1,...o})=>{var i,a,d;const c=o.hideMessageError||!1,s=t==="horizontal"?r==="sm"?342:r==="lg"?400:342:void 0;return e.jsxs(u.Box,{gap:t==="horizontal"?"spacing-96":"sm",direction:t==="horizontal"?"row":"column",...o.containerProps,children:[o.title&&e.jsx(ne,{condition:!!o.inputProps.required,fallback:e.jsxs(u.Box,{direction:"column",customMaxWidth:s,fullWidth:n,children:[e.jsx(se,{children:o.title}),e.jsx(k.Text,{fontSize:r,color:"gray-500",children:o.description})]}),children:e.jsxs(u.Box,{direction:"column",customMaxWidth:s,fullWidth:n,children:[e.jsxs(oe.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(se,{fontSize:r,children:o.title}),e.jsx(se,{color:"error",fontSize:r,children:l}),e.jsx(ne,{condition:!!((i=o.tooltip)!=null&&i.label),children:e.jsx(De.Tooltip,{label:(a=o.tooltip)==null?void 0:a.label,arrowPosition:(d=o.tooltip)==null?void 0:d.arrowPosition,...o.tooltip,children:e.jsx(E.Icon,{name:"InfoCircle",size:r==="lg"?"sm":"xs",style:{color:"var(--sa-color-info-500, #00abeb)",marginTop:"6px"}})})})]}),e.jsx(ne,{condition:!!o.description,children:e.jsx(k.Text,{fontSize:r,color:"gray-500",children:o.description})})]})}),e.jsxs(oe.Flex,{direction:"column",gap:"xs",children:[e.jsx(_r.Textarea,{ref:o.inputRef,size:r,...o.inputProps,status:o.errorMessage?"error":"default"}),!c&&o.errorMessage&&e.jsx(qe,{message:o.errorMessage})]})]})},Un=({size:r="md",direction:t="vertical",requiredTitle:l="(Required)",required:n=!1,fullWidth:o=!1,...c})=>{var i,a,d;const s=t==="horizontal"?r==="sm"?342:r==="lg"?400:342:void 0;return e.jsxs(u.Box,{gap:t==="horizontal"?"spacing-96":"sm",direction:t==="horizontal"?"row":"column",...c.containerProps,children:[c.title&&e.jsx(ne,{condition:n,fallback:e.jsxs(u.Box,{direction:"column",customMaxWidth:s,fullWidth:o,children:[e.jsx(se,{children:c.title}),e.jsx(k.Text,{fontSize:r,color:"gray-500",children:c.titleDescription})]}),children:e.jsxs(u.Box,{direction:"column",customMaxWidth:s,fullWidth:o,children:[e.jsxs(oe.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(se,{fontSize:r,children:c.title}),e.jsx(se,{color:"error",fontSize:r,children:l}),e.jsx(ne,{condition:!!((i=c.tooltip)!=null&&i.label),children:e.jsx(De.Tooltip,{label:(a=c.tooltip)==null?void 0:a.label,arrowPosition:(d=c.tooltip)==null?void 0:d.arrowPosition,...c.tooltip,children:e.jsx(E.Icon,{name:"InfoCircle",size:r==="lg"?"sm":"xs",style:{color:"var(--sa-color-info-500, #00abeb)",marginTop:"6px"}})})})]}),e.jsx(ne,{condition:!!c.titleDescription,children:e.jsx(k.Text,{fontSize:r,color:"gray-500",children:c.titleDescription})})]})}),e.jsx(cr.Toggle,{checked:c.checked,onChange:c.onChange,label:c.label,description:c.description}),c.errorMessage&&e.jsx(qe,{message:c.errorMessage})]})},Jn=({variant:r="primary",size:t="md",...l})=>{const n=nr.useColor(),o=s=>{var a,d,y,b,p,x;if(!s)return;const i=l.disabled?"var(--sa-text-disable, #181a198f)":r==="secondary"?"var(--sa-text-subtle, #8c8f97)":r==="secondary-danger"?(d=(a=n==null?void 0:n.computed)==null?void 0:a.red)==null?void 0:d[600]:r==="secondary-primary"?(b=(y=n==null?void 0:n.computed)==null?void 0:y.blue)==null?void 0:b[700]:(x=(p=n==null?void 0:n.computed)==null?void 0:p.gray)==null?void 0:x[50];return e.jsx(E.Icon,{name:s,size:t,style:{color:i}})},c=()=>{var i,a,d,y;if(r!=="secondary-danger"&&r!=="secondary-primary")return l.title;const s={color:l.disabled?"var(--sa-text-disable, #181a198f)":r==="secondary-danger"?(a=(i=n==null?void 0:n.computed)==null?void 0:i.red)==null?void 0:a[600]:(y=(d=n==null?void 0:n.computed)==null?void 0:d.blue)==null?void 0:y[700]};switch(t){case"xs":return e.jsx(Le.Body2,{props:{style:s},children:l.title});case"sm":case"md":return e.jsx(Le.SubH3,{props:{style:s},children:l.title});case"lg":return e.jsx(Le.SubH2,{props:{style:s},children:l.title});default:return l.title}};return e.jsx(P.Button,{fullWidth:!0,disabled:l.disabled,primary:r==="primary",secondary:r==="secondary"||r==="secondary-danger"||r==="secondary-primary",success:r==="success",onClick:l.onClick,type:l.type,iconLeft:o(l.iconLeft),iconRight:o(l.iconRight),size:t,children:c()})},Yn=r=>e.jsx(Le.H5,{props:{...r},children:r.title}),Xn=({size:r="md",direction:t="vertical",requiredTitle:l="(Required)",fullWidth:n=!1,...o})=>{var i,a,d;const c=o.hideMessageError||!1,s=t==="horizontal"?r==="sm"?342:r==="lg"?400:342:void 0;return e.jsxs(u.Box,{gap:t==="horizontal"?"spacing-96":"sm",direction:t==="horizontal"?"row":"column",onClick:o.onClickContainer,children:[o.title&&e.jsx(ne,{condition:!!o.inputProps.required,fallback:e.jsxs(u.Box,{direction:"column",customMaxWidth:s,fullWidth:n,children:[e.jsx(se,{children:o.title}),e.jsx(k.Text,{fontSize:r,color:"gray-500",children:o.description})]}),children:e.jsxs(u.Box,{direction:"column",customMaxWidth:s,fullWidth:n,children:[e.jsxs(oe.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(se,{fontSize:r,children:o.title}),e.jsx(se,{color:"error",fontSize:r,children:l}),e.jsx(ne,{condition:!!((i=o.tooltip)!=null&&i.label),children:e.jsx(De.Tooltip,{label:(a=o.tooltip)==null?void 0:a.label,arrowPosition:(d=o.tooltip)==null?void 0:d.arrowPosition,...o.tooltip,children:e.jsx(E.Icon,{name:"InfoCircle",size:r==="lg"?"sm":"xs",style:{color:"var(--sa-color-info-500, #00abeb)",marginTop:"6px"}})})})]}),e.jsx(ne,{condition:!!o.description,children:e.jsx(k.Text,{fontSize:r,color:"gray-500",children:o.description})})]})}),e.jsxs(oe.Flex,{direction:"column",gap:"xs",children:[e.jsx(u.Box,{direction:"column",style:{width:t==="horizontal"&&o.customWidth?o.customWidth:t==="horizontal"?"343px":""},children:e.jsx(Ke.StarasiaDate,{size:r,...o.inputProps,status:o.errorMessage?"error":void 0})}),!c&&o.errorMessage&&e.jsx(qe,{message:o.errorMessage})]})]})};async function Kn(r,t){const l=new Image;l.src=r,await new Promise((c,s)=>{l.onload=c,l.onerror=s});const n=document.createElement("canvas");n.width=t.width,n.height=t.height;const o=n.getContext("2d",{alpha:!0});if(!o)throw new Error("No 2D context");return o.drawImage(l,t.x,t.y,t.width,t.height,0,0,t.width,t.height),new Promise((c,s)=>{n.toBlob(i=>{if(!i)return s("Canvas is empty");const a=new File([i],"cropped.png",{type:"image/png"});c(a)},"image/png")})}const El={"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},Ml=h.forwardRef(({handleUpload:r,urlImage:t,isUploading:l,croppedImage:n,setCroppedImage:o,size:c="96",aspect:s="1:1",containerProps:i,maxFileSize:a=2,onError:d},y)=>{const b=pe.useMediaQuery("md"),[p,x]=h.useState(!1),[L,v]=h.useState(null),[T,F]=h.useState(!1),[I,S]=h.useState({x:0,y:0}),[w,V]=h.useState(1),[z,D]=h.useState(null);h.useEffect(()=>{t===null&&o(null)},[t]);const M=h.useCallback((Q,J)=>{D(J)},[]),j=Q=>{var ie;const J=(ie=Q.target.files)==null?void 0:ie[0];if(!J)return;const de=new FileReader;de.onload=()=>{v(de.result),F(!0)},de.readAsDataURL(J)},H=async()=>{if(!(!L||!z))try{const Q=await Kn(L,z);if(a&&Q.size>a*1024*1024){d==null||d(`Ukuran file maksimal ${a}MB`);return}r==null||r(Q);const J=URL.createObjectURL(Q);o(J,Q),F(!1)}catch{d==null||d("Gagal memproses gambar")}},Z=h.useRef(null),K=()=>{Z.current&&Z.current.click()};h.useImperativeHandle(y,()=>({openFileDialog:()=>{var Q;(Q=Z.current)==null||Q.click()}}));const te=parseInt(c,10),ge=El[s];let ue,ce;return ge>=1?(ce=te,ue=te*ge):(ue=te,ce=te/ge),e.jsxs(u.Box,{direction:"column",display:"flex",position:"relative",bg:(i==null?void 0:i.bg)||"gray-200",borderStyle:(i==null?void 0:i.borderStyle)||"border-none",borderColor:(i==null?void 0:i.borderColor)||"gray-200",borderWidth:(i==null?void 0:i.borderWidth)||"border-2",borderRadius:(i==null?void 0:i.borderRadius)||"rounded-md",overflow:"overflow-hidden",align:"center",justify:"center",style:{width:i!=null&&i.fullWidth?"100%":`${ue}px`,height:i!=null&&i.fullWidth?"auto":`${ce}px`,aspectRatio:ge,flexShrink:0},onMouseEnter:()=>x(!0),onMouseLeave:()=>x(!1),children:[n||t?e.jsx("img",{src:n||t||void 0,alt:"Profile",style:{objectFit:"cover",width:"100%",height:"100%"}}):e.jsx(u.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(c)/2<40?Number(c)/2:40,height:Number(c)/2<40?Number(c)/2:40}})}),e.jsxs(u.Box,{direction:"column",position:"absolute",display:"flex",align:"center",justify:"center",cursor:"pointer",style:{inset:0,backgroundColor:"var(--sa-color-black-alpha-a30, #080f214a)",opacity:p?1:0,transition:"opacity 0.3s ease-in-out"},onClick:K,children:[e.jsx("input",{ref:Z,type:"file",accept:"image/*",onChange:j,disabled:l,style:{display:"none"}}),e.jsxs(u.Box,{display:"flex",align:"center",gap:"spacing-2",direction:"row",children:[e.jsx(E.Icon,{name:"Edit3",style:{color:"var(--sa-background-primary, #ffffff)"}}),e.jsx(ne,{condition:c.toNumber()>80,children:e.jsx(k.Text,{color:"gray-50",fontSize:c.toNumber()>80?"sm":"md",fontWeight:"medium",children:"Edit Image"})})]})]}),l&&e.jsx(u.Box,{direction:"column",position:"absolute",display:"flex",align:"center",justify:"center",style:{inset:0,zIndex:20,backgroundColor:"var(--sa-color-white-alpha-a80, #e5e9f640)"},children:e.jsx(u.Box,{direction:"column",borderRadius:"rounded-full",style:{animation:"spin 1s linear infinite",border:"2px solid transparent",height:"2rem",width:"2rem"},borderColor:"info-600"})}),T&&Zr.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:()=>F(!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:b?s==="1:1"?"min(90vw, 480px)":`min(90vw, ${ue*2}px)`:"calc(100vw - 2rem)",display:"flex",flexDirection:"column"},onClick:Q=>Q.stopPropagation(),children:[e.jsx("div",{style:{position:"relative",width:"100%",height:"20rem",backgroundColor:"var(--sa-color-gray-100)"},children:L&&e.jsx(_l,{image:L,crop:I,zoom:w,aspect:s?El[s]:void 0,onCropChange:S,onZoomChange:V,onCropComplete:M,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,onClick:()=>F(!1),children:"Cancel"}),e.jsx(P.Button,{size:"sm",primary:!0,onClick:H,children:"Crop"})]})]})}),document.body)]})}),$n=({size:r="md",direction:t="vertical",requiredTitle:l="(Required)",fullWidth:n=!1,required:o=!1,...c})=>{var a,d,y;const s=c.hideMessageError||!1,i=t==="horizontal"?r==="sm"?342:r==="lg"?400:342:void 0;return e.jsxs(u.Box,{gap:t==="horizontal"?"spacing-96":"sm",direction:t==="horizontal"?"row":"column",...c.containerProps,children:[c.title&&e.jsx(ne,{condition:!!o,fallback:e.jsxs(u.Box,{direction:"column",customMaxWidth:i,fullWidth:n,children:[e.jsx(se,{children:c.title}),e.jsx(k.Text,{fontSize:r,color:"gray-500",children:c.description})]}),children:e.jsxs(u.Box,{direction:"column",customMaxWidth:i,fullWidth:n,children:[e.jsxs(oe.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(se,{fontSize:r,children:c.title}),e.jsx(se,{color:"error",fontSize:r,children:l}),e.jsx(ne,{condition:!!((a=c.tooltip)!=null&&a.label),children:e.jsx(De.Tooltip,{label:(d=c.tooltip)==null?void 0:d.label,arrowPosition:(y=c.tooltip)==null?void 0:y.arrowPosition,...c.tooltip,children:e.jsx(E.Icon,{name:"InfoCircle",size:r==="lg"?"sm":"xs",style:{color:"var(--sa-color-info-500, #00abeb)",marginTop:"6px"}})})})]}),e.jsx(ne,{condition:!!c.description,children:e.jsx(k.Text,{fontSize:r,color:"gray-500",children:c.description})})]})}),e.jsxs(oe.Flex,{direction:"column",gap:"xs",children:[e.jsx(Ml,{...c.inputProps}),!s&&c.errorMessage&&e.jsx(qe,{message:c.errorMessage})]})]})},Rn=({size:r="md",direction:t="vertical",requiredTitle:l="(Required)",fullWidth:n=!1,...o})=>{var s,i,a;const c=t==="horizontal"?r==="sm"?342:r==="lg"?400:342:void 0;return e.jsxs(u.Box,{gap:t==="horizontal"?"spacing-96":"sm",direction:t==="horizontal"?"row":"column",...o.containerProps,children:[o.title&&e.jsx(ne,{condition:!!o.inputProps.required,fallback:e.jsxs(u.Box,{direction:"column",customMaxWidth:c,fullWidth:n,children:[e.jsx(se,{children:o.title}),e.jsx(k.Text,{fontSize:r,color:"gray-500",children:o.description})]}),children:e.jsxs(u.Box,{direction:"column",customMaxWidth:c,fullWidth:n,children:[e.jsxs(oe.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(se,{fontSize:r,children:o.title}),e.jsx(se,{color:"error",fontSize:r,children:l}),e.jsx(ne,{condition:!!((s=o.tooltip)!=null&&s.label),children:e.jsx(De.Tooltip,{label:(i=o.tooltip)==null?void 0:i.label,arrowPosition:(a=o.tooltip)==null?void 0:a.arrowPosition,...o.tooltip,children:e.jsx(E.Icon,{name:"InfoCircle",size:r==="lg"?"sm":"xs",style:{color:"var(--sa-color-info-500, #00abeb)",marginTop:"6px"}})})})]}),e.jsx(ne,{condition:!!o.description,children:e.jsx(k.Text,{fontSize:r,color:"gray-500",children:o.description})})]})}),o.inputProps.extended&&o.inputProps.extended]})},ec=({items:r,id:t,handleOnUpdate:l,width:n,toggleShow:o=!0,disabled:c=!1})=>{var y;const[s,i]=h.useState([]);h.useEffect(()=>{r&&i([...r.map(b=>({id:b.id,isActive:b.isActive}))])},[r]);const a=(y=s.find(b=>b.id===t))==null?void 0:y.isActive,d=h.useCallback(()=>{i(b=>b.map(p=>p.id===t?{...p,isActive:!p.isActive}:p)),l&&l(!a)},[t,l,a]);return e.jsx(u.Box,{direction:"row",gap:"md",style:{width:n},children:o&&e.jsx(cr.Toggle,{disabled:c,checked:a,onChange:d,label:a?"Active":"Inactive"})})},rc={InputText:un,InputDropdown:yn,InputSingleFile:qn,CheckBoxOptions:Zn,RadioOptions:Gn,InputTextArea:Qn,ToggleForm:Un,ActionButton:Jn,FormTitle:Yn,InputDate:Xn,InputImgFile:$n,Custom:Rn},Ll=({customBottom:r})=>{const[t,l]=h.useState(!1),n=()=>{window.scrollY>window.screenY?l(!0):l(!1)},o=()=>{window.scrollTo({top:0,behavior:"smooth"})};return h.useEffect(()=>(window.addEventListener("scroll",n),()=>{window.removeEventListener("scroll",n)}),[]),e.jsx(u.Box,{direction:"column",style:{position:"fixed",bottom:0,right:0},children:e.jsx(u.Box,{direction:"column",position:"absolute",style:{bottom:r||"1.6rem",right:"2rem",transform:t?"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(E.Icon,{width:16,size:"xs",name:"ArrowPullUp",style:{color:"var(--sa-background-brand, #04254f)"}})})})})},Fe="sa-sidepanel-item",Tl="sa-sidepanel-item-styles",tc=`
|
|
46
|
+
`,document.head.appendChild(r)},Lr=r=>r==="right"?"right":r==="center"?"center":"left",an=/^(#|rgb|hsl|var\()/,Tr=r=>r?an.test(r)?r:`var(--sa-background-${r})`:void 0,dn=(r,t)=>{if(t)return r[t]},hn=(r,t)=>r==null&&t==null?0:r==null?-1:t==null?1:typeof r=="number"&&typeof t=="number"?r-t:String(r).localeCompare(String(t)),fn=({columns:r,data:t,getRowKey:l,rowBg:n,size:o="md",resizable:c=!1,layout:s="auto",widthStorageKey:i,columnState:a,onColumnStateChange:d,columnMenu:y=!1,sort:b,defaultSort:p,onSortChange:x,height:L,mobileLayout:v="cards",mobileBreakpoint:T="md",groupSeparator:F,summary:I,emptyState:S,loading:w=!1,loadingRows:V=8,rowActions:z})=>{sn();const M=!pe.useMediaQuery(T)&&v!=="scroll",j=!!(z!=null&&z.length),[H,Z]=h.useState(null);h.useEffect(()=>{if(!H)return;const C=()=>Z(null),B=setTimeout(()=>document.addEventListener("click",C),0);return()=>{clearTimeout(B),document.removeEventListener("click",C)}},[H]);const[K,te]=h.useState(()=>new Set),ge=a!==void 0,[ue,ce]=h.useState({}),Q=a??ue,J=C=>{d==null||d(C),ge||ce(C)},de=b!==void 0,[ie,fe]=h.useState(p??null),be=de?b??null:ie,ze=!x,He=C=>{x==null||x(C),de||fe(C)},{headerGroups:Te,leafColumns:he,hasGroups:ye}=h.useMemo(()=>{var Se;const C=new Set(Q.hidden??[]),B=(le,ae)=>le.key??(typeof le.accessor=="string"?le.accessor:`col-${ae}`),A=r.map((le,ae)=>{var Ge;if((Ge=le.children)!=null&&Ge.length){const er=le.children.map((Qe,dr)=>({col:Qe,key:B(Qe,`${ae}-${dr}`)})).filter(Qe=>!C.has(Qe.key));return{col:le,key:le.key??`group-${ae}`,isGroup:!0,leaves:er}}const xe={col:le,key:B(le,`${ae}`)};return{col:le,key:xe.key,isGroup:!1,leaves:C.has(xe.key)?[]:[xe]}}).filter(le=>le.leaves.length>0),re=A.some(le=>le.isGroup);let $=A.flatMap(le=>le.leaves);if(!re&&((Se=Q.order)!=null&&Se.length)){const le=new Map(Q.order.map((ae,xe)=>[ae,xe]));$=[...$].sort((ae,xe)=>(le.get(ae.key)??1/0)-(le.get(xe.key)??1/0))}return{headerGroups:A,leafColumns:$,hasGroups:re}},[r,Q]),Ve=h.useMemo(()=>new Map(he.map((C,B)=>[C.key,B])),[he]),Pe=!ye&&he.some(C=>(C.col.headerColSpan??1)>1),Ie=he.map(C=>C.key).join("|"),je=(C,B)=>{const A=C.sortKey??(typeof C.accessor=="string"?C.accessor:void 0);return A?B[A]:void 0},ar=C=>C.sortable??(!!C.sortKey||typeof C.accessor=="string"),m=h.useMemo(()=>{if(!ze||!be)return t;const C=he.find(A=>A.key===be.key);if(!C)return t;const B=be.direction==="asc"?1:-1;return[...t].sort((A,re)=>hn(je(C.col,A),je(C.col,re))*B)},[t,ze,be,he]),q=!ye&&!Pe,Y=!!i&&q,[W,U]=X.useColumnWidths(i??""),N=Y?W:void 0,G=h.useRef(null),[_,Ce]=h.useState();h.useLayoutEffect(()=>{Ce(void 0)},[Ie]),h.useLayoutEffect(()=>{if(!q||_||!G.current)return;const C=G.current.querySelectorAll("th.sa-tl-leaf");Ce(Array.from(C).map(B=>B.offsetWidth))},[_,q]);const[me,Ne]=h.useState(0);h.useLayoutEffect(()=>{if(!ye||!G.current)return;const C=G.current.querySelector(":scope > tr");C&&Ne(C.offsetHeight)},[ye,Ie]);const Ee=(C,B)=>{if((N==null?void 0:N[B])!=null)return N[B];if(C.width!=null)return C.width;if((_==null?void 0:_[B])!=null)return _[B]},Oe=(C,B)=>typeof C.width=="number"?C.width:_==null?void 0:_[B],Re=Q.frozenKey&&!ye&&!Pe?he.findIndex(C=>C.key===Q.frozenKey):-1,Ye=C=>C<=Re,Xe=C=>{if(!_)return 0;let B=0;for(let A=0;A<C;A++)B+=_[A]??0;return B},_e=h.useRef(null),[Vr,jr]=h.useState("100vh");h.useLayoutEffect(()=>{if(L!==void 0)return;const C=()=>{if(_e.current){const B=_e.current.getBoundingClientRect().top;jr(`calc(100vh - ${B}px)`)}};return C(),window.addEventListener("resize",C),()=>window.removeEventListener("resize",C)},[L]);const Ze=(C,B)=>l?l(C,B):B,ht=(C,B,A)=>C.render?C.render(B,A,m):dn(B,C.accessor),ft=he.length+(j?1:0),Al=["80%","55%","70%","45%","90%","60%"],Oc=(C,B)=>Al[(C*7+B*3)%Al.length],Wc=(C,B)=>e.jsx(We.Skeleton,{height:14,width:Oc(C,B),borderRadius:"rounded-sm"}),Ac=Array.from({length:V},(C,B)=>e.jsxs(X.Tr,{children:[he.map(({col:A,key:re},$)=>e.jsx(X.Td,{style:{textAlign:Lr(A.align)},children:Wc(B,$)},`sa-tl-sk-${B}-${re}`)),j&&e.jsx(X.Td,{style:{width:1,padding:0,border:"none"}})]},`sa-tl-sk-${B}`)),zc=(C,B)=>{B||J({...Q,hidden:[...Q.hidden??[],C]})},Hc=C=>J({...Q,frozenKey:Q.frozenKey===C?void 0:C}),Pr=C=>(z??[]).filter(B=>{var A;return!((A=B.hidden)!=null&&A.call(B,C))}),zl={position:"absolute",right:0,top:0,bottom:0,display:"flex",alignItems:"center",gap:4,paddingRight:16,paddingLeft:40,background:"linear-gradient(to right, transparent, var(--sa-background-primary-inverse, #f8f8f8) 40px)"},Nr=(C,B,A,re)=>{var Ge;const $=(Ge=C.disabled)==null?void 0:Ge.call(C,B),Se=(re==null?void 0:re.showLabel)??C.showLabel,le=(re==null?void 0:re.size)??"xs",ae=e.jsx(P.Button,{size:le,variant:C.variant??"tertiary",tone:C.tone??"neutral",disabled:$,onClick:()=>C.onClick(B,A),iconLeft:C.icon?e.jsx(E.Icon,{name:C.icon,size:"sm"}):void 0,children:Se&&C.label}),xe=C.tooltip;return xe?e.jsx(De.Tooltip,{label:xe,position:"top-end",children:ae}):ae},Vc=(C,B)=>{const A=Pr(C);if(!A.length)return null;if(A.length>5){const $=Ze(C,B),Se=(H==null?void 0:H.rowKey)===$;return e.jsx("div",{className:"sa-tl-row-actions",style:zl,onClick:le=>le.stopPropagation(),children:e.jsx(De.Tooltip,{label:"Aksi lainnya",position:"top",children:e.jsx(P.Button,{size:"xs",variant:"tertiary",onClick:le=>{const ae=le.currentTarget.getBoundingClientRect();Z(Se?null:{rowKey:$,top:ae.bottom+4,right:window.innerWidth-ae.right})},children:e.jsx(E.Icon,{name:"MenuVertical",size:"sm"})})})})}return e.jsx("div",{className:"sa-tl-row-actions",style:zl,children:A.map($=>e.jsx(h.Fragment,{children:Nr($,C,B)},$.key))})},jc=(C,B)=>{const A=Pr(C);return A.length?e.jsx("div",{style:{display:"flex",gap:6,flexWrap:"wrap",paddingTop:8,marginTop:8,borderTop:Er},children:A.map(re=>e.jsx(h.Fragment,{children:Nr(re,C,B,{showLabel:!0,size:"sm"})},re.key))}):null},Pc=(C,B)=>{const A=Pr(C);return A.length?e.jsx("div",{style:{display:"flex",gap:4,paddingRight:8,flexShrink:0},children:A.map(re=>e.jsx(h.Fragment,{children:Nr(re,C,B,{showLabel:!1})},re.key))}):null},gt=(C,B)=>{const{col:A,key:re}=C,$=Ve.get(re)??0,Se=Ye($),le=Se&&$===Re,ae=(be==null?void 0:be.key)===re?be.direction:null,xe=y&&!A.disableMenu?e.jsx(Sl,{active:!!ae||Se,canSort:ar(A),canHide:!A.locked,sortDir:ae,frozen:Se,onSort:dr=>He({key:re,direction:dr}),onClearSort:()=>He(null),onToggleFreeze:()=>Hc(re),onHide:()=>zc(re,A.locked)}):null,Ge=A.align==="right",er=A.align==="right"?"flex-end":A.align==="center"?"center":"flex-start",Qe=e.jsxs("span",{style:{flex:1,minWidth:0,display:"flex",alignItems:"center",gap:6,justifyContent:er,overflow:"hidden"},children:[A.icon&&e.jsx(E.Icon,{name:A.icon,size:"sm",style:{flexShrink:0}}),e.jsx("span",{style:Mr,children:A.title})]});return e.jsx(X.Th,{className:`sa-tl-leaf${Se?" sa-tl-frozen":""}`,rowSpan:B==null?void 0:B.rowSpan,colSpan:B==null?void 0:B.colSpan,minWidth:A.minWidth,resizable:q?A.resizable:!1,defaultWidth:Oe(A,$),style:{textAlign:Lr(A.align),width:Ee(A,$),position:"sticky",top:(B==null?void 0:B.top)??0,left:Se?Xe($):void 0,zIndex:Se?3:2,backgroundColor:yr,boxShadow:le?kl:void 0},children:e.jsx("div",{style:{display:"flex",alignItems:"center",gap:6,width:"100%"},children:Ge?e.jsxs(e.Fragment,{children:[xe,Qe]}):e.jsxs(e.Fragment,{children:[Qe,xe]})})},`th-${re}`)},Nc=()=>{const C=[];for(let B=0;B<he.length;){const A=he[B],re=A.col.headerColSpan??1,$=Math.max(1,Math.min(re,he.length-B));C.push(gt(A,$>1?{colSpan:$}:void 0)),B+=$}return C},ut=he.filter(C=>!C.col.hideOnMobile),yt=ut.find(C=>C.col.primary)??ut[0],_c=ut.filter(C=>C!==yt),qc=C=>te(B=>{const A=new Set(B);return A.has(C)?A.delete(C):A.add(C),A}),Hl=(C,B)=>_c.map(({col:A,key:re})=>{const $=ht(A,C,B),Se=typeof $=="string"||typeof $=="number"?e.jsx(k.Text,{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",textAlign:"right"},children:$}):e.jsx("div",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",textAlign:"right"},children:$});return e.jsxs("div",{style:{display:"flex",gap:12,justifyContent:"space-between",alignItems:"baseline"},children:[typeof A.title=="string"?e.jsx(k.Text,{color:"subtle",fontWeight:"medium",style:{color:cn,flexShrink:0},children:A.title}):e.jsx("div",{style:{flexShrink:0},children:A.title}),Se]},re)}),Vl=(C,B)=>{const A=yt?ht(yt.col,C,B):null;return typeof A=="string"||typeof A=="number"?e.jsx(k.Text,{as:"span",style:Mr,children:A}):e.jsx("span",{style:Mr,children:A})},Zc=e.jsx(u.Box,{style:{display:"flex",flexDirection:"column",gap:8,padding:8},children:Array.from({length:V},(C,B)=>e.jsxs(u.Box,{style:{border:Er,borderRadius:"var(--sa-radii-sm, 6px)",padding:12,display:"flex",flexDirection:"column",gap:8},children:[e.jsx(We.Skeleton,{height:16,width:"60%",borderRadius:"rounded-sm"}),e.jsx(We.Skeleton,{height:12,width:"85%",borderRadius:"rounded-sm"}),e.jsx(We.Skeleton,{height:12,width:"70%",borderRadius:"rounded-sm"})]},`sa-tl-sk-card-${B}`))}),jl=e.jsx(u.Box,{fullWidth:!0,style:{minHeight:(S==null?void 0:S.minHeight)??320,display:"flex",alignItems:"center",justifyContent:"center",padding:16},children:S==null?void 0:S.content}),Gc=w?Zc:m.length===0?jl:v==="expand"?e.jsx(u.Box,{style:{display:"flex",flexDirection:"column"},children:m.map((C,B)=>{const A=Ze(C,B),re=K.has(A),$=Tr(n==null?void 0:n(C,B));return e.jsxs("div",{style:{borderBottom:Er,backgroundColor:$},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[e.jsxs("button",{type:"button",onClick:()=>qc(A),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:[Vl(C,B),e.jsx(E.Icon,{name:re?"ChevronUp":"ChevronDown",size:"sm",style:{flexShrink:0}})]}),j&&Pc(C,B)]}),re&&e.jsx("div",{style:{padding:"0 12px 12px",display:"flex",flexDirection:"column",gap:6},children:Hl(C,B)})]},A)})}):e.jsx(u.Box,{style:{display:"flex",flexDirection:"column",gap:8,padding:8},children:m.map((C,B)=>e.jsxs(u.Box,{style:{border:Er,borderRadius:"var(--sa-radii-sm, 6px)",padding:12,display:"flex",flexDirection:"column",gap:6,backgroundColor:Tr(n==null?void 0:n(C,B))},children:[Vl(C,B),Hl(C,B),j&&jc(C,B)]},Ze(C,B)))}),Qc=c&&q&&_!==void 0,Pl=s==="fixed"&&!c&&(q?_!==void 0:!0),Uc=Pl&&!q,Jc=e.jsxs(X.Table,{className:"sa-table-layout",fullWidth:!0,size:o,resizable:Qc,style:Pl?{tableLayout:"fixed"}:void 0,onWidthsChange:Y?U:void 0,children:[Uc&&e.jsxs("colgroup",{children:[he.map(({col:C,key:B},A)=>e.jsx("col",{style:{width:Ee(C,A)}},`col-${B}`)),j&&e.jsx("col",{style:{width:1}})]}),e.jsx(X.Thead,{ref:G,children:ye?e.jsxs(e.Fragment,{children:[e.jsxs(X.Tr,{children:[Te.map(C=>C.isGroup?e.jsx(X.Th,{colSpan:C.leaves.length,style:{textAlign:"center",position:"sticky",top:0,zIndex:2,backgroundColor:yr},children:e.jsx("span",{style:Mr,children:C.col.title})},`grp-${C.key}`):gt(C.leaves[0],{rowSpan:2})),j&&e.jsx(X.Th,{rowSpan:2,style:{position:"sticky",top:0,right:0,zIndex:3,width:1,padding:0,border:"none",backgroundColor:yr}})]}),e.jsx(X.Tr,{children:Te.flatMap(C=>C.isGroup?C.leaves.map(B=>gt(B,{top:me})):[])})]}):e.jsxs(X.Tr,{children:[Nc(),j&&e.jsx(X.Th,{style:{position:"sticky",top:0,right:0,zIndex:3,width:1,padding:0,border:"none",backgroundColor:yr}})]})}),e.jsx(X.Tbody,{children:w?Ac:m.length===0?e.jsx(X.Tr,{children:e.jsx(X.Td,{colSpan:ft,children:jl})}):e.jsxs(e.Fragment,{children:[m.map((C,B)=>{const A=F==null?void 0:F(C,B,B>0?m[B-1]:void 0),re=Tr(n==null?void 0:n(C,B));return e.jsxs(h.Fragment,{children:[A!=null&&A!==!1&&e.jsx(X.Tr,{children:e.jsx(X.Td,{colSpan:ft,style:{backgroundColor:yr},children:A})}),e.jsxs(X.Tr,{children:[he.map(({col:$,key:Se},le)=>{var Nl;const ae=(Nl=$.cellProps)==null?void 0:Nl.call($,C,B,m);if(ae!=null&&ae.hidden)return null;const xe=Ye(le),Ge=xe&&le===Re,er=ht($,C,B),Qe=typeof $.bg=="function"?$.bg(C,B,m):$.bg,dr=Tr(Qe)??re;return e.jsx(X.Td,{className:xe?"sa-tl-frozen":void 0,colSpan:ae==null?void 0:ae.colSpan,rowSpan:ae==null?void 0:ae.rowSpan,style:{textAlign:Lr($.align),width:Ee($,le),minWidth:$.minWidth,position:xe?"sticky":void 0,left:xe?Xe(le):void 0,zIndex:xe?1:void 0,boxShadow:Ge?kl:void 0,...dr?{"--sa-tl-bg":dr}:{}},children:typeof er=="string"?e.jsx(k.Text,{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",textAlign:Lr($.align)},children:er}):er},`tl-cell-${B}-${Se}`)}),j&&e.jsx(X.Td,{style:{position:"sticky",right:0,width:1,padding:0,overflow:"visible",zIndex:2,border:"none"},children:Vc(C,B)})]})]},Ze(C,B))}),I!=null&&e.jsx(X.Tr,{children:e.jsx(X.Td,{colSpan:ft,children:I})})]})})]}),pt=H?m.findIndex((C,B)=>Ze(C,B)===H.rowKey):-1,bt=pt>=0?m[pt]:null;return e.jsxs(e.Fragment,{children:[e.jsx(u.Box,{ref:_e,fullWidth:!0,style:{overflow:"auto",height:L??Vr},children:M?Gc:Jc}),H&&bt&&e.jsx("div",{className:"sa-tl-kebab-menu",style:{top:H.top,right:H.right},onClick:C=>C.stopPropagation(),children:Pr(bt).map(C=>e.jsx("div",{style:{padding:"2px 4px"},children:Nr(C,bt,pt,{showLabel:!0,size:"sm"})},C.key))})]})},st=r=>r==="asc"||r==="desc",gn=(r={})=>{const{sortKeyParam:t="sortBy",sortOrderParam:l="sortOrder",pageKey:n="page",defaultSort:o=null,paramKeys:c,scopeId:s,storage:i=rt}=r,{searchParams:a,setSearchParams:d,searchQueries:y}=Be(),b=a.toString(),p=s?sr.tableSort(s):void 0,x=h.useRef(!1);h.useEffect(()=>{if(x.current||(x.current=!0,!p)||a.has(t)||a.has(l))return;const S=i.get(p);!(S!=null&&S.key)||!st(S.direction)||d({...Object.fromEntries(a.entries()),[t]:S.key,[l]:S.direction})},[]);const L=h.useMemo(()=>{const S=a.get(t),w=a.get(l);return S&&st(w)?{key:S,direction:w}:o},[b,t,l,o]);h.useEffect(()=>{if(!p)return;const S=a.get(t),w=a.get(l);S&&st(w)?i.set(p,{key:S,direction:w}):i.remove(p)},[b,p,t,l,i]);const v=(c==null?void 0:c.sortBy)??"sortBy",T=(c==null?void 0:c.sortOrder)??"sortOrder",F=h.useMemo(()=>L?{[v]:L.key,[T]:L.direction}:{},[L,v,T]),I=h.useCallback(S=>{const w={...y};S?(w[t]=S.key,w[l]=S.direction):(delete w[t],delete w[l]),delete w[n],d(w)},[y,t,l,n,d]);return{sort:L,setSort:I,params:F}},Ir=({of:r,render:t})=>h.Children.toArray(r==null?void 0:r.map((l,n,o)=>t(l,n,o))),ne=({condition:r,fallback:t,children:l,loading:n,isLoading:o})=>e.jsx(e.Fragment,{children:o?n:r?l:t}),se=r=>e.jsx(k.Text,{...r,fontFamily:"Poppins",fontSize:r.fontSize||"md",fontWeight:r.fontWeight||"medium",color:r.color||"gray-700",children:r.children}),qe=r=>e.jsx(k.Text,{color:"red-600",fontSize:"sm",children:r.message}),un=({size:r="md",direction:t="vertical",requiredTitle:l="(Required)",fullWidth:n=!1,...o})=>{var i,a,d;const c=o.hideMessageError||!1,s=t==="horizontal"?r==="sm"?342:r==="lg"?400:342:void 0;return e.jsxs(u.Box,{gap:t==="horizontal"?"spacing-96":"sm",direction:t==="horizontal"?"row":"column",...o.containerProps,children:[o.title&&e.jsx(ne,{condition:!!o.inputProps.required,fallback:e.jsxs(u.Box,{direction:"column",customMaxWidth:s,fullWidth:n,children:[e.jsx(se,{children:o.title}),e.jsx(k.Text,{fontSize:r,color:"gray-500",children:o.description})]}),children:e.jsxs(u.Box,{direction:"column",customMaxWidth:s,fullWidth:n,children:[e.jsxs(oe.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(se,{fontSize:r,children:o.title}),e.jsx(se,{color:"error",fontSize:r,children:l}),e.jsx(ne,{condition:!!((i=o.tooltip)!=null&&i.label),children:e.jsx(De.Tooltip,{label:(a=o.tooltip)==null?void 0:a.label,arrowPosition:(d=o.tooltip)==null?void 0:d.arrowPosition,...o.tooltip,children:e.jsx(E.Icon,{name:"InfoCircle",size:r==="lg"?"sm":"xs",style:{color:"var(--sa-color-info-500, #00abeb)",marginTop:"6px"}})})})]}),e.jsx(ne,{condition:!!o.description,children:e.jsx(k.Text,{fontSize:r,color:"gray-500",children:o.description})})]})}),e.jsxs(u.Box,{direction:"column",gap:"xs",fullWidth:o.inputProps.fullWidth||!1,children:[e.jsx(Je.Input,{ref:o.inputRef,size:r,...o.inputProps,status:o.errorMessage?"error":"default",fullWidth:!0}),!c&&o.errorMessage&&e.jsx(qe,{message:o.errorMessage}),o.inputProps.extended&&o.inputProps.extended]})]})},yn=({size:r="md",direction:t="vertical",requiredTitle:l="(Required)",fullWidth:n=!1,...o})=>{var i,a,d;const c=o.hideMessageError||!1,s=t==="horizontal"?r==="sm"?342:r==="lg"?400:342:void 0;return e.jsxs(u.Box,{gap:t==="horizontal"?"spacing-96":"sm",direction:t==="horizontal"?"row":"column",onClick:o.onClickContainer,children:[o.title&&e.jsx(ne,{condition:!!o.inputProps.required,fallback:e.jsxs(u.Box,{direction:"column",customMaxWidth:s,fullWidth:n,children:[e.jsx(se,{children:o.title}),e.jsx(k.Text,{fontSize:r,color:"gray-500",children:o.description})]}),children:e.jsxs(u.Box,{direction:"column",customMaxWidth:s,fullWidth:n,children:[e.jsxs(oe.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(se,{fontSize:r,children:o.title}),e.jsx(se,{color:"error",fontSize:r,children:l}),e.jsx(ne,{condition:!!((i=o.tooltip)!=null&&i.label),children:e.jsx(De.Tooltip,{label:(a=o.tooltip)==null?void 0:a.label,arrowPosition:(d=o.tooltip)==null?void 0:d.arrowPosition,...o.tooltip,children:e.jsx(E.Icon,{name:"InfoCircle",size:r==="lg"?"sm":"xs",style:{color:"var(--sa-color-info-500, #00abeb)",marginTop:"6px"}})})})]}),e.jsx(ne,{condition:!!o.description,children:e.jsx(k.Text,{fontSize:r,color:"gray-500",children:o.description})})]})}),e.jsxs(u.Box,{direction:"column",gap:"xs",fullWidth:o.inputProps.fullWidth||!1,children:[e.jsx(u.Box,{direction:"column",style:{width:o.inputProps.fullWidth?"100%":t==="horizontal"&&o.customWidth?o.customWidth:t==="horizontal"?"343px":""},children:e.jsx(lr.Dropdown,{size:r,...o.inputProps,error:!!o.errorMessage})}),!c&&o.errorMessage&&e.jsx(qe,{message:o.errorMessage}),o.inputProps.extended&&o.inputProps.extended]})]})},pn=(r,t)=>typeof r=="string"&&r||t==="error"?"var(--sa-border-danger)":"var(--sa-border-subtle)",bn=r=>{var i;const[t,l]=h.useState(!1),n=a=>{a.preventDefault(),a.stopPropagation()},o=a=>{a.preventDefault(),a.stopPropagation(),a.dataTransfer&&r.handleOnFileChange(a.dataTransfer.files.item(0))},c=a=>{a.preventDefault(),l(!0)},s=a=>{a.preventDefault(),l(!1)};return e.jsxs(u.Box,{width:"width-full",paddingInline:"md",direction:"row",gap:"sm",align:"center",onClick:r.handleOnClick,onDragOver:n,onDrop:o,onDragEnter:c,onDragLeave:s,paddingBlock:"md",borderRadius:"rounded-md",style:{border:t?"1px solid var(--sa-border-info)":`1px solid ${pn(r.errorMessage,r.status)}`},children:[e.jsx(E.Icon,{name:"Upload",size:"lg",style:{width:30,height:30}}),e.jsxs(oe.Flex,{direction:"column",gap:"xs",children:[e.jsxs(oe.Flex,{direction:"row",gap:"xs",children:[e.jsx(k.Text,{fontWeight:"medium",color:"gray-500",style:{textWrap:"nowrap"},fontSize:r.isDesktop?"md":"sm",children:"Click your upload"}),e.jsx(k.Text,{fontWeight:"medium",style:{textWrap:"nowrap"},fontSize:r.isDesktop?"md":"sm",children:"or Drag & Drop"})]}),e.jsx(k.Text,{fontSize:"sm",color:"gray-500",children:(i=r.fileSupports)==null?void 0:i.map(a=>a.toLocaleUpperCase()).join(", ")})]})]})};function vn(r){return r.split(" ").map(t=>t[0]).join("").slice(0,2).toUpperCase()}const ml=r=>{const t={day:"2-digit",month:"short",year:"numeric"};return r.toLocaleDateString("id-ID",t)},Cn=r=>{const t={Jan:0,Feb:1,Mar:2,Apr:3,Mei:4,Jun:5,Jul:6,Agu:7,Sep:8,Okt:9,Nov:10,Des:11},l=r.split(" ");if(l.length!==3)return null;const n=parseInt(l[0],10),o=t[l[1]],c=parseInt(l[2],10);return isNaN(n)||isNaN(o)||isNaN(c)?null:new Date(c,o,n)};function xn(r,t=!0){if(!r)return"Rp 0";const l=typeof r=="number"?r.toString():r;if(isNaN(Number(l)))return"Rp 0";const n=l.split("."),o=n[0].replace(/\B(?=(\d{3})+(?!\d))/g,"."),c=n.length===2?o+"."+n[1]:o;return t?"Rp"+c:c}String.prototype.toTitleCase=function(){return this.toLowerCase().split(" ").map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join(" ")},String.prototype.toNumber=function(){return Number(this)};const wn=r=>{const t=r.split(" ");let l=t[0].charAt(0);return t.length>1&&(l+=""+t[1].charAt(0)),l.toUpperCase()};function Dn(r){const t=typeof r=="string"?new Date(r):r;if(isNaN(t.getTime()))throw new Error("Invalid date format");const l=t.getFullYear(),n=String(t.getMonth()+1).padStart(2,"0"),o=String(t.getDate()).padStart(2,"0");return`${l}-${n}-${o}`}const Sn="sa-admin",Ae=r=>`var(--${Sn}-${r})`,kn={base:{borderColor:Ae("base-border-color"),textColor:Ae("base-text-color"),iconColor:Ae("base-icon-color"),placeholderColor:Ae("base-placeholder-color")},document:{bgColor:Ae("document-bg-color")},sidebar:{bgColor:Ae("sidebar-bg-color"),borderColor:Ae("sidebar-border-color"),maxWidth:Ae("sidebar-max-width"),width:Ae("sidebar-width"),collapseWidth:Ae("sidebar-collapse-width"),collapseV2Width:Ae("sidebar-v2-collapse-width")}},Bn=24*60*60*1e3,mn=r=>{const t="14px poppins",n=document.createElement("canvas").getContext("2d");n.font=t;const o=n.measureText(r).width;return Number(Math.ceil(o))},Fn=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,En=/--+/,Mn=/-$/;function Ln(r,t){return JSON.stringify(r)!==JSON.stringify(t)}function Tn(r){return/^(?:\+62|62|0)8[1-9][0-9]{7,10}$/.test(r)}function In(r){return/^[A-Za-z\s]+$/.test(r)}const On=r=>{const t=/^[0-9]$/,l=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Backspace","Delete","Enter","Tab"];(r.ctrlKey||r.metaKey)&&(r.key==="a"||r.key==="c"||r.key==="v")||!t.test(r.key)&&!l.includes(r.key)&&r.preventDefault()},Wn=r=>{const t=/^[0-9]$/,l=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Backspace","Delete","Enter","Tab"];(r.ctrlKey||r.metaKey)&&r.key==="v"||t.test(r.key)&&!l.includes(r.key)&&r.preventDefault()},An=r=>{const t=/^[0-9.]$/,l=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Backspace","Delete","Enter","Tab"];(r.ctrlKey||r.metaKey)&&r.key==="v"||!t.test(r.key)&&!l.includes(r.key)&&r.preventDefault()},zn=r=>Fn.test(r);function Hn(r){return!(En.test(r)||Mn.test(r))}const Vn=r=>{const t=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Backspace","Delete","Enter","Tab","Home","End"];if((r.ctrlKey||r.metaKey)&&["a","c","v","x"].includes(r.key.toLowerCase()))return;const l=r.currentTarget.value;/^[0-9]$/.test(r.key)||r.key==="."&&!l.includes(".")||r.key==="-"&&l.length===0&&!l.includes("-")||t.includes(r.key)||r.preventDefault()},jn=r=>{const t=document.getElementById(r);if(t){const l=t.getBoundingClientRect(),n=window.scrollY+l.top-80;window.scrollTo({top:n,behavior:"smooth"})}};function Pn(r){const t=r.toLowerCase();if(["kb","mb","gb"].find(c=>t.endsWith(c)))return r;const o=Number(r);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 Nn(r){const t=r.split("/");return t[t.length-1]}const _n=r=>{var t,l;return e.jsxs(u.Box,{width:"width-full",paddingInline:"md",height:"height-full",direction:"row",justify:"space-between",align:"center",onClick:r.handleOnClickFile,fullHeight:!0,paddingBlock:"md",id:"file-item",borderRadius:"rounded-md",style:{border:"1px solid var(--sa-border-subtle)",cursor:"pointer"},children:[e.jsxs(oe.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(oe.Flex,{direction:"column",style:{minWidth:0,flex:1},children:[e.jsx(k.Text,{fontWeight:"bold",style:{textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden"},children:r.defaultFile?Nn(r.defaultFile.url):(t=r.fileSelected)==null?void 0:t.name}),r.defaultFile?(r.defaultFile.size||r.defaultFile.date)&&e.jsxs(oe.Flex,{direction:"row",gap:"xs",align:"center",children:[r.defaultFile.size&&e.jsx(k.Text,{fontSize:"sm",fontWeight:"medium",children:r.defaultFile.size}),r.defaultFile.size&&r.defaultFile.date&&e.jsx(E.Icon,{name:"Dot",size:"xs"}),r.defaultFile.date&&e.jsx(k.Text,{fontSize:"sm",fontWeight:"medium",style:{textWrap:"nowrap"},children:r.defaultFile.date})]}):e.jsxs(oe.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(k.Text,{fontSize:"sm",fontWeight:"medium",children:Pn(((l=r.fileSelected)==null?void 0:l.size.toString())||"100000")}),e.jsx(E.Icon,{name:"Dot",size:"xs"}),e.jsx(k.Text,{fontSize:"sm",fontWeight:"medium",style:{textWrap:"nowrap"},children:ml(new Date)})]})]})]}),e.jsx(P.Button,{size:"xs",variant:"tertiary",tone:"error",type:"button",onClick:n=>{n.stopPropagation(),r.handleOnDeleteFile()},iconLeft:e.jsx(E.Icon,{name:"Trash1"})})]})},Fl=({status:r="default",labelPosition:t="outside-top",...l})=>{var p;const n=h.useRef(null),o=()=>{if(l.defaultFile){window.open(l.defaultFile.url);return}n.current&&n.current.click()},c=pe.useMediaQuery("md"),s=r==="error"||typeof l.errorMessage=="string"&&!!l.errorMessage,i=l.label?e.jsxs(oe.Flex,{direction:"row",align:"center",gap:"xs",children:[e.jsx(k.Text,{style:{fontSize:"14px",fontWeight:500,color:"var(--sa-text-primary)"},children:l.label}),l.optional&&e.jsx("span",{style:{background:"var(--sa-background-neutral)",border:"1px solid var(--sa-border-subtle)",borderRadius:"4px",padding:"0 8px",fontSize:"10px",fontWeight:500,lineHeight:"18px",color:"var(--sa-text-primary)",display:"inline-flex",alignItems:"center"},children:"Optional"}),l.required&&e.jsx("span",{style:{fontSize:"14px",fontWeight:500,color:"var(--sa-text-error)"},children:"*"})]}):null,a=l.description?e.jsx(k.Text,{style:{fontSize:"12px",fontWeight:400,color:"var(--sa-text-subtlest, #6b6e76)",lineHeight:"18px"},children:l.description}):null,d=e.jsxs(e.Fragment,{children:[l.helperText&&e.jsx(k.Text,{style:{fontSize:"12px",fontWeight:400,color:"var(--sa-text-subtlest, #6b6e76)",lineHeight:"18px"},children:l.helperText}),l.errorText&&r==="error"&&e.jsx(k.Text,{style:{fontSize:"12px",fontWeight:400,color:"var(--sa-text-error, #a4133c)",lineHeight:"18px"},children:l.errorText}),l.errorMessage&&!l.errorText&&e.jsx(k.Text,{style:{fontSize:"12px",fontWeight:400,color:"var(--sa-text-error, #a4133c)",lineHeight:"18px"},children:l.errorMessage})]}),y=e.jsx("input",{type:"file",style:{display:"none"},ref:n,onChange:x=>{var L;return l.handleOnChangeFile(((L=x.target.files)==null?void 0:L.item(0))||null)},accept:(p=l.fileSupportOption)==null?void 0:p.map(x=>"."+(x==null?void 0:x.toLowerCase())).join(", ")}),b=e.jsxs(u.Box,{direction:"column",fullWidth:!0,style:{minHeight:"69px"},borderRadius:"rounded-md",display:"flex",justify:"center",align:"center",cursor:"pointer",gap:"md",...l.containerProps,children:[y,(l.fileSelected||l.defaultFile)&&e.jsx(_n,{fileSelected:l.fileSelected,defaultFile:l.defaultFile,handleOnDeleteFile:l.handleOnDeleteFile,handleOnClickFile:o}),!l.fileSelected&&!l.defaultFile&&e.jsx(bn,{fileSupports:l.fileSupportOption,isDesktop:c,errorMessage:s?l.errorText||l.errorMessage||" ":void 0,status:s?"error":"default",handleOnClick:o,handleOnFileChange:l.handleOnChangeFile})]});return t==="outside-left"?e.jsxs(oe.Flex,{direction:"row",align:"flex-start",gap:"sm",style:{width:"100%"},children:[e.jsxs(oe.Flex,{direction:"column",gap:"xs",style:{width:"40%",minWidth:"120px",paddingTop:"10px"},children:[i,a]}),e.jsxs(oe.Flex,{direction:"column",gap:"sm",style:{flex:1,minWidth:0},children:[b,d]})]}):e.jsxs(oe.Flex,{direction:"column",gap:"sm",style:{width:"100%"},children:[i,a,b,d]})},qn=({size:r="md",direction:t="vertical",requiredTitle:l="(Required)",fullWidth:n=!1,...o})=>{var i,a,d;const c=o.hideMessageError||!1,s=t==="horizontal"?r==="sm"?342:r==="lg"?400:342:void 0;return e.jsxs(u.Box,{gap:t==="horizontal"?"spacing-96":"sm",direction:t==="horizontal"?"row":"column",...o.containerProps,children:[o.title&&e.jsx(ne,{condition:!!o.inputProps.required,fallback:e.jsxs(u.Box,{direction:"column",customMaxWidth:s,fullWidth:n,children:[e.jsx(se,{children:o.title}),e.jsx(k.Text,{fontSize:r,color:"gray-500",children:o.description})]}),children:e.jsxs(u.Box,{direction:"column",customMaxWidth:s,fullWidth:n,children:[e.jsxs(oe.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(se,{fontSize:r,children:o.title}),e.jsx(se,{color:"error",fontSize:r,children:l}),e.jsx(ne,{condition:!!((i=o.tooltip)!=null&&i.label),children:e.jsx(De.Tooltip,{label:(a=o.tooltip)==null?void 0:a.label,arrowPosition:(d=o.tooltip)==null?void 0:d.arrowPosition,...o.tooltip,children:e.jsx(E.Icon,{name:"InfoCircle",size:r==="lg"?"sm":"xs",style:{color:"var(--sa-color-info-500, #00abeb)",marginTop:"6px"}})})})]}),e.jsx(ne,{condition:!!o.description,children:e.jsx(k.Text,{fontSize:r,color:"gray-500",children:o.description})})]})}),e.jsxs(oe.Flex,{direction:"column",gap:"xs",children:[e.jsx(Fl,{...o.inputProps,status:o.errorMessage?"error":"default"}),!c&&o.errorMessage&&e.jsx(qe,{message:o.errorMessage})]})]})},Zn=({size:r="md",direction:t="vertical",requiredTitle:l="(Required)",fullWidth:n=!1,required:o=!1,...c})=>{var a,d,y,b;const s=c.hideMessageError||!1,i=t==="horizontal"?r==="sm"?342:r==="lg"?400:342:void 0;return e.jsxs(u.Box,{gap:t==="horizontal"||t==="horizontal-inline"?"spacing-96":"sm",direction:t==="horizontal"||t==="horizontal-inline"?"row":"column",...c.containerProps,children:[c.title&&e.jsx(ne,{condition:!!o,fallback:e.jsxs(u.Box,{direction:"column",customMaxWidth:i,fullWidth:n,children:[e.jsx(se,{children:c.title}),e.jsx(Le.Body3,{props:{color:"gray-500"},children:c.description})]}),children:e.jsxs(u.Box,{direction:"column",customMaxWidth:i,fullWidth:n,children:[e.jsxs(oe.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(se,{fontSize:r,children:c.title}),e.jsx(se,{color:"error",fontSize:r,children:l}),e.jsx(ne,{condition:!!((a=c.tooltip)!=null&&a.label),children:e.jsx(De.Tooltip,{label:(d=c.tooltip)==null?void 0:d.label,arrowPosition:(y=c.tooltip)==null?void 0:y.arrowPosition,...c.tooltip,children:e.jsx(E.Icon,{name:"InfoCircle",size:r==="lg"?"sm":"xs",style:{color:"var(--sa-color-info-500, #00abeb)",marginTop:"6px"}})})})]}),e.jsx(ne,{condition:!!c.description,children:e.jsx(k.Text,{fontSize:r,color:"gray-500",children:c.description})})]})}),e.jsx(u.Box,{gap:t==="horizontal-inline"?"xl":"md",direction:t==="horizontal-inline"?"row":"column",align:"flex-start",children:e.jsx(Ir,{of:(b=c.checkBoxesList)==null?void 0:b.map(p=>({...p,isChecked:c.checkBoxesAreChecked.includes(p.id)})),render:p=>p.renderBadge?e.jsxs(u.Box,{direction:"row",justify:"space-between",gap:"lg",...c.badgeContainerProps,children:[e.jsx(ir.Checkbox,{name:p.name,value:p.id,checked:p.isChecked,onChange:x=>c.onChecked(x.target.value,p),label:p.name,description:p.description}),p.renderBadge]}):e.jsx(ir.Checkbox,{name:p.name,value:p.id,checked:p.isChecked,onChange:x=>c.onChecked(x.target.value,p),label:p.name,description:p.description})})}),!s&&c.errorMessage&&e.jsx(qe,{message:c.errorMessage})]})},Gn=({position:r="vertical",size:t="md",fullWidth:l=!1,...n})=>{var c;const o=r==="horizontal-inline"||r==="horizontal-block"?t==="sm"?342:t==="lg"?400:342:void 0;return e.jsxs(u.Box,{gap:r==="horizontal-inline"||r==="horizontal-block"?"spacing-96":"sm",direction:r==="horizontal-inline"||r==="horizontal-block"?"row":"column",children:[e.jsx(ne,{condition:!!n.description||!!n.title,children:e.jsxs(u.Box,{direction:"column",customMaxWidth:o,fullWidth:l,children:[n.title&&e.jsx(se,{children:n.title}),e.jsx(ne,{condition:!!n.description,children:e.jsx(k.Text,{color:"gray-500",children:n.description})})]})}),e.jsx(u.Box,{gap:"sm",direction:r==="horizontal"||r==="horizontal-inline"?"row":"column",align:"flex-start",flexWrap:"wrap",children:e.jsx(Ir,{of:(c=n.radioList)==null?void 0:c.map(s=>({...s,isChecked:n.radioIsChecked===s.id})),render:({value:s,id:i,isChecked:a,subInput:d,label:y,description:b})=>e.jsxs(u.Box,{direction:"column",gap:"xs",customMaxWidth:o,children:[e.jsx(qr.Radio,{id:`${i.toString()}-${s}`,name:n.groupName||y,label:y,value:s,checked:a,onChange:p=>n.onChecked({id:i,label:p.target.name,value:p.target.value}),disabled:n.disableAll},i),b&&e.jsx(k.Text,{color:"gray-500",style:{marginLeft:28},children:b}),d]})})}),n.errorMessage&&e.jsx(qe,{message:n.errorMessage})]})},Qn=({size:r="md",direction:t="vertical",requiredTitle:l="(Required)",fullWidth:n=!1,...o})=>{var i,a,d;const c=o.hideMessageError||!1,s=t==="horizontal"?r==="sm"?342:r==="lg"?400:342:void 0;return e.jsxs(u.Box,{gap:t==="horizontal"?"spacing-96":"sm",direction:t==="horizontal"?"row":"column",...o.containerProps,children:[o.title&&e.jsx(ne,{condition:!!o.inputProps.required,fallback:e.jsxs(u.Box,{direction:"column",customMaxWidth:s,fullWidth:n,children:[e.jsx(se,{children:o.title}),e.jsx(k.Text,{fontSize:r,color:"gray-500",children:o.description})]}),children:e.jsxs(u.Box,{direction:"column",customMaxWidth:s,fullWidth:n,children:[e.jsxs(oe.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(se,{fontSize:r,children:o.title}),e.jsx(se,{color:"error",fontSize:r,children:l}),e.jsx(ne,{condition:!!((i=o.tooltip)!=null&&i.label),children:e.jsx(De.Tooltip,{label:(a=o.tooltip)==null?void 0:a.label,arrowPosition:(d=o.tooltip)==null?void 0:d.arrowPosition,...o.tooltip,children:e.jsx(E.Icon,{name:"InfoCircle",size:r==="lg"?"sm":"xs",style:{color:"var(--sa-color-info-500, #00abeb)",marginTop:"6px"}})})})]}),e.jsx(ne,{condition:!!o.description,children:e.jsx(k.Text,{fontSize:r,color:"gray-500",children:o.description})})]})}),e.jsxs(oe.Flex,{direction:"column",gap:"xs",children:[e.jsx(_r.Textarea,{ref:o.inputRef,size:r,...o.inputProps,status:o.errorMessage?"error":"default"}),!c&&o.errorMessage&&e.jsx(qe,{message:o.errorMessage})]})]})},Un=({size:r="md",direction:t="vertical",requiredTitle:l="(Required)",required:n=!1,fullWidth:o=!1,...c})=>{var i,a,d;const s=t==="horizontal"?r==="sm"?342:r==="lg"?400:342:void 0;return e.jsxs(u.Box,{gap:t==="horizontal"?"spacing-96":"sm",direction:t==="horizontal"?"row":"column",...c.containerProps,children:[c.title&&e.jsx(ne,{condition:n,fallback:e.jsxs(u.Box,{direction:"column",customMaxWidth:s,fullWidth:o,children:[e.jsx(se,{children:c.title}),e.jsx(k.Text,{fontSize:r,color:"gray-500",children:c.titleDescription})]}),children:e.jsxs(u.Box,{direction:"column",customMaxWidth:s,fullWidth:o,children:[e.jsxs(oe.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(se,{fontSize:r,children:c.title}),e.jsx(se,{color:"error",fontSize:r,children:l}),e.jsx(ne,{condition:!!((i=c.tooltip)!=null&&i.label),children:e.jsx(De.Tooltip,{label:(a=c.tooltip)==null?void 0:a.label,arrowPosition:(d=c.tooltip)==null?void 0:d.arrowPosition,...c.tooltip,children:e.jsx(E.Icon,{name:"InfoCircle",size:r==="lg"?"sm":"xs",style:{color:"var(--sa-color-info-500, #00abeb)",marginTop:"6px"}})})})]}),e.jsx(ne,{condition:!!c.titleDescription,children:e.jsx(k.Text,{fontSize:r,color:"gray-500",children:c.titleDescription})})]})}),e.jsx(cr.Toggle,{checked:c.checked,onChange:c.onChange,label:c.label,description:c.description}),c.errorMessage&&e.jsx(qe,{message:c.errorMessage})]})},Jn=({variant:r="primary",size:t="md",...l})=>{const n=nr.useColor(),o=s=>{var a,d,y,b,p,x;if(!s)return;const i=l.disabled?"var(--sa-text-disable, #181a198f)":r==="secondary"?"var(--sa-text-subtle, #8c8f97)":r==="secondary-danger"?(d=(a=n==null?void 0:n.computed)==null?void 0:a.red)==null?void 0:d[600]:r==="secondary-primary"?(b=(y=n==null?void 0:n.computed)==null?void 0:y.blue)==null?void 0:b[700]:(x=(p=n==null?void 0:n.computed)==null?void 0:p.gray)==null?void 0:x[50];return e.jsx(E.Icon,{name:s,size:t,style:{color:i}})},c=()=>{var i,a,d,y;if(r!=="secondary-danger"&&r!=="secondary-primary")return l.title;const s={color:l.disabled?"var(--sa-text-disable, #181a198f)":r==="secondary-danger"?(a=(i=n==null?void 0:n.computed)==null?void 0:i.red)==null?void 0:a[600]:(y=(d=n==null?void 0:n.computed)==null?void 0:d.blue)==null?void 0:y[700]};switch(t){case"xs":return e.jsx(Le.Body2,{props:{style:s},children:l.title});case"sm":case"md":return e.jsx(Le.SubH3,{props:{style:s},children:l.title});case"lg":return e.jsx(Le.SubH2,{props:{style:s},children:l.title});default:return l.title}};return e.jsx(P.Button,{fullWidth:!0,disabled:l.disabled,primary:r==="primary",secondary:r==="secondary"||r==="secondary-danger"||r==="secondary-primary",success:r==="success",onClick:l.onClick,type:l.type,iconLeft:o(l.iconLeft),iconRight:o(l.iconRight),size:t,children:c()})},Yn=r=>e.jsx(Le.H5,{props:{...r},children:r.title}),Xn=({size:r="md",direction:t="vertical",requiredTitle:l="(Required)",fullWidth:n=!1,...o})=>{var i,a,d;const c=o.hideMessageError||!1,s=t==="horizontal"?r==="sm"?342:r==="lg"?400:342:void 0;return e.jsxs(u.Box,{gap:t==="horizontal"?"spacing-96":"sm",direction:t==="horizontal"?"row":"column",onClick:o.onClickContainer,children:[o.title&&e.jsx(ne,{condition:!!o.inputProps.required,fallback:e.jsxs(u.Box,{direction:"column",customMaxWidth:s,fullWidth:n,children:[e.jsx(se,{children:o.title}),e.jsx(k.Text,{fontSize:r,color:"gray-500",children:o.description})]}),children:e.jsxs(u.Box,{direction:"column",customMaxWidth:s,fullWidth:n,children:[e.jsxs(oe.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(se,{fontSize:r,children:o.title}),e.jsx(se,{color:"error",fontSize:r,children:l}),e.jsx(ne,{condition:!!((i=o.tooltip)!=null&&i.label),children:e.jsx(De.Tooltip,{label:(a=o.tooltip)==null?void 0:a.label,arrowPosition:(d=o.tooltip)==null?void 0:d.arrowPosition,...o.tooltip,children:e.jsx(E.Icon,{name:"InfoCircle",size:r==="lg"?"sm":"xs",style:{color:"var(--sa-color-info-500, #00abeb)",marginTop:"6px"}})})})]}),e.jsx(ne,{condition:!!o.description,children:e.jsx(k.Text,{fontSize:r,color:"gray-500",children:o.description})})]})}),e.jsxs(oe.Flex,{direction:"column",gap:"xs",children:[e.jsx(u.Box,{direction:"column",style:{width:t==="horizontal"&&o.customWidth?o.customWidth:t==="horizontal"?"343px":""},children:e.jsx(Ke.StarasiaDate,{size:r,...o.inputProps,status:o.errorMessage?"error":void 0})}),!c&&o.errorMessage&&e.jsx(qe,{message:o.errorMessage})]})]})};async function Kn(r,t){const l=new Image;l.src=r,await new Promise((c,s)=>{l.onload=c,l.onerror=s});const n=document.createElement("canvas");n.width=t.width,n.height=t.height;const o=n.getContext("2d",{alpha:!0});if(!o)throw new Error("No 2D context");return o.drawImage(l,t.x,t.y,t.width,t.height,0,0,t.width,t.height),new Promise((c,s)=>{n.toBlob(i=>{if(!i)return s("Canvas is empty");const a=new File([i],"cropped.png",{type:"image/png"});c(a)},"image/png")})}const El={"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},Ml=h.forwardRef(({handleUpload:r,urlImage:t,isUploading:l,croppedImage:n,setCroppedImage:o,size:c="96",aspect:s="1:1",containerProps:i,maxFileSize:a=2,onError:d},y)=>{const b=pe.useMediaQuery("md"),[p,x]=h.useState(!1),[L,v]=h.useState(null),[T,F]=h.useState(!1),[I,S]=h.useState({x:0,y:0}),[w,V]=h.useState(1),[z,D]=h.useState(null);h.useEffect(()=>{t===null&&o(null)},[t]);const M=h.useCallback((Q,J)=>{D(J)},[]),j=Q=>{var ie;const J=(ie=Q.target.files)==null?void 0:ie[0];if(!J)return;const de=new FileReader;de.onload=()=>{v(de.result),F(!0)},de.readAsDataURL(J)},H=async()=>{if(!(!L||!z))try{const Q=await Kn(L,z);if(a&&Q.size>a*1024*1024){d==null||d(`Ukuran file maksimal ${a}MB`);return}r==null||r(Q);const J=URL.createObjectURL(Q);o(J,Q),F(!1)}catch{d==null||d("Gagal memproses gambar")}},Z=h.useRef(null),K=()=>{Z.current&&Z.current.click()};h.useImperativeHandle(y,()=>({openFileDialog:()=>{var Q;(Q=Z.current)==null||Q.click()}}));const te=parseInt(c,10),ge=El[s];let ue,ce;return ge>=1?(ce=te,ue=te*ge):(ue=te,ce=te/ge),e.jsxs(u.Box,{direction:"column",display:"flex",position:"relative",bg:(i==null?void 0:i.bg)||"gray-200",borderStyle:(i==null?void 0:i.borderStyle)||"border-none",borderColor:(i==null?void 0:i.borderColor)||"gray-200",borderWidth:(i==null?void 0:i.borderWidth)||"border-2",borderRadius:(i==null?void 0:i.borderRadius)||"rounded-md",overflow:"overflow-hidden",align:"center",justify:"center",style:{width:i!=null&&i.fullWidth?"100%":`${ue}px`,height:i!=null&&i.fullWidth?"auto":`${ce}px`,aspectRatio:ge,flexShrink:0},onMouseEnter:()=>x(!0),onMouseLeave:()=>x(!1),children:[n||t?e.jsx("img",{src:n||t||void 0,alt:"Profile",style:{objectFit:"cover",width:"100%",height:"100%"}}):e.jsx(u.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(c)/2<40?Number(c)/2:40,height:Number(c)/2<40?Number(c)/2:40}})}),e.jsxs(u.Box,{direction:"column",position:"absolute",display:"flex",align:"center",justify:"center",cursor:"pointer",style:{inset:0,backgroundColor:"var(--sa-color-black-alpha-a30, #080f214a)",opacity:p?1:0,transition:"opacity 0.3s ease-in-out"},onClick:K,children:[e.jsx("input",{ref:Z,type:"file",accept:"image/*",onChange:j,disabled:l,style:{display:"none"}}),e.jsxs(u.Box,{display:"flex",align:"center",gap:"spacing-2",direction:"row",children:[e.jsx(E.Icon,{name:"Edit3",style:{color:"var(--sa-background-primary, #ffffff)"}}),e.jsx(ne,{condition:c.toNumber()>80,children:e.jsx(k.Text,{color:"gray-50",fontSize:c.toNumber()>80?"sm":"md",fontWeight:"medium",children:"Edit Image"})})]})]}),l&&e.jsx(u.Box,{direction:"column",position:"absolute",display:"flex",align:"center",justify:"center",style:{inset:0,zIndex:20,backgroundColor:"var(--sa-color-white-alpha-a80, #e5e9f640)"},children:e.jsx(u.Box,{direction:"column",borderRadius:"rounded-full",style:{animation:"spin 1s linear infinite",border:"2px solid transparent",height:"2rem",width:"2rem"},borderColor:"info-600"})}),T&&Zr.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:()=>F(!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:b?s==="1:1"?"min(90vw, 480px)":`min(90vw, ${ue*2}px)`:"calc(100vw - 2rem)",display:"flex",flexDirection:"column"},onClick:Q=>Q.stopPropagation(),children:[e.jsx("div",{style:{position:"relative",width:"100%",height:"20rem",backgroundColor:"var(--sa-color-gray-100)"},children:L&&e.jsx(_l,{image:L,crop:I,zoom:w,aspect:s?El[s]:void 0,onCropChange:S,onZoomChange:V,onCropComplete:M,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,onClick:()=>F(!1),children:"Cancel"}),e.jsx(P.Button,{size:"sm",primary:!0,onClick:H,children:"Crop"})]})]})}),document.body)]})}),$n=({size:r="md",direction:t="vertical",requiredTitle:l="(Required)",fullWidth:n=!1,required:o=!1,...c})=>{var a,d,y;const s=c.hideMessageError||!1,i=t==="horizontal"?r==="sm"?342:r==="lg"?400:342:void 0;return e.jsxs(u.Box,{gap:t==="horizontal"?"spacing-96":"sm",direction:t==="horizontal"?"row":"column",...c.containerProps,children:[c.title&&e.jsx(ne,{condition:!!o,fallback:e.jsxs(u.Box,{direction:"column",customMaxWidth:i,fullWidth:n,children:[e.jsx(se,{children:c.title}),e.jsx(k.Text,{fontSize:r,color:"gray-500",children:c.description})]}),children:e.jsxs(u.Box,{direction:"column",customMaxWidth:i,fullWidth:n,children:[e.jsxs(oe.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(se,{fontSize:r,children:c.title}),e.jsx(se,{color:"error",fontSize:r,children:l}),e.jsx(ne,{condition:!!((a=c.tooltip)!=null&&a.label),children:e.jsx(De.Tooltip,{label:(d=c.tooltip)==null?void 0:d.label,arrowPosition:(y=c.tooltip)==null?void 0:y.arrowPosition,...c.tooltip,children:e.jsx(E.Icon,{name:"InfoCircle",size:r==="lg"?"sm":"xs",style:{color:"var(--sa-color-info-500, #00abeb)",marginTop:"6px"}})})})]}),e.jsx(ne,{condition:!!c.description,children:e.jsx(k.Text,{fontSize:r,color:"gray-500",children:c.description})})]})}),e.jsxs(oe.Flex,{direction:"column",gap:"xs",children:[e.jsx(Ml,{...c.inputProps}),!s&&c.errorMessage&&e.jsx(qe,{message:c.errorMessage})]})]})},Rn=({size:r="md",direction:t="vertical",requiredTitle:l="(Required)",fullWidth:n=!1,...o})=>{var s,i,a;const c=t==="horizontal"?r==="sm"?342:r==="lg"?400:342:void 0;return e.jsxs(u.Box,{gap:t==="horizontal"?"spacing-96":"sm",direction:t==="horizontal"?"row":"column",...o.containerProps,children:[o.title&&e.jsx(ne,{condition:!!o.inputProps.required,fallback:e.jsxs(u.Box,{direction:"column",customMaxWidth:c,fullWidth:n,children:[e.jsx(se,{children:o.title}),e.jsx(k.Text,{fontSize:r,color:"gray-500",children:o.description})]}),children:e.jsxs(u.Box,{direction:"column",customMaxWidth:c,fullWidth:n,children:[e.jsxs(oe.Flex,{direction:"row",gap:"xs",align:"center",children:[e.jsx(se,{fontSize:r,children:o.title}),e.jsx(se,{color:"error",fontSize:r,children:l}),e.jsx(ne,{condition:!!((s=o.tooltip)!=null&&s.label),children:e.jsx(De.Tooltip,{label:(i=o.tooltip)==null?void 0:i.label,arrowPosition:(a=o.tooltip)==null?void 0:a.arrowPosition,...o.tooltip,children:e.jsx(E.Icon,{name:"InfoCircle",size:r==="lg"?"sm":"xs",style:{color:"var(--sa-color-info-500, #00abeb)",marginTop:"6px"}})})})]}),e.jsx(ne,{condition:!!o.description,children:e.jsx(k.Text,{fontSize:r,color:"gray-500",children:o.description})})]})}),o.inputProps.extended&&o.inputProps.extended]})},ec=({items:r,id:t,handleOnUpdate:l,width:n,toggleShow:o=!0,disabled:c=!1})=>{var y;const[s,i]=h.useState([]);h.useEffect(()=>{r&&i([...r.map(b=>({id:b.id,isActive:b.isActive}))])},[r]);const a=(y=s.find(b=>b.id===t))==null?void 0:y.isActive,d=h.useCallback(()=>{i(b=>b.map(p=>p.id===t?{...p,isActive:!p.isActive}:p)),l&&l(!a)},[t,l,a]);return e.jsx(u.Box,{direction:"row",gap:"md",style:{width:n},children:o&&e.jsx(cr.Toggle,{disabled:c,checked:a,onChange:d,label:a?"Active":"Inactive"})})},rc={InputText:un,InputDropdown:yn,InputSingleFile:qn,CheckBoxOptions:Zn,RadioOptions:Gn,InputTextArea:Qn,ToggleForm:Un,ActionButton:Jn,FormTitle:Yn,InputDate:Xn,InputImgFile:$n,Custom:Rn},Ll=({customBottom:r})=>{const[t,l]=h.useState(!1),n=()=>{window.scrollY>window.screenY?l(!0):l(!1)},o=()=>{window.scrollTo({top:0,behavior:"smooth"})};return h.useEffect(()=>(window.addEventListener("scroll",n),()=>{window.removeEventListener("scroll",n)}),[]),e.jsx(u.Box,{direction:"column",style:{position:"fixed",bottom:0,right:0},children:e.jsx(u.Box,{direction:"column",position:"absolute",style:{bottom:r||"1.6rem",right:"2rem",transform:t?"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(E.Icon,{width:16,size:"xs",name:"ArrowPullUp",style:{color:"var(--sa-background-brand, #04254f)"}})})})})},Fe="sa-sidepanel-item",Tl="sa-sidepanel-item-styles",tc=`
|
|
47
47
|
.${Fe} {
|
|
48
48
|
display: block;
|
|
49
49
|
box-sizing: border-box;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@starasia/admin",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.19.0",
|
|
4
4
|
"description": "Core Admin Dashboard for starasia UI",
|
|
5
5
|
"author": "Rizki Izzul Haq",
|
|
6
6
|
"main": "dist/index.umd.js",
|
|
@@ -31,14 +31,14 @@
|
|
|
31
31
|
"@starasia/checkbox": "3.1.0",
|
|
32
32
|
"@starasia/css": "3.0.7",
|
|
33
33
|
"@starasia/date": "5.3.1",
|
|
34
|
-
"@starasia/dialog": "3.
|
|
34
|
+
"@starasia/dialog": "3.2.0",
|
|
35
35
|
"@starasia/drawer": "3.1.1",
|
|
36
36
|
"@starasia/dropdown": "5.5.0",
|
|
37
37
|
"@starasia/flex": "4.0.0",
|
|
38
38
|
"@starasia/grid": "1.0.0",
|
|
39
39
|
"@starasia/hooks": "1.0.2",
|
|
40
40
|
"@starasia/http": "1.0.4",
|
|
41
|
-
"@starasia/icon": "3.
|
|
41
|
+
"@starasia/icon": "3.4.0",
|
|
42
42
|
"@starasia/input": "4.2.0",
|
|
43
43
|
"@starasia/menu": "3.3.1",
|
|
44
44
|
"@starasia/pagination": "3.3.0",
|