@chaos_team/chaos-ui 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +286 -0
- package/LICENSE +21 -0
- package/README.md +295 -0
- package/THIRD_PARTY_NOTICES.md +22 -0
- package/dist/business.cjs +26 -0
- package/dist/business.d.cts +10311 -0
- package/dist/business.d.ts +10311 -0
- package/dist/business.js +26 -0
- package/dist/format-BUpOzeCo.d.cts +8 -0
- package/dist/format-BUpOzeCo.d.ts +8 -0
- package/dist/hooks.cjs +8 -0
- package/dist/hooks.d.cts +1148 -0
- package/dist/hooks.d.ts +1148 -0
- package/dist/hooks.js +8 -0
- package/dist/index.cjs +6 -0
- package/dist/index.d.cts +5616 -0
- package/dist/index.d.ts +5616 -0
- package/dist/index.js +6 -0
- package/dist/lib.cjs +42 -0
- package/dist/lib.d.cts +804 -0
- package/dist/lib.d.ts +804 -0
- package/dist/lib.js +42 -0
- package/dist/message-KJli9tvf.d.cts +71 -0
- package/dist/message-KJli9tvf.d.ts +71 -0
- package/dist/message-provider-BI-P3CNq.d.cts +11 -0
- package/dist/message-provider-BI-P3CNq.d.ts +11 -0
- package/dist/next.cjs +6 -0
- package/dist/next.d.cts +103 -0
- package/dist/next.d.ts +103 -0
- package/dist/next.js +6 -0
- package/dist/theme-toggle-JL_jZE-w.d.cts +81 -0
- package/dist/theme-toggle-JL_jZE-w.d.ts +81 -0
- package/dist/time-picker-H1AaecnE.d.cts +452 -0
- package/dist/time-picker-H1AaecnE.d.ts +452 -0
- package/dist/ui/icons.cjs +6 -0
- package/dist/ui/icons.d.cts +3 -0
- package/dist/ui/icons.d.ts +3 -0
- package/dist/ui/icons.js +6 -0
- package/dist/ui-icons.cjs +6 -0
- package/dist/ui-icons.d.cts +205 -0
- package/dist/ui-icons.d.ts +205 -0
- package/dist/ui-icons.js +6 -0
- package/dist/ui.cjs +6 -0
- package/dist/ui.d.cts +39 -0
- package/dist/ui.d.ts +39 -0
- package/dist/ui.js +6 -0
- package/package.json +265 -0
- package/styles.css +1300 -0
- package/styles.css.d.ts +11 -0
package/dist/business.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Chaos UI - Enterprise React Component Library
|
|
3
|
+
* Copyright (c) 2026 qxyfoods
|
|
4
|
+
* MIT License
|
|
5
|
+
*/
|
|
6
|
+
"use client";var gw=Object.defineProperty;var fw=(e,t,a)=>t in e?gw(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a;var ad=(e,t,a)=>fw(e,typeof t!="symbol"?t+"":t,a);import*as v0 from"react";import{clsx as bw}from"clsx";import{twMerge as xw}from"tailwind-merge";function l(...e){return xw(bw(e))}import*as P from"lucide-react";var wr=P.AlertCircleIcon,jt=P.AlertTriangleIcon;var Zn=P.ArrowDownIcon,Zo=P.ArrowDownRightIcon,Yi=P.ArrowLeftIcon;var _a=P.ArrowRightIcon,ng=P.ArrowUpDownIcon,_s=P.ArrowUpIcon,en=P.ArrowUpRightIcon,Ah=P.BadgeDollarSignIcon,rd=P.BarChart3Icon;var xo=P.BellIcon;var nx=P.BookmarkCheckIcon,sg=P.BookmarkIcon,Ji=P.Building2Icon,sx=P.BuildingIcon;var Eh=P.CalendarDaysIcon,jr=P.CalendarIcon,qe=P.CheckCircle2Icon,qs=P.CheckCircleIcon,U=P.CheckIcon,re=P.ChevronDownIcon,et=P.ChevronLeftIcon,me=P.ChevronRightIcon,Zi=P.ChevronUpIcon;var Fh=P.ClipboardListIcon,pe=P.ClockIcon,$h=P.Columns3Icon,Hh=P.CookieIcon,zt=P.CopyIcon,Vh=P.CreditCardIcon,ig=P.DollarSignIcon,qa=P.DownloadIcon,lg=P.EditIcon;var Fn=P.EyeIcon,Oh=P.EyeOffIcon;var es=P.FileIcon,dg=P.FileSpreadsheetIcon,Rt=P.FileTextIcon;var cg=P.FolderIcon;var mg=P.GridIcon,ts=P.GripVerticalIcon;var Uh=P.HomeIcon,ha=P.ImageIcon;var Wh=P.InboxIcon,od=P.InfoIcon;var ug=P.LanguagesIcon,_h=P.LayoutDashboardIcon,qh=P.LifeBuoyIcon,kc=P.LinkIcon,wc=P.ListIcon;var Pr=P.Loader2Icon,pg=P.LockIcon;var Pc=P.MailIcon,gg=P.MaximizeIcon,fg=P.MegaphoneIcon,bg=P.MenuIcon,el=P.MessageSquareIcon;var Kr=P.MinusIcon,tu=P.MonitorIcon,au=P.MoonIcon,ix=P.MoreHorizontalIcon,Gh=P.MousePointerClickIcon;var jh=P.PackageCheckIcon,Qr=P.PackageIcon;var tl=P.PencilIcon,xg=P.PinIcon;var ge=P.PlusIcon,as=P.PrinterIcon,Kh=P.QrCodeIcon,vg=P.RadioTowerIcon,ia=P.RefreshCwIcon,Qh=P.RotateCcwIcon;var X=P.SearchIcon,hg=P.SearchXIcon,rs=P.SendIcon,Xh=P.ServerCrashIcon;var Gs=P.SettingsIcon,Yh=P.ShieldAlertIcon;var nd=P.SmartphoneIcon;var Tc=P.StarIcon,ru=P.SunIcon,yg=P.TableIcon,Rc=P.TagIcon,ye=P.Trash2Icon,sd=P.TrashIcon,tn=P.TrendingDownIcon,an=P.TrendingUpIcon;var Ng=P.TrophyIcon,Cg=P.TruckIcon;var os=P.UploadIcon;var js=P.UserIcon,al=P.UsersIcon,Jh=P.WifiOffIcon,kg=P.WrenchIcon,rn=P.XCircleIcon,Q=P.XIcon,Zh=P.ActivityIcon,ey=P.AwardIcon,wg=P.BanknoteIcon;var ou=P.CalculatorIcon,Pg=P.CameraIcon,vo=P.CircleIcon;var Tg=P.ExternalLinkIcon;var ty=P.FilePlusIcon,ay=P.FlagIcon,ry=P.FolderOpenIcon;var id=P.LayoutGridIcon;var oy=P.Link2Icon;var on=P.MapPinIcon;var ny=P.MedalIcon,sy=P.MoreVerticalIcon,rl=P.PaperclipIcon,Rg=P.PauseIcon;var Sg=P.PlayIcon,Xr=P.ReceiptIcon;var ol=P.SaveIcon;var nu=P.SignatureIcon;var Ig=P.TargetIcon,iy=P.WalletIcon,Dg=P.ZapIcon,ly=P.CarIcon,dy=P.GlobeIcon,cy=P.LayersIcon,Mg=P.BrainIcon;var ld=P.CodeIcon,my=P.MicIcon,Bg=P.SparklesIcon;var uy=P.ThumbsDownIcon,py=P.ThumbsUpIcon;var Sc=P.BoldIcon,Ic=P.ItalicIcon,Lg=P.ListOrderedIcon,zg=P.QuoteIcon,Dc=P.UndoIcon,Mc=P.RedoIcon,Ag=P.Heading1Icon,Eg=P.Heading2Icon,gy=P.StrikethroughIcon,fy=P.ZoomInIcon,by=P.ZoomOutIcon,xy=P.PipetteIcon;import"react";import{useTranslation as vy}from"react-i18next";import{Dialog as Qs}from"@base-ui/react/dialog";import"react";import{Button as vw}from"@base-ui/react/button";import{cva as hw}from"class-variance-authority";import{Fragment as yw,jsx as lx,jsxs as Nw}from"react/jsx-runtime";var Ks=hw("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function C({className:e,variant:t="default",size:a="default",icon:r,iconRight:o,children:n,...i}){let c=r!=null||o!=null;return lx(vw,{"data-slot":"button",className:l(Ks({variant:t,size:a,className:e})),...i,children:c?Nw(yw,{children:[r!=null&&lx("span",{"data-icon":"inline-start",className:"shrink-0",children:r}),n,o!=null&&lx("span",{"data-icon":"inline-end",className:"shrink-0",children:o})]}):n})}import{jsx as Yr,jsxs as Fg}from"react/jsx-runtime";function Ie({...e}){return Yr(Qs.Root,{"data-slot":"dialog",...e})}function su({...e}){return Yr(Qs.Trigger,{"data-slot":"dialog-trigger",...e})}function hy({...e}){return Yr(Qs.Portal,{"data-slot":"dialog-portal",...e})}function yy({className:e,...t}){return Yr(Qs.Backdrop,{"data-slot":"dialog-overlay",className:l("data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0 fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs",e),...t})}function De({className:e,children:t,showCloseButton:a=!0,...r}){let{t:o}=vy("ui");return Fg(hy,{children:[Yr(yy,{}),Fg(Qs.Popup,{"data-slot":"dialog-content",className:l("bg-popover text-popover-foreground ring-foreground/10 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl p-4 text-sm ring-1 duration-100 outline-none sm:max-w-sm",e),...r,children:[t,a&&Fg(Qs.Close,{"data-slot":"dialog-close",render:Yr(C,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[Yr(Q,{}),Yr("span",{className:"sr-only",children:o("dialog.close")})]})]})]})}function $e({className:e,...t}){return Yr("div",{"data-slot":"dialog-header",className:l("flex flex-col gap-2",e),...t})}function Ge({className:e,showCloseButton:t=!1,children:a,...r}){let{t:o}=vy("ui");return Fg("div",{"data-slot":"dialog-footer",className:l("bg-muted/50 -mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t p-4 sm:flex-row sm:justify-end",e),...r,children:[a,t&&Yr(Qs.Close,{render:Yr(C,{variant:"outline"}),children:o("dialog.closeButton")})]})}function Me({className:e,...t}){return Yr(Qs.Title,{"data-slot":"dialog-title",className:l("font-heading text-base leading-none font-medium",e),...t})}function Ye({className:e,...t}){return Yr(Qs.Description,{"data-slot":"dialog-description",className:l("text-muted-foreground *:[a]:hover:text-foreground text-sm *:[a]:underline *:[a]:underline-offset-3",e),...t})}function iu({className:e,...t}){return Yr("div",{"data-slot":"dialog-body",className:l("flex flex-col gap-3 py-4",e),...t})}import"react";import{Avatar as dx}from"@base-ui/react/avatar";import{jsx as cx}from"react/jsx-runtime";function Tr({className:e,size:t="default",fontSize:a,...r}){return cx(dx.Root,{"data-slot":"avatar","data-size":t,className:l("group/avatar after:border-border relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten",e),style:a?{fontSize:typeof a=="number"?`${a}px`:a}:void 0,...r})}function nn({className:e,...t}){return cx(dx.Image,{"data-slot":"avatar-image",className:l("aspect-square size-full rounded-full object-cover",e),...t})}function Rr({className:e,...t}){return cx(dx.Fallback,{"data-slot":"avatar-fallback",className:l("bg-muted text-muted-foreground flex size-full items-center justify-center rounded-full text-sm group-data-[size=sm]/avatar:text-xs",e),...t})}import{mergeProps as Cw}from"@base-ui/react/merge-props";import{useRender as kw}from"@base-ui/react/use-render";import{cva as ww}from"class-variance-authority";var Ny=ww("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function B({className:e,variant:t="default",render:a,...r}){return kw({defaultTagName:"span",props:Cw({className:l(Ny({variant:t}),e)},r),render:a,state:{slot:"badge",variant:t}})}import"react";import{useTranslation as Pw}from"react-i18next";import{mergeProps as Tw}from"@base-ui/react/merge-props";import{useRender as Rw}from"@base-ui/react/use-render";import{jsx as Bc,jsxs as H5}from"react/jsx-runtime";function mx({className:e,...t}){let{t:a}=Pw("ui");return Bc("nav",{"aria-label":a("breadcrumb.navLabel"),"data-slot":"breadcrumb",className:l(e),...t})}function ux({className:e,...t}){return Bc("ol",{"data-slot":"breadcrumb-list",className:l("text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm wrap-break-word",e),...t})}function px({className:e,...t}){return Bc("li",{"data-slot":"breadcrumb-item",className:l("inline-flex items-center gap-1",e),...t})}function gx({className:e,render:t,...a}){return Rw({defaultTagName:"a",props:Tw({className:l("cursor-pointer transition-colors hover:text-foreground",e)},a),render:t,state:{slot:"breadcrumb-link"}})}function fx({className:e,...t}){return Bc("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:l("text-foreground font-normal",e),...t})}function bx({children:e,className:t,...a}){return Bc("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:l("[&>svg]:size-3.5",t),...a,children:e??Bc(me,{})})}import"react";import{Input as Sw}from"@base-ui/react/input";import{jsx as Iw}from"react/jsx-runtime";function T({className:e,type:t,...a}){return Iw(Sw,{type:t,"data-slot":"input",className:l("border-input file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 disabled:bg-input/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 h-8 w-full min-w-0 rounded-lg border bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:ring-3 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3 md:text-sm",e),...a})}import*as $g from"react";import{DayPicker as Dw,getDefaultClassNames as Cy}from"react-day-picker";import{jsx as Xs}from"react/jsx-runtime";function xx({className:e,classNames:t,showOutsideDays:a=!0,captionLayout:r="label",buttonVariant:o="ghost",locale:n,formatters:i,components:c,...s}){let d=Cy();return Xs(Dw,{showOutsideDays:a,className:l("group/calendar bg-background p-2 [--cell-radius:var(--radius-md)] [--cell-size:--spacing(7)] in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,e),captionLayout:r,locale:n,formatters:{formatMonthDropdown:m=>m.toLocaleString(n?.code,{month:"short"}),...i},classNames:{root:l("w-fit",d.root),months:l("relative flex flex-col gap-4 md:flex-row",d.months),month:l("flex w-full flex-col gap-4",d.month),nav:l("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",d.nav),button_previous:l(Ks({variant:o}),"size-(--cell-size) p-0 select-none aria-disabled:opacity-50",d.button_previous),button_next:l(Ks({variant:o}),"size-(--cell-size) p-0 select-none aria-disabled:opacity-50",d.button_next),month_caption:l("flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)",d.month_caption),dropdowns:l("flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium",d.dropdowns),dropdown_root:l("relative rounded-(--cell-radius)",d.dropdown_root),dropdown:l("absolute inset-0 bg-popover opacity-0",d.dropdown),caption_label:l("font-medium select-none",r==="label"?"text-sm":"flex items-center gap-1 rounded-(--cell-radius) text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground",d.caption_label),weekdays:l("flex",d.weekdays),weekday:l("flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal text-muted-foreground select-none",d.weekday),week:l("mt-2 flex w-full",d.week),week_number_header:l("w-(--cell-size) select-none",d.week_number_header),week_number:l("text-[0.8rem] text-muted-foreground select-none",d.week_number),day:l("group/day relative aspect-square h-full w-full rounded-(--cell-radius) p-0 text-center select-none [&:last-child[data-selected=true]_button]:rounded-r-(--cell-radius)",s.showWeekNumber?"[&:nth-child(2)[data-selected=true]_button]:rounded-l-(--cell-radius)":"[&:first-child[data-selected=true]_button]:rounded-l-(--cell-radius)",d.day),range_start:l("relative isolate z-0 rounded-l-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:right-0 after:w-4 after:bg-muted",d.range_start),range_middle:l("rounded-none",d.range_middle),range_end:l("relative isolate z-0 rounded-r-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:left-0 after:w-4 after:bg-muted",d.range_end),today:l("rounded-(--cell-radius) bg-muted text-foreground data-[selected=true]:rounded-none",d.today),outside:l("text-muted-foreground aria-selected:text-muted-foreground",d.outside),disabled:l("text-muted-foreground opacity-50",d.disabled),hidden:l("invisible",d.hidden),...t},components:{Root:({className:m,rootRef:u,...p})=>Xs("div",{"data-slot":"calendar",ref:u,className:l(m),...p}),Chevron:({className:m,orientation:u,...p})=>u==="left"?Xs(et,{className:l("size-4",m),...p}):u==="right"?Xs(me,{className:l("size-4",m),...p}):Xs(re,{className:l("size-4",m),...p}),DayButton:({...m})=>Xs(ky,{...n!==void 0?{locale:n}:{},...m}),WeekNumber:({children:m,...u})=>Xs("td",{...u,children:Xs("div",{className:"flex size-(--cell-size) items-center justify-center text-center",children:m})}),...c},...s})}function ky({className:e,day:t,modifiers:a,locale:r,...o}){let n=Cy(),i=$g.useRef(null);return $g.useEffect(()=>{a.focused&&i.current?.focus()},[a.focused]),Xs(C,{variant:"ghost",size:"icon","data-day":t.date.toLocaleDateString(r?.code),"data-selected-single":a.selected&&!a.range_start&&!a.range_end&&!a.range_middle,"data-range-start":a.range_start,"data-range-end":a.range_end,"data-range-middle":a.range_middle,className:l("group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:bg-muted data-[range-middle=true]:text-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground dark:hover:text-foreground relative isolate z-10 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 border-0 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-(--cell-radius) data-[range-end=true]:rounded-r-(--cell-radius) data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-(--cell-radius) data-[range-start=true]:rounded-l-(--cell-radius) [&>span]:text-xs [&>span]:opacity-70",n.day,e),...o})}import"react";import{jsx as dd,jsxs as tB}from"react/jsx-runtime";function Y({className:e,size:t="default",flush:a,...r}){return dd("div",{"data-slot":"card","data-size":t,...a?{"data-flush":""}:{},className:l("group/card bg-card text-card-foreground ring-foreground/10 flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl py-(--card-spacing) text-sm ring-1 [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",e),...r})}function le({className:e,...t}){return dd("div",{"data-slot":"card-header",className:l("group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)",e),...t})}function ie({className:e,size:t,...a}){return dd("div",{"data-slot":"card-title",className:l("font-heading leading-snug font-medium",t==="sm"?"text-sm":"text-base group-data-[size=sm]/card:text-sm",e),...a})}function Ga({className:e,...t}){return dd("div",{"data-slot":"card-description",className:l("text-muted-foreground text-sm",e),...t})}function vx({className:e,...t}){return dd("div",{"data-slot":"card-action",className:l("col-start-2 row-span-2 row-start-1 self-start justify-self-end",e),...t})}function J({className:e,flush:t,...a}){return dd("div",{"data-slot":"card-content",className:l(t?"":"px-(--card-spacing)","group-data-[flush]/card:px-0",e),...a})}function ho({className:e,...t}){return dd("div",{"data-slot":"card-footer",className:l("bg-muted/50 flex items-center rounded-b-xl border-t p-(--card-spacing)",e),...t})}import{Checkbox as wy}from"@base-ui/react/checkbox";import{jsx as hx}from"react/jsx-runtime";function ja({className:e,...t}){return hx(wy.Root,{"data-slot":"checkbox",className:l("peer border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border transition-colors outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:ring-3 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3",e),...t,children:hx(wy.Indicator,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3.5",children:hx(U,{})})})}import{Collapsible as Py}from"@base-ui/react/collapsible";import{jsx as Ty}from"react/jsx-runtime";function yx({...e}){return Ty(Py.Root,{"data-slot":"collapsible",...e})}function Nx({...e}){return Ty(Py.Panel,{"data-slot":"collapsible-content",...e})}import"react";import{Popover as lu}from"@base-ui/react/popover";import{jsx as du}from"react/jsx-runtime";function He({...e}){return du(lu.Root,{"data-slot":"popover",...e})}function Ve({...e}){return du(lu.Trigger,{"data-slot":"popover-trigger",...e})}function Oe({className:e,align:t="center",alignOffset:a=0,side:r="bottom",sideOffset:o=4,...n}){return du(lu.Portal,{children:du(lu.Positioner,{align:t,alignOffset:a,side:r,sideOffset:o,className:"isolate z-50",children:du(lu.Popup,{"data-slot":"popover-content",className:l("bg-popover text-popover-foreground ring-foreground/10 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 z-50 flex w-72 origin-(--transform-origin) flex-col gap-2.5 rounded-lg p-2.5 text-sm shadow-md ring-1 outline-hidden duration-100",e),...n})})})}import"react";import{jsx as Mw}from"react/jsx-runtime";function St({className:e,...t}){return Mw("textarea",{"data-slot":"textarea",className:l("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 disabled:bg-input/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 flex field-sizing-content min-h-16 w-full rounded-lg border bg-transparent px-2.5 py-2 text-base transition-colors outline-none focus-visible:ring-3 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3 md:text-sm",e),...t})}import{ScrollArea as cu}from"@base-ui/react/scroll-area";import{jsx as mu,jsxs as Bw}from"react/jsx-runtime";function Wt({className:e,children:t,...a}){return Bw(cu.Root,{"data-slot":"scroll-area",className:l("relative",e),...a,children:[mu(cu.Viewport,{"data-slot":"scroll-area-viewport",className:"focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",children:t}),mu(Ry,{}),mu(cu.Corner,{})]})}function Ry({className:e,orientation:t="vertical",...a}){return mu(cu.Scrollbar,{"data-slot":"scroll-area-scrollbar","data-orientation":t,orientation:t,className:l("flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent",e),...a,children:mu(cu.Thumb,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}import"react";import{cva as Lw}from"class-variance-authority";import{jsx as zw}from"react/jsx-runtime";var Sy=Lw("inline-block rounded-full",{variants:{size:{sm:"size-1.5",default:"size-2",lg:"size-2.5"},variant:{default:"bg-foreground/40",primary:"bg-primary",success:"bg-success",warning:"bg-warning",destructive:"bg-destructive",info:"bg-info"},pulse:{true:"relative after:absolute after:inset-0 after:rounded-full after:bg-inherit after:animate-ping after:opacity-75",false:""}},defaultVariants:{size:"default",variant:"default",pulse:!1}});function Cx({className:e,size:t,variant:a,pulse:r,...o}){return zw("span",{"data-slot":"dot",className:l(Sy({size:t,variant:a,pulse:r}),e),...o})}import"react";import{Drawer as cd}from"vaul";import{jsx as Ys,jsxs as Iy}from"react/jsx-runtime";function kx({...e}){return Ys(cd.Root,{"data-slot":"drawer",...e})}function Dy({...e}){return Ys(cd.Portal,{"data-slot":"drawer-portal",...e})}function wx({...e}){return Ys(cd.Close,{"data-slot":"drawer-close",...e})}function My({className:e,...t}){return Ys(cd.Overlay,{"data-slot":"drawer-overlay",className:l("data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0 fixed inset-0 z-50 bg-black/10 supports-backdrop-filter:backdrop-blur-xs",e),...t})}function Px({className:e,children:t,...a}){return Iy(Dy,{"data-slot":"drawer-portal",children:[Ys(My,{}),Iy(cd.Content,{"data-slot":"drawer-content",className:l("group/drawer-content bg-popover text-popover-foreground fixed z-50 flex h-auto flex-col text-sm data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-xl data-[vaul-drawer-direction=bottom]:border-t data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:rounded-r-xl data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:rounded-l-xl data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-xl data-[vaul-drawer-direction=top]:border-b data-[vaul-drawer-direction=left]:sm:max-w-sm data-[vaul-drawer-direction=right]:sm:max-w-sm",e),...a,children:[Ys("div",{className:"bg-muted mx-auto mt-4 hidden h-1 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block"}),t]})]})}function Tx({className:e,...t}){return Ys("div",{"data-slot":"drawer-header",className:l("flex flex-col gap-0.5 p-4 group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center group-data-[vaul-drawer-direction=top]/drawer-content:text-center md:gap-0.5 md:text-left",e),...t})}function Rx({className:e,...t}){return Ys(cd.Title,{"data-slot":"drawer-title",className:l("font-heading text-foreground text-base font-medium",e),...t})}function Sx({className:e,...t}){return Ys(cd.Description,{"data-slot":"drawer-description",className:l("text-muted-foreground text-sm",e),...t})}import"react";import{Menu as Js}from"@base-ui/react/menu";import{jsx as Zs,jsxs as $B}from"react/jsx-runtime";function sr({...e}){return Zs(Js.Root,{"data-slot":"dropdown-menu",...e})}function ir({...e}){return Zs(Js.Trigger,{"data-slot":"dropdown-menu-trigger",...e})}function lr({align:e="start",alignOffset:t=0,side:a="bottom",sideOffset:r=4,className:o,...n}){return Zs(Js.Portal,{children:Zs(Js.Positioner,{className:"isolate z-50 outline-none",align:e,alignOffset:t,side:a,sideOffset:r,children:Zs(Js.Popup,{"data-slot":"dropdown-menu-content",className:l("bg-popover text-popover-foreground ring-foreground/10 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg p-1 shadow-md ring-1 duration-100 outline-none data-closed:overflow-hidden",o),...n})})})}function ns({...e}){return Zs(Js.Group,{"data-slot":"dropdown-menu-group",...e})}function nl({className:e,inset:t,...a}){return Zs(Js.GroupLabel,{"data-slot":"dropdown-menu-label","data-inset":t,className:l("text-muted-foreground px-1.5 py-1 text-xs font-medium data-inset:pl-7",e),...a})}function la({className:e,inset:t,variant:a="default",...r}){return Zs(Js.Item,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":a,className:l("group/dropdown-menu-item focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:*:[svg]:text-destructive relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-inset:pl-7 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r})}function ss({className:e,...t}){return Zs(Js.Separator,{"data-slot":"dropdown-menu-separator",className:l("bg-border -mx-1 my-1 h-px",e),...t})}import{useDropzone as Aw}from"react-dropzone";import{jsx as Hg,jsxs as Ix}from"react/jsx-runtime";function uu({onDrop:e,accept:t,maxFiles:a=5,maxSize:r,disabled:o,className:n}){let{getRootProps:i,getInputProps:c,isDragActive:s}=Aw({...e!==void 0?{onDrop:e}:{},...t!==void 0?{accept:t}:{},maxFiles:a,...r!==void 0?{maxSize:r}:{},...o!==void 0?{disabled:o}:{}});return Ix("div",{...i(),className:l("flex cursor-pointer flex-col items-center justify-center rounded-lg border-2 border-dashed p-8 text-center transition-colors",s?"border-primary bg-primary/5":"border-muted-foreground/25 hover:border-muted-foreground/50",o&&"cursor-not-allowed opacity-50",n),children:[Hg("input",{...c()}),Hg(os,{className:l("mb-2 size-8",s?"text-primary":"text-muted-foreground")}),s?Hg("p",{className:"text-primary text-sm font-medium",children:"Drop files here..."}):Ix("div",{className:"space-y-1",children:[Hg("p",{className:"text-sm font-medium",children:"Drag & drop files here, or click to select"}),Ix("p",{className:"text-muted-foreground text-xs",children:[a>1?`Up to ${a} files`:"Single file",r&&` (max ${Math.round(r/1024/1024)}MB each)`]})]})]})}import*as sl from"react";import{Slot as Fw}from"@radix-ui/react-slot";import{Controller as $w,FormProvider as Hw,useFormContext as Vw}from"react-hook-form";import"react";import{jsx as Ew}from"react/jsx-runtime";function ue({className:e,...t}){return Ew("label",{"data-slot":"label",className:l("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...t})}import{jsx as md,jsxs as Ow}from"react/jsx-runtime";var By=Hw,Ly=sl.createContext({});function zy({...e}){return md(Ly.Provider,{value:{name:e.name},children:md($w,{...e})})}var Ay=sl.createContext({});function Dx(){let e=sl.useContext(Ly),t=sl.useContext(Ay),{getFieldState:a,formState:r}=Vw(),o=a(e.name,r);if(!e.name)throw new Error("useFormField should be used within <FormField>");let{id:n}=t;return{id:n,name:e.name,formItemId:`${n}-form-item`,formDescriptionId:`${n}-form-item-description`,formMessageId:`${n}-form-item-message`,...o}}function Ey({className:e,...t}){let a=sl.useId();return md(Ay.Provider,{value:{id:a},children:md("div",{"data-slot":"form-item",className:l("group/form-item space-y-1.5",e),...t})})}function Fy({className:e,required:t,...a}){let{error:r,formItemId:o}=Dx();return Ow(ue,{"data-slot":"form-label","data-error":!!r,className:l(r&&"text-destructive",e),htmlFor:o,...a,children:[a.children,t&&md("span",{className:"text-destructive",children:"*"})]})}function $y({...e}){let{error:t,formItemId:a,formDescriptionId:r,formMessageId:o}=Dx();return md(Fw,{"data-slot":"form-control",id:a,"aria-describedby":t?`${r} ${o}`:r,"aria-invalid":!!t,...e})}function Hy({className:e,...t}){let{error:a,formMessageId:r}=Dx(),o=a?String(a?.message??""):t.children;return o?md("p",{"data-slot":"form-message",id:r,className:l("text-destructive text-xs font-medium",e),...t,children:o}):null}import{Switch as Vy}from"@base-ui/react/switch";import{jsx as Oy}from"react/jsx-runtime";function $n({className:e,size:t="default",...a}){return Oy(Vy.Root,{"data-slot":"switch","data-size":t,className:l("peer group/switch focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:ring-3 aria-invalid:ring-3 data-disabled:cursor-not-allowed data-disabled:opacity-50 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px]",e),...a,children:Oy(Vy.Thumb,{"data-slot":"switch-thumb",className:"bg-background dark:data-checked:bg-primary-foreground dark:data-unchecked:bg-foreground pointer-events-none block rounded-full ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0"})})}import"react";import{Select as yo}from"@base-ui/react/select";import{jsx as dr,jsxs as Mx}from"react/jsx-runtime";var Pe=yo.Root;function Te({className:e,...t}){return dr(yo.Value,{"data-slot":"select-value",className:l("flex flex-1 text-left",e),...t})}function Re({className:e,size:t="default",children:a,...r}){return Mx(yo.Trigger,{"data-slot":"select-trigger","data-size":t,className:l("border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 flex w-fit items-center justify-between gap-1.5 rounded-lg border bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:ring-3 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3 data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[a,dr(yo.Icon,{render:dr(re,{className:"text-muted-foreground pointer-events-none size-4"})})]})}function Se({className:e,children:t,side:a="bottom",sideOffset:r=4,align:o="center",alignOffset:n=0,alignItemWithTrigger:i=!0,...c}){return dr(yo.Portal,{children:dr(yo.Positioner,{side:a,sideOffset:r,align:o,alignOffset:n,alignItemWithTrigger:i,className:"isolate z-50",children:Mx(yo.Popup,{"data-slot":"select-content","data-align-trigger":i,className:l("bg-popover text-popover-foreground ring-foreground/10 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg shadow-md ring-1 duration-100 data-[align-trigger=true]:animate-none",e),...c,children:[dr(Uy,{}),dr(yo.List,{children:t}),dr(Wy,{})]})})})}function ve({className:e,children:t,...a}){return Mx(yo.Item,{"data-slot":"select-item",className:l("focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...a,children:[dr(yo.ItemText,{className:"flex flex-1 shrink-0 gap-2 whitespace-nowrap",children:t}),dr(yo.ItemIndicator,{render:dr("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:dr(U,{className:"pointer-events-none"})})]})}function Uy({className:e,...t}){return dr(yo.ScrollUpArrow,{"data-slot":"select-scroll-up-button",className:l("bg-popover top-0 z-10 flex w-full cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:dr(Zi,{})})}function Wy({className:e,...t}){return dr(yo.ScrollDownArrow,{"data-slot":"select-scroll-down-button",className:l("bg-popover bottom-0 z-10 flex w-full cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:dr(re,{})})}import"react";import{cva as Uw}from"class-variance-authority";import{jsx as qy}from"react/jsx-runtime";var _y=Uw("pointer-events-none inline-flex items-center justify-center gap-0.5 rounded-md border bg-muted font-mono font-medium text-muted-foreground shadow-xs select-none",{variants:{size:{sm:"h-5 min-w-5 px-1 text-[0.65rem]",default:"h-6 min-w-6 px-1.5 text-xs",lg:"h-7 min-w-7 px-2 text-sm"}},defaultVariants:{size:"default"}});function il({className:e,size:t,...a}){return qy("kbd",{"data-slot":"kbd",className:l(_y({size:t}),e),...a})}function Vg({className:e,...t}){return qy("div",{"data-slot":"kbd-group",className:l("inline-flex items-center gap-1",e),...t})}import"react";import{cva as Ww}from"class-variance-authority";import{jsx as Og,jsxs as Bx}from"react/jsx-runtime";var Gy=Ww("w-full",{variants:{size:{sm:"max-w-2xl",default:"max-w-5xl",lg:"max-w-7xl",full:"max-w-full",none:""},padding:{none:"p-0",sm:"p-4",default:"p-6",lg:"p-8"},center:{true:"mx-auto",false:""}},defaultVariants:{size:"default",padding:"default",center:!0}});function Lx({className:e,size:t,padding:a,center:r,children:o,...n}){return Og("div",{"data-slot":"page-container",className:l(Gy({size:t,padding:a,center:r,className:e})),...n,children:o})}function zx({className:e,title:t,description:a,actions:r,breadcrumb:o,...n}){return Bx("div",{"data-slot":"page-header",className:l("space-y-2",e),...n,children:[o,Bx("div",{className:"flex items-start justify-between gap-4",children:[Bx("div",{className:"space-y-1",children:[Og("h1",{className:"text-2xl font-bold tracking-tight",children:t}),a&&Og("p",{className:"text-muted-foreground",children:a})]}),r&&Og("div",{className:"flex items-center gap-2",children:r})]})]})}import{Progress as Ax}from"@base-ui/react/progress";import{jsx as Ug,jsxs as _w}from"react/jsx-runtime";function cr({className:e,children:t,value:a,...r}){return _w(Ax.Root,{value:a,"data-slot":"progress",className:l("flex flex-wrap gap-3",e),...r,children:[t,Ug(jy,{children:Ug(Lc,{})})]})}function jy({className:e,...t}){return Ug(Ax.Track,{className:l("bg-muted relative flex h-1 w-full items-center overflow-x-hidden rounded-full",e),"data-slot":"progress-track",...t})}function Lc({className:e,...t}){return Ug(Ax.Indicator,{"data-slot":"progress-indicator",className:l("bg-primary h-full transition-all",e),...t})}import{Radio as Ky}from"@base-ui/react/radio";import{RadioGroup as qw}from"@base-ui/react/radio-group";import{jsx as Wg}from"react/jsx-runtime";function Qy({className:e,...t}){return Wg(qw,{"data-slot":"radio-group",className:l("grid w-full gap-2",e),...t})}function Ex({className:e,...t}){return Wg(Ky.Root,{"data-slot":"radio-group-item",className:l("group/radio-group-item peer border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary relative flex aspect-square size-4 shrink-0 rounded-full border outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:ring-3 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3",e),...t,children:Wg(Ky.Indicator,{"data-slot":"radio-group-indicator",className:"flex size-4 items-center justify-center",children:Wg("span",{className:"bg-primary-foreground absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full"})})})}import{Separator as Gw}from"@base-ui/react/separator";import{jsx as jw}from"react/jsx-runtime";function Ue({className:e,orientation:t="horizontal",...a}){return jw(Gw,{"data-slot":"separator",orientation:t,className:l("bg-border shrink-0 data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",e),...a})}import"react";import{Dialog as ei}from"@base-ui/react/dialog";import{jsx as No,jsxs as Fx}from"react/jsx-runtime";function ud({...e}){return No(ei.Root,{"data-slot":"sheet",...e})}function $x({...e}){return No(ei.Trigger,{"data-slot":"sheet-trigger",...e})}function Hx({...e}){return No(ei.Close,{"data-slot":"sheet-close",...e})}function Kw({...e}){return No(ei.Portal,{"data-slot":"sheet-portal",...e})}function Qw({className:e,...t}){return No(ei.Backdrop,{"data-slot":"sheet-overlay",className:l("fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs",e),...t})}function pd({className:e,children:t,side:a="right",showCloseButton:r=!0,...o}){return Fx(Kw,{children:[No(Qw,{}),Fx(ei.Popup,{"data-slot":"sheet-content","data-side":a,className:l("bg-popover text-popover-foreground fixed z-50 flex flex-col gap-4 bg-clip-padding text-sm shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm",e),...o,children:[t,r&&Fx(ei.Close,{"data-slot":"sheet-close",render:No(C,{variant:"ghost",className:"absolute top-3 right-3",size:"icon-sm"}),children:[No(Q,{}),No("span",{className:"sr-only",children:"Close"})]})]})]})}function gd({className:e,...t}){return No("div",{"data-slot":"sheet-header",className:l("flex flex-col gap-0.5 p-4",e),...t})}function Vx({className:e,...t}){return No("div",{"data-slot":"sheet-footer",className:l("mt-auto flex flex-col gap-2 p-4",e),...t})}function fd({className:e,...t}){return No(ei.Title,{"data-slot":"sheet-title",className:l("font-heading text-foreground text-base font-medium",e),...t})}function pu({className:e,...t}){return No(ei.Description,{"data-slot":"sheet-description",className:l("text-muted-foreground text-sm",e),...t})}import{jsx as Xw}from"react/jsx-runtime";function ut({className:e,...t}){return Xw("div",{"data-slot":"skeleton",className:l("bg-muted animate-pulse rounded-md",e),...t})}import*as zc from"react";import{Fragment as Xy,jsx as is,jsxs as _g}from"react/jsx-runtime";function gu({className:e,activeStep:t=0,orientation:a="horizontal",children:r}){let o=zc.Children.toArray(r).filter(zc.isValidElement);return is("div",{"data-slot":"stepper",className:l(a==="horizontal"?"flex w-full items-center justify-center":"flex flex-col",e),children:o.map((n,i)=>{let c=i===o.length-1;return zc.cloneElement(n,{index:i,active:i===t,completed:i<t,last:c,orientation:a})})})}function ll({className:e,index:t=0,active:a,completed:r,last:o,orientation:n,children:i}){return is("div",{className:l("flex items-center",n==="horizontal"?o?"shrink-0":"min-w-0 flex-1":"flex-col items-start",e),children:n==="horizontal"?_g(Xy,{children:[_g("div",{className:"flex shrink-0 flex-col items-center gap-1",children:[is("div",{className:l("flex size-8 shrink-0 items-center justify-center rounded-full border-2 text-sm font-medium transition-colors",r&&"border-primary bg-primary text-primary-foreground",a&&"border-primary bg-primary/10 text-primary animate-pulse",!r&&!a&&"border-muted-foreground/30 text-muted-foreground"),children:r?is(U,{className:"size-4"}):t+1}),i&&is("span",{className:l("text-xs font-medium whitespace-nowrap",a?"text-primary":"text-muted-foreground"),children:i})]}),!o&&is("div",{className:l("mx-2 mt-4 h-0.5 min-w-4 flex-1 self-start",r?"bg-primary":"bg-muted-foreground/30")})]}):_g(Xy,{children:[_g("div",{className:"flex items-center gap-2",children:[is("div",{className:l("flex size-8 shrink-0 items-center justify-center rounded-full border-2 text-sm font-medium transition-colors",r&&"border-primary bg-primary text-primary-foreground",a&&"border-primary bg-primary/10 text-primary animate-pulse",!r&&!a&&"border-muted-foreground/30 text-muted-foreground"),children:r?is(U,{className:"size-4"}):t+1}),i&&is("span",{className:l("text-xs font-medium whitespace-nowrap",a?"text-primary":"text-muted-foreground"),children:i})]}),!o&&is("div",{className:l("ml-3.5 h-8 w-0.5",r?"bg-primary":"bg-muted-foreground/30")})]})})}import"react";import{jsx as ti}from"react/jsx-runtime";function ze({className:e,...t}){return ti("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:ti("table",{"data-slot":"table",className:l("w-full caption-bottom text-sm",e),...t})})}function Ae({className:e,...t}){return ti("thead",{"data-slot":"table-header",className:l("[&_tr]:border-b",e),...t})}function ke({className:e,...t}){return ti("tbody",{"data-slot":"table-body",className:l("[&_tr:last-child]:border-0",e),...t})}function ai({className:e,...t}){return ti("tfoot",{"data-slot":"table-footer",className:l("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",e),...t})}function W({className:e,...t}){return ti("tr",{"data-slot":"table-row",className:l("hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t})}function E({className:e,...t}){return ti("th",{"data-slot":"table-head",className:l("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0",e),...t})}function D({className:e,...t}){return ti("td",{"data-slot":"table-cell",className:l("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0",e),...t})}function Ox({className:e,...t}){return ti("caption",{"data-slot":"table-caption",className:l("text-muted-foreground mt-4 text-sm",e),...t})}import{Tabs as qg}from"@base-ui/react/tabs";import{cva as Yw}from"class-variance-authority";import{jsx as Gg}from"react/jsx-runtime";function Sr({className:e,orientation:t="horizontal",...a}){return Gg(qg.Root,{"data-slot":"tabs","data-orientation":t,className:l("group/tabs flex gap-2 data-horizontal:flex-col",e),...a})}var Yy=Yw("group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none",{variants:{variant:{default:"bg-muted",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function Ir({className:e,variant:t="default",...a}){return Gg(qg.List,{"data-slot":"tabs-list","data-variant":t,className:l(Yy({variant:t}),e),...a})}function Ba({className:e,...t}){return Gg(qg.Tab,{"data-slot":"tabs-trigger",className:l("text-foreground/60 hover:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:text-muted-foreground dark:hover:text-foreground relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent","data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground","after:bg-foreground after:absolute after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100",e),...t})}function Co({className:e,...t}){return Gg(qg.Panel,{"data-slot":"tabs-content",className:l("flex-1 text-sm outline-none",e),...t})}import"react";import{cva as Jw}from"class-variance-authority";import{jsx as ko,jsxs as Ux}from"react/jsx-runtime";function bd({className:e,...t}){return ko("div",{"data-slot":"timeline",className:l("flex flex-col",e),...t})}var Jy=Jw("flex size-8 shrink-0 items-center justify-center rounded-full border-2 bg-background",{variants:{variant:{default:"border-muted-foreground",success:"border-success text-success",warning:"border-warning text-warning",destructive:"border-destructive text-destructive",info:"border-info text-info"}},defaultVariants:{variant:"default"}});function xd({className:e,icon:t,title:a,description:r,time:o,status:n,variant:i,children:c,...s}){let d=i??(n==="completed"?"success":n==="current"?"info":"default");return Ux("div",{className:l("relative flex gap-4",e),...s,children:[Ux("div",{className:"flex flex-col items-center self-stretch",children:[ko(Ac,{variant:d,children:t?ko(t,{className:"size-4"}):null}),ko(Ec,{})]}),Ux(Fc,{className:"pb-8 last:pb-0",children:[a!==void 0?ko(Zy,{children:a}):null,r!==void 0?ko(e0,{children:r}):null,o!==void 0?ko(t0,{children:o}):null,c]})]})}function Ac({className:e,variant:t,children:a,...r}){return ko("div",{className:l(Jy({variant:t}),e),...r,children:a})}function Ec({className:e,...t}){return ko("div",{className:l("bg-border mx-auto w-px flex-1",e),...t})}function Fc({className:e,...t}){return ko("div",{className:l("flex-1 pt-1",e),...t})}function Zy({className:e,...t}){return ko("h3",{className:l("text-sm leading-none font-semibold",e),...t})}function e0({className:e,...t}){return ko("p",{className:l("text-muted-foreground mt-1 text-sm",e),...t})}function t0({className:e,...t}){return ko("time",{className:l("text-muted-foreground mt-1 text-xs",e),...t})}import{Toggle as dL}from"@base-ui/react/toggle";import{cva as Zw}from"class-variance-authority";import{jsx as uL}from"react/jsx-runtime";var a0=Zw("group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-muted"},size:{default:"h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",sm:"h-7 min-w-7 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2"}},defaultVariants:{variant:"default",size:"default"}});import*as jg from"react";import{Toggle as eP}from"@base-ui/react/toggle";import{ToggleGroup as tP}from"@base-ui/react/toggle-group";import"class-variance-authority";import{jsx as Wx}from"react/jsx-runtime";var r0=jg.createContext({size:"default",variant:"default",spacing:2,orientation:"horizontal"});function o0({className:e,variant:t,size:a,spacing:r=2,orientation:o="horizontal",children:n,...i}){return Wx(tP,{"data-slot":"toggle-group","data-variant":t,"data-size":a,"data-spacing":r,"data-orientation":o,style:{"--gap":r},className:l("group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-vertical:flex-col data-vertical:items-stretch data-[size=sm]:rounded-[min(var(--radius-md),10px)]",e),...i,children:Wx(r0.Provider,{value:{variant:t,size:a,spacing:r,orientation:o},children:n})})}function n0({className:e,children:t,variant:a="default",size:r="default",...o}){let n=jg.useContext(r0);return Wx(eP,{"data-slot":"toggle-group-item","data-variant":n.variant||a,"data-size":n.size||r,"data-spacing":n.spacing,className:l("shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t",a0({variant:n.variant||a,size:n.size||r}),e),...o,children:t})}import"react";import{jsx as $c,jsxs as i0}from"react/jsx-runtime";var s0={xs:"size-3",sm:"size-4",md:"size-5",lg:"size-7",xl:"size-9"},aP={xs:"border",sm:"border-2",md:"border-2",lg:"border-[3px]",xl:"border-4"},_x={primary:"text-primary",secondary:"text-secondary-foreground",muted:"text-muted-foreground",destructive:"text-destructive",current:"text-current"};function l0({className:e,size:t="md",variant:a="circle",color:r="primary",label:o="Loading",...n}){return a==="dots"?i0("span",{role:"status","aria-label":o,"data-slot":"spinner","data-variant":"dots",className:l("inline-flex items-center gap-1",_x[r],e),...n,children:[[0,1,2].map(i=>$c("span",{className:l("animate-bounce rounded-full bg-current",s0[t]),style:{animationDelay:`${i*150}ms`,animationDuration:"1s"}},i)),$c("span",{className:"sr-only",children:o})]}):a==="bars"?i0("span",{role:"status","aria-label":o,"data-slot":"spinner","data-variant":"bars",className:l("inline-flex items-end gap-0.5",_x[r],e),...n,children:[[0,1,2,3].map(i=>$c("span",{className:"animate-pulse bg-current",style:{width:"3px",height:"100%",animationDelay:`${i*100}ms`,animationDuration:"1s"}},i)),$c("span",{className:"sr-only",children:o})]}):$c("span",{role:"status","aria-label":o,"data-slot":"spinner","data-variant":"circle",className:l("inline-block animate-spin rounded-full border-current border-t-transparent",s0[t],aP[t],_x[r],e),...n,children:$c("span",{className:"sr-only",children:o})})}import*as bu from"react";import{ChevronUp as rP,ChevronDown as oP}from"lucide-react";import{jsx as fu,jsxs as d0}from"react/jsx-runtime";function ri({className:e,value:t,defaultValue:a=null,min:r=-1/0,max:o=1/0,step:n=1,precision:i,controls:c=!0,disabled:s=!1,readOnly:d=!1,size:m="default",onChange:u,parser:p,formatter:f,nullAsUndefined:x=!1,...v}){let[N,h]=bu.useState(a),[b,g]=bu.useState(""),y=t!==void 0,k=y?t:N;bu.useEffect(()=>{k==null?g(""):g(f?f(k):String(k))},[k,f]);let w=I=>Math.min(Math.max(I,r),o),R=I=>{if(i!==void 0){let A=Math.pow(10,i);return Math.round(I*A)/A}return I},S=I=>{if(I===null||isNaN(I)){y||h(null),u?.(x?void 0:null);return}let A=R(w(I));y||h(A),u?.(A)},z=I=>{let A=I.target.value;if(g(A),A===""){S(null);return}let O=p?p(A):parseFloat(A);isNaN(O)||S(O)},L=I=>{if(s||d)return;let A=Number.isFinite(r)?r:0,O=k??A,G=I==="up"?O+n:O-n;S(G)},H=I=>{s||d||(I.key==="ArrowUp"?(I.preventDefault(),L("up")):I.key==="ArrowDown"&&(I.preventDefault(),L("down")),v.onKeyDown?.(I))},M=I=>{b!==""&&k!==null&&g(f?f(k):String(k)),v.onBlur?.(I)},$=m==="sm"?"h-7 text-sm":m==="lg"?"h-9 text-base":"h-8 text-sm";return d0("div",{"data-slot":"input-number",className:l("relative inline-flex w-full items-center",s&&"opacity-50",e),children:[fu("input",{type:"text",inputMode:"decimal",disabled:s,readOnly:d,value:b,onChange:z,onKeyDown:H,onBlur:M,className:l("w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-right transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 dark:bg-input/30 dark:disabled:bg-input/80",$,c&&"pr-7"),...v}),c&&!d&&d0("div",{className:"absolute right-0 top-0 flex h-full flex-col",children:[fu("button",{type:"button",tabIndex:-1,disabled:s||k!==null&&k>=o,onClick:()=>L("up"),className:"flex flex-1 items-center justify-center px-1.5 text-muted-foreground hover:text-foreground disabled:opacity-30","aria-label":"Increase",children:fu(rP,{className:"size-3"})}),fu("button",{type:"button",tabIndex:-1,disabled:s||k!==null&&k<=r,onClick:()=>L("down"),className:"flex flex-1 items-center justify-center px-1.5 text-muted-foreground hover:text-foreground disabled:opacity-30","aria-label":"Decrease",children:fu(oP,{className:"size-3"})})]})]})}import*as Gx from"react";import{jsx as qx,jsxs as sP}from"react/jsx-runtime";var nP={sm:"size-3.5",default:"size-5",lg:"size-7"};function ML({value:e,defaultValue:t,onChange:a,max:r=5,size:o="default",readonly:n,allowHalf:i,className:c,iconClassName:s,...d}){let[m,u]=Gx.useState(t??0),p=e!==void 0,f=p?e:m,[x,v]=Gx.useState(null),N=x??f,h=b=>{n||(p||u(b),a?.(b))};return qx("div",{"data-slot":"rating",role:"radiogroup","aria-label":"\u8BC4\u5206",className:l("inline-flex items-center gap-0.5",c),onMouseLeave:()=>v(null),...d,children:Array.from({length:r}).map((b,g)=>{let y=g+1,k=N>=y,w=i&&!k&&N>=y-.5;return sP("button",{type:"button",role:"radio","aria-checked":f===y,"aria-label":`${y} \u661F`,disabled:n,onMouseEnter:()=>!n&&v(y),onClick:()=>h(y),className:l("relative transition-transform",!n&&"cursor-pointer hover:scale-110",n&&"cursor-default"),children:[i&&qx("span",{className:"absolute inset-y-0 left-0 w-1/2",onClick:R=>{R.stopPropagation(),h(y-.5)}}),qx(Tc,{className:l(nP[o],"transition-colors",k||w?"fill-yellow-400 text-yellow-400":"text-muted-foreground/40 fill-transparent",s)})]},g)})})}import"react";import{useTranslation as iP}from"react-i18next";import{jsx as xu,jsxs as lP}from"react/jsx-runtime";var c0={default:{icon:Wh},search:{icon:X},error:{icon:jt},network:{icon:Jh}},m0={default:{title:"No data",description:"There are no items to display."},search:{title:"No results",description:"Try adjusting your search or filter criteria."},error:{title:"Something went wrong",description:"An error occurred while loading data."},network:{title:"No connection",description:"Check your internet connection and try again."}};function Hc({variant:e="default",icon:t,title:a,description:r,action:o,className:n,centered:i,fullPage:c,texts:s}){let d=!s,{t:m}=iP("data"),u=c0[e]??c0.default,p=t??u.icon,f=m0[e]??m0.default??{title:"",description:""},x=a??s?.title??(d?m(`emptyState.${e}.title`,f.title):f.title),v=r??s?.description??(d?m(`emptyState.${e}.description`,f.description):f.description);return lP("div",{"data-slot":"empty-state",className:l("flex flex-col items-center justify-center py-12 text-center",i&&"min-h-[400px] items-center justify-center",c&&"min-h-svh",n),children:[xu("div",{className:"bg-muted flex size-12 items-center justify-center rounded-full",children:xu(p,{className:"text-muted-foreground size-6"})}),xu("h3",{className:"mt-4 text-lg font-semibold",children:x}),xu("p",{className:"text-muted-foreground mt-1 max-w-sm text-sm",children:v}),o&&xu("div",{className:"mt-4",children:o})]})}import"react";import{jsx as mP,jsxs as cP}from"react/jsx-runtime";var dP={sm:"h-7 px-2 text-xs",default:"h-8 px-3 text-sm",lg:"h-9 px-4 text-sm"};function Kg({options:e,value:t,defaultValue:a,onChange:r,size:o="default",disabled:n,className:i,orientation:c="horizontal"}){return mP(o0,{"data-slot":"segmented-control",value:t?[t]:a?[a]:[],onValueChange:s=>{s.length>0&&r?.(s[s.length-1])},orientation:c,className:l("bg-muted/30 inline-flex items-center rounded-md border p-0.5",c==="vertical"&&"flex-col items-stretch",i),children:e.map(s=>cP(n0,{value:s.value,disabled:n||s.disabled,className:l("data-[pressed]:bg-background rounded-sm border-0 bg-transparent shadow-none transition-all data-[pressed]:shadow-xs",dP[o]),children:[s.icon,s.label]},s.value))})}import*as dl from"react";import{useTranslation as uP}from"react-i18next";import{Fragment as pP,jsx as Hn,jsxs as oi}from"react/jsx-runtime";function XL({steps:e,open:t,onOpenChange:a,onComplete:r,onSkip:o,storageKey:n,className:i}){let{t:c}=uP("tour"),[s,d]=dl.useState(()=>{if(typeof window>"u"||!n)return!0;try{return localStorage.getItem(n)!=="1"}catch{return!0}}),[m,u]=dl.useState(0),[p,f]=dl.useState(null),x=t??s,v=dl.useCallback(w=>{t===void 0&&d(w),a?.(w)},[t,a]);dl.useEffect(()=>{if(!x)return;let w=e[m];if(!w)return;let R=typeof w.target=="function"?w.target():document.querySelector(w.target);if(!R)return;R.scrollIntoView({behavior:"smooth",block:"center"});let S=()=>f(R.getBoundingClientRect());S();let z=new ResizeObserver(S);return z.observe(R),window.addEventListener("scroll",S,!0),window.addEventListener("resize",S),()=>{z.disconnect(),window.removeEventListener("scroll",S,!0),window.removeEventListener("resize",S)}},[x,m,e]);let N=w=>{w?o?.():r?.(),n&&localStorage.setItem(n,"1"),v(!1),u(0)};if(!x||!p)return null;let h=e[m]??{target:"",title:""},b=h.placement??"bottom",g=h.offset??8,y=Math.min(320,window.innerWidth-16),k=(()=>{let w={position:"fixed",zIndex:9999};return b==="bottom"?(w.top=p.bottom+g,w.left=p.left+p.width/2-y/2):b==="top"?(w.top=p.top-g-200,w.left=p.left+p.width/2-y/2):b==="right"?(w.top=p.top+p.height/2-100,w.left=p.right+g):(w.top=p.top+p.height/2-100,w.left=p.left-g-y),Object.assign(w,{left:Math.max(8,Math.min(w.left,window.innerWidth-y-8)),top:Math.max(8,Math.min(w.top,window.innerHeight-220)),width:y}),w})();return oi(pP,{children:[Hn("div",{"aria-hidden":!0,className:"fixed inset-0 z-[9998] bg-black/40 transition-opacity",onClick:()=>N(!0)}),Hn("div",{"aria-hidden":!0,className:"ring-primary/60 fixed z-[9999] rounded-md ring-4 transition-all",style:{top:p.top-4,left:p.left-4,width:p.width+8,height:p.height+8}}),oi(Y,{"data-slot":"tour",className:l("shadow-xl",i),style:k,children:[Hn(le,{className:"pb-2",children:oi("div",{className:"flex items-start justify-between gap-2",children:[oi("div",{children:[oi(Ga,{children:[m+1," / ",e.length]}),Hn(ie,{className:"text-base",children:h.title})]}),Hn(C,{variant:"ghost",size:"icon-xs",onClick:()=>N(!0),"aria-label":c("tour.close"),children:Hn(Q,{})})]})}),h.description&&Hn(J,{className:"text-muted-foreground text-sm",children:h.description}),oi(ho,{className:"flex flex-wrap items-center justify-between gap-2",children:[Hn(C,{variant:"ghost",size:"sm",onClick:()=>N(!0),children:c("tour.skip")}),oi("div",{className:"flex flex-wrap items-center justify-end gap-1",children:[oi(C,{variant:"outline",size:"sm",disabled:m===0,onClick:()=>u(w=>Math.max(0,w-1)),children:[Hn(et,{}),c("tour.previous")]}),m<e.length-1?oi(C,{size:"sm",onClick:()=>u(w=>w+1),children:[c("tour.next"),Hn(me,{})]}):Hn(C,{size:"sm",onClick:()=>N(!1),children:c("tour.complete")})]})]})]})]})}import*as Qg from"react";import{useTranslation as gP}from"react-i18next";import{jsx as cl}from"react/jsx-runtime";function tz({text:e,image:t,rotate:a=-22,gap:r=[120,100],fontSize:o=14,className:n,fullPage:i=!0,zIndex:c=1e3,opacity:s=.08,color:d="#000"}){let{t:m}=gP("data"),u=e??m("watermark.default"),[p,f]=Qg.useState([]),[x,v]=r;return Qg.useEffect(()=>{if(!i)return;let N=()=>{let h=Math.ceil(window.innerWidth/x)+1,b=Math.ceil(window.innerHeight/v)+1,g=[];for(let y=0;y<b;y++)for(let k=0;k<h;k++)g.push({x:k*x,y:y*v});f(g)};return N(),window.addEventListener("resize",N),()=>window.removeEventListener("resize",N)},[i,x,v]),i?cl("div",{"data-slot":"watermark","aria-hidden":!0,className:l("pointer-events-none fixed inset-0 overflow-hidden",n),style:{zIndex:c},children:p.map((N,h)=>cl("div",{className:"absolute",style:{left:N.x,top:N.y,width:x,height:v,transform:`rotate(${a}deg)`,display:"flex",alignItems:"center",justifyContent:"center"},children:t?cl("img",{src:t,alt:"",style:{opacity:s,maxHeight:"60%"}}):cl("span",{className:"font-medium whitespace-nowrap select-none",style:{color:d,fontSize:o,opacity:s},children:u})},h))}):cl("div",{"data-slot":"watermark","aria-hidden":!0,className:l("pointer-events-none absolute inset-0 overflow-hidden",n),style:{zIndex:c},children:cl("div",{className:"absolute inset-0 grid place-items-center",style:{transform:`rotate(${a}deg)`},children:t?cl("img",{src:t,alt:"",style:{opacity:s,maxWidth:"60%"}}):cl("span",{className:"font-medium whitespace-nowrap select-none",style:{color:d,fontSize:o,opacity:s},children:u})})})}import*as ls from"react";import{useTranslation as fP}from"react-i18next";import{Fragment as xP,jsx as wo,jsxs as ml}from"react/jsx-runtime";function cz({options:e,value:t,onChange:a,placeholder:r,searchPlaceholder:o,emptyText:n,disabled:i,className:c,align:s="start",clearable:d=!0,searchable:m=!0,renderOption:u}){let{t:p}=fP("ui"),[f,x]=ls.useState(!1),v=r??p("combobox.placeholder"),N=o??p("combobox.searchPlaceholder"),h=n??p("combobox.emptyText"),b=e.find(g=>g.value===t);return ml(He,{open:f,onOpenChange:x,"data-slot":"combobox",children:[ml(Ve,{render:wo(C,{variant:"outline",role:"combobox",disabled:i,"aria-expanded":f,className:l("w-[200px] justify-between font-normal",!b&&"text-muted-foreground",c)}),children:[wo("span",{className:"truncate",children:b?.label??v}),ml("div",{className:"flex items-center gap-1",children:[d&&b&&wo("span",{role:"button","aria-label":p("combobox.clear"),onClick:g=>{g.stopPropagation(),a?.(void 0)},className:"hover:bg-muted rounded p-0.5",children:wo(Q,{className:"size-3.5 opacity-60 hover:opacity-100"})}),wo(re,{className:"size-4 opacity-50"})]})]}),f&&wo(Oe,{align:s,className:"w-[var(--anchor-width)] p-0",children:wo(bP,{options:e,value:t,onChange:a,onClose:()=>x(!1),searchPlaceholder:N,searchable:m,emptyText:h,...u?{renderOption:u}:{}})})]})}function bP({options:e,value:t,onChange:a,onClose:r,searchPlaceholder:o,searchable:n,emptyText:i,renderOption:c}){let[s,d]=ls.useState(""),m=ls.useRef(null);ls.useEffect(()=>{m.current?.focus()},[]);let u=ls.useMemo(()=>{if(!s)return e;let f=s.toLowerCase();return e.filter(x=>x.label.toLowerCase().includes(f)||x.value.toLowerCase().includes(f)||x.description?.toLowerCase().includes(f)||x.keywords?.some(v=>v.toLowerCase().includes(f)))},[e,s]),p=ls.useMemo(()=>{let f=new Map;for(let x of u){let v=x.group??"",N=f.get(v)??[];N.push(x),f.set(v,N)}return Array.from(f.entries())},[u]);return ml(xP,{children:[n&&ml("div",{className:"flex items-center gap-2 border-b px-3 py-2",children:[wo(X,{className:"size-4 shrink-0 opacity-50"}),wo(T,{ref:m,value:s,onChange:f=>d(f.target.value),placeholder:o,className:"h-7 border-0 bg-transparent p-0 shadow-none focus-visible:ring-0"})]}),ml("div",{className:"max-h-64 overflow-y-auto p-1",children:[p.length===0&&wo("div",{className:"text-muted-foreground px-2 py-6 text-center text-sm",children:i}),p.map(([f,x])=>ml("div",{children:[f&&wo("div",{className:"text-muted-foreground px-2 py-1 text-xs font-medium",children:f}),x.map(v=>{let N=v.value===t;return ml(C,{variant:"ghost",size:"sm",...v.disabled!==void 0?{disabled:v.disabled}:{},onClick:()=>{a?.(v.value),r()},className:l("h-auto w-full justify-start gap-2 rounded-sm px-2 py-1.5 font-normal",N&&"bg-accent/50",v.disabled&&"pointer-events-none opacity-50"),children:[wo("span",{className:"flex-1 truncate",children:c?c(v):v.label}),N&&wo(U,{className:"size-4 shrink-0"})]},v.value)})]},f||"_default"))]})]})}import*as vu from"react";import{useTranslation as u0}from"react-i18next";import{jsx as vd,jsxs as jx}from"react/jsx-runtime";var vP={"bottom-right":"right-4","bottom-left":"left-4","bottom-center":"left-1/2 -translate-x-1/2"};function xz({icon:e,label:t,position:a="bottom-right",offset:r=4,className:o,...n}){return jx(C,{"data-slot":"fab",size:t?"default":"icon-lg",className:l("fixed bottom-4 z-40 rounded-full shadow-lg",vP[a],o),style:{bottom:`calc(${r} * 0.25rem + 1rem)`},...n,children:[e,t&&vd("span",{children:t})]})}function vz({icon:e,actions:t,position:a="bottom-right"}){let{t:r}=u0("navigation"),[o,n]=vu.useState(!1);return jx("div",{"data-slot":"fab-speed-dial",className:l("fixed bottom-4 z-40 flex flex-col-reverse items-end gap-2",a==="bottom-right"?"right-4":"left-4"),children:[o&&vd("div",{className:"flex flex-col-reverse items-end gap-2",children:t.map((i,c)=>jx("div",{className:"flex items-center gap-2",children:[vd("span",{className:"bg-foreground/90 text-background rounded-md px-2 py-1 text-xs shadow-md",children:i.label}),vd(C,{size:"icon",variant:"secondary",onClick:()=>{i.onClick?.(),n(!1)},className:"rounded-full shadow-md",children:i.icon})]},c))}),vd(C,{size:"icon-lg",onClick:()=>n(i=>!i),className:"rounded-full shadow-lg","aria-expanded":o,"aria-label":r(o?"fab.speedDialClose":"fab.speedDialOpen"),children:e})]})}function hz({threshold:e=400,target:t,className:a}){let{t:r}=u0("navigation"),[o,n]=vu.useState(!1);vu.useEffect(()=>{let c=t?.current??window,s=()=>{let d=t?.current?t.current.scrollTop:window.scrollY;n(d>e)};return c.addEventListener("scroll",s),s(),()=>c.removeEventListener("scroll",s)},[t,e]);let i=()=>{t?.current?t.current.scrollTo({top:0,behavior:"smooth"}):window.scrollTo({top:0,behavior:"smooth"})};return o?vd(C,{"data-slot":"back-top",variant:"secondary",size:"icon",onClick:i,className:l("fixed right-4 bottom-4 z-30 rounded-full shadow-md",a),"aria-label":r("fab.backTop"),children:vd(Zi,{})}):null}import*as ul from"react";import{useTranslation as g0}from"react-i18next";import{Fragment as yP,jsx as La,jsxs as ds}from"react/jsx-runtime";var hP=(e,t)=>t.label.toLowerCase().includes(e.toLowerCase());function Kx({dataSource:e,targetKeys:t=[],onChange:a,titles:r,searchable:o=!0,filterOption:n=hP,render:i,disabled:c,className:s,oneWay:d=!1}){let{t:m}=g0("transfer"),u=r??[m("transfer.sourceTitle"),m("transfer.targetTitle")],[p,f]=ul.useState([]),[x,v]=ul.useState([]),[N,h]=ul.useState(""),[b,g]=ul.useState(""),y=ul.useMemo(()=>e.filter(O=>!t.includes(O.key)),[e,t]),k=ul.useMemo(()=>e.filter(O=>t.includes(O.key)),[e,t]),w=y.filter(O=>n(N,O)),R=k.filter(O=>n(b,O)),S=()=>{if(c)return;let O=Array.from(new Set([...t,...p]));a?.(O),f([])},z=()=>{if(c)return;let O=t.filter(G=>!x.includes(G));a?.(O),v([])},L=O=>{c||(a?.(Array.from(new Set([...t,O]))),f(G=>G.filter(Ce=>Ce!==O)))},H=O=>{c||d||(a?.(t.filter(G=>G!==O)),v(G=>G.filter(Ce=>Ce!==O)))},M=O=>{f(G=>G.includes(O)?G.filter(Ce=>Ce!==O):[...G,O])},$=O=>{f(O?w.map(G=>G.key):[])},I=O=>{v(G=>G.includes(O)?G.filter(Ce=>Ce!==O):[...G,O])},A=O=>{v(O?R.map(G=>G.key):[])};return ds("div",{"data-slot":"transfer",className:l("flex min-w-0 flex-col gap-2 sm:flex-row sm:items-stretch",c&&"opacity-50",s),children:[La(p0,{title:u[0],items:w,selected:p,onToggle:M,onToggleAll:$,searchable:o,searchValue:N,onSearchChange:h,...i?{render:i}:{},...c!==void 0?{disabled:c}:{},onMoveItem:L}),ds("div",{className:"flex flex-row items-center justify-center gap-2 sm:flex-col",children:[La(C,{variant:"outline",size:"icon",onClick:S,disabled:p.length===0||c,"aria-label":m("transfer.moveToTarget"),children:La(me,{className:"rotate-90 sm:rotate-0"})}),!d&&La(C,{variant:"outline",size:"icon",onClick:z,disabled:x.length===0||c,"aria-label":m("transfer.moveToSource"),children:La(et,{className:"rotate-90 sm:rotate-0"})})]}),La(p0,{title:u[1],items:R,selected:x,onToggle:I,onToggleAll:A,searchable:o,searchValue:b,onSearchChange:g,...i?{render:i}:{},...c!==void 0?{disabled:c}:{},...d?{}:{onMoveItem:H}})]})}function p0({title:e,items:t,selected:a,onToggle:r,onToggleAll:o,searchable:n,searchValue:i,onSearchChange:c,render:s,disabled:d,onMoveItem:m}){let{t:u}=g0("transfer"),p=t.length>0&&t.every(v=>a.includes(v.key)),f=t.some(v=>a.includes(v.key)),x=v=>{d||v.disabled||m?.(v.key)};return ds("div",{className:"flex h-72 w-full min-w-0 flex-col rounded-md border",children:[ds("div",{className:"flex items-center justify-between border-b px-3 py-2 text-sm font-medium",children:[La("span",{children:e}),ds("span",{className:"text-muted-foreground text-xs",children:[a.length,"/",t.length]})]}),n&&ds("div",{className:"flex items-center gap-2 border-b px-3 py-2",children:[La(X,{className:"size-4 shrink-0 opacity-50"}),La(T,{value:i,onChange:v=>c(v.target.value),placeholder:u("transfer.search"),className:"h-7 border-0 bg-transparent p-0 shadow-none focus-visible:ring-0"})]}),ds("div",{className:"flex items-center border-b px-3 py-1.5",children:[ds(C,{variant:"ghost",size:"icon-xs","aria-label":u("transfer.selectAll"),...d!==void 0?{disabled:d||t.length===0}:{disabled:t.length===0},className:l("size-4 rounded-[4px] border p-0",p?"border-primary bg-primary text-primary-foreground hover:bg-primary/80":f?"border-primary bg-primary/50 text-primary-foreground hover:bg-primary/50":"border-input"),onClick:()=>o?.(!p),children:[p&&La(U,{className:"size-3"}),!p&&f&&La("span",{className:"bg-primary-foreground block h-0.5 w-2"})]}),La("span",{className:"text-muted-foreground ml-2 text-xs",children:u("transfer.selectAll")})]}),La("div",{className:"flex-1 overflow-y-auto p-1",children:t.length===0?La("div",{className:"text-muted-foreground px-2 py-6 text-center text-sm",children:u("transfer.noData")}):t.map(v=>ds("label",{onDoubleClick:()=>x(v),className:l("flex cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm","hover:bg-accent",v.disabled&&"pointer-events-none opacity-50"),children:[La(ja,{checked:a.includes(v.key),onCheckedChange:()=>r(v.key),disabled:v.disabled||d}),La("div",{className:"min-w-0 flex-1 truncate",children:s?s(v):ds(yP,{children:[La("div",{className:"truncate",children:v.label}),v.description&&La("div",{className:"text-muted-foreground truncate text-xs",children:v.description})]})})]},v.key))})]})}import*as Qx from"react";var NP="zh-CN";function pl(){return NP}function tt(e,t={dateStyle:"medium"},a=pl()){let r=e instanceof Date?e:new Date(e);return Number.isNaN(r.getTime())?"-":new Intl.DateTimeFormat(a,t).format(r)}function hu(e,t={timeStyle:"short"},a=pl()){let r=e instanceof Date?e:new Date(e);return Number.isNaN(r.getTime())?"-":new Intl.DateTimeFormat(a,t).format(r)}function ni(e,t=pl()){return tt(e,{dateStyle:"medium",timeStyle:"short"},t)}function gl(e,t=pl()){let a=e instanceof Date?e:new Date(e);if(Number.isNaN(a.getTime()))return"-";let r=(a.getTime()-Date.now())/1e3,o=Math.abs(r),n=new Intl.RelativeTimeFormat(t,{numeric:"auto"}),i=[[60,"second"],[3600,"minute"],[86400,"hour"],[2592e3,"day"],[31536e3,"month"],[1/0,"year"]],c="second",s=1;for(let[d,m]of i)if(o<d){c=m,s=c==="second"?1:c==="minute"?60:c==="hour"?3600:c==="day"?86400:c==="month"?2592e3:31536e3;break}return n.format(Math.round(r/s),c)}function q(e,t={},a=pl()){return new Intl.NumberFormat(a,t).format(e)}function Xg(e,t=pl()){return new Intl.NumberFormat(t,{notation:"compact",maximumFractionDigits:1}).format(e)}function bt(e,t=1,a=pl()){return new Intl.NumberFormat(a,{style:"percent",minimumFractionDigits:t,maximumFractionDigits:t}).format(e)}function Ne(e,t="CNY",a=pl()){return new Intl.NumberFormat(a,{style:"currency",currency:t}).format(e)}var f0=["B","KB","MB","GB","TB","PB"];function Yg(e,t=1){if(!Number.isFinite(e)||e<0)return"-";if(e===0)return"0 B";let a=Math.min(Math.floor(Math.log(e)/Math.log(1024)),f0.length-1);return`${(e/Math.pow(1024,a)).toFixed(a===0?0:t)} ${f0[a]}`}function b0(e,t=50,a="\u2026"){return e.length<=t?e:e.slice(0,t-a.length)+a}function sn(e){return e?e.trim().split(/\s+/).slice(0,2).map(a=>a[0]?.toUpperCase()??"").join(""):"?"}import{jsx as Jr,jsxs as yu}from"react/jsx-runtime";function Nu(e){return e.toString().padStart(2,"0")}function x0(e,t){let a=e>=12?"PM":"AM";return`${e%12||12}:${Nu(t)} ${a}`}function CP(e){let t=/^(\d{1,2}):(\d{2})$/.exec(e);if(t){let r=Number(t[1]??"0"),o=Number(t[2]??"0");if(r>=0&&r<24&&o>=0&&o<60)return{h:r,m:o}}let a=/^(\d{1,2}):(\d{2})\s*(AM|PM)$/i.exec(e);if(a){let r=Number(a[1]??"0"),o=Number(a[2]??"0"),n=(a[3]??"AM").toUpperCase();if(n==="PM"&&r<12&&(r+=12),n==="AM"&&r===12&&(r=0),r>=0&&r<24&&o>=0&&o<60)return{h:r,m:o}}return null}function kP({value:e,onChange:t,step:a=1,format:r="24h",disabled:o,placeholder:n="\u9009\u62E9\u65F6\u95F4",className:i}){let c=e?CP(e):null,s=Qx.useMemo(()=>{let u=[],p=r==="12h"?12:24;for(let f=r==="12h"?1:0;f<p;f++)u.push(f);return u},[r]),d=Qx.useMemo(()=>{let u=[];for(let p=0;p<60;p+=a)u.push(p);return u},[a]),m=(u,p)=>{let f=r==="12h"?x0(u,p):`${Nu(u)}:${Nu(p)}`;t?.(f)};return Jr("div",{"data-slot":"time-picker",children:yu(He,{children:[yu(Ve,{render:Jr(C,{variant:"outline",disabled:o,className:l("w-[160px] justify-start text-left font-normal",!e&&"text-muted-foreground",i)}),children:[Jr(pe,{}),e??Jr("span",{children:n})]}),Jr(Oe,{className:"w-auto p-3",align:"start",children:yu("div",{className:"flex items-center gap-2",children:[yu(Pe,{value:c?String(c.h):void 0,onValueChange:u=>{let p=c?.m??0;m(Number(u),p)},children:[Jr(Re,{className:"w-[88px]","aria-label":"\u5C0F\u65F6",children:Jr(Te,{placeholder:"\u65F6"})}),Jr(Se,{className:"max-h-64",children:s.map(u=>Jr(ve,{value:String(u),children:r==="12h"?u===12?12:u:Nu(u)},u))})]}),Jr("span",{children:":"}),yu(Pe,{value:c?String(c.m):void 0,onValueChange:u=>{let p=c?.h??0;m(p,Number(u))},children:[Jr(Re,{className:"w-[88px]","aria-label":"\u5206\u949F",children:Jr(Te,{placeholder:"\u5206"})}),Jr(Se,{className:"max-h-64",children:d.map(u=>Jr(ve,{value:String(u),children:Nu(u)},u))})]})]})})]})})}function wP(e,t,a="24h"){return a==="12h"?x0(e,t):hu(new Date(2e3,0,1,e,t),{timeStyle:"short"})}import{jsx as Vn,jsxs as Cu}from"react/jsx-runtime";function G4({items:e=[],onLoadMore:t,hasMore:a,className:r}){let o=v0.useMemo(()=>{let i=new Date,c=new Date(i);c.setDate(c.getDate()-1);let s=i.toDateString(),d=c.toDateString(),m={today:[],yesterday:[],earlier:[]};return e.forEach(u=>{let p=new Date(u.time);p.toDateString()===s?(m.today??[]).push(u):p.toDateString()===d?(m.yesterday??[]).push(u):(m.earlier??[]).push(u)}),m},[e]),n=(i,c)=>c.length===0?null:Cu("div",{className:"mb-6",children:[Vn("h4",{className:"text-muted-foreground mb-3 text-xs font-semibold tracking-wider uppercase",children:i}),Vn(bd,{children:c.map((s,d)=>Cu(xd,{children:[Vn(Ac,{variant:s.variant??"default",children:s.avatarFallback?Vn(Tr,{className:"size-6",children:Vn(Rr,{className:"text-[0.6rem]",children:s.avatarFallback})}):null}),Vn(Ec,{}),Cu(Fc,{children:[Cu("p",{className:"text-sm",children:[Vn("span",{className:"font-medium",children:s.user})," ",Vn("span",{className:"text-muted-foreground",children:s.action})]}),Vn("time",{className:"text-muted-foreground text-xs",children:new Date(s.time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]})]},d))})]});return Cu("div",{"data-slot":"activity-feed",className:l(r),children:[n("Today",o.today??[]),n("Yesterday",o.yesterday??[]),n("Earlier",o.earlier??[]),a&&Vn(C,{variant:"outline",size:"sm",onClick:t,className:"mt-2 w-full",children:"Load more"}),e.length===0&&Vn("p",{className:"text-muted-foreground py-8 text-center text-sm",children:"No activity yet."})]})}import*as h0 from"react";import{useTranslation as PP}from"react-i18next";import{jsx as Po,jsxs as cs}from"react/jsx-runtime";function rA({fields:e,savedSearches:t=[],defaultValues:a={},onSearch:r,onSaveSearch:o,className:n,...i}){let{t:c}=PP("data"),[s,d]=h0.useState(a),m=(u,p)=>{d(f=>({...f,[u]:p}))};return cs("form",{"data-slot":"advanced-search",className:l("space-y-4 rounded-lg border p-4",n),onSubmit:u=>{u.preventDefault(),r?.(s)},...i,children:[cs("div",{className:"flex flex-col gap-3 md:flex-row",children:[cs("div",{className:"flex-1 space-y-1.5",children:[Po(ue,{htmlFor:"advanced-search-query",children:c("advancedSearch.label")}),cs("div",{className:"relative",children:[Po(X,{className:"text-muted-foreground absolute top-1/2 left-2 size-4 -translate-y-1/2"}),Po(T,{id:"advanced-search-query",className:"pl-8",placeholder:c("advancedSearch.placeholder"),value:s.query??"",onChange:u=>m("query",u.target.value)})]})]}),e.map(u=>cs("div",{className:"min-w-40 space-y-1.5",children:[Po(ue,{children:u.label}),cs(Pe,{value:s[u.key]??"",onValueChange:p=>{p&&m(u.key,p)},children:[Po(Re,{children:Po(Te,{placeholder:c("advancedSearch.any")})}),Po(Se,{children:u.options.map(p=>Po(ve,{value:p.value,children:p.label},p.value))})]})]},u.key))]}),t.length>0&&cs("div",{className:"flex flex-wrap items-center gap-2",children:[Po("span",{className:"text-muted-foreground text-xs",children:c("advancedSearch.saved")}),t.map(u=>Po(C,{type:"button",variant:"ghost",size:"sm",className:"focus-visible:ring-ring/50 h-auto rounded-full p-0 outline-none focus-visible:ring-3",onClick:()=>d(u.values),children:Po(B,{variant:"outline",children:u.label})},u.id))]}),cs("div",{className:"flex justify-end gap-2",children:[o&&cs(C,{type:"button",variant:"outline",onClick:()=>o(s),children:[Po(Tc,{}),c("advancedSearch.saveFilter")]}),cs(C,{type:"submit",children:[Po(X,{}),c("advancedSearch.label")]})]})]})}import*as y0 from"react";import{jsx as Vc,jsxs as Jg}from"react/jsx-runtime";var TP={info:od,warning:xo,critical:jt},RP={info:"bg-blue-50 text-blue-900 border-blue-200 dark:bg-blue-950 dark:text-blue-100 dark:border-blue-800",warning:"bg-yellow-50 text-yellow-900 border-yellow-200 dark:bg-yellow-950 dark:text-yellow-100 dark:border-yellow-800",critical:"bg-red-50 text-red-900 border-red-200 dark:bg-red-950 dark:text-red-100 dark:border-red-800"};function dA({announcements:e,maxVisible:t=3,className:a,onDismiss:r,onViewAll:o}){let[n,i]=y0.useState(new Set),c=u=>{i(p=>new Set(p).add(u)),r?.(u)},s=e.filter(u=>!n.has(u.id)).sort((u,p)=>{let f={critical:0,warning:1,info:2};return f[u.priority]-f[p.priority]});if(s.length===0)return null;let d=s.slice(0,t),m=s.length-d.length;return Jg("div",{"data-slot":"announcement-banner",className:l("flex flex-col gap-1.5",a),children:[d.map(u=>{let p=TP[u.priority];return Jg("div",{className:l("relative flex items-start gap-2.5 rounded-lg border px-3 py-2.5 text-sm",RP[u.priority]),children:[Vc(p,{className:"mt-0.5 size-4 shrink-0"}),Jg("div",{className:"min-w-0 flex-1",children:[u.link?Vc("a",{href:u.link,className:"font-medium underline underline-offset-2 hover:no-underline",children:u.title}):Vc("span",{className:"font-medium",children:u.title}),u.content&&Vc("p",{className:"mt-0.5 opacity-80",children:u.content})]}),u.dismissible!==!1&&Vc(C,{variant:"ghost",size:"icon-xs",className:"size-5 shrink-0 opacity-60 hover:opacity-100",onClick:()=>c(u.id),children:Vc(Q,{className:"size-3"})})]},u.id)}),m>0&&o&&Jg(C,{variant:"ghost",size:"sm",className:"text-muted-foreground self-start text-xs",onClick:o,children:["\u67E5\u770B\u5168\u90E8 ",s.length," \u6761\u516C\u544A"]})]})}import{useTranslation as SP}from"react-i18next";import{jsx as Xx,jsxs as N0}from"react/jsx-runtime";var IP={approved:U,pending:pe,rejected:Q,skipped:pe},DP={approved:"success",pending:"info",rejected:"destructive",skipped:"default"};function xA({steps:e,className:t,texts:a}){let r={approved:"Approved",pending:"Pending",rejected:"Rejected",skipped:"Skipped"},o={approved:a?.statusApproved,pending:a?.statusPending,rejected:a?.statusRejected,skipped:a?.statusSkipped},n=!a,{t:i}=SP("transfer"),c=n?i:s=>s;return Xx(bd,{"data-slot":"approval-timeline",className:l("max-w-2xl",t),children:e.map(s=>{let d=a?o[s.status]??r[s.status]??s.status:c(`approvalTimeline.status.${s.status}`,String(r[s.status]??s.status));return Xx(xd,{icon:IP[s.status],title:N0("span",{className:"inline-flex items-center gap-2",children:[s.title,Xx(B,{variant:"outline",children:d})]}),description:N0("span",{children:[s.approver,s.note?` \xB7 ${s.note}`:""]}),time:s.time,variant:DP[s.status]},s.id)})})}import*as C0 from"react";import{jsx as ta,jsxs as ln}from"react/jsx-runtime";var MP={pending:{label:"\u7B49\u5F85\u4E2D",variant:"outline",icon:pe},running:{label:"\u6267\u884C\u4E2D",variant:"default",icon:ia},completed:{label:"\u5DF2\u5B8C\u6210",variant:"secondary",icon:qs},failed:{label:"\u5931\u8D25",variant:"destructive",icon:wr}};function RA({open:e,onOpenChange:t,tasks:a,onCancelTask:r,onRetryTask:o,onDownloadResult:n,className:i}){let[c,s]=C0.useState(null);return ta(kx,{"data-slot":"async-task-center",open:e,onOpenChange:t,direction:"right",children:ln(Px,{className:l("w-[400px] max-w-[90vw]",i),children:[ta(Tx,{className:"border-b",children:ln("div",{className:"flex items-center justify-between",children:[ln("div",{children:[ta(Rx,{children:"\u4EFB\u52A1\u4E2D\u5FC3"}),ln(Sx,{children:[a.length," \u4E2A\u4EFB\u52A1"]})]}),ta(wx,{asChild:!0,children:ta(C,{variant:"ghost",size:"icon-sm",children:ta(Q,{className:"size-4"})})})]})}),a.length===0?ln("div",{className:"text-muted-foreground flex flex-col items-center justify-center py-16",children:[ta(qs,{className:"mb-3 size-12"}),ta("p",{className:"text-sm",children:"\u6682\u65E0\u4EFB\u52A1"})]}):ta(Wt,{className:"h-[calc(100vh-8rem)]",children:ta("div",{className:"divide-y",children:a.map(d=>{let m=MP[d.status],u=m.icon,p=c===d.id;return ta("div",{className:"px-4 py-3",children:ln("div",{className:"flex cursor-pointer items-start gap-3",onClick:()=>s(p?null:d.id),children:[ta(u,{className:l("mt-0.5 size-4 shrink-0",d.status==="running"&&"animate-spin",d.status==="failed"&&"text-destructive",d.status==="completed"&&"text-green-500")}),ln("div",{className:"min-w-0 flex-1",children:[ln("div",{className:"flex items-center justify-between gap-2",children:[ta("p",{className:"truncate text-sm font-medium",children:d.title}),ta(B,{variant:m.variant,className:"shrink-0 text-[10px]",children:m.label})]}),ln("p",{className:"text-muted-foreground text-xs",children:[d.type," \xB7 ",d.createdAt.toLocaleTimeString()]}),(d.status==="running"||d.status==="pending")&&ln("div",{className:"mt-2",children:[ta(cr,{value:d.progress,className:"h-1.5"}),ta("p",{className:"text-muted-foreground mt-1 text-[10px]",children:d.message||`${d.progress}%`})]}),p&&ln("div",{className:"mt-2 flex gap-1.5",children:[(d.status==="pending"||d.status==="running")&&r&&ta(C,{size:"sm",variant:"outline",onClick:f=>{f.stopPropagation(),r(d.id)},children:"\u53D6\u6D88"}),d.status==="failed"&&o&&ta(C,{size:"sm",onClick:f=>{f.stopPropagation(),o(d.id)},children:"\u91CD\u8BD5"}),d.status==="completed"&&n&&ln(C,{size:"sm",variant:"outline",onClick:f=>{f.stopPropagation(),n(d.id)},children:[ta(qa,{className:"mr-1 size-3"}),"\u4E0B\u8F7D\u7ED3\u679C"]})]}),d.status==="failed"&&d.errorMsg&&p&&ta("p",{className:"bg-destructive/10 text-destructive mt-1.5 rounded px-2 py-1 text-xs",children:d.errorMsg})]}),ta(re,{className:l("text-muted-foreground mt-1 size-4 shrink-0 transition-transform",p&&"rotate-180")})]})},d.id)})})})]})})}import*as k0 from"react";import*as Yx from"react";import{useTranslation as BP}from"react-i18next";import{jsx as ya,jsxs as si}from"react/jsx-runtime";var LP=[{value:"eq",labelKey:"filterBuilder.operator.equals"},{value:"neq",labelKey:"filterBuilder.operator.notEquals"},{value:"contains",labelKey:"filterBuilder.operator.contains"},{value:"gt",labelKey:"filterBuilder.operator.greaterThan"},{value:"lt",labelKey:"filterBuilder.operator.lessThan"},{value:"gte",labelKey:"filterBuilder.operator.gte"},{value:"lte",labelKey:"filterBuilder.operator.lte"}];function Zg({fields:e,onChange:t,className:a}){let{t:r}=BP("data"),[o,n]=Yx.useState([]),[i,c]=Yx.useState("AND"),s=p=>{n(p),t?.({logic:i,filters:p})},d=()=>{s([...o,{field:e[0]?.key??"",operator:"eq",value:""}])},m=p=>{s(o.filter((f,x)=>x!==p))},u=(p,f,x)=>{let v=o.map((N,h)=>h===p?{...N,[f]:x}:N);s(v)};return si("div",{"data-slot":"filter-builder",className:l("space-y-3",a),children:[si("div",{className:"flex items-center gap-2",children:[ya("span",{className:"text-sm font-medium",children:r("filterBuilder.where")}),si(Pe,{value:i,onValueChange:p=>{p&&(c(p),t?.({logic:p,filters:o}))},children:[ya(Re,{className:"h-7 w-20",children:ya(Te,{})}),si(Se,{children:[ya(ve,{value:"AND",children:"AND"}),ya(ve,{value:"OR",children:"OR"})]})]}),si(C,{variant:"outline",size:"sm",onClick:d,children:[ya(ge,{className:"size-3 mr-1"}),r("filterBuilder.addFilter")]})]}),o.length===0&&ya("p",{className:"text-sm text-muted-foreground py-4 text-center",children:r("filterBuilder.empty")}),o.map((p,f)=>si("div",{className:"flex items-center gap-2",children:[si(Pe,{value:p.field,onValueChange:x=>x&&u(f,"field",x),children:[ya(Re,{className:"h-8 w-40",children:ya(Te,{})}),ya(Se,{children:e.map(x=>ya(ve,{value:x.key,children:x.label},x.key))})]}),si(Pe,{value:p.operator,onValueChange:x=>x&&u(f,"operator",x),children:[ya(Re,{className:"h-8 w-36",children:ya(Te,{})}),ya(Se,{children:LP.map(x=>ya(ve,{value:x.value,children:r(x.labelKey)},x.value))})]}),ya(T,{className:"h-8 flex-1",placeholder:r("filterBuilder.valuePlaceholder"),value:p.value,onChange:x=>u(f,"value",x.target.value)}),ya(C,{variant:"ghost",size:"icon-sm",onClick:()=>m(f),children:ya(ye,{className:"size-4 text-destructive"})})]},f)),o.length>0&&si("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[ya(B,{variant:"outline",children:r("filterBuilder.activeCount",{count:o.length})}),r("filterBuilder.active")]})]})}import{jsx as ku,jsxs as hd}from"react/jsx-runtime";function jA({fields:e,segments:t,selectedSegmentKeys:a=[],onSegmentsChange:r,onFiltersChange:o,estimatedSize:n,className:i}){let[c,s]=k0.useState(a),d=r?a:c,m=u=>{s(u),r?.(u)};return hd(Y,{"data-slot":"audience-segment-builder",className:l("overflow-hidden",i),children:[hd(le,{children:[hd(ie,{className:"flex items-center gap-2",children:[ku(al,{className:"size-4"}),"Audience segment"]}),ku(Ga,{children:"Combine reusable segments with rule-based filters."})]}),hd(J,{className:"space-y-5",children:[hd("div",{className:"flex flex-wrap items-center gap-2",children:[hd(B,{variant:"secondary",children:[d.length," saved segments"]}),n!==void 0&&hd(B,{variant:"outline",children:[n.toLocaleString()," estimated users"]})]}),ku(Kx,{dataSource:t,targetKeys:d,onChange:m,titles:["Available","Included"],className:"min-w-0"}),ku("div",{className:"rounded-lg border p-4",children:ku(Zg,{fields:e,...o?{onChange:o}:{}})})]})]})}import*as w0 from"react";import{useTranslation as zP}from"react-i18next";import{jsx as Dr,jsxs as wu}from"react/jsx-runtime";var AP={success:"default",warning:"secondary",error:"destructive",info:"outline"};function EP(e){return e.split(/\s+/).map(t=>t[0]).join("").slice(0,2).toUpperCase()}function FP({entries:e,emptyText:t,className:a,...r}){let{t:o}=zP("data"),n=t??o("auditLog.emptyText"),[i,c]=w0.useState({});return e.length===0?Dr("div",{"data-slot":"audit-log",className:l("text-muted-foreground rounded-lg border p-6 text-center text-sm",a),...r,children:n}):Dr("div",{"data-slot":"audit-log",className:l("divide-y rounded-lg border",a),...r,children:e.map(s=>{let d=i[s.id],m=!!s.details;return Dr("div",{className:"p-4",children:wu("div",{className:"flex items-start gap-3",children:[Dr(Tr,{className:"size-8",children:Dr(Rr,{children:EP(s.actor.name)})}),wu("div",{className:"min-w-0 flex-1",children:[wu("div",{className:"flex flex-wrap items-center gap-2",children:[Dr("p",{className:"text-sm font-medium",children:s.actor.name}),s.status&&Dr(B,{variant:AP[s.status],children:s.status})]}),s.actor.description&&Dr("p",{className:"text-muted-foreground text-xs",children:s.actor.description}),wu("p",{className:"mt-1 text-sm",children:[Dr("span",{className:"text-muted-foreground",children:s.action})," ",Dr("span",{className:"font-medium",children:s.target})]}),m&&d&&Dr("div",{className:"bg-muted/50 text-muted-foreground mt-3 rounded-md p-3 text-xs",children:s.details})]}),wu("div",{className:"flex shrink-0 items-center gap-2",children:[Dr("time",{className:"text-muted-foreground text-xs",children:s.timestamp}),m&&Dr(C,{type:"button",variant:"ghost",size:"icon-xs","aria-label":o(d?"auditLog.collapseDetails":"auditLog.expandDetails"),onClick:()=>c(u=>({...u,[s.id]:!d})),children:d?Dr(re,{}):Dr(me,{})})]})]})},s.id)})})}import{jsx as To,jsxs as ms}from"react/jsx-runtime";var $P={normal:"bg-muted text-muted-foreground",warning:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-100",critical:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-100"};function iE({title:e="\u64CD\u4F5C\u65E5\u5FD7",entries:t,loading:a=!1,className:r}){return a?ms("div",{"data-slot":"audit-sidebar",className:l("p-4",r),children:[To("h4",{className:"mb-3 text-sm font-semibold",children:e}),To("div",{className:"space-y-3",children:Array.from({length:5}).map((o,n)=>ms("div",{className:"animate-pulse space-y-1.5",children:[To("div",{className:"bg-muted h-3 w-1/2 rounded"}),To("div",{className:"bg-muted h-2.5 w-2/3 rounded"})]},n))})]}):ms("div",{"data-slot":"audit-sidebar",className:l("flex h-full flex-col",r),children:[ms("h4",{className:"shrink-0 border-b px-4 py-3 text-sm font-semibold",children:[e,ms("span",{className:"text-muted-foreground ml-1.5 text-xs font-normal",children:["(",t.length,")"]})]}),To(Wt,{className:"flex-1",children:t.length===0?To("p",{className:"text-muted-foreground p-4 text-sm",children:"\u6682\u65E0\u64CD\u4F5C\u8BB0\u5F55"}):To("div",{className:"divide-y",children:t.map(o=>ms("div",{className:"p-3 text-sm",children:[ms("div",{className:"flex items-start justify-between gap-2",children:[To("p",{className:"truncate font-medium",children:o.action}),o.status&&To(B,{className:l("shrink-0 px-1 py-0 text-[10px]",$P[o.status]),children:o.status})]}),ms("p",{className:"text-muted-foreground mt-0.5 text-xs",children:[o.operator," \xB7 ",o.time.toLocaleTimeString()]}),o.field&&o.oldValue!==void 0&&o.newValue!==void 0&&ms("div",{className:"bg-muted/50 mt-1.5 rounded px-2 py-1 text-xs",children:[ms("span",{className:"text-muted-foreground",children:[o.field,":"]})," ",To("span",{className:"text-muted-foreground/60 line-through",children:o.oldValue}),To("span",{className:"text-muted-foreground mx-1",children:"\u2192"}),To("span",{className:"font-medium",children:o.newValue})]}),o.details&&To("p",{className:"text-muted-foreground mt-1 text-xs",children:o.details})]},o.id))})})]})}import"react";import{Fragment as P0,jsx as Jx}from"react/jsx-runtime";function mE({permission:e,mode:t="hide",check:a,fallback:r=null,children:o}){return(a?a(e):!0)?Jx(P0,{children:o}):t==="disable"?Jx("div",{className:"pointer-events-none opacity-50","aria-disabled":"true",children:o}):Jx(P0,{children:r})}import"react";import*as Pu from"react";import{jsx as fE}from"react/jsx-runtime";var HP=Pu.createContext({permissions:[],hasPermission:()=>!0,hasAny:()=>!0,hasAll:()=>!0});function T0(){return Pu.useContext(HP)}import{Fragment as R0,jsx as Tu}from"react/jsx-runtime";function VP({code:e,mode:t="hide",check:a,fallback:r=null,children:o}){let{hasPermission:n}=T0();return(a?a(e):n(e))?Tu(R0,{children:o}):t==="disable"?Tu("div",{className:"pointer-events-none opacity-50","aria-disabled":"true",children:o}):Tu(R0,{children:r})}function hE(e,t){return a=>{let r=o=>Tu(VP,{code:e,fallback:t,children:Tu(a,{...o})});return r.displayName=`withPermission(${a.displayName??a.name})`,r}}import*as dn from"react";import{jsx as Zx,jsxs as S0}from"react/jsx-runtime";var I0=dn.createContext({visible:!1,show:()=>{},hide:()=>{}});function kE({children:e,defaultTip:t,zIndex:a=9999}){let[r,o]=dn.useState(!1),[n,i]=dn.useState(t),c=dn.useCallback(m=>{i(m??t),o(!0)},[t]),s=dn.useCallback(()=>{o(!1)},[]),d=dn.useMemo(()=>({visible:r,show:c,hide:s}),[r,c,s]);return S0(I0.Provider,{value:d,children:[e,r&&Zx("div",{"data-slot":"global-loading",className:"bg-background/80 fixed inset-0 flex items-center justify-center backdrop-blur-sm",style:{zIndex:a},role:"status","aria-live":"polite",children:S0("div",{className:"flex flex-col items-center gap-3",children:[Zx(l0,{size:"xl"}),n&&Zx("p",{className:"text-muted-foreground text-sm",children:n})]})})]})}function wE(){return dn.useContext(I0)}import"react";import{Fragment as OP,jsx as Ru,jsxs as D0}from"react/jsx-runtime";function ME({className:e,onSave:t,onCancel:a,onDelete:r,loading:o=!1,saveDisabled:n=!1,saveText:i="Save",cancelText:c="Cancel",deleteText:s="Delete",extraActions:d,showDelete:m=!1,align:u="end",...p}){return D0("div",{"data-slot":"edit-toolbar",className:l("border-border flex items-center gap-2 border-b px-4 py-2",u==="start"?"justify-start":u==="center"?"justify-center":"justify-end",e),...p,children:[d&&D0(OP,{children:[Ru("div",{className:"flex items-center gap-2",children:d}),Ru(Ue,{orientation:"vertical",className:"h-5"})]}),m&&r&&Ru(C,{variant:"destructive",size:"sm",onClick:r,disabled:o,children:s}),a&&Ru(C,{variant:"outline",size:"sm",onClick:a,disabled:o,children:c}),t&&Ru(C,{size:"sm",onClick:t,disabled:o||n,children:o?"...":i})]})}import{jsx as M0}from"react/jsx-runtime";function EE({onPrint:e,label:t="Print",variant:a="outline",size:r="sm",icon:o,children:n,...i}){return M0(C,{"data-slot":"print-button",variant:a,size:r,icon:o??M0(as,{}),onClick:()=>{e?e():typeof window<"u"&&window.print()},...i,children:n??t})}import*as ev from"react";import{jsx as fl,jsxs as Oc}from"react/jsx-runtime";function WE({open:e,onOpenChange:t,onImport:a,templateUrl:r,accept:o=".xlsx,.xls,.csv",title:n="Import Data",importText:i="Import",templateText:c="Download Template"}){let[s,d]=ev.useState(null),[m,u]=ev.useState(!1),p=async()=>{if(!(!s||!a)){u(!0);try{await a(s),t?.(!1),d(null)}finally{u(!1)}}};return fl(Ie,{open:e,onOpenChange:t,children:Oc(De,{"data-slot":"import-dialog",className:"sm:max-w-[480px]",children:[Oc($e,{children:[fl(Me,{children:n}),fl(Ye,{children:"Upload a file to import data. Please use the template for correct formatting."})]}),Oc(iu,{children:[r&&Oc("a",{href:r,download:!0,className:"text-primary mb-3 inline-flex items-center gap-1.5 text-sm hover:underline",children:[fl(qa,{className:"size-3.5"}),c]}),fl(uu,{...o?{accept:{"*/*":[o]}}:{},onDrop:f=>d(f[0]??null)}),s&&Oc("div",{className:"text-muted-foreground mt-2 text-sm",children:["Selected: ",s.name]})]}),Oc(Ge,{children:[fl(C,{variant:"outline",onClick:()=>t?.(!1),disabled:m,children:"Cancel"}),fl(C,{onClick:p,disabled:!s||m,icon:fl(os,{}),children:m?"Importing...":i})]})]})})}import"react";import{useTranslation as UP}from"react-i18next";import{jsx as z0,jsxs as tv}from"react/jsx-runtime";var B0={sm:"size-6 text-[0.6rem]",default:"size-8 text-xs",lg:"size-10 text-sm",xl:"size-12 text-base"},L0={sm:"ring-1",default:"ring-2",lg:"ring-2",xl:"ring-2"};function YE({users:e,max:t=4,size:a="default",showOverflow:r=!0,onOverflowClick:o,className:n,...i}){let{t:c}=UP("transfer"),s=e.slice(0,t),d=e.length-t;return tv("div",{"data-slot":"avatar-group",className:l("flex -space-x-2",n),...i,children:[s.map((m,u)=>tv(Tr,{className:l(B0[a],L0[a],"border-background border"),title:m.name,children:[m.src&&z0(nn,{src:m.src,alt:m.name}),z0(Rr,{children:sn(m.name)})]},`${m.name}-${u}`)),d>0&&r&&tv(C,{type:"button",variant:"ghost",onClick:o,className:l("border-background bg-muted text-muted-foreground inline-flex shrink-0 items-center justify-center rounded-full border font-medium",B0[a],L0[a]),"aria-label":c("avatarGroup.viewAll",{count:e.length}),children:["+",d]})]})}import"react";import{Fragment as ef,jsx as On,jsxs as Uc}from"react/jsx-runtime";function rF({status:e,onSaveDraft:t,onSubmit:a,onCancel:r,onApprove:o,onReject:n,onRecall:i,onPrint:c,onVoid:s,loading:d=!1,extra:m,className:u}){let p=e==="draft"&&Uc(ef,{children:[t&&On(C,{variant:"outline",onClick:t,disabled:d,children:"\u5B58\u8349\u7A3F"}),a&&On(C,{onClick:a,disabled:d,children:"\u63D0\u4EA4"}),r&&On(C,{variant:"ghost",onClick:r,disabled:d,children:"\u53D6\u6D88"})]}),f=e==="pending"&&Uc(ef,{children:[o&&On(C,{onClick:o,disabled:d,children:"\u5BA1\u6279\u901A\u8FC7"}),n&&On(C,{variant:"outline",onClick:n,disabled:d,children:"\u9A73\u56DE"}),i&&On(C,{variant:"ghost",onClick:i,disabled:d,children:"\u64A4\u56DE"})]}),x=e==="approved"&&Uc(ef,{children:[c&&On(C,{variant:"outline",onClick:c,disabled:d,children:"\u6253\u5370"}),s&&On(C,{variant:"outline",className:"text-destructive",onClick:s,disabled:d,children:"\u4F5C\u5E9F"})]}),v=e==="rejected"&&Uc(ef,{children:[a&&On(C,{onClick:a,disabled:d,children:"\u4FEE\u6539\u91CD\u63D0"}),s&&On(C,{variant:"outline",className:"text-destructive",onClick:s,disabled:d,children:"\u4F5C\u5E9F"})]});return Uc("div",{"data-slot":"bill-footer",className:l("bg-background flex items-center justify-between border-t px-6 py-3",u),children:[On("div",{className:"flex items-center gap-2",children:m}),Uc("div",{className:"flex items-center gap-2",children:[p,f,x,v]})]})}import"react";import{jsx as yd,jsxs as tf}from"react/jsx-runtime";function dF({fields:e,title:t="\u5355\u636E\u4FE1\u606F",extra:a,columns:r=4,loading:o=!1,className:n}){let i=e.filter(s=>!s.hidden);return yd(Y,{"data-slot":"bill-header",className:n,children:tf(J,{className:"pt-6",children:[(t||a)&&tf("div",{className:"mb-4 flex items-center justify-between",children:[yd("h3",{className:"text-foreground text-sm font-semibold",children:t}),a&&yd("div",{children:a})]}),tf("div",{className:l("grid gap-x-6 gap-y-3",{1:"grid-cols-1",2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4"}[r]),children:[i.map((s,d)=>tf("div",{className:l("min-w-0",s.span&&s.span>1&&`col-span-${s.span}`),children:[yd("dt",{className:"text-muted-foreground mb-1 text-xs font-medium",children:s.label}),yd("dd",{className:"text-foreground text-sm break-words",children:o?yd("span",{className:"bg-muted inline-block h-4 w-24 animate-pulse rounded"}):s.value})]},d)),i.length===0&&!o&&yd("p",{className:"text-muted-foreground col-span-full text-sm",children:"\u6682\u65E0\u5355\u636E\u4FE1\u606F"})]})]})})}import"react";import{jsx as Zr,jsxs as Su}from"react/jsx-runtime";var WP={draft:"\u8349\u7A3F",pending:"\u5BA1\u6279\u4E2D",approved:"\u5DF2\u901A\u8FC7",rejected:"\u5DF2\u9A73\u56DE"},_P={draft:"bg-muted text-muted-foreground",pending:"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",approved:"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400",rejected:"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400"};function bF({title:e,subtitle:t,status:a,onBack:r,actions:o,loading:n=!1,className:i,children:c}){return Su("div",{"data-slot":"bill-page",className:l("flex h-full flex-col",i),children:[Su("div",{className:"flex items-center justify-between border-b px-6 py-3",children:[Su("div",{className:"flex items-center gap-3",children:[r&&Zr(C,{variant:"ghost",size:"icon-sm",onClick:r,children:Zr("svg",{className:"size-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:Zr("path",{d:"M19 12H5M12 19l-7-7 7-7"})})}),Su("div",{children:[n?Zr(ut,{className:"h-6 w-48"}):Zr("h1",{className:"text-lg font-semibold",children:e}),n?Zr(ut,{className:"mt-1 h-4 w-32"}):t?Zr("p",{className:"text-muted-foreground text-sm",children:t}):null]}),a&&!n&&Zr("span",{className:l("ml-2 inline-flex items-center rounded-md px-2 py-0.5 text-xs font-medium",_P[a]),children:WP[a]})]}),o&&!n?Zr("div",{className:"flex items-center gap-2",children:o}):n?Zr(ut,{className:"h-8 w-64"}):null]}),Zr("div",{className:"flex-1 overflow-auto p-6",children:n?Su("div",{className:"space-y-4",children:[Zr(ut,{className:"h-8 w-1/3"}),Zr(ut,{className:"h-32 w-full"}),Zr(ut,{className:"h-32 w-full"})]}):c})]})}import*as F0 from"react";import{jsx as us,jsxs as Iu}from"react/jsx-runtime";var A0={completed:"bg-green-500 border-green-500",current:"bg-blue-500 border-blue-500",pending:"bg-transparent border-gray-300 dark:border-gray-600",rejected:"bg-red-500 border-red-500"},E0={completed:"text-green-700 dark:text-green-400",current:"text-blue-700 dark:text-blue-400 font-semibold",pending:"text-muted-foreground",rejected:"text-red-700 dark:text-red-400"};function yF({steps:e,direction:t="horizontal",className:a}){return t==="vertical"?us("div",{"data-slot":"bill-status-bar",className:l("flex flex-col",a),children:e.map((r,o)=>Iu("div",{className:"flex gap-3",children:[Iu("div",{className:"flex flex-col items-center",children:[us("div",{className:l("size-3 rounded-full border-2",A0[r.status])}),o<e.length-1&&us("div",{className:l("my-1 w-0.5 flex-1",r.status==="completed"?"bg-green-500":"bg-gray-200 dark:bg-gray-700")})]}),Iu("div",{className:"pb-6",children:[us("p",{className:l("text-sm leading-none",E0[r.status]),children:r.label}),r.description&&us("p",{className:"text-muted-foreground mt-1 text-xs",children:r.description})]})]},o))}):us("div",{"data-slot":"bill-status-bar",className:l("flex items-center",a),children:e.map((r,o)=>Iu(F0.Fragment,{children:[Iu("div",{className:"flex items-center gap-2",children:[us("div",{className:l("size-3 shrink-0 rounded-full border-2",A0[r.status])}),us("div",{className:"min-w-0",children:us("p",{className:l("truncate text-sm",E0[r.status]),children:r.label})})]}),o<e.length-1&&us("div",{className:l("mx-2 h-0.5 w-12 shrink-0",r.status==="completed"?"bg-green-500":"bg-gray-200 dark:bg-gray-700")})]},o))})}import"react";import{jsx as $0}from"react/jsx-runtime";var qP={draft:{color:"#6b7280",label:"\u8349\u7A3F",className:"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300"},pending:{color:"#3b82f6",label:"\u5BA1\u6279\u4E2D",className:"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400"},approved:{color:"#22c55e",label:"\u5DF2\u901A\u8FC7",className:"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400"},rejected:{color:"#ef4444",label:"\u5DF2\u9A73\u56DE",className:"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400"},rejected_mid:{color:"#f97316",label:"\u9A73\u56DE\u4E2D",className:"bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-400"},inactive:{color:"#6b7280",label:"\u5DF2\u505C\u7528",className:"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300"},active:{color:"#22c55e",label:"\u5DF2\u542F\u7528",className:"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400"}};function PF({status:e,label:t,statusMap:a,className:r}){let n={...qP,...a}[e];return n?$0("span",{"data-slot":"biz-status-tag",className:l("inline-flex rounded-md px-2 py-0.5 text-xs font-medium",n.className,r),children:t||n.label}):$0("span",{"data-slot":"biz-status-tag",className:l("bg-muted text-muted-foreground inline-flex rounded-md px-2 py-0.5 text-xs font-medium",r),children:t||e})}import{jsx as ii,jsxs as Un}from"react/jsx-runtime";var GP={"budgetPacing.card.title":"Budget Pacing","budgetPacing.status.under":"Under Budget","budgetPacing.status.onTrack":"On Track","budgetPacing.status.over":"Over Budget","budgetPacing.status.exhausted":"Exhausted","budgetPacing.spentOf":"spent of","budgetPacing.used":"used","budgetPacing.remaining":"Remaining","budgetPacing.forecast":"Forecast"};function Wc(e,t){if(t){let r={"budgetPacing.card.title":t.title,"budgetPacing.status.under":t.under,"budgetPacing.status.onTrack":t.onTrack,"budgetPacing.status.over":t.over,"budgetPacing.status.exhausted":t.exhausted,"budgetPacing.spentOf":t.spentOf,"budgetPacing.used":t.used,"budgetPacing.remaining":t.remaining,"budgetPacing.forecast":t.forecast}[e];if(r!==void 0)return r}return GP[e]??e}var jP={under:"budgetPacing.status.under","on-track":"budgetPacing.status.onTrack",over:"budgetPacing.status.over",exhausted:"budgetPacing.status.exhausted"},KP={under:"text-info","on-track":"text-success",over:"text-warning",exhausted:"text-destructive"};function af(e,t){return new Intl.NumberFormat("en-US",{style:"currency",currency:t,maximumFractionDigits:0}).format(e)}function MF({title:e,budget:t,spent:a,currency:r="USD",status:o,forecast:n,className:i,texts:c}){let s=e??Wc("budgetPacing.card.title",c),d=t>0?Math.min(Math.round(a/t*100),100):0,m=Math.max(t-a,0),u=o??(a>=t?"exhausted":d>85?"over":d<45?"under":"on-track");return Un(Y,{"data-slot":"budget-pacing-card",className:i,children:[Un(le,{children:[ii(ie,{children:s}),ii(Ga,{className:l("font-medium",KP[u]),children:Wc(jP[u],c)})]}),Un(J,{className:"space-y-4",children:[Un("div",{className:"flex items-end justify-between gap-4",children:[Un("div",{children:[ii("div",{className:"text-2xl font-semibold tabular-nums",children:af(a,r)}),Un("div",{className:"text-muted-foreground text-xs",children:[Wc("budgetPacing.spentOf",c)," ",af(t,r)]})]}),Un("div",{className:"text-right text-sm",children:[Un("div",{className:"font-medium tabular-nums",children:[d,"%"]}),ii("div",{className:"text-muted-foreground text-xs",children:Wc("budgetPacing.used",c)})]})]}),ii(cr,{value:d}),Un("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[Un("div",{className:"rounded-lg border p-3",children:[ii("div",{className:"text-muted-foreground text-xs",children:Wc("budgetPacing.remaining",c)}),ii("div",{className:"font-medium tabular-nums",children:af(m,r)})]}),Un("div",{className:"rounded-lg border p-3",children:[ii("div",{className:"text-muted-foreground text-xs",children:Wc("budgetPacing.forecast",c)}),ii("div",{className:"font-medium tabular-nums",children:af(n??a,r)})]})]})]})]})}import"react";import{useTranslation as QP}from"react-i18next";import{jsx as Du,jsxs as rf}from"react/jsx-runtime";function HF({count:e,selectedCount:t,onClear:a,actions:r=[],label:o,className:n,...i}){let{t:c}=QP("navigation"),s=o??c("bulkActionsToolbar.label");return t===0?null:rf("div",{"data-slot":"bulk-actions-toolbar",role:"toolbar","aria-label":c("bulkActionsToolbar.ariaLabel"),className:l("bg-popover sticky top-0 z-10 flex items-center gap-3 rounded-md border px-3 py-2 shadow-sm",n),...i,children:[rf("div",{className:"flex items-center gap-2 text-sm",children:[Du("span",{className:"font-medium",children:s}),rf("span",{className:"bg-primary/10 text-primary rounded-full px-2 py-0.5 text-xs",children:[t," / ",e]})]}),Du("div",{className:"bg-border mx-2 h-4 w-px"}),Du("div",{className:"flex flex-1 flex-wrap items-center gap-1",children:r.map((d,m)=>rf(C,{size:"sm",variant:d.variant??"outline",onClick:d.onClick,disabled:d.disabled,children:[d.icon,d.label]},m))}),a&&Du(C,{variant:"ghost",size:"icon-sm",onClick:a,"aria-label":c("bulkActionsToolbar.clear"),children:Du(Q,{})})]})}import{useTranslation as XP}from"react-i18next";import"react";import{jsx as _t,jsxs as cn}from"react/jsx-runtime";var YP={upload:0,mapping:1,validation:2,complete:3};function XF({step:e="upload",filename:t,progress:a=0,mappings:r=[],validationRows:o=[],importedCount:n,onUpload:i,onContinue:c,className:s,...d}){let{t:m}=XP("upload");return cn("div",{"data-slot":"bulk-import-wizard",className:l("space-y-6 rounded-lg border p-6",s),...d,children:[cn(gu,{activeStep:YP[e],children:[_t(ll,{children:m("bulkImportWizard.upload")}),_t(ll,{children:m("bulkImportWizard.mapFields")}),_t(ll,{children:m("bulkImportWizard.validate")}),_t(ll,{children:m("bulkImportWizard.complete")})]}),e==="upload"&&cn("div",{className:"flex flex-col items-center justify-center gap-3 rounded-lg border border-dashed p-8 text-center",children:[_t(os,{className:"text-muted-foreground size-8"}),cn("div",{children:[_t("p",{className:"text-sm font-medium",children:m("bulkImportWizard.uploadTitle")}),_t("p",{className:"text-muted-foreground text-xs",children:m("bulkImportWizard.uploadDescription")})]}),_t(C,{type:"button",onClick:i,children:m("bulkImportWizard.selectFile")})]}),e==="mapping"&&cn("div",{className:"space-y-3",children:[cn("div",{className:"flex items-center gap-2 text-sm",children:[_t(dg,{className:"text-muted-foreground size-4"}),_t("span",{children:t??"audience-import.csv"})]}),_t("div",{className:"grid gap-2",children:r.map(u=>cn("div",{className:"flex items-center justify-between rounded-md border p-3 text-sm",children:[_t("span",{children:u.source}),_t("span",{className:"text-muted-foreground",children:m("bulkImportWizard.mapsTo")}),_t(B,{variant:"outline",children:u.target})]},`${u.source}-${u.target}`))})]}),e==="validation"&&cn("div",{className:"space-y-3",children:[_t(cr,{value:a}),_t("div",{className:"divide-y rounded-lg border",children:o.map(u=>cn("div",{className:"flex items-center justify-between gap-3 p-3 text-sm",children:[cn("span",{children:["Row ",u.row]}),_t("span",{className:"text-muted-foreground flex-1",children:u.message}),_t(B,{variant:u.status==="error"?"destructive":u.status==="warning"?"secondary":"default",children:u.status})]},`${u.row}-${u.message}`))})]}),e==="complete"&&cn("div",{className:"flex flex-col items-center justify-center gap-3 rounded-lg border p-8 text-center",children:[_t(qe,{className:"text-success size-10"}),cn("div",{children:[_t("p",{className:"text-sm font-medium",children:m("bulkImportWizard.importComplete")}),_t("p",{className:"text-muted-foreground text-xs",children:m("bulkImportWizard.recordsImported",{count:n??0})})]})]}),e!=="complete"&&_t("div",{className:"flex justify-end",children:_t(C,{type:"button",onClick:c,children:m("bulkImportWizard.continue")})})]})}import{jsx as ZP}from"react/jsx-runtime";var JP={draft:{label:"Draft",className:"bg-muted text-muted-foreground"},scheduled:{label:"Scheduled",className:"bg-info/15 text-info"},active:{label:"Active",className:"bg-success/15 text-success"},paused:{label:"Paused",className:"bg-warning/15 text-warning"},completed:{label:"Completed",className:"bg-primary/10 text-primary"},failed:{label:"Failed",className:"bg-destructive/10 text-destructive"},archived:{label:"Archived",className:"bg-secondary text-secondary-foreground"}};function of({status:e,size:t="default",label:a,className:r}){let o=JP[e];return ZP(B,{"data-slot":"campaign-status-tag",variant:"secondary",className:l(t==="sm"&&"h-4 px-1.5 text-[0.65rem]",o.className,r),children:a??o.label})}import{Fragment as aT,jsx as bl,jsxs as _c}from"react/jsx-runtime";function eT(e){return e instanceof Date?e:new Date(e)}function tT(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function n$({month:e,events:t,className:a}){let r=new Date(e.getFullYear(),e.getMonth(),1),o=new Date(e.getFullYear(),e.getMonth()+1,0).getDate(),n=r.getDay(),i=Array.from({length:n+o},(c,s)=>s<n?null:new Date(e.getFullYear(),e.getMonth(),s-n+1));return _c("div",{"data-slot":"campaign-calendar",className:l("overflow-hidden rounded-lg border",a),children:[bl("div",{className:"bg-muted/30 text-muted-foreground grid grid-cols-7 border-b text-xs font-medium",children:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"].map(c=>bl("div",{className:"px-3 py-2 text-center",children:c},c))}),bl("div",{className:"grid grid-cols-7",children:i.map((c,s)=>{let d=c?t.filter(m=>tT(eT(m.date),c)):[];return bl("div",{className:"min-h-28 border-r border-b p-2 last:border-r-0",children:c&&_c(aT,{children:[bl("div",{className:"mb-2 text-xs font-medium tabular-nums",children:c.getDate()}),_c("div",{className:"space-y-1",children:[d.slice(0,3).map(m=>_c("div",{className:"bg-muted/60 rounded-md p-1.5",children:[bl("div",{className:"truncate text-xs font-medium",children:m.name}),_c("div",{className:"mt-1 flex items-center gap-1",children:[bl(of,{status:m.status,size:"sm"}),m.channel&&bl("span",{className:"text-muted-foreground truncate text-[0.65rem]",children:m.channel})]})]},m.id)),d.length>3&&_c("div",{className:"text-muted-foreground text-[0.65rem]",children:["+",d.length-3," more"]})]})]})},c?.toISOString()??`empty-${s}`)})})]})}import{useTranslation as rT}from"react-i18next";import{jsx as Ro,jsxs as mn}from"react/jsx-runtime";function H0(e,t){return new Intl.NumberFormat("en-US",{style:"currency",currency:t,maximumFractionDigits:0}).format(e)}function g$({name:e,description:t,status:a,channels:r,dateRange:o,budget:n,spent:i=0,currency:c="USD",metrics:s=[],actions:d,className:m}){let{t:u}=rT("marketing"),p=n?Math.min(Math.round(i/n*100),100):void 0;return mn(Y,{"data-slot":"campaign-card",className:m,children:[mn(le,{children:[Ro(ie,{children:e}),t&&Ro(Ga,{children:t}),Ro(vx,{children:Ro(of,{status:a})})]}),mn(J,{className:"space-y-4",children:[mn("div",{className:"text-muted-foreground flex flex-wrap gap-3 text-xs",children:[mn("span",{className:"inline-flex items-center gap-1",children:[Ro(vg,{className:"size-3.5"}),r.join(", ")]}),o&&mn("span",{className:"inline-flex items-center gap-1",children:[Ro(Eh,{className:"size-3.5"}),o]}),n!==void 0&&mn("span",{className:"inline-flex items-center gap-1",children:[Ro(ig,{className:"size-3.5"}),H0(n,c)]})]}),p!==void 0&&mn("div",{className:"space-y-1.5",children:[mn("div",{className:"text-muted-foreground flex justify-between text-xs",children:[mn("span",{children:[H0(i,c)," ",u("campaignCard.spent")]}),mn("span",{children:[p,"%"]})]}),Ro(cr,{value:p})]}),s.length>0&&Ro("div",{className:"grid gap-2 sm:grid-cols-3",children:s.map(f=>mn("div",{className:l("rounded-lg border p-3"),children:[Ro("div",{className:"text-muted-foreground text-xs",children:f.label}),Ro("div",{className:"text-lg font-semibold tabular-nums",children:f.value}),f.helper&&Ro("div",{className:"text-muted-foreground text-xs",children:f.helper})]},f.label))})]}),d&&Ro(ho,{className:"justify-end gap-2",children:d})]})}import*as av from"react";import{useTranslation as oT}from"react-i18next";import{jsx as nf,jsxs as V0}from"react/jsx-runtime";var nT=[{value:"email",label:"",description:""},{value:"sms",label:"",description:""},{value:"push",label:"",description:""},{value:"social",label:"",description:""},{value:"ads",label:"",description:""},{value:"offline",label:"",description:""}],sT={email:Pc,sms:el,push:nd,social:fg,ads:Ah,offline:vg};function N$({value:e,onChange:t,options:a,multiple:r=!1,disabled:o,className:n}){let{t:i}=oT("marketing"),c=av.useMemo(()=>(a??nT).map(u=>({...u,label:i(`channelPicker.${u.value}.label`),description:i(`channelPicker.${u.value}.description`)})),[a,i]),s=av.useMemo(()=>Array.isArray(e)?e:e?[e]:[],[e]),d=m=>{if(o)return;if(!r){t?.(s.includes(m)?void 0:m);return}let u=s.includes(m)?s.filter(p=>p!==m):[...s,m];t?.(u)};return nf("div",{"data-slot":"channel-picker",className:l("grid gap-2 sm:grid-cols-2 lg:grid-cols-3",n),children:c.map(m=>{let u=sT[m.value],p=s.includes(m.value);return V0(C,{type:"button",variant:p?"default":"outline",disabled:o,"aria-pressed":p,onClick:()=>d(m.value),className:"h-auto justify-start gap-3 p-3 text-left",children:[nf(u,{className:"size-4 shrink-0"}),V0("span",{className:"min-w-0",children:[nf("span",{className:"block truncate text-sm font-medium",children:m.label}),m.description&&nf("span",{className:"block truncate text-xs opacity-75",children:m.description})]})]},m.value)})})}import"react";import{ResponsiveContainer as iT,LineChart as T$,Line as R$,BarChart as S$,Bar as I$,AreaChart as D$,Area as M$,PieChart as B$,Pie as L$,Cell as z$,Tooltip as A$,Legend as E$,CartesianGrid as F$,XAxis as $$,YAxis as H$}from"recharts";import{jsx as Mu,jsxs as rv}from"react/jsx-runtime";var O$=["var(--chart-1)","var(--chart-2)","var(--chart-3)","var(--chart-4)","var(--chart-5)"],U$=["var(--brand-500)","var(--brand-600)","var(--brand-400)","var(--brand-700)","var(--brand-300)"],W$=["var(--primary)","var(--success)","var(--warning)","var(--info)","var(--destructive)"];function _$({children:e,className:t}){return Mu("div",{className:l("h-[350px] w-full min-w-0",t),"data-slot":"chart-container",children:Mu(iT,{width:"100%",height:"100%",children:e})})}function q$({active:e,payload:t,label:a,formatter:r}){return!e||!t?.length?null:rv("div",{className:"bg-popover rounded-lg border p-2 text-sm shadow-md",children:[Mu("p",{className:"mb-1 font-medium",children:a}),t.map((o,n)=>rv("div",{className:"flex items-center gap-2",children:[Mu("div",{className:"size-2 rounded-full",style:{backgroundColor:o.color}}),rv("span",{className:"text-muted-foreground",children:[o.name,":"]}),Mu("span",{className:"font-medium",children:r?r(o.value):String(o.value??"")})]},n))]})}import"react";import{useTranslation as lT}from"react-i18next";import{jsx as sf,jsxs as mT}from"react/jsx-runtime";var dT={default:"bg-muted text-foreground",primary:"bg-primary/10 text-primary",success:"bg-success/15 text-success",warning:"bg-warning/15 text-warning",destructive:"bg-destructive/10 text-destructive",info:"bg-info/15 text-info",outline:"border border-input bg-background"},cT={sm:"h-5 px-1.5 text-[0.65rem] gap-1",default:"h-6 px-2 text-xs gap-1.5",lg:"h-7 px-2.5 text-sm gap-1.5"};function Z$({variant:e="default",size:t="default",removable:a,onRemove:r,icon:o,className:n,children:i,...c}){let{t:s}=lT("ui");return mT("span",{"data-slot":"chip","data-variant":e,className:l("inline-flex items-center rounded-full font-medium transition-colors",dT[e],cT[t],n),...c,children:[o&&sf("span",{className:"-ml-0.5 inline-flex",children:o}),sf("span",{className:"truncate",children:i}),a&&sf(C,{type:"button",variant:"ghost",size:"icon-xs","aria-label":s("chip.remove"),onClick:r,className:"-mr-1 size-4 rounded-full opacity-60 hover:opacity-100",children:sf(Q,{className:"size-3"})})]})}import*as O0 from"react";import{useTranslation as uT}from"react-i18next";import*as li from"react";function un(){let[e,t]=li.useState(!1),a=li.useRef(null),r=li.useCallback(async n=>{if(typeof navigator>"u"||!navigator.clipboard)return!1;try{return await navigator.clipboard.writeText(n),t(!0),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>t(!1),2e3),!0}catch{return!1}},[]),o=li.useCallback(()=>{a.current&&clearTimeout(a.current),t(!1)},[]);return li.useEffect(()=>()=>{a.current&&clearTimeout(a.current)},[]),[e,r,o]}import{jsx as Wn,jsxs as ov}from"react/jsx-runtime";function pT(e,t){if(!t)return[e];let a={js:[/\/\/.*$/gm,/\b(?:const|let|var|function|return|if|else|for|while|import|export|from|default|class|new|async|await|true|false|null|undefined|this)\b/g,/(?:"[^"]*"|'[^']*'|`[^`]*`)/g,/\b\d+\b/g],ts:[/\/\/.*$/gm,/\b(?:const|let|var|function|return|if|else|for|while|import|export|from|default|class|new|async|await|interface|type|enum|public|private|protected|true|false|null|undefined|this|extends|implements)\b/g,/(?:"[^"]*"|'[^']*'|`[^`]*`)/g,/\b\d+\b/g],json:[/(?:"(?:[^"\\]|\\.)*")(\s*:)/g,/\b(?:true|false|null)\b/g,/\b-?\d+(?:\.\d+)?\b/g]},r=a[t]??a.js??[],o=[];for(let s=0;s<r.length;s++){let d=new RegExp(r[s].source,r[s].flags),m;for(;(m=d.exec(e))!==null;)o.push({start:m.index,end:m.index+m[0].length,type:["comment","keyword","string","number"][s]??"unknown"})}o.sort((s,d)=>s.start-d.start||d.end-s.end);let n=[];for(let s of o)n.some(d=>s.start<d.end&&s.end>d.start)||n.push(s);let i=[],c=0;for(let s of n)s.start>c&&i.push(e.slice(c,s.start)),i.push(Wn("span",{className:l(s.type==="comment"&&"text-muted-foreground italic",s.type==="keyword"&&"text-info",s.type==="string"&&"text-success",s.type==="number"&&"text-warning"),children:e.slice(s.start,s.end)},`${s.start}-${s.end}`)),c=s.end;return c<e.length&&i.push(e.slice(c)),i}function l6({code:e,language:t,filename:a,showLineNumbers:r=!0,showCopy:o=!0,highlightLines:n=[],maxHeight:i=480,className:c,...s}){let{t:d}=uT("data"),[m,u]=un(),p=e.split(`
|
|
7
|
+
`),f=O0.useMemo(()=>pT(e,t??""),[e,t]);return ov("div",{"data-slot":"code-block",className:l("group relative overflow-hidden rounded-md border bg-zinc-950 text-zinc-100",c),...s,children:[a&&ov("div",{className:"flex items-center justify-between border-b border-zinc-800 bg-zinc-900 px-3 py-1.5 text-xs text-zinc-400",children:[Wn("span",{className:"font-mono",children:a}),t&&Wn("span",{className:"text-[0.65rem] uppercase",children:t})]}),o&&Wn(C,{variant:"ghost",size:"icon-xs",className:"absolute top-2 right-2 z-10 opacity-0 transition-opacity group-hover:opacity-100",onClick:()=>u(e),"aria-label":d("codeBlock.copyCode"),children:m?Wn(U,{className:"text-zinc-100"}):Wn(zt,{className:"text-zinc-100"})}),Wn("pre",{className:"overflow-auto p-3 font-mono text-xs leading-relaxed",style:{maxHeight:i},children:Wn("code",{children:r?Wn("div",{className:"w-full",children:p.map((x,v)=>ov("div",{className:l("flex",n.includes(v+1)&&"bg-zinc-800/60"),children:[Wn("span",{className:"w-8 shrink-0 pr-4 text-right text-zinc-600 select-none",children:v+1}),Wn("span",{className:"flex-1 whitespace-pre",children:p[v]||" "})]},v))}):f})})]})}import*as q0 from"react";import gT from"@uiw/react-codemirror";import{javascript as U0}from"@codemirror/lang-javascript";import{sql as Bu,MySQL as W0,PostgreSQL as _0}from"@codemirror/lang-sql";import{json as fT}from"@codemirror/lang-json";import{css as bT}from"@codemirror/lang-css";import{html as xT}from"@codemirror/lang-html";import{oneDark as vT}from"@codemirror/theme-one-dark";import{useTranslation as hT}from"react-i18next";import{jsx as lf,jsxs as NT}from"react/jsx-runtime";function yT(e,t){switch(e){case"javascript":return[U0({jsx:!1,typescript:!1})];case"typescript":return[U0({jsx:!1,typescript:!0})];case"json":return[fT()];case"sql":{let a=t??"standard";return a==="mysql"?[Bu({dialect:W0})]:a==="postgresql"?[Bu({dialect:_0})]:[Bu({})]}case"mysql":return[Bu({dialect:W0})];case"postgresql":return[Bu({dialect:_0})];case"css":return[bT()];case"html":return[xT()];default:return[]}}function df({value:e,onChange:t,language:a="text",sqlDialect:r,placeholder:o,readOnly:n,hideCopy:i,minHeight:c=200,maxHeight:s,lineNumbers:d=!0,className:m,onFocus:u,onBlur:p}){let{t:f}=hT("data"),[x,v]=un(),N=q0.useMemo(()=>yT(a,r),[a,r]),h={minHeight:c||void 0,maxHeight:s};return NT("div",{"data-slot":"code-editor",className:l("group relative overflow-hidden rounded-md border bg-zinc-950",n&&"opacity-80",m),style:h,children:[!i&&lf(C,{variant:"ghost",size:"icon-xs",className:"absolute top-2 right-2 z-10 opacity-0 transition-opacity group-hover:opacity-100",onClick:()=>v(e),"aria-label":f("codeBlock.copyCode"),children:x?lf(U,{className:"text-zinc-100"}):lf(zt,{className:"text-zinc-100"})}),lf(gT,{value:e,extensions:N,theme:vT,basicSetup:{lineNumbers:d,foldGutter:!0,highlightActiveLine:!0,autocompletion:!n},style:{fontSize:"0.8125rem"},...t!==void 0?{onChange:t}:{},...o!==void 0?{placeholder:o}:{},...n!==void 0?{readOnly:n}:{},...u!==void 0?{onFocus:u}:{},...p!==void 0?{onBlur:p}:{}})]})}import*as xl from"react";import{useTranslation as CT}from"react-i18next";import{Command as qc}from"cmdk";import{jsx as Ka,jsxs as di}from"react/jsx-runtime";var kT=e=>e.flatMap(t=>t.items);function M6({open:e,onOpenChange:t,groups:a=[],placeholder:r="\u8F93\u5165\u547D\u4EE4\u6216\u641C\u7D22...",emptyText:o="\u672A\u627E\u5230\u7ED3\u679C",trigger:n,shortcut:i="mod+K",className:c,showShortcut:s=!0}){let{t:d}=CT("navigation"),m=r==="\u8F93\u5165\u547D\u4EE4\u6216\u641C\u7D22..."?d("commandPalette.placeholder"):r,u=o==="\u672A\u627E\u5230\u7ED3\u679C"?d("commandPalette.emptyText"):o,[p,f]=xl.useState(!1),x=e??p,v=xl.useCallback(h=>{e===void 0&&f(h),t?.(h)},[e,t]);xl.useEffect(()=>{if(typeof window>"u")return;let h=i.toLowerCase().split("+"),b=h.includes("mod")||h.includes("cmd")||h.includes("ctrl"),g=h.filter(k=>!["mod","cmd","ctrl","shift","alt","option"].includes(k))[0];if(!g)return;let y=k=>{b&&!(k.metaKey||k.ctrlKey)||k.key.toLowerCase()===g&&(k.preventDefault(),v(!x))};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[i,x,v]);let N=xl.useMemo(()=>kT(a),[a]);return di(Ie,{open:x,onOpenChange:v,children:[n&&Ka(su,{render:n}),di(De,{showCloseButton:!1,"data-slot":"command-palette",className:"max-w-xl gap-0 overflow-hidden p-0 sm:max-w-xl",children:[Ka(Me,{className:"sr-only",children:d("commandPalette.srTitle")}),di(qc,{className:l("[&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group-heading]]:px-3 [&_[cmdk-group-heading]]:py-2 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",c),label:d("commandPalette.label"),children:[di("div",{className:"flex items-center gap-2 border-b px-3",children:[Ka(X,{className:"size-4 shrink-0 opacity-50"}),Ka(qc.Input,{placeholder:m,className:"placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50"}),s&&Ka(Vg,{className:"ml-auto",children:wT(i)})]}),di(qc.List,{className:"max-h-80 overflow-y-auto p-1",children:[Ka(qc.Empty,{className:"text-muted-foreground px-3 py-8 text-center text-sm",children:u}),a.map(h=>Ka(qc.Group,{heading:h.label,children:h.items.map(b=>di(qc.Item,{value:`${b.label} ${b.keywords?.join(" ")??""}`,onSelect:()=>{b.onSelect?.(),v(!1)},...b.disabled!==void 0?{disabled:b.disabled}:{},className:"data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50",children:[b.icon,di("div",{className:"flex-1 truncate",children:[Ka("div",{className:"truncate",children:b.label}),b.description&&Ka("div",{className:"text-muted-foreground truncate text-xs",children:b.description})]}),b.shortcut&&Ka(Vg,{children:b.shortcut.split("+").map((g,y)=>Ka(il,{size:"sm",children:g.trim()},y))})]},b.id))},h.id))]}),N.length>0&&di("div",{className:"text-muted-foreground flex items-center justify-between border-t px-3 py-2 text-[0.65rem]",children:[Ka("span",{children:d("commandPalette.totalItems",{count:N.length})}),di("span",{className:"flex items-center gap-1",children:[Ka(il,{size:"sm",children:"\u2191"}),Ka(il,{size:"sm",children:"\u2193"}),d("commandPalette.navigate"),Ka(il,{size:"sm",children:"\u21B5"}),d("commandPalette.select"),Ka(il,{size:"sm",children:"Esc"}),d("commandPalette.close")]})]})]})]})]})}function wT(e){return e.split("+").map((t,a)=>Ka(il,{size:"sm",children:t.trim()==="mod"||t.trim()==="cmd"?"\u2318":t.trim()==="ctrl"?"Ctrl":t.trim()==="shift"?"\u21E7":t.trim()==="alt"?"\u2325":t.trim()},a))}import*as Gc from"react";import{useTranslation as PT}from"react-i18next";import{jsx as ci,jsxs as cf}from"react/jsx-runtime";function TT({open:e,onOpenChange:t,title:a="\u786E\u8BA4\u64CD\u4F5C",description:r="\u6B64\u64CD\u4F5C\u4E0D\u53EF\u64A4\u9500\uFF0C\u662F\u5426\u7EE7\u7EED\uFF1F",confirmText:o="\u786E\u8BA4",cancelText:n="\u53D6\u6D88",variant:i="default",onConfirm:c,loading:s,icon:d}){let{t:m}=PT("navigation"),[u,p]=Gc.useState(!1),f=a==="\u786E\u8BA4\u64CD\u4F5C"?m("confirmDialog.title"):a,x=r==="\u6B64\u64CD\u4F5C\u4E0D\u53EF\u64A4\u9500\uFF0C\u662F\u5426\u7EE7\u7EED\uFF1F"?m("confirmDialog.description"):r,v=o==="\u786E\u8BA4"?m("confirmDialog.confirm"):o,N=n==="\u53D6\u6D88"?m("confirmDialog.cancel"):n,h=async()=>{if(!c){t?.(!1);return}p(!0);try{await c(),t?.(!1)}finally{p(!1)}},b=s||u;return ci(Ie,{open:e,onOpenChange:t,children:cf(De,{"data-slot":"confirm-dialog",showCloseButton:!1,className:"sm:max-w-sm",children:[ci($e,{children:cf("div",{className:"flex items-start gap-3",children:[ci("div",{className:"bg-muted flex size-9 shrink-0 items-center justify-center rounded-full",children:d??ci(jt,{className:"size-4"})}),cf("div",{className:"flex flex-col gap-1.5",children:[ci(Me,{children:f}),ci(Ye,{children:x})]})]})}),cf(Ge,{children:[ci(C,{variant:"outline",onClick:()=>t?.(!1),disabled:b,children:N}),ci(C,{variant:i==="destructive"?"destructive":"default",onClick:h,disabled:b,children:v})]})]})})}function $6(){let[e,t]=Gc.useState({open:!1,options:{}}),a=Gc.useCallback(o=>new Promise(n=>{t({open:!0,options:o,resolve:n})}),[]),r=Gc.useCallback(o=>{e.resolve?.(o),t(n=>{let{resolve:i,...c}=n;return{...c,open:!1}})},[e]);return[a,r]}function H6({state:e,onClose:t}){return ci(TT,{open:e.open,onOpenChange:a=>{a||t(!1)},onConfirm:()=>t(!0),...e.options})}import*as G0 from"react";import{useTranslation as RT}from"react-i18next";import{Fragment as ST,jsx as Nd,jsxs as Lu}from"react/jsx-runtime";function G6({open:e,onAccept:t,onReject:a,onDismiss:r,title:o="Cookie \u4F7F\u7528\u63D0\u793A",description:n="\u6211\u4EEC\u4F7F\u7528 Cookie \u63D0\u5347\u60A8\u7684\u4F53\u9A8C\u3002\u70B9\u51FB\u300C\u63A5\u53D7\u300D\u4EE5\u542F\u7528\u5168\u90E8\u529F\u80FD\uFF0C\u6216\u5728\u8BBE\u7F6E\u4E2D\u81EA\u5B9A\u4E49\u3002",acceptText:i="\u63A5\u53D7\u5168\u90E8",rejectText:c="\u4EC5\u5FC5\u8981",policyText:s="\u9690\u79C1\u653F\u7B56",policyUrl:d,storageKey:m="cookie-consent",position:u="bottom",className:p}){let{t:f}=RT("cookie"),x=o==="Cookie \u4F7F\u7528\u63D0\u793A"?f("cookieBanner.title"):o,v=n==="\u6211\u4EEC\u4F7F\u7528 Cookie \u63D0\u5347\u60A8\u7684\u4F53\u9A8C\u3002\u70B9\u51FB\u300C\u63A5\u53D7\u300D\u4EE5\u542F\u7528\u5168\u90E8\u529F\u80FD\uFF0C\u6216\u5728\u8BBE\u7F6E\u4E2D\u81EA\u5B9A\u4E49\u3002"?f("cookieBanner.description"):n,N=i==="\u63A5\u53D7\u5168\u90E8"?f("cookieBanner.accept"):i,h=c==="\u4EC5\u5FC5\u8981"?f("cookieBanner.reject"):c,b=s==="\u9690\u79C1\u653F\u7B56"?f("cookieBanner.policy"):s,[g,y]=G0.useState(()=>{if(typeof window>"u"||m===void 0)return!0;try{return localStorage.getItem(m)===null}catch{return!0}}),k=e??g,w=H=>{try{localStorage.setItem(m,H)}catch{}},R=()=>{w("accepted"),t?.(),e===void 0&&y(!1)},S=()=>{w("rejected"),a?.(),e===void 0&&y(!1)},z=()=>{w("dismissed"),r?.(),e===void 0&&y(!1)},L={bottom:"bottom-4 left-1/2 -translate-x-1/2",top:"top-4 left-1/2 -translate-x-1/2","bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4"};return k?Lu("div",{"data-slot":"cookie-banner",role:"dialog","aria-label":f("cookieBanner.ariaLabel"),className:l("bg-popover fixed z-50 flex w-[min(640px,calc(100vw-2rem))] flex-col gap-3 rounded-lg border p-4 shadow-xl sm:flex-row sm:items-center",L[u],p),children:[Nd(Hh,{className:"text-muted-foreground size-5 shrink-0"}),Lu("div",{className:"flex-1 space-y-1",children:[Nd("p",{className:"text-sm font-medium",children:x}),Lu("p",{className:"text-muted-foreground text-xs",children:[v,d&&Lu(ST,{children:[" ",Nd("a",{href:d,className:"text-primary hover:underline",children:b})]})]})]}),Lu("div",{className:"flex items-center gap-2 sm:flex-row",children:[Nd(C,{variant:"outline",size:"sm",onClick:S,children:h}),Nd(C,{size:"sm",onClick:R,children:N}),Nd(C,{variant:"ghost",size:"icon-xs",onClick:z,"aria-label":f("cookieBanner.close"),children:Nd(Q,{})})]})]}):null}import*as Au from"react";import*as nv from"react";import{jsx as mi,jsxs as mf}from"react/jsx-runtime";function j0({fields:e,onSearch:t,onReset:a,layout:r="inline",collapsible:o=!0,loading:n=!1,className:i}){let[c,s]=nv.useState(()=>{let g={};for(let y of e)y.defaultValue!==void 0&&(g[y.key]=y.defaultValue);return g}),[d,m]=nv.useState(!1),u=(g,y)=>{s(k=>({...k,[g]:y}))},p=()=>t(c),f=()=>{s({}),a?.()},x=g=>{g.key==="Enter"&&p()},v=o&&!d?e.slice(0,3):e,N=e.length-3,h=g=>g.render?g.render(c[g.key],u):g.type==="select"&&g.options?mf("select",{className:"h-9 rounded-md border bg-background px-3 text-sm",value:String(c[g.key]??""),onChange:y=>u(g.key,y.target.value||void 0),children:[mi("option",{value:"",children:g.placeholder||g.label}),g.options.map(y=>mi("option",{value:y.value,children:y.label},y.value))]}):mi(T,{placeholder:g.placeholder||`\u8BF7\u8F93\u5165${g.label}`,value:String(c[g.key]??""),onChange:y=>u(g.key,y.target.value),onKeyDown:x,className:"w-44"}),b=mf("div",{"data-slot":"filter-bar",className:l("flex flex-wrap items-end gap-3",i),onKeyDown:x,children:[v.map(g=>mf("div",{className:"flex flex-col gap-1",children:[mi("label",{className:"text-xs font-medium text-muted-foreground",children:g.label}),h(g)]},g.key)),mf("div",{className:"flex items-center gap-2",children:[mi(C,{size:"sm",onClick:p,disabled:n,children:"\u67E5\u8BE2"}),mi(C,{size:"sm",variant:"outline",onClick:f,disabled:n,children:"\u91CD\u7F6E"}),o&&N>0&&mi(C,{size:"sm",variant:"ghost",onClick:()=>m(!d),children:d?"\u6536\u8D77":`\u5C55\u5F00 (${N})`})]})]});return r==="card"?mi(Y,{"data-slot":"filter-bar",children:mi(J,{className:"pt-4",children:b})}):b}import"react";import{jsx as Mr,jsxs as zu}from"react/jsx-runtime";function sv({columns:e,dataSource:t,rowKey:a="id",loading:r=!1,pagination:o,emptyText:n="\u6682\u65E0\u6570\u636E",onRow:i,className:c}){let s={left:"text-left",center:"text-center",right:"text-right"},d=(m,u)=>{let p=u.dataIndex||u.key;return m[p]};return zu("div",{"data-slot":"search-table",className:l("space-y-2",c),children:[Mr("div",{className:"overflow-x-auto rounded-md border",children:zu(ze,{children:[Mr(Ae,{children:Mr(W,{children:e.map(m=>Mr(E,{className:s[m.align||"left"],style:{width:m.width,minWidth:m.width},children:m.title},m.key))})}),Mr(ke,{children:r?Array.from({length:5}).map((m,u)=>Mr(W,{children:e.map((p,f)=>Mr(D,{children:Mr(ut,{className:"h-4 w-full"})},f))},u)):t.length===0?Mr(W,{children:Mr(D,{colSpan:e.length,className:"py-12 text-center text-muted-foreground",children:n})}):t.map((m,u)=>{let p=i?.(m,u);return Mr(W,{className:l(p?.onClick&&"cursor-pointer hover:bg-muted/50"),onClick:p?.onClick,children:e.map(f=>{let x=d(m,f),v=f.render?f.render(x,m,u):x!=null?String(x):"-";return Mr(D,{className:l(s[f.align||"left"],f.ellipsis&&"truncate max-w-0"),children:v},f.key)})},String(m[a]||u))})})]})}),o&&zu("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[zu("span",{children:["\u5171 ",o.total," \u6761"]}),zu("div",{className:"flex items-center gap-1",children:[Mr(C,{variant:"outline",size:"sm",disabled:o.current<=1,onClick:()=>o.onChange(o.current-1,o.pageSize),children:"\u4E0A\u4E00\u9875"}),Array.from({length:Math.ceil(o.total/o.pageSize)},(m,u)=>u+1).slice(Math.max(0,o.current-3),Math.min(Math.ceil(o.total/o.pageSize),o.current+2)).map(m=>Mr(C,{variant:m===o.current?"default":"outline",size:"sm",onClick:()=>o.onChange(m,o.pageSize),children:m},m)),Mr(C,{variant:"outline",size:"sm",disabled:o.current>=Math.ceil(o.total/o.pageSize),onClick:()=>o.onChange(o.current+1,o.pageSize),children:"\u4E0B\u4E00\u9875"})]})]})]})}import{Fragment as MT,jsx as aa,jsxs as ui}from"react/jsx-runtime";function IT({open:e,onOpenChange:t,title:a,fields:r,record:o,onSubmit:n}){let i=Au.useMemo(()=>{if(o)return{...o};let u={};return r.forEach(p=>{p.defaultValue!==void 0&&(u[p.key]=p.defaultValue)}),u},[o,r]),[c,s]=Au.useState(i),d=(u,p)=>{s(f=>({...f,[u]:p}))},m=u=>{if(u.render)return u.render(c[u.key],f=>d(u.key,f));let p=c[u.key];return u.type==="select"&&u.options?ui("select",{className:"bg-background h-9 w-full rounded-md border px-3 text-sm",value:String(p??""),onChange:f=>d(u.key,f.target.value||void 0),children:[aa("option",{value:"",children:u.placeholder||`\u8BF7\u9009\u62E9${u.label}`}),u.options.map(f=>aa("option",{value:f.value,children:f.label},f.value))]}):u.type==="textarea"?aa("textarea",{className:"bg-background min-h-[80px] w-full rounded-md border px-3 py-2 text-sm",placeholder:u.placeholder,value:String(p??""),onChange:f=>d(u.key,f.target.value)}):u.type==="number"?aa("input",{type:"number",className:"bg-background h-9 w-full rounded-md border px-3 text-sm",placeholder:u.placeholder,value:p!=null?String(p):"",onChange:f=>d(u.key,f.target.valueAsNumber||void 0)}):aa("input",{className:"bg-background h-9 w-full rounded-md border px-3 text-sm",placeholder:u.placeholder,value:String(p??""),onChange:f=>d(u.key,f.target.value)})};return aa(Ie,{open:e,onOpenChange:t,children:ui(De,{className:"sm:max-w-[560px]",children:[aa($e,{children:aa(Me,{children:a})}),aa("div",{className:"grid gap-4 py-2",children:r.map(u=>ui("div",{className:"flex flex-col gap-1.5",children:[ui("label",{className:"text-sm font-medium",children:[u.label,u.required&&aa("span",{className:"ml-1 text-red-500",children:"*"})]}),m(u)]},u.key))}),ui("div",{className:"flex justify-end gap-2",children:[aa(C,{variant:"outline",onClick:()=>t?.(!1),children:"\u53D6\u6D88"}),aa(C,{onClick:()=>n?.(c),children:"\u786E\u5B9A"})]})]})})}function DT({title:e,filterFields:t,columns:a,dataSource:r,rowKey:o="id",loading:n=!1,pagination:i,formFields:c,formTitle:s="\u8868\u5355",dialogOpen:d,onDialogOpenChange:m,editingRecord:u,actions:p,onRefresh:f,onAdd:x,onEdit:v,onSearch:N,onDelete:h,onSubmit:b,className:g}){let y=Au.useMemo(()=>!h&&!b&&!v?a:[...a,{key:"_operations",title:"\u64CD\u4F5C",width:120,align:"center",render:(w,R)=>ui("div",{className:"flex items-center justify-center gap-1",children:[(b||v)&&aa(C,{variant:"ghost",size:"sm",onClick:()=>{v?v(R):m?.(!0)},children:"\u7F16\u8F91"}),h&&aa(C,{variant:"ghost",size:"sm",className:"text-destructive",onClick:()=>h(R),children:"\u5220\u9664"})]})}],[a,h,b,v,m]);return ui(Lx,{"data-slot":"crud-page",className:g,children:[aa(zx,{title:e}),aa("div",{className:"mb-4",children:aa(j0,{fields:t,onSearch:N})}),(p||f||x)&&ui("div",{className:"mb-3 flex items-center gap-2",children:[ui(MT,{children:[f&&aa(C,{variant:"outline",size:"sm",onClick:f,children:"\u5237\u65B0"}),x&&aa(C,{size:"sm",onClick:x,children:"\u65B0\u589E"})]}),p]}),aa(sv,{columns:y,dataSource:r,rowKey:o,loading:n,pagination:i}),c&&aa(IT,{open:d,onOpenChange:m,title:s,fields:c,record:u,onSubmit:b},u?`edit-${String(u[o]??"")}`:`new-${d?"1":"0"}`)]})}import"react";import{jsx as pi,jsxs as Cd}from"react/jsx-runtime";function NH({primaryActions:e,searchPlaceholder:t="\u641C\u7D22...",searchValue:a,onSearch:r,onSearchChange:o,showSearch:n=!0,moreActions:i,selectionCount:c=0,bulkActionLabel:s,loading:d=!1,className:m}){let u=e||[{key:"create",label:"\u65B0\u589E",icon:ge,onClick:()=>{}},{key:"delete",label:"\u5220\u9664",icon:sd,onClick:()=>{},danger:!0},{key:"refresh",label:"\u5237\u65B0",icon:ia,onClick:()=>{}}];return Cd("div",{"data-slot":"crud-toolbar",className:l("flex flex-wrap items-center gap-2",m),children:[c>0&&s?Cd("div",{className:"flex items-center gap-2",children:[Cd("span",{className:"text-muted-foreground text-sm",children:["\u5DF2\u9009 ",c," \u9879"]}),pi(C,{size:"sm",variant:"default",children:s})]}):u.map(p=>Cd(C,{size:"sm",variant:p.danger?"outline":"default",className:l(p.danger&&"border-destructive text-destructive hover:bg-destructive/10"),onClick:p.onClick,disabled:p.disabled||d,children:[p.icon&&pi(p.icon,{className:"mr-1.5 size-3.5"}),p.label]},p.key)),n&&Cd("div",{className:"relative max-w-xs flex-1",children:[pi(X,{className:"text-muted-foreground absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2"}),pi(T,{className:"h-8 pl-8 text-sm",placeholder:t,value:a,onChange:p=>{o?.(p.target.value)},onKeyDown:p=>{p.key==="Enter"&&r?.(p.currentTarget.value)}})]}),i&&i.length>0&&Cd(sr,{children:[pi(ir,{children:pi("button",{type:"button",className:"hover:bg-accent hover:text-accent-foreground inline-flex h-8 w-8 items-center justify-center rounded-md border",children:pi(ix,{className:"size-4"})})}),pi(lr,{align:"end",children:i.map(p=>Cd(la,{onClick:p.onClick,disabled:p.disabled,className:l(p.danger&&"text-destructive"),children:[p.icon&&pi(p.icon,{className:"mr-2 size-4"}),p.label]},p.key))})]})]})}import{jsx as it,jsxs as Br}from"react/jsx-runtime";var BT={email:Pc,push:xo,social:el,ad:ha};function RH({mode:e,viewport:t="desktop",title:a,eyebrow:r,body:o,imageUrl:n,cta:i,from:c="Chaos Marketing",className:s}){let d=BT[e];return Br(Y,{"data-slot":"creative-preview",className:s,children:[it(le,{children:Br(ie,{className:"flex items-center gap-2",children:[it(d,{className:"size-4"}),"Creative preview",it(B,{variant:"outline",children:e}),it(B,{variant:"secondary",children:t})]})}),it(J,{children:Br(Sr,{defaultValue:t,children:[Br(Ir,{children:[it(Ba,{value:"desktop",children:"Desktop"}),Br(Ba,{value:"mobile",children:[it(nd,{}),"Mobile"]})]}),["desktop","mobile"].map(m=>it(Co,{value:m,children:Br("div",{className:l("bg-background mx-auto rounded-xl border p-4 shadow-xs",m==="mobile"?"max-w-[360px]":"max-w-2xl"),children:[e==="email"&&it(LT,{from:c,title:a,...o!==void 0?{body:o}:{},...n!==void 0?{imageUrl:n}:{},...i!==void 0?{cta:i}:{}}),e==="push"&&it(zT,{title:a,...o!==void 0?{body:o}:{}}),e==="social"&&it(AT,{from:c,title:a,...o!==void 0?{body:o}:{},...n!==void 0?{imageUrl:n}:{}}),e==="ad"&&it(ET,{title:a,...r!==void 0?{eyebrow:r}:{},...o!==void 0?{body:o}:{},...n!==void 0?{imageUrl:n}:{},...i!==void 0?{cta:i}:{}})]})},m))]},t)})]})}function iv({imageUrl:e}){return e?it("img",{src:e,alt:"",className:"aspect-video w-full rounded-lg object-cover"}):it("div",{className:"bg-muted text-muted-foreground flex aspect-video w-full items-center justify-center rounded-lg",children:it(ha,{className:"size-8"})})}function LT({from:e,title:t,body:a,imageUrl:r,cta:o}){return Br("div",{className:"space-y-4",children:[Br("div",{className:"text-muted-foreground border-b pb-3 text-xs",children:["From: ",e]}),it(iv,{...r!==void 0?{imageUrl:r}:{}}),Br("div",{children:[it("h3",{className:"text-xl font-semibold",children:t}),a&&it("p",{className:"text-muted-foreground mt-2 text-sm",children:a})]}),o&&it("div",{className:"bg-primary text-primary-foreground inline-flex rounded-md px-3 py-2 text-sm",children:o})]})}function zT({title:e,body:t}){return Br("div",{className:"bg-muted/30 rounded-xl border p-3",children:[it("div",{className:"text-sm font-medium",children:e}),t&&it("div",{className:"text-muted-foreground mt-1 text-sm",children:t})]})}function AT({from:e,title:t,body:a,imageUrl:r}){return Br("div",{className:"space-y-3",children:[Br("div",{className:"flex items-center gap-2 text-sm font-medium",children:[it("span",{className:"bg-primary/15 size-8 rounded-full"}),e]}),Br("div",{children:[it("div",{className:"font-medium",children:t}),a&&it("p",{className:"text-muted-foreground mt-1 text-sm",children:a})]}),it(iv,{...r!==void 0?{imageUrl:r}:{}})]})}function ET({eyebrow:e,title:t,body:a,imageUrl:r,cta:o}){return Br("div",{className:"grid gap-4 sm:grid-cols-[1fr_1.2fr]",children:[it(iv,{...r!==void 0?{imageUrl:r}:{}}),Br("div",{className:"flex flex-col justify-center",children:[e&&it("div",{className:"text-muted-foreground text-xs font-medium uppercase",children:e}),it("h3",{className:"mt-1 text-xl font-semibold",children:t}),a&&it("p",{className:"text-muted-foreground mt-2 text-sm",children:a}),o&&it("div",{className:"bg-primary text-primary-foreground mt-4 inline-flex w-fit rounded-md px-3 py-2 text-sm",children:o})]})]})}import*as kd from"react";import{useReactTable as FT,getCoreRowModel as $T,getSortedRowModel as HT,flexRender as K0}from"@tanstack/react-table";import{ArrowUpDown as VT,ArrowUp as OT,ArrowDown as UT}from"lucide-react";import{jsx as Na,jsxs as jc}from"react/jsx-runtime";function AH({columns:e,dataSource:t=[],rowKey:a="id",loading:r=!1,emptyText:o="No data",size:n="md",sortable:i=!1,expandable:c,className:s}){let[d,m]=kd.useState([]),[u,p]=kd.useState({}),f=kd.useMemo(()=>()=>e.map(N=>({id:N.key,accessorKey:N.key,header:N.title,size:typeof N.width=="number"?N.width:150,enableSorting:i||!!N.sortable,cell:h=>N.render?N.render(h.getValue(),h.row.original,h.row.index):h.getValue()??"\u2014"})),[e,i]),x=FT({data:t,columns:f,state:{sorting:d},onSortingChange:m,getCoreRowModel:$T(),...i?{getSortedRowModel:HT()}:{},enableSorting:i}),v=n==="sm"?"px-2 py-1.5":n==="lg"?"px-4 py-3":"px-3 py-2";return Na("div",{"data-slot":"data-table",className:l("overflow-x-auto rounded-lg border border-border",s),children:jc(ze,{children:[Na(Ae,{children:x.getHeaderGroups().map(N=>jc(W,{className:"bg-muted/30",children:[c&&Na(E,{className:l("w-10",v)}),N.headers.map(h=>{let b=e.find(k=>k.key===h.id),g=h.column.getCanSort(),y=h.column.getIsSorted();return Na(E,{className:l(v,b?.align==="center"&&"text-center",b?.align==="right"&&"text-right",g&&"cursor-pointer select-none",b?.fixed&&"sticky z-[2] bg-inherit",b?.fixed==="left"&&"left-0",b?.fixed==="right"&&"right-0"),style:b?.width?{width:b.width}:void 0,onClick:g?h.column.getToggleSortingHandler():void 0,children:jc("span",{className:"flex items-center gap-1",children:[K0(h.column.columnDef.header,h.getContext()),g&&(y==="asc"?Na(OT,{className:"size-3"}):y==="desc"?Na(UT,{className:"size-3"}):Na(VT,{className:"size-3 opacity-40"}))]})},h.id)})]},N.id))}),Na(ke,{children:r?Array.from({length:5}).map((N,h)=>jc(W,{children:[c&&Na(D,{className:v,children:Na(ut,{className:"size-4"})}),e.map(b=>Na(D,{className:v,children:Na(ut,{className:"h-4 w-full"})},b.key))]},`skeleton-${h}`)):x.getRowModel().rows.length===0?Na(W,{children:Na(D,{colSpan:e.length+(c?1:0),className:"py-12 text-center text-muted-foreground",children:o})}):x.getRowModel().rows.map(N=>{let b=N.original[a]??N.index,g=u[String(b)]??!1;return jc(kd.Fragment,{children:[jc(W,{children:[c&&Na(D,{className:l(v,"w-10"),children:Na("button",{type:"button",onClick:()=>p(y=>({...y,[String(b)]:!g})),className:"flex items-center justify-center",children:g?"\u25BC":"\u25B6"})}),N.getVisibleCells().map(y=>{let k=e.find(w=>w.key===y.column.id);return Na(D,{className:l(v,k?.align==="center"&&"text-center",k?.align==="right"&&"text-right"),children:K0(y.column.columnDef.cell,y.getContext())},y.id)})]}),c&&g&&Na(W,{children:Na(D,{colSpan:e.length+1,className:"bg-muted/20 px-8 py-4",children:c.rowExpand(N.original)})})]},b)})})]})})}import*as Eu from"react";import{useTranslation as WT}from"react-i18next";import{jsx as vl,jsxs as lv}from"react/jsx-runtime";function _T(e){return[{label:e("dateRangePicker.today"),getRange:()=>{let t=new Date;return t.setHours(0,0,0,0),{from:t,to:t}}},{label:e("dateRangePicker.yesterday"),getRange:()=>{let t=new Date;return t.setDate(t.getDate()-1),t.setHours(0,0,0,0),{from:t,to:t}}},{label:e("dateRangePicker.last7Days"),getRange:()=>{let t=new Date;t.setHours(23,59,59,999);let a=new Date;return a.setDate(a.getDate()-6),a.setHours(0,0,0,0),{from:a,to:t}}},{label:e("dateRangePicker.last30Days"),getRange:()=>{let t=new Date;t.setHours(23,59,59,999);let a=new Date;return a.setDate(a.getDate()-29),a.setHours(0,0,0,0),{from:a,to:t}}},{label:e("dateRangePicker.thisMonth"),getRange:()=>{let t=new Date,a=new Date(t.getFullYear(),t.getMonth(),1),r=new Date(t.getFullYear(),t.getMonth()+1,0);return{from:a,to:r}}},{label:e("dateRangePicker.lastMonth"),getRange:()=>{let t=new Date,a=new Date(t.getFullYear(),t.getMonth()-1,1),r=new Date(t.getFullYear(),t.getMonth(),0);return{from:a,to:r}}}]}function _H({value:e,onChange:t,placeholder:a,numberOfMonths:r=2,disabled:o,align:n="start",className:i,presets:c=!0}){let{t:s}=WT("transfer"),[d,m]=Eu.useState(!1),u=a??s("dateRangePicker.placeholder"),p=Eu.useMemo(()=>_T(s),[s]),f=Eu.useMemo(()=>e?.from?e.to?e.from.getTime()===e.to.getTime()?tt(e.from,{dateStyle:"medium"}):`${tt(e.from,{dateStyle:"medium"})} - ${tt(e.to,{dateStyle:"medium"})}`:tt(e.from,{dateStyle:"medium"}):u,[e,u]);return lv(He,{open:d,onOpenChange:m,children:[lv(Ve,{render:vl(C,{variant:"outline",disabled:o,className:l("w-[300px] justify-start text-left font-normal",!e?.from&&"text-muted-foreground",i)}),children:[vl(jr,{}),vl("span",{className:"truncate",children:f}),vl(re,{className:"ml-auto size-4 opacity-50"})]}),vl(Oe,{align:n,className:"w-auto p-0",children:lv("div",{className:"flex",children:[c&&vl("div",{className:"flex w-[140px] flex-col gap-1 border-r p-3",children:p.map(x=>vl(C,{variant:"ghost",size:"sm",className:"justify-start",onClick:()=>{t?.(x.getRange()),m(!1)},children:x.label},x.label))}),vl(xx,{mode:"range",selected:e,...t?{onSelect:t}:{onSelect:()=>{}},numberOfMonths:r,autoFocus:!0,required:!1})]})})]})}import"react";import{jsx as gi,jsxs as dv}from"react/jsx-runtime";var qT={added:"default",removed:"destructive",changed:"secondary",unchanged:"outline"};function XH({items:e,beforeLabel:t="Before",afterLabel:a="After",className:r,...o}){return dv("div",{"data-slot":"diff-viewer",className:l("overflow-hidden rounded-lg border",r),...o,children:[dv("div",{className:"grid grid-cols-[minmax(140px,0.7fr)_1fr_1fr_auto] border-b bg-muted/40 px-4 py-2 text-xs font-medium text-muted-foreground",children:[gi("span",{children:"Field"}),gi("span",{children:t}),gi("span",{children:a}),gi("span",{children:"Change"})]}),gi("div",{className:"divide-y",children:e.map(n=>{let i=n.type??"changed";return dv("div",{className:"grid grid-cols-[minmax(140px,0.7fr)_1fr_1fr_auto] gap-3 px-4 py-3 text-sm",children:[gi("span",{className:"font-medium",children:n.label??n.field}),gi("span",{className:l(i==="removed"&&"text-destructive line-through"),children:n.before??"-"}),gi("span",{className:l(i==="added"&&"text-success",i==="changed"&&"font-medium"),children:n.after??"-"}),gi(B,{variant:qT[i],children:i})]},n.field)})})]})}import*as Kc from"react";import{jsx as hl,jsxs as X0}from"react/jsx-runtime";var Q0=new Map,GT=1800*1e3,Y0=null;function aV(e){Y0=e}function rV({className:e,categoryCode:t,options:a,value:r,onChange:o,placeholder:n="Please select",allowClear:i=!0,disabled:c=!1,loading:s=!1,size:d="md",fetcher:m,...u}){let[p,f]=Kc.useState(a??[]),[x,v]=Kc.useState(s),[N,h]=Kc.useState(null);Kc.useEffect(()=>{if(a){f(a);return}if(!t)return;let g=Q0.get(t);if(g&&Date.now()-g.timestamp<GT){f(g.data);return}let y=m??Y0;if(!y){h("No dict fetcher configured");return}let k=!1;return v(!0),h(null),y(t).then(w=>{k||(Q0.set(t,{data:w,timestamp:Date.now()}),f(w))}).catch(w=>{k||h(w instanceof Error?w.message:"Failed to load dict")}).finally(()=>{k||v(!1)}),()=>{k=!0}},[t,a,m]);let b=d==="sm"?"h-8 text-xs":d==="lg"?"h-11 text-base":"h-9 text-sm";return x?hl("div",{className:l("flex items-center",e),...u,children:hl(ut,{className:l("w-full",b)})}):N?hl("div",{className:l("flex items-center rounded-md border border-destructive/30 bg-destructive/5 px-3 text-xs text-destructive",b,e),...u,children:N}):hl("div",{"data-slot":"dict-select",className:l("w-full",e),...u,children:X0(Pe,{value:r!==void 0?String(r):void 0,onValueChange:g=>{if(g==null)return;if(g===""){o?.(void 0);return}let y=p.find(k=>String(k.value)===g);o?.(y?.value??g)},disabled:c,children:[hl(Re,{className:l(b,"w-full"),children:hl(Te,{placeholder:n})}),X0(Se,{children:[i&&r!==void 0&&hl(ve,{value:"",children:"\u2014"}),p.map(g=>hl(ve,{value:String(g.value),disabled:g.disabled,children:g.label},String(g.value)))]})]})})}import*as _n from"react";import{jsx as ps,jsxs as J0}from"react/jsx-runtime";function jT({className:e,fetcher:t,value:a,onChange:r,initialOptions:o=[],debounceMs:n=300,cache:i=!0,searchPlaceholder:c="\u641C\u7D22...",placeholder:s="\u8BF7\u9009\u62E9",minKeywordLength:d=0,disabled:m=!1,size:u="md",...p}){let[f,x]=_n.useState(!1),[v,N]=_n.useState(""),[h,b]=_n.useState(o),[g,y]=_n.useState(!1),[k,w]=_n.useState(null),R=_n.useRef(new Map);_n.useEffect(()=>{if(!f)return;if(v.length<d){b(o);return}if(i&&R.current.has(v)){b(R.current.get(v));return}let M=setTimeout(()=>{let $=!1;return y(!0),w(null),t(v).then(I=>{$||(i&&R.current.set(v,I),b(I))}).catch(I=>{$||w(I instanceof Error?I.message:"\u67E5\u8BE2\u5931\u8D25")}).finally(()=>{$||y(!1)}),()=>{$=!0}},n);return()=>clearTimeout(M)},[v,f,t,n,i,d,o]);let S=_n.useRef(void 0),z=h.find(M=>String(M.value)===String(a)),L=z??S.current;z&&(S.current=z);let H=u==="sm"?"sm":"default";return ps("div",{"data-slot":"remote-select",className:l("w-full",e),...p,children:J0(Pe,{value:a!==void 0?String(a):void 0,onValueChange:M=>{if(M!=null){let $=h.find(I=>String(I.value)===String(M));$&&(S.current=$),r?.(M)}},open:f,onOpenChange:x,children:[ps(Re,{size:H,className:"w-full",children:ps(Te,{placeholder:s,children:L?.label??s})}),J0(Se,{className:"min-w-[var(--anchor-width)]",children:[ps("div",{className:"p-2",onClick:M=>M.stopPropagation(),children:ps(T,{value:v,onChange:M=>N(M.target.value),placeholder:c,className:"h-8",autoFocus:!0})}),k&&ps("div",{className:"px-3 py-2 text-xs text-destructive",children:k}),g?ps("div",{className:"p-2",children:ps(ut,{className:"h-6 w-full"})}):h.length===0?ps("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:v?"\u65E0\u5339\u914D\u9879":"\u8F93\u5165\u5173\u952E\u8BCD\u641C\u7D22"}):h.map(M=>ps(ve,{value:String(M.value),disabled:M.disabled,children:M.label},String(M.value)))]})]})})}import*as eN from"react";import{jsx as uf,jsxs as cv}from"react/jsx-runtime";var Z0=class extends eN.Component{constructor(){super(...arguments);ad(this,"state",{hasError:!1,error:null});ad(this,"reset",()=>{this.setState({hasError:!1,error:null})})}static getDerivedStateFromError(a){return{hasError:!0,error:a}}componentDidCatch(a,r){this.props.onError?.(a,r)}render(){if(this.state.hasError){let{fallback:a,className:r}=this.props;return typeof a=="function"?a(this.state.error,this.reset):a||cv("div",{"data-slot":"error-boundary",className:l("flex flex-col items-center justify-center gap-3 rounded-md border border-destructive/30 bg-destructive/5 p-8 text-center",r),children:[uf(jt,{className:"size-8 text-destructive"}),cv("div",{className:"space-y-1",children:[uf("h3",{className:"text-sm font-semibold",children:"\u7EC4\u4EF6\u51FA\u9519\u4E86"}),uf("p",{className:"text-xs text-muted-foreground",children:this.state.error?.message??"\u53D1\u751F\u672A\u77E5\u9519\u8BEF"})]}),cv(C,{size:"sm",variant:"outline",onClick:this.reset,children:[uf(ia,{}),"\u91CD\u8BD5"]})]})}return this.props.children}};import*as ff from"react";import"react";import{jsx as qt,jsxs as Qc}from"react/jsx-runtime";function pf({columns:e,data:t,onChange:a,minRows:r=1,maxRows:o=999,rowKey:n="id",footer:i,summaryKeys:c,readOnly:s=!1,loading:d=!1,className:m}){let u=(h,b,g)=>{let y=[...t];y[h]={...y[h],[b]:g};for(let k of e)k.compute&&(y[h]={...y[h],[k.key]:k.compute(y[h],y)});a?.(y)},p=()=>{if(t.length>=o)return;let h={[n]:crypto.randomUUID()};for(let b of e)b.defaultValue!==void 0&&(h[b.key]=b.defaultValue);a?.([...t,h])},f=h=>{if(t.length<=r)return;let b=t.filter((g,y)=>y!==h);a?.(b)},x={};if(c)for(let h of c)x[h]=t.reduce((b,g)=>b+(Number(g[h])||0),0);if(d)return qt("div",{className:l("space-y-2",m),children:Array.from({length:3}).map((h,b)=>qt("div",{className:"flex gap-3",children:e.map((g,y)=>qt("div",{className:"h-8 animate-pulse rounded bg-muted",style:{width:g.width||120}},y))},b))});let v={left:"text-left",center:"text-center",right:"text-right"},N=(h,b,g,y)=>h.render?h.render(b,g,y):h.editRender&&!s&&h.editable!==!1?h.editRender(b,g,k=>u(y,h.key,k)):h.type==="number"?b!=null?Number(b).toLocaleString():"-":(h.type==="custom",b!=null?String(b):"-");return Qc("div",{"data-slot":"line-editor",className:l("space-y-2",m),children:[qt("div",{className:"overflow-x-auto rounded-md border",children:Qc(ze,{children:[qt(Ae,{children:Qc(W,{children:[qt(E,{className:"w-10 text-center",children:"#"}),e.map(h=>qt(E,{className:v[h.align||"left"],style:{width:h.width,minWidth:h.width},children:h.title},h.key)),!s&&qt(E,{className:"w-16 text-center",children:"\u64CD\u4F5C"})]})}),qt(ke,{children:t.length===0?qt(W,{children:qt(D,{colSpan:e.length+(s?1:2),className:"py-8 text-center text-muted-foreground",children:"\u6682\u65E0\u660E\u7EC6\u884C\uFF0C\u70B9\u51FB\u4E0B\u65B9\u201C\u6DFB\u52A0\u884C\u201D\u5F00\u59CB"})}):t.map((h,b)=>Qc(W,{children:[qt(D,{className:"text-center text-sm text-muted-foreground",children:b+1}),e.map(g=>qt(D,{className:v[g.align||"left"],children:N(g,h[g.key],h,b)},g.key)),!s&&qt(D,{className:"text-center",children:qt(C,{variant:"ghost",size:"icon-sm",disabled:t.length<=r,onClick:()=>f(b),className:"text-muted-foreground hover:text-destructive",children:qt("svg",{className:"size-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:qt("path",{d:"M3 6h18M8 6V4a2 2 0 012-2h4a2 2 0 012 2v2m3 0v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6h14"})})})})]},String(h[n]||b)))}),c&&c.length>0&&t.length>0&&qt(ke,{children:Qc(W,{className:"border-t-2 bg-muted/50 font-medium",children:[qt(D,{className:"text-center",children:"\u5408\u8BA1"}),e.map(h=>qt(D,{className:v[h.align||"left"],children:c.includes(h.key)?Number(x[h.key]||0).toLocaleString():""},h.key)),!s&&qt(D,{})]})})]})}),!s&&Qc("div",{className:"flex items-center gap-2",children:[qt(C,{variant:"outline",size:"sm",disabled:t.length>=o,onClick:p,children:"\u6DFB\u52A0\u884C"}),i]}),i&&s&&qt("div",{children:i})]})}import{jsx as wd,jsxs as gf}from"react/jsx-runtime";function SV({className:e,data:t,defaultData:a=[],onChange:r,categories:o=[],readOnly:n=!1,minRows:i=1,maxRows:c,currency:s="\xA5",...d}){let m=t!==void 0,[u,p]=ff.useState(a),f=m?t:u,x=ff.useMemo(()=>[...o.length>0?[{key:"category",title:"Category",width:150,editable:!n,renderEditor:(b,g,y,k)=>gf("select",{value:String(b??""),onChange:w=>k(w.target.value),className:"h-8 w-full rounded border border-input bg-background px-2 text-sm",children:[wd("option",{value:"",children:"Select category"}),o.map(w=>wd("option",{value:w.value,children:w.label},w.value))]}),render:b=>o.find(y=>y.value===b)?.label??b??"\u2014"}]:[],{key:"summary",title:"Summary",editable:!n,renderEditor:(b,g,y,k)=>wd(T,{value:String(b??""),onChange:w=>k(w.target.value),placeholder:"Enter summary",className:"h-8"}),render:b=>b??"\u2014"},{key:"amount",title:`Amount (${s})`,width:140,editable:!n,renderEditor:(b,g,y,k)=>wd(ri,{value:b,onChange:w=>k(w??0),min:0,precision:2,size:"sm",className:"w-full"}),render:b=>b!=null?`${s}${Number(b).toFixed(2)}`:"\u2014"},{key:"remark",title:"Remark",editable:!n,renderEditor:(b,g,y,k)=>wd(T,{value:String(b??""),onChange:w=>k(w.target.value),placeholder:"Optional",className:"h-8"})}],[o,n,s]),v=b=>{let g=b;m||p(g),r?.(g)},N=f.reduce((b,g)=>b+Number(g.amount??0),0),h=gf("td",{colSpan:x.length+1,className:"px-3 py-2 text-right",children:[gf("span",{className:"mr-6 text-muted-foreground",children:[f.length," items"]}),gf("span",{className:"text-base font-semibold",children:["Total: ",s,N.toFixed(2)]})]});return wd("div",{"data-slot":"expense-line-editor",className:l("w-full",e),...d,children:wd(pf,{columns:x,data:f,onChange:v,readOnly:n,minRows:i,maxRows:c,footer:h,emptyText:"No expense items added"})})}import{useTranslation as KT}from"react-i18next";import{jsx as Lr,jsxs as fi}from"react/jsx-runtime";function EV({name:e,status:t="running",hypothesis:a,variants:r,primaryMetric:o,className:n}){let{t:i}=KT("marketing"),c=o??i("experimentSummary.primaryMetric");return fi(Y,{"data-slot":"experiment-summary",className:n,children:[fi(le,{children:[fi(ie,{className:"flex items-center gap-2",children:[Lr(Ng,{className:"size-4"}),e,Lr(B,{variant:"secondary",children:i(`experimentSummary.status.${t}`)})]}),a&&Lr(Ga,{children:a})]}),fi(J,{className:"space-y-3",children:[Lr("div",{className:"text-xs font-medium text-muted-foreground",children:c}),Lr("div",{className:"overflow-hidden rounded-lg border",children:fi("table",{className:"w-full text-sm",children:[Lr("thead",{className:"bg-muted/30 text-xs text-muted-foreground",children:fi("tr",{children:[Lr("th",{className:"px-3 py-2 text-left font-medium",children:i("experimentSummary.variant")}),Lr("th",{className:"px-3 py-2 text-right font-medium",children:i("experimentSummary.sample")}),Lr("th",{className:"px-3 py-2 text-right font-medium",children:i("experimentSummary.rate")}),Lr("th",{className:"px-3 py-2 text-right font-medium",children:i("experimentSummary.lift")})]})}),Lr("tbody",{children:r.map(s=>fi("tr",{className:l("border-t",s.winner&&"bg-success/10"),children:[Lr("td",{className:"px-3 py-2 font-medium",children:fi("span",{className:"inline-flex items-center gap-2",children:[s.name,s.winner&&Lr(B,{className:"bg-success text-success-foreground",children:i("experimentSummary.winner")})]})}),Lr("td",{className:"px-3 py-2 text-right tabular-nums",children:(s.sampleSize??0).toLocaleString()}),fi("td",{className:"px-3 py-2 text-right tabular-nums",children:[(s.conversionRate??0).toFixed(2),"%"]}),Lr("td",{className:"px-3 py-2 text-right tabular-nums",children:s.lift===void 0?"-":`${s.lift>0?"+":""}${s.lift.toFixed(1)}%`})]},s.id))})]})})]})]})}import*as aN from"react";import{useTranslation as QT}from"react-i18next";import{toast as XT}from"sonner";import{jsx as bi,jsxs as bf}from"react/jsx-runtime";function tN(e){if(e==null)return"";let t=String(e);return/[",\n]/.test(t)?`"${t.replace(/"/g,'""')}"`:t}function mv(e,t){let a=URL.createObjectURL(e),r=document.createElement("a");r.href=a,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(a)}function qV({data:e,filename:t="export",formats:a=["csv","xlsx","json"],columns:r,className:o,size:n="default",variant:i="outline",label:c,onExport:s}){let{t:d}=QT("upload"),m=c??d("exportButton.label"),u=aN.useCallback(()=>r||(e.length===0?[]:Object.keys(e[0]).map(b=>({key:b,header:b}))),[r,e]),p=()=>{let b=u(),g=b.map(w=>tN(w.header)).join(","),y=e.map(w=>b.map(R=>tN(R.format?R.format(w[R.key]):w[R.key])).join(",")),k="\uFEFF"+[g,...y].join(`
|
|
8
|
+
`);mv(new Blob([k],{type:"text/csv;charset=utf-8"}),`${t}.csv`)},N={csv:p,xlsx:()=>{let b=u(),g=e.map(k=>b.map(w=>(w.format?w.format(k[w.key]):k[w.key])??"")),y=[b.map(k=>k.header).join(" "),...g.map(k=>k.join(" "))].join(`
|
|
9
|
+
`);mv(new Blob([y],{type:"application/vnd.ms-excel"}),`${t}.xls`)},json:()=>{let b=JSON.stringify(e,null,2);mv(new Blob([b],{type:"application/json"}),`${t}.json`)},pdf:p,print:()=>{if(typeof window>"u")return;let b=u(),g=window.open("","_blank");if(!g){XT.error(d("exportButton.popupBlocked"));return}let y=`
|
|
10
|
+
<style>
|
|
11
|
+
body { font-family: system-ui, -apple-system, sans-serif; padding: 24px; color: #111; }
|
|
12
|
+
h1 { font-size: 18px; margin-bottom: 12px; }
|
|
13
|
+
table { width: 100%; border-collapse: collapse; font-size: 12px; }
|
|
14
|
+
th, td { border: 1px solid #ddd; padding: 6px 8px; text-align: left; }
|
|
15
|
+
th { background: #f5f5f5; }
|
|
16
|
+
</style>
|
|
17
|
+
`,k=b.map(R=>`<th>${R.header}</th>`).join(""),w=e.map(R=>`<tr>${b.map(S=>`<td>${S.format?S.format(R[S.key]):R[S.key]??""}</td>`).join("")}</tr>`).join("");g.document.write(`<html><head><title>${t}</title>${y}</head><body><h1>${t}</h1><table><thead><tr>${k}</tr></thead><tbody>${w}</tbody></table></body></html>`),g.document.close(),g.print()}};if(a.length===1){let b=a[0];return b?bf(C,{"data-slot":"export-button",variant:i,size:n,className:o,onClick:()=>{N[b](),s?.(b,e)},children:[bi(qa,{}),m]}):null}let h={csv:d("exportButton.csv"),xlsx:d("exportButton.xlsx"),json:d("exportButton.json"),pdf:d("exportButton.pdf"),print:d("exportButton.print")};return bf(sr,{"data-slot":"export-button",children:[bf(ir,{render:bi(C,{variant:i,size:n,className:l(o)}),children:[bi(qa,{}),m]}),bi(lr,{align:"end",children:a.map(b=>bf(la,{onClick:()=>{N[b](),s?.(b,e)},children:[b==="csv"&&bi(Rt,{}),b==="xlsx"&&bi(dg,{}),b==="json"&&bi(Rt,{}),b==="pdf"&&bi(Rt,{}),b==="print"&&bi(as,{}),h[b]]},b))})]})}import*as rN from"react";import{jsx as Xc,jsxs as JT}from"react/jsx-runtime";var YT={phone:e=>e.length>=11?`${e.slice(0,3)}****${e.slice(-4)}`:e,idcard:e=>e.length>=18?`${e.slice(0,4)}**********${e.slice(-4)}`:e,bankcard:e=>e.length>=16?`${e.slice(0,4)} **** **** ${e.slice(-4)}`:e,email:e=>{let t=e.indexOf("@");return t<=1?e:`${e[0]}***${e.slice(t)}`},name:e=>e.length<=1?e:e.length===2?`${e[0]}*`:`${e[0]}${"*".repeat(e.length-2)}${e[e.length-1]}`,custom:e=>e};function JV({value:e,mask:t="phone",canView:a=!1,className:r}){let[o,n]=rN.useState(!1),[,i]=un(),c=typeof t=="function"?t:YT[t],s=a||o?e:c(e);return JT("span",{"data-slot":"field-mask",className:l("inline-flex items-center gap-1.5 font-mono text-sm",r),children:[Xc("span",{className:"select-none",children:s}),!a&&Xc(C,{variant:"ghost",size:"icon-xs",className:"size-5",onClick:()=>n(!o),title:o?"\u9690\u85CF":"\u67E5\u770B",children:o?Xc(Oh,{className:"size-3"}):Xc(Fn,{className:"size-3"})}),Xc(C,{variant:"ghost",size:"icon-xs",className:"size-5",onClick:()=>i(e),title:"\u590D\u5236",children:Xc(zt,{className:"size-3"})})]})}import*as oN from"react";import{jsx as At,jsxs as Qa}from"react/jsx-runtime";function o8({files:e=[],onFilesChange:t,accept:a,maxFiles:r=10,maxSize:o,className:n}){let[i,c]=oN.useState("list"),s=p=>{t?.([...e,...p.map(f=>({file:f,name:f.name,size:f.size,type:f.type,status:"pending",progress:0}))])},d=p=>{t?.(e.filter((f,x)=>x!==p))},m=()=>t?.([]),u=p=>p==null?null:Math.min(Math.max(p,0),100);return Qa("div",{"data-slot":"file-upload-manager",className:l("space-y-4",n),children:[At(uu,{onDrop:s,...a!==void 0?{accept:a}:{},maxFiles:r,...o!==void 0?{maxSize:o}:{}}),e.length>0&&Qa("div",{className:"space-y-3",children:[Qa("div",{className:"flex items-center justify-between",children:[Qa("div",{className:"flex items-center gap-2",children:[Qa("span",{className:"text-sm font-medium",children:[e.length," file(s)"]}),Qa(B,{variant:"secondary",children:[(e.reduce((p,f)=>p+(f.size||0),0)/1024).toFixed(1)," ","KB"]})]}),Qa("div",{className:"flex items-center gap-1",children:[At(C,{variant:i==="list"?"secondary":"ghost",size:"icon-xs",onClick:()=>c("list"),children:At(wc,{className:"size-3.5"})}),At(C,{variant:i==="grid"?"secondary":"ghost",size:"icon-xs",onClick:()=>c("grid"),children:At(mg,{className:"size-3.5"})}),At(C,{variant:"ghost",size:"icon-xs",onClick:m,children:At(ye,{className:"size-3.5 text-destructive"})})]})]}),i==="list"?At("div",{className:"space-y-2",children:e.map((p,f)=>{let x=u(p.progress),v=p.status==="uploading"||x!==null&&x<100,N=x===100||p.status==="done"||p.status==="complete";return Qa("div",{className:l("group flex items-center gap-3 rounded-lg border px-3 py-2",N&&"bg-success/5"),children:[Qa("div",{className:"min-w-0 flex-1",children:[Qa("div",{className:"flex items-center gap-2",children:[At("span",{className:"text-sm font-medium truncate",children:p.name}),Qa("span",{className:"text-xs text-muted-foreground shrink-0",children:[(p.size/1024).toFixed(1)," KB"]}),v&&x!==null&&Qa("span",{className:"text-xs text-muted-foreground shrink-0 tabular-nums",children:[x,"%"]}),N&&At(B,{variant:"secondary",className:"shrink-0 text-[0.65rem] px-1.5 py-0",children:"Done"})]}),v&&x!==null&&At(cr,{value:x,className:"mt-1.5 h-1.5"})]}),At(C,{variant:"ghost",size:"icon-xs",onClick:()=>d(f),className:"shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",children:At(ye,{className:"size-3.5"})})]},f)})}):At("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-3",children:e.map((p,f)=>{let x=u(p.progress),v=p.status==="uploading"||x!==null&&x<100,N=x===100||p.status==="done"||p.status==="complete";return Qa("div",{className:l("group relative rounded-lg border overflow-hidden",N&&"border-success/30"),children:[p.type?.startsWith("image/")?At("div",{className:"aspect-square bg-muted flex items-center justify-center text-xs text-muted-foreground",children:"Image"}):At("div",{className:"aspect-square bg-muted flex items-center justify-center",children:At("span",{className:"text-xs text-muted-foreground uppercase font-medium",children:p.name?.split(".").pop()||"File"})}),v&&x!==null&&Qa("div",{className:"absolute inset-x-0 bottom-0 bg-background/80 backdrop-blur-sm px-2 py-1.5",children:[At("div",{className:"flex items-center justify-between text-xs mb-1",children:Qa("span",{className:"tabular-nums",children:[x,"%"]})}),At(cr,{value:x,className:"h-1.5"})]}),N&&At("div",{className:"absolute top-1 right-1",children:At(B,{variant:"secondary",className:"text-[0.6rem] px-1 py-0",children:"Done"})}),Qa("div",{className:"p-2",children:[At("p",{className:"text-xs truncate font-medium",children:p.name}),Qa("p",{className:"text-xs text-muted-foreground",children:[(p.size/1024).toFixed(1)," KB"]})]}),At(C,{variant:"ghost",size:"icon-xs",onClick:()=>d(f),className:"absolute top-1 right-1 size-5 rounded-full bg-destructive p-0 text-destructive-foreground opacity-0 hover:bg-destructive/80 group-hover:opacity-100 transition-opacity",children:At(ye,{className:"size-3"})})]},f)})})]})]})}import{jsx as Yc,jsxs as nN}from"react/jsx-runtime";function c8({title:e="\u6682\u65E0\u8BBF\u95EE\u6743\u9650",description:t="\u60A8\u6CA1\u6709\u8BBF\u95EE\u6B64\u5185\u5BB9\u7684\u6743\u9650\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u6216\u7533\u8BF7\u6743\u9650\u3002",onRequestAccess:a,code:r,className:o}){return nN("div",{"data-slot":"forbidden",className:l("flex flex-col items-center justify-center","rounded-lg border border-dashed border-border","bg-muted/30 p-12 text-center",o),children:[Yc("div",{className:"mb-4 flex size-16 items-center justify-center rounded-full bg-muted",children:Yc(pg,{className:"size-8 text-muted-foreground"})}),Yc("h3",{className:"mb-2 text-lg font-semibold text-foreground",children:e}),Yc("p",{className:"mb-6 max-w-sm text-sm text-muted-foreground",children:t}),r&&nN("p",{className:"mb-4 text-xs text-muted-foreground",children:["\u6743\u9650\u7801: ",Yc("code",{className:"rounded bg-muted px-1 py-0.5 font-mono",children:r})]}),a&&Yc(C,{variant:"outline",onClick:a,children:"\u7533\u8BF7\u6743\u9650"})]})}import"react";import{jsx as uv,jsxs as sN}from"react/jsx-runtime";function iN({label:e,description:t,error:a,required:r,children:o,className:n}){return sN("div",{"data-slot":"form-field",className:l("space-y-1.5",n),children:[e&&sN(ue,{children:[e,r&&uv("span",{className:"text-destructive",children:"*"})]}),o,t&&!a&&uv("p",{className:"text-xs text-muted-foreground",children:t}),a&&uv("p",{className:"text-xs text-destructive",children:a})]})}import*as xf from"react";import{useTranslation as ZT}from"react-i18next";import{Fragment as lN,jsx as yl,jsxs as Jc}from"react/jsx-runtime";function dN({steps:e,onComplete:t,className:a}){let{t:r}=ZT("navigation"),[o,n]=xf.useState(0),[i,c]=xf.useState({}),[s,d]=xf.useState({}),m=e[o]??{title:"",render:()=>null},u=o===0,p=o===e.length-1,f=()=>{if(!m.validate)return!0;let h=m.validate?m.validate(i):{};return d(h),Object.keys(h).length===0},x=()=>{f()&&(p?t?.(i):n(h=>h+1))},v=()=>{d({}),n(h=>h-1)},N=(h,b)=>{c(g=>({...g,[h]:b})),s[h]&&d(g=>{let y={...g};return delete y[h],y})};return Jc("div",{"data-slot":"form-wizard",className:l("space-y-6",a),children:[yl(gu,{activeStep:o,children:e.map(h=>yl(ll,{children:h.title},h.title))}),Jc("div",{className:"min-h-[200px] rounded-lg border p-6",children:[yl("h3",{className:"text-lg font-semibold mb-1",children:m.title}),m.description&&yl("p",{className:"text-sm text-muted-foreground mb-4",children:m.description}),m.render({formData:i,updateField:N,errors:s})]}),Jc("div",{className:"flex justify-between",children:[Jc(C,{variant:"outline",onClick:v,disabled:u,children:[yl(et,{className:"size-4 mr-1"}),r("formWizard.back")]}),yl(C,{onClick:x,children:p?Jc(lN,{children:[yl(U,{className:"size-4 mr-1"})," ",r("formWizard.submit")]}):Jc(lN,{children:[r("formWizard.next")," ",yl(me,{className:"size-4 ml-1"})]})})]})]})}import"react";import{jsx as Zc,jsxs as em}from"react/jsx-runtime";var cN={default:"stroke-primary",success:"stroke-success",warning:"stroke-warning",destructive:"stroke-destructive"};function T8({value:e,min:t=0,max:a=100,size:r=160,strokeWidth:o=12,label:n,showValue:i=!0,formatValue:c,variant:s="default",className:d,...m}){let u=Math.max(t,Math.min(a,e)),p=(u-t)/(a-t),f=(r-o)/2,x=r/2,v=r/2,N=135,h=405,b=h-N,g=N+b*p,y=$=>{let I=$*Math.PI/180;return{x:x+f*Math.cos(I),y:v+f*Math.sin(I)}},k=y(N),w=y(h),R=y(g),S=b>180?1:0,z=g-N>180?1:0,L=`M ${k.x} ${k.y} A ${f} ${f} 0 ${S} 1 ${w.x} ${w.y}`,H=`M ${k.x} ${k.y} A ${f} ${f} 0 ${z} 1 ${R.x} ${R.y}`,M=c?c(u):`${Math.round(p*100)}%`;return em("div",{"data-slot":"gauge",role:"meter","aria-valuemin":t,"aria-valuemax":a,"aria-valuenow":u,className:l("relative inline-flex flex-col items-center justify-center",d),style:{width:r,height:r},...m,children:[em("svg",{width:r,height:r,className:"-rotate-90",children:[Zc("path",{d:L,fill:"none",className:"stroke-muted",strokeWidth:o,strokeLinecap:"round"}),Zc("path",{d:H,fill:"none",className:l(cN[s],"transition-all duration-500"),strokeWidth:o,strokeLinecap:"round"})]}),em("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[i&&Zc("div",{className:"text-2xl font-semibold tabular-nums",children:M}),n&&Zc("div",{className:"mt-1 text-xs text-muted-foreground",children:n})]})]})}function R8({value:e,size:t=48,strokeWidth:a=4,showValue:r=!0,variant:o="default",className:n,...i}){let c=Math.max(0,Math.min(100,e)),s=(t-a)/2,d=2*Math.PI*s,m=d-c/100*d;return em("div",{"data-slot":"radial-progress",role:"progressbar","aria-valuenow":c,"aria-valuemin":0,"aria-valuemax":100,className:l("relative inline-flex items-center justify-center",n),style:{width:t,height:t},...i,children:[em("svg",{width:t,height:t,className:"-rotate-90",children:[Zc("circle",{cx:t/2,cy:t/2,r:s,fill:"none",className:"stroke-muted",strokeWidth:a}),Zc("circle",{cx:t/2,cy:t/2,r:s,fill:"none",className:l("transition-all duration-500",cN[o]),strokeWidth:a,strokeDasharray:d,strokeDashoffset:m,strokeLinecap:"round"})]}),r&&em("div",{className:"absolute inset-0 flex items-center justify-center text-[0.65rem] font-medium tabular-nums",children:[Math.round(c),"%"]})]})}import*as tm from"react";import{useTranslation as eR}from"react-i18next";import{jsx as xi,jsxs as vf}from"react/jsx-runtime";function pv(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function mN(e){let t=new Date(e);return t.setHours(0,0,0,0),t}function tR(e,t,a,r){let o=[],n=new Date(t),c=(n.getDay()-r+7)%7;n.setDate(n.getDate()-c);let s=0,d=new Date(n);for(;d<=a||d.getDay()!==r;){if(d>=t&&d<=a){let u=pv(d),p=e.get(u)??0;o.push({week:s,day:d.getDay(),date:new Date(d),value:p})}if(d.setDate(d.getDate()+1),d.getDay()===r&&s++,d.getFullYear()>a.getFullYear()+1)break}return o}function B8({data:e,startDate:t,endDate:a,weekStartsOn:r=0,cellSize:o=12,gap:n=2,levels:i=5,className:c,showLegend:s=!0,colorStops:d}){let{t:m}=eR("chart"),[u]=tm.useState(()=>Date.now()),p=mN(t??new Date(u-365*24*60*60*1e3)),f=mN(a??new Date(u)),x=tm.useMemo(()=>{let R=new Map;for(let S of e)R.set(pv(S.date instanceof Date?S.date:new Date(S.date)),S.value);return R},[e]),v=tm.useMemo(()=>tR(x,p,f,r),[x,p,f,r]),N=Math.max(1,...e.map(R=>R.value)),h=v.reduce((R,S)=>Math.max(R,S.week),0)+1,b=R=>R<=0?0:Math.min(i,Math.max(1,Math.ceil(R/N*i))),g=d??["#ebedf0","#9be9a8","#40c463","#30a14e","#216e39"],y=R=>R===0?"var(--hm-0, "+g[0]+")":"var(--hm-"+R+", "+g[R]+")",k=tm.useMemo(()=>{let R=[],S=-1;return v.forEach(z=>{let L=z.date.getMonth();L!==S&&z.day===r&&(R.push({x:z.week*(o+n),label:m("heatmapCalendar.monthLabel",{count:z.date.getMonth()+1})}),S=L)}),R},[v,o,n,r,m]),w=r===0?["",m("heatmapCalendar.day.mon"),"",m("heatmapCalendar.day.wed"),"",m("heatmapCalendar.day.fri"),""]:[m("heatmapCalendar.day.sun"),"",m("heatmapCalendar.day.tue"),"",m("heatmapCalendar.day.thu"),"",m("heatmapCalendar.day.sat")];return vf("div",{"data-slot":"heatmap-calendar",className:l("inline-block",c),style:{"--hm-0":g[0],"--hm-1":g[1],"--hm-2":g[2],"--hm-3":g[3],"--hm-4":g[4],"--hm-5":g[4]},children:[vf("div",{className:"flex",style:{gap:n},children:[xi("div",{className:"flex flex-col text-[0.6rem] text-muted-foreground",style:{gap:n,paddingTop:o+n+4},children:w.map((R,S)=>xi("div",{style:{height:o,lineHeight:`${o}px`},children:R},S))}),vf("div",{className:"flex-1",children:[xi("div",{className:"relative mb-1 h-4 text-[0.6rem] text-muted-foreground",children:k.map((R,S)=>xi("span",{className:"absolute",style:{left:R.x},children:R.label},S))}),xi("div",{className:"grid",style:{gridTemplateColumns:`repeat(${h}, ${o}px)`,gridAutoRows:o,gap:n},children:v.map(R=>{let S=b(R.value);return xi("div",{className:"rounded-sm",style:{width:o,height:o,backgroundColor:y(S)},title:`${pv(R.date)}: ${R.value}`},`${R.week}-${R.day}`)})})]})]}),s&&vf("div",{className:"mt-2 flex items-center justify-end gap-1 text-[0.6rem] text-muted-foreground",children:[xi("span",{children:m("heatmapCalendar.less")}),Array.from({length:i}).map((R,S)=>xi("span",{className:"inline-block rounded-sm",style:{width:o,height:o,backgroundColor:y(S)}},S)),xi("span",{children:m("heatmapCalendar.more")})]})]})}import*as Fu from"react";import{jsx as gs,jsxs as gv}from"react/jsx-runtime";function V8({value:e,placeholder:t="Empty",multiline:a,disabled:r,validate:o,onSave:n,renderValue:i,className:c,...s}){let[d,m]=Fu.useState(!1),[u,p]=Fu.useState(e),[f,x]=Fu.useState(),[v,N]=Fu.useState(!1),h=async()=>{let g=o?.(u);if(x(g),!g){N(!0);try{await n?.(u),m(!1)}finally{N(!1)}}};if(!d){let g=()=>{p(e),x(void 0),m(!0)};return gv("div",{"data-slot":"inline-edit",className:l("group/inline-edit inline-flex items-center gap-2",c),...s,children:[gs(C,{type:"button",variant:"ghost",size:"sm",disabled:r,className:"h-auto justify-start px-0 py-0 text-left font-normal",onClick:g,children:e?i?.(e)??e:gs("span",{className:"text-muted-foreground",children:t})}),!r&&gs(C,{type:"button",size:"icon-xs",variant:"ghost",className:"opacity-0 group-hover/inline-edit:opacity-100",onClick:g,"aria-label":"Edit value",children:gs(tl,{})})]})}let b=a?St:T;return gv("div",{"data-slot":"inline-edit",className:l("space-y-1.5",c),...s,children:[gv("div",{className:"flex items-start gap-2",children:[gs(b,{value:u,"aria-invalid":!!f,disabled:v,onChange:g=>{p(g.target.value),x(void 0)},onKeyDown:g=>{!a&&g.key==="Enter"&&h(),g.key==="Escape"&&m(!1)}}),gs(C,{type:"button",size:"icon-sm",onClick:h,disabled:v,"aria-label":"Save value",children:gs(U,{})}),gs(C,{type:"button",size:"icon-sm",variant:"outline",onClick:()=>m(!1),disabled:v,"aria-label":"Cancel editing",children:gs(Q,{})})]}),f&&gs("p",{className:"text-xs text-destructive",children:f})]})}import*as hf from"react";import{jsx as pN}from"react/jsx-runtime";function uN(e){try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function q8({value:e,onChange:t,placeholder:a,readOnly:r,minHeight:o=200,maxHeight:n,autoFormat:i,className:c,onFocus:s,onBlur:d}){let m=hf.useMemo(()=>i?uN(e):e,[i,e]),u=hf.useCallback(p=>{t?.(i?uN(p):p)},[t,i]);return pN("div",{"data-slot":"json-editor",className:l("relative",c),children:pN(df,{value:m,onChange:u,language:"json",placeholder:a??'{ "key": "value" }',readOnly:r,minHeight:o,maxHeight:n,onFocus:s,onBlur:d})})}import*as yf from"react";import{useTranslation as aR}from"react-i18next";import{jsx as It,jsxs as eo}from"react/jsx-runtime";function rR(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function vi({name:e}){return eo("span",{className:"text-primary",children:['"',e,'": ']})}function fv({value:e,keyName:t,depth:a=0,defaultCollapsedDepth:r=3,isLast:o=!0}){let[n,i]=yf.useState(a<r);if(e===null)return eo("span",{children:[t!==void 0&&It(vi,{name:t}),It("span",{className:"text-muted-foreground",children:"null"}),!o&&" "]});if(typeof e=="string")return eo("span",{children:[t!==void 0&&It(vi,{name:t}),eo("span",{className:"text-success",children:['"',e,'"']}),!o&&" "]});if(typeof e=="number")return eo("span",{children:[t!==void 0&&It(vi,{name:t}),It("span",{className:"text-info",children:String(e)}),!o&&" "]});if(typeof e=="boolean")return eo("span",{children:[t!==void 0&&It(vi,{name:t}),It("span",{className:"text-warning",children:String(e)}),!o&&" "]});if(Array.isArray(e))return e.length===0?eo("span",{children:[t!==void 0&&It(vi,{name:t}),It("span",{className:"text-muted-foreground",children:"[]"}),!o&&" "]}):eo("div",{children:[t!==void 0&&It(vi,{name:t}),eo(C,{type:"button",variant:"ghost",size:"sm",onClick:()=>i(c=>!c),className:"h-auto px-1 py-0 font-mono text-xs text-muted-foreground hover:text-foreground",children:[n?"\u25BC":"\u25B6"," [",e.length,"]"]}),n&&It("div",{className:"ml-4 border-l pl-3",children:e.map((c,s)=>It("div",{children:It(fv,{value:c,keyName:String(s),depth:a+1,defaultCollapsedDepth:r,isLast:s===e.length-1})},s))})]});if(rR(e)){let c=Object.keys(e);return c.length===0?eo("span",{children:[t!==void 0&&It(vi,{name:t}),It("span",{className:"text-muted-foreground",children:"{}"}),!o&&" "]}):eo("div",{children:[t!==void 0&&It(vi,{name:t}),eo(C,{type:"button",variant:"ghost",size:"sm",onClick:()=>i(s=>!s),className:"h-auto px-1 py-0 font-mono text-xs text-muted-foreground hover:text-foreground",children:[n?"\u25BC":"\u25B6"," {",c.length,"}"]}),n&&It("div",{className:"ml-4 border-l pl-3",children:c.map((s,d)=>It("div",{children:It(fv,{value:e[s],keyName:s,depth:a+1,defaultCollapsedDepth:r,isLast:d===c.length-1})},s))})]})}return eo("span",{children:[t!==void 0&&It(vi,{name:t}),String(e),!o&&" "]})}function Z8({data:e,defaultCollapsedDepth:t=3,className:a,rootClassName:r,showCopy:o=!0,indentSize:n=2}){let{t:i}=aR("data"),[c,s]=un(),d=yf.useMemo(()=>JSON.stringify(e,null,n),[e,n]);return eo("div",{className:l("group relative",r),children:[o&&It(C,{variant:"ghost",size:"icon-xs",className:"absolute top-2 right-2 opacity-0 transition-opacity group-hover:opacity-100",onClick:()=>s(d),"aria-label":i("jsonViewer.copyJson"),children:c?It(U,{}):It(zt,{})}),It("div",{"data-slot":"json-viewer",className:l("overflow-auto rounded-md border bg-muted/30 p-3 text-xs font-mono leading-relaxed",a),children:It(fv,{value:e,defaultCollapsedDepth:t})})]})}import*as gN from"react";import{DndContext as oR,closestCorners as nR,PointerSensor as sR,useSensor as iR,useSensors as lR}from"@dnd-kit/core";import{SortableContext as dR,verticalListSortingStrategy as cR,useSortable as mR,arrayMove as uR}from"@dnd-kit/sortable";import{CSS as pR}from"@dnd-kit/utilities";import{Fragment as bR,jsx as za,jsxs as $u}from"react/jsx-runtime";function fN({columns:e,onColumnsChange:t,renderCard:a,className:r}){let o=lR(iR(sR,{activationConstraint:{distance:5}}));return za(oR,{"data-slot":"kanban-board",sensors:o,collisionDetection:nR,onDragEnd:i=>{let{active:c,over:s}=i;if(!s)return;let d=c.data.current,m=s.data.current;if(!d||!m)return;let u=d.columnId,p=m.type==="column"?m.columnId:m.columnId??u;if(!u||!p)return;let f=e.map(x=>({...x,items:[...x.items]}));if(u===p){let x=f.find(h=>h.id===u);if(!x)return;let v=x.items.findIndex(h=>h.id===c.id),N=x.items.findIndex(h=>h.id===s.id);v!==-1&&N!==-1&&(x.items=uR(x.items,v,N))}else{let x=f.find(b=>b.id===u),v=f.find(b=>b.id===p);if(!x||!v)return;let N=x.items.findIndex(b=>b.id===c.id);if(N===-1)return;let[h]=x.items.splice(N,1);if(!h)return;if(m.type==="column")v.items.push(h);else{let b=v.items.findIndex(g=>g.id===s.id);b===-1?v.items.push(h):v.items.splice(b,0,h)}}t?.(f)},children:za("div",{className:l("flex gap-4 overflow-x-auto pb-4",r),children:e.map(i=>za(gR,{column:i,...a?{renderCard:a}:{}},i.id))})})}function gR({column:e,renderCard:t}){let[a,r]=gN.useState(!1);return $u("div",{className:"flex w-72 shrink-0 flex-col rounded-lg border bg-muted/30",children:[$u("div",{className:"flex items-center justify-between p-3",children:[$u("div",{className:"flex items-center gap-2",children:[za("h3",{className:"text-sm font-semibold",children:e.title}),za(B,{variant:"secondary",className:"h-5 px-1.5 text-xs",children:e.items.length})]}),za(C,{variant:"ghost",size:"icon-xs",onClick:()=>r(!a),children:za(re,{className:l("size-4 transition-transform",a&&"-rotate-90")})})]}),za(yx,{open:!a,children:za(Nx,{children:za(dR,{items:e.items.map(o=>o.id),strategy:cR,children:za("div",{className:"flex flex-col gap-2 p-2 pt-0 min-h-[40px]",children:e.items.map(o=>za(fR,{item:o,columnId:e.id,...t?{renderCard:t}:{}},o.id))})})})})]})}function fR({item:e,columnId:t,renderCard:a}){let{attributes:r,listeners:o,setNodeRef:n,transform:i,transition:c,isDragging:s}=mR({id:e.id,data:{columnId:t,type:"card"}}),d={transform:pR.Transform.toString(i),transition:c,opacity:s?.5:1};return za("div",{ref:n,style:d,className:l("rounded-md border bg-background p-3 text-sm shadow-xs",s&&"shadow-md"),children:$u("div",{className:"flex items-start gap-2",children:[za(C,{variant:"ghost",size:"icon-xs",className:"mt-0.5 size-auto cursor-grab p-0 text-muted-foreground hover:bg-transparent hover:text-foreground",...r,...o,children:za(ts,{className:"size-3.5"})}),za("div",{className:"flex-1 min-w-0",children:a?a(e):$u(bR,{children:[za("p",{className:"font-medium truncate",children:e.title}),e.description&&za("p",{className:"text-xs text-muted-foreground mt-0.5",children:e.description})]})})]})})}import"react";import{ResponsiveContainer as xR,AreaChart as vR,Area as hR}from"recharts";import{jsx as zr,jsxs as hi}from"react/jsx-runtime";function fO({title:e,value:t,change:a,changeLabel:r,changeType:o="neutral",sparkline:n,target:i,targetLabel:c,icon:s,className:d}){let m={positive:_s,negative:Zn,neutral:Kr},u={positive:"text-success",negative:"text-destructive",neutral:"text-muted-foreground"},p=m[o]??_s;return hi(Y,{"data-slot":"kpi-card",className:l(d),children:[hi(le,{className:"flex flex-row items-center justify-between pb-2",children:[zr(ie,{className:"text-sm font-medium text-muted-foreground",children:e}),s&&zr(s,{className:"size-4 text-muted-foreground"})]}),hi(J,{children:[zr("div",{className:"text-2xl font-bold",children:t}),a!==void 0&&hi("div",{className:l("flex items-center gap-1 mt-1 text-xs",u[o]),children:[zr(p,{className:"size-3"}),zr("span",{className:"font-medium",children:a}),r&&zr("span",{className:"text-muted-foreground",children:r})]}),n&&n.length>0&&zr("div",{className:"h-10 mt-3",children:zr(xR,{width:"100%",height:"100%",children:hi(vR,{data:n,children:[zr("defs",{children:hi("linearGradient",{id:"sparkFill",x1:"0",y1:"0",x2:"0",y2:"1",children:[zr("stop",{offset:"0%",stopColor:"hsl(var(--primary))",stopOpacity:.3}),zr("stop",{offset:"100%",stopColor:"hsl(var(--primary))",stopOpacity:0})]})}),zr(hR,{type:"monotone",dataKey:"value",stroke:"hsl(var(--primary))",fill:"url(#sparkFill)",strokeWidth:1.5,dot:!1})]})})}),i!==void 0&&hi("div",{className:"mt-3",children:[hi("div",{className:"flex justify-between text-xs mb-1",children:[zr("span",{className:"text-muted-foreground",children:c??"Progress"}),hi("span",{className:"font-medium",children:[i,"%"]})]}),zr("div",{className:"h-1.5 rounded-full bg-muted overflow-hidden",children:zr("div",{className:"h-full bg-primary rounded-full transition-all",style:{width:i+"%"}})})]})]})]})}import{useMemo as kR}from"react";import{useTranslation as wR}from"react-i18next";import{createContext as yR,useCallback as hO,useContext as NR,useEffect as yO,useState as NO}from"react";import{jsx as kO}from"react/jsx-runtime";var CR=yR(null);function bN(){let e=NR(CR);if(!e)throw new Error("useLocale must be used within a LocaleProvider");return e}import{jsx as Nl,jsxs as am}from"react/jsx-runtime";function BO({value:e,onChange:t,options:a,className:r,align:o="end"}){let{t:n}=wR("language"),{locale:i,setLocale:c}=bN(),s=kR(()=>[{code:"zh-CN",label:n("language.zhCN.label"),nativeLabel:n("language.zhCN")},{code:"en-US",label:n("language.enUS.label"),nativeLabel:n("language.enUS")}],[n]),d=a??s,m=e??i,u=t??c,p=d.find(f=>f.code===m)??d[0];return am(sr,{"data-slot":"language-switcher",children:[am(ir,{render:Nl(C,{variant:"ghost",size:"sm",className:l("gap-1.5",r),"aria-label":n("languageSwitcher.switchLanguage")}),children:[Nl(ug,{}),Nl("span",{className:"text-xs",children:p?.nativeLabel??p?.code})]}),am(lr,{align:o,className:"w-56",children:[am(ns,{children:[Nl(nl,{children:n("languageSwitcher.selectLanguage")}),Nl(ss,{})]}),d.map(f=>am(la,{onClick:()=>u(f.code),className:"justify-between",children:[am("div",{className:"flex flex-col gap-0.5",children:[Nl("span",{className:"text-sm",children:f.nativeLabel??f.label}),f.nativeLabel&&f.nativeLabel!==f.label&&Nl("span",{className:"text-xs text-muted-foreground",children:f.label})]}),f.code===m&&Nl(U,{className:"size-4"})]},f.code))]})]})}import"react";import{useTranslation as PR}from"react-i18next";import{Fragment as SR,jsx as So,jsxs as Nf}from"react/jsx-runtime";function HO({title:e,description:t,icon:a,variant:r="spinner",className:o,...n}){let{t:i}=PR("transfer"),c=e??i("loadingPage.title");return Nf("div",{"data-slot":"loading-page",role:"status","aria-live":"polite",className:l("flex min-h-[60vh] flex-col items-center justify-center gap-3 px-4 text-center",o),...n,children:[a??(r==="spinner"?So(Pr,{className:"size-8 animate-spin text-muted-foreground"}):null),r==="dots"&&So(TR,{}),r==="pulse"&&So(RR,{}),Nf("div",{className:"space-y-1",children:[So("p",{className:"text-sm font-medium",children:c}),t&&So("p",{className:"text-xs text-muted-foreground",children:t})]})]})}function TR(){return So("div",{className:"flex items-center gap-1.5",children:[0,1,2].map(e=>So("span",{className:"size-2 animate-bounce rounded-full bg-muted-foreground",style:{animationDelay:`${e*.16}s`}},e))})}function RR(){return Nf("div",{className:"relative size-10",children:[So("span",{className:"absolute inset-0 animate-ping rounded-full bg-primary/30"}),So("span",{className:"absolute inset-2 rounded-full bg-primary"})]})}function VO({show:e=!0,children:t}){return e?Nf("div",{className:"relative min-h-screen",children:[t&&So("div",{className:"pointer-events-none opacity-50",children:t}),So("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm",children:So(Pr,{className:"size-8 animate-spin text-primary"})})]}):So(SR,{children:t})}import"react";import{useTranslation as IR}from"react-i18next";import{Fragment as BR,jsx as Io,jsxs as Cl}from"react/jsx-runtime";function DR({data:e,width:t=80,height:a=24,strokeWidth:r=1.5,className:o,color:n="currentColor",fill:i=!0}){if(e.length===0)return null;let c=Math.min(...e),d=Math.max(...e)-c||1,m=e.length>1?t/(e.length-1):t,u=e.map((f,x)=>`${x*m},${a-(f-c)/d*a}`).join(" "),p=`0,${a} ${u} ${t},${a}`;return Cl("svg",{viewBox:`0 0 ${t} ${a}`,width:t,height:a,className:l("overflow-visible",o),"aria-hidden":!0,children:[i&&Io("polygon",{points:p,className:"fill-current opacity-20"}),Io("polyline",{points:u,fill:"none",stroke:n,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round",className:"text-current"})]})}var MR={number:e=>q(e),percent:e=>bt(e),compact:e=>q(e,{notation:"compact"}),currency:e=>q(e,{style:"currency",currency:"CNY"})};function XO({label:e,value:t,unit:a,change:r,changeLabel:o,format:n="number",sparklineData:i=[],trendDirection:c="up-good",icon:s,loading:d,className:m,...u}){let{t:p}=IR("chart"),f=o??p("metricTrend.changeLabel"),x=typeof t=="number"?MR[n](t):t,v=r??0,N=v>0?"up":v<0?"down":"flat",b=(c==="up-good"?N==="up":c==="down-good"?N==="down":!1)?"success":N==="flat"?"default":"destructive";return Io(Y,{"data-slot":"metric-trend",className:l("overflow-hidden",m),...u,children:Cl(J,{className:"flex flex-col gap-2 p-4",children:[Cl("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[Cl("span",{className:"flex items-center gap-1.5",children:[s,e]}),r!==void 0&&r!==0&&Cl("span",{className:l("inline-flex items-center gap-0.5 rounded px-1 text-[0.65rem] font-medium",b==="success"&&"bg-success/10 text-success",b==="destructive"&&"bg-destructive/10 text-destructive",b==="default"&&"bg-muted text-muted-foreground"),children:[N==="up"&&Io(_s,{className:"size-3"}),N==="down"&&Io(Zn,{className:"size-3"}),N==="flat"&&Io(Kr,{className:"size-3"}),bt(Math.abs(v),1)]})]}),Cl("div",{className:"flex items-end justify-between gap-2",children:[Io("div",{className:"flex items-baseline gap-1",children:d?Io("div",{className:"h-7 w-20 animate-pulse rounded bg-muted"}):Cl(BR,{children:[Io("span",{className:"text-2xl font-semibold tabular-nums tracking-tight",children:x}),a&&Io("span",{className:"text-xs text-muted-foreground",children:a})]})}),i.length>0&&Io("div",{className:l(b==="success"&&"text-success",b==="destructive"&&"text-destructive",b==="default"&&"text-muted-foreground"),children:Io(DR,{data:i})})]}),r!==void 0&&Cl("p",{className:"text-[0.65rem] text-muted-foreground",children:[Io(Cx,{variant:b==="destructive"?"destructive":b==="success"?"success":"default",className:"mr-1 inline-block align-middle"}),f]})]})})}import"react";import{jsx as xN}from"react/jsx-runtime";function tU({children:e,className:t}){return xN("div",{className:l("flex min-h-screen items-center justify-center bg-gradient-to-br from-primary/10 via-background to-secondary/10 p-4",t),children:xN("div",{className:"w-full max-w-md",children:e})})}import"react";import{jsx as LR}from"react/jsx-runtime";function iU({className:e,fullWidth:t=!0,...a}){return LR(C,{className:l("h-12 px-6 text-base","md:h-8 md:px-3 md:text-sm",t&&"w-full md:w-auto",e),...a})}import"react";import{jsx as Cf,jsxs as vN}from"react/jsx-runtime";function pU({title:e,description:t,children:a,actions:r,className:o}){return vN(Y,{className:l("w-full",o),children:[(e||t)&&vN(le,{className:"p-4 pb-2",children:[e&&Cf(ie,{className:"text-lg",children:e}),t&&Cf(Ga,{className:"text-sm",children:t})]}),Cf(J,{className:l("p-4",!(e||t)&&"pt-4"),children:a}),r&&Cf(ho,{className:"p-4 pt-2 border-t",children:r})]})}import"react";import"react";import*as hN from"react";import{jsx as yi,jsxs as Hu}from"react/jsx-runtime";function yN({title:e,description:t,breadcrumbItems:a,actions:r,primaryAction:o,secondaryActions:n,className:i}){let c=r??(o||n?.length?Hu("div",{className:"flex items-center gap-2",children:[n,o]}):void 0);return Hu("div",{"data-slot":"page-header",className:l("space-y-2",i),children:[a&&a.length>0&&yi(mx,{children:yi(ux,{children:a.map((s,d)=>{let m=d===a.length-1;return Hu(hN.Fragment,{children:[yi(px,{children:m||!s.href?yi(fx,{children:s.label}):yi(gx,{href:s.href,children:s.label})}),!m&&yi(bx,{})]},d)})})}),Hu("div",{className:"flex items-start justify-between gap-4",children:[Hu("div",{className:"space-y-1",children:[yi("h1",{className:"text-2xl font-bold tracking-tight",children:e}),t&&yi("p",{className:"text-muted-foreground",children:t})]}),c&&yi("div",{className:"flex items-center gap-2",children:c})]})]})}import{jsx as rm,jsxs as zR}from"react/jsx-runtime";function NN({onBack:e,onMenu:t,className:a,...r}){return zR("div",{className:l("flex items-center gap-3 p-4 border-b bg-background sticky top-0 z-10","md:p-0 md:border-0 md:mb-6 md:static md:z-auto",a),children:[e&&rm(C,{variant:"ghost",size:"icon-sm",onClick:e,className:"shrink-0",children:rm(Yi,{className:"size-5"})}),rm("div",{className:"flex-1 min-w-0",children:rm(yN,{...r})}),t&&rm(C,{variant:"ghost",size:"icon-sm",onClick:t,className:"shrink-0",children:rm(bg,{className:"size-5"})})]})}import{jsx as CN,jsxs as AR}from"react/jsx-runtime";function DU({children:e,title:t,description:a,actions:r,onBack:o,onMenu:n,className:i}){return AR("div",{className:l("min-h-screen bg-background",i),children:[t&&CN(NN,{title:t,...a!==void 0?{description:a}:{},...r!==void 0?{actions:r}:{},...o!==void 0?{onBack:o}:{},...n!==void 0?{onMenu:n}:{}}),CN("main",{className:"p-4 md:p-6",children:e})]})}import"react";import{jsx as om,jsxs as bv}from"react/jsx-runtime";function EU({columns:e,data:t,onRowClick:a,className:r}){let o=e.find(i=>i.primary)??e[0],n=o?e.filter(i=>i.key!==o.key):e;return o?om("div",{className:l("space-y-2",r),children:t.map((i,c)=>om(Y,{className:l("cursor-pointer transition-colors hover:bg-muted/50",a&&"active:bg-muted"),onClick:()=>a?.(i),children:bv(J,{className:"p-3",children:[om("div",{className:"flex items-center justify-between",children:om("div",{className:"font-medium text-sm",children:o.render?o.render(i):String(i[o.key]??"")})}),om("div",{className:"mt-2 flex flex-wrap gap-2",children:n.map(s=>bv("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[bv("span",{className:"font-medium",children:[s.header,":"]}),om("span",{children:s.render?s.render(i):String(i[s.key]??"")})]},s.key))})]})},c))}):null}import"react";import{jsx as Vu,jsxs as xv}from"react/jsx-runtime";function UU({children:e,title:t,description:a,trigger:r,actions:o,open:n,onOpenChange:i,className:c}){return xv(Ie,{open:n,onOpenChange:i,children:[r&&Vu(su,{render:r}),xv(De,{className:l("max-w-full inset-0 rounded-none p-0 translate-x-0 translate-y-0","sm:inset-auto sm:top-1/2 sm:left-1/2 sm:-translate-x-1/2 sm:-translate-y-1/2 sm:rounded-xl sm:max-w-md sm:p-6",c),children:[xv($e,{className:"p-4 sm:p-0 sm:mb-4 border-b sm:border-0",children:[t&&Vu(Me,{children:t}),a&&Vu(Ye,{children:a})]}),Vu("div",{className:"flex-1 overflow-auto p-4 sm:p-0",children:e}),o&&Vu(Ge,{className:"p-4 sm:p-0 sm:mt-4 border-t sm:border-0",children:o})]})]})}import"react";import{jsx as ER}from"react/jsx-runtime";function KU({className:e,...t}){return ER(Hc,{className:l("py-8",e),...t})}import{jsx as FR}from"react/jsx-runtime";function ZU({className:e,...t}){return FR(Zg,{className:l("[&_select]:h-12 [&_select]:px-4 [&_select]:text-base","[&_input]:h-12 [&_input]:px-4 [&_input]:text-base","md:[&_select]:h-8 md:[&_select]:px-2.5 md:[&_select]:text-sm","md:[&_input]:h-8 md:[&_input]:px-2.5 md:[&_input]:text-sm",e),...t})}import"react";import{jsx as $R}from"react/jsx-runtime";function oW({children:e,onSubmit:t,className:a}){return $R("form",{onSubmit:t,className:l("space-y-4 p-4","md:p-0 md:space-y-6",a),children:e})}import"react";import{jsx as HR}from"react/jsx-runtime";function cW({className:e,...t}){return HR(iN,{className:l("space-y-2",e),...t})}import"react";import{jsx as VR}from"react/jsx-runtime";function bW({steps:e,onComplete:t,className:a}){return VR(dN,{steps:e,...t!==void 0?{onComplete:t}:{},className:l("[&_button]:h-12 [&_button]:px-6 [&_button]:text-base","md:[&_button]:h-8 md:[&_button]:px-3 md:[&_button]:text-sm",a)})}import"react";import{jsx as OR}from"react/jsx-runtime";function CW({className:e,...t}){return OR(T,{className:l("h-12 px-4 text-base","md:h-8 md:px-2.5 md:text-sm",e),...t})}import"react";import{jsx as UR}from"react/jsx-runtime";function SW({className:e,...t}){return UR(fN,{className:l("[&>div]:w-64","md:[&>div]:w-72",e),...t})}import"react";import{jsx as Ou,jsxs as kf}from"react/jsx-runtime";function AW({title:e,value:t,change:a,changeType:r="neutral",icon:o,className:n}){let i={positive:_s,negative:Zn,neutral:Kr},c={positive:"text-success",negative:"text-destructive",neutral:"text-muted-foreground"},s=i[r];return kf(Y,{className:l(n),children:[kf(le,{className:"flex flex-row items-center justify-between pb-2",children:[Ou(ie,{className:"text-sm font-medium text-muted-foreground",children:e}),o&&Ou(o,{className:"size-4 text-muted-foreground"})]}),kf(J,{children:[Ou("div",{className:"text-2xl font-bold",children:t}),a&&kf("div",{className:l("flex items-center gap-1 mt-1 text-xs",c[r]),children:[Ou(s,{className:"size-3"}),Ou("span",{className:"font-medium",children:a})]})]})]})}import"react";import{jsx as Uu,jsxs as kN}from"react/jsx-runtime";function UW({items:e,className:t}){return Uu(Wt,{className:l("w-full",t),children:Uu("div",{className:"flex gap-2 p-2",children:e.map((a,r)=>a.href?kN(C,{variant:a.active?"default":"outline",size:"sm",className:"shrink-0",onClick:a.onClick,render:Uu("a",{href:a.href}),children:[a.icon&&Uu(a.icon,{className:"size-4 mr-1"}),a.label]},r):kN(C,{variant:a.active?"default":"outline",size:"sm",className:"shrink-0",onClick:a.onClick,children:[a.icon&&Uu(a.icon,{className:"size-4 mr-1"}),a.label]},r))})})}import*as kl from"react";import{useTranslation as WR}from"react-i18next";import{jsx as vv,jsxs as wN}from"react/jsx-runtime";function KW({onRefresh:e,threshold:t=60,disabled:a,className:r,refreshingText:o,pullText:n,releaseText:i,children:c,...s}){let{t:d}=WR("mobile"),m=o??d("pullToRefresh.refreshing"),u=n??d("pullToRefresh.pull"),p=i??d("pullToRefresh.release"),[f,x]=kl.useState(0),[v,N]=kl.useState(!1),h=kl.useRef(0),b=kl.useRef(0),g=kl.useRef(!1),y=kl.useRef(null),k=L=>{if(a||v)return;let H=y.current;if(!H||H.scrollTop>0)return;let M=L.touches[0];M&&(h.current=M.clientY,g.current=!0)},w=L=>{if(!g.current||a||v)return;let H=L.touches[0];if(!H)return;let M=H.clientY-h.current;if(M>0){L.cancelable&&L.preventDefault();let $=Math.min(M*.5,t*1.5);b.current=$,x($)}},R=async()=>{if(!g.current)return;if(g.current=!1,b.current>=t&&!v){N(!0);try{await e()}finally{N(!1),x(0),b.current=0}}else x(0),b.current=0},S=v?"refreshing":f>=t?"release":f>0?"pull":"idle",z=v?m:S==="release"?p:u;return wN("div",{ref:y,"data-slot":"pull-to-refresh",onTouchStart:k,onTouchMove:w,onTouchEnd:R,className:l("relative overflow-y-auto",r),...s,children:[wN("div",{"aria-hidden":!0,className:l("pointer-events-none absolute inset-x-0 top-0 z-10 flex items-center justify-center gap-2 text-xs text-muted-foreground transition-opacity",S==="idle"?"opacity-0":"opacity-100"),style:{height:f},children:[vv(Zn,{className:l("size-4 transition-transform",S==="release"&&"rotate-180",v&&"animate-spin")}),vv("span",{children:z})]}),vv("div",{style:{transform:`translateY(${f}px)`,transition:g.current?"none":"transform 0.2s"},children:c})]})}import{jsx as wf,jsxs as _R}from"react/jsx-runtime";function ZW({options:e,value:t,onValueChange:a,placeholder:r,disabled:o,className:n}){return _R(Pe,{value:t,onValueChange:i=>{i!==null&&a?.(i)},disabled:o,children:[wf(Re,{className:l("h-12 px-4 text-base w-full","md:h-8 md:px-2.5 md:text-sm",n),children:wf(Te,{placeholder:r})}),wf(Se,{children:e.map(i=>wf(ve,{value:i.value,children:i.label},i.value))})]})}import"react";import{jsx as Wu,jsxs as hv}from"react/jsx-runtime";function n9({children:e,title:t,description:a,trigger:r,actions:o,side:n="bottom",open:i,onOpenChange:c,className:s}){return hv(ud,{open:i,onOpenChange:c,children:[r&&Wu($x,{render:r}),hv(pd,{side:n,className:l("h-[80vh]","sm:h-auto sm:max-h-[90vh]",s),children:[hv(gd,{className:"p-4 border-b",children:[t&&Wu(fd,{children:t}),a&&Wu(pu,{children:a})]}),Wu("div",{className:"flex-1 overflow-auto p-4",children:e}),o&&Wu(Vx,{className:"p-4 border-t",children:o})]})]})}import{jsx as Xa,jsxs as Ni}from"react/jsx-runtime";function d9({className:e,...t}){return Ni("div",{className:l("flex items-center gap-3 border-b p-3",e),...t,children:[Xa("div",{className:"size-10 shrink-0 animate-pulse rounded-full bg-muted"}),Ni("div",{className:"flex-1 space-y-1.5",children:[Xa("div",{className:"h-3 w-2/3 animate-pulse rounded bg-muted"}),Xa("div",{className:"h-2 w-1/2 animate-pulse rounded bg-muted"})]}),Xa("div",{className:"size-6 animate-pulse rounded bg-muted"})]})}function c9({className:e,...t}){return Ni("div",{className:l("space-y-3 rounded-lg border p-4",e),...t,children:[Xa("div",{className:"h-4 w-1/3 animate-pulse rounded bg-muted"}),Ni("div",{className:"space-y-2",children:[Xa("div",{className:"h-3 w-full animate-pulse rounded bg-muted"}),Xa("div",{className:"h-3 w-5/6 animate-pulse rounded bg-muted"})]}),Ni("div",{className:"flex justify-between",children:[Xa("div",{className:"h-8 w-16 animate-pulse rounded bg-muted"}),Xa("div",{className:"h-8 w-16 animate-pulse rounded bg-muted"})]})]})}function m9({className:e,...t}){return Ni("div",{className:l("space-y-4 p-4",e),...t,children:[Ni("div",{className:"flex items-center gap-3",children:[Xa("div",{className:"size-12 animate-pulse rounded-full bg-muted"}),Ni("div",{className:"flex-1 space-y-2",children:[Xa("div",{className:"h-4 w-1/2 animate-pulse rounded bg-muted"}),Xa("div",{className:"h-3 w-1/4 animate-pulse rounded bg-muted"})]})]}),Xa("div",{className:"aspect-video animate-pulse rounded bg-muted"}),Ni("div",{className:"space-y-2",children:[Xa("div",{className:"h-3 w-full animate-pulse rounded bg-muted"}),Xa("div",{className:"h-3 w-11/12 animate-pulse rounded bg-muted"}),Xa("div",{className:"h-3 w-4/5 animate-pulse rounded bg-muted"}),Xa("div",{className:"h-3 w-3/4 animate-pulse rounded bg-muted"})]})]})}import*as Pf from"react";import{jsx as TN,jsxs as PN}from"react/jsx-runtime";function f9({onSwipeLeft:e,onSwipeRight:t,onSwipeUp:a,onSwipeDown:r,threshold:o=80,disabled:n,leftAction:i,rightAction:c,className:s,children:d,...m}){let[u,p]=Pf.useState(null),[f,x]=Pf.useState(0),[v,N]=Pf.useState(null),h=w=>{if(n)return;let R=w.touches[0];R&&(p({x:R.clientX,y:R.clientY}),x(0),N(null))},b=w=>{if(!u||n)return;let R=w.touches[0];if(!R)return;let S=R.clientX-u.x,z=R.clientY-u.y;v||N(Math.abs(S)>Math.abs(z)?"x":"y"),v==="x"||!v&&Math.abs(S)>Math.abs(z)?x(S):(v==="y"||!v&&Math.abs(z)>Math.abs(S))&&x(z)},g=()=>{if(n||f===0){p(null),x(0),N(null);return}Math.abs(f)>=o&&(v==="x"?f>0?(c&&c.onClick(),t?.()):(i&&i.onClick(),e?.()):v==="y"&&(f>0?r?.():a?.())),p(null),x(0),N(null)},y=f>0?c:i,k=Math.abs(f)>20&&y;return PN("div",{"data-slot":"swipe-actions",onTouchStart:h,onTouchMove:b,onTouchEnd:g,className:l("relative overflow-hidden",s),...m,children:[k&&TN("div",{className:l("absolute inset-y-0 flex items-center justify-center px-4 text-sm font-medium text-white",f>0?"left-0":"right-0"),style:{backgroundColor:y.color??"#ef4444",width:Math.abs(f)},children:PN("span",{className:"flex items-center gap-1.5",children:[y.icon,y.label]})}),TN("div",{className:"relative bg-background transition-transform",style:{transform:`translateX(${f}px)`,transition:u?"none":"transform 0.2s"},children:d})]})}import"react";import{jsx as Tf,jsxs as qR}from"react/jsx-runtime";function C9({tabs:e,defaultValue:t,className:a}){return qR(Sr,{defaultValue:t||e[0]?.value,className:l("w-full",a),children:[Tf(Wt,{className:"w-full border-b",children:Tf(Ir,{className:"w-full justify-start rounded-none border-0 bg-transparent p-0 h-auto",children:e.map(r=>Tf(Ba,{value:r.value,className:"rounded-none border-b-2 border-transparent px-4 py-3 data-[state=active]:border-primary data-[state=active]:shadow-none",children:r.label},r.value))})}),e.map(r=>Tf(Co,{value:r.value,className:"p-4 mt-0",children:r.content},r.value))]})}import"react";import{jsx as GR}from"react/jsx-runtime";function S9({className:e,...t}){return GR(St,{className:l("min-h-[120px] px-4 py-3 text-base","md:min-h-[80px] md:px-2.5 md:py-1 md:text-sm",e),...t})}import*as fs from"react";import{useTranslation as jR}from"react-i18next";import{Fragment as RN,jsx as Aa,jsxs as pn}from"react/jsx-runtime";function $9({options:e,value:t=[],onChange:a,placeholder:r,searchPlaceholder:o,emptyText:n,disabled:i,className:c,maxCount:s=3,maxSelected:d,clearable:m=!0}){let{t:u}=jR("ui"),[p,f]=fs.useState(!1),x=r??u("multiSelect.placeholder"),v=o??u("multiSelect.searchPlaceholder"),N=n??u("multiSelect.emptyText"),h=y=>{if(t.includes(y))a?.(t.filter(k=>k!==y));else{if(d&&t.length>=d)return;a?.([...t,y])}},b=t.slice(0,s),g=t.length-s;return pn(He,{"data-slot":"multi-select",open:p,onOpenChange:f,children:[pn(Ve,{render:Aa(C,{variant:"outline",disabled:i,className:l("h-auto min-h-9 w-full justify-between font-normal",t.length===0&&"text-muted-foreground",c)}),children:[Aa("div",{className:"flex flex-1 flex-wrap items-center gap-1 overflow-hidden",children:t.length===0?Aa("span",{children:x}):pn(RN,{children:[b.map(y=>{let k=e.find(w=>w.value===y);return pn(B,{variant:"secondary",className:"h-5 gap-0.5 pr-0.5 text-xs",children:[Aa("span",{className:"max-w-[80px] truncate",children:k?.label??y}),Aa("button",{type:"button","aria-label":u("multiSelect.remove"),onClick:w=>{w.stopPropagation(),h(y)},className:"hover:bg-muted inline-flex size-3.5 shrink-0 items-center justify-center rounded-full opacity-60 hover:opacity-100",children:Aa(Q,{className:"size-2.5"})})]},y)}),g>0&&pn(B,{variant:"secondary",className:"h-5 text-xs",children:["+",g]})]})}),pn("div",{className:"flex items-center gap-1",children:[m&&t.length>0&&Aa("button",{type:"button","aria-label":u("multiSelect.clearAll"),onClick:y=>{y.stopPropagation(),a?.([])},className:"hover:bg-muted inline-flex size-5 shrink-0 items-center justify-center rounded-full opacity-50 hover:opacity-100",children:Aa(Q,{className:"size-3"})}),Aa(re,{className:"size-4 opacity-50"})]})]}),p&&Aa(Oe,{className:"w-[var(--anchor-width)] p-0",align:"start",children:Aa(KR,{options:e,value:t,onToggle:h,searchPlaceholder:v,emptyText:N})})]})}function KR({options:e,value:t,onToggle:a,searchPlaceholder:r,emptyText:o}){let[n,i]=fs.useState(""),c=fs.useRef(null);fs.useEffect(()=>{c.current?.focus()},[]);let s=fs.useMemo(()=>{if(!n)return e;let m=n.toLowerCase();return e.filter(u=>u.label.toLowerCase().includes(m)||u.value.toLowerCase().includes(m)||u.description?.toLowerCase().includes(m))},[e,n]),d=fs.useMemo(()=>{let m=new Map;for(let u of s){let p=u.group??"",f=m.get(p)??[];f.push(u),m.set(p,f)}return Array.from(m.entries())},[s]);return pn(RN,{children:[pn("div",{className:"flex items-center gap-2 border-b px-3 py-2",children:[Aa(X,{className:"size-4 shrink-0 opacity-50"}),Aa(T,{ref:c,value:n,onChange:m=>i(m.target.value),placeholder:r,className:"h-7 border-0 bg-transparent p-0 shadow-none focus-visible:ring-0"})]}),pn("div",{className:"max-h-64 overflow-y-auto p-1",children:[d.length===0&&Aa("div",{className:"text-muted-foreground px-2 py-6 text-center text-sm",children:o}),d.map(([m,u])=>pn("div",{children:[m&&Aa("div",{className:"text-muted-foreground px-2 py-1 text-xs font-medium",children:m}),u.map(p=>{let f=t.includes(p.value);return pn(C,{type:"button",variant:"ghost",size:"sm",disabled:p.disabled,onClick:()=>a(p.value),className:l("flex h-auto w-full cursor-default items-center justify-start gap-2 rounded-sm px-2 py-1.5 text-left text-sm font-normal outline-hidden select-none","hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground",p.disabled&&"pointer-events-none opacity-50"),children:[Aa("span",{className:l("flex size-4 shrink-0 items-center justify-center rounded-sm border",f?"border-primary bg-primary text-primary-foreground":"border-input"),children:f&&Aa(U,{className:"size-3"})}),pn("span",{className:"flex-1 truncate",children:[p.label,p.description&&Aa("span",{className:"text-muted-foreground ml-2 text-xs",children:p.description})]})]},p.value)})]},m||"_default"))]})]})}import{useTranslation as QR}from"react-i18next";import{jsx as Ca,jsxs as bs}from"react/jsx-runtime";var XR={info:"bg-info/15 text-info",success:"bg-success/15 text-success",warning:"bg-warning/15 text-warning",error:"bg-destructive/15 text-destructive"};function X9({notifications:e,onMarkRead:t,onMarkAllRead:a,onClear:r,onItemClick:o,align:n="end",className:i,emptyText:c="\u6682\u65E0\u901A\u77E5"}){let{t:s}=QR("notification"),d=e.filter(u=>!u.read).length,m=c==="\u6682\u65E0\u901A\u77E5"?s("notificationCenter.emptyText"):c;return bs(He,{"data-slot":"notification-center",children:[bs(Ve,{render:Ca(C,{variant:"ghost",size:"icon",className:l("relative",i),"aria-label":s("notificationCenter.ariaLabel",{unreadText:d>0?s("notificationCenter.ariaLabelUnread",{count:d}):""})}),children:[Ca(xo,{}),d>0&&Ca(B,{variant:"destructive",className:"absolute -top-1 -right-1 flex size-4 items-center justify-center rounded-full p-0 text-[0.6rem]",children:d>99?"99+":d})]}),bs(Oe,{align:n,className:"w-80 p-0",children:[bs("div",{className:"flex items-center justify-between border-b px-3 py-2",children:[bs("div",{className:"flex items-center gap-2",children:[Ca("span",{className:"text-sm font-semibold",children:s("notificationCenter.title")}),d>0&&Ca(B,{variant:"secondary",className:"text-[0.65rem]",children:s("notificationCenter.unreadCount",{count:d})})]}),bs("div",{className:"flex items-center gap-1",children:[a&&d>0&&Ca(C,{size:"sm",variant:"ghost",onClick:a,className:"h-7 px-2 text-xs",children:s("notificationCenter.markAllRead")}),r&&e.length>0&&Ca(C,{size:"sm",variant:"ghost",onClick:r,className:"h-7 px-2 text-xs","aria-label":s("notificationCenter.clear"),children:Ca(Q,{})})]})]}),Ca(Wt,{className:"max-h-80",children:e.length===0?Ca("div",{className:"py-4",children:Ca(Hc,{variant:"default",title:m,description:s("notificationCenter.emptyDescription"),className:"py-6"})}):Ca("ul",{className:"flex flex-col",children:e.map(u=>bs("li",{className:l("group flex cursor-pointer gap-2 border-b px-3 py-2.5 transition-colors last:border-0 hover:bg-muted/50",!u.read&&"bg-muted/30"),onClick:()=>{o?.(u),u.read||t?.(u.id)},children:[Ca("div",{className:l("mt-0.5 size-2 shrink-0 rounded-full",u.read?"bg-transparent":XR[u.type??"info"])}),bs("div",{className:"flex-1 space-y-0.5",children:[bs("div",{className:"flex items-start justify-between gap-2",children:[Ca("p",{className:"text-sm font-medium leading-tight",children:u.title}),!u.read&&Ca("span",{role:"button","aria-label":s("notificationCenter.markRead"),onClick:p=>{p.stopPropagation(),t?.(u.id)},className:"opacity-0 group-hover:opacity-100",children:Ca(U,{className:"size-3.5 text-muted-foreground hover:text-foreground"})})]}),u.description&&Ca("p",{className:"text-xs text-muted-foreground",children:u.description}),bs("div",{className:"flex items-center justify-between pt-0.5",children:[Ca("span",{className:"text-[0.65rem] text-muted-foreground",children:gl(u.timestamp)}),u.action&&Ca("button",{type:"button",onClick:p=>{p.stopPropagation(),u.action?.onClick()},className:"text-[0.65rem] text-primary hover:underline",children:u.action.label})]})]})]},u.id))})})]})]})}import*as SN from"react";import{jsx as nm,jsxs as _u}from"react/jsx-runtime";function r_({className:e,data:t,onChange:a,skuOptions:r=[],onSkuSearch:o,readOnly:n=!1,minRows:i=1,maxRows:c,currency:s="\xA5",...d}){let m=SN.useMemo(()=>[{key:"sku",title:"SKU",width:200,editable:!n,renderEditor:(v,N,h,b)=>_u("select",{value:String(v??""),onChange:g=>{let y=r.find(k=>k.value===g.target.value);b(g.target.value),y?.price},className:"h-8 w-full rounded border border-input bg-background px-2 text-sm",children:[nm("option",{value:"",children:"Select SKU"}),r.map(g=>_u("option",{value:g.value,children:[g.label,g.price!==void 0?` (${s}${g.price})`:""]},g.value))]}),render:(v,N)=>N.skuLabel??v??"\u2014"},{key:"price",title:`Price (${s})`,width:120,editable:!n,renderEditor:(v,N,h,b)=>nm(ri,{value:v,onChange:g=>b(g??0),min:0,precision:2,size:"sm",className:"w-full"}),render:v=>v!=null?`${s}${Number(v).toFixed(2)}`:"\u2014"},{key:"qty",title:"Qty",width:100,editable:!n,renderEditor:(v,N,h,b)=>nm(ri,{value:v,onChange:g=>b(g??0),min:0,precision:0,size:"sm",className:"w-full"}),render:v=>v??"\u2014"},{key:"subtotal",title:`Subtotal (${s})`,width:120,editable:!1,compute:v=>{let N=Number(v.price??0),h=Number(v.qty??0),b=N*h;return`${s}${b.toFixed(2)}`}},{key:"remark",title:"Remark",editable:!n,renderEditor:(v,N,h,b)=>nm(T,{value:String(v??""),onChange:g=>b(g.target.value),placeholder:"Optional",className:"h-8"})}],[r,n,s]),u=v=>{let N=v.map(h=>{if(h.sku){let y=r.find(k=>k.value===h.sku);if(y?.price!==void 0&&h.price===void 0)return{...h,price:y.price}}let b=Number(h.price??0),g=Number(h.qty??0);return{...h,subtotal:b*g}});a?.(N)},p=t.reduce((v,N)=>v+Number(N.price??0)*Number(N.qty??0),0),f=t.reduce((v,N)=>v+Number(N.qty??0),0),x=_u("td",{colSpan:m.length+1,className:"px-3 py-2 text-right",children:[_u("span",{className:"mr-6 text-muted-foreground",children:[t.length," lines \xB7 ",f," items"]}),_u("span",{className:"text-base font-semibold",children:["Total: ",s,p.toFixed(2)]})]});return nm("div",{"data-slot":"order-line-editor",className:l("w-full",e),...d,children:nm(pf,{columns:m,data:t,onChange:u,readOnly:n,minRows:i,maxRows:c,footer:x,emptyText:"No items added"})})}import"react";import{useTranslation as YR}from"react-i18next";import{jsx as gn,jsxs as qu}from"react/jsx-runtime";function m_({roles:e,resources:t,value:a,onChange:r,readOnly:o,className:n,...i}){let{t:c}=YR("transfer"),s=(d,m,u)=>{if(o)return;let p=a[d]??{},f=p[m]??[],x=f.includes(u)?f.filter(v=>v!==u):[...f,u];r?.({...a,[d]:{...p,[m]:x}})};return gn("div",{"data-slot":"permission-matrix",className:l("overflow-x-auto rounded-lg border",n),...i,children:qu(ze,{children:[gn(Ae,{children:qu(W,{children:[gn(E,{className:"min-w-48",children:c("permissionMatrix.resource")}),e.map(d=>gn(E,{className:"min-w-40 text-center",children:d.label},d.id))]})}),gn(ke,{children:t.map(d=>qu(W,{children:[gn(D,{children:qu("div",{children:[gn("p",{className:"text-sm font-medium",children:d.label}),d.description&&gn("p",{className:"text-xs text-muted-foreground",children:d.description})]})}),e.map(m=>gn(D,{className:"align-top",children:gn("div",{className:"flex flex-col gap-2",children:d.permissions.map(u=>qu("label",{className:"flex items-center justify-center gap-2 text-xs",children:[gn(ja,{checked:(a[m.id]?.[d.id]??[]).includes(u),disabled:o,onCheckedChange:()=>s(m.id,d.id,u)}),gn("span",{children:u})]},u))})},m.id))]},d.id))})]})})}import*as sm from"react";import{useTranslation as JR}from"react-i18next";import{jsx as mr,jsxs as wl}from"react/jsx-runtime";function Rf(e,t){if(e.length===0)return 0;switch(t){case"sum":return e.reduce((a,r)=>a+r,0);case"count":return e.length;case"avg":return e.reduce((a,r)=>a+r,0)/e.length;case"min":return Math.min(...e);case"max":return Math.max(...e)}}function x_({data:e,rowField:t,columnField:a,valueField:r,aggregation:o="sum",className:n,showRowTotal:i=!0,showColumnTotal:c=!0,filter:s,formatValue:d}){let{t:m}=JR("data"),[u,p]=sm.useState(""),f=sm.useMemo(()=>{let y=e;if(s&&(y=y.filter(s)),u){let k=u.toLowerCase();y=y.filter(w=>String(w[t]).toLowerCase().includes(k))}return y},[e,s,t,u]),x=sm.useMemo(()=>{let y=new Set,k=new Set;for(let z of f)y.add(String(z[t])),k.add(String(z[a]));let w=Array.from(y).sort(),R=Array.from(k).sort(),S=new Map;for(let z of f){let L=`${z[t]}|${z[a]}`,H=S.get(L)??[],M=z[r];H.push(typeof M=="number"?M:Number(M)||0),S.set(L,H)}return{rows:w,cols:R,cellMap:S}},[f,t,a,r]),v=d??(y=>y.toLocaleString("zh-CN",{maximumFractionDigits:2})),N=(y,k)=>{let w=x.cellMap.get(`${y}|${k}`)??[];return Rf(w,o)},h=x.rows.map(y=>{let k=[];for(let w of x.cols){let R=x.cellMap.get(`${y}|${w}`)??[];k.push(...R)}return Rf(k,o)}),b=x.cols.map(y=>{let k=[];for(let w of x.rows){let R=x.cellMap.get(`${w}|${y}`)??[];k.push(...R)}return Rf(k,o)}),g=sm.useMemo(()=>{let y=[];for(let k of x.rows)for(let w of x.cols){let R=x.cellMap.get(`${k}|${w}`)??[];y.push(...R)}return Rf(y,o)},[x,o]);return wl(Y,{"data-slot":"pivot-table",className:l("overflow-hidden",n),children:[wl(le,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[wl(ie,{className:"text-sm font-medium",children:[String(t)," \xD7 ",String(a)," \xB7 ",o]}),mr(T,{value:u,onChange:y=>p(y.target.value),placeholder:m("pivotTable.searchPlaceholder"),className:"h-7 w-48"})]}),mr(J,{className:"p-0",children:mr(Wt,{children:wl(ze,{className:"w-full text-sm",children:[mr(Ae,{children:wl(W,{className:"border-b bg-muted/30",children:[wl(E,{className:"sticky left-0 z-10 bg-muted/30 px-3 py-2 text-left font-medium",children:[String(t)," \\ ",String(a)]}),x.cols.map(y=>mr(E,{className:"px-3 py-2 text-right font-medium",children:y},y)),c&&mr(E,{className:"bg-muted/50 px-3 py-2 text-right font-medium",children:m("pivotTable.total")})]})}),mr(ke,{children:x.rows.length===0?mr(W,{children:mr(D,{colSpan:x.cols.length+(c?2:1),className:"px-3 py-6 text-center text-muted-foreground",children:m("pivotTable.noData")})}):x.rows.map((y,k)=>wl(W,{className:"border-b last:border-0 hover:bg-muted/20",children:[mr(D,{className:"sticky left-0 z-10 bg-background px-3 py-2 font-medium",children:y}),x.cols.map(w=>mr(D,{className:"px-3 py-2 text-right tabular-nums",children:v(N(y,w))},w)),c&&mr(D,{className:"bg-muted/30 px-3 py-2 text-right font-semibold tabular-nums",children:v(h[k]??0)})]},y))}),i&&x.rows.length>0&&mr(ai,{children:wl(W,{className:"bg-muted/30 font-semibold",children:[mr(D,{className:"sticky left-0 z-10 bg-muted/30 px-3 py-2",children:m("pivotTable.total")}),b.map((y,k)=>mr(D,{className:"px-3 py-2 text-right tabular-nums",children:v(y)},k)),c&&mr(D,{className:"bg-muted/50 px-3 py-2 text-right tabular-nums",children:v(g)})]})})]})})})]})}import*as If from"react";import{useTranslation as IN}from"react-i18next";import{jsx as Ci,jsxs as Sf}from"react/jsx-runtime";function k_({open:e,onOpenChange:t,title:a="\u8BF7\u8F93\u5165",description:r,label:o,placeholder:n,defaultValue:i="",confirmText:c="\u786E\u8BA4",cancelText:s="\u53D6\u6D88",onConfirm:d,required:m=!0,inputType:u="text"}){let{t:p}=IN("navigation"),f=a==="\u8BF7\u8F93\u5165"?p("promptDialog.title"):a,x=c==="\u786E\u8BA4"?p("promptDialog.confirm"):c,v=s==="\u53D6\u6D88"?p("promptDialog.cancel"):s;return Ci(Ie,{"data-slot":"prompt-dialog",open:e,onOpenChange:t,children:e&&Ci(ZR,{title:f,description:r,...o!==void 0?{label:o}:{},...n!==void 0?{placeholder:n}:{},defaultValue:i,confirmText:x,cancelText:v,required:m,inputType:u,...d?{onConfirm:d}:{},onClose:()=>t?.(!1)})})}function ZR({title:e,description:t,label:a,placeholder:r,defaultValue:o,confirmText:n,cancelText:i,required:c,inputType:s,onConfirm:d,onClose:m}){let{t:u}=IN("navigation"),p=e==="\u8BF7\u8F93\u5165"?u("promptDialog.title"):e,f=n==="\u786E\u8BA4"?u("promptDialog.confirm"):n,x=i==="\u53D6\u6D88"?u("promptDialog.cancel"):i,[v,N]=If.useState(o??""),[h,b]=If.useState(!1),[g,y]=If.useState(null),k=async()=>{if(c&&!v.trim()){y(u("promptDialog.required"));return}if(!d){m();return}b(!0);try{await d(v),m()}finally{b(!1)}};return Sf(De,{showCloseButton:!1,className:"sm:max-w-sm",children:[Sf($e,{children:[Ci(Me,{children:p}),t&&Ci(Ye,{children:t})]}),Sf("div",{className:"flex flex-col gap-1.5",children:[a&&Ci(ue,{children:a}),Ci(T,{type:s,value:v,onChange:w=>{N(w.target.value),g&&y(null)},placeholder:r,autoFocus:!0,onKeyDown:w=>{w.key==="Enter"&&!w.shiftKey&&(w.preventDefault(),k())}}),g&&Ci("p",{className:"text-xs text-destructive",children:g})]}),Sf(Ge,{children:[Ci(C,{variant:"outline",onClick:m,disabled:h,children:x}),Ci(C,{onClick:k,disabled:h,children:f})]})]})}import"react";import{useTranslation as e1}from"react-i18next";import{jsx as MN,jsxs as DN}from"react/jsx-runtime";function I_({children:e,device:t="desktop",showFrame:a=!0,showLabel:r=!0,className:o}){let{t:n}=e1("marketing"),c={mobile:{width:375,height:667,label:n("responsivePreview.mobile")},tablet:{width:768,height:1024,label:n("responsivePreview.tablet")},desktop:{width:1024,height:768,label:n("responsivePreview.desktop")}}[t];return DN("div",{"data-slot":"responsive-preview",className:l("flex flex-col items-center gap-2",o),children:[r&&DN("div",{className:"text-xs text-muted-foreground font-medium",children:[c.label," (",c.width," \xD7 ",c.height,")"]}),MN("div",{className:l("border rounded-lg overflow-hidden bg-background",a&&"shadow-lg"),style:{width:a?Math.min(c.width,800):"100%",height:a?Math.min(c.height,600):"auto"},children:MN("div",{className:"w-full h-full overflow-auto",children:e})})]})}import"react";import{useTranslation as t1}from"react-i18next";import{jsx as Pd,jsxs as im}from"react/jsx-runtime";function F_({principals:e,roles:t,value:a,onChange:r,readOnly:o,className:n,...i}){let{t:c}=t1("transfer"),s=(d,m)=>{if(o)return;let u=a[d]??[],p=u.includes(m)?u.filter(f=>f!==m):[...u,m];r?.({...a,[d]:p})};return Pd("div",{"data-slot":"role-assignment",className:l("space-y-3",n),...i,children:e.map(d=>im("div",{className:"rounded-lg border p-4",children:[im("div",{className:"mb-3 flex items-start justify-between gap-3",children:[im("div",{children:[Pd("p",{className:"text-sm font-medium",children:d.name}),d.description&&Pd("p",{className:"text-xs text-muted-foreground",children:d.description})]}),im(B,{variant:"outline",children:[(a[d.id]??[]).length," ",c("roleAssignment.roles")]})]}),Pd("div",{className:"grid gap-2 sm:grid-cols-2",children:t.map(m=>im("label",{className:"flex items-start gap-2 rounded-md border p-3",children:[Pd(ja,{checked:(a[d.id]??[]).includes(m.id),disabled:o,onCheckedChange:()=>s(d.id,m.id)}),im("span",{children:[Pd("span",{className:"block text-sm font-medium",children:m.label}),m.description&&Pd("span",{className:"block text-xs text-muted-foreground",children:m.description})]})]},m.id))})]},d.id))})}import*as yv from"react";import{useTranslation as a1}from"react-i18next";import{jsx as ra,jsxs as fn}from"react/jsx-runtime";function G_({filters:e,activeId:t,onApply:a,onSave:r,onDelete:o,onPin:n,className:i,label:c="\u5DF2\u4FDD\u5B58\u7684\u7B5B\u9009"}){let{t:s}=a1("data"),d=c==="\u5DF2\u4FDD\u5B58\u7684\u7B5B\u9009"?s("savedFilters.label"):c,[m,u]=yv.useState(""),[p,f]=yv.useState(!1),x=()=>{m.trim()&&(r?.(m.trim()),u(""),f(!1))};return fn("div",{"data-slot":"saved-filters",className:l("flex items-center gap-2",i),children:[fn(sr,{children:[fn(ir,{render:ra(C,{variant:"outline",size:"sm"}),children:[ra(sg,{}),d,ra(re,{className:"size-3.5 opacity-50"})]}),ra(lr,{align:"start",className:"w-64",children:fn(ns,{children:[ra(nl,{children:d}),ra(ss,{}),e.length===0?ra("div",{className:"px-2 py-6 text-center text-xs text-muted-foreground",children:s("savedFilters.empty")}):e.map(v=>fn(la,{onClick:()=>a?.(v.id),className:"flex items-center justify-between",children:[fn("span",{className:"flex items-center gap-2",children:[v.isPinned?ra(nx,{className:"size-3.5 text-primary"}):ra(sg,{className:"size-3.5"}),ra("span",{className:"truncate",children:v.name})]}),fn("div",{className:"flex items-center gap-1",children:[v.id===t&&ra("span",{className:"rounded bg-primary/10 px-1 text-[0.65rem] text-primary",children:s("savedFilters.apply")}),n&&ra(C,{type:"button",variant:"ghost",size:"icon-xs","aria-label":s("savedFilters.pin"),onClick:N=>{N.stopPropagation(),n(v.id)},className:"opacity-50 hover:opacity-100",children:ra(sg,{className:"size-3"})}),o&&ra(C,{type:"button",variant:"ghost",size:"icon-xs","aria-label":s("savedFilters.delete"),onClick:N=>{N.stopPropagation(),o(v.id)},className:"opacity-50 hover:opacity-100 hover:text-destructive",children:ra(sd,{className:"size-3"})})]})]},v.id))]})})]}),r&&fn(sr,{open:p,onOpenChange:f,children:[fn(ir,{render:ra(C,{variant:"ghost",size:"sm"}),children:[ra(nx,{}),s("savedFilters.saveCurrent")]}),fn(lr,{align:"start",className:"w-64 p-3",children:[fn(ns,{children:[ra(nl,{children:s("savedFilters.nameAndSave")}),ra(ss,{})]}),fn("div",{className:"flex flex-col gap-2 p-1",children:[ra(T,{value:m,onChange:v=>u(v.target.value),placeholder:s("savedFilters.namePlaceholder"),autoFocus:!0,onKeyDown:v=>{v.key==="Enter"&&x()}}),ra(C,{size:"sm",onClick:x,disabled:!m.trim(),children:s("savedFilters.save")})]})]})]})]})}import{jsx as Df}from"react/jsx-runtime";var r1={wechat:{label:"WeChat",color:"#07C160"},weibo:{label:"Weibo",color:"#E6162D"},qq:{label:"QQ",color:"#12B7F5"},link:{label:"Copy Link",color:"#6B7280"}};function Z_({url:e=typeof window<"u"?window.location.href:"",title:t,platforms:a=["wechat","weibo","qq","link"],className:r}){let[o,n]=un(),i=c=>{let s=encodeURIComponent(e),d=encodeURIComponent(t??document.title);switch(c){case"weibo":window.open(`https://service.weibo.com/share/share.php?url=${s}&title=${d}`,"_blank");break;case"qq":window.open(`https://connect.qq.com/widget/shareqq/index.html?url=${s}&title=${d}`,"_blank");break;case"link":n(e);break;default:break}};return Df("div",{"data-slot":"social-share",className:l("flex items-center gap-2",r),children:a.map(c=>{let s=r1[c];return Df(C,{variant:"outline",size:"sm",onClick:()=>i(c),style:{borderColor:s.color,color:s.color},children:c==="link"&&o?Df(U,{}):Df("span",{children:s.label})},c)})})}import{jsx as n1}from"react/jsx-runtime";function o1({value:e,onChange:t,dialect:a="standard",placeholder:r,readOnly:o,minHeight:n=200,maxHeight:i,className:c,onFocus:s,onBlur:d}){return n1(df,{value:e,onChange:t,language:a==="mysql"?"mysql":a==="postgresql"?"postgresql":"sql",placeholder:r??"SELECT ...",readOnly:o,minHeight:n,maxHeight:i,className:c,onFocus:s,onBlur:d})}import{jsx as Gu,jsxs as Mf}from"react/jsx-runtime";function l7({title:e,value:t,change:a,changeType:r="neutral",icon:o,className:n}){let i=r==="positive"?an:r==="negative"?tn:Kr;return Mf(Y,{"data-slot":"stat-card",className:l(n),children:[Mf(le,{className:"flex-row items-center justify-between space-y-0 pb-2",children:[Gu(ie,{className:"text-sm font-medium text-muted-foreground",children:e}),o&&Gu(o,{className:"size-4 text-muted-foreground"})]}),Mf(J,{children:[Gu("div",{className:"text-2xl font-bold",children:t}),a&&Mf("div",{className:"mt-1 flex items-center gap-1 text-xs",children:[Gu(i,{className:l("size-3.5",r==="positive"&&"text-success",r==="negative"&&"text-destructive",r==="neutral"&&"text-muted-foreground")}),Gu("span",{className:l(r==="positive"&&"text-success",r==="negative"&&"text-destructive",r==="neutral"&&"text-muted-foreground"),children:a})]})]})]})}import"react";import{jsx as Pl,jsxs as Nv}from"react/jsx-runtime";function g7({cards:e,columns:t,className:a}){let r=[t?.xs?`grid-cols-${t.xs}`:"grid-cols-1",t?.sm?`sm:grid-cols-${t.sm}`:"",t?.md?`md:grid-cols-${t.md}`:"md:grid-cols-2",t?.lg?`lg:grid-cols-${t.lg}`:"lg:grid-cols-4"].filter(Boolean).join(" "),o=n=>n?n==="up"?"text-red-500":"text-green-500":"text-muted-foreground";return Pl("div",{"data-slot":"stat-card-row",className:l("grid gap-4",r,a),children:e.map((n,i)=>Pl(Y,{className:l(n.onClick&&"cursor-pointer hover:shadow-md transition-shadow"),onClick:n.onClick,children:Pl(J,{className:"pt-6",children:Nv("div",{className:"flex items-start justify-between",children:[Nv("div",{className:"min-w-0 flex-1",children:[Pl("p",{className:"text-sm font-medium text-muted-foreground truncate",children:n.title}),Pl("p",{className:"mt-2 text-2xl font-bold tabular-nums",children:n.value}),n.description&&Pl("p",{className:"mt-1 text-xs text-muted-foreground",children:n.description}),n.trend&&Nv("p",{className:l("mt-2 text-sm font-medium",o(n.trend.direction)),children:[n.trend.direction==="down"?"\u2193":"\u2191"," ",Math.abs(n.trend.value).toFixed(1),"%"]}),n.sparkline&&Pl("div",{className:"mt-2",children:n.sparkline})]}),n.icon&&Pl("div",{className:"flex size-10 items-center justify-center rounded-lg shrink-0",style:{backgroundColor:n.color?`${n.color}15`:void 0},children:n.icon})]})})},i))})}import{jsx as i1}from"react/jsx-runtime";var s1={draft:{label:"Draft",className:"bg-muted text-muted-foreground"},pending:{label:"Pending",className:"bg-warning/15 text-warning"},approved:{label:"Approved",className:"bg-info/15 text-info"},rejected:{label:"Rejected",className:"bg-destructive/10 text-destructive"},completed:{label:"Completed",className:"bg-success/15 text-success"},cancelled:{label:"Cancelled",className:"bg-muted text-muted-foreground line-through"}};function h7({status:e,size:t="default",label:a}){let r=e.toLowerCase(),o=s1[r]??{label:e,className:"bg-muted text-muted-foreground"};return i1(B,{"data-slot":"status-tag",className:l(o.className,t==="sm"&&"h-4 px-1.5 text-[0.65rem]"),children:a??o.label})}import"react";import{Fragment as BN,jsx as ka,jsxs as ki}from"react/jsx-runtime";function D7({user:e,actions:t=[],showProfile:a=!0,showSettings:r=!0,onProfile:o,onSettings:n,onSignOut:i,align:c="end",className:s}){return ki(sr,{children:[ka(ir,{render:ka(C,{variant:"ghost",size:"icon",className:l("rounded-full",s),"aria-label":`Open menu for ${e.name}`}),children:ki(Tr,{className:"size-8",children:[e.avatar&&ka(nn,{src:e.avatar,alt:e.name}),ka(Rr,{className:"text-xs",children:sn(e.name)})]})}),ki(lr,{align:c,className:"w-56",children:[ki(ns,{children:[ka(nl,{className:"font-normal",children:ki("div",{className:"flex flex-col gap-0.5",children:[ka("p",{className:"text-sm leading-none font-medium",children:e.name}),e.email&&ka("p",{className:"text-muted-foreground text-xs leading-none",children:e.email}),e.role&&ka("p",{className:"text-muted-foreground mt-1 text-xs leading-none",children:e.role})]})}),ka(ss,{})]}),a&&ki(ns,{children:[ka(la,{onClick:o,children:ka("span",{children:"\u4E2A\u4EBA\u8D44\u6599"})}),r&&ka(la,{onClick:n,children:ka("span",{children:"\u8D26\u6237\u8BBE\u7F6E"})})]}),t.length>0&&ki(BN,{children:[ka(ss,{}),ka(ns,{children:t.map((d,m)=>ki(la,{onClick:d.onClick,disabled:d.disabled,variant:d.destructive?"destructive":"default",children:[d.icon,ka("span",{children:d.label})]},`${d.label}-${m}`))})]}),i&&ki(BN,{children:[ka(ss,{}),ka(la,{onClick:i,variant:"destructive",children:ka("span",{children:"\u9000\u51FA\u767B\u5F55"})})]})]})]})}import*as zN from"react";import{useTranslation as l1}from"react-i18next";import{jsx as to,jsxs as Tl}from"react/jsx-runtime";var d1={url:"https://example.com/landing",source:"newsletter",medium:"email",campaign:"spring_launch",content:"",term:""};function LN(e){try{let t=new URL(e.url);return t.searchParams.set("utm_source",e.source),t.searchParams.set("utm_medium",e.medium),t.searchParams.set("utm_campaign",e.campaign),e.content?t.searchParams.set("utm_content",e.content):t.searchParams.delete("utm_content"),e.term?t.searchParams.set("utm_term",e.term):t.searchParams.delete("utm_term"),t.toString()}catch{return""}}function V7({value:e,onChange:t,className:a}){let{t:r}=l1("marketing"),[o,n]=zN.useState({...d1,...e}),i=LN(o),c=(d,m)=>{let u={...o,[d]:m};n(u),t?.(u,LN(u))},s=async()=>{!i||typeof navigator>"u"||!navigator.clipboard||await navigator.clipboard.writeText(i)};return Tl(Y,{"data-slot":"utm-builder",className:a,children:[Tl(le,{children:[Tl(ie,{className:"flex items-center gap-2",children:[to(kc,{className:"size-4"}),r("utmBuilder.title")]}),to(Ga,{children:r("utmBuilder.description")})]}),Tl(J,{className:"space-y-4",children:[Tl("div",{className:"grid gap-3 md:grid-cols-2",children:[to(lm,{label:r("utmBuilder.url"),value:o.url,onChange:d=>c("url",d),className:"md:col-span-2"}),to(lm,{label:r("utmBuilder.source"),value:o.source,onChange:d=>c("source",d)}),to(lm,{label:r("utmBuilder.medium"),value:o.medium,onChange:d=>c("medium",d)}),to(lm,{label:r("utmBuilder.campaign"),value:o.campaign,onChange:d=>c("campaign",d)}),to(lm,{label:r("utmBuilder.content"),value:o.content??"",onChange:d=>c("content",d)}),to(lm,{label:r("utmBuilder.term"),value:o.term??"",onChange:d=>c("term",d)})]}),Tl("div",{className:"bg-muted/30 rounded-lg border p-3",children:[Tl("div",{className:"mb-2 flex items-center justify-between gap-2",children:[to("span",{className:"text-muted-foreground text-xs font-medium",children:r("utmBuilder.resultUrl")}),to(C,{size:"icon-xs",variant:"ghost","aria-label":r("utmBuilder.copyUrl"),disabled:!i,onClick:s,children:to(zt,{})})]}),to("p",{className:l("text-xs break-all",!i&&"text-destructive"),children:i||r("utmBuilder.invalidUrl")})]})]})]})}function lm({label:e,value:t,onChange:a,className:r}){let o=`utm-${e.toLowerCase()}`;return Tl("div",{className:l("space-y-1.5",r),children:[to(ue,{htmlFor:o,children:e}),to(T,{id:o,value:t,onChange:n=>a(n.target.value)})]})}import"react";import{useTranslation as c1}from"react-i18next";import{jsx as xs,jsxs as dm}from"react/jsx-runtime";function Q7({versions:e,onRestore:t,className:a,...r}){let{t:o}=c1("data");return xs("div",{"data-slot":"version-history",className:l("space-y-3",a),...r,children:e.map((n,i)=>dm("div",{className:"relative rounded-lg border p-4",children:[i<e.length-1&&xs("span",{className:"bg-border absolute top-[calc(1rem+0.25rem+0.375rem)] left-[calc(1rem+0.375rem)] h-[calc(100%+0.75rem+2px)] w-px"}),dm("div",{className:"flex items-start gap-3",children:[xs("span",{className:"border-background bg-primary relative z-10 mt-1 size-3 rounded-full border-2"}),dm("div",{className:"min-w-0 flex-1",children:[dm("div",{className:"flex flex-wrap items-center gap-2",children:[xs("p",{className:"text-sm font-medium",children:n.title}),xs(B,{variant:n.current?"default":"outline",children:n.version}),n.current&&xs(B,{variant:"secondary",children:o("versionHistory.current")})]}),dm("p",{className:"text-muted-foreground mt-1 text-xs",children:[n.author," \xB7 ",n.timestamp]}),n.description&&xs("p",{className:"mt-2 text-sm",children:n.description}),n.changes&&xs("ul",{className:"text-muted-foreground mt-2 list-disc space-y-1 pl-4 text-xs",children:n.changes.map(c=>xs("li",{children:c},c))})]}),!n.current&&t&&dm(C,{size:"sm",variant:"outline",onClick:()=>t(n),children:[xs(Qh,{}),o("versionHistory.restore")]})]})]},n.id))})}import"react";import{jsx as u1,jsxs as p1}from"react/jsx-runtime";var AN={default:{bg:"bg-muted",text:"text-muted-foreground",border:"border-muted"},primary:{bg:"bg-primary/10",text:"text-primary",border:"border-primary/20"},success:{bg:"bg-green-50 dark:bg-green-950",text:"text-green-700 dark:text-green-300",border:"border-green-200 dark:border-green-900"},warning:{bg:"bg-amber-50 dark:bg-amber-950",text:"text-amber-700 dark:text-amber-300",border:"border-amber-200 dark:border-amber-900"},error:{bg:"bg-red-50 dark:bg-red-950",text:"text-red-700 dark:text-red-300",border:"border-red-200 dark:border-red-900"},info:{bg:"bg-blue-50 dark:bg-blue-950",text:"text-blue-700 dark:text-blue-300",border:"border-blue-200 dark:border-blue-900"},muted:{bg:"bg-muted/50",text:"text-muted-foreground",border:"border-muted"},blue:{bg:"bg-blue-50 dark:bg-blue-950",text:"text-blue-700 dark:text-blue-300",border:"border-blue-200 dark:border-blue-900"},red:{bg:"bg-red-50 dark:bg-red-950",text:"text-red-700 dark:text-red-300",border:"border-red-200 dark:border-red-900"},orange:{bg:"bg-orange-50 dark:bg-orange-950",text:"text-orange-700 dark:text-orange-300",border:"border-orange-200 dark:border-orange-900"},gold:{bg:"bg-yellow-50 dark:bg-yellow-950",text:"text-yellow-700 dark:text-yellow-300",border:"border-yellow-200 dark:border-yellow-900"},cyan:{bg:"bg-cyan-50 dark:bg-cyan-950",text:"text-cyan-700 dark:text-cyan-300",border:"border-cyan-200 dark:border-cyan-900"},green:{bg:"bg-emerald-50 dark:bg-emerald-950",text:"text-emerald-700 dark:text-emerald-300",border:"border-emerald-200 dark:border-emerald-900"},processing:{bg:"bg-blue-50 dark:bg-blue-950",text:"text-blue-700 dark:text-blue-300",border:"border-blue-200 dark:border-blue-900"}},m1={sm:"px-1.5 py-0.5 text-xs gap-1",md:"px-2 py-0.5 text-xs gap-1.5",lg:"px-2.5 py-1 text-sm gap-1.5"};function EN({className:e,color:t,size:a="md",dot:r=!1,colorConfig:o,children:n,...i}){let s={...AN,...o}[t]??AN.default;return p1("span",{"data-slot":"color-tag",className:l("inline-flex items-center rounded-md border font-medium",s.bg,s.text,s.border,m1[a],e),...i,children:[r&&u1("span",{className:l("size-1.5 rounded-full",s.text),"aria-hidden":"true"}),n]})}import"react";import{jsx as b1}from"react/jsx-runtime";var g1={biz:{draft:["\u8349\u7A3F","default"],pending:["\u5904\u7406\u4E2D","info"],processing:["\u5904\u7406\u4E2D","info"],approved:["\u5DF2\u901A\u8FC7","success"],active:["\u5DF2\u542F\u7528","success"],success:["\u6210\u529F","success"],rejected:["\u5DF2\u9A73\u56DE","error"],failed:["\u5931\u8D25","error"],canceled:["\u5DF2\u53D6\u6D88","default"],inactive:["\u5DF2\u505C\u7528","default"],closed:["\u5DF2\u5173\u95ED","default"]},"active-inactive":{1:["\u6FC0\u6D3B","success"],0:["\u505C\u7528","default"],true:["\u6FC0\u6D3B","success"],false:["\u505C\u7528","default"],active:["\u6FC0\u6D3B","success"],inactive:["\u505C\u7528","default"],yes:["\u662F","success"],no:["\u5426","default"]},"open-closed":{open:["\u8FDB\u884C\u4E2D","info"],closed:["\u5DF2\u5173\u95ED","default"],done:["\u5DF2\u5B8C\u6210","success"],todo:["\u5F85\u5904\u7406","default"]}};function f1({value:e,preset:t,mapping:a,label:r,size:o="md",dot:n=!1,className:i}){let s={...t?g1[t]:{},...a??{}},d=String(e),m=s[d],u=r??m?.[0]??e,p=m?.[1]??"default";return b1(EN,{color:p,size:o,dot:n,className:i,children:u})}import{toast as wi}from"sonner";function cm(e){let t={};return e?.key!==void 0&&(t.id=e.key),e?.duration!==void 0&&(t.duration=e.duration),e?.description!==void 0&&(t.description=e.description),e?.action&&(t.action={label:e.action.label,onClick:e.action.onClick}),e?.icon!==void 0&&(t.icon=e.icon),e?.className!==void 0&&(t.classNames={toast:e.className}),e?.onClick&&(t.onClick=e.onClick),e?.onDismiss&&(t.onDismiss=e.onDismiss),e?.onAutoClose&&(t.onAutoClose=e.onAutoClose),t}var FN={duration:3,maxCount:5,placement:"top-right",richColors:!0,expand:!1},$N=Object.assign((e,t)=>wi(e,cm(t)),{success:(e,t)=>wi.success(e,cm(t)),error:(e,t)=>wi.error(e,cm(t)),warning:(e,t)=>wi.warning(e,cm(t)),info:(e,t)=>wi.info(e,cm(t)),loading:(e,t)=>{let a=cm({...t,duration:t?.duration??0});return wi.loading(e,a)},promise:(e,t)=>wi.promise(e,{loading:t.loading??"Loading...",success:t.success,error:t.error}),destroy:e=>{e!==void 0?wi.dismiss(e):wi.dismiss()},config:e=>{FN={...FN,...e}}});function Bf(e,t={}){let{idKey:a="id",parentKey:r="parentId",childrenKey:o="children",rootParentId:n}=t,i=new Map,c=[];for(let s of e)i.set(s[a],{...s,[o]:[]});for(let s of e){let d=i.get(s[a]),m=s[r];if(m==null||m===n||!i.has(m))c.push(d);else{let u=i.get(m);u&&u[o].push(d)}}return c}import"react";import{jsx as HN}from"react/jsx-runtime";function x1({className:e,gap:t=3,...a}){let r=typeof t=="number"?`${t*.25}rem`:t;return HN("div",{"data-slot":"dialog-form-body",className:l("flex flex-col py-4",e),style:{gap:r},...a})}function v1({className:e,gap:t=4,direction:a="vertical",...r}){let o=typeof t=="number"?`${t*.25}rem`:t;return HN("div",{"data-slot":"form-stack",className:l("flex",a==="vertical"?"flex-col":"flex-row flex-wrap",e),style:{gap:o},...r})}import*as Lf from"react";import{jsx as vs,jsxs as ON}from"react/jsx-runtime";var VN={sm:"gap-2",md:"gap-4",lg:"gap-6"};function h1({className:e,sidebar:t,main:a,sidebarWidth:r=300,gap:o="md",collapsible:n=!1,masterOpen:i,defaultMasterOpen:c=!1,onMasterOpenChange:s,masterToggle:d,collapsibleDesktop:m=!1,...u}){let[p,f]=Lf.useState(c),x=i!==void 0,v=x?i:p,N=Lf.useCallback(y=>{x||f(y),s?.(y)},[x,s]),h={maxWidth:r},b={width:"100%",maxWidth:r};if(!n)return ON("div",{"data-slot":"master-detail-layout",className:l("flex flex-col md:flex-row",VN[o],e),...u,children:[vs("aside",{className:"w-full shrink-0 md:overflow-y-auto md:border-r",style:h,children:vs("div",{style:b,children:t})}),vs("div",{className:"min-w-0 flex-1",children:a})]});let g=d??vs("button",{type:"button","aria-label":"Toggle master",onClick:()=>N(!v),className:l("inline-flex size-9 items-center justify-center rounded-md border bg-background text-foreground hover:bg-muted",m?"":"md:hidden"),children:vs(bg,{className:"size-4"})});return ON("div",{"data-slot":"master-detail-layout",className:l("flex flex-col md:flex-row",VN[o],e),...u,children:[vs("div",{className:m?"":"md:hidden",children:g}),vs("aside",{style:h,className:l("shrink-0 md:overflow-y-auto md:border-r md:static md:bg-transparent md:p-0 md:transition-all md:duration-200",m?v?"md:w-auto md:translate-x-0 md:opacity-100":"md:!w-0 md:!max-w-0 md:overflow-hidden md:opacity-0 md:border-r-0":"md:w-auto md:translate-x-0","fixed inset-y-0 left-0 z-50 w-[85vw] max-w-[320px] border-r bg-background p-3 shadow-lg transition-transform duration-200",v?"translate-x-0":"-translate-x-full"),children:vs("div",{style:b,children:t})}),v&&vs("button",{type:"button","aria-label":"Close master",tabIndex:-1,onClick:()=>N(!1),className:"fixed inset-0 z-40 bg-black/30 md:hidden"}),vs("div",{className:"min-w-0 flex-1",children:a})]})}import"react";import{jsx as Rl,jsxs as UN}from"react/jsx-runtime";function y1({variant:e="centered",brand:t,brandClassName:a,formMaxWidth:r="420px",className:o,children:n,...i}){return e==="split"||t?UN("div",{"data-slot":"auth-layout","data-variant":"split",className:l("flex min-h-svh bg-background",o),...i,children:[Rl("div",{className:l("hidden lg:flex lg:w-1/2 lg:flex-col lg:items-center lg:justify-center bg-gradient-to-br from-primary/10 via-primary/5 to-background border-r",a),children:t??UN("div",{className:"flex flex-col items-center gap-4 p-8 text-center",children:[Rl("div",{className:"flex size-16 items-center justify-center rounded-2xl bg-primary text-primary-foreground text-2xl font-bold",children:"C"}),Rl("div",{className:"text-xl font-semibold",children:"Chaos UI"}),Rl("div",{className:"max-w-sm text-sm text-muted-foreground",children:"Enterprise management platform"})]})}),Rl("div",{className:"flex flex-1 items-center justify-center p-4 lg:p-8",children:Rl("div",{className:"w-full",style:{maxWidth:r},children:n})})]}):Rl("div",{"data-slot":"auth-layout","data-variant":"centered",className:l("flex min-h-svh items-center justify-center bg-gradient-to-br from-primary/10 via-background to-secondary/10 p-4",o),...i,children:Rl("div",{className:"w-full",style:{maxWidth:r},children:n})})}import"react";import{jsx as Sl,jsxs as Cv}from"react/jsx-runtime";function $q({title:e="\u7F16\u8F91",onBack:t,onSave:a,onCancel:r,loading:o=!1,children:n,className:i}){return Cv("div",{"data-slot":"master-edit-template",className:l("flex flex-col gap-4",i),role:"region","aria-label":`\u7F16\u8F91\u9875 ${e}`,children:[Cv("div",{className:"flex items-center gap-3",children:[t&&Sl(C,{type:"button",variant:"outline",size:"icon","aria-label":"\u8FD4\u56DE",onClick:t,children:Sl(Yi,{})}),Sl("h2",{className:"text-lg font-semibold",children:e})]}),Sl("div",{className:"flex-1 rounded-lg border bg-card p-4",children:n}),Cv("div",{className:"flex items-center justify-end gap-2 border-t pt-3",children:[r&&Sl(C,{type:"button",variant:"outline",onClick:r,disabled:o,icon:Sl(Q,{}),children:"\u53D6\u6D88"}),a&&Sl(C,{type:"button",onClick:a,disabled:o,icon:Sl(ol,{}),"aria-busy":o,children:o?"\u4FDD\u5B58\u4E2D":"\u4FDD\u5B58"})]})]})}import*as WN from"react";import{jsx as Td,jsxs as kv}from"react/jsx-runtime";function _q({title:e="\u5217\u8868",onCreate:t,onSearch:a,searchPlaceholder:r="\u641C\u7D22...",children:o,className:n}){let[i,c]=WN.useState(""),s=d=>{d.preventDefault(),a?.(i)};return kv("div",{"data-slot":"master-list-template",className:l("flex flex-col gap-4",n),role:"region","aria-label":`\u5217\u8868\u9875 ${e}`,children:[kv("div",{className:"flex flex-wrap items-center gap-3",children:[Td("h2",{className:"text-lg font-semibold",children:e}),a&&kv("form",{role:"search",onSubmit:s,className:"relative ml-auto",children:[Td(X,{className:"pointer-events-none absolute left-2 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"}),Td("input",{type:"search",value:i,onChange:d=>c(d.target.value),placeholder:r,"aria-label":r,className:"h-8 w-56 rounded-lg border bg-background pl-8 pr-3 text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring"})]}),t&&Td(C,{type:"button",onClick:t,icon:Td(ge,{}),children:"\u65B0\u589E"})]}),Td("div",{className:"flex-1 rounded-lg border bg-card",children:o??Td("p",{className:"p-8 text-center text-sm text-muted-foreground",children:"\u6682\u65E0\u6570\u636E"})})]})}import*as zf from"react";import{jsx as ur,jsxs as Do}from"react/jsx-runtime";function Xq({photos:e=[],onApprove:t,onReject:a,className:r}){let[o,n]=zf.useState(0),[i,c]=zf.useState(""),[s,d]=zf.useState(e.map(()=>({status:"pending"}))),m=e[o],u=m?o:0,p=()=>{m&&(d(v=>{let N=[...v];return N[u]={status:"approved"},N}),t?.(u))},f=()=>{if(!m)return;let v=i.trim()||"\u672A\u901A\u8FC7\u5BA1\u6838";d(N=>{let h=[...N];return h[u]={status:"rejected",reason:v},h}),a?.(u,v),c("")},x=v=>{v.key==="ArrowRight"?(v.preventDefault(),n(N=>Math.min(N+1,Math.max(0,e.length-1)))):v.key==="ArrowLeft"&&(v.preventDefault(),n(N=>Math.max(N-1,0)))};return Do(Y,{"data-slot":"photo-audit",className:l("w-full",r),onKeyDown:x,tabIndex:0,role:"group","aria-label":"\u7167\u7247\u5BA1\u6838",children:[ur(le,{children:Do(ie,{className:"flex items-center justify-between",children:[ur("span",{children:"\u7167\u7247\u5BA1\u6838"}),ur("span",{className:"text-sm font-normal text-muted-foreground tabular-nums",children:e.length>0?`${u+1} / ${e.length}`:"0 / 0"})]})}),Do(J,{className:"flex flex-col gap-4",children:[m?Do("figure",{className:"overflow-hidden rounded-lg border bg-muted",children:[ur("img",{src:m.src,alt:m.alt??`\u7167\u7247 ${u+1}`,className:"h-64 w-full object-cover",loading:"lazy"}),Do("figcaption",{className:"flex items-center justify-between px-3 py-2 text-sm",children:[ur("span",{className:"truncate text-muted-foreground",children:m.alt??`\u7167\u7247 ${u+1}`}),s[u]?.status==="approved"&&Do("span",{className:"inline-flex items-center gap-1 text-emerald-600",children:[ur(U,{})," \u5DF2\u901A\u8FC7"]}),s[u]?.status==="rejected"&&Do("span",{className:"inline-flex items-center gap-1 text-destructive",children:[ur(Q,{})," \u5DF2\u9A73\u56DE"]})]})]}):Do("div",{className:"flex h-64 flex-col items-center justify-center gap-2 rounded-lg border border-dashed text-muted-foreground",children:[ur(ha,{className:"size-8"}),ur("span",{className:"text-sm",children:"\u6682\u65E0\u5F85\u5BA1\u6838\u7167\u7247"})]}),m&&Do("div",{className:"flex flex-col gap-3",children:[ur(St,{placeholder:"\u9A73\u56DE\u7406\u7531\uFF08\u5982\u9700\u9A73\u56DE\u8BF7\u586B\u5199\uFF09",value:i,onChange:v=>c(v.target.value),"aria-label":"\u9A73\u56DE\u7406\u7531",rows:2}),Do("div",{className:"flex items-center gap-2",children:[Do(C,{type:"button",variant:"outline",onClick:p,children:[ur(U,{})," \u901A\u8FC7"]}),Do(C,{type:"button",variant:"destructive",onClick:f,children:[ur(Q,{})," \u9A73\u56DE"]}),Do("div",{className:"ml-auto flex items-center gap-1",children:[ur(C,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"\u4E0A\u4E00\u5F20",disabled:u===0,onClick:()=>n(v=>Math.max(v-1,0)),children:ur(et,{})}),ur(C,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"\u4E0B\u4E00\u5F20",disabled:u>=e.length-1,onClick:()=>n(v=>Math.min(v+1,e.length-1)),children:ur(me,{})})]})]})]})]})]})}import{jsx as Rd,jsxs as ju}from"react/jsx-runtime";function aG({logs:e,className:t}){return ju("ol",{"data-slot":"operation-log",className:l("flex flex-col gap-3",t),role:"list",children:[e.map(a=>ju("li",{className:"relative flex gap-3 pl-5",children:[Rd("span",{"aria-hidden":"true",className:"absolute left-0 top-1.5 size-2 rounded-full bg-primary ring-2 ring-primary/20"}),ju("div",{className:"flex-1",children:[ju("div",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-0.5",children:[Rd("span",{className:"text-sm font-medium",children:a.action}),Rd("time",{className:"text-xs text-muted-foreground tabular-nums",dateTime:a.timestamp,children:ni(a.timestamp)})]}),ju("div",{className:"mt-0.5 flex items-center gap-1 text-xs text-muted-foreground",children:[Rd(js,{className:"size-3"}),Rd("span",{children:a.operator})]}),a.detail?Rd("p",{className:"mt-1 text-xs text-muted-foreground",children:a.detail}):null]})]},a.id)),e.length===0?Rd("li",{className:"py-4 text-center text-sm text-muted-foreground",children:"\u6682\u65E0\u64CD\u4F5C\u65E5\u5FD7"}):null]})}import{jsx as mm,jsxs as _N}from"react/jsx-runtime";function lG({items:e,onItemClick:t,className:a}){return mm("ul",{"data-slot":"bill-todo-list",className:l("flex flex-col gap-1",a),children:e.map(r=>mm("li",{children:_N("button",{type:"button",onClick:()=>t?.(r.id),className:"flex w-full items-center gap-2 rounded-lg px-2 py-2 text-left text-sm hover:bg-muted/40",children:[mm("span",{className:"rounded bg-muted px-1.5 py-0.5 text-xs text-muted-foreground",children:r.type}),mm("span",{className:"flex-1 truncate",children:r.title}),r.deadline&&_N("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[mm(pe,{className:"size-3"}),tt(r.deadline)]}),mm(me,{className:"size-4 text-muted-foreground"})]})},r.id))})}import*as Af from"react";import{jsx as da,jsxs as hs}from"react/jsx-runtime";function N1(e){let t=new Date,a={yyyy:String(t.getFullYear()),yy:String(t.getFullYear()).slice(-2),MM:String(t.getMonth()+1).padStart(2,"0"),dd:String(t.getDate()).padStart(2,"0"),HH:String(t.getHours()).padStart(2,"0"),mm:String(t.getMinutes()).padStart(2,"0"),ss:String(t.getSeconds()).padStart(2,"0")},r=e.dateFormat;for(let[n,i]of Object.entries(a))r=r.replaceAll(n,i);let o=String(1).padStart(Math.max(0,e.zeroFill),"0");return[e.prefix,r,o].filter(Boolean).join(e.separator||"-")}function gG({rules:e=[],onChange:t,className:a}){let[r,o]=Af.useState(e);Af.useEffect(()=>{o(e)},[e]);let n=m=>{o(m),t?.(m)},i=(m,u)=>{let p=r.map((f,x)=>x===m?{...f,...u}:f);n(p)},c=()=>{n([...r,{prefix:"NO",dateFormat:"yyyyMMdd",zeroFill:4,separator:"-"}])},s=m=>{n(r.filter((u,p)=>p!==m))},d=m=>{let u=r[m];if(!u)return;let p={...u};n([...r,p])};return hs(Y,{"data-slot":"serial-number-manager",className:l("w-full",a),children:[da(le,{children:hs(ie,{className:"flex items-center justify-between",children:[da("span",{children:"\u7F16\u53F7\u89C4\u5219\u7BA1\u7406"}),hs(C,{type:"button",variant:"outline",size:"sm",onClick:c,children:[da(ge,{})," \u65B0\u589E\u89C4\u5219"]})]})}),da(J,{className:"flex flex-col gap-3",children:r.length===0?da("p",{className:"py-6 text-center text-sm text-muted-foreground",children:"\u6682\u65E0\u7F16\u53F7\u89C4\u5219\uFF0C\u70B9\u51FB\u201C\u65B0\u589E\u89C4\u5219\u201D\u521B\u5EFA\u3002"}):da("ul",{role:"list",className:"flex flex-col gap-3",children:r.map((m,u)=>hs("li",{className:"flex flex-col gap-3 rounded-lg border bg-muted/30 p-3",children:[hs("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[hs("div",{className:"flex flex-col gap-1",children:[da(ue,{htmlFor:`prefix-${u}`,children:"\u524D\u7F00"}),da(T,{id:`prefix-${u}`,value:m.prefix,onChange:p=>i(u,{prefix:p.target.value}),placeholder:"BILL"})]}),hs("div",{className:"flex flex-col gap-1",children:[da(ue,{htmlFor:`date-${u}`,children:"\u65E5\u671F\u683C\u5F0F"}),da(T,{id:`date-${u}`,value:m.dateFormat,onChange:p=>i(u,{dateFormat:p.target.value}),placeholder:"yyyyMMdd"})]}),hs("div",{className:"flex flex-col gap-1",children:[da(ue,{htmlFor:`fill-${u}`,children:"\u8865\u96F6\u4F4D\u6570"}),da(T,{id:`fill-${u}`,type:"number",min:0,value:m.zeroFill,onChange:p=>i(u,{zeroFill:Math.max(0,Number(p.target.value)||0)})})]}),hs("div",{className:"flex flex-col gap-1",children:[da(ue,{htmlFor:`sep-${u}`,children:"\u5206\u9694\u7B26"}),da(T,{id:`sep-${u}`,value:m.separator,onChange:p=>i(u,{separator:p.target.value}),placeholder:"-"})]})]}),hs("div",{className:"flex items-center justify-between gap-2",children:[da("span",{className:"text-xs text-muted-foreground",children:"\u793A\u4F8B\uFF1A"}),da("code",{className:"flex-1 truncate rounded bg-card px-2 py-1 text-xs font-mono",children:N1(m)}),da(C,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"\u590D\u5236\u89C4\u5219",onClick:()=>d(u),children:da(zt,{})}),da(C,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"\u5220\u9664\u89C4\u5219",onClick:()=>s(u),children:da(ye,{})})]})]},u))})})]})}import*as um from"react";import{jsx as bn,jsxs as Sd}from"react/jsx-runtime";function wG({schema:e,value:t,onChange:a,className:r}){let o=um.useRef(t??{});um.useEffect(()=>{t&&(o.current=t)},[t]);let n=um.useCallback((c,s)=>{let d={...o.current,[c]:s};o.current=d,a?.(d)},[a]),i=c=>!c||c.length===0?[]:c.map(s=>{if(typeof s=="string")return{value:s,label:s};if(s&&typeof s=="object"&&"value"in s){let d=s;return{value:String(d.value),label:d.label??String(d.value)}}return{value:String(s),label:String(s)}});return bn("form",{"data-slot":"dynamic-form-builder",className:l("flex flex-col gap-4",r),onSubmit:c=>c.preventDefault(),children:e.length===0?bn("p",{className:"text-sm text-muted-foreground",children:"\u6682\u65E0\u5B57\u6BB5"}):e.map(c=>{let s=`dfb-${c.name}`,d=o.current[c.name],m=Sd(ue,{htmlFor:s,children:[c.label,c.required?bn("span",{className:"ml-0.5 text-destructive",children:"*"}):null]});if(c.type==="select"){let p=i(c.options);return Sd("div",{className:"flex flex-col gap-1.5",children:[m,Sd(Pe,{value:typeof d=="string"?d:void 0,onValueChange:f=>n(c.name,f??""),children:[bn(Re,{id:s,children:bn(Te,{placeholder:"\u8BF7\u9009\u62E9"})}),bn(Se,{children:p.map(f=>bn(ve,{value:f.value,children:f.label},f.value))})]})]},c.name)}if(c.type==="textarea")return Sd("div",{className:"flex flex-col gap-1.5",children:[m,bn(St,{id:s,value:typeof d=="string"?d:"",onChange:p=>n(c.name,p.target.value)})]},c.name);if(c.type==="checkbox")return Sd("div",{className:"flex items-center gap-2",children:[bn(ja,{id:s,checked:d===!0,onCheckedChange:p=>n(c.name,p===!0)}),bn(ue,{htmlFor:s,children:c.label})]},c.name);if(c.type==="switch")return Sd("div",{className:"flex items-center justify-between gap-2",children:[m,bn($n,{checked:d===!0,onCheckedChange:p=>n(c.name,p)})]},c.name);let u=c.type==="number"||c.type==="date"?c.type:"text";return Sd("div",{className:"flex flex-col gap-1.5",children:[m,bn(T,{id:s,type:u,value:d==null?"":String(d),onChange:p=>n(c.name,c.type==="number"?p.target.valueAsNumber:p.target.value)})]},c.name)})})}import{jsx as Mo,jsxs as Ku}from"react/jsx-runtime";function C1({status:e}){switch(e){case"done":return Mo("span",{className:"flex size-6 items-center justify-center rounded-full bg-emerald-500 text-white",children:Mo(U,{className:"size-3.5"})});case"active":return Mo("span",{className:"flex size-6 items-center justify-center rounded-full bg-primary text-primary-foreground",children:Mo(Pr,{className:"size-3.5 animate-spin"})});case"rejected":return Mo("span",{className:"flex size-6 items-center justify-center rounded-full bg-destructive text-white",children:Mo(Q,{className:"size-3.5"})});default:return Mo("span",{className:"flex size-6 items-center justify-center rounded-full border border-border bg-background text-muted-foreground",children:Mo(pe,{className:"size-3.5"})})}}function IG({steps:e,className:t}){return Mo("ol",{"data-slot":"flow-tracker",className:l("flex flex-col gap-0",t),role:"list",children:e.map((a,r)=>{let o=r===e.length-1,n=a.status==="rejected";return Ku("li",{className:"flex gap-3",children:[Ku("div",{className:"flex flex-col items-center",children:[Mo(C1,{status:a.status}),o?null:Mo("span",{"aria-hidden":"true",className:l("my-1 w-px flex-1",n?"bg-destructive/30":"bg-border")})]}),Ku("div",{className:"flex-1 pb-4",children:[Ku("div",{className:"flex items-center justify-between gap-2",children:[Mo("span",{className:"text-sm font-medium",children:a.name}),a.time?Mo("time",{className:"text-xs text-muted-foreground tabular-nums",children:a.time}):null]}),a.operator?Ku("p",{className:"mt-0.5 text-xs text-muted-foreground",children:["\u64CD\u4F5C\u4EBA\uFF1A",a.operator]}):null]})]},a.id)})})}import*as wv from"react";import{jsx as pr,jsxs as Qu}from"react/jsx-runtime";function AG({nodes:e=[],onSelect:t,className:a}){let[r,o]=wv.useState(""),[n,i]=wv.useState(null),c=e.filter(d=>d.name.toLowerCase().includes(r.trim().toLowerCase())),s=()=>{n&&t?.(n)};return Qu("div",{"data-slot":"rebut-node-select",className:l("flex flex-col gap-3 rounded-lg border bg-card p-4",a),role:"group","aria-label":"\u9A73\u56DE\u8282\u70B9\u9009\u62E9",children:[Qu("div",{className:"flex items-center justify-between",children:[pr("h3",{className:"text-sm font-semibold",children:"\u9009\u62E9\u9A73\u56DE\u8282\u70B9"}),Qu("span",{className:"text-xs text-muted-foreground tabular-nums",children:["\u5171 ",e.length," \u4E2A\u8282\u70B9"]})]}),Qu("div",{className:"relative",children:[pr(X,{className:"pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"}),pr("input",{type:"text",value:r,onChange:d=>o(d.target.value),placeholder:"\u641C\u7D22\u8282\u70B9\u540D\u79F0","aria-label":"\u641C\u7D22\u8282\u70B9\u540D\u79F0",className:"h-8 w-full rounded-md border border-input bg-transparent pl-8 pr-8 text-sm outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50"}),r&&pr("button",{type:"button","aria-label":"\u6E05\u9664\u641C\u7D22",onClick:()=>o(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:pr(Q,{className:"size-4"})})]}),pr(Ue,{}),pr(Wt,{className:"max-h-64",children:c.length>0?pr("ul",{role:"list",className:"flex flex-col gap-1",children:c.map(d=>{let m=d.id===n;return pr("li",{children:Qu("button",{type:"button",onClick:()=>i(d.id),"aria-pressed":m,className:l("flex w-full items-center gap-2 rounded-md px-3 py-2 text-left text-sm transition-colors outline-none focus-visible:ring-3 focus-visible:ring-ring/50",m?"bg-primary/10 text-primary":"hover:bg-muted"),children:[pr(qe,{className:l("size-4 shrink-0",m?"text-primary":"text-muted-foreground/40")}),pr("span",{className:"flex-1 truncate",children:d.name}),m&&pr(_a,{className:"size-4 text-primary"})]})},d.id)})}):pr("p",{className:"py-6 text-center text-sm text-muted-foreground",children:"\u65E0\u5339\u914D\u8282\u70B9"})}),pr(Ue,{}),pr("div",{className:"flex items-center justify-end gap-2",children:pr(C,{type:"button",variant:"default",onClick:s,disabled:!n,children:"\u786E\u8BA4\u9A73\u56DE"})})]})}import*as Ef from"react";import{jsx as Id,jsxs as qN}from"react/jsx-runtime";var k1={approved:"bg-emerald-100 text-emerald-700",pending:"bg-yellow-100 text-yellow-700",rejected:"bg-red-100 text-red-700",processing:"bg-blue-100 text-blue-700"};function VG({nodes:e,edges:t,className:a}){let r=Ef.useMemo(()=>{let o=new Map;t.forEach(d=>o.set(d.from,d.to));let n=e.filter(d=>!t.some(m=>m.to===d.id)),i=[],c=n[0]?.id,s=new Set;for(;c&&!s.has(c);){s.add(c);let d=e.find(m=>m.id===c);d&&i.push(d),c=o.get(c)}return i.length===0?e:i},[e,t]);return Id("div",{"data-slot":"approval-flow",className:l("flex flex-wrap items-center gap-2",a),children:r.map((o,n)=>qN(Ef.Fragment,{children:[qN("div",{className:"flex items-center gap-2 rounded-lg border bg-card px-3 py-2 text-sm",children:[Id("span",{className:l("flex size-5 items-center justify-center rounded-full text-xs",k1[o.status??"pending"]??"bg-muted"),children:o.status==="approved"?Id(U,{className:"size-3"}):o.status==="rejected"?Id(Q,{className:"size-3"}):Id(pe,{className:"size-3"})}),Id("span",{className:"font-medium",children:o.name})]}),n<r.length-1&&Id(me,{className:"size-4 text-muted-foreground"})]},o.id))})}import{jsx as Pv,jsxs as Xu}from"react/jsx-runtime";function GG({onApprove:e,onReject:t,onTransfer:a,status:r,loading:o,className:n}){return Xu("div",{"data-slot":"approval-action-bar",className:l("flex items-center gap-2 rounded-lg border bg-card p-3",n),children:[r&&Xu("span",{className:"mr-auto text-sm text-muted-foreground",children:["\u5F53\u524D\u72B6\u6001\uFF1A",r]}),a&&Xu(C,{variant:"outline",onClick:a,disabled:o,children:[Pv(rs,{className:"size-4"}),"\u8F6C\u4EA4"]}),t&&Xu(C,{variant:"destructive",onClick:t,disabled:o,children:[Pv(Q,{className:"size-4"}),"\u9A73\u56DE"]}),e&&Xu(C,{onClick:e,disabled:o,children:[Pv(U,{className:"size-4"}),"\u901A\u8FC7"]})]})}import{jsx as pm,jsxs as GN}from"react/jsx-runtime";function YG({events:e,className:t}){return pm("ol",{"data-slot":"bill-timeline",className:l("flex flex-col gap-3",t),children:e.map(a=>GN("li",{className:"relative flex gap-3 pl-4",children:[pm("span",{className:"absolute left-0 top-1.5 size-2 rounded-full bg-primary"}),pm("span",{className:"absolute left-[3px] top-4 h-full w-px bg-border"}),GN("div",{children:[pm("div",{className:"text-sm font-medium",children:a.title}),a.description&&pm("div",{className:"text-xs text-muted-foreground",children:a.description}),pm("div",{className:"mt-0.5 text-xs text-muted-foreground",children:ni(a.timestamp)})]})]},a.id))})}import*as Tv from"react";import{jsx as Il,jsxs as Dd}from"react/jsx-runtime";function rj({billId:e,billType:t,onSubmit:a,className:r}){let[o,n]=Tv.useState("idle"),[i,c]=Tv.useState(null),s=async()=>{n("submitting"),c(null);try{await a?.(e),n("done")}catch(d){c(d instanceof Error?d.message:"\u63D0\u4EA4\u5931\u8D25"),n("error")}};return Dd("div",{"data-slot":"oa-bridge",className:l("flex flex-col gap-3 rounded-lg border bg-card p-4",r),role:"region","aria-label":"OA \u7CFB\u7EDF\u6865\u63A5",children:[Dd("div",{className:"flex items-center gap-3",children:[Il("span",{className:"flex size-9 items-center justify-center rounded-lg bg-muted",children:Il(Ji,{className:"size-5 text-muted-foreground"})}),Dd("div",{className:"flex flex-col",children:[Il("span",{className:"text-sm font-medium",children:"\u63D0\u4EA4\u81F3 OA \u7CFB\u7EDF"}),Dd("span",{className:"text-xs text-muted-foreground",children:[t," \xB7 ",e]})]}),Il(_a,{className:"ml-auto size-4 text-muted-foreground"})]}),Dd("p",{className:"text-sm text-muted-foreground",children:["\u5C06\u8BE5",t,"\u63A8\u9001\u81F3 OA \u7CFB\u7EDF\u53D1\u8D77\u5BA1\u6279\u6D41\u7A0B\uFF0C\u63D0\u4EA4\u540E\u53EF\u5728 OA \u7AEF\u8FFD\u8E2A\u5BA1\u6279\u8FDB\u5EA6\u3002"]}),o==="done"?Dd("div",{className:"flex items-center gap-2 rounded-md bg-emerald-50 px-3 py-2 text-sm text-emerald-700",role:"status",children:[Il(qe,{className:"size-4"}),"\u5DF2\u63D0\u4EA4\u81F3 OA \u7CFB\u7EDF\uFF0C\u5355\u636E ",e," \u8FDB\u5165\u5BA1\u6279\u6D41\u7A0B"]}):o==="error"?Dd("div",{className:"flex items-center gap-2 rounded-md bg-red-50 px-3 py-2 text-sm text-destructive",role:"alert",children:["\u63D0\u4EA4\u5931\u8D25\uFF1A",i]}):null,Il("div",{className:"flex justify-end",children:Il(C,{type:"button",onClick:s,disabled:o==="submitting"||o==="done",icon:Il(rs,{}),"aria-busy":o==="submitting",children:o==="submitting"?"\u63D0\u4EA4\u4E2D":o==="done"?"\u5DF2\u63D0\u4EA4":"\u63D0\u4EA4\u81F3 OA"})})]})}import*as zv from"react";import{jsx as ys,jsxs as Rv}from"react/jsx-runtime";var w1=[{label:"\u4E00\u6708",value:38},{label:"\u4E8C\u6708",value:52},{label:"\u4E09\u6708",value:41},{label:"\u56DB\u6708",value:67},{label:"\u4E94\u6708",value:55}],Ff=["#3b82f6","#10b981","#f59e0b","#ef4444","#8b5cf6","#06b6d4"];function Sv({data:e=w1,orientation:t="vertical",height:a=200,className:r}){let o=Math.max(1,...e.map(s=>s.value));if(t==="horizontal")return ys("div",{"data-slot":"bar-chart",className:l("flex flex-col gap-2 text-sm",r),role:"img","aria-label":`\u6A2A\u5411\u67F1\u72B6\u56FE\uFF0C\u5171 ${e.length} \u9879`,children:e.map((s,d)=>Rv("div",{className:"flex items-center gap-2",children:[ys("span",{className:"w-16 shrink-0 truncate text-muted-foreground",children:s.label}),ys("div",{className:"h-5 flex-1 overflow-hidden rounded bg-muted",role:"presentation",children:ys("div",{className:"h-full rounded",style:{width:`${s.value/o*100}%`,backgroundColor:s.color??Ff[d%Ff.length]},children:ys("span",{className:"sr-only",children:q(s.value)})})}),ys("span",{className:"w-12 shrink-0 text-right tabular-nums",children:q(s.value)})]},s.label))});let n=36,i=16,c=e.length*(n+i)+i;return ys("div",{"data-slot":"bar-chart",className:l("w-full text-primary",r),role:"img","aria-label":`\u67F1\u72B6\u56FE\uFF0C\u5171 ${e.length} \u9879\uFF0C\u6700\u5927\u503C ${o}`,children:ys("svg",{viewBox:`0 0 ${c} ${a}`,width:"100%",height:a,preserveAspectRatio:"xMidYMid meet",role:"presentation",children:e.map((s,d)=>{let m=s.value/o*(a-24),u=i+d*(n+i);return Rv("g",{children:[ys("rect",{x:u,y:a-16-m,width:n,height:m,rx:4,fill:s.color??Ff[d%Ff.length],children:Rv("title",{children:[s.label,": ",q(s.value)]})}),ys("text",{x:u+n/2,y:a-4,textAnchor:"middle",className:"fill-muted-foreground text-[10px]",children:s.label})]},s.label)})})})}import{jsx as Md,jsxs as Yu}from"react/jsx-runtime";var $f=["#3b82f6","#10b981","#f59e0b","#ef4444","#8b5cf6"];function Iv({series:e=[{name:"\u8425\u6536",values:[20,35,28,50,44]}],labels:t=["Q1","Q2","Q3","Q4","Q5"],height:a=180,className:r}){let i=e.flatMap(f=>f.values),c=Math.max(1,...i),s=Math.min(0,...i),d=c-s||1,m=Math.max(1,...e.map(f=>f.values.length)),u=304/Math.max(1,m-1),p=f=>8+(1-(f-s)/d)*(a-16);return Yu("div",{"data-slot":"line-chart",className:l("w-full",r),role:"img","aria-label":`\u6298\u7EBF\u56FE\uFF0C${e.length} \u6761\u7EBF\uFF0C${m} \u4E2A\u6570\u636E\u70B9`,children:[Md("svg",{viewBox:`0 0 320 ${a}`,width:"100%",height:a,preserveAspectRatio:"none",role:"presentation",children:e.map((f,x)=>{let v=f.color??$f[x%$f.length],h=`M ${f.values.map((b,g)=>`${8+g*u},${p(b)}`).join(" L ")}`;return Yu("g",{children:[Md("path",{d:h,fill:"none",stroke:v,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round"}),f.values.map((b,g)=>Md("circle",{cx:8+g*u,cy:p(b),r:2.5,fill:v,children:Yu("title",{children:[f.name," ",t[g]??g,": ",q(b)]})},g))]},f.name)})}),Yu("ul",{className:"mt-1 flex flex-wrap items-center justify-between gap-2 text-[10px]",children:[Md("li",{className:"flex gap-3",role:"list",children:e.map((f,x)=>Yu("span",{className:"flex items-center gap-1",children:[Md("span",{className:"inline-block size-2 rounded-sm",style:{backgroundColor:f.color??$f[x%$f.length]},"aria-hidden":"true"}),f.name]},f.name))}),Md("li",{className:"flex justify-between text-muted-foreground",role:"list",style:{flex:1},children:t.slice(0,m).map((f,x)=>Md("span",{children:f},x))})]})]})}import{jsx as gm,jsxs as Dv}from"react/jsx-runtime";var jN=["#3b82f6","#10b981","#f59e0b","#ef4444","#8b5cf6","#06b6d4"];function KN(e,t,a,r){let o=r*Math.PI/180;return{x:e+a*Math.cos(o),y:t+a*Math.sin(o)}}function Mv({data:e=[{label:"\u7EBF\u4E0A",value:58},{label:"\u7EBF\u4E0B",value:32},{label:"\u5176\u4ED6",value:10}],size:t=128,className:a}){let r=e.reduce((d,m)=>d+m.value,0)||1,o=50,n=50,i=46,c=-90,s=e.map((d,m)=>{let u=d.value/r,p=u*360,f=c,x=c+p,v=p>180?1:0,N=KN(o,n,i,f),h=KN(o,n,i,x),b=u>=1?`M ${o} ${n-i} A ${i} ${i} 0 1 1 ${o-.01} ${n-i} Z`:`M ${o} ${n} L ${N.x} ${N.y} A ${i} ${i} 0 ${v} 1 ${h.x} ${h.y} Z`;return c=x,{...d,path:b,color:d.color??jN[m%jN.length]}});return Dv("div",{"data-slot":"pie-chart",className:l("flex flex-wrap items-center gap-4",a),role:"img","aria-label":`\u997C\u56FE\uFF0C\u5171 ${e.length} \u5757\uFF0C\u603B\u8BA1 ${r}`,children:[gm("svg",{viewBox:"0 0 100 100",width:t,height:t,role:"presentation",children:s.map(d=>gm("path",{d:d.path,fill:d.color,children:Dv("title",{children:[d.label,": ",q(d.value)]})},d.label))}),gm("ul",{className:"flex flex-col gap-1.5 text-sm",role:"list",children:s.map(d=>Dv("li",{className:"flex items-center gap-2",children:[gm("span",{className:"size-2.5 shrink-0 rounded-sm",style:{backgroundColor:d.color},"aria-hidden":"true"}),gm("span",{className:"text-muted-foreground",children:d.label}),gm("span",{className:"ml-auto tabular-nums",children:q(d.value)})]},d.label))})]})}import{jsx as Bd,jsxs as Ju}from"react/jsx-runtime";var Hf=["#3b82f6","#10b981","#f59e0b","#ef4444"];function Bv({axes:e=["\u901F\u5EA6","\u8D28\u91CF","\u6210\u672C","\u670D\u52A1","\u521B\u65B0"],series:t=[{name:"\u672C\u671F",values:[80,70,60,75,50]}],max:a=100,className:r}){let c=e.length,s=u=>-Math.PI/2+u*2*Math.PI/c,d=(u,p)=>{let f=Math.min(1,Math.max(0,p/a)),x=s(u);return`${100+80*f*Math.cos(x)},${100+80*f*Math.sin(x)}`},m=[.25,.5,.75,1];return Ju("div",{"data-slot":"radar-chart",className:l("w-full",r),role:"img","aria-label":`\u96F7\u8FBE\u56FE\uFF0C${c} \u4E2A\u7EF4\u5EA6\uFF0C${t.length} \u6761\u6570\u636E`,children:[Ju("svg",{viewBox:"0 0 200 200",width:"100%",role:"presentation",children:[m.map((u,p)=>Bd("polygon",{points:e.map((f,x)=>{let v=s(x);return`${100+80*u*Math.cos(v)},${100+80*u*Math.sin(v)}`}).join(" "),fill:"none",className:"stroke-muted-foreground/20",strokeWidth:.5},p)),e.map((u,p)=>{let f=s(p);return Bd("line",{x1:100,y1:100,x2:100+80*Math.cos(f),y2:100+80*Math.sin(f),className:"stroke-muted-foreground/20",strokeWidth:.5},p)}),t.map((u,p)=>{let f=u.color??Hf[p%Hf.length];return Ju("g",{children:[Bd("polygon",{points:u.values.map((x,v)=>d(v,x)).join(" "),fill:f,fillOpacity:.15,stroke:f,strokeWidth:1.5}),u.values.map((x,v)=>{let N=s(v),h=Math.min(1,Math.max(0,x/a));return Bd("circle",{cx:100+80*h*Math.cos(N),cy:100+80*h*Math.sin(N),r:2,fill:f,children:Ju("title",{children:[u.name," ",e[v],": ",q(x)]})},v)})]},u.name)}),e.map((u,p)=>{let f=s(p),x=100+92*Math.cos(f),v=100+92*Math.sin(f);return Bd("text",{x,y:v,textAnchor:"middle",dominantBaseline:"middle",className:"fill-muted-foreground text-[9px]",children:u},p)})]}),Bd("ul",{className:"mt-1 flex flex-wrap justify-center gap-3 text-[10px]",role:"list",children:t.map((u,p)=>Ju("li",{className:"flex items-center gap-1",children:[Bd("span",{className:"inline-block size-2 rounded-sm",style:{backgroundColor:u.color??Hf[p%Hf.length]},"aria-hidden":"true"}),u.name]},u.name))})]})}import{jsx as fm,jsxs as XN}from"react/jsx-runtime";var QN=["#3b82f6","#10b981","#f59e0b","#ef4444"];function Lv({data:e=[{x:10,y:20},{x:30,y:50},{x:50,y:35},{x:70,y:70},{x:90,y:55}],xLabel:t="X",yLabel:a="Y",height:r=200,className:o}){let c=e.map(h=>h.x),s=e.map(h=>h.y),d=Math.max(1,...c),m=Math.min(0,...c),u=Math.max(1,...s),p=Math.min(0,...s),f=d-m||1,x=u-p||1,v=h=>28+(h-m)/f*264,N=h=>r-28-(h-p)/x*(r-56);return fm("div",{"data-slot":"scatter-chart",className:l("w-full",o),role:"img","aria-label":`\u6563\u70B9\u56FE\uFF0C\u5171 ${e.length} \u4E2A\u70B9`,children:XN("svg",{viewBox:`0 0 320 ${r}`,width:"100%",height:r,role:"presentation",children:[fm("line",{x1:28,y1:r-28,x2:292,y2:r-28,className:"stroke-muted-foreground/30",strokeWidth:.5}),fm("line",{x1:28,y1:28,x2:28,y2:r-28,className:"stroke-muted-foreground/30",strokeWidth:.5}),e.map((h,b)=>fm("circle",{cx:v(h.x),cy:N(h.y),r:4,fill:h.color??QN[b%QN.length],children:XN("title",{children:[h.label?`${h.label}: `:"","(",q(h.x),", ",q(h.y),")"]})},b)),fm("text",{x:292,y:r-28+16,textAnchor:"end",className:"fill-muted-foreground text-[9px]",children:t}),fm("text",{x:24,y:28,textAnchor:"end",dominantBaseline:"hanging",className:"fill-muted-foreground text-[9px]",children:a})]})})}import{jsx as bm,jsxs as YN}from"react/jsx-runtime";function Ld(e){return typeof e=="number"&&Number.isFinite(e)?e:typeof e=="string"?Number(e):0}function Vf(e){return typeof e=="string"?e:e==null?"":String(e)}function Lj({type:e,data:t,xField:a="x",yField:r="y",series:o,height:n=200,className:i}){let c=t,s=zv.useMemo(()=>{let u=new Map;for(let p of c){let f=o?Vf(p[o]):"\u9ED8\u8BA4",x=u.get(f);x?x.push(p):u.set(f,[p])}return Array.from(u.entries())},[c,o]),d=zv.useMemo(()=>s[0]?.[1].map(u=>Vf(u[a]))??[],[s,a]),m;if(e==="pie"){let u=c.map(p=>({label:Vf(p[a]),value:Ld(p[r])}));m=bm(Mv,{data:u})}else if(e==="scatter"){let u=c.map(p=>({x:Ld(p[a]),y:Ld(p[r])}));m=bm(Lv,{data:u,xLabel:a,yLabel:r,height:n})}else if(e==="radar"){let u=d.length>0?d:["A","B","C"],p=s.map(([f,x])=>({name:f,values:x.map(v=>Ld(v[r]))}));m=bm(Bv,{axes:u,series:p})}else if(e==="line"){let u=s.map(([p,f])=>({name:p,values:f.map(x=>Ld(x[r]))}));m=bm(Iv,{series:u,labels:d,height:n})}else{let u=c.map(p=>({label:Vf(p[a]),value:Ld(p[r])}));m=bm(Sv,{data:u,height:n})}return YN("div",{"data-slot":"chart-suite",className:l("w-full",i),role:"figure","aria-label":`\u56FE\u8868\u5957\u4EF6 (${e})\uFF0C\u5171 ${c.length} \u6761\u6570\u636E`,children:[c.length===0?bm("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"\u6682\u65E0\u6570\u636E"}):m,YN("p",{className:"sr-only",children:[e," \u56FE\uFF0C",c.length," \u6761\u8BB0\u5F55\uFF0C\u6700\u5927\u503C"," ",q(Math.max(0,...c.map(u=>Ld(u[r]))))]})]})}import{jsx as zd,jsxs as P1}from"react/jsx-runtime";var JN=["#3b82f6","#6366f1","#8b5cf6","#a855f7","#d946ef"];function $j({data:e,height:t=44,className:a}){let r=e[0]?.value??0,o=e.length;return zd("div",{"data-slot":"funnel-chart",className:l("flex flex-col gap-2",a),role:"img","aria-label":`\u6F0F\u6597\u56FE\uFF0C\u5171 ${o} \u9636\u6BB5`,children:zd("ol",{role:"list",children:e.map((n,i)=>{let c=r>0?Math.max(8,n.value/r*100):100,s=r>0?n.value/r:0;return P1("li",{className:"flex items-center gap-2 py-0.5",style:{minHeight:t},children:[zd("span",{className:"w-20 shrink-0 truncate text-sm text-muted-foreground",children:n.label}),zd("div",{className:"flex flex-1 items-center justify-center",children:zd("div",{className:"flex items-center justify-center rounded text-xs font-medium text-white",style:{width:`${c}%`,height:t-8,backgroundColor:n.color??JN[i%JN.length]},children:zd("span",{className:"truncate px-2 tabular-nums",children:q(n.value)})})}),zd("span",{className:"w-14 shrink-0 text-right text-xs tabular-nums text-muted-foreground",children:bt(s)})]},n.label)})})})}import*as Fv from"react";import{jsx as Ad,jsxs as Ev}from"react/jsx-runtime";function Av(e,t){return Math.round((t.getTime()-e.getTime())/864e5)}function Wj({tasks:e,className:t}){let a=Fv.useMemo(()=>{if(e.length===0)return{min:0,span:1,start:new Date};let n=e.map(u=>new Date(u.start)),i=e.map(u=>new Date(u.end)),c=Math.min(...n.map(u=>u.getTime())),s=Math.max(...i.map(u=>u.getTime())),d=new Date(c);d.setHours(0,0,0,0);let m=Math.max(1,Av(d,new Date(s))+1);return{min:c,span:m,start:d}},[e]),r=28,o=Fv.useMemo(()=>{let n=[];for(let i=0;i<a.span;i++){let c=new Date(a.start);c.setDate(c.getDate()+i),n.push({label:String(c.getDate()),idx:i})}return n},[a]);return Ev("div",{"data-slot":"gantt-chart",className:l("w-full overflow-x-auto rounded-lg border bg-card p-2 text-sm",t),role:"table","aria-label":`\u7518\u7279\u56FE\uFF0C\u5171 ${e.length} \u4E2A\u4EFB\u52A1`,children:[Ev("div",{role:"row",className:"flex border-b pb-1",style:{minWidth:96+a.span*r},children:[Ad("span",{role:"cell",className:"w-24 shrink-0 text-xs text-muted-foreground",children:"\u4EFB\u52A1"}),o.map(n=>Ad("span",{role:"columnheader",className:"shrink-0 text-center text-[10px] text-muted-foreground",style:{width:r},children:n.label},n.idx))]}),e.length===0?Ad("p",{className:"py-4 text-center text-xs text-muted-foreground",children:"\u65E0\u4EFB\u52A1"}):e.map(n=>{let i=new Date(n.start);i.setHours(0,0,0,0);let c=Math.max(0,Av(a.start,i)),s=Math.max(1,Av(new Date(n.start),new Date(n.end))+1),d=Math.min(100,Math.max(0,n.progress??0));return Ev("div",{role:"row",className:"flex items-center border-b py-1",children:[Ad("span",{role:"cell",className:"w-24 shrink-0 truncate text-xs",title:n.name,children:n.name}),Ad("div",{className:"relative flex-1",style:{height:18},children:Ad("div",{role:"cell",className:"absolute top-1/2 -translate-y-1/2 overflow-hidden rounded bg-primary/15 ring-1 ring-primary/40",style:{left:c*r,width:s*r},title:`${tt(n.start)} \u2192 ${tt(n.end)}`,children:Ad("div",{className:"h-full bg-primary",style:{width:`${d}%`}})})})]},n.id)})]})}import*as Zu from"react";import{jsx as xn,jsxs as xm}from"react/jsx-runtime";var T1=["\u65E5","\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D"];function ZN(e){return e<10?`0${e}`:`${e}`}function eC(e){return`${e.getFullYear()}-${ZN(e.getMonth()+1)}-${ZN(e.getDate())}`}function R1(e){let t=new Map;for(let a of e){let r=t.get(a.date);r?r.push(a):t.set(a.date,[a])}return t}function Kj({events:e,onDateSelect:t,className:a}){let r=new Date,[o,n]=Zu.useState(new Date(r.getFullYear(),r.getMonth(),1)),[i,c]=Zu.useState(null),s=o.getFullYear(),d=o.getMonth(),m=new Date(s,d,1).getDay(),u=new Date(s,d+1,0).getDate(),p=Zu.useMemo(()=>R1(e),[e]),f=eC(r),x=[];for(let g=0;g<m;g++)x.push({date:null,iso:null});for(let g=1;g<=u;g++){let y=new Date(s,d,g);x.push({date:y,iso:eC(y)})}for(;x.length%7!==0;)x.push({date:null,iso:null});let v=g=>n(y=>new Date(y.getFullYear(),y.getMonth()+g,1)),N=g=>{c(g),t?.(g)},h=(g,y)=>{y&&(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),N(y))},b=`${s}\u5E74${d+1}\u6708`;return xm("div",{"data-slot":"calendar-view",className:l("w-full rounded-lg border bg-card p-3 text-sm",a),children:[xm("div",{className:"mb-2 flex items-center justify-between",children:[xn("button",{type:"button","aria-label":"\u4E0A\u4E00\u6708",className:"inline-flex size-7 items-center justify-center rounded-md hover:bg-muted",onClick:()=>v(-1),children:xn(et,{className:"size-4"})}),xn("span",{className:"font-medium","aria-live":"polite",children:b}),xn("button",{type:"button","aria-label":"\u4E0B\u4E00\u6708",className:"inline-flex size-7 items-center justify-center rounded-md hover:bg-muted",onClick:()=>v(1),children:xn(me,{className:"size-4"})})]}),xn("div",{className:"grid grid-cols-7 gap-1 text-center text-xs text-muted-foreground",role:"row",children:T1.map(g=>xn("span",{role:"columnheader",className:"py-1",children:g},g))}),xn("div",{className:"mt-1 grid grid-cols-7 gap-1",role:"grid","aria-label":`${b} \u65E5\u5386`,children:x.map((g,y)=>{if(!g.date||!g.iso)return xn("span",{role:"gridcell","aria-hidden":"true"},y);let k=g.iso,w=p.get(k)??[],R=k===f,S=k===i;return xm("button",{type:"button",role:"gridcell",tabIndex:0,"aria-label":`${k}${w.length?`\uFF0C${w.length}\u4E2A\u4E8B\u4EF6`:""}`,"aria-pressed":S,onKeyDown:z=>h(z,k),onClick:()=>N(k),className:l("flex min-h-9 flex-col items-center justify-center rounded-md border border-transparent text-sm tabular-nums hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",R&&"border-primary font-semibold",S&&"bg-primary text-primary-foreground"),children:[g.date.getDate(),w.length>0&&xn("span",{className:"mt-0.5 flex gap-0.5","aria-hidden":"true",children:w.slice(0,3).map(z=>xn("span",{className:"size-1.5 rounded-full",style:{backgroundColor:z.color??"currentColor"}},z.id))})]},y)})}),i&&xm("ul",{className:"mt-3 border-t pt-2",role:"list","aria-live":"polite",children:[(p.get(i)??[]).length===0&&xm("li",{className:"text-xs text-muted-foreground",children:[i," \u65E0\u4E8B\u4EF6"]}),p.get(i)?.map(g=>xm("li",{className:"flex items-center gap-1.5 py-0.5 text-xs",children:[xn("span",{className:"size-2 rounded-sm",style:{backgroundColor:g.color??"#3b82f6"},"aria-hidden":"true"}),g.title]},g.id))]})]})}import*as rC from"react";import{jsx as qn,jsxs as tp}from"react/jsx-runtime";var ep=Array.from({length:12},(e,t)=>t+8);function tC(e){let t=new Date(e);return Number.isNaN(t.getTime())?NaN:t.getHours()*60+t.getMinutes()}var oC=480,S1=1200,aC=S1-oC;function Zj({resources:e=[],bookings:t=[],className:a}){let r=rC.useMemo(()=>{let o=new Map;for(let n of t){let i=o.get(n.resourceId)??[];i.push(n),o.set(n.resourceId,i)}return o},[t]);return qn("div",{"data-slot":"resource-schedule",className:l("w-full overflow-x-auto rounded-lg border",a),role:"region","aria-label":"\u8D44\u6E90\u8C03\u5EA6\u89C6\u56FE",children:tp("table",{className:"w-full min-w-[640px] border-collapse text-sm",children:[qn("thead",{children:tp("tr",{children:[qn("th",{scope:"col",className:"sticky left-0 z-10 w-32 border-b border-r bg-card px-3 py-2 text-left text-xs font-medium text-muted-foreground",children:"\u8D44\u6E90"}),ep.map(o=>tp("th",{scope:"col",className:"border-b px-1 py-2 text-center text-xs font-medium text-muted-foreground tabular-nums",children:[String(o).padStart(2,"0"),":00"]},o))]})}),qn("tbody",{children:e.length===0?qn("tr",{children:qn("td",{colSpan:ep.length+1,className:"px-3 py-6 text-center text-muted-foreground",children:"\u6682\u65E0\u8D44\u6E90"})}):e.map(o=>{let n=r.get(o.id)??[];return tp("tr",{className:"border-b last:border-b-0",children:[qn("th",{scope:"row",className:"sticky left-0 z-10 w-32 border-r bg-card px-3 py-2 text-left text-xs font-medium",children:o.name}),qn("td",{colSpan:ep.length,className:"relative h-12 p-0",children:tp("div",{className:"relative h-full w-full",children:[ep.map((i,c)=>qn("div",{className:"absolute top-0 bottom-0 border-r border-border/40",style:{left:`${c/ep.length*100}%`}},c)),n.map((i,c)=>{let s=tC(i.start),d=tC(i.end);if(Number.isNaN(s)||Number.isNaN(d)||d<=s)return null;let m=(s-oC)/aC*100,u=(d-s)/aC*100;return qn("div",{className:"absolute top-1 bottom-1 flex items-center rounded bg-primary/80 px-1.5 text-[10px] font-medium text-primary-foreground shadow-sm",style:{left:`${Math.max(0,m)}%`,width:`${Math.min(100-m,u)}%`},title:`${i.title} \xB7 ${hu(i.start)} - ${hu(i.end)}`,children:qn("span",{className:"truncate",children:i.title})},`${i.resourceId}-${c}`)})]})})]},o.id)})})]})})}import{jsx as Ed,jsxs as Of}from"react/jsx-runtime";function nK({events:e=[],className:t}){return Ed("ol",{"data-slot":"timeline-view",className:l("flex flex-col",t),role:"list",children:e.length===0?Of("li",{className:"flex items-center gap-3 py-6 text-sm text-muted-foreground",children:[Ed(pe,{className:"size-4"}),"\u6682\u65E0\u4E8B\u4EF6"]}):e.map((a,r)=>{let o=r===e.length-1;return Of("li",{className:"relative flex gap-3 pb-6 last:pb-0",children:[!o&&Ed("span",{className:"absolute left-[7px] top-4 bottom-0 w-px bg-border","aria-hidden":"true"}),Ed("span",{className:"relative z-10 mt-1 flex size-3.5 shrink-0 items-center justify-center rounded-full border-2 border-primary bg-background","aria-hidden":"true"}),Of("div",{className:"min-w-0 flex-1",children:[Of("div",{className:"flex items-baseline gap-2",children:[Ed("time",{dateTime:a.date,className:"shrink-0 text-xs font-medium text-primary tabular-nums",children:tt(a.date)}),Ed("h4",{className:"truncate text-sm font-medium",children:a.title})]}),a.description&&Ed("p",{className:"mt-1 text-xs text-muted-foreground",children:a.description})]})]},a.id)})})}import*as Uf from"react";import{jsx as Dl,jsxs as $v}from"react/jsx-runtime";function cK({data:e,className:t}){let a=Uf.useMemo(()=>{let s=[];for(let d of e)s.includes(d.x)||s.push(d.x);return s},[e]),r=Uf.useMemo(()=>{let s=[];for(let d of e)s.includes(d.y)||s.push(d.y);return s},[e]),o=Math.max(1,...e.map(s=>s.value)),n=Uf.useMemo(()=>{let s=new Map;for(let d of e)s.set(`${d.x}|${d.y}`,d.value);return s},[e]),i=s=>s<=0?"bg-muted":"",c=s=>s<=0?{}:{backgroundColor:`rgba(59,130,246,${(.15+s/o*.85).toFixed(2)})`};return Dl("div",{"data-slot":"heatmap-chart",className:l("w-full overflow-x-auto",t),role:"img","aria-label":`\u70ED\u529B\u56FE\uFF0C${r.length} \u884C \xD7 ${a.length} \u5217`,children:$v("table",{className:"w-full border-separate border-spacing-1 text-xs",children:[Dl("thead",{children:$v("tr",{children:[Dl("th",{scope:"col",className:"w-16"}),a.map(s=>Dl("th",{scope:"col",className:"px-1 text-center text-muted-foreground",children:s},s))]})}),Dl("tbody",{children:r.map(s=>$v("tr",{children:[Dl("th",{scope:"row",className:"truncate pr-1 text-left text-muted-foreground",children:s}),a.map(d=>{let m=n.get(`${d}|${s}`)??0;return Dl("td",{className:"p-0",children:Dl("div",{role:"gridcell","aria-label":`${s} ${d}: ${m}`,title:`${s} ${d}: ${q(m)}`,className:l("flex h-7 min-w-7 items-center justify-center rounded tabular-nums",i(m)),style:c(m),children:m>0?q(m):""})},d)})]},s))})]})})}import{jsx as Ml,jsxs as vm}from"react/jsx-runtime";function bK({region:e,data:t,className:a}){let r=Math.max(1,...t.map(o=>o.value));return vm("div",{"data-slot":"map-chart",className:l("flex flex-col gap-2 rounded-lg border bg-card p-3 text-sm",a),role:"img","aria-label":`${e} \u5730\u56FE\uFF0C\u5171 ${t.length} \u4E2A\u6807\u8BB0`,children:[vm("div",{className:"flex items-center justify-between",children:[Ml("span",{className:"font-medium",children:e}),vm("span",{className:"text-xs text-muted-foreground",children:["\u6807\u8BB0 ",t.length]})]}),Ml("div",{className:"relative h-48 w-full overflow-hidden rounded-md bg-[radial-gradient(circle_at_30%_30%,var(--muted),transparent_70%)] ring-1 ring-border",role:"presentation",children:t.map((o,n)=>{let i=Math.ceil(Math.sqrt(t.length)),c=n%i,s=Math.floor(n/i),d=(c+.5)/i*100,m=(s+.5)/Math.ceil(t.length/i)*100,u=14+o.value/r*20;return vm("div",{className:"absolute -translate-x-1/2 -translate-y-1/2",style:{left:`${d}%`,top:`${m}%`},children:[Ml(on,{className:"text-primary",style:{width:u,height:u},"aria-hidden":"true"}),Ml("span",{className:"absolute left-1/2 top-full -translate-x-1/2 whitespace-nowrap text-[10px] text-muted-foreground",children:o.name}),vm("span",{className:"sr-only",children:[o.name,": ",q(o.value)]})]},o.name)})}),Ml("ul",{className:"flex flex-wrap gap-x-4 gap-y-1 text-xs",role:"list",children:t.map(o=>vm("li",{className:"flex items-center gap-1",children:[Ml("span",{className:"size-2 rounded-sm bg-primary","aria-hidden":"true"}),Ml("span",{className:"text-muted-foreground",children:o.name}),Ml("span",{className:"tabular-nums",children:q(o.value)})]},o.name))})]})}import*as ap from"react";import{jsx as I1}from"react/jsx-runtime";function yK({map:e,markers:t=[],cluster:a=!0,className:r}){let o=ap.useRef(null),n=ap.useRef([]);return ap.useEffect(()=>{if(!e||(o.current&&(o.current.clearMarkers(),o.current=null),n.current.forEach(s=>s.setMap(null)),n.current=[],t.length===0))return;let i=window.AMap;if(!i)return;let c=t.map(s=>{let d=new i.Marker({position:[s.lng,s.lat],title:s.label,icon:s.icon||void 0});return s.content&&d.setLabel({content:s.content,direction:"top"}),d});if(a&&i.MarkerClusterer){let s=new i.MarkerClusterer(e,c,{gridSize:80,maxZoom:18});o.current=s}else c.forEach(s=>s.setMap(e));return n.current=c,()=>{o.current&&(o.current.clearMarkers(),o.current=null),n.current.forEach(s=>s.setMap(null)),n.current=[]}},[e,t,a]),I1("div",{"data-slot":"map-marker-cluster",className:l("hidden",r),"aria-hidden":!0})}import*as Pi from"react";import{jsx as D1}from"react/jsx-runtime";function wK({map:e,points:t=[],playing:a=!1,speed:r=10,color:o="#1677FF",onStart:n,onEnd:i,className:c}){let s=Pi.useRef(null),d=Pi.useRef(null),m=Pi.useRef(0),u=Pi.useRef(null);return Pi.useEffect(()=>{if(!e)return;let p=window.AMap;if(!p||(s.current&&(s.current.setMap(null),s.current=null),t.length<2))return;let f=t.map(v=>[v.lng,v.lat]),x=new p.Polyline({path:f,strokeColor:o,strokeWeight:4,strokeOpacity:.7,lineJoin:"round"});return x.setMap(e),s.current=x,e.setFitView([x]),()=>{x.setMap(null),s.current=null}},[e,t,o]),Pi.useEffect(()=>{if(!e||t.length===0)return;let p=window.AMap;if(p){if(d.current||(d.current=new p.Marker({position:[t[0].lng,t[0].lat],icon:new p.Icon({size:new p.Size(26,26),image:"data:image/svg+xml,"+encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="'+o+'"><circle cx="12" cy="12" r="10" fill-opacity="0.3"/><circle cx="12" cy="12" r="5"/></svg>'),imageSize:new p.Size(26,26)}),zIndex:100}),d.current?.setMap(e)),!a){u.current&&(clearInterval(u.current),u.current=null);return}return n?.(),m.current=0,u.current=setInterval(()=>{m.current+=r,m.current>=t.length-1&&(m.current=t.length-1,u.current&&(clearInterval(u.current),u.current=null),i?.());let f=t[m.current];d.current?.setPosition([f.lng,f.lat])},100),()=>{u.current&&(clearInterval(u.current),u.current=null)}}},[e,t,a,r,o,n,i]),Pi.useEffect(()=>()=>{s.current&&(s.current.setMap(null),s.current=null),d.current&&(d.current.setMap(null),d.current=null),u.current&&(clearInterval(u.current),u.current=null)},[]),D1("div",{"data-slot":"map-track",className:l("hidden",c),"aria-hidden":!0})}import*as Bl from"react";import{useTranslation as M1}from"react-i18next";import{jsx as rp,jsxs as L1}from"react/jsx-runtime";var Wf=null;function B1(e,t="2.0"){return Wf||(Wf=new Promise((a,r)=>{if(typeof window>"u"){r(new Error("MapView requires a browser environment"));return}let o=document.createElement("script");o.src=`https://webapi.amap.com/maps?v=${t}&key=${e}`,o.onload=()=>{window.AMap?a(window.AMap):r(new Error("AMap JSAPI loaded but AMap not found on window"))},o.onerror=()=>r(new Error("Failed to load AMap JSAPI")),document.head.appendChild(o)}),Wf)}function IK({amapKey:e,center:t=[116.397428,39.90923],zoom:a=12,height:r=400,className:o,onReady:n,onClick:i}){let{t:c}=M1("map"),s=Bl.useRef(null),d=Bl.useRef(null),[m,u]=Bl.useState(!0),[p,f]=Bl.useState(null),x=e||typeof process<"u"&&process.env.AMAP_KEY||"";return Bl.useEffect(()=>{if(!x){f(c("loading")),u(!1);return}let v=!1;return B1(x).then(N=>{if(v||!s.current)return;let b=N.Map,g=new b(s.current,{center:t,zoom:a,resizeEnable:!0});d.current=g,u(!1),n?.(g),i&&g.on("click",y=>{let k=y;i([k.lnglat.getLng(),k.lnglat.getLat()])})}).catch(N=>{v||(f(N.message),u(!1))}),()=>{v=!0}},[x]),L1("div",{"data-slot":"map-view",className:l("relative overflow-hidden rounded-lg border bg-muted",o),style:{height:r},children:[m&&rp("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-muted/80",children:rp("span",{className:"text-sm text-muted-foreground",children:c("loading")})}),p&&rp("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-muted/80",children:rp("span",{className:"text-sm text-destructive",children:p})}),rp("div",{ref:s,className:"size-full"})]})}import*as qf from"react";import{jsx as Ns,jsxs as np}from"react/jsx-runtime";var op=12,_f=48;function AK({widgets:e,onChange:t,className:a}){let[r,o]=qf.useState(e);qf.useEffect(()=>{o(e)},[e]);let n=r.reduce((m,u)=>Math.max(m,u.y+u.h),0),i=Math.max(n,4),c=i*_f,s=m=>{let u=r.filter(p=>p.id!==m);o(u),t?.(u)},d=(m,u,p)=>{let f=r.map(x=>{if(x.id!==m)return x;let v=Math.max(0,Math.min(op-x.w,x.x+u)),N=Math.max(0,x.y+p);return{...x,x:v,y:N}});o(f),t?.(f)};return np("div",{"data-slot":"dashboard-canvas",className:l("relative rounded-lg border bg-muted/30 p-2",a),style:{minHeight:c+16},role:"region","aria-label":"\u4EEA\u8868\u76D8\u753B\u5E03",children:[Ns("div",{className:"pointer-events-none absolute inset-2 grid gap-1",style:{gridTemplateColumns:`repeat(${op}, 1fr)`,gridTemplateRows:`repeat(${i}, ${_f}px)`},"aria-hidden":"true",children:Array.from({length:op*i}).map((m,u)=>Ns("div",{className:"rounded-sm bg-background/40"},u))}),r.map(m=>np("div",{"data-widget-id":m.id,className:"absolute rounded-lg border bg-card p-3 shadow-sm",style:{left:`calc(${m.x/op*100}% + 0.5rem)`,top:`${m.y*_f+8}px`,width:`calc(${m.w/op*100}% - 1rem)`,height:`${m.h*_f-4}px`},children:[np("div",{className:"flex items-center justify-between gap-2",children:[Ns("span",{className:"truncate text-sm font-medium",children:m.title}),np("div",{className:"flex items-center gap-1",children:[Ns(C,{type:"button",variant:"ghost",size:"icon-xs","aria-label":`\u5DE6\u79FB ${m.title}`,onClick:()=>d(m.id,-1,0),children:Ns(id,{className:"size-3 -scale-x-100"})}),Ns(C,{type:"button",variant:"ghost",size:"icon-xs","aria-label":`\u53F3\u79FB ${m.title}`,onClick:()=>d(m.id,1,0),children:Ns(id,{className:"size-3"})}),Ns(C,{type:"button",variant:"ghost",size:"icon-xs","aria-label":`\u79FB\u9664 ${m.title}`,onClick:()=>s(m.id),children:Ns(ye,{className:"size-3"})})]})]}),np("p",{className:"mt-1 text-xs text-muted-foreground",children:["\u4F4D\u7F6E ",m.x,",",m.y," \xB7 \u5C3A\u5BF8 ",m.w,"\xD7",m.h]})]},m.id)),r.length===0&&Ns("p",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"\u753B\u5E03\u4E3A\u7A7A\uFF0C\u8BF7\u6DFB\u52A0 widget"})]})}import{jsx as sp,jsxs as z1}from"react/jsx-runtime";function HK({data:e,className:t}){let a=Math.max(1,...e.map(r=>r.value));return sp("div",{"data-slot":"bar-list",className:l("flex flex-col gap-2",t),children:e.map(r=>z1("div",{className:"flex items-center gap-2 text-sm",children:[sp("span",{className:"w-28 shrink-0 truncate text-muted-foreground",children:r.label}),sp("div",{className:"h-4 flex-1 overflow-hidden rounded bg-muted",children:sp("div",{className:"h-full rounded",style:{width:`${r.value/a*100}%`,backgroundColor:r.color??"hsl(var(--primary))"}})}),sp("span",{className:"w-12 shrink-0 text-right tabular-nums",children:r.value})]},r.label))})}import{jsx as Hv,jsxs as Vv}from"react/jsx-runtime";function _K({value:e,maxValue:t,label:a,className:r}){let o=e>=0,n=t??Math.max(1,Math.abs(e)),i=Math.min(100,Math.max(0,Math.abs(e)/n*100));return Vv("div",{"data-slot":"delta-bar",className:l("flex flex-col gap-1",r),children:[a?Vv("div",{className:"flex items-center justify-between text-xs",children:[Hv("span",{className:"text-muted-foreground",children:a}),Vv("span",{className:l("font-medium tabular-nums",o?"text-emerald-600":"text-red-600"),children:[o?"+":"\u2212",bt(Math.abs(e)/100)]})]}):null,Hv("div",{className:"relative h-2 w-full overflow-hidden rounded-full bg-muted",role:"progressbar","aria-valuenow":e,"aria-valuemin":-n,"aria-valuemax":n,"aria-label":a??"\u589E\u91CF",children:Hv("div",{className:l("absolute inset-y-0 left-0 rounded-full",o?"bg-emerald-500":"bg-red-500"),style:{width:`${i}%`}})})]})}import{jsx as ip,jsxs as A1}from"react/jsx-runtime";function KK({data:e,className:t}){let a=Math.max(1,...e.map(r=>r.value));return ip("div",{"data-slot":"category-bar",className:l("flex flex-col gap-2",t),children:e.map(r=>A1("div",{className:"flex items-center gap-2 text-sm",children:[ip("span",{className:"w-28 shrink-0 truncate text-muted-foreground",children:r.label}),ip("div",{className:"h-4 flex-1 overflow-hidden rounded bg-muted",children:ip("div",{className:"h-full rounded",style:{width:`${r.value/a*100}%`,backgroundColor:r.color??"hsl(var(--primary))"}})}),ip("span",{className:"w-12 shrink-0 text-right tabular-nums",children:r.value})]},r.label))})}import"react";import{jsx as Ov,jsxs as nC}from"react/jsx-runtime";var E1={default:{wrap:"bg-muted/50 text-foreground",icon:"text-muted-foreground",Icon:od,label:"\u63D0\u793A"},info:{wrap:"bg-blue-50 text-blue-900 dark:bg-blue-950/40 dark:text-blue-200",icon:"text-blue-500",Icon:od,label:"\u4FE1\u606F"},success:{wrap:"bg-emerald-50 text-emerald-900 dark:bg-emerald-950/40 dark:text-emerald-200",icon:"text-emerald-500",Icon:qe,label:"\u6210\u529F"},warning:{wrap:"bg-amber-50 text-amber-900 dark:bg-amber-950/40 dark:text-amber-200",icon:"text-amber-500",Icon:jt,label:"\u8B66\u544A"},error:{wrap:"bg-red-50 text-red-900 dark:bg-red-950/40 dark:text-red-200",icon:"text-red-500",Icon:rn,label:"\u9519\u8BEF"}};function eQ({title:e,children:t,variant:a="default",className:r}){let o=E1[a],n=o.Icon;return nC("div",{"data-slot":"callout",role:"note",className:l("flex gap-3 rounded-lg border p-3 text-sm",o.wrap,r),children:[Ov(n,{className:l("mt-0.5 size-5 shrink-0",o.icon),"aria-hidden":"true"}),nC("div",{className:"min-w-0 flex-1",children:[e?Ov("p",{className:"font-semibold leading-snug",children:e}):null,Ov("div",{className:l(e?"mt-0.5":"","text-sm leading-snug"),children:t})]})]})}import{jsx as F1,jsxs as $1}from"react/jsx-runtime";function nQ({value:e,suffix:t="%",prefix:a,className:r}){let o=e>0?"up":e<0?"down":"flat",n=o==="up"?en:o==="down"?Zo:Kr;return $1("span",{className:l("inline-flex items-center gap-0.5 rounded px-1.5 py-0.5 text-xs font-medium",o==="up"?"bg-emerald-100 text-emerald-700":o==="down"?"bg-red-100 text-red-700":"bg-muted text-muted-foreground",r),"data-slot":"badge-delta",children:[F1(n,{className:"size-3"}),a,Math.abs(e),t]})}import{jsx as lp,jsxs as hm}from"react/jsx-runtime";function mQ({target:e,actual:t,label:a="\u8FFD\u8E2A\u9879",className:r}){let o=e>0?t/e:0,n=Math.min(1,o),i=t>=e&&e>0,c=32,s=2*Math.PI*c,d=n*s;return hm("div",{"data-slot":"tracking",className:l("inline-flex items-center gap-3",r),role:"group","aria-label":`${a} \u8FFD\u8E2A`,children:[hm("svg",{viewBox:"0 0 80 80",className:"size-16 -rotate-90","aria-hidden":"true",children:[lp("circle",{cx:"40",cy:"40",r:c,fill:"none",stroke:"currentColor",strokeWidth:"8",className:"text-muted"}),lp("circle",{cx:"40",cy:"40",r:c,fill:"none",stroke:"currentColor",strokeWidth:"8",strokeLinecap:"round",strokeDasharray:`${d} ${s}`,className:i?"text-emerald-500":"text-primary"})]}),hm("div",{className:"flex flex-col",children:[lp("span",{className:"text-xs text-muted-foreground",children:a}),hm("span",{className:"text-lg font-semibold tabular-nums",children:[q(t),hm("span",{className:"ml-1 text-xs font-normal text-muted-foreground",children:["/ ",q(e)]})]}),hm("span",{className:l("inline-flex items-center gap-1 text-xs font-medium tabular-nums",i?"text-emerald-600":"text-muted-foreground"),children:[i?lp(an,{}):lp(tn,{}),bt(o)]})]})]})}import"react";import{jsx as Gf,jsxs as sC}from"react/jsx-runtime";function xQ({title:e,description:t,children:a,footer:r,className:o}){return sC(Y,{"data-slot":"chart-card",className:l("w-full",o),children:[sC(le,{children:[Gf(ie,{children:e}),t?Gf(Ga,{children:t}):null]}),Gf(J,{children:a}),r?Gf(ho,{children:r}):null]})}import{jsx as dp,jsxs as cp}from"react/jsx-runtime";function kQ({label:e,value:t,trend:a,sparklineData:r=[],className:o}){let n=a!==void 0,i=(a??0)>=0,c=n?i?an:tn:null,s=r.length>0?r:[4,8,6,10,7,12],d=120,m=36,u=Math.max(1,...s),p=Math.min(0,...s),f=u-p||1,x=d/Math.max(1,s.length-1),v=k=>m-(k-p)/f*m,h=`M ${s.map((k,w)=>`${w*x},${v(k)}`).join(" L ")}`,b=`${h} L ${d},${m} L 0,${m} Z`,g=i?"#10b981":"#ef4444",y=typeof t=="number"?q(t):t;return cp("div",{"data-slot":"stat-card-with-sparkline",className:l("flex flex-col gap-2 rounded-lg border bg-card p-4",o),children:[cp("div",{className:"flex items-start justify-between gap-2",children:[cp("div",{className:"min-w-0",children:[dp("p",{className:"truncate text-xs text-muted-foreground",children:e}),dp("p",{className:"mt-0.5 text-xl font-semibold tabular-nums",children:y})]}),n&&c?cp("span",{className:l("flex shrink-0 items-center gap-0.5 text-xs font-medium tabular-nums",i?"text-emerald-600":"text-red-600"),"aria-label":`\u8D8B\u52BF ${i?"\u4E0A\u5347":"\u4E0B\u964D"} ${Math.abs(a)}%`,children:[dp(c,{className:"size-3.5","aria-hidden":"true"}),bt(Math.abs(a)/100)]}):null]}),cp("svg",{viewBox:`0 0 ${d} ${m}`,width:"100%",height:m,preserveAspectRatio:"none",role:"img","aria-label":`\u8D8B\u52BF\u7EBF\uFF0C${s.length} \u70B9`,className:"text-primary",children:[dp("path",{d:b,fill:g,fillOpacity:.15,stroke:"none"}),dp("path",{d:h,fill:"none",stroke:g,strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"})]})]})}import{jsx as Fd,jsxs as jf}from"react/jsx-runtime";function SQ({data:e,centerLabel:t,className:a}){let r=e.reduce((c,s)=>c+s.value,0)||1,o=40,n=2*Math.PI*o,i=0;return jf("div",{"data-slot":"donut-card",className:l("flex flex-col items-center gap-4 rounded-lg border bg-card p-4 sm:flex-row",a),role:"img","aria-label":`\u73AF\u5F62\u56FE\uFF0C\u5171 ${e.length} \u6BB5\uFF0C\u603B\u8BA1 ${r}`,children:[jf("div",{className:"relative size-32 shrink-0",children:[Fd("svg",{viewBox:"0 0 100 100",className:"size-32 -rotate-90",role:"presentation",children:e.map(c=>{let s=c.value/r,d=Fd("circle",{cx:"50",cy:"50",r:o,fill:"none",stroke:c.color,strokeWidth:"12",strokeDasharray:`${s*n} ${n}`,strokeDashoffset:-i*n,children:jf("title",{children:[c.label,": ",q(c.value)]})},c.label);return i+=s,d})}),t?Fd("span",{className:"absolute inset-0 flex items-center justify-center text-sm font-medium tabular-nums",children:t}):null]}),Fd("ul",{className:"flex flex-1 flex-col gap-1.5 text-sm",role:"list",children:e.map(c=>jf("li",{className:"flex items-center gap-2",children:[Fd("span",{className:"size-2.5 shrink-0 rounded-sm",style:{backgroundColor:c.color},"aria-hidden":"true"}),Fd("span",{className:"text-muted-foreground",children:c.label}),Fd("span",{className:"ml-auto tabular-nums",children:q(c.value)})]},c.label))})]})}import*as $d from"react";import{useTranslation as H1}from"react-i18next";import{jsx as vn,jsxs as Ll}from"react/jsx-runtime";function FQ({open:e,onOpenChange:t,onSelect:a,multiple:r=!1,items:o=[],title:n,searchPlaceholder:i,emptyText:c,className:s}){let{t:d}=H1("ui"),[m,u]=$d.useState(""),[p,f]=$d.useState([]),x=n??d("customerBrowse.title",{defaultValue:"\u9009\u62E9\u5BA2\u6237"}),v=i??d("customerBrowse.search",{defaultValue:"\u641C\u7D22\u5BA2\u6237"}),N=c??d("customerBrowse.empty",{defaultValue:"\u65E0\u5339\u914D\u5BA2\u6237"}),h=$d.useMemo(()=>{if(!m.trim())return o;let y=m.trim().toLowerCase();return o.filter(k=>k.name.toLowerCase().includes(y)||k.id.toLowerCase().includes(y)||k.contact?.toLowerCase().includes(y)||k.phone?.toLowerCase().includes(y))},[o,m]);$d.useEffect(()=>{e&&(u(""),f([]))},[e]);let b=y=>{f(r?k=>k.includes(y.id)?k.filter(w=>w!==y.id):[...k,y.id]:[y.id]),a(y)},g=()=>{t(!1)};return vn(Ie,{open:e,onOpenChange:t,children:Ll(De,{"data-slot":"customer-browse",className:l("sm:max-w-md",s),children:[Ll($e,{children:[vn(Me,{children:x}),vn(Ye,{children:d("customerBrowse.description",{defaultValue:r?"\u53EF\u591A\u9009\u5BA2\u6237":"\u4ECE\u5217\u8868\u4E2D\u9009\u62E9\u4E00\u4E2A\u5BA2\u6237"})})]}),Ll("div",{className:"flex items-center gap-2 border-b pb-2",children:[vn(X,{className:"size-4 shrink-0 opacity-50"}),vn(T,{value:m,onChange:y=>u(y.target.value),placeholder:v,"aria-label":v,className:"h-8 border-0 bg-transparent p-0 shadow-none focus-visible:ring-0"})]}),Ll("ul",{role:"list",className:"max-h-72 overflow-y-auto py-1",children:[h.length===0&&vn("li",{className:"px-2 py-6 text-center text-sm text-muted-foreground",children:N}),h.map(y=>{let k=p.includes(y.id);return vn("li",{children:Ll("button",{type:"button",disabled:y.disabled,"aria-pressed":k,onClick:()=>b(y),className:l("flex w-full items-center gap-2 rounded-sm px-2 py-2 text-left text-sm outline-none transition-colors","hover:bg-muted focus-visible:bg-muted focus-visible:ring-2 focus-visible:ring-ring/50",k&&"bg-accent/50",y.disabled&&"pointer-events-none opacity-50"),children:[vn(al,{className:"size-4 shrink-0 opacity-50"}),Ll("span",{className:"flex-1 truncate",children:[y.name,y.contact&&Ll("span",{className:"ml-1 text-xs text-muted-foreground",children:["\xB7 ",y.contact]})]}),y.phone&&vn("span",{className:"shrink-0 text-xs text-muted-foreground",children:y.phone}),k&&vn(U,{className:"size-4 shrink-0"})]})},y.id)})]}),Ll(Ge,{children:[vn(C,{variant:"outline",type:"button",onClick:()=>t(!1),children:d("dialog.closeButton",{defaultValue:"\u53D6\u6D88"})}),vn(C,{type:"button",disabled:p.length===0,onClick:g,children:d("customerBrowse.confirm",{defaultValue:"\u786E\u5B9A"})})]})]})})}import*as Hd from"react";import{useTranslation as V1}from"react-i18next";import{jsx as Bo,jsxs as zl}from"react/jsx-runtime";function jQ({open:e,onOpenChange:t,onSelect:a,multiple:r=!1,items:o=[],title:n,searchPlaceholder:i,emptyText:c,className:s}){let{t:d}=V1("ui"),[m,u]=Hd.useState(""),[p,f]=Hd.useState([]),x=n??d("productBrowse.title",{defaultValue:"\u9009\u62E9\u5546\u54C1"}),v=i??d("productBrowse.search",{defaultValue:"\u641C\u7D22\u5546\u54C1"}),N=c??d("productBrowse.empty",{defaultValue:"\u65E0\u5339\u914D\u5546\u54C1"}),h=Hd.useMemo(()=>{if(!m.trim())return o;let g=m.trim().toLowerCase();return o.filter(y=>y.name.toLowerCase().includes(g)||y.id.toLowerCase().includes(g)||y.sku?.toLowerCase().includes(g)||y.spec?.toLowerCase().includes(g))},[o,m]);Hd.useEffect(()=>{e&&(u(""),f([]))},[e]);let b=g=>{f(r?y=>y.includes(g.id)?y.filter(k=>k!==g.id):[...y,g.id]:[g.id]),a(g)};return Bo(Ie,{open:e,onOpenChange:t,children:zl(De,{"data-slot":"product-browse",className:l("sm:max-w-lg",s),children:[zl($e,{children:[Bo(Me,{children:x}),Bo(Ye,{children:d("productBrowse.description",{defaultValue:r?"\u53EF\u591A\u9009\u5546\u54C1":"\u4ECE\u5217\u8868\u4E2D\u9009\u62E9\u5546\u54C1"})})]}),zl("div",{className:"flex items-center gap-2 border-b pb-2",children:[Bo(X,{className:"size-4 shrink-0 opacity-50"}),Bo(T,{value:m,onChange:g=>u(g.target.value),placeholder:v,"aria-label":v,className:"h-8 border-0 bg-transparent p-0 shadow-none focus-visible:ring-0"})]}),zl("ul",{role:"list",className:"max-h-72 overflow-y-auto py-1",children:[h.length===0&&Bo("li",{className:"px-2 py-6 text-center text-sm text-muted-foreground",children:N}),h.map(g=>{let y=p.includes(g.id);return Bo("li",{children:zl("button",{type:"button",disabled:g.disabled,"aria-pressed":y,onClick:()=>b(g),className:l("flex w-full items-center gap-2 rounded-sm px-2 py-2 text-left text-sm outline-none transition-colors","hover:bg-muted focus-visible:bg-muted focus-visible:ring-2 focus-visible:ring-ring/50",y&&"bg-accent/50",g.disabled&&"pointer-events-none opacity-50"),children:[Bo(Qr,{className:"size-4 shrink-0 opacity-50"}),zl("span",{className:"flex-1 truncate",children:[g.name,g.spec&&zl("span",{className:"ml-1 text-xs text-muted-foreground",children:["\xB7 ",g.spec]})]}),g.unit&&Bo("span",{className:"shrink-0 text-xs text-muted-foreground",children:g.unit}),g.price!=null&&Bo("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:Ne(g.price)}),y&&Bo(U,{className:"size-4 shrink-0"})]})},g.id)})]}),zl(Ge,{children:[Bo(C,{variant:"outline",type:"button",onClick:()=>t(!1),children:d("dialog.closeButton",{defaultValue:"\u53D6\u6D88"})}),Bo(C,{type:"button",disabled:p.length===0,onClick:()=>t(!1),children:d("productBrowse.confirm",{defaultValue:"\u786E\u5B9A"})})]})]})})}import*as Vd from"react";import{useTranslation as O1}from"react-i18next";import{jsx as Lo,jsxs as Al}from"react/jsx-runtime";function rX({open:e,onOpenChange:t,onSelect:a,items:r=[],title:o,searchPlaceholder:n,emptyText:i,className:c}){let{t:s}=O1("ui"),[d,m]=Vd.useState(""),[u,p]=Vd.useState(null),f=o??s("salesOrderBrowse.title",{defaultValue:"\u9009\u62E9\u9500\u552E\u8BA2\u5355"}),x=n??s("salesOrderBrowse.search",{defaultValue:"\u641C\u7D22\u8BA2\u5355\u53F7/\u5BA2\u6237"}),v=i??s("salesOrderBrowse.empty",{defaultValue:"\u65E0\u5339\u914D\u8BA2\u5355"}),N=Vd.useMemo(()=>{if(!d.trim())return r;let b=d.trim().toLowerCase();return r.filter(g=>g.id.toLowerCase().includes(b)||g.no?.toLowerCase().includes(b)||g.customer?.toLowerCase().includes(b))},[r,d]);Vd.useEffect(()=>{e&&(m(""),p(null))},[e]);let h=()=>{if(u==null)return;let b=r.find(g=>g.id===u);b&&(a(b),t(!1))};return Lo(Ie,{open:e,onOpenChange:t,children:Al(De,{"data-slot":"sales-order-browse",className:l("sm:max-w-lg",c),children:[Al($e,{children:[Lo(Me,{children:f}),Lo(Ye,{children:s("salesOrderBrowse.description",{defaultValue:"\u4ECE\u5217\u8868\u4E2D\u9009\u62E9\u9500\u552E\u8BA2\u5355"})})]}),Al("div",{className:"flex items-center gap-2 border-b pb-2",children:[Lo(X,{className:"size-4 shrink-0 opacity-50"}),Lo(T,{value:d,onChange:b=>m(b.target.value),placeholder:x,"aria-label":x,className:"h-8 border-0 bg-transparent p-0 shadow-none focus-visible:ring-0"})]}),Al("ul",{role:"list",className:"max-h-72 overflow-y-auto py-1",children:[N.length===0&&Lo("li",{className:"px-2 py-6 text-center text-sm text-muted-foreground",children:v}),N.map(b=>{let g=b.id===u;return Lo("li",{children:Al("button",{type:"button",disabled:b.disabled,"aria-pressed":g,onClick:()=>p(b.id),className:l("flex w-full items-center gap-2 rounded-sm px-2 py-2 text-left text-sm outline-none transition-colors","hover:bg-muted focus-visible:bg-muted focus-visible:ring-2 focus-visible:ring-ring/50",g&&"bg-accent/50",b.disabled&&"pointer-events-none opacity-50"),children:[Lo(Xr,{className:"size-4 shrink-0 opacity-50"}),Al("span",{className:"flex-1 truncate",children:[b.no??b.id,b.customer&&Al("span",{className:"ml-1 text-xs text-muted-foreground",children:["\xB7 ",b.customer]})]}),b.date&&Lo("span",{className:"shrink-0 text-xs text-muted-foreground",children:tt(b.date)}),b.amount!=null&&Lo("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:Ne(b.amount)}),g&&Lo(U,{className:"size-4 shrink-0"})]})},b.id)})]}),Al(Ge,{children:[Lo(C,{variant:"outline",type:"button",onClick:()=>t(!1),children:s("dialog.closeButton",{defaultValue:"\u53D6\u6D88"})}),Lo(C,{type:"button",disabled:u==null,onClick:h,children:s("salesOrderBrowse.confirm",{defaultValue:"\u786E\u5B9A"})})]})]})})}import*as Od from"react";import{useTranslation as U1}from"react-i18next";import{jsx as zo,jsxs as El}from"react/jsx-runtime";function pX({open:e,onOpenChange:t,onSelect:a,items:r=[],title:o,searchPlaceholder:n,emptyText:i,className:c}){let{t:s}=U1("ui"),[d,m]=Od.useState(""),[u,p]=Od.useState(null),f=o??s("writeoffBrowse.title",{defaultValue:"\u9009\u62E9\u6838\u9500\u5355"}),x=n??s("writeoffBrowse.search",{defaultValue:"\u641C\u7D22\u6838\u9500\u5355"}),v=i??s("writeoffBrowse.empty",{defaultValue:"\u65E0\u5339\u914D\u6838\u9500\u5355"}),N=Od.useMemo(()=>{if(!d.trim())return r;let b=d.trim().toLowerCase();return r.filter(g=>g.id.toLowerCase().includes(b)||g.no?.toLowerCase().includes(b)||g.counterparty?.toLowerCase().includes(b))},[r,d]);Od.useEffect(()=>{e&&(m(""),p(null))},[e]);let h=()=>{if(u==null)return;let b=r.find(g=>g.id===u);b&&(a(b),t(!1))};return zo(Ie,{open:e,onOpenChange:t,children:El(De,{"data-slot":"writeoff-browse",className:l("sm:max-w-md",c),children:[El($e,{children:[zo(Me,{children:f}),zo(Ye,{children:s("writeoffBrowse.description",{defaultValue:"\u4ECE\u5217\u8868\u4E2D\u9009\u62E9\u6838\u9500\u5355"})})]}),El("div",{className:"flex items-center gap-2 border-b pb-2",children:[zo(X,{className:"size-4 shrink-0 opacity-50"}),zo(T,{value:d,onChange:b=>m(b.target.value),placeholder:x,"aria-label":x,className:"h-8 border-0 bg-transparent p-0 shadow-none focus-visible:ring-0"})]}),El("ul",{role:"list",className:"max-h-72 overflow-y-auto py-1",children:[N.length===0&&zo("li",{className:"px-2 py-6 text-center text-sm text-muted-foreground",children:v}),N.map(b=>{let g=b.id===u;return zo("li",{children:El("button",{type:"button",disabled:b.disabled,"aria-pressed":g,onClick:()=>p(b.id),className:l("flex w-full items-center gap-2 rounded-sm px-2 py-2 text-left text-sm outline-none transition-colors","hover:bg-muted focus-visible:bg-muted focus-visible:ring-2 focus-visible:ring-ring/50",g&&"bg-accent/50",b.disabled&&"pointer-events-none opacity-50"),children:[zo(Xr,{className:"size-4 shrink-0 opacity-50"}),El("span",{className:"flex-1 truncate",children:[b.no??b.id,b.counterparty&&El("span",{className:"ml-1 text-xs text-muted-foreground",children:["\xB7 ",b.counterparty]})]}),b.date&&zo("span",{className:"shrink-0 text-xs text-muted-foreground",children:tt(b.date)}),b.amount!=null&&zo("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:Ne(b.amount)}),g&&zo(U,{className:"size-4 shrink-0"})]})},b.id)})]}),El(Ge,{children:[zo(C,{variant:"outline",type:"button",onClick:()=>t(!1),children:s("dialog.closeButton",{defaultValue:"\u53D6\u6D88"})}),zo(C,{type:"button",disabled:u==null,onClick:h,children:s("writeoffBrowse.confirm",{defaultValue:"\u786E\u5B9A"})})]})]})})}import*as Ud from"react";import{useTranslation as W1}from"react-i18next";import{jsx as Ao,jsxs as Fl}from"react/jsx-runtime";function kX({open:e,onOpenChange:t,onSelect:a,items:r=[],title:o,searchPlaceholder:n,emptyText:i,className:c}){let{t:s}=W1("ui"),[d,m]=Ud.useState(""),[u,p]=Ud.useState(null),f=o??s("priceAdjustBrowse.title",{defaultValue:"\u9009\u62E9\u8C03\u4EF7\u5355"}),x=n??s("priceAdjustBrowse.search",{defaultValue:"\u641C\u7D22\u8C03\u4EF7\u5355"}),v=i??s("priceAdjustBrowse.empty",{defaultValue:"\u65E0\u5339\u914D\u8C03\u4EF7\u5355"}),N=Ud.useMemo(()=>{if(!d.trim())return r;let b=d.trim().toLowerCase();return r.filter(g=>g.id.toLowerCase().includes(b)||g.no?.toLowerCase().includes(b)||g.product?.toLowerCase().includes(b))},[r,d]);Ud.useEffect(()=>{e&&(m(""),p(null))},[e]);let h=()=>{if(u==null)return;let b=r.find(g=>g.id===u);b&&(a(b),t(!1))};return Ao(Ie,{open:e,onOpenChange:t,children:Fl(De,{"data-slot":"price-adjust-browse",className:l("sm:max-w-md",c),children:[Fl($e,{children:[Ao(Me,{children:f}),Ao(Ye,{children:s("priceAdjustBrowse.description",{defaultValue:"\u4ECE\u5217\u8868\u4E2D\u9009\u62E9\u4E00\u4E2A\u8C03\u4EF7\u5355"})})]}),Fl("div",{className:"flex items-center gap-2 border-b pb-2",children:[Ao(X,{className:"size-4 shrink-0 opacity-50"}),Ao(T,{value:d,onChange:b=>m(b.target.value),placeholder:x,"aria-label":x,className:"h-8 border-0 bg-transparent p-0 shadow-none focus-visible:ring-0"})]}),Fl("ul",{role:"list",className:"max-h-72 overflow-y-auto py-1",children:[N.length===0&&Ao("li",{className:"px-2 py-6 text-center text-sm text-muted-foreground",children:v}),N.map(b=>{let g=b.id===u;return Ao("li",{children:Fl("button",{type:"button",disabled:b.disabled,"aria-pressed":g,onClick:()=>p(b.id),className:l("flex w-full items-center gap-2 rounded-sm px-2 py-2 text-left text-sm outline-none transition-colors","hover:bg-muted focus-visible:bg-muted focus-visible:ring-2 focus-visible:ring-ring/50",g&&"bg-accent/50",b.disabled&&"pointer-events-none opacity-50"),children:[Ao(Xr,{className:"size-4 shrink-0 opacity-50"}),Fl("span",{className:"flex-1 truncate",children:[b.no??b.id,b.product&&Fl("span",{className:"ml-1 text-xs text-muted-foreground",children:["\xB7 ",b.product]})]}),b.date&&Ao("span",{className:"shrink-0 text-xs text-muted-foreground",children:tt(b.date)}),b.status&&Ao("span",{className:"shrink-0 text-xs text-muted-foreground",children:b.status}),g&&Ao(U,{className:"size-4 shrink-0"})]})},b.id)})]}),Fl(Ge,{children:[Ao(C,{variant:"outline",type:"button",onClick:()=>t(!1),children:s("dialog.closeButton",{defaultValue:"\u53D6\u6D88"})}),Ao(C,{type:"button",disabled:u==null,onClick:h,children:s("priceAdjustBrowse.confirm",{defaultValue:"\u786E\u5B9A"})})]})]})})}import*as Wd from"react";import{useTranslation as _1}from"react-i18next";import{jsx as Eo,jsxs as ym}from"react/jsx-runtime";function BX({open:e,onOpenChange:t,onSelect:a,items:r=[],title:o,searchPlaceholder:n,emptyText:i,className:c}){let{t:s}=_1("ui"),[d,m]=Wd.useState(""),[u,p]=Wd.useState(null),f=o??s("feeTypeBrowse.title",{defaultValue:"\u9009\u62E9\u8D39\u7528\u7C7B\u578B"}),x=n??s("feeTypeBrowse.search",{defaultValue:"\u641C\u7D22\u8D39\u7528\u7C7B\u578B"}),v=i??s("feeTypeBrowse.empty",{defaultValue:"\u65E0\u5339\u914D\u8D39\u7528\u7C7B\u578B"}),N=Wd.useMemo(()=>{if(!d.trim())return r;let b=d.trim().toLowerCase();return r.filter(g=>g.name.toLowerCase().includes(b)||g.id.toLowerCase().includes(b)||g.code?.toLowerCase().includes(b))},[r,d]);Wd.useEffect(()=>{e&&(m(""),p(null))},[e]);let h=()=>{if(u==null)return;let b=r.find(g=>g.id===u);b&&(a(b),t(!1))};return Eo(Ie,{open:e,onOpenChange:t,children:ym(De,{"data-slot":"fee-type-browse",className:l("sm:max-w-md",c),children:[ym($e,{children:[Eo(Me,{children:f}),Eo(Ye,{children:s("feeTypeBrowse.description",{defaultValue:"\u4ECE\u5217\u8868\u4E2D\u9009\u62E9\u4E00\u4E2A\u8D39\u7528\u7C7B\u578B"})})]}),ym("div",{className:"flex items-center gap-2 border-b pb-2",children:[Eo(X,{className:"size-4 shrink-0 opacity-50"}),Eo(T,{value:d,onChange:b=>m(b.target.value),placeholder:x,"aria-label":x,className:"h-8 border-0 bg-transparent p-0 shadow-none focus-visible:ring-0"})]}),ym("ul",{role:"list",className:"max-h-72 overflow-y-auto py-1",children:[N.length===0&&Eo("li",{className:"px-2 py-6 text-center text-sm text-muted-foreground",children:v}),N.map(b=>{let g=b.id===u;return Eo("li",{children:ym("button",{type:"button",disabled:b.disabled,"aria-pressed":g,onClick:()=>p(b.id),className:l("flex w-full items-center gap-2 rounded-sm px-2 py-2 text-left text-sm outline-none transition-colors","hover:bg-muted focus-visible:bg-muted focus-visible:ring-2 focus-visible:ring-ring/50",g&&"bg-accent/50",b.disabled&&"pointer-events-none opacity-50"),children:[Eo(Xr,{className:"size-4 shrink-0 opacity-50"}),Eo("span",{className:"flex-1 truncate",children:b.name}),b.direction&&Eo("span",{className:"shrink-0 text-xs text-muted-foreground",children:b.direction==="expense"?"\u652F\u51FA":"\u6536\u5165"}),g&&Eo(U,{className:"size-4 shrink-0"})]})},b.id)})]}),ym(Ge,{children:[Eo(C,{variant:"outline",type:"button",onClick:()=>t(!1),children:s("dialog.closeButton",{defaultValue:"\u53D6\u6D88"})}),Eo(C,{type:"button",disabled:u==null,onClick:h,children:s("feeTypeBrowse.confirm",{defaultValue:"\u786E\u5B9A"})})]})]})})}import*as _d from"react";import{useTranslation as q1}from"react-i18next";import{jsx as ao,jsxs as Nm}from"react/jsx-runtime";function OX({open:e,onOpenChange:t,onSelect:a,items:r=[],title:o,searchPlaceholder:n,emptyText:i,className:c}){let{t:s}=q1("ui"),[d,m]=_d.useState(""),[u,p]=_d.useState(null),f=o??s("shippingWayBrowse.title",{defaultValue:"\u9009\u62E9\u8FD0\u8F93\u65B9\u5F0F"}),x=n??s("shippingWayBrowse.search",{defaultValue:"\u641C\u7D22\u8FD0\u8F93\u65B9\u5F0F"}),v=i??s("shippingWayBrowse.empty",{defaultValue:"\u65E0\u5339\u914D\u8FD0\u8F93\u65B9\u5F0F"}),N=_d.useMemo(()=>{if(!d.trim())return r;let b=d.trim().toLowerCase();return r.filter(g=>g.name.toLowerCase().includes(b)||g.id.toLowerCase().includes(b)||g.code?.toLowerCase().includes(b)||g.carrier?.toLowerCase().includes(b))},[r,d]);_d.useEffect(()=>{e&&(m(""),p(null))},[e]);let h=()=>{if(u==null)return;let b=r.find(g=>g.id===u);b&&(a(b),t(!1))};return ao(Ie,{open:e,onOpenChange:t,children:Nm(De,{"data-slot":"shipping-way-browse",className:l("sm:max-w-md",c),children:[Nm($e,{children:[ao(Me,{children:f}),ao(Ye,{children:s("shippingWayBrowse.description",{defaultValue:"\u4ECE\u5217\u8868\u4E2D\u9009\u62E9\u8FD0\u8F93\u65B9\u5F0F"})})]}),Nm("div",{className:"flex items-center gap-2 border-b pb-2",children:[ao(X,{className:"size-4 shrink-0 opacity-50"}),ao(T,{value:d,onChange:b=>m(b.target.value),placeholder:x,"aria-label":x,className:"h-8 border-0 bg-transparent p-0 shadow-none focus-visible:ring-0"})]}),Nm("ul",{role:"list",className:"max-h-72 overflow-y-auto py-1",children:[N.length===0&&ao("li",{className:"px-2 py-6 text-center text-sm text-muted-foreground",children:v}),N.map(b=>{let g=b.id===u;return ao("li",{children:Nm("button",{type:"button",disabled:b.disabled,"aria-pressed":g,onClick:()=>p(b.id),className:l("flex w-full items-center gap-2 rounded-sm px-2 py-2 text-left text-sm outline-none transition-colors","hover:bg-muted focus-visible:bg-muted focus-visible:ring-2 focus-visible:ring-ring/50",g&&"bg-accent/50",b.disabled&&"pointer-events-none opacity-50"),children:[ao(Cg,{className:"size-4 shrink-0 opacity-50"}),ao("span",{className:"flex-1 truncate",children:b.name}),b.code&&ao("span",{className:"shrink-0 text-xs text-muted-foreground",children:b.code}),b.carrier&&ao("span",{className:"shrink-0 text-xs text-muted-foreground",children:b.carrier}),g&&ao(U,{className:"size-4 shrink-0"})]})},b.id)})]}),Nm(Ge,{children:[ao(C,{variant:"outline",type:"button",onClick:()=>t(!1),children:s("dialog.closeButton",{defaultValue:"\u53D6\u6D88"})}),ao(C,{type:"button",disabled:u==null,onClick:h,children:s("shippingWayBrowse.confirm",{defaultValue:"\u786E\u5B9A"})})]})]})})}import*as qd from"react";import{useTranslation as G1}from"react-i18next";import{jsx as ro,jsxs as Cm}from"react/jsx-runtime";function XX({open:e,onOpenChange:t,onSelect:a,items:r=[],title:o,searchPlaceholder:n,emptyText:i,className:c}){let{t:s}=G1("ui"),[d,m]=qd.useState(""),[u,p]=qd.useState(null),f=o??s("warehouseBrowse.title",{defaultValue:"\u9009\u62E9\u4ED3\u5E93"}),x=n??s("warehouseBrowse.search",{defaultValue:"\u641C\u7D22\u4ED3\u5E93"}),v=i??s("warehouseBrowse.empty",{defaultValue:"\u65E0\u5339\u914D\u4ED3\u5E93"}),N=qd.useMemo(()=>{if(!d.trim())return r;let b=d.trim().toLowerCase();return r.filter(g=>g.name.toLowerCase().includes(b)||g.id.toLowerCase().includes(b)||g.code?.toLowerCase().includes(b)||g.address?.toLowerCase().includes(b)||g.manager?.toLowerCase().includes(b))},[r,d]);qd.useEffect(()=>{e&&(m(""),p(null))},[e]);let h=()=>{if(u==null)return;let b=r.find(g=>g.id===u);b&&(a(b),t(!1))};return ro(Ie,{open:e,onOpenChange:t,children:Cm(De,{"data-slot":"warehouse-browse",className:l("sm:max-w-md",c),children:[Cm($e,{children:[ro(Me,{children:f}),ro(Ye,{children:s("warehouseBrowse.description",{defaultValue:"\u4ECE\u5217\u8868\u4E2D\u9009\u62E9\u4E00\u4E2A\u4ED3\u5E93"})})]}),Cm("div",{className:"flex items-center gap-2 border-b pb-2",children:[ro(X,{className:"size-4 shrink-0 opacity-50"}),ro(T,{value:d,onChange:b=>m(b.target.value),placeholder:x,"aria-label":x,className:"h-8 border-0 bg-transparent p-0 shadow-none focus-visible:ring-0"})]}),Cm("ul",{role:"list",className:"max-h-72 overflow-y-auto py-1",children:[N.length===0&&ro("li",{className:"px-2 py-6 text-center text-sm text-muted-foreground",children:v}),N.map(b=>{let g=b.id===u;return ro("li",{children:Cm("button",{type:"button",disabled:b.disabled,"aria-pressed":g,onClick:()=>p(b.id),className:l("flex w-full items-center gap-2 rounded-sm px-2 py-2 text-left text-sm outline-none transition-colors","hover:bg-muted focus-visible:bg-muted focus-visible:ring-2 focus-visible:ring-ring/50",g&&"bg-accent/50",b.disabled&&"pointer-events-none opacity-50"),children:[ro(Qr,{className:"size-4 shrink-0 opacity-50"}),ro("span",{className:"flex-1 truncate",children:b.name}),b.code&&ro("span",{className:"shrink-0 text-xs text-muted-foreground",children:b.code}),b.manager&&ro("span",{className:"shrink-0 text-xs text-muted-foreground",children:b.manager}),g&&ro(U,{className:"size-4 shrink-0"})]})},b.id)})]}),Cm(Ge,{children:[ro(C,{variant:"outline",type:"button",onClick:()=>t(!1),children:s("dialog.closeButton",{defaultValue:"\u53D6\u6D88"})}),ro(C,{type:"button",disabled:u==null,onClick:h,children:s("warehouseBrowse.confirm",{defaultValue:"\u786E\u5B9A"})})]})]})})}import*as Gd from"react";import{useTranslation as j1}from"react-i18next";import{jsx as Fo,jsxs as km}from"react/jsx-runtime";function nY({open:e,onOpenChange:t,onSelect:a,items:r=[],title:o,searchPlaceholder:n,emptyText:i,className:c}){let{t:s}=j1("ui"),[d,m]=Gd.useState(""),[u,p]=Gd.useState(null),f=o??s("companyBrowse.title",{defaultValue:"\u9009\u62E9\u516C\u53F8"}),x=n??s("companyBrowse.search",{defaultValue:"\u641C\u7D22\u516C\u53F8"}),v=i??s("companyBrowse.empty",{defaultValue:"\u65E0\u5339\u914D\u516C\u53F8"}),N=Gd.useMemo(()=>{if(!d.trim())return r;let b=d.trim().toLowerCase();return r.filter(g=>g.name.toLowerCase().includes(b)||g.id.toLowerCase().includes(b)||g.code?.toLowerCase().includes(b)||g.taxNo?.toLowerCase().includes(b))},[r,d]);Gd.useEffect(()=>{e&&(m(""),p(null))},[e]);let h=()=>{if(u==null)return;let b=r.find(g=>g.id===u);b&&(a(b),t(!1))};return Fo(Ie,{open:e,onOpenChange:t,children:km(De,{"data-slot":"company-browse",className:l("sm:max-w-md",c),children:[km($e,{children:[Fo(Me,{children:f}),Fo(Ye,{children:s("companyBrowse.description",{defaultValue:"\u4ECE\u5217\u8868\u4E2D\u9009\u62E9\u4E00\u4E2A\u516C\u53F8"})})]}),km("div",{className:"flex items-center gap-2 border-b pb-2",children:[Fo(X,{className:"size-4 shrink-0 opacity-50"}),Fo(T,{value:d,onChange:b=>m(b.target.value),placeholder:x,"aria-label":x,className:"h-8 border-0 bg-transparent p-0 shadow-none focus-visible:ring-0"})]}),km("ul",{role:"list",className:"max-h-72 overflow-y-auto py-1",children:[N.length===0&&Fo("li",{className:"px-2 py-6 text-center text-sm text-muted-foreground",children:v}),N.map(b=>{let g=b.id===u;return Fo("li",{children:km("button",{type:"button",disabled:b.disabled,"aria-pressed":g,onClick:()=>p(b.id),className:l("flex w-full items-center gap-2 rounded-sm px-2 py-2 text-left text-sm outline-none transition-colors","hover:bg-muted focus-visible:bg-muted focus-visible:ring-2 focus-visible:ring-ring/50",g&&"bg-accent/50",b.disabled&&"pointer-events-none opacity-50"),children:[Fo(Ji,{className:"size-4 shrink-0 opacity-50"}),Fo("span",{className:"flex-1 truncate",children:b.name}),b.code&&Fo("span",{className:"shrink-0 text-xs text-muted-foreground",children:b.code}),g&&Fo(U,{className:"size-4 shrink-0"})]})},b.id)})]}),km(Ge,{children:[Fo(C,{variant:"outline",type:"button",onClick:()=>t(!1),children:s("dialog.closeButton",{defaultValue:"\u53D6\u6D88"})}),Fo(C,{type:"button",disabled:u==null,onClick:h,children:s("companyBrowse.confirm",{defaultValue:"\u786E\u5B9A"})})]})]})})}import*as jd from"react";import{useTranslation as K1}from"react-i18next";import{jsx as $o,jsxs as wm}from"react/jsx-runtime";function gY({open:e,onOpenChange:t,onSelect:a,items:r=[],title:o,searchPlaceholder:n,emptyText:i,className:c}){let{t:s}=K1("ui"),[d,m]=jd.useState(""),[u,p]=jd.useState(null),f=o??s("cityBrowse.title",{defaultValue:"\u9009\u62E9\u57CE\u5E02"}),x=n??s("cityBrowse.search",{defaultValue:"\u641C\u7D22\u57CE\u5E02"}),v=i??s("cityBrowse.empty",{defaultValue:"\u65E0\u5339\u914D\u57CE\u5E02"}),N=jd.useMemo(()=>{if(!d.trim())return r;let b=d.trim().toLowerCase();return r.filter(g=>g.name.toLowerCase().includes(b)||g.code.toLowerCase().includes(b)||g.province?.toLowerCase().includes(b))},[r,d]);jd.useEffect(()=>{e&&(m(""),p(null))},[e]);let h=()=>{if(u==null)return;let b=r.find(g=>g.code===u);b&&(a(b),t(!1))};return $o(Ie,{open:e,onOpenChange:t,children:wm(De,{"data-slot":"city-browse",className:l("sm:max-w-md",c),showCloseButton:!0,children:[wm($e,{children:[$o(Me,{children:f}),$o(Ye,{children:s("cityBrowse.description",{defaultValue:"\u4ECE\u5217\u8868\u4E2D\u9009\u62E9\u4E00\u4E2A\u57CE\u5E02"})})]}),wm("div",{className:"flex items-center gap-2 border-b pb-2",children:[$o(X,{className:"size-4 shrink-0 opacity-50"}),$o(T,{value:d,onChange:b=>m(b.target.value),placeholder:x,"aria-label":x,className:"h-8 border-0 bg-transparent p-0 shadow-none focus-visible:ring-0"})]}),wm("ul",{role:"list",className:"max-h-72 overflow-y-auto py-1",children:[N.length===0&&$o("li",{className:"px-2 py-6 text-center text-sm text-muted-foreground",children:v}),N.map(b=>{let g=b.code===u;return $o("li",{children:wm("button",{type:"button",disabled:b.disabled,"aria-pressed":g,onClick:()=>p(b.code),className:l("flex w-full items-center gap-2 rounded-sm px-2 py-2 text-left text-sm outline-none transition-colors","hover:bg-muted focus-visible:bg-muted focus-visible:ring-2 focus-visible:ring-ring/50",g&&"bg-accent/50",b.disabled&&"pointer-events-none opacity-50"),children:[$o(on,{className:"size-4 shrink-0 opacity-50"}),$o("span",{className:"flex-1 truncate",children:b.name}),b.province&&$o("span",{className:"shrink-0 text-xs text-muted-foreground",children:b.province}),g&&$o(U,{className:"size-4 shrink-0"})]})},b.code)})]}),wm(Ge,{children:[$o(C,{variant:"outline",type:"button",onClick:()=>t(!1),children:s("dialog.closeButton",{defaultValue:"\u53D6\u6D88"})}),$o(C,{type:"button",disabled:u==null,onClick:h,children:s("cityBrowse.confirm",{defaultValue:"\u786E\u5B9A"})})]})]})})}import{jsx as Kt,jsxs as $l}from"react/jsx-runtime";function yY({rows:e,className:t}){let a=e.reduce((n,i)=>n+i.amount,0),r=e.reduce((n,i)=>n+i.taxAmount,0),o=a+r;return $l("section",{"data-slot":"tax-detail-table",className:l("flex flex-col gap-3",t),"aria-labelledby":"tax-detail-table-title",children:[$l("h3",{id:"tax-detail-table-title",className:"flex items-center gap-1.5 text-sm font-medium",children:[Kt(ou,{className:"size-4 text-primary","aria-hidden":"true"}),Kt("span",{children:"\u7A0E\u52A1\u660E\u7EC6"})]}),Kt("div",{className:"overflow-x-auto rounded-md border",children:$l("table",{className:"w-full text-sm",children:[$l("caption",{className:"sr-only",children:["\u7A0E\u52A1\u660E\u7EC6\uFF0C\u5408\u8BA1\u7A0E\u989D ",Ne(r)]}),Kt("thead",{className:"bg-muted/50",children:$l("tr",{children:[Kt("th",{scope:"col",className:"px-3 py-2 text-left font-medium",children:"\u9879\u76EE"}),Kt("th",{scope:"col",className:"px-3 py-2 text-right font-medium",children:"\u91D1\u989D"}),Kt("th",{scope:"col",className:"px-3 py-2 text-right font-medium",children:"\u7A0E\u7387"}),Kt("th",{scope:"col",className:"px-3 py-2 text-right font-medium",children:"\u7A0E\u989D"}),Kt("th",{scope:"col",className:"px-3 py-2 text-right font-medium",children:"\u4EF7\u7A0E\u5408\u8BA1"})]})}),$l("tbody",{children:[e.map(n=>$l("tr",{className:"border-t",children:[Kt("td",{className:"px-3 py-2 font-medium",children:n.name}),Kt("td",{className:"px-3 py-2 text-right tabular-nums",children:Ne(n.amount)}),Kt("td",{className:"px-3 py-2 text-right tabular-nums",children:bt(n.taxRate)}),Kt("td",{className:"px-3 py-2 text-right tabular-nums",children:Ne(n.taxAmount)}),Kt("td",{className:"px-3 py-2 text-right tabular-nums font-medium",children:Ne(n.amount+n.taxAmount)})]},n.id)),e.length===0?Kt("tr",{children:Kt("td",{colSpan:5,className:"px-3 py-6 text-center text-muted-foreground",children:"\u6682\u65E0\u7A0E\u52A1\u660E\u7EC6"})}):null]}),e.length>0?Kt("tfoot",{className:"border-t bg-muted/30 font-semibold",children:$l("tr",{children:[Kt("td",{className:"px-3 py-2",children:"\u5408\u8BA1"}),Kt("td",{className:"px-3 py-2 text-right tabular-nums",children:Ne(a)}),Kt("td",{className:"px-3 py-2 text-right text-muted-foreground",children:"\u2014"}),Kt("td",{className:"px-3 py-2 text-right tabular-nums",children:Ne(r)}),Kt("td",{className:"px-3 py-2 text-right tabular-nums",children:Ne(o)})]})}):null]})})]})}import"react";import{Fragment as Y1,jsx as Ho,jsxs as Kd}from"react/jsx-runtime";var Q1={done:{label:"\u5DF2\u5B8C\u6210",icon:Ho(qe,{className:"size-4"}),tone:"text-emerald-600"},doing:{label:"\u8FDB\u884C\u4E2D",icon:Ho(pe,{className:"size-4"}),tone:"text-primary"},pending:{label:"\u5F85\u5904\u7406",icon:Ho(vo,{className:"size-4"}),tone:"text-muted-foreground"},rejected:{label:"\u5DF2\u9A73\u56DE",icon:Ho(Q,{className:"size-4"}),tone:"text-destructive"}};function X1(e){let t=e.toLowerCase();return t==="done"||t==="completed"||t==="finish"||t==="finished"?"done":t==="doing"||t==="active"||t==="processing"||t==="current"?"doing":t==="rejected"||t==="fail"||t==="failed"||t==="error"?"rejected":"pending"}function SY({steps:e=[],className:t}){return e.length===0?Kd("div",{"data-slot":"writeoff-flow",className:l("flex items-center gap-2 rounded-lg border border-dashed p-6 text-sm text-muted-foreground",t),role:"status",children:[Ho(vo,{className:"size-4"}),"\u6682\u65E0\u6838\u9500\u6B65\u9AA4"]}):Ho("ol",{"data-slot":"writeoff-flow",className:l("flex flex-col gap-0",t),role:"list","aria-label":"\u6838\u9500\u6D41\u7A0B",children:e.map((a,r)=>{let o=X1(a.status),n=Q1[o],i=r===e.length-1,c=o==="done";return Kd("li",{className:"relative flex gap-3 pb-4 last:pb-0",children:[!i&&Ho("span",{className:l("absolute left-[15px] top-8 bottom-0 w-0.5",c?"bg-emerald-500":"bg-border"),"aria-hidden":"true"}),Ho("span",{className:l("relative z-10 flex size-8 shrink-0 items-center justify-center rounded-full border-2 bg-background",c&&"border-emerald-500",o==="doing"&&"border-primary",(o==="pending"||o==="rejected")&&"border-muted-foreground/30",n.tone),"aria-hidden":"true",children:n.icon}),Kd("div",{className:"flex min-w-0 flex-1 flex-col gap-1 pt-1",children:[Kd("div",{className:"flex flex-wrap items-center gap-2",children:[Ho("span",{className:"text-sm font-medium",children:a.name}),Ho(B,{variant:o==="done"?"default":o==="rejected"?"destructive":"secondary",className:l(o==="doing"&&"border-primary text-primary"),children:n.label}),a.amount!==void 0&&Ho("span",{className:"text-xs text-muted-foreground tabular-nums",children:Ne(a.amount)})]}),Kd("div",{className:"flex items-center gap-1 text-xs text-muted-foreground tabular-nums",children:[Kd("span",{children:["\u6B65\u9AA4 ",r+1," / ",e.length]}),!i&&Kd(Y1,{children:[Ho(_a,{className:"size-3","aria-hidden":"true"}),Ho("span",{children:e[r+1]?.name})]})]})]})]},a.id)})})}import{jsx as oo,jsxs as Hl}from"react/jsx-runtime";function LY({total:e,used:t,remaining:a,categories:r,currency:o="CNY",className:n}){let i=e>0?Math.round(t/e*100):0;return Hl("div",{"data-slot":"budget-overview",className:l("flex flex-col gap-3 rounded-lg border bg-card p-4",n),children:[Hl("div",{className:"flex items-baseline justify-between",children:[oo("span",{className:"text-sm font-medium",children:"\u9884\u7B97\u603B\u89C8"}),Hl("span",{className:"text-xs text-muted-foreground",children:["\u5DF2\u7528 ",i,"%"]})]}),oo("div",{className:"h-2 overflow-hidden rounded bg-muted",children:oo("div",{className:l("h-full rounded",i>90?"bg-red-500":i>70?"bg-yellow-500":"bg-emerald-500"),style:{width:`${i}%`}})}),Hl("div",{className:"grid grid-cols-3 gap-2 text-sm",children:[Hl("div",{children:[oo("div",{className:"text-xs text-muted-foreground",children:"\u603B\u9884\u7B97"}),oo("div",{className:"font-medium",children:Ne(e,o)})]}),Hl("div",{children:[oo("div",{className:"text-xs text-muted-foreground",children:"\u5DF2\u7528"}),oo("div",{className:"font-medium",children:Ne(t,o)})]}),Hl("div",{children:[oo("div",{className:"text-xs text-muted-foreground",children:"\u5269\u4F59"}),oo("div",{className:"font-medium",children:Ne(a,o)})]})]}),oo("div",{className:"flex flex-col gap-1 border-t pt-2 text-sm",children:r.map(c=>{let s=c.budget>0?Math.round(c.actual/c.budget*100):0;return Hl("div",{className:"flex items-center gap-2",children:[oo("span",{className:"w-24 truncate text-muted-foreground",children:c.name}),oo("div",{className:"h-1.5 flex-1 overflow-hidden rounded bg-muted",children:oo("div",{className:"h-full rounded bg-primary",style:{width:`${s}%`}})}),oo("span",{className:"w-20 text-right tabular-nums",children:Ne(c.actual,o)})]},c.name)})})]})}import{jsx as Ti,jsxs as Cs}from"react/jsx-runtime";function VY({target:e,actual:t,period:a,className:r}){let o=e>0?t/e:0,n=Math.min(1,o),i=t>=e&&e>0,c=i?"up":"down";return Cs(Y,{"data-slot":"target-progress",className:l("w-full",r),children:[Ti(le,{children:Cs(ie,{className:"flex items-center justify-between",children:[Cs("span",{className:"flex items-center gap-2",children:[Ti(Ig,{className:"size-4 text-primary"}),"\u76EE\u6807\u8FDB\u5EA6"]}),a&&Ti("span",{className:"text-xs font-normal text-muted-foreground",children:a})]})}),Cs(J,{className:"flex flex-col gap-4",children:[Cs("div",{className:"flex items-end justify-between",children:[Cs("div",{children:[Ti("p",{className:"text-xs text-muted-foreground",children:"\u5B9E\u9645 / \u76EE\u6807"}),Cs("p",{className:"text-2xl font-semibold tabular-nums",children:[q(t),Cs("span",{className:"ml-1 text-sm font-normal text-muted-foreground",children:["/ ",q(e)]})]})]}),Cs("div",{className:l("inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs font-medium tabular-nums",i?"bg-emerald-100 text-emerald-700 dark:bg-emerald-950/40 dark:text-emerald-400":"bg-amber-100 text-amber-700 dark:bg-amber-950/40 dark:text-amber-400"),children:[c==="up"?Ti(an,{}):Ti(tn,{}),bt(o)]})]}),Cs("div",{className:"flex flex-col gap-1.5",children:[Ti("div",{className:"h-2 w-full overflow-hidden rounded-full bg-muted",role:"progressbar","aria-valuenow":Math.round(n*100),"aria-valuemin":0,"aria-valuemax":100,"aria-label":"\u76EE\u6807\u5B8C\u6210\u7387",children:Ti("div",{className:l("h-full rounded-full transition-all",i?"bg-emerald-500":"bg-primary"),style:{width:`${n*100}%`}})}),Ti("p",{className:"text-xs text-muted-foreground",children:i?"\u5DF2\u8FBE\u6210\u76EE\u6807":`\u8FD8\u5DEE ${q(Math.max(0,e-t))} \u8FBE\u6210\u76EE\u6807`})]})]})]})}import{jsx as Vo,jsxs as Ri}from"react/jsx-runtime";var J1={normal:{label:"\u6B63\u5E38",tone:"text-emerald-600",dot:"bg-emerald-500"},low:{label:"\u504F\u4F4E",tone:"text-yellow-600",dot:"bg-yellow-500"},out:{label:"\u7F3A\u8D27",tone:"text-destructive",dot:"bg-red-500"}};function GY({items:e,className:t}){let a=e.filter(n=>n.status==="normal").length,r=e.filter(n=>n.status==="low").length,o=e.filter(n=>n.status==="out").length;return Ri("div",{"data-slot":"inventory-snapshot",className:l("flex flex-col gap-3 rounded-lg border bg-card p-4",t),role:"region","aria-label":"\u5E93\u5B58\u5FEB\u7167",children:[Ri("div",{className:"flex items-center justify-between",children:[Vo("span",{className:"text-sm font-medium",children:"\u5E93\u5B58\u5FEB\u7167"}),Ri("span",{className:"text-xs text-muted-foreground",children:["\u5171 ",e.length," \u9879"]})]}),Ri("div",{className:"grid grid-cols-3 gap-2 text-center text-xs",children:[Ri("div",{className:"rounded-md bg-emerald-50 py-1.5",children:[Vo("div",{className:"text-muted-foreground",children:"\u6B63\u5E38"}),Vo("div",{className:"font-semibold text-emerald-600",children:a})]}),Ri("div",{className:"rounded-md bg-yellow-50 py-1.5",children:[Vo("div",{className:"text-muted-foreground",children:"\u504F\u4F4E"}),Vo("div",{className:"font-semibold text-yellow-600",children:r})]}),Ri("div",{className:"rounded-md bg-red-50 py-1.5",children:[Vo("div",{className:"text-muted-foreground",children:"\u7F3A\u8D27"}),Vo("div",{className:"font-semibold text-destructive",children:o})]})]}),Vo("ul",{className:"flex flex-col divide-y",role:"list",children:e.map(n=>{let i=J1[n.status],c=n.status==="out"?Qr:jh;return Ri("li",{className:"flex items-center gap-3 py-2 text-sm",children:[Vo(c,{className:l("size-4 shrink-0",i.tone)}),Vo("span",{className:"flex-1 truncate",children:n.name}),Ri("span",{className:l("flex items-center gap-1 text-xs",i.tone),children:[Vo("span",{className:l("size-1.5 rounded-full",i.dot)}),i.label]}),Vo("span",{className:"w-16 text-right tabular-nums text-muted-foreground",children:n.status==="out"?"-":q(n.qty)})]},n.id)})}),e.length===0&&Vo("p",{className:"py-4 text-center text-sm text-muted-foreground",children:"\u6682\u65E0\u5E93\u5B58\u6570\u636E"})]})}import{jsx as Vl,jsxs as Pm}from"react/jsx-runtime";function JY({total:e,issued:t,pending:a,amount:r,className:o}){let n=e>0?Math.round(t/e*100):0,i=[{label:"\u53D1\u7968\u603B\u6570",value:q(e),icon:Xr,tone:"text-foreground"},{label:"\u5DF2\u5F00\u5177",value:q(t),icon:qe,tone:"text-emerald-600"},{label:"\u5F85\u5F00\u5177",value:q(a),icon:pe,tone:"text-yellow-600"}];return Pm("div",{"data-slot":"invoice-summary",className:l("flex flex-col gap-3 rounded-lg border bg-card p-4",o),role:"region","aria-label":"\u53D1\u7968\u6C47\u603B",children:[Pm("div",{className:"flex items-baseline justify-between",children:[Vl("span",{className:"text-sm font-medium",children:"\u53D1\u7968\u6C47\u603B"}),Pm("span",{className:"text-xs text-muted-foreground",children:["\u5F00\u5177\u7387 ",n,"%"]})]}),Vl("div",{className:"h-2 overflow-hidden rounded bg-muted",children:Vl("div",{className:"h-full rounded bg-emerald-500",style:{width:`${n}%`}})}),Vl("div",{className:"grid grid-cols-3 gap-3",children:i.map(c=>Pm("div",{className:"flex flex-col gap-1",children:[Pm("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[Vl(c.icon,{className:l("size-3",c.tone)}),c.label]}),Vl("span",{className:l("text-xl font-semibold tabular-nums",c.tone),children:c.value})]},c.label))}),Pm("div",{className:"flex items-center justify-between border-t pt-3 text-sm",children:[Vl("span",{className:"text-muted-foreground",children:"\u91D1\u989D\u5408\u8BA1"}),Vl("span",{className:"font-semibold tabular-nums",children:Ne(r)})]})]})}import{jsx as Kf,jsxs as iC}from"react/jsx-runtime";function oJ({balance:e,currency:t="CNY",label:a="\u8D26\u6237\u4F59\u989D",trend:r,className:o}){let n=(r??0)>=0;return iC("div",{"data-slot":"account-balance",className:l("flex flex-col gap-1 rounded-lg border bg-card p-4",o),children:[Kf("span",{className:"text-xs text-muted-foreground",children:a}),Kf("span",{className:"text-2xl font-semibold tabular-nums",children:Ne(e,t)}),r!==void 0&&iC("span",{className:l("flex items-center gap-1 text-xs font-medium",n?"text-emerald-600":"text-red-600"),"aria-label":`\u8D8B\u52BF ${r}%`,children:[n?Kf(en,{className:"size-3.5"}):Kf(Zo,{className:"size-3.5"}),Math.abs(r),"%"]})]})}import*as Qf from"react";import{jsx as Ar,jsxs as mp}from"react/jsx-runtime";function dJ({rows:e,onChange:t,className:a}){let[r,o]=Qf.useState(e);Qf.useEffect(()=>{o(e)},[e]);let n=(c,s)=>{let d=r.map(m=>{if(m.id!==c)return m;let u=s.orderAmount!==void 0?s.orderAmount:m.orderAmount,p=s.deduction!==void 0?s.deduction:m.deduction,f=u-p;return{...m,...s,netAmount:f}});o(d),t?.(d)},i=c=>{let s=Number(c);return Number.isFinite(s)?s:0};return Ar("div",{"data-slot":"reconciliation-line-editor",className:l("w-full overflow-x-auto",a),children:mp("table",{className:"w-full border-collapse text-sm",children:[Ar("thead",{children:mp("tr",{className:"border-b border-border bg-muted/40 text-left",children:[Ar("th",{scope:"col",className:"px-3 py-2 font-medium",children:"\u7ECF\u9500\u5546"}),Ar("th",{scope:"col",className:"px-3 py-2 text-right font-medium",children:"\u8BA2\u5355\u91D1\u989D"}),Ar("th",{scope:"col",className:"px-3 py-2 text-right font-medium",children:"\u6263\u51CF"}),Ar("th",{scope:"col",className:"px-3 py-2 text-right font-medium",children:"\u51C0\u989D"})]})}),Ar("tbody",{children:r.length===0?Ar("tr",{children:Ar("td",{colSpan:4,className:"px-3 py-4 text-center text-muted-foreground",children:"\u6682\u65E0\u5BF9\u8D26\u660E\u7EC6"})}):r.map(c=>mp("tr",{"data-slot":"reconciliation-line-editor-row",className:"border-b border-border last:border-0",children:[Ar("td",{className:"px-3 py-2",children:c.distributor}),mp("td",{className:"px-3 py-2 text-right",children:[Ar("label",{htmlFor:`order-${c.id}`,className:"sr-only",children:"\u8BA2\u5355\u91D1\u989D"}),Ar("input",{id:`order-${c.id}`,type:"number",inputMode:"decimal","data-slot":"reconciliation-line-editor-input","data-field":"orderAmount","aria-label":"\u8BA2\u5355\u91D1\u989D",value:c.orderAmount,onChange:s=>n(c.id,{orderAmount:i(s.target.value)}),className:"w-28 rounded-md border border-input bg-transparent px-2 py-1 text-right outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50"})]}),mp("td",{className:"px-3 py-2 text-right",children:[Ar("label",{htmlFor:`deduction-${c.id}`,className:"sr-only",children:"\u6263\u51CF"}),Ar("input",{id:`deduction-${c.id}`,type:"number",inputMode:"decimal","data-slot":"reconciliation-line-editor-input","data-field":"deduction","aria-label":"\u6263\u51CF",value:c.deduction,onChange:s=>n(c.id,{deduction:i(s.target.value)}),className:"w-28 rounded-md border border-input bg-transparent px-2 py-1 text-right outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50"})]}),Ar("td",{className:"px-3 py-2 text-right tabular-nums","data-slot":"reconciliation-line-editor-net",children:Ne(c.netAmount)})]},c.id))})]})})}import*as Xf from"react";import{jsx as pt,jsxs as Si}from"react/jsx-runtime";function hJ({rows:e,onChange:t,className:a}){let[r,o]=Xf.useState(e);Xf.useEffect(()=>{o(e)},[e]);let n=m=>{o(m),t?.(m)},i=(m,u,p)=>{n(r.map(f=>{if(f.id!==m)return f;let x={...f,[u]:p};return x.annual=x.q1+x.q2+x.q3+x.q4,x}))},c=m=>{n(r.filter(u=>u.id!==m))},s=()=>{let m=`row-${Date.now()}`;n([...r,{id:m,year:new Date().getFullYear(),region:"",q1:0,q2:0,q3:0,q4:0,annual:0}])},d=Math.max(1,...r.map(m=>m.annual));return Si("div",{"data-slot":"sales-target-editor",className:l("flex flex-col gap-3",a),children:[Si("div",{className:"flex items-center gap-2",children:[pt(Ig,{className:"size-5 text-muted-foreground","aria-hidden":!0}),pt("h3",{className:"text-base font-medium",children:"\u9500\u552E\u76EE\u6807"})]}),pt("div",{className:"overflow-x-auto",children:Si("table",{className:"w-full border-collapse text-sm",children:[pt("thead",{children:Si("tr",{className:"border-b text-left text-muted-foreground",children:[pt("th",{scope:"col",className:"px-2 py-1.5 font-medium",children:"\u5E74\u5EA6"}),pt("th",{scope:"col",className:"px-2 py-1.5 font-medium",children:"\u533A\u57DF"}),pt("th",{scope:"col",className:"px-2 py-1.5 font-medium",children:"Q1"}),pt("th",{scope:"col",className:"px-2 py-1.5 font-medium",children:"Q2"}),pt("th",{scope:"col",className:"px-2 py-1.5 font-medium",children:"Q3"}),pt("th",{scope:"col",className:"px-2 py-1.5 font-medium",children:"Q4"}),pt("th",{scope:"col",className:"px-2 py-1.5 font-medium",children:"\u5E74\u5EA6\u5408\u8BA1"}),pt("th",{scope:"col",className:"px-2 py-1.5 font-medium",children:"\u64CD\u4F5C"})]})}),pt("tbody",{children:r.length===0?pt("tr",{children:pt("td",{colSpan:8,className:"px-2 py-4 text-center text-muted-foreground",children:"\u6682\u65E0\u76EE\u6807\u6570\u636E"})}):r.map(m=>{let u=Math.min(100,m.annual/d*100);return Si("tr",{className:"border-b last:border-0",children:[pt("td",{className:"px-2 py-1.5 tabular-nums",children:m.year}),pt("td",{className:"px-2 py-1.5",children:pt(T,{"aria-label":`\u533A\u57DF ${m.id}`,value:m.region,onChange:p=>n(r.map(f=>f.id===m.id?{...f,region:p.target.value}:f))})}),["q1","q2","q3","q4"].map(p=>pt("td",{className:"px-2 py-1.5",children:pt(T,{"aria-label":`${p} ${m.id}`,type:"number",className:"w-20",value:Number.isFinite(m[p])?m[p]:0,onChange:f=>i(m.id,p,f.target.valueAsNumber)})},p)),pt("td",{className:"px-2 py-1.5",children:Si("div",{className:"flex flex-col gap-1",children:[pt(cr,{value:u,"aria-label":`\u5E74\u5EA6\u5408\u8BA1 ${m.id}`,children:pt(Lc,{style:{width:`${u}%`}})}),pt("span",{className:"text-xs tabular-nums text-muted-foreground",children:q(m.annual)})]})}),pt("td",{className:"px-2 py-1.5",children:pt(C,{type:"button",variant:"ghost",size:"sm","aria-label":`\u5220\u9664 ${m.id}`,onClick:()=>c(m.id),children:pt(ye,{className:"size-4","aria-hidden":!0})})})]},m.id)})})]})}),Si("div",{className:"flex items-center justify-between",children:[Si(ue,{className:"text-muted-foreground",children:["\u5171 ",r.length," \u6761"]}),Si(C,{type:"button",variant:"outline",size:"sm",onClick:s,children:[pt(ge,{className:"size-4","aria-hidden":!0}),"\u65B0\u589E\u76EE\u6807"]})]})]})}import*as Ol from"react";import{jsx as Et,jsxs as no}from"react/jsx-runtime";function MJ({initial:e,onSubmit:t,className:a}){let[r,o]=Ol.useState(typeof e?.name=="string"?e.name:""),[n,i]=Ol.useState(typeof e?.type=="string"?e.type:"discount"),[c,s]=Ol.useState(typeof e?.budget=="number"?e.budget:0),[d,m]=Ol.useState(typeof e?.start=="string"?e.start:""),[u,p]=Ol.useState(typeof e?.end=="string"?e.end:""),[f,x]=Ol.useState(e?.enabled===!0),[v,N]=Ol.useState(typeof e?.note=="string"?e.note:""),h=b=>{b.preventDefault(),t?.({name:r,type:n,budget:c,start:d,end:u,enabled:f,note:v})};return no("form",{"data-slot":"marketing-activity-form",className:l("flex flex-col gap-4",a),onSubmit:h,children:[no("div",{className:"flex items-center gap-2",children:[Et(fg,{className:"size-5 text-muted-foreground","aria-hidden":!0}),Et("h3",{className:"text-base font-medium",children:"\u8425\u9500\u6D3B\u52A8"})]}),no("div",{className:"flex flex-col gap-1.5",children:[Et(ue,{htmlFor:"maf-name",children:"\u6D3B\u52A8\u540D\u79F0"}),Et(T,{id:"maf-name",value:r,onChange:b=>o(b.target.value),placeholder:"\u8BF7\u8F93\u5165\u6D3B\u52A8\u540D\u79F0"})]}),no("div",{className:"grid grid-cols-2 gap-4",children:[no("div",{className:"flex flex-col gap-1.5",children:[Et(ue,{htmlFor:"maf-type",children:"\u6D3B\u52A8\u7C7B\u578B"}),no(Pe,{value:n,onValueChange:b=>i(b??"discount"),children:[Et(Re,{id:"maf-type",children:Et(Te,{placeholder:"\u8BF7\u9009\u62E9"})}),no(Se,{children:[Et(ve,{value:"discount",children:"\u6EE1\u51CF\u4F18\u60E0"}),Et(ve,{value:"coupon",children:"\u9886\u5238"}),Et(ve,{value:"gift",children:"\u8D60\u54C1"}),Et(ve,{value:"flash",children:"\u9650\u65F6\u79D2\u6740"})]})]})]}),no("div",{className:"flex flex-col gap-1.5",children:[Et(ue,{htmlFor:"maf-budget",children:"\u9884\u7B97\uFF08\u5143\uFF09"}),Et(T,{id:"maf-budget",type:"number",value:Number.isFinite(c)?c:0,onChange:b=>s(b.target.valueAsNumber)}),Et("span",{className:"text-xs text-muted-foreground tabular-nums",children:Ne(c)})]})]}),no("div",{className:"grid grid-cols-2 gap-4",children:[no("div",{className:"flex flex-col gap-1.5",children:[Et(ue,{htmlFor:"maf-start",children:"\u5F00\u59CB\u65E5\u671F"}),Et(T,{id:"maf-start",type:"date",value:d,onChange:b=>m(b.target.value)})]}),no("div",{className:"flex flex-col gap-1.5",children:[Et(ue,{htmlFor:"maf-end",children:"\u7ED3\u675F\u65E5\u671F"}),Et(T,{id:"maf-end",type:"date",value:u,onChange:b=>p(b.target.value)})]})]}),no("div",{className:"flex items-center justify-between gap-2",children:[Et(ue,{htmlFor:"maf-enabled",children:"\u7ACB\u5373\u542F\u7528"}),Et($n,{id:"maf-enabled",checked:f,onCheckedChange:x})]}),no("div",{className:"flex flex-col gap-1.5",children:[Et(ue,{htmlFor:"maf-note",children:"\u5907\u6CE8"}),Et(St,{id:"maf-note",value:v,onChange:b=>N(b.target.value),placeholder:"\u53EF\u9009\u7684\u6D3B\u52A8\u8BF4\u660E"})]}),Et("div",{className:"flex justify-end gap-2",children:no(C,{type:"submit",children:[Et(rs,{className:"size-4","aria-hidden":!0}),"\u63D0\u4EA4"]})})]})}import*as Yf from"react";import{jsx as gt,jsxs as Ii}from"react/jsx-runtime";function VJ({rows:e,onChange:t,className:a}){let[r,o]=Yf.useState(e);Yf.useEffect(()=>{o(e)},[e]);let n=d=>{o(d),t?.(d)},i=(d,m,u)=>{n(r.map(p=>p.id===d?{...p,[m]:u}:p))},c=d=>{n(r.filter(m=>m.id!==d))},s=()=>{let d=`row-${Date.now()}`;n([...r,{id:d,name:"",type:"discount",condition:"",reward:"",quota:0,used:0}])};return Ii("div",{"data-slot":"policy-line-editor",className:l("flex flex-col gap-3",a),children:[Ii("table",{className:"w-full border-collapse text-sm",children:[gt("thead",{children:Ii("tr",{className:"border-b text-left text-muted-foreground",children:[gt("th",{scope:"col",className:"px-2 py-1.5 font-medium",children:"\u653F\u7B56\u540D\u79F0"}),gt("th",{scope:"col",className:"px-2 py-1.5 font-medium",children:"\u7C7B\u578B"}),gt("th",{scope:"col",className:"px-2 py-1.5 font-medium",children:"\u6761\u4EF6"}),gt("th",{scope:"col",className:"px-2 py-1.5 font-medium",children:"\u5956\u52B1"}),gt("th",{scope:"col",className:"px-2 py-1.5 font-medium",children:"\u989D\u5EA6"}),gt("th",{scope:"col",className:"px-2 py-1.5 font-medium",children:"\u4F7F\u7528\u91CF"}),gt("th",{scope:"col",className:"px-2 py-1.5 font-medium",children:"\u64CD\u4F5C"})]})}),gt("tbody",{children:r.length===0?gt("tr",{children:gt("td",{colSpan:7,className:"px-2 py-4 text-center text-muted-foreground",children:"\u6682\u65E0\u653F\u7B56\u660E\u7EC6"})}):r.map(d=>{let m=d.quota>0?Math.min(100,d.used/d.quota*100):0;return Ii("tr",{className:"border-b last:border-0",children:[gt("td",{className:"px-2 py-1.5",children:gt(T,{"aria-label":`\u653F\u7B56\u540D\u79F0 ${d.id}`,value:d.name,onChange:u=>i(d.id,"name",u.target.value)})}),gt("td",{className:"px-2 py-1.5",children:gt(T,{"aria-label":`\u7C7B\u578B ${d.id}`,value:d.type,onChange:u=>i(d.id,"type",u.target.value)})}),gt("td",{className:"px-2 py-1.5",children:gt(T,{"aria-label":`\u6761\u4EF6 ${d.id}`,value:d.condition,onChange:u=>i(d.id,"condition",u.target.value)})}),gt("td",{className:"px-2 py-1.5",children:gt(T,{"aria-label":`\u5956\u52B1 ${d.id}`,value:d.reward,onChange:u=>i(d.id,"reward",u.target.value)})}),gt("td",{className:"px-2 py-1.5",children:gt(T,{"aria-label":`\u989D\u5EA6 ${d.id}`,type:"number",value:Number.isFinite(d.quota)?d.quota:0,onChange:u=>i(d.id,"quota",u.target.valueAsNumber)})}),gt("td",{className:"px-2 py-1.5",children:Ii("div",{className:"flex flex-col gap-1",children:[gt(cr,{value:m,"aria-label":`\u4F7F\u7528\u8FDB\u5EA6 ${d.id}`,children:gt(Lc,{style:{width:`${m}%`}})}),Ii("span",{className:"text-xs tabular-nums text-muted-foreground",children:[d.used," / ",d.quota]})]})}),gt("td",{className:"px-2 py-1.5",children:gt(C,{type:"button",variant:"ghost",size:"sm","aria-label":`\u5220\u9664\u653F\u7B56 ${d.id}`,onClick:()=>c(d.id),children:gt(ye,{className:"size-4","aria-hidden":!0})})})]},d.id)})})]}),Ii("div",{className:"flex items-center justify-between",children:[Ii(ue,{className:"text-muted-foreground",children:["\u5171 ",r.length," \u6761"]}),Ii(C,{type:"button",variant:"outline",size:"sm",onClick:s,children:[gt(ge,{className:"size-4","aria-hidden":!0}),"\u65B0\u589E\u653F\u7B56"]})]})]})}import*as lC from"react";import{jsx as Jf,jsxs as Uv}from"react/jsx-runtime";var Z1={open:"\u5F00\u6237",close:"\u9500\u6237",change:"\u53D8\u66F4"};function GJ({type:e,onSubmit:t,className:a}){let[r,o]=lC.useState("");return Uv("form",{"data-slot":"application-form",className:l("flex flex-col gap-3 rounded-lg border bg-card p-4",a),onSubmit:n=>{n.preventDefault(),t?.({type:e,reason:r})},children:[Uv("div",{className:"text-sm font-medium",children:[Z1[e],"\u7533\u8BF7"]}),Uv("label",{className:"text-sm",children:[Jf("span",{className:"mb-1 block text-muted-foreground",children:"\u7533\u8BF7\u4E8B\u7531"}),Jf(St,{value:r,onChange:n=>o(n.target.value),placeholder:"\u8BF7\u8F93\u5165\u7533\u8BF7\u4E8B\u7531",required:!0})]}),Jf("div",{className:"flex justify-end",children:Jf(C,{type:"submit",children:"\u63D0\u4EA4\u7533\u8BF7"})})]})}import{jsx as Oo,jsxs as Er}from"react/jsx-runtime";function ZJ({totalAmount:e,matchedAmount:t,unmatchedAmount:a,matchedCount:r,unmatchedCount:o,className:n}){let i=e>0?t/e:0,c=r+o;return Er(Y,{"data-slot":"reconciliation-summary",className:l("w-full",n),children:[Oo(le,{children:Er(ie,{className:"flex items-center gap-2",children:[Oo(wg,{className:"size-4 text-primary"}),"\u5BF9\u8D26\u6C47\u603B"]})}),Er(J,{className:"flex flex-col gap-4",children:[Er("div",{className:"rounded-lg border bg-muted/30 p-4",children:[Oo("p",{className:"text-xs text-muted-foreground",children:"\u5BF9\u8D26\u603B\u989D"}),Oo("p",{className:"text-2xl font-semibold tabular-nums",children:Ne(e)})]}),Er("div",{className:"grid grid-cols-2 gap-3",children:[Er("div",{className:"flex items-start gap-2 rounded-lg border border-emerald-200 bg-emerald-50 p-3 dark:border-emerald-900/50 dark:bg-emerald-950/30",children:[Oo(qe,{className:"mt-0.5 size-4 text-emerald-600"}),Er("div",{className:"min-w-0",children:[Oo("p",{className:"text-xs text-muted-foreground",children:"\u5DF2\u5339\u914D"}),Oo("p",{className:"text-sm font-semibold tabular-nums",children:Ne(t)}),Er("p",{className:"text-xs text-muted-foreground tabular-nums",children:[r," \u7B14"]})]})]}),Er("div",{className:"flex items-start gap-2 rounded-lg border border-amber-200 bg-amber-50 p-3 dark:border-amber-900/50 dark:bg-amber-950/30",children:[Oo(jt,{className:"mt-0.5 size-4 text-amber-600"}),Er("div",{className:"min-w-0",children:[Oo("p",{className:"text-xs text-muted-foreground",children:"\u672A\u5339\u914D"}),Oo("p",{className:"text-sm font-semibold tabular-nums",children:Ne(a)}),Er("p",{className:"text-xs text-muted-foreground tabular-nums",children:[o," \u7B14"]})]})]})]}),Er("div",{className:"flex flex-col gap-1.5",children:[Er("div",{className:"flex items-center justify-between text-sm",children:[Oo("span",{className:"text-muted-foreground",children:"\u5339\u914D\u7387"}),Er("span",{className:"font-medium tabular-nums",children:[(i*100).toFixed(1),"%"]})]}),Oo("div",{className:"h-2 w-full overflow-hidden rounded-full bg-muted",role:"progressbar","aria-valuenow":Math.round(i*100),"aria-valuemin":0,"aria-valuemax":100,"aria-label":"\u5BF9\u8D26\u5339\u914D\u7387",children:Oo("div",{className:"h-full rounded-full bg-primary transition-all",style:{width:`${Math.min(100,i*100)}%`}})}),Er("p",{className:"text-xs text-muted-foreground tabular-nums",children:["\u5171 ",c," \u7B14 \xB7 \u5DF2\u5339\u914D ",r," \xB7 \u672A\u5339\u914D ",o]})]})]})]})}import"react";import{jsx as Zf,jsxs as tS}from"react/jsx-runtime";var eS={unsettled:{label:"\u672A\u7ED3\u7B97",icon:Zf(vo,{}),className:"bg-muted text-muted-foreground"},partial:{label:"\u90E8\u5206\u7ED3\u7B97",icon:Zf(pe,{}),className:"bg-amber-100 text-amber-700 dark:bg-amber-950/40 dark:text-amber-400"},settled:{label:"\u5DF2\u7ED3\u7B97",icon:Zf(qe,{}),className:"bg-emerald-100 text-emerald-700 dark:bg-emerald-950/40 dark:text-emerald-400"},overdue:{label:"\u903E\u671F",icon:Zf(jt,{}),className:"bg-destructive/10 text-destructive"}};function nZ({status:e,className:t}){let a=eS[e];return tS("span",{"data-slot":"settlement-status-tag",role:"status",className:l("inline-flex w-fit items-center gap-1 rounded-full px-2 py-0.5 text-xs font-medium",a.className,t),children:[a.icon,a.label]})}import"react";import{jsx as eb}from"react/jsx-runtime";function uZ({onSign:e,signed:t=!1,label:a,className:r}){let o=a??(t?"\u5DF2\u7B7E\u6536":"\u7B7E\u6536"),n=i=>{t||(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),e?.())};return eb("span",{"data-slot":"sign-action-button",className:l("inline-flex",r),children:eb(C,{type:"button",variant:t?"secondary":"default",onClick:t?void 0:e,onKeyDown:n,disabled:t,"aria-label":o,"aria-pressed":t,icon:t?eb(U,{}):eb(nu,{}),children:o})})}import*as dC from"react";import{jsx as Qd,jsxs as Tm}from"react/jsx-runtime";var aS={pending:{label:"\u5F85\u5F00\u5177",tone:"bg-yellow-100 text-yellow-700"},issued:{label:"\u5DF2\u5F00\u5177",tone:"bg-emerald-100 text-emerald-700"},void:{label:"\u5DF2\u4F5C\u5E9F",tone:"bg-red-100 text-red-700"},draft:{label:"\u8349\u7A3F",tone:"bg-muted text-muted-foreground"}};function hZ({invoices:e,onIssue:t,className:a}){let[r,o]=dC.useState(null),n=async c=>{o(c);try{await t?.(c)}finally{o(null)}},i=e.reduce((c,s)=>c+s.amount,0);return Tm("div",{"data-slot":"invoice-manager",className:l("flex flex-col gap-3 rounded-lg border bg-card p-4",a),role:"region","aria-label":"\u53D1\u7968\u7BA1\u7406",children:[Tm("div",{className:"flex items-center justify-between",children:[Tm("span",{className:"flex items-center gap-2 text-sm font-medium",children:[Qd(Xr,{className:"size-4"}),"\u53D1\u7968\u7BA1\u7406"]}),Tm("span",{className:"text-xs text-muted-foreground",children:["\u5171 ",e.length," \u5F20 \xB7 \u5408\u8BA1 ",Ne(i)]})]}),Qd("ul",{className:"flex flex-col divide-y",role:"list",children:e.map(c=>{let s=aS[c.status]??{label:c.status,tone:"bg-muted text-muted-foreground"},d=c.status==="pending"||c.status==="draft";return Tm("li",{className:"flex items-center gap-3 py-2 text-sm",children:[Qd("span",{className:"font-mono text-xs text-muted-foreground",children:c.number}),Qd("span",{className:l("rounded px-1.5 py-0.5 text-xs",s.tone),children:s.label}),Qd("span",{className:"ml-auto font-medium tabular-nums",children:Ne(c.amount)}),d&&Tm(C,{type:"button",variant:"outline",size:"sm",disabled:r===c.id,onClick:()=>n(c.id),"aria-label":`\u5F00\u5177\u53D1\u7968 ${c.number}`,children:[Qd(rs,{className:"size-3"}),r===c.id?"\u5F00\u5177\u4E2D":"\u5F00\u5177"]})]},c.id)})}),e.length===0&&Qd("p",{className:"py-4 text-center text-sm text-muted-foreground",children:"\u6682\u65E0\u53D1\u7968"})]})}import{jsx as cC,jsxs as Wv}from"react/jsx-runtime";function wZ({total:e,currency:t="\xA5",payLabel:a="Pay Now",isLoading:r,onPay:o,className:n}){return Wv("div",{"data-slot":"checkout-bar",className:l("bg-background sticky bottom-0 flex items-center justify-between border-t p-4",n),children:[Wv("div",{className:"flex items-baseline gap-0.5",children:[cC("span",{className:"text-muted-foreground text-xs",children:"Total"}),Wv("span",{className:"text-xl font-bold",children:[t," ",e]})]}),cC(C,{size:"lg",onClick:o,disabled:r,children:r?"Processing...":a})]})}import{jsx as up,jsxs as tb}from"react/jsx-runtime";function IZ({value:e,description:t,expiresAt:a,used:r,onUse:o,className:n}){return tb("div",{"data-slot":"coupon-card",className:l("bg-card relative flex items-center gap-4 overflow-hidden rounded-lg border p-4",r&&"opacity-50",n),children:[up("div",{className:"border-border absolute inset-y-0 left-24 w-px border-l border-dashed"}),tb("div",{className:"flex w-24 shrink-0 flex-col items-center justify-center",children:[up("span",{className:"text-primary text-xl font-bold",children:e}),a&&tb("span",{className:"text-muted-foreground mt-0.5 text-[0.65rem]",children:["Until ",a]})]}),tb("div",{className:"flex flex-1 flex-col gap-1 pl-4",children:[t&&up("p",{className:"text-sm",children:t}),r&&up("span",{className:"text-muted-foreground text-xs",children:"Used"})]}),!r&&o&&up(C,{variant:"outline",size:"sm",onClick:o,children:"Use"})]})}import{jsx as ab,jsxs as _v}from"react/jsx-runtime";function FZ({url:e,description:t,className:a}){let[r,o]=un();return _v("div",{"data-slot":"invite-link",className:l("bg-card flex flex-col gap-2 rounded-lg border p-4",a),children:[t&&ab("p",{className:"text-muted-foreground text-sm",children:t}),_v("div",{className:"flex gap-2",children:[ab(T,{value:e,readOnly:!0,className:"flex-1 font-mono text-xs"}),_v(C,{variant:"outline",size:"sm",onClick:()=>o(e),className:"shrink-0",children:[r?ab(U,{className:"text-success"}):ab(zt,{}),r?"Copied":"Copy"]})]})]})}import"react";import{jsx as Xd,jsxs as mC}from"react/jsx-runtime";var rS=[{id:"card",label:"Card",icon:Xd(Vh,{})},{id:"wechat",label:"WeChat",icon:Xd(nd,{})},{id:"alipay",label:"Alipay",icon:Xd(nd,{})},{id:"transfer",label:"Bank Transfer",icon:Xd(wg,{})}];function _Z({value:e,onChange:t,className:a}){return mC("div",{"data-slot":"payment-method-selector",className:l("grid gap-2",a),children:[Xd(ue,{className:"text-sm font-medium",children:"Payment Method"}),Xd("div",{className:"grid grid-cols-2 gap-2",children:rS.map(r=>mC("button",{type:"button",onClick:()=>t?.(r.id),className:l("flex items-center gap-2 rounded-lg border p-3 text-sm transition-colors",e===r.id?"border-primary bg-primary/10 text-primary":"border-border hover:border-primary/50 hover:bg-muted"),children:[r.icon,Xd("span",{children:r.label})]},r.id))})]})}import{jsx as Rm,jsxs as pp}from"react/jsx-runtime";function XZ({status:e,orderId:t,amount:a,primaryLabel:r,onPrimary:o,secondaryLabel:n,onSecondary:i,className:c}){let s=e==="success";return pp("div",{"data-slot":"payment-result",className:l("flex flex-col items-center justify-center gap-4 p-8 text-center",c),children:[Rm("div",{className:l("flex size-16 items-center justify-center rounded-full",s?"bg-success/20":"bg-destructive/20"),children:s?Rm(U,{className:"text-success size-8"}):Rm("span",{className:"text-destructive text-3xl font-bold",children:"!"})}),Rm("h2",{className:"text-xl font-semibold",children:s?"Payment Successful":"Payment Failed"}),pp("div",{className:"text-muted-foreground space-y-1 text-sm",children:[t&&pp("p",{children:["Order: ",t]}),a&&pp("p",{children:["Amount: ",a]})]}),pp("div",{className:"mt-2 flex gap-3",children:[n&&Rm(C,{variant:"outline",onClick:i,children:n}),r&&Rm(C,{onClick:o,children:r})]})]})}import"react";import{jsx as Gn,jsxs as Yd}from"react/jsx-runtime";var oS={label:"\u5F85\u4ED8\u6B3E",tone:"text-muted-foreground",icon:pe},nS={paid:{label:"\u5DF2\u4ED8\u6B3E",tone:"text-emerald-600",icon:qe},pending:{label:"\u5F85\u4ED8\u6B3E",tone:"text-yellow-600",icon:pe},overdue:{label:"\u5DF2\u903E\u671F",tone:"text-destructive",icon:jr},default:{label:"\u5F85\u4ED8\u6B3E",tone:"text-muted-foreground",icon:pe}};function ree({schedule:e,className:t}){let a=e.reduce((i,c)=>i+c.amount,0),r=e.filter(i=>i.status==="paid").reduce((i,c)=>i+c.amount,0),o=a>0?Math.round(r/a*100):0,n=i=>nS[i]??oS;return Yd("div",{"data-slot":"payment-schedule",className:l("flex flex-col gap-3 rounded-lg border bg-card p-4",t),role:"region","aria-label":"\u4ED8\u6B3E\u8BA1\u5212",children:[Yd("div",{className:"flex items-baseline justify-between",children:[Gn("span",{className:"text-sm font-medium",children:"\u4ED8\u6B3E\u8BA1\u5212"}),Yd("span",{className:"text-xs text-muted-foreground",children:["\u5DF2\u4ED8 ",o,"%"]})]}),Gn("div",{className:"h-2 overflow-hidden rounded bg-muted",children:Gn("div",{className:"h-full rounded bg-emerald-500",style:{width:`${o}%`}})}),Gn("ol",{className:"flex flex-col",role:"list",children:e.map((i,c)=>{let s=n(i.status),d=s.icon;return Yd("li",{className:"flex gap-3 pb-4 last:pb-0",children:[Yd("div",{className:"flex flex-col items-center",children:[Gn("span",{className:l("flex size-7 items-center justify-center rounded-full border-2 bg-card",s.tone),children:Gn(d,{className:"size-3.5"})}),c<e.length-1&&Gn("span",{className:"mt-1 w-px flex-1 bg-border","aria-hidden":"true"})]}),Yd("div",{className:"flex flex-1 flex-col gap-0.5 pt-0.5",children:[Yd("div",{className:"flex items-center justify-between",children:[Gn("span",{className:"text-sm font-medium",children:tt(i.date)}),Gn("span",{className:"text-sm font-medium tabular-nums",children:Ne(i.amount)})]}),Gn("span",{className:l("text-xs",s.tone),children:s.label})]})]},i.id)})}),e.length===0&&Gn("p",{className:"py-4 text-center text-sm text-muted-foreground",children:"\u6682\u65E0\u4ED8\u6B3E\u8BA1\u5212"})]})}import{jsx as Di,jsxs as rb}from"react/jsx-runtime";function iee({title:e,fields:t,lines:a,className:r}){return rb("div",{"data-slot":"bill-print-template",className:l("rounded-lg border bg-white p-6 text-black print:shadow-none",r),children:[Di("h2",{className:"text-center text-lg font-bold",children:e}),Di("dl",{className:"mt-4 grid grid-cols-2 gap-x-6 gap-y-1 text-sm",children:t.map(o=>rb("div",{className:"flex",children:[rb("dt",{className:"text-muted-foreground",children:[o.label,"\uFF1A"]}),Di("dd",{className:"font-medium",children:o.value})]},o.label))}),a&&a.length>0&&(()=>{let o=a[0];return o?rb("table",{className:"mt-4 w-full border-collapse text-sm",children:[Di("thead",{children:Di("tr",{children:Object.keys(o).map(n=>Di("th",{className:"border bg-muted/40 px-2 py-1 text-left",children:n},n))})}),Di("tbody",{children:a.map((n,i)=>Di("tr",{children:Object.values(n).map((c,s)=>Di("td",{className:"border px-2 py-1",children:c},s))},i))})]}):null})()]})}import{jsx as ks,jsxs as qv}from"react/jsx-runtime";var sS={docx:ks(Rt,{className:"size-4 shrink-0 text-muted-foreground","aria-hidden":!0}),xlsx:ks(ty,{className:"size-4 shrink-0 text-muted-foreground","aria-hidden":!0}),pdf:ks(Rt,{className:"size-4 shrink-0 text-muted-foreground","aria-hidden":!0}),csv:ks(es,{className:"size-4 shrink-0 text-muted-foreground","aria-hidden":!0}),other:ks(es,{className:"size-4 shrink-0 text-muted-foreground","aria-hidden":!0})},iS={docx:"Word",xlsx:"Excel",pdf:"PDF",csv:"CSV",other:"\u6587\u4EF6"};function pee({templates:e,onDownload:t,emptyLabel:a="\u6682\u65E0\u53EF\u7528\u6A21\u677F",className:r}){return e.length===0?ks("p",{"data-slot":"template-download",className:l("rounded-md border border-dashed bg-muted/40 px-3 py-6 text-center text-sm text-muted-foreground",r),children:a}):ks("ul",{"data-slot":"template-download",role:"list",className:l("flex flex-col divide-y divide-border rounded-lg border bg-card text-card-foreground",r),children:e.map(o=>qv("li",{"data-slot":"template-download-item",className:"flex items-center gap-3 p-2.5",children:[sS[o.type],qv("div",{className:"min-w-0 flex-1",children:[ks("p",{className:"truncate text-sm font-medium",children:o.name}),ks("p",{className:"text-xs text-muted-foreground",children:iS[o.type]})]}),qv("a",{"data-slot":"template-download-link",href:o.url,download:o.name,className:l(Ks({variant:"outline",size:"sm"})),onClick:()=>t?.(o),children:[ks(qa,{className:"size-4","aria-hidden":!0}),"\u4E0B\u8F7D"]})]},o.id))})}import{jsx as Ya,jsxs as Ul}from"react/jsx-runtime";function vee({errors:e,onExport:t,className:a}){let r=e.length;return Ul("section",{"data-slot":"import-error-table",className:l("flex flex-col gap-3",a),"aria-labelledby":"import-error-table-title",children:[Ul("div",{className:"flex items-center justify-between gap-2",children:[Ul("h3",{id:"import-error-table-title",className:"flex items-center gap-1.5 text-sm font-medium",children:[Ya(jt,{className:"size-4 text-destructive","aria-hidden":"true"}),Ya("span",{children:"\u5BFC\u5165\u9519\u8BEF"}),Ya("span",{className:"rounded-full bg-destructive/10 px-2 py-0.5 text-xs font-semibold text-destructive","aria-label":`\u5171 ${r} \u6761\u9519\u8BEF`,children:r})]}),t?Ul("button",{type:"button",onClick:t,className:"inline-flex items-center gap-1 rounded-md border px-2 py-1 text-xs hover:bg-muted",children:[Ya(qa,{className:"size-3.5","aria-hidden":"true"}),Ya("span",{children:"\u5BFC\u51FA\u9519\u8BEF"})]}):null]}),r===0?Ya("p",{className:"rounded-md border border-dashed p-4 text-center text-sm text-muted-foreground",children:"\u6CA1\u6709\u5BFC\u5165\u9519\u8BEF"}):Ya("div",{className:"overflow-x-auto rounded-md border",children:Ul("table",{className:"w-full text-sm",children:[Ul("caption",{className:"sr-only",children:["\u5BFC\u5165\u9519\u8BEF\u660E\u7EC6\uFF0C\u5171 ",r," \u6761"]}),Ya("thead",{className:"bg-muted/50",children:Ul("tr",{children:[Ya("th",{scope:"col",className:"px-3 py-2 text-left font-medium",children:"\u884C\u53F7"}),Ya("th",{scope:"col",className:"px-3 py-2 text-left font-medium",children:"\u5B57\u6BB5"}),Ya("th",{scope:"col",className:"px-3 py-2 text-left font-medium",children:"\u9519\u8BEF\u503C"}),Ya("th",{scope:"col",className:"px-3 py-2 text-left font-medium",children:"\u9519\u8BEF\u539F\u56E0"})]})}),Ya("tbody",{children:e.map((o,n)=>Ul("tr",{className:"border-t",children:[Ya("td",{className:"px-3 py-2 tabular-nums text-muted-foreground",children:o.row}),Ya("td",{className:"px-3 py-2 text-muted-foreground",children:o.field??"\u2014"}),Ya("td",{className:"max-w-[12rem] truncate px-3 py-2 font-mono text-xs",children:o.value??"\u2014"}),Ya("td",{className:"px-3 py-2 text-destructive",children:o.message})]},`${o.row}-${n}`))})]})})]})}import*as uC from"react";import{jsx as Jd,jsxs as Gv}from"react/jsx-runtime";function Tee({open:e,onOpenChange:t,items:a,onPrint:r,className:o}){let[n,i]=uC.useState(new Set),c=s=>i(d=>{let m=new Set(d);return m.has(s)?m.delete(s):m.add(s),m});return Jd(Ie,{open:e,onOpenChange:t,children:Gv(De,{className:l("max-w-md",o),"data-slot":"batch-print-dialog",children:[Jd($e,{children:Jd(Me,{children:"\u6279\u91CF\u6253\u5370"})}),Jd("div",{className:"flex flex-col gap-2",children:a.map(s=>Gv("label",{className:"flex items-center gap-2 text-sm",children:[Jd(ja,{checked:n.has(s.id),onCheckedChange:()=>c(s.id)}),s.title]},s.id))}),Jd(Ge,{children:Gv(C,{onClick:()=>r?.(Array.from(n)),disabled:n.size===0,children:[Jd(as,{className:"size-4"}),"\u6253\u5370 ",n.size||""," \u9879"]})})]})})}import*as ob from"react";import{jsx as Fr,jsxs as Sm}from"react/jsx-runtime";var lS={title:"",fields:[]};function Bee({template:e,onChange:t,className:a}){let r=ob.useMemo(()=>e&&e.title!==void 0&&Array.isArray(e.fields)?e:lS,[e]),o=ob.useCallback(m=>{t?.(m)},[t]),n=m=>{o({...r,title:m.target.value})},i=(m,u)=>{let p=r.fields.map((f,x)=>x===m?{...f,label:u}:f);o({...r,fields:p})},c=(m,u)=>{let p=r.fields.map((f,x)=>x===m?{...f,...u?{key:u}:{}}:f);o({...r,fields:p})},s=()=>{o({...r,fields:[...r.fields,{label:""}]})},d=m=>{o({...r,fields:r.fields.filter((u,p)=>p!==m)})};return Sm("div",{"data-slot":"print-template-builder",className:l("flex flex-col gap-4 rounded-lg border bg-card p-4 text-card-foreground",a),children:[Sm("div",{className:"flex items-center gap-2",children:[Fr(Rt,{className:"size-5 text-muted-foreground"}),Fr("h3",{className:"text-sm font-semibold",children:"\u6253\u5370\u6A21\u677F\u6784\u5EFA\u5668"})]}),Sm("div",{className:"flex flex-col gap-1.5",children:[Fr("label",{htmlFor:"print-template-title",className:"text-xs font-medium text-muted-foreground",children:"\u6A21\u677F\u6807\u9898"}),Fr(T,{id:"print-template-title",type:"text",value:r.title,placeholder:"\u8BF7\u8F93\u5165\u6A21\u677F\u6807\u9898",onChange:n})]}),Sm("div",{className:"flex flex-col gap-2",children:[Sm("div",{className:"flex items-center justify-between",children:[Fr("span",{className:"text-xs font-medium text-muted-foreground",children:"\u5B57\u6BB5\u5217\u8868"}),Fr(C,{type:"button",variant:"outline",size:"sm",icon:Fr(ge,{}),onClick:s,children:"\u6DFB\u52A0\u5B57\u6BB5"})]}),r.fields.length===0?Fr("p",{className:"rounded-md border border-dashed bg-muted/40 px-3 py-4 text-center text-sm text-muted-foreground",children:"\u6682\u65E0\u5B57\u6BB5\uFF0C\u70B9\u51FB\u201C\u6DFB\u52A0\u5B57\u6BB5\u201D\u5F00\u59CB\u6784\u5EFA\u6A21\u677F"}):Fr("ol",{role:"list",className:"flex flex-col gap-2",children:r.fields.map((m,u)=>Sm("li",{"data-slot":"print-template-field",className:"flex items-center gap-2 rounded-md border bg-background p-2",children:[Fr(ts,{className:"size-4 shrink-0 text-muted-foreground","aria-hidden":!0}),Fr("span",{className:"w-5 shrink-0 text-center text-xs tabular-nums text-muted-foreground",children:u+1}),Fr(T,{type:"text",value:m.label,placeholder:"\u5B57\u6BB5\u6807\u7B7E","aria-label":`\u5B57\u6BB5 ${u+1} \u6807\u7B7E`,className:"flex-1",onChange:p=>i(u,p.target.value)}),Fr(T,{type:"text",value:m.key??"",placeholder:"\u6570\u636E\u952E\u540D","aria-label":`\u5B57\u6BB5 ${u+1} \u952E\u540D`,className:"w-32",onChange:p=>c(u,p.target.value)}),Fr(C,{type:"button",variant:"ghost",size:"icon-sm","aria-label":`\u5220\u9664\u5B57\u6BB5 ${u+1}`,onClick:()=>d(u),children:Fr(ye,{})})]},u))})]})]})}import"react";import{jsx as so,jsxs as Wl}from"react/jsx-runtime";var dS={pending:{label:"\u5F85\u6253\u5370",variant:"secondary",icon:so(pe,{})},printing:{label:"\u6253\u5370\u4E2D",variant:"default",icon:so(as,{})},done:{label:"\u5DF2\u5B8C\u6210",variant:"outline",icon:so(qe,{})},error:{label:"\u5931\u8D25",variant:"destructive",icon:so(jt,{})}};function Hee({jobs:e=[],onPrint:t,onRefresh:a,className:r}){let o=e.filter(n=>n.status==="pending"||n.status==="printing").length;return Wl("div",{"data-slot":"print-service",className:l("flex flex-col gap-3 rounded-lg border bg-card p-4 text-card-foreground",r),children:[Wl("div",{className:"flex items-center justify-between gap-2",children:[Wl("div",{className:"flex items-center gap-2",children:[so(as,{className:"size-5 text-muted-foreground"}),so("h3",{className:"text-sm font-semibold",children:"\u6253\u5370\u670D\u52A1"}),o>0&&Wl(B,{variant:"default",children:[o," \u9879\u5F85\u5904\u7406"]})]}),so(C,{type:"button",variant:"outline",size:"sm",icon:so(ia,{}),onClick:a,children:"\u5237\u65B0"})]}),e.length===0?so("p",{className:"rounded-md border border-dashed bg-muted/40 px-3 py-6 text-center text-sm text-muted-foreground",children:"\u6253\u5370\u961F\u5217\u4E3A\u7A7A"}):so("ul",{role:"list",className:"flex flex-col divide-y divide-border",children:e.map(n=>{let i=dS[n.status];return Wl("li",{"data-slot":"print-service-job",className:"flex items-center gap-3 py-2.5",children:[so(Rt,{className:"size-4 shrink-0 text-muted-foreground"}),Wl("div",{className:"min-w-0 flex-1",children:[so("p",{className:"truncate text-sm font-medium",children:n.title}),n.pages!=null&&Wl("p",{className:"text-xs text-muted-foreground",children:[n.pages," \u9875"]})]}),Wl(B,{variant:i.variant,children:[i.icon,i.label]}),so(C,{type:"button",variant:"ghost",size:"sm",icon:so(as,{}),onClick:()=>t?.(n),disabled:n.status==="done",children:"\u6253\u5370"})]},n.id)})})]})}import*as nb from"react";import{jsx as pC,jsxs as gC}from"react/jsx-runtime";function _ee({accept:e,maxSize:t,onUpload:a,className:r}){let o=nb.useRef(null),[n,i]=nb.useState(!1),c=s=>{if(!s)return;let d=Array.from(s),m=t?d.filter(u=>u.size<=t):d;a?.(m)};return gC("div",{"data-slot":"attachment-uploader",className:l("flex flex-col items-center justify-center gap-2 rounded-lg border-2 border-dashed p-6 text-sm text-muted-foreground transition-colors",n&&"border-primary bg-primary/5",r),onDragOver:s=>{s.preventDefault(),i(!0)},onDragLeave:()=>i(!1),onDrop:s=>{s.preventDefault(),i(!1),c(s.dataTransfer.files)},role:"button",tabIndex:0,onClick:()=>o.current?.click(),onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&o.current?.click()},children:[pC(os,{className:"size-6"}),gC("span",{children:["\u70B9\u51FB\u6216\u62D6\u62FD\u6587\u4EF6\u5230\u6B64\u5904\u4E0A\u4F20",t?`\uFF08\u6700\u5927 ${(t/1024/1024).toFixed(0)} MB\uFF09`:""]}),pC("input",{ref:o,type:"file",accept:e,multiple:!0,className:"hidden",onChange:s=>c(s.target.files)})]})}import"react";import{jsx as jn,jsxs as jv}from"react/jsx-runtime";function cS(e){return e.startsWith("image/")?jn(ha,{}):e==="application/pdf"||e==="text/plain"||e.startsWith("text/")?jn(Rt,{}):jn(es,{})}function fC({name:e,size:t,type:a,url:r,onRemove:o,className:n}){return jv("div",{"data-slot":"file-card",className:l("flex items-center gap-3 rounded-lg border bg-card p-3 text-sm",n),children:[jn("span",{"aria-hidden":"true",className:"flex size-9 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground",children:cS(a)}),jv("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[jn("span",{className:"truncate font-medium",title:e,children:e}),jn("span",{className:"text-xs text-muted-foreground",children:Yg(t)})]}),jv("div",{className:"flex shrink-0 items-center gap-1",children:[r!==void 0&&jn(C,{type:"button",variant:"ghost",size:"icon-sm","aria-label":`\u4E0B\u8F7D ${e}`,render:jn("a",{href:r,download:e}),children:jn(qa,{})}),o!==void 0&&jn(C,{type:"button",variant:"ghost",size:"icon-sm","aria-label":`\u79FB\u9664 ${e}`,onClick:o,children:jn(Q,{})})]})]})}import{jsx as Kv}from"react/jsx-runtime";function ate({attachments:e,onRemove:t,className:a}){return e.length===0?Kv("div",{"data-slot":"attachment-list",className:l("text-sm text-muted-foreground",a),children:"\u6682\u65E0\u9644\u4EF6"}):Kv("div",{"data-slot":"attachment-list",className:l("flex flex-col gap-2",a),children:e.map(r=>Kv(fC,{name:r.name,size:r.size,type:r.type,...r.url!==void 0?{url:r.url}:{},...t?{onRemove:()=>t(r.id)}:{}},r.id))})}import{jsx as sb,jsxs as mS}from"react/jsx-runtime";function ite({url:e,type:t,name:a,className:r}){return sb("div",{"data-slot":"attachment-preview",className:l("flex items-center justify-center overflow-hidden rounded-lg border bg-muted/30 p-4",r),children:t.startsWith("image/")?sb("img",{src:e,alt:a??"\u9644\u4EF6",className:"max-h-80 object-contain"}):mS("a",{href:e,target:"_blank",rel:"noreferrer",className:"flex flex-col items-center gap-2 text-sm text-muted-foreground hover:text-foreground",children:[sb(es,{className:"size-10"}),sb("span",{className:"underline",children:a??"\u6253\u5F00\u9644\u4EF6"})]})})}import*as Zd from"react";import{jsx as Uo,jsxs as ib}from"react/jsx-runtime";function pte({images:e,className:t}){let[a,r]=Zd.useState(0),[o,n]=Zd.useState(!1),i=e.length,c=i===0?0:Math.min(a,i-1),s=i===0?null:e[c],d=Zd.useCallback(f=>{i!==0&&r((f%i+i)%i)},[i]),m=Zd.useCallback(()=>d(c-1),[d,c]),u=Zd.useCallback(()=>d(c+1),[d,c]),p=(f,x)=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),r(x))};return i===0?ib("div",{"data-slot":"image-gallery",className:l("flex flex-col items-center justify-center gap-2 rounded-lg border border-dashed bg-muted/40 p-8 text-sm text-muted-foreground",t),children:[Uo(ha,{className:"size-6","aria-hidden":"true"}),Uo("span",{children:"\u6682\u65E0\u56FE\u7247"})]}):ib("div",{"data-slot":"image-gallery",className:l("flex flex-col gap-3",t),children:[ib("div",{className:l("group relative flex items-center justify-center overflow-hidden rounded-lg border bg-muted",o?"h-[32rem]":"h-64"),children:[Uo("img",{src:s.src,alt:s.alt??`\u56FE\u7247 ${c+1}`,className:"h-full w-full object-contain"}),Uo(C,{type:"button",variant:"secondary",size:"icon-sm",className:"absolute left-2 top-1/2 -translate-y-1/2 opacity-0 transition-opacity group-hover:opacity-100 focus-visible:opacity-100","aria-label":"\u4E0A\u4E00\u5F20",onClick:m,disabled:i<=1,children:Uo(et,{})}),Uo(C,{type:"button",variant:"secondary",size:"icon-sm",className:"absolute right-2 top-1/2 -translate-y-1/2 opacity-0 transition-opacity group-hover:opacity-100 focus-visible:opacity-100","aria-label":"\u4E0B\u4E00\u5F20",onClick:u,disabled:i<=1,children:Uo(me,{})}),Uo(C,{type:"button",variant:"secondary",size:"icon-sm",className:"absolute right-2 top-2 opacity-0 transition-opacity group-hover:opacity-100 focus-visible:opacity-100","aria-label":o?"\u7F29\u5C0F":"\u653E\u5927","aria-pressed":o,onClick:()=>n(f=>!f),children:Uo(gg,{})}),ib("span",{className:"absolute bottom-2 left-1/2 -translate-x-1/2 rounded-full bg-background/80 px-2 py-0.5 text-xs tabular-nums text-muted-foreground",children:[c+1," / ",i]})]}),i>1&&Uo("ul",{role:"list",className:"flex gap-2 overflow-x-auto pb-1",children:e.map((f,x)=>{let v=x===c;return Uo("li",{className:"shrink-0",children:Uo("button",{type:"button","aria-label":`\u67E5\u770B\u7B2C ${x+1} \u5F20\u56FE\u7247`,"aria-current":v?"true":void 0,tabIndex:0,onClick:()=>r(x),onKeyDown:N=>p(N,x),className:l("size-16 overflow-hidden rounded-md border-2 bg-muted transition-colors",v?"border-primary":"border-transparent hover:border-border"),children:Uo("img",{src:f.src,alt:`\u7F29\u7565\u56FE ${x+1}`,className:"h-full w-full object-cover"})})},`${f.src}-${x}`)})})]})}import*as gp from"react";import{Fragment as pS,jsx as lb,jsxs as db}from"react/jsx-runtime";function uS(e){let t=e.clipboardData?.files;if(t&&t.length>0)return Array.from(t);let a=e.clipboardData?.items;if(!a)return[];let r=[];for(let o of Array.from(a))if(o.kind==="file"){let n=o.getAsFile();n&&r.push(n)}return r}function vte({onPaste:e,children:t,className:a}){let[r,o]=gp.useState(null),n=gp.useCallback(c=>{let s=c.nativeEvent,d=uS(s);d.length!==0&&(c.preventDefault(),o(d.length),e?.(d))},[e]),i=gp.useCallback(c=>{(c.ctrlKey||c.metaKey)&&(c.key==="v"||c.key)},[]);return db("div",{"data-slot":"paste-upload",role:"region","aria-label":"\u7C98\u8D34\u4E0A\u4F20\u533A\u57DF",tabIndex:0,onPaste:n,onKeyDown:i,className:l("flex min-h-32 flex-col items-center justify-center gap-2 rounded-lg border border-dashed bg-muted/40 p-6 text-center text-sm text-muted-foreground outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50",a),children:[t??db(pS,{children:[lb("span",{"aria-hidden":"true",className:"flex size-9 items-center justify-center rounded-md bg-muted text-foreground",children:lb(Fh,{})}),lb("p",{className:"font-medium text-foreground",children:"\u7C98\u8D34\u6587\u4EF6\u4EE5\u4E0A\u4F20"}),db("p",{className:"flex items-center gap-1 text-xs",children:[lb(os,{"aria-hidden":"true",className:"size-3.5"}),"\u6309 Ctrl/Cmd + V \u7C98\u8D34\u56FE\u7247\u6216\u6587\u4EF6"]})]}),r!==null&&db("p",{role:"status",className:"mt-1 text-xs text-primary",children:["\u5DF2\u6355\u83B7 ",r," \u4E2A\u6587\u4EF6"]})]})}import{jsx as Ja,jsxs as fp}from"react/jsx-runtime";function gS(e){let t=e.toLowerCase();return t==="\u9AD8"||t==="high"||t==="urgent"?"bg-destructive/10 text-destructive":t==="\u4E2D"||t==="medium"||t==="normal"?"bg-amber-500/10 text-amber-600 dark:text-amber-500":"bg-muted text-muted-foreground"}function fS(e){let t=e.toLowerCase();return t.includes("\u5B8C\u6210")||t==="done"||t==="completed"||t==="success"?"bg-emerald-500/10 text-emerald-600 dark:text-emerald-500":t.includes("\u8FDB\u884C")||t==="running"||t==="active"||t==="in progress"?"bg-primary/10 text-primary":t.includes("\u53D6\u6D88")||t.includes("\u5931\u8D25")||t==="failed"||t==="cancelled"?"bg-destructive/10 text-destructive":"bg-muted text-muted-foreground"}function wte({tasks:e,className:t}){return Ja("div",{"data-slot":"task-list-table",className:l("overflow-x-auto rounded-lg ring-1 ring-border",t),children:fp("table",{className:"w-full text-sm",children:[Ja("thead",{className:"bg-muted/50 text-muted-foreground",children:fp("tr",{children:[Ja("th",{scope:"col",className:"px-3 py-2 text-left font-medium",children:"\u6807\u9898"}),Ja("th",{scope:"col",className:"px-3 py-2 text-left font-medium",children:"\u72B6\u6001"}),Ja("th",{scope:"col",className:"px-3 py-2 text-left font-medium",children:"\u4F18\u5148\u7EA7"}),Ja("th",{scope:"col",className:"px-3 py-2 text-left font-medium",children:"\u8D1F\u8D23\u4EBA"}),Ja("th",{scope:"col",className:"px-3 py-2 text-left font-medium",children:"\u622A\u6B62\u65E5\u671F"})]})}),fp("tbody",{className:"divide-y divide-border",children:[e.map(a=>fp("tr",{className:"hover:bg-muted/30",children:[Ja("td",{className:"px-3 py-2 font-medium",children:a.title}),Ja("td",{className:"px-3 py-2",children:Ja("span",{className:l("inline-flex rounded px-1.5 py-0.5 text-xs font-medium",fS(a.status)),children:a.status})}),Ja("td",{className:"px-3 py-2",children:Ja("span",{className:l("inline-flex rounded px-1.5 py-0.5 text-xs font-medium",gS(a.priority)),children:a.priority})}),Ja("td",{className:"px-3 py-2 text-muted-foreground",children:a.assignee??"\u2014"}),Ja("td",{className:"px-3 py-2 text-muted-foreground",children:a.deadline?fp("span",{className:"inline-flex items-center gap-1",children:[Ja(pe,{className:"size-3"}),tt(a.deadline)]}):"\u2014"})]},a.id)),e.length===0?Ja("tr",{children:Ja("td",{colSpan:5,className:"px-3 py-6 text-center text-muted-foreground",children:"\u6682\u65E0\u4EFB\u52A1"})}):null]})]})})}import"react";import{jsx as Im,jsxs as bS}from"react/jsx-runtime";function Dte({entries:e=[],className:t}){return Im("nav",{"data-slot":"quick-entry-grid",className:l("w-full",t),"aria-label":"\u5FEB\u6377\u5165\u53E3",children:Im("ul",{role:"list",className:"grid grid-cols-2 gap-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6",children:e.map(a=>Im("li",{children:bS("button",{type:"button",onClick:a.onClick,className:"group flex w-full flex-col items-center gap-2 rounded-lg border border-border bg-card p-4 text-center transition-colors hover:border-primary hover:bg-muted focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 outline-none","aria-label":a.label,children:[Im("span",{className:"flex size-10 items-center justify-center rounded-full bg-primary/10 text-primary group-hover:bg-primary group-hover:text-primary-foreground",children:a.icon??Im(mg,{className:"size-5"})}),Im("span",{className:"text-sm font-medium text-foreground",children:a.label})]})},a.id))})})}import{jsx as cb,jsxs as xS}from"react/jsx-runtime";function Ete({title:e,content:t,date:a,pinned:r,className:o}){return xS("div",{"data-slot":"announcement-card",className:l("relative rounded-lg border bg-card p-4",r&&"border-primary/40",o),children:[r&&cb(xg,{className:"absolute right-3 top-3 size-4 text-primary","aria-label":"\u7F6E\u9876"}),cb("div",{className:"font-medium",children:e}),cb("p",{className:"mt-1 text-sm text-muted-foreground",children:t}),a&&cb("div",{className:"mt-2 text-xs text-muted-foreground",children:tt(a)})]})}import"react";import{jsx as Za,jsxs as Dm}from"react/jsx-runtime";var vS={1:Ng,2:ny,3:ey};function Wte({rows:e,className:t}){return Dm("div",{"data-slot":"performance-rank-table",className:l("overflow-hidden rounded-lg border bg-card",t),role:"region","aria-label":"\u4E1A\u7EE9\u6392\u540D\u8868",children:[Dm("table",{className:"w-full text-sm",children:[Za("caption",{className:"sr-only",children:"\u4E1A\u7EE9\u6392\u540D"}),Za("thead",{className:"border-b bg-muted/50 text-xs text-muted-foreground",children:Dm("tr",{children:[Za("th",{scope:"col",className:"px-4 py-2 text-left font-medium",children:"\u6392\u540D"}),Za("th",{scope:"col",className:"px-4 py-2 text-left font-medium",children:"\u59D3\u540D"}),Za("th",{scope:"col",className:"px-4 py-2 text-right font-medium",children:"\u4E1A\u7EE9"}),Za("th",{scope:"col",className:"px-4 py-2 text-right font-medium",children:"\u73AF\u6BD4"})]})}),Za("tbody",{className:"divide-y",children:e.map(a=>{let r=(a.growth??0)>=0,o=r?en:Zo,n=vS[a.rank];return Dm("tr",{className:"hover:bg-muted/30",children:[Za("td",{className:"px-4 py-2.5",children:Dm("span",{className:"flex items-center gap-1.5",children:[n?Za(n,{className:l("size-4",a.rank===1?"text-yellow-500":a.rank===2?"text-slate-400":"text-amber-700")}):Za("span",{className:"flex size-5 items-center justify-center rounded-full bg-muted text-xs tabular-nums",children:a.rank}),Za("span",{className:"tabular-nums",children:a.rank})]})}),Za("td",{className:"px-4 py-2.5 font-medium",children:a.name}),Za("td",{className:"px-4 py-2.5 text-right tabular-nums",children:Ne(a.amount)}),Za("td",{className:"px-4 py-2.5 text-right",children:a.growth!==void 0?Dm("span",{className:l("inline-flex items-center gap-0.5 text-xs font-medium tabular-nums",r?"text-emerald-600":"text-destructive"),children:[Za(o,{className:"size-3"}),bt(a.growth)]}):Za("span",{className:"text-xs text-muted-foreground",children:"\u2014"})})]},a.id)})})]}),e.length===0&&Za("p",{className:"py-6 text-center text-sm text-muted-foreground",children:"\u6682\u65E0\u6392\u540D\u6570\u636E"})]})}import{jsx as Ft,jsxs as ws}from"react/jsx-runtime";function Qte({pools:e,className:t}){let a=e.reduce((n,i)=>n+i.total,0),r=e.reduce((n,i)=>n+i.used,0),o=e.reduce((n,i)=>n+i.available,0);return ws("section",{"data-slot":"pool-tracker-table",className:l("flex flex-col gap-3",t),"aria-labelledby":"pool-tracker-table-title",children:[ws("h3",{id:"pool-tracker-table-title",className:"flex items-center gap-1.5 text-sm font-medium",children:[Ft(iy,{className:"size-4 text-primary","aria-hidden":"true"}),Ft("span",{children:"\u8D44\u91D1\u6C60\u8DDF\u8E2A"})]}),Ft("div",{className:"overflow-x-auto rounded-md border",children:ws("table",{className:"w-full text-sm",children:[ws("caption",{className:"sr-only",children:["\u8D44\u91D1\u6C60\u4F7F\u7528\u60C5\u51B5\uFF0C\u5408\u8BA1\u603B\u989D ",q(a)]}),Ft("thead",{className:"bg-muted/50",children:ws("tr",{children:[Ft("th",{scope:"col",className:"px-3 py-2 text-left font-medium",children:"\u8D44\u91D1\u6C60"}),Ft("th",{scope:"col",className:"px-3 py-2 text-right font-medium",children:"\u603B\u989D"}),Ft("th",{scope:"col",className:"px-3 py-2 text-right font-medium",children:"\u5DF2\u7528"}),Ft("th",{scope:"col",className:"px-3 py-2 text-right font-medium",children:"\u53EF\u7528"}),Ft("th",{scope:"col",className:"px-3 py-2 text-left font-medium",children:"\u4F7F\u7528\u7387"})]})}),ws("tbody",{children:[e.map(n=>{let i=n.total>0?Math.min(100,n.used/n.total*100):0,c=i>=80;return ws("tr",{className:"border-t",children:[Ft("td",{className:"px-3 py-2 font-medium",children:n.name}),Ft("td",{className:"px-3 py-2 text-right tabular-nums",children:q(n.total)}),Ft("td",{className:"px-3 py-2 text-right tabular-nums",children:q(n.used)}),Ft("td",{className:"px-3 py-2 text-right tabular-nums",children:q(n.available)}),Ft("td",{className:"px-3 py-2",children:ws("div",{className:"flex items-center gap-2",children:[Ft("div",{className:"h-2 flex-1 overflow-hidden rounded bg-muted",role:"progressbar","aria-valuenow":Math.round(i),"aria-valuemin":0,"aria-valuemax":100,"aria-label":`${n.name} \u4F7F\u7528\u7387`,children:Ft("div",{className:l("h-full rounded",c?"bg-destructive":"bg-primary"),style:{width:`${i}%`}})}),ws("span",{className:l("w-10 shrink-0 text-right tabular-nums",c?"text-destructive":"text-muted-foreground"),children:[Math.round(i),"%"]})]})})]},n.id)}),e.length===0?Ft("tr",{children:Ft("td",{colSpan:5,className:"px-3 py-6 text-center text-muted-foreground",children:"\u6682\u65E0\u8D44\u91D1\u6C60"})}):null]}),e.length>0?Ft("tfoot",{className:"border-t bg-muted/30 font-medium",children:ws("tr",{children:[Ft("td",{className:"px-3 py-2",children:"\u5408\u8BA1"}),Ft("td",{className:"px-3 py-2 text-right tabular-nums",children:q(a)}),Ft("td",{className:"px-3 py-2 text-right tabular-nums",children:q(r)}),Ft("td",{className:"px-3 py-2 text-right tabular-nums",children:q(o)}),Ft("td",{className:"px-3 py-2"})]})}):null]})})]})}import*as mb from"react";import{jsx as bC,jsxs as hS}from"react/jsx-runtime";function tae({taskType:e,params:t,onComplete:a,children:r,className:o}){let[n,i]=mb.useState(!1),c=mb.useCallback(()=>{i(!0),Promise.resolve(a?.({taskType:e,params:t})).finally(()=>i(!1))},[e,t,a]);return bC("div",{"data-slot":"async-task-trigger",className:l("inline-flex items-center gap-2",o),children:hS(C,{onClick:c,disabled:n,children:[bC(ia,{className:l("size-4",n&&"animate-spin")}),r??"\u6267\u884C\u4EFB\u52A1"]})})}import"react";import{jsx as Kn,jsxs as ub}from"react/jsx-runtime";var yS={running:Kn(Pr,{className:"size-4 animate-spin text-primary"}),success:Kn(qe,{className:"size-4 text-emerald-500"}),done:Kn(qe,{className:"size-4 text-emerald-500"}),failed:Kn(rn,{className:"size-4 text-destructive"}),error:Kn(rn,{className:"size-4 text-destructive"}),pending:Kn(pe,{className:"size-4 text-muted-foreground"})};function NS(e){let t=e.toLowerCase();return t==="success"||t==="done"||t==="failed"||t==="error"}function iae({percent:e,status:t,message:a,className:r}){let o=Math.max(0,Math.min(100,e)),n=yS[t.toLowerCase()],i=NS(t);return ub("div",{"data-slot":"task-progress",className:l("flex flex-col gap-1.5",r),role:"status","aria-live":"polite",children:[ub("div",{className:"flex items-center justify-between gap-2 text-sm",children:[ub("span",{className:"flex items-center gap-1.5 font-medium",children:[n??Kn(pe,{className:"size-4 text-muted-foreground"}),Kn("span",{children:t})]}),ub("span",{className:"tabular-nums text-muted-foreground",children:[o.toFixed(0),"%"]})]}),Kn("div",{className:"relative h-2 w-full overflow-hidden rounded-full bg-muted",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":o,"aria-label":`\u4EFB\u52A1\u8FDB\u5EA6 ${o.toFixed(0)}%`,children:Kn("div",{className:l("h-full rounded-full transition-all",i&&t.toLowerCase()!=="success"&&t.toLowerCase()!=="done"?"bg-destructive":"bg-primary"),style:{width:`${o}%`}})}),a?Kn("p",{className:"text-xs text-muted-foreground",children:a}):null]})}import{jsx as $r,jsxs as pb}from"react/jsx-runtime";function uae({tasks:e,className:t}){return $r("div",{"data-slot":"task-history",className:l("overflow-x-auto rounded-lg ring-1 ring-border",t),children:pb("table",{className:"w-full text-sm",children:[$r("thead",{className:"bg-muted/50 text-muted-foreground",children:pb("tr",{children:[$r("th",{scope:"col",className:"px-3 py-2 text-left font-medium",children:"\u4EFB\u52A1ID"}),$r("th",{scope:"col",className:"px-3 py-2 text-left font-medium",children:"\u7C7B\u578B"}),$r("th",{scope:"col",className:"px-3 py-2 text-left font-medium",children:"\u72B6\u6001"}),$r("th",{scope:"col",className:"px-3 py-2 text-left font-medium",children:"\u5F00\u59CB\u65F6\u95F4"}),$r("th",{scope:"col",className:"px-3 py-2 text-left font-medium",children:"\u7ED3\u675F\u65F6\u95F4"})]})}),pb("tbody",{className:"divide-y divide-border",children:[e.map(a=>pb("tr",{className:"hover:bg-muted/30",children:[$r("td",{className:"px-3 py-2 tabular-nums",children:a.id}),$r("td",{className:"px-3 py-2",children:a.type}),$r("td",{className:"px-3 py-2",children:$r("span",{className:"rounded bg-muted px-1.5 py-0.5 text-xs",children:a.status})}),$r("td",{className:"px-3 py-2 text-muted-foreground tabular-nums",children:ni(a.startTime)}),$r("td",{className:"px-3 py-2 text-muted-foreground tabular-nums",children:a.endTime?ni(a.endTime):"\u2014"})]},a.id)),e.length===0?$r("tr",{children:$r("td",{colSpan:5,className:"px-3 py-6 text-center text-muted-foreground",children:"\u6682\u65E0\u5386\u53F2\u4EFB\u52A1"})}):null]})]})})}import*as Ts from"react";import{jsx as hn,jsxs as Ps}from"react/jsx-runtime";function xae({steps:e,open:t,onClose:a,className:r}){let[o,n]=Ts.useState(0),i=Ts.useRef(null);Ts.useEffect(()=>{t&&n(0)},[t]),Ts.useEffect(()=>{t&&i.current&&i.current.focus()},[t,o]);let c=e.length===0?0:Math.min(o,e.length-1),s=e[c],d=c===e.length-1,m=Ts.useCallback(()=>{n(f=>Math.min(f+1,e.length-1))},[e.length]),u=Ts.useCallback(()=>{n(f=>Math.max(f-1,0))},[]),p=f=>{if(f.key==="Escape"){f.preventDefault(),a?.();return}if(f.key==="ArrowRight"&&!d){f.preventDefault(),m();return}f.key==="ArrowLeft"&&c>0&&(f.preventDefault(),u())};return!t||e.length===0||!s?null:hn("div",{"data-slot":"feature-tour",className:l("fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4 supports-backdrop-filter:backdrop-blur-xs",r),role:"dialog","aria-modal":"true","aria-label":"\u529F\u80FD\u5F15\u5BFC",onClick:a,children:Ps("div",{ref:i,tabIndex:-1,role:"document",onClick:f=>f.stopPropagation(),onKeyDown:p,className:"w-full max-w-md rounded-xl bg-popover p-5 text-sm text-popover-foreground ring-1 ring-foreground/10 outline-none",children:[Ps("div",{className:"flex items-start justify-between gap-3",children:[Ps("div",{className:"flex items-center gap-2",children:[hn(Gh,{className:"size-5 text-primary"}),hn("h2",{className:"font-heading text-base font-medium",children:s.title})]}),hn("button",{type:"button","aria-label":"\u5173\u95ED\u5F15\u5BFC",onClick:a,className:"rounded-md p-1 text-muted-foreground hover:bg-muted hover:text-foreground",children:hn(Q,{className:"size-4"})})]}),hn("p",{className:"mt-3 text-muted-foreground",children:s.content}),Ps("p",{className:"mt-3 text-xs text-muted-foreground",children:["\u76EE\u6807\uFF1A",hn("code",{className:"rounded bg-muted px-1 py-0.5",children:s.target})]}),Ps("div",{className:"mt-5 flex items-center justify-between",children:[Ps("span",{className:"text-xs text-muted-foreground tabular-nums",children:["\u7B2C ",c+1," / ",e.length," \u6B65"]}),Ps("div",{className:"flex items-center gap-2",children:[Ps("button",{type:"button",onClick:u,disabled:c===0,className:"inline-flex h-8 items-center gap-1 rounded-lg px-2.5 text-sm font-medium hover:bg-muted disabled:pointer-events-none disabled:opacity-50",children:[hn(et,{className:"size-4"}),"\u4E0A\u4E00\u6B65"]}),d?Ps("button",{type:"button",onClick:a,className:"inline-flex h-8 items-center gap-1 rounded-lg bg-primary px-2.5 text-sm font-medium text-primary-foreground hover:bg-primary/80",children:[hn(U,{className:"size-4"}),"\u5B8C\u6210"]}):Ps("button",{type:"button",onClick:m,className:"inline-flex h-8 items-center gap-1 rounded-lg bg-primary px-2.5 text-sm font-medium text-primary-foreground hover:bg-primary/80",children:["\u4E0B\u4E00\u6B65",hn(me,{className:"size-4"})]})]})]}),hn("div",{className:"mt-4 flex items-center justify-center gap-1.5","aria-hidden":"true",children:e.map((f,x)=>hn("span",{className:l("h-1.5 rounded-full transition-all",x===c?"w-4 bg-primary":"w-1.5 bg-muted")},f.target+x))})]})})}import*as Mm from"react";import{jsx as yt,jsxs as _l}from"react/jsx-runtime";function gb({icon:e,label:t,description:a,checked:r,onChange:o}){return _l("li",{className:"flex items-center gap-3 py-3",children:[yt("span",{className:"flex size-8 items-center justify-center rounded-md bg-muted text-muted-foreground",children:e}),_l("div",{className:"min-w-0 flex-1",children:[yt("p",{className:"text-sm font-medium",children:t}),yt("p",{className:"truncate text-xs text-muted-foreground",children:a})]}),yt($n,{checked:r,onCheckedChange:o,"aria-label":`${t} \u5F00\u5173`})]})}function kae({open:e,onOpenChange:t,className:a}){let[r,o]=Mm.useState("system"),[n,i]=Mm.useState(!0),[c,s]=Mm.useState(!0),[d,m]=Mm.useState(!1),[u,p]=Mm.useState(!0),f={light:"\u6D45\u8272",dark:"\u6DF1\u8272",system:"\u8DDF\u968F\u7CFB\u7EDF"},x=()=>{o(v=>v==="light"?"dark":v==="dark"?"system":"light")};return yt(ud,{"data-slot":"preference-panel",open:e,onOpenChange:t,children:_l(pd,{side:"right",className:l("w-full sm:max-w-sm",a),children:[_l(gd,{children:[yt(fd,{children:"\u504F\u597D\u8BBE\u7F6E"}),yt(pu,{children:"\u8C03\u6574\u754C\u9762\u4E3B\u9898\u3001\u901A\u77E5\u4E0E\u663E\u793A\u504F\u597D\u3002"})]}),_l("div",{className:"flex items-center justify-between px-1 py-3",children:[_l("div",{className:"flex items-center gap-3",children:[yt("span",{className:"flex size-8 items-center justify-center rounded-md bg-muted text-muted-foreground",children:r==="light"?yt(ru,{}):r==="dark"?yt(au,{}):yt(tu,{})}),_l("div",{children:[yt("p",{className:"text-sm font-medium",children:"\u4E3B\u9898\u6A21\u5F0F"}),yt("p",{className:"text-xs text-muted-foreground",children:f[r]})]})]}),yt(C,{type:"button",variant:"outline",size:"sm",onClick:x,children:"\u5207\u6362"})]}),yt(Ue,{}),_l("ul",{className:"flex flex-col px-1",role:"list",children:[yt(gb,{icon:yt(xo,{}),label:"\u8D26\u5355\u5230\u671F\u63D0\u9192",description:"\u8D26\u5355\u5373\u5C06\u5230\u671F\u65F6\u63A8\u9001\u901A\u77E5",checked:n,onChange:i}),yt(gb,{icon:yt(xo,{}),label:"\u5BA1\u6279\u7ED3\u679C\u901A\u77E5",description:"\u5BA1\u6279\u901A\u8FC7 / \u9A73\u56DE\u65F6\u901A\u77E5",checked:c,onChange:s}),yt(gb,{icon:yt(tu,{}),label:"\u7D27\u51D1\u6A21\u5F0F",description:"\u538B\u7F29\u8868\u683C\u884C\u9AD8\u4EE5\u663E\u793A\u66F4\u591A\u6570\u636E",checked:d,onChange:m}),yt(gb,{icon:yt(ug,{}),label:"\u81EA\u52A8\u4FDD\u5B58\u8349\u7A3F",description:"\u7F16\u8F91\u8868\u5355\u65F6\u81EA\u52A8\u4FDD\u5B58\u8349\u7A3F",checked:u,onChange:p})]}),yt("div",{className:"mt-auto flex items-center justify-end gap-2 border-t pt-4",children:yt(Hx,{render:yt(C,{type:"button",variant:"outline",children:"\u5173\u95ED"})})})]})})}import"react";import{jsx as bp,jsxs as wS}from"react/jsx-runtime";var CS={left:"flex-row",right:"flex-row-reverse",bottom:"flex-col"},kS={left:"w-64",right:"w-64",bottom:"h-48"};function Dae({side:e,collapsed:t=!1,onToggle:a,children:r,className:o}){let n=e==="bottom",i=e==="left"?et:e==="right"?me:Zi,c=t?`\u5C55\u5F00${e==="bottom"?"\u4E0B\u65B9":"\u4FA7\u680F"}\u9762\u677F`:`\u6298\u53E0${e==="bottom"?"\u4E0B\u65B9":"\u4FA7\u680F"}\u9762\u677F`;return wS("div",{"data-slot":"dock-panel",className:l("flex items-stretch",CS[e],o),children:[bp("div",{className:l("flex shrink-0 items-center justify-center border-muted bg-card",n?"h-8 w-full border-t":"w-8 flex-col border-r"),children:bp(C,{type:"button",variant:"ghost",size:"icon-sm","aria-label":c,onClick:a,children:bp(i,{className:l("size-4 transition-transform",t&&"rotate-180")})})}),bp("div",{className:l("overflow-hidden border-muted bg-card transition-all",n?"border-t":"border-l",kS[e],t?n?"h-0":"w-0":""),role:"region","aria-label":"\u505C\u9760\u9762\u677F\u5185\u5BB9","aria-hidden":t,children:bp("div",{className:l("h-full overflow-auto p-3",n?"":"w-64"),children:t?null:r})})]})}import"react";import{jsx as Qv,jsxs as PS}from"react/jsx-runtime";function Eae({id:e,label:t,pinned:a=!1,onPin:r,className:o}){let n=()=>r?.(e),i=c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),r?.(e))};return PS("div",{"data-slot":"tab-pin",className:l("inline-flex items-center gap-1.5 rounded-md border bg-card px-2 py-1 text-sm",a&&"border-primary bg-primary/5 text-primary",o),children:[Qv("span",{className:"max-w-[10rem] truncate",title:t,children:t}),Qv("button",{type:"button",onClick:n,onKeyDown:i,"aria-pressed":a,"aria-label":a?`\u53D6\u6D88\u56FA\u5B9A ${t}`:`\u56FA\u5B9A ${t}`,className:l("inline-flex size-5 items-center justify-center rounded outline-none transition-colors focus-visible:ring-3 focus-visible:ring-ring/50",a?"text-primary hover:bg-primary/10":"text-muted-foreground hover:bg-muted hover:text-foreground"),children:Qv(xg,{className:l("size-3.5",a&&"fill-current")})})]})}import*as Xv from"react";import{jsx as yn,jsxs as fb}from"react/jsx-runtime";function Oae({sidebar:e,header:t,children:a,detailPanel:r,className:o}){let[n,i]=Xv.useState(!0),[c,s]=Xv.useState(!0);return fb("div",{"data-slot":"chat-shell",className:l("flex h-full w-full overflow-hidden bg-background",o),children:[e?yn("aside",{"data-slot":"chat-shell-sidebar","aria-label":"Conversations",className:l("flex shrink-0 flex-col border-r border-border transition-[width] duration-200",n?"w-64":"w-0"),children:yn("div",{className:l("h-full overflow-hidden",!n&&"hidden"),children:e})}):null,fb("div",{className:"flex min-w-0 flex-1 flex-col",children:[fb("div",{"data-slot":"chat-shell-topbar",className:"flex h-12 shrink-0 items-center gap-1 border-b border-border px-2",children:[e?yn("button",{type:"button","aria-label":n?"Collapse sidebar":"Expand sidebar","aria-expanded":n,onClick:()=>i(d=>!d),className:"inline-flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted",children:n?yn(et,{className:"size-4","aria-hidden":!0}):yn(me,{className:"size-4","aria-hidden":!0})}):null,yn("div",{className:"min-w-0 flex-1",children:t}),r?yn("button",{type:"button","aria-label":c?"Hide detail panel":"Show detail panel","aria-expanded":c,onClick:()=>s(d=>!d),className:"inline-flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted",children:c?yn(me,{className:"size-4","aria-hidden":!0}):yn(et,{className:"size-4","aria-hidden":!0})}):null]}),fb("div",{className:"flex min-h-0 flex-1",children:[yn("main",{"data-slot":"chat-shell-main",className:"min-w-0 flex-1 overflow-y-auto",children:a}),r?yn("aside",{"data-slot":"chat-shell-detail","aria-label":"Details",className:l("shrink-0 overflow-y-auto border-l border-border transition-[width] duration-200",c?"w-80":"w-0"),children:yn("div",{className:l("h-full",!c&&"hidden"),children:r})}):null]})]})]})}import*as xC from"react";import{jsx as Wo,jsxs as ql}from"react/jsx-runtime";function Qae({conversations:e,activeId:t,onSelect:a,className:r}){let o=xC.useCallback(n=>i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),a?.(n))},[a]);return ql("div",{"data-slot":"chat-sidebar",className:l("flex h-full flex-col bg-background",r),children:[ql("div",{className:"flex items-center gap-2 border-b border-border p-2",children:[ql(C,{type:"button",variant:"default",size:"sm",className:"flex-1",children:[Wo(ge,{className:"size-4","aria-hidden":!0}),"New chat"]}),Wo(C,{type:"button",variant:"outline",size:"icon-sm","aria-label":"Search conversations",children:Wo(X,{className:"size-4","aria-hidden":!0})})]}),Wo("nav",{className:"min-h-0 flex-1 overflow-y-auto","aria-label":"Conversation list",children:e.length===0?Wo("p",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"No conversations yet"}):Wo("ul",{role:"list",className:"flex flex-col gap-0.5 p-1",children:e.map(n=>{let i=n.id===t;return Wo("li",{children:ql("button",{type:"button",onClick:()=>a?.(n.id),onKeyDown:o(n.id),"aria-current":i?"true":void 0,className:l("flex w-full items-center gap-2 rounded-md px-2 py-2 text-left text-sm transition-colors",i?"bg-muted text-foreground":"hover:bg-muted/60"),children:[Wo("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-full bg-muted text-xs font-medium","aria-hidden":!0,children:sn(n.title)}),ql("span",{className:"flex min-w-0 flex-1 flex-col",children:[ql("span",{className:"flex items-center justify-between gap-1",children:[Wo("span",{className:"truncate font-medium",children:n.title}),n.time?Wo("span",{className:"shrink-0 text-[0.65rem] text-muted-foreground",children:n.time}):null]}),n.lastMessage?Wo("span",{className:"truncate text-xs text-muted-foreground",children:n.lastMessage}):null]}),n.unread&&n.unread>0?Wo(B,{variant:"default",className:"shrink-0","aria-label":`${n.unread} unread`,children:n.unread}):null]})},n.id)})})}),ql("div",{className:"flex items-center gap-2 border-t border-border p-2 text-xs text-muted-foreground",children:[Wo(el,{className:"size-3.5","aria-hidden":!0}),ql("span",{children:[e.length," conversations"]})]})]})}import"react";import{Fragment as TS,jsx as Rs,jsxs as Yv}from"react/jsx-runtime";function are({title:e,subtitle:t,status:a,actions:r,className:o}){return Yv("header",{"data-slot":"chat-header",className:l("flex h-full w-full items-center gap-2 px-2",o),children:[Yv("div",{className:"flex min-w-0 flex-1 flex-col",children:[Rs("h2",{className:"truncate text-sm font-semibold",title:e,children:e}),t?Rs("p",{className:"truncate text-xs text-muted-foreground",title:t,children:t}):null]}),a?Rs("span",{className:"shrink-0 rounded-full bg-muted px-2 py-0.5 text-xs text-muted-foreground","aria-label":`Status: ${a}`,children:a}):null,Rs("div",{className:"flex shrink-0 items-center gap-1",children:r??Yv(TS,{children:[Rs(C,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Refresh conversation",children:Rs(ia,{className:"size-4","aria-hidden":!0})}),Rs(C,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Conversation settings",children:Rs(Gs,{className:"size-4","aria-hidden":!0})}),Rs(C,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"More options",children:Rs(sy,{className:"size-4","aria-hidden":!0})})]})})]})}import"react";import{Fragment as RS,jsx as ec,jsxs as bb}from"react/jsx-runtime";function dre({sender:e,avatar:t,messages:a,className:r}){let o=[...a].reverse().find(n=>n.time!==void 0);return bb("div",{"data-slot":"chat-message-group",className:l("flex gap-2",r),"aria-label":`Messages from ${e}`,children:[ec(Tr,{size:"sm",className:"mt-0.5",children:t??bb(RS,{children:[ec(nn,{alt:e}),ec(Rr,{children:sn(e)})]})}),bb("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[bb("div",{className:"flex items-baseline gap-1.5",children:[ec("span",{className:"text-xs font-semibold text-foreground",children:e}),o?.time?ec("span",{className:"text-[0.65rem] text-muted-foreground tabular-nums",children:o.time}):null]}),ec("ul",{role:"list",className:"flex flex-col gap-1",children:a.map(n=>ec("li",{className:"w-fit max-w-full whitespace-pre-wrap break-words rounded-2xl rounded-tl-sm bg-muted px-3 py-2 text-sm",children:n.content},n.id))})]})]})}import"react";import{jsx as xb}from"react/jsx-runtime";function bre({onReply:e,onCopy:t,onDelete:a,onRegenerate:r,className:o}){let n=[e&&{label:"Reply",Icon:lg,handler:e},t&&{label:"Copy",Icon:zt,handler:t},r&&{label:"Regenerate",Icon:ia,handler:r},a&&{label:"Delete",Icon:ye,handler:a}].filter(Boolean);return n.length===0?xb("div",{"data-slot":"chat-message-actions",className:l("hidden",o),"aria-hidden":!0}):xb("div",{"data-slot":"chat-message-actions",role:"toolbar","aria-label":"Message actions",className:l("flex items-center gap-0.5",o),children:n.map(({label:i,Icon:c,handler:s})=>xb(C,{type:"button",variant:"ghost",size:"icon-sm",onClick:s,"aria-label":i,children:xb(c,{className:"size-4","aria-hidden":!0})},i))})}import*as hC from"react";import{jsx as Bm,jsxs as vC}from"react/jsx-runtime";function SS(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function Nre({content:e,duration:t,collapsed:a=!1,className:r}){let[o,n]=hC.useState(!a);return vC("div",{"data-slot":"chat-thinking-block",className:l("rounded-lg border border-border bg-muted/30",r),children:[vC("button",{type:"button",onClick:()=>n(i=>!i),"aria-expanded":o,className:"flex w-full items-center gap-1.5 px-3 py-2 text-xs font-medium text-muted-foreground hover:bg-muted/50",children:[Bm(me,{className:l("size-3.5 transition-transform",o&&"rotate-90"),"aria-hidden":!0}),Bm(Mg,{className:"size-3.5 text-purple-500","aria-hidden":!0}),Bm("span",{children:"Thought process"}),t!==void 0?Bm("span",{className:"ml-auto tabular-nums",children:SS(t)}):null]}),o?Bm("div",{className:"border-t border-border px-3 py-2",children:Bm("p",{className:"whitespace-pre-wrap break-words text-xs leading-relaxed text-muted-foreground",children:e})}):null]})}import*as NC from"react";import{jsx as Qn,jsxs as xp}from"react/jsx-runtime";function yC(e){try{return e===void 0?"":typeof e=="string"?e:JSON.stringify(e,null,2)}catch{return String(e)}}function Tre({toolName:e,toolInput:t,toolOutput:a,status:r,className:o}){let[n,i]=NC.useState(!1),c=t!==void 0?yC(t):"",s=a!==void 0?yC(a):"",d={calling:{Icon:Pr,label:"Calling",color:"text-blue-600 dark:text-blue-400",spin:!0},success:{Icon:qe,label:"Success",color:"text-green-600 dark:text-green-400",spin:!1},error:{Icon:rn,label:"Error",color:"text-red-600 dark:text-red-400",spin:!1}}[r],{Icon:m,label:u,color:p,spin:f}=d,x=c!==""||s!=="";return xp("div",{"data-slot":"chat-tool-call-block",className:l("rounded-lg border border-border bg-muted/30",o),children:[xp("button",{type:"button",onClick:()=>x&&i(v=>!v),"aria-expanded":n,disabled:!x,className:"flex w-full items-center gap-1.5 px-3 py-2 text-xs hover:bg-muted/50 disabled:cursor-default",children:[x?Qn(me,{className:l("size-3.5 transition-transform",n&&"rotate-90"),"aria-hidden":!0}):Qn("span",{className:"size-3.5","aria-hidden":!0}),Qn(m,{className:l("size-3.5",f&&"animate-spin",p),"aria-hidden":!0}),Qn("span",{className:"font-mono font-medium text-foreground",children:e}),Qn("span",{className:l("ml-auto",p),children:u})]}),n&&x?xp("div",{className:"border-t border-border px-3 py-2",children:[c?xp("div",{className:"mb-2",children:[Qn("p",{className:"mb-1 text-[0.65rem] font-medium uppercase tracking-wide text-muted-foreground",children:"Input"}),Qn("pre",{className:"overflow-x-auto rounded bg-muted p-2 font-mono text-[0.7rem] leading-relaxed",children:Qn("code",{children:c})})]}):null,s?xp("div",{children:[Qn("p",{className:"mb-1 text-[0.65rem] font-medium uppercase tracking-wide text-muted-foreground",children:"Output"}),Qn("pre",{className:"overflow-x-auto rounded bg-muted p-2 font-mono text-[0.7rem] leading-relaxed",children:Qn("code",{children:s})})]}):null]}):null]})}import*as vp from"react";import{Fragment as IS,jsx as Gl,jsxs as vb}from"react/jsx-runtime";function Bre({code:e,language:t,filename:a,className:r}){let[o,n]=vp.useState(!1),i=vp.useCallback(()=>{navigator.clipboard?.writeText(e).then(()=>{n(!0),window.setTimeout(()=>n(!1),1500)})},[e]),c=vp.useCallback(s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),i())},[i]);return vb("div",{"data-slot":"chat-code-block",className:l("overflow-hidden rounded-lg border border-border bg-muted/40",r),children:[vb("div",{className:"flex items-center justify-between gap-2 border-b border-border bg-muted/60 px-3 py-1.5",children:[Gl("div",{className:"flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground",children:a?vb(IS,{children:[Gl(Rt,{className:"size-3.5 shrink-0","aria-hidden":!0}),Gl("span",{className:"truncate font-medium text-foreground",children:a})]}):Gl("span",{className:"uppercase tracking-wide",children:t??"text"})}),vb(C,{type:"button",variant:"ghost",size:"xs",onClick:i,onKeyDown:c,"aria-label":"Copy code",children:[o?Gl(U,{className:"size-3.5","aria-hidden":!0}):Gl(zt,{className:"size-3.5","aria-hidden":!0}),o?"Copied":"Copy"]})]}),Gl("pre",{className:"overflow-x-auto p-3 text-xs leading-relaxed",children:Gl("code",{className:"font-mono",children:e})})]})}import"react";import{jsx as wa}from"react/jsx-runtime";function DS(e){let t=e.split(/\r?\n/),a=[],r=n=>t[n]??"",o=0;for(;o<t.length;){let n=r(o);if(!n.trim()){o+=1;continue}if(n.startsWith("### "))a.push({type:"h3",text:n.slice(4)}),o+=1;else if(n.startsWith("## "))a.push({type:"h2",text:n.slice(3)}),o+=1;else if(n.startsWith("# "))a.push({type:"h1",text:n.slice(2)}),o+=1;else if(n.startsWith("> ")){let i=[n.slice(2)];for(o+=1;o<t.length&&r(o).startsWith("> ");)i.push(r(o).slice(2)),o+=1;a.push({type:"quote",text:i.join(`
|
|
18
|
+
`)})}else if(n.startsWith("```")){let i=n.slice(3).trim();o+=1;let c=[];for(;o<t.length&&!r(o).startsWith("```");)c.push(r(o)),o+=1;o+=1,a.push({type:"code",text:i?`${i}
|
|
19
|
+
${c.join(`
|
|
20
|
+
`)}`:c.join(`
|
|
21
|
+
`)})}else if(/^\s*[-*]\s+/.test(n)){let i=[];for(;o<t.length&&/^\s*[-*]\s+/.test(r(o));)i.push(r(o).replace(/^\s*[-*]\s+/,"")),o+=1;a.push({type:"ul",text:i.join(`
|
|
22
|
+
`)})}else if(/^\s*\d+\.\s+/.test(n)){let i=[];for(;o<t.length&&/^\s*\d+\.\s+/.test(r(o));)i.push(r(o).replace(/^\s*\d+\.\s+/,"")),o+=1;a.push({type:"ol",text:i.join(`
|
|
23
|
+
`)})}else a.push({type:"p",text:n}),o+=1}return a}function tc(e){let t=[],a=/(\*\*([^*]+)\*\*|\*([^*]+)\*|`([^`]+)`|\[([^\]]+)\]\(([^)]+)\))/g,r=0,o=0,n;for(;(n=a.exec(e))!==null;)n.index>r&&t.push(e.slice(r,n.index)),n[2]!==void 0?t.push(wa("strong",{children:n[2]},o++)):n[3]!==void 0?t.push(wa("em",{children:n[3]},o++)):n[4]!==void 0?t.push(wa("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-[0.85em]",children:n[4]},o++)):n[5]!==void 0&&n[6]!==void 0&&t.push(wa("a",{href:n[6],target:"_blank",rel:"noopener noreferrer",className:"text-primary underline underline-offset-2",children:n[5]},o++)),r=a.lastIndex;return r<e.length&&t.push(e.slice(r)),t.length?t:e}function MS({content:e,className:t}){let a=DS(e);return a.length===0?wa("p",{className:"text-sm",children:e}):wa("div",{className:l("flex flex-col gap-2 text-sm leading-relaxed",t),children:a.map((r,o)=>{switch(r.type){case"h1":return wa("h1",{className:"text-lg font-semibold",children:tc(r.text)},o);case"h2":return wa("h2",{className:"text-base font-semibold",children:tc(r.text)},o);case"h3":return wa("h3",{className:"text-sm font-semibold",children:tc(r.text)},o);case"quote":return wa("blockquote",{className:"border-l-2 border-border pl-3 text-muted-foreground",children:tc(r.text)},o);case"code":return wa("pre",{className:"overflow-x-auto rounded-md bg-muted p-2 font-mono text-xs",children:wa("code",{children:r.text})},o);case"ul":return wa("ul",{className:"list-disc pl-5",children:r.text.split(`
|
|
24
|
+
`).map((n,i)=>wa("li",{children:tc(n)},i))},o);case"ol":return wa("ol",{className:"list-decimal pl-5",children:r.text.split(`
|
|
25
|
+
`).map((n,i)=>wa("li",{children:tc(n)},i))},o);default:return wa("p",{children:tc(r.text)},o)}})})}function hb({content:e,className:t}){return wa("div",{"data-slot":"chat-markdown-renderer",className:t,children:wa(MS,{content:e})})}import*as oa from"react";import{useEditor as BS,EditorContent as LS}from"@tiptap/react";import zS from"@tiptap/starter-kit";import AS from"@tiptap/extension-link";import ES from"@tiptap/extension-image";import FS from"@tiptap/extension-placeholder";import{Fragment as qS,jsx as _,jsxs as Dt}from"react/jsx-runtime";function $S({value:e="",onChange:t,placeholder:a="\u5F00\u59CB\u8F93\u5165...",editable:r=!0,showToolbar:o=!0,minHeight:n=200,onUpload:i,className:c,...s}){let d=BS({extensions:[zS.configure({codeBlock:{HTMLAttributes:{class:"language-*"}}}),AS.configure({openOnClick:!1,HTMLAttributes:{class:"text-primary underline"}}),ES.configure({inline:!1,allowBase64:!0}),FS.configure({placeholder:a})],content:e,editable:r,onUpdate:({editor:u})=>t?.(u.getHTML()),editorProps:{attributes:{style:`min-height: ${n}px`}},immediatelyRender:!1});if(oa.useEffect(()=>{d&&e!==d.getHTML()&&d.commands.setContent(e)},[d,e]),!d)return _("div",{className:"rounded-md border bg-muted/30 p-4 text-sm text-muted-foreground",children:"\u52A0\u8F7D\u7F16\u8F91\u5668..."});let m=u=>new Promise(p=>{let f=new FileReader;f.onload=x=>p({url:String(x.target?.result??""),name:u.name,size:u.size}),f.readAsDataURL(u)});return Dt("div",{"data-slot":"rich-text-editor",className:l("rounded-md border bg-background",c),...s,children:[o&&r&&_(HS,{editor:d,onUpload:i??m}),_("div",{className:"prose prose-sm max-w-none cursor-text px-3 py-2 focus:outline-none [&_.ProseMirror]:min-h-full [&_.ProseMirror]:cursor-text [&_.ProseMirror]:outline-none [&_a]:text-primary [&_blockquote]:border-l-4 [&_blockquote]:border-border [&_blockquote]:pl-4 [&_blockquote]:text-muted-foreground [&_code]:rounded [&_code]:bg-muted [&_code]:px-1 [&_h1]:text-2xl [&_h1]:font-bold [&_h2]:text-xl [&_h2]:font-semibold [&_img]:rounded [&_img]:max-w-full [&_ol]:list-decimal [&_ol]:pl-6 [&_p]:my-1 [&_ul]:list-disc [&_ul]:pl-6",style:{minHeight:n},onMouseDown:u=>{d&&!d.isFocused&&(u.preventDefault(),d.commands.focus("end"))},children:_(LS,{editor:d})})]})}function HS({editor:e,onUpload:t}){let[a,r]=oa.useState(!1),[o,n]=oa.useState(!1),[i,c]=oa.useState(!1),[s,d]=oa.useState(!1),m=e.getAttributes("link").href;return Dt("div",{className:"flex flex-wrap items-center gap-0.5 border-b p-1",role:"toolbar","aria-label":"\u5BCC\u6587\u672C\u7F16\u8F91\u5DE5\u5177\u680F",children:[_(io,{onClick:()=>e.chain().focus().toggleBold().run(),active:e.isActive("bold"),icon:_(Sc,{}),title:"\u52A0\u7C97"}),_(io,{onClick:()=>e.chain().focus().toggleItalic().run(),active:e.isActive("italic"),icon:_(Ic,{}),title:"\u659C\u4F53"}),_(io,{onClick:()=>e.chain().focus().toggleStrike().run(),active:e.isActive("strike"),icon:_(gy,{}),title:"\u5220\u9664\u7EBF"}),_(io,{onClick:()=>e.chain().focus().toggleHeading({level:1}).run(),active:e.isActive("heading",{level:1}),icon:_(Ag,{}),title:"\u6807\u98981"}),_(io,{onClick:()=>e.chain().focus().toggleHeading({level:2}).run(),active:e.isActive("heading",{level:2}),icon:_(Eg,{}),title:"\u6807\u98982"}),_(io,{onClick:()=>e.chain().focus().toggleBulletList().run(),active:e.isActive("bulletList"),icon:_(wc,{}),title:"\u65E0\u5E8F\u5217\u8868"}),_(io,{onClick:()=>e.chain().focus().toggleOrderedList().run(),active:e.isActive("orderedList"),icon:_(Lg,{}),title:"\u6709\u5E8F\u5217\u8868"}),_(io,{onClick:()=>e.chain().focus().toggleBlockquote().run(),active:e.isActive("blockquote"),icon:_(zg,{}),title:"\u5F15\u7528"}),_(io,{onClick:()=>e.chain().focus().toggleCodeBlock().run(),active:e.isActive("codeBlock"),icon:_(ld,{}),title:"\u4EE3\u7801\u5757"}),Dt(He,{open:a,onOpenChange:r,children:[_(Ve,{render:_(io,{onClick:()=>r(!0),active:e.isActive("link"),icon:_(kc,{}),title:"\u94FE\u63A5"})}),_(Oe,{className:"w-80",align:"start",children:_(VS,{currentUrl:m,onApply:(u,p)=>{u?e.chain().focus().extendMarkRange("link").setLink({href:u,target:p?"_blank":null,rel:p?"noopener noreferrer":null}).run():e.chain().focus().extendMarkRange("link").unsetLink().run(),r(!1)},onRemove:()=>{e.chain().focus().extendMarkRange("link").unsetLink().run(),r(!1)}})})]}),_(io,{onClick:()=>n(!0),icon:_(ha,{}),title:"\u56FE\u7247"}),_(io,{onClick:()=>c(!0),icon:_(rl,{}),title:"\u9644\u4EF6"}),_("input",{type:"file",accept:"image/*",className:"hidden",onChange:()=>n(!0),"data-image-input":!0}),_("div",{className:"mx-1 h-4 w-px bg-muted-foreground/20"}),_(io,{onClick:()=>e.chain().focus().undo().run(),icon:_(Dc,{}),title:"\u64A4\u9500"}),_(io,{onClick:()=>e.chain().focus().redo().run(),icon:_(Mc,{}),title:"\u91CD\u505A"}),_(OS,{open:o,onOpenChange:n,onUpload:t,onInsert:async(u,p)=>{u&&e.chain().focus().setImage({src:u,alt:p}).run()},inserting:s,setInserting:d}),_(WS,{open:i,onOpenChange:c,onUpload:t,onInsert:u=>{e.chain().focus().insertContent({type:"text",text:` [${u.name}](${u.url}) `,marks:[{type:"link",attrs:{href:u.url,target:"_blank",rel:"noopener noreferrer"}}]}).run()},inserting:s,setInserting:d})]})}function VS({currentUrl:e,onApply:t,onRemove:a}){let[r,o]=oa.useState(""),[n,i]=oa.useState(!1),c=!!e,s=r===""||/^https?:\/\/|mailto:|tel:|\//.test(r);return Dt("div",{className:"space-y-3",children:[Dt("div",{className:"space-y-1.5",children:[_(ue,{htmlFor:"link-url",className:"text-xs",children:"\u94FE\u63A5\u5730\u5740"}),_(T,{id:"link-url",value:r,onChange:d=>o(d.target.value),placeholder:c?e:"https://example.com",autoFocus:!0,onKeyDown:d=>{d.key==="Enter"&&(d.preventDefault(),t(r||e||"",n))}}),!s&&_("p",{className:"text-xs text-destructive",children:"\u8BF7\u8F93\u5165\u6709\u6548\u7684 URL"})]}),Dt("label",{className:"flex items-center gap-2 text-xs",children:[_($n,{checked:n,onCheckedChange:i}),_("span",{children:"\u5728\u65B0\u7A97\u53E3\u6253\u5F00"})]}),_(Ue,{}),Dt("div",{className:"flex items-center justify-between",children:[c&&Dt(C,{variant:"ghost",size:"xs",onClick:a,children:[_(sd,{}),"\u79FB\u9664\u94FE\u63A5"]}),Dt("div",{className:"ml-auto flex gap-1",children:[c&&_(C,{variant:"ghost",size:"xs",onClick:()=>t(e??"",n),children:"\u53D6\u6D88"}),_(C,{size:"xs",disabled:!s,onClick:()=>t(r,n),children:c?"\u66F4\u65B0":"\u63D2\u5165"})]})]})]},e??"new")}function OS({open:e,onOpenChange:t,onUpload:a,onInsert:r,inserting:o,setInserting:n}){return _(Ie,{open:e,onOpenChange:t,children:e&&_(US,{onOpenChange:t,onUpload:a,onInsert:r,inserting:o,setInserting:n})})}function US({onOpenChange:e,onUpload:t,onInsert:a,inserting:r,setInserting:o}){let[n,i]=oa.useState("upload"),[c,s]=oa.useState(""),[d,m]=oa.useState(""),[u,p]=oa.useState(null),[f,x]=oa.useState(""),[v,N]=oa.useState(null),[h,b]=oa.useState(!1),g=oa.useRef(null),y=async w=>{if(!w.type.startsWith("image/")){N("\u8BF7\u9009\u62E9\u56FE\u7247\u6587\u4EF6");return}if(w.size>10*1024*1024){N("\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7 10MB");return}N(null),x(w.name),o(!0);try{let R=await t(w);p(R.url),d||m(w.name.replace(/\.[^.]+$/,""))}catch{N("\u4E0A\u4F20\u5931\u8D25")}finally{o(!1)}},k=async()=>{let w=n==="upload"?u:c;if(!w){N(n==="upload"?"\u8BF7\u5148\u4E0A\u4F20\u56FE\u7247":"\u8BF7\u8F93\u5165\u56FE\u7247 URL");return}await a(w,d),e(!1)};return Dt(De,{className:"sm:max-w-md",children:[Dt($e,{children:[_(Me,{children:"\u63D2\u5165\u56FE\u7247"}),_(Ye,{children:"\u4ECE\u672C\u5730\u4E0A\u4F20\u6216\u4F7F\u7528\u5728\u7EBF\u56FE\u7247\u94FE\u63A5"})]}),Dt("div",{className:"flex gap-1 border-b",children:[_("button",{type:"button",onClick:()=>i("upload"),className:l("border-b-2 px-3 py-1.5 text-sm transition-colors",n==="upload"?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),children:"\u4E0A\u4F20"}),_("button",{type:"button",onClick:()=>i("url"),className:l("border-b-2 px-3 py-1.5 text-sm transition-colors",n==="url"?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),children:"\u94FE\u63A5"})]}),n==="upload"?Dt("div",{className:"space-y-3",children:[Dt("div",{onDragOver:w=>{w.preventDefault(),b(!0)},onDragLeave:()=>b(!1),onDrop:w=>{w.preventDefault(),b(!1);let R=w.dataTransfer.files?.[0];R&&y(R)},onClick:()=>g.current?.click(),className:l("flex aspect-video cursor-pointer flex-col items-center justify-center gap-2 rounded-md border-2 border-dashed bg-muted/20 text-sm text-muted-foreground transition-colors",h&&"border-primary bg-primary/5 text-primary",!h&&"hover:border-primary/50"),children:[u?_("img",{src:u,alt:d,className:"max-h-full max-w-full rounded object-contain"}):Dt(qS,{children:[_(ha,{className:"size-8"}),_("span",{children:"\u70B9\u51FB\u6216\u62D6\u62FD\u56FE\u7247\u5230\u6B64\u5904"}),_("span",{className:"text-xs text-muted-foreground",children:"\u652F\u6301 PNG / JPG / GIF / WebP \xB7 \u6700\u5927 10MB"})]}),_("input",{ref:g,type:"file",accept:"image/*",className:"hidden",onChange:w=>{let R=w.target.files?.[0];R&&y(R)}})]}),f&&!u&&r&&Dt("p",{className:"text-xs text-muted-foreground",children:["\u6B63\u5728\u4E0A\u4F20 ",f,"..."]})]}):Dt("div",{className:"space-y-1.5",children:[_(ue,{htmlFor:"img-url",children:"\u56FE\u7247 URL"}),_(T,{id:"img-url",value:c,onChange:w=>s(w.target.value),placeholder:"https://example.com/image.png"}),c&&_("div",{className:"mt-2 flex aspect-video items-center justify-center overflow-hidden rounded-md border bg-muted/20",children:_("img",{src:c,alt:"preview",className:"max-h-full max-w-full object-contain"})})]}),Dt("div",{className:"space-y-1.5",children:[_(ue,{htmlFor:"img-alt",children:"\u66FF\u4EE3\u6587\u672C\uFF08Alt\uFF09"}),_(T,{id:"img-alt",value:d,onChange:w=>m(w.target.value),placeholder:"\u56FE\u7247\u63CF\u8FF0\uFF08\u7528\u4E8E\u65E0\u969C\u788D\uFF09"})]}),v&&_("p",{className:"text-xs text-destructive",children:v}),Dt(Ge,{children:[_(C,{variant:"outline",onClick:()=>e(!1),children:"\u53D6\u6D88"}),_(C,{onClick:k,disabled:r,children:r?"\u4E0A\u4F20\u4E2D...":"\u63D2\u5165"})]})]})}function WS({open:e,onOpenChange:t,onUpload:a,onInsert:r,inserting:o,setInserting:n}){return _(Ie,{open:e,onOpenChange:t,children:e&&_(_S,{onOpenChange:t,onUpload:a,onInsert:r,inserting:o,setInserting:n})})}function _S({onOpenChange:e,onUpload:t,onInsert:a,inserting:r,setInserting:o}){let[n,i]=oa.useState([]),[c,s]=oa.useState(!1),d=oa.useRef(null),m=async v=>{let N=Array.from(v);i(h=>[...h,...N.map(b=>({file:b}))]);for(let h of N){if(h.size>50*1024*1024){i(b=>b.map(g=>g.file===h?{...g,error:"\u8D85\u8FC7 50MB"}:g));continue}o(!0);try{let b=await t(h);i(g=>g.map(y=>y.file===h?{...y,url:b.url}:y))}catch{i(b=>b.map(g=>g.file===h?{...g,error:"\u4E0A\u4F20\u5931\u8D25"}:g))}finally{o(!1)}}},u=v=>{i(N=>N.filter(h=>h.file!==v))},p=()=>{n.filter(N=>N.url&&!N.error).forEach(N=>{a({url:N.url,name:N.file.name,size:N.file.size})}),e(!1)},f=n.length>0&&n.every(v=>(v.url||v.error)&&!r),x=n.filter(v=>v.url&&!v.error).length;return Dt(De,{className:"sm:max-w-lg",children:[Dt($e,{children:[_(Me,{children:"\u63D2\u5165\u9644\u4EF6"}),_(Ye,{children:"\u652F\u6301 PDF\u3001\u6587\u6863\u3001\u538B\u7F29\u5305\u7B49\u4EFB\u610F\u6587\u4EF6"})]}),Dt("div",{onDragOver:v=>{v.preventDefault(),s(!0)},onDragLeave:()=>s(!1),onDrop:v=>{v.preventDefault(),s(!1),v.dataTransfer.files?.length&&m(v.dataTransfer.files)},onClick:()=>d.current?.click(),className:l("flex cursor-pointer flex-col items-center justify-center gap-2 rounded-md border-2 border-dashed bg-muted/20 px-4 py-6 text-sm text-muted-foreground transition-colors",c&&"border-primary bg-primary/5 text-primary",!c&&"hover:border-primary/50"),children:[_(rl,{className:"size-6"}),_("span",{children:"\u70B9\u51FB\u6216\u62D6\u62FD\u6587\u4EF6\u5230\u6B64\u5904"}),_("span",{className:"text-xs",children:"\u652F\u6301\u4EFB\u610F\u7C7B\u578B \xB7 \u5355\u4E2A\u6587\u4EF6\u6700\u5927 50MB"}),_("input",{ref:d,type:"file",multiple:!0,className:"hidden",onChange:v=>{v.target.files?.length&&m(v.target.files)}})]}),n.length>0&&_("div",{className:"max-h-60 space-y-1 overflow-y-auto rounded-md border bg-muted/20 p-2",children:n.map(v=>Dt("div",{className:"flex items-center gap-2 rounded bg-background px-2 py-1.5 text-xs",children:[_(rl,{className:"size-3.5 shrink-0 text-muted-foreground"}),Dt("div",{className:"flex-1 min-w-0",children:[_("div",{className:"truncate font-medium",children:v.file.name}),_("div",{className:"text-muted-foreground",children:Yg(v.file.size)})]}),v.error?_("span",{className:"text-destructive",children:v.error}):v.url?_("a",{href:v.url,target:"_blank",rel:"noreferrer",className:"text-primary hover:underline",title:"\u9884\u89C8",children:_(Tg,{className:"size-3.5"})}):_("span",{className:"text-muted-foreground",children:"\u4E0A\u4F20\u4E2D..."}),_(C,{type:"button",variant:"ghost",size:"icon-xs",onClick:N=>{N.stopPropagation(),u(v.file)},"aria-label":"\u79FB\u9664",children:_(sd,{})})]},v.file.name+v.file.size))}),Dt(Ge,{children:[_("span",{className:"mr-auto text-xs text-muted-foreground",children:x>0?`\u5C06\u63D2\u5165 ${x} \u4E2A\u9644\u4EF6`:"\u8BF7\u6DFB\u52A0\u6587\u4EF6"}),_(C,{variant:"outline",onClick:()=>e(!1),children:"\u53D6\u6D88"}),_(C,{onClick:p,disabled:!f||x===0,children:r?"\u4E0A\u4F20\u4E2D...":"\u63D2\u5165"})]})]})}function io({onClick:e,active:t,icon:a,title:r}){return _(C,{type:"button",variant:"ghost",size:"icon-xs",onClick:e,className:l(t&&"bg-accent text-accent-foreground"),title:r,"aria-label":r,children:a})}$S.displayName="RichTextEditor";import*as Lm from"react";import{ReactFlow as GS,Background as jS,Controls as KS,Handle as CC,Position as kC,useNodesState as QS,useEdgesState as XS}from"@xyflow/react";import"@xyflow/react/dist/style.css";import{jsx as Ss,jsxs as PC}from"react/jsx-runtime";function YS({data:e}){let t=e,{name:a,title:r,avatarUrl:o,department:n}=t.orgNode;return PC("div",{className:"min-w-40 rounded-lg border bg-card p-3 text-center shadow-sm transition-shadow hover:shadow-md",children:[Ss(CC,{type:"target",position:kC.Top,className:"size-2! bg-primary!"}),o?Ss("img",{src:o,alt:a,className:"mx-auto mb-1.5 size-10 rounded-full object-cover"}):Ss("div",{className:"mx-auto mb-1.5 flex size-10 items-center justify-center rounded-full bg-muted text-sm font-medium text-muted-foreground",children:a.charAt(0)}),Ss("div",{className:"text-sm font-medium",children:a}),Ss("div",{className:"text-xs text-muted-foreground",children:r}),n&&Ss("div",{className:"mt-1 text-xs text-muted-foreground/70",children:n}),Ss(CC,{type:"source",position:kC.Bottom,className:"size-2! bg-primary!"})]})}var JS={org:YS};function wC(e,t){let a=e.map((o,n)=>({id:o.id,type:"org",position:{x:0,y:n*120},data:{orgNode:o}})),r=(t??[]).map(o=>({id:`${o.source}-${o.target}`,source:o.source,target:o.target,type:"smoothstep"}));return{nodes:a,edges:r}}function ZS({nodes:e,edges:t,onNodeClick:a,className:r,...o}){let{nodes:n,edges:i}=Lm.useMemo(()=>wC(e,t),[e,t]),[c,s,d]=QS(n),[m,u,p]=XS(i);Lm.useEffect(()=>{let{nodes:x,edges:v}=wC(e,t);s(x),u(v)},[e,t,s,u]);let f=Lm.useCallback((x,v)=>{let N=v.data.orgNode;a?.(N)},[a]);return Ss("div",{"data-slot":"org-chart",className:l("rounded-md border bg-zinc-50 dark:bg-zinc-950",r),style:{height:500},...o,children:PC(GS,{nodes:c,edges:m,nodeTypes:JS,onNodesChange:d,onEdgesChange:p,onNodeClick:f,fitView:!0,proOptions:{hideAttribution:!0},children:[Ss(jS,{gap:16,size:1}),Ss(KS,{})]})})}ZS.displayName="OrgChart";import*as _o from"react";import{Document as e2,Page as t2,pdfjs as TC}from"react-pdf";import"react-pdf/dist/Page/AnnotationLayer.css";import"react-pdf/dist/Page/TextLayer.css";import{jsx as Nt,jsxs as zm}from"react/jsx-runtime";TC.GlobalWorkerOptions.workerSrc=`//unpkg.com/pdfjs-dist@${TC.version}/build/pdf.worker.min.mjs`;function a2({src:e,title:t,onLoadSuccess:a,onError:r,initialScale:o=100,className:n,...i}){let[c,s]=_o.useState(1),[d,m]=_o.useState(o),[u,p]=_o.useState(0),[f,x]=_o.useState(!0),[v,N]=_o.useState(null),h=_o.useRef(null),b=_o.useCallback(y=>{p(y.numPages),x(!1),N(null),a?.(y)},[a]),g=_o.useCallback(y=>{x(!1),N(y.message||"PDF \u52A0\u8F7D\u5931\u8D25"),r?.(y)},[r]);return _o.useEffect(()=>{s(1),m(o),x(!0),N(null),p(0)},[e,o]),zm("div",{"data-slot":"pdf-viewer",className:l("flex h-full flex-col rounded-md border",n),...i,children:[zm("div",{className:"flex items-center justify-between border-b bg-muted/30 px-3 py-1.5",children:[zm("div",{className:"flex items-center gap-2 truncate text-sm font-medium",children:[Nt(Rt,{className:"size-4 shrink-0 text-muted-foreground"}),Nt("span",{className:"truncate",children:t??"\u6587\u6863"})]}),zm("div",{className:"flex items-center gap-0.5",children:[Nt(C,{variant:"ghost",size:"icon-xs",onClick:()=>s(y=>Math.max(1,y-1)),disabled:c<=1||f,"aria-label":"\u4E0A\u4E00\u9875",children:Nt(et,{})}),Nt("span",{className:"px-2 text-xs tabular-nums",children:u>0?`${c} / ${u}`:"\u2014"}),Nt(C,{variant:"ghost",size:"icon-xs",onClick:()=>s(y=>Math.min(u,y+1)),disabled:c>=u||f,"aria-label":"\u4E0B\u4E00\u9875",children:Nt(me,{})}),Nt("span",{className:"mx-1 h-4 w-px bg-muted-foreground/20"}),Nt(C,{variant:"ghost",size:"icon-xs",onClick:()=>m(y=>Math.max(50,y-10)),disabled:f||!!v,"aria-label":"\u7F29\u5C0F",children:Nt(by,{})}),zm("span",{className:"px-1 text-xs tabular-nums",children:[d,"%"]}),Nt(C,{variant:"ghost",size:"icon-xs",onClick:()=>m(y=>Math.min(200,y+10)),disabled:f||!!v,"aria-label":"\u653E\u5927",children:Nt(fy,{})}),Nt("span",{className:"mx-1 h-4 w-px bg-muted-foreground/20"}),Nt(C,{variant:"ghost",size:"icon-xs",onClick:()=>h.current?.requestFullscreen(),"aria-label":"\u5168\u5C4F",children:Nt(gg,{})}),Nt(C,{variant:"ghost",size:"icon-xs",onClick:()=>window.open(e,"_blank"),"aria-label":"\u5728\u65B0\u7A97\u53E3\u6253\u5F00",children:Nt(qa,{})})]})]}),Nt("div",{ref:h,className:"flex-1 overflow-auto bg-muted/30 p-4",role:"document","aria-label":t??"PDF \u6587\u6863",children:v?zm("div",{className:"flex h-full flex-col items-center justify-center gap-2 text-center text-muted-foreground",children:[Nt(jt,{className:"size-8 text-destructive"}),Nt("div",{className:"text-sm font-medium text-foreground",children:"PDF \u52A0\u8F7D\u5931\u8D25"}),Nt("div",{className:"text-xs",children:v})]}):Nt(e2,{file:e,onLoadSuccess:b,onLoadError:g,loading:Nt("div",{className:"flex h-full items-center justify-center",children:Nt("div",{className:"mx-auto aspect-[1/1.414] w-full max-w-3xl animate-pulse rounded bg-muted"})}),className:"flex justify-center",children:Nt(t2,{pageNumber:c,scale:d/100,className:"shadow-md",loading:Nt("div",{className:"mx-auto aspect-[1/1.414] w-full max-w-3xl animate-pulse rounded bg-muted"})})})})]})}a2.displayName="PDFViewer";import*as Hr from"react";import{HexColorPicker as r2}from"react-colorful";import{jsx as xt,jsxs as Ea}from"react/jsx-runtime";var o2=["#ef4444","#f97316","#eab308","#22c55e","#14b8a6","#3b82f6","#6366f1","#a855f7","#ec4899","#6b7280","#000000","#ffffff"],RC="chaos-ui-color-history",n2=12;function s2(e){let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null}function i2(e,t,a){let r=o=>Math.max(0,Math.min(255,Math.round(o))).toString(16).padStart(2,"0");return`#${r(e)}${r(t)}${r(a)}`}function l2(e,t,a){e/=255,t/=255,a/=255;let r=Math.max(e,t,a),o=Math.min(e,t,a),n=0,i=0,c=(r+o)/2;if(r!==o){let s=r-o;switch(i=c>.5?s/(2-r-o):s/(r+o),r){case e:n=(t-a)/s+(t<a?6:0);break;case t:n=(a-e)/s+2;break;case a:n=(e-t)/s+4;break}n/=6}return{h:Math.round(n*360),s:Math.round(i*100),l:Math.round(c*100)}}function d2(e){let t=e.trim();return t.startsWith("#")||(t=`#${t}`),t}function c2(e){return/^#?[a-f\d]{6}$/i.test(e.trim())}function m2(){try{let e=localStorage.getItem(RC);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(a=>typeof a=="string"):[]}catch{return[]}}function u2(e){try{localStorage.setItem(RC,JSON.stringify(e))}catch{}}function p2({value:e="#3b82f6",onChange:t,format:a="hex",presets:r=o2,history:o=!0,enableEyeDropper:n=!0,enableAlpha:i=!1,showSwatches:c=!0,className:s}){let[d,m]=Hr.useState(!1),[u,p]=Hr.useState(e),[f,x]=Hr.useState(100),[v,N]=Hr.useState([]);Hr.useEffect(()=>{p(e)},[e]),Hr.useEffect(()=>{o&&d&&N(m2())},[o,d]);let h=Hr.useMemo(()=>s2(e),[e]),b=Hr.useMemo(()=>h?l2(h.r,h.g,h.b):null,[h]),g=Hr.useCallback(L=>{t?.(L),p(L)},[t]),y=Hr.useCallback(L=>{o&&N(H=>{let M=H.filter(I=>I!==L),$=[L,...M].slice(0,n2);return u2($),$})},[o]),k=L=>{p(L);let H=d2(L);c2(H)&&g(H.toLowerCase())},w=(L,H)=>{if(!h)return;let M=Math.max(0,Math.min(255,H)),$={...h,[L]:M};g(i2($.r,$.g,$.b))},R=async()=>{if(!(typeof window>"u"||!window.EyeDropper))try{let H=await new window.EyeDropper().open();g(H.sRGBHex),y(H.sRGBHex)}catch{}},S=L=>{g(L),y(L)},z=Hr.useMemo(()=>{if(!h)return e;switch(a){case"rgb":return`rgb(${h.r}, ${h.g}, ${h.b})`;case"hsl":return b?`hsl(${b.h}, ${b.s}%, ${b.l}%)`:e;default:return e}},[h,b,a,e]);return Ea(He,{open:d,onOpenChange:L=>{m(L),!L&&e&&y(e)},children:[Ea(Ve,{className:l("border-input inline-flex h-10 w-full items-center gap-2 rounded-md border bg-transparent px-3 text-sm",s),children:[xt("div",{className:"border-border size-5 shrink-0 rounded border",style:{backgroundColor:e}}),xt("span",{className:"truncate font-mono text-xs",children:z})]}),xt(Oe,{className:"w-64 p-3",align:"start",children:Ea("div",{className:"space-y-3",children:[xt(r2,{color:e,onChange:S,style:{width:"100%",height:140}}),i&&Ea("div",{className:"space-y-1",children:[Ea("div",{className:"text-muted-foreground flex items-center justify-between text-xs",children:[xt("span",{children:"\u900F\u660E\u5EA6"}),Ea("span",{className:"tabular-nums",children:[f,"%"]})]}),xt("input",{type:"range",min:0,max:100,value:f,onChange:L=>x(Number(L.target.value)),className:"accent-primary w-full","aria-label":"\u900F\u660E\u5EA6"})]}),Ea("div",{className:"space-y-1",children:[xt("label",{className:"text-muted-foreground text-xs",children:"HEX"}),Ea("div",{className:"flex items-center gap-1",children:[xt(T,{value:u,onChange:L=>k(L.target.value),className:"h-8 font-mono text-xs","aria-label":"HEX \u989C\u8272\u503C"}),n&&typeof window<"u"&&window.EyeDropper&&xt(C,{variant:"outline",size:"icon-sm",onClick:R,"aria-label":"\u4F7F\u7528\u5438\u7BA1\u53D6\u8272",title:"\u5438\u7BA1\u53D6\u8272",children:xt(xy,{})})]})]}),h&&a==="rgb"&&xt("div",{className:"grid grid-cols-3 gap-1",children:["r","g","b"].map(L=>Ea("div",{className:"space-y-0.5",children:[xt("label",{className:"text-muted-foreground text-[0.65rem] uppercase",children:L}),xt(T,{type:"number",min:0,max:255,value:h[L],onChange:H=>w(L,Number(H.target.value)),className:"h-7 text-xs","aria-label":`${L} \u901A\u9053`})]},L))}),b&&a==="hsl"&&Ea("div",{className:"grid grid-cols-3 gap-1",children:[Ea("div",{className:"space-y-0.5",children:[xt("label",{className:"text-muted-foreground text-[0.65rem] uppercase",children:"H"}),xt(T,{type:"number",min:0,max:360,value:b.h,readOnly:!0,className:"h-7 text-xs","aria-label":"\u8272\u76F8"})]}),Ea("div",{className:"space-y-0.5",children:[xt("label",{className:"text-muted-foreground text-[0.65rem] uppercase",children:"S"}),xt(T,{type:"number",min:0,max:100,value:b.s,readOnly:!0,className:"h-7 text-xs","aria-label":"\u9971\u548C\u5EA6"})]}),Ea("div",{className:"space-y-0.5",children:[xt("label",{className:"text-muted-foreground text-[0.65rem] uppercase",children:"L"}),xt(T,{type:"number",min:0,max:100,value:b.l,readOnly:!0,className:"h-7 text-xs","aria-label":"\u4EAE\u5EA6"})]})]}),c&&r.length>0&&Ea("div",{className:"space-y-1",children:[xt("label",{className:"text-muted-foreground text-xs",children:"\u9884\u8BBE"}),xt("div",{className:"flex flex-wrap gap-1",children:r.map(L=>xt("button",{type:"button",role:"button","aria-label":`\u9009\u62E9\u989C\u8272 ${L}`,className:l("size-6 rounded border transition-transform hover:scale-110",e.toLowerCase()===L.toLowerCase()&&"ring-primary ring-2 ring-offset-1"),style:{backgroundColor:L},onClick:()=>S(L)},L))})]}),o&&v.length>0&&Ea("div",{className:"space-y-1",children:[xt("label",{className:"text-muted-foreground text-xs",children:"\u5386\u53F2"}),xt("div",{className:"flex flex-wrap gap-1",children:v.map((L,H)=>xt("button",{type:"button",role:"button","aria-label":`\u5386\u53F2\u989C\u8272 ${L}`,className:l("size-6 rounded border transition-transform hover:scale-110",e.toLowerCase()===L.toLowerCase()&&"ring-primary ring-2 ring-offset-1"),style:{backgroundColor:L},onClick:()=>S(L)},`${L}-${H}`))})]}),Ea("div",{className:"flex items-center justify-end gap-1 border-t pt-2",children:[Ea(C,{variant:"ghost",size:"xs",onClick:()=>m(!1),children:[xt(Q,{}),"\u5173\u95ED"]}),Ea(C,{size:"xs",onClick:()=>{y(e),m(!1)},children:[xt(U,{}),"\u786E\u8BA4"]})]})]})})]})}p2.displayName="ColorBoard";import*as Am from"react";import{jsx as ca,jsxs as Jv}from"react/jsx-runtime";var g2=[{key:"bold",icon:ca(Sc,{}),title:"\u7C97\u4F53",wrap:["**","**"]},{key:"italic",icon:ca(Ic,{}),title:"\u659C\u4F53",wrap:["*","*"]},{key:"h1",icon:ca(Ag,{}),title:"\u6807\u98981",insert:"# "},{key:"h2",icon:ca(Eg,{}),title:"\u6807\u98982",insert:"## "},{key:"link",icon:ca(kc,{}),title:"\u94FE\u63A5",wrap:["[","](url)"]},{key:"code",icon:ca(ld,{}),title:"\u884C\u5185\u4EE3\u7801",wrap:["`","`"]},{key:"ul",icon:ca(wc,{}),title:"\u65E0\u5E8F\u5217\u8868",insert:"- "},{key:"ol",icon:ca(Lg,{}),title:"\u6709\u5E8F\u5217\u8868",insert:"1. "},{key:"quote",icon:ca(zg,{}),title:"\u5F15\u7528",insert:"> "},{key:"image",icon:ca(ha,{}),title:"\u56FE\u7247",insert:""}];function f2({value:e="",onChange:t,placeholder:a="\u8BF7\u8F93\u5165 Markdown...",mode:r,toolbar:o=!0,height:n=300,className:i}){let[c,s]=Am.useState("split"),d=r??c,m=Am.useRef(null),u=Am.useCallback(x=>{let v=m.current;if(!v)return;let N=v.selectionStart,h=v.selectionEnd,b=e.substring(N,h),g,y,k;if(x.wrap){let[w,R]=x.wrap;g=e.substring(0,N)+w+b+R+e.substring(h),y=N+w.length,k=h+w.length}else if(x.insert){let w=e.lastIndexOf(`
|
|
26
|
+
`,N-1)+1;g=e.substring(0,w)+x.insert+e.substring(w),y=N+x.insert.length,k=h+x.insert.length}else return;t?.(g),requestAnimationFrame(()=>{v.focus(),v.setSelectionRange(y,k)})},[e,t]),p=[{value:"editor",label:"\u7F16\u8F91",icon:ca(tl,{className:"size-3.5"})},{value:"split",label:"\u5206\u5C4F",icon:ca($h,{className:"size-3.5"})},{value:"preview",label:"\u9884\u89C8",icon:ca(Fn,{className:"size-3.5"})}],f=typeof n=="number"?{height:`${n}px`}:{height:n};return Jv("div",{"data-slot":"markdown-editor",className:l("flex flex-col rounded-md border bg-background",i),children:[o&&Jv("div",{className:"flex items-center justify-between gap-2 border-b p-1.5",children:[ca("div",{className:"flex flex-wrap items-center gap-0.5",role:"toolbar","aria-label":"Markdown \u7F16\u8F91\u5DE5\u5177\u680F",children:g2.map(x=>ca(C,{type:"button",variant:"ghost",size:"icon-xs",onClick:()=>u(x),title:x.title,"aria-label":x.title,children:x.icon},x.key))}),!r&&ca(Kg,{options:p,value:d,onChange:x=>s(x),size:"sm"})]}),Jv("div",{className:l("flex min-h-0 flex-1",d==="split"&&"flex-row divide-x"),style:f,children:[d!=="preview"&&ca(St,{ref:m,value:e,onChange:x=>t?.(x.target.value),placeholder:a,"aria-label":"Markdown \u7F16\u8F91\u533A",className:l("min-h-full flex-1 resize-none rounded-none border-0 focus-visible:ring-0",d==="split"&&"border-r"),style:{height:"100%"}}),d!=="editor"&&ca("div",{className:l("min-h-0 flex-1 overflow-auto p-3",d==="split"&&"bg-muted/20"),"aria-label":"Markdown \u9884\u89C8\u533A",children:e.trim()?ca(hb,{content:e}):ca("p",{className:"text-sm text-muted-foreground",children:a})})]})]})}f2.displayName="MarkdownEditor";import*as ac from"react";import SC from"cronstrue";import{jsx as Pa,jsxs as lo}from"react/jsx-runtime";var yb={minute:{label:"\u5206\u949F",tab:"\u5206",min:0,max:59,options:Array.from({length:60},(e,t)=>({value:String(t),label:String(t)}))},hour:{label:"\u5C0F\u65F6",tab:"\u65F6",min:0,max:23,options:Array.from({length:24},(e,t)=>({value:String(t),label:String(t)}))},day:{label:"\u65E5",tab:"\u65E5",min:1,max:31,options:Array.from({length:31},(e,t)=>({value:String(t+1),label:String(t+1)}))},month:{label:"\u6708",tab:"\u6708",min:1,max:12,options:[{value:"1",label:"1\u6708"},{value:"2",label:"2\u6708"},{value:"3",label:"3\u6708"},{value:"4",label:"4\u6708"},{value:"5",label:"5\u6708"},{value:"6",label:"6\u6708"},{value:"7",label:"7\u6708"},{value:"8",label:"8\u6708"},{value:"9",label:"9\u6708"},{value:"10",label:"10\u6708"},{value:"11",label:"11\u6708"},{value:"12",label:"12\u6708"}]},weekday:{label:"\u5468",tab:"\u5468",min:0,max:6,options:[{value:"0",label:"\u5468\u65E5"},{value:"1",label:"\u5468\u4E00"},{value:"2",label:"\u5468\u4E8C"},{value:"3",label:"\u5468\u4E09"},{value:"4",label:"\u5468\u56DB"},{value:"5",label:"\u5468\u4E94"},{value:"6",label:"\u5468\u516D"}]}},hp=["minute","hour","day","month","weekday"],b2=[{label:"\u6BCF 5 \u5206\u949F",value:"*/5 * * * *"},{label:"\u6BCF 10 \u5206\u949F",value:"*/10 * * * *"},{label:"\u6BCF 30 \u5206\u949F",value:"*/30 * * * *"},{label:"\u6BCF\u5C0F\u65F6",value:"0 * * * *"},{label:"\u6BCF\u5929 0 \u70B9",value:"0 0 * * *"},{label:"\u6BCF\u5929 9 \u70B9",value:"0 9 * * *"},{label:"\u5DE5\u4F5C\u65E5 9 \u70B9",value:"0 9 * * 1-5"},{label:"\u6BCF\u5468\u4E00 9 \u70B9",value:"0 9 * * 1"},{label:"\u6BCF\u6708 1 \u53F7 0 \u70B9",value:"0 0 1 * *"},{label:"\u6BCF\u6708\u6700\u540E\u4E00\u5929 23:59",value:"59 23 28-31 * *"}];function IC(e,t){if(e==="*")return{mode:"every",stepValue:1,specificValues:[],rangeStart:t.min,rangeEnd:t.max};let a=/^\*\/(\d+)$/.exec(e);if(a)return{mode:"step",stepValue:Number(a[1]),specificValues:[],rangeStart:t.min,rangeEnd:t.max};let r=/^(\d+)-(\d+)$/.exec(e);return r?{mode:"range",stepValue:1,specificValues:[],rangeStart:Number(r[1]),rangeEnd:Number(r[2])}:e.includes(",")?{mode:"specific",stepValue:1,specificValues:e.split(","),rangeStart:t.min,rangeEnd:t.max}:{mode:"specific",stepValue:1,specificValues:[e],rangeStart:t.min,rangeEnd:t.max}}function Zv(e){switch(e.mode){case"every":return"*";case"step":return`*/${e.stepValue}`;case"range":return`${e.rangeStart}-${e.rangeEnd}`;case"specific":return e.specificValues.length>0?e.specificValues.join(","):"*";default:return"*"}}function DC(e){let t=e.trim().split(/\s+/);for(;t.length<5;)t.push("*");return t.slice(0,5)}function x2(e){try{return SC.toString(e,{locale:"zh_CN",use24HourTimeFormat:!0})}catch{try{return SC.toString(e)}catch{return"\u65E0\u6548\u7684 Cron \u8868\u8FBE\u5F0F"}}}function v2({value:e="* * * * *",onChange:t,showDescription:a=!0,readOnly:r=!1,className:o}){let n=ac.useMemo(()=>DC(e),[e]),[i,c]=ac.useState(()=>{let p={};return hp.forEach((f,x)=>{p[f]=IC(n[x]??"*",yb[f])}),p});ac.useEffect(()=>{let p=DC(e);c(f=>{let x={};return hp.forEach((v,N)=>{let h=f[v],b=IC(p[N]??"*",yb[v]),g=Zv(h),y=Zv(b);x[v]=g===y&&g===p[N]?h:b}),x})},[e]);let s=(p,f)=>{r||c(x=>{let v={...x,[p]:{...x[p],...f}},N=hp.map(h=>Zv(v[h]));return t?.(N.join(" ")),v})},d=ac.useMemo(()=>x2(e),[e]),m=p=>{r||t?.(p)},u=[{value:"every",label:"\u6BCF"},{value:"step",label:"\u95F4\u9694"},{value:"specific",label:"\u6307\u5B9A"},{value:"range",label:"\u8303\u56F4"}];return lo("div",{"data-slot":"cron-editor",className:l("bg-background rounded-md border p-3",o),children:[lo("div",{className:"bg-muted/30 mb-3 flex items-center gap-2 rounded-md px-3 py-2",children:[Pa(pe,{className:"text-muted-foreground size-4 shrink-0"}),Pa("code",{className:"flex-1 font-mono text-sm font-medium",children:e})]}),lo("div",{className:"mb-3",children:[Pa(ue,{className:"text-muted-foreground mb-1.5 text-xs",children:"\u5E38\u7528\u9884\u8BBE"}),Pa("div",{className:"flex flex-wrap gap-1",children:b2.map(p=>Pa("button",{type:"button",disabled:r,onClick:()=>m(p.value),className:l("rounded-md border px-2 py-1 text-xs transition-colors","hover:border-primary hover:bg-primary/5","disabled:cursor-not-allowed disabled:opacity-50",e===p.value&&"border-primary bg-primary/10 text-primary"),children:p.label},p.value))})]}),lo(Sr,{defaultValue:"minute",children:[Pa(Ir,{className:"mb-2",children:hp.map(p=>Pa(Ba,{value:p,children:yb[p].tab},p))}),hp.map(p=>{let f=yb[p],x=i[p];return lo(Co,{value:p,className:"space-y-3",children:[lo("div",{className:"flex items-center gap-2",children:[Pa(ue,{className:"text-sm font-medium",children:f.label}),Pa(Kg,{options:u,value:x.mode,onChange:v=>s(p,{mode:v}),size:"sm",disabled:r})]}),x.mode==="every"&&lo("p",{className:"text-muted-foreground text-sm",children:["\u6BCF",f.label,"\u90FD\u6267\u884C"]}),x.mode==="step"&&lo("div",{className:"flex items-center gap-2",children:[Pa("span",{className:"text-muted-foreground text-sm",children:"\u6BCF"}),Pa(T,{type:"number",min:1,max:f.max-f.min+1,value:x.stepValue,onChange:v=>s(p,{stepValue:Math.max(1,Number(v.target.value)||1)}),disabled:r,className:"w-20","aria-label":`${f.label}\u95F4\u9694\u503C`}),lo("span",{className:"text-muted-foreground text-sm",children:["\u4E2A",f.label,"\u6267\u884C\u4E00\u6B21"]})]}),x.mode==="specific"&&lo("div",{className:"space-y-1.5",children:[lo("p",{className:"text-muted-foreground text-xs",children:["\u9009\u62E9\u591A\u4E2A",f.label,"(\u53EF\u591A\u9009)"]}),Pa("div",{className:"flex flex-wrap gap-1",children:f.options.map(v=>{let N=x.specificValues.includes(v.value);return Pa("button",{type:"button",disabled:r,onClick:()=>{let h=N?x.specificValues.filter(b=>b!==v.value):[...x.specificValues,v.value].sort((b,g)=>Number(b)-Number(g));s(p,{specificValues:h})},className:l("min-w-8 rounded border px-1.5 py-1 text-xs transition-colors",N?"border-primary bg-primary/10 text-primary":"hover:border-primary/50","disabled:cursor-not-allowed disabled:opacity-50"),"aria-pressed":N,children:v.label},v.value)})})]}),x.mode==="range"&&lo("div",{className:"flex items-center gap-2",children:[Pa("span",{className:"text-muted-foreground text-sm",children:"\u4ECE"}),Pa(T,{type:"number",min:f.min,max:f.max,value:x.rangeStart,onChange:v=>s(p,{rangeStart:Math.max(f.min,Math.min(f.max,Number(v.target.value)||f.min))}),disabled:r,className:"w-20","aria-label":`${f.label}\u8303\u56F4\u8D77\u59CB`}),Pa("span",{className:"text-muted-foreground text-sm",children:"\u5230"}),Pa(T,{type:"number",min:f.min,max:f.max,value:x.rangeEnd,onChange:v=>s(p,{rangeEnd:Math.max(f.min,Math.min(f.max,Number(v.target.value)||f.max))}),disabled:r,className:"w-20","aria-label":`${f.label}\u8303\u56F4\u7ED3\u675F`}),lo("span",{className:"text-muted-foreground text-sm",children:["\u6BCF",f.label,"\u6267\u884C"]})]})]},p)})]}),a&&lo("div",{className:"bg-primary/5 mt-3 rounded-md px-3 py-2",children:[Pa(ue,{className:"text-muted-foreground mb-0.5 block text-xs",children:"\u6267\u884C\u63CF\u8FF0"}),Pa("p",{className:"text-foreground text-sm font-medium",children:d})]})]})}v2.displayName="CronEditor";import"react";import{jsx as Mi,jsxs as Nb}from"react/jsx-runtime";function Woe({title:e,description:t,thumbnail:a,metadata:r,actions:o,className:n}){return Nb("div",{"data-slot":"chat-card-message",className:l("flex w-full max-w-sm flex-col overflow-hidden rounded-lg border border-border bg-background",n),children:[Nb("div",{className:"flex items-start gap-3 p-3",children:[a?Mi("img",{src:a,alt:"",className:"size-12 shrink-0 rounded-md object-cover",loading:"lazy"}):Mi("span",{className:"flex size-12 shrink-0 items-center justify-center rounded-md bg-muted","aria-hidden":!0,children:Mi(ha,{className:"size-5 text-muted-foreground"})}),Nb("div",{className:"flex min-w-0 flex-1 flex-col",children:[Mi("h4",{className:"truncate text-sm font-semibold",title:e,children:e}),t?Mi("p",{className:"line-clamp-2 text-xs text-muted-foreground",children:t}):null]})]}),r&&r.length>0?Mi("dl",{className:"grid grid-cols-2 gap-px border-t border-border bg-border",children:r.map(i=>Nb("div",{className:"bg-background px-3 py-1.5",children:[Mi("dt",{className:"text-[0.65rem] uppercase tracking-wide text-muted-foreground",children:i.label}),Mi("dd",{className:"truncate text-xs font-medium text-foreground",title:i.value,children:i.value})]},i.label))}):null,o?Mi("div",{className:"flex items-center justify-end gap-1 border-t border-border px-3 py-2",children:o}):null]})}import{jsx as Cb}from"react/jsx-runtime";function joe({images:e,className:t}){if(e.length===0)return Cb("div",{"data-slot":"chat-image-gallery",className:l("hidden",t),"aria-hidden":!0});let a=e.length===1?"grid-cols-1":e.length===2?"grid-cols-2":"grid-cols-3";return Cb("div",{"data-slot":"chat-image-gallery",className:l("grid max-w-md gap-1",a,t),role:"group","aria-label":`Image gallery, ${e.length} image${e.length>1?"s":""}`,children:e.map((r,o)=>Cb("a",{href:r.src,target:"_blank",rel:"noopener noreferrer",className:"group/img relative block aspect-square overflow-hidden rounded-md bg-muted","aria-label":r.alt??`Image ${o+1}`,children:Cb("img",{src:r.src,alt:r.alt??`Image ${o+1}`,loading:"lazy",className:"size-full object-cover transition-transform group-hover/img:scale-105"})},o))})}import*as Bi from"react";import{jsx as jl,jsxs as y2}from"react/jsx-runtime";function h2(e){let t=Math.floor(e/60),a=Math.floor(e%60);return`${t}:${a.toString().padStart(2,"0")}`}function Zoe({duration:e,src:t,className:a}){let r=Bi.useRef(null),[o,n]=Bi.useState(!1),[i,c]=Bi.useState(0),s=Bi.useCallback(()=>{let u=r.current;if(!u){n(p=>!p);return}o?u.pause():u.play().catch(()=>n(!1))},[o]);Bi.useEffect(()=>{let u=r.current;if(!u)return;let p=()=>{u.duration>0&&c(u.currentTime/u.duration)},f=()=>n(!0),x=()=>n(!1),v=()=>{n(!1),c(0)};return u.addEventListener("timeupdate",p),u.addEventListener("play",f),u.addEventListener("pause",x),u.addEventListener("ended",v),()=>{u.removeEventListener("timeupdate",p),u.removeEventListener("play",f),u.removeEventListener("pause",x),u.removeEventListener("ended",v)}},[]);let d=24,m=Math.round(i*d);return y2("div",{"data-slot":"chat-voice-message",className:l("inline-flex items-center gap-2 rounded-2xl bg-muted px-3 py-2",a),children:[jl(C,{type:"button",variant:"ghost",size:"icon-sm",onClick:s,"aria-label":o?"Pause voice message":"Play voice message",children:o?jl(Rg,{className:"size-4","aria-hidden":!0}):jl(Sg,{className:"size-4","aria-hidden":!0})}),jl(my,{className:"size-4 shrink-0 text-muted-foreground","aria-hidden":!0}),jl("div",{className:"flex h-6 items-center gap-0.5",role:"progressbar","aria-label":"Voice playback progress","aria-valuenow":Math.round(i*100),"aria-valuemin":0,"aria-valuemax":100,children:Array.from({length:d},(u,p)=>jl("span",{className:l("w-0.5 rounded-full",p<m?"bg-primary":"bg-muted-foreground/40"),style:{height:`${30+p*37%70}%`},"aria-hidden":!0},p))}),jl("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:h2(e)}),t?jl("audio",{ref:r,src:t,preload:"none"}):null]})}import*as eh from"react";import{jsx as kb,jsxs as MC}from"react/jsx-runtime";function nne({tools:e,onToolClick:t,className:a}){let r=eh.useCallback(n=>()=>t?.(n),[t]),o=eh.useCallback(n=>i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),t?.(n))},[t]);return MC("div",{"data-slot":"chat-input-toolbar",role:"toolbar","aria-label":"Input tools",className:l("flex items-center gap-1",a),children:[kb(C,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Attach file",children:kb(rl,{className:"size-4","aria-hidden":!0})}),kb("div",{className:"mx-1 h-4 w-px shrink-0 bg-border","aria-hidden":!0}),e.map(n=>MC(C,{type:"button",variant:"ghost",size:"sm",onClick:r(n.id),onKeyDown:o(n.id),"aria-label":n.label,children:[n.icon??null,kb("span",{children:n.label})]},n.id))]})}import*as yp from"react";import{jsx as Kl,jsxs as th}from"react/jsx-runtime";function mne({users:e,onSelect:t,className:a}){let[r,o]=yp.useState(0),n=Math.min(r,Math.max(0,e.length-1)),i=yp.useCallback(s=>t?.(s),[t]),c=yp.useCallback(s=>{if(e.length!==0){if(s.key==="ArrowDown")s.preventDefault(),o(d=>(d+1)%e.length);else if(s.key==="ArrowUp")s.preventDefault(),o(d=>(d-1+e.length)%e.length);else if(s.key==="Enter"){s.preventDefault();let d=e[n];d&&i(d.id)}}},[i,n,e]);return th("div",{"data-slot":"chat-mention-picker",role:"listbox","aria-label":"Mention a user",tabIndex:0,onKeyDown:c,className:l("flex w-full max-w-xs flex-col overflow-hidden rounded-lg border border-border bg-popover p-1 shadow-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",a),children:[Kl("p",{className:"px-2 py-1 text-[0.65rem] uppercase tracking-wide text-muted-foreground",children:"People"}),e.length===0?Kl("p",{className:"px-2 py-2 text-center text-xs text-muted-foreground",children:"No users"}):Kl("ul",{role:"list",children:e.map((s,d)=>{let m=d===n;return Kl("li",{role:"option","aria-selected":m,children:th("button",{type:"button",onMouseEnter:()=>o(d),onClick:()=>i(s.id),className:l("flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm",m?"bg-muted":""),children:[th(Tr,{size:"sm",children:[s.avatar?Kl(nn,{src:s.avatar,alt:s.name}):Kl(nn,{alt:s.name}),Kl(Rr,{children:sn(s.name)})]}),Kl("span",{className:"truncate",children:s.name})]})},s.id)})})]})}import*as Np from"react";import{jsx as Em,jsxs as ah}from"react/jsx-runtime";function fne({commands:e,onSelect:t,className:a}){let[r,o]=Np.useState(0),n=Math.min(r,Math.max(0,e.length-1)),i=Np.useCallback(s=>t?.(s),[t]),c=Np.useCallback(s=>{if(e.length!==0)if(s.key==="ArrowDown")s.preventDefault(),o(d=>(d+1)%e.length);else if(s.key==="ArrowUp")s.preventDefault(),o(d=>(d-1+e.length)%e.length);else if(s.key==="Enter"){s.preventDefault();let d=e[n];d&&i(d.id)}else s.key==="Escape"&&s.preventDefault()},[i,e,n]);return ah("div",{"data-slot":"chat-command-menu",role:"listbox","aria-label":"Slash commands",tabIndex:0,onKeyDown:c,className:l("flex w-full max-w-sm flex-col overflow-hidden rounded-lg border border-border bg-popover p-1 shadow-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",a),children:[Em("p",{className:"px-2 py-1 text-[0.65rem] uppercase tracking-wide text-muted-foreground",children:"Commands"}),e.length===0?Em("p",{className:"px-2 py-2 text-center text-xs text-muted-foreground",children:"No commands"}):Em("ul",{role:"list",children:e.map((s,d)=>{let m=d===n;return Em("li",{role:"option","aria-selected":m,children:ah("button",{type:"button",onMouseEnter:()=>o(d),onClick:()=>i(s.id),className:l("flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm",m?"bg-muted text-foreground":"text-muted-foreground"),children:[ah("span",{className:"font-mono text-primary",children:["/",s.id]}),Em("span",{className:"flex-1 truncate",children:s.label}),s.description?Em("span",{className:"shrink-0 text-xs text-muted-foreground/80",children:s.description}):null]})},s.id)})})]})}import*as wb from"react";import{jsx as N2,jsxs as C2}from"react/jsx-runtime";function hne({chunks:e,isStreaming:t=!1,speed:a=30,className:r}){let o=e.join(""),[n,i]=wb.useState(t?0:o.length);return wb.useEffect(()=>{if(!t){i(o.length);return}i(0);let c=0,s=window.setInterval(()=>{c+=1,c>=o.length?(i(o.length),window.clearInterval(s)):i(c)},Math.max(8,a));return()=>window.clearInterval(s)},[o,t,a]),C2("span",{"data-slot":"chat-streaming-text",className:l("whitespace-pre-wrap break-words",r),"aria-live":t?"polite":"off",children:[o.slice(0,n)||"\xA0",t&&n<o.length?N2("span",{className:"ml-0.5 inline-block h-4 w-1.5 animate-pulse bg-foreground align-middle","aria-hidden":!0}):null]})}import*as BC from"react";import{jsx as Pb,jsxs as k2}from"react/jsx-runtime";function wne({suggestions:e,onSelect:t,className:a}){let r=BC.useCallback(o=>n=>{(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),t?.(o))},[t]);return e.length===0?Pb("div",{"data-slot":"chat-suggest-replies",className:l("hidden",a),"aria-hidden":!0}):Pb("div",{"data-slot":"chat-suggest-replies",className:l("flex flex-wrap gap-2",a),"aria-label":"Suggested replies",children:e.map(o=>k2("button",{type:"button",onClick:()=>t?.(o),onKeyDown:r(o),className:"inline-flex items-center gap-1.5 rounded-full border border-border bg-background px-3 py-1.5 text-xs text-muted-foreground transition-colors hover:border-primary/40 hover:bg-muted hover:text-foreground",children:[Pb(Bg,{className:"size-3 shrink-0 text-primary","aria-hidden":!0}),Pb("span",{className:"max-w-[16rem] truncate",children:o})]},o))})}import{jsx as Fm,jsxs as rh}from"react/jsx-runtime";function Ine({context:e,className:t}){return rh("div",{"data-slot":"chat-context-panel",className:l("flex flex-col gap-2 p-3",t),"aria-label":"Conversation context",children:[Fm("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Context"}),e.length===0?Fm("p",{className:"text-sm text-muted-foreground",children:"No context attached"}):Fm("dl",{className:"flex flex-col",children:e.map((a,r)=>rh("div",{children:[r>0?Fm(Ue,{className:"my-2"}):null,rh("div",{className:"flex flex-col gap-0.5",children:[Fm("dt",{className:"text-[0.65rem] uppercase tracking-wide text-muted-foreground",children:a.label}),Fm("dd",{className:"break-words text-sm text-foreground",children:a.value})]})]},a.label))})]})}import*as kp from"react";import{Fragment as w2,jsx as Xn,jsxs as Cp}from"react/jsx-runtime";function Ane({models:e,activeId:t,onSwitch:a,className:r}){let[o,n]=kp.useState(!1),i=e.find(d=>d.id===t)??e[0],c=kp.useCallback(d=>{a?.(d),n(!1)},[a]),s=kp.useCallback(d=>{(d.key==="ArrowDown"||d.key==="Enter"||d.key===" ")&&(d.preventDefault(),n(!0))},[]);return Cp("div",{"data-slot":"chat-model-switcher",className:l("relative",r),children:[Cp(C,{type:"button",variant:"outline",size:"sm",onClick:()=>n(d=>!d),onKeyDown:s,"aria-haspopup":"listbox","aria-expanded":o,"aria-label":"Switch AI model",children:[Xn(Bg,{className:"size-4 text-primary","aria-hidden":!0}),Xn("span",{className:"max-w-[12rem] truncate",children:i?.name??"Select model"}),Xn(re,{className:l("size-4 transition-transform",o&&"rotate-180"),"aria-hidden":!0})]}),o?Cp(w2,{children:[Xn("button",{type:"button","aria-label":"Close model menu",tabIndex:-1,className:"fixed inset-0 z-10 cursor-default",onClick:()=>n(!1)}),Xn("ul",{role:"listbox","aria-label":"Available models",className:"absolute right-0 z-20 mt-1 max-h-72 w-64 overflow-y-auto rounded-md border border-border bg-popover p-1 shadow-md",children:e.map(d=>{let m=d.id===i?.id;return Xn("li",{role:"option","aria-selected":m,children:Cp("button",{type:"button",onClick:()=>c(d.id),className:"flex w-full items-start gap-2 rounded-md px-2 py-1.5 text-left hover:bg-muted",children:[Xn("span",{className:"mt-0.5 shrink-0",children:m?Xn(U,{className:"size-4 text-primary","aria-hidden":!0}):Xn("span",{className:"block size-4"})}),Cp("span",{className:"flex min-w-0 flex-1 flex-col",children:[Xn("span",{className:"truncate text-sm font-medium text-foreground",children:d.name}),d.description?Xn("span",{className:"truncate text-xs text-muted-foreground",children:d.description}):null]})]})},d.id)})})]}):null]})}import"react";import{jsx as LC,jsxs as T2}from"react/jsx-runtime";var P2={idle:{label:"Idle",dot:"bg-muted-foreground",text:"text-muted-foreground",spin:!1,Icon:qe},thinking:{label:"Thinking",dot:"bg-blue-500",text:"text-blue-600 dark:text-blue-400",spin:!0,Icon:Mg},acting:{label:"Acting",dot:"bg-amber-500",text:"text-amber-600 dark:text-amber-400",spin:!0,Icon:Dg},waiting:{label:"Waiting",dot:"bg-purple-500",text:"text-purple-600 dark:text-purple-400",spin:!0,Icon:Pr},done:{label:"Done",dot:"bg-green-500",text:"text-green-600 dark:text-green-400",spin:!1,Icon:qe}};function One({status:e,label:t,className:a}){let r=P2[e],o=t??r.label,n=r.Icon;return T2("span",{"data-slot":"chat-agent-status",role:"status","aria-label":`Agent status: ${o}`,className:l("inline-flex items-center gap-1.5 text-xs font-medium",r.text,a),children:[LC(n,{className:l("size-3.5",r.spin&&"animate-spin"),"aria-hidden":!0}),LC("span",{className:l("size-2 rounded-full",r.dot),"aria-hidden":!0}),o]})}import*as wp from"react";import{jsx as Yn,jsxs as Tb}from"react/jsx-runtime";function Kne({title:e,type:t,content:a,className:r}){let[o,n]=wp.useState(!1),i=a??"",c=wp.useCallback(()=>{navigator.clipboard?.writeText(i).then(()=>{n(!0),window.setTimeout(()=>n(!1),1500)})},[i]),s=wp.useCallback(()=>{let m=new Blob([i],{type:"text/plain;charset=utf-8"}),u=URL.createObjectURL(m),p=document.createElement("a");p.href=u,p.download=(e??"artifact").replace(/\s+/g,"-").toLowerCase()+".md",document.body.appendChild(p),p.click(),p.remove(),URL.revokeObjectURL(u)},[i,e]),d=t??"document";return Tb("section",{"data-slot":"chat-artifact-panel","aria-label":`Artifact: ${e??"Untitled"}`,className:l("flex h-full flex-col overflow-hidden border border-border bg-background",r),children:[Tb("header",{className:"flex items-center gap-2 border-b border-border px-3 py-2",children:[Yn(Rt,{className:"size-4 shrink-0 text-muted-foreground","aria-hidden":!0}),Tb("div",{className:"flex min-w-0 flex-1 flex-col",children:[Yn("h3",{className:"truncate text-sm font-semibold",title:e??"Untitled",children:e??"Untitled artifact"}),Yn("span",{className:"text-[0.65rem] uppercase tracking-wide text-muted-foreground",children:d})]}),Tb("div",{className:"flex shrink-0 items-center gap-1",children:[Yn(C,{type:"button",variant:"ghost",size:"icon-sm",onClick:c,"aria-label":"Copy artifact",children:o?Yn(U,{className:"size-4 text-green-600","aria-hidden":!0}):Yn(zt,{className:"size-4","aria-hidden":!0})}),Yn(C,{type:"button",variant:"ghost",size:"icon-sm",onClick:s,"aria-label":"Download artifact",children:Yn(qa,{className:"size-4","aria-hidden":!0})})]})]}),Yn("div",{className:"min-h-0 flex-1 overflow-y-auto p-3",children:i?Yn(hb,{content:i}):Yn("p",{className:"text-sm text-muted-foreground",children:"No content generated yet."})})]})}import*as Li from"react";import{jsx as Ql,jsxs as Rb}from"react/jsx-runtime";function ese({onLike:e,onDislike:t,onComment:a,className:r}){let[o,n]=Li.useState(null),[i,c]=Li.useState(!1),[s,d]=Li.useState(""),m=Li.useCallback(()=>{n(x=>x==="up"?null:"up"),e?.()},[e]),u=Li.useCallback(()=>{n(x=>x==="down"?null:"down"),t?.()},[t]),p=Li.useCallback(()=>{let x=s.trim();x&&a?.(x),d(""),c(!1)},[a,s]),f=Li.useCallback(x=>{x.key==="Enter"&&(x.metaKey||x.ctrlKey)&&(x.preventDefault(),p()),x.key==="Escape"&&(c(!1),d(""))},[p]);return Rb("div",{"data-slot":"chat-feedback",className:l("flex flex-col gap-1",r),children:[Rb("div",{className:"flex items-center gap-1",children:[Ql(C,{type:"button",variant:"ghost",size:"icon-sm",onClick:m,"aria-label":"Good response","aria-pressed":o==="up",children:Ql(py,{className:l("size-4",o==="up"&&"text-green-600"),"aria-hidden":!0})}),Ql(C,{type:"button",variant:"ghost",size:"icon-sm",onClick:u,"aria-label":"Bad response","aria-pressed":o==="down",children:Ql(uy,{className:l("size-4",o==="down"&&"text-red-600"),"aria-hidden":!0})}),a?Ql(C,{type:"button",variant:"ghost",size:"sm",onClick:()=>c(x=>!x),"aria-expanded":i,"aria-label":"Add comment",children:"Comment"}):null]}),i?Rb("div",{className:"flex flex-col gap-1",children:[Ql("textarea",{value:s,onChange:x=>d(x.target.value),onKeyDown:f,placeholder:"Add a comment (Cmd/Ctrl+Enter to submit)","aria-label":"Comment text",rows:2,className:"resize-none rounded-md border border-border bg-background p-2 text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring/40"}),Rb("div",{className:"flex justify-end gap-1",children:[Ql(C,{type:"button",variant:"ghost",size:"sm",onClick:()=>c(!1),children:"Cancel"}),Ql(C,{type:"button",size:"sm",onClick:p,disabled:s.trim().length===0,children:"Submit"})]})]}):null]})}import"react";import{Fragment as R2,jsx as zi,jsxs as Pp}from"react/jsx-runtime";function zC({role:e,content:t,avatar:a,name:r,time:o,status:n,className:i}){let c=e==="user",s=e==="system",d=r??(c?"You":s?"System":"Assistant");return s?Pp("div",{"data-slot":"chat-message-bubble",role:"status",className:l("mx-auto w-fit max-w-full rounded-md bg-muted px-3 py-1.5 text-center text-xs text-muted-foreground",i),children:[zi("span",{className:"sr-only",children:"System message"}),t,o?zi("span",{className:"ml-2 tabular-nums opacity-70",children:o}):null]}):Pp("div",{"data-slot":"chat-message-bubble",className:l("flex w-full gap-2",c?"flex-row-reverse":"flex-row",i),children:[zi(Tr,{size:"sm",className:"mt-0.5",children:a??Pp(R2,{children:[zi(nn,{alt:d}),zi(Rr,{children:sn(d)})]})}),Pp("div",{className:l("flex max-w-[80%] flex-col gap-0.5",c?"items-end":"items-start"),children:[Pp("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[zi("span",{className:"font-medium text-foreground",children:d}),o?zi("span",{className:"tabular-nums",children:o}):null,n?zi("span",{"aria-label":`Status: ${n}`,children:n}):null]}),zi("div",{className:l("whitespace-pre-wrap break-words rounded-2xl px-3 py-2 text-sm",c?"rounded-tr-sm bg-primary text-primary-foreground":"rounded-tl-sm bg-muted text-foreground"),children:t})]})]})}import{jsx as oh}from"react/jsx-runtime";function mse({messages:e,className:t}){return oh("div",{"data-slot":"chat-conversation",className:l("flex flex-col gap-3 px-4 py-4",t),role:"log","aria-live":"polite","aria-label":"Conversation messages",children:e.length===0?oh("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"No messages yet"}):e.map(a=>{let r=a.role==="user"||a.role==="assistant"||a.role==="system"?a.role:"assistant";return oh(zC,{role:r,content:a.content,...a.time!==void 0&&{time:a.time}},a.id)})})}import{jsx as Ai,jsxs as Sb}from"react/jsx-runtime";function xse({query:e,onQueryChange:t,results:a=[],className:r}){return Sb("div",{"data-slot":"chat-conversation-search",className:l("flex flex-col gap-2",r),role:"search","aria-label":"Search conversations",children:[Sb("div",{className:"relative",children:[Ai(X,{className:"text-muted-foreground absolute top-1/2 left-2 size-4 -translate-y-1/2","aria-hidden":!0}),Ai(T,{type:"search",value:e,onChange:o=>t?.(o.target.value),placeholder:"Search conversations...","aria-label":"Search query",className:"pl-8"})]}),Ai("div",{className:"min-h-0 flex-1 overflow-y-auto",children:e.trim().length===0?Ai("p",{className:"text-muted-foreground px-2 py-3 text-center text-xs",children:"Type to search"}):a.length===0?Sb("p",{className:"text-muted-foreground flex flex-col items-center gap-1 px-2 py-4 text-center text-xs",children:[Ai(hg,{className:"size-5","aria-hidden":!0}),"No results for \u201C",e,"\u201D"]}):Ai("ul",{role:"list",className:"flex flex-col gap-0.5",children:a.map(o=>Ai("li",{children:Sb("button",{type:"button",className:"hover:bg-muted flex w-full flex-col gap-0.5 rounded-md px-2 py-1.5 text-left",children:[Ai("span",{className:"text-foreground truncate text-sm font-medium",children:o.title}),Ai("span",{className:"text-muted-foreground line-clamp-2 text-xs",children:o.snippet})]})},o.id))})})]})}import*as Tp from"react";import{jsx as rc,jsxs as S2}from"react/jsx-runtime";function Cse({branches:e,onSelect:t,className:a}){let r=e.findIndex(m=>m.active),o=r>=0?r:0,n=Tp.useCallback(m=>{let u=(o+m+e.length)%e.length,p=e[u];p&&t?.(p.id)},[e,o,t]),i=Tp.useCallback(()=>n(-1),[n]),c=Tp.useCallback(()=>n(1),[n]),s=Tp.useCallback(m=>{m.key==="ArrowLeft"?(m.preventDefault(),n(-1)):m.key==="ArrowRight"&&(m.preventDefault(),n(1))},[n]);if(e.length===0)return rc("div",{"data-slot":"chat-branch",className:l("hidden",a),"aria-hidden":!0});let d=e[o];return S2("div",{"data-slot":"chat-branch",role:"group","aria-label":`Message branch ${o+1} of ${e.length}`,tabIndex:0,onKeyDown:s,className:l("inline-flex items-center gap-1 rounded-md border border-border bg-background px-1 py-0.5 text-xs text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",a),children:[rc("button",{type:"button",onClick:i,disabled:e.length<=1,"aria-label":"Previous branch",className:"inline-flex size-5 items-center justify-center rounded hover:bg-muted disabled:opacity-40",children:rc(et,{className:"size-3.5","aria-hidden":!0})}),rc("span",{className:"font-medium text-foreground",children:d?.label??"-"}),rc("span",{className:"tabular-nums",children:`${o+1}/${e.length}`}),rc("button",{type:"button",onClick:c,disabled:e.length<=1,"aria-label":"Next branch",className:"inline-flex size-5 items-center justify-center rounded hover:bg-muted disabled:opacity-40",children:rc(me,{className:"size-3.5","aria-hidden":!0})})]})}import{jsx as $m,jsxs as AC}from"react/jsx-runtime";function Sse({url:e,title:t,description:a,className:r}){let o=e;try{o=new URL(e).hostname.replace(/^www\./,"")}catch{}return AC("a",{"data-slot":"chat-shared-link",href:e,target:"_blank",rel:"noopener noreferrer",className:l("flex max-w-sm items-center gap-3 rounded-lg border border-border bg-background p-3 transition-colors hover:border-primary/40 hover:bg-muted/40",r),children:[$m("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-md bg-muted","aria-hidden":!0,children:$m(oy,{className:"size-4 text-muted-foreground"})}),AC("span",{className:"flex min-w-0 flex-1 flex-col",children:[$m("span",{className:"truncate text-sm font-medium text-foreground",title:t??e,children:t??b0(e,48)}),a?$m("span",{className:"line-clamp-2 text-xs text-muted-foreground",children:a}):null,$m("span",{className:"truncate text-[0.65rem] text-muted-foreground/80",children:o})]}),$m(Tg,{className:"size-4 shrink-0 text-muted-foreground","aria-hidden":!0})]})}import*as Is from"react";import{jsx as Ib,jsxs as EC}from"react/jsx-runtime";function zse({value:e,onChange:t,onSend:a,placeholder:r="Type a message...",disabled:o=!1,maxLength:n,className:i}){let[c,s]=Is.useState(""),d=e!==void 0,m=d?e:c,u=Is.useRef(null);Is.useEffect(()=>{let N=u.current;N&&(N.style.height="auto",N.style.height=`${Math.min(N.scrollHeight,200)}px`)},[m]);let p=Is.useCallback(N=>{let h=n!==void 0?N.target.value.slice(0,n):N.target.value;d||s(h),t?.(h)},[d,n,t]),f=Is.useCallback(()=>{o||m.trim()&&(a?.(),d||s(""))},[d,m,o,a]),x=Is.useCallback(N=>{N.key==="Enter"&&!N.shiftKey&&(N.preventDefault(),f())},[f]),v=n!==void 0?n-m.length:void 0;return EC("div",{"data-slot":"chat-message-input",className:l("flex items-end gap-2 rounded-xl border border-border bg-background p-2 focus-within:ring-2 focus-within:ring-ring/40",o&&"opacity-60",i),children:[Ib("textarea",{ref:u,rows:1,value:m,onChange:p,onKeyDown:x,placeholder:r,disabled:o,maxLength:n,"aria-label":"Message",className:"max-h-[200px] min-h-[1.5rem] flex-1 resize-none bg-transparent px-1 py-1 text-sm outline-none placeholder:text-muted-foreground"}),EC("div",{className:"flex shrink-0 flex-col items-end gap-0.5",children:[v!==void 0?Ib("span",{className:l("text-[0.65rem] tabular-nums",v<10&&"text-destructive"),"aria-live":"polite",children:v}):null,Ib(C,{type:"button",size:"icon-sm",onClick:f,disabled:o||m.trim().length===0,"aria-label":"Send message",children:Ib(rs,{className:"size-4","aria-hidden":!0})})]})]})}import*as oc from"react";import{jsx as Qt,jsxs as Ds}from"react/jsx-runtime";var FC=[{value:"text",label:"\u5355\u884C\u6587\u672C"},{value:"textarea",label:"\u591A\u884C\u6587\u672C"},{value:"number",label:"\u6570\u5B57"},{value:"select",label:"\u4E0B\u62C9\u9009\u62E9"},{value:"date",label:"\u65E5\u671F"},{value:"checkbox",label:"\u5F00\u5173"}];function qse({fields:e=[],onChange:t,className:a}){let[r,o]=oc.useState(e),[n,i]=oc.useState("");oc.useEffect(()=>{o(e)},[e]);let c=oc.useCallback(f=>{o(f),t?.(f)},[t]),s=()=>{let f=n.trim()||`\u5B57\u6BB5 ${r.length+1}`,x={id:`field-${Date.now()}`,type:"text",label:f,required:!1};c([...r,x]),i("")},d=(f,x)=>{c(r.map(v=>v.id===f?{...v,...x}:v))},m=f=>{c(r.filter(x=>x.id!==f))},u=(f,x)=>{let v=f+x;if(v<0||v>=r.length)return;let N=[...r],h=N[f],b=N[v];!h||!b||(N[f]=b,N[v]=h,c(N))},p=f=>{f.key==="Enter"&&(f.preventDefault(),s())};return Qt("div",{"data-slot":"form-designer",className:l("flex flex-col gap-4",a),children:Ds(Y,{children:[Qt(le,{children:Qt(ie,{children:"\u8868\u5355\u8BBE\u8BA1\u5668"})}),Ds(J,{className:"flex flex-col gap-4",children:[Ds("div",{className:"flex items-center gap-2",children:[Qt(T,{type:"text",value:n,placeholder:"\u8F93\u5165\u5B57\u6BB5\u6807\u7B7E\u540E\u56DE\u8F66\u65B0\u589E",onChange:f=>i(f.target.value),onKeyDown:p,"aria-label":"\u65B0\u5B57\u6BB5\u6807\u7B7E"}),Ds(C,{type:"button",onClick:s,"aria-label":"\u65B0\u589E\u5B57\u6BB5",children:[Qt(ge,{}),"\u65B0\u589E"]})]}),r.length===0?Qt("p",{className:"py-6 text-center text-sm text-muted-foreground",children:"\u6682\u65E0\u5B57\u6BB5\uFF0C\u8BF7\u5728\u4E0A\u65B9\u6DFB\u52A0\u3002"}):Qt("ul",{role:"list",className:"flex flex-col gap-2",children:r.map((f,x)=>{let v=FC.find(N=>N.value===f.type)?.label??f.type;return Ds("li",{className:"flex items-center gap-2 rounded-md border p-2",children:[Qt(ts,{className:"size-4 shrink-0 text-muted-foreground","aria-hidden":!0}),Ds("div",{className:"flex flex-1 flex-col gap-2 sm:flex-row sm:items-center",children:[Qt(T,{type:"text",value:f.label,"aria-label":`\u5B57\u6BB5 ${x+1} \u6807\u7B7E`,className:"sm:max-w-[12rem]",onChange:N=>d(f.id,{label:N.target.value})}),Ds(Pe,{value:f.type,onValueChange:N=>{typeof N=="string"&&d(f.id,{type:N})},children:[Qt(Re,{"aria-label":`\u5B57\u6BB5 ${x+1} \u7C7B\u578B`,className:"sm:w-[10rem]",children:Qt(Te,{})}),Qt(Se,{children:FC.map(N=>Qt(ve,{value:N.value,children:N.label},N.value))})]}),Ds("label",{className:"flex items-center gap-1.5 text-sm",children:[Qt(ja,{checked:!!f.required,onCheckedChange:N=>d(f.id,{required:N===!0}),"aria-label":`\u5B57\u6BB5 ${x+1} \u5FC5\u586B`}),Qt("span",{className:"text-muted-foreground",children:"\u5FC5\u586B"})]}),Qt(B,{variant:"secondary",children:v})]}),Ds("div",{className:"flex items-center gap-1",children:[Qt(C,{type:"button",variant:"ghost",size:"icon-sm",disabled:x===0,onClick:()=>u(x,-1),"aria-label":`\u4E0A\u79FB\u5B57\u6BB5 ${x+1}`,children:Qt(Zi,{})}),Qt(C,{type:"button",variant:"ghost",size:"icon-sm",disabled:x===r.length-1,onClick:()=>u(x,1),"aria-label":`\u4E0B\u79FB\u5B57\u6BB5 ${x+1}`,children:Qt(re,{})}),Qt(C,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>m(f.id),"aria-label":`\u5220\u9664\u5B57\u6BB5 ${x+1}`,children:Qt(ye,{})})]})]},f.id)})}),Ds("p",{className:"text-xs text-muted-foreground",children:["\u5171 ",r.length," \u4E2A\u5B57\u6BB5\u3002"]})]})]})})}import*as Db from"react";import{jsx as Ta,jsxs as Rp}from"react/jsx-runtime";function I2(e){let t=e;return Array.isArray(t)?t:t&&typeof t=="object"&&Array.isArray(t.fields)?t.fields:[]}function aie({schema:e,value:t={},onChange:a,className:r}){let o=I2(e),[n,i]=Db.useState(t);Db.useEffect(()=>{i(d=>JSON.stringify(d)===JSON.stringify(t)?d:t)},[t]);let c=(d,m)=>{let u={...n,[d]:m};i(u),a?.(u)},s=d=>{d.preventDefault(),a?.(n)};return Ta("div",{"data-slot":"form-designer-runtime",className:l("w-full",r),children:Rp(Y,{children:[Ta(le,{children:Ta(ie,{children:"\u8868\u5355\u586B\u5199"})}),Rp("form",{onSubmit:s,children:[Ta(J,{className:"flex flex-col gap-4",children:o.length===0?Ta("p",{className:"text-muted-foreground py-6 text-center text-sm",children:"\u6682\u65E0\u53EF\u586B\u5199\u7684\u5B57\u6BB5\u3002"}):Ta("ul",{role:"list",className:"flex flex-col gap-4",children:o.map(d=>{let m=n[d.id],u=()=>{switch(d.type){case"textarea":return Ta(St,{value:m??"",placeholder:d.placeholder,"aria-label":d.label,onChange:p=>c(d.id,p.target.value)});case"number":return Ta(T,{type:"number",value:m==null?"":String(m),placeholder:d.placeholder,"aria-label":d.label,onChange:p=>{let f=p.target.value;c(d.id,f===""?"":Number(f))}});case"checkbox":return Ta(ja,{checked:m===!0,"aria-label":d.label,onCheckedChange:p=>c(d.id,p===!0)});case"select":return Rp(Pe,{value:m??"",onValueChange:p=>c(d.id,p),children:[Ta(Re,{"aria-label":d.label,children:Ta(Te,{placeholder:d.placeholder??"\u8BF7\u9009\u62E9"})}),Ta(Se,{children:(d.options??[]).map(p=>Ta(ve,{value:p.value,children:p.label},p.value))})]});case"date":return Ta(T,{type:"date",value:m??"","aria-label":d.label,onChange:p=>c(d.id,p.target.value)});default:return Ta(T,{type:"text",value:m??"",placeholder:d.placeholder,"aria-label":d.label,onChange:p=>c(d.id,p.target.value)})}};return Rp("li",{className:"flex flex-col gap-1.5",children:[Rp(ue,{htmlFor:d.id,children:[d.label,d.required?Ta("span",{className:"text-destructive ml-0.5",children:"*"}):null]}),Ta("div",{id:d.id,children:u()})]},d.id)})})}),Ta(ho,{children:Ta(C,{type:"submit",children:"\u63D0\u4EA4"})})]})]})})}import*as Ms from"react";import{jsx as at,jsxs as co}from"react/jsx-runtime";var $C=[{value:"start",label:"\u5F00\u59CB"},{value:"approval",label:"\u5BA1\u6279"},{value:"condition",label:"\u6761\u4EF6"},{value:"task",label:"\u4EFB\u52A1"},{value:"end",label:"\u7ED3\u675F"}];function uie({nodes:e=[],edges:t=[],onChange:a,className:r}){let[o,n]=Ms.useState(e),[i,c]=Ms.useState(t),[s,d]=Ms.useState(""),[m,u]=Ms.useState("");Ms.useEffect(()=>{n(e)},[e]),Ms.useEffect(()=>{c(t)},[t]);let p=Ms.useCallback((g,y)=>{n(g),c(y),a?.({nodes:g,edges:y})},[a]),f=()=>{let g={id:`node-${Date.now()}`,type:"task",name:`\u8282\u70B9 ${o.length+1}`};p([...o,g],i)},x=(g,y)=>{p(o.map(k=>k.id===g?{...k,...y}:k),i)},v=g=>{p(o.filter(y=>y.id!==g),i.filter(y=>y.from!==g&&y.to!==g))},N=()=>{!s||!m||s===m||(p(o,[...i,{from:s,to:m}]),d(""),u(""))},h=g=>{p(o,i.filter((y,k)=>k!==g))},b=g=>o.find(y=>y.id===g)?.name??g;return at("div",{"data-slot":"workflow-designer",className:l("flex flex-col gap-4",r),children:co(Y,{children:[at(le,{children:co(ie,{className:"flex items-center gap-2",children:[at(Gs,{className:"size-4","aria-hidden":!0}),"\u5DE5\u4F5C\u6D41\u8BBE\u8BA1\u5668"]})}),co(J,{className:"flex flex-col gap-4",children:[o.length===0?at("p",{className:"py-6 text-center text-sm text-muted-foreground",children:"\u6682\u65E0\u8282\u70B9\uFF0C\u8BF7\u65B0\u589E\u8282\u70B9\u3002"}):at("ul",{role:"list",className:"grid gap-2 sm:grid-cols-2 lg:grid-cols-3",children:o.map(g=>{let y=$C.find(k=>k.value===g.type)?.label??g.type;return co("li",{className:"flex flex-col gap-2 rounded-md border p-2",children:[co("div",{className:"flex items-center justify-between",children:[at(B,{variant:"secondary",children:y}),at(C,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>v(g.id),"aria-label":`\u5220\u9664\u8282\u70B9 ${g.name}`,children:at(ye,{})})]}),at(T,{type:"text",value:g.name,"aria-label":`\u8282\u70B9 ${g.id} \u540D\u79F0`,onChange:k=>x(g.id,{name:k.target.value})}),co(Pe,{value:g.type,onValueChange:k=>{typeof k=="string"&&x(g.id,{type:k})},children:[at(Re,{"aria-label":`\u8282\u70B9 ${g.id} \u7C7B\u578B`,children:at(Te,{})}),at(Se,{children:$C.map(k=>at(ve,{value:k.value,children:k.label},k.value))})]})]},g.id)})}),at("div",{children:co(C,{type:"button",onClick:f,children:[at(ge,{}),"\u65B0\u589E\u8282\u70B9"]})}),co("div",{className:"rounded-md border p-2",children:[at("p",{className:"mb-2 text-sm font-medium",children:"\u8FDE\u7EBF"}),co("div",{className:"flex flex-wrap items-center gap-2",children:[co(Pe,{value:s,onValueChange:g=>{typeof g=="string"&&d(g)},children:[at(Re,{"aria-label":"\u8D77\u70B9\u8282\u70B9",className:"w-[10rem]",children:at(Te,{placeholder:"\u8D77\u70B9"})}),at(Se,{children:o.map(g=>at(ve,{value:g.id,children:g.name},g.id))})]}),at("span",{className:"text-muted-foreground",children:"\u2192"}),co(Pe,{value:m,onValueChange:g=>{typeof g=="string"&&u(g)},children:[at(Re,{"aria-label":"\u7EC8\u70B9\u8282\u70B9",className:"w-[10rem]",children:at(Te,{placeholder:"\u7EC8\u70B9"})}),at(Se,{children:o.map(g=>at(ve,{value:g.id,children:g.name},g.id))})]}),co(C,{type:"button",onClick:N,disabled:!s||!m,"aria-label":"\u65B0\u589E\u8FDE\u7EBF",children:[at(ge,{}),"\u8FDE\u7EBF"]})]}),i.length===0?at("p",{className:"mt-2 text-xs text-muted-foreground",children:"\u6682\u65E0\u8FDE\u7EBF\u3002"}):at("ul",{role:"list",className:"mt-2 flex flex-col gap-1",children:i.map((g,y)=>co("li",{className:"flex items-center gap-2 text-sm",children:[at("span",{className:"text-foreground",children:b(g.from)}),at("span",{className:"text-muted-foreground",children:"\u2192"}),at("span",{className:"text-foreground",children:b(g.to)}),at(C,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>h(y),"aria-label":`\u5220\u9664\u8FDE\u7EBF ${y+1}`,className:"ml-auto",children:at(ye,{})})]},`${g.from}-${g.to}-${y}`))})]}),co("p",{className:"text-xs text-muted-foreground",children:["\u5171 ",o.length," \u4E2A\u8282\u70B9\uFF0C",i.length," \u6761\u8FDE\u7EBF\u3002"]})]})]})})}import"react";import{jsx as er,jsxs as nc}from"react/jsx-runtime";var D2={done:{label:"\u5DF2\u5B8C\u6210",icon:er(qe,{className:"size-4 text-emerald-500","aria-hidden":!0}),tone:"border-emerald-200 bg-emerald-50"},active:{label:"\u8FDB\u884C\u4E2D",icon:er(pe,{className:"size-4 text-blue-500","aria-hidden":!0}),tone:"border-blue-200 bg-blue-50"},pending:{label:"\u5F85\u5904\u7406",icon:er(vo,{className:"size-4 text-muted-foreground","aria-hidden":!0}),tone:"border-border bg-muted/30"},rejected:{label:"\u5DF2\u9A73\u56DE",icon:er(rn,{className:"size-4 text-destructive","aria-hidden":!0}),tone:"border-destructive/30 bg-destructive/5"}};function HC(e){return D2[e??"pending"]??{label:e??"\u672A\u77E5",icon:er(vo,{className:"size-4 text-muted-foreground","aria-hidden":!0}),tone:"border-border bg-muted/30"}}function yie({nodes:e=[],edges:t=[],className:a}){let r=new Map;for(let i of t){let c=r.get(i.from)??[];c.push(i.to),r.set(i.from,c)}let o=i=>e.find(c=>c.id===i)?.name??i,n=e.reduce((i,c)=>{let s=c.status??"pending";return i[s]=(i[s]??0)+1,i},{});return er("div",{"data-slot":"workflow-preview",className:l("flex flex-col gap-4",a),children:nc(Y,{children:[er(le,{children:er(ie,{children:"\u5DE5\u4F5C\u6D41\u9884\u89C8"})}),nc(J,{className:"flex flex-col gap-4",children:[er("div",{className:"flex flex-wrap gap-2 text-sm",children:Object.entries(n).map(([i,c])=>{let s=HC(i);return nc(B,{variant:"outline",className:"gap-1.5",children:[s.icon,s.label,"\uFF1A",c]},i)})}),e.length===0?er("p",{className:"py-6 text-center text-sm text-muted-foreground",children:"\u6682\u65E0\u8282\u70B9\u3002"}):er("ol",{role:"list",className:"flex flex-col gap-2",children:e.map((i,c)=>{let s=HC(i.status),d=r.get(i.id)??[];return nc("li",{className:"flex flex-col gap-2",children:[nc("div",{className:l("flex items-center gap-2 rounded-md border p-3",s.tone),children:[er("span",{className:"flex size-6 shrink-0 items-center justify-center rounded-full bg-background text-xs font-medium tabular-nums","aria-hidden":!0,children:c+1}),s.icon,er("span",{className:"font-medium",children:i.name}),er(B,{variant:"secondary",className:"ml-auto",children:s.label})]}),d.length>0?er("ul",{role:"list",className:"ml-6 flex flex-col gap-1 border-l pl-4",children:d.map((m,u)=>nc("li",{className:"flex items-center gap-1.5 text-sm text-muted-foreground",children:[er(_a,{className:"size-3.5","aria-hidden":!0}),er("span",{children:o(m)})]},`${m}-${u}`))}):null]},i.id)})}),nc("p",{className:"text-xs text-muted-foreground",children:["\u5171 ",e.length," \u4E2A\u8282\u70B9\uFF0C",t.length," \u6761\u8FDE\u7EBF\u3002"]})]})]})})}import*as Hm from"react";import{jsx as Ra,jsxs as Ei}from"react/jsx-runtime";var VC=[{value:"==",label:"\u7B49\u4E8E"},{value:"!=",label:"\u4E0D\u7B49\u4E8E"},{value:">",label:"\u5927\u4E8E"},{value:">=",label:"\u5927\u4E8E\u7B49\u4E8E"},{value:"<",label:"\u5C0F\u4E8E"},{value:"<=",label:"\u5C0F\u4E8E\u7B49\u4E8E"},{value:"contains",label:"\u5305\u542B"},{value:"in",label:"\u5C5E\u4E8E"}],OC=[{value:"approve",label:"\u901A\u8FC7"},{value:"reject",label:"\u9A73\u56DE"},{value:"notify",label:"\u901A\u77E5"},{value:"escalate",label:"\u4E0A\u62A5"},{value:"skip",label:"\u8DF3\u8FC7"}];function Die({rules:e=[],onChange:t,className:a}){let[r,o]=Hm.useState(e);Hm.useEffect(()=>{o(e)},[e]);let n=Hm.useCallback(d=>{o(d),t?.(d)},[t]),i=()=>{let d={id:`rule-${Date.now()}`,field:"",operator:"==",value:"",action:"approve"};n([...r,d])},c=(d,m)=>{n(r.map(u=>u.id===d?{...u,...m}:u))},s=d=>{n(r.filter(m=>m.id!==d))};return Ra("div",{"data-slot":"rule-editor",className:l("flex flex-col gap-4",a),children:Ei(Y,{children:[Ra(le,{children:Ei(ie,{className:"flex items-center gap-2",children:[Ra(Dg,{className:"size-4","aria-hidden":!0}),"\u89C4\u5219\u7F16\u8F91\u5668"]})}),Ei(J,{className:"flex flex-col gap-4",children:[r.length===0?Ra("p",{className:"py-6 text-center text-sm text-muted-foreground",children:"\u6682\u65E0\u89C4\u5219\uFF0C\u8BF7\u70B9\u51FB\u65B0\u589E\u3002"}):Ra("ul",{role:"list",className:"flex flex-col gap-2",children:r.map((d,m)=>{let u=VC.find(f=>f.value===d.operator)?.label??d.operator,p=OC.find(f=>f.value===d.action)?.label??d.action;return Ei("li",{className:"flex flex-col gap-2 rounded-md border p-2 sm:flex-row sm:items-center",children:[Ei(B,{variant:"outline",className:"shrink-0",children:["#",m+1]}),Ra(T,{type:"text",value:d.field,placeholder:"\u5B57\u6BB5\u540D","aria-label":`\u89C4\u5219 ${m+1} \u5B57\u6BB5`,className:"sm:max-w-[10rem]",onChange:f=>c(d.id,{field:f.target.value})}),Ei(Pe,{value:d.operator,onValueChange:f=>{typeof f=="string"&&c(d.id,{operator:f})},children:[Ra(Re,{"aria-label":`\u89C4\u5219 ${m+1} \u64CD\u4F5C\u7B26`,className:"sm:w-[8rem]",children:Ra(Te,{children:u})}),Ra(Se,{children:VC.map(f=>Ra(ve,{value:f.value,children:f.label},f.value))})]}),Ra(T,{type:"text",value:d.value===void 0||d.value===null?"":String(d.value),placeholder:"\u6BD4\u8F83\u503C","aria-label":`\u89C4\u5219 ${m+1} \u503C`,className:"sm:max-w-[10rem]",onChange:f=>c(d.id,{value:f.target.value})}),Ei(Pe,{value:d.action,onValueChange:f=>{typeof f=="string"&&c(d.id,{action:f})},children:[Ra(Re,{"aria-label":`\u89C4\u5219 ${m+1} \u52A8\u4F5C`,className:"sm:w-[8rem]",children:Ra(Te,{children:p})}),Ra(Se,{children:OC.map(f=>Ra(ve,{value:f.value,children:f.label},f.value))})]}),Ra(C,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>s(d.id),"aria-label":`\u5220\u9664\u89C4\u5219 ${m+1}`,className:"sm:ml-auto",children:Ra(ye,{})})]},d.id)})}),Ra("div",{children:Ei(C,{type:"button",onClick:i,children:[Ra(ge,{}),"\u65B0\u589E\u89C4\u5219"]})}),Ei("p",{className:"text-xs text-muted-foreground",children:["\u5171 ",r.length," \u6761\u89C4\u5219\u3002"]})]})]})})}import"react";import{jsx as Sp,jsxs as UC}from"react/jsx-runtime";function Eie({title:e,onBack:t,children:a,className:r}){return UC("div",{"data-slot":"mobile-page-shell",className:l("flex h-full min-h-0 flex-col bg-background",r),children:[UC("header",{"data-slot":"mobile-page-shell-header",className:"relative flex h-12 shrink-0 items-center gap-2 border-b px-2",children:[t?Sp("button",{type:"button",onClick:t,"aria-label":"\u8FD4\u56DE",className:"inline-flex size-9 shrink-0 items-center justify-center rounded-md text-foreground hover:bg-muted",children:Sp(et,{className:"size-5"})}):null,Sp("h1",{className:"flex-1 truncate text-center text-base font-medium",children:e??""}),t?Sp("span",{className:"size-9 shrink-0","aria-hidden":"true"}):null]}),Sp("main",{"data-slot":"mobile-page-shell-body",className:"min-h-0 flex-1 overflow-y-auto",children:a??null})]})}import*as Om from"react";import{jsx as Vm,jsxs as WC}from"react/jsx-runtime";function Vie({open:e,onOpenChange:t,actions:a,className:r}){let o=Om.useId(),n=Om.useCallback(()=>t(!1),[t]);return Om.useEffect(()=>{if(!e)return;let i=c=>{c.key==="Escape"&&n()};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[e,n]),e?WC("div",{"data-slot":"mobile-action-sheet",role:"dialog","aria-modal":"true","aria-label":"\u64CD\u4F5C\u83DC\u5355",className:l("fixed inset-0 z-50 flex flex-col justify-end",r),children:[Vm("button",{type:"button","aria-label":"\u5173\u95ED",tabIndex:-1,onClick:n,className:"absolute inset-0 bg-black/40"}),WC("div",{role:"document",id:o,className:"relative m-2 mb-3 flex flex-col gap-1 rounded-xl bg-popover p-1 shadow-lg",children:[Vm("ul",{role:"menu",className:"flex flex-col",children:a.map(i=>Vm("li",{role:"none",children:Vm("button",{type:"button",role:"menuitem",onClick:()=>{i.onClick(),n()},className:l("h-11 w-full rounded-lg text-sm font-medium transition-colors hover:bg-muted",i.danger?"text-destructive":"text-foreground"),children:i.label})},i.label))}),Vm("div",{className:"my-1 h-px bg-border","aria-hidden":"true"}),Vm("button",{type:"button",role:"menuitem",onClick:n,className:"h-11 w-full rounded-lg text-sm font-medium text-foreground transition-colors hover:bg-muted",children:"\u53D6\u6D88"})]})]}):null}import*as Wm from"react";import{jsx as Um,jsxs as _C}from"react/jsx-runtime";function qie({options:e,value:t,onChange:a,className:r}){let o=t??e[0]?.value,n=Wm.useId(),i=Wm.useCallback(()=>{let s=e.findIndex(m=>m.value===o),d=document.getElementById(`${n}-opt-${s}`);d&&typeof d.scrollIntoView=="function"&&d.scrollIntoView({block:"nearest"})},[n,e,o]);Wm.useEffect(()=>{i()},[i]);let c=s=>{let d=e.findIndex(u=>u.value===o),m=e[d+s];m&&a?.(m.value)};return _C("div",{"data-slot":"mobile-picker",className:l("relative h-48 overflow-y-auto rounded-md border bg-popover [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",r),role:"listbox","aria-label":"\u9009\u62E9\u5668",id:n,onKeyDown:s=>{s.key==="ArrowDown"?(s.preventDefault(),c(1)):s.key==="ArrowUp"&&(s.preventDefault(),c(-1))},tabIndex:0,children:[Um("div",{className:"pointer-events-none sticky top-0 z-10 h-[calc(50%-1.25rem)] bg-gradient-to-b from-popover to-transparent"}),Um("ul",{className:"flex flex-col",children:e.map((s,d)=>{let m=s.value===o;return Um("li",{id:`${n}-opt-${d}`,role:"option","aria-selected":m,onClick:()=>a?.(s.value),className:l("flex h-10 cursor-pointer items-center justify-center text-sm transition-colors",m?"font-medium text-primary":"text-muted-foreground hover:text-foreground"),children:m?_C("span",{className:"flex items-center gap-1.5",children:[Um(U,{className:"size-4","aria-hidden":"true"}),s.label]}):s.label},s.value)})}),Um("div",{className:"pointer-events-none sticky bottom-0 z-10 h-[calc(50%-1.25rem)] bg-gradient-to-t from-popover to-transparent"}),Um("div",{className:"pointer-events-none absolute inset-x-0 top-1/2 z-0 h-10 -translate-y-1/2 border-y bg-accent/40","aria-hidden":"true"})]})}import*as Bs from"react";import{jsx as sc,jsxs as Mb}from"react/jsx-runtime";function Xie({onCapture:e,className:t}){let a=Bs.useRef(null),r=Bs.useRef(null),[o,n]=Bs.useState("idle"),i=Bs.useCallback(()=>{r.current?.getTracks().forEach(d=>d.stop()),r.current=null},[]),c=Bs.useCallback(async()=>{if(typeof navigator>"u"||!navigator.mediaDevices?.getUserMedia){n("unsupported");return}n("starting");try{let d=await navigator.mediaDevices.getUserMedia({video:{facingMode:"environment"},audio:!1});r.current=d,a.current&&(a.current.srcObject=d,await a.current.play().catch(()=>{})),n("live")}catch{n("denied")}},[]);Bs.useEffect(()=>(c(),i),[c,i]);let s=()=>{let d=a.current;if(!d||o!=="live")return;let m=document.createElement("canvas");m.width=d.videoWidth||640,m.height=d.videoHeight||480;let u=m.getContext("2d");u&&(u.drawImage(d,0,0,m.width,m.height),m.toBlob(p=>{p&&e?.(p)},"image/jpeg",.9))};return Mb("div",{"data-slot":"mobile-camera",className:l("relative flex flex-col overflow-hidden rounded-lg bg-black",t),children:[Mb("div",{className:"relative aspect-[3/4] w-full bg-black",children:[sc("video",{ref:a,playsInline:!0,muted:!0,className:"h-full w-full object-cover","data-slot":"mobile-camera-video"}),o!=="live"?Mb("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-2 p-4 text-center text-sm text-white/80",children:[sc(Pg,{className:"size-8","aria-hidden":"true"}),sc("span",{children:o==="starting"?"\u6B63\u5728\u542F\u52A8\u6444\u50CF\u5934\u2026":o==="denied"?"\u6444\u50CF\u5934\u8BBF\u95EE\u88AB\u62D2\u7EDD":o==="unsupported"?"\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u6444\u50CF\u5934":"\u70B9\u51FB\u4E0B\u65B9\u6309\u94AE\u5F00\u542F\u6444\u50CF\u5934"})]}):null]}),sc("div",{className:"flex items-center justify-center gap-4 bg-black/80 p-3",children:o==="live"?sc("button",{type:"button",onClick:s,"aria-label":"\u62CD\u7167",className:"inline-flex h-12 w-12 items-center justify-center rounded-full border-4 border-white bg-white/30 ring-2 ring-white transition-transform active:scale-95",children:sc("span",{className:"size-7 rounded-full bg-white"})}):Mb("button",{type:"button",onClick:c,className:"inline-flex items-center gap-2 rounded-full bg-white/10 px-4 py-2 text-sm text-white hover:bg-white/20",children:[sc(ia,{className:"size-4","aria-hidden":"true"}),"\u91CD\u8BD5"]})})]})}import*as qo from"react";import{jsx as Fi,jsxs as Ip}from"react/jsx-runtime";function tle({onScan:e,className:t}){let a=qo.useRef(null),r=qo.useRef(null),o=qo.useRef(null),[n,i]=qo.useState("idle"),[c,s]=qo.useState(""),d=qo.useCallback(()=>{o.current!=null&&cancelAnimationFrame(o.current),o.current=null,r.current?.getTracks().forEach(p=>p.stop()),r.current=null},[]),m=qo.useCallback(async()=>{if(!(typeof navigator<"u"&&!!navigator.mediaDevices?.getUserMedia&&typeof window<"u"&&typeof window.BarcodeDetector=="function")){i("unsupported");return}i("starting");try{let f=await navigator.mediaDevices.getUserMedia({video:{facingMode:"environment"},audio:!1});r.current=f,a.current&&(a.current.srcObject=f,await a.current.play().catch(()=>{})),i("scanning")}catch{i("denied")}},[]);qo.useEffect(()=>(m(),d),[m,d]),qo.useEffect(()=>{if(n!=="scanning")return;let p=new window.BarcodeDetector({formats:["qr_code"]}),f=document.createElement("canvas"),x=async()=>{let v=a.current;if(!v||v.readyState<2){o.current=requestAnimationFrame(x);return}try{let h=(await p.detect(v))[0];if(h&&h.rawValue){e?.(h.rawValue);return}}catch{}o.current=requestAnimationFrame(x)};return o.current=requestAnimationFrame(x),()=>{o.current!=null&&cancelAnimationFrame(o.current)}},[n,e]);let u=()=>{let p=c.trim();p&&e?.(p)};return Ip("div",{"data-slot":"mobile-qrcode-scanner",className:l("relative flex flex-col overflow-hidden rounded-lg bg-black",t),children:[Ip("div",{className:"relative aspect-square w-full bg-black",children:[Fi("video",{ref:a,playsInline:!0,muted:!0,className:"h-full w-full object-cover","data-slot":"mobile-qrcode-scanner-video"}),n==="scanning"?Fi("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:Fi("div",{className:"size-2/3 rounded-lg border-2 border-white/80 shadow-[0_0_0_9999px_rgba(0,0,0,0.4)]"})}):null,n!=="scanning"?Ip("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-2 p-4 text-center text-sm text-white/80",children:[Fi(Kh,{className:"size-8","aria-hidden":"true"}),Fi("span",{children:n==="starting"?"\u6B63\u5728\u542F\u52A8\u626B\u63CF\u2026":n==="denied"?"\u6444\u50CF\u5934\u8BBF\u95EE\u88AB\u62D2\u7EDD":n==="unsupported"?"\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u626B\u7801\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165":"\u70B9\u51FB\u4E0B\u65B9\u6309\u94AE\u5F00\u542F\u626B\u63CF"})]}):null]}),Ip("div",{className:"flex flex-col gap-2 bg-black/80 p-3",children:[n!=="scanning"?Fi("button",{type:"button",onClick:m,className:"self-center rounded-full bg-white/10 px-4 py-2 text-sm text-white hover:bg-white/20",children:"\u91CD\u65B0\u626B\u63CF"}):null,Ip("form",{className:"flex gap-2",onSubmit:p=>{p.preventDefault(),u()},children:[Fi("label",{className:"sr-only",htmlFor:"qr-manual-input",children:"\u624B\u52A8\u8F93\u5165\u4E8C\u7EF4\u7801\u5185\u5BB9"}),Fi("input",{id:"qr-manual-input",type:"text",value:c,onChange:p=>s(p.target.value),placeholder:"\u624B\u52A8\u8F93\u5165\u4E8C\u7EF4\u7801\u5185\u5BB9",className:"min-w-0 flex-1 rounded-md border border-white/20 bg-white/5 px-3 py-2 text-sm text-white placeholder:text-white/40"}),Fi("button",{type:"submit",className:"shrink-0 rounded-md bg-white px-3 py-2 text-sm font-medium text-black",children:"\u786E\u8BA4"})]})]})]})}import*as Ls from"react";import{jsx as _m,jsxs as qm}from"react/jsx-runtime";function qC(e,t){let a=t.getBoundingClientRect();return{x:(e.clientX-a.left)/a.width*t.width,y:(e.clientY-a.top)/a.height*t.height}}function sle({onSave:e,className:t}){let a=Ls.useRef(null),r=Ls.useRef(!1),o=Ls.useRef(null),[n,i]=Ls.useState(!1),c=Ls.useCallback(()=>{let x=a.current;if(!x)return;let v=x.getContext("2d");if(!v)return;let N=typeof window<"u"&&window.devicePixelRatio||1,h=x.getBoundingClientRect(),b=Math.max(1,Math.round(h.width*N)),g=Math.max(1,Math.round(h.height*N));if(x.width!==b||x.height!==g){let y=document.createElement("canvas");y.width=x.width,y.height=x.height;let k=y.getContext("2d");k&&k.drawImage(x,0,0),x.width=b,x.height=g,v.drawImage(y,0,0,x.width,x.height),v.lineJoin="round",v.lineCap="round",v.lineWidth=2*N,v.strokeStyle="currentColor"}},[]);Ls.useEffect(()=>{c()},[c]);let s=(x,v)=>{let N=a.current,h=N?.getContext("2d");!N||!h||(h.beginPath(),h.moveTo(x.x,x.y),h.lineTo(v.x,v.y),h.stroke())},d=x=>{let v=a.current;v&&(v.setPointerCapture(x.pointerId),r.current=!0,o.current=qC(x,v),i(!0))},m=x=>{let v=a.current;if(!v||!r.current||!o.current)return;let N=qC(x,v);s(o.current,N),o.current=N},u=x=>{let v=a.current;if(v)try{v.releasePointerCapture(x.pointerId)}catch{}r.current=!1,o.current=null},p=()=>{let x=a.current,v=x?.getContext("2d");!x||!v||(v.clearRect(0,0,x.width,x.height),i(!1))},f=()=>{let x=a.current;!x||!n||x.toBlob(v=>{v&&e?.(v)},"image/png")};return qm("div",{"data-slot":"mobile-signature",className:l("flex flex-col gap-2 text-foreground",t),children:[qm("div",{className:"relative h-40 w-full overflow-hidden rounded-lg border bg-background",children:[_m("canvas",{ref:a,"data-slot":"mobile-signature-canvas",onPointerDown:d,onPointerMove:m,onPointerUp:u,onPointerCancel:u,className:"h-full w-full touch-none",role:"img","aria-label":"\u7B7E\u540D\u753B\u677F"}),n?null:qm("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center gap-2 text-sm text-muted-foreground",children:[_m(nu,{className:"size-5","aria-hidden":"true"}),_m("span",{children:"\u8BF7\u5728\u6B64\u5904\u7B7E\u540D"})]}),_m("div",{className:"pointer-events-none absolute inset-x-0 bottom-3 border-b border-dashed border-border","aria-hidden":"true"})]}),qm("div",{className:"flex justify-end gap-2",children:[qm("button",{type:"button",onClick:p,className:"inline-flex items-center gap-1.5 rounded-md border px-3 py-1.5 text-sm hover:bg-muted",children:[_m(ye,{className:"size-4","aria-hidden":"true"}),"\u6E05\u9664"]}),qm("button",{type:"button",onClick:f,disabled:!n,className:"inline-flex items-center gap-1.5 rounded-md bg-primary px-3 py-1.5 text-sm font-medium text-primary-foreground disabled:opacity-50",children:[_m(nu,{className:"size-4","aria-hidden":"true"}),"\u4FDD\u5B58"]})]})]})}import*as jm from"react";import{jsx as Xl,jsxs as Gm}from"react/jsx-runtime";function GC(e,t){let a=t==="lat"?e>=0?"N":"S":e>=0?"E":"W";return`${Math.abs(e).toFixed(6)}\xB0 ${a}`}function mle({onLocate:e,className:t}){let[a,r]=jm.useState("idle"),[o,n]=jm.useState(null),[i,c]=jm.useState(""),s=jm.useCallback(()=>{if(typeof navigator>"u"||!navigator.geolocation){r("unsupported"),c("\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u5B9A\u4F4D");return}r("locating"),c(""),navigator.geolocation.getCurrentPosition(m=>{let u={lat:m.coords.latitude,lng:m.coords.longitude};n(u),r("success"),e?.(u)},m=>{r("denied"),c(m.code===m.PERMISSION_DENIED?"\u5B9A\u4F4D\u6743\u9650\u88AB\u62D2\u7EDD":m.code===m.POSITION_UNAVAILABLE?"\u65E0\u6CD5\u83B7\u53D6\u4F4D\u7F6E\u4FE1\u606F":"\u5B9A\u4F4D\u8D85\u65F6")},{enableHighAccuracy:!0,timeout:1e4,maximumAge:0})},[e]),d=a==="locating"?"\u6B63\u5728\u5B9A\u4F4D\u2026":a==="success"?"\u5B9A\u4F4D\u6210\u529F":a==="denied"||a==="unsupported"?i||"\u5B9A\u4F4D\u5931\u8D25":"\u70B9\u51FB\u6309\u94AE\u83B7\u53D6\u5F53\u524D\u4F4D\u7F6E";return Gm("div",{"data-slot":"mobile-geolocation",className:l("flex flex-col gap-3 rounded-lg border bg-card p-4",t),children:[Gm("div",{className:"flex items-center gap-2 text-sm",children:[Xl(on,{className:"size-4 text-primary","aria-hidden":"true"}),Xl("span",{className:"flex-1 text-muted-foreground",children:d}),Gm("button",{type:"button",onClick:s,disabled:a==="locating",className:"inline-flex items-center gap-1.5 rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground disabled:opacity-50",children:[Xl(ia,{className:l("size-3.5",a==="locating"&&"animate-spin"),"aria-hidden":"true"}),o?"\u91CD\u65B0\u5B9A\u4F4D":"\u83B7\u53D6\u5B9A\u4F4D"]})]}),o?Gm("dl",{className:"grid grid-cols-2 gap-2 text-sm",children:[Gm("div",{className:"rounded-md bg-muted/50 p-2",children:[Xl("dt",{className:"text-xs text-muted-foreground",children:"\u7EAC\u5EA6"}),Xl("dd",{className:"tabular-nums",children:GC(o.lat,"lat")})]}),Gm("div",{className:"rounded-md bg-muted/50 p-2",children:[Xl("dt",{className:"text-xs text-muted-foreground",children:"\u7ECF\u5EA6"}),Xl("dd",{className:"tabular-nums",children:GC(o.lng,"lng")})]})]}):Xl("div",{className:"flex h-24 items-center justify-center rounded-md border border-dashed text-xs text-muted-foreground",role:"presentation",children:"\u6682\u65E0\u4F4D\u7F6E\u6570\u636E"})]})}import*as Bb from"react";import{Fragment as M2,jsx as Dp,jsxs as jC}from"react/jsx-runtime";function ble({onLoadMore:e,hasMore:t=!0,loading:a=!1,children:r,className:o}){let n=Bb.useRef(null);return Bb.useEffect(()=>{let i=n.current;if(!i||!t||a||typeof IntersectionObserver>"u")return;let c=new IntersectionObserver(s=>{for(let d of s)d.isIntersecting&&!a&&t&&e?.()},{rootMargin:"200px 0px"});return c.observe(i),()=>c.disconnect()},[t,a,e]),jC("div",{"data-slot":"mobile-infinite-scroll",className:l("flex flex-col",o),children:[r,Dp("div",{ref:n,className:"flex items-center justify-center gap-2 py-3 text-xs text-muted-foreground","aria-live":"polite",children:a?jC(M2,{children:[Dp(Pr,{className:"size-3.5 animate-spin","aria-hidden":"true"}),Dp("span",{children:"\u52A0\u8F7D\u4E2D\u2026"})]}):t?Dp("span",{children:"\u4E0A\u62C9\u52A0\u8F7D\u66F4\u591A"}):Dp("span",{children:"\u6CA1\u6709\u66F4\u591A\u4E86"})})]})}import*as KC from"react";import{jsx as Mp,jsxs as B2}from"react/jsx-runtime";function yle({tabs:e,activeId:t,onSelect:a,className:r}){let o=t??e[0]?.id,n=KC.useId();return Mp("nav",{"data-slot":"mobile-tab-bar","aria-label":"\u4E3B\u5BFC\u822A",className:l("grid h-14 shrink-0 grid-flow-col auto-cols-fr border-t bg-background",r),children:Mp("ul",{role:"tablist","aria-orientation":"horizontal",className:"contents",id:n,children:e.map(i=>{let c=i.id===o,s=`${n}-tab-${i.id}`,d=`${n}-panel-${i.id}`;return Mp("li",{role:"none",className:"min-w-0",children:B2("button",{type:"button",role:"tab",id:s,"aria-selected":c,"aria-controls":d,tabIndex:c?0:-1,onClick:()=>a?.(i.id),onKeyDown:m=>{if(m.key==="ArrowRight"||m.key==="ArrowLeft"){m.preventDefault();let u=m.key==="ArrowRight"?1:-1,p=e.findIndex(x=>x.id===o),f=e[(p+u+e.length)%e.length];f&&a?.(f.id)}},className:l("flex h-full w-full flex-col items-center justify-center gap-0.5 text-[0.7rem] transition-colors",c?"text-primary":"text-muted-foreground hover:text-foreground"),children:[i.icon?Mp("span",{className:"[&>svg]:size-5","aria-hidden":"true",children:i.icon}):null,Mp("span",{className:"truncate leading-none",children:i.label})]})},i.id)})})})}import"react";import{jsx as Lb,jsxs as QC}from"react/jsx-runtime";function Tle({title:e,subtitle:t,trailing:a,onClick:r,className:o}){let n=typeof r=="function";return QC("div",{"data-slot":"mobile-list-item",role:n?"button":void 0,tabIndex:n?0:void 0,onClick:r,onKeyDown:c=>{n&&(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),r?.())},"aria-label":n?e:void 0,className:l("flex min-h-12 items-center gap-3 px-4 py-2 text-sm",n&&"cursor-pointer hover:bg-muted focus-visible:bg-muted focus-visible:outline-none",o),children:[QC("div",{className:"min-w-0 flex-1",children:[Lb("div",{className:"truncate font-medium",children:e}),t?Lb("div",{className:"truncate text-xs text-muted-foreground",children:t}):null]}),a?Lb("div",{className:"shrink-0 text-muted-foreground",children:a}):null,n?Lb(me,{className:"size-4 shrink-0 text-muted-foreground","aria-hidden":"true"}):null]})}import*as $t from"react";import{useReactTable as L2,getCoreRowModel as z2,flexRender as A2}from"@tanstack/react-table";import{jsx as vt,jsxs as Km}from"react/jsx-runtime";function E2({checked:e,indeterminate:t,onChange:a,className:r}){let o=$t.useRef(null);return $t.useEffect(()=>{o.current&&(o.current.indeterminate=t)},[t]),vt("input",{ref:o,type:"checkbox","data-slot":"tree-table-checkbox",checked:e,onChange:n=>a(n.target.checked),className:l("size-4 shrink-0 cursor-pointer rounded border border-input accent-primary",r)})}function XC(e,t,a,r,o=0,n=[]){let i=[];for(let c of e){let s=c[t],d=c[a],m=Array.isArray(d)&&d.length>0,u=r.has(s),p=m?d.map(f=>f[t]):[];i.push({row:c,key:s,depth:o,hasChildren:m,isExpanded:u,isLeaf:!m,ancestors:[...n],childKeys:p}),m&&u&&i.push(...XC(d,t,a,r,o+1,[...n,s]))}return i}function nh(e,t,a){let r=e[a];if(!Array.isArray(r)||r.length===0)return[];let o=[];for(let n of r){let i=n[t];o.push(i),o.push(...nh(n,t,a))}return o}function YC(e,t,a,r){let o=e[a];if(!Array.isArray(o)||o.length===0)return 0;let n=e[t];if(!r.has(n))return 0;let i=o.length;for(let c of o)i+=YC(c,t,a,r);return i}function sh(e,t,a,r){for(let o of e){if(o[a]===t)return o;let i=o[r];if(Array.isArray(i)&&i.length>0){let c=sh(i,t,a,r);if(c)return c}}}function JC(e,t,a,r,o){return e.map(n=>{if(n[r]===t)return{...n,[o]:a};let c=n[o];return Array.isArray(c)&&c.length>0?{...n,[o]:JC(c,t,a,r,o)}:n})}function ZC(e,t,a,r){return[...e].sort((n,i)=>{let c=n[t],s=i[t];if(c==null&&s==null)return 0;if(c==null)return 1;if(s==null)return-1;let d=0;return typeof c=="number"&&typeof s=="number"?d=c-s:d=String(c).localeCompare(String(s)),a==="asc"?d:-d}).map(n=>{let i=n[r];return Array.isArray(i)&&i.length>0?{...n,[r]:ZC(i,t,a,r)}:n})}function Ale({columns:e,data:t,rowKey:a="id",childrenKey:r="children",parentKey:o,loading:n=!1,emptyText:i="No data",size:c="md",selectable:s="none",selectedKeys:d,onSelectionChange:m,defaultExpandedKeys:u,expandedKeys:p,onExpandedChange:f,onExpandRow:x,caption:v,striped:N=!1,className:h}){let b=$t.useMemo(()=>o?Bf(t,{idKey:a,parentKey:o,childrenKey:r}):t,[t,o,a,r]),[g,y]=$t.useState(b);$t.useEffect(()=>{y(b)},[b]);let[k,w]=$t.useState(()=>new Set(u??[])),R=$t.useMemo(()=>p?new Set(p):k,[p,k]),S=$t.useCallback(Z=>{p||w(Z),f?.(Array.from(Z))},[p,f]),[z,L]=$t.useState(new Set),H=$t.useRef(new Set),[M,$]=$t.useState([]),I=$t.useMemo(()=>{if(M.length===0)return g;let{id:Z,desc:V}=M[0];return ZC(g,Z,V?"desc":"asc",r)},[g,M,r]),A=$t.useMemo(()=>XC(I,a,r,R),[I,a,r,R]),O=$t.useMemo(()=>new Set(d??[]),[d]),G=$t.useMemo(()=>s!=="multiple"?null:A.map(Z=>{let V=sh(I,Z.key,a,r),te=V?nh(V,a,r):[],ae=V?YC(V,a,r,R):0,mt=te.filter(ft=>O.has(ft)).length,je=ae>0&&mt===ae,nt=mt>0&&mt<ae;return{...Z,allDescendants:te,isAllChecked:je,isIndeterminate:nt}}),[A,s,O,I,a,r,R]),Ce=$t.useMemo(()=>e.map(Z=>({id:Z.key,accessorKey:Z.key,header:Z.title,enableSorting:!!Z.sortable,cell:V=>{let te=V.getValue(),ae=V.row.original,mt=V.row.index;return Z.render?Z.render(te,ae,mt):te??"\u2014"}})),[e]),j=L2({data:I,columns:Ce,state:{sorting:M},onSortingChange:$,getCoreRowModel:z2(),enableSorting:!0,manualSorting:!0}),de=c==="sm"?"px-2 py-1.5":c==="lg"?"px-4 py-3":"px-3 py-2",F=s==="single"||s==="multiple",ce=e.length+(F?1:0),lt=$t.useCallback(async(Z,V)=>{let te=!!x,ae=V[r],mt=!Array.isArray(ae)||ae.length===0;if(te&&mt&&!H.current.has(Z)&&x){L(nt=>new Set(nt).add(Z));try{let nt=await x(V);H.current.add(Z),y(ea=>JC(ea,Z,nt,a,r));let ft=new Set(R);ft.add(Z),S(ft)}finally{L(nt=>{let ft=new Set(nt);return ft.delete(Z),ft})}}else{let nt=new Set(R);nt.has(Z)?nt.delete(Z):nt.add(Z),S(nt)}},[x,r,a,R,S]),ct=$t.useCallback((Z,V)=>{if(s==="none")return;if(s==="single"){let je=O.has(Z)?[]:[Z];m?.(je);return}let te=sh(I,Z,a,r),ae=te?nh(te,a,r):[];if(O.has(Z)){let je=new Set([Z,...ae]),nt=Array.from(O).filter(ft=>!je.has(ft));m?.(nt)}else{let je=new Set(O);je.add(Z);for(let nt of ae)je.add(nt);m?.(Array.from(je))}},[s,O,m,I,a,r]),kr=$t.useCallback(Z=>{$(V=>{let te=V.find(ae=>ae.id===Z);return te?te.desc?[]:[{id:Z,desc:!0}]:[{id:Z,desc:!1}]})},[]);return vt("div",{"data-slot":"tree-table",className:l("overflow-x-auto rounded-lg border border-border",h),children:Km(ze,{children:[v&&vt(Ox,{children:v}),vt(Ae,{children:j.getHeaderGroups().map(Z=>Km(W,{className:"bg-muted/30",children:[F&&vt(E,{className:l("w-10",de)}),Z.headers.map(V=>{let te=e.find(je=>je.key===V.id),ae=V.column.getCanSort(),mt=V.column.getIsSorted();return vt(E,{className:l(de,te?.align==="center"&&"text-center",te?.align==="right"&&"text-right",ae&&"cursor-pointer select-none",te?.fixed&&"sticky z-[2] bg-inherit",te?.fixed==="left"&&"left-0",te?.fixed==="right"&&"right-0"),style:te?.width?{width:te.width}:void 0,onClick:ae?()=>kr(V.id):void 0,children:Km("span",{className:"flex items-center gap-1",children:[A2(V.column.columnDef.header,V.getContext()),ae&&(mt==="asc"?vt(_s,{className:"size-3"}):mt==="desc"?vt(Zn,{className:"size-3"}):vt(ng,{className:"size-3 opacity-40"}))]})},V.id)})]},Z.id))}),vt(ke,{children:n?Array.from({length:5}).map((Z,V)=>Km(W,{children:[F&&vt(D,{className:de,children:vt(ut,{className:"size-4"})}),e.map(te=>vt(D,{className:de,children:vt(ut,{className:"h-4 w-full"})},te.key))]},`skeleton-${V}`)):A.length===0?vt(W,{children:vt(D,{colSpan:ce,className:"py-12 text-center text-muted-foreground",children:i})}):(G??A).map((Z,V)=>{let te=z.has(Z.key),ae=O.has(Z.key),mt=G?G[V]:null;return Km(W,{"data-depth":Z.depth,"data-selected":ae||void 0,className:l(N&&V%2===1&&"bg-muted/20",ae&&"bg-muted"),children:[F&&vt(D,{className:l(de,"w-10"),children:s==="multiple"?vt(E2,{checked:ae,indeterminate:mt?.isIndeterminate??!1,onChange:()=>ct(Z.key,Z.row)}):vt("input",{type:"radio",name:"tree-table-selection","data-slot":"tree-table-radio",checked:ae,onChange:()=>ct(Z.key,Z.row),className:"size-4 shrink-0 cursor-pointer accent-primary"})}),e.map((je,nt)=>{let ft=Z.row[je.key],ea=je.render?je.render(ft,Z.row,V):ft??"\u2014";return vt(D,{className:l(de,je.align==="center"&&"text-center",je.align==="right"&&"text-right",je.fixed&&"sticky z-[2] bg-inherit",je.fixed==="left"&&"left-0",je.fixed==="right"&&"right-0"),style:je.width?{width:je.width}:void 0,children:nt===0?Km("span",{className:"flex items-center gap-1",children:[vt("span",{style:{paddingLeft:Z.depth*24},className:"inline-flex shrink-0"}),(Z.hasChildren||!!x&&!Z.hasChildren)&&vt("button",{type:"button","data-slot":"tree-table-expand",onClick:()=>lt(Z.key,Z.row),className:"inline-flex size-5 shrink-0 items-center justify-center rounded hover:bg-muted","aria-label":Z.isExpanded?"Collapse":"Expand",children:te?vt(Pr,{className:"size-4 animate-spin"}):Z.isExpanded?vt(re,{className:"size-4"}):vt(me,{className:"size-4"})}),!Z.hasChildren&&!x&&vt("span",{className:"inline-flex size-5 shrink-0"}),vt("span",{className:"min-w-0",children:ea})]}):ea},je.key)})]},Z.key)})})]})})}import*as Ct from"react";import{jsx as st,jsxs as ic}from"react/jsx-runtime";function ek(e,t,a,r,o=0){let n=[];for(let i of e){let c=i[t],s=i[a],d=Array.isArray(s)&&s.length>0,m=r.has(c);n.push({row:i,key:c,depth:o,hasChildren:d,isExpanded:m}),d&&m&&n.push(...ek(s,t,a,r,o+1))}return n}function lh(e,t,a,r){return e.map(o=>{let n=String(o[t]),i=o[a],c=o,s=r.get(n);if(s&&s.size>0){c={...o};for(let[d,m]of s.entries())c[d]=m;c=c}if(Array.isArray(i)&&i.length>0){let d=lh(i,t,a,r);c===o&&(c={...o}),c[a]=d}return c})}function ih(e,t,a,r){let o=[];function n(i){for(let c of i){let s=String(c[t]);r.has(s)&&r.get(s).size>0&&o.push(c);let d=c[a];Array.isArray(d)&&d.length>0&&n(d)}}return n(e),o}function F2({value:e,onChange:t,onCommit:a,onCancel:r}){return st(T,{"data-slot":"editable-cell-input",type:"text",value:e,autoFocus:!0,onChange:o=>t(o.target.value),onKeyDown:o=>{o.key==="Enter"&&(o.preventDefault(),a()),o.key==="Escape"&&(o.preventDefault(),r())},className:"h-7 text-sm"})}function $2({value:e,onChange:t,onCommit:a,onCancel:r}){return st(T,{"data-slot":"editable-cell-input",type:"number",value:e,autoFocus:!0,onChange:o=>t(o.target.value),onKeyDown:o=>{o.key==="Enter"&&(o.preventDefault(),a()),o.key==="Escape"&&(o.preventDefault(),r())},className:"h-7 text-sm"})}function H2({value:e,onChange:t,onCommit:a,onCancel:r,options:o}){let n=Ct.useRef(null);return Ct.useEffect(()=>{n.current&&n.current.focus()},[]),st("select",{ref:n,"data-slot":"editable-cell-select",value:String(e),onChange:i=>{t(i.target.value),a()},onKeyDown:i=>{i.key==="Escape"&&(i.preventDefault(),r())},className:"h-7 rounded border border-input bg-background px-1 text-sm focus:outline-none focus:ring-1 focus:ring-ring",children:o.map(i=>st("option",{value:String(i.value),children:i.label},String(i.value)))})}function qle({columns:e,data:t,rowKey:a="id",childrenKey:r="children",parentKey:o,loading:n=!1,emptyText:i="No data",size:c="md",expandedKeys:s,defaultExpandedKeys:d,onChange:m,onSave:u,onCancel:p,showToolbar:f=!1,editMode:x=!0,className:v}){let N=Ct.useMemo(()=>o?Bf(t,{idKey:a,parentKey:o,childrenKey:r}):t,[t,o,a,r]),[h,b]=Ct.useState(()=>new Set(d??[])),g=Ct.useMemo(()=>s?new Set(s):h,[s,h]),y=Ct.useMemo(()=>ek(N,a,r,g),[N,a,r,g]),[k,w]=Ct.useState(null),[R,S]=Ct.useState(""),[z,L]=Ct.useState(null),[H,M]=Ct.useState(new Map),$=Ct.useCallback((V,te,ae)=>{let mt=H.get(String(V));return mt?.has(te)?mt.get(te):ae[te]},[H]),I=Ct.useCallback((V,te)=>H.get(String(V))?.has(te)??!1,[H]),O=Ct.useMemo(()=>ih(t,a,r,H),[t,a,r,H]).length,G=Ct.useCallback((V,te)=>!x||!V.editable?!1:typeof V.editable=="function"?V.editable(te):!0,[x]),Ce=Ct.useCallback((V,te,ae)=>{if(!G(te,ae))return;let mt=$(V,te.key,ae);w({rowKey:V,columnKey:te.key}),S(mt??""),L(null)},[G,$]),j=Ct.useCallback(V=>{if(!m)return;let te=lh(t,a,r,V),ae=ih(t,a,r,V);m(te,ae)},[m,t,a,r]),de=Ct.useCallback(()=>{if(!k)return;let{rowKey:V,columnKey:te}=k,ae=e.find(ft=>ft.key===te),mt=y.find(ft=>ft.key===V);if(!ae||!mt){w(null);return}if(ae.validate){let ft=ae.validate(R,mt.row);if(ft){L(ft);return}}let je=mt.row[te],nt=String(V);M(ft=>{let ea=new Map(ft),Wa=new Map(ea.get(nt)??[]);return R===je?(Wa.delete(te),Wa.size===0?ea.delete(nt):ea.set(nt,Wa)):(Wa.set(te,R),ea.set(nt,Wa)),j(ea),ea}),w(null),L(null)},[k,e,y,R,j]),F=Ct.useCallback(()=>{w(null),L(null)},[]),ce=Ct.useCallback(async()=>{let V=lh(t,a,r,H),te=ih(t,a,r,H);await u?.(V,te),M(new Map)},[H,t,a,r,u]),lt=Ct.useCallback(()=>{M(new Map),w(null),L(null),p?.()},[p]),ct=Ct.useCallback(V=>{b(te=>{let ae=new Set(te);return ae.has(V)?ae.delete(V):ae.add(V),ae})},[]),kr=c==="sm"?"px-2 py-1.5":c==="lg"?"px-4 py-3":"px-3 py-2",Z=(V,te,ae)=>{let mt=k?.rowKey===ae&&k?.columnKey===V.key,je=$(ae,V.key,te),nt=I(ae,V.key);if(!mt){let ea=V.render?V.render(je,te,y.findIndex(Wa=>Wa.key===ae)):je??"\u2014";return ic("div",{"data-slot":"editable-cell-display","data-dirty":nt||void 0,className:l("group/cell relative min-h-[1.5rem] rounded px-1 py-0.5 transition-colors",G(V,te)&&"cursor-pointer hover:bg-muted/50",nt&&"bg-warning/10"),onClick:()=>Ce(ae,V,te),role:G(V,te)?"button":void 0,tabIndex:G(V,te)?0:void 0,onKeyDown:Wa=>{G(V,te)&&(Wa.key==="Enter"||Wa.key===" ")&&(Wa.preventDefault(),Ce(ae,V,te))},children:[ea,G(V,te)&&!nt&&st(tl,{className:"absolute right-0.5 top-0.5 size-3 text-muted-foreground opacity-0 transition-opacity group-hover/cell:opacity-100"})]})}let ft=V.editorType??"text";return ic("div",{"data-slot":"editable-cell-editor",children:[ft==="text"&&st(F2,{value:String(R??""),onChange:ea=>S(ea),onCommit:de,onCancel:F}),ft==="number"&&st($2,{value:R,onChange:ea=>S(ea),onCommit:de,onCancel:F}),ft==="select"&&st(H2,{value:R,onChange:ea=>S(ea),onCommit:de,onCancel:F,options:V.editorOptions??[]}),z&&st("p",{"data-slot":"editable-cell-error",className:"mt-0.5 text-xs text-destructive",children:z})]})};return ic("div",{"data-slot":"editable-tree-table",className:l("overflow-x-auto rounded-lg border border-border",v),children:[f&&x&&ic("div",{"data-slot":"editable-tree-table-toolbar",className:"sticky bottom-0 z-10 flex items-center justify-between border-t border-border bg-background px-3 py-2",children:[st("span",{className:"text-sm text-muted-foreground",children:O>0?`${O} unsaved change${O>1?"s":""}`:"No changes"}),ic("div",{className:"flex items-center gap-2",children:[st(C,{variant:"outline",size:"sm",onClick:lt,disabled:O===0,icon:st(Q,{className:"size-3.5"}),children:"Cancel"}),st(C,{size:"sm",onClick:ce,disabled:O===0,icon:st(U,{className:"size-3.5"}),children:"Save"})]})]}),ic(ze,{children:[st(Ae,{children:st(W,{className:"bg-muted/30",children:e.map(V=>st(E,{className:l(kr,V.align==="center"&&"text-center",V.align==="right"&&"text-right",V.fixed&&"sticky z-[2] bg-inherit",V.fixed==="left"&&"left-0",V.fixed==="right"&&"right-0"),style:V.width?{width:V.width}:void 0,children:V.title},V.key))})}),st(ke,{children:n?Array.from({length:5}).map((V,te)=>st(W,{children:e.map(ae=>st(D,{className:kr,children:st(ut,{className:"h-4 w-full"})},ae.key))},`skeleton-${te}`)):y.length===0?st(W,{children:st(D,{colSpan:e.length,className:"py-12 text-center text-muted-foreground",children:i})}):y.map((V,te)=>st(W,{"data-depth":V.depth,children:e.map((ae,mt)=>{let je=$(V.key,ae.key,V.row),nt=G(ae,V.row);return st(D,{className:l(kr,ae.align==="center"&&"text-center",ae.align==="right"&&"text-right",ae.fixed&&"sticky z-[2] bg-inherit",ae.fixed==="left"&&"left-0",ae.fixed==="right"&&"right-0"),style:ae.width?{width:ae.width}:void 0,children:mt===0?ic("span",{className:"flex items-center gap-1",children:[st("span",{style:{paddingLeft:V.depth*24},className:"inline-flex shrink-0"}),V.hasChildren&&st("button",{type:"button","data-slot":"editable-tree-table-expand",onClick:()=>ct(V.key),className:"inline-flex size-5 shrink-0 items-center justify-center rounded hover:bg-muted","aria-label":V.isExpanded?"Collapse":"Expand",children:V.isExpanded?st(re,{className:"size-4"}):st(me,{className:"size-4"})}),!V.hasChildren&&st("span",{className:"inline-flex size-5 shrink-0"}),st("span",{className:"min-w-0 flex-1",children:nt?Z(ae,V.row,V.key):ae.render?ae.render(je,V.row,te):je??"\u2014"})]}):nt?Z(ae,V.row,V.key):ae.render?ae.render(je,V.row,te):je??"\u2014"},ae.key)})},V.key))})]})]})}import*as Bp from"react";import{jsx as tr,jsxs as mo}from"react/jsx-runtime";function V2(e,t,a,r){let o=new Map,n=new Map;for(let s of e){let d=s[a];o.set(d,s)}for(let s of t){let d=s[a];n.set(d,s)}let i=[],c=new Set;for(let s of t){let d=s[a];c.add(d);let m=o.get(d);if(!m)i.push({status:"added",beforeRow:null,afterRow:s,key:d,changedFields:new Set});else{let u=new Set;for(let p of r){let f=m[p],x=s[p];f!==x&&u.add(p)}u.size>0?i.push({status:"changed",beforeRow:m,afterRow:s,key:d,changedFields:u}):i.push({status:"unchanged",beforeRow:m,afterRow:s,key:d,changedFields:new Set})}}for(let s of e){let d=s[a];c.has(d)||i.push({status:"removed",beforeRow:s,afterRow:null,key:d,changedFields:new Set})}return i}var tk={added:{label:"Added",variant:"default"},removed:{label:"Removed",variant:"destructive"},changed:{label:"Changed",variant:"secondary"},unchanged:{label:"Unchanged",variant:"outline"}},O2={added:"bg-green-50 dark:bg-green-950/20",removed:"bg-red-50 dark:bg-red-950/20",changed:"",unchanged:""};function Yle({before:e,after:t,rowKey:a,columns:r,viewMode:o="unified",showChangesOnly:n=!1,showSummary:i=!1,className:c}){let s=Bp.useMemo(()=>r.map(N=>N.key),[r]),d=Bp.useMemo(()=>V2(e,t,a,s),[e,t,a,s]),m=Bp.useMemo(()=>{let N={added:0,removed:0,changed:0,unchanged:0};for(let h of d)N[h.status]++;return N},[d]),u=Bp.useMemo(()=>n?d.filter(N=>N.status!=="unchanged"):d,[d,n]),p=(N,h)=>{if(!h)return tr("span",{className:"text-muted-foreground",children:"\u2014"});let b=h[N.key];return N.render?N.render(b,h):b??"\u2014"},f=(N,h)=>{let b=h.afterRow??h.beforeRow,g=h.changedFields.has(N.key);if(h.status==="removed"){let y=h.beforeRow?h.beforeRow[N.key]:void 0,k=N.render&&h.beforeRow?N.render(y,h.beforeRow):y??"\u2014";return tr("span",{className:"line-through text-muted-foreground",children:k})}if(g&&h.beforeRow&&h.afterRow){let y=h.beforeRow[N.key],k=h.afterRow[N.key],w=N.render?N.render(y,h.beforeRow):y??"\u2014",R=N.render?N.render(k,h.afterRow):k??"\u2014";return mo("div",{"data-slot":"diff-cell-changed",children:[tr("span",{children:R}),tr("span",{className:"block text-xs text-muted-foreground line-through",children:w})]})}return p(N,b)},x=(N,h,b)=>{let g=b==="before"?h.beforeRow:h.afterRow;if(!g)return tr("span",{className:"text-muted-foreground",children:"\u2014"});let y=g[N.key];return N.render?N.render(y,g):y??"\u2014"},v=(N,h,b)=>mo(ze,{children:[tr(Ae,{children:mo(W,{className:"bg-muted/30",children:[tr(E,{className:"w-20 px-3 py-2",children:"Status"}),r.map(g=>tr(E,{className:l("px-3 py-2",g.align==="center"&&"text-center",g.align==="right"&&"text-right"),style:g.width?{width:g.width}:void 0,children:g.title},g.key))]})}),tr(ke,{children:N.length===0?tr(W,{children:tr(D,{colSpan:r.length+1,className:"py-12 text-center text-muted-foreground",children:"No differences found"})}):N.map(g=>mo(W,{"data-status":g.status,className:l(O2[g.status]),children:[tr(D,{className:"px-3 py-2",children:tr(B,{variant:tk[g.status].variant,className:"text-[10px]",children:tk[g.status].label})}),r.map(y=>{let k=g.changedFields.has(y.key);return tr(D,{className:l("px-3 py-2",y.align==="center"&&"text-center",y.align==="right"&&"text-right",k&&g.status==="changed"&&"bg-yellow-50 dark:bg-yellow-950/20"),style:y.width?{width:y.width}:void 0,children:h(y,g)},y.key)})]},`${g.status}-${g.key}`))})]});return mo("div",{"data-slot":"diff-viewer-table",className:l("overflow-x-auto rounded-lg border border-border",c),children:[i&&mo("div",{"data-slot":"diff-viewer-summary",className:"flex flex-wrap items-center gap-3 border-b border-border bg-muted/30 px-3 py-2",children:[tr("span",{className:"mr-2 text-sm font-medium text-foreground",children:"Summary"}),mo(B,{variant:"default",className:"text-xs",children:[m.added," Added"]}),mo(B,{variant:"destructive",className:"text-xs",children:[m.removed," Removed"]}),mo(B,{variant:"secondary",className:"text-xs",children:[m.changed," Changed"]}),mo(B,{variant:"outline",className:"text-xs",children:[m.unchanged," Unchanged"]}),mo("span",{className:"ml-auto text-xs text-muted-foreground",children:[u.length," of ",d.length," rows shown"]})]}),o==="unified"?v(u,f):mo("div",{"data-slot":"diff-side-by-side",className:"grid grid-cols-2 divide-x divide-border",children:[mo("div",{"data-slot":"diff-side-before",children:[tr("div",{className:"border-b border-border bg-muted/20 px-3 py-1.5 text-xs font-medium text-muted-foreground",children:"Before"}),v(u,(N,h)=>x(N,h,"before"),"before")]}),mo("div",{"data-slot":"diff-side-after",children:[tr("div",{className:"border-b border-border bg-muted/20 px-3 py-1.5 text-xs font-medium text-muted-foreground",children:"After"}),v(u,(N,h)=>x(N,h,"after"),"after")]})]})]})}import*as Go from"react";import{jsx as ma,jsxs as Nn}from"react/jsx-runtime";var U2=[{code:"110000",name:"\u5317\u4EAC\u5E02",children:[{code:"110100",name:"\u5317\u4EAC\u5E02",children:[{code:"110101",name:"\u4E1C\u57CE\u533A"},{code:"110102",name:"\u897F\u57CE\u533A"},{code:"110105",name:"\u671D\u9633\u533A"}]}]},{code:"310000",name:"\u4E0A\u6D77\u5E02",children:[{code:"310100",name:"\u4E0A\u6D77\u5E02",children:[{code:"310101",name:"\u9EC4\u6D66\u533A"},{code:"310104",name:"\u5F90\u6C47\u533A"},{code:"310105",name:"\u957F\u5B81\u533A"}]}]},{code:"330000",name:"\u6D59\u6C5F\u7701",children:[{code:"330100",name:"\u676D\u5DDE\u5E02",children:[{code:"330102",name:"\u4E0A\u57CE\u533A"},{code:"330105",name:"\u62F1\u5885\u533A"},{code:"330106",name:"\u897F\u6E56\u533A"}]},{code:"330200",name:"\u5B81\u6CE2\u5E02",children:[{code:"330203",name:"\u6D77\u66D9\u533A"},{code:"330204",name:"\u6C5F\u4E1C\u533A"}]}]},{code:"440000",name:"\u5E7F\u4E1C\u7701",children:[{code:"440100",name:"\u5E7F\u5DDE\u5E02",children:[{code:"440103",name:"\u8354\u6E7E\u533A"},{code:"440104",name:"\u8D8A\u79C0\u533A"},{code:"440106",name:"\u5929\u6CB3\u533A"}]},{code:"440300",name:"\u6DF1\u5733\u5E02",children:[{code:"440303",name:"\u7F57\u6E56\u533A"},{code:"440304",name:"\u798F\u7530\u533A"},{code:"440305",name:"\u5357\u5C71\u533A"}]}]},{code:"510000",name:"\u56DB\u5DDD\u7701",children:[{code:"510100",name:"\u6210\u90FD\u5E02",children:[{code:"510104",name:"\u9526\u6C5F\u533A"},{code:"510105",name:"\u9752\u7F8A\u533A"},{code:"510106",name:"\u91D1\u725B\u533A"}]},{code:"510700",name:"\u7EF5\u9633\u5E02",children:[{code:"510703",name:"\u6DAA\u57CE\u533A"},{code:"510704",name:"\u6E38\u4ED9\u533A"}]}]}];function ak(e,t){let a=[],r=t;for(let o of e){let n=r.find(i=>i.code===o);if(n)a.push(n.name),r=n.children??[];else break}return a}function rk({nodes:e,selectedCode:t,onSelect:a,levelLabel:r}){let[o,n]=Go.useState(""),i=Go.useMemo(()=>o?e.filter(c=>c.name.toLowerCase().includes(o.toLowerCase())):e,[e,o]);return Nn("div",{className:"flex min-w-[160px] flex-col border-r last:border-r-0",children:[ma("div",{className:"border-b px-2 py-1.5",children:Nn("div",{className:"relative",children:[ma(X,{className:"pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2 text-muted-foreground"}),ma(T,{className:"h-7 pl-7 text-xs",placeholder:"\u641C\u7D22"+r,value:o,onChange:c=>n(c.target.value),"aria-label":"\u641C\u7D22"+r})]})}),Nn("div",{className:"max-h-64 overflow-y-auto",children:[i.length===0&&ma("div",{className:"px-3 py-4 text-center text-xs text-muted-foreground",children:"\u65E0\u6570\u636E"}),i.map(c=>{let s=c.code===t;return Nn("button",{type:"button",className:l("flex w-full items-center justify-between px-3 py-1.5 text-left text-sm hover:bg-accent",s&&"bg-accent font-medium"),onClick:()=>a(c),children:[ma("span",{className:"truncate",children:c.name}),s&&ma(U,{className:"size-3.5 shrink-0 text-primary"})]},c.code)})]})]})}var ok=["\u7701/\u5E02","\u5E02/\u533A","\u533A/\u53BF","\u8857\u9053"];function W2({tree:e,codes:t,level:a,onSelect:r,onLoad:o}){let n=Go.useMemo(()=>{let p=[e],f=e;for(let x=0;x<t.length&&x<a-1;x++){let v=f.find(N=>N.code===t[x]);if(v?.children?.length)p.push(v.children),f=v.children;else break}return p},[e,t,a]),[i,c]=Go.useState({}),[s,d]=Go.useState(null),m=a===4&&t.length>=3?t[2]:void 0;Go.useEffect(()=>{!m||!o||i[m]||(d(m),o(m).then(p=>{c(f=>({...f,[m]:p}))}).finally(()=>d(null)))},[m]);let u=m&&i[m]?i[m]:void 0;return Nn("div",{"data-slot":"address-picker-panel",className:"flex",children:[n.map((p,f)=>ma(rk,{nodes:p,selectedCode:t[f]??"",levelLabel:ok[f]??"\u7B2C"+(f+1)+"\u7EA7",onSelect:x=>r(f,x)},f)),a===4&&m&&ma(rk,{nodes:u??[],selectedCode:t[3]??"",levelLabel:ok[3]??"",onSelect:p=>r(3,p)}),a===4&&m&&s===m&&ma("div",{className:"flex min-w-[160px] items-center justify-center border-r px-3 py-4 text-xs text-muted-foreground last:border-r-0",children:"\u52A0\u8F7D\u4E2D\u2026"})]})}function ode({value:e=[],onChange:t,level:a=3,options:r,onLoad:o,placeholder:n="\u8BF7\u9009\u62E9\u5730\u5740",disabled:i=!1,inputTrigger:c=!0,clearable:s=!1,className:d}){let[m,u]=Go.useState(!1),[p,f]=Go.useState(e);Go.useEffect(()=>{f(e)},[e]);let x=r??U2,v=Go.useMemo(()=>ak(p,x),[p,x]),N=v.join(" / ")||n,h=v.length>0,b=(R,S)=>{let z=p.slice(0,R);z[R]=S.code;let L=(S.children?.length??0)>0,H=a,M=!L||z.length>=H,$=a===4&&R===2&&!L;if(f(z),M&&!$){let I=ak(z,x);t?.(z,I),u(!1)}},g=R=>{R.stopPropagation(),f([]),t?.([],[]),u(!1)},y=ma(W2,{tree:x,codes:p,level:a,onSelect:b,...o?{onLoad:o}:{}}),k=Nn("div",{className:"flex items-center gap-1.5 truncate",children:[ma(on,{className:"size-3.5 shrink-0 text-muted-foreground"}),ma("span",{className:l("truncate",!h&&"text-muted-foreground"),children:N})]}),w=s&&h&&!i?ma("button",{type:"button",className:"flex shrink-0 items-center justify-center rounded-full p-0.5 hover:bg-accent",onClick:g,"aria-label":"\u6E05\u9664\u9009\u62E9",children:ma(Q,{className:"size-3.5 text-muted-foreground"})}):null;return c?Nn(He,{open:m,onOpenChange:u,children:[Nn(Ve,{render:ma("button",{type:"button",disabled:i,"data-slot":"address-picker",className:l("flex h-9 w-full items-center justify-between gap-2 rounded-md border border-input bg-background px-3 text-sm ring-offset-background","placeholder:text-muted-foreground","focus-visible:ring-ring focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none",i&&"cursor-not-allowed opacity-50",d)}),children:[k,Nn("div",{className:"flex shrink-0 items-center gap-1",children:[w,ma(re,{className:"size-4 opacity-50"})]})]}),ma(Oe,{align:"start",className:"w-auto p-0",children:y})]}):Nn(He,{open:m,onOpenChange:u,children:[Nn(Ve,{render:ma("button",{type:"button",disabled:i,"data-slot":"address-picker",className:l("inline-flex h-9 items-center justify-between gap-2 rounded-md border border-input bg-background px-3 text-sm","hover:bg-accent hover:text-accent-foreground","focus-visible:ring-ring focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none",i&&"cursor-not-allowed opacity-50",d)}),children:[k,Nn("div",{className:"flex shrink-0 items-center gap-1",children:[w,ma(re,{className:"size-4 opacity-50"})]})]}),ma(Oe,{align:"start",className:"w-auto p-0",children:y})]})}import*as zs from"react";import{Fragment as Q2,jsx as kt,jsxs as Cn}from"react/jsx-runtime";var _2={pending:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-300","in-progress":"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300",completed:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300",expired:"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-300"};function nk(e){let t=[],a=r=>{for(let o of r)t.push(o),o.children?.length&&a(o.children)};return a(e),t}function q2(e,t){return nk(e).filter(r=>t.includes(r.id))}function G2(e,t){if(!t)return!0;let a=t.toLowerCase();return e.batchNo.toLowerCase().includes(a)||(e.productName?.toLowerCase().includes(a)??!1)}function sk(e,t){if(!t)return e;let a=[];for(let r of e){let o=r.children?sk(r.children,t):[];(G2(r,t)||o.length>0)&&a.push({...r,children:o.length>0?o:r.children??[]})}return a}function j2({status:e}){if(!e)return null;let t=_2[e]??"";return kt(B,{variant:"secondary",className:l("text-[10px]",t),children:e})}function ik({node:e,depth:t,selectedIds:a,expandedIds:r,mode:o,showStatus:n,showMetadata:i,onToggleExpand:c,onToggleSelect:s}){let d=(e.children?.length??0)>0,m=r.has(e.id),u=a.includes(e.id);return Cn("div",{children:[Cn("div",{className:l("flex items-center gap-1.5 rounded px-2 py-1 text-sm hover:bg-accent",u&&"bg-accent"),style:{paddingLeft:t*16+8},children:[kt("button",{type:"button",className:"flex size-4 shrink-0 items-center justify-center",onClick:()=>d&&c(e.id),tabIndex:-1,"aria-label":m?"Collapse":"Expand",children:d?m?kt(re,{className:"size-3.5"}):kt(me,{className:"size-3.5"}):kt("span",{className:"size-3.5"})}),o==="multiple"?kt(ja,{checked:u,onCheckedChange:()=>s(e),"aria-label":"Select "+e.batchNo}):kt("button",{type:"button",className:l("flex size-4 shrink-0 items-center justify-center rounded-full border border-input",u&&"border-primary bg-primary"),onClick:()=>s(e),"aria-label":"Select "+e.batchNo,children:u&&kt("span",{className:"size-2 rounded-full bg-primary-foreground"})}),kt("span",{className:"truncate font-medium",children:e.batchNo}),i&&e.productName&&kt("span",{className:"truncate text-xs text-muted-foreground",children:e.productName}),n&&e.status&&kt(j2,{status:e.status})]}),i&&u&&Cn("div",{className:"flex flex-wrap gap-x-4 gap-y-0.5 py-1 pl-2 text-xs text-muted-foreground",style:{paddingLeft:t*16+48},children:[e.quantity!=null&&Cn("span",{children:["Qty: ",e.quantity]}),e.productionDate&&Cn("span",{children:["Prod: ",e.productionDate]}),e.expiryDate&&Cn("span",{children:["Exp: ",e.expiryDate]})]}),d&&m&&kt("div",{children:e.children.map(p=>kt(ik,{node:p,depth:t+1,selectedIds:a,expandedIds:r,mode:o,showStatus:n,showMetadata:i,onToggleExpand:c,onToggleSelect:s},p.id))})]})}var K2=[];function gde({data:e,value:t=K2,onChange:a,mode:r="multiple",title:o="Select Batch",trigger:n,open:i,onOpenChange:c,showStatus:s=!0,showMetadata:d=!1,disabled:m=!1,className:u}){let[p,f]=zs.useState(!1),x=i??p,v=c??f,[N,h]=zs.useState(""),[b,g]=zs.useState(t),[y,k]=zs.useState(new Set);zs.useEffect(()=>{g(t)},[t]);let w=zs.useMemo(()=>sk(e,N),[e,N]);zs.useEffect(()=>{if(N){let $=new Set(nk(e).map(I=>I.id));k($)}},[N,e]);let R=$=>{k(I=>{let A=new Set(I);return A.has($)?A.delete($):A.add($),A})},S=$=>{g(r==="single"?[$.id]:I=>I.includes($.id)?I.filter(A=>A!==$.id):[...I,$.id])},z=()=>{let $=q2(e,b);a?.(b,$),v(!1)},L=()=>{g(t),v(!1)},H=b.length,M=kt(C,{variant:"outline",disabled:m,icon:kt(Qr,{}),children:H>0?H+" batch"+(H>1?"es":"")+" selected":"Select Batch"});return Cn(Q2,{children:[kt("button",{type:"button",disabled:m,className:l(m&&"pointer-events-none opacity-50"),onClick:()=>!m&&v(!0),"data-slot":"batch-selector",children:n??M}),kt(Ie,{open:x,onOpenChange:v,children:x&&Cn(De,{className:l("sm:max-w-lg",u),showCloseButton:!1,children:[kt($e,{children:kt(Me,{children:o})}),kt(iu,{className:"p-0",children:Cn("div",{className:"flex flex-col min-h-[320px]",children:[Cn("div",{className:"relative px-3 pb-2",children:[kt(X,{className:"pointer-events-none absolute top-1/2 left-5 size-3.5 -translate-y-1/2 text-muted-foreground"}),kt(T,{className:"h-8 pl-8 text-sm",placeholder:"Search batch or product...",value:N,onChange:$=>h($.target.value)})]}),Cn("div",{className:"max-h-72 overflow-y-auto px-1",children:[w.length===0&&kt("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"No batches found"}),w.map($=>kt(ik,{node:$,depth:0,selectedIds:b,expandedIds:y,mode:r,showStatus:s,showMetadata:d,onToggleExpand:R,onToggleSelect:S},$.id))]})]})}),Cn(Ge,{children:[kt(C,{variant:"outline",onClick:L,children:"Cancel"}),kt(C,{onClick:z,children:"OK"})]})]})})]})}import*as uo from"react";import{jsx as wt,jsxs as gr}from"react/jsx-runtime";var X2=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"];function Y2(e,t){let a=new Date(e,t,1),r=new Date(e,t+1,0),o=a.getDay()-1;o<0&&(o=6);let n=[];for(let i=o;i>0;i--)n.push(new Date(e,t,1-i));for(let i=1;i<=r.getDate();i++)n.push(new Date(e,t,i));for(;n.length%7!==0;){let i=new Date(n[n.length-1]);i.setDate(i.getDate()+1),n.push(i)}return n}function dh(e){let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return`${t}-${a}-${r}`}function ch(e){let t=e.getDay();return t===0||t===6}function Cde({shiftTypes:e,employees:t,assignments:a,onAssign:r,onRemove:o,initialMonth:n,month:i,onMonthChange:c,filterEmployeeIds:s,showFilter:d=!1,showSummary:m=!1,readOnly:u=!1,className:p}){let[f,x]=uo.useState(()=>i??n??new Date(new Date().getFullYear(),new Date().getMonth(),1)),[v,N]=uo.useState("all"),h=i??f,b=uo.useCallback(M=>{i||x(M),c?.(M)},[i,c]),g=uo.useCallback(()=>{let M=new Date(h.getFullYear(),h.getMonth()-1,1);b(M)},[h,b]),y=uo.useCallback(()=>{let M=new Date(h.getFullYear(),h.getMonth()+1,1);b(M)},[h,b]),k=uo.useMemo(()=>{let M=t;return s?.length&&(M=M.filter($=>s.includes($.id))),d&&v!=="all"&&(M=M.filter($=>$.id===v)),M},[t,s,d,v]),w=uo.useMemo(()=>{var $,I,A;let M={};for(let O of a)M[$=O.date]??(M[$]={}),((I=M[O.date])[A=O.employeeId]??(I[A]=[])).push(O);return M},[a]),R=uo.useMemo(()=>{let M={};for(let $ of e)M[$.id]=$;return M},[e]),S=uo.useMemo(()=>Y2(h.getFullYear(),h.getMonth()),[h]),z=h.toLocaleDateString("en-US",{month:"long",year:"numeric"}),L=uo.useCallback((M,$,I)=>{r?.(M,$,I)},[r]),H=uo.useCallback((M,$)=>{o?.(M,$)},[o]);return gr("div",{"data-slot":"shift-calendar",className:l("flex flex-col gap-3",p),children:[gr("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[gr("div",{className:"flex items-center gap-1",children:[wt(C,{type:"button",variant:"outline",size:"icon-sm",onClick:g,"aria-label":"Previous month",children:wt(et,{className:"size-4"})}),wt("span",{className:"min-w-[140px] text-center text-sm font-semibold",children:z}),wt(C,{type:"button",variant:"outline",size:"icon-sm",onClick:y,"aria-label":"Next month",children:wt(me,{className:"size-4"})})]}),d&&gr("select",{value:v,onChange:M=>N(M.target.value),className:"border-input bg-background h-8 rounded-md border px-2 text-sm","aria-label":"Filter employees",children:[wt("option",{value:"all",children:"All employees"}),t.map(M=>wt("option",{value:M.id,children:M.name},M.id))]})]}),wt(Wt,{children:gr("table",{className:"w-full border-collapse text-xs",children:[wt("thead",{children:gr("tr",{children:[wt("th",{className:"text-muted-foreground sticky left-0 z-10 bg-background min-w-[100px] border border-border p-1.5 text-left text-[0.65rem] font-medium",children:"Employee"}),S.map(M=>{let $=dh(M),I=ch(M),A=M.getMonth()===h.getMonth();return gr("th",{className:l("border border-border p-1 text-center text-[0.65rem] font-medium",I&&"bg-muted/40",!A&&"text-muted-foreground/40"),children:[wt("div",{children:X2[(M.getDay()+6)%7]}),wt("div",{className:"text-[0.7rem] font-semibold",children:M.getDate()})]},$)})]})}),gr("tbody",{children:[k.map(M=>gr("tr",{children:[wt("td",{className:"text-foreground sticky left-0 z-10 bg-background border border-border p-1.5 text-[0.7rem] font-medium",children:M.name}),S.map($=>{let I=dh($),A=ch($),O=$.getMonth()===h.getMonth(),G=w[I]?.[M.id]??[];return wt("td",{className:l("border border-border p-0.5 align-top",A&&"bg-muted/20",!O&&"opacity-30"),children:u?wt("div",{className:"flex flex-wrap gap-0.5 p-0.5",children:G.map((Ce,j)=>{let de=R[Ce.shiftTypeId];return de?wt("span",{className:l("inline-block rounded px-1 py-px text-[0.6rem] leading-tight",de.color,de.textColor??"text-white"),children:de.label},Ce.id??`${I}-${M.id}-${j}`):null})}):gr(He,{children:[wt(Ve,{className:"flex min-h-[28px] w-full cursor-pointer flex-wrap gap-0.5 rounded p-0.5 transition-colors hover:bg-muted/50",type:"button","aria-label":`Assign shift for ${M.name} on ${I}`,children:G.map((Ce,j)=>{let de=R[Ce.shiftTypeId];return de?wt("span",{className:l("inline-block rounded px-1 py-px text-[0.6rem] leading-tight",de.color,de.textColor??"text-white"),onContextMenu:F=>{F.preventDefault(),F.stopPropagation(),H(I,M.id)},onClick:F=>F.stopPropagation(),title:"Right-click to remove",children:de.label},Ce.id??`${I}-${M.id}-${j}`):null})}),wt(Oe,{side:"bottom",align:"center",children:gr("div",{className:"flex flex-col gap-1",children:[wt("span",{className:"text-muted-foreground px-1 text-[0.65rem]",children:"Assign shift"}),e.map(Ce=>gr(C,{type:"button",variant:"ghost",size:"xs",className:"justify-start gap-2",onClick:()=>L(I,M.id,Ce.id),children:[wt("span",{className:l("inline-block size-3 rounded-sm",Ce.color)}),wt("span",{children:Ce.label}),Ce.startTime&&Ce.endTime&&gr("span",{className:"text-muted-foreground ml-auto text-[0.6rem]",children:[Ce.startTime,"\\u2013",Ce.endTime]})]},Ce.id))]})})]})},I)})]},M.id)),m&&gr("tr",{children:[wt("td",{className:"text-muted-foreground sticky left-0 z-10 bg-background border border-border p-1.5 text-[0.65rem] font-semibold",children:"Total hours"}),S.map(M=>{let $=dh(M),I=ch(M);return wt("td",{className:l("border border-border p-0.5 text-center text-[0.6rem]",I&&"bg-muted/20"),children:(()=>{let A=0;for(let O of k)for(let G of w[$]?.[O.id]??[]){let Ce=R[G.shiftTypeId];Ce?.hours&&(A+=Ce.hours)}return A>0?A:""})()},$)})]})]})]})}),wt("div",{className:"flex flex-wrap items-center gap-3",children:e.map(M=>gr("div",{className:"flex items-center gap-1.5",children:[wt("span",{className:l("inline-block size-3 rounded-sm",M.color)}),gr("span",{className:"text-muted-foreground text-[0.7rem]",children:[M.label,M.hours?` (${M.hours}h)`:""]})]},M.id))})]})}import"react";import{Fragment as lk,jsx as Vr,jsxs as jo}from"react/jsx-runtime";var J2={running:{label:"Running",className:"bg-emerald-500/15 text-emerald-600 dark:bg-emerald-500/20 dark:text-emerald-400"},idle:{label:"Idle",className:"bg-muted text-muted-foreground"},maintenance:{label:"Maintenance",className:"bg-blue-500/15 text-blue-600 dark:bg-blue-500/20 dark:text-blue-400"},fault:{label:"Fault",className:"bg-red-500/15 text-red-600 dark:bg-red-500/20 dark:text-red-400"},offline:{label:"Offline",className:"bg-neutral-500/15 text-neutral-500 dark:bg-neutral-500/20 dark:text-neutral-400"}},Z2={up:an,down:tn,flat:Kr};function Mde({name:e,model:t,status:a,metrics:r,nextMaintenance:o,location:n,actions:i,onClick:c,className:s}){let d=J2[a];return jo(Y,{"data-slot":"equipment-card",className:l(c&&"cursor-pointer transition-shadow hover:shadow-md",s),onClick:c,role:c?"button":void 0,tabIndex:c?0:void 0,onKeyDown:c?m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),c())}:void 0,children:[Vr(le,{children:jo(ie,{className:"flex items-start justify-between gap-2",children:[jo("div",{className:"flex flex-col",children:[Vr("span",{children:e}),t&&Vr("span",{className:"text-muted-foreground text-xs font-normal",children:t})]}),Vr("span",{className:l("inline-flex h-5 shrink-0 items-center rounded-full px-2 text-xs font-medium",d.className),children:d.label})]})}),Vr(J,{children:jo("div",{className:"flex flex-col gap-3",children:[n&&jo("div",{className:"text-muted-foreground flex items-center gap-1.5 text-xs",children:[Vr(on,{className:"size-3.5 shrink-0"}),Vr("span",{children:n})]}),r&&r.length>0&&jo(lk,{children:[Vr(Ue,{}),Vr("div",{className:"grid grid-cols-2 gap-x-4 gap-y-2",children:r.map(m=>{let u=m.trend?Z2[m.trend]:void 0;return jo("div",{className:"flex flex-col",children:[Vr("span",{className:"text-muted-foreground text-[0.65rem] leading-tight",children:m.label}),jo("div",{className:"flex items-center gap-1",children:[jo("span",{className:"text-sm font-semibold",children:[m.value,m.unit&&Vr("span",{className:"text-muted-foreground ml-0.5 text-xs font-normal",children:m.unit})]}),u&&Vr(u,{className:l("size-3",m.trend==="up"&&"text-emerald-500",m.trend==="down"&&"text-red-500",m.trend==="flat"&&"text-muted-foreground")})]})]},m.label)})})]}),o&&jo(lk,{children:[Vr(Ue,{}),jo("div",{className:"text-muted-foreground flex items-center gap-1.5 text-xs",children:[Vr(pe,{className:"size-3.5 shrink-0"}),jo("span",{children:["Next maintenance: ",o]})]})]})]})}),i&&i.length>0&&Vr(ho,{className:"flex-wrap gap-2",children:i.map(m=>jo(C,{type:"button",variant:"outline",size:"xs",onClick:u=>{u.stopPropagation(),m.onClick?.()},children:[m.icon,m.label]},m.label))})]})}import*as zb from"react";import{jsx as Sa,jsxs as As}from"react/jsx-runtime";var dk={preventive:{label:"Preventive",variant:"info",icon:kg},corrective:{label:"Corrective",variant:"warning",icon:Gs},emergency:{label:"Emergency",variant:"destructive",icon:wr},inspection:{label:"Inspection",variant:"success",icon:qs},calibration:{label:"Calibration",variant:"default",icon:Zh}},eI={completed:"Completed","in-progress":"In Progress",scheduled:"Scheduled"},tI=[{value:"all",label:"All"},{value:"preventive",label:"Preventive"},{value:"corrective",label:"Corrective"},{value:"emergency",label:"Emergency"},{value:"inspection",label:"Inspection"},{value:"calibration",label:"Calibration"}];function Hde({entries:e,title:t,showFilter:a=!1,emptyText:r="No maintenance records.",className:o}){let[n,i]=zb.useState("all"),c=zb.useMemo(()=>n==="all"?e:e.filter(s=>s.type===n),[e,n]);return As("div",{"data-slot":"maintenance-log",className:l("flex flex-col gap-4",o),children:[t&&Sa("h3",{className:"text-base font-semibold",children:t}),a&&Sa("div",{className:"flex flex-wrap gap-1",children:tI.map(s=>Sa(C,{type:"button",variant:n===s.value?"default":"outline",size:"xs",onClick:()=>i(s.value),children:s.label},s.value))}),c.length>0?Sa(bd,{children:c.map(s=>{let d=dk[s.type]??dk.inspection,m=d.icon;return As(xd,{children:[Sa(Ac,{variant:d.variant,children:Sa(m,{className:"size-4"})}),Sa(Ec,{}),As(Fc,{className:"pb-6 last:pb-0",children:[As("div",{className:"flex flex-wrap items-center gap-2",children:[Sa("time",{className:"text-muted-foreground text-xs",children:s.date}),Sa(B,{variant:d.variant==="destructive"?"destructive":d.variant==="default"?"default":"secondary",children:d.label}),Sa(B,{variant:s.status==="completed"?"secondary":s.status==="in-progress"?"outline":"ghost",children:eI[s.status]})]}),s.title&&Sa("h4",{className:"mt-1 text-sm font-semibold",children:s.title}),s.description&&Sa("p",{className:"text-muted-foreground mt-1 text-sm",children:s.description}),As("div",{className:"text-muted-foreground mt-2 flex flex-wrap gap-x-4 gap-y-1 text-xs",children:[s.technician&&As("span",{children:["Technician:"," ",Sa("span",{className:"text-foreground font-medium",children:s.technician})]}),s.duration&&As("span",{className:"flex items-center gap-1",children:[Sa(pe,{className:"size-3"}),s.duration]}),s.cost!=null&&As("span",{children:["Cost:"," ",As("span",{className:"text-foreground font-medium",children:["\\u00a5",s.cost.toLocaleString()]})]})]}),s.parts&&s.parts.length>0&&As("div",{className:"mt-2",children:[Sa("span",{className:"text-xs font-medium",children:"Parts used:"}),Sa("ul",{className:"mt-1 flex flex-wrap gap-1",children:s.parts.map((u,p)=>Sa("li",{children:Sa(B,{variant:"outline",className:"text-[0.65rem]",children:u})},p))})]})]})]},s.id)})}):Sa("p",{className:"text-muted-foreground py-8 text-center text-sm",children:r})]})}import*as Ko from"react";import{Fragment as aI,jsx as Yl,jsxs as Lp}from"react/jsx-runtime";function qde({onStop:e,onStart:t,mimeType:a="audio/webm",screen:r,maxDuration:o,className:n}){let[i,c]=Ko.useState(!1),[s,d]=Ko.useState(0),m=Ko.useRef(null),u=Ko.useRef([]),p=Ko.useRef(null),f=Ko.useCallback(async()=>{try{let N=r?await navigator.mediaDevices.getDisplayMedia({video:!0,audio:!0}):await navigator.mediaDevices.getUserMedia({audio:!0}),h=new MediaRecorder(N,{...MediaRecorder.isTypeSupported(a)?{mimeType:a}:{}});u.current=[],h.ondataavailable=b=>{b.data.size>0&&u.current.push(b.data)},h.onstop=()=>{let b=new Blob(u.current,{type:h.mimeType});N.getTracks().forEach(g=>g.stop()),e?.(b)},h.start(100),m.current=h,c(!0),d(0),t?.(),p.current=setInterval(()=>{d(b=>b+1)},1e3)}catch(N){console.error("[MediaRecorder] Failed to start:",N)}},[r,a,e,t]),x=Ko.useCallback(()=>{m.current?.stop(),c(!1),p.current&&(clearInterval(p.current),p.current=null)},[]);Ko.useEffect(()=>{o&&s>=o&&i&&x()},[s,o,i,x]),Ko.useEffect(()=>()=>{m.current?.stop(),p.current&&clearInterval(p.current)},[]);let v=N=>{let h=Math.floor(N/60),b=N%60;return`${h}:${b.toString().padStart(2,"0")}`};return Yl("div",{"data-slot":"media-recorder",className:l("flex items-center gap-3",n),children:i?Lp(aI,{children:[Lp("div",{className:"flex items-center gap-2",children:[Lp("span",{className:"relative flex size-3",children:[Yl("span",{className:"bg-destructive absolute inline-flex size-full animate-ping rounded-full opacity-75"}),Yl("span",{className:"bg-destructive relative inline-flex size-3 rounded-full"})]}),Yl("span",{className:"font-mono text-sm tabular-nums",children:v(s)})]}),o?Yl("div",{className:"bg-muted h-1 flex-1 rounded",children:Yl("div",{className:"bg-destructive h-1 rounded transition-all",style:{width:`${s/o*100}%`}})}):null,Lp(C,{variant:"destructive",size:"sm",onClick:x,children:[Yl(Rg,{className:"mr-1"}),"Stop"]})]}):Lp(C,{variant:"outline",size:"sm",onClick:f,children:[Yl(Sg,{className:"mr-1"}),r?"Record Screen":"Record Audio"]})})}import*as Ab from"react";import{useForm as rI}from"react-hook-form";import{Fragment as gk,jsx as Ee,jsxs as ht}from"react/jsx-runtime";function ck(e,t){let a=!0;for(let r of e.fields){let o=t[r.id];if(r.type==="measurement"){if(o==null||o===""){a=!1;continue}let n=Number(o);if(!Number.isFinite(n)){a=!1;continue}if(r.specMin!=null&&n<r.specMin||r.specMax!=null&&n>r.specMax)return"fail"}if(r.type==="passfail"){if(o==null||o===""){a=!1;continue}if(o===!1||o==="fail")return"fail"}}return a?"pass":"pending"}function mk(e,t){if(e.type!=="measurement"||t==null||t==="")return!1;let a=Number(t);return Number.isFinite(a)?e.specMin!=null&&a<e.specMin||e.specMax!=null&&a>e.specMax:!1}var uk={pass:"bg-emerald-100 text-emerald-800 dark:bg-emerald-900/30 dark:text-emerald-400",fail:"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400",pending:"bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-400"},pk={pass:"PASS",fail:"FAIL",pending:"PENDING"};function oI(e){if(!e.some(o=>o.group))return[{name:null,fields:e}];let a=new Map,r=[];for(let o of e){let n=o.group??"__ungrouped__";a.has(n)||(a.set(n,[]),r.push(n)),a.get(n).push(o)}return r.map(o=>({name:o==="__ungrouped__"?null:o,fields:a.get(o)}))}function oce({template:e,values:t,inspector:a,onSubmit:r,readOnly:o=!1,showResult:n=!0,className:i}){let c=Ab.useMemo(()=>{let f={};for(let x of e.fields)f[x.id]=t?.[x.id]??"";return f},[e,t]),s=rI({defaultValues:c}),d=s.watch(),m=Ab.useMemo(()=>ck(e,d),[e,d]),u=s.handleSubmit(f=>{let x=f;r?.({values:x,result:ck(e,x),...a?{inspector:a}:{},date:new Date().toISOString()})}),p=Ab.useMemo(()=>oI(e.fields),[e.fields]);return o?ht("div",{"data-slot":"quality-inspection-form",className:l("space-y-4",i),children:[ht("div",{className:"flex items-center justify-between",children:[ht("div",{children:[Ee("h3",{className:"text-base font-semibold",children:e.name}),e.description&&Ee("p",{className:"text-sm text-muted-foreground",children:e.description})]}),n&&Ee("span",{"data-testid":"inspection-result-badge",className:l("inline-flex items-center rounded-full px-3 py-0.5 text-xs font-bold",uk[m]),children:pk[m]})]}),a&&ht("p",{className:"text-sm text-muted-foreground",children:["Inspector: ",Ee("span",{className:"font-medium",children:a})]}),p.map((f,x)=>ht("div",{className:"space-y-3",children:[f.name&&ht("div",{className:"space-y-1",children:[Ee("h4",{className:"text-sm font-semibold",children:f.name}),Ee(Ue,{})]}),Ee("dl",{className:"space-y-3",children:f.fields.map(v=>{let N=t?.[v.id]??d[v.id],h=mk(v,N);return ht("div",{className:"flex flex-col gap-0.5",children:[ht("dt",{className:"text-sm font-medium text-muted-foreground",children:[v.label,v.unit&&ht("span",{className:"ml-1 text-xs",children:["(",v.unit,")"]})]}),Ee("dd",{className:"text-sm","data-testid":`readonly-${v.id}`,children:v.type==="passfail"?Ee("span",{className:"inline-flex items-center gap-1",children:N===!0||N==="pass"?ht(gk,{children:[Ee(qs,{className:"size-4 text-emerald-600"}),Ee("span",{className:"text-emerald-700 dark:text-emerald-400",children:"Pass"})]}):N===!1||N==="fail"?ht(gk,{children:[Ee(rn,{className:"size-4 text-red-600"}),Ee("span",{className:"text-red-700 dark:text-red-400",children:"Fail"})]}):Ee("span",{className:"text-muted-foreground",children:"\u2014"})}):N!=null&&N!==""?Ee("span",{className:l(h&&"font-semibold text-red-600 dark:text-red-400"),children:String(N)}):Ee("span",{className:"text-muted-foreground",children:"\u2014"})})]},v.id)})})]},f.name??`group-${x}`))]}):Ee(By,{...s,children:ht("form",{"data-slot":"quality-inspection-form",className:l("space-y-5",i),onSubmit:u,children:[ht("div",{className:"flex items-center justify-between",children:[ht("div",{children:[Ee("h3",{className:"text-base font-semibold",children:e.name}),e.description&&Ee("p",{className:"text-sm text-muted-foreground",children:e.description})]}),n&&Ee("span",{"data-testid":"inspection-result-badge",className:l("inline-flex items-center rounded-full px-3 py-0.5 text-xs font-bold",uk[m]),children:pk[m]})]}),a&&ht("p",{className:"text-sm text-muted-foreground",children:["Inspector: ",Ee("span",{className:"font-medium",children:a})]}),p.map((f,x)=>ht("div",{className:"space-y-4",children:[f.name&&ht("div",{className:"space-y-1",children:[Ee("h4",{className:"text-sm font-semibold","data-testid":`group-header-${f.name}`,children:f.name}),Ee(Ue,{})]}),f.fields.map(v=>Ee(zy,{control:s.control,name:v.id,rules:{...v.required?{required:`${v.label} is required`}:{},...v.type==="measurement"?{validate:N=>{if(N==null||N==="")return!0;let h=Number(N);return Number.isFinite(h)?v.specMin!=null&&h<v.specMin?`Must be >= ${v.specMin}`:v.specMax!=null&&h>v.specMax?`Must be <= ${v.specMax}`:!0:"Must be a number"}}:{}},render:({field:N})=>{let h=mk(v,N.value);return ht(Ey,{children:[ht(Fy,{required:!!v.required,children:[v.label,v.unit&&ht("span",{className:"ml-1 text-xs font-normal text-muted-foreground",children:["(",v.unit,")"]})]}),Ee($y,{children:nI(v,N,h)}),v.type==="measurement"&&(v.specMin!=null||v.specMax!=null)&&ht("p",{className:"text-xs text-muted-foreground",children:["Spec:"," ",v.specMin!=null?v.specMin:"\u2014"," ","\u2013"," ",v.specMax!=null?v.specMax:"\u2014",v.unit?` ${v.unit}`:""]}),Ee(Hy,{})]})}},v.id))]},f.name??`group-${x}`)),Ee(C,{type:"submit",className:"w-full",children:"Submit Inspection"})]})})}function nI(e,t,a){switch(e.type){case"measurement":return ht("div",{className:"flex items-center gap-2",children:[Ee(ri,{value:t.value!=null&&t.value!==""?Number(t.value):null,onChange:r=>t.onChange(r??""),onBlur:t.onBlur,step:.01,controls:!1,placeholder:e.placeholder??`Enter ${e.label.toLowerCase()}`,className:l("flex-1",a&&"[&_input]:border-red-500 [&_input]:ring-red-500/20 dark:[&_input]:border-red-400"),"data-testid":`measurement-${e.id}`}),e.unit&&Ee("span",{className:"text-sm text-muted-foreground",children:e.unit})]});case"passfail":return ht(Qy,{value:String(t.value??""),onValueChange:r=>t.onChange(r??""),className:"flex flex-row gap-4",children:[ht("label",{className:"flex items-center gap-2 text-sm",children:[Ee(Ex,{value:"pass"}),Ee(qs,{className:"size-4 text-emerald-600"}),"Pass"]}),ht("label",{className:"flex items-center gap-2 text-sm",children:[Ee(Ex,{value:"fail"}),Ee(rn,{className:"size-4 text-red-600"}),"Fail"]})]});case"select":return ht(Pe,{value:String(t.value??""),onValueChange:r=>t.onChange(r??""),children:[Ee(Re,{className:"w-full",children:Ee(Te,{placeholder:e.placeholder??"Select..."})}),Ee(Se,{children:(e.options??[]).map(r=>Ee(ve,{value:r.value,children:r.label},r.value))})]});case"text":return Ee(St,{placeholder:e.placeholder??`Enter ${e.label.toLowerCase()}`,value:String(t.value??""),onChange:r=>t.onChange(r.target.value),onBlur:t.onBlur});case"photo":return Ee("button",{type:"button","data-testid":"photo-upload-placeholder",className:"flex h-24 w-full items-center justify-center rounded-lg border-2 border-dashed border-muted-foreground/25 text-muted-foreground transition-colors hover:border-muted-foreground/50",children:ht("div",{className:"flex flex-col items-center gap-1 text-sm",children:[Ee(Pg,{className:"size-5"}),Ee("span",{children:"Upload Photo"})]})});default:return null}}import*as Jl from"react";import{jsx as he,jsxs as po}from"react/jsx-runtime";var sI={critical:{label:"Critical",rowBg:"bg-red-50 dark:bg-red-950/10",badgeClass:"bg-red-100 text-red-800 dark:bg-red-900/40 dark:text-red-300"},warning:{label:"Warning",rowBg:"bg-yellow-50 dark:bg-yellow-950/10",badgeClass:"bg-amber-100 text-amber-800 dark:bg-amber-900/40 dark:text-amber-300"},info:{label:"Info",rowBg:"",badgeClass:"bg-blue-100 text-blue-800 dark:bg-blue-900/40 dark:text-blue-300"},normal:{label:"Normal",rowBg:"",badgeClass:"bg-emerald-100 text-emerald-800 dark:bg-emerald-900/40 dark:text-emerald-300"}},fk=[{key:"all",label:"All"},{key:"critical",label:"Critical"},{key:"warning",label:"Warning"},{key:"info",label:"Info"},{key:"normal",label:"Normal"}];function iI({data:e,width:t=80,height:a=24}){if(e.length<2)return null;let r=Math.max(...e),o=Math.min(...e),n=r-o||1,i=t/(e.length-1),c=d=>a-(d-o)/n*a,s=e.map((d,m)=>`${m*i},${c(d)}`).join(" ");return he("svg",{width:t,height:a,viewBox:`0 0 ${t} ${a}`,className:"text-foreground","data-testid":"sparkline",children:he("polyline",{points:s,fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function pce({items:e,activeTab:t,onTabChange:a,onItemClick:r,onReorder:o,loading:n=!1,showTrend:i=!1,showTransactions:c=!1,className:s}){let[d,m]=Jl.useState("all"),[u,p]=Jl.useState(new Set),f=t??d,x=b=>{t||m(b),a?.(b)},v=Jl.useMemo(()=>f==="all"?e:e.filter(b=>b.severity===f),[e,f]),N=Jl.useMemo(()=>{let b={all:e.length};for(let g of e)b[g.severity]=(b[g.severity]??0)+1;return b},[e]),h=b=>{p(g=>{let y=new Set(g);return y.has(b)?y.delete(b):y.add(b),y})};return n?po("div",{"data-slot":"inventory-alert-list",className:l("space-y-3",s),children:[he("div",{className:"flex gap-1 rounded-lg bg-muted/50 p-1",children:fk.map(b=>he(ut,{className:"h-8 w-20"},b.key))}),he("div",{className:"space-y-2",children:Array.from({length:5}).map((b,g)=>he(ut,{className:"h-12 w-full"},g))})]}):po("div",{"data-slot":"inventory-alert-list",className:l("space-y-3",s),children:[he("div",{"data-testid":"filter-tabs",className:"flex gap-1 rounded-lg bg-muted/50 p-1",children:fk.map(b=>po("button",{type:"button",onClick:()=>x(b.key),className:l("inline-flex items-center gap-1 rounded-md px-2.5 py-1 text-sm font-medium transition-colors",f===b.key?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[b.label,po("span",{className:"text-xs text-muted-foreground",children:["(",N[b.key]??0,")"]})]},b.key))}),v.length===0?he("div",{"data-testid":"empty-state",children:he(Hc,{})}):po(ze,{children:[he(Ae,{children:po(W,{children:[c&&he(E,{className:"w-8"}),he(E,{children:"Name"}),he(E,{className:"text-right",children:"Current Qty"}),he(E,{className:"text-right",children:"Safety Stock"}),he(E,{children:"Status"}),i&&he(E,{children:"Trend"}),he(E,{children:"Warehouse"}),he(E,{className:"text-right",children:"Actions"})]})}),he(ke,{children:v.map(b=>{let g=sI[b.severity],y=u.has(b.id);return po(Jl.Fragment,{children:[po(W,{className:l(g.rowBg,r&&"cursor-pointer"),onClick:()=>r?.(b),"data-testid":`row-${b.id}`,children:[c&&he(D,{children:b.recentTransactions&&b.recentTransactions.length>0&&he("button",{type:"button",className:"text-muted-foreground hover:text-foreground",onClick:k=>{k.stopPropagation(),h(b.id)},"data-testid":`expand-${b.id}`,children:he(re,{className:l("size-4 transition-transform",y&&"rotate-180")})})}),he(D,{children:po("div",{className:"flex flex-col",children:[he("span",{className:"font-medium",children:b.name}),b.code&&he("span",{className:"text-xs text-muted-foreground",children:b.code})]})}),he(D,{className:"text-right",children:po("span",{className:l("font-mono font-semibold",b.severity==="critical"&&"text-red-600 dark:text-red-400",b.severity==="warning"&&"text-amber-600 dark:text-amber-400"),children:[b.currentQty,b.unit?` ${b.unit}`:""]})}),he(D,{className:"text-right",children:he("span",{className:"font-mono text-muted-foreground",children:b.safetyStock??"\u2014"})}),he(D,{children:he("span",{"data-testid":`severity-badge-${b.id}`,className:l("inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium",g.badgeClass),children:g.label})}),i&&he(D,{children:b.trend&&b.trend.length>=2?he(iI,{data:b.trend}):he("span",{className:"text-xs text-muted-foreground",children:"\u2014"})}),he(D,{children:he("span",{className:"text-sm text-muted-foreground",children:b.warehouse??"\u2014"})}),he(D,{className:"text-right",children:(b.severity==="critical"||b.severity==="warning")&&he(C,{variant:"outline",size:"xs",onClick:k=>{k.stopPropagation(),o?.(b)},children:"Reorder"})})]}),c&&y&&b.recentTransactions&&he(W,{children:he(D,{colSpan:7+(i?1:0)+(c?1:0),className:"bg-muted/30 p-3",children:po("div",{className:"ml-8",children:[he("p",{className:"mb-2 text-xs font-semibold text-muted-foreground",children:"Recent Transactions"}),po("table",{className:"w-full text-xs",children:[he("thead",{children:po("tr",{className:"text-muted-foreground",children:[he("th",{className:"pb-1 text-left font-medium",children:"Date"}),he("th",{className:"pb-1 text-left font-medium",children:"Type"}),he("th",{className:"pb-1 text-right font-medium",children:"Qty"}),he("th",{className:"pb-1 text-right font-medium",children:"Ref"})]})}),he("tbody",{children:b.recentTransactions.map((k,w)=>po("tr",{className:"border-t border-border/50",children:[he("td",{className:"py-1",children:k.date}),he("td",{className:"py-1",children:he("span",{className:l("inline-flex items-center rounded px-1.5 py-0.5 text-xs font-medium",k.type==="in"?"bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-400":"bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-400"),children:k.type==="in"?"IN":"OUT"})}),he("td",{className:"py-1 text-right font-mono",children:k.quantity}),he("td",{className:"py-1 text-right text-muted-foreground",children:k.reference??"\u2014"})]},w))})]})]})})})]},b.id)})})]})]})}import*as go from"react";import{jsx as ua,jsxs as Es}from"react/jsx-runtime";var lI=[{id:"length",name:"Length",units:[{id:"mm",name:"Millimeter",abbr:"mm",toBase:.001,fromBase:1e3},{id:"cm",name:"Centimeter",abbr:"cm",toBase:.01,fromBase:100},{id:"m",name:"Meter",abbr:"m",toBase:1,fromBase:1},{id:"km",name:"Kilometer",abbr:"km",toBase:1e3,fromBase:.001},{id:"inch",name:"Inch",abbr:"in",toBase:.0254,fromBase:1/.0254},{id:"foot",name:"Foot",abbr:"ft",toBase:.3048,fromBase:1/.3048},{id:"yard",name:"Yard",abbr:"yd",toBase:.9144,fromBase:1/.9144},{id:"mile",name:"Mile",abbr:"mi",toBase:1609.344,fromBase:1/1609.344}]},{id:"weight",name:"Weight",units:[{id:"mg",name:"Milligram",abbr:"mg",toBase:1e-6,fromBase:1e6},{id:"g",name:"Gram",abbr:"g",toBase:.001,fromBase:1e3},{id:"kg",name:"Kilogram",abbr:"kg",toBase:1,fromBase:1},{id:"ton",name:"Metric Ton",abbr:"t",toBase:1e3,fromBase:.001},{id:"oz",name:"Ounce",abbr:"oz",toBase:.0283495,fromBase:1/.0283495},{id:"lb",name:"Pound",abbr:"lb",toBase:.453592,fromBase:1/.453592}]},{id:"volume",name:"Volume",units:[{id:"ml",name:"Milliliter",abbr:"mL",toBase:.001,fromBase:1e3},{id:"l",name:"Liter",abbr:"L",toBase:1,fromBase:1},{id:"m3",name:"Cubic Meter",abbr:"m\xB3",toBase:1e3,fromBase:.001},{id:"gal_us",name:"Gallon (US)",abbr:"gal",toBase:3.78541,fromBase:1/3.78541},{id:"qt",name:"Quart (US)",abbr:"qt",toBase:.946353,fromBase:1/.946353},{id:"pt",name:"Pint (US)",abbr:"pt",toBase:.473176,fromBase:1/.473176},{id:"cup",name:"Cup (US)",abbr:"cup",toBase:.236588,fromBase:1/.236588},{id:"fl_oz",name:"Fluid Ounce",abbr:"fl oz",toBase:.0295735,fromBase:1/.0295735}]},{id:"temperature",name:"Temperature",units:[{id:"c",name:"Celsius",abbr:"\xB0C",toBase:1,fromBase:1,convert(e,t){return e}},{id:"f",name:"Fahrenheit",abbr:"\xB0F",toBase:1,fromBase:1,convert(e,t){return t==="toBase"?(e-32)*(5/9):e*(9/5)+32}},{id:"k",name:"Kelvin",abbr:"K",toBase:1,fromBase:1,convert(e,t){return t==="toBase"?e-273.15:e+273.15}}]},{id:"area",name:"Area",units:[{id:"mm2",name:"Square Millimeter",abbr:"mm\xB2",toBase:1e-6,fromBase:1/1e-6},{id:"cm2",name:"Square Centimeter",abbr:"cm\xB2",toBase:1e-4,fromBase:1/1e-4},{id:"m2",name:"Square Meter",abbr:"m\xB2",toBase:1,fromBase:1},{id:"km2",name:"Square Kilometer",abbr:"km\xB2",toBase:1e6,fromBase:1/1e6},{id:"in2",name:"Square Inch",abbr:"in\xB2",toBase:64516e-8,fromBase:1/64516e-8},{id:"ft2",name:"Square Foot",abbr:"ft\xB2",toBase:.092903,fromBase:1/.092903},{id:"acre",name:"Acre",abbr:"ac",toBase:4046.86,fromBase:1/4046.86},{id:"hectare",name:"Hectare",abbr:"ha",toBase:1e4,fromBase:1/1e4}]},{id:"pressure",name:"Pressure",units:[{id:"pa",name:"Pascal",abbr:"Pa",toBase:1,fromBase:1},{id:"kpa",name:"Kilopascal",abbr:"kPa",toBase:1e3,fromBase:.001},{id:"mpa",name:"Megapascal",abbr:"MPa",toBase:1e6,fromBase:1/1e6},{id:"bar",name:"Bar",abbr:"bar",toBase:1e5,fromBase:1/1e5},{id:"psi",name:"PSI",abbr:"psi",toBase:6894.76,fromBase:1/6894.76},{id:"atm",name:"Atmosphere",abbr:"atm",toBase:101325,fromBase:1/101325}]}];function dI(e,t,a){let r=t.convert?t.convert(e,"toBase"):e*t.toBase;return a.convert?a.convert(r,"fromBase"):r*a.fromBase}function cI(e){return Number.isFinite(e)?e===0?"0":Number(e.toPrecision(6)).toString():"\u2014"}function kce({categories:e,defaultCategory:t,defaultFrom:a,defaultTo:r,showSwap:o=!0,compact:n=!1,className:i}){let c=e&&e.length>0?e:lI,[s,d]=go.useState(t??c[0]?.id??""),m=go.useMemo(()=>c.find(w=>w.id===s)??c[0],[c,s]),[u,p]=go.useState(a??m.units[0]?.id??""),[f,x]=go.useState(r??m.units[1]?.id??m.units[0]?.id??""),[v,N]=go.useState(1),h=go.useRef(s);go.useEffect(()=>{h.current!==s&&(h.current=s,p(m.units[0]?.id??""),x(m.units[1]?.id??m.units[0]?.id??""),N(1))},[s,m.units]);let b=m.units.find(w=>w.id===u),g=m.units.find(w=>w.id===f),y=go.useMemo(()=>v==null||!b||!g?NaN:dI(v,b,g),[v,b,g]),k=go.useCallback(()=>{let w=u;p(f),x(w),isNaN(y)||N(Number(y.toPrecision(6)))},[u,f,y]);return Es("div",{"data-slot":"unit-converter",className:l("space-y-4 rounded-lg border bg-card p-4",n&&"space-y-3 p-3",i),children:[n?Es("div",{className:"flex flex-col gap-1.5",children:[ua(ue,{className:"text-xs text-muted-foreground",children:"Category"}),Es(Pe,{value:s,onValueChange:w=>d(w??""),children:[ua(Re,{className:"w-full","data-testid":"category-select",children:ua(Te,{})}),ua(Se,{children:c.map(w=>ua(ve,{value:w.id,children:w.name},w.id))})]})]}):ua(Sr,{defaultValue:s,value:s,onValueChange:w=>w&&d(w),children:ua(Ir,{"data-testid":"category-tabs",children:c.map(w=>ua(Ba,{value:w.id,"data-testid":`tab-${w.id}`,children:w.name},w.id))})}),Es("div",{className:l("flex items-end gap-3",n?"flex-col":"flex-wrap sm:flex-nowrap"),children:[Es("div",{className:"flex-1 space-y-1.5",children:[ua(ue,{className:"text-xs text-muted-foreground",children:"From"}),Es(Pe,{value:u,onValueChange:w=>p(w??""),children:[ua(Re,{className:"w-full","data-testid":"from-unit-select",children:ua(Te,{})}),ua(Se,{children:m.units.map(w=>Es(ve,{value:w.id,children:[w.abbr," - ",w.name]},w.id))})]}),ua(ri,{value:v,onChange:w=>N(w??null),"data-testid":"from-input",placeholder:"Enter value",className:"w-full"})]}),o&&ua(C,{variant:"outline",size:"icon",onClick:k,"data-testid":"swap-button",className:l("shrink-0",n&&"self-center"),"aria-label":"Swap units",children:ua(ng,{className:"size-4"})}),Es("div",{className:"flex-1 space-y-1.5",children:[ua(ue,{className:"text-xs text-muted-foreground",children:"To"}),Es(Pe,{value:f,onValueChange:w=>x(w??""),children:[ua(Re,{className:"w-full","data-testid":"to-unit-select",children:ua(Te,{})}),ua(Se,{children:m.units.map(w=>Es(ve,{value:w.id,children:[w.abbr," - ",w.name]},w.id))})]}),ua("div",{"data-testid":"result-display",className:"flex h-8 items-center rounded-lg border border-input bg-muted/30 px-2.5 font-mono text-sm",children:isNaN(y)?"\u2014":cI(y)})]})]})]})}import*as Gt from"react";import{jsx as pa,jsxs as kn}from"react/jsx-runtime";function mI(e){let t=[],a=0;for(;a<e.length;){let r=e[a];if(/\s/.test(r)){a++;continue}if(/[0-9.]/.test(r)){let o="";for(;a<e.length&&/[0-9.]/.test(e[a]);)o+=e[a],a++;t.push({kind:"number",value:o});continue}if(/[a-zA-Z_$@]/.test(r)){let o="";for(;a<e.length&&/[a-zA-Z0-9_$@]/.test(e[a]);)o+=e[a],a++;t.push({kind:"ident",value:o});continue}if("+-*/%".includes(r)){t.push({kind:"op",value:r}),a++;continue}if(r==="("){t.push({kind:"lparen",value:"("}),a++;continue}if(r===")"){t.push({kind:"rparen",value:")"}),a++;continue}if(r===","){t.push({kind:"comma",value:","}),a++;continue}a++}return t.push({kind:"eof",value:""}),t}var mh=class{constructor(t,a){ad(this,"tokens");ad(this,"pos");ad(this,"vars");this.tokens=t,this.pos=0,this.vars=a}peek(){return this.tokens[this.pos]}advance(){return this.tokens[this.pos++]}parse(){return this.parseExpr()}parseExpr(){return this.parseAddSub()}parseAddSub(){let t=this.parseMulDiv();for(;this.peek().kind==="op"&&(this.peek().value==="+"||this.peek().value==="-");){let a=this.advance().value,r=this.parseMulDiv();t=a==="+"?t+r:t-r}return t}parseMulDiv(){let t=this.parseUnary();for(;this.peek().kind==="op"&&"*/%".includes(this.peek().value);){let a=this.advance().value,r=this.parseUnary();a==="*"?t=t*r:a==="/"?t=r!==0?t/r:NaN:t=r!==0?t%r:NaN}return t}parseUnary(){return this.peek().kind==="op"&&this.peek().value==="-"?(this.advance(),-this.parseUnary()):this.peek().kind==="op"&&this.peek().value==="+"?(this.advance(),this.parseUnary()):this.parsePrimary()}parsePrimary(){let t=this.peek();if(t.kind==="number")return this.advance(),parseFloat(t.value);if(t.kind==="lparen"){this.advance();let a=this.parseExpr();return this.peek().kind==="rparen"&&this.advance(),a}if(t.kind==="ident"){if(this.advance(),this.peek().kind==="lparen")return this.parseFunctionCall(t.value);let a=t.value.startsWith("$")?t.value.slice(1):t.value;return this.vars[a]??0}return this.advance(),0}parseFunctionCall(t){this.advance();let a=[];if(this.peek().kind!=="rparen")for(a.push(this.parseExpr());this.peek().kind==="comma";)this.advance(),a.push(this.parseExpr());switch(this.peek().kind==="rparen"&&this.advance(),t.toUpperCase()){case"SUM":return a.reduce((o,n)=>o+n,0);case"AVG":return a.length>0?a.reduce((o,n)=>o+n,0)/a.length:0;case"MIN":return Math.min(...a);case"MAX":return Math.max(...a);case"ABS":return Math.abs(a[0]??0);case"ROUND":return a.length>1?Math.round((a[0]??0)*Math.pow(10,a[1]??0))/Math.pow(10,a[1]??0):Math.round(a[0]??0);default:return NaN}}};function uI(e,t){try{let a=e,r=Object.keys(t).sort((c,s)=>s.length-c.length);for(let c of r){let s=new RegExp(`\\$?${c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}`,"g");a=a.replace(s,`(${t[c]})`)}let o=mI(a),i=new mh(o,t).parse();return Number.isFinite(i)?i:null}catch{return null}}function pI(e){let t=0;for(let a of e)if(a==="("&&t++,a===")"&&t--,t<0)return"Unexpected closing parenthesis";return t>0?"Unbalanced parentheses: missing closing parenthesis":null}function Bce({value:e="",onChange:t,variables:a=[],functions:r=[],validator:o,showPreview:n=!1,sampleValues:i={},placeholder:c="Enter formula, e.g. $price * $quantity + SUM($tax, $shipping)",disabled:s=!1,error:d,className:m}){let u=Gt.useRef(null),[p,f]=Gt.useState(e),[x,v]=Gt.useState(!1),[N,h]=Gt.useState(""),[b,g]=Gt.useState("$"),[y,k]=Gt.useState(0),[w,R]=Gt.useState(-1);Gt.useEffect(()=>{f(e)},[e]);let S=e!==void 0?e:p,z=Gt.useCallback(j=>{let de=j.target.value;f(de),t?.(de);let F=j.target.selectionStart,ce=de.slice(0,F),lt=ce.lastIndexOf("$"),ct=ce.lastIndexOf("@"),kr=Math.max(lt,ct);if(kr>=0){let Z=lt>=ct?"$":"@",V=ce.slice(kr+1);if(!/\s/.test(V)){v(!0),h(V.toLowerCase()),g(Z),R(kr),k(0);return}}v(!1)},[t]),L=Gt.useMemo(()=>{if(d)return d;if(!S.trim())return null;let j=pI(S);return j||(o?o(S):null)},[S,d,o]),H=Gt.useMemo(()=>!n||!S.trim()?null:uI(S,i),[n,S,i]),M=Gt.useMemo(()=>{if(!n||!S.trim())return null;let j=S,de=Object.keys(i).sort((F,ce)=>ce.length-F.length);for(let F of de){let ce=new RegExp(`\\$${F.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}`,"g");j=j.replace(ce,String(i[F]))}return j},[n,S,i]),$=Gt.useMemo(()=>b==="$"?a.filter(j=>!N||j.name.toLowerCase().includes(N)||j.label.toLowerCase().includes(N)):r.filter(j=>!N||j.name.toLowerCase().includes(N)||j.label.toLowerCase().includes(N)),[b,N,a,r]),I=Gt.useCallback(j=>{let de=u.current;if(!de){let V=S+j;f(V),t?.(V);return}let F=de.selectionStart,ce=de.selectionEnd,lt=F;x&&w>=0&&(lt=w);let ct=S.slice(0,lt),kr=S.slice(ce),Z=ct+j+kr;f(Z),t?.(Z),v(!1),requestAnimationFrame(()=>{de.focus();let V=ct.length+j.length;de.setSelectionRange(V,V)})},[S,t,x,w]),A=Gt.useCallback(j=>{I(`$${j}`)},[I]),O=Gt.useCallback(j=>{let de=j.args.map(F=>F.name).join(", ");I(`${j.name}(${de})`)},[I]),G=Gt.useCallback(j=>{if(b==="$"&&"type"in j&&!("args"in j))I(`$${j.name}`);else{let de=j,F=de.args.map(ce=>ce.name).join(", ");I(`${de.name}(${F})`)}},[b,I]),Ce=Gt.useCallback(j=>{!x||$.length===0||(j.key==="ArrowDown"?(j.preventDefault(),k(de=>(de+1)%$.length)):j.key==="ArrowUp"?(j.preventDefault(),k(de=>(de-1+$.length)%$.length)):j.key==="Enter"?(j.preventDefault(),G($[y])):j.key==="Escape"&&v(!1))},[x,$,y,G]);return kn("div",{"data-slot":"formula-editor",className:l("space-y-3",m),children:[kn("div",{className:"relative",children:[pa(St,{ref:u,value:S,onChange:z,onKeyDown:Ce,placeholder:c,disabled:s,"data-testid":"formula-textarea",className:l("min-h-24 font-mono text-sm",L&&"border-destructive"),"aria-invalid":!!L}),x&&$.length>0&&pa("div",{"data-testid":"autocomplete-dropdown",className:"absolute z-50 mt-1 max-h-48 w-full overflow-auto rounded-md border bg-popover p-1 shadow-md",children:$.map((j,de)=>{let F=de===y,ce="type"in j&&!("args"in j);return kn("button",{type:"button",className:l("flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-sm",F?"bg-accent text-accent-foreground":"hover:bg-accent/50"),"data-testid":`autocomplete-item-${j.name}`,onMouseDown:lt=>{lt.preventDefault(),G(j)},onMouseEnter:()=>k(de),children:[ce?pa(ld,{className:"size-3.5 text-muted-foreground"}):pa(ou,{className:"size-3.5 text-muted-foreground"}),pa("span",{className:"font-mono",children:j.name}),pa("span",{className:"text-muted-foreground",children:j.label})]},j.name)})})]}),L&&kn("div",{"data-testid":"formula-error",className:"flex items-center gap-1.5 text-sm text-destructive",children:[pa(wr,{className:"size-3.5"}),pa("span",{children:L})]}),(a.length>0||r.length>0)&&!s&&kn("div",{"data-testid":"insertion-toolbar",className:"space-y-2",children:[a.length>0&&kn("div",{className:"space-y-1",children:[pa("span",{className:"text-xs font-medium text-muted-foreground",children:"Variables"}),pa("div",{className:"flex flex-wrap gap-1",children:a.map(j=>kn(B,{variant:"outline",className:"cursor-pointer hover:bg-accent","data-testid":`var-badge-${j.name}`,onClick:()=>A(j.name),role:"button",tabIndex:0,children:[pa(ld,{className:"mr-1 size-3"}),j.label]},j.name))})]}),a.length>0&&r.length>0&&pa(Ue,{}),r.length>0&&kn("div",{className:"space-y-1",children:[pa("span",{className:"text-xs font-medium text-muted-foreground",children:"Functions"}),pa("div",{className:"flex flex-wrap gap-1",children:r.map(j=>kn(B,{variant:"outline",className:"cursor-pointer hover:bg-accent","data-testid":`fn-badge-${j.name}`,onClick:()=>O(j),role:"button",tabIndex:0,children:[pa(ou,{className:"mr-1 size-3"}),j.label]},j.name))})]})]}),n&&S.trim()&&pa(Y,{"data-testid":"preview-panel",className:"bg-muted/30",children:kn(J,{className:"space-y-2 pt-4",children:[M&&kn("div",{className:"space-y-1",children:[pa("span",{className:"text-xs font-medium text-muted-foreground",children:"Formula"}),pa("div",{"data-testid":"preview-formula",className:"rounded bg-background px-2 py-1 font-mono text-sm",children:M})]}),kn("div",{className:"space-y-1",children:[pa("span",{className:"text-xs font-medium text-muted-foreground",children:"Result"}),pa("div",{"data-testid":"preview-result",className:l("rounded bg-background px-2 py-1 font-mono text-sm font-semibold",H===null&&"text-muted-foreground"),children:H!==null?String(H):"Cannot evaluate"})]})]})})]})}import{jsx as zp,jsxs as gI}from"react/jsx-runtime";function $ce({label:e,subtitle:t,opened:a,onOpen:r,className:o}){return gI("div",{"data-slot":"red-packet",className:l("bg-destructive text-destructive-foreground relative flex w-48 flex-col items-center justify-center gap-2 rounded-lg p-6",a&&"bg-muted text-muted-foreground opacity-75",o),children:[zp("div",{className:"border-destructive-foreground flex h-16 w-16 items-center justify-center rounded-full border-2",children:zp("span",{className:"text-2xl",children:"\u{1F9E7}"})}),zp("span",{className:"text-lg font-bold",children:e}),t&&zp("span",{className:"text-xs opacity-80",children:t}),!a&&r&&zp(C,{variant:"secondary",size:"sm",onClick:r,className:"bg-destructive-foreground text-destructive hover:bg-destructive-foreground/90 mt-1",children:"Open"})]})}import*as Ap from"react";import{Fragment as ph,jsx as oe,jsxs as rt}from"react/jsx-runtime";var fI=[{type:"table",label:"Table",icon:oe(yg,{}),defaultW:6,defaultH:4,defaultConfig:{columnCount:5}},{type:"chart",label:"Chart",icon:oe(rd,{}),defaultW:6,defaultH:4,defaultConfig:{chartType:"bar"}},{type:"kpi",label:"KPI",icon:oe(id,{}),defaultW:3,defaultH:2,defaultConfig:{value:"0",unit:""}},{type:"text",label:"Text",icon:oe(Rt,{}),defaultW:4,defaultH:2,defaultConfig:{text:""}},{type:"image",label:"Image",icon:oe(ha,{}),defaultW:4,defaultH:3,defaultConfig:{src:""}}],uh=20;function bI(){return`w_${Date.now()}_${Math.random().toString(36).slice(2,8)}`}function xI(e,t,a){return e.length===0?{x:0,y:0}:{x:0,y:Math.max(...e.map(o=>o.y+o.h))}}function Qce({widgets:e,onChange:t,definitions:a=fI,onSave:r,onPreview:o,renderPropertyEditor:n,columns:i=12,canvasHeight:c=600,readOnly:s=!1,className:d}){let[m,u]=Ap.useState([]),p=e??m,[f,x]=Ap.useState(null),[v,N]=Ap.useState([]),[h,b]=Ap.useState([]),g=p.find(I=>I.id===f)??null;function y(I){N(A=>[...A.slice(-(uh-1)),p]),b([]),t?.(I),e===void 0&&u(I)}function k(I){t?.(I),e===void 0&&u(I)}function w(I){if(s)return;let A=xI(p,I.defaultW,i),O={id:bI(),type:I.type,title:I.label,x:A.x,y:A.y,w:I.defaultW,h:I.defaultH,config:{...I.defaultConfig??{}}};y([...p,O]),x(O.id)}function R(I){s||(y(p.filter(A=>A.id!==I)),f===I&&x(null))}function S(I,A){let O=p.map(G=>G.id===I?{...G,...A}:G);k(O)}function z(I,A){let O=p.map(G=>G.id===I?{...G,config:{...G.config,...A}}:G);k(O)}function L(){if(v.length===0)return;let I=v[v.length-1];N(A=>A.slice(0,-1)),b(A=>[...A.slice(-(uh-1)),p]),k(I)}function H(){if(h.length===0)return;let I=h[h.length-1];b(A=>A.slice(0,-1)),N(A=>[...A.slice(-(uh-1)),p]),k(I)}let M=100/i,$=60;return rt("div",{"data-slot":"report-builder",className:l("flex h-full min-h-[500px] flex-col border border-border bg-background rounded-lg overflow-hidden",d),children:[rt("div",{"data-slot":"report-builder-toolbar",className:"flex items-center gap-2 border-b border-border px-3 py-2",children:[!s&&rt(ph,{children:[rt(C,{size:"sm",variant:"outline",disabled:v.length===0,onClick:L,"data-testid":"undo-button",children:[oe(Dc,{})," Undo"]}),rt(C,{size:"sm",variant:"outline",disabled:h.length===0,onClick:H,"data-testid":"redo-button",children:[oe(Mc,{})," Redo"]}),oe(Ue,{orientation:"vertical",className:"mx-1 h-5"})]}),rt("div",{className:"ml-auto flex items-center gap-2",children:[o&&rt(C,{size:"sm",variant:"outline",onClick:()=>o(p),"data-testid":"preview-button",children:[oe(Fn,{})," Preview"]}),r&&!s&&rt(C,{size:"sm",onClick:()=>r(p),"data-testid":"save-button",children:[oe(ol,{})," Save"]})]})]}),rt("div",{className:"flex flex-1 overflow-hidden",children:[!s&&rt("div",{"data-slot":"report-builder-palette",className:"w-52 shrink-0 border-r border-border",children:[oe("div",{className:"px-3 py-2 text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Widgets"}),oe(Wt,{className:"h-[calc(100%-2rem)]",children:oe("div",{className:"flex flex-col gap-1.5 p-2",children:a.map(I=>rt("button",{type:"button",onClick:()=>w(I),"data-testid":`palette-${I.type}`,className:"flex items-center gap-2 rounded-md border border-border bg-card px-2.5 py-2 text-sm text-left transition-colors hover:bg-muted cursor-pointer",children:[oe("span",{className:"text-muted-foreground [&_svg]:size-4",children:I.icon}),oe("span",{children:I.label}),oe(ge,{className:"ml-auto size-3.5 text-muted-foreground"})]},I.type))})})]}),oe("div",{"data-slot":"report-builder-canvas",className:"flex-1 overflow-auto",children:oe("div",{className:"relative",style:{minHeight:c,backgroundImage:"linear-gradient(to right, hsl(var(--border)) 1px, transparent 1px), linear-gradient(to bottom, hsl(var(--border)) 1px, transparent 1px)",backgroundSize:`${M}% ${$}px`},onClick:I=>{I.target===I.currentTarget&&x(null)},children:p.map(I=>{let A=I.id===f;return oe("div",{"data-slot":"report-builder-widget","data-widget-id":I.id,"data-widget-type":I.type,className:l("absolute rounded-lg border bg-card transition-shadow",A?"ring-2 ring-primary border-primary z-10":"border-border hover:border-primary/40"),style:{left:`${I.x*M}%`,top:I.y*$,width:`${I.w*M}%`,height:I.h*$},onClick:O=>{O.stopPropagation(),x(I.id)},children:rt(Y,{className:"h-full border-0 ring-0",children:[rt(le,{className:"flex-row items-center gap-1 py-1.5 px-2",children:[oe(ts,{className:"size-3.5 text-muted-foreground shrink-0 cursor-grab"}),oe(ie,{className:"text-xs truncate flex-1",children:I.title}),oe(B,{variant:"outline",className:"text-[10px] px-1 shrink-0",children:I.type}),!s&&oe(C,{variant:"ghost",size:"icon-xs",onClick:O=>{O.stopPropagation(),R(I.id)},"data-testid":`delete-widget-${I.id}`,className:"shrink-0",children:oe(ye,{className:"size-3"})})]}),rt(J,{className:"flex-1 flex items-center justify-center text-muted-foreground text-xs px-2 pb-2",children:[I.type==="kpi"&&rt("div",{className:"text-center",children:[oe("div",{className:"text-2xl font-bold text-foreground",children:String(I.config.value??"0")}),oe("div",{className:"text-[10px]",children:String(I.config.unit??"")})]}),I.type==="text"&&oe("p",{className:"text-left w-full truncate",children:String(I.config.text??"Text content")}),I.type==="table"&&oe("div",{className:"w-full space-y-1",children:Array.from({length:3}).map((O,G)=>oe("div",{className:"h-2 rounded bg-muted"},G))}),I.type==="chart"&&oe("div",{className:"flex items-end gap-1 h-10",children:[60,80,45,90,70].map((O,G)=>oe("div",{className:"w-3 rounded-t bg-primary/40",style:{height:`${O}%`}},G))}),I.type==="image"&&oe(ha,{className:"size-8 text-muted-foreground/40"})]})]})},I.id)})})}),g&&!s&&rt("div",{"data-slot":"report-builder-properties",className:"w-64 shrink-0 border-l border-border overflow-y-auto",children:[rt("div",{className:"px-3 py-2 text-xs font-semibold text-muted-foreground uppercase tracking-wider flex items-center",children:["Properties",oe(C,{variant:"ghost",size:"icon-xs",className:"ml-auto",onClick:()=>x(null),"data-testid":"close-properties",children:oe(ye,{className:"size-3"})})]}),oe(Ue,{}),rt("div",{className:"space-y-3 p-3",children:[rt("div",{children:[oe("label",{className:"text-xs text-muted-foreground",htmlFor:"rb-title",children:"Title"}),oe(T,{id:"rb-title","data-testid":"property-title",value:g.title,onChange:I=>S(g.id,{title:I.target.value})})]}),rt("div",{className:"grid grid-cols-2 gap-2",children:[rt("div",{children:[oe("label",{className:"text-xs text-muted-foreground",htmlFor:"rb-x",children:"X"}),oe(T,{id:"rb-x",type:"number","data-testid":"property-x",min:0,max:i-g.w,value:g.x,onChange:I=>S(g.id,{x:Math.max(0,Number(I.target.value))})})]}),rt("div",{children:[oe("label",{className:"text-xs text-muted-foreground",htmlFor:"rb-y",children:"Y"}),oe(T,{id:"rb-y",type:"number","data-testid":"property-y",min:0,value:g.y,onChange:I=>S(g.id,{y:Math.max(0,Number(I.target.value))})})]}),rt("div",{children:[oe("label",{className:"text-xs text-muted-foreground",htmlFor:"rb-w",children:"W"}),oe(T,{id:"rb-w",type:"number","data-testid":"property-w",min:1,max:i,value:g.w,onChange:I=>S(g.id,{w:Math.min(i,Math.max(1,Number(I.target.value)))})})]}),rt("div",{children:[oe("label",{className:"text-xs text-muted-foreground",htmlFor:"rb-h",children:"H"}),oe(T,{id:"rb-h",type:"number","data-testid":"property-h",min:1,value:g.h,onChange:I=>S(g.id,{h:Math.max(1,Number(I.target.value))})})]})]}),oe(Ue,{}),g.type==="table"&&rt("div",{children:[oe("label",{className:"text-xs text-muted-foreground",htmlFor:"rb-colcount",children:"Column Count"}),oe(T,{id:"rb-colcount",type:"number","data-testid":"property-column-count",min:1,value:Number(g.config.columnCount??5),onChange:I=>z(g.id,{columnCount:Number(I.target.value)})})]}),g.type==="chart"&&rt("div",{children:[oe("label",{className:"text-xs text-muted-foreground",htmlFor:"rb-charttype",children:"Chart Type"}),rt("select",{id:"rb-charttype","data-testid":"property-chart-type",className:"flex h-8 w-full rounded-lg border border-input bg-transparent px-2 text-sm",value:String(g.config.chartType??"bar"),onChange:I=>z(g.id,{chartType:I.target.value}),children:[oe("option",{value:"bar",children:"Bar"}),oe("option",{value:"line",children:"Line"}),oe("option",{value:"pie",children:"Pie"}),oe("option",{value:"area",children:"Area"})]})]}),g.type==="text"&&rt("div",{children:[oe("label",{className:"text-xs text-muted-foreground",htmlFor:"rb-text",children:"Text"}),oe(T,{id:"rb-text","data-testid":"property-text",value:String(g.config.text??""),onChange:I=>z(g.id,{text:I.target.value})})]}),g.type==="kpi"&&rt(ph,{children:[rt("div",{children:[oe("label",{className:"text-xs text-muted-foreground",htmlFor:"rb-kpi-value",children:"Value"}),oe(T,{id:"rb-kpi-value","data-testid":"property-kpi-value",value:String(g.config.value??""),onChange:I=>z(g.id,{value:I.target.value})})]}),rt("div",{children:[oe("label",{className:"text-xs text-muted-foreground",htmlFor:"rb-kpi-unit",children:"Unit"}),oe(T,{id:"rb-kpi-unit","data-testid":"property-kpi-unit",value:String(g.config.unit??""),onChange:I=>z(g.id,{unit:I.target.value})})]})]}),g.type==="image"&&rt("div",{children:[oe("label",{className:"text-xs text-muted-foreground",htmlFor:"rb-img-src",children:"Image URL"}),oe(T,{id:"rb-img-src","data-testid":"property-image-src",value:String(g.config.src??""),onChange:I=>z(g.id,{src:I.target.value})})]}),n&&rt(ph,{children:[oe(Ue,{}),n(g,I=>z(g.id,I))]})]})]})]})]})}import*as lc from"react";import{Fragment as bk,jsx as K,jsxs as Ke}from"react/jsx-runtime";var vI=["kpi","chart-line","chart-bar","chart-pie","chart-donut","table","text","filter"],gh={kpi:{label:"KPI",icon:K(id,{}),defaultW:3,defaultH:2,defaultConfig:{value:"0",unit:""}},"chart-line":{label:"Line Chart",icon:K(rd,{}),defaultW:6,defaultH:4,defaultConfig:{chartType:"line"}},"chart-bar":{label:"Bar Chart",icon:K(rd,{}),defaultW:6,defaultH:4,defaultConfig:{chartType:"bar"}},"chart-pie":{label:"Pie Chart",icon:K(rd,{}),defaultW:4,defaultH:4,defaultConfig:{chartType:"pie"}},"chart-donut":{label:"Donut Chart",icon:K(rd,{}),defaultW:4,defaultH:4,defaultConfig:{chartType:"donut"}},table:{label:"Table",icon:K(yg,{}),defaultW:6,defaultH:4,defaultConfig:{columnCount:5}},text:{label:"Text",icon:K(Rt,{}),defaultW:4,defaultH:2,defaultConfig:{text:""}},filter:{label:"Filter",icon:K(Gs,{}),defaultW:3,defaultH:1,defaultConfig:{filterType:"select"}}},fh=20;function hI(){return`dw_${Date.now()}_${Math.random().toString(36).slice(2,8)}`}function yI(e,t,a){return e.length===0?{x:0,y:0}:{x:0,y:Math.max(...e.map(o=>o.y+o.h))}}function lme({config:e,onChange:t,onSave:a,onPreview:r,availableWidgets:o=vI,renderWidget:n,columns:i=12,readOnly:c=!1,className:s}){let d={widgets:[],filters:[]},[m,u]=lc.useState(d),p=e??m,f=p.widgets,[x,v]=lc.useState(null),[N,h]=lc.useState(!1),[b,g]=lc.useState([]),[y,k]=lc.useState([]),[w,R]=lc.useState(!1),S=f.find(F=>F.id===x)??null;function z(F){g(ce=>[...ce.slice(-(fh-1)),p]),k([]),t?.(F),e===void 0&&u(F)}function L(F){t?.(F),e===void 0&&u(F)}function H(F){let ce=gh[F];if(!ce)return;let lt=yI(f,ce.defaultW,i),ct={id:hI(),type:F,title:ce.label,x:lt.x,y:lt.y,w:ce.defaultW,h:ce.defaultH,config:{...ce.defaultConfig}},kr={...p,widgets:[...f,ct]};z(kr),v(ct.id)}function M(F){let ce={...p,widgets:f.filter(lt=>lt.id!==F)};z(ce),x===F&&(v(null),h(!1))}function $(F,ce){let lt={...p,widgets:f.map(ct=>ct.id===F?{...ct,...ce}:ct)};L(lt)}function I(F,ce){let lt={...p,widgets:f.map(ct=>ct.id===F?{...ct,config:{...ct.config,...ce}}:ct)};L(lt)}function A(){if(b.length===0)return;let F=b[b.length-1];g(ce=>ce.slice(0,-1)),k(ce=>[...ce.slice(-(fh-1)),p]),L(F)}function O(){if(y.length===0)return;let F=y[y.length-1];k(ce=>ce.slice(0,-1)),g(ce=>[...ce.slice(-(fh-1)),p]),L(F)}function G(F){v(F),c||h(!0)}let Ce=100/i,j=60,de=!c&&!w;return w?Ke("div",{"data-slot":"dashboard-designer","data-preview":"true",className:l("flex flex-col border border-border bg-background rounded-lg overflow-hidden",s),children:[Ke("div",{className:"flex items-center gap-2 border-b border-border px-3 py-2",children:[K("span",{className:"text-sm font-medium",children:"Preview"}),K(C,{size:"sm",variant:"outline",className:"ml-auto",onClick:()=>R(!1),"data-testid":"exit-preview-button",children:"Exit Preview"})]}),K("div",{className:"flex-1 overflow-auto p-4",children:K("div",{className:"relative",style:{minHeight:400},children:f.map(F=>K("div",{"data-slot":"dashboard-designer-widget","data-widget-id":F.id,"data-widget-type":F.type,className:"absolute rounded-lg border border-border bg-card",style:{left:`${F.x*Ce}%`,top:F.y*j,width:`${F.w*Ce}%`,height:F.h*j},children:Ke(Y,{className:"h-full border-0 ring-0",children:[K(le,{className:"py-1.5 px-2",children:K(ie,{className:"text-xs",children:F.title})}),K(J,{className:"flex-1 flex items-center justify-center text-muted-foreground text-xs px-2 pb-2",children:n?n(F):K("span",{children:F.type})})]})},F.id))})})]}):Ke("div",{"data-slot":"dashboard-designer",className:l("flex flex-col border border-border bg-background rounded-lg overflow-hidden",s),children:[Ke("div",{"data-slot":"dashboard-designer-toolbar",className:"flex items-center gap-2 border-b border-border px-3 py-2",children:[de&&Ke(bk,{children:[Ke(C,{size:"sm",variant:"outline",disabled:b.length===0,onClick:A,"data-testid":"undo-button",children:[K(Dc,{})," Undo"]}),Ke(C,{size:"sm",variant:"outline",disabled:y.length===0,onClick:O,"data-testid":"redo-button",children:[K(Mc,{})," Redo"]}),K(Ue,{orientation:"vertical",className:"mx-1 h-5"}),Ke(sr,{children:[Ke(ir,{render:K(C,{size:"sm",variant:"outline","data-testid":"add-widget-button"}),children:[K(ge,{})," Add Widget ",K(re,{className:"size-3.5"})]}),K(lr,{children:o.map(F=>{let ce=gh[F];return ce?Ke(la,{"data-testid":`catalog-${F}`,onClick:()=>H(F),children:[K("span",{className:"mr-2 [&_svg]:size-4",children:ce.icon}),ce.label]},F):null})})]})]}),Ke("div",{className:"ml-auto flex items-center gap-2",children:[r&&Ke(C,{size:"sm",variant:"outline",onClick:()=>{R(!0),r(p)},"data-testid":"preview-button",children:[K(Fn,{})," Preview"]}),a&&!c&&Ke(C,{size:"sm",onClick:()=>a(p),"data-testid":"save-button",children:[K(ol,{})," Save"]})]})]}),K("div",{"data-slot":"dashboard-designer-canvas",className:"flex-1 overflow-auto p-4",children:Ke("div",{className:"relative",style:{minHeight:500,backgroundImage:de?"linear-gradient(to right, hsl(var(--border)) 1px, transparent 1px), linear-gradient(to bottom, hsl(var(--border)) 1px, transparent 1px)":void 0,backgroundSize:`${Ce}% ${j}px`},onClick:F=>{F.target===F.currentTarget&&(v(null),h(!1))},children:[f.length===0&&K("div",{className:"flex items-center justify-center h-[400px] text-muted-foreground text-sm",children:de?'Click "Add Widget" to get started':"No widgets configured"}),f.map(F=>{let ce=F.id===x,lt=gh[F.type];return K("div",{"data-slot":"dashboard-designer-widget","data-widget-id":F.id,"data-widget-type":F.type,className:l("absolute rounded-lg border bg-card transition-shadow",ce?"ring-2 ring-primary border-primary z-10":"border-border hover:border-primary/40"),style:{left:`${F.x*Ce}%`,top:F.y*j,width:`${F.w*Ce}%`,height:F.h*j},onClick:ct=>{ct.stopPropagation(),G(F.id)},children:Ke(Y,{className:"h-full border-0 ring-0",children:[Ke(le,{className:"flex-row items-center gap-1 py-1.5 px-2",children:[de&&K(ts,{className:"size-3.5 text-muted-foreground shrink-0 cursor-grab"}),K(ie,{className:"text-xs truncate flex-1",children:F.title}),K(B,{variant:"outline",className:"text-[10px] px-1 shrink-0",children:lt?.label??F.type}),de&&K(C,{variant:"ghost",size:"icon-xs",onClick:ct=>{ct.stopPropagation(),M(F.id)},"data-testid":`delete-widget-${F.id}`,className:"shrink-0",children:K(ye,{className:"size-3"})})]}),K(J,{className:"flex-1 flex items-center justify-center text-muted-foreground text-xs px-2 pb-2",children:n?n(F):K(NI,{type:F.type,config:F.config})})]})},F.id)})]})}),de&&K(ud,{open:N,onOpenChange:h,children:Ke(pd,{side:"right",className:"w-80 p-0",children:[K(gd,{className:"border-b border-border",children:K(fd,{children:"Widget Properties"})}),S&&K(Wt,{className:"flex-1",children:Ke("div",{className:"space-y-3 p-4",children:[Ke("div",{children:[K("label",{className:"text-xs text-muted-foreground",htmlFor:"dd-title",children:"Title"}),K(T,{id:"dd-title","data-testid":"property-title",value:S.title,onChange:F=>$(S.id,{title:F.target.value})})]}),Ke("div",{className:"grid grid-cols-2 gap-2",children:[Ke("div",{children:[K("label",{className:"text-xs text-muted-foreground",htmlFor:"dd-x",children:"X"}),K(T,{id:"dd-x",type:"number","data-testid":"property-x",min:0,max:i-S.w,value:S.x,onChange:F=>$(S.id,{x:Math.max(0,Number(F.target.value))})})]}),Ke("div",{children:[K("label",{className:"text-xs text-muted-foreground",htmlFor:"dd-y",children:"Y"}),K(T,{id:"dd-y",type:"number","data-testid":"property-y",min:0,value:S.y,onChange:F=>$(S.id,{y:Math.max(0,Number(F.target.value))})})]}),Ke("div",{children:[K("label",{className:"text-xs text-muted-foreground",htmlFor:"dd-w",children:"W"}),K(T,{id:"dd-w",type:"number","data-testid":"property-w",min:1,max:i,value:S.w,onChange:F=>$(S.id,{w:Math.min(i,Math.max(1,Number(F.target.value)))})})]}),Ke("div",{children:[K("label",{className:"text-xs text-muted-foreground",htmlFor:"dd-h",children:"H"}),K(T,{id:"dd-h",type:"number","data-testid":"property-h",min:1,value:S.h,onChange:F=>$(S.id,{h:Math.max(1,Number(F.target.value))})})]})]}),K(Ue,{}),(S.type==="chart-line"||S.type==="chart-bar"||S.type==="chart-pie"||S.type==="chart-donut")&&Ke("div",{children:[K("label",{className:"text-xs text-muted-foreground",htmlFor:"dd-charttype",children:"Chart Type"}),Ke("select",{id:"dd-charttype","data-testid":"property-chart-type",className:"flex h-8 w-full rounded-lg border border-input bg-transparent px-2 text-sm",value:String(S.config.chartType??S.type.replace("chart-","")),onChange:F=>I(S.id,{chartType:F.target.value}),children:[K("option",{value:"line",children:"Line"}),K("option",{value:"bar",children:"Bar"}),K("option",{value:"pie",children:"Pie"}),K("option",{value:"donut",children:"Donut"}),K("option",{value:"area",children:"Area"})]})]}),S.type==="kpi"&&Ke(bk,{children:[Ke("div",{children:[K("label",{className:"text-xs text-muted-foreground",htmlFor:"dd-kpi-value",children:"Value"}),K(T,{id:"dd-kpi-value","data-testid":"property-kpi-value",value:String(S.config.value??""),onChange:F=>I(S.id,{value:F.target.value})})]}),Ke("div",{children:[K("label",{className:"text-xs text-muted-foreground",htmlFor:"dd-kpi-unit",children:"Unit"}),K(T,{id:"dd-kpi-unit","data-testid":"property-kpi-unit",value:String(S.config.unit??""),onChange:F=>I(S.id,{unit:F.target.value})})]})]}),S.type==="table"&&Ke("div",{children:[K("label",{className:"text-xs text-muted-foreground",htmlFor:"dd-colcount",children:"Column Count"}),K(T,{id:"dd-colcount",type:"number","data-testid":"property-column-count",min:1,value:Number(S.config.columnCount??5),onChange:F=>I(S.id,{columnCount:Number(F.target.value)})})]}),S.type==="text"&&Ke("div",{children:[K("label",{className:"text-xs text-muted-foreground",htmlFor:"dd-text",children:"Text"}),K(T,{id:"dd-text","data-testid":"property-text",value:String(S.config.text??""),onChange:F=>I(S.id,{text:F.target.value})})]}),S.type==="filter"&&Ke("div",{children:[K("label",{className:"text-xs text-muted-foreground",htmlFor:"dd-filter-type",children:"Filter Type"}),Ke("select",{id:"dd-filter-type","data-testid":"property-filter-type",className:"flex h-8 w-full rounded-lg border border-input bg-transparent px-2 text-sm",value:String(S.config.filterType??"select"),onChange:F=>I(S.id,{filterType:F.target.value}),children:[K("option",{value:"date-range",children:"Date Range"}),K("option",{value:"select",children:"Select"}),K("option",{value:"search",children:"Search"})]})]})]})})]})})]})}function NI({type:e,config:t}){return e==="kpi"?Ke("div",{className:"text-center",children:[K("div",{className:"text-2xl font-bold text-foreground",children:String(t.value??"0")}),K("div",{className:"text-[10px]",children:String(t.unit??"")})]}):e==="text"?K("p",{className:"text-left w-full truncate",children:String(t.text??"Text content")}):e==="table"?K("div",{className:"w-full space-y-1",children:Array.from({length:3}).map((a,r)=>K("div",{className:"h-2 rounded bg-muted"},r))}):e.startsWith("chart-")?K("div",{className:"flex items-end gap-1 h-10",children:[60,80,45,90,70].map((a,r)=>K("div",{className:"w-3 rounded-t bg-primary/40",style:{height:`${a}%`}},r))}):e==="filter"?Ke("div",{className:"flex items-center gap-1 text-[10px]",children:[K(Gs,{className:"size-3"}),K("span",{children:String(t.filterType??"Filter")})]}):K("span",{className:"text-muted-foreground",children:e})}import*as ga from"react";import{jsx as se,jsxs as Be}from"react/jsx-runtime";var CI={party:"Party Info",financial:"Financial",date:"Dates",terms:"Terms",custom:"Custom"},Eb={draft:{label:"Draft",className:"bg-muted text-muted-foreground"},review:{label:"Under Review",className:"bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-400"},signed:{label:"Signed",className:"bg-emerald-100 text-emerald-800 dark:bg-emerald-900/30 dark:text-emerald-400"},expired:{label:"Expired",className:"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400"},cancelled:{label:"Cancelled",className:"bg-gray-100 text-gray-700 dark:bg-gray-800/30 dark:text-gray-400"}},kI=[{label:"Sales",value:"sales"},{label:"Purchase",value:"purchase"},{label:"Service",value:"service"},{label:"Lease",value:"lease"},{label:"Other",value:"other"}],wI=[{label:"Draft",value:"draft"},{label:"Under Review",value:"review"},{label:"Signed",value:"signed"},{label:"Expired",value:"expired"},{label:"Cancelled",value:"cancelled"}],PI=/\{\{(\w+)\}\}/g;function TI(e){let t=new Map;for(let a of e){let r=t.get(a.category);r?r.push(a):t.set(a.category,[a])}return t}function RI(e,t,a){if(!e)return[];let r={};for(let d of a)d.defaultValue!=null&&(r[d.name]=d.defaultValue);let o=[],n=0,i,c=new RegExp(PI.source,"g"),s=0;for(;(i=c.exec(e))!==null;){i.index>n&&o.push(e.slice(n,i.index));let d=i[1],m=t[d]??r[d]??"",u=m!==""?String(m):`{{${d}}}`,p=m!=="";o.push(se("span",{className:l("inline rounded px-0.5",p?"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400":"bg-muted text-muted-foreground"),"data-slot":"contract-template-merge-field","data-field-name":d,children:u},`merge-${s++}`)),n=i.index+i[0].length}return n<e.length&&o.push(e.slice(n)),o}function Cme({template:e,onTemplateChange:t,fields:a=[],metadata:r,onMetadataChange:o,sampleValues:n={},onSave:i,readOnly:c=!1,activeTab:s,onTabChange:d,className:m}){let[u,p]=ga.useState(e??""),[f,x]=ga.useState(r??{}),[v,N]=ga.useState(s??"edit"),[h,b]=ga.useState(!0),g=ga.useRef(null);ga.useEffect(()=>{e!==void 0&&p(e)},[e]),ga.useEffect(()=>{r!==void 0&&x(r)},[r]),ga.useEffect(()=>{s!==void 0&&N(s)},[s]);let y=e??u,k=r??f,w=s??v,R=ga.useCallback(A=>{p(A),t?.(A)},[t]),S=ga.useCallback(A=>{let O={...k,...A};x(O),o?.(O)},[k,o]),z=ga.useCallback(A=>{let O=String(A);N(O),d?.(O)},[d]),L=ga.useCallback(A=>{if(c)return;let O=g.current,G=`{{${A}}}`;if(O){let Ce=O.selectionStart??y.length,j=O.selectionEnd??Ce,de=y.slice(0,Ce),F=y.slice(j),ce=de+G+F;R(ce),requestAnimationFrame(()=>{O.focus();let lt=Ce+G.length;O.setSelectionRange(lt,lt)})}else R(y+G)},[c,y,R]),H=ga.useCallback(A=>{if(c)return;let O=g.current;if(!O)return;let G=O.selectionStart??0,Ce=O.selectionEnd??0,j=y.slice(G,Ce),de=`${A}${j}${A}`,F=y.slice(0,G)+de+y.slice(Ce);R(F),requestAnimationFrame(()=>{O.focus();let ce=G+A.length+j.length+A.length;O.setSelectionRange(ce,ce)})},[c,y,R]),M=ga.useCallback(()=>{i?.({template:y,metadata:k})},[i,y,k]),$=ga.useMemo(()=>TI(a),[a]),I=k.status?Eb[k.status]:null;return Be("div",{"data-slot":"contract-template",className:l("flex flex-col gap-4 rounded-lg border bg-card p-4",m),role:"region","aria-label":"Contract Template",children:[Be("div",{className:"flex items-center justify-between",children:[Be("div",{className:"flex items-center gap-3",children:[se(Rt,{className:"text-muted-foreground size-5"}),se(ie,{className:"text-base",children:"Contract Template"}),I&&se(B,{variant:"secondary",className:l("text-xs",I.className),"data-slot":"contract-template-status",children:I.label}),k.contractNo&&se("span",{className:"text-muted-foreground font-mono text-xs",children:k.contractNo})]}),Be("div",{className:"flex items-center gap-2",children:[Be(C,{variant:"outline",size:"sm",onClick:()=>z("preview"),"aria-label":"Preview contract",children:[se(Fn,{className:"size-4"}),"Preview"]}),!c&&Be(C,{variant:"default",size:"sm",onClick:M,"aria-label":"Save contract",children:[se(ol,{className:"size-4"}),"Save"]})]})]}),se(Ue,{}),Be(Sr,{value:w,onValueChange:z,"data-slot":"contract-template-tabs",children:[Be(Ir,{children:[Be(Ba,{value:"edit",disabled:c,children:[se(tl,{className:"size-3.5"}),"Edit"]}),Be(Ba,{value:"preview",children:[se(Fn,{className:"size-3.5"}),"Preview"]}),Be(Ba,{value:"metadata",children:[se(Rc,{className:"size-3.5"}),"Metadata"]})]}),se(Co,{value:"edit",className:"mt-3",children:Be("div",{className:"flex gap-3",children:[Be("div",{className:"flex min-w-0 flex-1 flex-col gap-2",children:[Be("div",{className:"flex items-center gap-1 rounded-md border bg-muted/50 px-2 py-1",role:"toolbar","aria-label":"Text formatting",children:[se(C,{variant:"ghost",size:"icon-xs",onClick:()=>H("**"),"aria-label":"Bold",type:"button",children:se(Sc,{className:"size-4"})}),se(C,{variant:"ghost",size:"icon-xs",onClick:()=>H("*"),"aria-label":"Italic",type:"button",children:se(Ic,{className:"size-4"})}),se(Ue,{orientation:"vertical",className:"mx-1 h-4"}),Be("span",{className:"text-muted-foreground text-xs",children:["Use ","{{fieldName}}"," for merge fields"]})]}),se(St,{ref:g,value:y,onChange:A=>R(A.target.value),placeholder:"Enter contract template text. Use {{fieldName}} syntax for merge fields...",className:"min-h-[400px] font-mono text-sm",readOnly:c,disabled:c,"aria-label":"Contract template editor","data-slot":"contract-template-textarea"})]}),Be("div",{className:l("flex flex-col border-l pl-3 transition-all",h?"w-56":"w-8"),"data-slot":"contract-template-sidebar",children:[se(C,{variant:"ghost",size:"icon-xs",onClick:()=>b(!h),"aria-label":h?"Collapse sidebar":"Expand sidebar",className:"self-end",type:"button",children:h?se(me,{className:"size-4"}):se(et,{className:"size-4"})}),h&&se(Wt,{className:"max-h-[450px]",children:Be("div",{className:"flex flex-col gap-3 pr-2",children:[se("span",{className:"text-muted-foreground text-xs font-semibold",children:"Merge Fields"}),Array.from($.entries()).map(([A,O])=>Be("div",{className:"flex flex-col gap-1.5",children:[se("span",{className:"text-muted-foreground/80 text-xs font-medium",children:CI[A]??A}),se("div",{className:"flex flex-wrap gap-1",children:O.map(G=>Be("button",{type:"button",onClick:()=>L(G.name),className:l("inline-flex cursor-pointer items-center gap-1 rounded-md border px-2 py-0.5 text-xs","bg-background transition-colors hover:bg-muted","text-foreground/80 hover:text-foreground",c&&"pointer-events-none opacity-50"),title:G.description??G.label,"aria-label":`Insert ${G.label} field`,"data-slot":"contract-template-field-chip","data-field-name":G.name,children:[se(ge,{className:"size-3"}),G.label]},G.name))})]},A)),a.length===0&&se("span",{className:"text-muted-foreground text-xs",children:"No fields available"})]})})]})]})}),se(Co,{value:"preview",className:"mt-3",children:Be(Y,{children:[Be(le,{children:[Be("div",{className:"flex items-center justify-between",children:[se(ie,{className:"text-sm",children:"Document Preview"}),k.contractNo&&se("span",{className:"text-muted-foreground font-mono text-xs",children:k.contractNo})]}),k.partyA&&k.partyB&&Be("div",{className:"text-muted-foreground flex gap-4 text-xs",children:[Be("span",{className:"flex items-center gap-1",children:[se(sx,{className:"size-3"}),k.partyA]}),se("span",{children:"&"}),Be("span",{className:"flex items-center gap-1",children:[se(sx,{className:"size-3"}),k.partyB]})]})]}),se(Ue,{}),se(J,{className:"pt-4",children:y?se("div",{className:"whitespace-pre-wrap text-sm leading-relaxed","data-slot":"contract-template-preview-content",children:RI(y,n,a)}):se("p",{className:"text-muted-foreground text-sm italic",children:"No template content to preview."})})]})}),se(Co,{value:"metadata",className:"mt-3",children:Be("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2","data-slot":"contract-template-metadata",children:[Be("div",{className:"flex flex-col gap-1.5",children:[se("label",{htmlFor:"ct-contract-no",className:"text-muted-foreground text-xs font-medium",children:"Contract No"}),se(T,{id:"ct-contract-no",value:k.contractNo??"",onChange:A=>S({contractNo:A.target.value}),placeholder:"e.g. C-2025-001",disabled:c,"data-slot":"contract-template-field-contractNo"})]}),Be("div",{className:"flex flex-col gap-1.5",children:[se("label",{htmlFor:"ct-contract-type",className:"text-muted-foreground text-xs font-medium",children:"Contract Type"}),Be(Pe,{value:k.contractType??"",onValueChange:A=>S({contractType:A??""}),disabled:c,children:[se(Re,{className:"w-full",id:"ct-contract-type","data-slot":"contract-template-field-contractType",children:se(Te,{placeholder:"Select type..."})}),se(Se,{children:kI.map(A=>se(ve,{value:A.value,children:A.label},A.value))})]})]}),Be("div",{className:"flex flex-col gap-1.5",children:[Be("label",{htmlFor:"ct-effective-date",className:"text-muted-foreground text-xs font-medium",children:[se(jr,{className:"mr-1 inline size-3"}),"Effective Date"]}),se(T,{id:"ct-effective-date",type:"date",value:k.effectiveDate??"",onChange:A=>S({effectiveDate:A.target.value}),disabled:c,"data-slot":"contract-template-field-effectiveDate"})]}),Be("div",{className:"flex flex-col gap-1.5",children:[Be("label",{htmlFor:"ct-expiry-date",className:"text-muted-foreground text-xs font-medium",children:[se(jr,{className:"mr-1 inline size-3"}),"Expiry Date"]}),se(T,{id:"ct-expiry-date",type:"date",value:k.expiryDate??"",onChange:A=>S({expiryDate:A.target.value}),disabled:c,"data-slot":"contract-template-field-expiryDate"})]}),Be("div",{className:"flex flex-col gap-1.5",children:[Be("label",{htmlFor:"ct-party-a",className:"text-muted-foreground text-xs font-medium",children:[se(js,{className:"mr-1 inline size-3"}),"Party A"]}),se(T,{id:"ct-party-a",value:k.partyA??"",onChange:A=>S({partyA:A.target.value}),placeholder:"Company or individual name",disabled:c,"data-slot":"contract-template-field-partyA"})]}),Be("div",{className:"flex flex-col gap-1.5",children:[Be("label",{htmlFor:"ct-party-b",className:"text-muted-foreground text-xs font-medium",children:[se(js,{className:"mr-1 inline size-3"}),"Party B"]}),se(T,{id:"ct-party-b",value:k.partyB??"",onChange:A=>S({partyB:A.target.value}),placeholder:"Company or individual name",disabled:c,"data-slot":"contract-template-field-partyB"})]}),Be("div",{className:"flex flex-col gap-1.5",children:[Be("label",{htmlFor:"ct-amount",className:"text-muted-foreground text-xs font-medium",children:[se(ig,{className:"mr-1 inline size-3"}),"Amount"]}),se(T,{id:"ct-amount",type:"number",value:k.amount??"",onChange:A=>S({...A.target.value?{amount:Number(A.target.value)}:{}}),placeholder:"0.00",disabled:c,"data-slot":"contract-template-field-amount"})]}),Be("div",{className:"flex flex-col gap-1.5",children:[se("label",{htmlFor:"ct-status",className:"text-muted-foreground text-xs font-medium",children:"Status"}),Be("div",{className:"flex items-center gap-2",children:[Be(Pe,{value:k.status??"",onValueChange:A=>{A&&S({status:A})},disabled:c,children:[se(Re,{className:"w-full",id:"ct-status","data-slot":"contract-template-field-status",children:se(Te,{placeholder:"Select status..."})}),se(Se,{children:wI.map(A=>se(ve,{value:A.value,children:A.label},A.value))})]}),k.status&&Eb[k.status]&&se(B,{variant:"secondary",className:l("text-xs",Eb[k.status].className),"data-slot":"contract-template-status-badge",children:Eb[k.status].label})]})]})]})})]})]})}import*as Ia from"react";import{useTranslation as SI}from"react-i18next";import{jsx as We,jsxs as Fa}from"react/jsx-runtime";function zme({open:e,onOpenChange:t,loadData:a,columns:r,value:o,defaultValue:n=[],onChange:i,rowKey:c="id",tree:s,title:d,searchPlaceholder:m,emptyText:u,className:p,pageSize:f=10,searchDebounceMs:x=300,maxSelect:v,minSelect:N}){let{t:h}=SI("ui"),b=c,g=d??h("browseDialog.title",{defaultValue:"\u9009\u62E9"}),y=m??h("browseDialog.search",{defaultValue:"\u641C\u7D22..."}),k=u??h("browseDialog.empty",{defaultValue:"\u6682\u65E0\u6570\u636E"}),[w,R]=Ia.useState(""),[S,z]=Ia.useState(1),[L]=Ia.useState(f),[H,M]=Ia.useState([]),[$,I]=Ia.useState(0),[A,O]=Ia.useState(!1),G=Ia.useRef(new Map),[,Ce]=Ia.useState(0),j=()=>Ce(ee=>ee+1),[de,F]=Ia.useState([]),[ce,lt]=Ia.useState(void 0),[ct,kr]=Ia.useState(new Set(s?.defaultExpandedKeys??[])),Z=o!==void 0;Ia.useEffect(()=>{if(Z&&o){let ee=new Map;for(let Ot of o)ee.set(String(Ot[b]),Ot);G.current=ee,j()}},[Z,o,b]);let V=Ia.useRef(0);Ia.useEffect(()=>{if(!e)return;V.current+=1;let ee=V.current,Ot=setTimeout(()=>{O(!0),a({keyword:w,page:S,pageSize:L,...ce!==void 0?{categoryId:ce}:{}}).then(Ut=>{ee===V.current&&(M(Ut.rows),I(Ut.total))}).catch(()=>{ee===V.current&&(M([]),I(0))}).finally(()=>{ee===V.current&&O(!1)})},x);return()=>clearTimeout(Ot)},[e,w,S,L,ce,a,x]),Ia.useEffect(()=>{e&&s&&s.loadTree().then(F).catch(()=>F([]))},[e,s]),Ia.useEffect(()=>{e&&(R(""),z(1),lt(void 0),Z||(G.current=new Map,j()))},[e,Z]);let te=ee=>{let Ot=String(ee[b]),Ut=G.current;if(Ut.has(Ot))Ut.delete(Ot);else{if(v!=null&&Ut.size>=v)return;Ut.set(Ot,ee)}j()},ae=()=>{let ee=G.current,Ot=H.every(Ut=>ee.has(String(Ut[b])));for(let Ut of H){let td=String(Ut[b]);if(Ot)ee.delete(td);else{if(v!=null&&ee.size>=v)break;ee.set(td,Ut)}}j()},mt=ee=>{G.current.delete(String(ee)),j()},je=()=>{let ee=Array.from(G.current.values());N!=null&&ee.length<N||(i?.(ee),t(!1))},nt=()=>{t(!1)},ft=ee=>{kr(Ot=>{let Ut=new Set(Ot);return Ut.has(ee)?Ut.delete(ee):Ut.add(ee),Ut})},ea=ee=>{lt(ee.id),z(1)},Wa=G.current,Qi=Wa.size,Lh=H.length>0&&H.every(ee=>Wa.has(String(ee[b]))),cw=H.some(ee=>Wa.has(String(ee[b]))),mw=Qi>=(N??0)&&(v==null||Qi<=v),zh={left:"text-left",center:"text-center",right:"text-right"};return We(Ie,{open:e,onOpenChange:t,children:Fa(De,{"data-slot":"browse-dialog",className:l("sm:max-w-3xl",p),showCloseButton:!0,children:[Fa($e,{children:[We(Me,{children:g}),We(Ye,{children:v!=null?h("browseDialog.descriptionMax",{defaultValue:`\u6700\u591A\u53EF\u9009 ${v} \u9879`,max:v}):h("browseDialog.description",{defaultValue:"\u4ECE\u5217\u8868\u4E2D\u9009\u62E9"})})]}),Fa("div",{className:l("flex gap-0",s&&"min-h-[400px]"),children:[s&&We("div",{className:"w-48 shrink-0 border-r pr-2 overflow-y-auto",children:Fa("ul",{className:"space-y-0.5 py-1 text-sm",children:[We("li",{children:We("button",{type:"button",onClick:()=>{lt(void 0),z(1)},className:l("flex w-full items-center gap-1.5 rounded-sm px-2 py-1.5 text-left transition-colors hover:bg-muted",ce===void 0&&"bg-accent font-medium"),children:h("browseDialog.allCategories",{defaultValue:"\u5168\u90E8\u5206\u7C7B"})})}),de.map(ee=>We(xk,{node:ee,depth:0,expandedKeys:ct,activeCategoryId:ce,onToggleExpand:ft,onSelect:ea},String(ee.id)))]})}),Fa("div",{className:"flex-1 flex flex-col min-w-0 gap-3 pl-0 pl-3",children:[Fa("div",{className:"flex items-center gap-2 border rounded-lg px-2",children:[We(X,{className:"size-4 shrink-0 opacity-50"}),We(T,{value:w,onChange:ee=>{R(ee.target.value),z(1)},placeholder:y,"aria-label":y,className:"h-8 border-0 bg-transparent p-0 shadow-none focus-visible:ring-0"})]}),Qi>0&&Fa("div",{className:"flex flex-wrap items-center gap-1",children:[Fa("span",{className:"text-xs text-muted-foreground shrink-0",children:[h("browseDialog.selected",{defaultValue:`\u5DF2\u9009 ${Qi} \u9879`,count:Qi}),":"]}),Array.from(Wa.values()).map(ee=>{let Ot=String(ee[b]),Ut=typeof ee.name=="string"?ee.name:typeof ee.code=="string"?ee.code:Ot;return Fa(B,{variant:"secondary",className:"gap-1 cursor-default",children:[We("span",{className:"max-w-[120px] truncate",children:Ut}),We("button",{type:"button",onClick:()=>mt(Ot),className:"ml-0.5 inline-flex size-3 items-center justify-center rounded-full hover:bg-muted-foreground/20","aria-label":h("browseDialog.removeItem",{defaultValue:"\u79FB\u9664"}),children:We(Q,{className:"size-2.5"})})]},Ot)})]}),We("div",{className:"overflow-x-auto rounded-md border",children:Fa(ze,{children:[We(Ae,{children:Fa(W,{children:[We(E,{className:"w-10",children:We("input",{type:"checkbox",checked:Lh,ref:ee=>{ee&&(ee.indeterminate=cw&&!Lh)},onChange:ae,className:"size-4 rounded-[4px] border-input cursor-pointer","aria-label":h("browseDialog.selectAll",{defaultValue:"\u5168\u9009\u5F53\u524D\u9875"})})}),r.map(ee=>We(E,{className:zh[ee.align||"left"],style:{width:ee.width,minWidth:ee.width},children:ee.title},ee.key))]})}),We(ke,{children:A?Array.from({length:5}).map((ee,Ot)=>Fa(W,{children:[We(D,{children:We(ut,{className:"h-4 w-4"})}),r.map((Ut,td)=>We(D,{children:We(ut,{className:"h-4 w-full"})},td))]},Ot)):H.length===0?We(W,{children:We(D,{colSpan:r.length+1,className:"py-12 text-center text-muted-foreground",children:k})}):H.map((ee,Ot)=>{let Ut=String(ee[b]||Ot),td=Wa.has(Ut);return Fa(W,{className:l("cursor-pointer hover:bg-muted/50",td&&"bg-accent/30"),onClick:()=>te(ee),children:[We(D,{onClick:Xi=>Xi.stopPropagation(),children:We("input",{type:"checkbox",checked:td,onChange:()=>te(ee),className:"size-4 rounded-[4px] border-input cursor-pointer","aria-label":h("browseDialog.selectItem",{defaultValue:"\u9009\u62E9\u6B64\u9879"})})}),r.map(Xi=>{let uw=Xi.dataIndex||Xi.key,ox=ee[uw],pw=Xi.render?Xi.render(ox,ee,Ot):ox!=null?String(ox):"-";return We(D,{className:zh[Xi.align||"left"],children:pw},Xi.key)})]},Ut)})})]})}),Fa("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[We("span",{children:h("browseDialog.total",{defaultValue:`\u5171 ${$} \u6761`,count:$})}),Fa("div",{className:"flex items-center gap-1",children:[We(C,{variant:"outline",size:"sm",disabled:S<=1,onClick:()=>z(ee=>ee-1),children:h("browseDialog.prevPage",{defaultValue:"\u4E0A\u4E00\u9875"})}),Array.from({length:Math.ceil($/L)},(ee,Ot)=>Ot+1).slice(Math.max(0,S-3),Math.min(Math.ceil($/L),S+2)).map(ee=>We(C,{variant:ee===S?"default":"outline",size:"sm",onClick:()=>z(ee),children:ee},ee)),We(C,{variant:"outline",size:"sm",disabled:S>=Math.ceil($/L),onClick:()=>z(ee=>ee+1),children:h("browseDialog.nextPage",{defaultValue:"\u4E0B\u4E00\u9875"})})]})]})]})]}),Fa(Ge,{children:[We(C,{variant:"outline",type:"button",onClick:nt,children:h("dialog.closeButton",{defaultValue:"\u53D6\u6D88"})}),We(C,{type:"button",disabled:!mw,onClick:je,children:Qi>0?h("browseDialog.confirmWithCount",{defaultValue:`\u786E\u5B9A (${Qi})`,count:Qi}):h("browseDialog.confirm",{defaultValue:"\u786E\u5B9A"})})]})]})})}function xk({node:e,depth:t,expandedKeys:a,activeCategoryId:r,onToggleExpand:o,onSelect:n}){let i=e.children&&e.children.length>0,c=a.has(e.id),s=r===e.id;return Fa("li",{children:[Fa("button",{type:"button",onClick:()=>{n(e),i&&o(e.id)},className:l("flex w-full items-center gap-1 rounded-sm px-2 py-1.5 text-left text-sm transition-colors hover:bg-muted",s&&"bg-accent font-medium"),style:{paddingLeft:`${8+t*16}px`},children:[i?c?We(re,{className:"size-3.5 shrink-0 opacity-50"}):We(me,{className:"size-3.5 shrink-0 opacity-50"}):We("span",{className:"w-3.5 shrink-0"}),We("span",{className:"flex-1 truncate",children:e.label}),e.count!=null&&We("span",{className:"shrink-0 text-xs text-muted-foreground",children:e.count})]}),i&&c&&We("ul",{className:"space-y-0.5",children:e.children.map(d=>We(xk,{node:d,depth:t+1,expandedKeys:a,activeCategoryId:r,onToggleExpand:o,onSelect:n},String(d.id)))})]})}import{jsx as Ep,jsxs as bh}from"react/jsx-runtime";var II=[12,28,18,45,32,60,48],DI=["\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D","\u65E5"];function MI({data:e=II,labels:t=DI,height:a=180,color:r="currentColor",className:o}){let c=Math.max(1,...e),s=Math.min(0,...e),d=c-s||1,m=304/Math.max(1,e.length-1),u=v=>8+(1-(v-s)/d)*(a-16),f=`M ${e.map((v,N)=>`${8+N*m},${u(v)}`).join(" L ")}`,x=`${f} L ${8+(e.length-1)*m},${a-8} L 8,${a-8} Z`;return bh("div",{"data-slot":"area-chart",className:l("w-full text-primary",o),role:"img","aria-label":`\u9762\u79EF\u56FE\uFF0C\u5171 ${e.length} \u4E2A\u6570\u636E\u70B9\uFF0C\u6700\u5927\u503C ${c}`,children:[bh("svg",{viewBox:`0 0 320 ${a}`,width:"100%",height:a,preserveAspectRatio:"none",role:"presentation",children:[Ep("path",{d:x,fill:r,fillOpacity:.18,stroke:"none"}),Ep("path",{d:f,fill:"none",stroke:r,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round"}),e.map((v,N)=>Ep("circle",{cx:8+N*m,cy:u(v),r:2.5,fill:r,children:bh("title",{children:[t[N]??N,": ",q(v)]})},N))]}),Ep("ul",{className:"mt-1 flex justify-between text-[10px] text-muted-foreground",role:"list",children:t.slice(0,e.length).map((v,N)=>Ep("li",{children:v},N))})]})}import{jsx as $i,jsxs as vk}from"react/jsx-runtime";var BI=[{label:"\u534E\u5317",value:86},{label:"\u534E\u4E1C",value:72},{label:"\u534E\u5357",value:54},{label:"\u897F\u90E8",value:33}];function LI({title:e="\u6392\u540D",data:t=BI,className:a}){let r=Math.max(1,...t.map(o=>o.value));return vk(Y,{"data-slot":"bar-list-card",className:l("w-full",a),children:[$i(le,{children:$i(ie,{children:e})}),$i(J,{children:$i("ol",{className:"flex flex-col gap-2",role:"list",children:t.map((o,n)=>vk("li",{className:"flex items-center gap-2 text-sm",children:[$i("span",{className:"w-5 shrink-0 text-muted-foreground tabular-nums",children:n+1}),$i("span",{className:"w-20 shrink-0 truncate text-muted-foreground",children:o.label}),$i("div",{className:"h-4 flex-1 overflow-hidden rounded bg-muted",role:"presentation",children:$i("div",{className:"h-full rounded bg-primary",style:{width:`${o.value/r*100}%`,...o.color?{backgroundColor:o.color}:{}}})}),$i("span",{className:"w-12 shrink-0 text-right tabular-nums",children:q(o.value)})]},o.label))})})]})}import*as Fb from"react";import{jsx as $a,jsxs as Hi}from"react/jsx-runtime";function zI({total:e=0,categories:t=[],currency:a="CNY",onChange:r,className:o}){let[n,i]=Fb.useState(t);Fb.useEffect(()=>{i(t)},[t]);let c=n.reduce((u,p)=>u+p.amount,0),s=Math.max(0,e-c),d=e>0?Math.round(c/e*100):0,m=(u,p)=>{let f=Math.max(0,p);i(x=>{let v=x.map(N=>N.id===u?{...N,amount:N.cap!==void 0?Math.min(f,N.cap):f}:N);return r?.(v),v})};return Hi("div",{"data-slot":"budget-allocator",className:l("flex flex-col gap-4 rounded-lg border bg-card p-4",o),children:[Hi("div",{className:"flex items-baseline justify-between",children:[$a("span",{className:"text-sm font-medium",children:"\u9884\u7B97\u5206\u914D"}),Hi("span",{className:"text-xs text-muted-foreground",children:["\u5DF2\u5206\u914D ",d,"%"]})]}),$a("div",{className:"h-2 overflow-hidden rounded bg-muted",children:$a("div",{className:l("h-full rounded transition-all",d>100?"bg-red-500":d>90?"bg-yellow-500":"bg-emerald-500"),style:{width:`${Math.min(100,d)}%`}})}),Hi("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[Hi("div",{children:[$a("div",{className:"text-xs text-muted-foreground",children:"\u603B\u989D"}),$a("div",{className:"font-medium tabular-nums",children:Ne(e,a)})]}),Hi("div",{children:[$a("div",{className:"text-xs text-muted-foreground",children:"\u5269\u4F59"}),$a("div",{className:"font-medium tabular-nums",children:Ne(s,a)})]})]}),$a("ul",{className:"flex flex-col gap-3",children:n.map(u=>{let p=e>0?Math.round(u.amount/e*100):0,f=u.cap!==void 0&&u.amount>u.cap;return Hi("li",{className:"flex flex-col gap-1.5",children:[Hi("div",{className:"flex items-center justify-between text-sm",children:[$a("span",{className:"truncate text-muted-foreground",children:u.name}),$a("span",{className:l("tabular-nums",f&&"text-destructive"),children:Ne(u.amount,a)})]}),Hi("div",{className:"flex items-center gap-2",children:[$a(C,{type:"button",variant:"outline",size:"icon-sm","aria-label":`\u51CF\u5C11 ${u.name} \u9884\u7B97`,onClick:()=>m(u.id,u.amount-1e3),children:$a(Kr,{})}),$a("input",{type:"range",min:0,max:Math.max(e,u.cap??e,1),step:1e3,value:u.amount,onChange:x=>m(u.id,Number(x.target.value)),"aria-label":`${u.name} \u9884\u7B97\u6ED1\u5757`,className:"h-1.5 flex-1 cursor-pointer accent-primary"}),$a(C,{type:"button",variant:"outline",size:"icon-sm","aria-label":`\u589E\u52A0 ${u.name} \u9884\u7B97`,onClick:()=>m(u.id,u.amount+1e3),children:$a(ge,{})})]}),$a("div",{className:"h-1 overflow-hidden rounded bg-muted",children:$a("div",{className:"h-full rounded bg-primary",style:{width:`${Math.min(100,p)}%`}})})]},u.id)})}),n.length===0&&$a("p",{className:"text-center text-sm text-muted-foreground",children:"\u6682\u65E0\u5206\u914D\u7C7B\u522B"})]})}import*as Fp from"react";import{useTranslation as AI}from"react-i18next";import{jsx as wn,jsxs as dc}from"react/jsx-runtime";function EI({value:e,onChange:t,options:a=[],placeholder:r,searchPlaceholder:o,emptyText:n,disabled:i=!1,clearable:c=!0,className:s}){let{t:d}=AI("ui"),[m,u]=Fp.useState(!1),[p,f]=Fp.useState(""),x=r??d("companyPicker.placeholder",{defaultValue:"\u8BF7\u9009\u62E9\u516C\u53F8"}),v=o??d("companyPicker.search",{defaultValue:"\u641C\u7D22\u516C\u53F8"}),N=n??d("companyPicker.empty",{defaultValue:"\u65E0\u5339\u914D\u516C\u53F8"}),h=a.find(y=>y.value===e),b=Fp.useMemo(()=>{if(!p.trim())return a;let y=p.trim().toLowerCase();return a.filter(k=>k.label.toLowerCase().includes(y)||k.value.toLowerCase().includes(y)||k.code?.toLowerCase().includes(y))},[a,p]),g=y=>{y.stopPropagation(),t?.(void 0)};return dc(He,{open:m,onOpenChange:u,children:[dc(Ve,{render:wn(C,{variant:"outline",role:"combobox",type:"button",disabled:i,"aria-expanded":m,"aria-haspopup":"listbox",className:l("w-[200px] justify-between font-normal",!h&&"text-muted-foreground",s)}),children:[wn(Ji,{className:"size-4 shrink-0 opacity-50"}),wn("span",{className:"flex-1 truncate",children:h?.label??x}),dc("span",{className:"flex items-center gap-1",children:[c&&h&&wn("span",{role:"button",tabIndex:0,"aria-label":d("companyPicker.clear",{defaultValue:"\u6E05\u9664"}),onClick:g,onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),y.stopPropagation(),t?.(void 0))},className:"rounded p-0.5 hover:bg-muted",children:wn(Q,{className:"size-3.5 opacity-60 hover:opacity-100"})}),wn(re,{className:"size-4 opacity-50"})]})]}),m&&dc(Oe,{align:"start",className:"w-[var(--anchor-width)] p-0",children:[dc("div",{className:"flex items-center gap-2 border-b px-3 py-2",children:[wn(X,{className:"size-4 shrink-0 opacity-50"}),wn(T,{value:p,onChange:y=>f(y.target.value),placeholder:v,"aria-label":v,className:"h-7 border-0 bg-transparent p-0 shadow-none focus-visible:ring-0"})]}),dc("ul",{role:"listbox",className:"max-h-64 overflow-y-auto p-1",children:[b.length===0&&wn("li",{className:"px-2 py-6 text-center text-sm text-muted-foreground",children:N}),b.map(y=>{let k=y.value===e;return wn("li",{role:"option","aria-selected":k,children:dc(C,{variant:"ghost",size:"sm",type:"button",...y.disabled!==void 0?{disabled:y.disabled}:{},onClick:()=>{t?.(y.value),u(!1),f("")},className:l("h-auto w-full justify-start gap-2 rounded-sm px-2 py-1.5 font-normal",k&&"bg-accent/50",y.disabled&&"pointer-events-none opacity-50"),children:[wn("span",{className:"flex-1 truncate",children:y.label}),k&&wn(U,{className:"size-4 shrink-0"})]})},y.value)})]})]})]})}import*as $p from"react";import{useTranslation as FI}from"react-i18next";import{jsx as Pn,jsxs as cc}from"react/jsx-runtime";function $I({value:e,onChange:t,options:a=[],placeholder:r,searchPlaceholder:o,emptyText:n,disabled:i=!1,clearable:c=!0,className:s}){let{t:d}=FI("ui"),[m,u]=$p.useState(!1),[p,f]=$p.useState(""),x=r??d("costCenterPicker.placeholder",{defaultValue:"\u8BF7\u9009\u62E9\u6210\u672C\u4E2D\u5FC3"}),v=o??d("costCenterPicker.search",{defaultValue:"\u641C\u7D22\u6210\u672C\u4E2D\u5FC3"}),N=n??d("costCenterPicker.empty",{defaultValue:"\u65E0\u5339\u914D\u6210\u672C\u4E2D\u5FC3"}),h=a.find(g=>g.value===e),b=$p.useMemo(()=>{if(!p.trim())return a;let g=p.trim().toLowerCase();return a.filter(y=>y.label.toLowerCase().includes(g)||y.value.toLowerCase().includes(g)||y.code?.toLowerCase().includes(g))},[a,p]);return cc(He,{open:m,onOpenChange:u,children:[cc(Ve,{render:Pn(C,{variant:"outline",role:"combobox",type:"button",disabled:i,"aria-expanded":m,"aria-haspopup":"listbox",className:l("w-[200px] justify-between font-normal",!h&&"text-muted-foreground",s)}),children:[Pn(Xr,{className:"size-4 shrink-0 opacity-50"}),Pn("span",{className:"flex-1 truncate",children:h?.label??x}),cc("span",{className:"flex items-center gap-1",children:[c&&h&&Pn("span",{role:"button",tabIndex:0,"aria-label":d("costCenterPicker.clear",{defaultValue:"\u6E05\u9664"}),onClick:g=>{g.stopPropagation(),t?.(void 0)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),t?.(void 0))},className:"rounded p-0.5 hover:bg-muted",children:Pn(Q,{className:"size-3.5 opacity-60 hover:opacity-100"})}),Pn(re,{className:"size-4 opacity-50"})]})]}),m&&cc(Oe,{align:"start",className:"w-[var(--anchor-width)] p-0",children:[cc("div",{className:"flex items-center gap-2 border-b px-3 py-2",children:[Pn(X,{className:"size-4 shrink-0 opacity-50"}),Pn(T,{value:p,onChange:g=>f(g.target.value),placeholder:v,"aria-label":v,className:"h-7 border-0 bg-transparent p-0 shadow-none focus-visible:ring-0"})]}),cc("ul",{role:"listbox",className:"max-h-64 overflow-y-auto p-1",children:[b.length===0&&Pn("li",{className:"px-2 py-6 text-center text-sm text-muted-foreground",children:N}),b.map(g=>{let y=g.value===e;return Pn("li",{role:"option","aria-selected":y,children:cc(C,{variant:"ghost",size:"sm",type:"button",...g.disabled!==void 0?{disabled:g.disabled}:{},onClick:()=>{t?.(g.value),u(!1),f("")},className:l("h-auto w-full justify-start gap-2 rounded-sm px-2 py-1.5 font-normal",y&&"bg-accent/50",g.disabled&&"pointer-events-none opacity-50"),children:[Pn("span",{className:"flex-1 truncate",children:g.label}),y&&Pn(U,{className:"size-4 shrink-0"})]})},g.value)})]})]})]})}import*as Hp from"react";import{useTranslation as HI}from"react-i18next";import{jsx as Tn,jsxs as Vi}from"react/jsx-runtime";function VI({value:e,onChange:t,options:a=[],placeholder:r,searchPlaceholder:o,emptyText:n,disabled:i=!1,clearable:c=!0,className:s}){let{t:d}=HI("ui"),[m,u]=Hp.useState(!1),[p,f]=Hp.useState(""),x=r??d("customerPicker.placeholder",{defaultValue:"\u8BF7\u9009\u62E9\u5BA2\u6237"}),v=o??d("customerPicker.search",{defaultValue:"\u641C\u7D22\u5BA2\u6237"}),N=n??d("customerPicker.empty",{defaultValue:"\u65E0\u5339\u914D\u5BA2\u6237"}),h=a.find(y=>y.value===e),b=Hp.useMemo(()=>{if(!p.trim())return a;let y=p.trim().toLowerCase();return a.filter(k=>k.label.toLowerCase().includes(y)||k.value.toLowerCase().includes(y)||k.contact?.toLowerCase().includes(y)||k.type?.toLowerCase().includes(y))},[a,p]),g=y=>y==="distributor"?"\u7ECF\u9500\u5546":y==="terminal"?"\u7EC8\u7AEF":null;return Vi(He,{open:m,onOpenChange:u,children:[Vi(Ve,{render:Tn(C,{variant:"outline",role:"combobox",type:"button",disabled:i,"aria-expanded":m,"aria-haspopup":"listbox",className:l("w-[200px] justify-between font-normal",!h&&"text-muted-foreground",s)}),children:[Tn(al,{className:"size-4 shrink-0 opacity-50"}),Tn("span",{className:"flex-1 truncate",children:h?.label??x}),Vi("span",{className:"flex items-center gap-1",children:[c&&h&&Tn("span",{role:"button",tabIndex:0,"aria-label":d("customerPicker.clear",{defaultValue:"\u6E05\u9664"}),onClick:y=>{y.stopPropagation(),t?.(void 0)},onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),y.stopPropagation(),t?.(void 0))},className:"rounded p-0.5 hover:bg-muted",children:Tn(Q,{className:"size-3.5 opacity-60 hover:opacity-100"})}),Tn(re,{className:"size-4 opacity-50"})]})]}),m&&Vi(Oe,{align:"start",className:"w-[var(--anchor-width)] p-0",children:[Vi("div",{className:"flex items-center gap-2 border-b px-3 py-2",children:[Tn(X,{className:"size-4 shrink-0 opacity-50"}),Tn(T,{value:p,onChange:y=>f(y.target.value),placeholder:v,"aria-label":v,className:"h-7 border-0 bg-transparent p-0 shadow-none focus-visible:ring-0"})]}),Vi("ul",{role:"listbox",className:"max-h-64 overflow-y-auto p-1",children:[b.length===0&&Tn("li",{className:"px-2 py-6 text-center text-sm text-muted-foreground",children:N}),b.map(y=>{let k=y.value===e,w=g(y.type);return Tn("li",{role:"option","aria-selected":k,children:Vi(C,{variant:"ghost",size:"sm",type:"button",...y.disabled!==void 0?{disabled:y.disabled}:{},onClick:()=>{t?.(y.value),u(!1),f("")},className:l("h-auto w-full justify-start gap-2 rounded-sm px-2 py-1.5 font-normal",k&&"bg-accent/50",y.disabled&&"pointer-events-none opacity-50"),children:[Vi("span",{className:"flex-1 truncate",children:[y.label,y.contact&&Vi("span",{className:"ml-1 text-xs text-muted-foreground",children:["\xB7 ",y.contact]})]}),w&&Tn("span",{className:"shrink-0 text-xs text-muted-foreground",children:w}),k&&Tn(U,{className:"size-4 shrink-0"})]})},y.value)})]})]})]})}import{jsx as mc,jsxs as Vp}from"react/jsx-runtime";var hk={1:"sm:grid-cols-1",2:"sm:grid-cols-2",3:"sm:grid-cols-3",4:"sm:grid-cols-2 lg:grid-cols-4",6:"sm:grid-cols-3 lg:grid-cols-6"};function OI({title:e="\u4EEA\u8868\u76D8",stats:t=[],columns:a=4,className:r}){return Vp("div",{"data-slot":"dashboard-grid",className:l("flex flex-col gap-4",r),role:"region","aria-label":e,children:[Vp("div",{className:"flex items-center justify-between",children:[mc("h2",{className:"text-lg font-semibold",children:e}),Vp("span",{className:"text-xs text-muted-foreground",children:[t.length," \u9879\u6307\u6807"]})]}),mc("div",{className:l("grid grid-cols-1 gap-4",hk[a]??hk[4]),children:t.map(o=>{let n=o.trend?o.trend==="up":(o.delta??0)>=0,i=n?an:tn,c=n?en:Zo;return Vp("div",{className:"flex flex-col gap-1 rounded-lg border bg-card p-4",children:[mc("span",{className:"text-xs text-muted-foreground",children:o.label}),mc("span",{className:"text-2xl font-semibold tabular-nums",children:Xg(o.value)}),o.delta!==void 0&&Vp("span",{className:l("flex items-center gap-1 text-xs font-medium",n?"text-emerald-600":"text-destructive"),children:[mc(c,{className:"size-3"}),bt(o.delta),mc(i,{className:"size-3 opacity-70"})]})]},o.label)})}),t.length===0&&mc("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"\u6682\u65E0\u6307\u6807\u6570\u636E"})]})}import*as Op from"react";import{useTranslation as UI}from"react-i18next";import{jsx as Rn,jsxs as uc}from"react/jsx-runtime";function yk(e){let t=o=>e.filter(n=>(n.parent??"")===(o??"")),a=[],r=(o,n)=>{for(let i of t(o))a.push({...i,depth:n}),r(i.value,n+1)};return r(void 0,0),a}function WI({value:e,onChange:t,options:a=[],placeholder:r,searchPlaceholder:o,emptyText:n,disabled:i=!1,clearable:c=!0,className:s}){let{t:d}=UI("ui"),[m,u]=Op.useState(!1),[p,f]=Op.useState(""),x=r??d("departmentPicker.placeholder",{defaultValue:"\u8BF7\u9009\u62E9\u90E8\u95E8"}),v=o??d("departmentPicker.search",{defaultValue:"\u641C\u7D22\u90E8\u95E8"}),N=n??d("departmentPicker.empty",{defaultValue:"\u65E0\u5339\u914D\u90E8\u95E8"}),h=a.find(g=>g.value===e),b=Op.useMemo(()=>{if(!p.trim())return yk(a);let g=p.trim().toLowerCase(),y=a.filter(w=>w.label.toLowerCase().includes(g)||w.value.toLowerCase().includes(g)),k=new Set;for(let w of y){let R=w.value;for(;R;)k.add(R),R=a.find(z=>z.value===R)?.parent}return yk(a).filter(w=>k.has(w.value)).map(w=>({...w,depth:0}))},[a,p]);return uc(He,{open:m,onOpenChange:u,children:[uc(Ve,{render:Rn(C,{variant:"outline",role:"combobox",type:"button",disabled:i,"aria-expanded":m,"aria-haspopup":"listbox",className:l("w-[200px] justify-between font-normal",!h&&"text-muted-foreground",s)}),children:[Rn(Ji,{className:"size-4 shrink-0 opacity-50"}),Rn("span",{className:"flex-1 truncate",children:h?.label??x}),uc("span",{className:"flex items-center gap-1",children:[c&&h&&Rn("span",{role:"button",tabIndex:0,"aria-label":d("departmentPicker.clear",{defaultValue:"\u6E05\u9664"}),onClick:g=>{g.stopPropagation(),t?.(void 0)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),t?.(void 0))},className:"rounded p-0.5 hover:bg-muted",children:Rn(Q,{className:"size-3.5 opacity-60 hover:opacity-100"})}),Rn(re,{className:"size-4 opacity-50"})]})]}),m&&uc(Oe,{align:"start",className:"w-[var(--anchor-width)] p-0",children:[uc("div",{className:"flex items-center gap-2 border-b px-3 py-2",children:[Rn(X,{className:"size-4 shrink-0 opacity-50"}),Rn(T,{value:p,onChange:g=>f(g.target.value),placeholder:v,"aria-label":v,className:"h-7 border-0 bg-transparent p-0 shadow-none focus-visible:ring-0"})]}),uc("ul",{role:"tree",className:"max-h-64 overflow-y-auto p-1",children:[b.length===0&&Rn("li",{className:"px-2 py-6 text-center text-sm text-muted-foreground",children:N}),b.map(g=>{let y=g.value===e;return Rn("li",{role:"treeitem","aria-selected":y,children:uc(C,{variant:"ghost",size:"sm",type:"button",...g.disabled!==void 0?{disabled:g.disabled}:{},onClick:()=>{t?.(g.value),u(!1),f("")},style:{paddingLeft:`${8+g.depth*16}px`},className:l("h-auto w-full justify-start gap-2 rounded-sm py-1.5 pr-2 font-normal",y&&"bg-accent/50",g.disabled&&"pointer-events-none opacity-50"),children:[Rn("span",{className:"flex-1 truncate",children:g.label}),y&&Rn(U,{className:"size-4 shrink-0"})]})},g.value)})]})]})]})}import*as Up from"react";import{useTranslation as _I}from"react-i18next";import{jsx as Qo,jsxs as pc}from"react/jsx-runtime";function qI({value:e,onChange:t,options:a=[],placeholder:r,searchPlaceholder:o,emptyText:n,disabled:i=!1,clearable:c=!0,className:s}){let{t:d}=_I("ui"),[m,u]=Up.useState(!1),[p,f]=Up.useState(""),x=r??d("distributorPicker.placeholder",{defaultValue:"\u8BF7\u9009\u62E9\u7ECF\u9500\u5546"}),v=o??d("distributorPicker.search",{defaultValue:"\u641C\u7D22\u7ECF\u9500\u5546"}),N=n??d("distributorPicker.empty",{defaultValue:"\u65E0\u5339\u914D\u7ECF\u9500\u5546"}),h=a.find(g=>g.value===e),b=Up.useMemo(()=>{if(!p.trim())return a;let g=p.trim().toLowerCase();return a.filter(y=>y.label.toLowerCase().includes(g)||y.value.toLowerCase().includes(g)||y.code?.toLowerCase().includes(g)||y.region?.toLowerCase().includes(g))},[a,p]);return pc(He,{open:m,onOpenChange:u,children:[pc(Ve,{render:Qo(C,{variant:"outline",role:"combobox",type:"button",disabled:i,"aria-expanded":m,"aria-haspopup":"listbox",className:l("w-[200px] justify-between font-normal",!h&&"text-muted-foreground",s)}),children:[Qo(Cg,{className:"size-4 shrink-0 opacity-50"}),Qo("span",{className:"flex-1 truncate",children:h?.label??x}),pc("span",{className:"flex items-center gap-1",children:[c&&h&&Qo("span",{role:"button",tabIndex:0,"aria-label":d("distributorPicker.clear",{defaultValue:"\u6E05\u9664"}),onClick:g=>{g.stopPropagation(),t?.(void 0)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),t?.(void 0))},className:"rounded p-0.5 hover:bg-muted",children:Qo(Q,{className:"size-3.5 opacity-60 hover:opacity-100"})}),Qo(re,{className:"size-4 opacity-50"})]})]}),m&&pc(Oe,{align:"start",className:"w-[var(--anchor-width)] p-0",children:[pc("div",{className:"flex items-center gap-2 border-b px-3 py-2",children:[Qo(X,{className:"size-4 shrink-0 opacity-50"}),Qo(T,{value:p,onChange:g=>f(g.target.value),placeholder:v,"aria-label":v,className:"h-7 border-0 bg-transparent p-0 shadow-none focus-visible:ring-0"})]}),pc("ul",{role:"listbox",className:"max-h-64 overflow-y-auto p-1",children:[b.length===0&&Qo("li",{className:"px-2 py-6 text-center text-sm text-muted-foreground",children:N}),b.map(g=>{let y=g.value===e;return Qo("li",{role:"option","aria-selected":y,children:pc(C,{variant:"ghost",size:"sm",type:"button",...g.disabled!==void 0?{disabled:g.disabled}:{},onClick:()=>{t?.(g.value),u(!1),f("")},className:l("h-auto w-full justify-start gap-2 rounded-sm px-2 py-1.5 font-normal",y&&"bg-accent/50",g.disabled&&"pointer-events-none opacity-50"),children:[Qo("span",{className:"flex-1 truncate",children:g.label}),g.region&&Qo("span",{className:"shrink-0 text-xs text-muted-foreground",children:g.region}),y&&Qo(U,{className:"size-4 shrink-0"})]})},g.value)})]})]})]})}import{jsx as gc,jsxs as $b}from"react/jsx-runtime";var GI=[{label:"\u5DF2\u5B8C\u6210",value:56,color:"#3b82f6"},{label:"\u8FDB\u884C\u4E2D",value:28,color:"#10b981"},{label:"\u5F85\u5904\u7406",value:16,color:"#f59e0b"}];function jI({data:e=GI,size:t=128,thickness:a=12,centerLabel:r,className:o}){let n=e.reduce((d,m)=>d+m.value,0)||1,i=40,c=2*Math.PI*i,s=0;return $b("div",{"data-slot":"donut-chart",className:l("flex flex-wrap items-center gap-4",o),role:"img","aria-label":`\u73AF\u5F62\u56FE\uFF0C\u5171 ${e.length} \u6BB5\uFF0C\u603B\u8BA1 ${n}`,children:[$b("div",{className:"relative shrink-0",style:{width:t,height:t},children:[gc("svg",{viewBox:"0 0 100 100",className:"-rotate-90",role:"presentation",width:t,height:t,children:e.map(d=>{let m=d.value/n,u=gc("circle",{cx:"50",cy:"50",r:i,fill:"none",stroke:d.color??"currentColor",strokeWidth:a,strokeDasharray:`${m*c} ${c}`,strokeDashoffset:-s*c,children:$b("title",{children:[d.label,": ",q(d.value)]})},d.label);return s+=m,u})}),r?gc("span",{className:"absolute inset-0 flex items-center justify-center text-sm font-medium tabular-nums",children:r}):null]}),gc("ul",{className:"flex flex-col gap-1.5 text-sm",role:"list",children:e.map(d=>$b("li",{className:"flex items-center gap-2",children:[gc("span",{className:"size-2.5 shrink-0 rounded-sm",style:{backgroundColor:d.color??"currentColor"},"aria-hidden":"true"}),gc("span",{className:"text-muted-foreground",children:d.label}),gc("span",{className:"ml-auto tabular-nums",children:q(d.value)})]},d.label))})]})}import*as Wp from"react";import{useTranslation as KI}from"react-i18next";import{jsx as Sn,jsxs as Oi}from"react/jsx-runtime";function QI({value:e,onChange:t,options:a=[],placeholder:r,searchPlaceholder:o,emptyText:n,disabled:i=!1,clearable:c=!0,className:s}){let{t:d}=KI("ui"),[m,u]=Wp.useState(!1),[p,f]=Wp.useState(""),x=r??d("employeePicker.placeholder",{defaultValue:"\u8BF7\u9009\u62E9\u5458\u5DE5"}),v=o??d("employeePicker.search",{defaultValue:"\u641C\u7D22\u5458\u5DE5"}),N=n??d("employeePicker.empty",{defaultValue:"\u65E0\u5339\u914D\u5458\u5DE5"}),h=a.find(g=>g.value===e),b=Wp.useMemo(()=>{if(!p.trim())return a;let g=p.trim().toLowerCase();return a.filter(y=>y.label.toLowerCase().includes(g)||y.value.toLowerCase().includes(g)||y.code?.toLowerCase().includes(g)||y.department?.toLowerCase().includes(g))},[a,p]);return Oi(He,{"data-slot":"employee-picker",open:m,onOpenChange:u,children:[Oi(Ve,{render:Sn(C,{variant:"outline",role:"combobox",type:"button",disabled:i,"aria-expanded":m,"aria-haspopup":"listbox",className:l("w-[200px] justify-between font-normal",!h&&"text-muted-foreground",s)}),children:[Sn(js,{className:"size-4 shrink-0 opacity-50"}),Sn("span",{className:"flex-1 truncate",children:h?.label??x}),Oi("span",{className:"flex items-center gap-1",children:[c&&h&&Sn("span",{role:"button",tabIndex:0,"aria-label":d("employeePicker.clear",{defaultValue:"\u6E05\u9664"}),onClick:g=>{g.stopPropagation(),t?.(void 0)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),t?.(void 0))},className:"rounded p-0.5 hover:bg-muted",children:Sn(Q,{className:"size-3.5 opacity-60 hover:opacity-100"})}),Sn(re,{className:"size-4 opacity-50"})]})]}),m&&Oi(Oe,{align:"start",className:"w-[var(--anchor-width)] p-0",children:[Oi("div",{className:"flex items-center gap-2 border-b px-3 py-2",children:[Sn(X,{className:"size-4 shrink-0 opacity-50"}),Sn(T,{value:p,onChange:g=>f(g.target.value),placeholder:v,"aria-label":v,className:"h-7 border-0 bg-transparent p-0 shadow-none focus-visible:ring-0"})]}),Oi("ul",{role:"listbox",className:"max-h-64 overflow-y-auto p-1",children:[b.length===0&&Sn("li",{className:"px-2 py-6 text-center text-sm text-muted-foreground",children:N}),b.map(g=>{let y=g.value===e;return Sn("li",{role:"option","aria-selected":y,children:Oi(C,{variant:"ghost",size:"sm",type:"button",...g.disabled!==void 0?{disabled:g.disabled}:{},onClick:()=>{t?.(g.value),u(!1),f("")},className:l("h-auto w-full justify-start gap-2 rounded-sm px-2 py-1.5 font-normal",y&&"bg-accent/50",g.disabled&&"pointer-events-none opacity-50"),children:[Oi("span",{className:"flex-1 truncate",children:[g.label,g.code&&Oi("span",{className:"ml-1 text-xs text-muted-foreground",children:["\xB7 ",g.code]})]}),g.department&&Sn("span",{className:"shrink-0 text-xs text-muted-foreground",children:g.department}),y&&Sn(U,{className:"size-4 shrink-0"})]})},g.value)})]})]})]})}import"react";import XI from"next/link";import{useTranslation as YI}from"react-i18next";import{jsx as Ha,jsxs as Or}from"react/jsx-runtime";var JI={403:{title:"\u65E0\u6743\u8BBF\u95EE",description:"\u62B1\u6B49\uFF0C\u60A8\u6CA1\u6709\u6743\u9650\u8BBF\u95EE\u6B64\u9875\u9762\u3002\u5982\u6709\u7591\u95EE\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u3002"},404:{title:"\u9875\u9762\u4E0D\u5B58\u5728",description:"\u62B1\u6B49\uFF0C\u60A8\u8BBF\u95EE\u7684\u9875\u9762\u5DF2\u88AB\u79FB\u52A8\u6216\u4E0D\u5B58\u5728\u3002"},500:{title:"\u670D\u52A1\u5F02\u5E38",description:"\u62B1\u6B49\uFF0C\u670D\u52A1\u5668\u5F00\u4E86\u4E2A\u5C0F\u5DEE\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5\u3002"},503:{title:"\u670D\u52A1\u6682\u4E0D\u53EF\u7528",description:"\u7CFB\u7EDF\u6B63\u5728\u7EF4\u62A4\u4E2D\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002"}},ZI={403:{label:"Access restricted",impact:"\u5F53\u524D\u8D26\u53F7\u6743\u9650\u4E0D\u8DB3",action:"\u5207\u6362\u8D26\u53F7\u6216\u8054\u7CFB\u7BA1\u7406\u5458\u5F00\u901A\u8BBF\u95EE\u8303\u56F4\u3002",icon:Yh,accent:"text-warning",surface:"bg-warning/10 ring-warning/20"},404:{label:"Route not found",impact:"\u76EE\u6807\u9875\u9762\u672A\u547D\u4E2D",action:"\u68C0\u67E5\u94FE\u63A5\u662F\u5426\u5B8C\u6574\uFF0C\u6216\u56DE\u5230\u9996\u9875\u91CD\u65B0\u8FDB\u5165\u3002",icon:hg,accent:"text-info",surface:"bg-info/10 ring-info/20"},500:{label:"Server incident",impact:"\u670D\u52A1\u7AEF\u54CD\u5E94\u5F02\u5E38",action:"\u7A0D\u540E\u91CD\u8BD5\uFF1B\u5982\u679C\u6301\u7EED\u51FA\u73B0\uFF0C\u8BF7\u63D0\u4EA4\u9519\u8BEF\u4E0A\u4E0B\u6587\u3002",icon:Xh,accent:"text-destructive",surface:"bg-destructive/10 ring-destructive/20"},503:{label:"Maintenance window",impact:"\u7CFB\u7EDF\u6B63\u5728\u7EF4\u62A4",action:"\u7B49\u5F85\u7EF4\u62A4\u5B8C\u6210\u540E\u5237\u65B0\u9875\u9762\u3002",icon:kg,accent:"text-brand-600 dark:text-brand-700",surface:"bg-brand-100/70 ring-brand-300/50 dark:bg-brand-300/15 dark:ring-brand-400/30"}};function eD({status:e=404,title:t,description:a,homeHref:r="/",showHome:o=!0,showBack:n=!0,onBack:i,illustration:c,className:s}){let{t:d}=YI("error"),m=JI[e],u=ZI[e],p=u.icon,x={403:{title:"errorPage.accessRestricted.title",description:"errorPage.accessRestricted.description"},404:{title:"errorPage.notFound.title",description:"errorPage.notFound.description"},500:{title:"errorPage.serverError.title",description:"errorPage.serverError.description"},503:{title:"errorPage.maintenance.title",description:"errorPage.maintenance.description"}}[e],v=t??d(x.title,m.title),N=a??d(x.description,m.description);return Ha("div",{"data-slot":"error-page",className:l("flex min-h-[60vh] items-center justify-center bg-background px-4 py-10 sm:px-6",s),children:Or("div",{className:"grid w-full max-w-5xl overflow-hidden rounded-xl border bg-card text-card-foreground shadow-sm lg:grid-cols-[minmax(0,1fr)_20rem]",children:[Or("section",{className:"flex min-w-0 flex-col justify-between gap-10 p-6 sm:p-8 lg:p-10",children:[Or("div",{className:"space-y-8",children:[Or("div",{className:"flex flex-wrap items-center gap-3",children:[Ha(B,{variant:"outline",className:"h-6 rounded-md font-mono",children:e}),Ha("span",{className:"text-xs font-medium uppercase text-muted-foreground",children:u.label})]}),Or("div",{className:"grid gap-6 sm:grid-cols-[auto_minmax(0,1fr)] sm:items-center",children:[Ha("div",{className:l("flex size-20 items-center justify-center rounded-xl ring-1 sm:size-24",u.surface),children:c??Ha(p,{className:l("size-10 sm:size-12",u.accent)})}),Or("div",{className:"min-w-0 space-y-3",children:[Ha("p",{className:l("font-mono text-5xl font-semibold leading-none sm:text-6xl",u.accent),children:e}),Ha("h1",{className:"text-2xl font-semibold tracking-tight text-balance sm:text-3xl",children:v}),Ha("p",{className:"max-w-xl text-sm leading-6 text-muted-foreground sm:text-base",children:N})]})]})]}),Or("div",{className:"flex flex-wrap items-center gap-2",children:[o&&Or(XI,{href:r,className:Ks({size:"lg"}),children:[Ha(Uh,{}),d("errorPage.home")]}),n&&Or(C,{size:"lg",variant:"outline",onClick:i??(()=>history.back()),children:[Ha(Yi,{}),d("errorPage.back")]})]})]}),Ha("aside",{className:"border-t bg-muted/35 p-6 sm:p-8 lg:border-l lg:border-t-0",children:Or("div",{className:"flex h-full flex-col justify-between gap-8",children:[Or("div",{className:"space-y-5",children:[Or("div",{className:"flex items-center gap-2 text-sm font-medium",children:[Ha(qh,{className:"size-4 text-muted-foreground"}),d("errorPage.context")]}),Ha(Ue,{}),Or("dl",{className:"space-y-5 text-sm",children:[Or("div",{className:"space-y-1",children:[Ha("dt",{className:"text-xs font-medium uppercase text-muted-foreground",children:d("errorPage.impact")}),Ha("dd",{className:"text-foreground",children:u.impact})]}),Or("div",{className:"space-y-1",children:[Ha("dt",{className:"text-xs font-medium uppercase text-muted-foreground",children:d("errorPage.action")}),Ha("dd",{className:"leading-6 text-foreground",children:u.action})]})]})]}),Ha("div",{className:"rounded-lg border bg-background/70 p-3 text-xs leading-5 text-muted-foreground",children:"Request ID \u4F1A\u5728\u751F\u4EA7\u73AF\u5883\u7531\u4E0A\u6E38\u7F51\u5173\u6CE8\u5165\uFF0C\u7EC4\u4EF6\u4EC5\u8D1F\u8D23\u7A33\u5B9A\u5448\u73B0\u9519\u8BEF\u72B6\u6001\u3002"})]})})]})})}import{jsx as Hb,jsxs as kk}from"react/jsx-runtime";function Nk(e,t,a,r){let o=r*Math.PI/180;return{x:e+a*Math.cos(o),y:t+a*Math.sin(o)}}function Ck(e,t,a,r,o){let n=Nk(e,t,a,r),i=Nk(e,t,a,o),c=o-r>180?1:0;return`M ${n.x} ${n.y} A ${a} ${a} 0 ${c} 1 ${i.x} ${i.y}`}function tD({value:e=64,min:t=0,max:a=100,label:r,color:o="#3b82f6",className:n}){let i=Math.min(a,Math.max(t,e)),s=180-(a===t?0:(i-t)/(a-t))*180,d=50,m=50,u=40;return kk("div",{"data-slot":"gauge-chart",className:l("flex flex-col items-center",n),role:"img","aria-label":r?`${r}: ${e}`:`\u4EEA\u8868\u76D8: ${e}`,children:[kk("svg",{viewBox:"0 0 100 56",width:"160",role:"presentation",children:[Hb("path",{d:Ck(d,m,u,180,0),fill:"none",stroke:"currentColor",strokeOpacity:.15,strokeWidth:10,strokeLinecap:"round",className:"text-muted-foreground"}),Hb("path",{d:Ck(d,m,u,180,s),fill:"none",stroke:o,strokeWidth:10,strokeLinecap:"round"}),Hb("text",{x:d,y:m-4,textAnchor:"middle",className:"fill-foreground text-sm font-semibold tabular-nums",children:q(i)})]}),r?Hb("span",{className:"mt-1 text-xs text-muted-foreground",children:r}):null]})}import{jsx as Ui,jsxs as Vb}from"react/jsx-runtime";function aD({direction:e="received",author:t="",content:a="",timestamp:r,attachments:o=[],avatarUrl:n,className:i}){let c=e==="sent",s=r!==void 0?gl(r):"",d=t?t.trim().charAt(0).toUpperCase():"?";return Vb("div",{"data-slot":"im-message",className:l("flex w-full gap-2",c?"flex-row-reverse":"flex-row",i),role:"article","aria-label":`${c?"\u53D1\u9001":"\u63A5\u6536"}\u6D88\u606F${t?`\u6765\u81EA ${t}`:""}`,children:[Ui("div",{className:l("flex size-8 shrink-0 items-center justify-center rounded-full text-xs font-medium",c?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground"),"aria-hidden":"true",children:n?Ui("img",{src:n,alt:"",className:"size-8 rounded-full object-cover"}):d}),Vb("div",{className:l("flex max-w-[75%] flex-col gap-1",c?"items-end":"items-start"),children:[Vb("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[t&&Ui("span",{className:"font-medium text-foreground",children:t}),s&&Ui("span",{children:s})]}),Ui("div",{className:l("rounded-2xl px-3 py-2 text-sm",c?"rounded-br-sm bg-primary text-primary-foreground":"rounded-bl-sm bg-muted"),children:a||Ui("span",{className:"text-muted-foreground",children:"\uFF08\u7A7A\u6D88\u606F\uFF09"})}),o.length>0&&Ui("ul",{className:"flex flex-col gap-1",children:o.map(m=>Vb("li",{className:l("flex items-center gap-1.5 rounded-md border px-2 py-1 text-xs",c?"border-primary/30 bg-primary/10":"border-border bg-background"),children:[Ui(rl,{className:"size-3"}),Ui("span",{className:"truncate",children:m.name})]},m.id))})]})]})}import"react";import{jsx as Fs,jsxs as _p}from"react/jsx-runtime";var wk={primary:"bg-primary",emerald:"bg-emerald-500",yellow:"bg-yellow-500",red:"bg-red-500",blue:"bg-blue-500"};function rD({title:e="\u672A\u547D\u540D\u5217",accent:t="primary",cards:a=[],onAddCard:r,onCardClick:o,className:n}){let i=(c,s)=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),o?.(s))};return _p("div",{"data-slot":"kanban-column",className:l("flex w-72 shrink-0 flex-col gap-2 rounded-lg border bg-muted/30 p-2",n),role:"group","aria-label":`\u770B\u677F\u5217 ${e}`,children:[_p("div",{className:"flex items-center gap-2 px-1",children:[Fs("span",{className:l("size-2 rounded-full",wk[t]??wk.primary),"aria-hidden":"true"}),Fs("span",{className:"text-sm font-medium",children:e}),Fs(B,{variant:"secondary",className:"ml-auto",children:a.length})]}),Fs("ul",{className:"flex flex-col gap-2",role:"list",children:a.map(c=>Fs("li",{children:_p("div",{role:"button",tabIndex:0,onClick:()=>o?.(c.id),onKeyDown:s=>i(s,c.id),className:"flex flex-col gap-1.5 cursor-pointer rounded-lg border bg-card p-3 shadow-sm transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":`\u5361\u7247 ${c.title}`,children:[Fs("span",{className:"text-sm font-medium",children:c.title}),_p("div",{className:"flex items-center gap-2",children:[c.label&&Fs(B,{variant:"outline",children:c.label}),c.assignee&&Fs("span",{className:"ml-auto text-xs text-muted-foreground",children:c.assignee})]})]})},c.id))}),a.length===0&&Fs("p",{className:"py-3 text-center text-xs text-muted-foreground",children:"\u6682\u65E0\u5361\u7247"}),_p("button",{type:"button",onClick:r,className:"flex items-center justify-center gap-1 rounded-md border border-dashed py-1.5 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:[Fs(ge,{className:"size-3"}),"\u65B0\u589E\u5361\u7247"]})]})}import"react";import{jsx as Wi,jsxs as fc}from"react/jsx-runtime";var oD={info:{icon:od,tone:"text-blue-500"},warning:{icon:jt,tone:"text-yellow-500"},success:{icon:qe,tone:"text-emerald-500"},default:{icon:xo,tone:"text-muted-foreground"}};function nD({messages:e=[],onSelect:t,onMarkAllRead:a,className:r}){let o=e.filter(i=>!i.read).length,n=(i,c)=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),t?.(c))};return fc("div",{"data-slot":"message-list",className:l("flex flex-col gap-2 rounded-lg border bg-card p-3",r),role:"region","aria-label":"\u7AD9\u5185\u6D88\u606F\u5217\u8868",children:[fc("div",{className:"flex items-center justify-between px-1",children:[fc("span",{className:"flex items-center gap-2 text-sm font-medium",children:["\u6D88\u606F\u901A\u77E5",o>0&&fc("span",{className:"rounded-full bg-destructive px-1.5 py-0.5 text-xs text-destructive-foreground",children:[o," \u6761\u672A\u8BFB"]})]}),o>0&&a&&Wi("button",{type:"button",onClick:a,className:"text-xs text-primary hover:underline",children:"\u5168\u90E8\u5DF2\u8BFB"})]}),Wi("ul",{className:"flex flex-col divide-y",role:"list",children:e.map(i=>{let c=i.type??"default",s=oD[c],d=s.icon;return Wi("li",{children:fc("div",{role:"button",tabIndex:0,onClick:()=>t?.(i.id),onKeyDown:m=>n(m,i.id),className:l("flex cursor-pointer items-start gap-2.5 rounded-md px-2 py-2.5 transition-colors hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",!i.read&&"bg-primary/5"),"aria-label":`\u6D88\u606F ${i.title}${i.read?"":" \u672A\u8BFB"}`,children:[Wi(d,{className:l("mt-0.5 size-4 shrink-0",s.tone)}),fc("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[fc("div",{className:"flex items-center gap-2",children:[!i.read&&Wi("span",{className:"size-1.5 shrink-0 rounded-full bg-destructive","aria-hidden":"true"}),Wi("span",{className:l("truncate text-sm",!i.read&&"font-medium"),children:i.title}),i.time&&Wi("span",{className:"ml-auto shrink-0 text-xs text-muted-foreground",children:gl(i.time)})]}),i.content&&Wi("span",{className:"truncate text-xs text-muted-foreground",children:i.content})]})]})},i.id)})}),e.length===0&&Wi("p",{className:"py-6 text-center text-sm text-muted-foreground",children:"\u6682\u65E0\u6D88\u606F"})]})}import"react";import{jsx as fr,jsxs as $s}from"react/jsx-runtime";function sD({title:e="\u603B\u89C8",subtitle:t="",kpis:a=[],activities:r=[],children:o,className:n}){return $s("div",{"data-slot":"overview-page",className:l("flex flex-col gap-6",n),role:"region","aria-label":`${e}\u603B\u89C8`,children:[$s("div",{className:"flex items-center gap-3",children:[fr("span",{className:"flex size-10 items-center justify-center rounded-lg bg-primary/10",children:fr(_h,{className:"size-5 text-primary"})}),$s("div",{className:"flex flex-col",children:[fr("h1",{className:"text-xl font-semibold",children:e}),t&&fr("span",{className:"text-sm text-muted-foreground",children:t})]})]}),fr("section",{"aria-label":"\u5173\u952E\u6307\u6807",className:"grid grid-cols-2 gap-4 lg:grid-cols-4",children:a.map(i=>{let c=(i.delta??0)>=0,s=c?en:Zo;return $s("div",{className:"flex flex-col gap-1 rounded-lg border bg-card p-4",children:[fr("span",{className:"text-xs text-muted-foreground",children:i.label}),$s("span",{className:"text-2xl font-semibold tabular-nums",children:[Xg(i.value),i.unit&&fr("span",{className:"ml-0.5 text-sm font-normal text-muted-foreground",children:i.unit})]}),i.delta!==void 0&&$s("span",{className:l("flex items-center gap-1 text-xs font-medium",c?"text-emerald-600":"text-destructive"),children:[fr(s,{className:"size-3"}),c?"+":"",(i.delta*100).toFixed(1),"%"]})]},i.label)})}),$s("div",{className:"grid gap-6 lg:grid-cols-3",children:[fr("section",{"aria-label":"\u81EA\u5B9A\u4E49\u5185\u5BB9",className:"lg:col-span-2",children:o??fr("div",{className:"flex h-32 items-center justify-center rounded-lg border border-dashed text-sm text-muted-foreground",children:"\u6682\u65E0\u81EA\u5B9A\u4E49\u5185\u5BB9"})}),$s("section",{"aria-label":"\u6700\u8FD1\u6D3B\u52A8",className:"rounded-lg border bg-card p-4",children:[fr("h2",{className:"mb-3 text-sm font-medium",children:"\u6700\u8FD1\u6D3B\u52A8"}),r.length>0?fr("ol",{className:"flex flex-col gap-3",role:"list",children:r.map(i=>$s("li",{className:"flex items-start gap-2 text-sm",children:[fr("span",{className:"mt-1.5 size-1.5 shrink-0 rounded-full bg-primary","aria-hidden":"true"}),$s("div",{className:"flex flex-1 flex-col",children:[fr("span",{className:"text-foreground",children:i.text}),i.time&&fr("span",{className:"text-xs text-muted-foreground",children:i.time})]})]},i.id))}):fr("p",{className:"py-4 text-center text-sm text-muted-foreground",children:"\u6682\u65E0\u6D3B\u52A8"})]})]})]})}import"react";import{jsx as xh,jsxs as lD}from"react/jsx-runtime";function iD({permission:e,permissions:t,mode:a="disable",children:r="\u64CD\u4F5C",onClick:o,variant:n="default",disabled:i=!1,className:c}){let s=t===void 0||e===void 0?!0:t.includes(e);if(!s&&a==="hide")return null;let d=i||!s;return lD("div",{"data-slot":"permission-button",className:l("inline-flex items-center gap-1.5",c),children:[xh(C,{type:"button",variant:n,onClick:o,disabled:d,"aria-disabled":d,icon:d?xh(pg,{}):void 0,children:r}),!s&&a==="disable"&&xh("span",{className:"text-xs text-muted-foreground",children:"\u65E0\u6743\u9650"})]})}import*as qp from"react";import{useTranslation as dD}from"react-i18next";import{jsx as In,jsxs as bc}from"react/jsx-runtime";function Pk(e){let t=o=>e.filter(n=>(n.parent??"")===(o??"")),a=[],r=(o,n)=>{for(let i of t(o))a.push({...i,depth:n}),r(i.value,n+1)};return r(void 0,0),a}function cD({value:e,onChange:t,options:a=[],placeholder:r,searchPlaceholder:o,emptyText:n,disabled:i=!1,clearable:c=!0,className:s}){let{t:d}=dD("ui"),[m,u]=qp.useState(!1),[p,f]=qp.useState(""),x=r??d("productCategoryPicker.placeholder",{defaultValue:"\u8BF7\u9009\u62E9\u5546\u54C1\u5206\u7C7B"}),v=o??d("productCategoryPicker.search",{defaultValue:"\u641C\u7D22\u5206\u7C7B"}),N=n??d("productCategoryPicker.empty",{defaultValue:"\u65E0\u5339\u914D\u5206\u7C7B"}),h=a.find(g=>g.value===e),b=qp.useMemo(()=>{if(!p.trim())return Pk(a);let g=p.trim().toLowerCase(),y=a.filter(w=>w.label.toLowerCase().includes(g)||w.value.toLowerCase().includes(g)),k=new Set;for(let w of y){let R=w.value;for(;R;)k.add(R),R=a.find(z=>z.value===R)?.parent}return Pk(a).filter(w=>k.has(w.value)).map(w=>({...w,depth:0}))},[a,p]);return bc(He,{"data-slot":"product-category-picker",open:m,onOpenChange:u,children:[bc(Ve,{render:In(C,{variant:"outline",role:"combobox",type:"button",disabled:i,"aria-expanded":m,"aria-haspopup":"listbox",className:l("w-[200px] justify-between font-normal",!h&&"text-muted-foreground",s)}),children:[In(cg,{className:"size-4 shrink-0 opacity-50"}),In("span",{className:"flex-1 truncate",children:h?.label??x}),bc("span",{className:"flex items-center gap-1",children:[c&&h&&In("span",{role:"button",tabIndex:0,"aria-label":d("productCategoryPicker.clear",{defaultValue:"\u6E05\u9664"}),onClick:g=>{g.stopPropagation(),t?.(void 0)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),t?.(void 0))},className:"rounded p-0.5 hover:bg-muted",children:In(Q,{className:"size-3.5 opacity-60 hover:opacity-100"})}),In(re,{className:"size-4 opacity-50"})]})]}),m&&bc(Oe,{align:"start",className:"w-[var(--anchor-width)] p-0",children:[bc("div",{className:"flex items-center gap-2 border-b px-3 py-2",children:[In(X,{className:"size-4 shrink-0 opacity-50"}),In(T,{value:p,onChange:g=>f(g.target.value),placeholder:v,"aria-label":v,className:"h-7 border-0 bg-transparent p-0 shadow-none focus-visible:ring-0"})]}),bc("ul",{role:"tree",className:"max-h-64 overflow-y-auto p-1",children:[b.length===0&&In("li",{className:"px-2 py-6 text-center text-sm text-muted-foreground",children:N}),b.map(g=>{let y=g.value===e;return In("li",{role:"treeitem","aria-selected":y,children:bc(C,{variant:"ghost",size:"sm",type:"button",...g.disabled!==void 0?{disabled:g.disabled}:{},onClick:()=>{t?.(g.value),u(!1),f("")},style:{paddingLeft:`${8+g.depth*16}px`},className:l("h-auto w-full justify-start gap-2 rounded-sm py-1.5 pr-2 font-normal",y&&"bg-accent/50",g.disabled&&"pointer-events-none opacity-50"),children:[In("span",{className:"flex-1 truncate",children:g.label}),y&&In(U,{className:"size-4 shrink-0"})]})},g.value)})]})]})]})}import{jsx as br,jsxs as xr}from"react/jsx-runtime";function mD({name:e="\u672A\u547D\u540D\u4FC3\u9500",type:t="\u6298\u6263",discount:a=0,threshold:r,startDate:o,endDate:n,scope:i="\u5168\u90E8\u5546\u54C1",active:c=!1,onEdit:s,onDuplicate:d,className:m}){let u=t==="\u6298\u6263"?bt(a):t==="\u6EE1\u51CF"||t==="\u76F4\u964D"?`\u51CF ${a}`:`\u8D60 ${a}`;return xr(Y,{"data-slot":"promotion-rule-card",className:l("w-full",m),children:[br(le,{children:xr(ie,{className:"flex items-center justify-between gap-2",children:[xr("span",{className:"flex items-center gap-2 truncate",children:[br(Rc,{className:"size-4 text-primary"}),br("span",{className:"truncate",children:e})]}),c?br(B,{variant:"default",children:"\u751F\u6548\u4E2D"}):br(B,{variant:"secondary",children:"\u672A\u751F\u6548"})]})}),xr(J,{className:"flex flex-col gap-3",children:[xr("dl",{className:"grid grid-cols-2 gap-x-4 gap-y-2 text-sm",role:"list",children:[xr("div",{className:"flex items-center gap-1.5",children:[br("dt",{className:"text-muted-foreground",children:"\u7C7B\u578B"}),br("dd",{className:"font-medium",children:t})]}),xr("div",{className:"flex items-center gap-1.5",children:[br("dt",{className:"text-muted-foreground",children:"\u529B\u5EA6"}),br("dd",{className:"font-medium tabular-nums",children:u})]}),r!==void 0&&xr("div",{className:"flex items-center gap-1.5",children:[br("dt",{className:"text-muted-foreground",children:"\u95E8\u69DB"}),xr("dd",{className:"font-medium tabular-nums",children:["\u6EE1 ",r]})]}),xr("div",{className:"flex items-center gap-1.5",children:[br("dt",{className:"text-muted-foreground",children:"\u8303\u56F4"}),br("dd",{className:"font-medium",children:i})]})]}),xr("div",{className:"flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[xr("span",{className:"inline-flex items-center gap-1",children:[br(jr,{})," ",o??"\u5373\u65E5\u8D77"]}),xr("span",{className:"inline-flex items-center gap-1",children:[br(pe,{})," \u81F3 ",n??"\u957F\u671F"]})]}),xr("div",{className:"flex items-center gap-2",children:[xr(C,{type:"button",variant:"outline",size:"sm",onClick:s,children:[br(lg,{})," \u7F16\u8F91"]}),xr(C,{type:"button",variant:"ghost",size:"sm",onClick:d,children:[br(zt,{})," \u590D\u5236"]})]})]})]})}import*as Ob from"react";import{jsx as Pt,jsxs as vr}from"react/jsx-runtime";var uD=[{id:"rule-1",name:"\u6EE199\u51CF10",threshold:99,operator:"gte",action:"discount",amount:10}];function pD({rules:e=uD,onChange:t,className:a}){let[r,o]=Ob.useState(e);Ob.useEffect(()=>{o(e)},[e]);let n=m=>{o(m),t?.(m)},i=(m,u,p)=>{n(r.map(f=>f.id===m?{...f,[u]:p}:f))},c=()=>{let m=`rule-${Date.now()}`;n([...r,{id:m,name:"",threshold:0,operator:"gte",action:"discount",amount:0}])},s=m=>{n(r.filter(u=>u.id!==m))},d={discount:"\u6298\u6263",gift:"\u8D60\u54C1",coupon:"\u4F18\u60E0\u5238"};return vr("div",{"data-slot":"promotion-rule-editor",className:l("flex flex-col gap-4",a),children:[vr("div",{className:"flex items-center gap-2",children:[Pt(Rc,{className:"size-5 text-muted-foreground","aria-hidden":!0}),Pt("h3",{className:"text-base font-medium",children:"\u4FC3\u9500\u89C4\u5219"})]}),Pt("ol",{className:"flex flex-col gap-3",children:r.map((m,u)=>vr("li",{className:"flex flex-col gap-3 rounded-md border p-3",children:[vr("div",{className:"flex items-center justify-between",children:[vr(B,{variant:"secondary",children:["\u89C4\u5219 ",u+1]}),Pt(C,{type:"button",variant:"ghost",size:"sm","aria-label":`\u5220\u9664\u89C4\u5219 ${u+1}`,onClick:()=>s(m.id),children:Pt(ye,{className:"size-4","aria-hidden":!0})})]}),vr("div",{className:"flex flex-col gap-1.5",children:[Pt(ue,{htmlFor:`pre-name-${m.id}`,children:"\u89C4\u5219\u540D\u79F0"}),Pt(T,{id:`pre-name-${m.id}`,value:m.name,placeholder:"\u5982\uFF1A\u6EE1199\u51CF30",onChange:p=>i(m.id,"name",p.target.value)})]}),Pt(Ue,{}),vr("div",{className:"grid grid-cols-2 gap-3",children:[vr("div",{className:"flex flex-col gap-1.5",children:[Pt(ue,{htmlFor:`pre-threshold-${m.id}`,children:"\u95E8\u69DB"}),Pt(T,{id:`pre-threshold-${m.id}`,type:"number",value:Number.isFinite(m.threshold)?m.threshold:0,onChange:p=>i(m.id,"threshold",p.target.valueAsNumber)})]}),vr("div",{className:"flex flex-col gap-1.5",children:[Pt(ue,{htmlFor:`pre-operator-${m.id}`,children:"\u6BD4\u8F83"}),vr(Pe,{value:m.operator,onValueChange:p=>i(m.id,"operator",p??"gte"),children:[Pt(Re,{id:`pre-operator-${m.id}`,children:Pt(Te,{})}),vr(Se,{children:[Pt(ve,{value:"gte",children:"\u2265 \u5927\u4E8E\u7B49\u4E8E"}),Pt(ve,{value:"lte",children:"\u2264 \u5C0F\u4E8E\u7B49\u4E8E"}),Pt(ve,{value:"eq",children:"= \u7B49\u4E8E"})]})]})]}),vr("div",{className:"flex flex-col gap-1.5",children:[Pt(ue,{htmlFor:`pre-action-${m.id}`,children:"\u5956\u52B1\u7C7B\u578B"}),vr(Pe,{value:m.action,onValueChange:p=>i(m.id,"action",p??"discount"),children:[Pt(Re,{id:`pre-action-${m.id}`,children:Pt(Te,{children:d[m.action]})}),vr(Se,{children:[Pt(ve,{value:"discount",children:"\u6298\u6263"}),Pt(ve,{value:"gift",children:"\u8D60\u54C1"}),Pt(ve,{value:"coupon",children:"\u4F18\u60E0\u5238"})]})]})]}),vr("div",{className:"flex flex-col gap-1.5",children:[Pt(ue,{htmlFor:`pre-amount-${m.id}`,children:"\u6570\u503C"}),Pt(T,{id:`pre-amount-${m.id}`,type:"number",value:Number.isFinite(m.amount)?m.amount:0,onChange:p=>i(m.id,"amount",p.target.valueAsNumber)})]})]})]},m.id))}),Pt("div",{className:"flex justify-start",children:vr(C,{type:"button",variant:"outline",size:"sm",onClick:c,children:[Pt(ge,{className:"size-4","aria-hidden":!0}),"\u65B0\u589E\u89C4\u5219"]})})]})}import{jsx as Ub,jsxs as Gp}from"react/jsx-runtime";function gD({value:e=66,max:t=100,label:a="\u8FBE\u6210\u7387",color:r="#3b82f6",size:o=120,className:n}){let i=Math.min(1,Math.max(0,e/t)),c=42,s=2*Math.PI*c,d=50;return Gp("div",{"data-slot":"radial-chart",className:l("flex flex-col items-center",n),role:"img","aria-label":`${a}: ${q(e)} / ${q(t)}`,children:[Gp("div",{className:"relative",style:{width:o,height:o},children:[Gp("svg",{viewBox:"0 0 100 100",className:"-rotate-90",width:o,height:o,role:"presentation",children:[Ub("circle",{cx:d,cy:d,r:c,fill:"none",stroke:"currentColor",strokeOpacity:.15,strokeWidth:8,className:"text-muted-foreground"}),Ub("circle",{cx:d,cy:d,r:c,fill:"none",stroke:r,strokeWidth:8,strokeLinecap:"round",strokeDasharray:`${i*s} ${s}`})]}),Gp("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[Ub("span",{className:"text-lg font-semibold tabular-nums",children:bt(i)}),Gp("span",{className:"text-[10px] text-muted-foreground",children:[q(e),"/",q(t)]})]})]}),Ub("span",{className:"mt-1 text-xs text-muted-foreground",children:a})]})}import*as jp from"react";import{useTranslation as fD}from"react-i18next";import{jsx as Dn,jsxs as xc}from"react/jsx-runtime";function Tk(e){let t=o=>e.filter(n=>(n.parent??"")===(o??"")),a=[],r=(o,n)=>{for(let i of t(o))a.push({...i,depth:n}),r(i.value,n+1)};return r(void 0,0),a}function bD({value:e,onChange:t,options:a=[],placeholder:r,searchPlaceholder:o,emptyText:n,disabled:i=!1,clearable:c=!0,className:s}){let{t:d}=fD("ui"),[m,u]=jp.useState(!1),[p,f]=jp.useState(""),x=r??d("regionPicker.placeholder",{defaultValue:"\u8BF7\u9009\u62E9\u5730\u533A"}),v=o??d("regionPicker.search",{defaultValue:"\u641C\u7D22\u5730\u533A"}),N=n??d("regionPicker.empty",{defaultValue:"\u65E0\u5339\u914D\u5730\u533A"}),h=a.find(g=>g.value===e),b=jp.useMemo(()=>{if(!p.trim())return Tk(a);let g=p.trim().toLowerCase(),y=a.filter(w=>w.label.toLowerCase().includes(g)||w.value.toLowerCase().includes(g)),k=new Set;for(let w of y){let R=w.value;for(;R;)k.add(R),R=a.find(z=>z.value===R)?.parent}return Tk(a).filter(w=>k.has(w.value)).map(w=>({...w,depth:0}))},[a,p]);return xc(He,{open:m,onOpenChange:u,children:[xc(Ve,{render:Dn(C,{variant:"outline",role:"combobox",type:"button",disabled:i,"aria-expanded":m,"aria-haspopup":"listbox",className:l("w-[200px] justify-between font-normal",!h&&"text-muted-foreground",s)}),children:[Dn(on,{className:"size-4 shrink-0 opacity-50"}),Dn("span",{className:"flex-1 truncate",children:h?.label??x}),xc("span",{className:"flex items-center gap-1",children:[c&&h&&Dn("span",{role:"button",tabIndex:0,"aria-label":d("regionPicker.clear",{defaultValue:"\u6E05\u9664"}),onClick:g=>{g.stopPropagation(),t?.(void 0)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),t?.(void 0))},className:"rounded p-0.5 hover:bg-muted",children:Dn(Q,{className:"size-3.5 opacity-60 hover:opacity-100"})}),Dn(re,{className:"size-4 opacity-50"})]})]}),m&&xc(Oe,{align:"start",className:"w-[var(--anchor-width)] p-0",children:[xc("div",{className:"flex items-center gap-2 border-b px-3 py-2",children:[Dn(X,{className:"size-4 shrink-0 opacity-50"}),Dn(T,{value:p,onChange:g=>f(g.target.value),placeholder:v,"aria-label":v,className:"h-7 border-0 bg-transparent p-0 shadow-none focus-visible:ring-0"})]}),xc("ul",{role:"tree",className:"max-h-64 overflow-y-auto p-1",children:[b.length===0&&Dn("li",{className:"px-2 py-6 text-center text-sm text-muted-foreground",children:N}),b.map(g=>{let y=g.value===e;return Dn("li",{role:"treeitem","aria-selected":y,children:xc(C,{variant:"ghost",size:"sm",type:"button",...g.disabled!==void 0?{disabled:g.disabled}:{},onClick:()=>{t?.(g.value),u(!1),f("")},style:{paddingLeft:`${8+g.depth*16}px`},className:l("h-auto w-full justify-start gap-2 rounded-sm py-1.5 pr-2 font-normal",y&&"bg-accent/50",g.disabled&&"pointer-events-none opacity-50"),children:[Dn("span",{className:"flex-1 truncate",children:g.label}),y&&Dn(U,{className:"size-4 shrink-0"})]})},g.value)})]})]})]})}import*as Kp from"react";import{jsx as Qm,jsxs as Wb}from"react/jsx-runtime";var xD=[{source:"\u641C\u7D22",target:"\u4E0B\u5355",value:40},{source:"\u5E7F\u544A",target:"\u4E0B\u5355",value:25},{source:"\u5E7F\u544A",target:"\u6D41\u5931",value:15},{source:"\u76F4\u63A5",target:"\u4E0B\u5355",value:20}],vD={\u641C\u7D22:"#3b82f6",\u5E7F\u544A:"#8b5cf6",\u76F4\u63A5:"#10b981"},hD={\u4E0B\u5355:"#3b82f6",\u6D41\u5931:"#ef4444"};function yD({flows:e=xD,className:t}){let a=Kp.useMemo(()=>{let b=[];for(let g of e)b.includes(g.source)||b.push(g.source);return b},[e]),r=Kp.useMemo(()=>{let b=[];for(let g of e)b.includes(g.target)||b.push(g.target);return b},[e]),o=Kp.useMemo(()=>{let b=new Map;for(let g of e)b.set(g.source,(b.get(g.source)??0)+g.value);return b},[e]),n=Kp.useMemo(()=>{let b=new Map;for(let g of e)b.set(g.target,(b.get(g.target)??0)+g.value);return b},[e]),i=200,c=8,s=Math.max(1,...Array.from(o.values())),d=Math.max(1,...Array.from(n.values())),m=Math.max(s,d),u=a.map((b,g)=>{let y=a.slice(0,g).reduce((w,R)=>w+(o.get(R)??0)/m*(i-c*(a.length-1)),0),k=(o.get(b)??0)/m*(i-c*(a.length-1));return{label:b,y:y+g*c,h:k,color:vD[b]??"#3b82f6"}}),p=r.map((b,g)=>{let y=r.slice(0,g).reduce((w,R)=>w+(n.get(R)??0)/m*(i-c*(r.length-1)),0),k=(n.get(b)??0)/m*(i-c*(r.length-1));return{label:b,y:y+g*c,h:k,color:hD[b]??"#10b981"}}),f=90,x=230,v=b=>b.value/m*(i-c*(Math.max(a.length,r.length)-1)),N=new Map,h=new Map;return Qm("div",{"data-slot":"sankey-chart",className:l("w-full overflow-x-auto",t),role:"img","aria-label":`\u6851\u57FA\u56FE\uFF0C${a.length} \u6E90 \u2192 ${r.length} \u76EE\u6807`,children:Wb("svg",{viewBox:`0 0 320 ${i}`,width:"100%",role:"presentation",children:[e.map((b,g)=>{let y=u.find($=>$.label===b.source),k=p.find($=>$.label===b.target);if(!y||!k)return null;let w=N.get(b.source)??0,R=h.get(b.target)??0,S=v(b);N.set(b.source,w+S),h.set(b.target,R+S);let z=y.y+w,L=k.y+R,H=(f+x)/2,M=`M ${f} ${z} C ${H} ${z}, ${H} ${L}, ${x} ${L} L ${x} ${L+S} C ${H} ${L+S}, ${H} ${z+S}, ${f} ${z+S} Z`;return Qm("path",{d:M,fill:y.color,fillOpacity:.25,children:Wb("title",{children:[b.source," \u2192 ",b.target,": ",q(b.value)]})},g)}),u.map(b=>Wb("g",{children:[Qm("rect",{x:f-8,y:b.y,width:8,height:b.h,fill:b.color}),Qm("text",{x:f-12,y:b.y+b.h/2,textAnchor:"end",dominantBaseline:"middle",className:"fill-muted-foreground text-[9px]",children:b.label})]},`s-${b.label}`)),p.map(b=>Wb("g",{children:[Qm("rect",{x,y:b.y,width:8,height:b.h,fill:b.color}),Qm("text",{x:x+12,y:b.y+b.h/2,textAnchor:"start",dominantBaseline:"middle",className:"fill-muted-foreground text-[9px]",children:b.label})]},`t-${b.label}`))]})})}import*as Qp from"react";import{useTranslation as ND}from"react-i18next";import{jsx as Xo,jsxs as _i}from"react/jsx-runtime";function CD({value:e,onChange:t,options:a=[],placeholder:r,searchPlaceholder:o,emptyText:n,disabled:i=!1,clearable:c=!0,className:s}){let{t:d}=ND("ui"),[m,u]=Qp.useState(!1),[p,f]=Qp.useState(""),x=r??d("skuPicker.placeholder",{defaultValue:"\u8BF7\u9009\u62E9\u5546\u54C1"}),v=o??d("skuPicker.search",{defaultValue:"\u641C\u7D22\u5546\u54C1/SKU"}),N=n??d("skuPicker.empty",{defaultValue:"\u65E0\u5339\u914D\u5546\u54C1"}),h=a.find(g=>g.value===e),b=Qp.useMemo(()=>{if(!p.trim())return a;let g=p.trim().toLowerCase();return a.filter(y=>y.label.toLowerCase().includes(g)||y.value.toLowerCase().includes(g)||y.code?.toLowerCase().includes(g)||y.spec?.toLowerCase().includes(g))},[a,p]);return _i(He,{open:m,onOpenChange:u,children:[_i(Ve,{render:Xo(C,{variant:"outline",role:"combobox",type:"button",disabled:i,"aria-expanded":m,"aria-haspopup":"listbox",className:l("w-[200px] justify-between font-normal",!h&&"text-muted-foreground",s)}),children:[Xo(Qr,{className:"size-4 shrink-0 opacity-50"}),Xo("span",{className:"flex-1 truncate",children:h?.label??x}),_i("span",{className:"flex items-center gap-1",children:[c&&h&&Xo("span",{role:"button",tabIndex:0,"aria-label":d("skuPicker.clear",{defaultValue:"\u6E05\u9664"}),onClick:g=>{g.stopPropagation(),t?.(void 0)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),t?.(void 0))},className:"rounded p-0.5 hover:bg-muted",children:Xo(Q,{className:"size-3.5 opacity-60 hover:opacity-100"})}),Xo(re,{className:"size-4 opacity-50"})]})]}),m&&_i(Oe,{align:"start",className:"w-[var(--anchor-width)] p-0",children:[_i("div",{className:"flex items-center gap-2 border-b px-3 py-2",children:[Xo(X,{className:"size-4 shrink-0 opacity-50"}),Xo(T,{value:p,onChange:g=>f(g.target.value),placeholder:v,"aria-label":v,className:"h-7 border-0 bg-transparent p-0 shadow-none focus-visible:ring-0"})]}),_i("ul",{role:"listbox",className:"max-h-64 overflow-y-auto p-1",children:[b.length===0&&Xo("li",{className:"px-2 py-6 text-center text-sm text-muted-foreground",children:N}),b.map(g=>{let y=g.value===e;return Xo("li",{role:"option","aria-selected":y,children:_i(C,{variant:"ghost",size:"sm",type:"button",...g.disabled!==void 0?{disabled:g.disabled}:{},onClick:()=>{t?.(g.value),u(!1),f("")},className:l("h-auto w-full justify-start gap-2 rounded-sm px-2 py-1.5 font-normal",y&&"bg-accent/50",g.disabled&&"pointer-events-none opacity-50"),children:[_i("span",{className:"flex-1 truncate",children:[g.label,g.spec&&_i("span",{className:"ml-1 text-xs text-muted-foreground",children:["\xB7 ",g.spec]})]}),g.unit&&Xo("span",{className:"shrink-0 text-xs text-muted-foreground",children:g.unit}),g.price!=null&&Xo("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:Ne(g.price)}),y&&Xo(U,{className:"size-4 shrink-0"})]})},g.value)})]})]})]})}import{jsx as Rk,jsxs as Sk}from"react/jsx-runtime";function kD({data:e=[4,8,6,12,10,14,11],width:t=120,height:a=32,color:r="currentColor",className:o}){let n=Math.max(1,...e),i=Math.min(0,...e),c=n-i||1,s=t/Math.max(1,e.length-1),d=f=>a-(f-i)/c*a,u=`M ${e.map((f,x)=>`${x*s},${d(f)}`).join(" L ")}`,p=`${u} L ${t},${a} L 0,${a} Z`;return Sk("svg",{"data-slot":"spark-chart",viewBox:`0 0 ${t} ${a}`,width:t,height:a,preserveAspectRatio:"none",className:l("text-primary",o),role:"img","aria-label":`\u8D8B\u52BF\u7EBF\uFF0C${e.length} \u70B9\uFF0C\u6700\u5927 ${n}`,children:[Rk("path",{d:p,fill:r,fillOpacity:.15,stroke:"none"}),Rk("path",{d:u,fill:"none",stroke:r,strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"}),Sk("title",{children:["\u6700\u5927\u503C ",q(n)]})]})}import{jsx as Xp,jsxs as vh}from"react/jsx-runtime";function wD({label:e="\u6307\u6807",value:t=0,delta:a=0,icon:r,className:o}){let n=a>=0,i=typeof t=="number"?q(t):t,c=n?en:Zo;return vh("div",{"data-slot":"stat-card-with-delta",className:l("flex items-center gap-3 rounded-lg border bg-card p-4",o),children:[r?Xp("span",{className:"flex size-10 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground",children:Xp(r,{className:"size-5","aria-hidden":"true"})}):null,vh("div",{className:"min-w-0 flex-1",children:[Xp("p",{className:"truncate text-xs text-muted-foreground",children:e}),Xp("p",{className:"mt-0.5 text-xl font-semibold tabular-nums",children:i})]}),vh("span",{className:l("flex shrink-0 items-center gap-0.5 text-xs font-medium tabular-nums",n?"text-emerald-600":"text-red-600"),"aria-label":`\u8D8B\u52BF ${n?"\u4E0A\u5347":"\u4E0B\u964D"} ${Math.abs(a)}%`,children:[Xp(c,{className:"size-3.5","aria-hidden":"true"}),bt(Math.abs(a)/100)]})]})}import*as Xm from"react";import{jsx as Hs,jsxs as hh}from"react/jsx-runtime";var PD=[{id:"basic",label:"\u57FA\u672C\u4FE1\u606F",fields:[{name:"code",label:"\u7F16\u7801"},{name:"name",label:"\u540D\u79F0"}]},{id:"contact",label:"\u8054\u7CFB\u65B9\u5F0F",fields:[{name:"phone",label:"\u7535\u8BDD"},{name:"address",label:"\u5730\u5740",type:"textarea"}]}];function TD({tabs:e=PD,value:t,onChange:a,className:r}){let o=Xm.useRef(t??{});Xm.useEffect(()=>{t&&(o.current=t)},[t]);let n=Xm.useCallback((i,c)=>{let s={...o.current,[i]:c};o.current=s,a?.(s)},[a]);return Hs("div",{"data-slot":"subform-tabs",className:l("flex flex-col gap-3",r),children:hh(Sr,{defaultValue:e[0]?.id,children:[Hs(Ir,{"aria-label":"\u5B50\u8868\u5355\u5206\u533A",children:e.map(i=>Hs(Ba,{value:i.id,children:i.label},i.id))}),e.map(i=>Hs(Co,{value:i.id,children:Hs("div",{className:"flex flex-col gap-4 py-2",children:i.fields.length===0?Hs("p",{className:"text-sm text-muted-foreground",children:"\u8BE5\u5206\u533A\u6682\u65E0\u5B57\u6BB5"}):i.fields.map(c=>{let s=`sft-${i.id}-${c.name}`,d=o.current[c.name];return c.type==="textarea"?hh("div",{className:"flex flex-col gap-1.5",children:[Hs(ue,{htmlFor:s,children:c.label}),Hs(St,{id:s,value:typeof d=="string"?d:"",onChange:m=>n(c.name,m.target.value)})]},c.name):hh("div",{className:"flex flex-col gap-1.5",children:[Hs(ue,{htmlFor:s,children:c.label}),Hs(T,{id:s,value:d==null?"":String(d),onChange:m=>n(c.name,m.target.value)})]},c.name)})})},i.id))]})})}import*as yh from"react";import{jsx as Zl,jsxs as Yp}from"react/jsx-runtime";function RD({tabs:e=[{id:"all",label:"\u5168\u90E8"}],active:t,defaultActive:a,onTabChange:r,onCreate:o,query:n,onQueryChange:i,children:c,className:s}){let d=t!==void 0,[m,u]=yh.useState(a??e[0]?.id??"all"),p=d?t:m,[f,x]=yh.useState(""),v=n!==void 0?n:f,N=b=>{d||u(b),r?.(b)},h=b=>{let g=b.target.value;n===void 0&&x(g),i?.(g)};return Yp("div",{"data-slot":"tab-crud-page",className:l("flex flex-col gap-3",s),children:[Zl(Y,{children:Yp(J,{className:"flex flex-wrap items-center gap-2 p-3",children:[Yp("div",{className:"relative min-w-[12rem] flex-1",children:[Zl(X,{className:"pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"}),Zl(T,{type:"search",value:v,onChange:h,placeholder:"\u641C\u7D22...","aria-label":"\u641C\u7D22",className:"pl-8"})]}),o&&Yp(C,{type:"button",onClick:o,"aria-label":"\u65B0\u5EFA",children:[Zl(ge,{})," \u65B0\u5EFA"]})]})}),Yp(Sr,{value:p,onValueChange:b=>N(String(b)),className:"gap-3",children:[Zl(Ir,{"aria-label":"CRUD \u5206\u7EC4",children:e.map(b=>Zl(Ba,{value:b.id,children:b.label},b.id))}),Zl(Ue,{}),Zl("div",{className:"min-h-0 flex-1",children:c})]})]})}import{useTheme as SD}from"next-themes";import{jsx as Vs,jsxs as Ym}from"react/jsx-runtime";function ID({className:e,showSystem:t=!0,align:a="end"}){let{theme:r,setTheme:o}=SD();return Ym(sr,{children:[Ym(ir,{render:Vs(C,{variant:"ghost",size:"icon",className:l("relative",e),"aria-label":"Toggle theme"}),children:[Vs(ru,{className:"size-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),Vs(au,{className:"absolute size-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"}),Vs("span",{className:"sr-only",children:"Toggle theme"})]}),Ym(lr,{align:a,children:[Ym(la,{onClick:()=>o("light"),children:[Vs(ru,{}),"\u6D45\u8272",r==="light"&&Vs("span",{className:"ml-auto text-xs",children:"\u2713"})]}),t&&Ym(la,{onClick:()=>o("system"),children:[Vs(tu,{}),"\u8DDF\u968F\u7CFB\u7EDF",r==="system"&&Vs("span",{className:"ml-auto text-xs",children:"\u2713"})]}),Ym(la,{onClick:()=>o("dark"),children:[Vs(au,{}),"\u6DF1\u8272",r==="dark"&&Vs("span",{className:"ml-auto text-xs",children:"\u2713"})]})]})]})}import{jsx as Va,jsxs as Jp}from"react/jsx-runtime";var DD=[{id:"t1",title:"\u5BA1\u6838\u4ECA\u65E5\u91C7\u8D2D\u5355",priority:"high"},{id:"t2",title:"\u590D\u6838\u5E93\u5B58\u76D8\u70B9\u7ED3\u679C",priority:"medium"},{id:"t3",title:"\u63D0\u4EA4\u6708\u5EA6\u8D22\u52A1\u62A5\u8868",priority:"low"}],MD={high:"\u9AD8",medium:"\u4E2D",low:"\u4F4E"},BD={high:"bg-destructive/10 text-destructive",medium:"bg-amber-500/10 text-amber-600",low:"bg-primary/10 text-primary"};function LD({items:e,onToggle:t,className:a}){let r=e??DD;return Va("div",{"data-slot":"todo-list-table",className:l("overflow-x-auto rounded-md border",a),children:Jp("table",{className:"w-full text-sm",children:[Va("caption",{className:"sr-only",children:"\u5F85\u529E\u4E8B\u9879"}),Va("thead",{className:"bg-muted/50",children:Jp("tr",{children:[Va("th",{scope:"col",className:"w-10 px-3 py-2 text-center font-medium",children:"\u5B8C\u6210"}),Va("th",{scope:"col",className:"px-3 py-2 text-left font-medium",children:"\u4E8B\u9879"}),Va("th",{scope:"col",className:"px-3 py-2 text-left font-medium",children:"\u4F18\u5148\u7EA7"}),Va("th",{scope:"col",className:"px-3 py-2 text-left font-medium",children:"\u622A\u6B62\u65E5\u671F"})]})}),Va("tbody",{children:r.map(o=>{let n=o.completed??!1;return Jp("tr",{className:"border-t",children:[Va("td",{className:"px-3 py-2 text-center",children:Va("button",{type:"button",role:"checkbox","aria-checked":n,"aria-label":n?`\u6807\u8BB0\u300C${o.title}\u300D\u4E3A\u672A\u5B8C\u6210`:`\u6807\u8BB0\u300C${o.title}\u300D\u4E3A\u5DF2\u5B8C\u6210`,onClick:()=>t?.(o.id),className:l("inline-flex size-5 items-center justify-center rounded border transition-colors",n?"border-primary bg-primary text-primary-foreground":"border-input hover:bg-muted"),children:n?Va(U,{className:"size-3.5","aria-hidden":"true"}):Va(vo,{className:"size-3 text-transparent","aria-hidden":"true"})})}),Va("td",{className:l("px-3 py-2",n?"text-muted-foreground line-through":"font-medium"),children:o.title}),Va("td",{className:"px-3 py-2",children:o.priority?Jp("span",{className:l("inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-xs font-medium",BD[o.priority]),children:[Va(ay,{className:"size-3","aria-hidden":"true"}),MD[o.priority]]}):Va("span",{className:"text-muted-foreground",children:"\u2014"})}),Va("td",{className:"px-3 py-2 text-muted-foreground",children:o.deadline?Jp("span",{className:"inline-flex items-center gap-1",children:[Va(pe,{className:"size-3","aria-hidden":"true"}),tt(o.deadline)]}):"\u2014"})]},o.id)})})]})})}import*as vc from"react";import{jsx as Mt,jsxs as Os}from"react/jsx-runtime";function zD(e){let t=[],a=r=>{for(let o of r)t.push(o),o.children?.length&&a(o.children)};return a(e),t}function AD(e,t){let a=t.trim().toLowerCase();if(!a)return e;let r=o=>{let n=[];for(let i of o){let c=i.children?.length?r(i.children):[];if(i.label.toLowerCase().includes(a)||c.length>0){let s={...i};c.length>0?s.children=c:i.children&&(s.children=i.children),n.push(s)}}return n};return r(e)}function Ik({node:e,level:t,selectedId:a,expandedIds:r,onToggle:o,onSelect:n}){let i=!!e.children?.length,c=r.has(e.id),s=a===e.id,d=m=>{m.key==="Enter"||m.key===" "?(m.preventDefault(),n(e.id)):(m.key==="ArrowRight"&&i&&!c||m.key==="ArrowLeft"&&i&&c)&&(m.preventDefault(),o(e.id))};return Os("li",{role:"none",children:[Os("div",{role:"treeitem",tabIndex:0,"aria-expanded":i?c:void 0,"aria-selected":s,"aria-level":t+1,onKeyDown:d,onClick:()=>n(e.id),className:l("flex cursor-pointer items-center gap-1 rounded-md py-1.5 pr-2 outline-none transition-colors focus-visible:ring-3 focus-visible:ring-ring/50",s?"bg-primary/10 text-primary":"hover:bg-muted"),style:{paddingLeft:`${t*16+4}px`},children:[i?Mt("button",{type:"button","aria-label":c?`\u6536\u8D77 ${e.label}`:`\u5C55\u5F00 ${e.label}`,onClick:m=>{m.stopPropagation(),o(e.id)},className:"inline-flex size-4 shrink-0 items-center justify-center rounded outline-none hover:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50",children:c?Mt(re,{className:"size-3.5"}):Mt(me,{className:"size-3.5"})}):Mt("span",{className:"inline-flex size-4 shrink-0 items-center justify-center","aria-hidden":"true"}),Mt("span",{className:"shrink-0 text-muted-foreground","aria-hidden":"true",children:i?c?Mt(ry,{className:"size-4"}):Mt(cg,{className:"size-4"}):Mt(es,{className:"size-4"})}),Mt("span",{className:"min-w-0 flex-1 truncate text-sm",children:e.label})]}),i&&c&&Mt("ul",{role:"group",className:"m-0 list-none p-0",children:e.children.map(m=>Mt(Ik,{node:m,level:t+1,selectedId:a,expandedIds:r,onToggle:o,onSelect:n},m.id))})]})}function ED({tree:e=[],selected:t,defaultSelected:a,onSelect:r,onCreate:o,onRefresh:n,query:i,onQueryChange:c,children:s,className:d}){let m=t!==void 0,[u,p]=vc.useState(a??null),f=m?t:u,[x,v]=vc.useState(""),N=i!==void 0?i:x,[h,b]=vc.useState(()=>{let L=new Set;for(let H of e)H.children?.length&&L.add(H.id);return L}),g=vc.useMemo(()=>AD(e,N),[e,N]),y=vc.useMemo(()=>zD(g),[g]),k=N.trim()?new Set(y.map(L=>L.id)):h,w=L=>{b(H=>{let M=new Set(H);return M.has(L)?M.delete(L):M.add(L),M})},R=L=>{m||p(L),r?.(L)},S=L=>{let H=L.target.value;i===void 0&&v(H),c?.(H)},z=y.find(L=>L.id===f)??null;return Os("div",{"data-slot":"tree-crud-page",className:l("flex h-full min-h-0 gap-3",d),role:"group","aria-label":"\u5DE6\u6811\u53F3\u8868 CRUD",children:[Os("aside",{className:"flex w-64 shrink-0 flex-col gap-2 rounded-lg border bg-card p-2","aria-label":"\u5206\u7C7B\u6811",children:[Os("div",{className:"flex items-center gap-1",children:[o&&Os(C,{type:"button",variant:"outline",size:"sm",onClick:o,"aria-label":"\u65B0\u589E\u5206\u7C7B",children:[Mt(ge,{})," \u65B0\u589E\u5206\u7C7B"]}),n&&Mt(C,{type:"button",variant:"ghost",size:"icon-sm",onClick:n,"aria-label":"\u5237\u65B0",children:Mt(ia,{})})]}),Os("div",{className:"relative",children:[Mt(X,{className:"pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"}),Mt(T,{type:"search",value:N,onChange:S,placeholder:"\u641C\u7D22\u5206\u7C7B","aria-label":"\u641C\u7D22\u5206\u7C7B",className:"pl-8 pr-8"}),N&&Mt("button",{type:"button","aria-label":"\u6E05\u9664\u641C\u7D22",onClick:()=>{i===void 0&&v(""),c?.("")},className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:Mt(Q,{className:"size-4"})})]}),Mt(Ue,{}),Mt("div",{className:"min-h-0 flex-1 overflow-auto",children:g.length===0?Mt("p",{className:"py-6 text-center text-sm text-muted-foreground",children:"\u6682\u65E0\u5206\u7C7B"}):Mt("ul",{role:"tree","aria-label":"\u5206\u7C7B",className:"m-0 list-none p-0",children:g.map(L=>Mt(Ik,{node:L,level:0,selectedId:f,expandedIds:k,onToggle:w,onSelect:R},L.id))})})]}),Os("section",{className:"flex min-w-0 flex-1 flex-col gap-2","aria-label":"CRUD \u8BE6\u60C5",children:[Os("div",{className:"flex items-center justify-between rounded-lg border bg-card px-3 py-2",children:[Mt("span",{className:"truncate text-sm font-medium",children:z?z.label:"\u672A\u9009\u62E9\u5206\u7C7B"}),Os("span",{className:"text-xs text-muted-foreground tabular-nums",children:["\u5171 ",y.length," \u9879"]})]}),Mt("div",{className:"min-h-0 flex-1",children:s})]})]})}import{jsx as _b,jsxs as Mk}from"react/jsx-runtime";var Dk=["#3b82f6","#10b981","#f59e0b","#ef4444","#8b5cf6","#06b6d4","#ec4899"];function FD({data:e=[{name:"\u98DF\u54C1",value:48},{name:"\u65E5\u7528",value:28},{name:"\u5BB6\u7535",value:16},{name:"\u5176\u4ED6",value:8}],className:t}){let a=e.reduce((o,n)=>o+n.value,0)||1,r=e.length<=2?e.length:Math.ceil(Math.sqrt(e.length));return _b("div",{"data-slot":"treemap-chart",className:l("w-full",t),role:"img","aria-label":`\u6811\u56FE\uFF0C\u5171 ${e.length} \u9879`,children:_b("div",{className:"grid w-full gap-1",style:{gridTemplateColumns:`repeat(${r}, 1fr)`},children:e.map((o,n)=>{let i=o.value/a,c=Math.max(1,Math.round(i*r*2)),s=o.color??Dk[n%Dk.length];return Mk("div",{className:"flex min-h-16 flex-col justify-between overflow-hidden rounded-md p-2 text-white",style:{backgroundColor:s,gridColumn:`span ${Math.min(r,c)}`},children:[_b("span",{className:"truncate text-xs font-medium",children:o.name}),_b("span",{className:"text-sm font-semibold tabular-nums",children:q(o.value)}),Mk("span",{className:"sr-only",children:["\u5360\u6BD4 ",(i*100).toFixed(0),"%"]})]},o.name)})})})}import*as Zp from"react";import{useTranslation as $D}from"react-i18next";import{jsx as Yo,jsxs as hc}from"react/jsx-runtime";function HD({value:e,onChange:t,options:a=[],placeholder:r,searchPlaceholder:o,emptyText:n,disabled:i=!1,clearable:c=!0,className:s}){let{t:d}=$D("ui"),[m,u]=Zp.useState(!1),[p,f]=Zp.useState(""),x=r??d("warehousePicker.placeholder",{defaultValue:"\u8BF7\u9009\u62E9\u4ED3\u5E93"}),v=o??d("warehousePicker.search",{defaultValue:"\u641C\u7D22\u4ED3\u5E93"}),N=n??d("warehousePicker.empty",{defaultValue:"\u65E0\u5339\u914D\u4ED3\u5E93"}),h=a.find(g=>g.value===e),b=Zp.useMemo(()=>{if(!p.trim())return a;let g=p.trim().toLowerCase();return a.filter(y=>y.label.toLowerCase().includes(g)||y.value.toLowerCase().includes(g)||y.code?.toLowerCase().includes(g)||y.address?.toLowerCase().includes(g))},[a,p]);return hc(He,{open:m,onOpenChange:u,children:[hc(Ve,{render:Yo(C,{variant:"outline",role:"combobox",type:"button",disabled:i,"aria-expanded":m,"aria-haspopup":"listbox",className:l("w-[200px] justify-between font-normal",!h&&"text-muted-foreground",s)}),children:[Yo(Qr,{className:"size-4 shrink-0 opacity-50"}),Yo("span",{className:"flex-1 truncate",children:h?.label??x}),hc("span",{className:"flex items-center gap-1",children:[c&&h&&Yo("span",{role:"button",tabIndex:0,"aria-label":d("warehousePicker.clear",{defaultValue:"\u6E05\u9664"}),onClick:g=>{g.stopPropagation(),t?.(void 0)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),t?.(void 0))},className:"rounded p-0.5 hover:bg-muted",children:Yo(Q,{className:"size-3.5 opacity-60 hover:opacity-100"})}),Yo(re,{className:"size-4 opacity-50"})]})]}),m&&hc(Oe,{align:"start",className:"w-[var(--anchor-width)] p-0",children:[hc("div",{className:"flex items-center gap-2 border-b px-3 py-2",children:[Yo(X,{className:"size-4 shrink-0 opacity-50"}),Yo(T,{value:p,onChange:g=>f(g.target.value),placeholder:v,"aria-label":v,className:"h-7 border-0 bg-transparent p-0 shadow-none focus-visible:ring-0"})]}),hc("ul",{role:"listbox",className:"max-h-64 overflow-y-auto p-1",children:[b.length===0&&Yo("li",{className:"px-2 py-6 text-center text-sm text-muted-foreground",children:N}),b.map(g=>{let y=g.value===e;return Yo("li",{role:"option","aria-selected":y,children:hc(C,{variant:"ghost",size:"sm",type:"button",...g.disabled!==void 0?{disabled:g.disabled}:{},onClick:()=>{t?.(g.value),u(!1),f("")},className:l("h-auto w-full justify-start gap-2 rounded-sm px-2 py-1.5 font-normal",y&&"bg-accent/50",g.disabled&&"pointer-events-none opacity-50"),children:[Yo("span",{className:"flex-1 truncate",children:g.label}),g.code&&Yo("span",{className:"shrink-0 text-xs text-muted-foreground",children:g.code}),y&&Yo(U,{className:"size-4 shrink-0"})]})},g.value)})]})]})]})}import{jsx as eg,jsxs as Nh}from"react/jsx-runtime";function VD({data:e=[{label:"\u671F\u521D",value:100,absolute:!0},{label:"\u6536\u5165",value:40},{label:"\u6210\u672C",value:-20},{label:"\u7A0E\u8D39",value:-10},{label:"\u671F\u672B",value:110,absolute:!0}],height:t=200,className:a}){let c=0,s=e.map(x=>{let v,N;return x.absolute?(v=0,N=x.value,c=x.value):(v=c,N=c+x.value,c=N),{...x,start:v,end:N,delta:N-v}}),d=Math.max(1,...s.map(x=>Math.max(x.start,x.end))),m=Math.min(0,...s.map(x=>Math.min(x.start,x.end))),u=d-m||1,p=t-40,f=x=>20+(1-(x-m)/u)*p;return eg("div",{"data-slot":"waterfall-chart",className:l("w-full",a),role:"img","aria-label":`\u7011\u5E03\u56FE\uFF0C\u5171 ${e.length} \u6B65`,children:Nh("svg",{viewBox:`0 0 320 ${t}`,width:"100%",height:t,role:"presentation",children:[eg("line",{x1:20,y1:f(0),x2:300,y2:f(0),className:"stroke-muted-foreground/30",strokeWidth:.5}),s.map((x,v)=>{let N=20+v*52,h=f(Math.max(x.start,x.end)),b=Math.max(2,Math.abs(f(x.end)-f(x.start))),g=x.delta>=0,y=x.absolute?"#64748b":g?"#10b981":"#ef4444";return Nh("g",{children:[eg("rect",{x:N,y:h,width:36,height:b,fill:y,rx:3,children:Nh("title",{children:[x.label,": ",x.absolute?q(x.value):`${x.delta>=0?"+":""}${q(x.delta)}`]})}),v<s.length-1&&!x.absolute?eg("line",{x1:N+36,y1:f(x.end),x2:N+36+16,y2:f(x.end),className:"stroke-muted-foreground/40",strokeWidth:1,strokeDasharray:"2 2"}):null,eg("text",{x:N+36/2,y:t-4,textAnchor:"middle",className:"fill-muted-foreground text-[9px]",children:x.label})]},x.label)})]})})}import*as ed from"react";import{jsx as Da,jsxs as Mn}from"react/jsx-runtime";function qb(e,t){return Math.round((t.getTime()-e.getTime())/864e5)}function OD(e,t){let a=new Date(e);return a.setDate(a.getDate()+t),a}function UD(e){let t=e.getDay();return t===0||t===6}function WD(e){let t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate())),a=t.getUTCDay()||7;t.setUTCDate(t.getUTCDate()+4-a);let r=new Date(Date.UTC(t.getUTCFullYear(),0,1));return Math.ceil(((t.getTime()-r.getTime())/864e5+1)/7)}function _D(e,t,a){let{x:r,y:o}=e,{x:n,y:i}=t,c=6;if(a==="FS"){if(n>=r+c){let m=n-c;return`M ${r} ${o} L ${m} ${o} L ${m} ${i} L ${n-4} ${i}`}let d=Math.max(r,n)+c;return`M ${r} ${o} L ${d} ${o} L ${d} ${i} L ${n-4} ${i}`}if(a==="SS"){if(n>=r){let m=r-c;return`M ${r} ${o} L ${m} ${o} L ${m} ${i} L ${n-4} ${i}`}let d=Math.min(r,n)-c;return`M ${r} ${o} L ${d} ${o} L ${d} ${i} L ${n-4} ${i}`}if(a==="FF"){if(n<=r){let m=r+c;return`M ${r} ${o} L ${m} ${o} L ${m} ${i} L ${n+4} ${i}`}let d=Math.max(r,n)+c;return`M ${r} ${o} L ${d} ${o} L ${d} ${i} L ${n+4} ${i}`}let s=(r+n)/2;return`M ${r} ${o} L ${s} ${o} L ${s} ${i} L ${n+4} ${i}`}function Ofe({tasks:e,dependencies:t=[],zoom:a="day",showToday:r=!0,showWeekSeparators:o=!0,showTaskList:n=!0,rowHeight:i=36,onTaskClick:c,className:s}){let d=ed.useMemo(()=>{if(e.length===0){let H=new Date;return H.setHours(0,0,0,0),{start:H,span:7}}let y=e.map(H=>new Date(H.start)),k=e.map(H=>new Date(H.end)),w=Math.min(...y.map(H=>H.getTime())),R=Math.max(...k.map(H=>H.getTime())),S=new Date(w);S.setHours(0,0,0,0);let z=new Date(R);z.setHours(0,0,0,0);let L=Math.max(1,qb(S,z)+1);return{start:S,span:L}},[e]),m=a==="day"?32:a==="week"?14:6,u=n?200:0,p=ed.useMemo(()=>{let y=e.filter(S=>!S.parent),k=[],w=(S,z)=>{let L=e.filter(H=>H.parent===S);for(let H of L)k.push({task:H,depth:z}),w(H.id,z+1)};for(let S of y)k.push({task:S,depth:0}),w(S.id,1);let R=new Set(e.map(S=>S.id));for(let S of e)S.parent&&!R.has(S.parent)&&!y.includes(S)&&k.push({task:S,depth:0});return k},[e]),f=ed.useMemo(()=>{let y=new Map;return p.forEach(({task:k},w)=>{let R=new Date(k.start);R.setHours(0,0,0,0);let S=Math.max(0,qb(d.start,R)),z=k.isMilestone?0:Math.max(1,qb(new Date(k.start),new Date(k.end))+1);y.set(k.id,{startX:u+S*m,endX:u+(S+z)*m,y:w*i+i/2,row:w})}),y},[p,d,m,u,i]),x=ed.useMemo(()=>{let y=new Date;return y.setHours(0,0,0,0),qb(d.start,y)},[d]),v=ed.useMemo(()=>{let y=[];for(let k=0;k<d.span;k++){let w=OD(d.start,k),R=w.getDate()===1,S=w.getDay()===1;y.push({day:k,label:a==="month"?"":String(w.getDate()),...R?{monthLabel:`${w.getMonth()+1}\u6708`}:{},...S?{weekLabel:`W${WD(w)}`}:{},isWeekendDay:UD(w)})}return y},[d,a]),N=d.span*m,h=u+N,b=p.length*i+48,g=ed.useId();return Da("div",{"data-slot":"gantt-chart-pro",className:l("w-full overflow-auto rounded-lg border border-border bg-card",s),role:"figure","aria-label":`Gantt chart with ${e.length} tasks and ${t.length} dependencies`,children:Mn("div",{style:{minWidth:h,position:"relative"},children:[Mn("div",{className:"sticky top-0 z-10 flex border-b border-border bg-muted/50 backdrop-blur",style:{height:48},children:[n&&Da("div",{className:"shrink-0 border-r border-border px-3 py-2",style:{width:u},children:Da("span",{className:"text-xs font-medium text-foreground",children:"Task"})}),Da("div",{className:"flex",style:{width:N},children:v.map(y=>Mn("div",{className:l("shrink-0 border-r border-border/50 text-center",y.isWeekendDay&&"bg-muted/30"),style:{width:m},children:[Mn("div",{className:"h-6 border-b border-border/30",children:[y.monthLabel&&Da("span",{className:"text-[10px] font-semibold text-primary",children:y.monthLabel}),y.weekLabel&&!y.monthLabel&&a!=="day"&&Da("span",{className:"text-[8px] text-muted-foreground",children:y.weekLabel})]}),Da("div",{className:"h-6 flex items-center justify-center",children:y.label&&Da("span",{className:l("text-[10px]",y.isWeekendDay?"text-muted-foreground":"text-foreground"),children:y.label})})]},y.day))})]}),Mn("div",{style:{position:"relative"},children:[o&&v.map(y=>y.weekLabel?Da("div",{className:"absolute top-0 bottom-0 border-l border-border/20",style:{left:u+y.day*m}},`sep-${y.day}`):null),r&&x>=0&&x<d.span&&Da("div",{"data-slot":"gantt-today-marker",className:"absolute top-0 bottom-0 border-l-2 border-red-500/50",style:{left:u+x*m},children:Da("span",{className:"absolute -top-0 -translate-y-full rounded bg-red-500 px-1 text-[9px] text-white",children:"Today"})}),p.length===0?Da("div",{className:"flex items-center justify-center text-sm text-muted-foreground",style:{height:80},children:"No tasks"}):p.map(({task:y,depth:k},w)=>{let R=f.get(y.id);if(!R)return null;let S=Math.min(100,Math.max(0,y.progress??0)),z=y.isMilestone?16:20,L=w*i+(i-z)/2;return Mn("div",{role:"row",className:l("flex items-center border-b border-border/30 hover:bg-muted/20",w%2===1&&"bg-muted/5"),style:{height:i},children:[n&&Mn("div",{className:"shrink-0 truncate border-r border-border px-2 py-1",style:{width:u,paddingLeft:8+k*16},children:[Mn("span",{className:l("text-xs",y.isMilestone&&"font-semibold",y.critical&&"text-destructive"),title:y.name,children:[y.isMilestone&&"\u25C6 ",y.name]}),y.assignee&&Mn("span",{className:"ml-1 text-[10px] text-muted-foreground",children:["(",y.assignee,")"]})]}),Da("div",{className:"relative flex-1",style:{width:N},children:y.isMilestone?Da("button",{type:"button","data-slot":"gantt-milestone",onClick:()=>c?.(y),className:l("absolute rotate-45 border-2",y.critical?"border-destructive bg-destructive/20":"border-primary bg-primary/20"),style:{left:R.startX-z/2,top:L,width:z,height:z},"aria-label":`Milestone: ${y.name}`,title:`${y.name} (${tt(y.start)})`}):Mn("button",{type:"button","data-slot":"gantt-task-bar",onClick:()=>c?.(y),className:l("absolute overflow-hidden rounded-md ring-1 transition-opacity hover:opacity-80",y.critical?"bg-destructive/20 ring-destructive/50":"bg-primary/15 ring-primary/40"),style:{left:R.startX,top:L,width:Math.max(m,R.endX-R.startX),height:z},title:`${y.name}: ${tt(y.start)} \u2192 ${tt(y.end)} (${S}%)`,children:[Da("div",{className:l("h-full rounded-l-md",y.critical?"bg-destructive":"bg-primary"),style:{width:`${S}%`}}),R.endX-R.startX>60&&Mn("span",{className:"absolute inset-0 flex items-center justify-center text-[10px] font-medium text-foreground/80",children:[S,"%"]})]})})]},y.id)}),t.length>0&&p.length>0&&Mn("svg",{"data-slot":"gantt-dependencies",className:"pointer-events-none absolute left-0 top-0",width:h,height:b,style:{zIndex:5},children:[Da("defs",{children:Da("marker",{id:g,markerWidth:"8",markerHeight:"8",refX:"6",refY:"3",orient:"auto",children:Da("path",{d:"M0,0 L6,3 L0,6 Z",fill:"currentColor"})})}),t.map((y,k)=>{let w=f.get(y.from),R=f.get(y.to);if(!w||!R)return null;let S=y.type??"FS",z=y.lag??0,L,H;S==="FS"?(L={x:w.endX+z*m,y:w.y},H={x:R.startX,y:R.y}):S==="SS"?(L={x:w.startX+z*m,y:w.y},H={x:R.startX,y:R.y}):S==="FF"?(L={x:w.endX+z*m,y:w.y},H={x:R.endX,y:R.y}):(L={x:w.startX+z*m,y:w.y},H={x:R.endX,y:R.y});let M=_D(L,H,S),I=e.find(A=>A.id===y.from)?.critical;return Da("path",{d:M,fill:"none",stroke:I?"var(--destructive)":"var(--muted-foreground)",strokeWidth:I?1.5:1,strokeDasharray:I?"0":"3 2",markerEnd:`url(#${g})`,opacity:.7},`dep-${k}`)})]})]})]})})}import*as Bk from"react";import{jsx as Le,jsxs as Bn}from"react/jsx-runtime";function tg(e,t="\xA5"){return e?`${t}${e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`:`${t}0.00`}function qD(){return`je-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}function Xfe({lines:e,onChange:t,accounts:a=[],readOnly:r=!1,currencySymbol:o="\xA5",voucherNo:n,showBalanceStatus:i=!0,className:c}){let s=Bk.useMemo(()=>{let p=e.reduce((x,v)=>x+(Number(v.debit)||0),0),f=e.reduce((x,v)=>x+(Number(v.credit)||0),0);return{debit:p,credit:f,balanced:Math.abs(p-f)<.005,diff:p-f}},[e]),d=()=>{let p={id:qD(),accountCode:"",accountName:"",description:"",debit:0,credit:0};t?.([...e,p])},m=p=>{t?.(e.filter(f=>f.id!==p))},u=(p,f,x)=>{t?.(e.map(v=>{if(v.id!==p)return v;if(f==="debit"||f==="credit"){let N=typeof x=="string"?parseFloat(x)||0:x;return f==="debit"&&N>0?{...v,debit:N,credit:0}:f==="credit"&&N>0?{...v,credit:N,debit:0}:{...v,[f]:N}}if(f==="accountCode"){let N=a.find(h=>h.code===x);return{...v,accountCode:String(x),accountName:N?.name??""}}return{...v,[f]:x}}))};return Bn("div",{"data-slot":"journal-entry-editor",className:l("space-y-3",c),children:[(n||i)&&Bn("div",{className:"flex items-center justify-between gap-4",children:[n&&Bn("span",{className:"text-sm font-medium text-foreground",children:["Voucher: ",n]}),i&&Le("div",{className:"flex items-center gap-2",children:s.balanced&&e.length>0?Bn(B,{variant:"default",className:"gap-1 bg-green-600",children:[Le(qe,{className:"size-3"}),"Balanced"]}):Bn(B,{variant:"destructive",className:"gap-1",children:[Le(wr,{className:"size-3"}),"Unbalanced (",tg(Math.abs(s.diff),o),")"]})})]}),Le("div",{className:"overflow-x-auto rounded-lg border border-border",children:Bn(ze,{children:[Le(Ae,{children:Bn(W,{className:"bg-muted/30",children:[Le(E,{className:"w-10 text-center",children:"#"}),Le(E,{className:"min-w-[140px]",children:"Account Code"}),Le(E,{className:"min-w-[160px]",children:"Account Name"}),Le(E,{className:"min-w-[180px]",children:"Description"}),Le(E,{className:"w-32 text-right",children:"Debit"}),Le(E,{className:"w-32 text-right",children:"Credit"}),!r&&Le(E,{className:"w-12 text-center",children:"Action"})]})}),Le(ke,{children:e.length===0?Le(W,{children:Le(D,{colSpan:r?6:7,className:"py-8 text-center text-muted-foreground",children:'No journal lines. Click "Add Line" to start.'})}):e.map((p,f)=>Bn(W,{"data-slot":"journal-entry-line",children:[Le(D,{className:"text-center text-sm text-muted-foreground",children:f+1}),Le(D,{children:r?Le("span",{className:"text-sm",children:p.accountCode||"\u2014"}):a.length>0?Bn("select",{className:"h-8 w-full rounded border border-input bg-background px-2 text-sm",value:p.accountCode,onChange:x=>u(p.id,"accountCode",x.target.value),"aria-label":"Account code",children:[Le("option",{value:"",children:"Select account"}),a.map(x=>Bn("option",{value:x.code,children:[x.code," \u2014 ",x.name]},x.code))]}):Le(T,{className:"h-8",value:p.accountCode,onChange:x=>u(p.id,"accountCode",x.target.value),placeholder:"Account code","aria-label":"Account code"})}),Le(D,{children:r?Le("span",{className:"text-sm",children:p.accountName||"\u2014"}):Le(T,{className:"h-8",value:p.accountName,onChange:x=>u(p.id,"accountName",x.target.value),placeholder:"Account name","aria-label":"Account name"})}),Le(D,{children:r?Le("span",{className:"text-sm",children:p.description||"\u2014"}):Le(T,{className:"h-8",value:p.description??"",onChange:x=>u(p.id,"description",x.target.value),placeholder:"Memo","aria-label":"Description"})}),Le(D,{className:"text-right",children:r?Le("span",{className:l("text-sm tabular-nums",p.debit>0&&"font-medium text-foreground"),children:p.debit>0?tg(p.debit,o):"\u2014"}):Le(T,{type:"number",className:"h-8 text-right tabular-nums",value:p.debit||"",onChange:x=>u(p.id,"debit",x.target.value),placeholder:"0.00","aria-label":"Debit amount",min:0,step:"0.01"})}),Le(D,{className:"text-right",children:r?Le("span",{className:l("text-sm tabular-nums",p.credit>0&&"font-medium text-foreground"),children:p.credit>0?tg(p.credit,o):"\u2014"}):Le(T,{type:"number",className:"h-8 text-right tabular-nums",value:p.credit||"",onChange:x=>u(p.id,"credit",x.target.value),placeholder:"0.00","aria-label":"Credit amount",min:0,step:"0.01"})}),!r&&Le(D,{className:"text-center",children:Le(C,{variant:"ghost",size:"icon-sm",onClick:()=>m(p.id),className:"text-muted-foreground hover:text-destructive","aria-label":"Remove line",children:Le(ye,{className:"size-4"})})})]},p.id))}),e.length>0&&Le(ke,{children:Bn(W,{className:"border-t-2 bg-muted/50 font-semibold",children:[Le(D,{colSpan:4,className:"text-right text-sm",children:"Totals:"}),Le(D,{className:"text-right text-sm tabular-nums text-foreground","data-slot":"journal-total-debit",children:tg(s.debit,o)}),Le(D,{className:"text-right text-sm tabular-nums text-foreground","data-slot":"journal-total-credit",children:tg(s.credit,o)}),!r&&Le(D,{})]})})]})}),!r&&Le("div",{className:"flex items-center gap-2",children:Bn(C,{variant:"outline",size:"sm",onClick:d,children:[Le(ge,{className:"mr-1 size-4"}),"Add Line"]})})]})}import*as yc from"react";import{jsx as fe,jsxs as qi}from"react/jsx-runtime";function kh(){return`bom-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}function Ch(e,t){return`${t}${e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`}function wh(e){let t=e.quantity*e.unitCost;if(!e.children||e.children.length===0)return t;let a=e.children.reduce((r,o)=>r+wh(o),0);return t+(e.isPhantom?0:a)}function Lk(e){return!e.children||e.children.length===0?0:e.children.reduce((t,a)=>t+1+Lk(a),0)}function zk(e){return{...e,id:kh(),partNumber:`${e.partNumber}-COPY`,children:e.children?.map(zk)??[]}}function Ak(e,t,a){return e.map(r=>r.id===t?a(r):r.children?{...r,children:Ak(r.children,t,a)}:r)}function Ek(e,t){return e.filter(a=>a.id!==t).map(a=>a.children?{...a,children:Ek(a.children,t)}:a)}function Fk(e,t,a){return e.map(r=>r.id===t?{...r,children:[...r.children??[],a]}:r.children?{...r,children:Fk(r.children,t,a)}:r)}function $k(e,t,a=0){let r=[];for(let o of e){let n=!!o.children&&o.children.length>0,i=t.has(o.id);r.push({item:o,depth:a,hasChildren:n,isExpanded:i,totalCost:wh(o),descendantCount:Lk(o)}),n&&i&&r.push(...$k(o.children,t,a+1))}return r}function nbe({items:e,onChange:t,readOnly:a=!1,showCostRollup:r=!0,currencySymbol:o="\xA5",className:n}){let[i,c]=yc.useState(()=>new Set(e.filter(h=>h.children?.length).map(h=>h.id)));yc.useEffect(()=>{c(h=>{let b=new Set(h);for(let g of e)g.children?.length&&b.has(g.id);return b})},[e]);let s=yc.useMemo(()=>$k(e,i),[e,i]),d=yc.useMemo(()=>e.reduce((h,b)=>h+wh(b),0),[e]),m=h=>{c(b=>{let g=new Set(b);return g.has(h)?g.delete(h):g.add(h),g})},u=(h,b,g)=>{t&&t(Ak(e,h,y=>b==="quantity"||b==="unitCost"?{...y,[b]:typeof g=="string"?parseFloat(g)||0:g}:{...y,[b]:g}))},p=h=>{if(!t)return;let b={id:kh(),partNumber:"",partName:"",quantity:1,unit:"pcs",unitCost:0,type:"material"};t(Fk(e,h,b)),c(g=>new Set(g).add(h))},f=()=>{if(!t)return;let h={id:kh(),partNumber:"",partName:"",quantity:1,unit:"pcs",unitCost:0,type:"material"};t([...e,h])},x=h=>{t&&t(Ek(e,h))},v=h=>{if(!t)return;let b=g=>{for(let y of g){if(y.id===h)return[...g,zk(y)];if(y.children){let k=b(y.children);if(k!==y.children)return g.map(w=>w.id===y.id?{...w,children:k}:w)}}return g};t(b(e))},N={material:{label:"Material",variant:"default"},phantom:{label:"Phantom",variant:"outline"},subassembly:{label:"Sub-assembly",variant:"secondary"},service:{label:"Service",variant:"destructive"}};return qi("div",{"data-slot":"bom-tree-editor",className:l("space-y-3",n),children:[fe("div",{className:"overflow-x-auto rounded-lg border border-border",children:qi(ze,{children:[fe(Ae,{children:qi(W,{className:"bg-muted/30",children:[fe(E,{className:"w-10"}),fe(E,{className:"min-w-[120px]",children:"Part Number"}),fe(E,{className:"min-w-[160px]",children:"Part Name"}),fe(E,{className:"w-20 text-right",children:"Qty"}),fe(E,{className:"w-16",children:"Unit"}),fe(E,{className:"w-24 text-right",children:"Unit Cost"}),r&&fe(E,{className:"w-28 text-right",children:"Total Cost"}),fe(E,{className:"w-20",children:"Type"}),fe(E,{className:"min-w-[100px]",children:"Reference"}),!a&&fe(E,{className:"w-24 text-center",children:"Actions"})]})}),fe(ke,{children:s.length===0?fe(W,{children:fe(D,{colSpan:a?9:10,className:"py-8 text-center text-muted-foreground",children:'No BOM items. Click "Add Component" to start.'})}):s.map(h=>{let{item:b,depth:g,hasChildren:y,isExpanded:k,totalCost:w,descendantCount:R}=h,S=b.type??"material";return qi(W,{"data-slot":"bom-tree-row","data-depth":g,className:l(g>0&&"bg-muted/5",b.isPhantom&&"opacity-70"),children:[fe(D,{children:y?fe("button",{type:"button",onClick:()=>m(b.id),className:"inline-flex size-5 items-center justify-center rounded hover:bg-muted","aria-label":k?"Collapse":"Expand",children:k?fe(re,{className:"size-4"}):fe(me,{className:"size-4"})}):fe("span",{className:"inline-flex size-5 items-center justify-center",children:b.isPhantom?fe(cy,{className:"size-3 text-muted-foreground"}):fe(Qr,{className:"size-3 text-muted-foreground"})})}),fe(D,{style:{paddingLeft:8+g*20},children:a?fe("span",{className:"text-sm font-mono",children:b.partNumber||"\u2014"}):fe(T,{className:"h-8 font-mono text-sm",value:b.partNumber,onChange:z=>u(b.id,"partNumber",z.target.value),placeholder:"P-0001","aria-label":"Part number"})}),fe(D,{children:a?fe("span",{className:"text-sm",children:b.partName||"\u2014"}):fe(T,{className:"h-8 text-sm",value:b.partName,onChange:z=>u(b.id,"partName",z.target.value),placeholder:"Component name","aria-label":"Part name"})}),fe(D,{className:"text-right",children:a?fe("span",{className:"text-sm tabular-nums",children:b.quantity}):fe(T,{type:"number",className:"h-8 text-right tabular-nums",value:b.quantity,onChange:z=>u(b.id,"quantity",z.target.value),"aria-label":"Quantity",min:0,step:"0.01"})}),fe(D,{children:a?fe("span",{className:"text-sm",children:b.unit}):fe(T,{className:"h-8 text-sm",value:b.unit,onChange:z=>u(b.id,"unit",z.target.value),"aria-label":"Unit"})}),fe(D,{className:"text-right",children:a?fe("span",{className:"text-sm tabular-nums",children:Ch(b.unitCost,o)}):fe(T,{type:"number",className:"h-8 text-right tabular-nums",value:b.unitCost,onChange:z=>u(b.id,"unitCost",z.target.value),"aria-label":"Unit cost",min:0,step:"0.01"})}),r&&qi(D,{className:"text-right text-sm font-medium tabular-nums","data-slot":"bom-total-cost",children:[Ch(w,o),R>0&&qi("span",{className:"ml-1 text-[10px] text-muted-foreground",children:["(",R," sub)"]})]}),fe(D,{children:fe(B,{variant:N[S].variant,className:"text-[10px]",children:N[S].label})}),fe(D,{children:a?fe("span",{className:"text-sm",children:b.reference||"\u2014"}):fe(T,{className:"h-8 text-sm",value:b.reference??"",onChange:z=>u(b.id,"reference",z.target.value),placeholder:"R1, R2","aria-label":"Reference designator"})}),!a&&fe(D,{className:"text-center",children:qi("div",{className:"flex items-center justify-center gap-0.5",children:[y||b.type==="subassembly"?fe(C,{variant:"ghost",size:"icon-sm",onClick:()=>p(b.id),className:"text-muted-foreground hover:text-foreground","aria-label":"Add child component",title:"Add child",children:fe(ge,{className:"size-3.5"})}):null,fe(C,{variant:"ghost",size:"icon-sm",onClick:()=>v(b.id),className:"text-muted-foreground hover:text-foreground","aria-label":"Duplicate item",title:"Duplicate",children:fe(zt,{className:"size-3.5"})}),fe(C,{variant:"ghost",size:"icon-sm",onClick:()=>x(b.id),className:"text-muted-foreground hover:text-destructive","aria-label":"Remove item",title:"Remove",children:fe(ye,{className:"size-3.5"})})]})})]},b.id)})}),e.length>0&&r&&fe(ke,{children:qi(W,{className:"border-t-2 bg-muted/50 font-semibold",children:[fe(D,{colSpan:r?6:5,className:"text-right text-sm",children:"Grand Total:"}),fe(D,{className:"text-right text-sm tabular-nums text-primary","data-slot":"bom-grand-total",children:Ch(d,o)}),fe(D,{colSpan:a?2:3})]})})]})}),!a&&fe("div",{className:"flex items-center gap-2",children:qi(C,{variant:"outline",size:"sm",onClick:f,children:[fe(ge,{className:"mr-1 size-4"}),"Add Component"]})})]})}import"react";import{Fragment as Hk,jsx as na,jsxs as Oa}from"react/jsx-runtime";function GD(e){let t=e.reduce((r,o)=>r+o.weight,0);if(t===0)return 0;let a=e.reduce((r,o)=>r+o.score*(o.weight/t),0);return Math.round(a*10)/10}function jD(e){return e>=90?{tier:"A",label:"Excellent",color:"text-green-600"}:e>=75?{tier:"B",label:"Good",color:"text-blue-600"}:e>=60?{tier:"C",label:"Fair",color:"text-yellow-600"}:{tier:"D",label:"Poor",color:"text-red-600"}}function KD(e){return e>=90?"bg-green-500":e>=75?"bg-blue-500":e>=60?"bg-yellow-500":"bg-red-500"}function QD(e){return e==="up"?na("span",{className:"text-green-600",children:"\u25B2"}):e==="down"?na("span",{className:"text-red-600",children:"\u25BC"}):e==="stable"?na("span",{className:"text-muted-foreground",children:"\u2014"}):null}function ube({supplier:e,showWeightedTotal:t=!0,showTrends:a=!0,showBars:r=!0,className:o}){let n=GD(e.criteria),i=jD(n),c=e.previousScore!=null?n-e.previousScore:null;return Oa("div",{"data-slot":"supplier-scorecard",className:l("rounded-lg border border-border bg-card p-5",o),children:[Oa("div",{className:"mb-4 flex items-start justify-between gap-4 border-b border-border pb-4",children:[Oa("div",{children:[na("h3",{className:"text-lg font-semibold text-foreground",children:e.name}),Oa("div",{className:"mt-1 flex items-center gap-2 text-sm text-muted-foreground",children:[e.code&&Oa("span",{children:["Code: ",e.code]}),e.category&&Oa(Hk,{children:[na("span",{children:"\u2022"}),na("span",{children:e.category})]}),e.period&&Oa(Hk,{children:[na("span",{children:"\u2022"}),na("span",{children:e.period})]})]})]}),Oa("div",{className:"flex flex-col items-end gap-1",children:[Oa("div",{className:"flex items-center gap-2",children:[na("span",{className:l("text-3xl font-bold tabular-nums",i.color),"data-slot":"supplier-overall-score",children:n.toFixed(1)}),Oa("span",{className:l("text-lg font-bold",i.color),children:["(",i.tier,")"]})]}),na(B,{variant:"outline",className:"text-xs",children:i.label}),c!=null&&Oa("span",{className:l("text-xs",c>0?"text-green-600":c<0?"text-red-600":"text-muted-foreground"),children:[c>0?"+":"",c.toFixed(1)," vs prev"]})]})]}),na("div",{className:"space-y-3",children:e.criteria.map(s=>Oa("div",{"data-slot":"supplier-criterion",children:[Oa("div",{className:"flex items-center justify-between gap-2 text-sm",children:[Oa("div",{className:"flex items-center gap-2",children:[na("span",{className:"font-medium text-foreground",children:s.name}),Oa("span",{className:"text-xs text-muted-foreground",children:["(weight: ",s.weight,"%)"]}),a&&QD(s.trend)]}),Oa("div",{className:"flex items-center gap-2",children:[na("div",{className:"flex",children:Array.from({length:5}).map((d,m)=>na(Tc,{className:l("size-3.5",m<Math.round(s.score/20)?"fill-yellow-400 text-yellow-400":"fill-muted text-muted")},m))}),na("span",{className:"w-12 text-right font-medium tabular-nums text-foreground",children:s.score})]})]}),r&&na("div",{className:"mt-1 h-2 overflow-hidden rounded-full bg-muted",children:na("div",{className:l("h-full rounded-full transition-all",KD(s.score)),style:{width:`${s.score}%`}})}),s.comment&&na("p",{className:"mt-1 text-xs text-muted-foreground",children:s.comment})]},s.id))}),t&&Oa("div",{className:"mt-4 flex items-center justify-between border-t border-border pt-3",children:[na("span",{className:"text-sm font-medium text-foreground",children:"Weighted Total Score"}),Oa("div",{className:"flex items-center gap-2",children:[na("span",{className:"text-2xl font-bold tabular-nums text-primary",children:n.toFixed(1)}),na("span",{className:"text-sm text-muted-foreground",children:"/ 100"})]})]})]})}import*as Ph from"react";import{jsx as Gi,jsxs as Ln}from"react/jsx-runtime";var XD=[{code:"CNY",symbol:"\xA5",name:"Chinese Yuan"},{code:"USD",symbol:"$",name:"US Dollar"},{code:"EUR",symbol:"\u20AC",name:"Euro"},{code:"GBP",symbol:"\xA3",name:"British Pound"},{code:"JPY",symbol:"\xA5",name:"Japanese Yen"},{code:"HKD",symbol:"HK$",name:"Hong Kong Dollar"},{code:"SGD",symbol:"S$",name:"Singapore Dollar"},{code:"AUD",symbol:"A$",name:"Australian Dollar"}];function Vk(e,t){return`${t}${e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`}function Ok(e,t){return e.find(a=>a.code===t)?.symbol??t}function hbe({value:e=0,onChange:t,currencies:a=XD,currency:r="USD",onCurrencyChange:o,baseCurrency:n="CNY",rate:i,onRateChange:c,rates:s={},readOnly:d=!1,allowRateOverride:m=!0,showConversion:u=!0,placeholder:p="0.00",className:f}){let x=Ph.useMemo(()=>i??(r===n?1:s[r]??1),[i,r,n,s]),v=Ph.useMemo(()=>Math.round(e*x*100)/100,[e,x]),N=Ok(a,r),h=Ok(a,n),b=w=>{let R=parseFloat(w)||0;t?.(R,Math.round(R*x*100)/100,r,x)},g=w=>{o?.(w);let R=w===n?1:s[w]??x;t?.(e,Math.round(e*R*100)/100,w,R)},y=w=>{let R=parseFloat(w)||0;c?.(R),t?.(e,Math.round(e*R*100)/100,r,R)},k=r===n;return Ln("div",{"data-slot":"multi-currency-input",className:l("space-y-2",f),children:[Ln("div",{className:"flex items-stretch gap-2",children:[Gi("select",{className:"h-9 shrink-0 rounded-md border border-input bg-background px-2 text-sm font-medium",value:r,onChange:w=>g(w.target.value),disabled:d,"aria-label":"Currency",children:a.map(w=>Ln("option",{value:w.code,children:[w.code," (",w.symbol,")"]},w.code))}),Ln("div",{className:"relative flex-1",children:[Gi("span",{className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground",children:N}),Gi(T,{type:"number",className:"pl-8 text-right tabular-nums",value:e||"",onChange:w=>b(w.target.value),placeholder:p,disabled:d,"aria-label":"Amount",min:0,step:"0.01"})]})]}),u&&!k&&Ln("div",{className:"space-y-1.5",children:[Ln("div",{className:"flex items-center gap-2 text-xs",children:[Gi("span",{className:"text-muted-foreground",children:"Exchange Rate:"}),Ln("span",{className:"text-muted-foreground",children:["1 ",r," ="]}),m&&!d?Gi(T,{type:"number",className:"h-7 w-24 px-2 text-xs tabular-nums",value:x,onChange:w=>y(w.target.value),"aria-label":"Exchange rate",step:"0.0001",min:0}):Ln("span",{className:"font-medium tabular-nums text-foreground",children:[h,x.toFixed(4)]}),Gi("span",{className:"text-muted-foreground",children:n})]}),Ln("div",{className:"flex items-center gap-2 rounded-md border border-border bg-muted/30 px-3 py-1.5","data-slot":"currency-conversion",children:[Ln("span",{className:"text-sm tabular-nums text-muted-foreground",children:[Vk(e,N)," ",r]}),Gi(_a,{className:"size-3.5 text-muted-foreground"}),Ln("span",{className:"text-sm font-semibold tabular-nums text-foreground",children:[Vk(v,h)," ",n]})]})]}),u&&k&&Ln("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[Gi(B,{variant:"outline",className:"text-[10px]",children:"Same currency"}),Gi("span",{children:"No conversion needed"})]})]})}import*as Gb from"react";import{jsx as Xe,jsxs as fo}from"react/jsx-runtime";function Th(e,t){return!e||e===t||e==="string"||e==="number"&&t==="string"||e==="date"&&t==="string"}function Uk(e,t){let a=[],r=new Set;for(let o of t){let n=e.find(c=>c.name.toLowerCase()===o.name.toLowerCase()&&!r.has(c.name));if(n){a.push({source:n.name,target:o.name,autoMatched:!0,typeMatch:Th(n.detectedType,o.type)}),r.add(n.name);continue}let i=e.find(c=>!r.has(c.name)&&(c.name.toLowerCase().includes(o.name.toLowerCase())||o.name.toLowerCase().includes(c.name.toLowerCase())));if(i){a.push({source:i.name,target:o.name,autoMatched:!0,typeMatch:Th(i.detectedType,o.type)}),r.add(i.name);continue}a.push({source:"",target:o.name,autoMatched:!1,typeMatch:!0})}return a}function Rbe({sourceColumns:e,targetFields:t,mappings:a,onMappingsChange:r,showSamples:o=!0,onBack:n,onContinue:i,className:c}){let[s,d]=Gb.useState(()=>a.length>0?a:Uk(e,t)),m=a.length>0?a:s,u=(N,h)=>{let b=e.find(k=>k.name===h),g=t.find(k=>k.name===N),y=m.map(k=>k.target===N?{...k,source:h,autoMatched:!1,typeMatch:b&&g?Th(b.detectedType,g.type):!0}:k);r?r(y):d(y)},p=()=>{let N=Uk(e,t);r?r(N):d(N)},f=Gb.useMemo(()=>{let N=m.filter(y=>y.source).length,h=t.filter(y=>y.required).length,b=m.filter(y=>y.source&&t.find(k=>k.name===y.target)?.required).length,g=m.filter(y=>y.source&&!y.typeMatch).length;return{mapped:N,total:m.length,required:h,requiredMapped:b,typeMismatches:g}},[m,t]),x=f.requiredMapped===f.required&&f.typeMismatches===0,v=new Set(m.filter(N=>N.source).map(N=>N.source));return fo("div",{"data-slot":"import-mapping-wizard",className:l("space-y-4",c),children:[fo("div",{className:"flex flex-wrap items-center gap-3 rounded-lg border border-border bg-muted/30 px-4 py-2",children:[Xe("span",{className:"text-sm font-medium text-foreground",children:"Mapping Summary:"}),fo(B,{variant:"default",className:"text-xs",children:[f.mapped,"/",f.total," mapped"]}),fo(B,{variant:f.requiredMapped===f.required?"default":"destructive",className:"text-xs",children:[f.requiredMapped,"/",f.required," required"]}),f.typeMismatches>0&&fo(B,{variant:"destructive",className:"text-xs",children:[f.typeMismatches," type mismatch"]}),Xe(C,{variant:"outline",size:"sm",onClick:p,className:"ml-auto",children:"Auto-Match"})]}),Xe("div",{className:"overflow-x-auto rounded-lg border border-border",children:fo(ze,{children:[Xe(Ae,{children:fo(W,{className:"bg-muted/30",children:[Xe(E,{className:"min-w-[180px]",children:"Source Column"}),Xe(E,{className:"w-12 text-center",children:"\u2192"}),Xe(E,{className:"min-w-[180px]",children:"Target Field"}),Xe(E,{className:"w-20",children:"Type"}),Xe(E,{className:"w-16",children:"Required"}),Xe(E,{className:"w-16",children:"Status"}),o&&Xe(E,{className:"min-w-[200px]",children:"Sample Data"})]})}),Xe(ke,{children:m.map(N=>{let h=t.find(k=>k.name===N.target),b=e.find(k=>k.name===N.source),g=!N.source,y=N.source&&!N.typeMatch;return fo(W,{"data-slot":"import-mapping-row","data-status":g?"unmapped":y?"mismatch":"mapped",children:[Xe(D,{children:fo("select",{className:"h-8 w-full rounded border border-input bg-background px-2 text-sm",value:N.source,onChange:k=>u(N.target,k.target.value),"aria-label":`Source column for ${N.target}`,children:[Xe("option",{value:"",children:"\u2014 Not mapped \u2014"}),e.map(k=>fo("option",{value:k.name,disabled:v.has(k.name)&&k.name!==N.source,children:[k.name,k.detectedType?` (${k.detectedType})`:""]},k.name))]})}),Xe(D,{className:"text-center",children:Xe(_a,{className:"mx-auto size-4 text-muted-foreground"})}),Xe(D,{children:fo("div",{className:"flex flex-col",children:[Xe("span",{className:"text-sm font-medium text-foreground",children:h?.label??N.target}),Xe("span",{className:"text-xs text-muted-foreground",children:N.target})]})}),Xe(D,{children:Xe(B,{variant:"outline",className:"text-[10px]",children:h?.type??"string"})}),Xe(D,{className:"text-center",children:h?.required?Xe("span",{className:"text-destructive",children:"*"}):Xe("span",{className:"text-muted-foreground",children:"\u2014"})}),Xe(D,{className:"text-center",children:g?h?.required?Xe(wr,{className:"mx-auto size-4 text-destructive"}):Xe("span",{className:"text-muted-foreground",children:"\u2014"}):y?Xe(wr,{className:"mx-auto size-4 text-yellow-500"}):Xe(qe,{className:"mx-auto size-4 text-green-600"})}),o&&Xe(D,{children:b?.samples?Xe("div",{className:"flex flex-col gap-0.5 text-xs text-muted-foreground",children:b.samples.slice(0,3).map((k,w)=>Xe("span",{className:"truncate",children:k},w))}):Xe("span",{className:"text-xs text-muted-foreground",children:"\u2014"})})]},N.target)})})]})}),fo("div",{className:"flex items-center justify-between",children:[fo(C,{variant:"outline",onClick:n,children:[Xe(Yi,{className:"mr-1 size-4"}),"Back"]}),fo(C,{onClick:i,disabled:!x,children:["Continue",Xe(_a,{className:"ml-1 size-4"})]})]})]})}import*as Jm from"react";import{jsx as _e,jsxs as ar}from"react/jsx-runtime";var Wk={create:{label:"Created",variant:"default"},update:{label:"Updated",variant:"secondary"},delete:{label:"Deleted",variant:"destructive"},restore:{label:"Restored",variant:"outline"}};function YD(e){return new Date(e).toLocaleString("en-US",{year:"numeric",month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"})}function Abe({entries:e,showFilter:t=!0,showEntity:a=!0,showUser:r=!0,showTimestamp:o=!0,showReason:n=!1,className:i}){let[c,s]=Jm.useState(""),[d,m]=Jm.useState("all"),u=Jm.useMemo(()=>{let f=e;if(c.trim()){let x=c.toLowerCase();f=f.filter(v=>v.field.toLowerCase().includes(x)||v.fieldLabel?.toLowerCase().includes(x)||v.entityType.toLowerCase().includes(x)||v.entityId.toLowerCase().includes(x)||v.user.toLowerCase().includes(x)||v.oldValue?.toLowerCase().includes(x)||v.newValue?.toLowerCase().includes(x))}return d!=="all"&&(f=f.filter(x=>x.action===d)),f},[e,c,d]),p=Jm.useMemo(()=>{let f={create:0,update:0,delete:0,restore:0};for(let x of e)f[x.action]++;return f},[e]);return ar("div",{"data-slot":"audit-trail-diff",className:l("space-y-3",i),children:[t&&ar("div",{className:"flex flex-wrap items-center gap-2",children:[ar("div",{className:"relative flex-1 min-w-[200px]",children:[_e(X,{className:"absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"}),_e(T,{className:"h-8 pl-8 text-sm",placeholder:"Search fields, entities, users...",value:c,onChange:f=>s(f.target.value),"aria-label":"Search audit trail"})]}),ar("select",{className:"h-8 rounded-md border border-input bg-background px-2 text-sm",value:d,onChange:f=>m(f.target.value),"aria-label":"Filter by action",children:[_e("option",{value:"all",children:"All actions"}),ar("option",{value:"create",children:["Created (",p.create,")"]}),ar("option",{value:"update",children:["Updated (",p.update,")"]}),ar("option",{value:"delete",children:["Deleted (",p.delete,")"]}),ar("option",{value:"restore",children:["Restored (",p.restore,")"]})]})]}),_e("div",{className:"overflow-x-auto rounded-lg border border-border",children:ar(ze,{children:[_e(Ae,{children:ar(W,{className:"bg-muted/30",children:[_e(E,{className:"w-20",children:"Action"}),a&&_e(E,{className:"min-w-[140px]",children:"Entity"}),_e(E,{className:"min-w-[120px]",children:"Field"}),_e(E,{className:"min-w-[140px]",children:"Old Value"}),_e(E,{className:"w-8 text-center",children:"\u2192"}),_e(E,{className:"min-w-[140px]",children:"New Value"}),r&&_e(E,{className:"min-w-[100px]",children:"User"}),o&&_e(E,{className:"min-w-[140px]",children:"Time"}),n&&_e(E,{className:"min-w-[120px]",children:"Reason"})]})}),_e(ke,{children:u.length===0?_e(W,{children:_e(D,{colSpan:8+(n?1:0),className:"py-8 text-center text-muted-foreground",children:"No audit entries found"})}):u.map(f=>ar(W,{"data-slot":"audit-trail-entry","data-action":f.action,className:l(f.action==="delete"&&"bg-red-50 dark:bg-red-950/10",f.action==="create"&&"bg-green-50 dark:bg-green-950/10"),children:[_e(D,{children:_e(B,{variant:Wk[f.action].variant,className:"text-[10px]",children:Wk[f.action].label})}),a&&_e(D,{children:ar("div",{className:"flex flex-col",children:[_e("span",{className:"text-sm font-medium text-foreground",children:f.entityType}),_e("span",{className:"text-xs text-muted-foreground",children:f.entityId})]})}),ar(D,{children:[_e("span",{className:"text-sm text-foreground",children:f.fieldLabel??f.field}),f.section&&ar("span",{className:"ml-1 text-xs text-muted-foreground",children:["(",f.section,")"]})]}),_e(D,{children:f.action==="create"?_e("span",{className:"text-xs text-muted-foreground",children:"\u2014"}):_e("span",{className:l("text-sm tabular-nums",f.action==="delete"?"line-through text-muted-foreground":"text-muted-foreground line-through decoration-red-500/50"),children:f.oldValue||"(empty)"})}),_e(D,{className:"text-center",children:_e(_a,{className:"mx-auto size-3.5 text-muted-foreground"})}),_e(D,{children:f.action==="delete"?_e("span",{className:"text-xs text-muted-foreground",children:"\u2014"}):_e("span",{className:l("text-sm font-medium tabular-nums text-foreground",f.action==="create"&&"text-green-600"),children:f.newValue||"(empty)"})}),r&&_e(D,{children:ar("div",{className:"flex items-center gap-1",children:[_e(js,{className:"size-3 text-muted-foreground"}),_e("span",{className:"text-sm text-foreground",children:f.user})]})}),o&&_e(D,{children:ar("div",{className:"flex items-center gap-1",children:[_e(pe,{className:"size-3 text-muted-foreground"}),_e("span",{className:"text-xs text-muted-foreground",children:YD(f.timestamp)})]})}),n&&_e(D,{children:_e("span",{className:"text-xs text-muted-foreground",children:f.reason||"\u2014"})})]},f.id))})]})}),ar("div",{className:"text-xs text-muted-foreground",children:["Showing ",u.length," of ",e.length," entries"]})]})}import"react";import{jsx as Fe,jsxs as sa}from"react/jsx-runtime";var JD={eq:"equals",neq:"not equals",gt:"greater than",gte:"\u2265",lt:"less than",lte:"\u2264",contains:"contains",in:"in"},_k={email:{label:"Email",icon:Pc,color:"text-blue-600"},sms:{label:"SMS",icon:el,color:"text-green-600"},inApp:{label:"In-App",icon:xo,color:"text-purple-600"},webhook:{label:"Webhook",icon:dy,color:"text-orange-600"}},ZD=[{value:"order.created",label:"Order Created",group:"Sales"},{value:"order.updated",label:"Order Updated",group:"Sales"},{value:"invoice.overdue",label:"Invoice Overdue",group:"Finance"},{value:"payment.received",label:"Payment Received",group:"Finance"},{value:"stock.low",label:"Low Stock Alert",group:"Inventory"},{value:"approval.required",label:"Approval Required",group:"Workflow"},{value:"task.assigned",label:"Task Assigned",group:"Workflow"}],eM=[{value:"amount",label:"Amount",type:"number"},{value:"status",label:"Status",type:"enum"},{value:"department",label:"Department",type:"string"},{value:"priority",label:"Priority",type:"enum"},{value:"createdDate",label:"Created Date",type:"date"},{value:"dueDate",label:"Due Date",type:"date"}];function qk(){return`nr-${Date.now()}-${Math.random().toString(36).slice(2,6)}`}function _be({rule:e,onChange:t,events:a=ZD,fields:r=eM,recipientOptions:o=[],templates:n=[],readOnly:i=!1,className:c}){let s=N=>{t&&t({...e,...N})},d=()=>{s({conditions:[...e.conditions,{id:qk(),field:r[0]?.value??"",operator:"eq",value:""}]})},m=N=>{s({conditions:e.conditions.filter(h=>h.id!==N)})},u=(N,h,b)=>{s({conditions:e.conditions.map(g=>g.id===N?{...g,[h]:b}:g)})},p=()=>{if(o.length===0)return;let N=o[0];s({recipients:[...e.recipients,{id:qk(),type:N.type,target:N.value}]})},f=N=>{s({recipients:e.recipients.filter(h=>h.id!==N)})},x=(N,h,b)=>{s({recipients:e.recipients.map(g=>g.id===N?{...g,[h]:b}:g)})},v=N=>{let h=e.channels.includes(N);s({channels:h?e.channels.filter(b=>b!==N):[...e.channels,N]})};return sa("div",{"data-slot":"notification-rule-builder",className:l("space-y-5 rounded-lg border border-border bg-card p-5",c),children:[sa("div",{className:"flex items-center justify-between gap-4 border-b border-border pb-4",children:[Fe("div",{className:"flex-1",children:i?Fe("span",{className:"text-lg font-semibold text-foreground",children:e.name}):Fe(T,{className:"h-9 text-lg font-semibold",value:e.name,onChange:N=>s({name:N.target.value}),placeholder:"Rule name","aria-label":"Rule name"})}),sa("div",{className:"flex items-center gap-2",children:[Fe("span",{className:"text-sm text-muted-foreground",children:"Enabled"}),Fe($n,{checked:e.enabled,onCheckedChange:N=>s({enabled:N}),disabled:i,"aria-label":"Enable rule"})]})]}),sa("div",{"data-slot":"rule-event-section",children:[Fe("label",{className:"mb-1.5 block text-sm font-medium text-foreground",children:"When event fires:"}),Fe("select",{className:"h-9 w-full rounded-md border border-input bg-background px-3 text-sm",value:e.event,onChange:N=>s({event:N.target.value}),disabled:i,"aria-label":"Event trigger",children:a.map(N=>sa("option",{value:N.value,children:[N.group?`${N.group}: `:"",N.label]},N.value))})]}),sa("div",{"data-slot":"rule-conditions-section",children:[sa("div",{className:"mb-2 flex items-center justify-between",children:[Fe("label",{className:"text-sm font-medium text-foreground",children:"Conditions (all must match):"}),!i&&sa(C,{variant:"outline",size:"sm",onClick:d,children:[Fe(ge,{className:"mr-1 size-3.5"}),"Add"]})]}),Fe("div",{className:"space-y-2",children:e.conditions.length===0?Fe("p",{className:"text-sm text-muted-foreground",children:"No conditions \u2014 notify on every event occurrence."}):e.conditions.map(N=>sa("div",{"data-slot":"rule-condition",className:"flex items-center gap-2",children:[Fe("select",{className:"h-8 flex-1 rounded border border-input bg-background px-2 text-sm",value:N.field,onChange:h=>u(N.id,"field",h.target.value),disabled:i,"aria-label":"Condition field",children:r.map(h=>Fe("option",{value:h.value,children:h.label},h.value))}),Fe("select",{className:"h-8 w-32 rounded border border-input bg-background px-2 text-sm",value:N.operator,onChange:h=>u(N.id,"operator",h.target.value),disabled:i,"aria-label":"Condition operator",children:Object.entries(JD).map(([h,b])=>Fe("option",{value:h,children:b},h))}),Fe(T,{className:"h-8 flex-1 text-sm",value:N.value,onChange:h=>u(N.id,"value",h.target.value),placeholder:"Value",disabled:i,"aria-label":"Condition value"}),!i&&Fe(C,{variant:"ghost",size:"icon-sm",onClick:()=>m(N.id),className:"text-muted-foreground hover:text-destructive","aria-label":"Remove condition",children:Fe(ye,{className:"size-4"})})]},N.id))})]}),sa("div",{"data-slot":"rule-recipients-section",children:[sa("div",{className:"mb-2 flex items-center justify-between",children:[Fe("label",{className:"text-sm font-medium text-foreground",children:"Notify who:"}),!i&&o.length>0&&sa(C,{variant:"outline",size:"sm",onClick:p,children:[Fe(ge,{className:"mr-1 size-3.5"}),"Add"]})]}),Fe("div",{className:"space-y-2",children:e.recipients.length===0?Fe("p",{className:"text-sm text-muted-foreground",children:"No recipients configured."}):e.recipients.map(N=>sa("div",{"data-slot":"rule-recipient",className:"flex items-center gap-2",children:[sa("select",{className:"h-8 w-24 rounded border border-input bg-background px-2 text-sm",value:N.type,onChange:h=>x(N.id,"type",h.target.value),disabled:i,"aria-label":"Recipient type",children:[Fe("option",{value:"user",children:"User"}),Fe("option",{value:"role",children:"Role"}),Fe("option",{value:"group",children:"Group"}),Fe("option",{value:"field",children:"Field"})]}),Fe("select",{className:"h-8 flex-1 rounded border border-input bg-background px-2 text-sm",value:N.target,onChange:h=>x(N.id,"target",h.target.value),disabled:i,"aria-label":"Recipient target",children:o.filter(h=>h.type===N.type).map(h=>Fe("option",{value:h.value,children:h.label},h.value))}),!i&&Fe(C,{variant:"ghost",size:"icon-sm",onClick:()=>f(N.id),className:"text-muted-foreground hover:text-destructive","aria-label":"Remove recipient",children:Fe(ye,{className:"size-4"})})]},N.id))})]}),sa("div",{"data-slot":"rule-channels-section",children:[Fe("label",{className:"mb-2 block text-sm font-medium text-foreground",children:"Delivery channels:"}),Fe("div",{className:"flex flex-wrap gap-2",children:Object.keys(_k).map(N=>{let h=_k[N],b=h.icon,g=e.channels.includes(N);return sa("button",{type:"button","data-slot":"rule-channel","data-active":g,onClick:()=>!i&&v(N),disabled:i,className:l("flex items-center gap-1.5 rounded-md border px-3 py-1.5 text-sm transition-colors",g?"border-primary bg-primary/10 text-primary":"border-border bg-background text-muted-foreground hover:bg-muted"),"aria-pressed":g,children:[Fe(b,{className:l("size-4",g&&h.color)}),h.label]},N)})})]}),(n.length>0||e.priority)&&sa("div",{className:"flex flex-wrap gap-4",children:[n.length>0&&sa("div",{className:"flex-1",children:[Fe("label",{className:"mb-1.5 block text-sm font-medium text-foreground",children:"Template:"}),sa("select",{className:"h-9 w-full rounded-md border border-input bg-background px-3 text-sm",value:e.templateId??"",onChange:N=>s({templateId:N.target.value}),disabled:i,"aria-label":"Message template",children:[Fe("option",{value:"",children:"Default template"}),n.map(N=>Fe("option",{value:N.id,children:N.name},N.id))]})]}),sa("div",{children:[Fe("label",{className:"mb-1.5 block text-sm font-medium text-foreground",children:"Priority:"}),sa("select",{className:"h-9 w-32 rounded-md border border-input bg-background px-3 text-sm",value:e.priority??"normal",onChange:N=>{N.target.value&&s({priority:N.target.value})},disabled:i,"aria-label":"Priority",children:[Fe("option",{value:"low",children:"Low"}),Fe("option",{value:"normal",children:"Normal"}),Fe("option",{value:"high",children:"High"}),Fe("option",{value:"urgent",children:"Urgent"})]})]})]})]})}import*as jb from"react";import{jsx as Bt,jsxs as fa}from"react/jsx-runtime";function tM(e,t){if(!e||!t)return 0;let a=new Date(e),r=new Date(t);return Math.round((r.getTime()-a.getTime())/864e5)+1}function aM(e){if(!e)return!1;let a=new Date(e).getDay();return a===0||a===6}function rM(e,t){let a=[],r=new Date(e,t,1),o=new Date(e,t+1,0),n=r.getDay();for(let i=0;i<n;i++)a.push({date:"",day:0,isWeekend:!1});for(let i=1;i<=o.getDate();i++){let c=`${e}-${String(t+1).padStart(2,"0")}-${String(i).padStart(2,"0")}`;a.push({date:c,day:i,isWeekend:aM(c)})}return a}function Jbe({leaveType:e="annual",onLeaveTypeChange:t,startDate:a="",endDate:r="",onDateChange:o,balances:n,approvers:i,reason:c="",onReasonChange:s,onSubmit:d,onCancel:m,readOnly:u=!1,className:p}){let f=tM(a,r),x=n.find(w=>w.type===e),v=a?new Date(a):new Date,N=v.getFullYear(),h=v.getMonth(),b=jb.useMemo(()=>rM(N,h),[N,h]),g=new Date(N,h,1).toLocaleString("en-US",{month:"long",year:"numeric"}),y=w=>!w||!a||!r?!1:w>=a&&w<=r,k=x?x.total-x.used<f:!1;return fa("div",{"data-slot":"leave-request-form",className:l("space-y-5 rounded-lg border border-border bg-card p-5",p),children:[fa("div",{children:[Bt("label",{className:"mb-1.5 block text-sm font-medium text-foreground",children:"Leave Type"}),Bt("div",{className:"flex flex-wrap gap-2",children:n.map(w=>Bt("button",{type:"button","data-slot":"leave-type-option","data-active":e===w.type,onClick:()=>!u&&t?.(w.type),disabled:u,className:l("rounded-md border px-3 py-1.5 text-sm transition-colors",e===w.type?"border-primary bg-primary/10 text-primary":"border-border bg-background text-muted-foreground hover:bg-muted"),children:w.label},w.type))})]}),x&&fa("div",{"data-slot":"leave-balance",className:"flex items-center gap-3 rounded-md border border-border bg-muted/30 px-4 py-2",children:[Bt("span",{className:"text-sm text-muted-foreground",children:"Available balance:"}),fa(B,{variant:k?"destructive":"default",className:"text-xs",children:[x.total-x.used," / ",x.total," ",x.unit]}),k&&f>0&&fa("span",{className:"text-xs text-destructive",children:["Insufficient balance for ",f," ",x.unit]})]}),fa("div",{className:"grid grid-cols-2 gap-3",children:[fa("div",{children:[Bt("label",{className:"mb-1.5 block text-sm font-medium text-foreground",children:"Start Date"}),fa("div",{className:"relative",children:[Bt(jr,{className:"absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"}),Bt(T,{type:"date",className:"pl-8",value:a,onChange:w=>o?.(w.target.value,r),disabled:u,"aria-label":"Start date"})]})]}),fa("div",{children:[Bt("label",{className:"mb-1.5 block text-sm font-medium text-foreground",children:"End Date"}),fa("div",{className:"relative",children:[Bt(jr,{className:"absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"}),Bt(T,{type:"date",className:"pl-8",value:r,onChange:w=>o?.(a,w.target.value),disabled:u,"aria-label":"End date"})]})]})]}),f>0&&fa("div",{className:"flex items-center gap-2 text-sm",children:[Bt(pe,{className:"size-4 text-muted-foreground"}),fa("span",{className:"text-foreground",children:["Duration: ",Bt("strong",{children:f})," day",f>1?"s":""]})]}),fa("div",{"data-slot":"leave-calendar-preview",children:[Bt("div",{className:"mb-2 text-sm font-medium text-foreground",children:g}),fa("div",{className:"grid grid-cols-7 gap-1",children:[["S","M","T","W","T","F","S"].map((w,R)=>Bt("div",{className:"text-center text-[10px] font-medium text-muted-foreground",children:w},R)),b.map((w,R)=>Bt("div",{className:l("flex h-7 items-center justify-center rounded text-xs",!w.date&&"opacity-0",w.isWeekend&&w.date&&!y(w.date)&&"bg-muted/50 text-muted-foreground",y(w.date)&&"bg-primary text-primary-foreground font-medium"),children:w.day||""},R))]})]}),fa("div",{children:[Bt("label",{className:"mb-1.5 block text-sm font-medium text-foreground",children:"Reason"}),Bt("textarea",{className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",rows:3,value:c,onChange:w=>s?.(w.target.value),placeholder:"Please provide a reason for your leave request...",disabled:u,"aria-label":"Leave reason"})]}),i.length>0&&fa("div",{children:[Bt("label",{className:"mb-2 block text-sm font-medium text-foreground",children:"Approval Chain"}),Bt("div",{className:"flex items-center gap-2",children:i.map((w,R)=>fa(jb.Fragment,{children:[fa("div",{className:"flex items-center gap-2 rounded-md border border-border bg-muted/30 px-3 py-1.5",children:[Bt("div",{className:"flex size-7 items-center justify-center rounded-full bg-primary/10 text-xs font-medium text-primary",children:w.name.charAt(0)}),fa("div",{children:[Bt("div",{className:"text-sm font-medium text-foreground",children:w.name}),w.title&&Bt("div",{className:"text-xs text-muted-foreground",children:w.title})]})]}),R<i.length-1&&Bt("span",{className:"text-muted-foreground",children:"\u2192"})]},w.id))})]}),!u&&fa("div",{className:"flex items-center justify-end gap-2 border-t border-border pt-4",children:[m&&Bt(C,{variant:"outline",onClick:m,children:"Cancel"}),d&&Bt(C,{onClick:d,disabled:k&&f>0,children:"Submit Request"})]})]})}import{jsx as dt,jsxs as ba}from"react/jsx-runtime";var Rh=["08:00","08:30","09:00","09:30","10:00","10:30","11:00","11:30","12:00","12:30","13:00","13:30","14:00","14:30","15:00","15:30","16:00","16:30","17:00","17:30","18:00","18:30"];function oM(e,t,a,r,o){return o.find(n=>n.roomId===e&&n.date===t&&!(n.endTime<=a||n.startTime>=r))??null}function sxe({rooms:e,existingBookings:t=[],selectedRoom:a="",onRoomChange:r,date:o="",onDateChange:n,startTime:i="09:00",endTime:c="10:00",onTimeChange:s,title:d="",onTitleChange:m,attendeeCount:u=1,onAttendeeCountChange:p,onBook:f,readOnly:x=!1,className:v}){let N=oM(a,o,i,c,t),h=e.find(k=>k.id===a),b=h&&u>h.capacity,g=t.filter(k=>k.roomId===a&&k.date===o),y=k=>g.some(w=>k>=w.startTime&&k<w.endTime);return ba("div",{"data-slot":"meeting-room-booking",className:l("space-y-4 rounded-lg border border-border bg-card p-5",v),children:[ba("div",{children:[dt("label",{className:"mb-1.5 block text-sm font-medium text-foreground",children:"Meeting Title"}),dt(T,{value:d,onChange:k=>m?.(k.target.value),placeholder:"Quarterly Review",disabled:x,"aria-label":"Meeting title"})]}),ba("div",{children:[dt("label",{className:"mb-1.5 block text-sm font-medium text-foreground",children:"Date"}),dt(T,{type:"date",value:o,onChange:k=>n?.(k.target.value),disabled:x,"aria-label":"Booking date"})]}),ba("div",{children:[dt("label",{className:"mb-1.5 block text-sm font-medium text-foreground",children:"Select Room"}),dt("div",{className:"grid grid-cols-2 gap-2",children:e.map(k=>ba("button",{type:"button","data-slot":"room-option","data-active":a===k.id,onClick:()=>!x&&r?.(k.id),disabled:x,className:l("flex flex-col items-start rounded-md border p-3 text-left transition-colors",a===k.id?"border-primary bg-primary/5":"border-border bg-background hover:bg-muted"),children:[dt("span",{className:"text-sm font-medium text-foreground",children:k.name}),ba("div",{className:"mt-1 flex items-center gap-2 text-xs text-muted-foreground",children:[ba("span",{className:"flex items-center gap-1",children:[dt(al,{className:"size-3"}),k.capacity]}),k.floor&&ba("span",{children:["\u2022 ",k.floor]})]}),k.equipment&&k.equipment.length>0&&dt("div",{className:"mt-1 flex flex-wrap gap-1",children:k.equipment.map(w=>dt(B,{variant:"outline",className:"text-[9px]",children:w},w))})]},k.id))})]}),ba("div",{children:[dt("label",{className:"mb-1.5 block text-sm font-medium text-foreground",children:"Time Slot"}),ba("div",{className:"flex items-center gap-2",children:[dt("select",{className:"h-9 flex-1 rounded-md border border-input bg-background px-3 text-sm",value:i,onChange:k=>s?.(k.target.value,c),disabled:x,"aria-label":"Start time",children:Rh.map(k=>dt("option",{value:k,children:k},k))}),dt("span",{className:"text-muted-foreground",children:"to"}),dt("select",{className:"h-9 flex-1 rounded-md border border-input bg-background px-3 text-sm",value:c,onChange:k=>s?.(i,k.target.value),disabled:x,"aria-label":"End time",children:Rh.map(k=>dt("option",{value:k,children:k},k))})]})]}),ba("div",{children:[dt("label",{className:"mb-1.5 block text-sm font-medium text-foreground",children:"Attendees"}),dt(T,{type:"number",min:1,value:u,onChange:k=>p?.(parseInt(k.target.value)||1),disabled:x,"aria-label":"Attendee count"}),b&&ba("p",{className:"mt-1 flex items-center gap-1 text-xs text-destructive",children:[dt(wr,{className:"size-3"}),"Exceeds room capacity (",h?.capacity,")"]})]}),N&&ba("div",{"data-slot":"booking-conflict",className:"flex items-start gap-2 rounded-md border border-destructive/30 bg-destructive/5 px-3 py-2",children:[dt(wr,{className:"mt-0.5 size-4 text-destructive"}),ba("div",{className:"text-sm",children:[dt("p",{className:"font-medium text-destructive",children:"Time Conflict"}),ba("p",{className:"text-xs text-muted-foreground",children:["Room is booked by ",N.bookedBy," (",N.title,") from ",N.startTime," to ",N.endTime]})]})]}),a&&o&&g.length>0&&ba("div",{"data-slot":"room-schedule",children:[dt("div",{className:"mb-1.5 text-sm font-medium text-foreground",children:"Today's Schedule"}),dt("div",{className:"space-y-1",children:g.map(k=>ba("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[dt(pe,{className:"size-3"}),ba("span",{children:[k.startTime," - ",k.endTime]}),dt("span",{className:"text-foreground",children:k.title}),ba("span",{children:["(",k.bookedBy,")"]})]},k.id))})]}),a&&o&&ba("div",{"data-slot":"slot-grid",children:[dt("div",{className:"mb-1.5 text-sm font-medium text-foreground",children:"Availability"}),dt("div",{className:"grid grid-cols-6 gap-1",children:Rh.map(k=>dt("div",{className:l("rounded px-1 py-0.5 text-center text-[9px]",y(k)?"bg-destructive/20 text-destructive":"bg-green-100 text-green-700 dark:bg-green-950/20 dark:text-green-400"),children:k},k))})]}),!x&&f&&dt(C,{className:"w-full",onClick:f,disabled:!!N||!a||!o,children:"Book Room"})]})}import*as Nc from"react";import{jsx as Jo,jsxs as ji}from"react/jsx-runtime";var Kb={present:{label:"Present",bg:"bg-green-100 dark:bg-green-950/30",text:"text-green-700 dark:text-green-400",dot:"bg-green-500"},absent:{label:"Absent",bg:"bg-red-100 dark:bg-red-950/30",text:"text-red-700 dark:text-red-400",dot:"bg-red-500"},late:{label:"Late",bg:"bg-yellow-100 dark:bg-yellow-950/30",text:"text-yellow-700 dark:text-yellow-400",dot:"bg-yellow-500"},leave:{label:"Leave",bg:"bg-blue-100 dark:bg-blue-950/30",text:"text-blue-700 dark:text-blue-400",dot:"bg-blue-500"},holiday:{label:"Holiday",bg:"bg-purple-100 dark:bg-purple-950/30",text:"text-purple-700 dark:text-purple-400",dot:"bg-purple-500"},weekend:{label:"Weekend",bg:"bg-muted/50",text:"text-muted-foreground",dot:"bg-muted-foreground"}};function nM(e,t){let a=new Date(e,t,1),r=new Date(e,t+1,0),o=a.getDay(),n=[];for(let i=0;i<o;i++)n.push({date:null,day:0});for(let i=1;i<=r.getDate();i++){let c=`${e}-${String(t+1).padStart(2,"0")}-${String(i).padStart(2,"0")}`;n.push({date:c,day:i})}return n}function mxe({year:e,month:t,records:a,onMonthChange:r,onDayClick:o,className:n}){let i=new Date,[c,s]=Nc.useState(e??i.getFullYear()),[d,m]=Nc.useState(t??i.getMonth()),u=Nc.useMemo(()=>{let h=new Map;for(let b of a)h.set(b.date,b);return h},[a]),p=Nc.useMemo(()=>nM(c,d),[c,d]),f=new Date(c,d,1).toLocaleString("en-US",{month:"long",year:"numeric"}),x=Nc.useMemo(()=>{let h={present:0,absent:0,late:0,leave:0,holiday:0,weekend:0};for(let b of a)new Date(b.date).getMonth()===d&&new Date(b.date).getFullYear()===c&&h[b.status]++;return h},[a,d,c]),v=()=>{let h=d-1;h<0?(s(c-1),m(11),r?.(c-1,11)):(m(h),r?.(c,h))},N=()=>{let h=d+1;h>11?(s(c+1),m(0),r?.(c+1,0)):(m(h),r?.(c,h))};return ji("div",{"data-slot":"attendance-calendar",className:l("rounded-lg border border-border bg-card p-4",n),children:[ji("div",{className:"mb-3 flex items-center justify-between",children:[Jo("h3",{className:"text-lg font-semibold text-foreground",children:f}),ji("div",{className:"flex items-center gap-1",children:[Jo("button",{type:"button",onClick:v,className:"rounded p-1 hover:bg-muted","aria-label":"Previous month",children:Jo(et,{className:"size-4"})}),Jo("button",{type:"button",onClick:N,className:"rounded p-1 hover:bg-muted","aria-label":"Next month",children:Jo(me,{className:"size-4"})})]})]}),Jo("div",{className:"mb-3 flex flex-wrap gap-2",children:Object.keys(Kb).map(h=>x[h]===0&&h!=="weekend"?null:ji("div",{className:"flex items-center gap-1 text-xs",children:[Jo("span",{className:l("size-2 rounded-full",Kb[h].dot)}),Jo("span",{className:"text-muted-foreground",children:Kb[h].label}),Jo("span",{className:"font-medium text-foreground",children:x[h]})]},h))}),ji("div",{className:"grid grid-cols-7 gap-1",children:[["Sun","Mon","Tue","Wed","Thu","Fri","Sat"].map(h=>Jo("div",{className:"text-center text-[10px] font-medium text-muted-foreground pb-1",children:h},h)),p.map((h,b)=>{if(!h.date)return Jo("div",{className:"h-16"},b);let g=u.get(h.date),y=new Date(h.date).getDay(),k=y===0||y===6,w=g?.status??(k?"weekend":"absent"),R=Kb[w];return ji("button",{type:"button","data-slot":"attendance-day","data-status":w,onClick:()=>g&&o?.(g),className:l("flex h-16 flex-col items-start rounded-md border p-1 text-left transition-colors",R.bg,g?"cursor-pointer hover:ring-1 hover:ring-primary":"cursor-default"),children:[Jo("span",{className:l("text-xs font-medium",R.text),children:h.day}),g&&ji("div",{className:"mt-0.5 flex-1 text-[9px]",children:[g.checkIn&&ji("div",{className:R.text,children:["In: ",g.checkIn]}),g.checkOut&&ji("div",{className:R.text,children:["Out: ",g.checkOut]}),g.note&&Jo("div",{className:l("truncate",R.text),children:g.note})]})]},b)})]})]})}import*as Xb from"react";import{jsx as ne,jsxs as Ua}from"react/jsx-runtime";function sM(){return`po-line-${Date.now()}-${Math.random().toString(36).slice(2,6)}`}function Qb(e,t="\xA5"){return`${t}${e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`}function iM({poNumber:e,vendor:t,onVendorChange:a,orderDate:r,expectedDelivery:o,paymentTerms:n,onHeaderChange:i,lineItems:c,onLineItemsChange:s,approvalSteps:d=[],status:m="draft",currencySymbol:u="\xA5",readOnly:p=!1,onSubmit:f,className:x}){let v=Xb.useMemo(()=>{let y=c.reduce((w,R)=>w+R.quantity*R.unitPrice,0),k=c.reduce((w,R)=>w+R.quantity*R.unitPrice*(R.taxRate/100),0);return{subtotal:y,tax:k,total:y+k}},[c]),N=()=>{s?.([...c,{id:sM(),productCode:"",productName:"",quantity:1,unit:"pcs",unitPrice:0,taxRate:13}])},h=y=>s?.(c.filter(k=>k.id!==y)),b=(y,k,w)=>{s?.(c.map(R=>R.id===y?{...R,[k]:(k==="quantity"||k==="unitPrice"||k==="taxRate")&&typeof w=="string"?parseFloat(w)||0:w}:R))},g={draft:{label:"Draft",variant:"outline"},pending:{label:"Pending Approval",variant:"secondary"},approved:{label:"Approved",variant:"default"},rejected:{label:"Rejected",variant:"destructive"},completed:{label:"Completed",variant:"default"}};return Ua("div",{"data-slot":"purchase-order-editor",className:l("space-y-4",x),children:[ne("div",{className:"flex items-center justify-between rounded-lg border border-border bg-card p-4",children:Ua("div",{className:"flex items-center gap-3",children:[ne("h3",{className:"text-lg font-semibold text-foreground",children:"Purchase Order"}),e&&ne(B,{variant:"outline",className:"font-mono text-xs",children:e}),ne(B,{variant:g[m].variant,children:g[m].label})]})}),Ua("div",{className:"grid grid-cols-2 gap-3 rounded-lg border border-border bg-card p-4 md:grid-cols-4",children:[Ua("div",{children:[ne("label",{className:"mb-1 block text-xs font-medium text-muted-foreground",children:"Vendor"}),ne(T,{value:t??"",onChange:y=>a?.(y.target.value),disabled:p,placeholder:"Vendor name","aria-label":"Vendor"})]}),Ua("div",{children:[ne("label",{className:"mb-1 block text-xs font-medium text-muted-foreground",children:"Order Date"}),ne(T,{type:"date",value:r??"",onChange:y=>i?.("orderDate",y.target.value),disabled:p,"aria-label":"Order date"})]}),Ua("div",{children:[ne("label",{className:"mb-1 block text-xs font-medium text-muted-foreground",children:"Expected Delivery"}),ne(T,{type:"date",value:o??"",onChange:y=>i?.("expectedDelivery",y.target.value),disabled:p,"aria-label":"Expected delivery"})]}),Ua("div",{children:[ne("label",{className:"mb-1 block text-xs font-medium text-muted-foreground",children:"Payment Terms"}),ne(T,{value:n??"",onChange:y=>i?.("paymentTerms",y.target.value),disabled:p,placeholder:"Net 30","aria-label":"Payment terms"})]})]}),ne("div",{className:"overflow-x-auto rounded-lg border border-border",children:Ua(ze,{children:[ne(Ae,{children:Ua(W,{className:"bg-muted/30",children:[ne(E,{className:"min-w-[120px]",children:"Product Code"}),ne(E,{className:"min-w-[160px]",children:"Product Name"}),ne(E,{className:"w-20 text-right",children:"Qty"}),ne(E,{className:"w-16",children:"Unit"}),ne(E,{className:"w-28 text-right",children:"Unit Price"}),ne(E,{className:"w-20 text-right",children:"Tax %"}),ne(E,{className:"w-28 text-right",children:"Line Total"}),!p&&ne(E,{className:"w-12"})]})}),ne(ke,{children:c.length===0?ne(W,{children:ne(D,{colSpan:p?7:8,className:"py-8 text-center text-muted-foreground",children:"No line items"})}):c.map(y=>{let k=y.quantity*y.unitPrice*(1+y.taxRate/100);return Ua(W,{"data-slot":"po-line-item",children:[ne(D,{children:ne(T,{className:"h-8 font-mono text-sm",value:y.productCode,onChange:w=>b(y.id,"productCode",w.target.value),disabled:p,"aria-label":"Product code"})}),ne(D,{children:ne(T,{className:"h-8 text-sm",value:y.productName,onChange:w=>b(y.id,"productName",w.target.value),disabled:p,"aria-label":"Product name"})}),ne(D,{children:ne(T,{type:"number",className:"h-8 text-right tabular-nums",value:y.quantity,onChange:w=>b(y.id,"quantity",w.target.value),disabled:p,"aria-label":"Quantity",min:0})}),ne(D,{children:ne(T,{className:"h-8 text-sm",value:y.unit,onChange:w=>b(y.id,"unit",w.target.value),disabled:p,"aria-label":"Unit"})}),ne(D,{children:ne(T,{type:"number",className:"h-8 text-right tabular-nums",value:y.unitPrice,onChange:w=>b(y.id,"unitPrice",w.target.value),disabled:p,"aria-label":"Unit price",min:0,step:"0.01"})}),ne(D,{children:ne(T,{type:"number",className:"h-8 text-right tabular-nums",value:y.taxRate,onChange:w=>b(y.id,"taxRate",w.target.value),disabled:p,"aria-label":"Tax rate",min:0})}),ne(D,{className:"text-right text-sm font-medium tabular-nums",children:Qb(k,u)}),!p&&ne(D,{children:ne(C,{variant:"ghost",size:"icon-sm",onClick:()=>h(y.id),className:"text-muted-foreground hover:text-destructive","aria-label":"Remove line",children:ne(ye,{className:"size-4"})})})]},y.id)})}),c.length>0&&Ua(ke,{children:[Ua(W,{className:"border-t-2 bg-muted/50",children:[ne(D,{colSpan:5,className:"text-right text-sm font-medium",children:"Subtotal:"}),ne(D,{className:"text-right text-sm tabular-nums","data-slot":"po-subtotal",children:Qb(v.subtotal,u)}),!p&&ne(D,{})]}),Ua(W,{className:"bg-muted/50",children:[ne(D,{colSpan:5,className:"text-right text-sm font-medium",children:"Tax:"}),ne(D,{className:"text-right text-sm tabular-nums","data-slot":"po-tax",children:Qb(v.tax,u)}),!p&&ne(D,{})]}),Ua(W,{className:"bg-muted/50 font-semibold",children:[ne(D,{colSpan:5,className:"text-right text-sm",children:"Grand Total:"}),ne(D,{className:"text-right text-sm tabular-nums text-primary","data-slot":"po-total",children:Qb(v.total,u)}),!p&&ne(D,{})]})]})]})}),!p&&Ua(C,{variant:"outline",size:"sm",onClick:N,children:[ne(ge,{className:"mr-1 size-4"}),"Add Line"]}),d.length>0&&Ua("div",{"data-slot":"po-approval-flow",className:"rounded-lg border border-border bg-card p-4",children:[ne("h4",{className:"mb-3 text-sm font-medium text-foreground",children:"Approval Flow"}),ne("div",{className:"flex items-center gap-2",children:d.map((y,k)=>Ua(Xb.Fragment,{children:[Ua("div",{className:"flex flex-col items-center gap-1","data-slot":"approval-step","data-status":y.status,children:[y.status==="approved"?ne(qe,{className:"size-6 text-green-600"}):y.status==="current"?ne(pe,{className:"size-6 text-yellow-500"}):y.status==="rejected"?ne(vo,{className:"size-6 text-red-500"}):ne(vo,{className:"size-6 text-muted-foreground"}),ne("span",{className:"text-xs font-medium text-foreground",children:y.approver}),y.title&&ne("span",{className:"text-[10px] text-muted-foreground",children:y.title})]}),k<d.length-1&&ne("div",{className:l("h-0.5 w-8",y.status==="approved"?"bg-green-500":"bg-border")})]},y.id))})]}),!p&&f&&ne("div",{className:"flex justify-end gap-2 border-t border-border pt-4",children:ne(C,{onClick:f,children:"Submit for Approval"})})]})}import{jsx as we,jsxs as rr}from"react/jsx-runtime";function lM(){return`st-${Date.now()}-${Math.random().toString(36).slice(2,6)}`}function Sxe({transferNo:e,fromWarehouse:t,toWarehouse:a,onFromWarehouseChange:r,onToWarehouseChange:o,warehouses:n=[],lines:i,onLinesChange:c,transferType:s="regular",onTransferTypeChange:d,remark:m,onRemarkChange:u,onSubmit:p,onCancel:f,readOnly:x=!1,className:v}){let N=()=>c?.([...i,{id:lM(),productCode:"",productName:"",quantity:1,unit:"pcs"}]),h=k=>c?.(i.filter(w=>w.id!==k)),b=(k,w,R)=>{c?.(i.map(S=>S.id===k?{...S,[w]:w==="quantity"&&typeof R=="string"?parseFloat(R)||0:R}:S))},g=i.reduce((k,w)=>k+w.quantity,0),y=!!t&&!!a&&t===a;return rr("div",{"data-slot":"stock-transfer-dialog",className:l("space-y-4 rounded-lg border border-border bg-card p-5",v),children:[rr("div",{className:"flex items-center justify-between border-b border-border pb-3",children:[we("h3",{className:"text-lg font-semibold text-foreground",children:"Stock Transfer"}),e&&we(B,{variant:"outline",className:"font-mono",children:e})]}),rr("div",{className:"grid grid-cols-[1fr_auto_1fr] items-end gap-3",children:[rr("div",{children:[we("label",{className:"mb-1 block text-xs font-medium text-muted-foreground",children:"From Warehouse"}),rr("select",{className:"h-9 w-full rounded-md border border-input bg-background px-3 text-sm",value:t??"",onChange:k=>r?.(k.target.value),disabled:x,"aria-label":"From warehouse",children:[we("option",{value:"",children:"Select source"}),n.map(k=>we("option",{value:k,children:k},k))]})]}),we(_a,{className:"mb-2 size-5 text-muted-foreground"}),rr("div",{children:[we("label",{className:"mb-1 block text-xs font-medium text-muted-foreground",children:"To Warehouse"}),rr("select",{className:"h-9 w-full rounded-md border border-input bg-background px-3 text-sm",value:a??"",onChange:k=>o?.(k.target.value),disabled:x,"aria-label":"To warehouse",children:[we("option",{value:"",children:"Select destination"}),n.map(k=>we("option",{value:k,children:k},k))]})]})]}),y&&we("p",{className:"text-xs text-destructive",children:"Source and destination cannot be the same"}),rr("div",{className:"flex items-center gap-2",children:[we("label",{className:"text-sm font-medium text-foreground",children:"Type:"}),rr("div",{className:"flex gap-1",children:[we("button",{type:"button","data-slot":"transfer-type","data-active":s==="regular",onClick:()=>!x&&d?.("regular"),disabled:x,className:l("rounded-md border px-3 py-1 text-xs",s==="regular"?"border-primary bg-primary/10 text-primary":"border-border text-muted-foreground"),children:"Regular"}),we("button",{type:"button","data-slot":"transfer-type","data-active":s==="urgent",onClick:()=>!x&&d?.("urgent"),disabled:x,className:l("rounded-md border px-3 py-1 text-xs",s==="urgent"?"border-destructive bg-destructive/10 text-destructive":"border-border text-muted-foreground"),children:"Urgent"})]})]}),we("div",{className:"overflow-x-auto rounded-lg border border-border",children:rr(ze,{children:[we(Ae,{children:rr(W,{className:"bg-muted/30",children:[we(E,{className:"min-w-[120px]",children:"Product Code"}),we(E,{className:"min-w-[160px]",children:"Product Name"}),we(E,{className:"w-20 text-right",children:"Qty"}),we(E,{className:"w-16",children:"Unit"}),we(E,{className:"min-w-[120px]",children:"Batch No"}),we(E,{className:"w-24 text-right",children:"Available"}),!x&&we(E,{className:"w-12"})]})}),we(ke,{children:i.length===0?we(W,{children:we(D,{colSpan:x?6:7,className:"py-6 text-center text-muted-foreground",children:"No items"})}):i.map(k=>rr(W,{"data-slot":"transfer-line",children:[we(D,{children:we(T,{className:"h-8 font-mono text-sm",value:k.productCode,onChange:w=>b(k.id,"productCode",w.target.value),disabled:x,"aria-label":"Product code"})}),we(D,{children:we(T,{className:"h-8 text-sm",value:k.productName,onChange:w=>b(k.id,"productName",w.target.value),disabled:x,"aria-label":"Product name"})}),we(D,{children:we(T,{type:"number",className:l("h-8 text-right tabular-nums",k.availableQty!=null&&k.quantity>k.availableQty&&"border-destructive"),value:k.quantity,onChange:w=>b(k.id,"quantity",w.target.value),disabled:x,"aria-label":"Quantity",min:0})}),we(D,{children:we(T,{className:"h-8 text-sm",value:k.unit,onChange:w=>b(k.id,"unit",w.target.value),disabled:x,"aria-label":"Unit"})}),we(D,{children:we(T,{className:"h-8 text-sm",value:k.batchNo??"",onChange:w=>b(k.id,"batchNo",w.target.value),disabled:x,"aria-label":"Batch number"})}),we(D,{className:"text-right text-sm tabular-nums text-muted-foreground",children:k.availableQty??"\u2014"}),!x&&we(D,{children:we(C,{variant:"ghost",size:"icon-sm",onClick:()=>h(k.id),className:"text-muted-foreground hover:text-destructive","aria-label":"Remove line",children:we(ye,{className:"size-4"})})})]},k.id))})]})}),rr("div",{className:"flex items-center justify-between",children:[!x&&rr(C,{variant:"outline",size:"sm",onClick:N,children:[we(ge,{className:"mr-1 size-4"}),"Add Item"]}),rr("span",{className:"text-sm text-muted-foreground",children:["Total: ",we("strong",{className:"text-foreground",children:g})," units"]})]}),rr("div",{children:[we("label",{className:"mb-1 block text-xs font-medium text-muted-foreground",children:"Remark"}),we("textarea",{className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm",rows:2,value:m??"",onChange:k=>u?.(k.target.value),disabled:x,"aria-label":"Remark"})]}),!x&&rr("div",{className:"flex justify-end gap-2 border-t border-border pt-3",children:[f&&we(C,{variant:"outline",onClick:f,children:"Cancel"}),p&&we(C,{onClick:p,disabled:y,children:"Submit Transfer"})]})]})}import*as Ih from"react";import{jsx as Ht,jsxs as zn}from"react/jsx-runtime";var dM=[{label:"0-30",maxDays:31},{label:"31-60",maxDays:61},{label:"61-90",maxDays:91},{label:"90+",maxDays:1/0}];function cM(e,t){let a=new Date(e),r=new Date(t);return Math.floor((r.getTime()-a.getTime())/864e5)}function mM(e,t){for(let a=0;a<t.length;a++){let r=t[a];if(r&&e<r.maxDays)return a}return t.length-1}function Zm(e,t){let a=e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2});return`${t}${a}`}var Sh=["text-emerald-600","text-amber-600","text-orange-600","text-destructive"],uM=["bg-emerald-50 dark:bg-emerald-950/30","bg-amber-50 dark:bg-amber-950/30","bg-orange-50 dark:bg-orange-950/30","bg-destructive/10"];function zxe({entries:e,asOfDate:t,type:a="ar",buckets:r=dM,currencySymbol:o="\xA5",onRowClick:n,className:i}){let c=t??new Date().toISOString().slice(0,10),s=Ih.useMemo(()=>e.map(p=>{let f=Math.max(0,cM(p.dueDate,c)),x=mM(f,r);return{...p,overdueDays:f,bucketIdx:x}}),[e,c,r]),d=Ih.useMemo(()=>{let p=new Array(r.length).fill(0);for(let f of s)p[f.bucketIdx]+=f.amount;return p},[s,r]),m=d.reduce((p,f)=>p+f,0),u=r.map(p=>p.label);return zn("div",{"data-slot":"ar-ap-aging-table",className:l("space-y-4 rounded-lg border border-border bg-card p-5",i),children:[zn("div",{className:"flex items-center justify-between",children:[zn("div",{className:"flex items-center gap-2",children:[Ht("h3",{className:"text-lg font-semibold text-foreground",children:a==="ar"?"AR Aging":"AP Aging"}),zn(B,{variant:"outline",className:"text-xs",children:["as of ",c]})]}),zn("div",{className:"text-sm text-muted-foreground",children:["Total:"," ",Ht("strong",{className:l("tabular-nums",m>0?"text-foreground":""),children:Zm(m,o)})]})]}),Ht("div",{className:"grid gap-2",style:{gridTemplateColumns:`repeat(${r.length}, 1fr)`},children:r.map((p,f)=>zn("div",{"data-slot":"aging-bucket-summary",className:l("rounded-md border border-border p-3",uM[f]??"bg-muted/30"),children:[zn("div",{className:"text-xs text-muted-foreground",children:[p.label," days"]}),Ht("div",{className:l("text-lg font-bold tabular-nums",Sh[f]??"text-foreground"),children:Zm(d[f],o)})]},p.label))}),Ht("div",{className:"overflow-x-auto rounded-lg border border-border",children:zn(ze,{children:[Ht(Ae,{children:zn(W,{className:"bg-muted/30",children:[Ht(E,{className:"min-w-[120px]",children:"Party"}),Ht(E,{className:"min-w-[120px]",children:"Doc No"}),Ht(E,{className:"w-28",children:"Doc Date"}),Ht(E,{className:"w-28",children:"Due Date"}),u.map(p=>Ht(E,{className:"w-28 text-right",children:p},p)),Ht(E,{className:"w-28 text-right",children:"Total"})]})}),Ht(ke,{children:s.length===0?Ht(W,{children:zn(D,{colSpan:5+r.length,className:"py-8 text-center text-muted-foreground",children:["No ",a==="ar"?"receivables":"payables"," found"]})}):s.map(p=>zn(W,{"data-slot":"aging-row",className:l(n&&"cursor-pointer hover:bg-muted/30"),onClick:()=>n?.(p),children:[Ht(D,{className:"font-medium text-foreground",children:p.partyName}),Ht(D,{className:"font-mono text-xs text-muted-foreground",children:p.docNo}),Ht(D,{className:"text-sm text-muted-foreground",children:p.docDate}),Ht(D,{className:"text-sm text-muted-foreground",children:p.dueDate}),r.map((f,x)=>Ht(D,{className:l("text-right text-sm tabular-nums",p.bucketIdx===x?l("font-semibold",Sh[x]??"text-foreground"):"text-muted-foreground"),children:p.bucketIdx===x?Zm(p.amount,o):"\u2014"},x)),Ht(D,{className:"text-right text-sm font-bold tabular-nums text-foreground",children:Zm(p.amount,o)})]},p.id))}),s.length>0&&Ht(ai,{children:zn(W,{className:"bg-muted/30 font-semibold",children:[Ht(D,{colSpan:4,children:"Total"}),d.map((p,f)=>Ht(D,{className:l("text-right tabular-nums",Sh[f]??"text-foreground"),children:Zm(p,o)},f)),Ht(D,{className:"text-right tabular-nums text-foreground",children:Zm(m,o)})]})})]})})]})}import*as ag from"react";import{jsx as Ur,jsxs as Wr}from"react/jsx-runtime";var Gk={blue:{bar:"bg-blue-500",badge:"bg-blue-100 text-blue-700 dark:bg-blue-950 dark:text-blue-300",header:"text-blue-600"},indigo:{bar:"bg-indigo-500",badge:"bg-indigo-100 text-indigo-700 dark:bg-indigo-950 dark:text-indigo-300",header:"text-indigo-600"},violet:{bar:"bg-violet-500",badge:"bg-violet-100 text-violet-700 dark:bg-violet-950 dark:text-violet-300",header:"text-violet-600"},amber:{bar:"bg-amber-500",badge:"bg-amber-100 text-amber-700 dark:bg-amber-950 dark:text-amber-300",header:"text-amber-600"},emerald:{bar:"bg-emerald-500",badge:"bg-emerald-100 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-300",header:"text-emerald-600"},rose:{bar:"bg-rose-500",badge:"bg-rose-100 text-rose-700 dark:bg-rose-950 dark:text-rose-300",header:"text-rose-600"}},pM={high:"border-l-rose-500",medium:"border-l-amber-500",low:"border-l-emerald-500"};function Yb(e,t){return`${t}${e.toLocaleString("en-US",{maximumFractionDigits:0})}`}function $xe({stages:e,deals:t,onDealMove:a,onDealClick:r,currencySymbol:o="\xA5",readOnly:n=!1,className:i}){let[c,s]=ag.useState(null),[d,m]=ag.useState(null),u=ag.useMemo(()=>{let h=new Map;for(let b of e)h.set(b.id,[]);for(let b of t){let g=h.get(b.stageId);g&&g.push(b)}return h},[e,t]),p=t.reduce((h,b)=>h+b.value,0),f=t.reduce((h,b)=>{let g=e.find(y=>y.id===b.stageId);return h+b.value*(g?.probability??0)/100},0),x=h=>{n||s(h)},v=(h,b)=>{n||(h.preventDefault(),m(b))},N=(h,b)=>{if(h.preventDefault(),n||!c)return;let g=t.find(y=>y.id===c);g&&g.stageId!==b&&a?.(g.id,g.stageId,b),s(null),m(null)};return Wr("div",{"data-slot":"lead-pipeline-board",className:l("space-y-4 rounded-lg border border-border bg-card p-5",i),children:[Wr("div",{className:"flex items-center justify-between border-b border-border pb-3",children:[Ur("h3",{className:"text-lg font-semibold text-foreground",children:"Pipeline"}),Wr("div",{className:"flex items-center gap-4 text-sm",children:[Wr("div",{className:"text-muted-foreground",children:["Deals: ",Ur("strong",{className:"text-foreground",children:t.length})]}),Wr("div",{className:"text-muted-foreground",children:["Total: ",Ur("strong",{className:"text-foreground tabular-nums",children:Yb(p,o)})]}),Wr("div",{className:"text-muted-foreground",children:["Weighted: ",Ur("strong",{className:"text-foreground tabular-nums",children:Yb(f,o)})]})]})]}),Ur("div",{className:"grid gap-3",style:{gridTemplateColumns:`repeat(${e.length}, minmax(200px, 1fr))`},children:e.map(h=>{let b=u.get(h.id)??[],g=b.reduce((w,R)=>w+R.value,0),y=Gk[h.color??"blue"]??Gk.blue,k=d===h.id;return Wr("div",{"data-slot":"pipeline-column","data-stage-id":h.id,onDragOver:w=>v(w,h.id),onDrop:w=>N(w,h.id),onDragLeave:()=>m(null),className:l("flex flex-col rounded-lg border border-border bg-muted/20",k&&"ring-2 ring-primary ring-offset-1"),children:[Wr("div",{className:l("rounded-t-lg border-b border-border px-3 py-2"),children:[Wr("div",{className:"flex items-center justify-between",children:[Ur("span",{className:l("text-sm font-semibold",y.header),children:h.label}),Wr("span",{className:l("rounded-full px-1.5 py-0.5 text-xs font-medium",y.badge),children:[h.probability,"%"]})]}),Wr("div",{className:"mt-1 flex items-center justify-between text-xs text-muted-foreground",children:[Wr("span",{children:[b.length," deals"]}),Ur("span",{className:"tabular-nums",children:Yb(g,o)})]}),Ur("div",{className:"mt-1.5 h-1 overflow-hidden rounded-full bg-muted",children:Ur("div",{className:l("h-full transition-all",y.bar),style:{width:`${h.probability}%`}})})]}),Ur("div",{className:"flex-1 space-y-2 overflow-y-auto p-2",style:{maxHeight:"400px"},children:b.length===0?Ur("div",{className:"py-4 text-center text-xs text-muted-foreground",children:"No deals"}):b.map(w=>Wr("div",{"data-slot":"deal-card","data-deal-id":w.id,draggable:!n,onDragStart:()=>x(w.id),onClick:()=>r?.(w),className:l("cursor-pointer rounded-md border border-border border-l-4 bg-card p-2.5 shadow-sm transition-shadow hover:shadow-md",pM[w.priority??"low"],c===w.id&&"opacity-50"),children:[Ur("div",{className:"text-sm font-medium text-foreground",children:w.title}),Ur("div",{className:"mt-0.5 text-xs text-muted-foreground",children:w.customer}),Wr("div",{className:"mt-1.5 flex items-center justify-between",children:[Ur("span",{className:"text-sm font-bold tabular-nums text-foreground",children:Yb(w.value,w.currency?"":o)}),w.owner&&Ur("span",{className:"text-xs text-muted-foreground",children:w.owner})]}),w.expectedClose&&Wr("div",{className:"mt-1 text-xs text-muted-foreground",children:["Close: ",w.expectedClose]})]},w.id))})]},h.id)})})]})}import{jsx as be,jsxs as _r}from"react/jsx-runtime";function gM(){return`ql-${Date.now()}-${Math.random().toString(36).slice(2,6)}`}function jk(e){return e.unitPrice*(1-e.discountPct/100)}function og(e){return jk(e)*e.quantity}function Kk(e){return e.unitCost*e.quantity}function Qk(e){return og(e)-Kk(e)}function fM(e){let t=og(e);return t===0?0:Qk(e)/t*100}function bM(e){return og(e)*((e.taxRate??0)/100)}function Ki(e,t){return`${t}${e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`}function rg(e){return e<0?"text-destructive":e<15?"text-amber-600":"text-emerald-600"}function jxe({quoteNo:e,lines:t,onLinesChange:a,currencySymbol:r="\xA5",onSubmit:o,onCancel:n,readOnly:i=!1,className:c}){let s=()=>{a?.([...t,{id:gM(),productCode:"",productName:"",quantity:1,unit:"pcs",unitCost:0,unitPrice:0,discountPct:0,taxRate:13}])},d=h=>{a?.(t.filter(b=>b.id!==h))},m=(h,b,g)=>{a?.(t.map(y=>{if(y.id!==h)return y;if(b==="productCode"||b==="productName"||b==="unit")return{...y,[b]:g};let k=typeof g=="string"?parseFloat(g)||0:g;return{...y,[b]:k}}))},u=t.reduce((h,b)=>h+og(b),0),p=t.reduce((h,b)=>h+Kk(b),0),f=u-p,x=t.reduce((h,b)=>h+bM(b),0),v=u+x,N=u>0?f/u*100:0;return _r("div",{"data-slot":"quotation-line-editor",className:l("space-y-4 rounded-lg border border-border bg-card p-5",c),children:[_r("div",{className:"flex items-center justify-between border-b border-border pb-3",children:[be("h3",{className:"text-lg font-semibold text-foreground",children:"Quotation Editor"}),e&&be(B,{variant:"outline",className:"font-mono",children:e})]}),be("div",{className:"overflow-x-auto rounded-lg border border-border",children:_r(ze,{children:[be(Ae,{children:_r(W,{className:"bg-muted/30",children:[be(E,{className:"min-w-[100px]",children:"Code"}),be(E,{className:"min-w-[140px]",children:"Product"}),be(E,{className:"w-20 text-right",children:"Qty"}),be(E,{className:"w-16",children:"Unit"}),be(E,{className:"w-24 text-right",children:"Unit Cost"}),be(E,{className:"w-24 text-right",children:"Unit Price"}),be(E,{className:"w-20 text-right",children:"Disc%"}),be(E,{className:"w-24 text-right",children:"Net Price"}),be(E,{className:"w-24 text-right",children:"Subtotal"}),be(E,{className:"w-24 text-right",children:"Profit"}),be(E,{className:"w-20 text-right",children:"Margin"}),be(E,{className:"w-20 text-right",children:"Tax%"}),!i&&be(E,{className:"w-12"})]})}),be(ke,{children:t.length===0?be(W,{children:be(D,{colSpan:i?11:12,className:"py-6 text-center text-muted-foreground",children:"No line items"})}):t.map(h=>{let b=Qk(h),g=fM(h);return _r(W,{"data-slot":"quotation-line",children:[be(D,{children:be(T,{className:"h-8 font-mono text-sm",value:h.productCode,onChange:y=>m(h.id,"productCode",y.target.value),disabled:i,"aria-label":"Product code"})}),be(D,{children:be(T,{className:"h-8 text-sm",value:h.productName,onChange:y=>m(h.id,"productName",y.target.value),disabled:i,"aria-label":"Product name"})}),be(D,{children:be(T,{type:"number",className:"h-8 text-right tabular-nums",value:h.quantity,onChange:y=>m(h.id,"quantity",y.target.value),disabled:i,"aria-label":"Quantity",min:0})}),be(D,{children:be(T,{className:"h-8 text-sm",value:h.unit,onChange:y=>m(h.id,"unit",y.target.value),disabled:i,"aria-label":"Unit"})}),be(D,{children:be(T,{type:"number",className:"h-8 text-right tabular-nums",value:h.unitCost,onChange:y=>m(h.id,"unitCost",y.target.value),disabled:i,"aria-label":"Unit cost",min:0})}),be(D,{children:be(T,{type:"number",className:"h-8 text-right tabular-nums",value:h.unitPrice,onChange:y=>m(h.id,"unitPrice",y.target.value),disabled:i,"aria-label":"Unit price",min:0})}),be(D,{children:be(T,{type:"number",className:"h-8 text-right tabular-nums",value:h.discountPct,onChange:y=>m(h.id,"discountPct",y.target.value),disabled:i,"aria-label":"Discount percent",min:0,max:100})}),be(D,{className:"text-right text-sm tabular-nums text-muted-foreground",children:Ki(jk(h),r)}),be(D,{className:"text-right text-sm font-medium tabular-nums text-foreground",children:Ki(og(h),r)}),be(D,{className:l("text-right text-sm tabular-nums",rg(g)),children:Ki(b,r)}),_r(D,{className:l("text-right text-sm font-semibold tabular-nums",rg(g)),children:[g.toFixed(1),"%"]}),be(D,{children:be(T,{type:"number",className:"h-8 text-right tabular-nums",value:h.taxRate??0,onChange:y=>m(h.id,"taxRate",y.target.value),disabled:i,"aria-label":"Tax rate",min:0})}),!i&&be(D,{children:be(C,{variant:"ghost",size:"icon-sm",onClick:()=>d(h.id),className:"text-muted-foreground hover:text-destructive","aria-label":"Remove line",children:be(ye,{className:"size-4"})})})]},h.id)})}),t.length>0&&be(ai,{children:_r(W,{className:"bg-muted/30 font-semibold",children:[be(D,{colSpan:7,children:"Total"}),be(D,{className:"text-right text-muted-foreground",children:"\u2014"}),be(D,{className:"text-right tabular-nums text-foreground",children:Ki(u,r)}),be(D,{className:l("text-right tabular-nums",rg(N)),children:Ki(f,r)}),_r(D,{className:l("text-right tabular-nums",rg(N)),children:[N.toFixed(1),"%"]}),be(D,{className:"text-right text-muted-foreground",children:Ki(x,r)}),!i&&be(D,{})]})})]})}),_r("div",{className:"flex items-center justify-between",children:[_r("div",{className:"space-y-1 text-sm",children:[_r("div",{className:"text-muted-foreground",children:["Subtotal: ",be("strong",{className:"text-foreground tabular-nums",children:Ki(u,r)})," \xB7 ","Tax: ",be("strong",{className:"text-foreground tabular-nums",children:Ki(x,r)})," \xB7 ",_r("span",{className:l("font-semibold",rg(N)),children:["Margin: ",N.toFixed(1),"%"]})]}),_r("div",{className:"text-base font-bold text-foreground",children:["Grand Total: ",be("span",{className:"tabular-nums",children:Ki(v,r)})]})]}),_r("div",{className:"flex items-center gap-2",children:[!i&&_r(C,{variant:"outline",size:"sm",onClick:s,children:[be(ge,{className:"mr-1 size-4"}),"Add Line"]}),!i&&n&&be(C,{variant:"outline",onClick:n,children:"Cancel"}),!i&&o&&be(C,{onClick:o,children:"Save Quotation"})]})]})]})}import{jsx as Je,jsxs as Ma}from"react/jsx-runtime";var xM={platinum:{label:"Platinum",className:"bg-slate-200 text-slate-700 dark:bg-slate-800 dark:text-slate-200"},gold:{label:"Gold",className:"bg-amber-200 text-amber-800 dark:bg-amber-950 dark:text-amber-200"},silver:{label:"Silver",className:"bg-gray-200 text-gray-700 dark:bg-gray-800 dark:text-gray-200"},bronze:{label:"Bronze",className:"bg-orange-200 text-orange-800 dark:bg-orange-950 dark:text-orange-200"}},vM={order:"\u{1F6D2}",call:"\u{1F4DE}",email:"\u2709\uFE0F",meeting:"\u{1F5D3}\uFE0F",note:"\u{1F4DD}",ticket:"\u{1F3AB}"};function hM(e){return e>=80?{text:"text-emerald-600",bg:"bg-emerald-500",ring:"text-emerald-500"}:e>=60?{text:"text-blue-600",bg:"bg-blue-500",ring:"text-blue-500"}:e>=40?{text:"text-amber-600",bg:"bg-amber-500",ring:"text-amber-500"}:{text:"text-destructive",bg:"bg-destructive",ring:"text-destructive"}}var yM={up:"\u2191",down:"\u2193",flat:"\u2192"},NM={up:"text-emerald-600",down:"text-destructive",flat:"text-muted-foreground"};function CM(e,t){return`${t}${e.toLocaleString("en-US",{maximumFractionDigits:0})}`}function Jxe({name:e,logo:t,industry:a,tier:r,healthScore:o,metrics:n=[],contacts:i=[],activities:c=[],lifetimeValue:s,currencySymbol:d="\xA5",tags:m=[],className:u}){let p=r?xM[r]:null,f=o!=null?hM(o):null,x=o??0;return Ma("div",{"data-slot":"customer-360-card",className:l("space-y-5 rounded-xl border border-border bg-card p-5 shadow-sm",u),children:[Ma("div",{className:"flex items-start gap-4",children:[Je("div",{className:"flex size-16 shrink-0 items-center justify-center overflow-hidden rounded-xl border border-border bg-muted",children:t?Je("img",{src:t,alt:e,className:"size-full object-cover"}):Je("span",{className:"text-2xl font-bold text-primary",children:e.charAt(0)})}),Ma("div",{className:"flex-1",children:[Ma("div",{className:"flex items-center gap-2",children:[Je("h3",{className:"text-xl font-semibold text-foreground",children:e}),p&&Je(B,{className:l("text-xs",p.className),children:p.label})]}),a&&Je("p",{className:"mt-0.5 text-sm text-muted-foreground",children:a}),m.length>0&&Je("div",{className:"mt-1.5 flex flex-wrap gap-1",children:m.map(v=>Je("span",{className:"rounded-full bg-muted px-2 py-0.5 text-xs text-muted-foreground",children:v},v))})]}),f&&Ma("div",{className:"flex flex-col items-center","data-slot":"health-score",children:[Ma("div",{className:"relative size-16",children:[Ma("svg",{className:"size-16 -rotate-90",viewBox:"0 0 64 64",children:[Je("circle",{cx:"32",cy:"32",r:"28",fill:"none",stroke:"currentColor",strokeWidth:"6",className:"text-muted"}),Je("circle",{cx:"32",cy:"32",r:"28",fill:"none",stroke:"currentColor",strokeWidth:"6",strokeLinecap:"round",className:f.ring,strokeDasharray:`${x/100*175.9} 175.9`})]}),Je("div",{className:l("absolute inset-0 flex items-center justify-center text-lg font-bold",f.text),children:x})]}),Je("span",{className:"mt-0.5 text-xs text-muted-foreground",children:"Health"})]})]}),n.length>0&&Je("div",{"data-slot":"customer-metrics",className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:n.map(v=>Ma("div",{"data-slot":"customer-metric",className:"rounded-lg border border-border bg-muted/20 p-3",children:[Je("div",{className:"text-xs text-muted-foreground",children:v.label}),Je("div",{className:"mt-0.5 text-lg font-bold tabular-nums text-foreground",children:v.value}),v.trend&&v.delta&&Ma("div",{className:l("mt-0.5 flex items-center gap-1 text-xs",NM[v.trend]),children:[Je("span",{children:yM[v.trend]}),Je("span",{children:v.delta})]})]},v.label))}),s!=null&&Ma("div",{className:"flex items-center justify-between rounded-lg border border-primary/20 bg-primary/5 px-4 py-2.5",children:[Je("span",{className:"text-sm text-muted-foreground",children:"Lifetime Value"}),Je("span",{className:"text-xl font-bold tabular-nums text-primary",children:CM(s,d)})]}),Ma("div",{className:"grid gap-4 md:grid-cols-2",children:[i.length>0&&Ma("div",{"data-slot":"customer-contacts",children:[Je("h4",{className:"mb-2 text-sm font-semibold text-foreground",children:"Key Contacts"}),Je("div",{className:"space-y-2",children:i.map(v=>Ma("div",{"data-slot":"contact-item",className:"flex items-center gap-2 rounded-md border border-border bg-muted/20 px-3 py-2",children:[Je("div",{className:"flex size-8 items-center justify-center rounded-full bg-primary/10 text-xs font-medium text-primary",children:v.name.charAt(0)}),Ma("div",{className:"flex-1",children:[Ma("div",{className:"flex items-center gap-1.5",children:[Je("span",{className:"text-sm font-medium text-foreground",children:v.name}),v.isPrimary&&Je(B,{variant:"outline",className:"text-[10px]",children:"Primary"})]}),Je("div",{className:"text-xs text-muted-foreground",children:v.title})]}),Ma("div",{className:"text-right text-xs text-muted-foreground",children:[v.phone&&Je("div",{children:v.phone}),v.email&&Je("div",{className:"truncate",children:v.email})]})]},v.id))})]}),c.length>0&&Ma("div",{"data-slot":"customer-activities",children:[Je("h4",{className:"mb-2 text-sm font-semibold text-foreground",children:"Recent Activity"}),Je("div",{className:"space-y-2",children:c.map(v=>Ma("div",{"data-slot":"activity-item",className:"flex items-start gap-2 rounded-md border border-border bg-muted/20 px-3 py-2",children:[Je("span",{className:"text-base",children:vM[v.type]??"\u2022"}),Ma("div",{className:"flex-1",children:[Je("div",{className:"text-sm font-medium text-foreground",children:v.title}),v.description&&Je("div",{className:"text-xs text-muted-foreground",children:v.description}),Je("div",{className:"mt-0.5 text-xs text-muted-foreground",children:v.date})]})]},v.id))})]})]}),n.length===0&&i.length===0&&c.length===0&&s==null&&Je("div",{className:"py-8 text-center text-sm text-muted-foreground",children:"No customer data available"})]})}import*as Dh from"react";import{Fragment as TM,jsx as qr,jsxs as xa}from"react/jsx-runtime";function kM(e){return e.length===0?0:e.reduce((t,a)=>t+a,0)/e.length}function wM(e,t){if(e.length<2)return 0;let a=e.reduce((r,o)=>r+(o-t)**2,0)/(e.length-1);return Math.sqrt(a)}function PM(e,t,a){let r=new Set;if(a===0)return r;for(let i=0;i<e.length;i++)Math.abs(e[i].value-t)>3*a&&r.add(i);let o=0,n=0;for(let i=0;i<e.length;i++){let c=e[i].value>t?1:e[i].value<t?-1:0;if(c===0)o=0,n=0;else if(c===o){if(n++,n>=8)for(let s=i-7;s<=i;s++)r.add(s)}else o=c,n=1}for(let i=2;i<e.length;i++){let c=[e[i-2],e[i-1],e[i]],s=0,d=0;for(let m of c)m.value>t+2*a&&s++,m.value<t-2*a&&d++;if(s>=2||d>=2)for(let m=i-2;m<=i;m++)Math.abs(e[m].value-t)>2*a&&r.add(m)}return r}function Us(e,t){return`${e.toFixed(2)}${t??""}`}function rve({samples:e,title:t="SPC Control Chart",centerLine:a,ucl:r,lcl:o,sigma:n,showWarningLimits:i=!0,yLabel:c,unit:s,height:d=320,className:m}){let u=Math.max(600,e.length*50+80),p={top:30,right:30,bottom:50,left:60},f=u-p.left-p.right,x=d-p.top-p.bottom,v=e.map(I=>I.value),{cl:N,sd:h}=Dh.useMemo(()=>{let I=a??kM(v),A=n??wM(v,I);return{cl:I,sd:A}},[a,n,v]),b=r??N+3*h,g=o??N-3*h,y=Dh.useMemo(()=>PM(e,N,h),[e,N,h]),k=Math.min(g,...v)-h,R=Math.max(b,...v)+h-k||1,S=I=>p.top+x-(I-k)/R*x,z=I=>e.length<=1?p.left+f/2:p.left+I/(e.length-1)*f,L=e.map((I,A)=>`${A===0?"M":"L"} ${z(A)} ${S(I.value)}`).join(" "),H=N+2*h,M=N-2*h,$=h>0?Math.min((b-N)/(3*h),(N-g)/(3*h)):0;return xa("div",{"data-slot":"spc-control-chart",className:l("space-y-3 rounded-lg border border-border bg-card p-5",m),children:[xa("div",{className:"flex items-center justify-between",children:[qr("h3",{className:"text-lg font-semibold text-foreground",children:t}),xa("div",{className:"flex items-center gap-3 text-sm",children:[xa(B,{variant:"outline",className:"text-xs",children:["CL: ",Us(N,s)]}),xa(B,{variant:"outline",className:"text-xs",children:["\u03C3: ",Us(h,s)]}),xa(B,{variant:$>=1.33?"default":"destructive",className:"text-xs",children:["Cpk: ",$.toFixed(2)]}),y.size>0&&xa(B,{variant:"destructive",className:"text-xs","data-slot":"violation-badge",children:[y.size," violation",y.size>1?"s":""]})]})]}),qr("div",{className:"overflow-x-auto",children:xa("svg",{width:u,height:d,"data-slot":"spc-chart-svg",role:"img","aria-label":"SPC control chart",children:[[0,.25,.5,.75,1].map(I=>{let A=p.top+x*I;return qr("line",{x1:p.left,y1:A,x2:u-p.right,y2:A,stroke:"currentColor",strokeWidth:"0.5",className:"text-border"},I)}),i&&h>0&&xa(TM,{children:[qr("line",{x1:p.left,y1:S(H),x2:u-p.right,y2:S(H),stroke:"currentColor",strokeWidth:"1",strokeDasharray:"6 4",className:"text-amber-500"}),xa("text",{x:p.left-8,y:S(H)-4,textAnchor:"end",className:"fill-amber-600 text-[10px]",children:["+2\u03C3: ",Us(H,s)]}),qr("line",{x1:p.left,y1:S(M),x2:u-p.right,y2:S(M),stroke:"currentColor",strokeWidth:"1",strokeDasharray:"6 4",className:"text-amber-500"}),xa("text",{x:p.left-8,y:S(M)+12,textAnchor:"end",className:"fill-amber-600 text-[10px]",children:["-2\u03C3: ",Us(M,s)]})]}),qr("line",{x1:p.left,y1:S(b),x2:u-p.right,y2:S(b),stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"8 4",className:"text-destructive"}),xa("text",{x:p.left-8,y:S(b)-4,textAnchor:"end",className:"fill-destructive text-[10px] font-medium",children:["UCL: ",Us(b,s)]}),qr("line",{x1:p.left,y1:S(g),x2:u-p.right,y2:S(g),stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"8 4",className:"text-destructive"}),xa("text",{x:p.left-8,y:S(g)+12,textAnchor:"end",className:"fill-destructive text-[10px] font-medium",children:["LCL: ",Us(g,s)]}),qr("line",{x1:p.left,y1:S(N),x2:u-p.right,y2:S(N),stroke:"currentColor",strokeWidth:"1.5",className:"text-primary"}),xa("text",{x:p.left-8,y:S(N)-4,textAnchor:"end",className:"fill-primary text-[10px] font-medium",children:["CL: ",Us(N,s)]}),qr("path",{d:L,fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"text-foreground/70"}),e.map((I,A)=>{let O=y.has(A);return xa("g",{children:[qr("circle",{cx:z(A),cy:S(I.value),r:O?5:3.5,fill:O?"currentColor":"white",stroke:"currentColor",strokeWidth:"1.5",className:O?"text-destructive":"text-primary"}),O&&qr("text",{x:z(A),y:S(I.value)-10,textAnchor:"middle",className:"fill-destructive text-[10px] font-bold",children:"!"})]},A)}),e.map((I,A)=>{let O=Math.ceil(e.length/15);return A%O!==0&&A!==e.length-1?null:qr("text",{x:z(A),y:d-p.bottom+16,textAnchor:"middle",className:"fill-muted-foreground text-[10px]",children:I.label},`label-${A}`)}),c&&qr("text",{x:-(d/2),y:16,transform:"rotate(-90)",textAnchor:"middle",className:"fill-muted-foreground text-xs",children:c})]})}),xa("div",{className:"flex flex-wrap items-center gap-4 text-xs text-muted-foreground",children:[xa("span",{children:["n = ",e.length]}),xa("span",{children:["Min = ",Us(Math.min(...v),s)]}),xa("span",{children:["Max = ",Us(Math.max(...v),s)]}),xa("span",{children:["Range = ",Us(Math.max(...v)-Math.min(...v),s)]}),y.size===0?qr(B,{variant:"outline",className:"text-xs text-emerald-600",children:"Process in control"}):qr(B,{variant:"destructive",className:"text-xs",children:"Out of control \u2014 investigate"})]})]})}import{jsx as Xt,jsxs as va}from"react/jsx-runtime";function RM(e){return e.availability/100*(e.performance/100)*(e.quality/100)*100}function SM(e,t){return e>=t?"text-emerald-500":e>=t*.8?"text-amber-500":"text-destructive"}function IM(e,t){return e>=t?"#10b981":e>=t*.8?"#f59e0b":"#ef4444"}function Zb(e){return`${e.toFixed(1)}%`}function Cc(e){if(e>=60){let t=Math.floor(e/60),a=Math.round(e%60);return a>0?`${t}h ${a}m`:`${t}h`}return`${Math.round(e)}m`}var DM={availability:"bg-rose-500",performance:"bg-amber-500",quality:"bg-violet-500"};function Jb({label:e,value:t,target:a,sublabel:r}){let c=2*Math.PI*55,s=c-t/100*c,d=IM(t,a);return va("div",{className:"flex flex-col items-center","data-slot":"oee-gauge",children:[va("div",{className:"relative",style:{width:120,height:120},children:[va("svg",{width:120,height:120,className:"-rotate-90",children:[Xt("circle",{cx:120/2,cy:120/2,r:55,fill:"none",stroke:"currentColor",strokeWidth:10,className:"text-muted"}),Xt("circle",{cx:120/2,cy:120/2,r:55,fill:"none",stroke:d,strokeWidth:10,strokeLinecap:"round",strokeDasharray:c,strokeDashoffset:s,style:{transition:"stroke-dashoffset 0.5s ease"}})]}),va("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[Xt("span",{className:l("text-2xl font-bold",SM(t,a)),children:Zb(t)}),r&&Xt("span",{className:"text-[10px] text-muted-foreground",children:r})]})]}),Xt("span",{className:"mt-1 text-sm font-medium text-foreground",children:e})]})}function lve({equipment:e,losses:t=[],title:a="OEE Dashboard",targetOee:r=85,className:o}){let n=RM(e),i=t.reduce((c,s)=>c+s.minutes,0);return va("div",{"data-slot":"oee-dashboard",className:l("space-y-5 rounded-xl border border-border bg-card p-5 shadow-sm",o),children:[va("div",{className:"flex items-center justify-between border-b border-border pb-3",children:[va("div",{children:[Xt("h3",{className:"text-lg font-semibold text-foreground",children:a}),Xt("p",{className:"text-sm text-muted-foreground",children:e.name})]}),va(B,{variant:n>=r?"default":"destructive",className:"text-sm",children:["Target: ",Zb(r)]})]}),va("div",{className:"flex flex-wrap items-center justify-around gap-4",children:[Xt(Jb,{label:"OEE",value:n,target:r,sublabel:"Overall"}),Xt(Jb,{label:"Availability",value:e.availability,target:90,sublabel:`${Cc(e.runTime)} / ${Cc(e.plannedTime)}`}),Xt(Jb,{label:"Performance",value:e.performance,target:95,sublabel:`${e.totalUnits} units`}),Xt(Jb,{label:"Quality",value:e.quality,target:99,sublabel:`${e.defectUnits} defects`})]}),t.length>0&&va("div",{"data-slot":"oee-losses",children:[va("h4",{className:"mb-2 text-sm font-semibold text-foreground",children:["Loss Breakdown ",va("span",{className:"text-muted-foreground",children:["(",Cc(i)," total)"]})]}),Xt("div",{className:"space-y-1.5",children:t.map((c,s)=>{let d=i>0?c.minutes/i*100:0;return va("div",{"data-slot":"loss-item",className:"flex items-center gap-2",children:[Xt("span",{className:"w-32 shrink-0 text-xs text-muted-foreground",children:c.label}),va("div",{className:"relative h-5 flex-1 overflow-hidden rounded bg-muted",children:[Xt("div",{className:l("h-full rounded transition-all",DM[c.category]??"bg-muted-foreground"),style:{width:`${d}%`}}),va("span",{className:"absolute inset-0 flex items-center justify-end pr-2 text-[10px] font-medium text-foreground",children:[Cc(c.minutes)," (",Zb(d),")"]})]})]},s)})})]}),va("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[va("div",{className:"rounded-lg border border-border bg-muted/20 p-3","data-slot":"oee-metric",children:[Xt("div",{className:"text-xs text-muted-foreground",children:"Planned Time"}),Xt("div",{className:"mt-0.5 text-lg font-bold tabular-nums text-foreground",children:Cc(e.plannedTime)})]}),va("div",{className:"rounded-lg border border-border bg-muted/20 p-3","data-slot":"oee-metric",children:[Xt("div",{className:"text-xs text-muted-foreground",children:"Run Time"}),Xt("div",{className:"mt-0.5 text-lg font-bold tabular-nums text-foreground",children:Cc(e.runTime)})]}),va("div",{className:"rounded-lg border border-border bg-muted/20 p-3","data-slot":"oee-metric",children:[Xt("div",{className:"text-xs text-muted-foreground",children:"Downtime"}),Xt("div",{className:"mt-0.5 text-lg font-bold tabular-nums text-destructive",children:Cc(e.downtime)})]}),va("div",{className:"rounded-lg border border-border bg-muted/20 p-3","data-slot":"oee-metric",children:[Xt("div",{className:"text-xs text-muted-foreground",children:"Defect Rate"}),Xt("div",{className:"mt-0.5 text-lg font-bold tabular-nums text-foreground",children:e.totalUnits>0?Zb(e.defectUnits/e.totalUnits*100):"0.0%"})]})]})]})}import"react";import{Fragment as zM,jsx as Yt,jsxs as hr}from"react/jsx-runtime";var ex={raw:{label:"Raw Material",color:"border-blue-300 dark:border-blue-800",badge:"bg-blue-100 text-blue-700 dark:bg-blue-950 dark:text-blue-300",icon:"\u{1F4E6}"},wip:{label:"WIP",color:"border-amber-300 dark:border-amber-800",badge:"bg-amber-100 text-amber-700 dark:bg-amber-950 dark:text-amber-300",icon:"\u2699\uFE0F"},finished:{label:"Finished",color:"border-emerald-300 dark:border-emerald-800",badge:"bg-emerald-100 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-300",icon:"\u2705"},scrap:{label:"Scrap",color:"border-rose-300 dark:border-rose-800",badge:"bg-rose-100 text-rose-700 dark:bg-rose-950 dark:text-rose-300",icon:"\u{1F5D1}\uFE0F"}},MM={released:{label:"Released",className:"bg-emerald-100 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-300"},quarantine:{label:"Quarantine",className:"bg-amber-100 text-amber-700 dark:bg-amber-950 dark:text-amber-300"},rejected:{label:"Rejected",className:"bg-rose-100 text-rose-700 dark:bg-rose-950 dark:text-rose-300"}};function Xk(e){let t=1;for(let a of e.children??[])t+=Xk(a);return t}function BM({node:e,onBatchClick:t,isRoot:a}){let r=ex[e.type]??ex.wip??ex.wip,o=e.status?MM[e.status]:null;return r?hr("div",{"data-slot":"batch-node","data-batch-no":e.batchNo,onClick:()=>t?.(e),className:l("inline-block min-w-[200px] cursor-pointer rounded-lg border-2 bg-card p-3 shadow-sm transition-shadow hover:shadow-md",r.color,a&&"ring-2 ring-primary ring-offset-2"),children:[hr("div",{className:"flex items-center justify-between",children:[Yt("span",{className:"text-base",children:r.icon}),Yt("span",{className:l("rounded-full px-2 py-0.5 text-[10px] font-medium",r.badge),children:r.label})]}),Yt("div",{className:"mt-1.5 font-mono text-sm font-bold text-foreground",children:e.batchNo}),Yt("div",{className:"text-sm text-muted-foreground",children:e.product}),hr("div",{className:"mt-1.5 space-y-0.5 text-xs text-muted-foreground",children:[hr("div",{className:"flex items-center justify-between",children:[Yt("span",{children:"Qty:"}),hr("span",{className:"font-medium tabular-nums text-foreground",children:[e.quantity.toLocaleString()," ",e.unit]})]}),hr("div",{className:"flex items-center justify-between",children:[Yt("span",{children:"Date:"}),Yt("span",{className:"text-foreground",children:e.date})]}),e.operator&&hr("div",{className:"flex items-center justify-between",children:[Yt("span",{children:"Operator:"}),Yt("span",{className:"text-foreground",children:e.operator})]})]}),o&&Yt("div",{className:"mt-1.5",children:Yt("span",{className:l("rounded-full px-2 py-0.5 text-[10px] font-medium",o.className),children:o.label})})]}):null}function Yk(e,t,a=!1){let r=e.children&&e.children.length>0;return hr("div",{"data-slot":"tree-level",className:"flex flex-col items-center",children:[Yt(BM,{node:e,...t?{onBatchClick:t}:{},isRoot:a}),r&&hr(zM,{children:[Yt("div",{className:"h-6 w-px bg-border"}),hr("div",{className:"relative flex justify-center gap-6",children:[e.children.length>1&&Yt("div",{className:"absolute top-0 h-px bg-border",style:{left:"12%",right:"12%"}}),e.children.map((o,n)=>hr("div",{className:"flex flex-col items-center",children:[Yt("div",{className:"h-6 w-px bg-border"}),Yk(o,t)]},`${o.batchNo}-${n}`))]})]})]})}function LM({root:e,direction:t="backward",onBatchClick:a,className:r}){let o=Xk(e);return hr("div",{"data-slot":"batch-genealogy-tree",className:l("space-y-4 rounded-lg border border-border bg-card p-5",r),children:[hr("div",{className:"flex items-center justify-between border-b border-border pb-3",children:[hr("div",{className:"flex items-center gap-2",children:[Yt("h3",{className:"text-lg font-semibold text-foreground",children:"Batch Genealogy"}),Yt(B,{variant:"outline",className:"text-xs",children:t==="backward"?"\u2191 Backward Trace":"\u2193 Forward Trace"})]}),hr("span",{className:"text-sm text-muted-foreground",children:[o," batch",o>1?"es":""," in tree"]})]}),Yt("div",{className:"overflow-x-auto py-4",children:Yt("div",{className:"flex justify-center min-w-fit",children:Yk(e,a,!0)})}),Yt("div",{className:"flex flex-wrap items-center gap-3 border-t border-border pt-3",children:Object.entries(ex).map(([n,i])=>hr("div",{className:"flex items-center gap-1.5",children:[Yt("span",{className:"text-sm",children:i.icon}),Yt("span",{className:"text-xs text-muted-foreground",children:i.label})]},n))})]})}import{jsx as Vt,jsxs as Jt}from"react/jsx-runtime";var AM={planned:{label:"Planned",className:"bg-slate-100 text-slate-700 dark:bg-slate-800 dark:text-slate-300",dot:"bg-slate-400"},released:{label:"Released",className:"bg-blue-100 text-blue-700 dark:bg-blue-950 dark:text-blue-300",dot:"bg-blue-500"},in_progress:{label:"In Progress",className:"bg-amber-100 text-amber-700 dark:bg-amber-950 dark:text-amber-300",dot:"bg-amber-500 animate-pulse"},on_hold:{label:"On Hold",className:"bg-orange-100 text-orange-700 dark:bg-orange-950 dark:text-orange-300",dot:"bg-orange-500"},completed:{label:"Completed",className:"bg-emerald-100 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-300",dot:"bg-emerald-500"},cancelled:{label:"Cancelled",className:"bg-rose-100 text-rose-700 dark:bg-rose-950 dark:text-rose-300",dot:"bg-rose-500"}},EM={low:{label:"Low",className:"bg-slate-100 text-slate-600"},medium:{label:"Medium",className:"bg-blue-100 text-blue-600"},high:{label:"High",className:"bg-amber-100 text-amber-700"},urgent:{label:"Urgent",className:"bg-rose-100 text-rose-700"}},FM={pending:"\u25CB",running:"\u25D0",done:"\u25CF",skipped:"\u2715"},$M={pending:"text-muted-foreground",running:"text-amber-500",done:"text-emerald-500",skipped:"text-rose-500"};function xve({orderNo:e,product:t,productCode:a,status:r,plannedStart:o,plannedEnd:n,plannedQty:i,completedQty:c,unit:s="pcs",priority:d="medium",workCenter:m,operations:u=[],supervisor:p,onClick:f,className:x}){let v=AM[r],N=EM[d],h=i>0?Math.min(100,c/i*100):0,b=Math.max(0,i-c),g=r!=="completed"&&r!=="cancelled"&&n<new Date().toISOString().slice(0,10),y=u.filter(w=>w.status==="done").length,k=u.find(w=>w.status==="running");return Jt("div",{"data-slot":"work-order-card","data-order-no":e,onClick:f,className:l("rounded-xl border border-border bg-card p-4 shadow-sm transition-shadow",f&&"cursor-pointer hover:shadow-md",g&&"border-l-4 border-l-rose-500",x),children:[Jt("div",{className:"flex items-start justify-between",children:[Jt("div",{className:"flex-1",children:[Jt("div",{className:"flex items-center gap-2",children:[Vt("div",{className:l("size-2.5 rounded-full",v.dot)}),Vt("span",{className:"font-mono text-sm font-bold text-foreground",children:e})]}),Vt("div",{className:"mt-1 text-base font-semibold text-foreground",children:t}),a&&Vt("div",{className:"font-mono text-xs text-muted-foreground",children:a})]}),Jt("div",{className:"flex flex-col items-end gap-1",children:[Vt("span",{className:l("rounded-full px-2 py-0.5 text-xs font-medium",v.className),children:v.label}),Vt("span",{className:l("rounded-full px-2 py-0.5 text-xs font-medium",N.className),children:N.label}),g&&Vt("span",{className:"text-xs font-medium text-rose-600",children:"Overdue"})]})]}),Jt("div",{className:"mt-3","data-slot":"wo-progress",children:[Jt("div",{className:"flex items-center justify-between text-sm",children:[Vt("span",{className:"text-muted-foreground",children:"Progress"}),Jt("span",{className:"font-medium tabular-nums text-foreground",children:[c.toLocaleString()," / ",i.toLocaleString()," ",s]})]}),Vt("div",{className:"mt-1 h-2 overflow-hidden rounded-full bg-muted",children:Vt("div",{className:l("h-full rounded-full transition-all",h>=100?"bg-emerald-500":h>=50?"bg-blue-500":"bg-amber-500"),style:{width:`${h}%`}})}),Jt("div",{className:"mt-0.5 flex items-center justify-between text-xs text-muted-foreground",children:[Jt("span",{children:[h.toFixed(1),"% complete"]}),b>0&&r!=="completed"&&Jt("span",{children:[b.toLocaleString()," ",s," remaining"]})]})]}),Jt("div",{className:"mt-3 grid grid-cols-2 gap-2 text-xs",children:[Jt("div",{className:"rounded-md border border-border bg-muted/20 px-2.5 py-1.5",children:[Vt("span",{className:"text-muted-foreground",children:"Planned Start"}),Vt("div",{className:"font-medium text-foreground",children:o})]}),Jt("div",{className:"rounded-md border border-border bg-muted/20 px-2.5 py-1.5",children:[Vt("span",{className:"text-muted-foreground",children:"Planned End"}),Vt("div",{className:l("font-medium",g?"text-rose-600":"text-foreground"),children:n})]}),m&&Jt("div",{className:"rounded-md border border-border bg-muted/20 px-2.5 py-1.5",children:[Vt("span",{className:"text-muted-foreground",children:"Work Center"}),Vt("div",{className:"font-medium text-foreground",children:m})]}),p&&Jt("div",{className:"rounded-md border border-border bg-muted/20 px-2.5 py-1.5",children:[Vt("span",{className:"text-muted-foreground",children:"Supervisor"}),Vt("div",{className:"font-medium text-foreground",children:p})]})]}),u.length>0&&Jt("div",{className:"mt-3","data-slot":"wo-operations",children:[Jt("div",{className:"mb-1.5 flex items-center justify-between",children:[Jt("span",{className:"text-xs font-semibold text-foreground",children:["Operations (",y,"/",u.length,")"]}),k&&Jt("span",{className:"text-xs text-amber-600",children:["Running: ",k.name]})]}),Vt("div",{className:"space-y-1",children:u.map(w=>Jt("div",{"data-slot":"wo-operation","data-op-status":w.status,className:"flex items-center gap-2 rounded-md border border-border bg-muted/10 px-2.5 py-1.5",children:[Vt("span",{className:l("text-sm",$M[w.status]),children:FM[w.status]}),Vt("span",{className:"text-xs font-mono text-muted-foreground",children:String(w.seq).padStart(2,"0")}),Vt("span",{className:"flex-1 text-xs font-medium text-foreground",children:w.name}),Vt("span",{className:"text-xs text-muted-foreground",children:w.workCenter}),Jt("span",{className:"text-xs tabular-nums text-muted-foreground",children:[w.completedQty,"/",w.plannedQty]}),w.operator&&Vt("span",{className:"text-xs text-muted-foreground",children:w.operator})]},w.id))})]})]})}import{jsx as Ze,jsxs as or}from"react/jsx-runtime";var HM={official:"Official Seal",financial:"Financial Seal",contract:"Contract Seal",hr:"HR Seal",invoice:"Invoice Seal",personal:"Personal Seal"},VM={official:"bg-slate-200 text-slate-700 dark:bg-slate-800 dark:text-slate-200",financial:"bg-emerald-200 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-200",contract:"bg-blue-200 text-blue-700 dark:bg-blue-950 dark:text-blue-200",hr:"bg-violet-200 text-violet-700 dark:bg-violet-950 dark:text-violet-200",invoice:"bg-amber-200 text-amber-700 dark:bg-amber-950 dark:text-amber-200",personal:"bg-rose-200 text-rose-700 dark:bg-rose-950 dark:text-rose-200"},OM={active:"Active",custody:"In Custody",stored:"Stored",lost:"Lost",revoked:"Revoked"},UM={active:"text-emerald-600",custody:"text-blue-600",stored:"text-muted-foreground",lost:"text-destructive",revoked:"text-destructive"},Jk={pending:{label:"Pending",className:"bg-amber-100 text-amber-700 dark:bg-amber-950 dark:text-amber-300"},approved:{label:"Approved",className:"bg-blue-100 text-blue-700 dark:bg-blue-950 dark:text-blue-300"},rejected:{label:"Rejected",className:"bg-rose-100 text-rose-700 dark:bg-rose-950 dark:text-rose-300"},completed:{label:"Completed",className:"bg-emerald-100 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-300"}};function kve({seals:e,usageLogs:t=[],onSealClick:a,onApplyUsage:r,readOnly:o=!1,className:n}){let i=e.filter(s=>s.status==="active").length,c=e.filter(s=>s.status==="custody").length;return or("div",{"data-slot":"seal-stamp-registry",className:l("space-y-5 rounded-lg border border-border bg-card p-5",n),children:[or("div",{className:"flex items-center justify-between border-b border-border pb-3",children:[or("div",{children:[Ze("h3",{className:"text-lg font-semibold text-foreground",children:"Seal & Stamp Registry"}),or("p",{className:"text-sm text-muted-foreground",children:[e.length," registered \xB7 ",i," active \xB7 ",c," in custody"]})]}),!o&&r&&Ze(C,{size:"sm",onClick:r,children:"Apply for Usage"})]}),Ze("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",children:e.map(s=>or("div",{"data-slot":"seal-card","data-seal-id":s.id,onClick:()=>a?.(s),className:l("rounded-lg border border-border bg-muted/20 p-4",a&&"cursor-pointer hover:bg-muted/40"),children:[Ze("div",{className:"mb-2 flex items-center justify-center",children:s.imageUrl?Ze("img",{src:s.imageUrl,alt:s.name,className:"size-16 rounded-full border-2 border-border object-cover"}):Ze("div",{className:"flex size-16 items-center justify-center rounded-full border-2 border-dashed border-border bg-card text-2xl",children:"\u{1F50F}"})}),or("div",{className:"text-center",children:[Ze("div",{className:"font-medium text-foreground",children:s.name}),Ze("div",{className:"font-mono text-xs text-muted-foreground",children:s.regNo})]}),Ze("div",{className:"mt-2 flex justify-center",children:Ze("span",{className:l("rounded-full px-2 py-0.5 text-xs font-medium",VM[s.type]),children:HM[s.type]})}),or("div",{className:"mt-2 space-y-1 text-xs",children:[or("div",{className:"flex items-center justify-between",children:[Ze("span",{className:"text-muted-foreground",children:"Custodian:"}),Ze("span",{className:"font-medium text-foreground",children:s.custodian})]}),s.department&&or("div",{className:"flex items-center justify-between",children:[Ze("span",{className:"text-muted-foreground",children:"Dept:"}),Ze("span",{className:"text-foreground",children:s.department})]}),or("div",{className:"flex items-center justify-between",children:[Ze("span",{className:"text-muted-foreground",children:"Used:"}),or("span",{className:"text-foreground",children:[s.usageCount," times"]})]}),s.lastUsed&&or("div",{className:"flex items-center justify-between",children:[Ze("span",{className:"text-muted-foreground",children:"Last:"}),Ze("span",{className:"text-foreground",children:s.lastUsed})]}),or("div",{className:"flex items-center justify-between",children:[Ze("span",{className:"text-muted-foreground",children:"Status:"}),Ze("span",{className:l("font-medium",UM[s.status]),children:OM[s.status]})]})]})]},s.id))}),t.length>0&&or("div",{"data-slot":"seal-usage-log",children:[Ze("h4",{className:"mb-2 text-sm font-semibold text-foreground",children:"Recent Usage Log"}),Ze("div",{className:"overflow-x-auto rounded-lg border border-border",children:or(ze,{children:[Ze(Ae,{children:or(W,{className:"bg-muted/30",children:[Ze(E,{className:"min-w-[100px]",children:"Applicant"}),Ze(E,{className:"min-w-[150px]",children:"Document"}),Ze(E,{className:"w-28",children:"Date"}),Ze(E,{className:"w-28",children:"Approver"}),Ze(E,{className:"w-24",children:"Status"})]})}),Ze(ke,{children:t.map(s=>{let d=Jk[s.status]??Jk.pending;return or(W,{"data-slot":"usage-log-row",children:[Ze(D,{className:"font-medium text-foreground",children:s.applicant}),Ze(D,{className:"text-sm text-muted-foreground",children:s.document}),Ze(D,{className:"text-sm text-muted-foreground",children:s.date}),Ze(D,{className:"text-sm text-muted-foreground",children:s.approver}),Ze(D,{children:Ze("span",{className:l("rounded-full px-2 py-0.5 text-xs font-medium",d.className),children:d.label})})]},s.id)})})]})})]})]})}import*as Jn from"react";import{jsx as ot,jsxs as Tt}from"react/jsx-runtime";var WM={sedan:"Sedan",suv:"SUV",van:"Van",bus:"Bus",truck:"Truck"},Zk={available:{label:"Available",className:"text-emerald-600"},in_use:{label:"In Use",className:"text-amber-600"},maintenance:{label:"Maintenance",className:"text-destructive"}},ew={pending:{label:"Pending",className:"bg-amber-100 text-amber-700 dark:bg-amber-950 dark:text-amber-300"},approved:{label:"Approved",className:"bg-blue-100 text-blue-700 dark:bg-blue-950 dark:text-blue-300"},rejected:{label:"Rejected",className:"bg-rose-100 text-rose-700 dark:bg-rose-950 dark:text-rose-300"},completed:{label:"Completed",className:"bg-emerald-100 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-300"},cancelled:{label:"Cancelled",className:"bg-slate-100 text-slate-600 dark:bg-slate-800 dark:text-slate-400"}};function _M(e,t,a,r){return e<r&&a<t}function qM(e,t,a,r,o){return e.filter(n=>n.vehicleId===t&&n.id!==o&&(n.status==="approved"||n.status==="pending")&&_M(a,r,n.startTime,n.endTime))}function Dve({vehicles:e,bookings:t,onSubmit:a,onCancel:r,readOnly:o=!1,className:n}){let[i,c]=Jn.useState(""),[s,d]=Jn.useState(""),[m,u]=Jn.useState(""),[p,f]=Jn.useState(""),[x,v]=Jn.useState(""),[N,h]=Jn.useState(1),[b,g]=Jn.useState(""),[y,k]=Jn.useState(""),w=Jn.useMemo(()=>!i||!p||!x?[]:qM(t,i,p,x),[t,i,p,x]),R=w.length>0,S=p&&x&&x<=p,z=!o&&i&&s&&m&&p&&x&&!R&&!S,L=()=>{z&&a?.({vehicleId:i,applicant:s,destination:m,startTime:p,endTime:x,passengers:N,...b?{driver:b}:{},...y?{purpose:y}:{}})},H=e.find(M=>M.id===i);return Tt("div",{"data-slot":"vehicle-booking",className:l("space-y-4 rounded-lg border border-border bg-card p-5",n),children:[Tt("div",{className:"flex items-center gap-2 border-b border-border pb-3",children:[ot(ly,{className:"size-5 text-primary"}),ot("h3",{className:"text-lg font-semibold text-foreground",children:"Vehicle Booking"})]}),Tt("div",{children:[ot("label",{className:"mb-1.5 block text-sm font-medium text-foreground",children:"Select Vehicle"}),ot("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3",children:e.map(M=>{let $=i===M.id,I=Zk[M.status]??Zk.available;return Tt("button",{type:"button","data-slot":"vehicle-option","data-active":$,disabled:o||M.status==="maintenance",onClick:()=>c(M.id),className:l("flex items-center gap-3 rounded-lg border-2 p-3 text-left transition-colors",$?"border-primary bg-primary/5":"border-border bg-background hover:bg-muted/30",M.status==="maintenance"&&"cursor-not-allowed opacity-50"),children:[ot("div",{className:"flex size-10 items-center justify-center rounded-lg bg-muted text-xl",children:"\u{1F697}"}),Tt("div",{className:"flex-1",children:[ot("div",{className:"text-sm font-medium text-foreground",children:M.model}),ot("div",{className:"font-mono text-xs text-muted-foreground",children:M.plate}),Tt("div",{className:"flex items-center gap-2 text-xs",children:[ot("span",{className:"text-muted-foreground",children:WM[M.type]}),ot("span",{className:"text-muted-foreground",children:"\xB7"}),Tt("span",{className:"text-muted-foreground",children:[M.seats," seats"]}),Tt("span",{className:l("font-medium",I.className),children:["\xB7 ",I.label]})]})]})]},M.id)})})]}),Tt("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[Tt("div",{children:[ot("label",{className:"mb-1 block text-xs font-medium text-muted-foreground",children:"Applicant"}),ot(T,{value:s,onChange:M=>d(M.target.value),disabled:o,"aria-label":"Applicant name"})]}),Tt("div",{children:[ot("label",{className:"mb-1 block text-xs font-medium text-muted-foreground",children:"Destination"}),ot(T,{value:m,onChange:M=>u(M.target.value),disabled:o,"aria-label":"Destination"})]}),Tt("div",{children:[ot("label",{className:"mb-1 block text-xs font-medium text-muted-foreground",children:"Start Time"}),Tt("div",{className:"relative",children:[ot(pe,{className:"absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"}),ot(T,{type:"datetime-local",className:"pl-8",value:p,onChange:M=>f(M.target.value),disabled:o,"aria-label":"Start time"})]})]}),Tt("div",{children:[ot("label",{className:"mb-1 block text-xs font-medium text-muted-foreground",children:"End Time"}),Tt("div",{className:"relative",children:[ot(pe,{className:"absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"}),ot(T,{type:"datetime-local",className:"pl-8",value:x,onChange:M=>v(M.target.value),disabled:o,"aria-label":"End time"})]})]}),Tt("div",{children:[ot("label",{className:"mb-1 block text-xs font-medium text-muted-foreground",children:"Passengers"}),ot(T,{type:"number",min:1,max:H?.seats??50,value:N,onChange:M=>h(parseInt(M.target.value)||1),disabled:o,"aria-label":"Passengers"})]}),Tt("div",{children:[ot("label",{className:"mb-1 block text-xs font-medium text-muted-foreground",children:"Driver (optional)"}),ot(T,{value:b,onChange:M=>g(M.target.value),disabled:o,"aria-label":"Driver"})]})]}),Tt("div",{children:[ot("label",{className:"mb-1 block text-xs font-medium text-muted-foreground",children:"Purpose"}),ot("textarea",{className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm",rows:2,value:y,onChange:M=>k(M.target.value),disabled:o,"aria-label":"Purpose"})]}),S&&ot("div",{className:"rounded-md border border-destructive/30 bg-destructive/5 px-3 py-2 text-xs text-destructive","data-slot":"time-error",children:"End time must be after start time"}),R&&Tt("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/5 px-3 py-2","data-slot":"conflict-warning",children:[Tt("div",{className:"text-xs font-medium text-amber-700 dark:text-amber-400",children:["\u26A0 ",w.length," booking conflict",w.length>1?"s":""," detected:"]}),w.map(M=>Tt("div",{className:"mt-1 text-xs text-amber-600 dark:text-amber-500",children:[M.applicant,": ",M.startTime," \u2192 ",M.endTime," (",M.destination,")"]},M.id))]}),i&&Tt("div",{"data-slot":"vehicle-bookings",children:[ot("h4",{className:"mb-2 text-sm font-semibold text-foreground",children:"Existing Bookings"}),Tt("div",{className:"space-y-1.5",children:[t.filter(M=>M.vehicleId===i&&(M.status==="approved"||M.status==="pending")).map(M=>{let $=ew[M.status]??ew.pending;return Tt("div",{"data-slot":"booking-entry",className:"flex items-center gap-2 rounded-md border border-border bg-muted/20 px-3 py-1.5",children:[ot(jr,{className:"size-4 text-muted-foreground"}),ot("span",{className:"flex-1 text-sm text-foreground",children:M.applicant}),Tt("span",{className:"text-xs text-muted-foreground",children:[M.startTime," \u2192 ",M.endTime]}),ot("span",{className:l("rounded-full px-2 py-0.5 text-[10px] font-medium",$.className),children:$.label})]},M.id)}),t.filter(M=>M.vehicleId===i&&(M.status==="approved"||M.status==="pending")).length===0&&ot("div",{className:"py-2 text-center text-xs text-muted-foreground",children:"No existing bookings"})]})]}),!o&&Tt("div",{className:"flex justify-end gap-2 border-t border-border pt-3",children:[r&&ot(C,{variant:"outline",onClick:r,children:"Cancel"}),ot(C,{onClick:L,disabled:!z,children:"Submit Booking"})]})]})}import*as tw from"react";import{jsx as xe,jsxs as Zt}from"react/jsx-runtime";function GM(){return`cd-${Date.now()}-${Math.random().toString(36).slice(2,6)}`}function aw(e,t){let a=0,r=e;for(let o of t){if(r<=0)break;let n=o.to-o.from,i=Math.min(r,n);i>0&&(a+=i*(o.rate/100),r-=i)}return a}function jM(e,t,a,r){let o=new Map;for(let i of e){o.has(i.rep)||o.set(i.rep,{deals:[],totalAmount:0});let c=o.get(i.rep);c.deals.push(i),c.totalAmount+=i.amount}let n=new Map;for(let[i,c]of o){let s=0;for(let u of c.deals){let p=aw(u.amount,t),f=p*(u.overridePct??0)/100;s+=p-f}let d=a!=null&&c.totalAmount>=a,m=d&&r?c.totalAmount*r/100:0;n.set(i,{totalAmount:c.totalAmount,totalCommission:s,dealCount:c.deals.length,quotaMet:d,bonus:m})}return n}function Ws(e,t){return`${t}${e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`}function Hve({tiers:e,deals:t,quota:a,quotaBonusRate:r=0,currencySymbol:o="\xA5",onDealsChange:n,className:i}){let c=()=>{n?.([...t,{id:GM(),rep:"",dealNo:"",customer:"",amount:0,date:new Date().toISOString().slice(0,10)}])},s=f=>{n?.(t.filter(x=>x.id!==f))},d=(f,x,v)=>{n?.(t.map(N=>N.id!==f?N:x==="amount"||x==="overridePct"?{...N,[x]:typeof v=="string"?parseFloat(v)||0:v}:{...N,[x]:v}))},m=tw.useMemo(()=>jM(t,e,a,r),[t,e,a,r]),u=t.reduce((f,x)=>f+x.amount,0),p=Array.from(m.values()).reduce((f,x)=>f+x.totalCommission+x.bonus,0);return Zt("div",{"data-slot":"commission-calculator",className:l("space-y-4 rounded-lg border border-border bg-card p-5",i),children:[Zt("div",{className:"flex items-center justify-between border-b border-border pb-3",children:[xe("h3",{className:"text-lg font-semibold text-foreground",children:"Commission Calculator"}),Zt("div",{className:"flex items-center gap-3 text-sm",children:[Zt("span",{className:"text-muted-foreground",children:["Total Sales: ",xe("strong",{className:"text-foreground tabular-nums",children:Ws(u,o)})]}),Zt("span",{className:"text-muted-foreground",children:["Total Commission: ",xe("strong",{className:"text-primary tabular-nums",children:Ws(p,o)})]})]})]}),Zt("div",{className:"flex flex-wrap items-center gap-2","data-slot":"commission-tiers",children:[xe("span",{className:"text-xs font-medium text-muted-foreground",children:"Tiers:"}),e.map((f,x)=>Zt(B,{variant:"outline",className:"text-xs",children:[f.to===1/0?`${o}${f.from.toLocaleString()}+`:`${o}${f.from.toLocaleString()}\u2013${o}${f.to.toLocaleString()}`," \u2192 ",f.rate,"%"]},x)),a!=null&&Zt(B,{variant:"outline",className:"text-xs text-emerald-600",children:["Quota: ",o,a.toLocaleString()," \u2192 +",r,"% bonus"]})]}),m.size>0&&xe("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3","data-slot":"rep-summary",children:Array.from(m.entries()).map(([f,x])=>Zt("div",{"data-slot":"rep-card",className:l("rounded-lg border p-3",x.quotaMet?"border-emerald-300 bg-emerald-50 dark:border-emerald-800 dark:bg-emerald-950/30":"border-border bg-muted/20"),children:[Zt("div",{className:"flex items-center justify-between",children:[xe("span",{className:"font-medium text-foreground",children:f}),x.quotaMet&&xe(B,{className:"text-[10px] bg-emerald-100 text-emerald-700",children:"Quota Met"})]}),Zt("div",{className:"mt-1 space-y-0.5 text-xs text-muted-foreground",children:[Zt("div",{children:["Sales: ",xe("span",{className:"font-medium tabular-nums text-foreground",children:Ws(x.totalAmount,o)})]}),Zt("div",{children:["Deals: ",xe("span",{className:"font-medium text-foreground",children:x.dealCount})]}),Zt("div",{children:["Commission: ",xe("span",{className:"font-medium tabular-nums text-foreground",children:Ws(x.totalCommission,o)})]}),x.bonus>0&&Zt("div",{children:["Bonus: ",xe("span",{className:"font-medium tabular-nums text-emerald-600",children:Ws(x.bonus,o)})]}),Zt("div",{className:"border-t border-border pt-0.5",children:["Total: ",xe("span",{className:"font-bold tabular-nums text-primary",children:Ws(x.totalCommission+x.bonus,o)})]})]})]},f))}),xe("div",{className:"overflow-x-auto rounded-lg border border-border",children:Zt(ze,{children:[xe(Ae,{children:Zt(W,{className:"bg-muted/30",children:[xe(E,{className:"min-w-[100px]",children:"Rep"}),xe(E,{className:"min-w-[120px]",children:"Deal No"}),xe(E,{className:"min-w-[120px]",children:"Customer"}),xe(E,{className:"w-28 text-right",children:"Amount"}),xe(E,{className:"w-28",children:"Date"}),xe(E,{className:"w-20 text-right",children:"Override%"}),xe(E,{className:"w-28 text-right",children:"Commission"}),n&&xe(E,{className:"w-12"})]})}),xe(ke,{children:t.length===0?xe(W,{children:xe(D,{colSpan:n?8:7,className:"py-6 text-center text-muted-foreground",children:"No deals"})}):t.map(f=>{let x=aw(f.amount,e),v=x*(f.overridePct??0)/100,N=x-v;return Zt(W,{"data-slot":"commission-deal",children:[xe(D,{children:n?xe(T,{className:"h-8 text-sm",value:f.rep,onChange:h=>d(f.id,"rep",h.target.value),"aria-label":"Rep name"}):xe("span",{className:"text-sm font-medium text-foreground",children:f.rep})}),xe(D,{children:n?xe(T,{className:"h-8 font-mono text-sm",value:f.dealNo,onChange:h=>d(f.id,"dealNo",h.target.value),"aria-label":"Deal number"}):xe("span",{className:"font-mono text-xs text-muted-foreground",children:f.dealNo})}),xe(D,{children:n?xe(T,{className:"h-8 text-sm",value:f.customer,onChange:h=>d(f.id,"customer",h.target.value),"aria-label":"Customer"}):xe("span",{className:"text-sm text-muted-foreground",children:f.customer})}),xe(D,{children:n?xe(T,{type:"number",className:"h-8 text-right tabular-nums",value:f.amount,onChange:h=>d(f.id,"amount",h.target.value),"aria-label":"Amount",min:0}):xe("span",{className:"text-sm tabular-nums text-foreground",children:Ws(f.amount,o)})}),xe(D,{children:n?xe(T,{type:"date",className:"h-8 text-sm",value:f.date,onChange:h=>d(f.id,"date",h.target.value),"aria-label":"Date"}):xe("span",{className:"text-sm text-muted-foreground",children:f.date})}),xe(D,{children:n?xe(T,{type:"number",className:"h-8 text-right tabular-nums",value:f.overridePct??0,onChange:h=>d(f.id,"overridePct",h.target.value),"aria-label":"Override percent",min:0,max:100}):Zt("span",{className:"text-sm tabular-nums text-muted-foreground",children:[f.overridePct??0,"%"]})}),xe(D,{className:"text-right text-sm font-semibold tabular-nums text-primary",children:Ws(N,o)}),n&&xe(D,{children:xe(C,{variant:"ghost",size:"icon-sm",onClick:()=>s(f.id),className:"text-muted-foreground hover:text-destructive","aria-label":"Remove deal",children:xe(ye,{className:"size-4"})})})]},f.id)})}),t.length>0&&xe(ai,{children:Zt(W,{className:"bg-muted/30 font-semibold",children:[xe(D,{colSpan:3,children:"Grand Total"}),xe(D,{className:"text-right tabular-nums text-foreground",children:Ws(u,o)}),xe(D,{}),xe(D,{}),xe(D,{className:"text-right tabular-nums text-primary",children:Ws(p,o)}),n&&xe(D,{})]})})]})}),n&&xe("div",{className:"flex justify-start",children:Zt(C,{variant:"outline",size:"sm",onClick:c,children:[xe(ge,{className:"mr-1 size-4"}),"Add Deal"]})})]})}import{jsx as An,jsxs as yr}from"react/jsx-runtime";function rw(e,t){return t===0?0:e/t*100}function KM(e){return e>=100?"bg-emerald-500/80 dark:bg-emerald-600/80":e>=80?"bg-blue-500/70 dark:bg-blue-600/70":e>=60?"bg-amber-500/60 dark:bg-amber-600/60":e>=40?"bg-orange-500/50 dark:bg-orange-600/50":"bg-rose-500/40 dark:bg-rose-600/40"}function QM(e){return e>=60?"text-white":"text-foreground"}function tx(e,t){return e>=1e6?`${t}${(e/1e6).toFixed(1)}M`:e>=1e3?`${t}${(e/1e3).toFixed(0)}K`:`${t}${e}`}function _ve({regions:e,title:t="Sales Territory Map",currencySymbol:a="\xA5",gridCols:r=4,onRegionClick:o,className:n}){let i=e.reduce((m,u)=>m+u.sales,0),c=e.reduce((m,u)=>m+u.target,0),s=c>0?rw(i,c):0,d=e.reduce((m,u)=>m+u.customerCount,0);return yr("div",{"data-slot":"territory-map",className:l("space-y-4 rounded-lg border border-border bg-card p-5",n),children:[yr("div",{className:"flex items-center justify-between border-b border-border pb-3",children:[An("h3",{className:"text-lg font-semibold text-foreground",children:t}),yr("div",{className:"flex items-center gap-3 text-sm",children:[yr("span",{className:"text-muted-foreground",children:["Sales: ",An("strong",{className:"text-foreground tabular-nums",children:tx(i,a)})]}),yr("span",{className:"text-muted-foreground",children:["Target: ",An("strong",{className:"text-foreground tabular-nums",children:tx(c,a)})]}),yr(B,{variant:s>=100?"default":"destructive",className:"text-xs",children:[s.toFixed(1),"%"]})]})]}),An("div",{className:"grid gap-2",style:{gridTemplateColumns:`repeat(${r}, 1fr)`},"data-slot":"territory-grid",children:e.map(m=>{let u=rw(m.sales,m.target),p=!m.rep;return yr("div",{"data-slot":"territory-region","data-region-id":m.id,onClick:()=>o?.(m),style:m.gridArea?{gridColumnStart:m.gridArea.col+1,gridRowStart:m.gridArea.row+1,gridColumnEnd:m.gridArea.colSpan?`span ${m.gridArea.colSpan}`:void 0,gridRowEnd:m.gridArea.rowSpan?`span ${m.gridArea.rowSpan}`:void 0}:void 0,className:l("relative overflow-hidden rounded-lg border border-border p-3 transition-shadow",o&&"cursor-pointer hover:shadow-md",p&&"border-dashed"),children:[An("div",{className:l("absolute inset-0",KM(u)),"data-slot":"territory-heat"}),yr("div",{className:l("relative z-10",QM(u)),children:[yr("div",{className:"flex items-center justify-between",children:[An("span",{className:"text-sm font-bold",children:m.name}),yr("span",{className:"text-xs font-medium opacity-80",children:[u.toFixed(0),"%"]})]}),An("div",{className:"mt-1 text-lg font-bold tabular-nums",children:tx(m.sales,a)}),yr("div",{className:"text-xs opacity-80",children:["Target: ",tx(m.target,a)]}),yr("div",{className:"mt-1.5 flex items-center justify-between text-xs",children:[yr("span",{className:"opacity-80",children:[m.customerCount," customers"]}),m.rep?An("span",{className:"font-medium",children:m.rep}):An("span",{className:"italic opacity-60",children:"Unassigned"})]})]})]},m.id)})}),yr("div",{className:"flex flex-wrap items-center gap-3 border-t border-border pt-3","data-slot":"territory-legend",children:[An("span",{className:"text-xs font-medium text-muted-foreground",children:"Coverage:"}),[{label:"\u2265100%",color:"bg-emerald-500"},{label:"80\u201399%",color:"bg-blue-500"},{label:"60\u201379%",color:"bg-amber-500"},{label:"40\u201359%",color:"bg-orange-500"},{label:"<40%",color:"bg-rose-500"}].map(m=>yr("div",{className:"flex items-center gap-1",children:[An("span",{className:l("size-3 rounded",m.color)}),An("span",{className:"text-xs text-muted-foreground",children:m.label})]},m.label)),yr("span",{className:"ml-auto text-xs text-muted-foreground",children:[d," total customers \xB7 ",e.length," regions"]})]})]})}import*as nw from"react";import{jsx as Qe,jsxs as Lt}from"react/jsx-runtime";var ow=[{id:"small",label:"40\xD730mm",width:40,height:30},{id:"medium",label:"60\xD740mm",width:60,height:40},{id:"large",label:"100\xD760mm",width:100,height:60},{id:"shipping",label:"100\xD7150mm",width:100,height:150}];function XM(){return`lf-${Date.now()}-${Math.random().toString(36).slice(2,6)}`}var Mh={text:"\u{1F4DD}",barcode:"\u25AE",qrcode:"\u25A3",line:"\u2500",image:"\u{1F5BC}\uFE0F"},ax={text:"Text",barcode:"Barcode",qrcode:"QR Code",line:"Line",image:"Image"};function Yve({fields:e,onFieldsChange:t,labelSize:a=ow[1],sizePresets:r=ow,onSizeChange:o,onPrint:n,readOnly:i=!1,className:c}){let[s,d]=nw.useState(null),m=3,u=v=>{if(i)return;let N={id:XM(),type:v,label:`${ax[v]} ${e.length+1}`,sampleValue:v==="barcode"?"1234567890128":v==="qrcode"?"https://example.com":"Sample Text",x:5,y:5+e.length*8,width:v==="qrcode"?15:40,height:v==="barcode"?10:v==="qrcode"?15:5,fontSize:8};t?.([...e,N]),d(N.id)},p=v=>{t?.(e.filter(N=>N.id!==v)),s===v&&d(null)},f=(v,N,h)=>{t?.(e.map(b=>b.id===v?{...b,[N]:typeof h=="string"&&typeof b[N]=="number"?parseFloat(h)||0:h}:b))},x=e.find(v=>v.id===s);return Lt("div",{"data-slot":"label-designer",className:l("grid grid-cols-1 gap-4 rounded-lg border border-border bg-card p-5 lg:grid-cols-[200px_1fr_240px]",c),children:[Lt("div",{className:"space-y-2","data-slot":"label-palette",children:[Qe("h4",{className:"text-sm font-semibold text-foreground",children:"Add Field"}),Object.keys(ax).map(v=>Lt("button",{type:"button","data-slot":"field-type-btn",disabled:i,onClick:()=>u(v),className:l("flex w-full items-center gap-2 rounded-md border border-border bg-background px-3 py-2 text-sm text-left transition-colors",!i&&"hover:bg-muted/30",i&&"cursor-not-allowed opacity-50"),children:[Qe("span",{className:"text-base",children:Mh[v]}),Qe("span",{className:"text-foreground",children:ax[v]})]},v)),Lt("div",{className:"mt-3",children:[Qe("h4",{className:"text-sm font-semibold text-foreground",children:"Label Size"}),Qe("div",{className:"mt-1 space-y-1",children:r.map(v=>Lt("button",{type:"button","data-slot":"size-preset","data-active":a.id===v.id,disabled:i,onClick:()=>o?.(v),className:l("flex w-full items-center justify-between rounded-md border px-3 py-1.5 text-xs transition-colors",a.id===v.id?"border-primary bg-primary/5 text-primary":"border-border text-muted-foreground hover:bg-muted/30"),children:[Qe("span",{children:v.label}),Lt("span",{className:"text-[10px]",children:[v.width,"\xD7",v.height,"mm"]})]},v.id))})]})]}),Lt("div",{className:"flex flex-col items-center","data-slot":"label-preview-container",children:[Lt("div",{className:"mb-2 flex items-center gap-2",children:[Qe("span",{className:"text-sm font-medium text-foreground",children:"Preview"}),Lt(B,{variant:"outline",className:"text-xs",children:[a.width,"\xD7",a.height,"mm"]})]}),Lt("div",{"data-slot":"label-preview",className:"relative border-2 border-dashed border-border bg-white",style:{width:a.width*m,height:a.height*m},onClick:()=>d(null),children:[e.length===0&&Qe("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:"Add fields to design your label"}),e.map(v=>Lt("div",{"data-slot":"label-field","data-field-id":v.id,"data-field-type":v.type,onClick:N=>{N.stopPropagation(),d(v.id)},className:l("absolute border",s===v.id?"border-primary border-2":"border-transparent hover:border-blue-300"),style:{left:v.x*m,top:v.y*m,width:v.width*m,height:v.height*m},children:[v.type==="text"&&Qe("span",{className:"block truncate px-0.5 text-black",style:{fontSize:(v.fontSize??8)*(m/3)},children:v.sampleValue}),v.type==="barcode"&&Qe("div",{className:"flex h-full items-center justify-center bg-black text-white text-[8px] font-mono",children:v.sampleValue}),v.type==="qrcode"&&Qe("div",{className:"flex h-full items-center justify-center bg-black text-white text-[8px]",children:"QR"}),v.type==="line"&&Qe("div",{className:"h-px w-full bg-black",style:{marginTop:v.height*m/2}}),v.type==="image"&&Qe("div",{className:"flex h-full items-center justify-center bg-muted text-xs text-muted-foreground",children:"IMG"})]},v.id))]}),n&&!i&&Qe(C,{className:"mt-3",size:"sm",onClick:n,children:"Print Label"})]}),Lt("div",{className:"space-y-3","data-slot":"label-properties",children:[Qe("h4",{className:"text-sm font-semibold text-foreground",children:"Properties"}),x?Lt("div",{className:"space-y-2",children:[Lt("div",{className:"flex items-center gap-2",children:[Qe("span",{className:"text-base",children:Mh[x.type]}),Qe("span",{className:"text-sm font-medium text-foreground",children:ax[x.type]})]}),Lt("div",{children:[Qe("label",{className:"mb-0.5 block text-xs text-muted-foreground",children:"Label"}),Qe(T,{className:"h-8 text-sm",value:x.label,onChange:v=>f(x.id,"label",v.target.value),disabled:i,"aria-label":"Field label"})]}),Lt("div",{children:[Qe("label",{className:"mb-0.5 block text-xs text-muted-foreground",children:"Sample Value"}),Qe(T,{className:"h-8 text-sm",value:x.sampleValue,onChange:v=>f(x.id,"sampleValue",v.target.value),disabled:i,"aria-label":"Sample value"})]}),Lt("div",{className:"grid grid-cols-2 gap-2",children:[Lt("div",{children:[Qe("label",{className:"mb-0.5 block text-xs text-muted-foreground",children:"X (mm)"}),Qe(T,{type:"number",className:"h-8 text-sm",value:x.x,onChange:v=>f(x.id,"x",v.target.value),disabled:i,"aria-label":"X position"})]}),Lt("div",{children:[Qe("label",{className:"mb-0.5 block text-xs text-muted-foreground",children:"Y (mm)"}),Qe(T,{type:"number",className:"h-8 text-sm",value:x.y,onChange:v=>f(x.id,"y",v.target.value),disabled:i,"aria-label":"Y position"})]}),Lt("div",{children:[Qe("label",{className:"mb-0.5 block text-xs text-muted-foreground",children:"W (mm)"}),Qe(T,{type:"number",className:"h-8 text-sm",value:x.width,onChange:v=>f(x.id,"width",v.target.value),disabled:i,"aria-label":"Width"})]}),Lt("div",{children:[Qe("label",{className:"mb-0.5 block text-xs text-muted-foreground",children:"H (mm)"}),Qe(T,{type:"number",className:"h-8 text-sm",value:x.height,onChange:v=>f(x.id,"height",v.target.value),disabled:i,"aria-label":"Height"})]})]}),x.type==="text"&&Lt("div",{children:[Qe("label",{className:"mb-0.5 block text-xs text-muted-foreground",children:"Font Size (pt)"}),Qe(T,{type:"number",className:"h-8 text-sm",value:x.fontSize??8,onChange:v=>f(x.id,"fontSize",v.target.value),disabled:i,"aria-label":"Font size"})]}),!i&&Qe(C,{variant:"outline",size:"sm",className:"w-full text-destructive",onClick:()=>p(x.id),children:"Remove Field"})]}):Qe("p",{className:"text-xs text-muted-foreground",children:"Select a field to edit its properties"}),e.length>0&&Lt("div",{className:"mt-3 border-t border-border pt-3",children:[Lt("h5",{className:"mb-1 text-xs font-semibold text-muted-foreground",children:["Fields (",e.length,")"]}),Qe("div",{className:"space-y-1",children:e.map(v=>Lt("button",{type:"button",onClick:()=>d(v.id),className:l("flex w-full items-center gap-1.5 rounded px-2 py-1 text-xs text-left transition-colors",s===v.id?"bg-primary/10 text-primary":"text-muted-foreground hover:bg-muted/30"),children:[Qe("span",{children:Mh[v.type]}),Qe("span",{className:"truncate",children:v.label})]},v.id))})]})]})]})}import*as eu from"react";import{jsx as Nr,jsxs as Gr}from"react/jsx-runtime";var YM={temperature:"\u{1F321}\uFE0F",humidity:"\u{1F4A7}",pressure:"\u{1F4E1}",vibration:"\u{1F4F3}",co2:"\u2601\uFE0F",flow:"\u{1F504}",voltage:"\u26A1"};function sw(e){return e.status?e.status:e.minThreshold!=null&&e.value<e.minThreshold||e.maxThreshold!=null&&e.value>e.maxThreshold?"critical":e.minThreshold!=null&&e.value<e.minThreshold*1.1||e.maxThreshold!=null&&e.value>e.maxThreshold*.9?"warning":"online"}var iw={online:{label:"Online",color:"text-emerald-600",border:"border-emerald-300 dark:border-emerald-800",badge:"bg-emerald-100 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-300",dot:"bg-emerald-500"},warning:{label:"Warning",color:"text-amber-600",border:"border-amber-300 dark:border-amber-800",badge:"bg-amber-100 text-amber-700 dark:bg-amber-950 dark:text-amber-300",dot:"bg-amber-500"},critical:{label:"Critical",color:"text-destructive",border:"border-destructive/50",badge:"bg-destructive/10 text-destructive",dot:"bg-destructive"},offline:{label:"Offline",color:"text-muted-foreground",border:"border-border",badge:"bg-muted text-muted-foreground",dot:"bg-muted-foreground"}};function JM(e){return e>=60?"text-emerald-500":e>=20?"text-amber-500":"text-destructive"}function ZM(e){return e>=75?4:e>=50?3:e>=25?2:e>0?1:0}function the({sensors:e,title:t="IoT Sensor Grid",refreshInterval:a=0,onSensorClick:r,className:o}){let[n,i]=eu.useState(0);eu.useEffect(()=>{if(a<=0)return;let s=setInterval(()=>i(d=>d+1),a);return()=>clearInterval(s)},[a]);let c=eu.useMemo(()=>{let s={online:0,warning:0,critical:0,offline:0};for(let d of e){let m=sw(d);s[m]++}return s},[e,n]);return Gr("div",{"data-slot":"iot-sensor-grid",className:l("space-y-4 rounded-lg border border-border bg-card p-5",o),children:[Gr("div",{className:"flex items-center justify-between border-b border-border pb-3",children:[Gr("div",{className:"flex items-center gap-2",children:[Nr("h3",{className:"text-lg font-semibold text-foreground",children:t}),Nr("span",{className:"size-2 rounded-full bg-emerald-500 animate-pulse","data-slot":"live-indicator"})]}),Nr("div",{className:"flex items-center gap-2",children:["online","warning","critical","offline"].map(s=>{let d=iw[s];return Gr("div",{className:"flex items-center gap-1",children:[Nr("span",{className:l("size-2 rounded-full",d.dot)}),Nr("span",{className:"text-xs text-muted-foreground",children:e5(s,c)})]},s)})})]}),Nr("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4","data-slot":"sensor-cards",children:e.map(s=>{let d=sw(s),m=iw[d],u=ZM(s.signalStrength??0),p=s.minThreshold!=null&&s.value<s.minThreshold||s.maxThreshold!=null&&s.value>s.maxThreshold;return Gr("div",{"data-slot":"sensor-card","data-sensor-id":s.id,"data-sensor-status":d,onClick:()=>r?.(s),className:l("rounded-lg border-2 bg-card p-4 shadow-sm transition-shadow",m.border,r&&"cursor-pointer hover:shadow-md"),children:[Gr("div",{className:"flex items-start justify-between",children:[Gr("div",{className:"flex items-center gap-2",children:[Nr("span",{className:"text-2xl",children:YM[s.type]??"\u{1F4CA}"}),Gr("div",{children:[Nr("div",{className:"text-sm font-medium text-foreground",children:s.name}),Nr("div",{className:"text-xs text-muted-foreground",children:s.location})]})]}),Nr("span",{className:l("rounded-full px-1.5 py-0.5 text-[10px] font-medium",m.badge),children:m.label})]}),Gr("div",{className:"mt-3 flex items-baseline gap-1",children:[Nr("span",{className:l("text-2xl font-bold tabular-nums",p?m.color:"text-foreground"),children:s.value.toFixed(1)}),Nr("span",{className:"text-sm text-muted-foreground",children:s.unit})]}),(s.minThreshold!=null||s.maxThreshold!=null)&&Gr("div",{className:"mt-1 text-xs text-muted-foreground",children:["Range: ",s.minThreshold??"\u2014"," ~ ",s.maxThreshold??"\u2014"," ",s.unit]}),Gr("div",{className:"mt-3 flex items-center justify-between border-t border-border pt-2",children:[s.batteryLevel!=null&&Gr("div",{className:"flex items-center gap-1",children:[Nr("span",{className:"text-xs text-muted-foreground",children:"\u{1F50B}"}),Gr("span",{className:l("text-xs font-medium",JM(s.batteryLevel)),children:[s.batteryLevel,"%"]})]}),s.signalStrength!=null&&Gr("div",{className:"flex items-center gap-0.5","data-slot":"signal-bars",children:[[1,2,3,4].map(f=>Nr("div",{className:l("w-1 rounded-sm",f<=u?"bg-foreground":"bg-muted"),style:{height:`${4+f*2}px`}},f)),Gr("span",{className:"ml-1 text-[10px] text-muted-foreground",children:[s.signalStrength,"%"]})]}),s.lastUpdate&&Nr("span",{className:"text-[10px] text-muted-foreground",children:s.lastUpdate})]})]},s.id)})}),e.length===0&&Nr("div",{className:"py-8 text-center text-sm text-muted-foreground",children:"No sensors deployed"})]})}function e5(e,t){return`${{online:"Online",warning:"Warning",critical:"Critical",offline:"Offline"}[e]}: ${t[e]}`}import*as rx from"react";import{jsx as Cr,jsxs as nr}from"react/jsx-runtime";var Bh={compliant:{label:"Compliant",className:"bg-emerald-100 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-300",icon:"\u2713"},non_compliant:{label:"Non-Compliant",className:"bg-rose-100 text-rose-700 dark:bg-rose-950 dark:text-rose-300",icon:"\u2715"},in_progress:{label:"In Progress",className:"bg-amber-100 text-amber-700 dark:bg-amber-950 dark:text-amber-300",icon:"\u25D0"},not_applicable:{label:"N/A",className:"bg-slate-100 text-slate-600 dark:bg-slate-800 dark:text-slate-400",icon:"\u2014"},pending:{label:"Pending",className:"bg-blue-100 text-blue-700 dark:bg-blue-950 dark:text-blue-300",icon:"\u25CB"}},t5={low:{label:"Low",className:"text-emerald-600"},medium:{label:"Medium",className:"text-amber-600"},high:{label:"High",className:"text-destructive"}},lw=["compliant","in_progress","pending","non_compliant","not_applicable"];function nhe({items:e,title:t="Compliance Checklist",onItemClick:a,onStatusChange:r,readOnly:o=!1,className:n}){let i=rx.useMemo(()=>{let m=new Map;for(let u of e)m.has(u.category)||m.set(u.category,[]),m.get(u.category).push(u);return Array.from(m.entries())},[e]),c=rx.useMemo(()=>{let m=e.filter(p=>p.status!=="not_applicable");return m.length===0?0:e.filter(p=>p.status==="compliant").length/m.length*100},[e]),s=rx.useMemo(()=>{let m={compliant:0,non_compliant:0,in_progress:0,not_applicable:0,pending:0};for(let u of e)m[u.status]++;return m},[e]),d=c>=80?"text-emerald-600":c>=60?"text-amber-600":"text-destructive";return nr("div",{"data-slot":"compliance-checklist",className:l("space-y-4 rounded-lg border border-border bg-card p-5",n),children:[nr("div",{className:"flex items-center justify-between border-b border-border pb-3",children:[Cr("h3",{className:"text-lg font-semibold text-foreground",children:t}),Cr("div",{className:"flex items-center gap-3",children:nr("div",{className:"text-right",children:[Cr("div",{className:"text-xs text-muted-foreground",children:"Compliance Score"}),nr("div",{className:l("text-2xl font-bold tabular-nums",d),children:[c.toFixed(0),"%"]})]})})]}),Cr("div",{className:"flex flex-wrap items-center gap-2","data-slot":"compliance-summary",children:lw.map(m=>{let u=Bh[m];return Cr("div",{className:"flex items-center gap-1.5",children:nr("span",{className:l("rounded-full px-2 py-0.5 text-xs font-medium",u.className),children:[u.icon," ",u.label,": ",s[m]]})},m)})}),Cr("div",{className:"space-y-4","data-slot":"compliance-categories",children:i.map(([m,u])=>{let p=u.filter(v=>v.status==="compliant").length,f=u.filter(v=>v.status!=="not_applicable").length,x=f>0?p/f*100:0;return nr("div",{"data-slot":"compliance-category",children:[nr("div",{className:"mb-2 flex items-center justify-between",children:[Cr("h4",{className:"text-sm font-semibold text-foreground",children:m}),nr("span",{className:"text-xs text-muted-foreground",children:[p,"/",f," compliant"," \xB7 ",nr("span",{className:l("font-medium",x>=80?"text-emerald-600":x>=60?"text-amber-600":"text-destructive"),children:[x.toFixed(0),"%"]})]})]}),Cr("div",{className:"space-y-1",children:u.map(v=>{let N=Bh[v.status],h=v.risk?t5[v.risk]:null;return nr("div",{"data-slot":"compliance-item","data-item-id":v.id,"data-item-status":v.status,onClick:()=>a?.(v),className:l("flex items-start gap-2 rounded-md border border-border bg-muted/20 px-3 py-2",a&&"cursor-pointer hover:bg-muted/40"),children:[Cr("span",{className:l("mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-full text-xs font-bold",N.className),children:N.icon}),nr("div",{className:"flex-1",children:[nr("div",{className:"flex items-center gap-2",children:[Cr("span",{className:"font-mono text-xs text-muted-foreground",children:v.code}),h&&nr("span",{className:l("text-[10px] font-medium",h.className),children:[h.label," risk"]})]}),Cr("div",{className:"text-sm text-foreground",children:v.description}),nr("div",{className:"mt-1 flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[v.owner&&nr("span",{children:["\u{1F464} ",v.owner]}),v.dueDate&&nr("span",{children:["\u{1F4C5} ",v.dueDate]}),v.evidence&&nr("span",{children:["\u{1F4CE} ",v.evidence]})]}),v.notes&&Cr("div",{className:"mt-0.5 text-xs italic text-muted-foreground",children:v.notes})]}),!o&&r?Cr("select",{className:"h-7 rounded border border-border bg-background px-1.5 text-xs",value:v.status,onChange:b=>{b.stopPropagation(),r(v.id,b.target.value)},onClick:b=>b.stopPropagation(),"aria-label":"Status selector",children:lw.map(b=>Cr("option",{value:b,children:Bh[b].label},b))}):Cr("span",{className:l("shrink-0 rounded-full px-2 py-0.5 text-[10px] font-medium",N.className),children:N.label})]},v.id)})})]},m)})}),e.length===0&&Cr("div",{className:"py-8 text-center text-sm text-muted-foreground",children:"No compliance items"})]})}import*as dw from"react";import{jsx as En,jsxs as bo}from"react/jsx-runtime";function a5(e){let t=e.filter(r=>!r.isSource);return t.length===0?100:t.filter(r=>r.text.trim().length>0).length/t.length*100}function mhe({fieldKey:e,label:t,translations:a,onTranslationChange:r,multiline:o=!1,maxLength:n,readOnly:i=!1,className:c}){let[s,d]=dw.useState(a[0]?.locale??""),m=a.find(x=>x.locale===s)??a[0],u=a.find(x=>x.isSource),p=a5(a),f=p===100?"text-emerald-600":p>=50?"text-amber-600":"text-destructive";return bo("div",{"data-slot":"i18n-form-field","data-field-key":e,className:l("space-y-2 rounded-lg border border-border bg-card p-4",c),children:[bo("div",{className:"flex items-center justify-between",children:[bo("div",{className:"flex items-center gap-2",children:[t&&En("label",{className:"text-sm font-medium text-foreground",children:t}),En("span",{className:"font-mono text-xs text-muted-foreground",children:e})]}),bo("div",{className:"flex items-center gap-2",children:[En("span",{className:"text-xs text-muted-foreground",children:"Translation:"}),bo(B,{variant:"outline",className:l("text-xs",f),children:[p.toFixed(0),"%"]})]})]}),En("div",{className:"flex flex-wrap gap-1 border-b border-border pb-2","data-slot":"locale-tabs",children:a.map(x=>{let v=x.locale===s,N=x.text.trim().length>0;return bo("button",{type:"button","data-slot":"locale-tab","data-active":v,"data-locale":x.locale,onClick:()=>d(x.locale),className:l("flex items-center gap-1.5 rounded-md border px-2.5 py-1 text-xs transition-colors",v?"border-primary bg-primary/5 text-primary":"border-border text-muted-foreground hover:bg-muted/30"),children:[x.flag&&En("span",{className:"text-sm",children:x.flag}),En("span",{className:"font-medium",children:x.label}),x.isSource&&En("span",{className:"rounded-full bg-blue-100 px-1 text-[9px] text-blue-700 dark:bg-blue-950 dark:text-blue-300",children:"SRC"}),!x.isSource&&En("span",{className:l("size-1.5 rounded-full",N?"bg-emerald-500":"bg-muted-foreground/30")})]},x.locale)})}),bo("div",{className:"space-y-2",children:[u&&m&&!m.isSource&&bo("div",{"data-slot":"source-reference",className:"rounded-md border border-blue-200 bg-blue-50 px-3 py-2 dark:border-blue-900 dark:bg-blue-950/30",children:[bo("div",{className:"flex items-center gap-1.5 text-xs text-blue-600 dark:text-blue-400",children:[En("span",{children:u.flag}),bo("span",{className:"font-medium",children:["Source (",u.label,"):"]})]}),En("div",{className:"mt-0.5 text-sm text-foreground",children:u.text||"\u2014"})]}),bo("div",{children:[bo("div",{className:"mb-1 flex items-center justify-between",children:[bo("span",{className:"text-xs text-muted-foreground",children:[m?.flag," ",m?.label,m?.isSource&&" (Source)"]}),n&&bo("span",{className:l("text-xs tabular-nums",(m?.text.length??0)>n?"text-destructive":"text-muted-foreground"),children:[m?.text.length??0," / ",n]})]}),o?En("textarea",{className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",rows:3,value:m?.text??"",onChange:x=>r?.(s,x.target.value),disabled:i,"aria-label":`Translation for ${m?.label}`,maxLength:n}):En(T,{className:"text-sm",value:m?.text??"",onChange:x=>r?.(s,x.target.value),disabled:i,"aria-label":`Translation for ${m?.label}`,maxLength:n})]})]})]})}export{oJ as AccountBalance,G4 as ActivityFeed,rk as AddressColumn,W2 as AddressPanel,ode as AddressPicker,rA as AdvancedSearch,dA as AnnouncementBanner,Ete as AnnouncementCard,GJ as ApplicationForm,GG as ApprovalActionBar,VG as ApprovalFlow,xA as ApprovalTimeline,zxe as ArApAgingTable,MI as AreaChart,RA as AsyncTaskCenter,tae as AsyncTaskTrigger,ate as AttachmentList,ite as AttachmentPreview,_ee as AttachmentUploader,mxe as AttendanceCalendar,jA as AudienceSegmentBuilder,FP as AuditLog,iE as AuditSidebar,Abe as AuditTrailDiff,mE as AuthGuard,y1 as AuthLayout,YE as AvatarGroup,nbe as BOMTreeEditor,hz as BackTop,nQ as BadgeDelta,Sv as BarChart,HK as BarList,LI as BarListCard,LM as BatchGenealogyTree,Tee as BatchPrintDialog,gde as BatchSelector,rF as BillFooter,dF as BillHeader,bF as BillPage,iee as BillPrintTemplate,yF as BillStatusBar,YG as BillTimeline,lG as BillTodoList,PF as BizStatusTag,zme as BrowseDialog,zI as BudgetAllocator,LY as BudgetOverview,MF as BudgetPacingCard,HF as BulkActionsToolbar,XF as BulkImportWizard,CI as CATEGORY_LABELS,Kj as CalendarView,eQ as Callout,n$ as CampaignCalendar,g$ as CampaignCard,of as CampaignStatusTag,KK as CategoryBar,N$ as ChannelPicker,xQ as ChartCard,_$ as ChartContainer,Lj as ChartSuite,q$ as ChartTooltip,One as ChatAgentStatus,Kne as ChatArtifactPanel,Cse as ChatBranch,Woe as ChatCardMessage,Bre as ChatCodeBlock,fne as ChatCommandMenu,Ine as ChatContextPanel,mse as ChatConversation,xse as ChatConversationSearch,ese as ChatFeedback,are as ChatHeader,joe as ChatImageGallery,nne as ChatInputToolbar,hb as ChatMarkdownRenderer,mne as ChatMentionPicker,bre as ChatMessageActions,zC as ChatMessageBubble,dre as ChatMessageGroup,zse as ChatMessageInput,Ane as ChatModelSwitcher,Sse as ChatSharedLink,Oae as ChatShell,Qae as ChatSidebar,hne as ChatStreamingText,wne as ChatSuggestReplies,Nre as ChatThinkingBlock,Tre as ChatToolCallBlock,Zoe as ChatVoiceMessage,wZ as CheckoutBar,Z$ as Chip,gY as CityBrowse,l6 as CodeBlock,df as CodeEditor,p2 as ColorBoard,EN as ColorTag,cz as Combobox,M6 as CommandPalette,Hve as CommissionCalculator,nY as CompanyBrowse,EI as CompanyPicker,nhe as ComplianceChecklist,TT as ConfirmDialog,H6 as ConfirmDialogContainer,Cme as ContractTemplate,G6 as CookieBanner,$I as CostCenterPicker,IZ as CouponCard,RH as CreativePreview,v2 as CronEditor,DT as CrudPage,NH as CrudToolbar,Jxe as Customer360Card,FQ as CustomerBrowse,VI as CustomerPicker,AK as DashboardCanvas,lme as DashboardDesigner,OI as DashboardGrid,AH as DataTable,_H as DateRangePicker,_K as DeltaBar,WI as DepartmentPicker,x1 as DialogFormBody,rV as DictSelect,XH as DiffViewer,Yle as DiffViewerTable,qI as DistributorPicker,Dae as DockPanel,SQ as DonutCard,jI as DonutChart,wG as DynamicFormBuilder,ME as EditToolbar,qle as EditableTreeTable,QI as EmployeePicker,Hc as EmptyState,Mde as EquipmentCard,Z0 as ErrorBoundary,eD as ErrorPage,SV as ExpenseLineEditor,EV as ExperimentSummary,qV as ExportButton,xz as Fab,vz as FabSpeedDial,xae as FeatureTour,BX as FeeTypeBrowse,JV as FieldMask,fC as FileCard,o8 as FileUploadManager,j0 as FilterBar,Zg as FilterBuilder,IG as FlowTracker,c8 as Forbidden,qse as FormDesigner,aie as FormDesignerRuntime,v1 as FormStack,dN as FormWizard,Bce as FormulaEditor,VO as FullPageLoader,$j as FunnelChart,Wj as GanttChart,Ofe as GanttChartPro,T8 as Gauge,tD as GaugeChart,I0 as GlobalLoadingContext,kE as GlobalLoadingProvider,B8 as HeatmapCalendar,cK as HeatmapChart,mhe as I18nFormField,aD as ImMessage,pte as ImageGallery,WE as ImportDialog,vee as ImportErrorTable,Rbe as ImportMappingWizard,V8 as InlineEdit,iI as InlineSparkline,pce as InventoryAlertList,GY as InventorySnapshot,FZ as InviteLink,hZ as InvoiceManager,JY as InvoiceSummary,the as IotSensorGrid,Xfe as JournalEntryEditor,q8 as JsonEditor,Z8 as JsonViewer,fO as KPICard,fN as KanbanBoard,rD as KanbanColumn,Yve as LabelDesigner,iN as LabeledField,BO as LanguageSwitcher,$xe as LeadPipelineBoard,Jbe as LeaveRequestForm,Iv as LineChart,pf as LineEditor,HO as LoadingPage,Hde as MaintenanceLog,bK as MapChart,yK as MapMarkerCluster,wK as MapTrack,IK as MapView,f2 as MarkdownEditor,MJ as MarketingActivityForm,h1 as MasterDetailLayout,$q as MasterEditTemplate,_q as MasterListTemplate,qde as MediaRecorder,sxe as MeetingRoomBooking,nD as MessageList,XO as MetricTrend,Vie as MobileActionSheet,tU as MobileAuthLayout,iU as MobileButton,Xie as MobileCamera,pU as MobileCard,c9 as MobileCardSkeleton,DU as MobileDashboardLayout,EU as MobileDataTable,m9 as MobileDetailSkeleton,UU as MobileDialog,KU as MobileEmptyState,ZU as MobileFilterBuilder,oW as MobileForm,cW as MobileFormField,bW as MobileFormWizard,mle as MobileGeolocation,ble as MobileInfiniteScroll,CW as MobileInput,AW as MobileKPICard,SW as MobileKanban,Tle as MobileListItem,d9 as MobileListItemSkeleton,UW as MobileNavigation,NN as MobilePageHeader,Eie as MobilePageShell,qie as MobilePicker,tle as MobileQrCodeScanner,ZW as MobileSelect,n9 as MobileSheet,sle as MobileSignature,yle as MobileTabBar,C9 as MobileTabs,S9 as MobileTextarea,hbe as MultiCurrencyInput,$9 as MultiSelect,X9 as NotificationCenter,_be as NotificationRuleBuilder,rj as OaBridge,lve as OeeDashboard,aG as OperationLog,r_ as OrderLineEditor,ZS as OrgChart,sD as OverviewPage,a2 as PDFViewer,yN as PageHeader,vte as PasteUpload,_Z as PaymentMethodSelector,XZ as PaymentResult,ree as PaymentSchedule,Wte as PerformanceRankTable,iD as PermissionButton,m_ as PermissionMatrix,VP as PermissionWrapper,Xq as PhotoAudit,Mv as PieChart,x_ as PivotTable,VJ as PolicyLineEditor,Qte as PoolTrackerTable,kae as PreferencePanel,kX as PriceAdjustBrowse,EE as PrintButton,Hee as PrintService,Bee as PrintTemplateBuilder,jQ as ProductBrowse,cD as ProductCategoryPicker,mD as PromotionRuleCard,pD as PromotionRuleEditor,k_ as PromptDialog,KW as PullToRefresh,iM as PurchaseOrderEditor,oce as QualityInspectionForm,Dte as QuickEntryGrid,jxe as QuotationLineEditor,Bv as RadarChart,gD as RadialChart,R8 as RadialProgress,ML as Rating,AG as RebutNodeSelect,dJ as ReconciliationLineEditor,ZJ as ReconciliationSummary,$ce as RedPacket,bD as RegionPicker,jT as RemoteSelect,Qce as ReportBuilder,Zj as ResourceSchedule,I_ as ResponsivePreview,$S as RichTextEditor,F_ as RoleAssignment,Die as RuleEditor,rve as SPCControlChart,Eb as STATUS_CONFIG,rX as SalesOrderBrowse,hJ as SalesTargetEditor,yD as SankeyChart,G_ as SavedFilters,Lv as ScatterChart,kve as SealStampRegistry,sv as SearchTable,Kg as SegmentedControl,gG as SerialNumberManager,nZ as SettlementStatusTag,Cde as ShiftCalendar,OX as ShippingWayBrowse,uZ as SignActionButton,CD as SkuPicker,Z_ as SocialShare,kD as SparkChart,DR as Sparkline,o1 as SqlEditor,l7 as StatCard,g7 as StatCardRow,wD as StatCardWithDelta,kQ as StatCardWithSparkline,f1 as StatusBadge,h7 as StatusTag,Sxe as StockTransferDialog,TD as SubformTabs,ube as SupplierScorecard,f9 as SwipeActions,RD as TabCrudPage,Eae as TabPin,VY as TargetProgress,uae as TaskHistory,wte as TaskListTable,iae as TaskProgress,yY as TaxDetailTable,pee as TemplateDownload,_ve as TerritoryMap,ID as ThemeToggle,kP as TimePicker,nK as TimelineView,LD as TodoListTable,XL as Tour,mQ as Tracking,Kx as Transfer,ED as TreeCrudPage,Ale as TreeTable,FD as TreemapChart,V7 as UTMBuilder,kce as UnitConverter,D7 as UserMenu,Dve as VehicleBooking,Q7 as VersionHistory,XX as WarehouseBrowse,HD as WarehousePicker,VD as WaterfallChart,tz as Watermark,xve as WorkOrderCard,uie as WorkflowDesigner,yie as WorkflowPreview,pX as WriteoffBrowse,SY as WriteoffFlow,U$ as brandColors,lI as builtInCategories,AN as colorConfig,ck as computeResult,dI as convertValue,nT as defaultChannelOptions,O$ as defaultColors,qP as defaultStatusMap,Ne as formatCurrency,tt as formatDate,ni as formatDateTime,q as formatNumber,bt as formatPercent,gl as formatRelativeTime,cI as formatResult,wP as formatTimeInput,$N as message,uI as safeEvaluate,aV as setDictFetcher,W$ as statusColors,s1 as statusConfig,$6 as useConfirm,wE as useGlobalLoading,c0 as variantConfig,hE as withPermission};
|