@lax-wp/design-system 0.11.22 → 0.11.23

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 CHANGED
@@ -87,7 +87,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
87
87
  disabled:bg-neutral-50 dark:disabled:!bg-black-800 dark:disabled:placeholder:!text-black-400
88
88
  ${D&&R?.color&&`bg-${R.color}-50`}
89
89
  ${p||""}
90
- `,onChange:G=>{n(G.target.value)},value:r,defaultValue:a,id:t||e,style:E,autoComplete:"off",placeholder:P}),l.jsx("span",{className:"absolute inset-y-0 right-3 flex items-center z-[1000px] h-full dark:text-black-100",children:"%"})]}),i&&l.jsx(ne,{className:"text-error-500 mt-1",appearance:"custom",size:"extra-small",variant:"medium",children:i})]}),F&&R&&D&&L&&l.jsx("div",{role:"tooltip",tabIndex:0,className:"absolute left-0 right-0 top-[95%] mt-1 z-50 bg-white dark:bg-black-600 rounded-xl",onClick:G=>G.stopPropagation(),onMouseDown:G=>G.preventDefault(),onKeyDown:G=>{G.key==="Escape"&&z(!1)},children:l.jsx(L,{riskDetails:R})})]})});j4.displayName="PercentageInputField";const H4=h.forwardRef(({onSubmit:t,...e},r)=>l.jsx("form",{ref:r,onSubmit:n=>{n.preventDefault(),t?.(n)},...e}));H4.displayName="Form";const F4=typeof window<"u"?h.useLayoutEffect:h.useEffect;function xb(t,e,r,n){const i=h.useRef(e);F4(()=>{i.current=e},[e]),h.useEffect(()=>{const a=r?.current||window;if(!(a&&a.addEventListener)||t===null)return;const s=o=>i.current(o);return a.addEventListener(t,s,n),()=>{a.removeEventListener(t,s)}},[t,r,n])}const _o=h.memo(h.forwardRef(({adjustWithScreen:t,children:e,renderViewClassName:r,fullHeight:n,...i},a)=>{const[s,o]=h.useState(window.innerHeight),A=h.useRef(null);return xb("resize",()=>{t&&o(window.innerHeight)}),h.useImperativeHandle(a,()=>({get getInstance(){return A.current},get view(){return A.current?.view??null},scrollToTop:()=>{A.current&&A.current.scrollToTop()},scrollToRight:()=>{A.current&&A.current.scrollToRight()}}),[]),l.jsx(TN.Scrollbars,{ref:A,autoHide:!0,renderTrackVertical:({style:c,...d})=>l.jsx("div",{style:c,className:"h-full top-0 right-0 rounded-md z-[1001] !w-scrollbar-size",...d}),renderThumbVertical:({style:c,...d})=>l.jsx("div",{style:c,className:"rounded-md bg-[#00000033] dark:bg-black-500 absolute right-0.5 !w-2",...d}),renderTrackHorizontal:({style:c,...d})=>l.jsx("div",{style:c,className:"w-full bottom-0 left-0 rounded-md z-[1001] !h-scrollbar-size ",...d}),renderThumbHorizontal:({style:c,...d})=>l.jsx("div",{style:c,className:"rounded-md bg-[#00000033] dark:bg-black-500 absolute bottom-0.5 !h-2",...d}),renderView:c=>l.jsx("div",{className:B("!-mr-scrollbar-size h-full !-mb-scrollbar-size",r,n?"!h-[calc(100%+var(--scroll-bar-size))]":""),...c}),...i,style:{...i.style||{},zIndex:0,...!i.autoHeight&&!i.style?.height?{height:n?"100%":s,overflowX:"hidden"}:{}},children:e})}));_o.displayName="CustomScrollbar";const ZR=({id:t,value:e="",onChange:r,placeholder:n="Enter markdown content...",rows:i=1,disabled:a=!1,className:s,textareaClassName:o,previewClassName:A,defaultMode:u="markdown",mode:c,label:d,required:f=!1})=>{const[p,m]=h.useState(u),[g,_]=h.useState(!1),b=t||`md-input-${Math.random().toString(36).slice(2,11)}`,y=h.useMemo(()=>{if(!e)return i;const k=(e.match(/\n/g)||[]).length+1;return Math.min(18,k)},[e,i]),v=c??p,S=c!==void 0;return l.jsxs("div",{className:B("flex flex-col gap-2",s),children:[l.jsxs("div",{className:"flex items-center gap-3",children:[!S&&l.jsx("div",{className:"flex items-center gap-2",children:l.jsxs("div",{className:"inline-flex grow-0 p-1 rounded-lg bg-neutral-100 dark:bg-black-700 w-auto",children:[l.jsx("button",{className:B("rounded-md p-1 flex items-center justify-center",v==="markdown"?"bg-white dark:bg-black-700 !text-neutral-900 dark:!text-neutral-100":""),onClick:()=>m("markdown"),disabled:a,children:l.jsx(ne,{variant:"semibold",size:"extra-small",appearance:"subtitle",className:B(v==="markdown"?"!text-neutral-900 dark:!text-neutral-100":""),children:"Markdown"})}),l.jsx("button",{className:B("rounded-md p-1 flex items-center justify-center",v==="preview"?"bg-white dark:bg-black-700 !text-neutral-900 dark:!text-neutral-100":""),onClick:()=>m("preview"),disabled:a,children:l.jsx(ne,{variant:"semibold",size:"extra-small",appearance:"subtitle",className:B(v==="preview"?"!text-neutral-900 dark:!text-neutral-100":""),children:"Preview"})})]})}),d&&l.jsxs("label",{htmlFor:b,className:"text-xs font-medium text-gray-600 dark:text-gray-300",children:[d,f&&l.jsx("span",{className:"text-red-500 ml-1",children:"*"})]})]}),l.jsx("div",{className:"relative",children:v==="markdown"?l.jsx("textarea",{id:b,value:e,onChange:k=>r(k.target.value),placeholder:n,rows:y,disabled:a,required:f,className:B("w-full border rounded-lg bg-white dark:bg-black-600","py-2.5 px-3 font-inter font-medium text-sm","text-gray-900 dark:text-gray-100","placeholder:text-gray-400 dark:placeholder:text-gray-500","transition-colors duration-200","focus:ring-2 focus:outline-none resize-vertical","border-gray-300 dark:border-gray-600","focus:border-blue-500 focus:ring-blue-200 dark:focus:ring-blue-400/20",{"bg-gray-50 dark:bg-gray-700 text-gray-400 dark:text-gray-500 cursor-not-allowed":a},o),onClick:k=>k.stopPropagation()}):l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:B("w-full rounded-lg","py-2.5 px-3 min-h-[calc(2.5rem*var(--rows,8))]","text-sm",A),style:{"--rows":y>3?y-3:y},children:l.jsx(_o,{autoHeight:!0,autoHeightMax:`calc(1rem * ${y>3?y-3:y})`,children:l.jsx("div",{className:"markdown-preview text-gray-900 dark:text-gray-100 [&_h1]:text-2xl [&_h1]:font-bold [&_h1]:mb-4 [&_h1]:mt-2 [&_h2]:text-xl [&_h2]:font-bold [&_h2]:mb-3 [&_h2]:mt-2 [&_h3]:text-lg [&_h3]:font-semibold [&_h3]:mb-2 [&_h3]:mt-2 [&_p]:mb-2 [&_p]:leading-relaxed [&_ul]:list-disc [&_ul]:ml-6 [&_ul]:mb-2 [&_ol]:list-decimal [&_ol]:ml-6 [&_ol]:mb-2 [&_li]:mb-1 [&_code]:bg-gray-100 [&_code]:dark:bg-gray-800 [&_code]:px-1 [&_code]:py-0.5 [&_code]:rounded [&_code]:text-sm [&_code]:font-mono [&_pre]:bg-gray-100 [&_pre]:dark:bg-gray-800 [&_pre]:p-3 [&_pre]:rounded [&_pre]:overflow-x-auto [&_pre]:mb-2 [&_blockquote]:border-l-4 [&_blockquote]:border-gray-300 [&_blockquote]:dark:border-gray-600 [&_blockquote]:pl-4 [&_blockquote]:italic [&_blockquote]:mb-2 [&_a]:text-blue-600 [&_a]:dark:text-blue-400 [&_a]:underline [&_strong]:font-bold [&_em]:italic [&_table]:w-full [&_table]:border-collapse [&_table]:mb-2 [&_th]:border [&_th]:border-gray-300 [&_th]:dark:border-gray-600 [&_th]:px-2 [&_th]:py-1 [&_th]:bg-gray-50 [&_th]:dark:bg-gray-700 [&_th]:font-semibold [&_td]:border [&_td]:border-gray-300 [&_td]:dark:border-gray-600 [&_td]:px-2 [&_td]:py-1 [&_hr]:my-4 [&_hr]:border-gray-300 [&_hr]:dark:border-gray-600",children:l.jsx(L1,{remarkPlugins:[I1],children:e||"*No content to preview*"})})})}),l.jsx("button",{onClick:()=>_(!0),className:"absolute bottom-2 right-2 p-1 rounded-md bg-neutral-100 dark:bg-black-600 hover:bg-gray-200 dark:hover:bg-black-500 transition-colors shadow-sm flex items-center justify-center",title:"Expand preview",type:"button",children:l.jsx(de.OpenInFull,{sx:{fontSize:"16px"},className:"text-neutral-600 dark:text-neutral-400"})})]})}),l.jsx(cn,{open:g,onCancel:()=>_(!1),title:"Markdown Preview",width:800,footer:null,children:l.jsx(_o,{autoHeight:!0,autoHeightMax:"70vh",children:l.jsx("div",{className:"markdown-preview text-gray-900 dark:text-gray-100 [&_h1]:text-2xl [&_h1]:font-bold [&_h1]:mb-4 [&_h1]:mt-2 [&_h2]:text-xl [&_h2]:font-bold [&_h2]:mb-3 [&_h2]:mt-2 [&_h3]:text-lg [&_h3]:font-semibold [&_h3]:mb-2 [&_h3]:mt-2 [&_p]:mb-2 [&_p]:leading-relaxed [&_ul]:list-disc [&_ul]:ml-6 [&_ul]:mb-2 [&_ol]:list-decimal [&_ol]:ml-6 [&_ol]:mb-2 [&_li]:mb-1 [&_code]:bg-gray-100 [&_code]:dark:bg-gray-800 [&_code]:px-1 [&_code]:py-0.5 [&_code]:rounded [&_code]:text-sm [&_code]:font-mono [&_pre]:bg-gray-100 [&_pre]:dark:bg-gray-800 [&_pre]:p-3 [&_pre]:rounded [&_pre]:overflow-x-auto [&_pre]:mb-2 [&_blockquote]:border-l-4 [&_blockquote]:border-gray-300 [&_blockquote]:dark:border-gray-600 [&_blockquote]:pl-4 [&_blockquote]:italic [&_blockquote]:mb-2 [&_a]:text-blue-600 [&_a]:dark:text-blue-400 [&_a]:underline [&_strong]:font-bold [&_em]:italic [&_table]:w-full [&_table]:border-collapse [&_table]:mb-2 [&_th]:border [&_th]:border-gray-300 [&_th]:dark:border-gray-600 [&_th]:px-2 [&_th]:py-1 [&_th]:bg-gray-50 [&_th]:dark:bg-gray-700 [&_th]:font-semibold [&_td]:border [&_td]:border-gray-300 [&_td]:dark:border-gray-600 [&_td]:px-2 [&_td]:py-1 [&_hr]:my-4 [&_hr]:border-gray-300 [&_hr]:dark:border-gray-600",children:l.jsx(L1,{remarkPlugins:[I1],children:e||"*No content to preview*"})})})})]})},{Dragger:$R}=Ke.Upload,JR=50*1024*1024,eP=({getFile:t,id:e,description:r,errorMessage:n=null,disabled:i=!1,defaultFile:a=null,acceptedFiles:s=null,isLoading:o=!1,asBase64:A=!1,toFileServer:u=!1,setFileUploading:c,fileUploading:d=!1,uploadToDocServer:f=!1,multiple:p=!1,getRealFileName:m=!1,onDelete:g,maxSize:_=JR,fileUploadService:b,systemMessages:y,toast:v})=>{const[S,k]=h.useState(null),[E,w]=h.useState([]),[T,O]=h.useState("#d9d9d9"),[C,N]=h.useState(!1),[R,D]=h.useState(null),L=async()=>{if(!b){console.warn("MultiFileUpload: File server upload requires fileUploadService");return}Promise.all(E.map(I=>{const F=new FormData;F.append("file",I);const z=Ia({file_upload_path:f?"document-server":null,token:localStorage.getItem("token")});return b.uploadFileToFileServer(F,z)})).then(I=>{t(p?I?.map(F=>F?.fileUrl):I?.[0]?.fileUrl,m?S?.name:I?.[0]?.fileName),c?.(null),D(I?.[0])})},P={accept:s||"*",multiple:p,showUploadList:!1,disabled:i,onRemove:()=>{w([])},beforeUpload:(I,F)=>{if(I.size>_){const z=Math.round(_/1048576),W=y?.fileSizeLimit(String(z),"MB")||`File size must be less than ${z}MB`;return v?v.error(W,{toastId:W}):console.error(W),!1}return k(I),u?(c?.(e||"field-file-upload"),w(F)):(A?Promise.all((p?F:[I]).map(z=>new Promise(W=>{const G=new FileReader;G.onload=X=>{W({filename:z.name,content:X?.target?.result?.split(",")[1]})},G.readAsDataURL(z)}))).then(z=>{t(p?z:z[0])}):t(I),k(I)),!1}},U=async()=>{if(u&&R&&b){const I=Ia({token:localStorage.getItem("token")});b.deleteFileFromFileServer(R?.fileName,I).then(()=>{D(null)})}k(null),w([]),t(""),g?.()};h.useEffect(()=>{a?.name&&k(a)},[a]),h.useEffect(()=>{O(n?"#EF4444":"#d9d9d9")},[n]),h.useEffect(()=>{E.length&&L()},[E]);const j=I=>I?I.length<=20?I:I.slice(0,14)+"...."+I.slice(-7):"";return l.jsxs("div",{children:[l.jsx("div",{className:"h-32",onMouseEnter:()=>N(!0),onMouseLeave:()=>N(!1),children:l.jsx($R,{...P,style:{borderColor:C&&!n?"#1890ff":T},disabled:i||d,children:S?l.jsxs("div",{className:"flex items-center justify-between mx-5",title:S?.name||a?.name,children:[l.jsxs("div",{className:"flex items-center justify-center gap-4",children:[S?.type==="application/pdf"?l.jsx("div",{className:"p-3 bg-[#E6F1FC] rounded-lg",children:l.jsx(Xe.FilePdfIcon,{size:24,className:"text-primary-600 dark:text-primary-600"})}):l.jsx("div",{className:"p-3 bg-[#E6F1FC] rounded-lg",children:l.jsx(de.DescriptionRounded,{sx:{height:"20px",width:"20px",color:"#006CCF"}})}),l.jsxs("div",{className:"text-left",children:[l.jsx(ne,{size:"small",variant:"medium",className:"font-inter text-md font-medium text-base",children:j(S?.name||a?.name)}),d?l.jsx(ne,{size:"small",variant:"medium",appearance:"subtitle",children:"Uploading..."}):S?.size>0?l.jsxs(ne,{size:"small",variant:"medium",appearance:"subtitle",children:[(S.size/1e3).toFixed(2)," ","KB"]}):null]})]}),o?l.jsx(Xe.LoadingSpinnerIcon,{size:36,className:"text-primary-600 dark:text-white"}):l.jsx("button",{id:"btn-file-upload",className:"ml-4 cursor-pointer",onClick:I=>{I.stopPropagation(),U()},disabled:i,children:l.jsx(Xe.DeleteIcon,{size:18,className:"text-error-500 dark:text-error-500"})})]}):l.jsx("div",{className:"flex items-center justify-center",children:l.jsxs("div",{className:"flex-col",children:[l.jsx("div",{className:"mb-4 flex justify-center",children:l.jsx(Xe.DownloadIcon,{size:24,className:"text-neutral-400 dark:text-neutral-400"})}),l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center justify-center",children:[l.jsx(ne,{size:"small",variant:"medium",className:"text-primary-600 dark:text-primary-300",appearance:"custom",children:"Click to upload"}),l.jsx(ne,{size:"small",variant:"medium",className:"ml-1",appearance:"subtitle",children:"or drag and drop"})]}),r?l.jsx(ne,{size:"small",variant:"medium",appearance:"subtitle",children:r}):null]})]})})})}),n&&l.jsx(ne,{className:"text-error-500 mt-1",appearance:"custom",size:"extra-small",variant:"medium",children:n})]})},tP=Object.keys(Fu).filter(t=>t?.endsWith("Rounded")),rP=[...tP||[],...(v4||[]).map(t=>`flag-${t}`)],nP=t=>{if(t?.startsWith("flag-")){const e=t?.replace("flag-","");return mb(e||"")||e}return t.replaceAll(/([A-Z])/g," $1").trim()},iP=({onChange:t,selectedIcon:e,setOpen:r})=>{const[n,i]=h.useState(""),a=(rP||[]).filter(o=>{if(o?.startsWith("flag-")){const A=o?.replace("flag-","");return A?.toLowerCase()?.includes(n?.trim()?.toLowerCase()||"")||mb(A||"")?.toLowerCase()?.includes(n?.trim()?.toLowerCase()||"")}return o?.trim()?.toLowerCase()?.includes(n?.trim()?.toLowerCase()||"")}),s=(o,A)=>{if(A.stopPropagation(),e===o){t?.(null);return}t?.(o),r?.(!1)};return l.jsxs("div",{className:"flex flex-col gap-3",onKeyDown:o=>{o.key==="Enter"&&(o.preventDefault(),o.stopPropagation())},children:[l.jsx(cb,{id:"input-field-icon-picker",placeholder:"Search icons...",onChange:o=>i(o||""),fieldSuffix:l.jsx(Fu.Search,{sx:{width:16,height:16,color:"rgb(152 162 179)"}})}),l.jsx(VS.FixedSizeGrid,{columnCount:5,rowCount:Math.ceil((a?.length||0)/5),columnWidth:40,rowHeight:40,width:220,height:240,children:({columnIndex:o,rowIndex:A,style:u})=>{const c=A*5+o,d=a?.[c];return d?l.jsx("div",{style:{...u,padding:"4px"},children:l.jsx(Ke.Tooltip,{title:nP(d),placement:"bottom",children:l.jsx(WS.IconButton,{type:"button",className:B("flex items-center justify-center !rounded-md hover:bg-neutral-200 dark:hover:bg-black-700",{"!bg-primary-50 dark:!bg-black-800":e===d}),onClick:f=>s(d,f),onKeyDown:f=>{f.key==="Enter"&&(f.preventDefault(),f.stopPropagation())},children:l.jsx(_b,{iconName:d,sx:{width:20,height:20},className:"text-neutral-900 dark:text-white"})})})}):null}})]})},_b=({iconName:t,sx:e,className:r,isHovering:n})=>{if(t?.startsWith?.("flag-")){const a=t?.replace("flag-","");return Ja?.(a||"",n||!1)||l.jsx("div",{children:"-"})}const i=Fu?.[t];return i?l.jsx(i,{sx:e,className:r,isHovering:n}):l.jsx("div",{children:"-"})},aP=({selectedIcon:t,onChange:e,label:r,required:n=!1,allowClear:i=!0,disabled:a=!1,errorMessage:s,dropdownPosition:o="bottom"})=>{const[A,u]=h.useState(!1),c=h.useRef(!1),d=h.useRef(null),f=h.useRef(!1);h.useEffect(()=>{f.current&&!A&&d.current?.focus(),f.current=A},[A]);const p=m=>{m.stopPropagation(),e?.("")};return l.jsx(Ke.Popover,{arrow:!1,placement:o,trigger:"click",getPopupContainer:m=>m?.parentElement||document.body,open:A,onOpenChange:m=>{m?(c.current&&u(!0),c.current=!1):u(!1)},content:l.jsx(iP,{onChange:e,selectedIcon:t,setOpen:u}),children:l.jsxs("div",{className:"flex flex-col gap-1",children:[r?l.jsx(Xt,{label:r||"",required:n||!1}):null,l.jsxs("button",{ref:d,type:"button",id:`btn-icon-picker-icon-${t?"selected":"unselected"}`,className:`lax-form-trigger min-w-[83px] py-1.5 px-3 rounded-md border ${a?"cursor-not-allowed opacity-60 bg-neutral-50 dark:bg-black-800":"bg-white dark:bg-black-800"} ${s?"border-red-500":"focus:border-primary-600 dark:focus:border-primary-400"} flex items-center justify-between gap-2`,disabled:a,onClick:m=>{if(a){m.preventDefault(),m.stopPropagation();return}m.detail>0&&(c.current=!0)},onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),A||m.currentTarget.closest("form")?.querySelector('button[type="submit"]')?.click())},children:[t?l.jsx(_b,{iconName:t,sx:{width:20,height:20},className:"text-neutral-900 dark:text-white"}):l.jsx(ne,{size:"small",variant:"medium",appearance:"subtitle",children:"Select Icon"}),t&&i&&!a?l.jsx(Fu.CloseRounded,{sx:{width:20,height:20},className:"hover:bg-neutral-100 dark:hover:bg-black-800 rounded-full transition-colors cursor-pointer text-neutral-400 dark:text-neutral-500",onClick:p}):null]}),s&&l.jsx(ne,{size:"extra-small",className:"text-red-500 font-medium",children:s})]})})},sP=h.lazy(()=>Promise.resolve({default:t=>l.jsx(h.Suspense,{fallback:l.jsx("div",{className:"min-w-[83px] h-[30px] animate-pulse bg-neutral-100 dark:bg-black-800 rounded-md"}),children:l.jsx(aP,{...t})})})),oP={purple:"bg-purple-50 text-purple-500 border border-purple-100 dark:bg-purple-950 dark:text-purple-400 dark:border-purple-800",blue:"bg-blue-50 text-blue-500 border border-blue-100 dark:bg-blue-950 dark:text-blue-400 dark:border-blue-800",teal:"bg-teal-50 text-teal-500 border border-teal-100 dark:bg-teal-950 dark:text-teal-400 dark:border-teal-800",green:"bg-green-50 text-green-500 border border-green-100 dark:bg-green-950 dark:text-green-400 dark:border-green-800",yellow:"bg-yellow-50 text-yellow-600 border border-yellow-100 dark:bg-yellow-950 dark:text-yellow-400 dark:border-yellow-800",orange:"bg-orange-50 text-orange-500 border border-orange-100 dark:bg-orange-950 dark:text-orange-400 dark:border-orange-800",peach:"bg-orange-50 text-orange-400 border border-orange-100 dark:bg-orange-950 dark:text-orange-300 dark:border-orange-800",red:"bg-red-50 text-red-500 border border-red-100 dark:bg-red-950 dark:text-red-400 dark:border-red-800",navy:"bg-navy-50 text-navy-700 border border-navy-100 dark:bg-navy-950 dark:text-navy-400 dark:border-navy-800",grey:"bg-neutral-50 text-neutral-500 border border-neutral-100 dark:bg-neutral-950 dark:text-neutral-400 dark:border-neutral-800"},lP="bg-blue-50 text-blue-600 border border-blue-200 dark:bg-blue-950 dark:text-blue-400 dark:border-blue-800",U4=h.forwardRef(({status:t,children:e,className:r,"aria-label":n},i)=>{const a=t?.toLowerCase();return l.jsx(Ar,{ref:i,label:e,className:B(a?oP[a]:lP,r),"aria-label":n||`Status: ${t||"default"}`,role:"status"})});U4.displayName="StatusColorMapping";const z4=h.forwardRef(({status:t="default",children:e,appearance:r="outline",size:n="md",className:i,isRounded:a=!1,capitalize:s=!0,"aria-label":o},A)=>{const u=m=>!m||!s?m:m.replace(/\w\S*/g,g=>g.charAt(0).toUpperCase()+g.substr(1).toLowerCase()),c=()=>{switch(n){case"sm":return"text-xs px-1.5 py-0.5";case"lg":return"text-sm px-3 py-1.5";default:return"text-xs px-2 py-1"}},d=()=>{switch(t){case"primary":case"default":return"bg-blue-50 dark:bg-blue-950 text-blue-600 dark:text-blue-300 border border-blue-300 dark:border-blue-700";case"warning":return"bg-yellow-50 dark:bg-yellow-950 text-yellow-600 dark:text-yellow-300 border border-yellow-300 dark:border-yellow-700";case"error":return"bg-red-50 dark:bg-red-950 text-red-600 dark:text-red-300 border border-red-300 dark:border-red-700";case"neutral":return"bg-neutral-50 dark:bg-neutral-950 text-neutral-600 dark:text-neutral-300 border border-neutral-300 dark:border-neutral-700";case"success":return"bg-green-50 dark:bg-green-950 text-green-600 dark:text-green-300 border border-green-300 dark:border-green-700";case"info":return"bg-blue-50 dark:bg-blue-950 text-blue-600 dark:text-blue-300 border border-blue-300 dark:border-blue-700";default:return"bg-blue-50 dark:bg-blue-950 text-blue-600 dark:text-blue-300 border border-blue-300 dark:border-blue-700"}},f=()=>{switch(t){case"primary":case"default":return"bg-blue-600 dark:bg-blue-700 text-white";case"warning":return"bg-yellow-600 dark:bg-yellow-700 text-white";case"success":return"bg-green-600 dark:bg-green-700 text-white";case"error":return"bg-red-600 dark:bg-red-700 text-white";case"neutral":return"bg-neutral-600 dark:bg-neutral-700 text-white";case"info":return"bg-blue-600 dark:bg-blue-700 text-white";default:return"bg-blue-600 dark:bg-blue-700 text-white"}},p=()=>r==="filled"?f():d();return l.jsx("span",{ref:A,className:B("inline-flex items-center justify-center font-medium transition-colors",a?"rounded-full":"rounded",c(),p(),i),"aria-label":o||`Badge: ${t}`,role:"status",children:u(e)})});z4.displayName="Badge";const ps=({title:t,children:e})=>t?l.jsx(l.Fragment,{children:e}):null;ps.displayName="HelmetTitle";const yb=({children:t,className:e="",title:r,style:n,id:i})=>l.jsxs(l.Fragment,{children:[l.jsx(ps,{title:r}),l.jsx("div",{className:`bg-white dark:bg-black-800 border border-neutral-200 dark:border-black-600 rounded-lg shadow-100 w-full flex flex-col ${e}`,style:n,id:i,children:t})]});yb.displayName="Card";const Qu=({id:t,children:e,onClose:r,open:n,title:i,parentContainer:a="full-screen-container",resizable:s,width:o=400,placement:A="right",closable:u=!1,mask:c,classNames:d,styles:f,getContainer:p,zIndex:m,footer:g,..._})=>{const b=h.useRef(!1),[y,v]=h.useState(o);h.useEffect(()=>{v(o)},[n,o]);const S=h.useCallback(w=>{if(b.current)if(A==="right"){const T=document.body.offsetWidth-(w.clientX-document.body.offsetLeft);T>256&&v(T)}else w.clientX>256&&v(w.clientX)},[A,v]),k=h.useCallback(()=>{b.current&&(b.current=!1)},[]);h.useEffect(()=>(document.addEventListener("mousemove",S),document.addEventListener("mouseup",k),()=>{document.removeEventListener("mousemove",S),document.removeEventListener("mouseup",k)}),[S,k]);const E=typeof window<"u"?document.getElementById(a)||document.body:null;return E?Qr.createPortal(l.jsxs(Ke.Drawer,{id:t||"",closable:u,title:i,onClose:r,open:n,width:y,getContainer:p!==void 0?p:!1,placement:A,mask:c,classNames:d,styles:f,zIndex:m,footer:g,..._,children:[s&&l.jsx("div",{className:"cursor-ew-resize w-1 pl-[2px] absolute top-0 bottom-0 z-[2100] bg-transparent dark:bg-black-600 hover:bg-neutral-200 dark:hover:bg-black-700",onMouseDown:()=>{b.current=!0},style:A==="right"?{left:0}:{right:0}}),e]}),E):null};Qu.displayName="Drawer";const AP=({children:t,showAsModal:e,...r})=>e?l.jsx(cn,{onCancel:r.onClose,...r,children:t}):l.jsx(Qu,{...r,children:t});function B4(t){const[e,r]=h.useState(void 0),n=h.useRef(null);return h.useEffect(()=>{if(t.current)return n.current=new ResizeObserver(i=>{if(i[0]){const{width:a,height:s}=i[0].contentRect;r({width:a,height:s})}}),n.current.observe(t.current),()=>{n.current&&n.current.disconnect()}},[t]),e}const uP=({tags:t,size:e="sm",className:r="",maxVisible:n,icon:i,title:a=null,truncate:s=void 0,noWrap:o=!1,fitContent:A=!1,trailingContent:u})=>{const c=h.useRef(null),d=B4(c),f=S=>{switch(S){case"xs":return 6.5;case"sm":return 6.5;case"md":return 7;case"lg":return 7;default:return 6.5}},p=S=>{switch(S){case"xs":return 16;case"sm":return 20;case"md":return 24;case"lg":return 28;default:return 20}},m=(S,k)=>{if(!S)return 0;const E=k&&S.length>k?S.slice(0,k)+"...":S,w=f(e),T=p(e),O=i?16:0;return E.length*w+T+O},g=h.useMemo(()=>{if(!d||!t?.length)return{visibleTags:t||[],hiddenTags:[],truncateMap:new Map};const S=d.width,k=8,E=m("+ XX more")+10,w=t.map((D,L)=>({index:L,width:m(D.label,s)}));if(w.reduce((L,P)=>L+P.width,0)+(w.length-1)*k<=S)return{visibleTags:t,hiddenTags:[],truncateMap:new Map};let O=0,C=0;const N=new Map;for(let D=0;D<w.length;D++){const L=w[D].width,P=D>0?k:0,U=w.length-D-1,j=U>0;if(C+P+L+(j?k+E:0)>S){if(U===1){const F=w[D+1].width;if(C+P+L+k+F<=S){O=D+2;break}}if(D===0){const z=Math.floor((S-p(e)-(i?16:0)-k-E)/f(e))-3;z>=10?(N.set(0,Math.max(10,z)),O=1):(O=1,N.set(0,10))}break}if(C+=P+L,O++,!j)break}return O=Math.max(1,Math.min(O,t.length)),n&&(O=Math.min(O,n)),t.length-O===1&&O<t.length&&w.slice(0,O+1).reduce((L,P)=>L+P.width,0)+O*k<=S&&O++,{visibleTags:t.slice(0,O),hiddenTags:t.slice(O),truncateMap:N}},[d,t,e,i,n,s]),{visibleTags:_,hiddenTags:b,truncateMap:y}=g;if(!t||t.length===0)return"-";const v=()=>l.jsxs(l.Fragment,{children:[l.jsx("style",{children:`
90
+ `,onChange:G=>{n(G.target.value)},value:r,defaultValue:a,id:t||e,style:E,autoComplete:"off",placeholder:P}),l.jsx("span",{className:"absolute inset-y-0 right-3 flex items-center z-[1000px] h-full dark:text-black-100",children:"%"})]}),i&&l.jsx(ne,{className:"text-error-500 mt-1",appearance:"custom",size:"extra-small",variant:"medium",children:i})]}),F&&R&&D&&L&&l.jsx("div",{role:"tooltip",tabIndex:0,className:"absolute left-0 right-0 top-[95%] mt-1 z-50 bg-white dark:bg-black-600 rounded-xl",onClick:G=>G.stopPropagation(),onMouseDown:G=>G.preventDefault(),onKeyDown:G=>{G.key==="Escape"&&z(!1)},children:l.jsx(L,{riskDetails:R})})]})});j4.displayName="PercentageInputField";const H4=h.forwardRef(({onSubmit:t,...e},r)=>l.jsx("form",{ref:r,onSubmit:n=>{n.preventDefault(),t?.(n)},...e}));H4.displayName="Form";const F4=typeof window<"u"?h.useLayoutEffect:h.useEffect;function xb(t,e,r,n){const i=h.useRef(e);F4(()=>{i.current=e},[e]),h.useEffect(()=>{const a=r?.current||window;if(!(a&&a.addEventListener)||t===null)return;const s=o=>i.current(o);return a.addEventListener(t,s,n),()=>{a.removeEventListener(t,s)}},[t,r,n])}const _o=h.memo(h.forwardRef(({adjustWithScreen:t,children:e,renderViewClassName:r,fullHeight:n,...i},a)=>{const[s,o]=h.useState(window.innerHeight),A=h.useRef(null);return xb("resize",()=>{t&&o(window.innerHeight)}),h.useImperativeHandle(a,()=>({get getInstance(){return A.current},get view(){return A.current?.view??null},scrollToTop:()=>{A.current&&A.current.scrollToTop()},scrollToRight:()=>{A.current&&A.current.scrollToRight()}}),[]),l.jsx(TN.Scrollbars,{ref:A,autoHide:!0,renderTrackVertical:({style:c,...d})=>l.jsx("div",{style:c,className:"h-full top-0 right-0 rounded-md z-[1001] !w-scrollbar-size",...d}),renderThumbVertical:({style:c,...d})=>l.jsx("div",{style:c,className:"rounded-md bg-[#00000033] dark:bg-black-500 absolute right-0.5 !w-2",...d}),renderTrackHorizontal:({style:c,...d})=>l.jsx("div",{style:c,className:"w-full bottom-0 left-0 rounded-md z-[1001] !h-scrollbar-size ",...d}),renderThumbHorizontal:({style:c,...d})=>l.jsx("div",{style:c,className:"rounded-md bg-[#00000033] dark:bg-black-500 absolute bottom-0.5 !h-2",...d}),renderView:c=>l.jsx("div",{className:B("!-mr-scrollbar-size h-full !-mb-scrollbar-size",r,n?"!h-[calc(100%+var(--scroll-bar-size))]":""),...c}),...i,style:{...i.style||{},zIndex:0,...!i.autoHeight&&!i.style?.height?{height:n?"100%":s,overflowX:"hidden"}:{}},children:e})}));_o.displayName="CustomScrollbar";const ZR=({id:t,value:e="",onChange:r,placeholder:n="Enter markdown content...",rows:i=1,disabled:a=!1,className:s,textareaClassName:o,previewClassName:A,defaultMode:u="markdown",mode:c,label:d,required:f=!1})=>{const[p,m]=h.useState(u),[g,_]=h.useState(!1),b=t||`md-input-${Math.random().toString(36).slice(2,11)}`,y=h.useMemo(()=>{if(!e)return i;const k=(e.match(/\n/g)||[]).length+1;return Math.min(18,k)},[e,i]),v=c??p,S=c!==void 0;return l.jsxs("div",{className:B("flex flex-col gap-2",s),children:[l.jsxs("div",{className:"flex items-center gap-3",children:[!S&&l.jsx("div",{className:"flex items-center gap-2",children:l.jsxs("div",{className:"inline-flex grow-0 p-1 rounded-lg bg-neutral-100 dark:bg-black-700 w-auto",children:[l.jsx("button",{className:B("rounded-md p-1 flex items-center justify-center",v==="markdown"?"bg-white dark:bg-black-700 !text-neutral-900 dark:!text-neutral-100":""),onClick:()=>m("markdown"),disabled:a,children:l.jsx(ne,{variant:"semibold",size:"extra-small",appearance:"subtitle",className:B(v==="markdown"?"!text-neutral-900 dark:!text-neutral-100":""),children:"Markdown"})}),l.jsx("button",{className:B("rounded-md p-1 flex items-center justify-center",v==="preview"?"bg-white dark:bg-black-700 !text-neutral-900 dark:!text-neutral-100":""),onClick:()=>m("preview"),disabled:a,children:l.jsx(ne,{variant:"semibold",size:"extra-small",appearance:"subtitle",className:B(v==="preview"?"!text-neutral-900 dark:!text-neutral-100":""),children:"Preview"})})]})}),d&&l.jsxs("label",{htmlFor:b,className:"text-xs font-medium text-gray-600 dark:text-gray-300",children:[d,f&&l.jsx("span",{className:"text-red-500 ml-1",children:"*"})]})]}),l.jsx("div",{className:"relative",children:v==="markdown"?l.jsx("textarea",{id:b,value:e,onChange:k=>r(k.target.value),placeholder:n,rows:y,disabled:a,required:f,className:B("w-full border rounded-lg bg-white dark:bg-black-600","py-2.5 px-3 font-inter font-medium text-sm","text-gray-900 dark:text-gray-100","placeholder:text-gray-400 dark:placeholder:text-gray-500","transition-colors duration-200","focus:ring-2 focus:outline-none resize-vertical","border-gray-300 dark:border-gray-600","focus:border-blue-500 focus:ring-blue-200 dark:focus:ring-blue-400/20",{"bg-gray-50 dark:bg-gray-700 text-gray-400 dark:text-gray-500 cursor-not-allowed":a},o),onClick:k=>k.stopPropagation()}):l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:B("w-full rounded-lg","py-2.5 px-3 min-h-[calc(2.5rem*var(--rows,8))]","text-sm",A),style:{"--rows":y>3?y-3:y},children:l.jsx(_o,{autoHeight:!0,autoHeightMax:`calc(1rem * ${y>3?y-3:y})`,children:l.jsx("div",{className:"markdown-preview text-gray-900 dark:text-gray-100 [&_h1]:text-2xl [&_h1]:font-bold [&_h1]:mb-4 [&_h1]:mt-2 [&_h2]:text-xl [&_h2]:font-bold [&_h2]:mb-3 [&_h2]:mt-2 [&_h3]:text-lg [&_h3]:font-semibold [&_h3]:mb-2 [&_h3]:mt-2 [&_p]:mb-2 [&_p]:leading-relaxed [&_ul]:list-disc [&_ul]:ml-6 [&_ul]:mb-2 [&_ol]:list-decimal [&_ol]:ml-6 [&_ol]:mb-2 [&_li]:mb-1 [&_code]:bg-gray-100 [&_code]:dark:bg-gray-800 [&_code]:px-1 [&_code]:py-0.5 [&_code]:rounded [&_code]:text-sm [&_code]:font-mono [&_pre]:bg-gray-100 [&_pre]:dark:bg-gray-800 [&_pre]:p-3 [&_pre]:rounded [&_pre]:overflow-x-auto [&_pre]:mb-2 [&_blockquote]:border-l-4 [&_blockquote]:border-gray-300 [&_blockquote]:dark:border-gray-600 [&_blockquote]:pl-4 [&_blockquote]:italic [&_blockquote]:mb-2 [&_a]:text-blue-600 [&_a]:dark:text-blue-400 [&_a]:underline [&_strong]:font-bold [&_em]:italic [&_table]:w-full [&_table]:border-collapse [&_table]:mb-2 [&_th]:border [&_th]:border-gray-300 [&_th]:dark:border-gray-600 [&_th]:px-2 [&_th]:py-1 [&_th]:bg-gray-50 [&_th]:dark:bg-gray-700 [&_th]:font-semibold [&_td]:border [&_td]:border-gray-300 [&_td]:dark:border-gray-600 [&_td]:px-2 [&_td]:py-1 [&_hr]:my-4 [&_hr]:border-gray-300 [&_hr]:dark:border-gray-600",children:l.jsx(L1,{remarkPlugins:[I1],children:e||"*No content to preview*"})})})}),l.jsx("button",{onClick:()=>_(!0),className:"absolute bottom-2 right-2 p-1 rounded-md bg-neutral-100 dark:bg-black-600 hover:bg-gray-200 dark:hover:bg-black-500 transition-colors shadow-sm flex items-center justify-center",title:"Expand preview",type:"button",children:l.jsx(de.OpenInFull,{sx:{fontSize:"16px"},className:"text-neutral-600 dark:text-neutral-400"})})]})}),l.jsx(cn,{open:g,onCancel:()=>_(!1),title:"Markdown Preview",width:800,footer:null,children:l.jsx(_o,{autoHeight:!0,autoHeightMax:"70vh",children:l.jsx("div",{className:"markdown-preview text-gray-900 dark:text-gray-100 [&_h1]:text-2xl [&_h1]:font-bold [&_h1]:mb-4 [&_h1]:mt-2 [&_h2]:text-xl [&_h2]:font-bold [&_h2]:mb-3 [&_h2]:mt-2 [&_h3]:text-lg [&_h3]:font-semibold [&_h3]:mb-2 [&_h3]:mt-2 [&_p]:mb-2 [&_p]:leading-relaxed [&_ul]:list-disc [&_ul]:ml-6 [&_ul]:mb-2 [&_ol]:list-decimal [&_ol]:ml-6 [&_ol]:mb-2 [&_li]:mb-1 [&_code]:bg-gray-100 [&_code]:dark:bg-gray-800 [&_code]:px-1 [&_code]:py-0.5 [&_code]:rounded [&_code]:text-sm [&_code]:font-mono [&_pre]:bg-gray-100 [&_pre]:dark:bg-gray-800 [&_pre]:p-3 [&_pre]:rounded [&_pre]:overflow-x-auto [&_pre]:mb-2 [&_blockquote]:border-l-4 [&_blockquote]:border-gray-300 [&_blockquote]:dark:border-gray-600 [&_blockquote]:pl-4 [&_blockquote]:italic [&_blockquote]:mb-2 [&_a]:text-blue-600 [&_a]:dark:text-blue-400 [&_a]:underline [&_strong]:font-bold [&_em]:italic [&_table]:w-full [&_table]:border-collapse [&_table]:mb-2 [&_th]:border [&_th]:border-gray-300 [&_th]:dark:border-gray-600 [&_th]:px-2 [&_th]:py-1 [&_th]:bg-gray-50 [&_th]:dark:bg-gray-700 [&_th]:font-semibold [&_td]:border [&_td]:border-gray-300 [&_td]:dark:border-gray-600 [&_td]:px-2 [&_td]:py-1 [&_hr]:my-4 [&_hr]:border-gray-300 [&_hr]:dark:border-gray-600",children:l.jsx(L1,{remarkPlugins:[I1],children:e||"*No content to preview*"})})})})]})},{Dragger:$R}=Ke.Upload,JR=50*1024*1024,eP=({getFile:t,id:e,description:r,errorMessage:n=null,disabled:i=!1,defaultFile:a=null,acceptedFiles:s=null,isLoading:o=!1,asBase64:A=!1,toFileServer:u=!1,setFileUploading:c,fileUploading:d=!1,uploadToDocServer:f=!1,multiple:p=!1,getRealFileName:m=!1,onDelete:g,maxSize:_=JR,fileUploadService:b,systemMessages:y,toast:v})=>{const[S,k]=h.useState(null),[E,w]=h.useState([]),[T,O]=h.useState("#d9d9d9"),[C,N]=h.useState(!1),[R,D]=h.useState(null),L=async()=>{if(!b){console.warn("MultiFileUpload: File server upload requires fileUploadService");return}Promise.all(E.map(I=>{const F=new FormData;F.append("file",I);const z=Ia({file_upload_path:f?"document-server":null,token:localStorage.getItem("token")});return b.uploadFileToFileServer(F,z)})).then(I=>{t(p?I?.map(F=>F?.fileUrl):I?.[0]?.fileUrl,m?S?.name:I?.[0]?.fileName),c?.(null),D(I?.[0])})},P={accept:s||"*",multiple:p,showUploadList:!1,disabled:i,onRemove:()=>{w([])},beforeUpload:(I,F)=>{if(I.size>_){const z=Math.round(_/1048576),W=y?.fileSizeLimit(String(z),"MB")||`File size must be less than ${z}MB`;return v?v.error(W,{toastId:W}):console.error(W),!1}return k(I),u?(c?.(e||"field-file-upload"),w(F)):(A?Promise.all((p?F:[I]).map(z=>new Promise(W=>{const G=new FileReader;G.onload=X=>{W({filename:z.name,content:X?.target?.result?.split(",")[1]})},G.readAsDataURL(z)}))).then(z=>{t(p?z:z[0])}):t(I),k(I)),!1}},U=async()=>{if(u&&R&&b){const I=Ia({token:localStorage.getItem("token")});b.deleteFileFromFileServer(R?.fileName,I).then(()=>{D(null)})}k(null),w([]),t(""),g?.()};h.useEffect(()=>{a?.name&&k(a)},[a]),h.useEffect(()=>{O(n?"#EF4444":"#d9d9d9")},[n]),h.useEffect(()=>{E.length&&L()},[E]);const j=I=>I?I.length<=20?I:I.slice(0,14)+"...."+I.slice(-7):"";return l.jsxs("div",{children:[l.jsx("div",{className:"h-32",onMouseEnter:()=>N(!0),onMouseLeave:()=>N(!1),children:l.jsx($R,{...P,style:{borderColor:C&&!n?"#1890ff":T},disabled:i||d,children:S?l.jsxs("div",{className:"flex items-center justify-between mx-5",title:S?.name||a?.name,children:[l.jsxs("div",{className:"flex items-center justify-center gap-4",children:[S?.type==="application/pdf"?l.jsx("div",{className:"p-3 bg-[#E6F1FC] rounded-lg",children:l.jsx(Xe.FilePdfIcon,{size:24,className:"text-primary-600 dark:text-primary-600"})}):l.jsx("div",{className:"p-3 bg-[#E6F1FC] rounded-lg",children:l.jsx(de.DescriptionRounded,{sx:{height:"20px",width:"20px",color:"#006CCF"}})}),l.jsxs("div",{className:"text-left",children:[l.jsx(ne,{size:"small",variant:"medium",className:"font-inter text-md font-medium text-base",children:j(S?.name||a?.name)}),d?l.jsx(ne,{size:"small",variant:"medium",appearance:"subtitle",children:"Uploading..."}):S?.size>0?l.jsxs(ne,{size:"small",variant:"medium",appearance:"subtitle",children:[(S.size/1e3).toFixed(2)," ","KB"]}):null]})]}),o?l.jsx(Xe.LoadingSpinnerIcon,{size:36,className:"text-primary-600 dark:text-white"}):l.jsx("button",{id:"btn-file-upload",className:"ml-4 cursor-pointer",onClick:I=>{I.stopPropagation(),U()},disabled:i,children:l.jsx(Xe.DeleteIcon,{size:18,className:"text-error-500 dark:text-error-500"})})]}):l.jsx("div",{className:"flex items-center justify-center",children:l.jsxs("div",{className:"flex-col",children:[l.jsx("div",{className:"mb-4 flex justify-center",children:l.jsx(Xe.DownloadIcon,{size:24,className:"text-neutral-400 dark:text-neutral-400"})}),l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center justify-center",children:[l.jsx(ne,{size:"small",variant:"medium",className:"text-primary-600 dark:text-primary-300",appearance:"custom",children:"Click to upload"}),l.jsx(ne,{size:"small",variant:"medium",className:"ml-1",appearance:"subtitle",children:"or drag and drop"})]}),r?l.jsx(ne,{size:"small",variant:"medium",appearance:"subtitle",children:r}):null]})]})})})}),n&&l.jsx(ne,{className:"text-error-500 mt-1",appearance:"custom",size:"extra-small",variant:"medium",children:n})]})},tP=Object.keys(Fu).filter(t=>t?.endsWith("Rounded")),rP=[...tP||[],...(v4||[]).map(t=>`flag-${t}`)],nP=t=>{if(t?.startsWith("flag-")){const e=t?.replace("flag-","");return mb(e||"")||e}return t.replaceAll(/([A-Z])/g," $1").trim()},iP=({onChange:t,selectedIcon:e,setOpen:r})=>{const[n,i]=h.useState(""),a=(rP||[]).filter(o=>{if(o?.startsWith("flag-")){const A=o?.replace("flag-","");return A?.toLowerCase()?.includes(n?.trim()?.toLowerCase()||"")||mb(A||"")?.toLowerCase()?.includes(n?.trim()?.toLowerCase()||"")}return o?.trim()?.toLowerCase()?.includes(n?.trim()?.toLowerCase()||"")}),s=(o,A)=>{if(A.stopPropagation(),e===o){t?.(null);return}t?.(o),r?.(!1)};return l.jsxs("div",{className:"flex flex-col gap-3",onKeyDown:o=>{o.key==="Enter"&&(o.preventDefault(),o.stopPropagation())},children:[l.jsx(cb,{id:"input-field-icon-picker",placeholder:"Search icons...",onChange:o=>i(o||""),fieldSuffix:l.jsx(Fu.Search,{sx:{width:16,height:16,color:"rgb(152 162 179)"}})}),l.jsx(VS.FixedSizeGrid,{columnCount:5,rowCount:Math.ceil((a?.length||0)/5),columnWidth:40,rowHeight:40,width:220,height:240,children:({columnIndex:o,rowIndex:A,style:u})=>{const c=A*5+o,d=a?.[c];return d?l.jsx("div",{style:{...u,padding:"4px"},children:l.jsx(Ke.Tooltip,{title:nP(d),placement:"bottom",children:l.jsx(WS.IconButton,{type:"button",className:B("flex items-center justify-center !rounded-md hover:bg-neutral-200 dark:hover:bg-black-700",{"!bg-primary-50 dark:!bg-black-800":e===d}),onClick:f=>s(d,f),onKeyDown:f=>{f.key==="Enter"&&(f.preventDefault(),f.stopPropagation())},children:l.jsx(_b,{iconName:d,sx:{width:20,height:20},className:"text-neutral-900 dark:text-white"})})})}):null}})]})},_b=({iconName:t,sx:e,className:r,isHovering:n})=>{if(t?.startsWith?.("flag-")){const a=t?.replace("flag-","");return Ja?.(a||"",n||!1)||l.jsx("div",{children:"-"})}const i=Fu?.[t];return i?l.jsx(i,{sx:e,className:r,isHovering:n}):l.jsx("div",{children:"-"})},aP=({selectedIcon:t,onChange:e,label:r,required:n=!1,allowClear:i=!0,disabled:a=!1,errorMessage:s,dropdownPosition:o="bottom"})=>{const[A,u]=h.useState(!1),c=h.useRef(!1),d=h.useRef(null),f=h.useRef(!1);h.useEffect(()=>{f.current&&!A&&d.current?.focus(),f.current=A},[A]);const p=m=>{m.stopPropagation(),e?.("")};return l.jsx(Ke.Popover,{arrow:!1,placement:o,trigger:"click",getPopupContainer:m=>m?.parentElement||document.body,open:A,onOpenChange:m=>{m?(c.current&&u(!0),c.current=!1):u(!1)},content:l.jsx(iP,{onChange:e,selectedIcon:t,setOpen:u}),children:l.jsxs("div",{className:"flex flex-col gap-1",children:[r?l.jsx(Xt,{label:r||"",required:n||!1}):null,l.jsxs("button",{ref:d,type:"button",id:`btn-icon-picker-icon-${t?"selected":"unselected"}`,className:`lax-form-trigger min-w-[83px] py-1.5 px-3 rounded-md border ${a?"cursor-not-allowed opacity-60 bg-neutral-50 dark:bg-black-800":"bg-white dark:bg-black-800"} ${s?"border-red-500":"focus:border-primary-600 dark:focus:border-primary-400"} flex items-center justify-between gap-2`,disabled:a,onClick:m=>{if(a){m.preventDefault(),m.stopPropagation();return}m.detail>0&&(c.current=!0)},onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),A||m.currentTarget.closest("form")?.querySelector('button[type="submit"]')?.click())},children:[t?l.jsx(_b,{iconName:t,sx:{width:20,height:20},className:"text-neutral-900 dark:text-white"}):l.jsx(ne,{size:"small",variant:"medium",appearance:"subtitle",children:"Select Icon"}),t&&i&&!a?l.jsx(Fu.CloseRounded,{sx:{width:20,height:20},className:"hover:bg-neutral-100 dark:hover:bg-black-800 rounded-full transition-colors cursor-pointer text-neutral-400 dark:text-neutral-500",onClick:p}):null]}),s&&l.jsx(ne,{size:"extra-small",className:"text-red-500 font-medium",children:s})]})})},sP=h.lazy(()=>Promise.resolve({default:t=>l.jsx(h.Suspense,{fallback:l.jsx("div",{className:"min-w-[83px] h-[30px] animate-pulse bg-neutral-100 dark:bg-black-800 rounded-md"}),children:l.jsx(aP,{...t})})})),oP={purple:"!bg-purple-50 !text-purple-500 border !border-purple-100 dark:!bg-purple-950 dark:!text-purple-400 dark:!border-purple-800",blue:"!bg-blue-50 !text-blue-500 border !border-blue-100 dark:!bg-blue-950 dark:!text-blue-400 dark:!border-blue-800",teal:"!bg-teal-50 !text-teal-500 border !border-teal-100 dark:!bg-teal-950 dark:!text-teal-400 dark:!border-teal-800",green:"!bg-green-50 !text-green-500 border !border-green-100 dark:!bg-green-950 dark:!text-green-400 dark:!border-green-800",yellow:"!bg-yellow-50 !text-yellow-600 border !border-yellow-100 dark:!bg-yellow-950 dark:!text-yellow-400 dark:!border-yellow-800",orange:"!bg-orange-50 !text-orange-500 border !border-orange-100 dark:!bg-orange-950 dark:!text-orange-400 dark:!border-orange-800",peach:"!bg-orange-50 !text-orange-400 border !border-orange-100 dark:!bg-orange-950 dark:!text-orange-300 dark:!border-orange-800",red:"!bg-red-50 !text-red-500 border !border-red-100 dark:!bg-red-950 dark:!text-red-400 dark:!border-red-800",navy:"!bg-navy-50 !text-navy-700 border !border-navy-100 dark:!bg-navy-950 dark:!text-navy-400 dark:!border-navy-800",grey:"!bg-neutral-50 !text-neutral-500 border !border-neutral-100 dark:!bg-neutral-950 dark:!text-neutral-400 dark:!border-neutral-800"},lP="bg-blue-50 text-blue-600 border border-blue-200 dark:bg-blue-950 dark:text-blue-400 dark:border-blue-800",U4=h.forwardRef(({status:t,children:e,className:r,"aria-label":n},i)=>{const a=t?.toLowerCase();return l.jsx(Ar,{ref:i,label:e,className:B(a?oP[a]:lP,r),"aria-label":n||`Status: ${t||"default"}`,role:"status"})});U4.displayName="StatusColorMapping";const z4=h.forwardRef(({status:t="default",children:e,appearance:r="outline",size:n="md",className:i,isRounded:a=!1,capitalize:s=!0,"aria-label":o},A)=>{const u=m=>!m||!s?m:m.replace(/\w\S*/g,g=>g.charAt(0).toUpperCase()+g.substr(1).toLowerCase()),c=()=>{switch(n){case"sm":return"text-xs px-1.5 py-0.5";case"lg":return"text-sm px-3 py-1.5";default:return"text-xs px-2 py-1"}},d=()=>{switch(t){case"primary":case"default":return"bg-blue-50 dark:bg-blue-950 text-blue-600 dark:text-blue-300 border border-blue-300 dark:border-blue-700";case"warning":return"bg-yellow-50 dark:bg-yellow-950 text-yellow-600 dark:text-yellow-300 border border-yellow-300 dark:border-yellow-700";case"error":return"bg-red-50 dark:bg-red-950 text-red-600 dark:text-red-300 border border-red-300 dark:border-red-700";case"neutral":return"bg-neutral-50 dark:bg-neutral-950 text-neutral-600 dark:text-neutral-300 border border-neutral-300 dark:border-neutral-700";case"success":return"bg-green-50 dark:bg-green-950 text-green-600 dark:text-green-300 border border-green-300 dark:border-green-700";case"info":return"bg-blue-50 dark:bg-blue-950 text-blue-600 dark:text-blue-300 border border-blue-300 dark:border-blue-700";default:return"bg-blue-50 dark:bg-blue-950 text-blue-600 dark:text-blue-300 border border-blue-300 dark:border-blue-700"}},f=()=>{switch(t){case"primary":case"default":return"bg-blue-600 dark:bg-blue-700 text-white";case"warning":return"bg-yellow-600 dark:bg-yellow-700 text-white";case"success":return"bg-green-600 dark:bg-green-700 text-white";case"error":return"bg-red-600 dark:bg-red-700 text-white";case"neutral":return"bg-neutral-600 dark:bg-neutral-700 text-white";case"info":return"bg-blue-600 dark:bg-blue-700 text-white";default:return"bg-blue-600 dark:bg-blue-700 text-white"}},p=()=>r==="filled"?f():d();return l.jsx("span",{ref:A,className:B("inline-flex items-center justify-center font-medium transition-colors",a?"rounded-full":"rounded",c(),p(),i),"aria-label":o||`Badge: ${t}`,role:"status",children:u(e)})});z4.displayName="Badge";const ps=({title:t,children:e})=>t?l.jsx(l.Fragment,{children:e}):null;ps.displayName="HelmetTitle";const yb=({children:t,className:e="",title:r,style:n,id:i})=>l.jsxs(l.Fragment,{children:[l.jsx(ps,{title:r}),l.jsx("div",{className:`bg-white dark:bg-black-800 border border-neutral-200 dark:border-black-600 rounded-lg shadow-100 w-full flex flex-col ${e}`,style:n,id:i,children:t})]});yb.displayName="Card";const Qu=({id:t,children:e,onClose:r,open:n,title:i,parentContainer:a="full-screen-container",resizable:s,width:o=400,placement:A="right",closable:u=!1,mask:c,classNames:d,styles:f,getContainer:p,zIndex:m,footer:g,..._})=>{const b=h.useRef(!1),[y,v]=h.useState(o);h.useEffect(()=>{v(o)},[n,o]);const S=h.useCallback(w=>{if(b.current)if(A==="right"){const T=document.body.offsetWidth-(w.clientX-document.body.offsetLeft);T>256&&v(T)}else w.clientX>256&&v(w.clientX)},[A,v]),k=h.useCallback(()=>{b.current&&(b.current=!1)},[]);h.useEffect(()=>(document.addEventListener("mousemove",S),document.addEventListener("mouseup",k),()=>{document.removeEventListener("mousemove",S),document.removeEventListener("mouseup",k)}),[S,k]);const E=typeof window<"u"?document.getElementById(a)||document.body:null;return E?Qr.createPortal(l.jsxs(Ke.Drawer,{id:t||"",closable:u,title:i,onClose:r,open:n,width:y,getContainer:p!==void 0?p:!1,placement:A,mask:c,classNames:d,styles:f,zIndex:m,footer:g,..._,children:[s&&l.jsx("div",{className:"cursor-ew-resize w-1 pl-[2px] absolute top-0 bottom-0 z-[2100] bg-transparent dark:bg-black-600 hover:bg-neutral-200 dark:hover:bg-black-700",onMouseDown:()=>{b.current=!0},style:A==="right"?{left:0}:{right:0}}),e]}),E):null};Qu.displayName="Drawer";const AP=({children:t,showAsModal:e,...r})=>e?l.jsx(cn,{onCancel:r.onClose,...r,children:t}):l.jsx(Qu,{...r,children:t});function B4(t){const[e,r]=h.useState(void 0),n=h.useRef(null);return h.useEffect(()=>{if(t.current)return n.current=new ResizeObserver(i=>{if(i[0]){const{width:a,height:s}=i[0].contentRect;r({width:a,height:s})}}),n.current.observe(t.current),()=>{n.current&&n.current.disconnect()}},[t]),e}const uP=({tags:t,size:e="sm",className:r="",maxVisible:n,icon:i,title:a=null,truncate:s=void 0,noWrap:o=!1,fitContent:A=!1,trailingContent:u})=>{const c=h.useRef(null),d=B4(c),f=S=>{switch(S){case"xs":return 6.5;case"sm":return 6.5;case"md":return 7;case"lg":return 7;default:return 6.5}},p=S=>{switch(S){case"xs":return 16;case"sm":return 20;case"md":return 24;case"lg":return 28;default:return 20}},m=(S,k)=>{if(!S)return 0;const E=k&&S.length>k?S.slice(0,k)+"...":S,w=f(e),T=p(e),O=i?16:0;return E.length*w+T+O},g=h.useMemo(()=>{if(!d||!t?.length)return{visibleTags:t||[],hiddenTags:[],truncateMap:new Map};const S=d.width,k=8,E=m("+ XX more")+10,w=t.map((D,L)=>({index:L,width:m(D.label,s)}));if(w.reduce((L,P)=>L+P.width,0)+(w.length-1)*k<=S)return{visibleTags:t,hiddenTags:[],truncateMap:new Map};let O=0,C=0;const N=new Map;for(let D=0;D<w.length;D++){const L=w[D].width,P=D>0?k:0,U=w.length-D-1,j=U>0;if(C+P+L+(j?k+E:0)>S){if(U===1){const F=w[D+1].width;if(C+P+L+k+F<=S){O=D+2;break}}if(D===0){const z=Math.floor((S-p(e)-(i?16:0)-k-E)/f(e))-3;z>=10?(N.set(0,Math.max(10,z)),O=1):(O=1,N.set(0,10))}break}if(C+=P+L,O++,!j)break}return O=Math.max(1,Math.min(O,t.length)),n&&(O=Math.min(O,n)),t.length-O===1&&O<t.length&&w.slice(0,O+1).reduce((L,P)=>L+P.width,0)+O*k<=S&&O++,{visibleTags:t.slice(0,O),hiddenTags:t.slice(O),truncateMap:N}},[d,t,e,i,n,s]),{visibleTags:_,hiddenTags:b,truncateMap:y}=g;if(!t||t.length===0)return"-";const v=()=>l.jsxs(l.Fragment,{children:[l.jsx("style",{children:`
91
91
  .popover-tags-no-scrollbar {
92
92
  scrollbar-width: none;
93
93
  -ms-overflow-style: none;